sccoda.util.data_visualization.stackbar¶
-
sccoda.util.data_visualization.
stackbar
(y, type_names, title, level_names, figsize=None, dpi=100, cmap=<matplotlib.colors.ListedColormap object>, plot_legend=True)¶ Plots a stacked barplot for one (discrete) covariate Typical use (only inside stacked_barplot): plot_one_stackbar(data.X, data.var.index, “xyz”, data.obs.index)
- Parameters
- y :
ndarray
ndarray
The count data, collapsed onto the level of interest. i.e. a binary covariate has two rows, one for each group, containing the count mean of each cell type
- type_names :
List
[str
]List
[str
] The names of all cell types
- title :
str
str
Plot title, usually the covariate’s name
- level_names :
List
[str
]List
[str
] names of the covariate’s levels
- figsize :
Tuple
[int
,int
],None
Optional
[Tuple
[int
,int
]] (default:None
) figure size
- dpi :
int
,None
Optional
[int
] (default:100
) dpi setting
- cmap :
ListedColormap
,None
Optional
[ListedColormap
] (default:<matplotlib.colors.ListedColormap object at 0x7fc15f8333d0>
) The color map for the barplot
- plot_legend :
bool
,None
Optional
[bool
] (default:True
) If True, adds a legend
- y :
- Return type
AxesSubplot
AxesSubplot
- Returns
Returns a plot
ax – a plot