makeDisplay
). Useful in conjunction with setLims
.
prepanel(data, prepanelFn = NULL, params = NULL, packages = NULL, control = NULL, verbose = TRUE)
xlim
and ylim
for determining axis limits, and optionally dx
and dy
for determining aspect ratio (used to define slopes of line segments used for banking computations). prepanelFn can also be a panelFn (see makeDisplay
) that returns either an object of class "trellis" or "ggplot", since xlim and ylim can be determined from these.prepanelFn
(most should be taken care of automatically such that this is rarely necessary to specify)rhwatch
in RHIPE) - see rhipeControl
and localDiskControl
dx
and dy
are supplied in prepanelFn
. Can be used with plot.trsPre
and setLims
.
You do not need to use prepanel()
to ultimately create a display with makeDisplay()
, but if you bypass, you will either need to specify your own limits in your plot command, or do nothing, in which case each individual plot will have limits based on the data in the split being plotted (the axes will be "free").
Axis limits are very important. What makes viewing groups of plots of subsets of data ("small multiples") so powerful is being able to make meaningful visual comparisons across plots. This is much easier to do if scales for each plot are commensurate.
This function is also useful for identifying subsets with very large outlying values, and in conjunction with setLims
, allows you to account for that prior to the expensive process of creating all of the plots.
x
plot.trsPre
, setLims
, makeDisplay
d <- datadr::divide(iris, "Species")
irisPreFn <- function(x) {
list(
xlim = range(x$Sepal.Length),
ylim = range(x$Sepal.Width)
)
}
irisPre <- prepanel(d, prepanelFn = irisPreFn)
plot(irisPre)
irisLims <- setLims(irisPre, x = "same", y = "sliced")
Run the code above in your browser using DataLab