drvi.utils.plotting.plot_interpretability_scores#
- drvi.utils.plotting.plot_interpretability_scores(gene_scores_df, n_top_genes=10, ncols=5, score_threshold=0.1, dim_subset=None, show=True, **kwargs)[source]#
Plot bar plots of the top genes per latent dimension for an interpretability score.
This function visualizes the result of
get_interpretability_scores(). For each latent dimension (a column ofgene_scores_df) it draws a horizontal bar plot of then_top_genesgenes with the highest scores.- Parameters:
gene_scores_df (
DataFrame) – DataFrame of interpretability scores with genes as rows and latent dimensions as columns, as returned byget_interpretability_scores.n_top_genes (
int(default:10)) – Number of top genes to display per dimension.ncols (
int(default:5)) – Number of columns in the subplot grid.score_threshold (
float(default:0.1)) – Minimum score for a dimension to be plotted. Dimensions whose maximum gene score is below this threshold are skipped.dim_subset (
Sequence[str] |None(default:None)) – Subset of dimension titles (column names) to plot. If None, all dimensions meetingscore_thresholdare plotted, ordered by their dimension number.show (
bool(default:True)) – Whether to display the plot. If False, returns the figure object.**kwargs – Additional keyword arguments passed to
matplotlib.axes.Axes.barh().
- Returns:
matplotlib.figure.Figure or None The figure object if
show=False, otherwise None.