anndict.wrappers.plot_confusion_matrix_adata_dict

anndict.wrappers.plot_confusion_matrix_adata_dict#

anndict.wrappers.plot_confusion_matrix_adata_dict(adata, true_label_key, predicted_label_key, title='Confusion Matrix', row_color_keys=None, col_color_keys=None, figsize=None, diagonalize=False, true_ticklabels=None, predicted_ticklabels=None, annot=None, adt_key=None)[source]#

Plots a confusion matrix from an AnnData object, with optional row and column colors.

Set diagonalize=True to automatically arrange the column and rows to make the confusion matrix appear as diagonal as possible.

Wraps plot_confusion_matrix().

Parameters:
adata AnnData

An AnnData.

true_label_key str

key to access the true class labels in adata.obs.

predicted_label_key str

key to access the predicted class labels in adata.obs.

title str (default: 'Confusion Matrix')

title of the plot.

row_color_key

key for row colors in adata.obs.

col_color_key

key for column colors in adata.obs.

adt_key tuple[str, ...] | None (default: None)

Used when wrapping with adata_dict_fapply().

row_color_keys str | None

col_color_keys str | None

figsize tuple[int, int] | None

diagonalize bool

true_ticklabels list[str] | None

predicted_ticklabels list[str] | None

annot bool | None

Return type:

ClusterGrid

Returns:

The confusion matrix plot object.

See also

plot_confusion_matrix()

the main plotting function used.