Saving Matplotlib figures so that all text becomes a TikZ overlay.
This allows for easy customization of the text on the LaTeX
side. Nominally for use with the LaTeX style nmd/nmd-graphics
from my
personal document class,
though it only depends on a few lines of that, specifically the
tikzoverlay* environment.
Assuming you are using Python 3, do:
python3 -m pip install -U https://github.com/NathanDunfield/mpltikztext/archive/master.zip
Download the source code zipfile and in the resulting directory do:
cd examples python3 sine_wave.py pdflatex sine_wave.tex python3 scatter.py pdflatex scatter.tex
See the above Python and TeX files for more on usage.
Each TikZ overlay generated includes a scope
where the coordinates
are the native ones with respect to the data plotted. This is
potentially useful for adding on annotations or whatever in TeX
without firing up matplotlib.
Copyright Nathan Dunfield, 2014-present. Released under the terms of the GNU General Public License, version 2 or later.