[BioC] PCA-3D Plot

James W. MacDonald jmacdon at uw.edu
Mon Jul 8 17:12:23 CEST 2013


Hi Satya,


On 7/4/2013 9:18 AM, Veera Venkata Satyanarayana wrote:
> Dear All,
>
> Can You help me in adding labels to the scatterplot3d of PCA object. 
> the code I used is
>
> > PCA_3d<-prcomp(t(Expresso), cor=TRUE)
>
> > scatterplot3d(PCA_3d$x[,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)
>
> > text(PCA_3d$x[,1:3], labels=row.names(PCA_3d$x), cex=.5, pos=4)
>
>
> But with the text command, I'm not able to add labels in the plot. 
> Kindly, I request your help to solve..

This is getting off-topic for this list, so I will give you a pointer 
and request that any other questions about the scatterplot3d package be 
taken to R-help, which is the correct list.

A large number of packages come with a vignette, which is a more in 
depth introduction to a package and what you can do with it. The 
scatterplot3d package happens to have one, and it also happens to have 
an example of adding text to a 3D plot. You can access the vignette by 
either doing

vignette(package = "scatterplot3d")
## here you can see that the vignette is called 's3d'
vignette("s3d")

or you can just google scatterplot3d, and then read the vignette on CRAN.

Best,

Jim



>
> Thanks in advance.
>
> Satya
>
>
>
> On Tue, Jul 2, 2013 at 12:41 AM, Veera Venkata Satyanarayana 
> <veeru.vsn at gmail.com <mailto:veeru.vsn at gmail.com>> wrote:
>
>     Thank You Mr. Steve and Mr. James. Its really helped me to have a
>     clear understanding of PCA function. Now I could able to plot and
>     capture the 3D plots through package:rgl.
>
>     Thanks Again..
>
>
>
>     On Tue, Jul 2, 2013 at 12:11 AM, Steve Lianoglou
>     <lianoglou.steve at gene.com <mailto:lianoglou.steve at gene.com>> wrote:
>
>         Hi,
>
>         On Mon, Jul 1, 2013 at 11:07 AM, Veera Venkata Satyanarayana
>         <veeru.vsn at gmail.com <mailto:veeru.vsn at gmail.com>> wrote:
>         > Dear,
>         > Yes, Its worked with function "prcomp":
>         >> PCA_3d<-prcomp(t(Normalized_Expresso), cor=TRUE)
>         >
>         > Here is the Question:
>         > while ploting the object PCA_3d with scatterplot3d from
>         > package:scatterplot3d, the x,y,z coordinates were given as
>         PCA_3d$x[,1:3],
>         > but the PCA_3d$x has 7 PC components (columns) and 7 samples
>         as rows. If I
>         > give the first three PC components [PC1, PC2, PC3] as
>         coordinates, I
>         > insists to know about other PCs like [PC4,PC5, PC6, PC7].
>         Out of all which
>         > gives the best reliable pattern of samples on the plot.
>
>         I didn't actually catch the question here.
>
>         Do you want to try all possible pairs of 3 axes to see which is
>         "best"? Just change the `[,1:3]` to include the PC's that you like
>         (you are picking 1,2,3) to see which you think does better.
>
>         Generally speaking, you should expect to get the best
>         separation using
>         the first three PCs since PC1 explains more of the variance
>         than PC2,
>         and PC2 > PC3, etc. but feel free to experiment as you like.
>
>         James' suggestion to use rgl is a good one -- often times
>         spinning the
>         plot around interactively is quite helpful.
>
>         -steve
>
>         --
>         Steve Lianoglou
>         Computational Biologist
>         Bioinformatics and Computational Biology
>         Genentech
>
>
>
>
>     -- 
>     Chevala. V V S Narayana
>     Junior Research Fellow,
>     NIPGR.
>
>
>
>
> -- 
> Chevala. V V S Narayana
> Junior Research Fellow,
> NIPGR.
>

-- 
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099



More information about the Bioconductor mailing list