Re: [Matplotlib-users] Newb question - multiple colors in bar chart

2010-01-25 Thread Matthias Michler
Hi Jeff,

you can do something like the following and specify the color for each bar by 
providing a list of colors for the keyword argument 'color'.

import numpy as np
import matplotlib.pyplot as plt

# generate some data
left = np.arange(6)
height = np.random.uniform(size=6)
# plot 3 blue and 3 red bars:
plt.bar(left, height, color=['blue']*3+ ['red']*3)
plt.show()

You second way could be provided by the color list

['red', '0.5']*3 = ['red', '0.5', 'red', '0.5', 'red', '0.5']

Kind regards,
Matthias

On Saturday 23 January 2010 16:36:36 Jeff Layton wrote:
> Good morning,
>
> I hate to ask such a newbie question but I am a newb with matplotlib :)
>
> I want to create a bar chart with, for example, 6 "bars". I want the first
> 3 bars to be one color and the second 3 bars to be another color. I'm
> not entirely sure how to do this - any suggestions?
>
> Alternatively, I would like to create 6 bars where every other bar is
> a different color. For example, gray, red, gray, red, gray, red. Any
> suggestions on this?
>
> TIA!
>
> Jeff

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Newb question - multiple colors in bar chart

2010-01-23 Thread Jeff Layton
Good morning,

I hate to ask such a newbie question but I am a newb with matplotlib :)

I want to create a bar chart with, for example, 6 "bars". I want the first
3 bars to be one color and the second 3 bars to be another color. I'm
not entirely sure how to do this - any suggestions?

Alternatively, I would like to create 6 bars where every other bar is
a different color. For example, gray, red, gray, red, gray, red. Any
suggestions on this?

TIA!

Jeff


--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users