Cropping a plot.geo map by land features

I’m creating a global choropleth map (sample notebook) using plot.geo and would like to crop and shift the map slightly, after I removed Antartica from the Mercator projection.

What’s the best way to do this? There’s a lot of whitespace at the bottom of the plot that i want to get rid of. I’d also like to move it a tiny bit to the left, to move that bit of Russia next to Alaska to the other side.

I thought restricting it via the domain option under projection would handle the cropping it, but I’m not sure what to pass/filter there.

import {world110m, world50m} from "@visionscarto/geo"

land = topojson.feature(world110m, world110m.objects.countries);

countByCountry = new Map(
  responseData.map(d => [d.country_code_alpha3, d[colorCriteria]])
);
Plot.plot({
  title: `Results by ${colorCriterias[colorCriteria]}`,
  projection: {
    type: "mercator",
    // domain: land.features.filter(d => d.properties.continent !== "Antarctica")
  },
  width,
  marks: [
    Plot.geo(
      land.features.filter(d => d.properties.continent !== "Antarctica"), 
      {
        fill: d => countByCountry.get(d.properties.a3),
        stroke: "black",
        strokeWidth: 0.25,
        tip: {
          x: d => d3.geoCentroid(d)[0],
          y: d => d3.geoCentroid(d)[1],
          title: d => {
            const count = countByCountry.get(d.properties.a3);

            return `${d.properties.name}\nPopulation: ${count ? count.toLocaleString() : "No data"}`;
          }
        }
      }
    ),
  ],
  color: {
    type: "quantize",
    domain: responseData.map(d => d[colorCriteria]),
    range: d3.schemeGreens[5],
    missing: "#ccc"
  }
})

Hello, would you mind moving this question to the Plot discussions board? We’re trying to centralize the help there. Thanks! Also, please share a notebook that has your current code, it will make it easier to answer.

1 Like

Sure thing. I’ve created that post here along with a sample notebook.