Hi,

I have a hard time in drawing circle on PCA.
I have 60 samples. The corresponding PC1 scores and PC2 scores were stored
as "mergedata". Here are the summary of PCs scores.

> range(mergedata[,"PC1"])
[1] 0.0085 0.0100
> range(mergedata[,"PC2"])
[1] 0.0032 0.0075
> mean(mergedata[,"PC1"])
[1] 0.009241667
> mean(mergedata[,"PC2"])
[1] 0.005541667
> dim(mergedata)
[1]  60 102
First of all, I need to find the center of the cluster points in PC plot.
Then, I would lilke to draw out from that center concentric circles with
radius 1 SD, 1.5 SD, 2 SD, 2.5 SD and 3 SD.

plot(mergedata[,"PC1"],mergedata[,"PC2"],xlab="PC1",ylab="PC2",xlim=range(mergedata[,"PC1"]),ylim=range(mergedata[,"PC2"]),pch=20,col="blue")
####circle with radius 1SD
symbols(mean(mergedata[,"PC1"]),mean(mergedata[,"PC2"]),circle=sd(c(mergedata[,"PC2"],mergedata[,"PC1"])),inches=FALSE,add=TRUE)


However, only points were plotted, but the cicle doesn't appear. Could
anyone tell me what's wrong with my code?

Thanks,
Phoebe

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to