scanpy.pl.DotPlot.style

Contents

scanpy.pl.DotPlot.style#

DotPlot.style(*, cmap=_empty, color_on=_empty, dot_max=_empty, dot_min=_empty, smallest_dot=_empty, largest_dot=_empty, dot_edge_color=_empty, dot_edge_lw=_empty, size_exponent=_empty, grid=_empty, x_padding=_empty, y_padding=_empty)[source]#

Modifies plot visual parameters

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

String denoting matplotlib color map.

color_on Union[Literal['dot', 'square'], Empty] (default: _empty)

By default the color map is applied to the color of the "dot". Optionally, the colormap can be applied to a "square" behind the dot, in which case the dot is transparent and only the edge is shown.

dot_max float | None | Empty (default: _empty)

If None, the maximum dot size is set to the maximum fraction value found (e.g. 0.6). If given, the value should be a number between 0 and 1. All fractions larger than dot_max are clipped to this value.

dot_min float | None | Empty (default: _empty)

If None, the minimum dot size is set to 0. If given, the value should be a number between 0 and 1. All fractions smaller than dot_min are clipped to this value.

smallest_dot float | Empty (default: _empty)

All expression fractions with dot_min are plotted with this size.

largest_dot float | Empty (default: _empty)

All expression fractions with dot_max are plotted with this size.

dot_edge_color Union[str, tuple[float, ...], None, Empty] (default: _empty)

Dot edge color. When color_on='dot', None means no edge. When color_on='square', None means that the edge color is white for darker colors and black for lighter background square colors.

dot_edge_lw float | None | Empty (default: _empty)

Dot edge line width. When color_on='dot', None means no edge. When color_on='square', None means a line width of 1.5.

size_exponent float | Empty (default: _empty)

Dot size is computed as: fraction ** size exponent and afterwards scaled to match the smallest_dot and largest_dot size parameters. Using a different size exponent changes the relative sizes of the dots to each other.

grid bool | Empty (default: _empty)

Set to true to show grid lines. By default grid lines are not shown. Further configuration of the grid lines can be achieved directly on the returned ax.

x_padding float | Empty (default: _empty)

Space between the plot left/right borders and the dots center. A unit is the distance between the x ticks. Only applied when color_on = dot

y_padding float | Empty (default: _empty)

Space between the plot top/bottom borders and the dots center. A unit is the distance between the y ticks. Only applied when color_on = dot

Return type:

Self

Returns:

DotPlot

Examples

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

Change color map and apply it to the square behind the dot

>>> sc.pl.DotPlot(adata, markers, groupby='bulk_labels') \
...     .style(cmap='RdBu_r', color_on='square').show()

Add edge to dots and plot a grid

>>> sc.pl.DotPlot(adata, markers, groupby='bulk_labels') \
...     .style(dot_edge_color='black', dot_edge_lw=1, grid=True) \
...     .show()