draw_tsne | R Documentation |
draw tsne plot with annotation by ggplot2
draw_tsne(
exp,
group_list,
perplexity = 30,
color = c("#2874C5", "#f87669", "#e6b707", "#868686", "#92C5DE", "#F4A582", "#66C2A5",
"#FC8D62", "#8DA0CB", "#E78AC3", "#A6D854", "#FFD92F", "#E5C494", "#B3B3B3"),
color.label = "group",
addEllipses = TRUE
)
exp |
A numeric matrix |
group_list |
A factor with duplicated character or factor |
perplexity |
numeric; perplexity parameter for Rtsne |
color |
color vector |
color.label |
color legend label |
addEllipses |
logical,add ellipses or not |
a ggplot object
Xiaojie Sun
exp <- matrix(rnorm(10000),nrow = 50)
colnames(exp) <- paste0("sample",1:200)
rownames(exp) <- paste0("gene",1:50)
exp[1:4,1:4]
exp[,1:100] = exp[,1:100]+10
group_list <- factor(rep(c("A","B"),each = 100))
if(requireNamespace("Rtsne",quietly = TRUE)){
draw_tsne(exp,group_list)
}else{
warning("Package 'Rtsne' needed for this function to work.
Please install it by install.packages('Rtsne')")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.