add errorbars color

To John Hunter,
John, I think this may be quite a common wish. I usually want my errorbars to have different properties to the default; not just colour but also a different weight from the main trend line. Perhaps this is a good candidate for factoring into the .matplotlibrc file and maybe for extra format specifiers in the errorbar call. I'd rate it an extremely low priority though, since you can already achieve it as in the example. Alternatively, adding this to a code sample could be useful to others.


----- Original Message -----
From: "Gary Ruben" <gazzar@...25...>
Date: Fri, 07 May 2004 21:11:10 +1000
To: "Nino Cucchiara" <cucchiar@...180...>,
Subject: Re: [Matplotlib-users] add errorbars color

> I've some data with yerrorbars. I want to know if there is one option to
> add color errorbar, because the fmt flag change only the color of the
> data points.

Try this example, Nino:

from matplotlib.matlab import *

t = arange(0.1, 4, 0.1)
s = exp(-t)
e = 0.1*abs(randn(len(s)))
line0, errlines0 = errorbar(t, s, e, fmt='bx:')
set(errlines0, 'color', 'c')
line1, errlines1 = errorbar(t, s+1, e, fmt='r-')
set(errlines1, 'color', 'g')
xlabel('Distance (m)')
ylabel('Height (m)')
title('Mean and standard error as a function of distance')
legend((line0, line1), ('legend 1', 'legend 2'))

Sign-up for Ads Free at