[R] bubbleplot for matrix
bogdan romocea
br44114 at gmail.com
Wed Jun 14 22:47:32 CEST 2006
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 at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Albert Vilella
> Sent: Tuesday, June 13, 2006 7:11 AM
> To: r-help at 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 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
>
More information about the R-help
mailing list