-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadaptPaper.m
More file actions
40 lines (29 loc) · 996 Bytes
/
adaptPaper.m
File metadata and controls
40 lines (29 loc) · 996 Bytes
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
% function adaptPaper(setwidth)
function adaptPaper(setwidth, margin)
opt margin double 5;
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'Units', 'Centimeters');
pos = get(gcf, 'Position');
width = pos(3);
height = pos(4);
if nargin < 1 || isempty(setwidth)
%scale = 25/max(width, height);
scale = 1;
else
scale = setwidth/width;
end
width = width*scale;
height = height*scale;
left = width*margin/100;
bottom = height*margin/100;
paperwidth = width + 2*left;
paperheight = height + 2*bottom;
papersize = [paperwidth paperheight];
display(sprintf('Paper size: %1.1f x %1.1f', paperwidth, paperheight));
pos = [left bottom width height];
set(gcf, 'PaperSize', papersize);
set(gcf, 'PaperPosition', pos);
fontsize = 0.4*max(width, height);
%allfonts('Bookman', fontsize);
display(sprintf('Fontsize: %1.1f', fontsize));
end