surf() plots weird black lines

4 次查看(过去 30 天)
Hi,
the surface plot contains weird lines that connect edges of the surface. For example the following code:
x = -3:0.1:3;
y = -3:0.1:3;
[xx,yy] = meshgrid(x,y);
zz = xx.^2 - yy.^2;
surf(xx,yy,zz);
plots this:
surprisingly when I File->Save As, those lines are gone from the output image file.
I'm using version: 8.2.0.701 (R2013b) Is this a bug? There appears to be a similar question here: http://www.mathworks.com/matlabcentral/answers/52846-surf-command-gives-false-lines
I know I can disable lines with: 'EdgeColor', none. But I want the grid because it helps me visualize.

采纳的回答

Sean de Wolski
Sean de Wolski 2014-7-23
编辑:Sean de Wolski 2014-7-23
Most likely opengl and when you print it implicitly changes the renderer to painters. You can do this explicitly by running:
set(gcf,'Renderer','painters')
You could also try using the software version of opengl:
opengl software
  1 个评论
Jason
Jason 2014-12-19
编辑:Jason 2014-12-19
Awesome. This was driving me crazy as well. Thanks!
As an FYI 'painters' really slows down the rendering 'zbuffer' seems to work as well and provides faster processing.

请先登录,再进行评论。

更多回答(2 个)

Joseph Cheng
Joseph Cheng 2014-7-23
If you rotate the surf image does the lines disappear? I was able to run what you have in the same 8.2.0.701 (R2013b) (64 bit) and i don't have those lines.
if you check out this thread http://www.mathworks.com/matlabcentral/answers/52943-mesh-or-surf-display-problem-on-windows-7 it does sound like it may be your graphics drivers or openGL.

Donald K
Donald K 2014-7-23
The lines remain when you rotate the figure.
Changing OpenGL to software mode does "fix" the issue. Although I have fairly recent NVIDIA drivers - 335.23 - and I don't get these issues with any of the OpenGL code I write. I still think it's a Matlab bug, but at least I have a workaround.
Thank you.
  1 个评论
Sean de Wolski
Sean de Wolski 2014-7-23
The fact that opengl software fixes it points to this not being a MATLAB bug but being a bug in the drivers.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by