Plotting Module (pl)

celltag_tools.plotting.diagnostic_plots(ct_obj, mtx_use='metric')

Generates diagnostic scatter and histogram plots for a specified matrix (allow, bin, or metric) within a CellTagData object.

Args:
ct_obj (CellTagData):

The CellTagData object containing the matrix to be visualized.

mtx_use (str, optional):

The type of matrix to plot. Must be one of {“allow”, “bin”, “metric”}. Defaults to “metric”.

Raises:
ValueError:

If ct_obj is not a valid CellTagData object, or if mtx_use is not in {“metric”, “allow”, “bin”}.

Notes:

The function checks whether the specified matrix dictionary (mtx_use_mtx) is valid, then creates a 2x2 figure showing: - A scatter plot of row sums (CellTags per cell). - A scatter plot of column sums (cells per CellTag). - A histogram of row sums. - A histogram of column sums.

celltag_tools.plotting.plot_size_by_den(ct_obj, highlight_clones=None, ax=None, **kwargs)

Creates a scatter plot of clone size versus edge density for visualization, with the option to highlight specific clones by coloring or labeling them.

Args:
clone_meta (pd.DataFrame):

A DataFrame containing per-clone metadata, expected to have columns: - ‘edge.den’: The clone’s edge density. - ‘size’: The clone’s size (number of cells). - ‘clone.id’: The clone ID for labeling (if highlighting).

highlight_clones (list | np.ndarray | None, optional):

A list of clone IDs to highlight and label in red. Defaults to None.

ax (matplotlib.axes.Axes | None, optional):

A matplotlib Axes object on which to draw the plot. If None, the current Axes (plt.gca()) is used. Defaults to None.

**kwargs:

Additional keyword arguments passed to sns.scatterplot.

Returns:
matplotlib.axes.Axes:

The Axes object containing the scatter plot.

Raises:
ValueError: If clone_info is missing or invalid, or if highlight_clones

is not a valid list/array when provided.