Bar Chart with Error Bars#

This example overlays a bar cgart of the mean bill length of a set of penguins per island with error bars computed from their standard deviation.

import hvplot.pandas  # noqa

df = hvplot.sampledata.penguins("pandas")
df = df.groupby("island").agg({"bill_length_mm": ["mean", "std"]})
df.columns = df.columns.droplevel(0)

bar = df.hvplot.bar(y="mean", alpha=0.5)
errorbars = df.hvplot.errorbars(
    y="mean",
    yerr1="std",
    ylabel="Bill Length (mm)",
    title="Bar Chart with Error Bars (Bokeh)",
)
bar * errorbars
import hvplot.pandas  # noqa
hvplot.extension("matplotlib")

df = hvplot.sampledata.penguins("pandas")
df = df.groupby("island").agg({"bill_length_mm": ["mean", "std"]})
df.columns = df.columns.droplevel(0)

bar = df.hvplot.bar(y="mean")
errorbars = df.hvplot.errorbars(
    y="mean",
    yerr1="std",
    ylabel="Bill Length (mm)",
    title="Bar Chart with Error Bars (Matplotlib)",
)
bar * errorbars
This web page was generated from a Jupyter notebook and not all interactivity will work on this website.