How to remove white lines when surf edgecolor is set to 'none' and figure is exported as a .pdf file using export_fig?
5 ビュー (過去 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!