-
-
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
Plotting in a specific axis with DataFrame.hist(by=) is not working as expected #5353
Comments
@TomAugspurger can you have a look. still a bug? |
This works by doing df.hist(column='area', by=df.color) and it returns an array of |
umm, I guess, how does seaborn / ggplot do it? I suppose it might be nice to map it like
but seems kind of complicated to me |
going to move this and the other one you pointed to 0.15 |
IMO pandas plotting code should just be maintenance and bug fix only |
yep, although a couple of new contributors have add some good stuff: http://pandas-docs.github.io/pandas-docs-travis/whatsnew.html#plotting |
Thanks for looking into this. If I remember correctly, I had a figure with something else plotted in one subplot and wanted to be able to direct the histogram from pandas into one of the empty subplots of that figures. Maybe this code describes my situation better: import pandas as pd
df = pd.DataFrame({'color': ['blue','blue','yellow','blue','yellow'], 'area': [2,2,3,4,4]})
#fig, (ax1, ax2) = plt.subplots(1,2)
fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2,2)
ax3.plot([[2,2], [3,6]])
ax4.plot([[3,6], [2,2]])
df.area.hist(by=df.color, ax=ax1) Ideally, in my example, the pandas histogram is 1,2 and should then split ax1 into two subplots. Alternatively, it could be plotted into ax1 and ax2, and then the user could make sure that the correct number of empty subplots are available. This is just how I thought it would work when I saw the axis argument and it would be useful for me. However, if this is overly time consuming to implement, there are obviously far more important things to focus on than adjusting minor plotting features as already mentioned. |
Hi,
I posted this on stackoverflow http://stackoverflow.com/questions/19602864/how-to-plot-in-a-specific-axis-with-dataframe-histby-in-pandas?noredirect=1#comment29118427_19602864 and was suggested to file a bug report here.
I am trying plot several histogram groups in the same figure. Each group contains two conditions and I am therefore using the 'by=' argument from pandas histogram options. However, this does not work as I expected and pandas creates a new figure instead of plotting in the axis I am passing. I tried to pass four axes as well, but still no go. Sample code:
I'm using pandas 0.12.0, matplotlib 1.3.0, numpy 1.7.1 and python 2.7.5. Any suggestion that leads to a way of combining/stitching multiple 'hist(by=)-plots' in the same subplot grid is welcome.
The text was updated successfully, but these errors were encountered: