Here is the answer Dave W. posted a few years ago on the R-help mailing list. You can probably enable the whole stream in google.
From: David Winsemius Following the wirefrane help tips, you need to look at the levelplot for advice re: the correct specification for colorkey
and follow the relevant links on the help pages. Be your data
is the correct entry into the framework; it cannot be determined from the information included, although, I believe, your stated success indicates that this is so.
This has not been verified (since there was nothing to test) after reading the material I pointed out:
wireframe(data.m,aspect = c(0.3), shade=TRUE, screen = list(z = 0, x = -45), light.source = c(0,0,10), distance = 0.2,zlab="Freq",xlab="base",ylab="Fragment", col=level.colors(x, at = do.breaks(range(data.m), 30), col.regions = colorRampPalette(c("red", "white", "blue")(30)) )
EDIT: At Josh's request, I played a little. Below will be applied color scheme (drapery):
wireframe(dmat,drape=TRUE,col='black',col.regions = colorRampPalette(c("red", "white", "blue"))(30) )
Which sets the drape colors, but not the grids themselves. It's embarrassing that wireframe does not respect par(new=TRUE) , because if that were the case, we could cut the data matrix into z-ranges and remodel one color at a time.
I will have to check my "archive" of old experiments with R / R graphics when I get home, but I think that in the end I used the scatterplot3d package to get the grid colors depending on the data.