Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the surface coloring (using lattice::wireframe)

Tags:

r

lattice

I am using lattice::wireframe to create a surface. I need to change the coloring so that it depends on the x or y variable (instead of on z). How should this be done? The documentation says that the color is automatically chosen to depend on the height (e.g. z).

Thanks! Georgi

like image 442
user3000568 Avatar asked Nov 21 '13 22:11

user3000568


1 Answers

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

As per your coment and with inspiration from @DWin who I am sure will do a better job here, perhaps with ?persp you 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

like image 128
user1317221_G Avatar answered Sep 20 '22 23:09

user1317221_G