How to remove white lines when surf edgecolor is set to 'none' and figure is exported as a .pdf file using export_fig?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Jan
am 24 Apr. 2018
Bearbeitet: Jan
am 24 Apr. 2018
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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Lighting, Transparency, and Shading finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!