hvPlot.area#
- hvPlot.area(x=None, y=None, y2=None, stacked=True, **kwds)[source]#
The area plot can be used to color the area under a line or to color the space between two lines.
Reference: https://hvplot.holoviz.org/reference/tabular/area.html
- Parameters:
- xstring, optional
Field name(s) to draw x-positions from. If not specified, the index is used. Can refer to continuous and categorical data.
- ystring, optional
Field name to draw the first y-position from
- y2string, optional
Field name to draw the second y-position from
- stackedboolean, optional
Whether to stack multiple areas. Default is True.
- **kwdsoptional
Additional keywords arguments are documented in hvplot.help(‘area’). See Plotting Options for more information.
- Returns:
holoviews.element.Area
/ 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/user_guide/plotting.html#directed-areas
HoloViews: https://holoviews.org/reference/elements/matplotlib/Area.html
Pandas: https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.plot.area.html
Matplotlib: https://matplotlib.org/stable/gallery/lines_bars_and_markers/fill_between_demo.html
Examples
import hvplot.pandas import pandas as pd df = pd.DataFrame( { "actual": [100, 150, 125, 140, 145, 135, 123], "forecast": [90, 160, 125, 150, 141, 141, 120], "numerical": [1.1, 1.9, 3.2, 3.8, 4.3, 5.0, 5.5], "date": pd.date_range("2022-01-03", "2022-01-09"), "string": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], }, ) df["min"] = df[["actual", "forecast"]].min(axis=1) df["max"] = df[["actual", "forecast"]].max(axis=1) area = df.hvplot.area( x="numerical", y="min", y2="max", ylabel="value", legend="bottom", height=500, color=["#55a194"], alpha=0.7, line_width=2, ylim=(0, 200), ) area
Backend-specific styling options#
alpha, 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
alpha, c, capstyle, color, ec, ecolor, edgecolor, facecolor, fc, fill, hatch, interpolate, joinstyle, linestyle, linewidth, lw, step
Examples#
TBD