Description Usage Arguments Details
Transform raster as data.frame to be later used with ggplot Modified from rasterVis::gplot
1 | gplot_data(x, maxpixels = 50000)
|
x |
A Raster* object |
maxpixels |
Maximum number of pixels to use |
rasterVis::gplot is nice to plot a raster in a ggplot but if you want to plot different rasters on the same plot, you are stuck. If you want to add other information or transform your raster as a category raster, you can not do it. With 'cartomisc::gplot_data', you retrieve your raster as a data.frame that can be modified as wanted using 'dplyr' and then plot in 'ggplot' using 'geom_tile'. If Raster has levels, they will be joined to the final tibble.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.