MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / barh

Method barh

lib/matplotlib/axes/_axes.py:2659–2796  ·  view source on GitHub ↗

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

(self, y, width, height=0.8, left=None, *, align="center",
             data=None, **kwargs)

Source from the content-addressed store, hash-verified

2657 # @_preprocess_data() # let 'bar' do the unpacking..
2658 @_docstring.interpd
2659 def barh(self, y, width, height=0.8, left=None, *, align="center",
2660 data=None, **kwargs):
2661 r"""
2662 Make a horizontal bar plot.
2663
2664 The bars are positioned at *y* with the given *align*\ment. Their
2665 dimensions are given by *width* and *height*. The horizontal baseline
2666 is *left* (default 0).
2667
2668 Many parameters can take either a single value applying to all bars
2669 or a sequence of values, one for each bar.
2670
2671 Parameters
2672 ----------
2673 y : float or array-like
2674 The y coordinates of the bars. See also *align* for the
2675 alignment of the bars to the coordinates.
2676
2677 Bars are often used for categorical data, i.e. string labels below
2678 the bars. You can provide a list of strings directly to *y*.
2679 ``barh(['A', 'B', 'C'], [1, 2, 3])`` is often a shorter and more
2680 convenient notation compared to
2681 ``barh(range(3), [1, 2, 3], tick_label=['A', 'B', 'C'])``. They are
2682 equivalent as long as the names are unique. The explicit *tick_label*
2683 notation draws the names in the sequence given. However, when having
2684 duplicate values in categorical *y* data, these values map to the same
2685 numerical y coordinate, and hence the corresponding bars are drawn on
2686 top of each other.
2687
2688 width : float or array-like
2689 The width(s) of the bars.
2690
2691 Note that if *left* has units (e.g. datetime), *width* should be in
2692 units that are a difference from the value of *left* (e.g. timedelta).
2693
2694 height : float or array-like, default: 0.8
2695 The heights of the bars.
2696
2697 Note that if *y* has units (e.g. datetime), then *height* should be in
2698 units that are a difference (e.g. timedelta) around the *y* values.
2699
2700 left : float or array-like, default: 0
2701 The x coordinates of the left side(s) of the bars.
2702
2703 Note that if *left* has units, then the x-axis will get a Locator and
2704 Formatter appropriate for the units (e.g. dates, or categorical).
2705
2706 align : {'center', 'edge'}, default: 'center'
2707 Alignment of the base to the *y* coordinates*:
2708
2709 - 'center': Center the bars on the *y* positions.
2710 - 'edge': Align the bottom edges of the bars with the *y*
2711 positions.
2712
2713 To align the bars on the top edge pass a negative *height* and
2714 ``align='edge'``.
2715
2716 Returns

Callers 15

grouped_barMethod · 0.95
barhFunction · 0.80
test_jpl_barh_unitsFunction · 0.80
test_barhMethod · 0.80
test_sticky_toleranceFunction · 0.80
test_barh_decimal_centerFunction · 0.80
test_barh_decimal_heightFunction · 0.80
test_barh_tick_labelFunction · 0.80
test_bar_timedeltaFunction · 0.80
test_bar_datetime_startFunction · 0.80
test_axes_marginsFunction · 0.80

Calls 1

barMethod · 0.95

Tested by 15

test_jpl_barh_unitsFunction · 0.64
test_barhMethod · 0.64
test_sticky_toleranceFunction · 0.64
test_barh_decimal_centerFunction · 0.64
test_barh_decimal_heightFunction · 0.64
test_barh_tick_labelFunction · 0.64
test_bar_timedeltaFunction · 0.64
test_bar_datetime_startFunction · 0.64
test_axes_marginsFunction · 0.64
test_bar_broadcast_argsFunction · 0.64