contourPlot {EdSurvey} | R Documentation |
Overlaid Scatter and Contour Plots
Description
Diagnostic plots for regressions can become too dense to interpret. This function helps by adding a contour plot over the points to allow the density of points to be seen, even when an area is entirely covered in points.
Usage
contourPlot(
x,
y,
m = 30L,
xrange,
yrange,
xkernel,
ykernel,
nlevels = 9L,
densityColors = heat.colors(nlevels),
pointColors = "gray",
...
)
Arguments
x |
numeric vector of the |
y |
numeric vector of the |
m |
integer value of the number of |
xrange |
numeric vector of length two indicating |
yrange |
numeric vector of length two indicating |
xkernel |
numeric indicating the standard deviation of Normal
|
ykernel |
numeric indicating the standard deviation of Normal
|
nlevels |
integer with the number of levels of the contour plot |
densityColors |
colors to use, specified as in |
pointColors |
color for the plot points |
... |
additional arguments to be passed to a plot call that generates the scatter plot and the contour plot |
Author(s)
Yuqi Liao and Paul Bailey
Examples
## Not run:
sdf <- readNAEP(path=system.file("extdata/data", "M36NT2PM.dat", package = "NAEPprimer"))
lm1 <- lm.sdf(formula=composite ~ pared * dsex + sdracem, data=sdf)
# plot the results
contourPlot(x=lm1$fitted.values,
y=lm1$residuals[,1], # use only the first plausible value
m=30,
xlab="fitted values",
ylab="residuals",
main="Figure 1")
# add a line indicating where the residual is zero
abline(0,0)
## End(Not run)