This works, though I'm not sure why symbols() complains about axes=FALSE while fulfilling the request.
a <- matrix(sample(1:5,100,replace=TRUE),nrow=10) rownames(a) <- c("aed","fde","fda","yxj","ijk","ddd","gcd","sbe","adc","asd") colnames(a) <- c("aed","fde","fda","yxj","ijk","ddd","gcd","sbe","adc","asd") 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,]) } xp <- as.numeric(as.factor(x)) yp <- as.numeric(as.factor(y)) symbols(xp,yp,z,inches=0.2,bg="khaki",axes=FALSE) axis(1,at=1:length(unique(x)),labels=sort(unique(x))) axis(2,at=1:length(unique(y)),labels=sort(unique(y))) box() text(xp,yp,labels=z) On 6/15/06, Albert Vilella <[EMAIL PROTECTED]> wrote: > Thanks Bogdan for the reply, > > I almost got it working, but in my case, the rownames and colnames are > strings, not numbers, and I guess that this is a problem when using your > snippet: > > a <- > matrix(sample(1:5,100,replace=TRUE),nrow=10,dimnames=list(1:10,5*1:10)) > rownames(a) = > c("aed","fde","fda","yxj","ijk","ddd","gcd","sbe","adc","asd") > colnames(a) = > c("aed","fde","fda","yxj","ijk","ddd","gcd","sbe","adc","asd") > 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) > > > symbols(as.numeric(x),as.numeric(y),z,inches=0.2,bg="khaki") > Error in plot.window(xlim, ylim, log, asp, ...) : > need finite 'xlim' values > In addition: Warning messages: > 1: NAs introduced by coercion > 2: NAs introduced by coercion > 3: no finite arguments to min; returning Inf > 4: no finite arguments to max; returning -Inf > 5: no finite arguments to min; returning Inf > 6: no finite arguments to max; returning -Inf > > Any guess? > > Thanks in advance, > > Albert. > > On Wed, 2006-06-14 at 16:47 -0400, bogdan romocea wrote: > > 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) > > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of Albert Vilella > > > Sent: Tuesday, June 13, 2006 7:11 AM > > > To: r-help@stat.math.ethz.ch > > > Subject: [R] bubbleplot for matrix > > > > > > Hi all, > > > > > > I would like to ask if it is possible to use bubbleplot for a 20x20 > > > matrix, instead of a dataframe with factors in columns. > > > > > > The idea would be to get a tabular representation with bubbles like in > > > Rnews_2006_2 article, which look very nice. > > > > > > Thanks in advance, > > > > > > Albert. > > > > > > ______________________________________________ > > > R-help@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 > > > > > ______________________________________________ R-help@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