Save all open Matplotlib figures
Project description
savefigs
The goal is to make it easy to save all open Matplotlib figures, with names that are useful.
Usage
Assume we have a script some_script.py
that creates multiple Matplotlib figures.
Import the savefigs
function:
from savefigs import savefigs
The below examples assume the figures do not have a label (fig.get_label()
, set using the num
argument to plt.figure()
).
If a figure does have a label, it will be used in place of fig{N}
.
Default save settings:
savefigs()
# ./some_script_fig1.png, ./some_script_fig2.png, ...
Specify directory:
savefigs(save_dir="figs") # must exist
# ./figs/some_script_fig1.png, ./figs/some_script_fig2.png, ...
Specify a prefix to the base stem format:
savefigs(stem_prefix="run1")
# ./run1_fig1.png, ./run1_fig2.png, ...
Save in multiple file formats:
savefigs(formats=["png", "pdf"])
# ./some_script_fig1.png, ./some_script_fig1.pdf, ...
Avoid overwriting files:
savefigs(clobber=False, clobber_method="add_num")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
savefigs-0.1.0.tar.gz
(3.1 kB
view hashes)