Let’s start with a very basic
ggplot2 scatterplot. By default,
ggplot2 offers a grey background with white major and minor gridlines.
It is possible to change that thanks to the
theme() function. Keep reading to learn how!
Two options of the
theme() functions are available to control the map background color.
plot_background controls the color of the whole chart.
panel.background controls the part between the axis.
Both are rectangles, their features is thus specified through an
Two main types of grid exist with
ggplot2: major and minor. They are controled thanks to the
Once more, you can add the options
.x at the end of the function name to control one orientation only.
Features are wrapped in an
element_line() function. Specifying
element_blanck() will simply removing the grid.