episcanpy.api.pl.silhouette_tot

episcanpy.api.pl.silhouette_tot(adata_name, cluster_annot, value='X_pca', metric='euclidean', xlabel=None, ylabel=None, title=None, size='large', alternative_plot=False, name_cluster=True, name_cluster_pos='left', palette=None, save=None, key_added=None)

Both compute silhouette scores and plot it.

It computes the general silhouette score as well as a silhouette score for every cell according to the cell cluster assigned to it.

Parameters
adata_name : AnnData object

cluster_annot : observational variable corresponding to a cell clustering

value : measure used to build the silhouette plot (X_pca, X_tsne, X_umap)

metric : 'euclidean'

key_added : key to save the computed silhouette scores

Returns

general silhouette score in ‘uns’ of the AnnData object individual silhouette scores in ‘obs’ of the AnnData object

Silhouette plot

Credit to sklearn script : https://scikit-learn.org/stable/auto_examples/cluster/plot_kmeans_silhouette_analysis.html#sphx-glr-auto-examples-cluster-plot-kmeans-silhouette-analysis-py return score and silhouette plot. Still some work to do to finish the function. size=None but you can put ‘large’ if you want a bigger default figure size