Re: [R] axis.break on Date-x-axis in lattice xyplot

From: Jim Lemon <jim_at_bitwrit.com.au>
Date: Mon, 28 Jul 2008 22:12:12 +1000

On Mon, 2008-07-28 at 12:19 +0200, Henning Wildhagen wrote:
> Dear list,
>
> i am using the following code to produce a lattice xyplot, but the
> axis.break-function is seemingly not executed.
>
> Date<-seq(as.Date("2006-08-29"), as.Date("2007-08-28"), by="2 weeks")
> Period<-
> var1<-rnorm(27, 90000000, 30000000)
> var2<-rnorm(27, 500000000,250000000)
> var3<-rnorm(27, 1000000,500000)
> var4<-rnorm(27, 600000,300000)
> var5<-rnorm(27, 50000, 25000)
>
> Start<-as.Date("2006-08-01") ##1. August 2006
> End<-as.Date("2007-09-01") ##31. August 2007
> Periode<-seq(Start, End, by="month")
>
> df<-data.frame(Date,var1,var2,var3,var4,var5)
>
> library(reshape)
>
> df<-melt(df, id="Date")
>
> library(lattice)
> library(plotrix)
>
> P<-xyplot(df$value~df$Date|df$variable,
>
> scales=list(x=list(at=Periode,rot=60,tck=-1,format="%d.%b.%Y",alternating=F),
> y=list(relation="free",rot=0
> )),
> axis.break(axis=1,
> breakpos="2007-01-01",style="gap",bgcol="white",breakcol="black",brw=0.1)
> )
>
> This code is resulting in an error, the problem is the specification of
> the breakpos-Argument, but I dont know what "user units" in this case
> are.
>
Sorry Henning,
axis.break may have some problems in the lattice environment. The "user units" don't necessarily correspond to what is on the plot, nor can you necessarily add things to a plot that is displayed. Unfortunately, I can't get your example to run (I get "Error in as.vector(x, mode) : invalid 'mode' argument"), so I can't suggest how you might get around this.

Jim



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 Mon 28 Jul 2008 - 12:18:43 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 Mon 28 Jul 2008 - 12:32:44 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