In the Grammar of Graphics, geometric objects are the visual elements of which the properties are used to encode data. Many geometric objects exist, and this module intends to give an overview of the available geometries.

From this module on, we step away from the abstract Grammar of Graphics, and we are going to reference the visualisation tools based on the Grammar that were introduced in the Introduction and the origins of the Grammar of Graphics module. These tools are:

All three tools share the Grammar of Graphics philosophy, but their practical implementation and terminology differ a little bit between them. For example, geometric objects are called geometries (or geoms for short) in ggplot2, while they are called marks in Vega-Lite and Observable Plot. In this training, we are using the term “geometries”.

This module gives an overview of the geometries available in the 3 tools, without going too much into detail about how the geometries can be used in each tool. This is discussed in the 3 modules that introduce each of the tools properly:

In this module, geometries are grouped according to their dimensionality.

<aside> ❗ Many of the example charts in this module have links to the page they are sourced from. On these source pages, you have access to the code snippets that generated the plots. This can help you how aesthetics can be used in the 3 implementations of the Grammar of Graphics. But these code snippets can also be a little overwhelming or confusing. Don’t worry about this: how to make visualisations and use aesthetics is explained in detail in the coming modules.

</aside>

0-dimensional geometries

Point geometries

0-dimensional geometries are tied to a single, exact position on the x-y plain. In its most basic form, these geometries are points. Therefore, ggplot2 and Vega-Lite have a point geometry, in Observable Plot this geometry is called a dot. This geometry is mostly used to produce scatter plots.

A scatterplot made in ggplot2 using the point geometry. Source: Maarten Lambrechts, CC BY SA 4.0

A scatterplot made in ggplot2 using the point geometry. Source: Maarten Lambrechts, CC BY SA 4.0

Point geometries do not necessarily need to be dots or little circles. Points in ggplot2 and Vega-Lite have a shape aesthetic that can be used to show categorical data.

The 24 shapes that can be used for point geometries in ggplot2. Source: Maarten Lambrechts, CC BY SA 4.0, adapted from ggplot2.tidyverse.org/articles/ggplot2-specs.html

The 24 shapes that can be used for point geometries in ggplot2. Source: Maarten Lambrechts, CC BY SA 4.0, adapted from ggplot2.tidyverse.org/articles/ggplot2-specs.html

The shapes of the poin geometry in ggplot2 in use. Source: Maarten Lambrechts, CC BY SA 4.0

The shapes of the poin geometry in ggplot2 in use. Source: Maarten Lambrechts, CC BY SA 4.0

Vega-Lite has a tick geometry which produces short lines instead of dots or other shapes. It can be used to create very compact visualisations of distributions.