Dear R gurus, I'm trying to visualize a matrix 256 x 920 using image(), but i find the display too slow (~ 1 minute ?? admittedly, my iBook G4 isn't very fast). The aim is not to get a good resolution image, but rather have a quick look at the matrix. I couldn't find a way to plot a smaller set of points from my data in a sensible manner (basically, i want to decrease the resolution). Is there an easy option for this purpose in image(), or possibly the lattice equivalent? Minimal example: x<-c(1:256) y<-c(1:920) z<-x%*%t(y) image(x,y,z) Best regards, baptiste
I'm not aware of any existing function that does what you want, but you could easily write a function to sample from x, y, z, and then pass the sampled values to image. e.g., sam <- function(sx,sy,x,y,z){ xind<-seq(1,length(x),by=sx) yind<-seq(1,length(y),by=sy) samplex<-x[xind] sampley<-y[yind] samplez<-z[xind,yind] list(x=samplex,y=sampley,z=samplez) } newval<-sam(sx=13.3,sy=15,x=x,y=y,z=z) image(newval$x,newval$y,newval$z) On Sun, 21 Oct 2007, [ISO-8859-1] baptiste Augui? wrote:> Dear R gurus, > > I'm trying to visualize a matrix 256 x 920 using image(), but i find > the display too slow (~ 1 minute ?? admittedly, my iBook G4 isn't > very fast). The aim is not to get a good resolution image, but rather > have a quick look at the matrix. I couldn't find a way to plot a > smaller set of points from my data in a sensible manner (basically, i > want to decrease the resolution). Is there an easy option for this > purpose in image(), or possibly the lattice equivalent? > > Minimal example: > > x<-c(1:256) > y<-c(1:920) > z<-x%*%t(y) > image(x,y,z) > > > Best regards, > > baptiste > > ______________________________________________ > R-help at r-project.org 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. >
Take a looks at the 'hexbin' package on BioConductor. It may give you want you want. On 10/21/07, baptiste Augui? <ba208 at exeter.ac.uk> wrote:> Dear R gurus, > > I'm trying to visualize a matrix 256 x 920 using image(), but i find > the display too slow (~ 1 minute ?? admittedly, my iBook G4 isn't > very fast). The aim is not to get a good resolution image, but rather > have a quick look at the matrix. I couldn't find a way to plot a > smaller set of points from my data in a sensible manner (basically, i > want to decrease the resolution). Is there an easy option for this > purpose in image(), or possibly the lattice equivalent? > > Minimal example: > > x<-c(1:256) > y<-c(1:920) > z<-x%*%t(y) > image(x,y,z) > > > Best regards, > > baptiste > > ______________________________________________ > R-help at r-project.org 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?