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.

3.23.84.44.85.25.76.57.6Unemployment (%)
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 7.0 - 73 km SE of Pangai, TongaM 6.7 - Burma (Myanmar)M 6.6 - central Mid-Atlantic RidgeM 6.2 - 85 km SE of Pangai, TongaM 6.1 - central Mid-Atlantic RidgeM 5.8 - 86 km SE of Pangai, TongaM 5.7 - 205 km ENE of Lospalos, Timor LesteM 5.7 - South Sandwich Islands regionM 5.6 - 72 km SSW of Tambolaka, IndonesiaM 5.4 - 71 km NW of Isangel, VanuatuM 5.3 - 54 km SSE of Pangai, TongaM 5.3 - South Sandwich Islands regionM 5.3 - 55 km ENE of La Tirana, ChileM 5.2 - 6 km ESE of Vogar, IcelandM 5.2 - central Mid-Atlantic RidgeM 5.2 - Mariana Islands regionM 5.2 - 22 km SW of Merke, KazakhstanM 5.2 - 44 km ESE of Kandrian, Papua New GuineaM 5.1 - southern Mid-Atlantic RidgeM 5.1 - 59 km E of Egegik, AlaskaM 5.1 - 28 km NNW of Mandalay, Burma (Myanmar)M 5.1 - 12 km S of Banda Aceh, IndonesiaM 5.1 - 19 km SW of Nay Pyi Taw, Burma (Myanmar)M 5.1 - 80 km S of Panguna, Papua New GuineaM 5.0 - south of the Fiji IslandsM 5.0 - 15 km WNW of Mandalay, Burma (Myanmar)M 5.0 - 34 km ENE of Pototano, IndonesiaM 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 4.9 - 18 km SSW of Grindavík, IcelandM 4.9 - 6 km SE of Tingloy, PhilippinesM 4.9 - south of the Fiji IslandsM 4.9 - 93 km SE of Pangai, TongaM 4.9 - Southwest Indian RidgeM 4.9 - 82 km SE of Pangai, TongaM 4.9 - South Sandwich Islands regionM 4.9 - Mid-Indian RidgeM 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.8 - 37 km N of Nay Pyi Taw, Burma (Myanmar)M 4.8 - south of the Fiji IslandsM 4.8 - 93 km SE of Pangai, TongaM 4.8 - 92 km SE of Pangai, TongaM 4.8 - 60 km ESE of Fangale’ounga, TongaM 4.8 - 90 km SE of Pangai, TongaM 4.8 - Kermadec Islands regionM 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.7 - south of the Fiji IslandsM 4.7 - south of AfricaM 4.7 - 75 km SSE of Katsuura, JapanM 4.7 - 12 km SW of Zhaotong, ChinaM 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.6 - Fiji regionM 4.6 - 3 km SE of Vogar, IcelandM 4.6 - 5 km SE of Argelia, ColombiaM 4.6 - Greenland SeaM 4.6 - 173 km NE of Agats, IndonesiaM 4.6 - 65 km ESE of Uthal, PakistanM 4.6 - 218 km W of Tual, IndonesiaM 4.6 - 44 km SSE of Kushima, JapanM 4.6 - 12 km WNW of Mandalay, Burma (Myanmar)M 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.5 - 238 km NNE of Hicks Bay, New ZealandM 4.5 - 64 km NW of Kimbe, Papua New GuineaM 4.5 - 108 km ESE of Kokopo, Papua New GuineaM 4.5 - 70 km NW of San Antonio de los Cobres, ArgentinaM 4.5 - 30 km ENE of Palca, PeruM 4.5 - 25 km SW of Tambolaka, IndonesiaM 4.5 - Chagos Archipelago regionM 4.5 - 14 km SSW of Urakawa, JapanM 4.5 - 8 km WSW of Lumangbayan, PhilippinesM 4.5 - 3 km SSW of Inba, JapanM 4.5 - 74 km SSE of Gorontalo, IndonesiaM 4.5 - Vanuatu regionM 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.4 - 147 km ENE of Katobu, IndonesiaM 4.4 - 63 km SW of Ollagüe, ChileM 4.4 - Reykjanes RidgeM 4.4 - 108 km WNW of Abepura, IndonesiaM 4.4 - 27 km SSW of Blowing Point Village, AnguillaM 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.3 - 177 km SE of Hualien City, TaiwanM 4.3 - 73 km WSW of Taltal, ChileM 4.3 - 28 km E of Puerto Ocopa, PeruM 4.3 - 16 km W of Gündoğmuş, TurkeyM 4.3 - 82 km WNW of Dêqên, ChinaM 4.3 - 70 km WNW of Abra Pampa, ArgentinaM 4.3 - 160 km NNE of Labuan Bajo, IndonesiaM 4.3 - 27 km E of Shwebo, Burma (Myanmar)M 4.3 - 67 km W of Cantwell, AlaskaM 4.3 - 73 km WSW of Abra Pampa, ArgentinaM 4.3 - western XizangM 4.3 - 140 km W of Diego de Almagro, ChileM 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.2 - 33 km S of Beykonak, TurkeyM 4.2 - Rat Islands, Aleutian Islands, AlaskaM 4.2 - south of the Fiji IslandsM 4.2 - 62 km SW of Lithakiá, GreeceM 4.2 - 96 km WNW of San Antonio de los Cobres, ArgentinaM 4.2 - 17 km E of Shwebo, Burma (Myanmar)M 4.2 - 41 km NNW of Otrada, RussiaM 4.2 - 220 km E of Levuka, FijiM 4.2 - 24 km SSE of Jurm, AfghanistanM 4.2 - 12 km WNW of Mandalay, Burma (Myanmar)M 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.1 - 60 km SSE of Nemuro, JapanM 4.1 - 61 km ENE of Khorugh, TajikistanM 4.1 - 4 km NE of Sagaing, Burma (Myanmar)M 4.1 - 33 km NNW of Mejillones, ChileM 4.1 - 134 km WNW of Constitución, ChileM 4.1 - 26 km ESE of San Agustín de Valle Fértil, ArgentinaM 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.0 - 100 km SSW of Umm Bāb, QatarM 4.0 - 57 km NE of Valmy, NevadaM 4.0 - 86 km S of Pacocha, PeruM 4.0 - 42 km N of Hanmer Springs, New ZealandM 4.0 - 73 km SSE of Adak, AlaskaM 4.0 - 30 km SSE of Jurm, AfghanistanM 4.0 - 142 km SE of Kuqa, ChinaM 3.9 - 58 km E of Egegik, AlaskaM 3.8 - 85 km NE of Chalkyitsik, AlaskaM 3.8 - 127 km SW of Adak, AlaskaM 3.7 - 66 km NNE of Petersville, AlaskaM 3.7 - 47 km SSE of Denali National Park, AlaskaM 3.7 - 15 km ENE of Yerington, NevadaM 3.7 - 130 km WSW of Adak, AlaskaM 3.7 - 62 km NNW of San Antonio, Puerto RicoM 3.7 - 22 km NNE of Punta Cana, Dominican RepublicM 3.6 - 136 km NNE of Cruz Bay, U.S. Virgin IslandsM 3.6 - 33 km SSE of Bunkerville, NevadaM 3.6 - 47 km E of Fort Bidwell, CaliforniaM 3.5 - 13 km NNE of Wells, TexasM 3.5 - 32 km SW of Paxson, AlaskaM 3.4 - 47 km SSE of Punta Cana, Dominican RepublicM 3.4 - 54 km NE of Valmy, NevadaM 3.4 - off the coast of OregonM 3.4 - 99 km E of McCarthy, AlaskaM 3.4 - 32 km S of Scenic, ArizonaM 3.4 - 84 km N of Isabela, Puerto RicoM 3.4 - 28 km SSE of Malibu, CAM 3.3 - 114 km NNE of San Juan, Puerto RicoM 3.3 - 3 km W of Estacion Coahuila, B.C., MXM 3.3 - 20 km SSE of Honaunau-Napoopoo, HawaiiM 3.3 - 61 km E of Egegik, AlaskaM 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 - 52 km W of Stella, Puerto RicoM 3.2 - 24 km SSE of Cruz Bay, U.S. Virgin IslandsM 3.2 - 10 km W of Puerto Real, Puerto RicoM 3.2 - 74 km N of Tierras Nuevas Poniente, Puerto RicoM 3.2 - 2 km SE of Fox, 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 - 7 km WNW of Páchna, CyprusM 3.1 - 107 km NW of Yakutat, AlaskaM 3.1 - 27 km SSE of Malibu, CAM 3.1 - 60 km N of Isabela, Puerto RicoM 3.1 - 18 km ESE of Miches, Dominican RepublicM 3.1 - 18 km S of Cruz Bay, U.S. Virgin IslandsM 3.1 - 30 km NW of Aguadilla, Puerto RicoM 3.0 - 23 km N of Suárez, Puerto RicoM 3.0 - 1 km SSE of Indios, Puerto RicoM 3.0 - 16 km SSE of Newkirk, New MexicoM 3.0 - 65 km SE of Denali National Park, AlaskaM 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 - 12 km NE of Pāhala, HawaiiM 3.0 - 16 km NNW of Shoshone, CAM 3.0 - 5 km S of Guánica, Puerto RicoM 3.0 - 21 km SSE of Fern Forest, HawaiiM 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 - 59 km NE of Valmy, NevadaM 2.9 - 6 km SW of Fortuna, CAM 2.9 - 39 km WSW of Cantwell, AlaskaM 2.9 - 11 km W of Stanley, IdahoM 2.9 - 3 km SSW of Pāhala, HawaiiM 2.9 - 17 km SSE of Pāhala, HawaiiM 2.8 - 21 km WSW of Manton, CAM 2.8 - 17 km SSE of Petrolia, CAM 2.8 - 56 km S of Whites City, New MexicoM 2.8 - 56 km WNW of Anchor Point, AlaskaM 2.8 - 87 km WNW of Big Lagoon, CaliforniaM 2.8 - 22 km ESE of Black Rock City, NevadaM 2.8 - 16 km NNE of Pinnacles, CAM 2.8 - 19 km N of Dorado, Puerto RicoM 2.7 - 11 km E of Naalehu, HawaiiM 2.7 - 4 km SSE of Bombay Beach, CAM 2.7 - 46 km E of Fort Bidwell, CaliforniaM 2.7 - 65 km N of Petersville, AlaskaM 2.7 - 119 km W of Pistol River, OregonM 2.7 - 31 km NW of Toyah, TexasM 2.7 - 158 km WSW of Port Orford, OregonM 2.7 - 123 km NNE of Laupāhoehoe, HawaiiM 2.7 - 17 km SE of Grace, IdahoM 2.6 - 12 km SSW of Tres Pinos, CAM 2.6 - 2 km SW of Guánica, Puerto RicoM 2.6 - 55 km NE of Valmy, NevadaM 2.6 - 59 km NE of Valmy, NevadaM 2.6 - 49 km E of Fort Bidwell, CaliforniaM 2.6 - 2 km NW of Las Marias, Puerto RicoM 2.6 - 56 km S of Whites City, New MexicoM 2.6 - 21 km NNE of Yerington, NevadaM 2.6 - 28 km SSE of Mina, NevadaM 2.6 - 31 km NW of Toyah, TexasM 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 - 16 km W of Johannesburg, CAM 2.6 - 16 km WSW of Johannesburg, CAM 2.6 - 29 km S of Tallaboa, Puerto RicoM 2.6 - 11 km SSW of Naalehu, HawaiiM 2.6 - 10 km ESE of Alum Rock, CAM 2.5 - 23 km W of Petrolia, CAM 2.5 - 3 km SSE of Ridgemark, CAM 2.5 - 4 km ENE of Oak Bay, CanadaM 2.5 - 58 km S of Whites City, New MexicoM 2.5 - 40 km SE of Denali National Park, AlaskaM 2.5 - 54 km NE of Valmy, NevadaM 2.5 - 55 km WNW of Elfin Cove, AlaskaM 2.5 - 32 km S of Scenic, ArizonaM 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 - 1 km ESE of Indios, Puerto RicoM 2.5 - 19 km NNW of Laytonville, CAFork
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.

1960’s1970’s1980’s1990’s2000’sFork
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.