[BioC] PCA-3D Plot
Chevala V V S Narayana [guest]
guest at bioconductor.org
Mon Jul 1 14:28:49 CEST 2013
Dear All,
I request help in generating "Sample-based 3D-PCA plot" (Principal component analysis). I used function "princomp" from package:stats to create a PCA object on the data-set. the data dimensions are 600 * 7.
While genetaring, the plot were created on Genes with both "plot3d" and "scatterplot3d" functions, and I want the PCA-3d plot according to the samples.
The code I used is,
> dim(Expresso)
[1] 618 7
> PCA_3d<-princomp(Expresso, cor=TRUE)
> plot3d(PCA_3d$scores[,1:7],xlab="Component 1",main="My 3D
+ PCA",ylab="Component 2", zlab="Component 3", type="h", box=F, axes=F)
> spheres3d(PCA_3d$scores[,1:7], radius=0.1, col="pink")
> grid3d(side="z", at=list(z=0))
> text3d(PCA_3d$scores[,1:7], text=rownames(PCA_3d$scores), adj=1.3)
I also tried to plot with function "scatterplot3d"
> scatterplot3d(PCA_3d$scores[,1:3],xlab="Component 1 (26.9%)",main="My 3D PCA",ylab="Component 2(17.9%)", zlab="Component 3 (12.4%)",type="h",box=FALSE,pch=21)
> scatterplot3d(PCA_3d$scores [,1:3],xlab="Component 1 (26.9%)",main="My 3D PCA",ylab="Component 2(17.9%)", zlab="Component 3 (12.4%)",type="h",box=FALSE,pch=21,bg=color)
-- output of sessionInfo():
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-redhat-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_0.9.3 reshape2_1.2.2 scatterplot3d_0.3-33
[4] rgl_0.93.935 DESeq_1.10.1 lattice_0.20-13
[7] locfit_1.5-8 Biobase_2.18.0 BiocGenerics_0.4.0
loaded via a namespace (and not attached):
[1] annotate_1.36.0 AnnotationDbi_1.20.3 colorspace_1.2-1
[4] DBI_0.2-5 dichromat_2.0-0 digest_0.6.2
[7] genefilter_1.40.0 geneplotter_1.36.0 grid_2.15.1
[10] gtable_0.1.2 IRanges_1.16.5 labeling_0.1
[13] MASS_7.3-23 munsell_0.4 parallel_2.15.1
[16] plyr_1.8 proto_0.3-10 RColorBrewer_1.0-5
[19] RSQLite_0.11.2 scales_0.2.3 splines_2.15.1
[22] stats4_2.15.1 stringr_0.6.2 survival_2.37-2
[25] tcltk_2.15.1 tools_2.15.1 XML_3.95-0.1
[28] xtable_1.7-0
--
Sent via the guest posting facility at bioconductor.org.
More information about the Bioconductor
mailing list