To plot the cell values of a Raster* object, we can use the 'plot' function in the 'raster' package and the 'levelplot' function in the 'rasterVis' package. The later function provides enhanced plots with relative ease.
Boxes with grey background contain code snippets, and boxes with white background containt code (text) outputs
EXAMPLES
Examples of visualisation of the cell values of rasters (i.e. plotting rasters) in R are presented below. The examples are taken from the “Effects of Cyclone Yasi Green Cover at Mission Beach” tutorial. It can be beneficial to put Putting the code snippets in context, by looking at a broader section of the R script. Code snippets have a grey background, and outputs have a white background, could be benefitial. Boxes with grey background contain code snippets, and boxes with white background containt code (text) outputs.
We use the function the ‘levelplot’ function to visualise the raster contents. Before using this function, we create a user defined colour palette; with yellow for low Seasonal Persistent Green Cover (SPGC) values, and green for high values. We use the 'grid.arrange' function in the 'gridExtra' package to plot multiple grobs (i.e. grid graphical objects) on a page (i.e. in a single graph).
...
Div | ||
---|---|---|
| ||
|
Example 2: Plot Raster with Raw & Standardised Differences between both Seasons (winter of 2010 and winter of 2011)
...
Div | ||
---|---|---|
| ||
|