panel_shading | R Documentation |
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.
panel_shading(obj, level = NA, col = NULL, density = 25, angle = c( -45, 45),
lwd = 1, lty = 1, verbose = TRUE)
obj |
Object of class |
level |
Positive numeric. Threshold for |
col |
|
density |
Numeric. The density of shading lines, in lines per inch. Default is |
angle |
Numeric. The slope of shading lines, given as an angle in degrees (counter-clockwise). Default is vector of length two |
lwd |
Numeric. Line width for shading. Default is |
lty |
Numeric or character. Line type for shading. Default is |
verbose |
Logical. If |
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)
NULL
Nikita Platonov platonov@sevin.ru
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()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.