-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
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
ENH: Allow subplots axes to be passed into DataFrame.plot() #6306
Comments
This seems a bit tricky API wise. We'd need to figure out what to do if df2 and df1 are not indexed the same. What would you think about having more control over the layout if you had a MultiIndex for the columns? df3 = pd.concat([df1, df2], axis=1, keys=['a', 'b'])
In [1]: df3
Out[68]:
a b \
0 1 2 3 0 1 2
0 0.403222 0.179409 0.819205 0.839402 0.421360 0.334930 0.251081
1 0.689900 0.969358 0.247526 0.670381 0.509042 0.237918 0.794933
2 0.998004 0.965907 0.354623 0.109929 0.160774 0.130975 0.591787
3 0.761342 0.420306 0.571551 0.109936 0.581581 0.925967 0.586253
4 0.750932 0.624856 0.975460 0.860216 0.414069 0.883192 0.668196
3
0 0.952108
1 0.420736
2 0.378974
3 0.037831
4 0.706987
[5 rows x 8 columns] And then you could to subplots by a level of the MultiIndex? That removes any ambiguity of differently index as a workaround for now: axes = df1.plot(subplots=True)
for i, ax in enumerate(axes):
df2[i].plot(ax=ax)
plt.draw() |
This works:
The multiindex idea sounds good too. |
#6667 will make this possible I think |
dupe of #6667 |
This works nicely:
But this doesn't:
It would be nice if you could use the
subplots
flag, because it makes it easier to compare two data frames visually.The text was updated successfully, but these errors were encountered: