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

From: hadley wickham <h.wickham_at_gmail.com>
Date: Thu, 03 Jul 2008 09:32:02 -0500

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/

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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:35:34 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