scanpy.pl.StackedViolin.add_totals
- StackedViolin.add_totals(show=True, sort=None, size=0.8, color=None)
Show barplot for the number of cells in in
groupby
category.The barplot is by default shown on the right side of the plot or on top if the axes are swapped.
- Parameters
- show :
bool
|None
Optional
[bool
] (default:True
) Boolean to turn on (True) or off (False) ‘add_totals’
- sort : {‘ascending’, ‘descending’} |
None
Optional
[Literal
[‘ascending’, ‘descending’]] (default:None
) Set to either ‘ascending’ or ‘descending’ to reorder the categories by cell number
- size :
float
|None
Optional
[float
] (default:0.8
) size of the barplot. Corresponds to width when shown on the right of the plot, or height when shown on top. The unit is the same as in matplotlib (inches).
- color :
str
|Tuple
[float
, …] |Sequence
[Union
[str
,Tuple
[float
, …]]] |None
Union
[str
,Tuple
[float
, …],Sequence
[Union
[str
,Tuple
[float
, …]]],None
] (default:None
) Color for the bar plots or list of colors for each of the bar plots. By default, each bar plot uses the colors assigned in
adata.uns[{groupby}_colors]
.
- show :
- Returns
BasePlot
Examples
>>> adata = sc.datasets.pbmc68k_reduced() >>> markers = {'T-cell': 'CD3D', 'B-cell': 'CD79A', 'myeloid': 'CST3'} >>> sc.pl.BasePlot(adata, markers, groupby='bulk_labels').add_totals().show()