Platform
Resources
Pricing
Sign in
Get started
Sam Albers
Workspace
Fork
Public
By
Sam Albers
Edited
Sep 11, 2023
Fork of
consistent colours
1 star
Insert cell
Insert cell
penguins_raw
=
d3
.
csv
(
"https://raw.githubusercontent.com/allisonhorst/palmerpenguins/master/inst/extdata/penguins.csv"
,
d3
.
autoType
)
Insert cell
import
{
aq
,
op
}
from
'@uwdata/arquero'
;
Insert cell
penguins
=
aq
.
from
(
penguins_raw
)
Insert cell
[
"All"
]
.
concat
(
"Adelie"
,
"Gentoo"
,
"Chinstrap"
)
Insert cell
viewof
pen_types
=
Inputs
.
select
(
[
"All"
]
.
concat
(
"Adelie"
,
"Gentoo"
,
"Chinstrap"
)
)
Insert cell
pen_types
Insert cell
pplot
=
{
let
pplot
;
if
(
pen_types
==
"All"
)
{
return
pplot
=
penguins
;
}
else
{
return
pplot
=
penguins
.
filter
(
aq
.
escape
(
d
=>
op
.
includes
(
d
.
species
,
pen_types
)
)
)
;
}
}
Insert cell
Plot
.
plot
(
{
marginLeft
:
60
,
color
:
{
legend
:
true
}
,
marks
:
[
Plot
.
dot
(
pplot
,
{
y
:
"body_mass_g"
,
x
:
"bill_length_mm"
,
fill
:
"species"
}
)
]
}
)
Insert cell
foo
=
{
return
(
pen_types
===
"All"
)
?
penguins
// If pen_types is "All", no filtering is applied
:
penguins
.
filter
(
aq
.
escape
(
d
=>
op
.
includes
(
d
.
species
,
pen_types
)
)
)
;
}
Insert cell
[
"All"
]
.
concat
(
penguins
.
dedupe
(
"island"
)
.
array
(
"island"
)
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
penguins_raw
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
penguins
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
pen_types
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
pplot
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
foo
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML