Skip to content

Instantly share code, notes, and snippets.

@lauratboyer
Created September 7, 2015 23:44
Show Gist options
  • Save lauratboyer/76a1b5cfea49815caf8f to your computer and use it in GitHub Desktop.
Save lauratboyer/76a1b5cfea49815caf8f to your computer and use it in GitHub Desktop.
## custom-color-palettes.r
## Defining custom color palettes and loading packages for others
## -------------------------------------------------------
## Author: Laura Tremblay-Boyer (lauratb@spc.int)
## Written on: August 20, 2015
## Time-stamp: <2015-08-20 10:12:30 lauratb>
require(RColorBrewer)
require(colorspace)
cpue.colpal <- function(n=12) {
fb35 <- "#AC2020" #intermediate firebrick 3-4
# other option going from neutral to red
# colorRampPalette(c("wheat3","wheat2","orange1","indianred1","firebrick2",fb35))
colorRampPalette(c("royalblue3","deepskyblue1","gold","orange1","indianred1","firebrick2",fb35))(n)
}
# for residuals, want zero to be neutral colored
res.colpal <- function(n) {
colorRampPalette(c("royalblue4","royalblue2","deepskyblue","grey","ivory","ivory","grey","pink","indianred2","tomato3"))(n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment