-
Notifications
You must be signed in to change notification settings - Fork 213
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
Order bar charts #295
Comments
I think we should at least respect the order of the dataframe, it does not seem to be the case today EDIT: Okay actually data is sorted before ggplot rendering, but it sort the x-axis alphabetically. We then should be able to pass sort=False in some kind of way to respect the order of the dataframe. |
For readers just so you know I found a "hack" to get cool bar plots without much effort. 1/ Sort your dataframe as you wish This ensure the alphabetic ordering of the column matches the order of rank thanks to the :) I would still have preferred an explicit way to do this through plot nine |
Plotnine has inherited this from ggplot2, which respects the sort order of the datatypes involved, not the order of the data points. Turning a column in a sorted dataframe into a categorical isn't that bad, though a bit verbose: Guess I'll be adding a convenient method for that in my dppd library... |
Sorting is standard and is handled automatically by the |
For those stumbling upon this issue recently, you can do something like (data
>> ggplot()
+ geom_col(aes(x = 'reorder(col1, col2)', y = 'col2'))
) after you have reordered your data as you wish. |
Hello,
I would like to reopen issue 94 I don't think it's really user friendly to not include automatic sorting in geom_bar function. If I understand correctly we need to make a pandas.Categorical each time we want to define the order of our graph.
That's something I find really painful. Can't we implement a keyword_argument sort_by="xxxx" in geom_bar?
I can do the MR if it's not too much complicated, I don't know plotnine code as of now :)
Thanks for the answer
By the way thanks for this incredible package, easily the best python package for graphs available :)
The text was updated successfully, but these errors were encountered: