In order to save MATLAB plots with minimal white space I have been using the code from this resource,with the code copied below.
ax = gca;outerpos = ax.OuterPosition;ti = ax.TightInset; left = outerpos(1) + ti(1);bottom = outerpos(2) + ti(2);ax_width = outerpos(3) - ti(1) - ti(3);ax_height = outerpos(4) - ti(2) - ti(4);ax.Position = [left bottom ax_width ax_height];
However, part of the figure is now cut off (the 0 on the axis bar). Is there a simple solution to this problem?
Edit: also there is still white space at the left and right edges. It is hard to see extra white space so I also attached the image. Of course I can remove this manually, but since I am processing many images it would be much faster to do it automatically.
Thanks!
Best Answer