Skip to content

Agustinus' very opiniated publication-ready plotting library

License

Notifications You must be signed in to change notification settings

wiseodd/pub-ready-plots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

       

from pub_ready_plots import get_mpl_rcParams

rc_params, fig_width_in, fig_height_in = get_mpl_rcParams(
    width=1,
    height=0.15,
-   layout="icml",
+   layout="poster-landscape",
)

Installation

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

pip install pub-ready-plots

Usage

rc_params, fig_width_in, fig_height_in = pub_ready_plots.get_mpl_rcParams(
    width=1,  # between 0 and 1
    height=0.1,  # between 0 and 1
    layout="icml"  # or "iclr", "neurips", "poster-portrait", "poster-landscape"
)
plt.rcParams.update(rc_params)

fig, axs = plt.subplots(
    nrows,
    ncols,
    constrained_layout=True, # Important!
)
fig.set_size_inches(fig_width_in, fig_height_in)

# Your plot here!

plt.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!

Tip

That's it! But you should use TikZ more.

Using your own styles

Two options:

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

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.

About

Agustinus' very opiniated publication-ready plotting library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages