ggAutoColorScale: ggAutoColorScale

View source: R/mu_ggplots2_ext.R

ggAutoColorScaleR Documentation

ggAutoColorScale

Description

Automatical color scales for values for ggplots

Usage

ggAutoColorScale(x, method = "color", symmetric = TRUE)

Arguments

x

vector of values

method

method for scaling: "color" or "fill"

symmetric

treat numeric values as symmetric. If there are values smaller and larger than 0, a diverging color scheme will be applied

Value

the theme structure

Examples

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"])

demuellae/muRtools documentation built on Sept. 8, 2023, 4:32 p.m.