Skip to content

Geo mark ^0.6.1

The geo mark draws geographic features — polygons, lines, points, and other geometry — often as thematic maps. It works with Plot’s projection system. For example, the choropleth map below shows unemployment by county in the United States.

Unemployment (%)
Fork
js
Plot.plot({
  projection: "albers-usa",
  color: {
    type: "quantile",
    n: 9,
    scheme: "blues",
    label: "Unemployment (%)",
    legend: true
  },
  marks: [
    Plot.geo(counties, {
      fill: "unemployment",
      title: (d) => `${d.properties.name} ${d.properties.unemployment}%`,
      tip: true
    })
  ]
})

A geo mark’s data is typically GeoJSON. You can pass a single GeoJSON object, a feature or geometry collection, or an array or iterable of GeoJSON objects; Plot automatically normalizes these into an array of features or geometries. When a mark’s data is GeoJSON, Plot will look for the specified field name (such as unemployment above, for fill) in the GeoJSON object’s properties if the object does not have this property directly. ^0.6.16

The size of Point and MultiPoint geometries is controlled by the r option. For example, below we show earthquakes in the last seven days with a magnitude of 2.5 or higher as reported by the USGS. As with the dot mark, the effective radius is controlled by the r scale, which is by default a sqrt scale such that the area of a point is proportional to its value. And likewise point geometries are by default sorted by descending radius to reduce occlusion, drawing the smallest circles on top. Set the sort option to null to use input order instead.

M 7.7 - 2025 Mandalay, Burma (Myanmar) EarthquakeM 6.7 - Burma (Myanmar)M 6.7 - 164 km WSW of Riverton, New ZealandM 6.6 - central Mid-Atlantic RidgeM 6.1 - central Mid-Atlantic RidgeM 5.7 - South Sandwich Islands regionM 5.6 - 74 km SSE of Adak, AlaskaM 5.4 - 71 km NW of Isangel, VanuatuM 5.4 - 55 km ENE of La Tirana, ChileM 5.4 - 169 km WSW of Riverton, New ZealandM 5.3 - South Sandwich Islands regionM 5.3 - 63 km WSW of Sola, VanuatuM 5.2 - Mariana Islands regionM 5.2 - 22 km SW of Merke, KazakhstanM 5.2 - 44 km ESE of Kandrian, Papua New GuineaM 5.2 - 24 km N of La Serena, ChileM 5.2 - 77 km SSE of Adak, AlaskaM 5.1 - 80 km S of Panguna, Papua New GuineaM 5.1 - 191 km SSE of Port Blair, IndiaM 5.1 - 154 km ESE of Neiafu, TongaM 5.1 - 114 km N of Tarama, JapanM 5.0 - 22 km WSW of Merke, KazakhstanM 5.0 - 54 km ENE of Lakatoro, VanuatuM 5.0 - Easter Island regionM 5.0 - 94 km SE of Honiara, Solomon IslandsM 5.0 - 272 km WSW of Tual, IndonesiaM 5.0 - 14 km NNE of Le Lorrain, MartiniqueM 5.0 - 20 km WSW of Xuyong, ChinaM 5.0 - South Sandwich Islands regionM 4.9 - 19 km NNW of Atka, AlaskaM 4.9 - northwest of the Kuril IslandsM 4.9 - Burma (Myanmar)M 4.9 - 14 km W of Sagaing, Burma (Myanmar)M 4.9 - 42 km WSW of Ashkāsham, AfghanistanM 4.9 - Kermadec Islands, New ZealandM 4.9 - 145 km SW of Sarangani, PhilippinesM 4.9 - 103 km N of Labuan Bajo, IndonesiaM 4.9 - Nicobar Islands, India regionM 4.9 - 163 km WSW of Riverton, New ZealandM 4.9 - 62 km NNE of Kerman, IranM 4.9 - 197 km SSE of Burica, PanamaM 4.8 - northern East Pacific RiseM 4.8 - 29 km E of Taungdwingyi, Burma (Myanmar)M 4.8 - Pacific-Antarctic RidgeM 4.8 - 104 km SSE of Lata, Solomon IslandsM 4.8 - 163 km SE of Kandrian, Papua New GuineaM 4.8 - 208 km SE of Port Blair, IndiaM 4.8 - south of the Kermadec IslandsM 4.7 - 268 km SE of Alo, Wallis and FutunaM 4.7 - 54 km ENE of Pototano, IndonesiaM 4.7 - 41 km NW of Auki, Solomon IslandsM 4.7 - 31 km SE of Suklayin, PhilippinesM 4.7 - Easter Island regionM 4.7 - 227 km WSW of Tual, IndonesiaM 4.7 - Kermadec Islands regionM 4.7 - 73 km E of Kinablangan, PhilippinesM 4.6 - BurmaM 4.6 - 23 km NE of Shwebo, Burma (Myanmar)M 4.6 - 5 km ENE of Ōtaki, JapanM 4.6 - 9 km NNE of Unidad, PhilippinesM 4.6 - east of the Kuril IslandsM 4.6 - 40 km NNW of Bintuni, IndonesiaM 4.6 - South Sandwich Islands regionM 4.6 - 222 km NW of Sabang, IndonesiaM 4.6 - 76 km SSW of Singaparna, IndonesiaM 4.6 - 161 km ENE of Masohi, IndonesiaM 4.6 - 31 km WNW of Coronel, ChileM 4.5 - 71 km SW of Modisi, IndonesiaM 4.5 - 22 km S of Yamethin, Burma (Myanmar)M 4.5 - 145 km N of Manatutu, Timor LesteM 4.5 - BurmaM 4.5 - 3 km NNW of Pyinmana, Burma (Myanmar)M 4.5 - BurmaM 4.5 - 13 km NE of Coyuquilla Norte, MexicoM 4.5 - 20 km NE of Oía, GreeceM 4.5 - 51 km ESE of Bobon, PhilippinesM 4.5 - 95 km SE of Puerto Natales, ChileM 4.5 - 33 km SSW of Yangliuqing, ChinaM 4.5 - 297 km E of Levuka, FijiM 4.5 - 193 km WSW of Riverton, New ZealandM 4.5 - 39 km SW of Blangpidie, IndonesiaM 4.5 - 77 km SW of Gorontalo, IndonesiaM 4.5 - 100 km N of Ambon, IndonesiaM 4.5 - Kermadec Islands regionM 4.5 - 297 km E of Levuka, FijiM 4.5 - 14 km ENE of Baganga, PhilippinesM 4.5 - 174 km E of Miyakojima, JapanM 4.4 - Fiji regionM 4.4 - 99 km E of Mawlaik, Burma (Myanmar)M 4.4 - 11 km NE of Shwebo, Burma (Myanmar)M 4.4 - 11 km SE of Berekua, DominicaM 4.4 - 107 km NNW of Lobuche, NepalM 4.4 - Fiji regionM 4.4 - 25 km WSW of Nemuro, JapanM 4.4 - 270 km ESE of Levuka, FijiM 4.4 - 69 km E of Sōma, JapanM 4.4 - Fiji regionM 4.4 - 291 km ENE of Lospalos, Timor LesteM 4.4 - 190 km S of Burica, PanamaM 4.4 - 78 km S of Faro, PortugalM 4.4 - 102 km SSE of Adak, AlaskaM 4.4 - Banda SeaM 4.3 - 29 km W of Ashkāsham, AfghanistanM 4.3 - Pagan region, Northern Mariana IslandsM 4.3 - 52 km NW of Loikaw, Burma (Myanmar)M 4.3 - 23 km N of Mutsu, JapanM 4.3 - 28 km SSE of Jurm, AfghanistanM 4.3 - 255 km NNW of Gorontalo, IndonesiaM 4.3 - 115 km WNW of Panguna, Papua New GuineaM 4.3 - 3 km WSW of Aratoca, ColombiaM 4.3 - 88 km NNW of Pototano, IndonesiaM 4.3 - 65 km WNW of Mosteiros, PortugalM 4.3 - 3 km NNW of Darband, TajikistanM 4.3 - 190 km WSW of Riverton, New ZealandM 4.3 - 288 km E of Levuka, FijiM 4.3 - 179 km N of Likisá, Timor LesteM 4.3 - 5 km ENE of Hitachi-Naka, JapanM 4.2 - 24 km SSE of Jurm, AfghanistanM 4.2 - 52 km NNW of Sandy Ground Village, AnguillaM 4.2 - 260 km SE of Alo, Wallis and FutunaM 4.2 - 48 km W of San Pedro de Atacama, ChileM 4.2 - 57 km NNE of Masohi, IndonesiaM 4.2 - 110 km WSW of Gejiu, ChinaM 4.2 - 14 km WSW of San Agustín, El SalvadorM 4.2 - 48 km WSW of Calingasta, ArgentinaM 4.2 - 92 km ESE of Hasaki, JapanM 4.2 - 159 km ESE of Sarangani, PhilippinesM 4.2 - 13 km SSE of Romanovka, RussiaM 4.2 - 71 km W of Bandar Abbas, IranM 4.2 - 222 km NNE of Palu, IndonesiaM 4.1 - 116 km NE of Taunggyi, Burma (Myanmar)M 4.1 - 170 km N of Kuril’sk, RussiaM 4.1 - 276 km WSW of Tual, IndonesiaM 4.1 - 38 km SW of San Pedro de Atacama, ChileM 4.1 - 16 km WNW of Ngongotaha, New ZealandM 4.1 - 74 km WNW of Petersville, AlaskaM 4.1 - 146 km SE of Ungsang-nodongjagu, North KoreaM 4.0 - 73 km SSE of Adak, AlaskaM 4.0 - 30 km SSE of Jurm, AfghanistanM 4.0 - 142 km SE of Kuqa, ChinaM 4.0 - 11 km NW of Yasuj, IranM 3.9 - 91 km S of Adak, AlaskaM 3.9 - Rat Islands, Aleutian Islands, AlaskaM 3.9 - 75 km SSE of Adak, AlaskaM 3.9 - 90 km SSE of Hualien City, TaiwanM 3.8 - 141 km NNE of Vieques, Puerto RicoM 3.8 - 110 km S of Adak, AlaskaM 3.8 - 22 km SSW of San Rafael del Yuma, Dominican RepublicM 3.8 - 4 km N of Guaymate, Dominican RepublicM 3.8 - 131 km SW of Nikolski, AlaskaM 3.8 - 77 km NNE of Cruz Bay, U.S. Virgin IslandsM 3.7 - 17 km ENE of Yerington, NevadaM 3.7 - 130 km WSW of Adak, AlaskaM 3.7 - 80 km SW of Unalaska, AlaskaM 3.7 - 22 km NNE of Punta Cana, Dominican RepublicM 3.6 - 47 km E of Fort Bidwell, CaliforniaM 3.6 - 45 km SSE of Nelchina, AlaskaM 3.6 - 29 km NNE of Skwentna, AlaskaM 3.6 - 97 km SSE of Adak, AlaskaM 3.6 - 94 km SSE of Adak, AlaskaM 3.5 - 73 km NNE of Cruz Bay, U.S. Virgin IslandsM 3.5 - 124 km SW of Adak, AlaskaM 3.5 - 32 km SW of Paxson, AlaskaM 3.4 - 99 km E of McCarthy, AlaskaM 3.4 - 32 km S of Scenic, ArizonaM 3.4 - 130 km NNE of Vieques, Puerto RicoM 3.4 - 67 km WNW of Petrolia, CAM 3.3 - 133 km NNE of Vieques, Puerto RicoM 3.3 - 3 km W of Estacion Coahuila, B.C., MXM 3.3 - 55 km NNE of Charlotte Amalie, U.S. Virgin IslandsM 3.3 - 44 km SSE of Nelchina, AlaskaM 3.3 - 52 km N of Petersville, AlaskaM 3.3 - 32 km S of Scenic, ArizonaM 3.3 - 178 km S of Atka, AlaskaM 3.3 - 52 km W of Stella, Puerto RicoM 3.2 - 74 km N of Tierras Nuevas Poniente, Puerto RicoM 3.2 - 103 km SSE of Adak, AlaskaM 3.2 - 95 km SE of Adak, AlaskaM 3.2 - 67 km N of San Antonio, Puerto RicoM 3.2 - 31 km WSW of Kailua-Kona, HawaiiM 3.2 - 75 km W of Pole Ojea, Puerto RicoM 3.1 - 74 km ESE of Maneadero, B.C., MXM 3.1 - 107 km NW of Yakutat, AlaskaM 3.1 - 2 km SSE of Indios, Puerto RicoM 3.0 - 59 km NNW of Culebra, Puerto RicoM 3.0 - 62 km W of Tyonek, AlaskaM 3.0 - 260 km W of Adak, AlaskaM 3.0 - 58 km SE of Mud Bay, AlaskaM 3.0 - 39 km WNW of Skwentna, AlaskaM 3.0 - 54 km S of Whites City, New MexicoM 3.0 - 76 km SSW of Kaktovik, AlaskaM 3.0 - 12 km NE of Pāhala, HawaiiM 3.0 - 13 km NE of Coachella, CAM 3.0 - 44 km SW of Captain Cook, HawaiiM 3.0 - 5 km SSW of Tallaboa, Puerto RicoM 3.0 - 16 km W of Johannesburg, CAM 2.9 - 9 km NNW of Brenas, Puerto RicoM 2.9 - 42 km WSW of Petrolia, CAM 2.9 - 2 km NW of Orocovis, Puerto RicoM 2.9 - 11 km W of Stanley, IdahoM 2.9 - 14 km NNE of Luray, KansasM 2.9 - 31 km S of Scenic, ArizonaM 2.9 - 3 km SSW of Pāhala, HawaiiM 2.8 - 57 km W of Waldport, OregonM 2.8 - 22 km ESE of Black Rock City, NevadaM 2.8 - 15 km NNW of Hope, AlaskaM 2.8 - 31 km NW of Toyah, TexasM 2.8 - 16 km N of Willow, AlaskaM 2.8 - 53 km WNW of Ninilchik, AlaskaM 2.8 - 60 km ENE of Pedro Bay, AlaskaM 2.8 - 83 km SSE of Adak, AlaskaM 2.8 - 93 km SSE of Adak, AlaskaM 2.8 - 101 km SSE of Adak, AlaskaM 2.8 - 40 km SW of Covenant Life, AlaskaM 2.8 - 19 km N of Dorado, Puerto RicoM 2.8 - 16 km SSE of Mammoth Lakes, CAM 2.8 - 0 km ESE of Indios, Puerto RicoM 2.7 - 8 km NNW of Swede Heaven, WashingtonM 2.7 - 46 km E of Fort Bidwell, CaliforniaM 2.7 - 15 km W of Johannesburg, CAM 2.7 - 53 km W of Mentone, TexasM 2.7 - 108 km SSE of Adak, AlaskaM 2.7 - 92 km SSE of Adak, AlaskaM 2.7 - 11 km SSE of Pāhala, HawaiiM 2.7 - 17 km SE of Grace, IdahoM 2.7 - 5 km W of Dublin, CAM 2.6 - 2 km WSW of Indios, Puerto RicoM 2.6 - 57 km NW of Toyah, TexasM 2.6 - 24 km SW of Coyanosa, TexasM 2.6 - 66 km SSW of Point Hope, AlaskaM 2.6 - 23 km E of Honaunau-Napoopoo, HawaiiM 2.6 - 5 km WSW of Formoso, KansasM 2.6 - 31 km SSE of Bunkerville, NevadaM 2.6 - 9 km W of Stanley, IdahoM 2.6 - 3 km S of Milton, KansasM 2.6 - 37 km E of Pedro Bay, AlaskaM 2.6 - 55 km S of Whites City, New MexicoM 2.6 - 61 km S of Whites City, New MexicoM 2.6 - 63 km SSE of Adak, AlaskaM 2.6 - 50 km S of Adak, AlaskaM 2.6 - 239 km WSW of Adak, AlaskaM 2.6 - 29 km S of Tallaboa, Puerto RicoM 2.6 - 10 km ESE of Alum Rock, CAM 2.6 - 13 km WSW of Searles Valley, CAM 2.5 - 3 km S of Indios, Puerto RicoM 2.5 - 3 km WSW of San Bernardino, CAM 2.5 - 5 km WNW of Dublin, CAM 2.5 - 3 km SSE of Ridgemark, CAM 2.5 - 18 km W of Manton, CAM 2.5 - 4 km ENE of Oak Bay, CanadaM 2.5 - 1 km SSE of Indios, Puerto RicoM 2.5 - 7 km SSW of Guánica, Puerto RicoM 2.5 - 17 km ESE of Point Possession, AlaskaM 2.5 - 31 km SSE of Bunkerville, NevadaM 2.5 - 16 km NNE of Amanda Park, WashingtonM 2.5 - 34 km WSW of Tatitlek, AlaskaM 2.5 - 64 km S of Alcan Border, AlaskaM 2.5 - 70 km NNE of Petersville, AlaskaM 2.5 - 31 km NW of Toyah, TexasM 2.5 - 224 km ESE of Chiniak, AlaskaM 2.5 - 17 km NE of Yerington, NevadaM 2.5 - 15 km ENE of Yerington, NevadaM 2.5 - 9 km SSE of Toyah, TexasM 2.5 - 55 km S of Whites City, New MexicoM 2.5 - 12 km NE of Susitna, AlaskaM 2.5 - 35 km SSE of Skwentna, AlaskaM 2.5 - 4 km SE of Maria Antonia, Puerto RicoM 2.5 - 1 km ESE of Indios, Puerto RicoM 2.5 - 1 km W of Indios, Puerto RicoM 2.5 - 1 km SE of Indios, Puerto RicoFork
js
Plot.plot({
  projection: "equirectangular",
  r: {transform: (r) => Math.pow(10, r)}, // Richter to amplitude
  marks: [
    Plot.geo(land, {fill: "currentColor", fillOpacity: 0.2}),
    Plot.sphere(),
    Plot.geo(earthquakes, {
      r: "mag",
      fill: "red",
      fillOpacity: 0.2,
      stroke: "red",
      title: "title",
      href: "url",
      target: "_blank"
    })
  ]
})

TIP

Click on any of the earthquakes above to see details.

The graticule helper draws a uniform grid of meridians (lines of constant longitude) and parallels (lines of constant latitude) every 10° between ±80° latitude; for the polar regions, meridians are drawn every 90°. The sphere helper draws the outline of the projected sphere.

Fork
js
Plot.plot({
  inset: 2,
  projection: {type: "orthographic", rotate: [0, -30, 20]},
  marks: [
    Plot.sphere({fill: "white", stroke: "currentColor"}),
    Plot.graticule({strokeOpacity: 0.3})
  ]
})

The geo mark’s geometry channel can be used to generate geometry from a non-GeoJSON data source. For example, below we visualize the shockwave created by the explosion of the Hunga Tonga–Hunga Haʻapai volcano on January 15, 2022 with a series of geodesic circles of increasing radius.

05,00010,00015,000Distance from Tonga (km)
Fork
js
Plot.plot({
  projection: {
    type: "equal-earth",
    rotate: [90, 0]
  },
  color: {
    legend: true,
    label: "Distance from Tonga (km)",
    transform: (d) => 111.2 * d, // degrees to km
    zero: true
  },
  marks: [
    Plot.geo(land),
    Plot.geo([0.5, 179.5].concat(d3.range(10, 171, 10)), {
      geometry: d3.geoCircle().center([-175.38, -20.57]).radius((r) => r),
      stroke: (r) => r,
      strokeWidth: 2
    }),
    Plot.sphere()
  ]
})

