quanttoolbox.viz¶
viz.export¶
quanttoolbox.viz.export
¶
Figure export convenience wrapper.
Ported from QuantToolBox/tools/save_graphic.m (+ save_graphic2.m).
QuantToolBox/export/*.m, the third-party MATLAB export_fig package,
is NOT ported -- matplotlib's native savefig already handles
resolution/format/tight-bbox export directly, with no equivalent gap to
fill.
Translation notes:
- The original saves up to 7 resolution/format variants (pdf at 3
resolutions, png at 3 resolutions, plus one via the third-party
export_fig) into a fixed
Figures/<variant>/directory tree. This is simplified to a single function that saves whichever formats/resolutions are requested into one output directory -- matplotlib'ssavefig(dpi=...)already parameterizes resolution directly, so there's no need for MATLAB's separate low/med/high-res code paths.
save_graphic(fig, name, output_dir='Figures', formats=('pdf', 'png'), resolutions=(600, 300, 150))
¶
Save a matplotlib figure in the given formats, each at the given
DPI resolutions, into output_dir/
Original: tools/save_graphic.m (+ save_graphic2.m)
Source code in src/quanttoolbox/viz/export.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |