scirpy.pl.embedding¶
-
scirpy.pl.
embedding
(adata, basis, *, color=None, panel_size=4, 4, palette=None, legend_loc='right margin', ax=None, ncols=3, show=False, hspace=0.25, wspace=None, **kwargs)¶ A customized wrapper to the
scanpy.pl.embedding()
function.- The differences to the scanpy embedding function are:
allows to specify a
panel_size
Allows to specify a different
basis
,legend_loc
andpalette
for each panel. The number of panels is defined by thecolor
parameter.Use a patched version for adding “on data” labels. The original raises a flood of warnings when coords are
nan
.For columns with many categories, cycles through colors instead of reverting to grey
allows to specify axes, even if multiple colors are set.
- Parameters
- adata :
AnnData
AnnData
annotated data matrix
- basis :
str
str
embedding to plot. Get the coordinates from the “X_{basis}” key in
adata.obsm
. This can be a list of the same length ascolor
to specify different bases for each panel.- color :
str
|Sequence
[str
] |None
Union
[str
,Sequence
[str
],None
] (default:None
) Keys for annotations of observations/cells or variables/genes, e.g.,
'ann1'
or['ann1', 'ann2']
.- panel_size :
Tuple
[float
,float
]Tuple
[float
,float
] (default:(4, 4)
) Size tuple (
width
,height
) of a single panel in inches- palette :
str
|Cycler
|Sequence
[str
] |Sequence
[Cycler
] |None
Union
[str
,Cycler
,Sequence
[str
],Sequence
[Cycler
],None
] (default:None
) Colors to use for plotting categorical annotation groups. The palette can be a valid
ListedColormap
name ('Set2'
,'tab20'
, …) or aCycler
object. It is possible to specify a list of the same size ascolor
to choose a different color map for each panel.- legend_loc :
str
str
(default:'right margin'
) Location of legend, either
'on data'
,'right margin'
or a valid keyword for theloc
parameter ofLegend
.- ax :
Axes
|Sequence
[Axes
] |None
Union
[Axes
,Sequence
[Axes
],None
] (default:None
) A matplotlib axes object or a list with the same length as
color
thereof.- ncols :
int
int
(default:3
) Number of columns for multi-panel plots
- show :
bool
|None
Optional
[bool
] (default:False
) If True, show the firgure. If false, return a list of Axes objects
- wspace :
float
|None
Optional
[float
] (default:None
) Adjust the width of the space between multiple panels.
- hspace :
float
float
(default:0.25
) Adjust the height of the space between multiple panels.
- **kwargs
Arguments to pass to
scanpy.pl.embedding()
.
- adata :
- Return type
- Returns
axes A list of axes objects, containing one element for each
color
, or None ifshow == True
.
See also