将两个名称(.format)添加到 matplotlib 图形
Add two names (.format) to matplotlib graph
我正在尝试使用两个循环为我的图表添加两种格式的标题,但在 Python 中未使用 Matplotlib 显示所需的结果。目标是两个标题如下的图表:
第一个图表:“图表 1:点”
第二张图:“图 2:线条”
这是我一直在尝试的代码:
types = ['Dots','Lines']
for graph in range(2):
ax = fig.add_subplot(1,2,graph+1, aspect='equal')
plt.imshow(myarray[graph],extent = extent)
plt.xlabel('X',fontsize=5)
plt.ylabel('Y',fontsize=5)
plt.colorbar(shrink=1.0)
for name in types:
plt.title('Graph {}: {}'.format(graph+1, name),fontsize = 10)
非常感谢任何使这个更简单的帮助,在此先感谢! ;)
我正在尝试使用两个循环为我的图表添加两种格式的标题,但在 Python 中未使用 Matplotlib 显示所需的结果。目标是两个标题如下的图表:
第一个图表:“图表 1:点”
第二张图:“图 2:线条”
这是我一直在尝试的代码:
types = ['Dots','Lines']
for graph in range(2):
ax = fig.add_subplot(1,2,graph+1, aspect='equal')
plt.imshow(myarray[graph],extent = extent)
plt.xlabel('X',fontsize=5)
plt.ylabel('Y',fontsize=5)
plt.colorbar(shrink=1.0)
for name in types:
plt.title('Graph {}: {}'.format(graph+1, name),fontsize = 10)
非常感谢任何使这个更简单的帮助,在此先感谢! ;)