Ready-made gnuplot (epslatex) settings that produce standalone PDF figures at the exact column width, font, and line widths a journal asks for, so you start from a concrete base (size, margins, fonts, tics, colors) instead of from an empty script.
A figure is your normal gnuplot script plus six lines at the top:
FIG_ROOT = "/path/to/this/repo" # where core/ and journals/ are
JOURNAL = "nature" # aps | nature | pnas | (your own, see journals/_template.gpt)
C = 1 # number of columns (the profile says which values are allowed)
R = 0.75 # height / width
OUTNAME = "myfig" # writes myfig.tex in the current directory
load FIG_ROOT."/core/fig_core.gpt"
set xlabel 'Time (s)'
set ylabel 'Amplitude (a.u.)'
set label PT(6, '(a)') at graph 0.08, 0.92 center # text at exactly 6 pt
set xrange [0:2*pi]; set samples 400
plot sin(x) title '$\sin x$', \
sin(2*x) title '$\sin 2x$'
set outputgnuplot myfig.gp
xelatex myfig.tex # pdflatex for APS; see the table belowmyfig.pdf is the figure, with the page size equal to the figure size.
There is nothing to install: clone or download this repository to any folder and point FIG_ROOT at it. Only core/ and journals/ are read when a figure is built, so you can also copy just those two folders into a project to keep it self-contained.
- gnuplot with the
epslatexterminal (developed and tested with gnuplot 6.0). - TeX Live (or similar) with
pdflatex,xelatex,amsmath,fontspec,mathastext,epstopdf. - For Nature and PNAS: a sans font that
fontspeccan find (both journals ask for Helvetica or Arial).core/font.gptpicks the first installed of Helvetica, Nimbus Sans, TeX Gyre Heros, Arimo, Arial (on Windows it uses Arial); setSANS_FONT = "..."before loadingcore/fig_core.gptto choose one. If none is installedxelatexstops with "The font "Helvetica" cannot be found"; see troubleshooting. - For
make test:pdfinfo,pdftotext,pdffonts(poppler-utils),mutool(mupdf-tools, for the real text sizes and line widths; those checks are skipped without it),python3and a POSIX shell.
JOURNAL |
C and width |
Text | Engine | Source of the numbers |
|---|---|---|---|---|
aps |
1 = 8.5, 1.5 = 12.75, 2 = 17.0 cm | Computer Modern, 12 pt | pdflatex | One column: APS style basics (8.5 cm). 1.5 and 2 columns: no width is published there, so one column times the factor is used. |
nature |
1 = 8.8 cm, 2 = 18.0 cm | Helvetica 7 pt | xelatex | Nature Portfolio artwork guide (88 / 180 mm, text 5-7 pt). |
pnas |
1 = 8.7, 1.5 = 11.4, 2 = 17.8 cm | Helvetica 8 pt | xelatex | PNAS digital art guide (widths, text 6-8 pt, lines >= 0.25 pt). |
| (none) | 1 = 8.5 cm, 2 = 17.5 cm | Computer Modern, 10 pt | pdflatex | Generic defaults, not tied to a journal. |
Per-journal notes, with what each guide says and what was and was not checked:
APS, Nature, PNAS.
The comments at the top of each file in journals/ summarise the same.
Where the numbers come from (read on 2026-11-27 unless a journal page says otherwise):
| Journal | Web page | Guide (PDF) |
|---|---|---|
| APS | Style basics | APS Journals Style Guide for Authors |
| Nature | Formatting guidelines | Guide to preparing final artwork |
| PNAS | Manuscript formatting guidelines | Digital art guide |
These guides may be out of date or have changed since they were read here. Always check the requirements on the journal's own website before you submit. A column count a journal does not offer is refused: the script stops with an error and writes nothing. Use WIDTH = <cm> to set a width by hand.
-
Reference (every variable, macro and command)
-
Troubleshooting · per-journal notes in
docs/journals/
Four small figures built only from known functions, each a plain gnuplot script you can copy:
| Script | Shows |
|---|---|
examples/sine_cosine.gpt |
one column; custom tic labels ($\pi$), curves that also differ in dash type so they survive grayscale |
examples/gaussian.gpt |
one column; normal distributions with a pattern-filled area (no transparency in epslatex) |
examples/two_panel.gpt |
two columns; two panels with (a) / (b) labels using multiplot and the journal's margins |
examples/alpha.gpt |
one column; overlapping distributions with real transparency (TERM_TYPE = "cairolatex") |
make examples JOURNAL=aps # PDFs in build/examples/aps/ (aps | nature | pnas; omit for the generic defaults)The same scripts work for every journal: only JOURNAL changes the width, fonts, margins and engine.
Every setting is a variable. Set it before loading core/fig_core.gpt to override the
journal's value, or set it afterward and re-run load FIG_ROOT."/core/style.gpt".
The full reference, with defaults and what each journal changes, is in
docs/reference.md (and at the top of core/fig_core.gpt):
| Area | Variables |
|---|---|
| Input | C, R, FIG_ROOT, JOURNAL, OUTNAME, WIDTH |
| Margins (cm) | MARGIN_L, MARGIN_R, MARGIN_B, MARGIN_T (per panel: PANEL, see below) |
| Frame, tics | BORDER, BORDER_LW, TIC_LEN (cm), MTIC_RATIO, TIC_DIR, TIC_MIRROR, MINOR_TICS, TIC_FORMAT, TIC_OFFSET_X/Y, GRID |
| Text | TEXT_PT, LABEL_PT, TITLE_PT, XLABEL_OFFSET, YLABEL_OFFSET |
| Legend | KEY_POS, KEY_BOX, KEY_SPACING, KEY_SAMPLEN, KEY_WIDTH |
| Data | LINE_LW, POINT_SIZE, OPEN_POINT_RATIO, PALETTE |
| Terminal | TERM_TYPE (epslatex or cairolatex), TERM_FONT, TERM_LW, TERM_HEADER, TEX_ENGINE, SANS_FONT (Nature, PNAS) |
Precedence: your variable, then the journal profile, then the core default.
Tic labels and legend entries use the profile's \normalsize (TEXT_PT points). Any other text can be set at an exact size in points, in every journal:
set label PT(5, 'small note') at 1,2 center
set xlabel LBL('x') # LABEL_PT = 7 sets the size of all axis labelsText wrapped in a size is centered on its anchor by gnuplot instead of being left-aligned, so give such labels the center keyword. Tic labels and legend entries are deliberately not wrapped: it would break their alignment.
In epslatex, lw 1 is 0.25 pt; the effective width is lw * TERM_LW * 0.25 pt. APS asks for curves of at least 0.5 pt (its profile uses TERM_LW = 2); PNAS for at least 0.25 pt.
core/palette.gpt defines color_c1 ... color_c9: the color-blind-friendly Okabe-Ito palette with the yellow replaced by a wine red (0x882255) for contrast on white. Linetypes 1-8 use it (black, blue, vermilion, green, reddish purple, sky blue, orange, wine; c9 is white, for use over other colors). PALETTE = 1..4 loads the same colors as seen in grayscale, protanopia, deuteranopia and tritanopia, to check how a figure reads for those readers (APS also requires figures to work in grayscale print).
core/palette.gpt is generated by tools/palette_check/palette_check.py (needs numpy), which is also the tool to try your own palette:
python3 tools/palette_check/palette_check.py # report on the default palette
python3 tools/palette_check/palette_check.py --colors "#000000,#E69F00,#56B4E9" --png out/
python3 tools/palette_check/palette_check.py --check --min-de 10 # exit status 1 if two colours are too close
python3 tools/palette_check/palette_check.py --de 2000 # CIEDE2000 instead of CIE76
make palette # rewrite core/palette.gpt after editing the paletteIt prints, for normal vision, grayscale, protanopia, deuteranopia and tritanopia, the smallest color difference (Delta E) and the pairs that fall below the threshold; --png DIR draws the colors and the full Delta E matrix of every variant, and --json FILE saves the report. The default palette keeps every pair at Delta E (CIE76) >= 10 in normal vision and in the three color blindness simulations; in grayscale some pairs are close (as with any 8 colors on one brightness axis), which is why --check ignores grayscale unless you add --check-gray.
For figures with several panels, or axis labels at the same distance from the figure edge in every figure, core/layout.gpt adds eval PANEL(l, r, b, t) (margins in cm), eval XLABEL('..'), eval YLABEL('..'), eval Y2LABEL('..'), eval NOLABELS and PH(n, gap); see the reference.
make test # everything below
make test-fig # needs gnuplot, pdflatex, xelatex and poppler-utils; takes a few minutes
make test-palette # palette checker (python3 + numpy; matplotlib for the PNG test)
make clean # removes build/For each journal and each column count (and the core defaults) three test figures are built in build/ (layout, lines, fonts) and compiled with the engine the profile asks for. Look at the PDFs to see what you get: frame and tics, line widths and point types and sizes, text sizes from 5 to 24 pt, Greek letters and formulas. The runner checks automatically:
- page size equals the nominal size (0.1 mm);
- all fonts embedded, no Type 3 fonts;
- no text outside the page, and both axis labels present;
- every test also runs with
TERM_TYPE = "cairolatex"(one and two columns; page size within 0.36 mm); PT(n, ...)really gives n points, and the unwrapped text equalsTEXT_PT, both measured as the real font size in the PDF (within 2%; 5% with Computer Modern, which has only fixed design sizes:PT(14, ...)comes out at 14.4 pt);- the publisher's minimum is met by the real sizes in the PDF: font size of all text >=
MIN_TEXT_PTand <=MAX_TEXT_PT(Nature 7 pt, PNAS 8 pt; only for the default text,PT(n, ...)sizes are yours) (APS 8.8 pt = 2 mm numerals in Computer Modern, Nature 5 pt, PNAS 6 pt) and width of every line >=MIN_LW_PT(APS 0.5 pt, PNAS 0.25 pt; Nature gives none), and every data marker >=MIN_POINT_MM(APS 1 mm). - Sub/superscripts are reported, not checked;
- Nature's 5/6/7 pt macros come out as 5, 6 and 7 pt;
- invalid column counts are refused without leaving files;
- every example builds for every journal, fits on its page, and carries its axis labels;
- Nature and PNAS still build with
SANS_FONT = "Nimbus Sans"when Helvetica is not available; - no absolute paths in the tracked files.
make test-palette checks the color-difference code against published CIEDE2000 reference values, that every variant is derived correctly, that the default palette stays distinguishable, and that core/palette.gpt is exactly what the program generates.
- One journal per gnuplot run. Variables survive a
load, so a second figure in the same session inherits the first one's settings. - The output is written in the current directory. gnuplot writes the file name you give to
set outputinto\includegraphics, so compile from the directory that holds the.tex. - No transparency with
epslatex. Use patterned fills, orTERM_TYPE = "cairolatex"for real transparency (page size rounded to whole points); see docs/transparency.md. - Legend width. gnuplot measures legend entries from the raw LaTeX string, so entries with formulas can misalign their samples;
KEY_WIDTH(negative to shrink) corrects it. - Problems? See docs/troubleshooting.md (missing font, cut-off labels, ...).
- A title needs room. The default
MARGIN_T(0.3 cm) leaves none; raise it when you use one. - Nature and PNAS need
xelatex/lualatex; the Nature font size inTERM_FONTis 8 because the LaTeX class has no 7 pt size (the text itself is 7 pt).
core/ fig_core.gpt (settings and terminal), style.gpt (set commands, PT/LBL/TTL), palette.gpt,
font.gpt (sans font detection), layout.gpt (PANEL, XLABEL, YLABEL: per-panel margins and labels)
journals/ aps.gpt, nature.gpt, pnas.gpt, _template.gpt (start of a new journal)
tests/ test figures, checks and the runner (run_tests.sh)
examples/ four example figures and build.sh
docs/ getting started, reference, customizing, adding a journal, transparency, per-journal notes, troubleshooting
tools/palette_check/ palette checker and generator of core/palette.gpt, with its tests
To add a journal, copy journals/_template.gpt, fill in the values from its artwork guide, and run make test (the runner picks up every file in journals/ not starting with _).
The idea, the original implementation (the journal headers and the palette checker this repository started from), and the responsibility for the content are Isidoro González-Adalid Pemartín's, who reviews every change. Claude Code (Anthropic) was used as a programming assistant for part of the work: reorganizing the original files into a common core with journal profiles, the test suite (including the measurements of text size, line width, and point size in the PDFs), the cairolatex option, the font detection, and drafting the documentation. Commits made with its help carry a Co-Authored-By: Claude line. The values taken from the journals' guidelines should be checked against the journals' own pages.
MIT, see LICENSE. The journals' artwork guides are linked from docs/journals/, not
redistributed.