1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Data Visualization with ggplot2

Connected

Exercise

Multiple time series

We already saw how the form of your data affects how you can plot it. Let's explore that further with multiple time series. Here, it's important that all lines are on the same scale, and if possible, on the same plot.

fish.species contains the global capture rates of seven salmon species from 1950–2010. Each variable (column) is a Salmon species and each observation (row) is one year. fish.tidy contains the same data, but in three columns: Species, Year, and Capture (i.e. one variable per column).

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • Use str() in the console to examine the structure of both fish.species and fish.tidy.
  • Plot only the Rainbow salmon time series with geom_line().