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.)
- 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?
In case anyone is ever interested here is how I solved it (a workaround really):
im1 = imagesc(...); im1.Visible = 'off';
c1 = contour(...); c1.Visible = 'off'; cb = colorbar; cb.Visible = 'off'; ax1 = axes(...); ax1.Box = 'off'; ax1.XAxis.Color = 'none'; ax1.YAxis.Color = 'none'; ... etc
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.