如何正确遍历matplotlib图的子图?

时间:2019-10-29 01:49:04

标签: python for-loop matplotlib

我目前有一个matplotlib图形,具有16个子图,4列和4行。我生成了以下代码,这些代码循环遍历每个子图并在16个子图上绘制不同的数据:

fac_list = [one, two, three, four, five, six, seven, eight, nine, 
ten , eleven, twelve, thirteen, fourteen, fifteen, sixteen]

color = ['blue','red']

ds_i = 0
    for row in range(0,subplot_shape[0]):
        for col in range(0,subplot_shape[1]):
            fac = fac_list[ds_i]
                plot('total', 
                    currentname=fac,
                    subplot_index=(row,col))
                #axes[row][col].text(1.1,new_obj['total'].values[-1],new_obj['total'].values[-1],
                #transform=axes[row][col].transAxes, color=color[0])
            ds_i += 1

目前,我已经知道了,因此注释行仅显示了fac_list中的最后一项的最终y轴值(十六),但是此值显示在我图中的每个子图中,而不仅仅是最后一个子图

如何正确遍历子图,以使fac_list中每个项目的最终y轴值显示在每个对应的子图中(fac_list中的一个显示在子图(0,0)上,fac_list中的两个显示在图中子图(0,1)等)?到目前为止,我还没有尝试过。

0 个答案:

没有答案
相关问题