[R] ggplot2: scaling and tick mark of x-axis

From: Henning Wildhagen <HWildhagen_at_gmx.de>
Date: Thu, 03 Jul 2008 15:38:57 +0200

Dear list,

i am trying to plot data in a way like this:

Date<-seq(as.Date("2006-08-29"), as.Date("2007-08-28"), by="2 weeks") var<-rnorm(27, 10000, 2500)
err<-rnorm(27, 3000, 1000)
df<-data.frame(cbind(Date, var, err))


g <- ggplot(df, aes(x=Date, y=var,
min=(var - err), max=(var + err)))

g1 <- g + geom_line() + geom_point() + geom_errorbar(width=2, linetype=1)


It works, however i am not satisfied with the output. I would like to have the x-axis starting at "2006-08-01" and ending at "2007-08-31" with tick marks and labels and each 1st of the months.

I managed to do this with a trellis plot by defining

Start<-as.Date("2006-08-01") ##1. August 2006 End <-as.Date("2007-09-01") ##1. September 2007 Period<-seq(Start, Ende, by="month")

and then using "Period" as argument in scales(at).

How can I succeed in ggplot2?




Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx

	[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 Jul 2008 - 14:07:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jul 2008 - 15:01:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive