Skip to content
elenacandellonePublic

About

No description or website provided.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

plottino

Paper-ready matplotlib and seaborn figures. plottino makes each figure at the size it will be printed, styles it for the journal or your LaTeX document, and checks that it is legible.

pip install git+https://github.com/elenacandellone/plottino
import plottino as pt

pt.use('science')                        # or 'nature', 'pnas', 'cell', 'sciadv'; or pt.use_latex()
fig, ax = pt.figure('single')            # or pt.figure(r'0.5\textwidth') after pt.use_latex()
...                                      # any matplotlib / seaborn plot
pt.save(fig, 'fig1')                     # checks, then writes fig1.pdf + fig1.png
plottino check: Science, figure 2.24 x 1.80 in
  x error   text_overlap     6 x tick labels overlap in axes 0: use fewer ticks, rotate them, swap the axes or widen the panel

Before and after

Left: as figures often start, with the problems plottino finds boxed. Right: after following its report. Shown at the same printed width (code).

Before After
Crowded labels
Legend on the data; red and green
Made at screen size, shrunk into a column

What it checks

Overlapping or cut-off text · text or legends on top of data · fonts, lines and symbols too small at print size · figure size against the journal's columns · low-contrast text · colours colour-blind readers cannot tell apart · rainbow colormaps · unlabelled axes · the journal's own rules (e.g. no figure title in the image, no red with green, units in axis labels).

report = pt.check(fig, journal='nature')   # print(report), report.ok, report.highlight()
pt.check(fig, width=r'0.5\textwidth')      # check at the size it will be included
pt.save(fig, 'fig1', strict=True)          # refuse to save a figure with errors

Journals

widths text source
Science 5.7 / 12.1 / 18.4 cm 6-8 pt guide
Science Advances 9 / 14.4 / 18.4 cm 6-8 pt guide
Nature 89 / 183 mm 5-7 pt specifications
PNAS 8.7 / 11.4 / 17.8 cm 6-8 pt guidelines
Cell 8.5 / 11.4 / 17.4 cm 6-8 pt guidelines
LaTeX fractions of \textwidth \footnotesize pt.use_latex(textwidth=..., fontsize=...)

Guidelines change: check them before submitting. Add your own with pt.journals.register.

Helpers: pt.panel_labels, pt.label_lines (direct labels instead of a legend), pt.emphasize (grey out the rest), pt.OKABE_ITO (colour-blind-safe palette). More in examples/examples.ipynb.

Colour-blindness simulation: Machado et al. (2009); colour distances: OKLab (Ottosson 2020); palette: Okabe & Ito (2008).

About

No description or website provided.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages