scanpy.pl.StackedViolin.style

scanpy.pl.StackedViolin.style#

StackedViolin.style(*, cmap='Blues', stripplot=False, jitter=False, jitter_size=1, linewidth=0.2, row_palette=None, density_norm='width', yticklabels=False, ylim=None, x_padding=0.5, y_padding=0.5, scale=None)[source]#

Modifies plot visual parameters

Parameters:
cmap str | None (default: 'Blues')

String denoting matplotlib color map.

stripplot bool | None (default: False)

Add a stripplot on top of the violin plot. See stripplot().

jitter float | bool | None (default: False)

Add jitter to the stripplot (only when stripplot is True) See stripplot().

jitter_size int | None (default: 1)

Size of the jitter points.

linewidth float | None (default: 0.2)

linewidth for the violin plots.

row_palette str | None (default: None)

The row palette determines the colors to use for the stacked violins. The value should be a valid seaborn or matplotlib palette name (see color_palette()). Alternatively, a single color name or hex value can be passed, e.g. 'red' or '#cc33ff'.

density_norm Literal['area', 'count', 'width'] (default: 'width')

The method used to scale the width of each violin. If ‘width’ (the default), each violin will have the same width. If ‘area’, each violin will have the same area. If ‘count’, a violin’s width corresponds to the number of observations.

yticklabels bool | None (default: False)

Set to true to view the y tick labels.

ylim tuple[float, float] | None (default: None)

minimum and maximum values for the y-axis. If set. All rows will have the same y-axis range. Example: ylim=(0, 5)

x_padding float | None (default: 0.5)

Space between the plot left/right borders and the violins. A unit is the distance between the x ticks.

y_padding float | None (default: 0.5)

Space between the plot top/bottom borders and the violins. A unit is the distance between the y ticks.

Return type:

Self

Returns:

StackedViolin

Examples

>>> import scanpy as sc
>>> adata = sc.datasets.pbmc68k_reduced()
>>> markers = ['C1QA', 'PSAP', 'CD79A', 'CD79B', 'CST3', 'LYZ']

Change color map and turn off edges

>>> sc.pl.StackedViolin(adata, markers, groupby='bulk_labels') \
...     .style(row_palette='Blues', linewidth=0).show()