【发布时间】:2019-10-24 21:04:09
【问题描述】:
所以我有一个包含 16 个子图、4 列和 4 行的图形。首先,我专注于让位置 (0,0) 的子图正常工作(我想通了!),然后再继续让循环正常工作。
这就是我卡住的地方。这是我的代码的 matplotlib 部分的样子:
new_list = [one, two, three, four, five, six, seven, eight, nine, ten , eleven, twelve,
thirteen, fourteen, fifteen, sixteen]
color = ['blue','red']
for name in new_list:
for row in range(0,subplot_shape[0]):
for col in range(0,subplot_shape[1]):
display.plot('total',
currentname=name,
subplot_index=(row,col),
linestyle='-',
marker='.',
label="RG",
color=color[0])
display.plot('new_total',
currentname=name,
subplot_index=(row,col),
linestyle='-',
marker='.',
label="RG New",
color=color[1])
display.axes[row][col].set_title(name + ' Total on ' + date)
display.axes[row][col].legend()
display.axes[row][col].autoscale(tight=False, axis='y')
display.axes[row][col].set_xlim(xrng)
按照我目前的设置方式,所有内容都绘制在每个子图上。我不确定我做错了什么。
我希望每个子图的每个数据集的内容都以“new_list”命名。 (因此,subplot(0,0) 将具有数据集 1,subplot(0,1) 将具有数据集 2,依此类推。
【问题讨论】:
-
这段代码中的“显示”是什么?这不是 matplotlib
标签: python for-loop matplotlib