View source: R/mu_ggplots2_ext.R
ggAutoColorScale | R Documentation |
Automatical color scales for values for ggplots
ggAutoColorScale(x, method = "color", symmetric = TRUE)
x |
vector of values |
method |
method for scaling: |
symmetric |
treat numeric values as symmetric. If there are values smaller and larger than 0, a diverging color scheme will be applied |
the theme structure
dframe.num.pos <- data.frame(x=runif(100),y=runif(100))
ggplot(dframe.num.pos, aes(x=x,y=y, color=x)) + geom_point() + ggAutoColorScale(dframe.num.pos[,"x"])
dframe.num.sym <- data.frame(x=rnorm(100),y=rnorm(100))
ggplot(dframe.num.sym, aes(x=x,y=y, color=x)) + geom_point() + ggAutoColorScale(dframe.num.sym[,"x"])
dframe.num.sym.lab <- data.frame(x=rnorm(100),y=rnorm(100), lab=sample(c("A", "B", "C", "D"), 100, replace=TRUE))
ggplot(dframe.num.sym.lab, aes(x=x,y=y, color=lab)) + geom_point() + ggAutoColorScale(dframe.num.sym.lab[,"lab"])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.