Export
Output formats
cvs.save(path)
Write the figure to path; the format follows the extension. Figure,
DemandDiagram and EdgeworthBox have the same method.
- PNG: raster, at the canvas
dpi(default 300). - PDF, SVG: vector output that stays sharp when printed or scaled.
- TeX: TikZ code (
.tex) for inclusion in LaTeX documents; adjust it with the keyword argumentstikz_scaleandtikz_standalone.
# PNG with canvas DPI default 300
cvs.save("figure.png")
# PDF vector
cvs.save("figure.pdf")
# SVG vector
cvs.save("figure.svg")
# TikZ
cvs.save("figure.tex")
The dpi parameter of Canvas only affects raster output; lower it for
faster previews:
Animated GIFs
Export a GIF with Animator.save(); Animation has complete examples.
from utility_viz.core.animation import Animator
Animator(draw_frame, frames=frames).save(
"animation.gif", fps=12, dpi=120
)
Interactive window
cvs.show() opens a live matplotlib window instead of saving. In
the CLI, omitting --output has the same effect (Plotting):