On Thu, Sep 15, 2011 at 7:12 AM, Nils Wagner
<nwag...@iam.uni-stuttgart.de>wrote:

> Hi all,
>
> I am looking for a simple method to generate various
> colours (n > 15, n denotes the number of colours) for a
> stacked bar plot.
>
> Any pointer would be appreciated.
>
> The example
> http://matplotlib.sourceforge.net/examples/pylab_examples/table_demo.html
> generates pastel colours. However the difference between
> the different colors decreases drastically.
>

You might try using one or more of the default
colormaps<http://matplotlib.sourceforge.net/examples/pylab_examples/show_colormaps.html>to
generate colors. For example:

>>> for n in np.linspace(0, 1, 20):
>>>    plt.plot(n, 0, 'o', mfc=plt.cm.Set1(n))

will plot 20 points in a line with a different color for each dot.
Nevertheless, some colors are difficult to differentiate. Instead of
grabbing all your colors from one colormap you could grab the first 10 from
a pastel colormap (e.g. 'Set3') and then the next 10 from a dark colormap
(e.g. 'Dark2') and maybe even some more from a bright colormap (e.g.
'spectral').

You'll probably have to tweak these colormaps before they are properly
differentiated (i.e. you might not be able to get away with evenly-spaced
indexes into the colormap), but something like this should work.

Best,
-Tony

(Sorry for the duplicate email, Nils, but I forgot to reply all).
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop 
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops?   How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to