tfmindi.pl.region_topic_tsne

tfmindi.pl.region_topic_tsne#

tfmindi.pl.region_topic_tsne(adata, topics_to_show=None, vmin=0.0, vmax=0.6, point_size=2.0, cmap='viridis', ncols=3, perplexity=30.0, random_state=42, **kwargs)#

Plot t-SNE visualization of regions colored by topic probabilities.

This function computes t-SNE coordinates from the region-topic matrix and shows how different topics are distributed across the region t-SNE space.

Parameters:
  • adata (AnnData) – AnnData object with stored topic modeling results

  • topics_to_show (list[str] | None (default: None)) – List of topic names to plot. If None, plots all topics

  • vmin (float (default: 0.0)) – Minimum value for colormap

  • vmax (float (default: 0.6)) – Maximum value for colormap

  • point_size (float (default: 2.0)) – Size of scatter points

  • cmap (str (default: 'viridis')) – Colormap name

  • ncols (int (default: 3)) – Number of columns in subplot grid

  • perplexity (float (default: 30.0)) – t-SNE perplexity parameter

  • random_state (int (default: 42)) – Random seed for t-SNE reproducibility

  • **kwargs – Additional arguments passed to render_plot()

Return type:

Figure | None

Returns:

matplotlib Figure or None if show=False

Examples

>>> import tfmindi as tmi
>>> # After topic modeling
>>> tm.tl.run_topic_modeling(adata, n_topics=5)
>>> fig = tmi.pl.region_topic_tsne(adata, topics_to_show=["Topic_1", "Topic_2", "Topic_3"])