matlib icon indicating copy to clipboard operation
matlib copied to clipboard

transparency and rgl parameters in 3D plots (plotEqn3d)

Open friendly opened this issue 5 years ago • 2 comments

In conjunction with a problem with ugly rendering of 2D ellipses in 3D heplots, Duncan Murdock suggested a solution using a new (to me) rgl property: mask_depth

https://stackoverflow.com/questions/64486375/rgl-how-to-avoid-moire-effect-in-transparent-3d-ellipsoids/64490059

In plotEqn3d, we use alpha=1 by default, so this problem doesn't arise, yet the result of showing regression planes is not very insightful. One can only see the non-occluded portions of the planes.

I've implemented Duncan's suggestion in plotEqn3d() on github, and tested it under different values of alpha. My question is: Should I change the default from alpha=1 to something alpha<1 ? Your thoughts?
[This also affects regec3d where the default results are often uglier]

Extending the example:

> # three consistent equations in three unknowns
> A <- matrix(c(13, -4, 2, -4, 11, -2, 2, -2, 8), 3,3)
> b <- c(1,2,4)
> plotEqn3d(A,b)
> plotEqn(A, b, alpha=0.5)
> plotEqn(A, b, alpha=0.8)

The differences among these are best seen in plots you can rotate. In static views, I get:

alpha=1 plotEqn3d-opaque alpha=0.5 plotEqn3d-trans-5 alpha=0.8 plotEqn3d-trans-8

friendly avatar Oct 27 '20 20:10 friendly

I made the default alpha=0.9. Let me know what you think.

friendly avatar Oct 28 '20 13:10 friendly

I like alpha=0.9, especially for ellipsoids. It makes them look like big translucent balloons which, I imagine, enhances the sense of verisimilitude and makes the viewer's 3d cognitive apparatus more likely to get fully activated. Of course, I have no idea what I'm talking about ... but you might!

gmonette avatar Oct 28 '20 16:10 gmonette