[R] Extracting coordinates for cluster::clusplot()

Mark Difford mark_difford at yahoo.co.uk
Sat Jan 31 09:14:57 CET 2009


>> Dear Friends,
>> How can I extract the coordinates used in the plot?

They are not made available. You can get them as follows:

x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)),  
cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)))
pp <- pam(x, 2)

## The coordinates are in obj$scores
princomp(pp$data, scores = TRUE, cor = ncol(pp$data) != 2)$scores
plot(princomp(pp$data, scores = TRUE, cor = ncol(pp$data) != 2)$scores)

I have not set the y-scaling to match to output from plot(pp, which = 1),
but you can set it for yourself to see that they are the same. Or you can
debug "clusplot()" for yourself.

Mark Difford.


Michael Kubovy wrote:
> 
> Dear Friends,
> 
> require(cluster)
> x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)),  
> cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)))
> plot(pp <- pam(x, 2), which.plots = 1)
> 
> How can I extract the coordinates used in the plot?
> 
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> Postal Address:
> 	P.O.Box 400400, Charlottesville, VA 22904-4400
> Express Parcels Address:
> 	Gilmer Hall, Room 102, McCormick Road, Charlottesville, VA 22903
> Office:    B011;		Phone: +1-434-982-4729
> Lab:        B019;		Phone: +1-434-982-4751
> WWW:    http://www.people.virginia.edu/~mk9y/
> Skype name: polyurinsane
> 
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Extracting-coordinates-for-cluster%3A%3Aclusplot%28%29-tp21758809p21760937.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list