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

hadley wickham h.wickham at gmail.com
Thu Jul 3 16:32:02 CEST 2008


Hi Henning,

> 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.

Unfortunately this is a deficiency in the date scale - there's no way
to manually set the breaks.  It's on my to do list to fix, but I'm
currently working on some bigger things like a decent
theming/customisation system and a rewrite of the faceting code so it
may be a while before I get to it.  Currently, your only option is to
do something like this:

g <- ggplot(df, aes(as.numeric(Date), var, min=(var - err), max=(var + err)))
...
g + scale_x_continuous(breaks = as.numeric(Period), labels = Period)

Does that help?

Regards,

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list