Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « matplotlib.pyplot »

Fonction errorbar - module matplotlib.pyplot

Signature de la fonction errorbar

def errorbar(x: 'float | ArrayLike', y: 'float | ArrayLike', yerr: 'float | ArrayLike | None' = None, xerr: 'float | ArrayLike | None' = None, fmt: 'str' = '', *, ecolor: 'ColorType | None' = None, elinewidth: 'float | None' = None, capsize: 'float | None' = None, barsabove: 'bool' = False, lolims: 'bool | ArrayLike' = False, uplims: 'bool | ArrayLike' = False, xlolims: 'bool | ArrayLike' = False, xuplims: 'bool | ArrayLike' = False, errorevery: 'int | tuple[int, int]' = 1, capthick: 'float | None' = None, data=None, **kwargs) -> 'ErrorbarContainer' 

Description

help(matplotlib.pyplot.errorbar)

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 as the
errorbars. Use fmt='none' to draw errorbars without any data markers.

.. versionadded:: 3.7
   Caps and error lines are drawn in polar coordinates on polar plots.


Parameters
----------
x, y : float or array-like
    The data positions.

xerr, yerr : float or array-like, shape(N,) or shape(2, N), optional
    The errorbar sizes:

    - scalar: Symmetric +/- values for all data points.
    - shape(N,): Symmetric +/-values for each data point.
    - shape(2, N): Separate - and + values for each bar. First row
      contains the lower errors, the second row contains the upper
      errors.
    - *None*: No errorbar.

    All values must be >= 0.

    See :doc:`/gallery/statistics/errorbar_features`
    for an example on the usage of ``xerr`` and ``yerr``.

fmt : str, default: ''
    The format for the data points / data lines. See `.plot` for
    details.

    Use 'none' (case-insensitive) to plot errorbars without any data
    markers.

ecolor : :mpltype:`color`, default: None
    The color of the errorbar lines.  If None, use the color of the
    line connecting the markers.

elinewidth : float, default: None
    The linewidth of the errorbar lines. If None, the linewidth of
    the current style is used.

capsize : float, default: :rc:`errorbar.capsize`
    The length of the error bar caps in points.

capthick : float, default: None
    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.

barsabove : bool, default: False
    If True, will plot the errorbars above the plot
    symbols. Default is below.

lolims, uplims, xlolims, xuplims : bool or array-like, default: False
    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, `~.Axes.set_xlim` or `~.Axes.set_ylim` must be called before
    :meth:`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!

errorevery : int or (int, int), default: 1
    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.

Returns
-------
`.ErrorbarContainer`
    The container contains:

    - data_line : A `~matplotlib.lines.Line2D` instance of x, y plot markers
      and/or line.
    - caplines : A tuple of `~matplotlib.lines.Line2D` instances of the error
      bar caps.
    - barlinecols : A tuple of `.LineCollection` with the horizontal and
      vertical error ranges.

Other Parameters
----------------
data : indexable object, optional
    If given, the following parameters also accept a string ``s``, which is
    interpreted as ``data[s]`` if ``s`` is a key in ``data``:

    *x*, *y*, *xerr*, *yerr*

**kwargs
    All other keyword arguments are passed on to the `~.Axes.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:

    - *dashes*
    - *dash_capstyle*
    - *dash_joinstyle*
    - *drawstyle*
    - *fillstyle*
    - *linestyle*
    - *marker*
    - *markeredgecolor*
    - *markeredgewidth*
    - *markerfacecolor*
    - *markerfacecoloralt*
    - *markersize*
    - *markevery*
    - *solid_capstyle*
    - *solid_joinstyle*

    Refer to the corresponding `.Line2D` property for more details:

    Properties:
    agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
    alpha: scalar or None
    animated: bool
    antialiased or aa: bool
    clip_box: `~matplotlib.transforms.BboxBase` or None
    clip_on: bool
    clip_path: Patch or (Path, Transform) or None
    color or c: :mpltype:`color`
    dash_capstyle: `.CapStyle` or {'butt', 'projecting', 'round'}
    dash_joinstyle: `.JoinStyle` or {'miter', 'round', 'bevel'}
    dashes: sequence of floats (on/off ink in points) or (None, None)
    data: (2, N) array or two 1D arrays
    drawstyle or ds: {'default', 'steps', 'steps-pre', 'steps-mid', 'steps-post'}, default: 'default'
    figure: `~matplotlib.figure.Figure` or `~matplotlib.figure.SubFigure`
    fillstyle: {'full', 'left', 'right', 'bottom', 'top', 'none'}
    gapcolor: :mpltype:`color` or None
    gid: str
    in_layout: bool
    label: object
    linestyle or ls: {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
    linewidth or lw: float
    marker: marker style string, `~.path.Path` or `~.markers.MarkerStyle`
    markeredgecolor or mec: :mpltype:`color`
    markeredgewidth or mew: float
    markerfacecolor or mfc: :mpltype:`color`
    markerfacecoloralt or mfcalt: :mpltype:`color`
    markersize or ms: float
    markevery: None or int or (int, int) or slice or list[int] or float or (float, float) or list[bool]
    mouseover: bool
    path_effects: list of `.AbstractPathEffect`
    picker: float or callable[[Artist, Event], tuple[bool, dict]]
    pickradius: float
    rasterized: bool
    sketch_params: (scale: float, length: float, randomness: float)
    snap: bool or None
    solid_capstyle: `.CapStyle` or {'butt', 'projecting', 'round'}
    solid_joinstyle: `.JoinStyle` or {'miter', 'round', 'bevel'}
    transform: unknown
    url: str
    visible: bool
    xdata: 1D array
    ydata: 1D array
    zorder: float

Notes
-----

.. note::

    This is the :ref:`pyplot wrapper <pyplot_interface>` for `.axes.Axes.errorbar`.


Vous êtes un professionnel et vous avez besoin d'une formation ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé