Last active
August 29, 2015 14:13
-
-
Save geotheory/4b70f11ef419f45fe21e to your computer and use it in GitHub Desktop.
Quick rwantshue demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# *** PACKAGE IS CURRENTLY UNDER DEVELOPMENT SO THIS CODE MAY NOT WORK *** | |
# this doesn't do the iwanthue tool justice it just shows the flow | |
# checkout http://tools.medialab.sciences-po.fr/iwanthue/ for detail | |
require(devtools) | |
install_github("hoesler/rwantshue") | |
require(rwantshue) | |
scheme <- iwanthue() | |
col_hcl <- list(c(0, 360), # hue range [0,360] | |
c(0, 3), # chroma range [0,3] | |
c(0, 1.5)) # lightness range [0,1.5] | |
cols <- scheme$hex(n = 4, force_mode = FALSE, quality = 50, color_space = col_hcl) | |
# for example | |
require(ggplot2) | |
dat = reshape2::melt(iris, id.vars='Species') | |
ggplot(dat, aes(Species, value, fill=variable)) + geom_bar(stat='identity') + scale_fill_manual(values = cols) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment