Skip to content

Instantly share code, notes, and snippets.

@bholt
Created August 12, 2015 17:49
Show Gist options
  • Save bholt/38fc80d5d5b377cb3302 to your computer and use it in GitHub Desktop.
Save bholt/38fc80d5d5b377cb3302 to your computer and use it in GitHub Desktop.
Custom color scheme for ggplot
c.blue <- "#0072B2"
c.yellow <- "#E69F00"
c.green <- "#009E73"
c.red <- "#D55E00"
c.pink <- "#CC79A7"
c.gray <- "#999999"
palette <- c(
'follow'=c.blue,
'newuser'=c.yellow,
'post'=c.green,
'repost'=c.red,
'timeline'=c.pink,
)
color_scales <- function(title, palette)
list(
scale_fill_manual(values=palette, name=title),
scale_color_manual(values=palette, name=title)
)
ggplot(...)+color_scales(title='Transaction Type')
@bholt
Copy link
Author

bholt commented Aug 12, 2015

(where follow, newuser, etc are levels in a factor you wish to color)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment