Figures with large amounts of data don't export properly to .eps
26 views (last 30 days)
Show older comments
I am plotting velocity fields using imagesc. These fields have a large amount of data (in this example 200*50 points which is already small) and I like to plot multiple axes in the same figure (in this example 6, so 200*50*6=60000 points). I save these as .eps files to load them into a latex document for an academic publication. When I export to .eps, either from the menu->save as, or using the print command the figure is not exported correctly (pixels are distorted, colors are mixed). See example (note that this is a small part of the figure but shows the issue):
One solution is to reduce the number of data points (here I use every third data point in both directions, reducing the amount of points by a factor 9):
The colors are now proper and it is a true vector image, but way too coarse for me.
Another solution is saving as .png:
Which draws the colours quite accurately, but now the lines and labels are obviously not vectorized anymore. (Note that this example image is not that good, but the results in the real .png are proper.)
Comments:
- I am now using Matlab2017a, but had the problem before in 2015a.
- This does not seem to be related to the renderer. The problem exists with both opengl and painters.
- It is not an .eps viewer problem. I have tried multiple .eps viewers. I might add that I can see from the file size that at some point matlab stops exporting as vector.
- It is not just related to imagesc. I have the same problem (actually even worse) with three dimensional slice plots.
- The only solution I have found is to export the velocity map separately without lines/axes/labels/annotations as a .png, export the lines/axes etc. as .eps and combine the two later on in the latex file. But this seems very tedious to me, especially when drawing 3D plots consisting of multiple slices.
I hope someone can tell me:
A) Why does matlab do this?
B) Is there a way to control this (i.e. change the number of points for which matlab decides not to create a vector image)?
C) In absence of a solution, what is the best way to combine separately exported velocity fields and lines/axes/annotations?
Thanks, Tim
2 Comments
Jan
on 19 Sep 2017
Edited: Jan
on 19 Sep 2017
Please provide some data and code, such that the problem can be reproduced. Note that it is clear to you, what you consider as "pixels are distorted, colors are mixed". But the readers here see the posted graphics only and cannot guess, what you are expecting instead. So I ask for a clarification: What is the problem exactly and how can it be reproduced? How does the wanted output look like?
Accepted Answer
Tim Berk
on 20 Sep 2017
1 Comment
Glenn Bitar
on 15 Nov 2018
Thanks for providing a workaround. However, I'm not satisfied by not having an answer to this issue, so I reopened a new question with an equivalent problem, including an MWE: https://se.mathworks.com/matlabcentral/answers/429829-figures-with-large-amounts-of-data-don-t-export-properly-to-eps
There's no answer yet, but I hope it can be useful for anyone trying to debug it.
More Answers (2)
binod poudel
on 26 Feb 2020
I got into the same situation, doing from save as eps, I got distorted image and some more google search lead me to the solution as in this link below.
0 Comments
Luca Martinelli
on 18 May 2018
Same problem here. My workaround is to save the .fig files, than go to a different laptop with the 2015 version of matlab and produce the .epsc file (with the saveas command), that can be imported in Latex.
No success with Metafiles.
0 Comments
See Also
Categories
Find more on Orange in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!