I had a look at Kaggle's univariate-plotting-with-pandas. There's this line which generates bar graph.
reviews['province'].value_counts().head(10).plot.bar()
I don't see any color scheme defined specifically.
I tried plotting it using jupyter notebook
but could see only one color instead of all multiple colors as at Kaggle.
I tried reading the document and online help but couldn't get any method to generate these colors just by the line above.
How do we do that? Is there a config to set this randomness by default?
It seems like the multicoloured bars were the default behaviour in one of the former
pandas
versions and Kaggle must have used that one for their tutorial (you can read more here).You can easily recreate the plot by defining a list of standard colours and then using it as an argument in
bar
.Tested on
pandas 0.24.1
andmatplotlib 2.2.2
.The colorful plot has been produced with an earlier version of pandas (<= 0.23). Since then, pandas has decided to make bar plots monochrome, because the color of the bars is pretty meaningless. If you still want to produce a bar chart with the default colors from the "tab10" colormap in pandas >= 0.24, and hence recreate the previous behaviour, it would look like
In seaborn is it not problem:
In matplotlib are not spaces, but possible with convert values to one row DataFrame:
Or use some qualitative colormap: