更改主图图例标签文本

2023-12-12

到目前为止,我已经能够很好地标记次要情节,但我对主要情节有疑问。

这是我的代码的相关部分:

data_BS_P = data[channels[0]]
data_BS_R = data[channels[1]]
data_BS_Y = data[channels[2]]
plot_BS_P = data_BS_P.plot() #data_BS_P is a pandas dataframe
axBS = plot_BS_P.gca()
axBS.plot(data_BS_R, label='Roll')
axBS.plot(data_BS_Y, label='Yaw')
axBS.set_ylabel('Amplitude (urad)')
axBS.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05), ncol=3,
            fancybox=True, shadow=True)
ml1 = MultipleLocator(10)
ml2 = MultipleLocator(3600)
axBS.yaxis.set_minor_locator(ml1)
axBS.xaxis.set_minor_locator(ml2)
plot_BS_P.save('L1-SUS-BS_M1_DAMP_PRY_INMON.jpg')

And this is what I have so far: enter image description here Notice the lengthy label for the blue line. I'd like that to be labeled as "Pitch" instead of the file name. In which line can I do that?


其他方式:

ax.legend(labels=mylabels)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

更改主图图例标签文本 的相关文章

随机推荐