I just started using pandas/matplotlib as a replacement for Excel to generate stacked bar charts. I am running into an issue
(1) there are only 5 colors in the default colormap, so if I have more than 5 categories then the colors repeat. How can I specify more colors? Ideally, a gradient with a start color and an end color, and a way to dynamically generate n colors in between?
(2) the colors are not very visually pleasing. How do I specify a custom set of n colors? Or, a gradient would also work.
An example which illustrates both of the above points is below:
4 from matplotlib import pyplot
5 from pandas import *
6 import random
7
8 x = [{i:random.randint(1,5)} for i in range(10)]
9 df = DataFrame(x)
10
11 df.plot(kind='bar', stacked=True)
And the output is this: