panel_raster {ursa} | R Documentation |
Add raster to the image panel
Description
If specified image has 3 or 4 bands, then color composite is plotted on image panel, else the image is plotted regarding to its color table.
Usage
panel_raster(...)
Arguments
... |
Set of arguments, which are recognized via their names (using regular expressions) and classes.
|
Details
If obj
is list of raster images, then panel_raster
is applied to each item of list, and colortable of last item is returned.
If obj
has 3 or 4 bands then obj
is interpreted as RGB(A) image.
Function attempts to speed up plotting by reduce image matrix for big rasters.
Value
If argument obj
has strictly one band, then function returns color table - object of class ursaColorTable
, which can be used as an input argument for the colorbar legend (function legend_colorbar
). Otherwise function returns NULL
value.
Author(s)
Nikita Platonov platonov@sevin.ru
Examples
session_grid(NULL)
# example no.1 -- direct use
session_grid(regrid(mul=1/32))
dima <- with(session_grid(),c(columns,rows,3))
a <- ursa_new(value=array(runif(prod(dima),min=127,max=255),dim=dima))
p <- colorize(a,pal=c("black","white"),ramp=TRUE,value=0:256)
compose_open(layout=c(2,3),skip=4,legend=list(list("top","full"),list("bottom",2:3)))
for (i in seq(6)) {
panel_new()
if (i<4)
panel_raster(p[i])
else
panel_raster(a,interpolate=i==5)
panel_decor(col="black",coast=FALSE)
panel_annotation(c("red","green","blue"
,"interpolate=FALSE","interpolate=TRUE"))
}
legend_colorbar(p,label=seq(0,256,by=16),units="channels")
legend_mtext("color composite")
compose_close()
# example no.2 -- indirect use
ps <- pixelsize(NULL)
display(ps,raster.verb=TRUE)
# example no.3 -- color table for legend
session_grid(NULL)
compose_open()
panel_new()
ct <- panel_raster(ps,pal=terrain.colors)
panel_decor()
compose_legend(ct)
compose_close()