gmtColors | R Documentation |
gmtColors
provides colors used in various palettes
used by Generic Mapping Tools (GMT)
gmtColors(pal.name = "relief")
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") |
a vector of hexadecimal color levels of the desired palette
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.