FUNCTION_DESCRIPTION

plot_rast(in_rast, band = 1, in_poly = NULL, in_points = NULL,
  background = FALSE, limits = NULL, tails = c(0, 1),
  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 character 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 character corresponding to a valid "R" color or HEX representation, Default: 'gray90'

maxpixels

numeric Maximum number of pixels to be plotted. Increase this to have better rendering at the cost of speed!, 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 (?)

Value

OUTPUT_DESCRIPTION

Details

DETAILS

See also

Examples

library(sprawl) in_rast <- system.file("extdata/REYE_test", "REYE_2016_185_gNDVI.tif", package = "sprawl.data") in_vect <- create_fishnet(in_rast, pix_for_cell = 150)
#> create_fishnet --> Creating Fishnet over in_rast
#> Warning: 'x' is NULL so the result will be NULL
#> Error in 0:nx: argument of length 0
# 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)
#> Error in plot_rast(in_rast, in_poly = in_vect, tails = c(0.1, 0.99), legend = "custom", palette = "RdYlBu", title = "RapidEye - GNDVI", maxpixels = 1e+06): object 'in_vect' not found
# Plot more than one band in_rast <- raster::stack(system.file( "extdata/OLI_test", "oli_multi_1000.tif", package = "sprawl.data"))[[2:5]] plot_rast(in_rast, legend = "custom", maxpixels = 1e5)