0
votes

I have tried most of the usually used options (print(figr, '-depsc', 'cross_corr.eps');) to save a matlab figure as eps/pdf but each time I do it, the figure contents are saved partially and perhaps one quarter of it is lost. I have shared the figure here: http://ge.tt/2ZrsdD02/v/0?c

Using the options such as the following save it completely but I prefer it save it directly inti eps/pdf:

print(figr, '-dpng', 'cross_corr.png'); 
2
Exactly what gets lost? I'm unable to replicate. Anyway, a couple of things you could try: set(gcf,'PaperPositionMode','auto') prior to printing. On the matlab file exchange, there's a function called export_fig that I've had good luck with in terms of preserving figure contents, you may find it useful as well. - KevinMc
Unfortunately, that didn't help much.please see my 'answer' to know what exactly is lost. - Martin

2 Answers

1
votes

The problem seems to be that you have very small values in the 'PaperPosition' property of the figure. Try changing them to the default ones,

set(figr, 'PaperPosition', [0.634517 6.34517 20.3046 15.2284])

and then apply your print(figr, '-depsc', 'cross_corr.eps').

I attach results on my computer without and with 'PaperPosition' correction (using GSview with bounding box showed):

enter image description here

enter image description here

Also, consider reducing font size to avoid overlapped text:

set(findobj('type','text'), 'Fontsize', 5)

enter image description here

0
votes

If I first enlarge the figure size (by using the middle button on the top right), and then save it as eps, I get this: http://ge.tt/1Pv8YE02/v/0

The quality is very nice as compared to all other options and the content are also ok.

Its not possible to automate it through script?...