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)
| 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 | ------- |