[R] lattice: emulating the par(xaxs="i") behaviour

Thomas Zumbrunn t.zumbrunn at unibas.ch
Fri Mar 21 18:33:07 CET 2008


I tried to emulate the axis interval calculation behaviour of the traditional 
graphics system (with par(xaxs="i")) in lattice but couldn't find a flexible 
solution.

Let's say a have a simple xyplot:

x <- seq(0, 1, 0.01)
xyplot(x^2 ~ x, type="l")

I want to restrict the plotting region to the data range _and_ have axis 
labels over the full data range like this:

xyplot(x^2 ~ x, type="l", xlim=0:1, ylim=0:1,
scales=list(labels=seq(0, 1, 0.2)))

Is there a simple way to achieve this in a more general fashion (e.g. with 
lattice options) so that the behaviour could be applied to a whole set of 
plots?

Thomas Zumbrunn



More information about the R-help mailing list