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)
Configures dot size and the colorbar legends
- Parameters:
- show :
Optional
[bool
] (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 :
Optional
[bool
] (default:True
) Set to
False
to hide the dot size legend- show_colorbar :
Optional
[bool
] (default:True
) Set to
False
to hide the colorbar legend- size_title :
Optional
[str
] (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 :
Optional
[str
] (default:'Mean expression\\nin group'
) Title for the color bar. Use ‘n’ to add line breaks. Appears on top of the color bar
- width :
Optional
[float
] (default:1.5
) Width of the legends area. The unit is the same as in matplotlib (inches).
- show :
- Returns:
:
DotPlot
Examples
Set color bar title:
>>> 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()