Maintain a PDF-file with Matplotlib figures as pages.
Project description
matplotlib_pdf
matplotlib_pdf
can maintain a PDF-file with Matplotlib figures as pages.
The container is initialized with a Path to a destination for putting the PDF-file with the figures.
container.add_figure_page()
is called to add current figure to PDF.
Example
# Make a container
container = PDFFigureContainer(Path(output_dir, "container.pdf"))
#
# Make a figure
#
# Add figure to pdf
container.add_figure_page()
Additional Control
Additional options and uses are:
- The container can buffer many pages by calling
container.add_figure_page(commit=False)
, and them comiting them all to the file usingcontainer.update_file()
(to avoid constantly updating the file). - You can specify figure with
add_figure_page(figure=fig)
.
Experimental
- By running
container.set_timestamp()
before adding pages to a container, the container will add a time-stamp to each page, allowing reader to see what each page has last been updated (check documentation of method for options toset_timestamp()
). - By running
container.set_enumeration()
before adding pages to a container, the container will add an enumeration to the pages (ex.2 / 3
) (check documentation of method for options toset_enumeration()
).
Test-script
Running the __main__.py
-script will make three figures and pass them all to a PDF-file. It then overwrites the second
page with a different figure. The end result is something like:
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
matplotlib_pdf-0.1.1.tar.gz
(7.8 kB
view details)
File details
Details for the file matplotlib_pdf-0.1.1.tar.gz
.
File metadata
- Download URL: matplotlib_pdf-0.1.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29134df21df2797f1878ee996d109c187b51f8e295e594b5344629cf7da87b08 |
|
MD5 | b999d2588dbd9668412475f4b0c0b5f3 |
|
BLAKE2b-256 | aba7d0e9fbf9f1969ebb13e19fd00252e53195263a70e605d4f507b9e57c109d |