Plot y versus x as lines and/or markers with attached errorbars.
x, y define the data locations, xerr, yerr define the errorbar sizes. By default, this draws the data markers/lines as well the errorbars. Use fmt='none' to draw errorbars without any data markers.
The data positions.
The errorbar sizes:
Note that all error arrays should have positive values.
See Different ways of specifying error bars for an example on the usage of xerr
and yerr
.
The format for the data points / data lines. See plot
for details.
Use 'none' (case insensitive) to plot errorbars without any data markers.
The color of the errorbar lines. If None, use the color of the line connecting the markers.
The linewidth of the errorbar lines. If None, the linewidth of the current style is used.
rcParams["errorbar.capsize"]
(default: 0.0
)
The length of the error bar caps in points.
An alias to the keyword argument markeredgewidth (a.k.a. mew). This setting is a more sensible name for the property that controls the thickness of the error bar cap in points. For backwards compatibility, if mew or markeredgewidth are given, then they will over-ride capthick. This may change in future releases.
If True, will plot the errorbars above the plot symbols. Default is below.
These arguments can be used to indicate that a value gives only upper/lower limits. In that case a caret symbol is used to indicate this. lims-arguments may be scalars, or array-likes of the same length as xerr and yerr. To use limits with inverted axes, set_xlim
or set_ylim
must be called before errorbar()
. Note the tricky parameter names: setting e.g. lolims to True means that the y-value is a lower limit of the True value, so, only an upward-pointing arrow will be drawn!
draws error bars on a subset of the data. errorevery =N draws error bars on the points (x[::N], y[::N]). errorevery =(start, N) draws error bars on the points (x[start::N], y[start::N]). e.g. errorevery=(6, 3) adds error bars to the data at (x[6], x[9], x[12], x[15], ...). Used to avoid overlapping error bars when two series share x-axis values.
ErrorbarContainer
The container contains:
Line2D
instance of x, y plot markers and/or line.Line2D
instances of the error bar caps.LineCollection
with the horizontal and vertical error ranges.If given, the following parameters also accept a string s
, which is interpreted as data[s]
(unless this raises an exception):
x, y, xerr, yerr
All other keyword arguments are passed on to the plot
call drawing the markers. For example, this code makes big red squares with thick green edges:
x, y, yerr = rand(3, 10) errorbar(x, y, yerr, marker='s', mfc='red', mec='green', ms=20, mew=4)
where mfc, mec, ms and mew are aliases for the longer property names, markerfacecolor, markeredgecolor, markersize and markeredgewidth.
Valid kwargs for the marker properties are Line2D
properties:
Property | Description |
---|---|
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array | |
scalar or None | |
bool | |
| bool |
bool | |
Patch or (Path, Transform) or None | |
| color |
| |
| |
sequence of floats (on/off ink in points) or (None, None) | |
(2, N) array or two 1D arrays | |
| {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default' |
{'full', 'left', 'right', 'bottom', 'top', 'none'} | |
str | |
bool | |
object | |
| {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} |
| float |
marker style string, | |
| color |
| float |
| color |
| color |
| float |
None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool] | |
float or callable[[Artist, Event], tuple[bool, dict]] | |
float | |
bool | |
(scale: float, length: float, randomness: float) | |
bool or None | |
| |
| |
unknown | |
str | |
bool | |
1D array | |
1D array | |
float |
matplotlib.axes.Axes.errorbar
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.axes.Axes.errorbar.html