[R] How limits are set in a scales list
Deepayan Sarkar
deepayan at stat.wisc.edu
Tue Sep 9 08:40:02 CEST 2003
On Monday 08 September 2003 23:36, Patrick Connolly wrote:
> I have a lattice plot that has 4 pages with 4 columns and 8 rows per
> page. I wish to have the rows use a separate x-axis since their
> ranges are quite different, but I wish to have those same limits used
> on each page.
>
> By setting an element of the scales list to something like x = list(limits
> = lim.list$CFU, lim.list$CFU, lim.list$CFU, lim.list$CFU, lim.list$TU,
> lim.list$TU, lim.list$TU, lim.list$TU, etc, etc) ,
> relation = "sliced")
>
> where lim.list is a list of the limits I wish to use, Only the first
> four panels (but on each page) are drawn using the limits I wish to
> use. Thereafter, they're all the same, but not in accordance with any
> other values in lim.list.
Could you specify your call more precisely ? I'm assuming limits was something
like
limits = list(lim.list$CFU, lim.list$CFU, ...
^^^^
What were the values of lim.list$CFU and lim.list$TU ? If you are explicitly
specifying the limits, why do you have relation="sliced" and not
relation="free" ? If lim.list$CFU and lim.list$TU don't have the same diff(),
the limits will be modified to honour the relation="sliced" setting. Is that
what you want ? I would guess from the reported behaviour that
diff(lim.list$TU) is less than diff(lim.list$CFU).
> The help page does not make it clear to me just how I should be
> specifying the list. There was recently something like this but I
> didn't manage to find it in the archives to check if it covered what I
> require.
Yes, the help page doesn't seem to mention this at all. I have updated this,
and the relevant new portions are:
In \item{scales}
relation : determines limits of the axis. Possible values are "same"
(default), "free" and "sliced". For relation="same", the same limits
(determined by \code{xlim, ylim, scales$limits} etc) are used for
all the panels. For relation="free", limits for each panel is
determined by the points in that panel (via the \code{prepanel}
function). Behaviour for relation = "sliced" is similar, except that
the length (max - min) of the scales are constrained to remain the
same across panels (limits specified as character vectors, if any,
are ignored in these computations). If relation is not "same", the
value of \code{xlim/ ylim/ scales$limits} is normally ignored,
except when the latter is a list, when it is treated as if its
components were the limit values obtained from the prepanel
calculations for each panel.
\item{xlim}
Normally a numeric vector of length 2 (possibly a
DateTime object) giving minimum and maximum for the x-axis, or, a
character vector, expected to denote the levels of \code{x}. The
latter form is interpreted as a range containing c(1, length(xlim)),
with the character vector determining labels at tick positions
\code{1:length(xlim)}
\code{xlim} could also be a list, with as many components as the
number of panels (recycled if necessary), with each component as
described above. This is meaningul only when
\code{scales$x$relation} is "free" or "sliced", in which case these
are treated as if they were the corresponding limit components
returned by prepanel calculations.
Deepayan
More information about the R-help
mailing list