Before using this package you’ll want to configure color codes and palette combinations. This is accomplished on the R/config.yml file using standard yaml formatting (including a trailing newline). This needs to be performed the package is installed. Required components are:
colors:
orange: "#F58220"
lime: "#7AC143"
brown: "#591F00"
gold: "#ffd051"
sand: "#f7a964"
green: "#508d2a"
red: "#b84000"
cream: "#b84000"
palettes:
all:
- orange
- lime
- brown
- green
- gold
- red
main:
- orange
- lime
light:
- orange
- gold
These examples demonstrate usage of two functions (scales) that can be used to modify color schemes of a ggplot. Common params for these include:
library(EasyBranding)
library(ggplot2)
library(ggprism)
theme_set(theme_prism() + theme(aspect.ratio = 0.4))
p <- ggplot(iris, aes(x=Sepal.Length, y=Sepal.Width, color = Species)) +
geom_point(size = 2) +
geom_smooth(formula = 'y ~ x', method = 'glm', se = F)
p + scale_color_brand() +
labs(title='main palette')In this series we demonstrate how palettes are created when datasets require more colors than those defined in a palette. This is typically accomplished by interpolating intermediate values, therefore when a palette is defined by 2 values the colors are all intermediate those two, then more are specified then colors are interpolated along those specifications.
df <- data.frame(category = LETTERS[1:20],
value = runif(20)+1)
p <- ggplot(df, aes(category, value, fill = category)) +
geom_col()
p + scale_fill_brand() +
labs(title='main palette') +
theme(legend.position = 'none')p + scale_fill_brand(palette = "all") +
labs(title='*all* palette') +
theme(legend.position = 'none')