Public
Edited
Mar 21, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof color = Inputs.color({ label: "Favorite color", value: "#4682b4" })
Insert cell
Plot.plot({
marks: [
Plot.barX(energy_2021, {
x: "quadrillion_btu",
y: "type",
fill: color,
stroke: "yellow",
sort: { y: "x", reverse: true }
}),
Plot.ruleX([0])
],
marginLeft: 150
})
Insert cell
Insert cell
Insert cell
Insert cell
us_energy.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
viewof pickLineWidth = Inputs.range([0, 10], {
label: "Choose line width",
step: 1
})
Insert cell
viewof minYear = Inputs.range([1973, 2021], { label: "min year", value: 1973 })
Insert cell
Insert cell
Plot.plot({
marks: [
Plot.ruleY([0]),
Plot.lineY(energy_production, {
x: "year",
y: "quadrillion_btu",
stroke: "type",
strokeWidth: pickLineWidth
})
],
color: { legend: true },
x: { domain: [minYear, 2022] }
})
Insert cell
Insert cell
Insert cell
Insert cell
power_plants
SELECT * FROM "power_plants"
Insert cell
Insert cell
Plot.plot({
projection: "albers-usa",
marks: [
Plot.dot(us_plants, {
x: "longitude",
y: "latitude",
fill: "primary_source",
r: "total_capacity"
}),
Plot.geo(states)
],
r: { range: [0.5, 12] }
})
Insert cell
us_plants.map((d) => d.primary_source)
Insert cell
x = 6
Insert cell
x == 5 ? "YA" : "NO"
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
Insert cell
Insert cell
energy_2021 = energy_production.filter(d => d.year == 2021)
Insert cell
Insert cell
import {power_plants} from "@observablehq/us-energy-mix-bubble-map-recreation"
Insert cell
Insert cell
import {states} from "@observablehq/us-energy-mix-bubble-map-recreation"
Insert cell
import {showMe} from "@observablehq/show-me"
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