[AstroPy] matplotlib's pie colors
Wed Nov 30 23:42:36 CST 2011
To improve the visibility of the text, you may use patheffect module,
instead of changing the coloring.
a = pie([1,2,4,3], labels=["1", "2", "4", "3"], autopct="%d")
from matplotlib.patheffects import withStrokeeffect_whiteborder =
for txt in a: txt.set_path_effects([effect_whiteborder])
On Thu, Dec 1, 2011 at 10:38 AM, Derek Homeier
> On 01.12.2011, at 1:16AM, Grigoris Maravelias wrote:
>> Thanks Jake, but I know that I can set the colors but I would like it to
>> happen without me specifying the colors like this. Another approach
>> would be to create a list of colors according to the objects
>> automatically somehow by using #hex codes but it is getting too much
>> without really a purpose.
>> Thanks for you answer!
>> On 11/30/2011 06:26 PM, Jacob VanderPlas wrote:
>>> Try the following:
>>>>>> ax = pylab.axes()
>>>>>> ax.set_color_cycle(['green', 'orange', 'blue', 'red','brown','pink'])
>>>>>> ax.plot(x1, y1)
>>>>>> ax.plot(x2, y2)
> Thanks everyone, that's a very useful pointer - I have been wondering as well how
> to best set the default sequence of colours.
> Constructing a sequence is actually not that different using the *range() functions;
> e.g. you could apply them on rgb tuples, or even more comfortable, directly access
> any of the default colourmaps like
> and just pick your favourite from
> - now there'd only have to be a wider choice of maps that would all print well as
> lines on white bg ;-) but for pie charts etc. a lot of them should work well.
> AstroPy mailing list
More information about the AstroPy