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? Cheers Henning -- [[alternative HTML version deleted]]
On 6/20/08, Henning Wildhagen <HWildhagen at gmx.de> 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
There is an example in the examples section of ?xyplot.zoo in the zoo package of using panel.axis. It works largely the same way even if you don't use zoo. On Fri, Jun 20, 2008 at 6:06 AM, Henning Wildhagen <HWildhagen at gmx.de> 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? > > Cheers > > Henning > -- > > > > [[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. >