Skip to contents

Draws the network with plot_network() using a geographic layout, then places a Stadia map tile underneath it. All styling (edges, nodes, labels, palettes, ...) is handled by plot_network(), so any changes made there carry through automatically.

Usage

plot_staticmap(
  g,
  key = NULL,
  lat = "lat",
  long = "long",
  zoom = 5,
  maptype = "stamen_terrain",
  lon_range = NULL,
  lat_range = NULL,
  pad = 0.05,
  jitter = 0,
  seed = 2026,
  theme = "minimal",
  ...
)

Arguments

g

An igraph network.

key

Stadia API key. See https://stadiamaps.com.

lat, long

Vertex attributes holding latitude and longitude.

zoom

Stadia tile zoom.

maptype

Stadia map tile type.

lon_range, lat_range

Optional length-2 vectors. If both are supplied, the network is filtered to nodes inside this box and the map is cropped to it.

pad

Fraction of the node extent added around the edges of the map when lon_range/lat_range are not supplied.

jitter

Maximum random shift (in degrees) applied to each node's position, so nodes in the same place don't overlap. Applied after filtering by lon_range/lat_range.

seed

Random seed used for the jitter (and passed to plot_network()).

theme

Plot theme: "minimal", "black white", "void", or "blank" (keeps the theme from plot_network()).

...

Further arguments passed to plot_network(), e.g. fill, shape, edge, label, node_size, pal.

Value

A ggplot object, or NULL (invisibly) if no key is given.

Examples

if (FALSE) { # \dontrun{
plot_staticmap(example_network, key = my_key, zoom = 11, fill = "site")
} # }