TL'DR, the vertical bar charts are shown in a conventional way -- things line up from left to right. However, when it is converted to horizontal bar chart (from bar
to barh
), everything is upside-down. I.e., for a grouped bar chart, not only the order of the grouped bar is wrong, the order of the each group is wrong as well.
For e.g., the graph from http://dwheelerau.com/2014/05/28/pandas-data-analysis-new-zealanders-and-their-sheep/
If you look closely, you will find that the the bar and legend are in reverse order -- Beef shows on top in legend but on bottom in the graph.
As the simplest demo, I changed kind='bar',
to kind='barh',
from this graph
https://plot.ly/pandas/bar-charts/#pandas-grouped-bar-chart
and the result looks like this:
https://plot.ly/7/~xpt/
I.e., the bars in the horizontal grouped bar chart is ordered upside-down.
How to fix it?
EDIT: @Ajean, it is actually not only the order of the grouped bar is wrong, the order of the each group is wrong as well. The graph from Simple customization of matplotlib/pandas bar chart (labels, ticks, etc.) shows it clearly:
We can see that the order is unconventional too, because people would expect the graph to be top-down, with "AAA" at the top, not the bottom.
If you search for "Excel upside-down", you will find people are complaining about this in Excel all over the places. The Microsoft Excel has a fix for it, do Matplotlib/Panda/Searborn/Ploty/etc has a fix for it?