View source: R/cust.colorbar.r
cust.colorbar | R Documentation |
v.raster
and add.region
-calls.
function (used by v) to define the colorbar placement and figure dimensions. Unlike set.colorbar the colorbar is not added to an existing plot but to a dummy device.
cust.colorbar(v_area, lon, lat, cbpos='', cbx, cby,
figdim, input.mode, force.figdim.widget=F, xpos=-1)
v_area |
region-keyword predefined by the region_definitions-dataset or an extent. |
lon |
Vector returning longitude coordinates of the area to be plotted. |
lat |
Vector returning latitude coordinates of the area to be plotted. |
cbpos |
letter ("b", "l", "t", "r") indicating the position of the colorbar (bottom, left, top, right). Overwrites |
cbx |
the horizontal limits (x1, x2) of the colorbar. If missing, the user will be asked for manual colorbar placement. |
cby |
the vertical limits (y1, y2) of the colorbar. If missing, the user will be asked for manual colorbar placement. |
figdim |
numeric vector indicating the |
input.mode |
character indicating the input mode of the function: 'i' for manual colorbar placement, 'v' for a vertical colorbar on the right side of the plot or 'h' for a hoizontal colorbar below the plot.. |
force.figdim.widget |
whether |
xpos |
integer: initial position of the top left corner of the figure window on the pc-screen, given in pixels. Negative values are from the opposite corner. (default is -1). Disregarded under Mac OS. |
like set.colobar
cust.colobar
defines colorbar settings, but furthermore the default figure size. The function is used by calls of v on non-'.gz'
-files and add.region.
a list of colorbar definition vectors: cbx, cby, figdim
and align
of which the latter holds the values of gradient
and oticks
. See function argmuments for more details.
Robert K. Bauer
set.colorbar, add.region and v.raster
## Example:
path <- system.file("test_files", package="oceanmap")
nfiles <- Sys.glob(paste0(path,'/herring*.nc')) # load sample-'.nc'-files
head(nfiles)
rfile <- nc2raster(nfiles[1], varname='Conc', layer=1)
ext <- extent(rfile)
#cb <- cust.colorbar(ext) # starts new plot device to define colorbar placement
#cust.colorbar(ext, cbx=cb$cbx, cby=cb$cby) # if cbx and cby are given no figure is produced
#plotmap(ext)
#set.colorbar(cb$cbx, cb$cby) # plots to an existing plot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.