Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a896af8

Browse files
authored
Merge pull request #10224 from timhoffm/axes-doc-errorbar
improve docstring of Axes.errorbar
2 parents d7f69fe + bcb7b41 commit a896af8

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,9 +2485,7 @@ def broken_barh(self, xranges, yrange, **kwargs):
24852485
24862486
Notes
24872487
-----
2488-
..
2489-
[Empty notes is a workaround to prevent the data note from being
2490-
injected into the Returns section.]
2488+
.. [Notes section required for data comment. See #10189.]
24912489
24922490
"""
24932491
# process the unit information
@@ -2941,68 +2939,65 @@ def errorbar(self, x, y, yerr=None, xerr=None,
29412939
xlolims=False, xuplims=False, errorevery=1, capthick=None,
29422940
**kwargs):
29432941
"""
2944-
Plot an errorbar graph.
2942+
Plot y versus x as lines and/or markers with attached errorbars.
29452943
2946-
Plot x versus y with error deltas in yerr and xerr.
2947-
Vertical errorbars are plotted if yerr is not None.
2948-
Horizontal errorbars are plotted if xerr is not None.
2949-
2950-
x, y, xerr, and yerr can all be scalars, which plots a
2951-
single error bar at x, y.
2944+
*x*, *y* define the data locations, *xerr*, *yerr* define the errorbar
2945+
sizes. By default, this draws the data markers/lines as well the
2946+
errorbars. Use fmt='none' to draw errorbars without any data markers.
29522947
29532948
Parameters
29542949
----------
2955-
x : scalar or array-like
2956-
y : scalar or array-like
2950+
x, y : scalar or array-like
2951+
The data positions.
29572952
2958-
xerr/yerr : scalar or array-like, shape(N,) or shape(2,N), optional
2959-
If a scalar number, len(N) array-like object, or a N-element
2960-
array-like object, errorbars are drawn at +/-value relative
2961-
to the data. Default is None.
2953+
xerr, yerr : scalar or array-like, shape(N,) or shape(2,N), optional
2954+
The errorbar sizes:
29622955
2963-
If a sequence of shape 2xN, errorbars are drawn at -row1
2964-
and +row2 relative to the data.
2956+
- scalar: Symmetric +/- values for all data points.
2957+
- shape(N,): Symmetric +/-values for each data point.
2958+
- shape(2,N): Separate + and - values for each data point.
2959+
- *None*: No errorbar.
2960+
2961+
fmt : plot format string, optional, default: ''
2962+
The format for the data points / data lines. See `~.plot` for
2963+
details.
29652964
2966-
fmt : plot format string, optional, default: None
2967-
The plot format symbol. If fmt is 'none' (case-insensitive),
2968-
only the errorbars are plotted. This is used for adding
2969-
errorbars to a bar plot, for example. Default is '',
2970-
an empty plot format string; properties are
2971-
then identical to the defaults for :meth:`plot`.
2965+
Use 'none' (case insensitive) to plot errorbars without any data
2966+
markers.
29722967
29732968
ecolor : mpl color, optional, default: None
2974-
A matplotlib color arg which gives the color the errorbar lines;
2975-
if None, use the color of the line connecting the markers.
2969+
A matplotlib color arg which gives the color the errorbar lines.
2970+
If None, use the color of the line connecting the markers.
29762971
29772972
elinewidth : scalar, optional, default: None
2978-
The linewidth of the errorbar lines. If None, use the linewidth.
2973+
The linewidth of the errorbar lines. If None, the linewidth of
2974+
the current style is used.
29792975
29802976
capsize : scalar, optional, default: None
2981-
The length of the error bar caps in points; if None, it will
2977+
The length of the error bar caps in points. If None, it will
29822978
take the value from ``errorbar.capsize``
29832979
:data:`rcParam<matplotlib.rcParams>`.
29842980
29852981
capthick : scalar, optional, default: None
2986-
An alias kwarg to markeredgewidth (a.k.a. - mew). This
2987-
setting is a more sensible name for the property that
2982+
An alias to the keyword argument *markeredgewidth* (a.k.a. *mew*).
2983+
This setting is a more sensible name for the property that
29882984
controls the thickness of the error bar cap in points. For
2989-
backwards compatibility, if mew or markeredgewidth are given,
2990-
then they will over-ride capthick. This may change in future
2985+
backwards compatibility, if *mew* or *markeredgewidth* are given,
2986+
then they will over-ride *capthick*. This may change in future
29912987
releases.
29922988
29932989
barsabove : bool, optional, default: False
2994-
If True , will plot the errorbars above the plot
2990+
If True, will plot the errorbars above the plot
29952991
symbols. Default is below.
29962992
2997-
lolims / uplims / xlolims / xuplims : bool, optional, default:None
2998-
These arguments can be used to indicate that a value gives
2999-
only upper/lower limits. In that case a caret symbol is
3000-
used to indicate this. lims-arguments may be of the same
3001-
type as *xerr* and *yerr*. To use limits with inverted
3002-
axes, :meth:`set_xlim` or :meth:`set_ylim` must be called
3003-
before :meth:`errorbar`.
2993+
lolims, uplims, xlolims, xuplims : bool, optional, default: None
2994+
These arguments can be used to indicate that a value gives only
2995+
upper/lower limits. In that case a caret symbol is used to
2996+
indicate this. *lims*-arguments may be of the same type as *xerr*
2997+
and *yerr*. To use limits with inverted axes, :meth:`set_xlim`
2998+
or :meth:`set_ylim` must be called before :meth:`errorbar`.
30042999
3005-
errorevery : positive integer, optional, default:1
3000+
errorevery : positive integer, optional, default: 1
30063001
Subsamples the errorbars. e.g., if errorevery=5, errorbars for
30073002
every 5-th datapoint will be plotted. The data plot itself still
30083003
shows all data points.
@@ -3031,13 +3026,18 @@ def errorbar(self, x, y, yerr=None, xerr=None,
30313026
errorbar(x, y, yerr, marker='s', mfc='red',
30323027
mec='green', ms=20, mew=4)
30333028
3034-
where mfc, mec, ms and mew are aliases for the longer
3035-
property names, markerfacecolor, markeredgecolor, markersize
3036-
and markeredgewidth.
3029+
where *mfc*, *mec*, *ms* and *mew* are aliases for the longer
3030+
property names, *markerfacecolor*, *markeredgecolor*, *markersize*
3031+
and *markeredgewidth*.
30373032
3038-
Valid kwargs for the marker properties are
3033+
Valid kwargs for the marker properties are `~.Lines2D` properties:
30393034
30403035
%(Line2D)s
3036+
3037+
Notes
3038+
-----
3039+
.. [Notes section required for data comment. See #10189.]
3040+
30413041
"""
30423042
kwargs = cbook.normalize_kwargs(kwargs, _alias_map)
30433043
# anything that comes in as 'None', drop so the default thing

0 commit comments

Comments
 (0)