comparison savepng.m @ 282:18c023aaf3f7 v0.1

Merge.
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 12 Sep 2016 11:14:00 +0200
parents b4ae78a1c2b9
children 236744dda401
comparison
equal deleted inserted replaced
270:d755816aa0fa 282:18c023aaf3f7
1 % TODO
2 % Let print size in inches as input parameter
3 % Smaller boundingbox
1 function savepng(h, filename, dpi) 4 function savepng(h, filename, dpi)
2 default_arg('dpi', 300) 5 default_arg('dpi', 300)
6
7 handle_units = h.Units; % Save the current units to be able to restore
8
9 % Copy size of figure in centimeters to a place where saveas will honor it
10 h.Units = 'centimeters';
11 h.PaperUnits = 'centimeters';
12 h.PaperPosition(3:4) = h.Position(3:4);
13
14 % Save as a bugged eps file.
3 print(h,filename,'-dpng',sprintf('-r%d',dpi)); 15 print(h,filename,'-dpng',sprintf('-r%d',dpi));
4 % Let print size in inches as input parameter 16
5 % Smaller boundingbox 17 h.Units = handle_units; % Restore the old units
18
19
20
6 end 21 end