Create a scatter plot with ggplot

Make your first steps with the ggplot2 package to create a scatter plot. Use the grammar-of-graphics to map data set attributes to your plot and connect different layers using the + operator.

  • Define a dataset for the plot using the ggplot() function
  • Specify a geometric layer using the geom_point() function
  • Map attributes from the dataset to plotting properties using the mapping parameter
  • Connect different ggplot objects using the + operator
library(ggplot2)
ggplot(___) + 
  geom_point(
    mapping = aes(x = ___, y = ___)
  )
View Interactive Version