sl.num2colbarbreaks: Auto-Define Colourbar Breaks

sl.num2colbarbreaksR Documentation

Auto-Define Colourbar Breaks

Description

Automatically define a discrete number of breaks given a numerical vector or matrix for application with a discrete colourbar.

Usage

sl.num2colbarbreaks(num, colbar = NULL, Nbreaks = NULL, breaks.log = FALSE)

Arguments

num

a numerical vector or matrix.

colbar

a spheRlab colourbar of length N, that is, a list of characters giving colours as produced by sl.colbar (which uses the function rgb to generate the individual colours). This argument is optional; instead, just the number of breaks can be specified via Nbreaks.

Nbreaks

an integer giving the number of breaks to be generated. Note that Nbreaks corresponds to N-1. If NULL, colbar is used to determine Nbreaks if colbar is provided, otherwise a default of 10 is used for Nbreaks.

breaks.log

a logical value indicating whether the breaks shall be placed in logarithmic steps. Default is breaks.log=FALSE.

Details

This function is used by sl.num2colbar.

Value

A vector of length N-1 giving the breaks.

Author(s)

Helge Goessling

See Also

sl.num2colbar

Examples

cb = sl.colbar(cols=list(c(1,0,0),c(.5,.5,.5),c(0,0,1)),N=5)
sl.num2colbarbreaks(num=runif(n=1000,min=-5,max=5),colbar=cb)
## Should return something like (result subject to randomness):
## [1] -3.0019879 -1.0079374  0.9861131  2.9801636

helgegoessling/spheRlab documentation built on April 8, 2024, 8:34 a.m.