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
Hashes for matplatex-0.4.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55b93dcb463de005f21b810223fa027c1e31ca7377b3951e3601d64683b044c6 |
|
MD5 | 2f482e73d609662b04e9833f34e4e2bc |
|
BLAKE2b-256 | 68947f06fe21fd20637915d08f1d4f589e3f62e30e1d64aca6459b15e7c318a0 |