How to Make Publication-Quality Figures in PyMOL: Ray Tracing, Resolution and Journal Requirements

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.

🫧
Without ray trace
OpenGL rendering. Fast, jaggy edges, flat lighting, visible aliasing at print size.
🫧
With ray trace
Ray traced. Smooth edges, depth shadows, professional lighting, print-ready quality.
PyMOL command line — ray tracing
# 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)
Ray tracing can be slow
A 1200×900 ray trace of a typical protein takes 30 seconds to 5 minutes depending on scene complexity and your machine. Get the orientation, coloring, and scene setup right in the interactive view first, then ray trace only when you’re satisfied. Surface representations are particularly slow to ray trace — complex scenes with surfaces can take 10+ minutes at high resolution.

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 typeray commandpng 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
The pixel math
Physical width (inches) × DPI = pixels. A single-column figure at 3.5 inches and 300 DPI needs 3.5 × 300 = 1050 pixels wide. For 600 DPI (some journals require this for line art): 3.5 × 600 = 2100 pixels. When in doubt, render larger than you think you need — you can always downsample, but you can’t add resolution.

Background color — white, black, or transparent

🫧
White
bg_color white
Required by almost every journal. Set this first and always use set ray_opaque_background, 1 when exporting.
🫧
Black
bg_color black
PyMOL default. Good for presentations and slides. Not acceptable for journal submissions.
🫧
Transparent
ray_opaque_background, 0
PNG only. Useful when compositing in Illustrator or PowerPoint. Avoid for direct submission.
PyMOL command line
# 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:

set ambient, VALUE
Range: 0.0 – 1.0
Overall ambient light level. Higher values flatten shadows and make the structure look more uniform. Lower values deepen shadows.
Recommended: 0.35 – 0.45
set specular, VALUE
Range: 0.0 – 1.0
Surface shininess. High values create bright specular highlights on the protein surface. Low values give a matte appearance preferred for most publications.
Recommended: 0.2 – 0.35
set light_count, VALUE
Range: 1 – 10
Number of light sources in the scene. More lights give smoother, more even illumination. Default is 2; 4 gives a noticeably more professional look.
Recommended: 4 – 6
set ray_shadow, VALUE
0 = off, 1 = on
Enables cast shadows during ray tracing. Adds realism and depth cues but increases render time. Strongly recommended for publication figures.
Recommended: 1 (on)
PyMOL command line — lighting setup
# 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

PyMOL command line — cartoon quality
# 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

PyMOL command line — export formats
# 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
PyMOL’s PNG DPI tag
PyMOL embeds the DPI metadata in the PNG file when you specify 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:

figure1a.pml — master publication figure template
Run with: pymol -c figure1a.pml
# ── 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 familyFormatMin DPINotes
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.
Always check the specific journal’s figure guide
Journal requirements change, and there are exceptions. Every journal has an “Author Guidelines” or “Figure Preparation” page — check it before final submission. The table above reflects common current requirements but is not a substitute for the journal’s official specifications.

Pre-submission checklist

  • White background set — bg_color white and set 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.

Last updated on

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *