[R] image versus levelplot

Nicolas Servant nservant at curie.fr
Mon Jul 15 23:55:57 CEST 2013

Dear R users,

I'm currently using the Graphics package to display several hundred of 
matrix objects, using a layout and the image() function.
It works well except for large matrices (> 1000*1000) or for a large 
number of matrices (there is a limitation around 400 if I remember well)
To solve these issues, I move to the Matrix package which is much more 
efficient for large sparse matrix, and to the grid package for the plot 
(using image from Matrix)
However, the levelplot() is much more slow than the graphics image() 
function !!
Basically, with the image() from graphics, I'm able to plot 360 matrices 
in 30 sec, against more than 10 minutes with levelplot().
I would appreciate if anyone has some experience on that, and could give 
me some advice to efficiently use the grid package !?

 > i=1000
 > M1 <- Matrix(rnorm(i*i), ncol=i)
 > system.time(print(Matrix::image(M1)))
    user  system elapsed
  11.320   0.064  11.406
 > M2 <- matrix(rnorm(i*i), ncol=i)
 > system.time(image(as.matrix(M2)))
    user  system elapsed
   0.837   0.004   0.844

Nicolas Servant
Plateforme de Bioinformatique
Unité 900 : Institut Curie - Inserm - Mines ParisTech
26, rue d'Ulm - 75248 Paris Cedex 05 - FRANCE

Email: Nicolas.Servant at curie.fr
Tel: 01 56 24 69 85

More information about the R-help mailing list