Skip to content

Conversation

@HHammond
Copy link
Contributor

Modifies the horizontal bar plot behavior to plot series in order from top-to-bottom.

Plotting a regular bar graph from a DataFrame object will plot each series of data from left-to-right in the same order as presented in the legend from top-to-bottom. When plotting a horizontal bar graph the series of data are plotted from bottom-to-top, which is the reverse of the legend and unintuitive.

Pandas allows a legend='reverse' option which reverses the order of the legend and preserves series colors, but does not fix the unintuitive bottom-to-top ordering of series.

Pandas Standard barh Behavior:

original_behaviour

Desired barh Behavior:

alternate_behaviour

Pandas Standard barh legend='reverse' Behavior:

reversed_legend

@HHammond HHammond changed the title Bugfix for inconsistent barplot series ordering. ENH: Intuitive Barplot Series Ordering Apr 14, 2015
@TomAugspurger TomAugspurger modified the milestones: 0.17.0, Next Major Release Apr 14, 2015
@TomAugspurger
Copy link
Contributor

Thanks for the informative summary (with pictures). I think the current behavior comes from us drawing from the origin outward. This makes sense when going left to right, not so much bottom to top.

I'd rather we have another keyword argument for this, since it will be an API change, something like bar_order or group_order.

It will be a bit before I can review the code.

@sinhrks
Copy link
Member

sinhrks commented Apr 14, 2015

I think the behavior can be generalized if plot can accept sort_columns='reverse' (like legend does). It may useful for other stacking and pie charts.

@jreback
Copy link
Contributor

jreback commented Jul 12, 2015

pls rebase/update. closing, but reopen if you want to work on.

@jreback jreback closed this Jul 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

4 participants