Reputation: 17
My histogram doesn't look like it's on the correct date when I plot it.
My data looks like this
date tcol names
2005-03-31 170 Site 4
2005-03-31 328 Site 5
2005-03-31 40 Site 6
My Code looks like
ggplot(data=allsite, aes(x=date, weight=tcol, colour=names, fill=names))+
geom_histogram(binwidth=20000, position=position_dodge())+
scale_y_continuous(limits=c(0,1000))+
scale_x_datetime(labels = date_format("%d-%m-%y"),
limits = as.POSIXct(c("2005-03-29","2005-04-02")))
It's appearing as thought the data is for the 30th of the 3rd and not the 31st
Thanks for any help you can give me :)
Upvotes: 1
Views: 101
Reputation: 1500
you need to specify the time zone in as.POSIXct
limits = as.POSIXct(c("2005-03-29","2005-04-02"), tz="GMT"))
Upvotes: 2