Published
Edited
May 7, 2022
1 star
Insert cell
Insert cell
firstColumn = Array(100).fill(0).map((x, i) => 0.01*i*i);
Insert cell
secondColumn = Array(100).fill(0).map((x, i) => 100 - 0.01*i*i);
Insert cell
Plot.plot({
color: {
type: "categorical",
legend: true,
// domain: ["first", "second"], // changes labels but lines disappear
},
marks: [
Plot.lineY(firstColumn, {stroke: 0}),
Plot.lineY(secondColumn, {stroke: 1})
]
})
Insert cell
Insert cell
Plot.plot({
color: {
type: "categorical",
legend: true,
domain: ["first", "second"],
},
marks: [
Plot.lineY(firstColumn, {stroke: (_) => "first"}),
Plot.lineY(secondColumn, {stroke: (_) => "second"})
]
})
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