Creating Line Graphs

A picture is worth a thousand words. When analyzing data, a picture might be worth more than a million words. As you progress through your data analyst or data scientist career, you will encounter situations where you need to present your data findings to a group of people and creating a compelling visualization will make conveying your findings easier than through spoken language.

Throughout this lesson and subsequent lessons, you will gradually grow your data visualization skills to ensure you are prepared to land your first job in data! (If you’d like to read why you should learn data viz in R, we wrote about why in this blog post).

In the first lesson of our data visualization course, you will explore the principles of data visualization, learn to write R code to visualize trends in different ways, build intuition around different types of visualizations that will help you understand your data.

To create data visualizations in R, you’ll learn to use one of the most popular tidyverse packages: ggplot2. The ggplot2 package is popular among R users because of its consistent syntax and the efficiency with which you can use it to create high-quality visualizations.

Throughout this lesson, you’ll create line graphs to visualize and understand changes in United States life expectancies over time. Not only will you learn how to create and interpret a visualization, but you will also learn how to refine your graph aesthetics to make it easier to read and interpret results.


  • Learn the basics of ggplot2 for data visualization.
  • Create line graphs to visualize changes over time.
  • Learn how visualizing data can help you understand trends.

Lesson Outline

  1. Introduction to Data Visualization
  2. Introducing the Data
  3. Using Plots to Visualize Patterns in Data
  4. Data Visualization and the Grammar of Graphics
  5. Mapping Variables to Axes
  6. Adding Geometric Objects to Visualize Data Points
  7. Selecting Data for Visualization
  8. Adding Graph Titles and Changing Axis Labels
  9. Refining Graph Aesthetics
  10. Using Your Line Graph to Understand the Data
  11. Takeaways

Get started for free

No credit card required.

Or With

By creating an account you agree to accept our terms of use and privacy policy.