How to Make Publication-Quality Figures in PyMOL: Ray Tracing, Resolution and Journal Requirements
The gap between a PyMOL screenshot and a journal-ready figure is smaller than most researchers think — but it requires knowing about five or six specific settings that are off by default. This tutorial covers every setting that matters, the correct resolution for any figure size, and how to organize a reusable script that generates consistent figures across a whole paper.
Ray tracing — why it matters and how to use it
The default PyMOL display uses OpenGL rendering — fast, interactive, but not publication quality. Ray tracing is a physically accurate lighting simulation that traces individual light rays through the scene, producing smooth surfaces, realistic shadows, and proper depth cues. The difference between a standard screenshot and a ray-traced image at the same resolution is dramatic.
# Basic ray trace at viewer resolution
ray
# Ray trace at specific pixel dimensions
ray 1200, 900
# Ray trace and export in one command
png figure1a.png, width=1200, height=900, dpi=300, ray=1
# Ray trace mode (1 = production quality, 0 = fast preview)
set ray_trace_mode, 1 # standard photorealistic
set ray_trace_mode, 3 # outline mode (black outlines, good for diagrams)
Resolution and DPI — getting the numbers right
Most journal figure rejections due to image quality come from two mistakes: submitting screenshots instead of ray-traced renders, and not understanding that pixel count × DPI determines physical print size. The PyMOL ray command takes pixel dimensions — you need to calculate the right pixel count for your target print size.
| Figure type | ray command | png DPI |
|---|---|---|
| Single column (88 mm / 3.5 in) | ray 1050, 800 | dpi=300 |
| 1.5 column (136 mm / 5.35 in) | ray 1600, 1200 | dpi=300 |
| Double column (180 mm / 7 in) | ray 2100, 1600 | dpi=300 |
| Full page panel | ray 2480, 3508 | dpi=300 |
| Cover image (high-res) | ray 3000, 4000 | dpi=300 |
Background color — white, black, or transparent
# White background — do this before every publication figure
bg_color white
set ray_opaque_background, 1 # ensures background is white, not transparent
# Transparent background (for Illustrator compositing)
bg_color white
set ray_opaque_background, 0
ray
png figure_transparent.png # transparent PNG — no background
# Presentation / dark theme (not for journals)
bg_color black
Lighting and shadows
PyMOL’s default lighting is acceptable for interactive use but looks flat in publication figures. Four settings control the majority of the lighting character:
# Publication-standard lighting
set ambient, 0.40
set specular, 0.25
set light_count, 4
set ray_shadow, 1
# For a softer, more diffuse look (good for surfaces)
set ambient, 0.50
set specular, 0.15
set light_count, 6
# For dramatic depth (talks, covers)
set ambient, 0.25
set specular, 0.40
set light_count, 2
set ray_shadow, 1
Cartoon settings for publication
# Rounded helices (publication standard — enable first)
set cartoon_fancy_helices, 1
# Smooth loops between secondary structure elements
set cartoon_smooth_loops, 1
# Tube radius for coil/loop regions
set cartoon_tube_radius, 0.4 # default 0.5 — thinner looks cleaner
# Anti-aliasing for smoother edges
set antialias, 2 # range 1–4; 2 is best quality/speed balance
# Higher surface quality if surface is in the figure
set surface_quality, 2 # default 0; use 1 or 2 for publication
Saving as PNG and TIFF
# PNG export — most common, works for all journals
ray 1200, 900
png figure1a.png, dpi=300
# Combine ray + export in one command (cleaner scripts)
png figure1a.png, width=1200, height=900, dpi=300, ray=1
# TIFF export — required by some journals (Nature, Cell)
# PyMOL doesn't export TIFF natively — export PNG first,
# then convert with ImageMagick (free, command line):
# convert figure1a.png -compress LZW figure1a.tif
# Check DPI of the exported file (ImageMagick)
# identify -verbose figure1a.png | grep Resolution
dpi=300 in the png command. This metadata tells submission systems and image editors the intended print resolution. Always specify DPI — without it, some submission portals default to 72 DPI and flag the file as too low resolution even if the pixel count is sufficient.
The master figure script
Save every publication figure as a reusable .pml script. This makes it trivial to regenerate a figure after reviewer requests, adjust colors for revision, or create a panel set with consistent settings. Here is a complete template:
# ── Load and prepare ──────────────────────────────
fetch 4XYZ
as cartoon
hide everything, resn HOH
# ── Color scheme ──────────────────────────────────
util.cbc # color by chain
color slate, chain A # override specific chains
color salmon, chain B
show sticks, resi 273 and chain A # active site residue
color red, resi 273 and chain A
# ── Cartoon quality ───────────────────────────────
set cartoon_fancy_helices, 1
set cartoon_smooth_loops, 1
set cartoon_tube_radius, 0.4
# ── Background ────────────────────────────────────
bg_color white
set ray_opaque_background, 1
# ── Lighting ──────────────────────────────────────
set ambient, 0.40
set specular, 0.25
set light_count, 4
set ray_shadow, 1
set antialias, 2
# ── View (paste get_view output here) ─────────────
set_view (\
0.92, -0.21, 0.32,\
-0.18, 0.45, 0.87,\
-0.35, -0.87, 0.35,\
0.00, 0.00, -85.0,\
12.50, 8.30, 10.20,\
65.00, 105.0, -20.0)
# ── Render and export ─────────────────────────────
png figure1a.png, width=1200, height=900, dpi=300, ray=1
Journal requirements
| Journal family | Format | Min DPI | Notes |
|---|---|---|---|
| Nature / Nature journals | TIFF or EPS | 300 (photos), 600 (combination) | Convert PNG to TIFF with ImageMagick. Single-column = 88 mm. |
| Science / AAAS | TIFF, EPS, or PDF | 300 | Single column = 5.5 cm or 9 cm. Full width = 17.8 cm. |
| PNAS | TIFF or EPS | 500 (halftone), 1000 (line) | More demanding than most — render at higher pixel counts. |
| JACS / ACS journals | TIFF, EPS, or PNG | 300 | PNG accepted. Single column = 3.25 in; double = 7 in. |
| eLife / PLOS ONE | Any raster format | 300 | More flexible than legacy publishers. PNG works fine. |
| Structure / Elsevier | TIFF or EPS preferred | 300 | Single column = 90 mm; double = 190 mm. |
Pre-submission checklist
- White background set —
bg_color whiteandset ray_opaque_background, 1 - Fancy helices enabled —
set cartoon_fancy_helices, 1 - Smooth loops enabled —
set cartoon_smooth_loops, 1 - Lighting adjusted — ambient 0.35–0.45, specular 0.2–0.35, light_count 4
- Anti-aliasing set —
set antialias, 2 - Ray traced at correct pixel dimensions for target figure size and DPI
- DPI specified in png export —
png filename.png, dpi=300 - Format matches journal requirements (PNG, TIFF, or EPS as needed)
- Session saved as .pse for later revisions
- .pml script saved — figure can be regenerated from scratch
Publication figures in one paragraph
Every publication PyMOL figure needs five things that are off by default: bg_color white, set ray_opaque_background, 1, set cartoon_fancy_helices, 1, a ray command at the correct pixel dimensions for your target print size, and png filename.png, dpi=300. Add ambient and specular lighting adjustments for a professional look. Save the figure setup as a .pml script — not just a .pse session — so any panel in the paper can be regenerated in seconds rather than reconstructed from memory six months later when reviewers ask for revisions.