scanpy.pl.DotPlot.legend#
- DotPlot.legend(*, show=True, show_size_legend=True, show_colorbar=True, size_title='Fraction of cells\\nin group (%)', colorbar_title='Mean expression\\nin group', width=1.5)[source]#
Configure dot size and the colorbar legends.
- Parameters:
- show
bool
|None
(default:True
) Set to
False
to hide the default plot of the legends. This sets the legend width to zero, which will result in a wider main plot.- show_size_legend
bool
|None
(default:True
) Set to
False
to hide the dot size legend- show_colorbar
bool
|None
(default:True
) Set to
False
to hide the colorbar legend- size_title
str
|None
(default:'Fraction of cells\\nin group (%)'
) Title for the dot size legend. Use
\n
to add line breaks. Appears on top of dot sizes- colorbar_title
str
|None
(default:'Mean expression\\nin group'
) Title for the color bar. Use
\n
to add line breaks. Appears on top of the color bar- width
float
|None
(default:1.5
) Width of the legends area. The unit is the same as in matplotlib (inches).
- show
- Return type:
Self
- Returns:
Examples
Set color bar title:
>>> import scanpy as sc >>> adata = sc.datasets.pbmc68k_reduced() >>> markers = {"T-cell": "CD3D", "B-cell": "CD79A", "myeloid": "CST3"} >>> dp = sc.pl.DotPlot(adata, markers, groupby="bulk_labels") >>> dp.legend(colorbar_title="log(UMI counts + 1)").show()