Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you remove the intersection curve between two translucent surfaces

Tags:

plot

matlab

I am plotting two surfaces using surf and the FaceAlpha parameter. When FaceAlpha is less than 1, the surfaces are translucent and the curve of intersection shows up in white. Why does this happen, and how do you remove it?

enter image description here

Code to reproduce in 2015b:

x = linspace(0, 1, 21);
y = linspace(0, 1, 21);
[x, y] = meshgrid(x, y);
z1 = x;
z2 = y;
hold off
surf(x, y, z1, 'FaceAlpha', 0.2)
hold on
surf(x, y, z2, 'FaceAlpha', 0.2)

Contrast this with:

hold off
surf(x, y, z1)
hold on
surf(x, y, z2)
like image 832
Alex Avatar asked Feb 05 '26 00:02

Alex


1 Answers

This seems to be a problem with OpenGL. Change the renderer to painters and the white line disappears:

set(gcf, 'Renderer', 'painters')

(tested on Mac OS 10.11.1 and MATLAB 2015b)

like image 112
zeeMonkeez Avatar answered Feb 06 '26 18:02

zeeMonkeez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!