README.md

databrew: The R package of databrew

Installation

if(!require(devtools)) install.packages("devtools")
install_github('databrew/databrew')

Theme

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

Color palettes

The databrew package includes a few brand-compatible color palettes. The below show their usage:

Categorical

n <- length(unique(df$c))
g + scale_color_manual(name = '',
                       values = make_colors(n = n))

Continuous

g + scale_color_manual(name = '',
                       values = make_colors(n = n,
                                            categorical = FALSE))

Continuous (blue to green)

g + scale_color_manual(name = '',
                       values = make_colors(n = n,
                                            categorical = FALSE,
                                            b2g = TRUE))

Continuous (red to green)

g + scale_color_manual(name = '',
                       values = make_colors(n = n,
                                            categorical = FALSE,
                                            r2g = TRUE))

Details

Read the vignette for full details.



databrew/databrew documentation built on Feb. 1, 2020, 2:28 p.m.