Skip to content

Commit 55d7a4f

Browse files
committed
Merge pull request #7032 from Seraf69/docs_errorbar
DOC: Updating docstring to numpy doc format for errorbar
1 parent 705678e commit 55d7a4f

File tree

1 file changed

+50
-56
lines changed

1 file changed

+50
-56
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 50 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2698,106 +2698,100 @@ def errorbar(self, x, y, yerr=None, xerr=None,
26982698
"""
26992699
Plot an errorbar graph.
27002700
2701-
Call signature::
2702-
2703-
errorbar(x, y, yerr=None, xerr=None,
2704-
fmt='', ecolor=None, elinewidth=None, capsize=None,
2705-
barsabove=False, lolims=False, uplims=False,
2706-
xlolims=False, xuplims=False, errorevery=1,
2707-
capthick=None)
2708-
2709-
Plot *x* versus *y* with error deltas in *yerr* and *xerr*.
2710-
Vertical errorbars are plotted if *yerr* is not *None*.
2711-
Horizontal errorbars are plotted if *xerr* is not *None*.
2701+
Plot x versus y with error deltas in yerr and xerr.
2702+
Vertical errorbars are plotted if yerr is not None.
2703+
Horizontal errorbars are plotted if xerr is not None.
27122704
2713-
*x*, *y*, *xerr*, and *yerr* can all be scalars, which plots a
2714-
single error bar at *x*, *y*.
2705+
x, y, xerr, and yerr can all be scalars, which plots a
2706+
single error bar at x, y.
27152707
2716-
Optional keyword arguments:
2708+
Parameters
2709+
----------
2710+
x : scalar
2711+
y : scalar
27172712
2718-
*xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ]
2713+
xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional
27192714
If a scalar number, len(N) array-like object, or an Nx1
27202715
array-like object, errorbars are drawn at +/-value relative
2721-
to the data.
2716+
to the data. Default is None.
27222717
27232718
If a sequence of shape 2xN, errorbars are drawn at -row1
27242719
and +row2 relative to the data.
27252720
2726-
*fmt*: [ '' | 'none' | plot format string ]
2727-
The plot format symbol. If *fmt* is 'none' (case-insensitive),
2721+
fmt : plot format string, optional, default: None
2722+
The plot format symbol. If fmt is 'none' (case-insensitive),
27282723
only the errorbars are plotted. This is used for adding
27292724
errorbars to a bar plot, for example. Default is '',
27302725
an empty plot format string; properties are
27312726
then identical to the defaults for :meth:`plot`.
27322727
2733-
*ecolor*: [ *None* | mpl color ]
2728+
ecolor : mpl color, optional, default: None
27342729
A matplotlib color arg which gives the color the errorbar lines;
2735-
if *None*, use the color of the line connecting the markers.
2730+
if None, use the color of the line connecting the markers.
27362731
2737-
*elinewidth*: scalar
2738-
The linewidth of the errorbar lines. If *None*, use the linewidth.
2732+
elinewidth : scalar, optional, default: None
2733+
The linewidth of the errorbar lines. If None, use the linewidth.
27392734
2740-
*capsize*: scalar
2741-
The length of the error bar caps in points; if *None*, it will
2735+
capsize : scalar, optional, default: None
2736+
The length of the error bar caps in points; if None, it will
27422737
take the value from ``errorbar.capsize``
27432738
:data:`rcParam<matplotlib.rcParams>`.
27442739
2745-
*capthick*: scalar
2746-
An alias kwarg to *markeredgewidth* (a.k.a. - *mew*). This
2740+
capthick : scalar, optional, default: None
2741+
An alias kwarg to markeredgewidth (a.k.a. - mew). This
27472742
setting is a more sensible name for the property that
27482743
controls the thickness of the error bar cap in points. For
2749-
backwards compatibility, if *mew* or *markeredgewidth* are given,
2750-
then they will over-ride *capthick*. This may change in future
2744+
backwards compatibility, if mew or markeredgewidth are given,
2745+
then they will over-ride capthick. This may change in future
27512746
releases.
27522747
2753-
*barsabove*: [ *True* | *False* ]
2754-
if *True*, will plot the errorbars above the plot
2748+
barsabove : bool, optional, default: False
2749+
if True , will plot the errorbars above the plot
27552750
symbols. Default is below.
27562751
2757-
*lolims* / *uplims* / *xlolims* / *xuplims*: [ *False* | *True* ]
2752+
lolims / uplims / xlolims / xuplims : bool, optional, default:None
27582753
These arguments can be used to indicate that a value gives
27592754
only upper/lower limits. In that case a caret symbol is
27602755
used to indicate this. lims-arguments may be of the same
27612756
type as *xerr* and *yerr*. To use limits with inverted
27622757
axes, :meth:`set_xlim` or :meth:`set_ylim` must be called
27632758
before :meth:`errorbar`.
27642759
2765-
*errorevery*: positive integer
2760+
errorevery : positive integer, optional, default:1
27662761
subsamples the errorbars. e.g., if errorevery=5, errorbars for
27672762
every 5-th datapoint will be plotted. The data plot itself still
27682763
shows all data points.
27692764
2770-
All other keyword arguments are passed on to the plot command for the
2771-
markers. For example, this code makes big red squares with
2772-
thick green edges::
2773-
2774-
x,y,yerr = rand(3,10)
2775-
errorbar(x, y, yerr, marker='s',
2776-
mfc='red', mec='green', ms=20, mew=4)
2777-
2778-
where *mfc*, *mec*, *ms* and *mew* are aliases for the longer
2779-
property names, *markerfacecolor*, *markeredgecolor*, *markersize*
2780-
and *markeredgewidth*.
2781-
2782-
valid kwargs for the marker properties are
2765+
Returns
2766+
-------
2767+
plotline : :class:`~matplotlib.lines.Line2D` instance
2768+
x, y plot markers and/or line
2769+
caplines : list of :class:`~matplotlib.lines.Line2D` instances
2770+
error bar cap
2771+
barlinecols : list of :class:`~matplotlib.collections.LineCollection`
2772+
horizontal and vertical error ranges.
27832773
2784-
%(Line2D)s
2774+
Other Parameters
2775+
----------------
2776+
kwargs : All other keyword arguments are passed on to the plot
2777+
command for the markers. For example, this code makes big red
2778+
squares with thick green edges::
27852779
2786-
Returns (*plotline*, *caplines*, *barlinecols*):
2780+
x,y,yerr = rand(3,10)
2781+
errorbar(x, y, yerr, marker='s', mfc='red',
2782+
mec='green', ms=20, mew=4)
27872783
2788-
*plotline*: :class:`~matplotlib.lines.Line2D` instance
2789-
*x*, *y* plot markers and/or line
2784+
where mfc, mec, ms and mew are aliases for the longer
2785+
property names, markerfacecolor, markeredgecolor, markersize
2786+
and markeredgewidth.
27902787
2791-
*caplines*: list of error bar cap
2792-
:class:`~matplotlib.lines.Line2D` instances
2793-
*barlinecols*: list of
2794-
:class:`~matplotlib.collections.LineCollection` instances for
2795-
the horizontal and vertical error ranges.
2788+
valid kwargs for the marker properties are
27962789
2797-
**Example:**
2790+
%(Line2D)s
27982791
2792+
Examples
2793+
--------
27992794
.. plot:: mpl_examples/statistics/errorbar_demo.py
2800-
28012795
"""
28022796
kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
28032797
kwargs.setdefault('zorder', 2)

0 commit comments

Comments
 (0)