strip.default
is the function that draws the strips by default
in Trellis plots. Users can write their own strip functions, but most
commonly this involves calling strip.default
with a slightly
different arguments. strip.custom
provides a convenient way to
obtain new strip functions that differ from strip.default
only
in the default values of certain arguments.
strip.default(which.given, which.panel, var.name, factor.levels, shingle.intervals, strip.names = c(FALSE, TRUE), strip.levels = c(TRUE, FALSE), sep = " : ", style = 1, horizontal = TRUE, bg = trellis.par.get("strip.background")$col[which.given], fg = trellis.par.get("strip.shingle")$col[which.given], par.strip.text = trellis.par.get("add.text"))
strip.custom(...)
which.packet
, which is a more accurate
name.
strip.names
and
style
(see below). By default, the names are shown for
shingles, but not for factors.
which.given
. Whether these levels are shown on the strip
depends on the values of strip.levels
and style
(see
below). factor.levels
may be specified for both factors and
shingles (despite the name), but by default they are shown only for
factors. If shown, the labels may optionally be abbreviated by
specifying suitable components in par.strip.text
(see
xyplot
)
levels(shingle)
). Otherwise, it should be NULL
This argument is ignored for a factor when style
is not one
of 1 and 3.
shingle.intervals
is
non-null. The best way to find out what effect the value of style
has
is to try them out. Here is a short description: for a style value
of 1, the strip is colored in the background color with the strip
text (as determined by other arguments) centered on it. A value of 3
is the same, except that a part of the strip is colored in the
foreground color, indicating the current level of the factor. For
styles 2 and 4, the part corresponding to the current level remains
colored in the foreground color, however, for style = 2, the
remaining part is not colored at all, whereas for 4, it is colored
with the background color. For both these, the names of all the
levels of the factor are placed on the strip from left to right.
Styles 5 and 6 produce the same effect (they are subtly different in
S, this implementation corresponds to 5), they are similar to style
1, except that the strip text is not centered, it is instead
positioned according to the current level.
Note that unlike S-PLUS, the default value of style
is 1.
strip.names
and strip.levels
have no effect if
style
is not 1 or 3.
horizontal=FALSE
is useful for strips on the
left of panels using strip.left=TRUE
col
, cex
, font
,
etc.
strip.default
, overriding
whatever value it would have normally assumed
strip.default
is called for its side-effect, which is to draw a
strip appropriate for multi-panel Trellis conditioning plots.
strip.custom
returns a function that is similar to
strip.default
, but with different defaults for the arguments
specified in the call.
style
argument --- non-default styles
are often more informative, especially when the names of the levels
of the factor x
are small. Traditional use is as
strip = function(...) strip.default(style=2,...)
, though
this can be simplified by the use of strip.custom
.
xyplot
, Lattice
## Traditional use
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = function(..., style) strip.default(..., style = 4))
## equivalent call using strip.custom
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = strip.custom(style = 4))
xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = FALSE,
strip.left = strip.custom(style = 4, horizontal = FALSE))
Run the code above in your browser using DataLab