[R] ggplot and scale_x_date

hadley wickham h.wickham at gmail.com
Thu Apr 22 03:51:24 CEST 2010


Hi Liam,

Unfortunately this currently isn't supported.  It's on my to do list:
http://github.com/hadley/ggplot2/issues/issue/94

Hadley

On Tue, Apr 20, 2010 at 7:59 PM, Liam Blanckenberg
<liam.blanckenberg at gmail.com> wrote:
> Hi all,
>
> I have a question about setting arbitrary breaks/labels when using GGPLOT
> and date/time data on the x-axis. I want to specify the breaks/limits
> arbitrarily rather than using scale_x_date(major = 'blah'), much like when
> arbitrarily defining breaks/labels using scale_x_discrete(breaks = blah,
> labels = blah)
>
> I have tried variants such as:
>
> scale_x_date(major = seq(from = as.Date('2000-01-01'), to  =
> as.Date('2009-01-01'), by = 'months'));
>
> etc but can't get this to work. I want to arbitrarily define the
> breaks/labels because I want to be able to control when the ticks/labels
> start (i.e. I want to be able to set where the first and last ticks/labels
> occur - you do not appear to be able to do this using the major = 'blah'
> command under scale_x_date).
>
> R-version: 2.9.2
> ggplotversion: 0.8.5
> OS: Windows 7
>
> Many thanks,
>
> Liam
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>



-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-help mailing list