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

Skip to content

Commit baead7d

Browse files
authored
Merge pull request #17308 from timhoffm/doc-bar
2 parents 2d4fcc7 + 5da7c66 commit baead7d

File tree

1 file changed

+41
-55
lines changed

1 file changed

+41
-55
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 41 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,26 +2272,25 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
22722272
Make a bar plot.
22732273
22742274
The bars are positioned at *x* with the given *align*\ment. Their
2275-
dimensions are given by *width* and *height*. The vertical baseline
2275+
dimensions are given by *height* and *width*. The vertical baseline
22762276
is *bottom* (default 0).
22772277
2278-
Each of *x*, *height*, *width*, and *bottom* may either be a scalar
2279-
applying to all bars, or it may be a sequence of length N providing a
2280-
separate value for each bar.
2278+
Many parameters can take either a single value applying to all bars
2279+
or a sequence of values, one for each bar.
22812280
22822281
Parameters
22832282
----------
2284-
x : sequence of scalars
2283+
x : float or array-like
22852284
The x coordinates of the bars. See also *align* for the
22862285
alignment of the bars to the coordinates.
22872286
2288-
height : scalar or sequence of scalars
2287+
height : float or array-like
22892288
The height(s) of the bars.
22902289
2291-
width : scalar or array-like, default: 0.8
2290+
width : float or array-like, default: 0.8
22922291
The width(s) of the bars.
22932292
2294-
bottom : scalar or array-like, default: 0
2293+
bottom : float or array-like, default: 0
22952294
The y coordinate(s) of the bars bases.
22962295
22972296
align : {'center', 'edge'}, default: 'center'
@@ -2310,20 +2309,20 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23102309
23112310
Other Parameters
23122311
----------------
2313-
color : scalar or array-like, optional
2312+
color : color or list of color, optional
23142313
The colors of the bar faces.
23152314
2316-
edgecolor : scalar or array-like, optional
2315+
edgecolor : color or list of color, optional
23172316
The colors of the bar edges.
23182317
2319-
linewidth : scalar or array-like, optional
2318+
linewidth : float or array-like, optional
23202319
Width of the bar edge(s). If 0, don't draw edges.
23212320
2322-
tick_label : str or array-like, optional
2321+
tick_label : str or list of str, optional
23232322
The tick labels of the bars.
23242323
Default: None (Use default numeric labels.)
23252324
2326-
xerr, yerr : scalar or array-like of shape(N,) or shape(2, N), optional
2325+
xerr, yerr : float or array-like of shape(N,) or shape(2, N), optional
23272326
If not *None*, add horizontal / vertical errorbars to the bar tips.
23282327
The values are +/- sizes relative to the data:
23292328
@@ -2337,13 +2336,11 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23372336
See :doc:`/gallery/statistics/errorbar_features`
23382337
for an example on the usage of ``xerr`` and ``yerr``.
23392338
2340-
ecolor : scalar or array-like, default: 'black'
2339+
ecolor : color or list of color, default: 'black'
23412340
The line color of the errorbars.
23422341
2343-
capsize : scalar, optional
2342+
capsize : float, default: :rc:`errorbar.capsize`
23442343
The length of the error bar caps in points.
2345-
Default: None, which will take the value from
2346-
:rc:`errorbar.capsize`.
23472344
23482345
error_kw : dict, optional
23492346
Dictionary of kwargs to be passed to the `~.Axes.errorbar`
@@ -2357,23 +2354,18 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center",
23572354
*This is for internal use only.* Please use `barh` for
23582355
horizontal bar plots. Default: 'vertical'.
23592356
2357+
**kwargs : `.Rectangle` properties
2358+
2359+
%(Rectangle)s
2360+
23602361
See Also
23612362
--------
23622363
barh: Plot a horizontal bar plot.
23632364
23642365
Notes
23652366
-----
2366-
The optional arguments *color*, *edgecolor*, *linewidth*,
2367-
*xerr*, and *yerr* can be either scalars or sequences of
2368-
length equal to the number of bars. This enables you to use
2369-
bar as the basis for stacked bar charts, or candlestick plots.
2370-
Detail: *xerr* and *yerr* are passed directly to
2371-
:meth:`errorbar`, so they can also have shape 2xN for
2372-
independent specification of lower and upper errors.
2373-
2374-
Other optional kwargs:
2375-
2376-
%(Rectangle)s
2367+
Stacked bars can be achieved by passing individual *bottom* values per
2368+
bar. See :doc:`/gallery/lines_bars_and_markers/bar_stacked`.
23772369
"""
23782370
kwargs = cbook.normalize_kwargs(kwargs, mpatches.Patch)
23792371
color = kwargs.pop('color', None)
@@ -2547,23 +2539,22 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
25472539
dimensions are given by *width* and *height*. The horizontal baseline
25482540
is *left* (default 0).
25492541
2550-
Each of *y*, *width*, *height*, and *left* may either be a scalar
2551-
applying to all bars, or it may be a sequence of length N providing a
2552-
separate value for each bar.
2542+
Many parameters can take either a single value applying to all bars
2543+
or a sequence of values, one for each bar.
25532544
25542545
Parameters
25552546
----------
2556-
y : scalar or array-like
2547+
y : float or array-like
25572548
The y coordinates of the bars. See also *align* for the
25582549
alignment of the bars to the coordinates.
25592550
2560-
width : scalar or array-like
2551+
width : float or array-like
25612552
The width(s) of the bars.
25622553
2563-
height : sequence of scalars, default: 0.8
2554+
height : float or array-like, default: 0.8
25642555
The heights of the bars.
25652556
2566-
left : sequence of scalars, default: 0
2557+
left : float or array-like, default: 0
25672558
The x coordinates of the left sides of the bars.
25682559
25692560
align : {'center', 'edge'}, default: 'center'
@@ -2583,20 +2574,20 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
25832574
25842575
Other Parameters
25852576
----------------
2586-
color : scalar or array-like, optional
2577+
color : color or list of color, optional
25872578
The colors of the bar faces.
25882579
2589-
edgecolor : scalar or array-like, optional
2580+
edgecolor : color or list of color, optional
25902581
The colors of the bar edges.
25912582
2592-
linewidth : scalar or array-like, optional
2583+
linewidth : float or array-like, optional
25932584
Width of the bar edge(s). If 0, don't draw edges.
25942585
2595-
tick_label : str or array-like, optional
2586+
tick_label : str or list of str, optional
25962587
The tick labels of the bars.
25972588
Default: None (Use default numeric labels.)
25982589
2599-
xerr, yerr : scalar or array-like of shape(N,) or shape(2, N), optional
2590+
xerr, yerr : float or array-like of shape(N,) or shape(2, N), optional
26002591
If not ``None``, add horizontal / vertical errorbars to the
26012592
bar tips. The values are +/- sizes relative to the data:
26022593
@@ -2610,13 +2601,11 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
26102601
See :doc:`/gallery/statistics/errorbar_features`
26112602
for an example on the usage of ``xerr`` and ``yerr``.
26122603
2613-
ecolor : scalar or array-like, default: 'black'
2604+
ecolor : color or list of color, default: 'black'
26142605
The line color of the errorbars.
26152606
2616-
capsize : scalar, optional
2607+
capsize : float, default: :rc:`errorbar.capsize`
26172608
The length of the error bar caps in points.
2618-
Default: None, which will take the value from
2619-
:rc:`errorbar.capsize`.
26202609
26212610
error_kw : dict, optional
26222611
Dictionary of kwargs to be passed to the `~.Axes.errorbar`
@@ -2626,23 +2615,20 @@ def barh(self, y, width, height=0.8, left=None, *, align="center",
26262615
log : bool, default: False
26272616
If ``True``, set the x-axis to be log scale.
26282617
2618+
**kwargs : `.Rectangle` properties
2619+
2620+
%(Rectangle)s
2621+
26292622
See Also
26302623
--------
26312624
bar: Plot a vertical bar plot.
26322625
26332626
Notes
26342627
-----
2635-
The optional arguments *color*, *edgecolor*, *linewidth*,
2636-
*xerr*, and *yerr* can be either scalars or sequences of
2637-
length equal to the number of bars. This enables you to use
2638-
bar as the basis for stacked bar charts, or candlestick plots.
2639-
Detail: *xerr* and *yerr* are passed directly to
2640-
:meth:`errorbar`, so they can also have shape 2xN for
2641-
independent specification of lower and upper errors.
2642-
2643-
Other optional kwargs:
2644-
2645-
%(Rectangle)s
2628+
Stacked bars can be achieved by passing individual *left* values per
2629+
bar. See
2630+
:doc:`/gallery/lines_bars_and_markers/horizontal_barchart_distribution`
2631+
.
26462632
"""
26472633
kwargs.setdefault('orientation', 'horizontal')
26482634
patches = self.bar(x=left, height=height, width=width, bottom=y,

0 commit comments

Comments
 (0)