Re: [Matplotlib-users] Bar plot choose colours

2015-10-29 Thread questions anon
Wonderful! thank you! On Fri, Oct 30, 2015 at 4:51 AM, Joshua Klein wrote: > My mistake, I thought you were using a DataFrame, not a Series. Instead do > this > > colors = ['r' if row > 0 else 'b' for i, row in meantempanomaly.iteritems()] > meantempanomaly.plot(kind='bar', color=colors) > > ​ >

Re: [Matplotlib-users] Bar plot choose colours

2015-10-29 Thread Joshua Klein
My mistake, I thought you were using a DataFrame, not a Series. Instead do this colors = ['r' if row > 0 else 'b' for i, row in meantempanomaly.iteritems()] meantempanomaly.plot(kind='bar', color=colors) ​ On Thu, Oct 29, 2015 at 5:43 AM, questions anon wrote: > Thanks for taking the time to r

Re: [Matplotlib-users] Bar plot choose colours

2015-10-29 Thread questions anon
Thanks for taking the time to respond I am receiving the error: AttributeError: 'Series' object has no attribute 'iterrow' I will look into this further. thank you On Thu, Oct 29, 2015 at 2:31 PM, Joshua Klein wrote: > The pandas plot function doesn’t take colors as it does ‘x’ or ‘y’, but it

Re: [Matplotlib-users] Bar plot choose colours

2015-10-28 Thread Joshua Klein
The pandas plot function doesn’t take colors as it does ‘x’ or ‘y’, but it lets you pass color information just as you would with raw matplotlib code, which means you can pass it a sequence of colors which match the length of your sequence of drawn observations. # compute color codes using a terna

[Matplotlib-users] Bar plot choose colours

2015-10-28 Thread questions anon
I have calculated annual temperature anomaly and I would like to plot as a bar plot with all values positive make red and all values negative make blue I am using pandas and the time series data in this example are called 'anomaly' mybarplot=anomaly.plot(kind='bar') the data look like this: tim