[R] plot3d labels
Duncan Murdoch
murdoch at stats.uwo.ca
Fri Jul 20 11:53:50 CEST 2007
On 20/07/2007 5:23 AM, Birgit Lemcke wrote:
> Hello Jim,
>
> thanks for your answer but I still have problems with the labels.
> Perhaps you can help me a second time.
>
> I have the output of cmdscale and it looks like this:
>
> [,1] [,2] [,3]
> Anth_cap -0.011833788 -0.1091355289 -0.0222467839
> Anth_crin -0.008178993 -0.0219545815 -0.0076695878
> Anth_eck 0.026900827 -0.0422055677 -0.1340542844
> Anth_gram -0.010860990 0.0080112322 0.0201743866.........
>
> In the next step I created 3 vectors out of the three columns
>
> PCoA1<-PCoA[,1]
> PCoA2<-PCoA[,2]
> PCoA3<-PCoA[,3]
>
> After that I plotted the 3 vectors
>
> plot3d(PCoA1,PCoA2,PCoA3, type="p", col=rainbow(1000),size=5)
There's no need to extract the 3 columns: you could just use
plot3d(PCoA, type="p", col=rainbow(1000),size=5)
with the data above.
>
> and now I try to handle this text3d function and label the points in
> the graphic with the names in the first column. But I am a beginner
> and don´t know the syntax for this in the text3d.
>
> I tried to make vectors out of every row like this:
>
> Anth_cap<- PCoA[1,]
> > Anth_crin<- PCoA[2,]
> > Anth_eck<- PCoA[3,]
> > Anth_gram<- PCoA[4,]
> > Anth_insi<- PCoA[5,]
> > Anth_laxi<- PCoA[6,].........
>
> and than tried to implement this in the text3d:
>
> text3d( c(Anth_cap,
> Anth_crin,
I think all you need is
text3d(PCoA, text=Nam)
but you might want to set the adj argument if you want the labels offset
from the points, and you might want type="n" in the original plot3d call
if you don't want the points to interfere with the labels.
Duncan Murdoch
More information about the R-help
mailing list