Change the color of the surface (using the grill :: frame)

I use the :: wireframe grid to create a surface. I need to change the coloring so that it depends on the variable x or y (instead of z). How to do it? The documentation states that the color is automatically selected so that it depends on the height (for example, z).

Thanks! Georgi

+4
source share
1 answer

Use col.regions

wireframe(volcano, drape = TRUE,
       aspect = c(61/87, 0.4),
       light.source = c(10,0,10), 
       col.regions = colorRampPalette(c("blue", "pink"))(100))

enter image description here

According to your agreement and with the inspiration from @DWin, which I'm sure will work better here, perhaps with the help ?perspyou can get closer to what you want.

> persp(x, y, z, theta = 135, phi = 30, col = colorRampPalette(c("blue", "pink"))(9500), scale = FALSE,
+       ltheta = -120, shade = 0.75, border = NA, box = FALSE)

enter image description here

+3
source

All Articles