Penguin Crossfilter#
import numpy as np
import pandas as pd
import panel as pn
import holoviews as hv
import hvplot.pandas # noqa
pn.extension(template='fast')
pn.state.template.logo = 'https://github.com/allisonhorst/palmerpenguins/raw/main/man/figures/logo.png'
Introduction#
welcome = "## Welcome and meet the Palmer penguins!"
penguins_art = pn.pane.PNG('https://raw.githubusercontent.com/allisonhorst/palmerpenguins/main/man/figures/palmerpenguins.png', height=160)
credit = "### Artwork by @allison_horst"
instructions = """
Use the box-select and lasso-select tools to select a subset of penguins
and reveal more information about the selected subgroup through the power
of cross-filtering.
"""
license = """
### License
Data are available by CC-0 license in accordance with the Palmer Station LTER Data Policy and the LTER Data Access Policy for Type I data."
"""
art = pn.Column(
welcome, penguins_art, credit, instructions, license,
sizing_mode='stretch_width'
).servable(area='sidebar')
art
Building some plots#
Let us first load the Palmer penguin dataset (Gorman et al.) which contains measurements about a number of penguin species:
penguins = pd.read_csv('https://datasets.holoviz.org/penguins/v1/penguins.csv')
penguins = penguins[~penguins.sex.isnull()].reset_index().sort_values('species')
penguins
index | species | island | bill_length_mm | bill_depth_mm | flipper_length_mm | body_mass_g | sex | year | |
---|---|---|---|---|---|---|---|---|---|
0 | 0 | Adelie | Torgersen | 39.1 | 18.7 | 181.0 | 3750.0 | male | 2007 |
94 | 100 | Adelie | Biscoe | 35.0 | 17.9 | 192.0 | 3725.0 | female | 2009 |
95 | 101 | Adelie | Biscoe | 41.0 | 20.0 | 203.0 | 4725.0 | male | 2009 |
96 | 102 | Adelie | Biscoe | 37.7 | 16.0 | 183.0 | 3075.0 | female | 2009 |
97 | 103 | Adelie | Biscoe | 37.8 | 20.0 | 190.0 | 4250.0 | male | 2009 |
98 | 104 | Adelie | Biscoe | 37.9 | 18.6 | 193.0 | 2925.0 | female | 2009 |
99 | 105 | Adelie | Biscoe | 39.7 | 18.9 | 184.0 | 3550.0 | male | 2009 |
93 | 99 | Adelie | Dream | 43.2 | 18.5 | 192.0 | 4100.0 | male | 2008 |
100 | 106 | Adelie | Biscoe | 38.6 | 17.2 | 199.0 | 3750.0 | female | 2009 |
102 | 108 | Adelie | Biscoe | 38.1 | 17.0 | 181.0 | 3175.0 | female | 2009 |
103 | 109 | Adelie | Biscoe | 43.2 | 19.0 | 197.0 | 4775.0 | male | 2009 |
104 | 110 | Adelie | Biscoe | 38.1 | 16.5 | 198.0 | 3825.0 | female | 2009 |
106 | 112 | Adelie | Biscoe | 39.7 | 17.7 | 193.0 | 3200.0 | female | 2009 |
107 | 113 | Adelie | Biscoe | 42.2 | 19.5 | 197.0 | 4275.0 | male | 2009 |
108 | 114 | Adelie | Biscoe | 39.6 | 20.7 | 191.0 | 3900.0 | female | 2009 |
101 | 107 | Adelie | Biscoe | 38.2 | 20.0 | 190.0 | 3900.0 | male | 2009 |
92 | 98 | Adelie | Dream | 33.1 | 16.1 | 178.0 | 2900.0 | female | 2008 |
91 | 97 | Adelie | Dream | 40.3 | 18.5 | 196.0 | 4350.0 | male | 2008 |
90 | 96 | Adelie | Dream | 38.1 | 18.6 | 190.0 | 3700.0 | female | 2008 |
75 | 81 | Adelie | Torgersen | 42.9 | 17.6 | 196.0 | 4700.0 | male | 2008 |
76 | 82 | Adelie | Torgersen | 36.7 | 18.8 | 187.0 | 3800.0 | female | 2008 |
77 | 83 | Adelie | Torgersen | 35.1 | 19.4 | 193.0 | 4200.0 | male | 2008 |
78 | 84 | Adelie | Dream | 37.3 | 17.8 | 191.0 | 3350.0 | female | 2008 |
79 | 85 | Adelie | Dream | 41.3 | 20.3 | 194.0 | 3550.0 | male | 2008 |
80 | 86 | Adelie | Dream | 36.3 | 19.5 | 190.0 | 3800.0 | male | 2008 |
81 | 87 | Adelie | Dream | 36.9 | 18.6 | 189.0 | 3500.0 | female | 2008 |
82 | 88 | Adelie | Dream | 38.3 | 19.2 | 189.0 | 3950.0 | male | 2008 |
83 | 89 | Adelie | Dream | 38.9 | 18.8 | 190.0 | 3600.0 | female | 2008 |
84 | 90 | Adelie | Dream | 35.7 | 18.0 | 202.0 | 3550.0 | female | 2008 |
85 | 91 | Adelie | Dream | 41.1 | 18.1 | 205.0 | 4300.0 | male | 2008 |
86 | 92 | Adelie | Dream | 34.0 | 17.1 | 185.0 | 3400.0 | female | 2008 |
87 | 93 | Adelie | Dream | 39.6 | 18.1 | 186.0 | 4450.0 | male | 2008 |
88 | 94 | Adelie | Dream | 36.2 | 17.3 | 187.0 | 3300.0 | female | 2008 |
89 | 95 | Adelie | Dream | 40.8 | 18.9 | 208.0 | 4300.0 | male | 2008 |
109 | 115 | Adelie | Biscoe | 42.7 | 18.3 | 196.0 | 4075.0 | male | 2009 |
74 | 80 | Adelie | Torgersen | 34.6 | 17.2 | 189.0 | 3200.0 | female | 2008 |
110 | 116 | Adelie | Torgersen | 38.6 | 17.0 | 188.0 | 2900.0 | female | 2009 |
112 | 118 | Adelie | Torgersen | 35.7 | 17.0 | 189.0 | 3350.0 | female | 2009 |
132 | 138 | Adelie | Dream | 37.0 | 16.5 | 185.0 | 3400.0 | female | 2009 |
133 | 139 | Adelie | Dream | 39.7 | 17.9 | 193.0 | 4250.0 | male | 2009 |
134 | 140 | Adelie | Dream | 40.2 | 17.1 | 193.0 | 3400.0 | female | 2009 |
135 | 141 | Adelie | Dream | 40.6 | 17.2 | 187.0 | 3475.0 | male | 2009 |
136 | 142 | Adelie | Dream | 32.1 | 15.5 | 188.0 | 3050.0 | female | 2009 |
137 | 143 | Adelie | Dream | 40.7 | 17.0 | 190.0 | 3725.0 | male | 2009 |
131 | 137 | Adelie | Dream | 40.2 | 20.1 | 200.0 | 3975.0 | male | 2009 |
138 | 144 | Adelie | Dream | 37.3 | 16.8 | 192.0 | 3000.0 | female | 2009 |
140 | 146 | Adelie | Dream | 39.2 | 18.6 | 190.0 | 4250.0 | male | 2009 |
141 | 147 | Adelie | Dream | 36.6 | 18.4 | 184.0 | 3475.0 | female | 2009 |
142 | 148 | Adelie | Dream | 36.0 | 17.8 | 195.0 | 3450.0 | female | 2009 |
143 | 149 | Adelie | Dream | 37.8 | 18.1 | 193.0 | 3750.0 | male | 2009 |
144 | 150 | Adelie | Dream | 36.0 | 17.1 | 187.0 | 3700.0 | female | 2009 |
145 | 151 | Adelie | Dream | 41.5 | 18.5 | 201.0 | 4000.0 | male | 2009 |
139 | 145 | Adelie | Dream | 39.0 | 18.7 | 185.0 | 3650.0 | male | 2009 |
130 | 136 | Adelie | Dream | 35.6 | 17.5 | 191.0 | 3175.0 | female | 2009 |
129 | 135 | Adelie | Dream | 41.1 | 17.5 | 190.0 | 3900.0 | male | 2009 |
128 | 134 | Adelie | Dream | 38.1 | 17.6 | 187.0 | 3425.0 | female | 2009 |
113 | 119 | Adelie | Torgersen | 41.1 | 18.6 | 189.0 | 3325.0 | male | 2009 |
114 | 120 | Adelie | Torgersen | 36.2 | 17.2 | 187.0 | 3150.0 | female | 2009 |
115 | 121 | Adelie | Torgersen | 37.7 | 19.8 | 198.0 | 3500.0 | male | 2009 |
116 | 122 | Adelie | Torgersen | 40.2 | 17.0 | 176.0 | 3450.0 | female | 2009 |
117 | 123 | Adelie | Torgersen | 41.4 | 18.5 | 202.0 | 3875.0 | male | 2009 |
118 | 124 | Adelie | Torgersen | 35.2 | 15.9 | 186.0 | 3050.0 | female | 2009 |
119 | 125 | Adelie | Torgersen | 40.6 | 19.0 | 199.0 | 4000.0 | male | 2009 |
120 | 126 | Adelie | Torgersen | 38.8 | 17.6 | 191.0 | 3275.0 | female | 2009 |
121 | 127 | Adelie | Torgersen | 41.5 | 18.3 | 195.0 | 4300.0 | male | 2009 |
122 | 128 | Adelie | Torgersen | 39.0 | 17.1 | 191.0 | 3050.0 | female | 2009 |
123 | 129 | Adelie | Torgersen | 44.1 | 18.0 | 210.0 | 4000.0 | male | 2009 |
124 | 130 | Adelie | Torgersen | 38.5 | 17.9 | 190.0 | 3325.0 | female | 2009 |
125 | 131 | Adelie | Torgersen | 43.1 | 19.2 | 197.0 | 3500.0 | male | 2009 |
126 | 132 | Adelie | Dream | 36.8 | 18.5 | 193.0 | 3500.0 | female | 2009 |
127 | 133 | Adelie | Dream | 37.5 | 18.5 | 199.0 | 4475.0 | male | 2009 |
111 | 117 | Adelie | Torgersen | 37.3 | 20.5 | 199.0 | 3775.0 | male | 2009 |
73 | 79 | Adelie | Torgersen | 42.1 | 19.1 | 195.0 | 4000.0 | male | 2008 |
105 | 111 | Adelie | Biscoe | 45.6 | 20.3 | 191.0 | 4600.0 | male | 2009 |
71 | 77 | Adelie | Torgersen | 37.2 | 19.4 | 184.0 | 3900.0 | male | 2008 |
20 | 25 | Adelie | Biscoe | 35.3 | 18.9 | 187.0 | 3800.0 | female | 2007 |
21 | 26 | Adelie | Biscoe | 40.6 | 18.6 | 183.0 | 3550.0 | male | 2007 |
22 | 27 | Adelie | Biscoe | 40.5 | 17.9 | 187.0 | 3200.0 | female | 2007 |
23 | 28 | Adelie | Biscoe | 37.9 | 18.6 | 172.0 | 3150.0 | female | 2007 |
24 | 29 | Adelie | Biscoe | 40.5 | 18.9 | 180.0 | 3950.0 | male | 2007 |
25 | 30 | Adelie | Dream | 39.5 | 16.7 | 178.0 | 3250.0 | female | 2007 |
19 | 24 | Adelie | Biscoe | 38.8 | 17.2 | 180.0 | 3800.0 | male | 2007 |
26 | 31 | Adelie | Dream | 37.2 | 18.1 | 178.0 | 3900.0 | male | 2007 |
28 | 33 | Adelie | Dream | 40.9 | 18.9 | 184.0 | 3900.0 | male | 2007 |
29 | 34 | Adelie | Dream | 36.4 | 17.0 | 195.0 | 3325.0 | female | 2007 |
30 | 35 | Adelie | Dream | 39.2 | 21.1 | 196.0 | 4150.0 | male | 2007 |
31 | 36 | Adelie | Dream | 38.8 | 20.0 | 190.0 | 3950.0 | male | 2007 |
32 | 37 | Adelie | Dream | 42.2 | 18.5 | 180.0 | 3550.0 | female | 2007 |
33 | 38 | Adelie | Dream | 37.6 | 19.3 | 181.0 | 3300.0 | female | 2007 |
27 | 32 | Adelie | Dream | 39.5 | 17.8 | 188.0 | 3300.0 | female | 2007 |
18 | 23 | Adelie | Biscoe | 38.2 | 18.1 | 185.0 | 3950.0 | male | 2007 |
17 | 22 | Adelie | Biscoe | 35.9 | 19.2 | 189.0 | 3800.0 | female | 2007 |
16 | 21 | Adelie | Biscoe | 37.7 | 18.7 | 180.0 | 3600.0 | male | 2007 |
1 | 1 | Adelie | Torgersen | 39.5 | 17.4 | 186.0 | 3800.0 | female | 2007 |
2 | 2 | Adelie | Torgersen | 40.3 | 18.0 | 195.0 | 3250.0 | female | 2007 |
3 | 4 | Adelie | Torgersen | 36.7 | 19.3 | 193.0 | 3450.0 | female | 2007 |
72 | 78 | Adelie | Torgersen | 36.2 | 16.1 | 187.0 | 3550.0 | female | 2008 |
5 | 6 | Adelie | Torgersen | 38.9 | 17.8 | 181.0 | 3625.0 | female | 2007 |
6 | 7 | Adelie | Torgersen | 39.2 | 19.6 | 195.0 | 4675.0 | male | 2007 |
7 | 12 | Adelie | Torgersen | 41.1 | 17.6 | 182.0 | 3200.0 | female | 2007 |
8 | 13 | Adelie | Torgersen | 38.6 | 21.2 | 191.0 | 3800.0 | male | 2007 |
9 | 14 | Adelie | Torgersen | 34.6 | 21.1 | 198.0 | 4400.0 | male | 2007 |
10 | 15 | Adelie | Torgersen | 36.6 | 17.8 | 185.0 | 3700.0 | female | 2007 |
11 | 16 | Adelie | Torgersen | 38.7 | 19.0 | 195.0 | 3450.0 | female | 2007 |
12 | 17 | Adelie | Torgersen | 42.5 | 20.7 | 197.0 | 4500.0 | male | 2007 |
13 | 18 | Adelie | Torgersen | 34.4 | 18.4 | 184.0 | 3325.0 | female | 2007 |
14 | 19 | Adelie | Torgersen | 46.0 | 21.5 | 194.0 | 4200.0 | male | 2007 |
15 | 20 | Adelie | Biscoe | 37.8 | 18.3 | 174.0 | 3400.0 | female | 2007 |
34 | 39 | Adelie | Dream | 39.8 | 19.1 | 184.0 | 4650.0 | male | 2007 |
35 | 40 | Adelie | Dream | 36.5 | 18.0 | 182.0 | 3150.0 | female | 2007 |
4 | 5 | Adelie | Torgersen | 39.3 | 20.6 | 190.0 | 3650.0 | male | 2007 |
37 | 42 | Adelie | Dream | 36.0 | 18.5 | 186.0 | 3100.0 | female | 2007 |
56 | 62 | Adelie | Biscoe | 37.6 | 17.0 | 185.0 | 3600.0 | female | 2008 |
57 | 63 | Adelie | Biscoe | 41.1 | 18.2 | 192.0 | 4050.0 | male | 2008 |
58 | 64 | Adelie | Biscoe | 36.4 | 17.1 | 184.0 | 2850.0 | female | 2008 |
59 | 65 | Adelie | Biscoe | 41.6 | 18.0 | 192.0 | 3950.0 | male | 2008 |
60 | 66 | Adelie | Biscoe | 35.5 | 16.2 | 195.0 | 3350.0 | female | 2008 |
61 | 67 | Adelie | Biscoe | 41.1 | 19.1 | 188.0 | 4100.0 | male | 2008 |
62 | 68 | Adelie | Torgersen | 35.9 | 16.6 | 190.0 | 3050.0 | female | 2008 |
63 | 69 | Adelie | Torgersen | 41.8 | 19.4 | 198.0 | 4450.0 | male | 2008 |
64 | 70 | Adelie | Torgersen | 33.5 | 19.0 | 190.0 | 3600.0 | female | 2008 |
65 | 71 | Adelie | Torgersen | 39.7 | 18.4 | 190.0 | 3900.0 | male | 2008 |
66 | 72 | Adelie | Torgersen | 39.6 | 17.2 | 196.0 | 3550.0 | female | 2008 |
67 | 73 | Adelie | Torgersen | 45.8 | 18.9 | 197.0 | 4150.0 | male | 2008 |
68 | 74 | Adelie | Torgersen | 35.5 | 17.5 | 190.0 | 3700.0 | female | 2008 |
70 | 76 | Adelie | Torgersen | 40.9 | 16.8 | 191.0 | 3700.0 | female | 2008 |
36 | 41 | Adelie | Dream | 40.8 | 18.4 | 195.0 | 3900.0 | male | 2007 |
55 | 61 | Adelie | Biscoe | 41.3 | 21.1 | 195.0 | 4400.0 | male | 2008 |
54 | 60 | Adelie | Biscoe | 35.7 | 16.9 | 185.0 | 3150.0 | female | 2008 |
69 | 75 | Adelie | Torgersen | 42.8 | 18.5 | 195.0 | 4250.0 | male | 2008 |
52 | 58 | Adelie | Biscoe | 36.5 | 16.6 | 181.0 | 2850.0 | female | 2008 |
53 | 59 | Adelie | Biscoe | 37.6 | 19.1 | 194.0 | 3750.0 | male | 2008 |
39 | 44 | Adelie | Dream | 37.0 | 16.9 | 185.0 | 3000.0 | female | 2007 |
40 | 45 | Adelie | Dream | 39.6 | 18.8 | 190.0 | 4600.0 | male | 2007 |
41 | 46 | Adelie | Dream | 41.1 | 19.0 | 182.0 | 3425.0 | male | 2007 |
42 | 48 | Adelie | Dream | 36.0 | 17.9 | 190.0 | 3450.0 | female | 2007 |
43 | 49 | Adelie | Dream | 42.3 | 21.2 | 191.0 | 4150.0 | male | 2007 |
44 | 50 | Adelie | Biscoe | 39.6 | 17.7 | 186.0 | 3500.0 | female | 2008 |
38 | 43 | Adelie | Dream | 44.1 | 19.7 | 196.0 | 4400.0 | male | 2007 |
46 | 52 | Adelie | Biscoe | 35.0 | 17.9 | 190.0 | 3450.0 | female | 2008 |
47 | 53 | Adelie | Biscoe | 42.0 | 19.5 | 200.0 | 4050.0 | male | 2008 |
48 | 54 | Adelie | Biscoe | 34.5 | 18.1 | 187.0 | 2900.0 | female | 2008 |
49 | 55 | Adelie | Biscoe | 41.4 | 18.6 | 191.0 | 3700.0 | male | 2008 |
50 | 56 | Adelie | Biscoe | 39.0 | 17.5 | 186.0 | 3550.0 | female | 2008 |
51 | 57 | Adelie | Biscoe | 40.6 | 18.8 | 193.0 | 3800.0 | male | 2008 |
45 | 51 | Adelie | Biscoe | 40.1 | 18.9 | 188.0 | 4300.0 | male | 2008 |
284 | 295 | Chinstrap | Dream | 49.2 | 18.2 | 195.0 | 4400.0 | male | 2007 |
285 | 296 | Chinstrap | Dream | 42.4 | 17.3 | 181.0 | 3600.0 | female | 2007 |
286 | 297 | Chinstrap | Dream | 48.5 | 17.5 | 191.0 | 3400.0 | male | 2007 |
287 | 298 | Chinstrap | Dream | 43.2 | 16.6 | 187.0 | 2900.0 | female | 2007 |
288 | 299 | Chinstrap | Dream | 50.6 | 19.4 | 193.0 | 3800.0 | male | 2007 |
291 | 302 | Chinstrap | Dream | 50.5 | 18.4 | 200.0 | 3400.0 | female | 2008 |
290 | 301 | Chinstrap | Dream | 52.0 | 19.0 | 197.0 | 4150.0 | male | 2007 |
292 | 303 | Chinstrap | Dream | 49.5 | 19.0 | 200.0 | 3800.0 | male | 2008 |
293 | 304 | Chinstrap | Dream | 46.4 | 17.8 | 191.0 | 3700.0 | female | 2008 |
294 | 305 | Chinstrap | Dream | 52.8 | 20.0 | 205.0 | 4550.0 | male | 2008 |
283 | 294 | Chinstrap | Dream | 46.4 | 18.6 | 190.0 | 3450.0 | female | 2007 |
296 | 307 | Chinstrap | Dream | 54.2 | 20.8 | 201.0 | 4300.0 | male | 2008 |
289 | 300 | Chinstrap | Dream | 46.7 | 17.9 | 195.0 | 3300.0 | female | 2007 |
295 | 306 | Chinstrap | Dream | 40.9 | 16.6 | 187.0 | 3200.0 | female | 2008 |
275 | 286 | Chinstrap | Dream | 46.6 | 17.8 | 193.0 | 3800.0 | female | 2007 |
281 | 292 | Chinstrap | Dream | 50.3 | 20.0 | 197.0 | 3300.0 | male | 2007 |
267 | 278 | Chinstrap | Dream | 51.3 | 19.2 | 193.0 | 3650.0 | male | 2007 |
297 | 308 | Chinstrap | Dream | 42.5 | 16.7 | 187.0 | 3350.0 | female | 2008 |
268 | 279 | Chinstrap | Dream | 45.4 | 18.7 | 188.0 | 3525.0 | female | 2007 |
269 | 280 | Chinstrap | Dream | 52.7 | 19.8 | 197.0 | 3725.0 | male | 2007 |
270 | 281 | Chinstrap | Dream | 45.2 | 17.8 | 198.0 | 3950.0 | female | 2007 |
271 | 282 | Chinstrap | Dream | 46.1 | 18.2 | 178.0 | 3250.0 | female | 2007 |
282 | 293 | Chinstrap | Dream | 58.0 | 17.8 | 181.0 | 3700.0 | female | 2007 |
272 | 283 | Chinstrap | Dream | 51.3 | 18.2 | 197.0 | 3750.0 | male | 2007 |
274 | 285 | Chinstrap | Dream | 51.3 | 19.9 | 198.0 | 3700.0 | male | 2007 |
276 | 287 | Chinstrap | Dream | 51.7 | 20.3 | 194.0 | 3775.0 | male | 2007 |
277 | 288 | Chinstrap | Dream | 47.0 | 17.3 | 185.0 | 3700.0 | female | 2007 |
278 | 289 | Chinstrap | Dream | 52.0 | 18.1 | 201.0 | 4050.0 | male | 2007 |
279 | 290 | Chinstrap | Dream | 45.9 | 17.1 | 190.0 | 3575.0 | female | 2007 |
280 | 291 | Chinstrap | Dream | 50.5 | 19.6 | 201.0 | 4050.0 | male | 2007 |
273 | 284 | Chinstrap | Dream | 46.0 | 18.9 | 195.0 | 4150.0 | female | 2007 |
298 | 309 | Chinstrap | Dream | 51.0 | 18.8 | 203.0 | 4100.0 | male | 2008 |
315 | 326 | Chinstrap | Dream | 48.1 | 16.4 | 199.0 | 3325.0 | female | 2009 |
300 | 311 | Chinstrap | Dream | 47.5 | 16.8 | 199.0 | 3900.0 | female | 2008 |
266 | 277 | Chinstrap | Dream | 50.0 | 19.5 | 196.0 | 3900.0 | male | 2007 |
330 | 341 | Chinstrap | Dream | 49.6 | 18.2 | 193.0 | 3775.0 | male | 2009 |
329 | 340 | Chinstrap | Dream | 43.5 | 18.1 | 202.0 | 3400.0 | female | 2009 |
328 | 339 | Chinstrap | Dream | 55.8 | 19.8 | 207.0 | 4000.0 | male | 2009 |
327 | 338 | Chinstrap | Dream | 45.7 | 17.0 | 195.0 | 3650.0 | female | 2009 |
326 | 337 | Chinstrap | Dream | 46.8 | 16.5 | 189.0 | 3650.0 | female | 2009 |
325 | 336 | Chinstrap | Dream | 51.9 | 19.5 | 206.0 | 3950.0 | male | 2009 |
324 | 335 | Chinstrap | Dream | 45.6 | 19.4 | 194.0 | 3525.0 | female | 2009 |
323 | 334 | Chinstrap | Dream | 50.2 | 18.8 | 202.0 | 3800.0 | male | 2009 |
322 | 333 | Chinstrap | Dream | 49.3 | 19.9 | 203.0 | 4050.0 | male | 2009 |
321 | 332 | Chinstrap | Dream | 45.2 | 16.6 | 191.0 | 3250.0 | female | 2009 |
320 | 331 | Chinstrap | Dream | 52.2 | 18.8 | 197.0 | 3450.0 | male | 2009 |
319 | 330 | Chinstrap | Dream | 42.5 | 17.3 | 187.0 | 3350.0 | female | 2009 |
318 | 329 | Chinstrap | Dream | 50.7 | 19.7 | 203.0 | 4050.0 | male | 2009 |
299 | 310 | Chinstrap | Dream | 49.7 | 18.6 | 195.0 | 3600.0 | male | 2008 |
317 | 328 | Chinstrap | Dream | 45.7 | 17.3 | 193.0 | 3600.0 | female | 2009 |
314 | 325 | Chinstrap | Dream | 49.8 | 17.3 | 198.0 | 3675.0 | female | 2009 |
313 | 324 | Chinstrap | Dream | 51.5 | 18.7 | 187.0 | 3250.0 | male | 2009 |
312 | 323 | Chinstrap | Dream | 49.0 | 19.6 | 212.0 | 4300.0 | male | 2009 |
311 | 322 | Chinstrap | Dream | 50.1 | 17.9 | 190.0 | 3400.0 | female | 2009 |
310 | 321 | Chinstrap | Dream | 50.8 | 18.5 | 201.0 | 4450.0 | male | 2009 |
309 | 320 | Chinstrap | Dream | 50.9 | 17.9 | 196.0 | 3675.0 | female | 2009 |
308 | 319 | Chinstrap | Dream | 45.5 | 17.0 | 196.0 | 3500.0 | female | 2008 |
307 | 318 | Chinstrap | Dream | 50.9 | 19.1 | 196.0 | 3550.0 | male | 2008 |
306 | 317 | Chinstrap | Dream | 46.2 | 17.5 | 187.0 | 3650.0 | female | 2008 |
305 | 316 | Chinstrap | Dream | 49.0 | 19.5 | 210.0 | 3950.0 | male | 2008 |
304 | 315 | Chinstrap | Dream | 53.5 | 19.9 | 205.0 | 4500.0 | male | 2008 |
303 | 314 | Chinstrap | Dream | 46.9 | 16.6 | 192.0 | 2700.0 | female | 2008 |
302 | 313 | Chinstrap | Dream | 52.0 | 20.7 | 210.0 | 4800.0 | male | 2008 |
301 | 312 | Chinstrap | Dream | 47.6 | 18.3 | 195.0 | 3850.0 | female | 2008 |
316 | 327 | Chinstrap | Dream | 51.4 | 19.0 | 201.0 | 3950.0 | male | 2009 |
265 | 276 | Chinstrap | Dream | 46.5 | 17.9 | 192.0 | 3500.0 | female | 2007 |
332 | 343 | Chinstrap | Dream | 50.2 | 18.7 | 198.0 | 3775.0 | female | 2009 |
331 | 342 | Chinstrap | Dream | 50.8 | 19.0 | 210.0 | 4100.0 | male | 2009 |
213 | 221 | Gentoo | Biscoe | 50.7 | 15.0 | 223.0 | 5550.0 | male | 2008 |
177 | 184 | Gentoo | Biscoe | 45.1 | 14.5 | 207.0 | 5050.0 | female | 2007 |
178 | 185 | Gentoo | Biscoe | 59.6 | 17.0 | 230.0 | 6050.0 | male | 2007 |
179 | 186 | Gentoo | Biscoe | 49.1 | 14.8 | 220.0 | 5150.0 | female | 2008 |
180 | 187 | Gentoo | Biscoe | 48.4 | 16.3 | 220.0 | 5400.0 | male | 2008 |
181 | 188 | Gentoo | Biscoe | 42.6 | 13.7 | 213.0 | 4950.0 | female | 2008 |
182 | 189 | Gentoo | Biscoe | 44.4 | 17.3 | 219.0 | 5250.0 | male | 2008 |
183 | 190 | Gentoo | Biscoe | 44.0 | 13.6 | 208.0 | 4350.0 | female | 2008 |
184 | 191 | Gentoo | Biscoe | 48.7 | 15.7 | 208.0 | 5350.0 | male | 2008 |
185 | 192 | Gentoo | Biscoe | 42.7 | 13.7 | 208.0 | 3950.0 | female | 2008 |
186 | 193 | Gentoo | Biscoe | 49.6 | 16.0 | 225.0 | 5700.0 | male | 2008 |
187 | 194 | Gentoo | Biscoe | 45.3 | 13.7 | 210.0 | 4300.0 | female | 2008 |
176 | 183 | Gentoo | Biscoe | 42.8 | 14.2 | 209.0 | 4700.0 | female | 2007 |
188 | 195 | Gentoo | Biscoe | 49.6 | 15.0 | 216.0 | 4750.0 | male | 2008 |
190 | 197 | Gentoo | Biscoe | 43.6 | 13.9 | 217.0 | 4900.0 | female | 2008 |
191 | 198 | Gentoo | Biscoe | 45.5 | 13.9 | 210.0 | 4200.0 | female | 2008 |
192 | 199 | Gentoo | Biscoe | 50.5 | 15.9 | 225.0 | 5400.0 | male | 2008 |
193 | 200 | Gentoo | Biscoe | 44.9 | 13.3 | 213.0 | 5100.0 | female | 2008 |
194 | 201 | Gentoo | Biscoe | 45.2 | 15.8 | 215.0 | 5300.0 | male | 2008 |
195 | 202 | Gentoo | Biscoe | 46.6 | 14.2 | 210.0 | 4850.0 | female | 2008 |
196 | 203 | Gentoo | Biscoe | 48.5 | 14.1 | 220.0 | 5300.0 | male | 2008 |
197 | 204 | Gentoo | Biscoe | 45.1 | 14.4 | 210.0 | 4400.0 | female | 2008 |
198 | 205 | Gentoo | Biscoe | 50.1 | 15.0 | 225.0 | 5000.0 | male | 2008 |
199 | 206 | Gentoo | Biscoe | 46.5 | 14.4 | 217.0 | 4900.0 | female | 2008 |
200 | 207 | Gentoo | Biscoe | 45.0 | 15.4 | 220.0 | 5050.0 | male | 2008 |
201 | 208 | Gentoo | Biscoe | 43.8 | 13.9 | 208.0 | 4300.0 | female | 2008 |
189 | 196 | Gentoo | Biscoe | 50.5 | 15.9 | 222.0 | 5550.0 | male | 2008 |
175 | 182 | Gentoo | Biscoe | 47.3 | 15.3 | 222.0 | 5250.0 | male | 2007 |
174 | 181 | Gentoo | Biscoe | 50.0 | 15.3 | 220.0 | 5550.0 | male | 2007 |
173 | 180 | Gentoo | Biscoe | 48.2 | 14.3 | 210.0 | 4600.0 | female | 2007 |
146 | 152 | Gentoo | Biscoe | 46.1 | 13.2 | 211.0 | 4500.0 | female | 2007 |
147 | 153 | Gentoo | Biscoe | 50.0 | 16.3 | 230.0 | 5700.0 | male | 2007 |
148 | 154 | Gentoo | Biscoe | 48.7 | 14.1 | 210.0 | 4450.0 | female | 2007 |
149 | 155 | Gentoo | Biscoe | 50.0 | 15.2 | 218.0 | 5700.0 | male | 2007 |
150 | 156 | Gentoo | Biscoe | 47.6 | 14.5 | 215.0 | 5400.0 | male | 2007 |
151 | 157 | Gentoo | Biscoe | 46.5 | 13.5 | 210.0 | 4550.0 | female | 2007 |
152 | 158 | Gentoo | Biscoe | 45.4 | 14.6 | 211.0 | 4800.0 | female | 2007 |
153 | 159 | Gentoo | Biscoe | 46.7 | 15.3 | 219.0 | 5200.0 | male | 2007 |
154 | 160 | Gentoo | Biscoe | 43.3 | 13.4 | 209.0 | 4400.0 | female | 2007 |
155 | 161 | Gentoo | Biscoe | 46.8 | 15.4 | 215.0 | 5150.0 | male | 2007 |
156 | 162 | Gentoo | Biscoe | 40.9 | 13.7 | 214.0 | 4650.0 | female | 2007 |
157 | 163 | Gentoo | Biscoe | 49.0 | 16.1 | 216.0 | 5550.0 | male | 2007 |
202 | 209 | Gentoo | Biscoe | 45.5 | 15.0 | 220.0 | 5000.0 | male | 2008 |
158 | 164 | Gentoo | Biscoe | 45.5 | 13.7 | 214.0 | 4650.0 | female | 2007 |
160 | 166 | Gentoo | Biscoe | 45.8 | 14.6 | 210.0 | 4200.0 | female | 2007 |
161 | 167 | Gentoo | Biscoe | 49.3 | 15.7 | 217.0 | 5850.0 | male | 2007 |
162 | 168 | Gentoo | Biscoe | 42.0 | 13.5 | 210.0 | 4150.0 | female | 2007 |
163 | 169 | Gentoo | Biscoe | 49.2 | 15.2 | 221.0 | 6300.0 | male | 2007 |
164 | 170 | Gentoo | Biscoe | 46.2 | 14.5 | 209.0 | 4800.0 | female | 2007 |
165 | 171 | Gentoo | Biscoe | 48.7 | 15.1 | 222.0 | 5350.0 | male | 2007 |
167 | 173 | Gentoo | Biscoe | 45.1 | 14.5 | 215.0 | 5000.0 | female | 2007 |
168 | 174 | Gentoo | Biscoe | 46.5 | 14.5 | 213.0 | 4400.0 | female | 2007 |
169 | 175 | Gentoo | Biscoe | 46.3 | 15.8 | 215.0 | 5050.0 | male | 2007 |
170 | 176 | Gentoo | Biscoe | 42.9 | 13.1 | 215.0 | 5000.0 | female | 2007 |
171 | 177 | Gentoo | Biscoe | 46.1 | 15.1 | 215.0 | 5100.0 | male | 2007 |
172 | 179 | Gentoo | Biscoe | 47.8 | 15.0 | 215.0 | 5650.0 | male | 2007 |
159 | 165 | Gentoo | Biscoe | 48.4 | 14.6 | 213.0 | 5850.0 | male | 2007 |
203 | 210 | Gentoo | Biscoe | 43.2 | 14.5 | 208.0 | 4450.0 | female | 2008 |
204 | 211 | Gentoo | Biscoe | 50.4 | 15.3 | 224.0 | 5550.0 | male | 2008 |
205 | 212 | Gentoo | Biscoe | 45.3 | 13.8 | 208.0 | 4200.0 | female | 2008 |
239 | 247 | Gentoo | Biscoe | 50.8 | 15.7 | 226.0 | 5200.0 | male | 2009 |
238 | 246 | Gentoo | Biscoe | 44.5 | 14.7 | 214.0 | 4850.0 | female | 2009 |
237 | 245 | Gentoo | Biscoe | 49.5 | 16.1 | 224.0 | 5650.0 | male | 2009 |
236 | 244 | Gentoo | Biscoe | 45.5 | 14.5 | 212.0 | 4750.0 | female | 2009 |
235 | 243 | Gentoo | Biscoe | 52.2 | 17.1 | 228.0 | 5400.0 | male | 2009 |
234 | 242 | Gentoo | Biscoe | 47.5 | 15.0 | 218.0 | 4950.0 | female | 2009 |
233 | 241 | Gentoo | Biscoe | 52.1 | 17.0 | 230.0 | 5550.0 | male | 2009 |
232 | 240 | Gentoo | Biscoe | 47.5 | 14.0 | 212.0 | 4875.0 | female | 2009 |
231 | 239 | Gentoo | Biscoe | 51.3 | 14.2 | 218.0 | 5300.0 | male | 2009 |
230 | 238 | Gentoo | Biscoe | 43.4 | 14.4 | 218.0 | 4600.0 | female | 2009 |
229 | 237 | Gentoo | Biscoe | 50.8 | 17.3 | 228.0 | 5600.0 | male | 2009 |
228 | 236 | Gentoo | Biscoe | 44.9 | 13.8 | 212.0 | 4750.0 | female | 2009 |
240 | 248 | Gentoo | Biscoe | 49.4 | 15.8 | 216.0 | 4925.0 | male | 2009 |
227 | 235 | Gentoo | Biscoe | 50.0 | 15.9 | 224.0 | 5350.0 | male | 2009 |
225 | 233 | Gentoo | Biscoe | 52.5 | 15.6 | 221.0 | 5450.0 | male | 2009 |
224 | 232 | Gentoo | Biscoe | 49.1 | 14.5 | 212.0 | 4625.0 | female | 2009 |
223 | 231 | Gentoo | Biscoe | 45.2 | 16.4 | 223.0 | 5950.0 | male | 2008 |
222 | 230 | Gentoo | Biscoe | 45.2 | 13.8 | 215.0 | 4750.0 | female | 2008 |
221 | 229 | Gentoo | Biscoe | 51.1 | 16.3 | 220.0 | 6000.0 | male | 2008 |
220 | 228 | Gentoo | Biscoe | 47.5 | 14.2 | 209.0 | 4600.0 | female | 2008 |
219 | 227 | Gentoo | Biscoe | 48.6 | 16.0 | 230.0 | 5800.0 | male | 2008 |
218 | 226 | Gentoo | Biscoe | 46.4 | 15.0 | 216.0 | 4700.0 | female | 2008 |
217 | 225 | Gentoo | Biscoe | 46.5 | 14.8 | 217.0 | 5200.0 | female | 2008 |
216 | 224 | Gentoo | Biscoe | 48.2 | 15.6 | 221.0 | 5100.0 | male | 2008 |
215 | 223 | Gentoo | Biscoe | 46.4 | 15.6 | 221.0 | 5000.0 | male | 2008 |
214 | 222 | Gentoo | Biscoe | 47.7 | 15.0 | 216.0 | 4750.0 | female | 2008 |
226 | 234 | Gentoo | Biscoe | 47.4 | 14.6 | 212.0 | 4725.0 | female | 2009 |
241 | 249 | Gentoo | Biscoe | 46.9 | 14.6 | 222.0 | 4875.0 | female | 2009 |
242 | 250 | Gentoo | Biscoe | 48.4 | 14.4 | 203.0 | 4625.0 | female | 2009 |
243 | 251 | Gentoo | Biscoe | 51.1 | 16.5 | 225.0 | 5250.0 | male | 2009 |
206 | 213 | Gentoo | Biscoe | 46.2 | 14.9 | 221.0 | 5300.0 | male | 2008 |
207 | 214 | Gentoo | Biscoe | 45.7 | 13.9 | 214.0 | 4400.0 | female | 2008 |
208 | 215 | Gentoo | Biscoe | 54.3 | 15.7 | 231.0 | 5650.0 | male | 2008 |
209 | 216 | Gentoo | Biscoe | 45.8 | 14.2 | 219.0 | 4700.0 | female | 2008 |
210 | 217 | Gentoo | Biscoe | 49.8 | 16.8 | 230.0 | 5700.0 | male | 2008 |
211 | 219 | Gentoo | Biscoe | 49.5 | 16.2 | 229.0 | 5800.0 | male | 2008 |
264 | 275 | Gentoo | Biscoe | 49.9 | 16.1 | 213.0 | 5400.0 | male | 2009 |
263 | 274 | Gentoo | Biscoe | 45.2 | 14.8 | 212.0 | 5200.0 | female | 2009 |
262 | 273 | Gentoo | Biscoe | 50.4 | 15.7 | 222.0 | 5750.0 | male | 2009 |
261 | 272 | Gentoo | Biscoe | 46.8 | 14.3 | 215.0 | 4850.0 | female | 2009 |
260 | 270 | Gentoo | Biscoe | 47.2 | 13.7 | 214.0 | 4925.0 | female | 2009 |
259 | 269 | Gentoo | Biscoe | 48.8 | 16.2 | 222.0 | 6000.0 | male | 2009 |
258 | 267 | Gentoo | Biscoe | 55.1 | 16.0 | 230.0 | 5850.0 | male | 2009 |
257 | 266 | Gentoo | Biscoe | 46.2 | 14.1 | 217.0 | 4375.0 | female | 2009 |
256 | 265 | Gentoo | Biscoe | 51.5 | 16.3 | 230.0 | 5500.0 | male | 2009 |
255 | 264 | Gentoo | Biscoe | 43.5 | 15.2 | 213.0 | 4650.0 | female | 2009 |
254 | 263 | Gentoo | Biscoe | 49.8 | 15.9 | 229.0 | 5950.0 | male | 2009 |
253 | 262 | Gentoo | Biscoe | 50.5 | 15.2 | 216.0 | 5000.0 | female | 2009 |
252 | 261 | Gentoo | Biscoe | 48.1 | 15.1 | 209.0 | 5500.0 | male | 2009 |
251 | 260 | Gentoo | Biscoe | 43.3 | 14.0 | 208.0 | 4575.0 | female | 2009 |
250 | 259 | Gentoo | Biscoe | 53.4 | 15.8 | 219.0 | 5500.0 | male | 2009 |
249 | 258 | Gentoo | Biscoe | 41.7 | 14.7 | 210.0 | 4700.0 | female | 2009 |
248 | 257 | Gentoo | Biscoe | 46.8 | 16.1 | 215.0 | 5500.0 | male | 2009 |
247 | 255 | Gentoo | Biscoe | 49.1 | 15.0 | 228.0 | 5500.0 | male | 2009 |
246 | 254 | Gentoo | Biscoe | 47.2 | 15.5 | 215.0 | 4975.0 | female | 2009 |
245 | 253 | Gentoo | Biscoe | 55.9 | 17.0 | 228.0 | 5600.0 | male | 2009 |
244 | 252 | Gentoo | Biscoe | 48.5 | 15.0 | 219.0 | 4850.0 | female | 2009 |
212 | 220 | Gentoo | Biscoe | 43.5 | 14.2 | 220.0 | 4700.0 | female | 2008 |
166 | 172 | Gentoo | Biscoe | 50.2 | 14.3 | 218.0 | 5700.0 | male | 2007 |
Next we will set up a linked selections instance that will allow us to perform cross-filtering on the plots we will create in the next step:
ls = hv.link_selections.instance()
def count(selected):
return f"## {len(selected)}/{len(penguins)} penguins selected"
selected = pn.pane.Markdown(
pn.bind(count, ls.selection_param(penguins)),
align='center', width=400, margin=(0, 100, 0, 0)
)
header = pn.Row(
pn.layout.HSpacer(), selected,
sizing_mode='stretch_width'
).servable(area='header')
selected
Now we can start plotting the data with hvPlot, which provides a familiar API to pandas .plot
users but generates interactive plots and use the linked selections object to allow cross-filtering across the plots:
colors = {
'Adelie': '#1f77b4',
'Gentoo': '#ff7f0e',
'Chinstrap': '#2ca02c'
}
scatter = penguins.hvplot.points(
'bill_length_mm', 'bill_depth_mm', c='species',
cmap=colors, responsive=True, min_height=300
)
histogram = penguins.hvplot.hist(
'body_mass_g', by='species', color=hv.dim('species').categorize(colors),
legend=False, alpha=0.5, responsive=True, min_height=300
)
bars = penguins.hvplot.bar(
'species', 'index', c='species', cmap=colors,
responsive=True, min_height=300, ylabel=''
).aggregate(function=np.count_nonzero)
violin = penguins.hvplot.violin(
'flipper_length_mm', by=['species', 'sex'], cmap='Category20',
responsive=True, min_height=300, legend='bottom_right'
).opts(split='sex')
plots = pn.pane.HoloViews(
ls(scatter.opts(show_legend=False) + bars + histogram + violin).opts(sizing_mode='stretch_both').cols(2)
).servable(title='Palmer Penguins')
plots