Unlisted
Edited
Dec 5, 2023
Insert cell
Insert cell
guns_1 = FileAttachment("guns_2.tsv").tsv({typed: true})
Insert cell
abortion_1 = FileAttachment("abortion_2.tsv").tsv({typed: true})
Insert cell
ev_1 = FileAttachment("electric_vehicle_1.tsv").tsv({typed: true})
Insert cell
topic_bill_1 = FileAttachment("topic_2.tsv").tsv({typed: true})
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
us = FileAttachment("us-counties-10m.json").json()
Insert cell
nation = topojson.feature(us, us.objects.nation)
Insert cell
states = topojson.feature(us, us.objects.states)
Insert cell
statesMesh = topojson.mesh(us, us.objects.states, (a, b) => a !== b)
Insert cell
import {addTooltips} from "@mkfreeman/plot-tooltip"
Insert cell
Plot.plot({
projection: "albers-usa",
color: {
//type: "quantile",
//scheme: "reds",
//range: ["#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#00AEF3", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "#DE0100", "purple", "purple", "purple", "purple", "purple", "purple", "purple", "purple", "purple", "purple", "orange", "orange", "orange", "orange", "orange"],
//domain: ["California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Hawaii", "Illinois", "Maine", "Maryland", "Massachusetts", "New Hampshire", "New Jersey", "New Mexico", "New York", "Oregon", "Rhode Island", "Vermont", "Virginia", "Washington", "Alabama", "Alaska", "Arkansas", "Idaho", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Mississippi", "Missouri", "Montana", "Nebraska", "North Dakota", "Oklahoma", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "West Virginia", "Wyoming", "Arizona", "Florida", "Georgia", "Michigan", "Minnesota", "Nevada", "North Carolina", "Ohio", "Pennsylvania", "Wisconsin", "American Samoa", "Guam", "Puerto Rico", "Virgin Islands", "Northern Mariana Islands"],
//label: "Abortion Bills (%)",
legend: true
},
marks: [
Plot.geo(flat_class, {fill: "red", title: (d) => d.state}),
Plot.geo(statesMesh, { strokeOpacity: 0.5 }),
Plot.geo(nation, {strokeWidth: 1.5})
]
})
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