1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
   | library(plotly) library(Seurat) sample13 <- readRDS("~/upload/zl_liu/work/Prognosis/scRNA/sample13.rds") sample13 <- RunUMAP(sample13, dims = 1:10, n.components = 3L) plot.data <- FetchData(object = sample13, vars = c("UMAP_1", "UMAP_2", "UMAP_3", "seurat_clusters")) plot.data$label <- paste(rownames(plot.data))
  plot_ly(data = plot.data,          x = ~UMAP_1, y = ~UMAP_2, z = ~UMAP_3,          color = ~seurat_clusters,          colors = c("lightseagreen",                    "gray50",                    "darkgreen",                    "red4",                    "red",                    "turquoise4",                    "black",                    "yellow4",                    "royalblue1",                    "lightcyan3",                    "peachpuff3",                    "khaki3",                    "gray20",                    "orange2",                    "royalblue4",                    "yellow3",                    "gray80",                    "darkorchid1",                    "lawngreen",                    "plum2",                    "darkmagenta")[1:7],         type = "scatter3d",          mode = "markers",          marker = list(size = 5, width=2),          text=~label,          hoverinfo="text") 
 
  |