Published
Edited
May 19, 2021
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
plotPlot = Plot.line(data, {
x: d => new Date(d["week_ending_date"]),
y: d => parseInt(d["all_cause"]),
stroke: "jurisdiction_of_occurrence"
}).plot()
Insert cell
Insert cell
vl.markLine()
.data(data)
.encode(
vl.x().fieldT("week_ending_date"),
vl.y().fieldQ("all_cause"),
vl.color().fieldN("jurisdiction_of_occurrence")
)
.render()
Insert cell
Insert cell
{
const traces = []
const zValues = [...new Set(data.map(d => d["jurisdiction_of_occurrence"]))]
const traceMap = new Map(zValues.map(d => [d, {x :[], y: [], name: d, mode: "lines"}]))
for (const row of data) {
const trace = traceMap.get(row["jurisdiction_of_occurrence"])
trace.x.push(new Date(row["week_ending_date"]))
trace.y.push(parseInt(row["all_cause"]))
}
const plotData = [...traceMap.values()]
const div = html`<div></div>`
Plotly.newPlot(div, plotData)
return div
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.dot(penguinData.filter(d => d["sex"]), {x: "bill_length", y: "bill_depth", fill: "species"}).plot({
facet: {
data: penguinData, x: "sex"
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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