Public
Edited
Mar 4, 2023
3 forks
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
penguins
Insert cell
data = penguins
Insert cell
data
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
x = Plot.plot({
color: {
legend: true,
},
style: {
//background: "black",
//color: "white"
},
x: {
//range: [0]
},
//width: width,
//height: 500,
caption: "bill shape of penguins",
marks: [
Plot.dot(penguins, {x:"culmen_depth_mm", y: "culmen_length_mm", fill: "sex"})
],
})

Insert cell
Insert cell
Plot.auto(penguins, {x:"culmen_depth_mm", y: "culmen_length_mm"}).plot()

Insert cell
Plot.auto(penguins, {x:"species", y: "culmen_length_mm"}).plot()
Insert cell
Insert cell
Plot.plot({
color: {
legend: true,
},
r: {
range: [0, 20]
},
marks: [
Plot.dot(penguins, {
x: "culmen_depth_mm",
y: "culmen_length_mm",
r: "body_mass_g",
fill: "island",
opacity: .4
})
]
})
Insert cell
Insert cell
viewof interestId = Inputs.range([0, penguins.length], {step: 1})
Insert cell
Plot.plot({
marks: [
Plot.dot(penguins, {
x:"culmen_depth_mm",
y: "culmen_length_mm",
fill: "sex",
opacity: .8
}),
Plot.circle(
penguins.filter((p, i) => i === interestId),
{
x: "culmen_depth_mm",
y: "culmen_length_mm",
r: 20,
stroke: "red",
z: 0
}
)
]
})
Insert cell
Plot.plot({
marks: [
Plot.dot(penguins, {x:"culmen_depth_mm", y: "body_mass_g", fill: "sex"}),
Plot.ruleY([5750]),
Plot.textY([5750], {text: d => "chonky penguins", lineAnchor: "bottom"}),
Plot.ruleX([d3.median(penguins, d => d.culmen_depth_mm)]),
]
})
Insert cell
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
Insert cell
addTooltips(
Plot.plot({
color: {
legend: true,
},
marks: [
Plot.dot(penguins, {
x:"culmen_depth_mm",
y: "culmen_length_mm",
fill: "island",
title: (d) =>
`${d.sex} \n bill depth: ${d.culmen_depth_mm} \n bill length: ${d.culmen_length_mm}`
})
]
})
)

Insert cell
Insert cell
Plot.plot({
color: {
legend: true
},
facet: {
x: "species",
y: "island",
data: penguins,
},
marks: [
Plot.rectY(
penguins,
Plot.binX(
{ y: "count" },
{ x: "body_mass_g", fill: "sex", thresholds: 20 }
)
),
Plot.ruleX([5500])
]
})

Insert cell
## Plot with Weather
Insert cell
weather2012 = weather.filter(d => d.date.getFullYear() === 2012)
Insert cell
Insert cell
Insert cell
import {san_diego_stops} from "@eads/first-observable-notebook-imports"
Insert cell
Plot.plot({
marks: [
Plot.dot(san_diego_stops, {x: "perceived_age"})
]
})
Insert cell
Plot.plot({
marks: [
Plot.auto(san_diego_stops, {x: "perceived_age"})
]
})
Insert cell
stops_by_age_count = san_diego_stops_aq.groupby('perceived_age').rollup({
count: aq.op.count(),
}).objects()
Insert cell
Plot.plot({
width,
marks: [
Plot.barY(stops_by_age_count, {"x": "perceived_age", y: "count"}),
Plot.text(stops_by_age_count, {"x": "perceived_age", y: "count", text: "perceived_age", dy: -5}),
]
})
Insert cell
Plot.plot({
marks: [
Plot.rectY(san_diego_stops, Plot.binX({y: "count"}, {x: "perceived_age"}))
]
})
Insert cell
Plot.plot({
marks: [
Plot.rectY(san_diego_stops, Plot.binX({y: "count"}, {x: "perceived_age"})),
Plot.text(san_diego_stops, Plot.binX({y: "count"}, {x: "perceived_age", fill: 'black', lineAnchor: 'bottom' }))
]
})
Insert cell
san_diego_stops_aq = aq.from(san_diego_stops)
Insert cell
san_diego_stops_aq.groupby("reason_for_stop_detail").count().view()
Insert cell

op.parse_date('2022-04-01')
Insert cell
import { aq, op } from "@uwdata/arquero"
Insert cell
Plot.plot({
marks: [
Plot.line(san_diego_stops,{x: "date_stop", y: ""})
]
})
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