gis.pal: Configure GIS palette

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/gis.pal.R

Description

Expands GIS palette to desired length and range of data values.

Usage

1
gis.pal(name, pal, n = NA, zlim = NA)

Arguments

name

The name of a built-in GIS palette. One of name or pal must be specified.

pal

A GIS palette. One of name or pal must be specified.One of name or pal must be specified.

n

The number of colors desired. Cannot be smaller than the size of the original palette. If not specified, the size of the original palette is preserved.

zlim

The desired output range of data values. Must be specified for percentage-based palettes.

Details

Linear interpolation is used to add both value levels and colors between those specified explicitly in the palette.

Value

Returns a data frame with three columns:

value

The data value or percentage associated with each color.

pct

TRUE if the entry is a percentage; FALSE for a data value.

color

Color specification in hexadecimal format.

Author(s)

Sarah Goslee

See Also

gis.pal.info, gisimage

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  # different sizes of palette
  par(mfrow=c(5,1))
  display.gis.pal(pal=gis.pal("gyr", n=3, zlim=c(0,1)))
  display.gis.pal(pal=gis.pal("gyr", n=4, zlim=c(0,1)))
  display.gis.pal(pal=gis.pal("gyr", n=5, zlim=c(0,1)))
  display.gis.pal(pal=gis.pal("gyr", n=13, zlim=c(0,1)))
  display.gis.pal(pal=gis.pal("gyr", n=28, zlim=c(0,1)))

  # color an image
  mat1 <- matrix(runif(100), 10, 10)
  pal1 <- gis.pal("gyr", n=11, zlim=c(0,1))
  pal1
  gis.pal.info("gyr")
  layout(matrix(c(1,1,1,2), ncol=1))
  gisimage(mat1, pal1, legend=FALSE)
  display.gis.pal(pal=pal1)

phiala/giscolor documentation built on Jan. 28, 2020, 3:35 a.m.