scanpy.pl.StackedViolin.legend
- StackedViolin.legend(show=True, title='Expression\\nlevel in group', width=1.5)
Configure legend parameters
- Parameters
- show :
bool
|None
Optional
[bool
] (default:True
) Set to ‘False’ to hide the default plot of the legend. This sets the legend width to zero which will result in a wider main plot.
- title :
str
|None
Optional
[str
] (default:'Expression\nlevel in group'
) Legend title. Appears on top of the color bar. Use ‘n’ to add line breaks.
- width :
float
|None
Optional
[float
] (default:1.5
) Width of the legend. The unit is the same as in matplotlib (inches)
- show :
- Returns
BasePlot
Examples
Set legend title:
>>> adata = sc.datasets.pbmc68k_reduced() >>> markers = {'T-cell': 'CD3D', 'B-cell': 'CD79A', 'myeloid': 'CST3'} >>> dp = sc.pl.BasePlot(adata, markers, groupby='bulk_labels') >>> dp.legend(colorbar_title='log(UMI counts + 1)').show()