Home icon
Data Visualisation Guide

Theming

2 minutes read

Scales, guides, facets and theming

Just like scales have default configuration in all three implementations of the Grammar of Graphics, plots have default theming settings. The theming of a plot consists of the used colours, the spacing between elements and the used fonts.

Colours used in scales are specified in the scales themselves. But the colours of non-data elements in a plot can be set in the theming. In the plot below, a background colour is applied to an Observable Plot visualisation. The plot is also using a customised font family, font size and font colour.

A line chart with 4 lines showing temperatures measured over the year 2021

Source: observablehq.com/@observablehq/plot-cheatsheets-layouts

Apart from colours and fonts, the spacing between elements on a plot is an important part of its theming. Below is a schematic representation of the available spacing options in an Observable Plot visualisation.

A line chart with 2 lines with a lot of annotations naming all customisable and stylable elements in an Observable Plot

Source: observablehq.com/@observablehq/plot-cheatsheets-layouts

Below is a similar schema, illustrating all chart elements that can be themed with the theming system in ggplot2.

An annotated faceted ggplot2 naming the themable elements

Source: Henry Wang

More about the theming in each of the 3 implementations of the Grammar of Graphics can be found in their respective introduction pages:

Related pages

Facets

Guides

Scales

Scale types

Scale configuration

Intro to tidy data

Scales, guides, facets and theming