Public
Edited
Apr 27, 2023
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
data_cars = cars
Insert cell
data_cars
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Plot.plot({
color: {
legend: true
},
x: {
label: "Miles Per Gallon →",
grid: true
},
y: {
label: "Horsepower ↑",
grid: true
},
marks: [
Plot.dot(data_cars, {x: "economy (mpg)", y: "power (hp)", r:"power (hp)",fill: "cylinders", fillOpacity: 0.4}),

Plot.text(data_cars, {x: "economy (mpg)",y: "power (hp)",text: d => d["power (hp)"] > 220 ? d["power (hp)"] : "" ,fontSize: 15,}),
Plot.linearRegressionY(data_cars, {x: "economy (mpg)",y: "power (hp)",stroke: "red"})
]
})
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