Public
Edited
Aug 14, 2023
Insert cell
Insert cell
penguins = d3.csv(
"https://raw.githubusercontent.com/allisonhorst/palmerpenguins/master/inst/extdata/penguins.csv",
d3.autoType
)
Insert cell
Insert cell
Plot.plot({
grid: true,
marginRight: 60,
facet: {label: null},
marks: [
Plot.frame(),
Plot.dot(penguins, {
x: "bill_length_mm",
y: "bill_depth_mm",
fx: "sex",
fy: "species"
})
]
})
Insert cell
import { aq, op } from '@uwdata/arquero';
Insert cell
penguins_arc = aq.from(penguins)
Insert cell
penguins_arc.dedupe('species').array('species')
Insert cell
bill = penguins_arc.array('bill_length_mm')
Insert cell
max_billy = penguins_arc
.rollup({
max_bill: d => op.max(d.bill_length_mm)
})
.array('max_bill')
Insert cell
Plot.plot({x: {domain: [new Date("2023-03-15T04:48:21Z"), new Date("2023-04-15T04:48:21Z")], grid: true}})
Insert cell
typeof bill
Insert cell
penguins_arc.numRows()
Insert cell
function highlightbar() {
return x => htl.html`<div style="
background: ${x === 'female' ? 'red' : x === 'male' ? 'yellow' : 'white'};
width: 100%;
padding-right: 3px;
box-sizing: border-box;
display: flex;
justify-content: flex-end;">${x.toLocaleString("en")}`
}

Insert cell
Inputs.table(penguins_arc, {
format: {
sex : highlightbar()
}
})
Insert cell
d3.max(penguins, d => d.body_mass_g)
Insert cell
foo = "foo"
Insert cell
typeof(foo)
Insert cell
ar = ["bar"]
Insert cell
typeof(ar)
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.
Learn more