[R] Help plotting some data

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed Aug 15 17:53:25 CEST 2001


Hi,

I am trying to draw a figure with a series of plots to show the results
of a k-means cluster analysis.

Following the example in the MASS book (pg 338-339), I was able to plot
the clusters in Principal Component space.

My first question is:

I want to emphasise the clusters using colour so I use:

>plot(chem.predict[, 1:2], type="n", xlab="First principal component",
ylab="Second principal component")
>text(chem.predict[,1:2], labels=km$cluster, cex=0.75, col=km$cluster)
>points(chem.centers[,1:2], pch=3, cex=4)

This works OK, but I would like to specify the colours used for each
cluster as the cyan doesn't show up very well when printed.  How do I do
this?

My second question is:
I want to plot the points 3 times, one for PC1:PC2, PC1:PC3, and
PC2:PC3.  Next to those plots I want to plot up the biplot arrows shown
for the relevant components.  So I end up with a 3x2 matrix of plots,
with the first column containing the plots for each dimension pair, and
the second column showing the biplot arrows for each dimension pair.

I am able to plot the points on different PC's but haven't worked out
how to generate a plot showing only the biplot arrows yet.

Version######
> R.version
         _              
platform i386-pc-mingw32
arch     x86            
os       Win32          
system   x86, Win32     
status                  
major    1              
minor    3.0            
year     2001           
month    06             
day      22             
language R    

Windows2000

Many thanks for any suggestions

Gav

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list