[R] rgl package don't draw points with a color over points with another color

Duncan Murdoch murdoch.duncan at gmail.com
Tue Jul 27 23:35:59 CEST 2010


On 27/07/2010 3:20 PM, rrichte2 at fh-lausitz.de wrote:
>   I want to plot points with different colors to show different 
> selections of points in a 3d plot.
> 
> My problem is that if I plot a red point at a location where already a 
> blue point was plotted, than the point is still blue.
> Is there a parameter or so which can be used to draw over a existing point?

No.

The way rgl uses OpenGL, if an object exists at a particular distance, 
then it hides points drawn at an equal or greater distance.

If you want later points to win the test, change line 375 of 
src/scene.cpp from

   glDepthFunc(GL_LESS);

to

   glDepthFunc(GL_LEQUAL);

It might be that this should be the default, but rgl is getting to be an 
old package now, so I'm sure that would mess up someone's old code.  If 
you want to submit a patch to make it a par3d option (with the current 
behaviour as the default) I'd consider including it.

Duncan Murdoch

> 
> Example:
>  > require(rgl)
>  > open3d()
>  > plot3d(a<-c(1,2,3,4,5),a,a,type="l", col="blue")    # draw line
>  > plot3d(a<-c(1,2,3,4,5),a,a,type="p",col="blue",add=TRUE)    # mark 
> points at the line
>  > plot3d(a<-c(3),a,a,col="red",type="p",add=TRUE)    # mark a point 
> with another color
> 
> thanks
> roland
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list