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

Skip to content

Commit 954b752

Browse files
committed
Merge pull request #2183 from NelleV/MEP10_barh
DOC moved barh to new style MEP10 documentation
2 parents e7f6874 + 090f8d7 commit 954b752

File tree

1 file changed

+77
-50
lines changed

1 file changed

+77
-50
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 77 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
17531753
xerr : scalar or array-like, optional, default: None
17541754
if not None, will be used to generate errorbar(s) on the bar chart
17551755
1756-
yerr :scalar or array-like, optional, default: None
1756+
yerr : scalar or array-like, optional, default: None
17571757
if not None, will be used to generate errorbar(s) on the bar chart
17581758
17591759
ecolor : scalar or array-like, optional, default: None
@@ -1779,7 +1779,7 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
17791779
17801780
Returns
17811781
-------
1782-
:class:`matplotlib.patches.Rectangle` instances.
1782+
`matplotlib.patches.Rectangle` instances.
17831783
17841784
Notes
17851785
-----
@@ -1795,6 +1795,13 @@ def bar(self, left, height, width=0.8, bottom=None, **kwargs):
17951795
17961796
%(Rectangle)s
17971797
1798+
See also
1799+
--------
1800+
barh: Plot a horizontal bar plot.
1801+
1802+
Example
1803+
-------
1804+
17981805
**Example:** A stacked bar chart.
17991806
18001807
.. plot:: mpl_examples/pylab_examples/bar_stacked.py
@@ -2007,68 +2014,88 @@ def barh(self, bottom, width, height=0.8, left=None, **kwargs):
20072014
"""
20082015
Make a horizontal bar plot.
20092016
2010-
Call signature::
2011-
2012-
barh(bottom, width, height=0.8, left=0, **kwargs)
2013-
20142017
Make a horizontal bar plot with rectangles bounded by:
20152018
2016-
*left*, *left* + *width*, *bottom*, *bottom* + *height*
2019+
`left`, `left` + `width`, `bottom`, `bottom` + `height`
20172020
(left, right, bottom and top edges)
20182021
2019-
*bottom*, *width*, *height*, and *left* can be either scalars
2022+
`bottom`, `width`, `height`, and `left` can be either scalars
20202023
or sequences
20212024
2022-
Return value is a list of
2023-
:class:`matplotlib.patches.Rectangle` instances.
2025+
Parameters
2026+
----------
2027+
bottom : scalar or array-like
2028+
the y coordinate(s) of the bars
20242029
2025-
Required arguments:
2030+
width : scalar or array-like
2031+
the width(s) of the bars
20262032
2027-
======== ======================================================
2028-
Argument Description
2029-
======== ======================================================
2030-
*bottom* the vertical positions of the bottom edges of the bars
2031-
*width* the lengths of the bars
2032-
======== ======================================================
2033+
height : sequence of scalars, optional, default: 0.8
2034+
the heights of the bars
20332035
2034-
Optional keyword arguments:
2036+
left : sequence of scalars
2037+
the x coordinates of the left sides of the bars
20352038
2036-
=============== ==========================================
2037-
Keyword Description
2038-
=============== ==========================================
2039-
*height* the heights (thicknesses) of the bars
2040-
*left* the x coordinates of the left edges of the
2041-
bars
2042-
*color* the colors of the bars
2043-
*edgecolor* the colors of the bar edges
2044-
*linewidth* width of bar edges; None means use default
2045-
linewidth; 0 means don't draw edges.
2046-
*xerr* if not None, will be used to generate
2047-
errorbars on the bar chart
2048-
*yerr* if not None, will be used to generate
2049-
errorbars on the bar chart
2050-
*ecolor* specifies the color of any errorbar
2051-
*capsize* (default 3) determines the length in
2052-
points of the error bar caps
2053-
*align* 'edge' (default) | 'center'
2054-
*log* [False|True] False (default) leaves the
2055-
horizontal axis as-is; True sets it to log
2056-
scale
2057-
=============== ==========================================
2058-
2059-
Setting *align* = 'edge' aligns bars by their bottom edges in
2060-
bottom, while *align* = 'center' interprets these values as
2061-
the *y* coordinates of the bar centers.
2062-
2063-
The optional arguments *color*, *edgecolor*, *linewidth*,
2064-
*xerr*, and *yerr* can be either scalars or sequences of
2039+
Returns
2040+
--------
2041+
`matplotlib.patches.Rectangle` instances.
2042+
2043+
Other parameters
2044+
----------------
2045+
color : scalar or array-like, optional
2046+
the colors of the bars
2047+
2048+
edgecolor : scalar or array-like, optional
2049+
the colors of the bar edges
2050+
2051+
linewidth : scalar or array-like, optional, default: None
2052+
width of bar edge(s). If None, use default
2053+
linewidth; If 0, don't draw edges.
2054+
2055+
xerr : scalar or array-like, optional, default: None
2056+
if not None, will be used to generate errorbar(s) on the bar chart
2057+
2058+
yerr : scalar or array-like, optional, default: None
2059+
if not None, will be used to generate errorbar(s) on the bar chart
2060+
2061+
ecolor : scalar or array-like, optional, default: None
2062+
specifies the color of errorbar(s)
2063+
2064+
capsize : integer, optional, default: 3
2065+
determines the length in points of the error bar caps
2066+
2067+
error_kw :
2068+
dictionary of kwargs to be passed to errorbar method. `ecolor` and
2069+
`capsize` may be specified here rather than as independent kwargs.
2070+
2071+
align : ['edge' | 'center'], optional, default: 'edge'
2072+
If `edge`, aligns bars by their left edges (for vertical bars) and
2073+
by their bottom edges (for horizontal bars). If `center`, interpret
2074+
the `left` argument as the coordinates of the centers of the bars.
2075+
2076+
orientation : 'vertical' | 'horizontal', optional, default: 'vertical'
2077+
The orientation of the bars.
2078+
2079+
log : boolean, optional, default: False
2080+
If true, sets the axis to be log scale
2081+
2082+
Notes
2083+
-----
2084+
The optional arguments `color`, `edgecolor`, `linewidth`,
2085+
`xerr`, and `yerr` can be either scalars or sequences of
20652086
length equal to the number of bars. This enables you to use
2066-
barh as the basis for stacked bar charts, or candlestick
2067-
plots.
2087+
bar as the basis for stacked bar charts, or candlestick plots.
2088+
Detail: `xerr` and `yerr` are passed directly to
2089+
:meth:`errorbar`, so they can also have shape 2xN for
2090+
independent specification of lower and upper errors.
20682091
2069-
other optional kwargs:
2092+
Other optional kwargs:
20702093
20712094
%(Rectangle)s
2095+
2096+
See also
2097+
--------
2098+
bar: Plot a vertical bar plot.
20722099
"""
20732100

20742101
patches = self.bar(left=left, height=height, width=width,

0 commit comments

Comments
 (0)