A package to save matplotlib figures for easy inclusion in LaTeX.
Project description
MatpLaTeX
MatpLaTeX lets you save a matplotlib Figure
as a combination of a pdf file containing the graphics and a LaTeX file containing the text. With this, text in the figure will automatically use the typeface, size and other settings of the surrounding text.
Installation
MatpLaTeX is on PyPI, simply
pip install matplatex
Python requirements:
- python >= 3.10 (If someone asks I may add support for earlier versions.)
- matplotlib >= 3.5
- beartype
LaTeX requirements:
- tikz
- graphicx
Basic Usage
To save a figure, simply use
matplatex.save(fig, "myfig")
this will create two files named myfig.pdf
and myfig.pdf_tex
.
In your LaTeX document, define the width of the figure with
\newlength{\figurewidth}
\setlength{\figurewidth}{<your desired width>}
and include the figure as such:
\input{myfig.pdf_tex}
LaTeX commands such as \small
and \textbf{}
will affect the text in the expected way.
Options
Note: this is still under development and may change in future versions.
matplatex.save
accepts the following keyword options:
widthcommand
: string
Command used to set the width of the figure. Default:\figurewidth
.draw_anchors
: bool
Mark the text anchors in the figure. Useful for debugging. Default:False
.verbose
: bool
Print message upon successful save. Default:True
.
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
Built Distribution
File details
Details for the file matplatex-0.5.0.tar.gz
.
File metadata
- Download URL: matplatex-0.5.0.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af1242911c40707ebe1028610a270c7faae5833612cd1f1afe43308e10c1e1e0 |
|
MD5 | 6cdec86104d9f74fc8a07ba07fa6b715 |
|
BLAKE2b-256 | 5b690c39c4acf13a73d5ebb648c230704341d41d28a0481291d8941d458f108e |
File details
Details for the file matplatex-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: matplatex-0.5.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a66e3e40c0e45e2977f907c70e8868240912212b4b63806ba152ae246cd458c7 |
|
MD5 | 07fd247710ec2036b2ec48389178465f |
|
BLAKE2b-256 | 2fc2eeb2089de78640aaa8c20073e4a3e84e963cd4599a303c6e2acf94b54d5f |