Reputation: 924
I would like to configure the y-axis so the values are more interpretable.
This is the code I tried:
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)
When running:
ts = Statements.set_index('Date')
ts.mean_Kincaid.plot()
ts.mean_Score.plot(secondary_y=True)
I get:
Which is much different from my original graph. What is causing this and how do I fix it?
Upvotes: 1
Views: 255
Reputation: 15240
You are looking for the secondary_y
keyword argument.
ts = Statements.set_index('Date')
ts.mean_Kincaid.plot()
ts.mean_Score.plot(secondary_y=True)
If you'd like to display a legend and axis labels, use something like
ts = Statements.set_index('Date')
ax = ts.mean_Kincaid.plot(legend=True)
ts.mean_Score.plot(legend=True, secondary_y=True)
ax.set_ylabel('mean_Kincaid')
ax.right_ax.set_ylabel('mean_Score')
Upvotes: 1