chplot {chplot} | R Documentation |
Plots 2D convex hulls or bivariate density contours, one for each group of data. Descriptive statistics are plotted as error bars or confidence ellipses within convex hulls. Marginal distributions as well as a special legend are added by default. Additionally, area of convex hull per point can be displayed.
chplot(formula,data,chull=TRUE,clevel=0.95,band.power=.2, mar.den=FALSE,descriptives="mean.sd",dlevel=0.68,bw=FALSE,ratio=.75, plot.points=FALSE,log="",xlab,ylab,col,lty,legend,...)
formula |
a formula describing the form of conditioning plot. The
formula is generally of the form y ~ x | g1 , indicating that
plots of y (on the y axis) versus x (on the x axis)
should be produced conditional on the variable g1 .
However, the conditioning variable g1 may be omitted.
The names of the y , x and g1 variables are used
for the axes and legend title.
|
data |
a data frame containing values for any variables in the formula. |
chull |
logical; if TRUE (default), convex hulls are plotted,
otherwise density contours are drawn.
|
clevel |
the confidence level for the density plot if
chull=FALSE (default is 0.95).
|
band.power |
applies if chull=FALSE ; bandwidth for bivariate density estimation
is calculated as (group size)^(-band.power) for each group
(default is 0.2).
|
mar.den |
logical; defines the nature of marginal distribution
plots. If FALSE (default), relative frequency polygons are
plotted, otherwise density plots are drawn.
|
descriptives |
the option to be used for depicting descriptive statistics. The default value
is mean.sd , which produces a cross with the lines intersecting at
the mean of x and y for each group and depicting the 68-percent tolerance interval
(i.e., stretching one standard deviation in each direction) with default dlevel setting.
Option mean.se does the same with standard errors of the means,
while median makes the lines one quartile long in each direction and
cross at the median. Option ellipse plots confidence ellipses.
|
dlevel |
the tolerance/confidence level applied if descriptives=mean.sd or
mean.sd .
|
bw |
logical; if TRUE , the plot is produced in black-and-white. The
default is FALSE , which plots in colour.
|
ratio |
the ratio of the main plot to the whole figure region. The default value is 0.75. If equal to 1, the marginal distributions are not plotted. If the ratio is less or equal to 0.75, the default legend position is outside the main plot (i.e., in the top right corner), otherwise it is within the main plot (i.e., to be selected by the user with mouse). |
plot.points |
logical; if true , the points are drawn in addition to the convex
hulls or density contours.
|
log |
the character strings "x" , "y" or "xy" makes a
specific (or both) axes logarithmic; the default, which does nothing, is "" .
|
xlab |
a title for the x axis in the main plot; the default is the name of the x variable. |
ylab |
a title for the y axis in the main plot; the default is the name of the y variable. |
col |
the plotting colors; vector of length equalling the number of groups. |
lty |
the type of line; vector of length equalling the number of groups. |
legend |
object of class legend.control specifying various parameters for the legend.
Default is legend.control(...) .
|
... |
other arguments will be passed to legend.control |
.
The relative frequency polygons chosen with mar.den=FALSE
connect the points in the middle of the intervals and the starting and
ending interval with zero frequency in each group. All the
frequencies are rescaled in order to make the plots immediately
comparable (the same is true for the density curves).
The default density contour might not fit into the plot - this can be
avoided by decreasing the clevel
. In such cases the
area does not provide a sensible measure.
A list with components:
usrc |
the limits of the central plotting region. |
usru |
the limits of the top left plotting region. |
usrr |
the limits of the bottom right plotting region. |
ratio |
the ratio used. |
is.xlog |
logical, denoting whether either log="x"
or log="xy" was used. |
is.ylog |
logical, denoting whether either log="y"
or log="xy" was used. |
Vidmar, G., and Pohar, M. Augmented convex hull plots: rationale, implementation in R and biomedical applications. Computer Methods and Programs in Biomedicine, 2005, in press.
chadd
, chull
, bkde2D
, legend.control
.
# the hdr dataset data(hdr) chplot(age~income|gender,data=hdr,log="x") # the iris dataset data(iris) chplot(Sepal.Length~Sepal.Width|Species,data=iris,bw=TRUE,legend=legend.control(cex=.6))