issue with colors when using errorbar and legend


From other postings I see how to use a legend with errorbar. For example:

But I see that there is still a problem with the color of the legend
symbols. Specifically, if I plot using errorbar and then overplot a line,
the color of the line in the legend is set to the color of the errorbar

For example:

from pylab import *
data = [1,2,3]
error = [.5, .5, .5]
# The errorbar plot is blue.
line1 = errorbar(data, data, error, None, 'bo')
# The dashed line plot is red.
line2 = plot(data, data, 'r--')

Notice that in the legend both the points and the dashed lines are blue,
when the dashed line should be red.

Is there a way around this? Am I using legend() incorrectly?