We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Following issue #3598,
df = pd.DataFrame(np.random.uniform(size=10).reshape(5,2),columns=['A','B']) df['A'] = df['A'] * 100 df.A.plot() df.B.plot(kind='bar',secondary_y=True) plt.show()
This gives the right plot, with A plotted as line in the primary axis, and B is plotted as bar in the secondary axis.
A
B
But if I index the dataframe by datetime
df = pd.DataFrame(np.random.uniform(size=10).reshape(5,2),columns=['A','B']) df = df.set_index(pd.date_range('20130101',periods=5)) df['A'] = df['A'] * 100 df.A.plot() df.B.plot(kind='bar',secondary_y=True) plt.show()
This wont plot A as line in the primary axis, only the B as bar in the secondary axis. Not sure why.
The text was updated successfully, but these errors were encountered:
Update: It seems because they are share x axis. The below wont work if sharex=True is not removed.
sharex=True
f, axarr = plt.subplots(2, sharex=True) df.A.plot(legend=True, style='r', ax=axarr[0]) df.B.plot(ax=axarr[1], kind='bar', legend=True) plt.show()
Sorry, something went wrong.
#41233
No branches or pull requests
Following issue #3598,
This gives the right plot, with
A
plotted as line in the primary axis, andB
is plotted as bar in the secondary axis.But if I index the dataframe by datetime
This wont plot A as line in the primary axis, only the B as bar in the secondary axis. Not sure why.
The text was updated successfully, but these errors were encountered: