How to remove white lines when surf edgecolor is set to 'none' and figure is exported as a .pdf file using export_fig?
3 次查看(过去 30 天)
显示 更早的评论
I wish to properly plot and export a figure of a surface plotted using
surf
First, I wanted to remove the edges of its related mesh. To that end, I used
set(h,'edgecolor','none')
Then, I wanted to use a specific LaTeX-like font. To that end, I used
set(gca,'FontName','CMU Serif')
and, for instance,
ylabel('$$\varepsilon$$','Interpreter','latex')
Now, the figure as it is displayed on the screen is exactly as I want it to be:
But here comes the tricky part. I want to export the figure as a .pdf file, exactly as it is displayed on the screen. To that end, I tried to use export_fig:
export_fig filename -Transparent -pdf
but I keep getting these white lines on the edges:
Someone could help me getting rid of them, please?
0 个评论
采纳的回答
Jan
2018-4-24
编辑:Jan
2018-4-24
In this forum you find many questions concerning these white lines on PDF. Under some of them you find my answer, that this is not a problem of Matlab, but of the program, which displays the PDF. If it is Acrobat reader, open the Preferences and deselect "Smooth line art" and/or "smooth images".
It is an inherent problem: If two triangles with different colors are touching, it cannot be uniquely defined, how the pixels on the edge are drawn. The decision to apply an anti-aliasing, "smoothing", causes the edge to be a mixture of the color of the area and background of the paper. If both triangles use this, you see the white color of the background at the edge. Disabling the smoothing let this effect vanish. This is a problem of the definition of surfaces as 2D vector graphics in the PDF format.
Maybe it is better to use the OpenGL renderer and export this as a bitmap instead of vector graphics. See e.g. print -dpng. You can set a higher resolution there also e.g. by -r 600, if you are afraid for pixel artifacts in the output.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!