I am trying to do a simple temperature over time curve in ggplot2. I have an average temperature measurement every day over 8 months. When I plot this the x axis gets very crowded. How can I format the x axis so that only the 8 months in full name and the year (e.g. October - 2013) are used as tick-names?
This is my code so far:
T <- read.table("R_Q_all.csv", header=T, sep=";")
head(T)
Q date
1 2.440 2013-10-01
2 2.206 2013-10-02
3 2.172 2013-10-03
4 3.115 2013-10-04
5 3.136 2013-10-05
6 2.788 2013-10-06
library("ggplot2")
library("scales")
ggplot(data=na.omit(T), aes(x=date, y=Q))
+ geom_line()+
+ scale_x_date(breaks = "month", labels=date_format("%m-%Y"))+
+ xlab("date")+
+ ylab("temp"))
Fehler in aes(x = date, y = Q) + geom_line() :
nicht-numerisches Argument für binären Operator
which gives me the error that there is a non numeric argument for the binary operator.
T$date <- as.Date(T$date)