As the ever growing R package environment can be a rough terrain to navigate and find the appropriate tools to achieve one’s goals, this vignette is meant to point out some ways to overcome initial problems with visualizing neutral landscape models or more general raster data. This is probably a heavily biased view on packages and functions and I am sure there are other good R packages out there to achieve the same (if so - feel free to point that out to me and I will include it!). However, I am also sure this collection can at least be a kickstart for quickly visualizing your results and help you to communicate them.
show_landscape was developed to help users to adhere to some standards concerning color scales and typography. This means for example that by default the viridis color scale is applied which makes your plots easier to read by those with colorblindness.
# ... chose any other scale: # show_landscape returns a ggplot2 object, so you can follow your usual ggplot2 # workflow and change the color, axis labels, ... library(ggplot2) library(pals) show_landscape(landscape) + scale_fill_gradientn(colours=pals::parula(100)) + # parula color scale theme_void() + # minimal theme guides(fill = FALSE) # remove legend
rasterVis also offers some convenience functions to plot raster, for example:
Another nice function from rasterVis is
gplot(), a wrapper to use ggplot2 with raster data without reshaping your data as long data.frame:
If you want to start from scratch with ggplot2:
… if you are in a lot of hurry, raster itself also has a plot method for raster: