"R version 4.0.3 (2020-10-10)"
I have a some time-series data where I am trying to look at the change in consumption over time. Here is a reprex.
set.seed(1)
date <- seq(as.POSIXct('2010-01-01'),as.POSIXct('2010-04-10'),by=86400)
Consumption <- rnorm(99)
Data <- data.frame(date,Consumption)
plot(Data$Consumption~Data$date,type='l') # X-axis labels and ticks not printing
par(yaxt='n')
axis(side = 2,at=seq(-3,3,0.5),labels = seq(-3,3,0.5)) # This works on the first plot on the y axis
plot(Data$date~Data$Consumption,type='l') # X-axis refusing to print despite assigning it.
par(xaxt='n')
axis(side = 1,at=seq(-3,3,0.5),labels = seq(-3,3,0.5)) # This works on the first plot
The graph outputted in the initial plot() is exactly what I want except for the fact it doesn't have any labels for the x-axis.
I am using Base Plotting for an assignment rather than everyday use and would usually use ggplot.
I have been trying to figure out why the x-axis is not plotting. Initially I thought the problem was with the date variable and tried cleaning it up with lubridate::ymd(). However when I started making the above reprex for the purpose of this question it is clear to the X-axis labels and ticks as whole is not printing. In the second plot I put the consumption variable on the x-axis. I was surprised to find that the date is printing neatly on its own on the Y-axis.
What am I doing wrong?

