[R] Control of axis limits in multiple panel lattice plots
Deepayan Sarkar
deepayan.sarkar at gmail.com
Thu Oct 28 19:09:54 CEST 2010
On Wed, Oct 27, 2010 at 6:45 AM, Peter Davenport <pwdavenport at gmail.com> wrote:
> I've found the solution to this in an old post of Deepayan's:
>
> lattice.options(axis.padding = list(numeric=0))
Or
xyplot(a~b|c,data=test.df, scales = list(axs = "i"))
-Deepayan
>
> 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
>>
>
> ______________________________________________
> 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.
>
More information about the R-help
mailing list