Generate Strip Labels
USAGE:
strip.default(which.given, which.panel, var.name,
factor.levels, shingle.intervals,
par.strip.text = trellis.par.get("add.text"),
strip.names = c(F, T), style = 3, strip.var.names = NULL)
ARGUMENTS:
- which.given
-
integer that tells which of the variables the current strip label
corresponds to.
- which.panel
-
integer vector that tells the levels of each of the given variables.
which.panel[which.given]
is the level of the current factor or shingle.
- var.name
-
character vector giving the names of all of the given variables.
var.name[which.given]
is the name of the current variable.
- factor.levels
-
if variable for this strip label is a factor, this argument gives the
character string of all of the levels; otherwise it is NULL.
The current level of the current factor is
factor.levels[which.panel[which.given]]
.
- shingle.intervals
-
if variable for this strip label is a shingle, this argument gives the
matrix of intervals; otherwise it is NULL.
The current interval of the current shingle is
shingle.intervals[which.panel[which.given],]
.
The intervals have been scaled to range from 0 to 1.
- par.strip.text
-
a list giving graphical parameters that should be in effect
when the text is drawn in the strip labels.
- strip.names
-
logical vector of length 2 (for factors and shingles, respectively)
that tells whether the variable name should
be put in the strip label.
The first element indicates whether the names of factors should be included in strip labels along with the names of factor levels. The second element indicates whether the names of shingles should be included.
- style
-
a numeric variable that tells which style should be used for strip
labels corresponding to factors.
For particular situations (e.g. factors where the names of all of
the levels can be plotted in a strip label),
some of the less-common styles may be very effective.
Current styles include:
1 = the full strip label is colored in background color and the text
string for the current factor level is centered in it;
2 = all the factor levels are spread across the strip with the current
level is drawn atop a colored rectangle;
3 = identical to style 1 but a portion of the strip is highlighted (as in
a shingle) to indicate the position of the current level;
4 = like 2 except the entire strip label is colored in background color.
5 = like 1 but the current factor level is positioned left-to-right
across the strip;
6 = like 5 but the string adjustment varies
from left-justified to right-justified as the string moves left-to-right.
The strip function is called once for each strip label on each panel.
When it is called, both the x- and y-coordinates are set up from 0 to 1.
If you are bold enough, you can modify
strip.default
to add your own styles
or you can write your own strip function.
- strip.var.names
-
a character vector containing strings to use for labeling strips, instead of
using the default variable names. The length of
strip.var.names
should equal the length of
var.name
, and the order of
the strings in
strip.var.names
should correspond to
the variable names in
var.name
.
The first element of the
strip.names
must be TRUE, for
example
strip.names=c(T,T)
.
EXAMPLES:
# use a non-standard strip style for factors
xyplot(..., strip = function(...) strip.default(..., style = 2))
# create a boxplot using strip.default
bwplot(age ~ log(1 + usage) | income * pick, strip = function(...)
strip.default(..., strip.names = c(T, T), strip.var.names = c("Income Level",
"Long Distance Phone Service")), skip = c(F, F, F, F, F, F, F, T),
layout = c(2, 4, 2), data = market.survey)