hvPlot.barh#
- hvPlot.barh(x=None, y=None, stacked=False, **kwds)[source]#
A horizontal bar plot
A barh plot represents categorical data with rectangular bars with heights proportional to the values that they represent. The y-axis of the chart plots categories and the x-axis represents the value scale. The bars are of equal width which allows for instant comparison of data.
barh can be used on dataframes with regular Index or MultiIndex.
Reference: https://hvplot.holoviz.org/reference/tabular/barh.html
- Parameters:
- stackedbool, optional
If True, creates a stacked horizontal bar plot. Default is False.
- **kwdsoptional
Additional keywords arguments are documented in hvplot.help(‘barh’). See Plotting Options for more information.
- Returns:
holoviews.element.Bars
/ Panel objectYou can print the object to study its composition and run:
import holoviews as hv hv.help(the_holoviews_object)
to learn more about its parameters and options.
References
Bokeh: https://docs.bokeh.org/en/latest/docs/reference/models/glyphs/hbar.html
HoloViews: https://holoviews.org/reference/elements/bokeh/Bars.html
Matplotlib: https://matplotlib.org/stable/gallery/lines_bars_and_markers/barh.html
Plotly: https://plotly.com/python/horizontal-bar-charts/
Wiki: https://en.wikipedia.org/wiki/Bar_chart
Examples
import hvplot.pandas import pandas as pd df = pd.DataFrame( { "speed": [0.1, 17.5, 40, 48, 52, 69, 88], "lifespan": [2, 8, 70, 1.5, 25, 12, 28], }, index=["snail", "pig", "elephant", "rabbit", "giraffe", "coyote", "horse"], ) df.hvplot.barh(color=["#457278", "#615078"])
You can stack the bars by setting stacked=True
df.hvplot.barh(stacked=True, color=["#457278", "#615078"])
Backend-specific styling options#
alpha, bar_width, cmap, color, fill_alpha, fill_color, hover_alpha, hover_color, hover_fill_alpha, hover_fill_color, hover_line_alpha, hover_line_cap, hover_line_color, hover_line_dash, hover_line_dash_offset, hover_line_join, hover_line_width, line_alpha, line_cap, line_color, line_dash, line_dash_offset, line_join, line_width, muted, muted_alpha, muted_color, muted_fill_alpha, muted_fill_color, muted_line_alpha, muted_line_cap, muted_line_color, muted_line_dash, muted_line_dash_offset, muted_line_join, muted_line_width, nonselection_alpha, nonselection_color, nonselection_fill_alpha, nonselection_fill_color, nonselection_line_alpha, nonselection_line_cap, nonselection_line_color, nonselection_line_dash, nonselection_line_dash_offset, nonselection_line_join, nonselection_line_width, selection_alpha, selection_color, selection_fill_alpha, selection_fill_color, selection_line_alpha, selection_line_cap, selection_line_color, selection_line_dash, selection_line_dash_offset, selection_line_join, selection_line_width, visible
align, alpha, c, capsize, color, ec, ecolor, edgecolor, error_kw, facecolor, fc, hatch, log, visible
Examples#
TBD