Skip to contents

Draws a heatmap of the normalized gravity connectivity matrix \(\pi_{ij}\) (calc_diffusion_matrix_pi), the probability that a traveler leaving origin \(i\) arrives at destination \(j\). This is the \(\pi_{ij}\) panel of the "spatial" figure group in render_MOSAIC_figures.

Usage

plot_diffusion_pi(pi, location_name = rownames(pi), latitude = NULL)

Arguments

pi

Numeric J x J connectivity matrix from calc_mobility_flux (element $pi), diagonal NA.

location_name

Character vector of length J giving axis labels in the order of pi's rows/columns. Defaults to rownames(pi).

latitude

Numeric vector of length J giving each location's latitude in the row order of pi; used to order the axes south-to-north (matching plot_mobility). When NULL (default) the axes are left in the order of location_name.

Value

Invisibly, the ggplot2 object.

Details

The aesthetic matches the published \(\pi\) panel of plot_mobility exactly (theme_bw(), viridis "G" fill, bottom colorbar). Axes are ordered south-to-north by latitude via a keyed factor(levels = ) over the named matrix (values follow their labels); no positional sort of labels is performed.

This is the model-derived sibling of the observed-OAG \(\pi\) panel in plot_mobility; the two visualize different quantities (modeled vs observed) and are intentionally separate.