persp & colors
Timur Elzhov wrote:
Dear R experts!
I use image() & persp() functions for color plotting z(x,y)-type
graphics. In image() colors correspond to z-values, that's what
I want. OTOH, in persp() the col option means:
col: the color(s) of the surface facets. Transparent colours are
ignored. This is recycled to the (nx-1)(ny-1) facets.
but I'd like to persp()' colors behave like in image() function!
Could you help me to solve this problem?
Thank you very much.
--
WBR,
Timur.
That's not easy, because you have to redefine x, y and z values. Simple example: x <- y <- 1:2 z <- matrix(1:4, 2) image(x, y, z) # OK, quite nice but persp(x, y, z) has only one facet. So the only way is to calculate the 9 values for x, y, and z to get the corners for the 4 facets in it. That's easy for x and y, but can be impossible for z... Uwe Ligges