Skip to content

Instantly share code, notes, and snippets.

@naarkhoo
Created May 26, 2017 11:52
Show Gist options
  • Save naarkhoo/4629f1b2daff568b15105d66a61fc96a to your computer and use it in GitHub Desktop.
Save naarkhoo/4629f1b2daff568b15105d66a61fc96a to your computer and use it in GitHub Desktop.
Get color codes of a ggplot figure
ggplotColours <- function(n = 6, h = c(0, 360) + 15){
if ((diff(h) %% 360) < 1) h[2] <- h[2] - 360/n
hcl(h = (seq(h[1], h[2], length = n)), c = 100, l = 65)
}
ggplotColours(n = 3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment