I have tried everything but I did not manage to succeed. My code so far is the following:
covid_data$day <- as.Date(covid_data$day)
contagion.ts <- ts(covid_data$contagion, frequency = 365)
contagion.hw <- HoltWinters(x=contagion.ts, gamma=FALSE)
plot(contagion.hw)
Therefore, I would like to customize the xtickers, but it seems impossible and I am honestly giving up. I have read a ton of examples but I cannot figure out why it is not working.
The code I wrote is:
covid_data$day <- as.Date(covid_data$day)
contagion.ts <- ts(covid_data$contagion, frequency = 365)
contagion.hw <- HoltWinters(x=contagion.ts, gamma=FALSE)
plot(contagion.hw, xaxt = "n")
axis(1, at=covid_data$day)
And I obtain this error message: Error in axis(1, at = covid_data$day) : plot.new has not been called yet
, which i don't what it means nor how I fix it.
I have documented a lil more and I have discovered I can change directly the xtickers in the plot()
function:
covid_data$day <- as.Date(covid_data$day)
contagion.ts <- ts(covid_data$contagion, frequency = 365)
contagion.hw <- HoltWinters(x=contagion.ts, gamma=FALSE)
plot(contagion.hw, xaxp = covid_data$day)
and I get the error message: Error in plot.window(xlim, ylim, log, ...) : the parameter "xaxp" has wrong length
I even tried to change the xtickers with a standard vector c(-100,100,100)
but I obtain no xtickers in the plot.