Skip to content

Commit 3892bd6

Browse files
committed
two techniques for bleed-edges maps
1 parent f5363f1 commit 3892bd6

File tree

5 files changed

+76
-12
lines changed

5 files changed

+76
-12
lines changed

test/output/projectionBleedEdges.svg

Lines changed: 4 additions & 5 deletions
Loading

test/output/projectionBleedEdges2.svg

Lines changed: 42 additions & 0 deletions
Loading

test/plots/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export {default as penguinSpeciesIslandRelative} from "./penguin-species-island-
171171
export {default as penguinSpeciesIslandSex} from "./penguin-species-island-sex.js";
172172
export {default as polylinear} from "./polylinear.js";
173173
export {default as projectionBleedEdges} from "./projection-bleed-edges.js";
174+
export {default as projectionBleedEdges2} from "./projection-bleed-edges2.js";
174175
export {default as projectionClipAngle} from "./projection-clip-angle.js";
175176
export {default as projectionClipAngleFrame} from "./projection-clip-angle-frame.js";
176177
export {default as projectionClipBerghaus} from "./projection-clip-berghaus.js";

test/plots/projection-bleed-edges.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ import {feature} from "topojson-client";
55
export default async function () {
66
const world = await d3.json("data/countries-50m.json");
77
const domain = feature(world, world.objects.land);
8+
const width = 600;
89
return Plot.plot({
9-
width: 600,
10-
height: 600,
10+
width,
11+
height: width,
12+
margin: -1,
1113
projection: {
12-
type: "azimuthal-equidistant",
13-
rotate: [0, -90],
14-
clipAngle: 35,
15-
inset: -100
14+
type: "azimuthal-equal-area",
15+
rotate: [45, -90],
16+
clipAngle: 31,
17+
inset: -width * (Math.SQRT1_2 - 0.5) // extend to corners instead of edges
1618
},
17-
marks: [Plot.graticule(), Plot.geo(domain, {fill: "#ccc", stroke: "currentColor"}), Plot.frame({stroke: "white"})]
19+
marks: [Plot.geo(domain, {fill: "#ccc", stroke: "currentColor"}), Plot.graticule()]
1820
});
1921
}

test/plots/projection-bleed-edges2.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import * as Plot from "@observablehq/plot";
2+
import * as d3 from "d3";
3+
import {feature} from "topojson-client";
4+
5+
export default async function () {
6+
const world = await d3.json("data/countries-110m.json");
7+
const domain = feature(world, world.objects.land);
8+
return Plot.plot({
9+
width: 600,
10+
height: 600,
11+
facet: {x: [1, 2], data: [1, 2]},
12+
projection: {
13+
type: "azimuthal-equidistant",
14+
rotate: [90, -90],
15+
clipAngle: 85,
16+
inset: -185
17+
},
18+
marks: [Plot.graticule(), Plot.geo(domain, {fill: "#ccc", stroke: "currentColor"}), Plot.frame({stroke: "white"})]
19+
});
20+
}

0 commit comments

Comments
 (0)