Public
Edited
Apr 30, 2023
Insert cell
Insert cell
import { aq, op } from "@uwdata/arquero"
Insert cell
data_aq = aq.fromCSV(await FileAttachment("movies.csv").text())
Insert cell
Plot.auto(data, { x: "Release Date", y: "Worldwide Gross" }).plot()
Insert cell
op.indexof(
data_aq.rollup({ a: op.array_agg_distinct("Major Genre") }).get("a"),
"Adventure"
) / 3
Insert cell
data = FileAttachment("movies.csv").csv()
Insert cell
genres = Array.from(new Set(data.map((d) => d["Major Genre"])))
Insert cell
n = 5
Insert cell
fx = (key) => genres.indexOf(key) % n
Insert cell
fy = (key) => Math.floor(genres.indexOf(key) / n)
Insert cell
Plot.boxY(data, {
x: "Major Genre",
y: (d) => +d["Production Budget"]
}).plot()
Insert cell
Plot.plot({
fx: { axis: null },
fy: { axis: null },
color: { legend: true },
marks: [
Plot.boxY(data, {
fx: (d) => fx(d["Major Genre"]),
fy: (d) => fy(d["Major Genre"]),
y: (d) => +d["Production Budget"],
x: "MPAA Rating",
fill: "MPAA Rating"
}),
Plot.text(genres, { fx, fy, frameAnchor: "top-left", dx: 6, dy: 10 })
]
})
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