Question: How to plot 2 different symbols in a 3D PCA plot generated by rgl-plot3D
0
gravatar for maria2019
8 months ago by
maria2019100
maria2019100 wrote:

Hi,

I have plotted a 3D PCA on my control vs treated samples using rgl. I am interested in plotting control as SPHEREs and treatment as CUBEs. Is it possible to do that?

Below is my code:

library(rgl)
library(DESeq2)

rld_mat<- assay(rld)

select<- male_sig
rld_mat_male <- subset(rld_mat, rownames(rld_mat) %in% select)

pca<-prcomp(rld_mat_male)
percentVar <- round(pca$sdev / sum(pca$sdev) * 100, 2)

colors <- c(rep("#3300FF",4),rep("#add8e6",5))
samples <- rownames(rld_mat_male)

plot3d(pca$x[,1], pca$x[,2], pca$x[,3],xlab=paste0("PC1: ",percentVar[1],"%"), ylab=paste0("PC2: ",percentVar[2],"%"), zlab=paste0("PC3: ",percentVar[3],"%"), facets = TRUE,
                  col=colors,type="s")

## Add bounding box decoration
rgl.bbox(color=c("#333377","black"), emission="#808080",
          specular="#3333FF", shininess=5, alpha=0.8, nticks = 3 )
plot3d rna-seq 3d_pca rgl • 475 views
ADD COMMENTlink modified 8 months ago • written 8 months ago by maria2019100
0
gravatar for segato.felipe
8 months ago by
segato.felipe20 wrote:

Hey,

Since you're using R, I'd recommend the package "plot3D". It's a very flexible and easy to use package where you can do what you're looking for easily.

ADD COMMENTlink written 8 months ago by segato.felipe20

Thanks for your comment. I just tried plot3D. The problem is that I cannot rotate the generated figure

ADD REPLYlink modified 8 months ago • written 8 months ago by maria2019100
1

I think 'plot3D' and 'plot3d' are different. Former one is a package, while the later is a function.

ADD REPLYlink written 8 months ago by mbk0asis570

True! thanks for your comment. I just tried it. The problem with plot3D is that I cannot rotate the generated figure.

ADD REPLYlink written 8 months ago by maria2019100
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1170 users visited in the last hour