Published
Edited
Dec 15, 2021
Insert cell
Insert cell
Plot.plot( {
x: {
// domain: d3.groupSort(data, g => -g.length, d => d.SimpleType),
tickFormat: d => d === null ? "N/A" : d,
label: "Energy Type"
},
y: {
grid: true,
label: "Plants Built"
},
marks: [
Plot.barY(data, Plot.groupX({y: "count"}, {x: "Category", fill: "SimpleType"})),
// Plot.barY(data, Plot.groupX({y: "count",}, {x: "SimpleType"})),
Plot.ruleY([0])
]
})

Insert cell
data = {
let final = []
let data = d3.csvParse(await FileAttachment("plants_since_1980@1.csv").text())
data.forEach(d => {
if (d.SimpleType != "Other") {
if (d.SimpleType == "Solar"|| d.SimpleType == "Wind") {d.Category = "Charismatic Renewables"}
else if (d.SimpleType == "Nuclear") {d.Category = "Nuclear"}
else if (d.SimpleType == "Coal"||d.SimpleType == "Natural Gas") {d.Category = "Fossil Fuels"}
else {d.Category = "Other"}
final.push(d);
}
});
return final
}
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