@@ -1877,102 +1877,88 @@ def bar(self, *args, **kwargs):
1877
1877
bar(x, height, width, *, align='center', **kwargs)
1878
1878
bar(x, height, width, bottom, *, align='center', **kwargs)
1879
1879
1880
- Make a bar plot with rectangles bounded by
1880
+ The bars are positioned at *x* with the given *align*\ ment. Their
1881
+ dimensions are given by *width* and *height*. The vertical baseline
1882
+ is *bottom* (default 0).
1881
1883
1882
- .. math::
1883
-
1884
- (x - width/2, x + width/2, bottom, bottom + height)
1885
-
1886
- (left, right, bottom and top edges) by default. *x*,
1887
- *height*, *width*, and *bottom* can be either scalars or
1888
- sequences.
1884
+ Each of *x*, *height*, *width*, and *bottom* may either be a scalar
1885
+ applying to all bars, or it may be a sequence of length N providing a
1886
+ separate value for each bar.
1889
1887
1890
- The *align* and *orientation* kwargs control the interpretation of *x*
1891
- and *bottom*
1892
-
1893
- The *align* keyword-only argument controls if *x* is interpreted
1894
- as the center or the left edge of the rectangle.
1895
1888
1896
1889
Parameters
1897
1890
----------
1898
1891
x : sequence of scalars
1899
- the x coordinates of the bars.
1900
-
1901
- *align* controls if *x* is the bar center (default) or
1902
- left edge.
1892
+ The x coordinates of the bars. See also *align* for the
1893
+ alignment of the bars to the coordinates.
1903
1894
1904
1895
height : scalar or sequence of scalars
1905
- the height(s) of the bars
1896
+ The height(s) of the bars.
1906
1897
1907
1898
width : scalar or array-like, optional
1908
- the width(s) of the bars
1909
- default: 0.8
1899
+ The width(s) of the bars (default: 0.8).
1910
1900
1911
1901
bottom : scalar or array-like, optional
1912
- the y coordinate(s) of the bars
1913
- default: None
1902
+ The y coordinate(s) of the bars bases (default: 0).
1914
1903
1915
1904
align : {'center', 'edge'}, optional, default: 'center'
1916
- If 'center', interpret the *x* argument as the coordinates
1917
- of the centers of the bars. If 'edge', aligns bars by
1918
- their left edges
1905
+ Alignment of the bars to the *x* coordinates:
1919
1906
1920
- To align the bars on the right edge pass a negative
1921
- *width* and ``align='edge'``
1907
+ - 'center': Center the base on the *x* positions.
1908
+ - 'edge': Align the left edges of the bars with the *x* positions.
1909
+
1910
+ To align the bars on the right edge pass a negative *width* and
1911
+ ``align='edge'``.
1922
1912
1923
1913
Returns
1924
1914
-------
1925
- bars : matplotlib.container. BarContainer
1926
- Container with all of the bars + errorbars
1915
+ `~. BarContainer`
1916
+ Container with all the bars and optionally errorbars.
1927
1917
1928
1918
Other Parameters
1929
1919
----------------
1930
1920
color : scalar or array-like, optional
1931
- the colors of the bar faces
1921
+ The colors of the bar faces.
1932
1922
1933
1923
edgecolor : scalar or array-like, optional
1934
- the colors of the bar edges
1924
+ The colors of the bar edges.
1935
1925
1936
1926
linewidth : scalar or array-like, optional
1937
- width of bar edge(s). If None, use default
1938
- linewidth; If 0, don't draw edges.
1939
- default: None
1927
+ Width of the bar edge(s). If 0, don't draw edges.
1940
1928
1941
1929
tick_label : string or array-like, optional
1942
- the tick labels of the bars
1943
- default: None
1930
+ The tick labels of the bars.
1931
+ Default: None (Use default numeric labels.)
1932
+
1933
+ xerr, yerr : scalar or array-like of shape(N,) or shape(2,N), optional
1934
+ If not *None*, add horizontal / vertical errorbars to the bar tips.
1935
+ The values are +/- sizes relative to the data:
1944
1936
1945
- xerr : scalar or array-like, optional
1946
- if not None, will be used to generate errorbar(s) on the bar chart
1947
- default: None
1937
+ - scalar: symmetric +/- values for all bars
1938
+ - shape(N,): symmetric +/- values for each bar
1939
+ - shape(2,N): separate + and - values for each bar
1948
1940
1949
- yerr : scalar or array-like, optional
1950
- if not None, will be used to generate errorbar(s) on the bar chart
1951
- default: None
1941
+ Default: None
1952
1942
1953
- ecolor : scalar or array-like, optional
1954
- specifies the color of errorbar(s)
1955
- default: None
1943
+ ecolor : scalar or array-like, optional, default: 'black'
1944
+ The line color of the errorbars.
1956
1945
1957
1946
capsize : scalar, optional
1958
- determines the length in points of the error bar caps
1959
- default : None, which will take the value from the
1947
+ The length of the error bar caps in points.
1948
+ Default : None, which will take the value from the
1960
1949
``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.
1961
1950
1962
1951
error_kw : dict, optional
1963
- dictionary of kwargs to be passed to errorbar method. *ecolor* and
1964
- *capsize* may be specified here rather than as independent kwargs.
1952
+ Dictionary of kwargs to be passed to the `~.Axes.errorbar`
1953
+ method. Values of *ecolor* or *capsize* defined here take
1954
+ precedence over the independent kwargs.
1965
1955
1966
- log : boolean, optional
1967
- If true, sets the axis to be log scale.
1968
- default: False
1956
+ log : bool, optional, default: False
1957
+ If *True*, set the y-axis to be log scale.
1969
1958
1970
1959
orientation : {'vertical', 'horizontal'}, optional
1971
-
1972
- This is for internal use, please do not directly use this,
1973
- call `barh` instead.
1974
-
1975
- The orientation of the bars.
1960
+ *This is for internal use only.* Please use `barh` for
1961
+ horizontal bar plots. Default: 'vertical'.
1976
1962
1977
1963
See also
1978
1964
--------
@@ -2208,83 +2194,85 @@ def barh(self, *args, **kwargs):
2208
2194
bar(y, width, height, *, align='center', **kwargs)
2209
2195
bar(y, width, height, left, *, align='center', **kwargs)
2210
2196
2211
- Make a horizontal bar plot with rectangles by default bounded by
2197
+ The bars are positioned at *y* with the given *align*\ ment. Their
2198
+ dimensions are given by *width* and *height*. The horizontal baseline
2199
+ is *left* (default 0).
2212
2200
2213
- .. math::
2214
-
2215
- (left, left + width, y - height/2, y + height/2)
2216
-
2217
- (left, right, bottom and top edges) by default. *y*, *width*,
2218
- *height*, and *left* can be either scalars or sequences.
2219
-
2220
- The *align* keyword-only argument controls if *y* is interpreted
2221
- as the center or the bottom edge of the rectangle.
2201
+ Each of *y*, *width*, *height*, and *left* may either be a scalar
2202
+ applying to all bars, or it may be a sequence of length N providing a
2203
+ separate value for each bar.
2222
2204
2223
2205
2224
2206
Parameters
2225
2207
----------
2226
2208
y : scalar or array-like
2227
- the y coordinate(s) of the bars
2228
-
2229
- *align* controls if *y* is the bar center (default)
2230
- or bottom edge.
2209
+ The y coordinates of the bars. See also *align* for the
2210
+ alignment of the bars to the coordinates.
2231
2211
2232
2212
width : scalar or array-like
2233
- the width(s) of the bars
2213
+ The width(s) of the bars.
2234
2214
2235
2215
height : sequence of scalars, optional, default: 0.8
2236
- the heights of the bars
2216
+ The heights of the bars.
2237
2217
2238
2218
left : sequence of scalars
2239
- the x coordinates of the left sides of the bars
2219
+ The x coordinates of the left sides of the bars (default: 0).
2240
2220
2241
2221
align : {'center', 'edge'}, optional, default: 'center'
2242
- If 'center', interpret the *y* argument as the coordinates
2243
- of the centers of the bars. If 'edge', aligns bars by
2244
- their bottom edges
2222
+ Alignment of the base to the *y* coordinates*:
2245
2223
2246
- To align the bars on the top edge pass a negative
2247
- *height* and ``align='edge'``
2224
+ - 'center': Center the bars on the *y* positions.
2225
+ - 'edge': Align the bottom edges of the bars with the *y*
2226
+ positions.
2227
+
2228
+ To align the bars on the top edge pass a negative *height* and
2229
+ ``align='edge'``.
2248
2230
2249
2231
Returns
2250
2232
-------
2251
- `matplotlib.patches.Rectangle` instances.
2233
+ `~.BarContainer`
2234
+ Container with all the bars and optionally errorbars.
2252
2235
2253
2236
Other Parameters
2254
2237
----------------
2255
2238
color : scalar or array-like, optional
2256
- the colors of the bars
2239
+ The colors of the bar faces.
2257
2240
2258
2241
edgecolor : scalar or array-like, optional
2259
- the colors of the bar edges
2242
+ The colors of the bar edges.
2260
2243
2261
- linewidth : scalar or array-like, optional, default: None
2262
- width of bar edge(s). If None, use default
2263
- linewidth; If 0, don't draw edges.
2244
+ linewidth : scalar or array-like, optional
2245
+ Width of the bar edge(s). If 0, don't draw edges.
2264
2246
2265
- tick_label : string or array-like, optional, default: None
2266
- the tick labels of the bars
2247
+ tick_label : string or array-like, optional
2248
+ The tick labels of the bars.
2249
+ Default: None (Use default numeric labels.)
2267
2250
2268
- xerr : scalar or array-like, optional, default: None
2269
- if not None, will be used to generate errorbar(s) on the bar chart
2251
+ xerr, yerr : scalar or array-like of shape(N,) or shape(2,N), optional
2252
+ If not *None*, add horizontal / vertical errorbars to the bar tips.
2253
+ The values are +/- sizes relative to the data:
2270
2254
2271
- yerr : scalar or array-like, optional, default: None
2272
- if not None, will be used to generate errorbar(s) on the bar chart
2255
+ - scalar: symmetric +/- values for all bars
2256
+ - shape(N,): symmetric +/- values for each bar
2257
+ - shape(2,N): separate + and - values for each bar
2273
2258
2274
- ecolor : scalar or array-like, optional, default: None
2275
- specifies the color of errorbar(s)
2259
+ Default: None
2260
+
2261
+ ecolor : scalar or array-like, optional, default: 'black'
2262
+ The line color of the errorbars.
2276
2263
2277
2264
capsize : scalar, optional
2278
- determines the length in points of the error bar caps
2279
- default : None, which will take the value from the
2265
+ The length of the error bar caps in points.
2266
+ Default : None, which will take the value from the
2280
2267
``errorbar.capsize`` :data:`rcParam<matplotlib.rcParams>`.
2281
2268
2282
- error_kw :
2283
- dictionary of kwargs to be passed to errorbar method. `ecolor` and
2284
- `capsize` may be specified here rather than as independent kwargs.
2269
+ error_kw : dict, optional
2270
+ Dictionary of kwargs to be passed to the `~.Axes.errorbar`
2271
+ method. Values of *ecolor* or *capsize* defined here take
2272
+ precedence over the independent kwargs.
2285
2273
2286
- log : boolean , optional, default: False
2287
- If true, sets the axis to be log scale
2274
+ log : bool , optional, default: False
2275
+ If *True*, set the x- axis to be log scale.
2288
2276
2289
2277
See also
2290
2278
--------
0 commit comments