I need to draw the following graph:
On X axis I have 72 values which represents the months from 2015 to 2020. On Y axis I can have value from 0 to 5.
This is my code with x values divided in wrong way:
yval=round(runif(72, 0, 5))
plot(yval, type="l", col="red")
I would like to see my x axis divided by year values, in my case: 2015,2016,2017,2018,2019,2020
Something like the x axis of the following graph:
How can I do this?
Use xaxt="n'
to disable the automatic axis labeling, and axis(.)
to add your own.
plot(yval, type="l", col="red", xaxt="n")
axis(1, c(0,12,24,36,48,60), 2015:2020)
(BTW, I changed 32 to 36, I thought it would align better :-)