Learn R Programming

ursa (version 3.9.4)

colortable: Color Tables of raster images.

Description

Manipulation with color tables of raster images.

Usage

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

# S3 method for ursaColorTable [(x, i)

ursa_colortable(x)

ursa_colortable(x) <- value

ursa_colorindex(ct)

# S3 method for ursaColorTable names(x)

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

Arguments

x

ursaRaster object.

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 codevalue are assign to interval breaks.

i

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

passing to generic print. Currently not used.

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.

Color tables are written to ENVI header file.

Warning

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

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.

See Also

colorize

Examples

Run this code
# NOT RUN {
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"
                        ,"errata"="darkolivegreen4")
print(ursa_colortable(b2))
names(ursa_colortable(b2))[4] <- "Polar"
print(ursa_colortable(b2))
display(b2)
# }

Run the code above in your browser using DataLab