troutpy.pl.crosstab#
- troutpy.pl.crosstab(sdata, xvar, yvar, layer='transcripts', normalize=True, axis=1, kind='barh', save=True, figures_path='', stacked=True, figsize=None, cmap='troutpy', saving_format='pdf', sortby=None)#
Generate a cross-tabulation plot between two categorical variables from
sdata.points.- Parameters:
sdata (
SpatialData) – The input spatial data object containing the categorical variables.xvar (
str) – The categorical variable for the x-axis.yvar (
str) – The categorical variable for the y-axis.layer (
str(default:'transcripts')) – The layer insdata.pointsto extract data from.normalize (
bool(default:True)) – Whether to normalize proportions.axis (
int(default:1)) – Axis to normalize across (1 = row, 0 = column).kind (
str(default:'barh')) – Plot type:"barh","bar","heatmap", or"clustermap".save (
bool(default:True)) – Whether to save the plot.figures_path (
str(default:'')) – Path to save the plot.stacked (
bool(default:True)) – Whether bar plots should be stacked.figsize (
Optional[tuple] (default:None)) – Automatically computed based on the number of categories unless manually specified.cmap (
str(default:'troutpy')) – Custom color palette, resolved viatroutpy.pl.get_colormap().saving_format (
str(default:'pdf')) – File format to save the plot (e.g."png","pdf").sortby (
Optional[str] (default:None)) – Column/row to sort before plotting.
- Return type:
- Returns:
None