8000 Merge pull request #7032 from Seraf69/docs_errorbar · matplotlib/matplotlib@38be7ae · GitHub
[go: up one dir, main page]

Skip to content

Commit 38be7ae

Browse files
authored
Merge pull request #7032 from Seraf69/docs_errorbar
DOC: Updating docstring to numpy doc format for errorbar
2 parents 4f559a9 + bec46f0 commit 38be7ae

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
@@ -2700,106 +2700,100 @@ def errorbar(self, x, y, yerr=None, xerr=None,
27002700
"""
27012701
Plot an errorbar graph.
27022702
2703-
Call signature::
2704-
2705-
errorbar(x, y, yerr=None, xerr=None,
2706-
fmt='', ecolor=None, elinewidth=None, capsize=None,
2707-
barsabove=False, lolims=False, uplims=False,
2708-
xlolims=False, xuplims=False, errorevery=1,
2709-
capthick=None)
2710-
2711-
Plot *x* versus *y* with error deltas in *yerr* and *xerr*.
2712-
Vertical errorbars are plotted if *yerr* is not *None*.
2713-
Horizontal errorbars are plotted if *xerr* is not *None*.
2703+
Plot x versus y with error deltas in yerr and xerr.
2704+
Vertical errorbars are plotted if yerr is not None.
2705+
Horizontal errorbars are plotted if xerr is not None.
27142706
2715-
*x*, *y*, *xerr*, and *yerr* can all be scalars, which plots a
2716-
single error bar at *x*, *y*.
2707+
x, y, xerr, and yerr can all be scalars, which plots a
2708+
single error bar at x, y.
27172709
2718-
Optional keyword arguments:
2710+
Parameters
2711+
----------
2712+
x : scalar
2713+
y : scalar
27192714
2720-
*xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ]
2715+
xerr/yerr : scalar or array-like, shape(n,1) or shape(2,n), optional
27212716
If a scalar number, len(N) array-like object, or an Nx1
27222717
array-like object, errorbars are drawn at +/-value relative
2723-
to the data.
2718+
to the data. Default is None.
27242719
27252720
If a sequence of shape 2xN, errorbars are drawn at -row1
27262721
and +row2 relative to the data.
27272722
2728-
*fmt*: [ '' | 'none' | plot format string ]
2729-
The plot format symbol. If *fmt* is 'none' (case-insensitive),
2723+
fmt : plot format string, optional, default: None
2724+
The plot format symbol. If fmt is 'none' (case-insensitive),
27302725
only the errorbars are plotted. This is used for adding
27312726
errorbars to a bar plot, for example. Default is '',
27322727
an empty plot format string; properties are
27332728
then identical to the defaults for :meth:`plot`.
27342729
2735-
*ecolor*: [ *None* | mpl color ]
2730+
ecolor : mpl color, optional, default: None
27362731
A matplotlib color arg which gives the color the errorbar lines;
2737-
if *None*, use the color of the line connecting the markers.
2732+
if None, use the color of the line connecting the markers.
27382733
2739-
*elinewidth*: scalar
2740-
The linewidth of the errorbar lines. If *None*, use the linewidth.
2734+
elinewidth : scalar, optional, default: None
2735+
The linewidth of the errorbar lines. If None, use the linewidth.
27412736
2742-
*capsize*: scalar
2743-
The length of the error bar caps in points; if *None*, it will
2737+
capsize : scalar, optional, default: None
2738+
The length of the error bar caps in points; if None, it will
27442739
take the value from ``errorbar.capsize``
27452740
:data:`rcParam<matplotlib.rcParams>`.
27462741
2747-
*capthick*: scalar
2748-
An alias kwarg to *markeredgewidth* (a.k.a. - *mew*). This
2742+
capthick : scalar, optional, default: None
2743+
An alias kwarg to markeredgewidth (a.k.a. - mew). This
27492744
setting is a more sensible name for the property that
27502745
controls the thickness of the error bar cap in points. For
2751-
backwards compatibility, if *mew* or *markeredgewidth* are given,
2752-
then they will over-ride *capthick*. This may change in future
2746+
backwards compatibility, if mew or markeredgewidth are given,
2747+
then they will over-ride capthick. This may change in future
27532748
releases.
27542749
2755-
*barsabove*: [ *True* | *False* ]
2756-
if *True*, will plot the errorbars above the plot
2750+
barsabove : bool, optional, default: False
2751+
if True , will plot the errorbars above the plot
27572752
symbols. Default is below.
27582753
2759-
*lolims* / *uplims* / *xlolims* / *xuplims*: [ *False* | *True* ]
2754+
lolims / uplims / xlolims / xuplims : bool, optional, default:None
27602755
These arguments can be used to indicate that a value gives
27612756
only upper/lower limits. In that case a caret symbol is
27622757
used to indicate this. lims-arguments may be of the same
27632758
type as *xerr* and *yerr*. To use limits with inverted
27642759
axes, :meth:`set_xlim` or :meth:`set_ylim` must be called
27652760
before :meth:`errorbar`.
27662761
2767-
*errorevery*: positive integer
2762+
errorevery : positive integer, optional, default:1
27682763
subsamples the errorbars. e.g., if errorevery=5, errorbars for
27692764
every 5-th datapoint will be plotted. The data plot itself still
27702765
shows all data points.
27712766
2772-
All other keyword arguments are passed on to the plot command for the
2773-
markers. For example, this code makes big red squares with
2774-
thick green edges::
2775-
2776-
x,y,yerr = rand(3,10)
2777-
errorbar(x, y, yerr, marker='s',
2778-
mfc='red', mec='green', ms=20, mew=4)
2779-
2780-
where *mfc*, *mec*, *ms* and *mew* are aliases for the longer
2781-
property names, *markerfacecolor*, *markeredgecolor*, *markersize*
2782-
and *markeredgewidth*.
2783-
2784-
valid kwargs for the marker properties are
2767+
Returns
2768+
-------
2769+
plotline : :class:`~matplotlib.lines.Line2D` instance
2770+
x, y plot markers and/or line
2771+
caplines : list of :class:`~matplotlib.lines.Line2D` instances
2772+
error bar cap
2773+
barlinecols : list of :class:`~matplotlib.collections.LineCollection`
2774+
horizontal and vertical error ranges.
27852775
2786-
%(Line2D)s
2776+
Other Parameters
2777+
----------------
2778+
kwargs : All other keyword arguments are passed on to the plot
2779+
command for the markers. For example, this code makes big red
2780+
squares with thick green edges::
27872781
2788-
Returns (*plotline*, *caplines*, *barlinecols*):
2782+
x,y,yerr = rand(3,10)
2783+
errorbar(x, y, yerr, marker='s', mfc='red',
2784+
mec='green', ms=20, mew=4)
27892785
2790-
*plotline*: :class:`~matplotlib.lines.Line2D` instance
2791-
*x*, *y* plot markers and/or line
2786+
where mfc, mec, ms and mew are aliases for the longer
2787+
property names, markerfacecolor, markeredgecolor, markersize
2788+
and markeredgewidth.
27922789
2793-
*caplines*: list of error bar cap
2794-
:class:`~matplotlib.lines.Line2D` instances
2795-
*barlinecols*: list of
2796-
:class:`~matplotlib.collections.LineCollection` instances for
2797-
the horizontal and vertical error ranges.
2790+
valid kwargs for the marker properties are
27982791
2799-
**Example:**
2792+
%(Line2D)s
28002793
2794+
Examples
2795+
--------
28012796
.. plot:: mpl_examples/statistics/errorbar_demo.py
2802-
28032797
"""
28042798
kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
28052799
kwargs.setdefault('zorder', 2)

0 commit comments

Comments
 (0)
0