cellrank.ul.models.FittedModel.plot

FittedModel.plot(figsize=(8, 5), same_plot=False, hide_cells=False, perc=None, abs_prob_cmap=<matplotlib.colors.ListedColormap object>, cell_color=None, lineage_color='black', alpha=0.8, lineage_alpha=0.2, title=None, size=15, lw=2, cbar=True, margins=0.015, xlabel='pseudotime', ylabel='expression', conf_int=True, lineage_probability=False, lineage_probability_conf_int=False, lineage_probability_color=None, obs_legend_loc='best', dpi=None, fig=None, ax=None, return_fig=False, save=None, **kwargs)

Plot the smoothed gene expression.

Parameters
  • figsize (Tuple[float, float]) – Size of the figure.

  • same_plot (bool) – Whether to plot all trends in the same plot.

  • hide_cells (bool) – Whether to hide the cells.

  • perc (Optional[Tuple[float, float]]) – Percentile by which to clip the absorption probabilities.

  • abs_prob_cmap (ListedColormap) – Colormap to use when coloring in the absorption probabilities.

  • cell_color (Optional[str]) – Key in anndata.AnnData.obs or anndata.AnnData.var_names used for coloring the cells.

  • lineage_color (str) – Color for the lineage.

  • alpha (float) – Alpha channel for cells.

  • lineage_alpha (float) – Alpha channel for lineage confidence intervals.

  • title (Optional[str]) – Title of the plot.

  • size (int) – Size of the points.

  • lw (float) – Line width for the smoothed values.

  • cbar (bool) – Whether to show colorbar.

  • margins (float) – Margins around the plot.

  • xlabel (str) – Label on the x-axis.

  • ylabel (str) – Label on the y-axis.

  • conf_int (bool) – Whether to show the confidence interval.

  • lineage_probability (bool) – Whether to show smoothed lineage probability as a dashed line. Note that this will require 1 additional model fit.

  • lineage_probability_conf_int (Union[bool, float]) – Whether to compute and show smoothed lineage probability confidence interval. If self is cellrank.ul.models.GAMR, it can also specify the confidence level, the default is 0.95. Only used when show_lineage_probability=True.

  • lineage_probability_color (Optional[str]) – Color to use when plotting the smoothed lineage_probability. If None, it’s the same as lineage_color. Only used when show_lineage_probability=True.

  • obs_legend_loc (Optional[str]) – Location of the legend when cell_color corresponds to a categorical variable.

  • dpi (Optional[int]) – Dots per inch.

  • fig (Optional[Figure]) – Figure to use, if None, create a new one.

  • ax (matplotlib.axes.Axes) – Ax to use, if None, create a new one.

  • return_fig (bool) – If True, return the figure object.

  • save (Optional[str]) – Filename where to save the plot. If None, just shows the plots.

  • kwargs – Keyword arguments for matplotlib.axes.Axes.legend(), e.g. to disable the legend, specify loc=None. Only available when show_lineage_probability=True.

Return type

Optional[Figure]

Returns

Nothing, just plots the figure. Optionally saves it based on save.