Learn R Programming

agsemisc (version 1.2-1)

panel.xy: Flexible panel.xyplot replacement

Description

panel.xy is used like panel.xyplot but offers more features. In particular, it can add an lqs resistant regression line besides a normal one, can plot a prediction interval around the standard regression line, can add text indicating correlation and number of data points, and automatically uses different colors and line styles.

Usage

panel.xy(x, y, type = "p,r,r.pred,r=,N=,grid",
         r.min = 0.5, level = 0.8, unicolor = FALSE, ...)

Arguments

x
Vector of x coordindates for the plot.
y
Vector of x coordindates for the plot. Pairs (x,y) containing NAs will be filtered out.
type
A character vector (or single comma-separated string) of options to use for plotting. Entries "p", "l", "b", "o", "h", "s", "S" are handled just as plot or
r.min
Even if type "r" is requested, the regression line will appear only if abs(cor(x,y) >= r.min).
level
The confidence level of the intervals plotted by type "r.conf" and type "r.pred".
unicolor
The colors used for the lines drawn by types "r", "r.pred", "r.conf", "loess" are normally taken from trellis.par.get("regression.line") (as introduced by a.resetplotparams). However, if you use x
...
Further parameters as needed for instance by panel.loess and lqs.

Details

The types "p", "l", "b", "o", "h", "s", "S" are in fact processed by panel.xyplot. Specifying col, lty, lwd will not work, as there are calls that include both ... and some of these.

See Also

a.resetplotparams, trellis.par.get, panel.xyplot, panel.superpose, panel.loess, lm, lqs.

Examples

Run this code
# set  grid.prompt(TRUE)  to see each plot separately (click graphics window)
data(iris)
a.resetplotparams()
print(xyplot(Sepal.Width ~ Sepal.Length|Species, data=iris,
             panel=panel.xy, type="p,grid,v,lqs,r.pred,loess"))
print(xyplot(Sepal.Width ~ Sepal.Length, data=iris, groups=Species,
             panel=panel.superpose, panel.groups=panel.xy,
             type=c("p","grid","v","loess"), unicolor=TRUE))

Run the code above in your browser using DataLab