This vignette focuses on the available ggplot2
themes in INBOtheme
.
They mainly control the looks of the axes, background, legend, ...
Some themes also impact the schemes when using a colour or fill along a variable.
We illustrate that in vignette("colour", package = "INBOtheme")
.
The ggplot2
package must be loaded prior to INBOtheme
.
Loading INBOtheme
sets inbo_theme()
as default theme and inbo_steun_blauw
as default colour for the geoms
.
Note how we use theme_set()
and switch_colour()
.
This applies the theme and colour to all subsequent plots without the need to change the ggplot2
code.
INBOtheme
Add the following code after loading the ggplot2
or tidyverse
package and before creating the ggplot2
plots.
library(INBOtheme)
In case you need to change the default font size or background add the code below after loading the package.
theme_set(theme_inbo(base_size = 12, transparent = FALSE))
INBOtheme
Add the following code after loading the ggplot2
or tidyverse
package and before creating the ggplot2
plots.
library(INBOtheme) theme_set(theme_vlaanderen2015(base_size = 12, transparent = FALSE)) switch_colour(vl_darkyellow)
library(INBOtheme) theme_set(theme_elsevier(base_size = 12, transparent = FALSE)) switch_colour("black")
library(knitr) opts_chunk$set( echo = FALSE, message = FALSE, warning = FALSE ) base_size <- ifelse(opts_knit$get("rmarkdown.pandoc.to") == "latex", 7, 12)
library(ggplot2) library(INBOtheme)
# Prepare the data for the figures d <- data.frame( x = "Sphinx of black quartz, judge my vow", y = "Sphinx of\nblack quartz,\njudge my vow" ) data("esoph") cancer <- esoph cancer$Age <- cancer$agegp cancer$Alcohol <- cancer$alcgp cancer$Tabacco <- cancer$tobgp cancer$Proportion <- cancer$ncases / (cancer$ncases + cancer$ncontrols)
theme_inbo()
theme_inbo()
with default backgroundtheme_set(theme_inbo(base_size = 12)) switch_colour(inbo_steun_blauw)
theme_set(theme_inbo(base_size = base_size)) switch_colour(inbo_steun_blauw)
rmd <- knit_expand("child/_themes_test_figures.Rmd", theme = "inbo") md <- knit(text = rmd, quiet = TRUE) cat(md)
theme_inbo()
with transparent backgroundtheme_set(theme_inbo(base_size = 12, transparent = TRUE)) switch_colour(inbo_steun_blauw)
theme_set(theme_inbo(base_size = base_size, transparent = TRUE)) switch_colour(inbo_steun_blauw)
rmd <- knit_expand("child/_themes_test_figures.Rmd", theme = "inbo-tr") md <- knit(text = rmd, quiet = TRUE) cat(md)
theme_vlaanderen2015()
theme_vlaanderen2015()
with default backgroundtheme_set(theme_vlaanderen2015(base_size = 12)) switch_colour(vl_darkyellow)
theme_set(theme_vlaanderen2015(base_size = base_size)) switch_colour(vl_darkyellow)
rmd <- knit_expand("child/_themes_test_figures.Rmd", theme = "vlaanderen") md <- knit(text = rmd, quiet = TRUE) cat(md)
theme_vlaanderen2015()
with transparent backgroundtheme_set(theme_vlaanderen2015(base_size = 12, transparent = TRUE)) switch_colour(vl_darkyellow)
theme_set(theme_vlaanderen2015(base_size = base_size, transparent = TRUE)) switch_colour(vl_darkyellow)
rmd <- knit_expand("child/_themes_test_figures.Rmd", theme = "vlaanderen-tr") md <- knit(text = rmd, quiet = TRUE) cat(md)
theme_elsevier()
Note that theme_elsevier()
uses a base font size of 7.
Use that default when preparing plots for a paper.
theme_set(theme_elsevier(base_size = 12)) switch_colour("black")
theme_set(theme_elsevier(base_size = base_size)) switch_colour("black")
rmd <- knit_expand("child/_themes_test_figures.Rmd", theme = "elsevier") md <- knit(text = rmd, quiet = TRUE) cat(md)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.