bug with legends and errorbar plots

I'm a new user to matplotlib and I don't believe that

    > legends play nicely with errorbars. My guess is that each
    > errorbar counts as a seperate graph, which screws up the
    > counting. Here's some code.

Yes, in this case you are going to have to give legend a little help.
The auto legend only works if the line instances correspond to the
number of legend strings. In the case of error bar, there are a lot
of extra lines in the plot. But you can pass the lines you want to
label to legend. In the case of errorbar, the line handles are
returned separately, one part for the line markers and one part for
the error bars. So it is easy to get the legend you want

from matplotlib.matlab import *

t = arange(0.1, 4, 0.1)
s = exp(-t)
e = 0.1*abs(randn(len(s)))
figure(1)
l0, errlines0 = errorbar(t, s, e, fmt='bo-')
l1, errlines1 = errorbar(t, s+1, e, fmt='ro-')
xlabel('Distance (m)')
ylabel('Height (m)')
title('Mean and standard error as a function of distance')
legend((l0, l1), ('legend 1', 'legend 2'))
show()