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 resultstopics_to_show (
list[str] |None(default:None)) – List of topic names to plot. If None, plots all topicsvmin (
float(default:0.0)) – Minimum value for colormapvmax (
float(default:0.6)) – Maximum value for colormappoint_size (
float(default:2.0)) – Size of scatter pointscmap (
str(default:'viridis')) – Colormap namencols (
int(default:3)) – Number of columns in subplot gridperplexity (
float(default:30.0)) – t-SNE perplexity parameterrandom_state (
int(default:42)) – Random seed for t-SNE reproducibility**kwargs – Additional arguments passed to render_plot()
- Return type:
- 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"])