I am struggling to get a date field on the x-axis in ggplot. The data, I am using, is a time-series data of aerosol concentration from two different sensors. The date field in the time-series is not continuous. Rather, it contains daily observations of just three months of a year, i.e. March, April, and May, starting from 2007 to 2016. So while I am assigning the date column in the data frame as 'Date' field, it is showing this figure in the link which I don't like. ggplot output. However, without assigning the date column as 'Date' it shows me this figure. ggplot output2. The problem with this new figure is the unreadability of the x-axis text. I guess, the reason behind this is- the date field which has been read as a factor variable. With some modifications in the code, I am able to remove the x-axis ticks and axis text. Now I want the original dates in the data frame to be put in the x-axis with reasonable breaks. I am sharing the code and a subset of data I have used.
library(ggplot2)
library(reshape2)
df = read.csv('./mydata.csv')
names(df) = c('Date','MODIS','MISR')
df_melt = melt(df, id.vars = 'Date')
head(df_melt)
names(df_melt) = c('Date','grp','AOD')
ggplot(df_melt, aes(x = Date, y = AOD, group = 1, colour = grp))+
theme(axis.text.x = element_blank()
,axis.ticks.x = element_blank())+
geom_line()+
facet_wrap(~ grp, ncol = 1)