pegasus.dotplot¶
- pegasus.dotplot(data, genes, groupby, reduce_function=<function mean>, fraction_min=0, fraction_max=None, dot_min=0, dot_max=20, switch_axes=False, cmap='Reds', sort_function='natsorted', grid=True, return_fig=False, dpi=300.0, **kwds)[source]¶
Generate a dot plot.
- Parameters
data (
AnnData
orUnimodalData
orMultimodalData
object) – Single cell expression data.genes (
str
orList[str]
) – Features to plot.groupby (
str
) – A categorical variable in data.obs that is used to categorize the cells, e.g. Clusters.reduce_function (
Callable[[np.ndarray], float]
, optional, default:np.mean
) – Function to calculate statistic on expression data. Default is mean.fraction_min (
float
, optional, default:0
.) – Minimum fraction of expressing cells to consider.fraction_max (
float
, optional, default:None
.) – Maximum fraction of expressing cells to consider. IfNone
, use the maximum value from data.dot_min (
int
, optional, default:0
.) – Minimum size in pixels for dots.dot_max (
int
, optional, default:20
.) – Maximum size in pixels for dots.switch_axes (
bool
, optional, default:False
.) – IfTrue
, switch X and Y axes.cmap (
str
orList[str]
orTuple[str]
, optional, default:Reds
) – Color map.sort_function (
Union[Callable[List[str], List[str]], str]
, optional, default:natsorted
) – Function used for sorting groupby labels. Ifnatsorted
, apply natsorted function to sort by natural order. IfNone
, don’t sort. Otherwise, a callable function will be applied to the labels for sorting.grid (
bool
, optional, default:True
) – IfTrue
, plot grids.return_fig (
bool
, optional, default:False
) – Return aFigure
object ifTrue
; returnNone
otherwise.dpi (
float
, optional, default:300.0
) – The resolution in dots per inch.**kwds – Are passed to
matplotlib.pyplot.scatter
.
- Returns
A
matplotlib.figure.Figure
object containing the dot plot ifreturn_fig == True
- Return type
Figure
object
Examples
>>> pg.dotplot(data, genes = ['CD14', 'TRAC', 'CD34'], groupby = 'louvain_labels')