panel_contour | R Documentation |
An instrument to overlay multiple rasters on the same image panel. Contour is derived from one band of raster image. The colors (and respective colorbar in legend) is an alternative to contour labeling.
panel_contour(obj, type = "", ...)
obj |
Object of class |
type |
Character. Keyword list to descibe characteristics of contour, which is interpreted using regular expressions. |
... |
Set of arguments, which are recognized via their names (using regular expressions) and classes:
Other arguments are used in the functuion |
Function contourLines
is used for contouring.
The color table of input raster image is kept. The output panel have one element left, because contours are borders between areas of the same color. It is recommended to use only gradient palettes.
The color table is forced not to be ramp (argument ramp=FALSE
in the function colorize
) to prevent extra density of contour lines.
The color table is forced to be interval (argument interval=1L
in the function colorize
) to prevent lost of elements in the palette.
Object of class ursaColorTable
, which then should be used as an input argument for the colorbar legend (function legend_colorbar
). If there is no argument of class ursaRaster
then function returns NULL
value.
Nikita Platonov platonov@sevin.ru
contourLines
contour
session_grid(NULL)
a <- pixelsize()
refval <- seq(450,650,by=25)
val <- refval[seq(refval) %% 2 == 1]
ref <- colorize(a,breakvalue=refval,pal.rich=45,pal.rotate=0)
p1 <- colorize(a,breakvalue=val,pal.rich=135,pal.rotate=0)
p2 <- colorize(a,value=val,pal.rich=-15,pal.rotate=0)
p3 <- colorize(a,value=refval)
if (exam1 <- TRUE) {
compose_open(legend=list(list(1,"left"),list(1,"right")),scale=2)
panel_new()
# ct1 <- panel_raster(ref)
# ct2 <- panel_contour(p2,"colored line",palname="Greens",lwd=15,lwd.bg=0)
ct2 <- panel_contour(p2,"colored line",pal.rich=240,pal.rotate=0,lwd.fg=15,lwd.bg=0)
# panel_contour(ref,lwd=0)
# mysource("contour.R")
# mycontour(.panel_contour(a),lwd=0)
if (exists("ct1"))
compose_legend(ct1,units="raster")
if (exists("ct2"))
compose_legend(ct2,units="contour")
compose_close(bpp=8)
}
if (exam2 <- TRUE) {
compose_open(layout=c(2,2),byrow=FALSE
,legend=list(list(1,"left"),list("bottom",1)
,list(1,"right"),list("top",2)
,list(2,"right"),list("bottom",2)))
panel_new()
panel_raster(ref)
panel_contour(a)
panel_new()
ct0 <- panel_contour(a,"color",value=val,pal.rich=240,pal.rotate=0,lwd=11,lwd.bg=12)
panel_contour(a)
panel_annotation(text="no colortable")
panel_new()
panel_raster(p1)
ct1 <- panel_contour(p1,"color",lwd=11,lwd.bg=2)
panel_contour(a)
panel_annotation(text="colortable:category")
panel_new()
panel_raster(p2)
ct2 <- panel_contour(p2,"color",lwd=11,lwd.bg=2)
panel_contour(a)#,cex=0.5)
panel_annotation(text="colortable:interval")
compose_legend(ref,units="reference")
compose_legend(ct0,units="contour")
compose_legend(p1,units="raster")
compose_legend(ct1,units="contour")
compose_legend(p2,units="raster")
compose_legend(ct2,units="contour")
compose_close()
}
if (exam3 <- TRUE) {
s <- 29
session_grid(NULL)
a <- as.ursa(volcano)
if (FALSE) {
display(a)
a2 <- regrid(a,mul=s,cascade=TRUE,verbose=TRUE)
display(a2)
session_grid(a)
}
compose_open() ## device="windows")
panel_new()
ct1 <- panel_raster(a,ramp=FALSE,interval=TRUE)
ct2 <- panel_contour(a,"label")
rm(ct2)
panel_decor()
if (exists("ct2"))
legend_colorbar(ct2)
else if (exists("ct1"))
legend_colorbar(ct1)
compose_close()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.