# Seurat绘制3D-umap

之前在Rstudio-server上安装了seurat，现在可以试试绘制3D-umap了

## 安装补充包

- export R_LIBS_SITE=””
- .libPaths(‘/home/rstudio/miniconda3/envs/r_4_1_3/lib/R/library’)
- install.packages(“plotly”)

## 正式开始

    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 your data, in this example my Seurat object had 21 clusters (0-20)
    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), # controls size of points
            text=~label, #This is that extra column we made earlier for which we will use for cell ID
            hoverinfo="text") #When you visualize your plotly object, hovering your mouse pointer over a point shows cell names

绘图
Seurat绘制3D-umap
https://occdn.limour.top/2263.html
Author
Limour
Posted on
August 19, 2022
Licensed under
COX-Ridge：外部数据集验证 Previous
timeROC绘图记录 Next

#### Search

Keyword