0

Data1 in Excel

I have the following plots in RStudio:

plot(Data1$Year, Data1$UKAll16_64, pch = 16, cex = 0.5,type="l", col = "blue", main = "UNEMPLOYMENT RATES 16-64", xlab = "YEARS (YR)", ylab = "PERCENTAGE (%)")

plot(Data1$Year, Data1$UKFemale16_64, pch = 16, cex = 0.5,type="l", col = "red", main = "UNEMPLOYMENT RATES FEMALES 16-64 ", xlab = "YEARS (YR)", ylab = "PERCENTAGE (%)")

plot(Data1$Year, Data1$UKMale16_64, pch = 16, cex = 0.5,type="l", col = "orange", main = "UNEMPLOYMENT RATES MALES 16-64 ", xlab = "YEARS (YR)", ylab = "PERCENTAGE (%)")


As I am fairly new to R and RStudio, I am still learning and wanting to know how to include all 3 in one graph. Any help would be very much appreciated!!

Edit: I included my data set in the form I wanted on excel to give a visual example of what I am trying to accomplish on R Studio

Dit
  • 13
  • 3
  • 1
    What do you mean by "one graph" are you imagining 3 separate graphs side by side or just a graph that has three sets of lines each corresponding to a different part of the data? – Emily Kothe Feb 16 '19 at 20:04
  • Oh, I'm sorry for the confusion! I mean one graph that has three sets of lines. – Dit Feb 16 '19 at 21:08

1 Answers1

0

Just use lines on the second and third "plots". Use lty to change the line type and lwd to change the line width. Cex is not relevant when plotting lines.

plot(Data1$Year, Data1$UKAll16_64, lwd = 0.5,type="l",
     col = "blue", main = "UNEMPLOYMENT RATES 16-64",
     xlab = "YEARS (YR)", ylab = "PERCENTAGE (%)")

lines(Data1$Year, Data1$UKFemale16_64, col = "red", lty = 3, lwd = 2)

lines(Data1$Year, Data1$UKMale16_64, col = "orange", lty = 5, lwd = 3)
JavRoNu
  • 349
  • 2
  • 12
  • Thank you so much for the answer! I have done what you have told me and I have realised I have not been specific enough with what I wanted. As I realised from a question propped up by another comment. I desire to have one graph with 3 sets of lines inside of it. I hope that makes sense and I am sorry for the misunderstanding. – Dit Feb 16 '19 at 21:09
  • Do you want to plot one over another ? – JavRoNu Feb 16 '19 at 21:11
  • Hello! I have included a picture of what I am trying to accomplish. I hope that will help to understand. – Dit Feb 16 '19 at 21:18
  • Thank you so much. I really appreciate the help! – Dit Feb 16 '19 at 21:22