Groupby with Widget#

An interactive scatter plot of penguins grouped by island. When groupby is set a widget (or multiple if groupby is set to a list of variables) is displayed and updating its value re-renders the plot showing another slice of the dataset.

import hvplot.pandas  # noqa

df = hvplot.sampledata.penguins("pandas").dropna()

df.hvplot.scatter(
    x='bill_length_mm',
    y='flipper_length_mm',
    color='sex',
    groupby='island',
    title='Penguins size by Sex',
    xlabel='Bill Length (mm)',
    ylabel='Flipper Length (mm)',
    dynamic=False,
    framewise=False,
    frame_width=300,
)
import hvplot.pandas  # noqa
hvplot.extension('matplotlib')

df = hvplot.sampledata.penguins('pandas').dropna()

df.hvplot.scatter(
    x='bill_length_mm',
    y='flipper_length_mm',
    color='sex',
    groupby='island',
    title='Penguins size by Sex',
    xlabel='Bill Length (mm)',
    ylabel='Flipper Length (mm)',
    dynamic=False,
    framewise=False,
    width=200,
    height=200,
)

See also

This web page was generated from a Jupyter notebook and not all interactivity will work on this website.