hvPlot.errorbars#

hvPlot.errorbars(x=None, y=None, yerr1=None, yerr2=None, **kwds)[source]#

errorbars provide a visual indicator for the variability of the plotted data on a graph. They are usually overlaid with other plots such as scatter , line or bar plots to indicate the variability.

Reference: https://hvplot.holoviz.org/ref/api/manual/hvplot.hvPlot.errorbars.html

Plotting options: https://hvplot.holoviz.org/ref/plotting_options/index.html

Parameters:
xstring, optional

Field name to draw the x-position from. If not specified, the index is used. Can refer to continuous and categorical data.

ystring, optional

Field name to draw the y-position from

yerr1string, optional

Field name to draw symmetric / negative errors from

yerr2string, optional

Field name to draw positive errors from

**kwdsoptional

Additional keywords arguments are documented in Plotting Options. Run hvplot.help('errorbars') for the full method documentation.

Returns:
holoviews.element.ErrorBars / Panel object

You 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

Backend-specific styling options#

alpha, color, line_alpha, line_cap, line_color, line_dash, line_dash_offset, line_join, line_width, lower_head, muted, upper_head, visible

alpha, barsabove, c, capsize, capthick, color, dashes, ec, ecolor, edgecolor, elinewidth, errorevery, linestyle, linewidth, lolims, lw, markeredgecolor, markeredgewidth, markerfacecolor, markersize, mec, mew, mfc, ms, solid_capstyle, solid_joinstyle, uplims, xlolims, xuplims

Examples#

Basic error bars plot#

Error bars are usually overlaid on another plot using the * operator. We set yerr1 to a variable. When only yerr1 is set and not yerr2, it is displayed as the symmetric error.

import hvplot.pandas  # noqa
import pandas as pd

df = pd.DataFrame({"x": range(1, 4), "y": [1, 3, 2], "yerr": [0.2, 0.8, 0.5]})

df.hvplot.scatter(x="x", y="y") *\
df.hvplot.errorbars(x="x", y="y", yerr1="yerr")

Use of yerr1 and yerr2#

When both yerr1 and yerr2 are set, yerr1 is displayed as the negative error and yerr2 as the positive error, both as the distance from the center.

import hvplot.pandas  # noqa
import pandas as pd

df = pd.DataFrame({"x": range(1, 4), "y": [1, 3, 2], "yerr1": 0.5, "yerr2": 1})

df.hvplot.scatter(x="x", y="y") *\
df.hvplot.errorbars(x="x", y="y", yerr1="yerr1", yerr2="yerr2")

Inverted error bars#

import hvplot.pandas  # noqa
import pandas as pd

df = pd.DataFrame({"x": range(1, 4), "y": [1, 3, 2], "yerr": 0.5})

df.hvplot.scatter(x="x", y="y") *\
df.hvplot.errorbars(x="x", y="y", yerr1="yerr", invert=True)

Bar plot with error bars#

import hvplot.pandas  # noqa
import pandas as pd

df = pd.DataFrame({"x": ["A", "B", "C"], "y": [1, 3, 2], "yerr": 0.5})

df.hvplot.bar(x="x", y="y", alpha=0.5) *\
df.hvplot.errorbars(x="x", y="y", yerr1="yerr")
import hvplot.pandas  # noqa
import pandas as pd

df = pd.DataFrame({"x": ["A", "B", "C"], "y": [1, 3, 2], "yerr": 0.5})

df.hvplot.barh(x="x", y="y", alpha=0.5) *\
df.hvplot.errorbars(x="x", y="y", yerr1="yerr")
This web page was generated from a Jupyter notebook and not all interactivity will work on this website.