I have the following
date ratio 1992-1 0.5 1992-1 0.6 1992-1 0.5 1992-2 0.7 1992-2 0.65 1992-2 0.65
and I try to run the following code to create a graph
occratiocomb <- ggplot() + # blue plot geom_line(data=SKILL_1_OCC_FINAL, aes(x=Date, y=ratio_1occ_comb, group = 1, colour="very low")) + geom_smooth(data=SKILL_1_OCC_FINAL, aes(x=Date, y=ratio_1occ_comb), method = loess, fill="red", colour="red", size=1) + theme(axis.text.x=element_text(angle=60, hjust=1)) # PROBLEM occratiocomb + scale_x_date(date_breaks = "1 year", date_labels = "%Y") print(occratiocomb)
The x axis (date) of my graph is looking terrible since I have monthly data as well as it shows a period of 30 years. The thing I try to do now is to change the date scale from a scale based on months to one based on years. Unfortunately, if I try to run the code the error
date_trans works with objects of class Date only, is displayed. In my opinion, this is weird because my date column is already in a date format. Or is the issue related to the fact that my date variable does not contain any days?
Many thanks in advance