Skip to main content

Functions and shortcuts to create latex-ready images from matplotlib

Project description

matplotlib-latex-bridge

Documentation Status

This library provides a set of functions and shortcuts to create latex-ready images with matplotlib.

This library is not a replacement for matplotlib, it can just be used to set sensible settings in order to have figures with readable text and with a font size that is consistent both among various figures and with the rest of the text in the document.

Example:

example

Install

The latest stable version can be installed via pip:

pip install matplotlib-latex-bridge

Otherwise, the library can be installed from sources:

git clone https://github.com/loreucci/matplotlib-latex-bridge.git
cd matplotlib-latex-bridge
pip install -e .

Quickstart

Initialize the library using one of the presets provided:

import matplotlib_latex_bridge as mlb

mlb.setup_page(**mlb.formats.article_letterpaper_10pt_singlecolumn)

Create a new figure and use it as normal:

mlb.figure_textwidth()  # for full page images
mlb.figure_columnwidth()  # for full column images

plt.plot(...)  # use matplotlib as normal

fig.savefig("image.png")

Include it in the latex file without scaling:

\begin{figure}
    \centering
    \includegraphics[scale=1]{image.png}
\end{figure}

That's it!

For more options please refer to the online documentation.

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

matplotlib-latex-bridge-0.2.0.tar.gz (18.4 kB view hashes)

Uploaded Source

Built Distributions

matplotlib_latex_bridge-0.2.0-py3-none-any.whl (18.6 kB view hashes)

Uploaded Python 3

matplotlib_latex_bridge-0.2.0-py2-none-any.whl (18.6 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page