Skip to content

documentation mistake in errorbar #2974

Closed
@oliverw1

Description

@oliverw1

Copying this from the mpl mailinglist item.

When using errorbar, the documentation says the color of the errorbar lines will match with the color of the markers if ecolor=None. That’s not what I found. Apparently it takes over the color of the Line2D instance which interconnects the markers.

Short, Self Contained, Correct Example:

from pylab import *
plt.ion()  # saves typing show

x = np.arange(10)
y = np.random.rand(10)
xerr, yerr = y/4., y/4.

# Markers in red, but errorlines assume the color of the "trendline" (default rcparams: blue).
errorbar(x, y, yerr=yerr, mfc='r', marker='o', ecolor=None) 

# Errorlines get color green now - documentation not in line with results

figure(); errorbar(x, y, yerr=xerr, mfc='r', marker='o', ecolor=None, color='g')
# Errorlines get color blue now, because it can be specified - expected behaviour
figure(); errorbar(x, y, yerr=xerr, mfc='r', marker='o', ecolor='b', color='g')

I don't know what the original design decision was: to make sure the errorbarlines get the same color as the markers or if they should get the same color as the "trendline". In the latter case, only the documentation needs to be fixed (although I'm sure fixing the code will be just as easy in this case).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions