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=canonical(heli.rsm)$xs)
# 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=canonical(heli.rsm)$xs)
# Same plots, souped-up with facet coloring and axis labeling
persp (heli.rsm, ~x1+x2+x3+x4, contours="col", col=rainbow(40), at=canonical(heli.rsm)$xs,
xlabs = c("Wing area", "Wing length", "Body width", "Body length"), zlab = "Flight time")
### 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=canonical(heli.rsm)$xs)
dev.off()
# Save perspective plots in six separate PNG files
png.hook = list()
png.hook$pre.plot = function(lab)
png(file = paste(lab[3], lab[4], ".png", sep = ""))
png.hook$post.plot = function(lab)
dev.off()
persp (heli.rsm, ~x1+x2+x3+x4, at=canonical(heli.rsm)$xs, hook = png.hook)
Run the code above in your browser using DataLab