2.6 geom_point()

You might guess that by substituting geom_point() for a different geom function, you’d get a different type of plot.

That’s a great guess!

In the following sections, you’ll learn about some of the other important geoms provided in ggplot2.

This isn’t an exhaustive list, but should cover the most commonly used plot types.

  • geom_smooth() fits a smoother to the data and displays the smooth and its standard error.

  • geom_boxplot() produces a box-and-whisker plot to summarise the distribution of a set of points.

  • geom_histogram() and geom_freqpoly() show the distribution of continuous variables.

  • geom_bar() shows the distribution of categorical variables.

  • geom_path() and geom_line() draw lines between the data points. A line plot is constrained to produce lines that travel from left to right, while paths can go in any direction. Lines are typically used to explore how things change over time.