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 (AnnData or UnimodalData or MultimodalData object) – Single cell expression data.

  • genes (str or List[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) – If True, 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. If None, 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.) – If True, switch X and Y axes.

  • cmap (str or List[str] or Tuple[str], optional, default: Reds) – Color map.

  • sort_function (Union[Callable[List[str], List[str]], str], optional, default: natsorted) – Function used for sorting groupby labels. If natsorted, apply natsorted function to sort by natural order. If None, don’t sort. Otherwise, a callable function will be applied to the labels for sorting.

  • grid (bool, optional, default: True) – If True, plot grids.

  • return_fig (bool, optional, default: False) – Return a Figure object if True; return None otherwise.

  • dpi (float, optional, default: 300.0) – The resolution in dots per inch.

  • **kwds – Are passed to matplotlib.pyplot.scatter.

Return type

Optional[Figure]

Returns

  • Figure object – A matplotlib.figure.Figure object containing the dot plot if return_fig == True

Examples

>>> pg.dotplot(data, genes = ['CD14', 'TRAC', 'CD34'], groupby = 'louvain_labels')