Python在plot中添加标记选项

2024-09-27 07:24:16 发布

您现在位置:Python中文网/ 问答频道 /正文

嗨,我正在尝试使用markevery选项向python绘图添加标记。当我添加这个时,我得到以下错误:ValueError:太多的值需要解包。我不知道是什么引起的。下面是我的代码。你知道吗

    temp = pd.read_csv(path+filename)
    temp=pd.DataFrame(temp).convert_objects(convert_numeric=True)

    fig,axes = plt.subplots(nrows=2,ncols=1)
    fig.subplots_adjust(hspace=1)
    fig = plt.figure()
    markers_on=[887,1661,2631,3406,4714,5606,6880,8332,9751]
    fig.subplots_adjust(hspace=.5)
    fig.suptitle('BC Attributes', fontsize=12)
    plt.subplot(3,1,1)
    plt.plot(temp.index,temp.BC_T_NODE0_CPU0_TEMP, marker='s', markevery=[887,1661,2631,3406,4714,5606,6880,8332,9751])
    plt.xlabel('Time')
    plt.ylabel('Node0 CPU0 Temp')
    plt.subplot(3,1,2)
    plt.plot(temp.index, temp.BC_T_NODE0_CPU1_TEMP, marker='s', markevery=[887,1661,2631,3406,4714,5606,6880,8332,9751])
    plt.xlabel('Time')
    plt.ylabel('Node0 CPU1 Temp')
    plt.subplot(3,1,3)
    plt.plot(temp.index, temp.BC_T_NODE1_CPU0_TEMP)
    plt.xlabel('Time')
    plt.ylabel('Node1 CPU0 Temp')

    final_path="plots/CD/"
    fig.savefig(final_path+filename+'_1.png')
    plt.close(fig)
    plt.show()

Tags: pathindextimeplotfigplttempbc

热门问题