Skip to main content

Easy publication-ready matplotlib plots for ML papers and posters.

Project description

Agustinus' Very Opiniated Publication-Ready Plotting Library

I love TikZ (btw). I love tikzplotlib. I've been an advocate for the latter (proof). However, tikzplotlib is as good as dead. I need to move on.

[!IMPORTANT] Here's what I use now for all my publication needs. This library is designed to be very opiniated. Beauty is in the eye of the beholder. Also, it is very simple, just a single file and that's it.

[!NOTE] Of course I still use TikZ whenever possible (e.g. Fig. 1 in a paper, diagrams, etc.)

Examples

Left: ICML (letter size), single-column layout. Right: A0 landscape poster, 3-column layout.

       

import pub_ready_plots

...

pub_ready_plots.get_context(
    ...
-   layout="icml",
+   layout="poster-landscape",
    ...
)

...

Installation

Still with me? Still want to use this library? Here's how:

pip install pub-ready-plots

Quick Usage

import pub_ready_plots

with pub_ready_plots.get_context(
    width_frac=1,  # between 0 and 1
    height_frac=0.15,  # between 0 and 1
    layout="icml",  # or "iclr", "neurips", "poster-portrait", "poster-landscape"
    single_col=False,  # only works for the "icml" layout
    nrows=1,  # depending on your subplots, default = 1
    ncols=2,  # depending on your subplots, default = 1
    sharey=True,  # Additional keyword args for `plt.subplots`
    override_rc_params={"lines.linewidth": 4.123}  # Overriding rcParams
) as (fig, axs):
    # Do whatever you want with `fig` and `axs`
    ...

    # Once your done, save it, but do NOT set `tight_layout=True`!
    fig.savefig("filename.pdf")

Then in your LaTeX file, include the plot as follows:

\includegraphics[width=\linewidth]{filename.pdf}

[!IMPORTANT] The argument width=\linewidth is crucial!

That's it! But you should use TikZ more. Anyway, see the full, runnable example in examples/simple_plot.py

[!TIP] I recommend using this library in conjunction with [pypalettes]https://github.com/JosephBARBIERDARNAL/pypalettes to avoid the generic blue-orange Matplotlib colors. Distinguish your plots from others!

Using your own styles

Two options:

  1. Use this library and update the resulting rc_params dict with your styles.
  2. Fork this repo and modify things as you wish.

Other libraries

Check out tueplots if you want a more complex library. My library is designed to achieve what I want in my papers and posters, with as little code as possible. Because of this, it is very forkable and hackable.

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

pub_ready_plots-0.2.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

pub_ready_plots-0.2.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file pub_ready_plots-0.2.1.tar.gz.

File metadata

  • Download URL: pub_ready_plots-0.2.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.9.19 Darwin/23.5.0

File hashes

Hashes for pub_ready_plots-0.2.1.tar.gz
Algorithm Hash digest
SHA256 12ba861103e9a411c5dc89ef05f34a0ed0d0a9402371e98d4c0fb8aa4b51cc7d
MD5 71718b003b8bf897a971fc91a357ac31
BLAKE2b-256 a6e1578639cc3443447ee1f8291deb9196822d60f6f6753dc7f10c21c7edcd90

See more details on using hashes here.

File details

Details for the file pub_ready_plots-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pub_ready_plots-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.18.1 CPython/3.9.19 Darwin/23.5.0

File hashes

Hashes for pub_ready_plots-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 90f083828b40fd2ab07d57d5c237ee4130b4b93780e6c18f91f0dc1e501406be
MD5 04dcec12f5bd37b9a7b34f94bcbdeac4
BLAKE2b-256 85dece2f3a2b246a87f1a143f304d2fa4c0bb38964292d483400cf2b83874793

See more details on using hashes here.

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