Mercurial > repos > public > sbplib
annotate savepng.m @ 1037:2d7ba44340d0 feature/burgers1d
Pass scheme specific parameters as cell array. This will enabale constructDiffOps to be more general. In addition, allow for schemes returning function handles as diffOps, which is currently how non-linear schemes such as Burgers1d are implemented.
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 18 Jan 2019 09:02:02 +0100 |
parents | 236744dda401 |
children |
rev | line source |
---|---|
281
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
1 % TODO |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
2 % Let print size in inches as input parameter |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
3 % Smaller boundingbox |
124 | 4 function savepng(h, filename, dpi) |
143
125c51e4dca8
Added function to set alla font sizes of a figure. Added default dpi to savepng.
Jonatan Werpers <jonatan@werpers.com>
parents:
124
diff
changeset
|
5 default_arg('dpi', 300) |
281
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
6 |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
7 handle_units = h.Units; % Save the current units to be able to restore |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
8 |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
9 % Copy size of figure in centimeters to a place where saveas will honor it |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
10 h.Units = 'centimeters'; |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
11 h.PaperUnits = 'centimeters'; |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
12 h.PaperPosition(3:4) = h.Position(3:4); |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
13 |
124 | 14 print(h,filename,'-dpng',sprintf('-r%d',dpi)); |
281
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
15 |
b4ae78a1c2b9
savepng: Added todo and fixed size bug.
Jonatan Werpers <jonatan@werpers.com>
parents:
143
diff
changeset
|
16 h.Units = handle_units; % Restore the old units |
124 | 17 end |