Skip to content
Prev 94273 / 398498 Next

bubbleplot for matrix

Here's an example. By the way, I find that it's more convenient (where
applicable) to keep the data in 3 vectors/factors rather than one
matrix/data frame.

a <- matrix(sample(1:5,100,replace=TRUE),nrow=10,dimnames=list(1:10,5*1:10))
x <- y <- z <- vector()
for (i in 1:nrow(a)) {
  x <- c(x,rep(rownames(a)[i],ncol(a)))
  y <- c(y,colnames(a))
  z <- c(z,a[i,])
}
symbols(as.numeric(x),as.numeric(y),z,inches=0.2,bg="khaki")
text(as.numeric(x),as.numeric(y),labels=z)