MCPcopy
hub / github.com/matplotlib/matplotlib / bar

Method bar

lib/matplotlib/axes/_axes.py:2307–2655  ·  view source on GitHub ↗

r""" Make a bar plot. The bars are positioned at *x* with the given *align*\ment. Their dimensions are given by *height* and *width*. The vertical baseline is *bottom* (default 0). Many parameters can take either a single value applying to all bars o

(self, x, height, width=0.8, bottom=None, *, align="center",
            **kwargs)

Source from the content-addressed store, hash-verified

2305 @_preprocess_data()
2306 @_docstring.interpd
2307 def bar(self, x, height, width=0.8, bottom=None, *, align="center",
2308 **kwargs):
2309 r"""
2310 Make a bar plot.
2311
2312 The bars are positioned at *x* with the given *align*\ment. Their
2313 dimensions are given by *height* and *width*. The vertical baseline
2314 is *bottom* (default 0).
2315
2316 Many parameters can take either a single value applying to all bars
2317 or a sequence of values, one for each bar.
2318
2319 Parameters
2320 ----------
2321 x : float or array-like
2322 The x coordinates of the bars. See also *align* for the
2323 alignment of the bars to the coordinates.
2324
2325 Bars are often used for categorical data, i.e. string labels below
2326 the bars. You can provide a list of strings directly to *x*.
2327 ``bar(['A', 'B', 'C'], [1, 2, 3])`` is often a shorter and more
2328 convenient notation compared to
2329 ``bar(range(3), [1, 2, 3], tick_label=['A', 'B', 'C'])``. They are
2330 equivalent as long as the names are unique. The explicit *tick_label*
2331 notation draws the names in the sequence given. However, when having
2332 duplicate values in categorical *x* data, these values map to the same
2333 numerical x coordinate, and hence the corresponding bars are drawn on
2334 top of each other.
2335
2336 height : float or array-like
2337 The height(s) of the bars.
2338
2339 Note that if *bottom* has units (e.g. datetime), *height* should be in
2340 units that are a difference from the value of *bottom* (e.g. timedelta).
2341
2342 width : float or array-like, default: 0.8
2343 The width(s) of the bars.
2344
2345 Note that if *x* has units (e.g. datetime), then *width* should be in
2346 units that are a difference (e.g. timedelta) around the *x* values.
2347
2348 bottom : float or array-like, default: 0
2349 The y coordinate(s) of the bottom side(s) of the bars.
2350
2351 Note that if *bottom* has units, then the y-axis will get a Locator and
2352 Formatter appropriate for the units (e.g. dates, or categorical).
2353
2354 align : {'center', 'edge'}, default: 'center'
2355 Alignment of the bars to the *x* coordinates:
2356
2357 - 'center': Center the base on the *x* positions.
2358 - 'edge': Align the left edges of the bars with the *x* positions.
2359
2360 To align the bars on the right edge pass a negative *width* and
2361 ``align='edge'``.
2362
2363 Returns
2364 -------

Callers 15

barhMethod · 0.95
grouped_barMethod · 0.95
make_matplotlib_iconFunction · 0.45
barFunction · 0.45
test_gidFunction · 0.45
plot_hatchFunction · 0.45
test_simpleFunction · 0.45
test_nonstring_labelFunction · 0.45
test_bbox_inches_tightFunction · 0.45
test_jpl_bar_unitsFunction · 0.45
test_barMethod · 0.45

Calls 15

_parse_bar_color_argsMethod · 0.95
_convert_dxMethod · 0.95
get_pathMethod · 0.95
errorbarMethod · 0.95
BarContainerClass · 0.90
_process_unit_infoMethod · 0.80
set_xscaleMethod · 0.80
convert_xunitsMethod · 0.80
convert_yunitsMethod · 0.80
_internal_updateMethod · 0.80
add_patchMethod · 0.80

Tested by 15

test_gidFunction · 0.36
plot_hatchFunction · 0.36
test_simpleFunction · 0.36
test_nonstring_labelFunction · 0.36
test_bbox_inches_tightFunction · 0.36
test_jpl_bar_unitsFunction · 0.36
test_barMethod · 0.36
test_bar_labelMethod · 0.36
test_legend_auto2Function · 0.36