Pandas Stacked Bar Chart Duplicates Colors For Large Legends
I need to create a stacked bar chart with a large number (10 or so) categories. The problem is that Pandas only provides colors for up to 7 different categories. It sets the remain
Solution 1:
In [22]: colors = plt.cm.GnBu(np.linspace(0, 1, 10))
In [23]: df.plot(kind='bar', stacked=True, figsize=(20, 10), color=colors)
Out[23]: <matplotlib.axes._subplots.AxesSubplot at 0x10b792d90>
matplotlib has a bunch of different colormaps to choose from. Just don't use jet
.
Post a Comment for "Pandas Stacked Bar Chart Duplicates Colors For Large Legends"