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:
- gdf
geopandas.GeoDataFrame
a long-form geodataframe with columns for unit index, time index, and class value
- cluster_col
str
column on the gdf containing neighborhood type labels
- temporal_index
str
, optional Column defining time and or sequencing of the long-form data. Default is “year”.
- unit_index
str
, optional Column identifying the unique id of spatial units. Default is “geoid”.
- w_type
str
, 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_options
dict
additional options passed to a libpysal weights constructor (e.g. k for a KNN weights matrix)
- permutations
int
, optional number of permutations for use in randomization based inference (the default is 0).
- figsize
tuple
, optional size of the resulting figure (13, 12)
- n_rows
int
, optional rows in the plot; n_rows * n_cols must be >= the number of neighborhood types
- n_cols
int
, optional columns in the plot; n_rows * n_cols must be >= the number of neighborhood types
- suptitle
str
, optional title of the figure
- title_kwds
dict
, optional additional keyword options for formatting the title
- savefig
str
, optional location the plot will be saved
- dpi
int
, optional dpi of the resulting image, default is 300
- gdf
- Returns:
matplotlib
Axes
the axes on which the plots are drawn