plot_rast: quick plot for a raster based on level_plot

Description Usage Arguments Details Value See Also Examples

View source: R/plot_rast.R

Description

FUNCTION_DESCRIPTION

Usage

1
2
3
4
5
plot_rast(in_rast, band = 1, in_poly = NULL, in_points = NULL,
  background = FALSE, limits = NULL, tails = c(0.02, 0.98),
  palette = "RdYlGn", legend_type = "standard", col_outlow = "gray10",
  col_outhigh = "gray90", maxpixels = 5e+05, title = "Raster Plot",
  plot_now = TRUE, ...)

Arguments

in_rast

Input raster object or file

band

PARAM_DESCRIPTION, Default: 1

in_poly

optional input polygon vector object or file to be overlayed on the plot, Default: NULL

in_points

optional input points vector object or file to be overlayed on the plot, Default: NULL

background

not used, Default: FALSE

limits

numeric array [2] optional limits governing the range of values to be plotted (e.g., c(0.2,0.4)), Default: NULL

tails

numeric array [2] percentiles used to "cut" the values to be plotted to allow a "good" representation. Values outside the specified percentiles will be plotted as NoData, or using the colors specified in col_outlow and col_outhigh, Default: c(0.02, 0.98) (meaning) cutting the values at the 2nd and 98th percentile)

palette

Palette to be used for colors (see RColorBrewer::brewer.pal), Default: 'RdYlGn'

legend_type

"standard" or "custom" (see examples), Default: 'standard'

col_outlow

Color used to plot the values below the lower limit/tail. Can be a string corresponding to a valid "R" color or HEX representation, Default: 'gray10'

col_outhigh

Color used to plot the values below the lower limit/tail. Can be a string corresponding to a valid "R" color or HEX representation, Default: 'gray90'

maxpixels

numeric Maximum number of pixels to be plotted, Default: 5e+05

title

character Title for the plot, Default: 'Raster Plot'

plot_now

logic If TRUE, the plot is immediately printed to screen. Otherwise, an object allowing later plotting/modifications is returned, Default: TRUE

...

Any other arguments (?)

Details

DETAILS

Value

OUTPUT_DESCRIPTION

See Also

layer stack,quantile levelplot brewer.pal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 
 library(sprawl)

 in_rast <- system.file("extdata", "gNDVI.tif", package = "sprawl.data")
 in_vect <- create_fishnet(in_rast, pix_for_cell = 150)
 # plot only the raster
 plot_rast(in_rast)

 # plot only the raster with custom legend
 plot_rast(in_rast, legend = "custom")

 # add a polygon and change the legend, palette and maxpixels
 plot_rast(in_rast,
           in_poly   = in_vect,
           tails     = c(0.1, 0.99),
           legend    = "custom",
           palette   = "RdYlBu" ,
           title     = "RapidEye - GNDVI",
           maxpixels = 10e5)

 in_rast <- raster::stack(system.file("extdata", "sprawl_EVItest.tif",
                                      package = "sprawl.data"))[[1:4]]
 plot_rast(in_rast)
 
## End(Not run)

IREA-CNR-MI/sprawl documentation built on May 27, 2019, 1:12 p.m.