Line plot with multiple lines

Hello,

I am trying to create a line graph in R studio as above ^ however I am struggling. I would like the X axis to be dates from May 1997-Apr 1998, the y axis to be Sea Surface Temperatures, and the 2 lines to show the minimum and maximum sea surface temperatures.

My excel sheet is formatted as follows:
Date SST Min SST Max

May 97 25 30
June 97 27 31
July 97 30 33

and so on.

Any ideas for a code using ggplot?

Thanks.

The first step is to have the data in R rather than excel, are you able to do that ?
an easy way is to use excel to save as csv, then use R to read the csv

Hi, yes I converted it to a csv file and imported it into R.

yes, define you aesthetics, x being your dates, and y being your first line. use geom line, then use a second geom line with y aesthetic set for the second line required.

I'm assuming you are familiar with aesthetics in ggplot2 ?
for a tutorial look at https://r4ds.had.co.nz/ chaper 3

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.