specify color in pie chart?

Greetings,

Sorry, I am new to matplotlib(0.86.1). I modifed the sample pie chart below to report disk quota usage. But how do I specify colors? (blue for free, and red for used)

···

-----------
from pylab import * figure(1, figsize=(4,4))
ax = axes([0.1, 0.1,0.8,0.8])
labels = 'Free', 'Used'
fracs = [15,85]
figure(1)
pie(fracs, labels=labels)
figure(2, figsize=(8,8))
explode=(0.05,0)
pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
savefig('pie_demo')
show()

regards,
Ryan

Just testing ---- I seem to be unable to post to this list. Thanks!

···

On 3/10/06, Ryan Suarez <ryan@...1038...> wrote:

Greetings,

Sorry, I am new to matplotlib(0.86.1). I modifed the sample pie chart
below to report disk quota usage. But how do I specify colors? (blue
for free, and red for used)

-----------
from pylab import *
figure(1, figsize=(4,4))
ax = axes([0.1, 0.1,0.8,0.8])
labels = 'Free', 'Used'
fracs = [15,85]
figure(1)
pie(fracs, labels=labels)
figure(2, figsize=(8,8))
explode=(0.05,0)
pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
savefig('pie_demo')
show()

regards,
Ryan

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Add the argument colors('b', 'r') when calling pie, i.e.

pie(fracs, colors = ('b', 'r'), explode=explode, labels=labels,

autopct='%1.1f%%', shadow=True)

Look at the docstring help(pie) for more info on the key arguments.

David

2006/3/10, Ryan Suarez <ryan@...1038...>:

···

Greetings,

Sorry, I am new to matplotlib(0.86.1). I modifed the sample pie chart
below to report disk quota usage. But how do I specify colors? (blue
for free, and red for used)

-----------
from pylab import *
figure(1, figsize=(4,4))
ax = axes([0.1, 0.1,0.8,0.8])
labels = 'Free', 'Used'
fracs = [15,85]
figure(1)
pie(fracs, labels=labels)
figure(2, figsize=(8,8))
explode=(0.05,0)
pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
savefig('pie_demo')
show()

regards,
Ryan

-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users