colortable {ursa}R Documentation

Color Tables of raster images.

Description

Manipulation with color tables of raster images.

Usage

## S3 method for class 'ursaColorTable'
print(x, ...)

## S3 method for class 'ursaColorTable'
x[i]


ursa_colortable(x)

ursa_colortable(x) <- value

ursa_colorindex(ct)
   
ursa_color(ct, ...)

## S3 method for class 'ursaColorTable'
names(x)

## S3 replacement method for class 'ursaColorTable'
names(x) <- value

Arguments

x

ursaRaster object. Extended for numeric (integer or real) of character vector.

ct

ursaColorTable object with or without indexing.

value

Named character vector. In Replacement functions:

For ursa_colortable(): values are colors in “#RRGGBB” notation or R color names (colors). names(value) are names of categories.

For names(): values are names of categories. If length of names is n-1, where n is length of colors, then intervaling is assumed, and value are assign to interval breaks.

i

Integer vector. Indices specifying elements to extract part (subset) of color table.

...

In print(), passing to generic print. Currently not used.
In ursa_colortable(), passing to generic print. Currently not used.
In ursa_color(), passing to colorize.

Details

The example of the class structure

Class 'ursaColorTable'  Named chr [1:4] "#313695" "#BCE1EE" "#FDBE70" "#A50026"
  ..- attr(*, "names")= chr [1:4] "<= 450" "(450;550]" "(550;650]" "> 650"

It is recommended to use ursa_colortable and ursa_colortable<- instead of colortable and colortable<-. ursa_colortable and colortable are synonyms. ursa_colortable<- and colortable<- are synonyms too. Package raster contains colortable and colortable<- functions. colortable and colortable<- will be remove from this package if the case of frequent joint use of both packages.

If color tables describe continuous and non-intersecting intervals, then print gives additional line of extracted breaks.

Value

ursa_colortable returns value of $colortable element if ursaRaster object.

ursa_colortable<- returns ursaRaster object with modified $colortable element.

Class of $colortable element is “ursaColorTable”. This is named character vector, where names are categories, and values are “#RRGGBB” or R color names.

Extract function [] for ursaColorTable object returns object of class ursaColorTable.

Extract function names for ursaColorTable object returns character vector (names of categories).

Replace function names<- for ursaColorTable object returns ursaColorTable with changed names of categories.

ursa_colorindex returns index (if presents) for ursaColorTable object.

ursa_color returns character vector of colors in hex format.

Color tables are written to ENVI header file.

Warning

If colors are specified as R color names, then slow down may appear.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

colorize

Examples

session_grid(NULL)
print(methods(class="ursaColorTable"))

a <- pixelsize()
print(a)
b1 <- colorize(a,value=c(400,500,600,700),interval=FALSE)
b2 <- colorize(a,value=c(450,550,650)    ,interval=TRUE)
display(list(b1,b2))
print(is.ursa(a,"colortable"))
print(is.ursa(b1,"colortable"))
print(is.ursa(b2,"colortable"))
print(ursa_colortable(a))
print(ursa_colortable(b1))
print(ursa_colortable(b2))
ursa_colortable(b2) <- c("Low"="darkolivegreen1"
                        ,"Moderate"="darkolivegreen2"
                        ,"High"="darkolivegreen3"
                        ,"undefined"="darkolivegreen4")
print(ursa_colortable(b2))
names(ursa_colortable(b2))[4] <- "Polar"
print(ursa_colortable(b2))
display(b2)

lab <- sample(c("A","B","C"),9,replace=TRUE)
lab
ct <- ursa_color(lab)
names(ct) <- lab
ct

[Package ursa version 3.10.4 Index]