[R] image versus levelplot

Paul Murrell paul at stat.auckland.ac.nz
Mon Aug 19 07:24:30 CEST 2013


Hi

You could try the 'useRaster' argument to levelplot()

Alternatively, if you are not doing much annotation (such as axes and 
labels) around the matrix-representations, you could possibly speed 
things up by calling grid.rect() directly.  Feel free to contact me 
directly if that sounds like an option.

Paul

On 07/16/13 09:55, Nicolas Servant wrote:
> 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 !?
> Regards
> Nicolas
>
>  > 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
>
>
>
>
>

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list