library (rsm)
heli.rsm <- rsm (ave ~ block + SO(x1, x2, x3, x4), data = heli)
# Plain contour plots
par (mfrow = c (2,3))
contour (heli.rsm, ~x1+x2+x3+x4, at = xs(heli.rsm))
# Same but with image overlay, slices at origin and block 2,
# and no slice labeling
contour (heli.rsm, ~x1+x2+x3+x4, at = list(block="2"),
atpos = 0, image = TRUE)
# Default perspective views
persp (heli.rsm, ~x1+x2+x3+x4, at = xs(heli.rsm))
# Same plots, souped-up with facet coloring and axis labeling
persp (heli.rsm, ~x1+x2+x3+x4, at = xs(heli.rsm),
contours = "col", col = rainbow(40), zlab = "Flight time",
xlabs = c("Wing area", "Wing length", "Body width", "Body length"))
### Hints for creating graphics files for use in publications...
# Save perspective plots in one PDF file (will be six pages long)
pdf(file = "heli-plots.pdf")
persp (heli.rsm, ~x1+x2+x3+x4, at = xs(heli.rsm))
dev.off()
# Save perspective plots in six separate PNG files
png.hook = list(
pre.plot = function(lab)
png(file = paste(lab[3], lab[4], ".png", sep = "")),
post.plot = function(lab)
dev.off())
persp (heli.rsm, ~x1+x2+x3+x4, at = xs(heli.rsm), hook = png.hook)
Run the code above in your browser using DataLab