'Plotnine, changing order of Months on x axis, currently alphabetically
Using Plotnine to plot values per month. Currently, the Months are ordered alphabetically on x axis. How to change this?
here is the code:
(ggplot(df, aes(x = 'Month', y='Rented Bike Count')) +
stat_summary(fun_data = 'mean_sdl', geom = 'bar') +
theme(axis_text_x = element_text(angle=90)))
Solution 1:[1]
just found out the solution:
months = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"]
(ggplot(df, aes(x = 'Month', y='Rented Bike Count')) +
stat_summary(fun_data = 'mean_sdl', geom = 'bar') +
scale_x_discrete(limits=months) +
theme(axis_text_x = element_text(angle=90)))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sylwia Kmiec |