By default, the geo mark doesn’t have x and y channels; when you use the tip option, the centroid transform is implicitly applied on the geometries to compute the tip position by generating x and y channels. ^0.6.16 You can alternatively specify these channels explicitly. The centroids are shown below in red.

Fork
js
Plot.plot({
  projection: "albers-usa",
  marks: [
    Plot.geo(states, {strokeOpacity: 0.1, tip: true, title: "name"}),
    Plot.geo(nation),
    Plot.dot(states, Plot.centroid({fill: "red", stroke: "white"}))
  ]
})

The geo mark supports faceting. Below, a comic strip of sorts shows the locations of Walmart store openings in past decades.

dateFork
js
Plot.plot({
  margin: 0,
  padding: 0,
  projection: "albers",
  fy: {interval: "10 years"},
  marks: [
    Plot.geo(statemesh, {strokeOpacity: 0.2}),
    Plot.geo(nation),
    Plot.geo(walmarts, {fy: "date", r: 1.5, fill: "blue", tip: true, title: "date"}),
    Plot.axisFy({frameAnchor: "top", dy: 30, tickFormat: (d) => `${d.getUTCFullYear()}’s`})
  ]
})

INFO

This uses the interval scale option to bin temporal data into facets by decade.

Lastly, the geo mark is not limited to spherical geometries! Plot’s projection system includes planar projections, which allow you to work with shapes — such as contours — generated on an arbitrary flat surface.

