Dot plot function

celltypist.dotplot(predictions: AnnotationResult, use_as_reference: str | list | tuple | ndarray | Series | Index, use_as_prediction: str = 'majority_voting', prediction_order: str | list | tuple | ndarray | Series | Index | None = None, reference_order: str | list | tuple | ndarray | Series | Index | None = None, filter_prediction: float = 0.0, cmap: str = 'RdBu_r', vmin: float | None = 0.0, vmax: float | None = 1.0, colorbar_title: str | None = 'Mean probability', dot_min: float | None = 0.0, dot_max: float | None = 1.0, smallest_dot: float | None = 0.0, size_title: str | None = 'Fraction of cells (%)', swap_axes: bool | None = False, title: str | None = 'CellTypist label transfer', figsize: tuple | None = None, show: bool | None = None, save: str | bool | None = None, ax: _AxesSubplot | None = None, return_fig: bool | None = False, **kwds) DotPlot | dict | None[source]

Generate a dot plot showing CellTypist label transfer. This is a wrapper around the scanpy.pl.DotPlot with selected parameters and customized defaults.

Parameters:
  • predictions – An AnnotationResult object containing celltypist prediction result through annotate().

  • use_as_reference – Key (column name) of the input AnnData representing the reference cell types (or clusters) celltypist will assess. Also accepts any list-like objects already loaded in memory (such as an array).

  • use_as_prediction – Column name of predicted_labels specifying the prediction type which the assessment is based on. Set to ‘predicted_labels’ if you want to assess the prediction result without majority voting. (Default: ‘majority_voting’)

  • prediction_order – Order in which to show the predicted cell types. Can be a subset of predicted cell type labels. Default to plotting all predicted labels, with the order of categories as is (alphabetical order in most cases).

  • reference_order – Order in which to show the reference cell types (or clusters). Can be a subset of reference cell types (or clusters). Default to plotting all reference cell types, with an order that ensures the resulting dot plot is diagonal.

  • filter_prediction – Filter out the predicted cell types with the maximal assignment fractions less than filter_prediction. This argument is only effective when prediction_order is not specified, and can be used to reduce the number of predicted cell types displayed in the dot plot. Default to 0 (no filtering).

  • title – Title of the dot plot. (Default: ‘CellTypist label transfer’)

  • size_title – Legend title for the dot sizes. (Default: ‘Fraction of cells (%)’)

  • colorbar_title – Legend title for the dot colors. (Default: ‘Mean probability’)

  • swap_axes – Whether to swap the x and y axes. (Default: False)

  • others – All other parameters are the same as scanpy.pl.dotplot() with selected tags and customized defaults.

Return type:

If return_fig is True, returns a scanpy.pl.DotPlot object, else if show is false, return axes dict.