I have created a data frame ('precip2') with 'Date' and precipitaion ('sum_precip'). I have created a bar chart in ggplot which shows precipitation on particular dates. I want to now draw vertical arrows above the bar, pointing to specific dates.
I get the error message: 'Error: Invalid input: date_trans works with objects of class Date only'
im pretty sure the Date is of the class date
Thanks
This is what I have so far:
precip2 %\>%
ggplot(aes(x=Date,y=sum_precip))+
geom_bar(stat="identity",fill="blue")+
theme(
panel.background=element_rect(fill="white"),
axis.line=element_line(colour="black")) +
geom_segment(aes(x= 2017-11-22, y = 60 , xend = 2017-11-22, yend = 30))
im pretty sure the Date is of the class date as I put this in the script before:
precip2$Datetime\<-as.POSIXct(precip2$Datetime,"%d/%m/%Y %H:%M",tz="UTC")
Without seeing the format of
precip2, I think this should work.