if(!require(devtools)) install.packages("devtools")
install_github('databrew/databrew')
The theme_databrew()
function, used in conjunction with ggplot2
objects, styles a plot to the databrew brand:
library(ggplot2)
library(databrew)
df <- data.frame(a = 1:10,
b = rep(1, 10),
c = letters[1:10])
g <- ggplot(data = df,
aes(x = a,
y = b,
color = c)) +
geom_point(size = 15) +
theme_databrew() +
theme(legend.position = 'none')
g
The databrew
package includes a few brand-compatible color palettes. The below show their usage:
n <- length(unique(df$c))
g + scale_color_manual(name = '',
values = make_colors(n = n))
g + scale_color_manual(name = '',
values = make_colors(n = n,
categorical = FALSE))
g + scale_color_manual(name = '',
values = make_colors(n = n,
categorical = FALSE,
b2g = TRUE))
g + scale_color_manual(name = '',
values = make_colors(n = n,
categorical = FALSE,
r2g = TRUE))
Read the vignette for full details.