[Rd] graphics:persp - suggestion

Duncan Murdoch murdoch.duncan at gmail.com
Tue Oct 8 12:28:06 CEST 2013

On 13-10-08 1:48 AM, Christoph Häni wrote:
> Dear Devels,
> I'm not sure if I'm going the right way by mailing to this list. I have two
> suggestions regarding the persp function from the graphics package:
> 1. In the documentation of the persp function, it is said, that the "col"
> argument will ignore transparent colors. However, this is not true, if you
> use strings as color code - at least it works with HEX-code (eg. :
> col="#bf000022" would produce a red-colored surface with transparency = 22).

That may be an obsolete limitation.  I'll take a look...
> 2. It would be helpful if one could add a surface to an existing plot. I
> simply copied persp and deleted the "plot.new()" line, but I guess there
> are better ways...

That won't work in general.  persp() relies in the "painter's 
algorithm", in which objects at the back are drawn before objects in 
front of them.  If you put two surfaces into the same plot there will be 
no way to guarantee that.

If you want two surfaces in the same plot (or other things in a surface 
plot), you should probably use persp3d from the rgl package.

Duncan Murdoch

More information about the R-devel mailing list