Internal R package of Statistics Greenland. Consists of extensions for ggplot2 themes, with plans to include miscellaneous tools for table output, tools for data wrangling, and API functions for the Statbank
This is a development version; expect things to change.
The development version of statgl
is available on
GitHub. To install, run:
# install.packages("devtools")
devtools::install_github("StatisticsGreenland/statgl")
At the moment, this package only has extension functions for ggplot2
,
providing themes and color palettes that follow the company design
manual.
The color functions are made by following this great blog post by Simon Jackson.
Add + theme_statgl()
to a ggplot object, to provide a custom theme:
library(ggplot2)
library(statgl)
library(dplyr)
ex_plot <-
mpg %>%
ggplot(aes(x = displ, y = hwy, color = class)) +
geom_point()
ex_plot + theme_statgl()
Add + scale_color_statgl()
ot a ggplot object to provide custom color
scale:
ex_plot + theme_statgl() + scale_color_statgl()
To provide a fill palette, use + scale_fill_statgl()
instead:
ex_plot <- mpg %>% ggplot(aes(x = class, fill = class)) + geom_bar()
ex_plot + theme_statgl() + scale_fill_statgl()