Themes
View or edit on GitHub
This page is synchronized from trase/products/analysis/themes/README.md. Last modified on 2025-12-10 18:30 CET by Trase Admin.
Please view or edit the original file there; changes should be reflected here after a midnight build (CET time),
or manually triggering it with a GitHub action (link).
This folder contains theme files for common plotting libraries, to quickly style charts to reflect Trase branding.
ggplot2
With your working directory set to the TRASE_ANALYSIS repository on your local machine, run source("themes/theme_trase.R")
to load a few objects into your current R environment:
theme_trase, a ggplot themetrase_palette_categorical, a 10-colour Trase-branded color palette for categorical variablestrase_palette_categorical2, a 5-colour Trase-branded color palette for categorical variablestrase_palette_linear, an 8-colour Trase-branded linear palettetrase_palette_linear2, a 9-colour Trase-branded linear palettetrase_palette_grey, a grey Trase-branded linear palettetrase_palette_green, a green Trase-branded linear palette
There are also specific colours for different plot elements
- trase_map_border, for jurisdiction borders in maps
- trase_country_background, the background colour of focus jurisdictions
Then, add theme_trase() and the color palettes to your plot call as your would for any other ggplot theme.
library(ggplot2)
library(extrafont) # needed to load Trase fonts Decima Mono Pro and Merriweather. See below for installation.
# theme applied without Trase color palette
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_point() +
theme_trase()
# theme and color palette applied
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width, color = Species)) +
geom_point() +
theme_trase() +
scale_color_manual(values = trase_palette_linear)
Example plots are shown in the THEME_EXAMPLES folder.
Note on fonts: this theme works best with Trase fonts installed on your machine, which can be downloaded from the Trase dropbox at
https://www.dropbox.com/work/Trase/3.%20workstreams/ws4.%20frontend/8.%20design%20assets/Fonts, as well as for fonts
to be registered in R (extrafont::loadfonts() is helpful for this).