-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfigexport.m
More file actions
53 lines (44 loc) · 1.3 KB
/
figexport.m
File metadata and controls
53 lines (44 loc) · 1.3 KB
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
45
46
47
48
49
50
51
52
53
function figexport(filename, size, plotscale, fontscale, linescale)
if(nargin < 2)
size = 1024;
end
if(nargin < 3)
plotscale = 3;
end
if(nargin < 4)
fontscale = plotscale/1.5;
end
if(nargin < 5)
linescale = plotscale/2.5;
end
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperUnits', 'inches');
pos = get(gcf, 'PaperPosition');
pos1 = pos*plotscale;
set(gcf, 'PaperPosition', pos1);
inches = pos1(3);
dpi = size/inches;
display(sprintf('width: %d', inches));
display(sprintf('DPI: %d', dpi));
htext = findall(gcf, '-property', 'FontSize');
hline = findall(gcf, '-property', 'LineWidth');
for i = 1:length(htext)
fontsize(i) = get(htext(i), 'FontSize');
set(htext(i), 'FontSize', fontsize(i)*fontscale);
end
for i = 1:length(hline)
linewidth(i) = get(hline(i), 'LineWidth');
set(hline(i), 'LineWidth', linewidth(i)*linescale);
end
drawnow;
print('-dpng', sprintf('-r%d', dpi), filename);
set(gcf, 'PaperPosition', pos);
display('fertig');
for i = 1:length(htext)
set(htext(i), 'FontSize', fontsize(i));
end
for i = 1:length(hline)
set(hline(i), 'LineWidth', linewidth(i));
end
drawnow;
end