mantispy.pl.cell_cycle_occupancy#

mantispy.pl.cell_cycle_occupancy(adata, key='cell_cycle', by='Metadata_Perturbation', highlight=None, palette=None, legend_loc='right margin', legend_fontsize=6, seed=0, ax=None)[source]#

How the cells of each group occupy the cycle placed by project_cell_cycle().

Each cell contributes one position drawn from its own posterior, so a cell in a plateau spreads over that plateau instead of piling onto its median, and an arrest shows as a group’s curve rising above the others at one position. Cells off the cycle have no position and are left out. Dotted lines mark where S begins and ends.

Parameters:
adata AnnData

Single-cell object project_cell_cycle() has run on.

key str (default: 'cell_cycle')

The key_added prefix project_cell_cycle() wrote.

by str | None (default: 'Metadata_Perturbation')

obs column whose groups become curves, or None for one curve over every row.

highlight str | None (default: None)

A group of by, such as the controls, drawn thicker and in black.

palette Mapping[str, Any] | Sequence[Any] | str | None (default: None)

Colours for the groups, read as in cell_cycle_clock(); None for the matplotlib colour cycle.

legend_loc str | None (default: 'right margin')

"right margin" for a legend beside the plot, or None for no legend.

legend_fontsize float (default: 6)

Font size of the legend.

seed int (default: 0)

Seed for the positions drawn.

ax Axes | None (default: None)

Axes to draw on, or None for a new figure.

Return type:

Axes | None

Returns:

The axes when the caller passed ax, else None because the plot then owns the figure it created. They hold one density curve per group of by.

Raises:
  • KeyError – obsm has no key + "_quantiles".

  • ValueError – legend_loc is not "right margin" or None.