Controlling themes in graphics
The theme layer specifies all non-data-related properties on the plot, such as the background, legend, axis labels, and so on. Proper control of the themes in the plot could aid visual communication by highlighting critical information and directing users’ attention to the intended message we would like to convey.
There are three types of visual elements controlled by the theme layer, as follows:
- Text, used to specify the textual display (for example, color) of the axis label
- Line, used to specify the visual properties of the axes such as color and line type
- Rectangle, used to control the borders and backgrounds of the plot
All three types are specified using functions that start with element_
, including examples such as element_text()
and element_line()
. We will go over these functions in the following section.
Adjusting themes
The theme layer can be easily applied as an additional layer on the existing graph. Let...