trelliscope (version 0.9.7)

setLims: Specify Rules for x and y Limits for a Display

Description

Based on results from prepanel, specify rules that will determine x and y axis limits to be passed as the lims argument when calling makeDisplay.

Usage

setLims(lims, x = "same", y = "same", xQuant = c(0, 1), yQuant = c(0, 1), xRangeQuant = 1, yRangeQuant = 1, prop = 0.07)

Arguments

lims
object of class "trsPre"
x
x-axis limits rule (either "same", "sliced", or "free" - see details)
y
y-axis limits rule (either "same", "sliced", or "free" - see details)
xQuant
lower and upper quantiles at which to cut off x-axis limits, in the case of outliers. Used when x="same".
yQuant
same as xQuant but for y-axis
xRangeQuant
a single upper quantile at which to cut off the x-axis range, used when x="sliced", used in the case of a few splits having abnormally high range, which are wished to be excluded
yRangeQuant
same as xRangeQuant but for y-axis
prop
the proportion of the axis range to pad beyond the actual axis range

Value

object of class "trsLims", which can be used in a call to makeDisplay

Details

This function reduces the list of axis limits computed for each split of a data set to an overall axis limit rule for the plot.

About "x" and "y" parameters: This is the same as in lattice. From lattice documentation: A character string that determines how axis limits are calculated for each panel. Possible values are "same" (default), "free" and "sliced". For relation="same", the same limits, usually large enough to encompass all the data, are used for all the panels. For relation="free", limits for each panel is determined by just the points in that panel. Behavior for relation="sliced" is similar, except that the length (max - min) of the scales are constrained to remain the same across panels.

See Also

prepanel, makeDisplay

Examples

Run this code
## Not run: 
# irisSplit <- datadr::divide(iris, "Species")
# irisPreFn <- function(x) {
#   list(
#     xlim = range(x$Sepal.Length),
#     ylim = range(x$Sepal.Width)
#   )
# }
# irisPre <- prepanel(irisSplit, prepanelFn = irisPreFn)
# irisLims <- setLims(irisPre, x = "same", y = "sliced")
# ## End(Not run)

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