我想配置y轴以使值更易于解释。 将两个y轴刻度添加到同一个图表
这是我试过的代码:
ax = Statements.plot(x='Date', y='mean_Kincaid', legend=True,
title="Fed Statement Kincaid and Sentiment scores over time")
Statements.plot(x='Date', y='mean_Score', ax=ax)
Statements.plot(secondary_y='mean_Kincaid', style='g', ax=ax)
当运行:
ts = Statements.set_index('Date')
ts.mean_Kincaid.plot()
ts.mean_Score.plot(secondary_y=True)
我得到:
这与我的原始图大不相同。这是什么原因造成的,我该如何解决?
https://pandas.pydata.org/pandas-docs/stable/visualization.html#plotting -on-a-secondary-y-axis? – MaxU