gmtColors: GMT palette colors

View source: R/gmtColors.R

gmtColorsR Documentation

GMT palette colors

Description

gmtColors provides colors used in various palettes used by Generic Mapping Tools (GMT)

Usage

gmtColors(pal.name = "relief")

Arguments

pal.name

A palette name - One of the following 19 palette names: ("cool", "copper", "gebco", "globe", "gray", "haxby", "hot", "jet", "no_green", "ocean", "polar", "rainbow", "red2green", "relief", "sealand","seis", "split", "topo", "wysiwyg")

Value

a vector of hexadecimal color levels of the desired palette

Examples

# Visualization of palettes derived from GMT colors
pnames <- c(
  "cool", "copper", "gebco", "globe", "gray", "haxby",
  "hot", "jet", "no_green", "ocean", "polar", "rainbow",
  "red2green", "relief", "sealand","seis", "split", "topo", "wysiwyg"
)
txtCol <- c(rep(1,16), "white", rep(1,3))

op <- par(mar=c(0.1,0.1,0.1,0.1), mfrow=c(length(pnames), 1))
for(i in seq(pnames)){
  pal <- colorRampPalette(gmtColors(pal.name=pnames[i]))
image(matrix(seq(20), nrow=20, ncol=1), col=pal(20), axes=FALSE)
  box()
  usr <- par()$usr
  text(mean(usr[1:2]), mean(usr[3:4]), labels=pnames[i], 
       font=2, cex=1, col=txtCol[i])
}
par(op)

# Application to image plot
relief.pal <- colorRampPalette(gmtColors("relief"))
op <- par(mar=c(1,1,1,1))
image(volcano, col=relief.pal(100), axes=FALSE)
par(op)


marchtaylor/sinkr documentation built on July 4, 2022, 5:48 p.m.