Peter Davenport
2010-Oct-27 08:28 UTC
[R] Control of axis limits in multiple panel lattice plots
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
Peter Davenport
2010-Oct-27 13:45 UTC
[R] Control of axis limits in multiple panel lattice plots
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 >
Reasonably Related Threads
- Plotting a grid of directly specified colours
- CDR MYSQL missing field data
- best, safest and easiest way to provide remote access to files on linux machine
- [Bug 82843] New: [NV96][Regression][Bisected] Failure to resume
- FW: Re: domain groups accessing samba share