[R] Control of axis limits in multiple panel lattice plots
Peter Davenport
pwdavenport at gmail.com
Wed Oct 27 15:45:06 CEST 2010
I've found the solution to this in an old post of Deepayan's:
lattice.options(axis.padding = list(numeric=0))
Best,
Peter
On 27 October 2010 09:28, Peter Davenport <pwdavenport at gmail.com> wrote:
> Unwanted space (padding?) is introduced at the extremes of the x and y
> axes of my lattice plots.
> I've tried defining the scales using xlim, scale and num.limits in
> x.scale.components, but haven't succeded in getting overriding the
> introduction of extra space.
> Here's the problem:
>
> test.df<-data.frame(a=runif(100,0,1),b=c(runif(50,0,1),runif(50,0,2)),c=c(rep(c("A","B"),c(50,50))))
>
> 1) Space appears when I plot multiple panels:
> xyplot(a~b|c,data=test.df)
>
> 2) I can get rid of the space by explicitly defining scales (shown for
> x axis)...
> xyplot(a~b|c,data=test.df
> ,scale=list(x=list(limits=c(0,2),at=seq(0,2,0.5)))
> )
>
> 3) ...but not when relation="free":
> xyplot(a~b|c,data=test.df
> ,scale=list(x=list(relation="free",limits=list(c(0,1),c(0,2)),at=seq(0,2,0.5)))
> )
>
> Peter Davenport
>
More information about the R-help
mailing list