Changing the surface coloring (using lattice::wireframe)

匿名 (未验证) 提交于 2019-12-03 08:46:08

问题:

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

回答1:

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))

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)



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!