pegasus.dotplot
- pegasus.dotplot(data, genes, groupby, reduce_function='mean', show_only_expressed=True, 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 (
AnnDataorUnimodalDataorMultimodalDataobject) – Single cell expression data.genes (
strorList[str]) – Features to plot.groupby (
str) – A categorical variable in data.obs that is used to categorize the cells, e.g. Clusters.reduce_function (
Union[str, Callable[[np.ndarray], float]], optional, default:"mean") – Function to calculate statistic on expression data. Default is mean.show_only_expressed (
bool, optional, default: True) – IfTrue, the statistic is calculated over only cells expressing the selected genes; otherwise, it’s calculated over all cells.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 (
strorList[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 aFigureobject ifTrue; returnNoneotherwise.dpi (
float, optional, default:300.0) – The resolution in dots per inch.**kwds – Are passed to
matplotlib.pyplot.scatter.
- Return type
Optional[Figure]- Returns
Figureobject – Amatplotlib.figure.Figureobject containing the dot plot ifreturn_fig == True
Examples
>>> pg.dotplot(data, genes = ['CD14', 'TRAC', 'CD34'], groupby = 'louvain_labels')