Published unlisted
Edited
Oct 3, 2021
1 star
Insert cell
Insert cell
Plot.plot({
x: { grid: true },
y: {
grid: true,
transform: (d) => d / 1000000
},
marks: [
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y5", fill: "orange" }
)
),
Plot.rectY(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcWeek, y: "y5", fill: "green" }
)
),
Plot.line(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y5", stroke: "black" }
)
),
Plot.dot(
data,
Plot.binX(
{ y: "sum" },
{ x: (d) => d.x, thresholds: d3.utcMonth, y: "y5", stroke: "black" }
)
),
Plot.ruleY([0])
]
})
Insert cell
summarize({
data: data,
transform: "binX",
outputs: { y: "sum" },
options: { x: (d) => d.x, thresholds: d3.utcMonth, y: "y5" }
})
Insert cell
import { summarize } from "@ee2dev/plot-party"
Insert cell
import { Plot, d3 } from "@observablehq/plot"
Insert cell
data = (await FileAttachment("test_data.txt").json()).map((d) => ({
...d,
x: new Date(d.x)
}))
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