[R] Question on shardsplot

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Aug 31 10:42:09 CEST 2007


Ebi, keisyu, or whatever your name is,

I know that this questions has already been answered by the shardplot 
author in a private thread, where this has been posted under a different 
name. Why do you obscure your real name on the list???

The answer by Nils Raabe was that shardsplot is intended to draw the 
cluster map but adding sample numbers is more difficult. His quick 
proposal that needs some minor tweaking is:

xycords <- cbind(kronecker(1:14, rep(1,6)), rep(1:6, 14))
labs <- sapply(1:nrow(xycords),
     function(x) paste(as.character(which(
           (iris.som3$visual[,1] + 1 == xycords[x,1]) *
           (iris.som3$visual[,2] + 1 == xycords[x,2])   == 1)),
        collapse = ";"))
text(cbind(xycords[,2], xycords[,1]), labs, cex=0.75)


Uwe Ligges



ebi wrote:
> Dear All,
> 
> 
> 
> Would you please tell me how to display the sample No. on the map ?
> 
> 
> 
> ---Below commands don't display the sample No.(from 1 to 150).---
> 
> library(som)
> 
> library(klaR)
> 
> iris.som3 <- som(iris[,1:4], xdim = 14,ydim = 6)
> 
> library(klaR); opar<- par(xpd = NA)
> 
> shardsplot(iris.som3, data.or = iris,label = TRUE)
> 
> legend(3.5,14.3, col = rainbow(3), xjust =0.5, yjust = 0,legend =
> levels(iris[, 5]),pch = 16, horiz = TRUE)
> 
> par(opar)
> 
> ----------------
> 
> Ebi
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch 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.



More information about the R-help mailing list