Hi, i am currently creating some plots in R but i need help.
I have currently made a plot with the following code:
#plot of age
plot(WTC_age$`Crowding – many`, type = 'l', main = "Effect of Age on the Willingness to Cycle",
col="darkblue", ylab = "Distance (Km)", xlab = "Age", ylim=c(0,18))
lines(WTC_age$`Congestion – light`, col='purple')
lines(WTC_age$`Three stops`, col='cornflowerblue')
legend("topleft", # Add legend to plot
legend = c("Crowding","Congestion","Stops"),
col = c("darkblue", "purple", "cornflowerblue"),
lty = 1)
However, the x-axis is wrong as the age of the respondents varies from 18 to 78 years old.. instead of the way it is shown on the axis now (with 0-60). I have tried simply leaving out the x-axis and relabeling this with the axis function but then the plot also doesn't make sense anymore.
Basically what i want to do is ignore the numbering done by Rstudio itself, and changing the x-axis to the Age data. Can anyone help me?