Skip to content

Commit 7732410

Browse files
Filmbostock
authored andcommitted
two techniques for bleed-edges maps
1 parent 38a5232 commit 7732410

5 files changed

+72
-9
lines changed

test/output/projectionBleedEdges.svg

Lines changed: 4 additions & 4 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: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@ export default async function () {
77
const domain = feature(world, world.objects.land);
88
const width = 600;
99
return Plot.plot({
10-
width: width,
10+
width,
1111
height: width,
12-
margin: -1,
1312
projection: {
14-
type: "azimuthal-equidistant",
13+
type: "azimuthal-equal-area",
1514
rotate: [45, -90],
1615
domain: {type: "Sphere"},
17-
clipAngle: 31,
16+
clip: 31,
1817
inset: -width * (Math.SQRT1_2 - 0.5) // extend to corners instead of edges
1918
},
20-
marks: [Plot.graticule(), Plot.geo(domain, {fill: "#ccc", stroke: "currentColor"})]
19+
marks: [Plot.geo(domain, {fill: "#ccc", stroke: "currentColor"}), Plot.graticule()]
2120
});
2221
}

test/plots/projection-bleed-edges2.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 land = 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+
domain: d3.geoCircle().center([0, 90]).radius(85)(),
16+
clip: "frame",
17+
inset: -185
18+
},
19+
marks: [Plot.graticule(), Plot.geo(land, {fill: "#ccc", stroke: "currentColor"}), Plot.frame({stroke: "white"})]
20+
});
21+
}

0 commit comments

Comments
 (0)