Published
Edited
Apr 19, 2022
4 forks
2 stars
Insert cell
Insert cell
Insert cell
data = FileAttachment("bandcamp-oneday.csv").csv({typed: true})
Insert cell
Inputs.table(data)
Insert cell
Insert cell
Insert cell
// type your code here

Insert cell
Insert cell
Insert cell
// type your code here

Insert cell
Insert cell
// let's update this code to change the group by and the aggregation
Plot.barX(data, Plot.groupY({x: "mean"}, {
x: "amount_paid",
y: "type",
sort: { y: "x", reverse: true }
}))
.plot({ marginLeft: 100 })
Insert cell
Insert cell
Insert cell
countries = new Set(data.map(d => d.country))
Insert cell
// type your code here

Insert cell
Insert cell
// let's update this code to filter the data by country
Plot.barX(data, Plot.groupY({x: "sum"}, {
x: "amount_paid",
y: "type",
sort: { y: "x", reverse: true, limit: 10 }
}))
.plot({
marginLeft: 100
})
Insert cell
Insert cell
Insert cell
Insert cell
// lets update this code to color dots differently above and below a minimum amount paid
Plot.plot({
marks: [
Plot.dot(data.filter(d => d.country == "United Kingdom"), { x: "utc_timestamp", y: "amount_paid" })
],
y: { type: "symlog" }
})
Insert cell
Insert cell
Insert cell
Insert cell
// type your code here

Insert cell
// update this code to use the search data
Inputs.table(data)
Insert cell
// update this code to use the search data
Plot.plot({
marks: [
Plot.rectY(data, Plot.binX({y: "sum"}, { x: "utc_timestamp", y: "amount_paid", fill: "type", thresholds: d3.utcHour }))
],
})
Insert cell
Insert cell
Insert cell
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