rasterplot: Pretty plot of raster object

Description Usage Arguments Value

View source: R/rasterplot.R

Description

Pretty plot of raster object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
rasterplot(raster, objectname = deparse(substitute(raster)), name = "",
  rangecol = c(min(values(raster), na.rm = T), max(values(raster), na.rm =
  T)), midpoint = NULL, dimcol = 50, numbreak = 10, colbreaks = if
  (is.null(midpoint)) {     pretty(rangecol, dimcol) } else {    
  c(pretty(c(rangecol[1], midpoint), n = round(dimcol/2) - 1), midpoint,
  pretty(c(midpoint, rangecol[2]), n = round(dimcol/2) - 1)) } %>% unique(),
  legmid = NULL, legbreaks = if (is.null(legmid)) {     pretty(rangecol, n =
  numbreak - 1) } else {     c(pretty(c(rangecol[1], legmid), n =
  round(numbreak/2)), legmid, pretty(c(legmid, rangecol[2]), n =
  round(numbreak/2))) } %>% unique(), vecol = c("cyan", "dodgerblue1",
  "blue", "forestgreen", "orange", "red", "purple"), contrast = 0, pdf = F,
  add = F, plotlegend = T, discrete = F)

Arguments

raster

A raster layer object

objectname

The name of the object plotted or other name to keep track of the pdf

name

Title fo the plot

rangecol

Range of the color palette

dimcol

Number of color breaks in the gradient

numbreak

Number of breaks in the color scale

vecol

Color vector for the palette

contrast

Interger for number of increase contrast iteration

pdf

Logical whether to output plot as pedf

add

Logical whether this plot will be overplotted on an existing one in the graphic device

plotlegend

Logical whether the color legend is plotted. Useful when overlaying two maps.

breaks

Breaks used in the color scale

Value

Prints a plot of a raster object with a nice color palette and without axis (easily changed). If desired, it is outputed as pdf'.


MoisesExpositoAlonso/moiR documentation built on Dec. 24, 2021, 10:12 p.m.