cust.colorbar: defines colorbar settings for 'v.raster' and...

View source: R/cust.colorbar.r

cust.colorbarR Documentation

defines colorbar settings for v.raster and add.region-calls.

Description

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.

Usage

cust.colorbar(v_area, lon, lat, cbpos='', cbx, cby, 
              figdim, input.mode, force.figdim.widget=F, xpos=-1)

Arguments

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 and cby values.

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 width and height of the plot device in inches. If missing and force.figdim.widget is set FALSE, figdim is assigned a default width and height of 7in, otherwise the user will be asked to resize the plot device to set plot dimensions.

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 figdim should be assigned by a widget if missing.

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.

Details

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.

Value

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.

Author(s)

Robert K. Bauer

See Also

set.colorbar, add.region and v.raster

Examples

## 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

oceanmap documentation built on Nov. 10, 2023, 5:08 p.m.