colorize {ursa}R Documentation

Create color table

Description

colorize assigns color table to raster image.

Usage

colorize(obj, value = NULL, breakvalue = NULL, name = NULL, pal = NULL, inv = NA,
         stretch = c("default", "linear", "equal", "mean", "positive",
                     "negative", "diff", "category", "julian", "date", "time",
                     "slope", "conc", "sd", "significance", "bathy",
                     "grayscale", "greyscale", ".onetoone"),
         minvalue = NA, maxvalue = NA, byvalue = NA, ltail = NA, rtail = NA, tail = NA,
         ncolor = NA, nbreak = NA, interval = 0L, ramp = TRUE, byte = FALSE,
         lazyload = FALSE, reset = FALSE, origin = "1970-01-01" ,format = "",
         alpha = "", colortable = NULL, verbose = FALSE, ...)
                          
palettize(...) ## wrapper for non-spatial vectors

Arguments

obj

ursaRaster object or one-dimension numeric or character vector.

value

Numeric. Values to be assigned to categories.

breakvalue

Numeric. Values to be assigned to intervals.

name

Character. Names of categories.

pal

Function or character. If function then value should corresponded to function, which creates a vector of colors. If character then values should correponded to R color names or hexadecimal string of the form "#RRGGBB" or "#RRGGBBAA".

inv

Logical. Invert sequence of colors.

stretch

Character. Either kind of value transformation ("linear", "equal") or pre-defined options with palette specification ("positive", "data", "significance", etc)

minvalue

Numeric. Lower range limit.

maxvalue

Numeric. Upper range limit.

byvalue

Numeric. Increment of the sequence from minvalue to maxvalue.

ltail

Numeric. Partition of omitted values at left tail.

rtail

Numeric. Partition of omitted values at right tail.

tail

Numeric. Partition of omitted values at both tail. If length of tail is 2 then left and right tails may differ.

ncolor

Numeric or interer. Number of desired colors (or categories)

nbreak

Numeric or interer. Number of desired separators between colors.

interval

Integer. How to underwrite categories? Use direct

ramp

Logical. Is color ramp required?

byte

Logical. Forcing to produce color table for storage in byte format (not more than 255 colors). Default is FALSE.

lazyload

Logical. If FALSE then raster is reclassified to categories. If TRUE then color table is created without any change to source raster. Default is FALSE.

reset

Logical. If TRUE and source raster has color table, then this color table is destroyed, and new one is created. Default is FALSE.

origin

Character. Origin for stretch="date" (passed to function as.Date) and stretch="time" (passed to function as.POSIXct). See desription of orogin in respective functions. Default is "1970-01-01".

format

Character. Format date/time objects for arguments stretch with values "date", "time", or "julian". Default is "" (character of length 0).

alpha

Character or numeric. The characteristics of transparency. If character, then hexadecimal values between "00" and "FF" are allowed, and then coerced to numeric value between 0 and 255. If numeric, and ⁠0 <= alpha <= 1⁠, then alpha is multiplied to 255. alpha=0 means full transparency, alpha=255 means full opacity. Default is ""; if palette has no alpha channel, then alpha is assign to "FF".

colortable

Object of class ursaColorTable or object of class ursaRaster with color table. Reference color table. Is specified, then all other arguments are ignored, expexted lazyload. Default is NULL (unspecified).

verbose

Logical. Some output in console. Primarily for debug purposes.

...

For colorize(): If pal is a function, and argument names are in the format "pal.*" then prefix "pal." is omitted, and the rest part is used for argument names, which are passed to pal function.

For palettize(): Arguments, which are passed to colorize().

Details

palettize is a wrapper ursa_colortable(colorize(...)) to return color table for one-dimensional numeric or character vector.

colortable is designed to prepare pretty thematic maps.

Color rampimg (ramp=TRUE) is not quick in computatons and has no effective labelling. It is intoduced to visualize non-thematic maps, and it is assumed that labeling can be omitted for such maps.

The labelling implementation is based on some improvements of pretty function. The notation of intervals is mixed by brackets and comparative symbols, for example: "<=1.5","(1.5,2.5]","(2.5,3.5]",">3.5"

Reserved values for interval:

Keywords for stretch to create pre-defined color tables:

It is allowed manual correction of labels using followed code example: names(ursa_colortable(x)) <- c("a<=0","0<a<=1","a>1")

Value

Object of class ursaRaster with named character vector of item $colortable

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

ursa_colortable, ursa_colortable<-

Examples

session_grid(NULL)
a <- pixelsize()-350
print(a)
b1 <- colorize(a,ramp=FALSE)
print(ursa_colortable(b1))
b2 <- colorize(a,interval=1,stretch="positive",ramp=FALSE)
print(ursa_colortable(b2))
b3 <- colorize(a,interval=2,stretch="positive",ramp=FALSE)
print(ursa_colortable(b3))
b4 <- colorize(a,value=c(150,250),interval=1)
print(ursa_colortable(b4))
names(ursa_colortable(b4)) <- c("x<=150","150<x<=250","x>250")
print(ursa_colortable(b4))
display(b4)

[Package ursa version 3.10.4 Index]