-
| I'm creating a global choropleth map using  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  Sample notebook: https://observablehq.com/d/2e154369ef679bb7 (Side note: the tip is also not working, would love a... uh... tip about that too) import {world110m, world50m} from "@visionscarto/geo"
land = topojson.feature(world110m, world110m.objects.countries);
populationByCountry = new Map(
  Object.entries(await FileAttachment("[email protected]").json())
)Plot.plot({
  title: `Population size`,
  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) => populationByCountry.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 = populationByCountry.get(d.properties.a3);
            return `${d.properties.name}\nPopulation: ${
              count ? count.toLocaleString() : "No data"
            }`;
          }
        }
      }
    )
  ],
  color: {
    type: "quantize",
    domain: Array.from(populationByCountry.values()),
    range: d3.schemeGreens[5],
    missing: "#ccc"
  }
}) | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
| Here are some possible adjustments, with comments:   projection: {
    type: "mercator",
    // rotate the projection to reattach the tip of eastern Siberia
    rotate: [-10, 0], 
    // create a valid GeoJSON domain
    domain: {
      type: "FeatureCollection",
      // filter the features on valid properties (there is no "continent" property on this dataset)
      features: land.features.filter((d) => populationByCountry.get(d.properties.a3)) 
    }
  },
  width,
  // set the aspect ratio
  height: width * 0.65, | 
Beta Was this translation helpful? Give feedback.


Here are some possible adjustments, with comments: