MATLAB Answers

Save figure in Matlab without borders

304 views (last 30 days)
Davide
Davide on 19 Nov 2015
Answered: thomas weldon on 21 Jun 2018
I am experiencing several troubles in exporting figures in matlab. Typically I save figures in eps format and then I try to convert them in pdf using eps2pdf. The results is a figure with a huge white border around. How can I remove it and get a proper figure? I tried with
set(gca,'LooseInset',get(gca,'TightInset'));
with commands:
export_fig
print
Without any success. Unfortunately if I try
system('pdfcrop .... ')
does not work in mac, it returns the error
>> system('pdfcrop')
/bin/bash: pdfcrop: command not found
Nevertheless pdfcrop is installed because if I launch it from the terminal it works fine and the removes the borders correctly.

  0 Comments

Sign in to comment.

Accepted Answer

James Tursa
James Tursa on 19 Nov 2015
You might take a look at this FEX submission by Yair Altman:

  1 Comment

Davide
Davide on 20 Nov 2015
Thanks, the output now is much better. Using
export_fig([name_fig,'.pdf'], '-pdf','-transparent');
I get a very nice figure.

Sign in to comment.

More Answers (1)

thomas weldon
thomas weldon on 21 Jun 2018
Try this: fig=gcf;ax=fig.CurrentAxes;fig.Color='w';fig.OuterPosition=fig.InnerPosition;

  0 Comments

Sign in to comment.


Translated by