Perspective scatter problem3 in MATLAB R2011b

I see a promising problem with three-dimensional scatterplots: some points are drawn above the points that should be in front of them in the current projection. Example with a discretized cylinder:

[r, phi, h] = meshgrid(1, 0:pi/10:2*pi, 0:0.05:1); x = r.*cos(phi); y = r.*sin(phi); z = h; xyz = [x(:) y(:) z(:)]; scatter3(xyz(:,1), xyz(:,2), xyz(:,3), 50, xyz(:,3), 'filled') view(-37, 28) 

Notice that some of the blue dots on the back are drawn above the red dots on the front. There is no problem in exporting a PNG image, so it makes no sense to provide an image.

So why is this happening? Does it depend on the order of points in the vectors x, y, z? Has it been fixed in new versions?

+4
source share
1 answer

This is a bug with the default painters renderer. This is not fixed in 2012b, I have not downloaded 2013a yet.

You can change the rendering of shapes to zbuffer or opengl to fix:

 set(gcf,'renderer','zbuffer'); set(gcf,'renderer','opengl'); 
+2
source

Source: https://habr.com/ru/post/1489471/


All Articles