Geo options

The geometry channel specifies the geometry (GeoJSON object) to draw; if not specified, the mark’s data is assumed to be GeoJSON.

In addition to the standard mark options, the r option controls the size of Point and MultiPoint geometries. It can be specified as either a channel or constant. When r is specified as a number, it is interpreted as a constant radius in pixels; otherwise it is interpreted as a channel and the effective radius is controlled by the r scale. If the r option is not specified it defaults to 3 pixels. Geometries with a nonpositive radius are not drawn. If r is a channel, geometries will be sorted by descending radius by default.

The x and y position channels may also be specified in conjunction with the tip option. ^0.6.16 These are bound to the x and y scale (or projection), respectively.

geo(data, options)

js
Plot.geo(counties, {fill: "rate"})

Returns a new geo mark with the given data and options. If data is a GeoJSON feature collection, then the mark’s data is data.features; if data is a GeoJSON geometry collection, then the mark’s data is data.geometries; if data is some other GeoJSON object, then the mark’s data is the single-element array [data]. If the geometry option is not specified, data is assumed to be a GeoJSON object or an iterable of GeoJSON objects.

sphere(options) ^0.6.1

js
Plot.sphere()

Returns a new geo mark with a Sphere geometry object and the given options.

graticule(options) ^0.6.1

js
Plot.graticule()

Returns a new geo mark with a 10° global graticule geometry object and the given options.