How to remove text that appeared in the chart?

Am trying to plot 2 different columns of a time series data type in a single plot, however the year appears which seems to block the view of the chart. How do i remove the year in the chart so that i can see the charts nicely?
Am trying to plot 2 different columns of a time series data type in a single plot, however the year appears which seems to block the view of the chart. How do i remove the year in the chart so that i can see the charts nicely?
enter image description here
The below code is how i created the chart

data('fertil3')
fertil = ts(fertil3, frequency = 1, start = 1913)
plot(x = fertil[,"year"], y = fertil[,"gfr"], type="l", col="red", ylim = c(0, 250), xlab="Time", ylab="")
par(new=TRUE)
plot(x = fertil[,"year"], y = fertil[,"pe_1"], type="l", col="blue", ylim = c(0, 250),xlab="Time", ylab="")

>Solution :

You should convert the time series object ts to as.numeric which then is a vector and can be used to plot it like lines like this:

library(wooldridge)
data('fertil3')
fertil = ts(fertil3, frequency = 1, start = 1913)
plot(x = as.numeric(fertil[,"year"]), y = as.numeric(fertil[,"gfr"]), type="l", col="red", ylim = c(0, 250), xlab="Time", ylab="")
par(new=TRUE)
plot(x = as.numeric(fertil[,"year"]), y = as.numeric(fertil[,"pe_1"]), type="l", col="blue", ylim = c(0, 250),xlab="Time", ylab="")

Created on 2022-10-15 with reprex v2.0.2

Leave a Reply