Simple Box Plot#

A simple box and whisker plot for visualizing the distribution and spread of numeric values grouped by category. This example shows how to create a box plot using a small dataset with categories.

import pandas as pd
import numpy as np
import hvplot.pandas  # noqa

np.random.seed(0)
df = pd.DataFrame({
    'group': np.random.choice(['A', 'B', 'C'], size=100),
    'score': np.random.normal(loc=75, scale=10, size=100)
})

df.hvplot.box(y='score', by='group', title='Simple Box Plot (Bokeh)')
import pandas as pd
import numpy as np
import hvplot.pandas  # noqa
hvplot.extension('matplotlib')

np.random.seed(0)
df = pd.DataFrame({
    'group': np.random.choice(['A', 'B', 'C'], size=100),
    'score': np.random.normal(loc=75, scale=10, size=100)
})

df.hvplot.box(y='score', by='group', title='Simple Box Plot (Matplotlib)')
This web page was generated from a Jupyter notebook and not all interactivity will work on this website.