Re: [GRASS-user] Re: spgrass6
On Wednesday, February 22, 2012, Paolo Cavallini wrote: Il 22/02/2012 15:54, Roger Bivand ha scritto: Using the improved raster graphics handling for square cells with image() rather than spplot() and useRaster=TRUE - equivalent to image.SpatialGridDataFrame() and useRasterImage=TRUE with the same matrix takes 1.2 seconds on x11/cairo. You didn't say which version of R you are using - the raster graphics facilities have been improved recently. 2.14.1-1 on Debian testing. Did you try using image() instead of spplot() if your cells are square, and if rasterImage() is available in your version of R? Yes, image() is resonably fast, but misses automatic legend, etc. Thanks a lot for your reply. -- Paolo Cavallini See: http://www.faunalia.it/pc ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user Check out the plot() function from the raster package, or the related rasterViz (?) package. They have some neat stuff in there. Roger already mentioned this, but I'll add a little more. Now that we have powerful computers and nice packages like spgrass6 it is very simple to load large raster files into R without much effort. However, just because we can fit a linear model on that massive stack of pixels doesn't mean that one should. This is even more important with regard to plotting functions. I have found that coarsening the region resolution a bit before loading in raster that only need to be plotted helps considerably. If you really must work with stacks of large grids, the best approach I have found is the raster package. Cheers, Dylan -- Dylan E. Beaudette USDA-NRCS Soil Scientist California Soil Resource Lab http://casoilresource.lawr.ucdavis.edu/ ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: spgrass6
Il 06/03/2012 22:32, Dylan Beaudette ha scritto: Check out the plot() function from the raster package, or the related rasterViz (?) package. They have some neat stuff in there. Roger already mentioned this, but I'll add a little more. Now that we have Thanks for your comments. Please note however that I was talking about a very small (~1Mb) raster, for which the loading time was really surprising. All the best. -- Paolo Cavallini See: http://www.faunalia.it/pc ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: spgrass6
Rely on hexbin() instead of plot() hb - hexbin(your_independent_var, your_dependent_var, xbins = 40) plot(hb) Duccio ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: spgrass6
Just 2k may mean 4 million rectangles. R display is vector, hard-copy, with some recent support for raster grids when the rectangles are in fact square. As has been said, the graphics engine is not designed for fast screen output, but for scientific statistical graphics. spplot uses lattice graphics, which are slower anyway, but analytically more powerful. For me running levelplot() - the internals of spplot - on a 2k by 2k matrix takes 2 seconds, but output to a png file using cairo takes 70 seconds. Using the improved raster graphics handling for square cells with image() rather than spplot() and useRaster=TRUE - equivalent to image.SpatialGridDataFrame() and useRasterImage=TRUE with the same matrix takes 1.2 seconds on x11/cairo. You didn't say which version of R you are using - the raster graphics facilities have been improved recently. Did you try using image() instead of spplot() if your cells are square, and if rasterImage() is available in your version of R? Roger Paolo Cavallini wrote Il 22/02/2012 12:21, Benjamin Ducke ha scritto: As opposed to GRASS, R has not been designed with computational and/or memory efficiency as a priority. Oh! I was not fully aware of this. Maybe your analysis would allow you to run your computations on a representative sample instead of the whole dataset? In our case, the analysis is vert simple: just ssplot() of a small (2k by 2k cells) raster. Thanks. -- Paolo Cavallini See: http://www.faunalia.it/pc ___ grass-user mailing list grass-user@.osgeo http://lists.osgeo.org/mailman/listinfo/grass-user -- View this message in context: http://osgeo-org.1560.n6.nabble.com/spgrass6-tp4494142p4495201.html Sent from the Grass - Users mailing list archive at Nabble.com. ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] Re: spgrass6
Il 22/02/2012 15:54, Roger Bivand ha scritto: Using the improved raster graphics handling for square cells with image() rather than spplot() and useRaster=TRUE - equivalent to image.SpatialGridDataFrame() and useRasterImage=TRUE with the same matrix takes 1.2 seconds on x11/cairo. You didn't say which version of R you are using - the raster graphics facilities have been improved recently. 2.14.1-1 on Debian testing. Did you try using image() instead of spplot() if your cells are square, and if rasterImage() is available in your version of R? Yes, image() is resonably fast, but misses automatic legend, etc. Thanks a lot for your reply. -- Paolo Cavallini See: http://www.faunalia.it/pc ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] Re: spgrass6
Paolo: at a first glance I was persuaded you would perform exploratory analysis between two sets. The same concepts expressed by Roger Bivand about mapping lattice matrices apply to scatterplots. In case you would perform exploratory analysis on the data I suggest hexagon binning to make quick plots of one var versus another one. Then you could add regression and/or LOWESS lines to the plot: look at: http://cran.r-project.org/web/packages/hexbin/index.html Enjoy! Duccio -- Message: 3 Date: Wed, 22 Feb 2012 06:54:32 -0800 (PST) From: Roger Bivand roger.biv...@nhh.no Subject: [GRASS-user] Re: spgrass6 To: grass-user@lists.osgeo.org Message-ID: 1329922472770-4495201.p...@n6.nabble.com Content-Type: text/plain; charset=us-ascii Just 2k may mean 4 million rectangles. R display is vector, hard-copy, with some recent support for raster grids when the rectangles are in fact square. As has been said, the graphics engine is not designed for fast screen output, but for scientific statistical graphics. spplot uses lattice graphics, which are slower anyway, but analytically more powerful. For me running levelplot() - the internals of spplot - on a 2k by 2k matrix takes 2 seconds, but output to a png file using cairo takes 70 seconds. Using the improved raster graphics handling for square cells with image() rather than spplot() and useRaster=TRUE - equivalent to image.SpatialGridDataFrame() and useRasterImage=TRUE with the same matrix takes 1.2 seconds on x11/cairo. You didn't say which version of R you are using - the raster graphics facilities have been improved recently. Did you try using image() instead of spplot() if your cells are square, and if rasterImage() is available in your version of R? Roger ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user