scanpy.pl.violin

scanpy.pl.violin(adata, keys, groupby=None, log=False, use_raw=None, stripplot=True, jitter=True, size=1, scale='width', order=None, multi_panel=None, show=None, xlabel='', rotation=None, save=None, ax=None, **kwds)
../_images/scanpy.pl.violin.png

Violin plot.

Wraps seaborn.violinplot for AnnData.

Parameters
adata : AnnData

Annotated data matrix.

keys : str or list of str

Keys for accessing variables of .var_names or fields of .obs.

groupby : str or None, optional (default: None)

The key of the observation grouping to consider.

log : bool, optional (default: False)

Plot on logarithmic axis.

use_raw : bool, optional (default: None)

Use raw attribute of adata if present.

multi_panel : bool, optional (default: False)

Display keys in multiple panels also when groupby is not None.

stripplot : bool optional (default: True)

Add a stripplot on top of the violin plot. See seaborn.stripplot.

jitter : float or bool, optional (default: True)

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

size : int, optional (default: 1)

Size of the jitter points.

order : list of str, optional (default: True)

Order in which to show the categories.

scale : {'area', 'count', 'width'}, optional (default: 'width')

The method used to scale the width of each violin. If ‘area’, each violin will have the same area. If ‘count’, the width of the violins will be scaled by the number of observations in that bin. If ‘width’, each violin will have the same width.

xlabel : str, optional (default: '')

Label of the x axis. Defaults to groupby if rotation is None, otherwise, no label is shown.

rotation : float, optional (default: None)

Rotation of xtick labels.

show

Show the plot, do not return axis.

save

If True or a str, save the figure. A string is appended to the default filename. Infer the filetype if ending on {‘.pdf’, ‘.png’, ‘.svg’}.

ax

A matplotlib axes object. Only works if plotting a single component.

**kwds : keyword arguments

Are passed to seaborn.violinplot.

Returns

A Axes object if ax is None else None.