Figures with large amounts of data don't export properly to .eps
32 次查看(过去 30 天)
显示 更早的评论
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):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167301/image.png)
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):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167303/image.png)
The colors are now proper and it is a true vector image, but way too coarse for me.
Another solution is saving as .png:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/167304/image.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 个评论
Jan
2017-9-19
编辑:Jan
2017-9-19
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?
采纳的回答
Tim Berk
2017-9-20
1 个评论
Glenn Bitar
2018-11-15
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.
更多回答(2 个)
binod poudel
2020-2-26
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 个评论
Luca Martinelli
2018-5-18
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Printing and Saving 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!