matplotlib
Fork me on GitHub


Travis-CI:

This Page

matplotlib.pyplot.barh

matplotlib.pyplot.barh(*args, **kwargs)

Make a horizontal bar plot.

Call signatures:

bar(y, width, *, align='center', **kwargs)
bar(y, width, height, *, align='center', **kwargs)
bar(y, width, height, left, *, align='center', **kwargs)

Make a horizontal bar plot with rectangles by default bounded by

(left, right, bottom and top edges) by default. y, width, height, and left can be either scalars or sequences.

The align keyword-only argument controls if y is interpreted as the center or the bottom edge of the rectangle.

Parameters:

y : scalar or array-like

the y coordinate(s) of the bars

align controls if y is the bar center (default) or bottom edge.

width : scalar or array-like

the width(s) of the bars

height : sequence of scalars, optional, default: 0.8

the heights of the bars

left : sequence of scalars

the x coordinates of the left sides of the bars

align : {‘center’, ‘edge’}, optional, default: ‘center’

If ‘center’, interpret the y argument as the coordinates of the centers of the bars. If ‘edge’, aligns bars by their bottom edges

To align the bars on the top edge pass a negative height and align='edge'

Returns:

matplotlib.patches.Rectangle instances.

Other Parameters:
 

color : scalar or array-like, optional

the colors of the bars

edgecolor : scalar or array-like, optional

the colors of the bar edges

linewidth : scalar or array-like, optional, default: None

width of bar edge(s). If None, use default linewidth; If 0, don’t draw edges.

tick_label : string or array-like, optional, default: None

the tick labels of the bars

xerr : scalar or array-like, optional, default: None

if not None, will be used to generate errorbar(s) on the bar chart

yerr : scalar or array-like, optional, default: None

if not None, will be used to generate errorbar(s) on the bar chart

ecolor : scalar or array-like, optional, default: None

specifies the color of errorbar(s)

capsize : scalar, optional

determines the length in points of the error bar caps default: None, which will take the value from the errorbar.capsize rcParam.

error_kw :

dictionary of kwargs to be passed to errorbar method. ecolor and capsize may be specified here rather than as independent kwargs.

log : boolean, optional, default: False

If true, sets the axis to be log scale

See also

bar
Plot a vertical bar plot.

Notes

The optional arguments color, edgecolor, linewidth, xerr, and yerr can be either scalars or sequences of length equal to the number of bars. This enables you to use bar as the basis for stacked bar charts, or candlestick plots. Detail: xerr and yerr are passed directly to errorbar(), so they can also have shape 2xN for independent specification of lower and upper errors.

Other optional kwargs:

Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha float or None
animated bool
antialiased or aa [True | False] or None for default
capstyle [‘butt’ | ‘round’ | ‘projecting’]
clip_box a Bbox instance
clip_on bool
clip_path [(Path, Transform) | Patch | None]
color matplotlib color spec
contains a callable function
edgecolor or ec mpl color spec, None, ‘none’, or ‘auto’
facecolor or fc mpl color spec, or None for default, or ‘none’ for no color
figure a Figure instance
fill [True | False]
gid an id string
hatch [‘/’ | ‘' | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle [‘miter’ | ‘round’ | ‘bevel’]
label object
linestyle or ls [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-' | '--' | '-.' | ':' | 'None' | ' ' | '']
linewidth or lw float or None for default
path_effects AbstractPathEffect
picker [None | bool | float | callable]
rasterized bool or None
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url a url string
visible bool
zorder float