Mercurial > repos > public > sbplib
comparison savepng.m @ 307:fefb2f9884f7 feature/beams
Merge with default.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 23 Sep 2016 10:40:12 +0200 |
parents | b4ae78a1c2b9 |
children | 236744dda401 |
comparison
equal
deleted
inserted
replaced
306:8368beb0d1b3 | 307:fefb2f9884f7 |
---|---|
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 |