hadley/ggplot2 — pull request #1024 by bleutner (2014-10-29 18:10:03+00:00)
Title: Fortify for Raster* objects

Hi,

I'd like to suggest to expand the functionality of fortify to Raster* objects from the raster package. Since rasters are often very large (>memory) they should be subsampled for efficient plotting. This is implemented in the raster package for calls to raster::plot but it would be nice to have a fortify method for use with ggplot2.

There are three classes RasterLayer, RasterBrick and RasterStack which can all be subsampled in the same way using a regur grid.The maximal number of pixels to plot can be specified and defaults to 500000.

Fortify returns a data.frame with pixel coordinates and corresponding raster values intended for use with geom_raster.

What do you think?
Benjamin