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

From: hadley wickham <>
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?




______________________________________________ mailing list
PLEASE do read the posting guide
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 Please read the posting guide before posting to the list.

list of date sections of archive