Render matplotlib png images to a zip file
Project description
# PNG Renderer
For constructing a zip file of png images. I created this package as I had many plots associated from the output of a plotting script and wanted to keep them together. Similar to `matplotlib.backends.PdfPages` I wanted to associate the images, but using the `png` format, so I chose to zip the collection of images. I wanted png images as they contained large amounts of data which created extremely large pdf files.
## Example usage
``` python
import matplotlib.pyplot as plt
from pngrenderer import PNGRenderer
fig = plt.figure()
plt.plot(...)
# Save the resulting image(s) to "out.zip"
renderer = PNGRenderer("out")
# Save the first png image
renderer.savefig("first.png")
# Alternatively call .save_page
# renderer.save_page("first.png")
# Render the zip file to disk
renderer.render()
# Alternatively use the context manager
from pngrenderer import png_render
with png_render("out") as renderer:
renderer.savefig()
# The context manager calls the `render` method
```
## Requirements and installation
This package requires matplotlib, but no other packages
Installation: `pip install git+https://github.com/mindriot101/pngrenderer.git`
If this package ever makes it onto pypi then probably the installation will be `pip install matplotlib-pngrenderer`.
## Contributing
To contribute, clone the repository at [this github link](https://github.com/mindriot101/matplotlib-pngrenderer), and run the tests with `python setup.py test`
For constructing a zip file of png images. I created this package as I had many plots associated from the output of a plotting script and wanted to keep them together. Similar to `matplotlib.backends.PdfPages` I wanted to associate the images, but using the `png` format, so I chose to zip the collection of images. I wanted png images as they contained large amounts of data which created extremely large pdf files.
## Example usage
``` python
import matplotlib.pyplot as plt
from pngrenderer import PNGRenderer
fig = plt.figure()
plt.plot(...)
# Save the resulting image(s) to "out.zip"
renderer = PNGRenderer("out")
# Save the first png image
renderer.savefig("first.png")
# Alternatively call .save_page
# renderer.save_page("first.png")
# Render the zip file to disk
renderer.render()
# Alternatively use the context manager
from pngrenderer import png_render
with png_render("out") as renderer:
renderer.savefig()
# The context manager calls the `render` method
```
## Requirements and installation
This package requires matplotlib, but no other packages
Installation: `pip install git+https://github.com/mindriot101/pngrenderer.git`
If this package ever makes it onto pypi then probably the installation will be `pip install matplotlib-pngrenderer`.
## Contributing
To contribute, clone the repository at [this github link](https://github.com/mindriot101/matplotlib-pngrenderer), and run the tests with `python setup.py test`
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pngrenderer-0.1.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for pngrenderer-0.1.1-py27-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05ba88132bfadd252bca3677a9c3d8926ddd98cee37638da1577273caae4f4c0 |
|
MD5 | 746426f2c394bf1c8ad2bea0e7919739 |
|
BLAKE2b-256 | 872b09750f5099a000cb2231e148cc4a455896f53b3bd33f9cc115f33d860bf7 |