Bug eps, pdf matlab 2014b surface plot (contourf)

1 vue (au cours des 30 derniers jours)
Loïc Houpert
Loïc Houpert le 4 Juin 2015
Commenté : Ilja Maljutenko le 11 Juil 2016
Hi all, with matlabR2014b I got very bad quality eps and pdf files for surface plots.
)
But using the same script with MatlabR2014b I got very bad quality figures (white lines, bad dot size using plot3D, and very large size for the file: the eps from R2014b is 40x larger than the eps from R2014a!): http://lhoupert.fr/files/others/matlab/bugfig2014b/figR2014b.eps and http://lhoupert.fr/files/others/matlab/bugfig2014b/figR2014b.pdf <http://lhoupert.fr/files/others/matlab/bugfig2014b/figR2014b.pdf>
Do you know if this bug is fixed / will be fixed in the more recent versions of Matlab (>=R2015a)?

Réponse acceptée

Steve Eddins
Steve Eddins le 9 Sep 2015
Hi Loïc,
Prior to R2014b, the MATLAB graphics system used a different process, with a different set of vector primitives, for exporting to vector formats such as EPS and PDF. Unfortunately, these primitives could not always render every aspect of a MATLAB figure correctly. Also, other software, such as printer drivers, often had bugs in rendering these primitives. As a result, there were many reports of incorrect exported plots in earlier versions of MATLAB.
To solve these problems, the MATLAB graphics team revised the rendering pipeline to obtain more direct control over the vector output. The primary method was to use many small triangles. This procedure corrected earlier problems but had two undesirable effects:
  • It increased the output file size.
  • It caused white lines to appear when viewing the PDF or EPS files on screen. (The white lines do not affect printed output.)
The file size increased directly as a result of the increased number of primitives (small triangles).
The white lines are caused by bugs in widely-used PDF and EPS viewers. The antialiasing method in these viewers does not handle correctly the case where two same-color polygons share a common edge. The white lines are appearing at these common edges.
Compensating for bugs in external viewers has proved challenging, but MATLAB R2015a has improved the situation somewhat by grouping triangle strips together. A graphics developer who looked at your plots thinks that you will see improvement in the visual quality and file size with R2015a, although the problems might not be solved completely.
  1 commentaire
Ilja Maljutenko
Ilja Maljutenko le 11 Juil 2016
If one wants his graphics to consist of numerous primitive elements, one chooses raster format and adjusts resolution. The purpose of vector graphics is different.
  • Increase in output file size is inevitable, since same characteristics are saved for each so called primitive. For even plot(0:0.01:pi,sin(0:0.01:pi));print(gcf,'-depsc','-painters','sin_test.eps') line is saved into 7 different line segments. I have no idea why is that necessary.
  • Pseudo lines is just empty space between artificially sliced patches. They are there with reason and no antializing should make it look prettier.
With those new features matlab vector graphics have made postprocssing nearly impossible and hardly publishable in science journals.

Connectez-vous pour commenter.

Plus de réponses (3)

Loïc Houpert
Loïc Houpert le 4 Juin 2015
All the files are in a vectorial format. Before printing the figure, I do: set(gcf, 'renderer','painters'). And I launch exactly the same script with the 2 Matlab versions.
If the pdf or eps files are opened with a software like Inkscape, you can see that is vector format.
It's seems that in MatlabR2014b, the contourf surface is composed of small triangle, like with the surf function. But in MatlabR2014a, the contourf surfaces were unique vector ''objects''
PS: I am using the unix Version of Matlab

Loïc Houpert
Loïc Houpert le 15 Juin 2016
Are you planning to add a possibility in the new release of matlab to go back in the graphical function prior R2014b? It's a shame to not be able to export nice vectorial plots since R2014b. I just re-used Matlab R2008 to do a figure for a scientific paper even if I have R2014b and R2016a on my computer.....
  1 commentaire
Walter Roberson
Walter Roberson le 15 Juin 2016
Only Mathworks Sales is authorized to speak about product plans.

Connectez-vous pour commenter.


Jan
Jan le 4 Juin 2015
I guess that the renderer is set to OpenGL automatically, such that the created EPS/PDF contains pixels graphics instead of the smarter and sarper vector format. Please try to set the renderer to Painters manually.

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by