Re: [R] Problem with "date"-x-axis in lattice

From: Deepayan Sarkar <>
Date: Fri, 20 Jun 2008 12:16:40 -0700

On 6/20/08, Henning Wildhagen <> wrote:
> Hello list,
> i am trying to plot a continous variable y against a "date" variable, both
> in one dataframe named "df", using a code like this
> library(lattice)
> plot1<-xyplot(y~date, data=df, type="b")
> "date" is of class "Date", of course, format="%d.%m.%Y", and spans two
> calendar years. The problem is that the x-axis is labeled with only one
> tick mark corresponding to the year with century (%Y) of the second
> calendar year.
> Is there a way to define the increment of the x-axis tick marks?

Could you provide a reproducible example?

In general, the algorithm that computes tick locations for date-time scales often performs inadequately. Presumably the algorithm could be improved, but I don't know how (the current code is ripped off from traditional graphics, which has similar problems). It may be simpler to just specify 'at' locations manually in the 'scales' argument (see ?xyplot).

-Deepayan mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sat 21 Jun 2008 - 05:27:07 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 Sat 21 Jun 2008 - 05:30:45 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive