geosnap.visualize.plot_transition_matrix

geosnap.visualize.plot_transition_matrix(gdf=None, cluster_col=None, w_type='rook', w_options=None, temporal_index='year', unit_index='geoid', permutations=0, figsize=(13, 12), n_rows=None, n_cols=None, suptitle=None, title_kwds=None, savefig=None, dpi=300, transition_model=None)[source]

Plot global and spatially-conditioned transition matrices as heatmaps.

Parameters:
gdfgeopandas.GeoDataFrame

a long-form geodataframe with columns for unit index, time index, and class value

cluster_colstr

column on the gdf containing neighborhood type labels

temporal_indexstr, optional

Column defining time and or sequencing of the long-form data. Default is “year”.

unit_indexstr, optional

Column identifying the unique id of spatial units. Default is “geoid”.

w_typestr, optional

Type of spatial weights type (“rook”, “queen”, “knn” or “kernel”) to be used for spatial structure. Default is None, if non-spatial Markov transition rates are desired.

w_optionsdict

additional options passed to a libpysal weights constructor (e.g. k for a KNN weights matrix)

permutationsint, optional

number of permutations for use in randomization based inference (the default is 0).

figsizetuple, optional

size of the resulting figure (13, 12)

n_rowsint, optional

rows in the plot; n_rows * n_cols must be >= the number of neighborhood types

n_colsint, optional

columns in the plot; n_rows * n_cols must be >= the number of neighborhood types

suptitlestr, optional

title of the figure

title_kwdsdict, optional

additional keyword options for formatting the title

savefigstr, optional

location the plot will be saved

dpiint, optional

dpi of the resulting image, default is 300

Returns:
matplotlib Axes

the axes on which the plots are drawn