Re: [R] bubbleplot for matrix

From: Albert Vilella <avilella_at_gmail.com>
Date: Fri 16 Jun 2006 - 01:18:50 EST

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: r-help-bounces@stat.math.ethz.ch
> > [mailto:r-help-bounces@stat.math.ethz.ch] 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 Received on Fri Jun 16 01:39:09 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 16 Jun 2006 - 04:12:57 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.