Site icon R-bloggers

GMT topography colours (I)

[This article was first published on Dan Kelley Blog/R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I enjoyed the blog posting by “me nugget”, which I ran across on R-bloggers, and so I decided to try that author’s GMT colourscheme. This revealed some intriguing patterns in the Oce dataset named topoWorld. The following code produces a graph to illustrate.

1. Set up colours as suggested on the “menuggest” blog

1
2
3
4
5
6
7
8
9
## test GMT colours as suggested by
## http://menugget.blogspot.ca/2014/01/importing-bathymetry-and-coastline-data.html
ocean.pal <- colorRampPalette(c("#000000", "#000209", "#000413", "#00061E", 
    "#000728", "#000932", "#002650", "#00426E", "#005E8C", "#007AAA", "#0096C8", 
    "#22A9C2", "#45BCBB", "#67CFB5", "#8AE2AE", "#ACF6A8", "#BCF8B9", "#CBF9CA", 
    "#DBFBDC", "#EBFDED"))
land.pal <- colorRampPalette(c("#336600", "#F3CA89", "#D9A627", "#A49019", "#9F7B0D", 
    "#996600", "#B27676", "#C2B0B0", "#E5E5E5", "#FFFFFF"))
library(oce)
## Loading required package: methods
1
2
3
4
5
data(topoWorld)
waterBreaks <- seq(-10000, -100, by = 50)
landBreaks <- seq(100, 10000, by = 50)
imagep(topoWorld, asp = 1, breaks = c(waterBreaks, 0, landBreaks), col = c(ocean.pal(length(waterBreaks)), 
    land.pal(length(landBreaks))))

Resources

To leave a comment for the author, please follow the link and comment on their blog: Dan Kelley Blog/R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.