panel_shading {ursa}R Documentation

Shaded overlay by image mask

Description

This specific function is designed to illustrate linear slope and areas of statistically significant slope on the same panel, however can be used commonly for shading by raster mask.

Usage

panel_shading(obj, level = NA, col = NULL, density = 25, angle = c( -45, 45),
                  lwd = 1, lty = 1, verbose = TRUE)

Arguments

obj

Object of class ursaRaster.

level

Positive numeric. Threshold for obj reclassification { obj<(-level) | obj>(+level) }. If NULL then mask is created from non-NA values of obj. Default is NULL.

col

ursaColorTable (ursaRaster with color table) or character. Color for shading lines (grid). If object of class ursaColorTable.
Two colors on the limits of color vector are extracted to separate source values <=(-level) and >=(+level).

density

Numeric. The density of shading lines, in lines per inch. Default is 25. See description of argument density in function polygon.

angle

Numeric. The slope of shading lines, given as an angle in degrees (counter-clockwise). Default is vector of length two c(-45,45). See description of argument angle in polygon function.

lwd

Numeric. Line width for shading. Default is 1. See description of lwd in par function

lty

Numeric or character. Line type for shading. Default is 1. See description of lty in par function.

verbose

Logical. If TRUE then progresss bar is appeared. Default is TRUE.

Details

Values of input obj is reclassified to raster mask: { values<=(-level) OR values>=(+level) }. For common use, select appropriate level and, if necessary, reclassify obj prior.

Color limits are extracted using range function.

Raster images can be used for colored shading using alpha argument of panel_raster function, e.g. panel_raster(a,alpha=3/4)

Value

NULL

Author(s)

Nikita Platonov platonov@sevin.ru

Examples

session_grid(NULL)
if (first.example <- TRUE) {
   session_grid(NULL)
   session_grid(regrid(mul=1/8))
   ps <- pixelsize()
   compose_open()
   ct <- compose_panel()
   panel_shading(ps>1.1*global_mean(ps),angle=90)
   compose_legend(ct)
   compose_close()
}
if (second.example <- TRUE) {
   session_grid(NULL)
   a <- ursa_dummy(nband=15,mul=1/8)
   b <- local_stat(a)
   compose_open()
   lev <- 0.90
   d <- as.matrix(b["slopeS"],coords=TRUE)
   e <- contourLines(d,levels=c(-lev,lev))
   p <- list(significance.raw=colorize(b["slopeS"])
            ,significance.formatted=colorize(b["slopeS"],stretch="significance")
            ,slope=colorize(b["slope"]))
   p <- c(p,rep(p[3],3))
   names(p)[c(3,4,5)] <- c("Slope and shaded significance"
                          ,"Slope and contoured significance"
                          ,"Slope and 'contourLines'")
   compose_open(p,layout=c(2,NA),byrow=FALSE)
   compose_panel(p[1])
   compose_panel(p[2])
   compose_panel(p[3])
   panel_shading(b["slopeS"],level=lev)
   compose_panel(p[4])
   panel_contour(b["slopeS"],value=c(-lev,lev))
   compose_panel(p[5])
   lapply(e,panel_polygon)
   compose_panel(p[6])
   ct <- panel_contour(b["slopeS"],"color"
                      ,value=c(-0.99,-0.95,-0.9,-0.5,0.5,0.9,0.95,0.99))
   compose_legend(c(head(p,-1),'(Colorbar for contours)'=list(ct)),las=3)
   compose_close()
}

[Package ursa version 3.10.4 Index]