mpl-template: matplotlib report template constructor
Project description
mpl-template
A python class for creating full report figures, including borders, titleblocks, logos, and content, entirely within matplotlib.
Quick start
Simply importing mpl_template
lets you use the report template module.
import matplotlib as mpl
from mpl_template import template
import math
report_fig = template.Template(figsize=(8.5, 11), draft=True, scriptname='template.py')
title_block = [
{
'name': 'title',
'text': {
's': 'Example Figure',
'x': 0.5,
'y': 0.5,
'va': 'center',
'ha': 'center',
}
},
{},{},{},{},
]
report_fig.titleblock_content = title_block
report_fig.path_text = 'template.py'
fig = report_fig.setup_figure()
page_ax = report_fig.add_page()
# create a sub-gridspec that will be used for the main image
left, right, top, bottom = report_fig.margins
main = report_fig.gsfig[4 + top:-(report_fig.t_h + bottom + 8), 8 + left:-(right + 8)]
gs_timeseries = mpl.gridspec.GridSpecFromSubplotSpec(3, 1, main, hspace=0.3, wspace=0.3)
for n in range(3):
ax = fig.add_subplot(gs_timeseries[n])
ax.set_ylim(-2.5, 2.5)
plot = ax.plot([math.sin(i * (n + 1)) for i in range(0, 100)])
Installation
Dependencies
requires: matplotlib
optional: pillow
, requests
tests: pytest
, pytest-mpl
, pytest-cov
Official Releases
TODO: release on pypi For now, please install from source.
Development Builds
This is a pure-python package, so building from source is easy on all platforms:
git clone https://github.com/austinorr/mpl-template.git
cd mpl-template
pip install -e .
Testing
Testing is done via pytest
:
$pytest --mpl
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
mpl_template-0.4.0.tar.gz
(2.8 MB
view details)
Built Distribution
File details
Details for the file mpl_template-0.4.0.tar.gz
.
File metadata
- Download URL: mpl_template-0.4.0.tar.gz
- Upload date:
- Size: 2.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e61a1ee56ad2af303b0f421aa882e8dcfe8263b5ee9b24622d5492ba5725a60 |
|
MD5 | 396dac6129b344f36fc12b90ba54f28b |
|
BLAKE2b-256 | 21467cdc58663ee27b9c6b7487ef31b70af691b8eaaaf8b8d43bec9e6e63dcaf |
Provenance
File details
Details for the file mpl_template-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: mpl_template-0.4.0-py3-none-any.whl
- Upload date:
- Size: 2.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 061321fea69ecc72653f3196a18aea5c5a635c7570b5e3ae3a0776841efe18d3 |
|
MD5 | 71c57899d44ede4ea8879cdce79a2fe5 |
|
BLAKE2b-256 | f8f4cbd1af98d3fe7dc8bb648235308cf66f6197d63a00328194fad296f430f1 |