[Rd] Bug: persp and colors (PR#1476)

oliver.niggemann@acterna.com oliver.niggemann@acterna.com
Tue, 23 Apr 2002 09:41:42 +0200 (MET DST)

Full_Name: Oliver Niggemann
Version: Windows 1.4 patched
OS: Windows NT 4.0
Submission from: (NULL) (


I am working with the persp command. I want to change to color of the facets
to their z-value. The colors seems to be transposed, i.e. the color of a facet A
to be used for a facet B which is a (defined?) way off....

An example:

nx <- 21 
ny <- 21 
x <- seq(-1, 1, length = nx) 
y <- seq(-1, 1, length = ny)
z <- outer(x, y, function(x,y) x^2 + y^2) 
hgt <- z / max(z) 
persp(x, y, z, col = gray(1 - hgt), theta = 70, phi = 40, expand = 0.4)

Now the z-value should define the color, but the color pattern seems to be

    Oliver Niggemann


r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch