segregation.decomposition.DecomposeSegregation¶
- class segregation.decomposition.DecomposeSegregation(index1, index2, counterfactual_approach='composition')[source]¶
Decompose segregation differences into spatial and attribute components.
Given two segregation indices of the same type, use Shapley decomposition to measure whether the differences between index measures arise from differences in spatial structure or population structure
- Parameters:
- index1
segregation.SegIndexclass First SegIndex class to compare.
- index2
segregation.SegIndexclass Second SegIndex class to compare.
- counterfactual_approach
str,oneof{“composition”, “share”, “dual_composition”} The technique used to generate the counterfactual population distributions.
- index1
- Attributes:
Methods
__init__(index1, index2[, ...])Initialize class.
plot([plot_type, figsize, city_a, city_b, ...])Plot maps or CDFs of urban contexts used in calculating the Decomposition class.
- plot(plot_type='cdfs', figsize=None, city_a=None, city_b=None, cmap='OrRd', scheme='equalinterval', k=10, suptitle_size=16, title_size=12, savefig=None, dpi=300)[source]¶
Plot maps or CDFs of urban contexts used in calculating the Decomposition class.
- Parameters:
- plot_type
str, {‘cdfs, ‘maps’} which type of plot to generate. Options include cdfs and maps by default “cdfs”
- figsize
tuple,optional figsize parameter passed to matplotlib.pyplot
- city_a
str,optional Name of the first “city” to be used in plotting. If None, defaults to ‘City A’
- city_b
str,optional Name of the second “city” to be used in plotting. If None, defaults to ‘City B’
- cmap
str,optional matplotlib colormap used to shade the map, by default “OrRd”
- scheme
str,optional pysal.mapclassify classification scheme used to shade the map, by default “equalinterval”
- k
int,optional number of classes in pysal.mapclassify classification scheme, by default 10
- suptitle_size
int,optional size parameter passed to matplotlib.Figure.suptitle, by default 16
- title_size
int,optional size parameter passed to matplotlib.Axes.set_title, by default 12
- savefig
str,optional Location to save the figure if desired. If None, fig will not be saved
- dpi
int,optional dpi parameter passed to matplotlib.pyplot, by default 300
- plot_type
- Returns:
NoneGenerates a new matplotlib.Figure instance and optionally saves to disk