Box#
import hvplot.pandas # noqa
box
plots are most useful when grouped by additional dimensions.
from bokeh.sampledata.sprint import sprint as df
df.head()
Name | Country | Medal | Time | Year | |
---|---|---|---|---|---|
0 | Usain Bolt | JAM | GOLD | 9.63 | 2012 |
1 | Yohan Blake | JAM | SILVER | 9.75 | 2012 |
2 | Justin Gatlin | USA | BRONZE | 9.79 | 2012 |
3 | Usain Bolt | JAM | GOLD | 9.69 | 2008 |
4 | Richard Thompson | TRI | SILVER | 9.89 | 2008 |
boxplot = df.hvplot.box(y='Time', by='Medal', height=400, width=400, legend=False)
boxplot
Overlay this plot with the jittered scatter plot of the medalist times using the *
operator:
boxplot * df.hvplot.scatter(y='Time', x='Medal', c='orange').opts(jitter=0.5)
Use groupby
to create a separate plot for each medal type with a widget for selecting between the plots.
df.hvplot.box(y='Time', groupby='Medal', by='Country', ylabel='Sprint Time', height=400, width=600)
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.