-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Stacked bar graph: Bar segments are sorted in opposite order of legend. #6014
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
Comments
This seems like the expected behavior. A stacked column or bar chart should plot the first variable nearest to the intersection of the X & Y axes, right? |
I appreciate what you are saying, but if you think about the order of the segments & legend as 'first to last' rather than 'top to bottom', the current behavior makes sense. The first value is always the one nearest to the x-axis. Imagine if the values of a, b, and c were all negative. 'Top to bottom' takes on a different meaning on the other side of the x-axis...or if the dataset was rendered as a horizontal bar chart. |
Thanks for the comment, although I totally disagree :) Stacked bar graphs are hardly ever negative. In the typical case they are positive, and it makes it a lot easier for people to match segments to labels if they follow the same order in the 'top to bottom' sense (i.e the visually intuitive sense), not the 'first to last' sense. I'm new to issue reporting on github and so I don't know the etiquette for these things, but I'm curious if we can get someone else's opinion on this. |
Let's try a constructional proof:
That's not convincing in the least, but it shows the behavior makes sense for some Show me a major piece of related software that does this differently: ggplot2, Demonstrate that there's In fact a consensus among most of those and this ain't it, and The etiquette on GH issues is to argue your point well while remaining polite. Amuse if you're able. |
Hi all, Here is the default behavior in Excel, which I think is much easier to read. I also like how Excel preserves the order of the categories rather than sorting alphabetically. I personally think the Excel-style visually-matching ordering should be the default, but if that's not possible do you think there could be a simple "reverse labels" option in the plot method, or some other simple way to accomplish this? Thanks. P.S, I don't have Tableau, but I did a google image search, and it looks like the segments and labels are sorted in the same way visually, as in Excel. |
I've opened a PR for 0.14.0, we'll see how it goes. the plotting part of pandas is really fragile. |
Thanks y-p, much appreciated. |
I just merged #6118. |
Thanks, and here's my full version string:
INSTALLED VERSIONS
Python: 2.7.6.final.0
OS: Darwin
Release: 13.0.0
Processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.13.0
Cython: Not installed
Numpy: 1.8.0
Scipy: 0.13.1
statsmodels: Not installed
patsy: Not installed
scikits.timeseries: Not installed
dateutil: 2.2
pytz: 2013.9
bottleneck: Not installed
PyTables: Not Installed
numexpr: Not Installed
matplotlib: 1.3.1
openpyxl: Not installed
xlrd: Not installed
xlwt: Not installed
xlsxwriter: Not installed
sqlalchemy: Not installed
lxml: Not installed
bs4: Not installed
html5lib: Not installed
bigquery: Not installed
apiclient: Not installed
The text was updated successfully, but these errors were encountered: