Public
Edited
Feb 14, 2023
Insert cell
Insert cell
Insert cell
chart = UsStateChoropleth(total_cattle_ops, {
id: d => namemap.get(d.state),
value: d => d.total_cattle_ops,
scale: d3.scaleQuantize,
domain: [0, 114100],
range: d3.schemeBuPu[7],
title: (f, d) => `${f.properties.name}\n${d?.total_cattle_ops}%`
})
Insert cell
total_cattle_ops = FileAttachment("USDA_2017_Cattle_Production.csv").csv({typed: true})
Insert cell
string
integer
integer
integer
integer
0
Alabama
17,539
386,354,988
71
6,653,967
1
Arizona
3,812
403,856,996
86
755,851,995
2
Arkansas
21,360
707,365,989
69
9,940,986
3
California
10,267
3,111,325,998
1,287
6,422,664,983
4
Colorado
12,024
3,336,895,988
164
650,271,986
5
Connecticut
659
3,730,997
124
79,772,998
6
Delaware
192
5,799,000
30
16,755,000
7
Florida
13,734
457,579,992
147
410,975,978
8
Georgia
13,234
293,080,962
243
223,696,958
9
Idaho
8,757
1,563,423,994
491
2,315,033,990
10
Illinois
13,946
731,682,983
722
285,829,969
11
Indiana
13,529
443,649,984
1,290
561,161,973
12
Iowa
23,427
4,540,441,989
1,248
692,329,968
13
Kansas
24,211
9,181,653,986
368
295,259,965
14
Kentucky
32,109
986,701,994
658
158,038,961
15
Louisiana
9,913
222,179,988
103
28,456,993
16
Maine
1,253
18,833,994
286
129,145,996
17
Maryland
2,517
75,041,000
389
168,952,995
18
Massachusetts
754
10,915,997
128
44,872,998
19
Michigan
9,539
580,989,995
1,652
1,766,130,993
usda_2017_cattle_production
51 rows
USDA_2017_Cattle_Production.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
namemap = new Map(states.features.map(d => [d.properties.name, d.id]))
Insert cell
Insert cell
function UsStateChoropleth(data, {
features = states,
borders = statemesh,
width = 975,
height = 610,
...options
} = {}) {
return Choropleth(data, {features, borders, width, height, ...options});
}
Insert cell
import {us, states, statemesh, Choropleth, Legend} from "@d3/choropleth"
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