Learn

You’ve completed the introduction to ggplot lesson! You’re ready to follow the general pattern for creating a visualization:

  1. Determine what relationship you wish to explore in your data
  2. Find the right geom(s) in the ggplot2 documentation to display that relationship and read about the arguments and aesthetics specific to that geom
  3. Extend the grammar of graphics to follow the pattern learned in this lesson to add layers and create a visualization. Improve graph legibility by polishing labels and styles.

Some of the key concepts you learned in this lesson include:

  • The basic units of grammar include data, geoms, and aesthetics.
  • The dataframe associated to the plot by using the ggplot() function creates a ggplot object that is known as the canvas.
  • The geometries or geoms are the shapes that display the data. Geometries become layers as you add them to your ggplot object.
  • The aesthetics are visual instructions you provide the plot. Aesthetics can be inherited or specified at the geom level.
  • Aesthetic mappings are data-driven visual instructions for the plot.
  • You can add context to your plot by customizing its labels with the labs() function

Instructions

Feel free to customize the plot you just created by modifying labels or assigning new manual or mapped aesthetics. What other relationships in the mpg data could you display and what geoms could you use to show them? Continue when you’re ready!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?