scanpy.pl.StackedViolin.style

scanpy.pl.StackedViolin.style#

StackedViolin.style(*, cmap=_empty, stripplot=_empty, jitter=_empty, jitter_size=_empty, linewidth=_empty, row_palette=_empty, density_norm=_empty, yticklabels=_empty, ylim=_empty, x_padding=_empty, y_padding=_empty, scale=_empty)[source]#

Modifies plot visual parameters

Parameters:
cmap Colormap | str | None | Empty (default: _empty)

Matplotlib color map, specified by name or directly. If None, use matplotlib.rcParams["image.cmap"]

stripplot bool | Empty (default: _empty)

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

jitter float | bool | Empty (default: _empty)

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

jitter_size float | Empty (default: _empty)

Size of the jitter points.

linewidth float | None | Empty (default: _empty)

line width for the violin plots. If None, use matplotlib.rcParams["lines.linewidth"]

row_palette str | None | Empty (default: _empty)

The row palette determines the colors to use for the stacked violins. If None, use matplotlib.rcParams["axes.prop_cycle"] 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 Union[Literal['area', 'count', 'width'], Empty] (default: _empty)

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 | Empty (default: _empty)

Set to true to view the y tick labels.

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

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

x_padding float | Empty (default: _empty)

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

y_padding float | Empty (default: _empty)

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()