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에서 Orange에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!