-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenhanceFigure.m
17 lines (17 loc) · 1.05 KB
/
enhanceFigure.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function enhanceFigure( figure_handle )
%ENHANCEFIGURE will maximize the figure to full screen, tighten the plot
%(or subplots), and re-maximize the screen again for saving the figure
% The purpose is to provide an automated way of saving large figures
% This uses the TIGHTFIG function created by Richard Crozier, which you
% can find using this link:
% {http://www.mathworks.com/matlabcentral/fileexchange/34055-tightfig}
warning off MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame
jFrame = get(handle(figure_handle),'JavaFrame'); % using Javaframe to maximize figure
pause(10) % wait 10 seconds so JavaScript function has ample time to execute
jFrame.setMaximized(true); % to maximize the figure
pause(10) % wait 10 seconds so JavaScript function has ample time to execute
tightfig; % to tighten the margins around the figure
pause(10) % wait 10 seconds so tightfig function has ample time to execute
jFrame.setMaximized(true); % to re-maximize the figure
pause(10) % wait 10 seconds so JavaScript function has ample time to execute
end