Skip to content

Commit d7d283f

Browse files
committed
sketch examples for release notes
1 parent 3b9866c commit d7d283f

File tree

1 file changed

+99
-1
lines changed

1 file changed

+99
-1
lines changed

CHANGELOG.md

Lines changed: 99 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,107 @@
66

77
The new [geo mark](https://observablehq.com/@observablehq/plot-geo)
88

9+
```js
10+
Plot.geo(counties, {fill: (d) => d.properties.unemployment}).plot({
11+
projection: "albers-usa",
12+
color: {
13+
type: "quantile",
14+
n: 8,
15+
scheme: "blues",
16+
label: "Unemployment (%)",
17+
legend: true
18+
}
19+
})
20+
```
21+
22+
Faceting.
23+
24+
```js
25+
Plot.plot({
26+
width: 960,
27+
height: 150,
28+
marginLeft: 0,
29+
marginRight: 0,
30+
projection: "albers",
31+
fx: { tickFormat: (d) => `${d}’s`, padding: 0 },
32+
facet: { data: walmarts, x: (d) => Math.floor(d.date.getUTCFullYear() / 10) * 10 },
33+
marks: [
34+
Plot.geo(statemesh, { clip: "frame", strokeOpacity: 0.1 }),
35+
Plot.dot(walmarts, { x: "longitude", y: "latitude", r: 1, fill: "currentColor" }),
36+
Plot.geo(nation, { clip: "frame" })
37+
]
38+
})
39+
```
40+
941
[Projections!](https://observablehq.com/@observablehq/plot-projections)
1042

11-
[Mapping with Plot](https://observablehq.com/@observablehq/plot-mapping)
43+
Projected vector.
44+
45+
```js
46+
Plot.plot({
47+
projection: "albers-usa",
48+
width: 975,
49+
marks: [
50+
Plot.geo(statemesh, {strokeWidth: 0.75}),
51+
Plot.geo(nation),
52+
Plot.vector(elections, {
53+
filter: (d) => d.votes > 0,
54+
anchor: "start",
55+
x: (d) => centroids.get(d.fips)?.[0],
56+
y: (d) => centroids.get(d.fips)?.[1],
57+
sort: (d) => Math.abs(+d.results_trumpd - +d.results_bidenj),
58+
stroke: (d) => (+d.results_trumpd > +d.results_bidenj ? "red" : "blue"),
59+
length: (d) => Math.sqrt(Math.abs(+d.margin2020 * +d.votes)),
60+
rotate: (d) => (+d.results_bidenj < +d.results_trumpd ? 60 : -60)
61+
})
62+
]
63+
})
64+
```
65+
66+
Projected line.
67+
68+
```js
69+
Plot.plot({
70+
projection: "equal-earth",
71+
marks: [
72+
Plot.geo(land, {fill: "currentColor"}),
73+
Plot.graticule(),
74+
Plot.line(beagle.coordinates, {stroke: (d, i) => i, z: null, strokeWidth: 2}),
75+
Plot.geo(london, {fill: "red", r: 5}),
76+
Plot.sphere()
77+
]
78+
})
79+
```
80+
81+
Projected transforms (hexbin aggregation).
82+
83+
```js
84+
Plot.plot({
85+
width: 975,
86+
projection: "albers",
87+
r: {
88+
range: [0, 20]
89+
},
90+
color: {
91+
legend: true,
92+
label: "First year opened",
93+
scheme: "spectral"
94+
},
95+
marks: [
96+
Plot.geo(statemesh, { strokeOpacity: 0.25 }),
97+
Plot.geo(nation),
98+
Plot.dot(
99+
walmarts,
100+
Plot.hexbin(
101+
{ r: "count", fill: "min" },
102+
{ x: "longitude", y: "latitude", fill: "date" }
103+
)
104+
)
105+
]
106+
})
107+
```
108+
109+
For more, see [Mapping with Plot](https://observablehq.com/@observablehq/plot-mapping).
12110

13111
Mark-level facets via the *mark*.**fx** and *mark*.**fy** option. E.g., facet annotations, or mixing datasets across marks while using facets.
14112

0 commit comments

Comments
 (0)