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

Description Usage Arguments Details Value See Also Examples

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

1
2
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

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.

Value

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

See Also

prepanel, makeDisplay

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## 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")

delta-rho/trelliscope documentation built on May 15, 2019, 3:21 a.m.