| name | publication-figures |
| description | Use when creating publication-quality molecular figures with proper styling, ray tracing, and export settings through PyMOL. |
| version | 0.1.0 |
Publication Figures
Settings and workflows for creating journal-quality molecular visualizations.
Send all cmd.* code via: ~/.pymol-agent-bridge/bin/pymol-agent-bridge exec "..." (or heredoc for multi-line). See @pymol-fundamentals for details.
Background Settings
White Background
cmd.bg_color("white")
cmd.set("ray_opaque_background", 1)
Transparent Background
cmd.set("ray_opaque_background", 0)
cmd.bg_color("white")
Quality Settings
Antialiasing
cmd.set("antialias", 2)
Lighting
cmd.set("direct", 0.5)
cmd.set("spec_reflect", 0.5)
cmd.set("ambient", 0.4)
Shadows and Depth
cmd.set("ray_shadows", 0)
cmd.set("depth_cue", 0)
cmd.set("ray_shadows", 1)
cmd.set("ray_shadow_decay_factor", 0.1)
cmd.set("depth_cue", 1)
Cartoon Styling
Basic Improvements
cmd.set("cartoon_fancy_helices", 1)
cmd.set("cartoon_smooth_loops", 1)
cmd.set("cartoon_flat_sheets", 1)
Cylinder Helices
cmd.set("cartoon_cylindrical_helices", 1)
Line Width
cmd.set("cartoon_tube_radius", 0.3)
cmd.set("cartoon_loop_radius", 0.3)
Stick Styling
cmd.set("stick_radius", 0.15)
cmd.set("stick_ball", 1)
cmd.set("stick_ball_ratio", 1.5)
Surface Styling
cmd.set("surface_quality", 1)
cmd.set("transparency", 0.5)
cmd.set("surface_color", "white")
Viewport and Resolution
Set Viewport
cmd.viewport(1200, 900)
cmd.viewport(1600, 900)
Common Sizes
| Use Case | Resolution | DPI |
|---|
| Web/slides | 1200x900 | 72-150 |
| Journal (1 col) | 1200x1200 | 300 |
| Journal (2 col) | 2400x1200 | 300 |
| Poster | 3000x2000 | 300 |
Rendering
Preview (Fast)
cmd.draw(1200, 900)
Final (Ray Traced)
cmd.ray(1200, 900)
Ray Tracing Settings
cmd.set("ray_trace_mode", 1)
cmd.set("ray_trace_gain", 0.1)
Saving Images
PNG
cmd.ray(1200, 900)
cmd.png("/path/to/image.png", dpi=300)
cmd.draw(1200, 900)
cmd.png("/path/to/image.png", dpi=150)
With Ray Tracing
cmd.ray(2400, 1800)
cmd.png("/path/to/figure.png", dpi=300)
Scenes for Figures
Store Views
cmd.scene("panel_A", "store", message="Overview")
cmd.scene("panel_B", "store", message="Active site")
cmd.scene("panel_C", "store", message="Close-up")
Recall and Export
for panel in ["panel_A", "panel_B", "panel_C"]:
cmd.scene(panel, "recall")
cmd.ray(1200, 900)
cmd.png("/path/to/" + panel + ".png", dpi=300)
Complete Workflow
Standard Figure
cmd.fetch("1ubq")
cmd.show("cartoon")
cmd.hide("lines")
cmd.dss()
cmd.color("green", "ss h")
cmd.color("yellow", "ss s")
cmd.color("cyan", "ss l+")
cmd.bg_color("white")
cmd.set("ray_opaque_background", 1)
cmd.set("antialias", 2)
cmd.set("cartoon_fancy_helices", 1)
cmd.set("ray_shadows", 0)
cmd.set("depth_cue", 0)
cmd.orient()
cmd.zoom("all", 2)
cmd.ray(2400, 1800)
cmd.png("/path/to/figure.png", dpi=300)
Multi-Panel Figure
cmd.orient()
cmd.scene("overview", "store")
cmd.zoom("resi 45-50", 5)
cmd.scene("detail", "store")
import os
output_dir = os.path.expanduser("~/Desktop")
for scene in ["overview", "detail"]:
cmd.scene(scene, "recall")
cmd.ray(1200, 900)
cmd.png(output_dir + "/" + scene + ".png", dpi=300)
Color Recommendations
Colorblind-Friendly
cmd.color("marine", "chain A")
cmd.color("orange", "chain B")
cmd.color("teal", "chain A")
cmd.color("salmon", "chain B")
Classic Schemes
cmd.color("red", "ss h")
cmd.color("yellow", "ss s")
cmd.color("green", "ss l+")
cmd.do("util.cbc")
Tips
- Ray trace final figures; use
draw for previews
- 300 DPI for print, 150 DPI for web/slides
- Disable shadows for clean diagrams
- White background is standard for journals
- Store scenes before adjusting for different panels
- Test colors with colorblindness simulators
- Always
cmd.remove("solvent") before making figures (removes water clutter)
- Use
cmd.ray(w, h) then cmd.png(path) — never pass dimensions to cmd.png() (causes view corruption)
- Set
cmd.set("specular", 0.2) for subtle shine without glare
- Marine (blue) + orange is a good colorblind-safe secondary structure scheme