-
Notifications
You must be signed in to change notification settings - Fork 5
/
init_figure.m
45 lines (39 loc) · 1.6 KB
/
init_figure.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function hFig = init_figure(size)
%% prepare the figures (set some defaults)
% this method also helps to create/print figures running in headless mode
% to cicumvent a 6-7 year old Matlab bug on GNU/Linux multi-monitors, dock the figure (or else!)
% set(0,'DefaultFigureWindowStyle','docked')
% we will randomly offset the left and bottom positions
% so multiple figures do not overlap (why do I do this? related to linux bug mentioned above)
range = 2; % in inches
offset = range*(1 - 2*rand(2,1)); % in inches
left = 3 + offset(1);
bottom = 3 + offset(2);
if isempty(size)
width = 10;
height = 10;
else
width = size(1);
height = size(2);
end
% create the figure handle
% hFig = figure('name' , '', ...
% 'color' , 'white', ...
% 'NumberTitle', 'off', ...
% 'units' , 'inches', ...
% 'Position' , [left, bottom, width, height], ...
% 'WindowStyle', 'docked');
hFig = figure('name' , '', ...
'color' , 'white', ...
'NumberTitle', 'off', ...
'units' , 'inches', ...
'Visible' , 'off', ...
'Position' , [left, bottom, width, height]);
% hFig = figure('name' , '', ...
% 'color' , 'white', ...
% 'NumberTitle', 'off', ...
% 'units' , 'inches', ...
% 'Visible' , 'on', ...
% 'Position' , [left, bottom, width, height]);
% make sure figure is active window
% figure(hFig)