coplot {base} | R Documentation |
Conditioning Plots
Description
This function produces two variants of the conditioning plots discussed in the reference below.
Usage
coplot(formula, data, given.values, panel = points, rows, columns,
show.given = TRUE, col = par("fg"), pch = par("pch"),
xlab = c(x.name, paste("Given :", a.name)),
ylab = c(y.name, paste("Given :", b.name)),
subscripts = FALSE,
number = 6, overlap = 0.5, ...)
co.intervals(x, number = 6, overlap = 0.5)
Arguments
formula |
a formula describing the form of conditioning plot. A
formula of the form
|
data |
a data frame containing values for any variables in the
formula. By default the environment where |
given.values |
a value or list of two values which determine how
the conditioning on When there is no |
panel |
a |
rows |
the panels of the plot are laid out in a |
columns |
the number of columns in the panel layout array. |
show.given |
logical (possibly of length 2 for 2 conditioning
variables): should conditioning plots be shown for the
corresponding conditioning variables (default |
.
col |
a vector of colors to be used to plot the points. If too short, the values are recycled. |
pch |
a vector of plotting symbols or characters. If too short, the values are recycled. |
xlab |
character; labels to use for the x axis and the first conditioning variable. If only one label is given, it is used for the x axis and the default label is used for the conditioning variable. |
ylab |
character; labels to use for the y axis and any second conditioning variable. |
subscripts |
logical: if true the panel function is given an additional
(third) argument |
number |
integer; the number of conditioning intervals, possibly of length 2 for x and y direction. |
overlap |
numeric < 1; the fraction of overlap of the conditioning variables, possibly of length 2 for x and y direction. When overlap < 0, there will be gaps between the data slices. |
... |
additional arguments to the panel function. |
Details
In the case of a single conditioning variable a
, when both rows
and columns
are unspecified, a “close to square” layout is
chosen with columns >= rows
.
In the case of multiple rows
, the order of the panel
plots is from the bottom and from the left (corresponding to
increasing a
, typically).
Value
co.intervals(., number, .)
returns a (number
\times
2) matrix
, say ci
, where ci[k,]
is
the range
of x
values for the k
-th interval.
References
Cleveland, W. S. (1993) Visualizing Data. New Jersey: Summit Press.
See Also
pairs
,
panel.smooth
,
points
.
Examples
## Tonga Trench Earthquakes
data(quakes)
coplot(long ~ lat | depth, data = quakes)
given.depth <- co.intervals(quakes$depth, number=4, overlap=.1)
coplot(long ~ lat | depth, data = quakes, given.v=given.depth, rows=1)
## Conditioning on 2 variables:
ll.dm <- long ~ lat | depth * mag
coplot(ll.dm, data = quakes)
coplot(ll.dm, data = quakes, number=c(4,7), show.given = c(T,F))
coplot(ll.dm, data = quakes, number=c(3,7),
overlap=c(-.5,.1)) # negative overlap DROPS values
data(warpbreaks)
## given two factors
coplot(breaks ~ 1:54 | wool * tension, data = warpbreaks, col = 'red')
## Example with empty panels:
data(state)
attach(data.frame(state.x77))#> don't need `data' arg. below
coplot(Life.Exp ~ Income | Illiteracy * state.region, number = 3,
panel = function(x, y, ...) panel.smooth(x, y, span = .8, ...))
detach() # data.frame(state.x77)