I am plotting 15 months of data and by default R is only plotting one x-axis tick mark, "2016". Ideally, I would have tick marks at intervals of every three, with labels such as "Sept" or "9/1/2015".
So far, I have succeeded in getting R to plot more tick marks, but the x-axis values don't display dates. I am not even sure if they correspond to the first of each month at three-month intervals (Sept, Dec, etc.), which would be my preference.
I have already various things, including:
#1
axis(1, at = seq(as.Date("2015-09-11"), as.Date("2016-12-11"), by = "month"))
#2
xaxp=c(as.Date("2015-09-11"), as.Date("2016-12-11"), 15)
#3
axis.Date(1, temperature_subset_maximum_EMI_2015_DATE_CONVERTED, at=seq(as.Date(temperature_subset_maximum_EMI_2015_DATE_CONVERTED), by="months", labels = TRUE, origin="1970-01-01")
#4
z<-cbind("2015-09-01", "2015-10-01", "2015-11-01", "2015-12-01", "2016-01-01", "2016-02-01", "2016-03-01", "2016-04-01", "2016-05-01", "2016-06-01", "2016-07-01", "2016-08-01", "2016-09-01", "2016-10-01", "2016-11-01","2016-12-01"
z<-as.Date(z, format="%Y-%m-%d")
class(z)
# [1] "Date"
#5
axis(side=1, at=c(1:15), labels=c("September","October","November","December","January","February","March","April","May","June","July", "August","September","October","November","December")
#6
axis.POSIXct(1, temperature_subset_maximum_EMI_2015_DATE_CONVERTED, format(seq.Date(as.Date("2015-09-01"), by = "month", len = 5)), labels = TRUE)
My most successful code so far is:
plot(x, y, xlim=c(as.Date("2015-09-11"),as.Date("2016-12-01")), ylim=c(0,30),xaxt="n", xlab="Date")
axis(1, at = seq(as.Date("2015-09-11"), as.Date("2016-12-31"), by = 93))
As I mentioned, I have been able to get more tick marks to show up on the x-axis, but I don't know if they denote the first the month (in one or three-month intervals), and the dates or names of months that they denote do not show up on the x-axis (instead 5 digit numbers show up). Currently, there are no error messages when I run the code. Below is the output: Graph with 2015-2016 data, but dates won't show up on x-axis