View source: R/plot_functions.R
| plot_tsne_pq | R Documentation |
Partially inspired by phylosmith::tsne_phyloseq() function developed by Schuyler D. Smith.
plot_tsne_pq(
physeq,
method = "bray",
dims = 2,
theta = 0,
perplexity = 30,
fact = NA,
ellipse_level = 0.95,
plot_dims = c(1, 2),
na_remove = TRUE,
force_factor = TRUE,
...
)
physeq |
(required) a |
method |
A method to calculate distance using |
dims |
(Int) Output dimensionality (default: 2) |
theta |
(Numeric) Speed/accuracy trade-off (increase for less accuracy), set to 0.0 for exact TSNE (default: 0.0 see details in the man page of |
perplexity |
(Numeric) Perplexity parameter (should not be bigger than 3 * perplexity < nrow(X) - 1, see details in the man page of |
fact |
Name of the column in |
ellipse_level |
The level used in stat_ellipse. Set to NULL to discard ellipse (default = 0.95) |
plot_dims |
A vector of 2 values defining the rank of dimension to plot (default: c(1,2)) |
na_remove |
(logical, default TRUE) Does the samples with NA values in fact are removed? (default: true) |
force_factor |
(logical, default TRUE) Force the fact column to be a factor. |
... |
Additional arguments passed on to |
As explained in the documentation of tsne_pq(), t-SNE is a local
technique: the plot is reliable for neighbourhood, outlier and cluster
identification, but the distances between points or clusters, the cluster
density and the class separability it suggests must not be read as faithful
to the original space (Jeon et al., 2026). See tsne_pq() for details and
for global alternatives (PCA, MDS/PCoA).
A ggplot object
Adrien Taudière
Jeon, H., Park, J., Shin, S., & Seo, J. (2026). Stop Misusing t-SNE and UMAP for Visual Analytics. IEEE Transactions on Visualization and Computer Graphics. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2506.08725")}
van der Maaten, L., & Hinton, G. (2008). Visualizing Data using t-SNE. Journal of Machine Learning Research, 9, 2579-2605.
if (requireNamespace("Rtsne")) {
plot_tsne_pq(data_fungi_mini, fact = "Height", perplexity = 15)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.