# How to make a publication-quality protein figure

> Take one structure from its default view to a figure a journal accepts: pick cartoon, surface or sticks, colour by one property, light it with ray tracing and export a PNG at the width the journal prints. Every step has its PyMOL equivalent.

HIV-1 protease (PDB entry [1HSG](https://www.rcsb.org/structure/1HSG)) opens in the PDB viewer as a two-colour ribbon with 127 crystal waters floating around it and an inhibitor too small to read. It is a fine working view and a poor figure.

To turn it into one, hide the waters, show one style, colour by one property, light it with the Ray traced option and save the image from **Export** at the width the journal prints: 1,051 pixels for an 89 mm column at 300 dpi.

PyMOL gets there with `ray` and `png figure.png, 10cm, dpi=300, ray=1`. This guide builds the figure in the [PDB viewer by ProteinIQ](/app/pdb-viewer), which draws with the Mol* engine and runs in the browser with no install, and gives the PyMOL command beside each step.

## Start from one structure and a clear view

A figure makes one point, so remove what does not serve it. For 1HSG that means the waters, and for most structures it means any chain that is not in the story.

1. Open the [PDB viewer](/app/pdb-viewer), type `1HSG` into the search box and press `Enter`.
2. In the panel beside the canvas, click the eye icon on the `HOH` row to hide the waters.
3. Drag to rotate, scroll to zoom, and stop when the feature you want to show faces you. `Reset the view`, at the bottom right of the canvas, undoes a bad turn.

Rotate before you style. A view that hides the active site behind a loop cannot be fixed by colour. In PyMOL, `fetch 1hsg` downloads the entry as mmCIF by default, `remove solvent` deletes the waters and `orient` lines the structure up with the screen axes.

## Choose cartoon, surface or sticks

The three styles answer different questions, and a figure usually needs one of them for the whole protein and a second only for the part under discussion. A ribbon diagram or protein cartoon, the same thing under two names, shows how the chain folds. A surface shows what a ligand or partner can touch. Sticks show atoms and bonds, which only matter for a few residues.

  <caption><strong>Table 1. What each style shows and when to use it.</strong> The names are those in the PDB viewer's `Representation` menu; the PyMOL commands are `show cartoon`, `show surface` and `show sticks`.</caption>
  <thead>
    <tr>
      <th scope="col">Style</th>
      <th scope="col">Shows</th>
      <th scope="col">Use it for</th>
      <th scope="col">Avoid it when</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Cartoon</td>
      <td>Backbone path, helices as coils and strands as arrows</td>
      <td>Fold, topology, domain layout, overall comparisons</td>
      <td>The point is a specific atom contact</td>
    </tr>
    <tr>
      <td>Surface</td>
      <td>The outline a solvent probe can reach</td>
      <td>Pockets, interfaces, electrostatic or hydrophobic patches</td>
      <td>Secondary structure matters, because the surface hides it</td>
    </tr>
    <tr>
      <td>Sticks</td>
      <td>Every heavy atom and bond of the chosen residues</td>
      <td>A ligand, a mutated residue, a catalytic triad</td>
      <td>More than a few dozen residues, where they become clutter</td>
    </tr>
  </tbody>

In the viewer, point at `Representation`, the top button of the toolbar on the left of the canvas, and check `Cartoon`, `Surface` or `Sticks`. With nothing selected the menu acts on the whole structure; with something selected, its title changes to the selection and a style is added to it only. That is how you get a cartoon protein with one ligand in sticks.

## Colour by chain, secondary structure, B-factor, pLDDT or hydrophobicity

Colour should carry one message that the caption can state in a sentence. Open `Color` in the toolbar and pick a scheme: `Chain`, `Secondary structure`, `Element`, `B-factor`, `pLDDT` or `Hydrophobicity`. As with styles, a selection limits the colour to itself.

  <caption><strong>Table 2. Which colouring answers which question.</strong> In PyMOL, `util.cbc` colours by chain, `spectrum b` by B-factor and `color red, ss h` a secondary structure type.</caption>
  <thead>
    <tr>
      <th scope="col">Colouring</th>
      <th scope="col">Answers</th>
      <th scope="col">Watch for</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Chain</td>
      <td>Which subunit is which</td>
      <td>Two similar hues merge in greyscale print</td>
    </tr>
    <tr>
      <td>Secondary structure</td>
      <td>Where the helices and strands are</td>
      <td>Says little about an all-strand protein such as 1HSG</td>
    </tr>
    <tr>
      <td>B-factor</td>
      <td>How mobile or disordered atoms were in the crystal</td>
      <td>The scale is relative to one entry, so give the range and compare only within a structure</td>
    </tr>
    <tr>
      <td>pLDDT</td>
      <td>How confident a prediction is, residue by residue</td>
      <td>Meaningful only for predicted models; crystal structures keep B-factors in the same column</td>
    </tr>
    <tr>
      <td>Hydrophobicity</td>
      <td>Where greasy and polar patches sit</td>
      <td>Which scale is used, and the red to green default</td>
    </tr>
  </tbody>

### B-factor

`B-factor` colours each atom by its temperature factor, so flexible loops stand apart from the rigid core.  The number depends on the refinement program and the entry, so a loop that is red in one structure is not comparable with a red loop in another. State the range in the caption. In PyMOL, `spectrum b, blue_white_red` does the same, and `minimum=` and `maximum=` fix the range.

### pLDDT

A predicted model stores its confidence where a crystal structure stores B-factors, and `pLDDT` reads that column and colours by the usual [pLDDT](/guides/plddt) bands: above 90 very high, 70 to 90 confident, 50 to 70 low and below 50 very low.

To get a model to colour, search for a UniProt accession in the viewer, or predict one with [AlphaFold 2](/app/alphafold-2) or [ESMFold](/app/esmfold).

### Hydrophobicity

The viewer has two hydrophobicity colourings, and they use different scales. `Color`, then `Hydrophobicity`, uses the Wimley and White scale for residues at membrane interfaces. Under `By attribute` in the same menu, the Kyte-Doolittle entry colours by Kyte and Doolittle's [hydropathy index](/guides/kyte-doolittle-hydropathy). Name the scale in the caption either way.

The `Hydrophobicity` colouring runs from red to green by default. Cell Press asks authors not to put red and green together in a figure, so for a figure that goes to a journal choose a palette in `By attribute` that runs blue, white, red instead. PyMOL has no built-in command for hydrophobicity; the PyMOL Wiki hosts a `color_h` script that uses the Eisenberg scale.

## Highlight a ligand and its contacts

The usual figure is a protein in pale cartoon with the ligand in sticks and its contacts marked. 1HSG holds the inhibitor indinavir, listed as `MK1`.

1. Click `MK1` in the `Ligands` list. The viewer selects it and zooms in.
2. Open `Color` and choose `Element`. The menu title names the selection, so only the ligand changes.
3. Click `Clear` above the selection so later steps act on everything again.
4. Click `Ligand interactions`, the first button of the second toolbar group. With `Show contacts in 3D` on, dashed lines join the ligand to the residues it touches and the residues are labelled.

The panel lists each contact with its type and distance in ångströms, so the figure and the table agree. If the labels overlap, hide the kinds of contact you are not discussing with the coloured switches above the table. For the chemistry of what the dashes mean, see [protein-ligand interactions](/guides/protein-ligand-interactions).

In PyMOL, `show sticks, resn MK1` draws the ligand and `distance hbonds, resn MK1, polymer, 3.5, mode=2` draws polar contacts, where `mode=2` shows only polar contact distances.

## Light the scene and set the background

`Lighting`, in the toolbar, has four settings: `Flat`, `Outline`, `Soft shadows` and `Ray traced`. `Flat` is standard lighting. `Outline` draws flat colour with black outlines, like an illustration. `Soft shadows` darkens crevices. `Ray traced` bounces light between surfaces and casts soft shadows.

The canvas looks grainy while you turn the structure and sharpens within a second or two once you stop. The exported image traces for longer than the canvas does, so it is cleaner than what you see. The option appears only when your graphics card supports it in the browser; on older or integrated graphics, `Soft shadows` is the closest look.

In PyMOL, `ray` renders the current view with its own ray tracer, which can take several minutes for a complex scene. `set ray_trace_mode, 1` adds black outlines.

Background is a choice in the export dialog, covered next. Pick `White` for a journal. Pick `Transparent` for slides and posters, so the slide colour shows through behind the protein.

## Export the image at the journal's size

Open `Export`, the download button at the bottom of the left toolbar, and stay on the `Image` tab. `Size` offers `1×`, `2×` and `4×` the canvas, or `Custom` for a width and height in pixels. The line under it shows the result, for example 2408 × 2044 px at `2×` in a 1,600 px wide browser window.

`Background` is `Transparent`, `White` or `Black`. `Download PNG` renders the image in the lighting you chose, and `Copy` puts it on the clipboard.

Journals ask for a width in millimetres and a resolution in dots per inch, so convert before you pick a size. The number of pixels is the width in millimetres divided by 25.4, times 300:

$$\text{pixels} = \frac{\text{width in mm}}{25.4} \times 300$$

  <caption><strong>Table 3. Figure widths at 300 dpi.</strong> Widths are the journals' own; we calculated the pixels. Nature lists 89 mm and 183 mm as its standard sizes, with 120 to 136 mm as a column and a half; Cell Press lists maximum widths for research articles.</caption>
  <thead>
    <tr>
      <th scope="col">Journal</th>
      <th scope="col">Column</th>
      <th scope="col">Width</th>
      <th scope="col">Pixels at 300 dpi</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Nature</td>
      <td>Single</td>
      <td>89 mm</td>
      <td>1,051</td>
    </tr>
    <tr>
      <td>Nature</td>
      <td>One and a half</td>
      <td>120 to 136 mm</td>
      <td>1,417 to 1,606</td>
    </tr>
    <tr>
      <td>Nature</td>
      <td>Double</td>
      <td>183 mm</td>
      <td>2,161</td>
    </tr>
    <tr>
      <td>Cell Press</td>
      <td>Single</td>
      <td>8.5 cm</td>
      <td>1,004</td>
    </tr>
    <tr>
      <td>Cell Press</td>
      <td>One and a half</td>
      <td>11.4 cm</td>
      <td>1,346</td>
    </tr>
    <tr>
      <td>Cell Press</td>
      <td>Full width</td>
      <td>17.4 cm</td>
      <td>2,055</td>
    </tr>
  </tbody>

Nature wants photographic images at a minimum of 300 dpi at the largest size they will be used, and says that raising the resolution in an art program does not improve quality. Cell Press asks for at least 300 dpi for colour figures at the desired print size. A rendered protein is not a photograph, but the safe reading is the same: export at the pixel width in the table or larger, and never enlarge a small export afterwards.

To export at an exact size, choose `Custom` and type the width in pixels. The height follows from what you type, so check it against the journal's depth limit. A size beyond what your graphics card can render is reduced, and the dialog marks it.

The command line takes the same request in PyMOL's syntax. `png figure.png, 10cm, dpi=300` saves an image 10 cm wide at 300 dpi, which is 1,181 pixels, and a missing height keeps the canvas's proportions. 

The file format depends on the journal. Cell Press lists TIFF, PDF, EPS, JPG, PSD and PNG for production files. Nature prefers TIFF or layered PSD for raster images and accepts high-resolution JPEG, but does not list PNG. Export a white background first, then convert with Python and Pillow:
```python
from PIL import Image

Image.open("figure.png").convert("RGB").save(
    "figure.tif", dpi=(300, 300), compression="tiff_lzw"
)
```
Nature recommends RGB and Cell Press asks for it when colour is used, and the conversion keeps RGB. It also drops the transparency channel, which is why the white background matters.

## The same figure in PyMOL

PyMOL separates drawing from saving: `ray` renders the view with the ray tracer and `png` writes it. Giving `png` the option `ray=1` runs the ray trace first, at the size you ask for. The commands below build the same figure as the steps above.

The viewer's `Command line`, at the bottom of the canvas, accepts PyMOL syntax, so you can try them there. It reads `png` the same way, but its `ray` turns on `Ray traced` lighting, and the `ray=1` option of `png` is accepted without changing anything, because every export is rendered off screen. 

  <caption><strong>Table 4. Viewer steps and their PyMOL commands.</strong> PyMOL syntax is from the PyMOL command reference and the PyMOL Wiki.</caption>
  <thead>
    <tr>
      <th scope="col">Step</th>
      <th scope="col">In the viewer</th>
      <th scope="col">In PyMOL</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Open the entry</td>
      <td>Search for `1HSG`</td>
      <td>`fetch 1hsg`</td>
    </tr>
    <tr>
      <td>Remove the waters</td>
      <td>Hide the `HOH` row</td>
      <td>`remove solvent`</td>
    </tr>
    <tr>
      <td>Cartoon, surface, sticks</td>
      <td>`Representation`</td>
      <td>`show cartoon`, `show surface`, `show sticks, resn MK1`</td>
    </tr>
    <tr>
      <td>Colour by chain</td>
      <td>`Color`, `Chain`</td>
      <td>`util.cbc`</td>
    </tr>
    <tr>
      <td>Colour by B-factor</td>
      <td>`Color`, `B-factor`</td>
      <td>`spectrum b, blue_white_red`</td>
    </tr>
    <tr>
      <td>Secondary structure</td>
      <td>`Color`, `Secondary structure`</td>
      <td>`color red, ss h` and `color yellow, ss s`</td>
    </tr>
    <tr>
      <td>White background</td>
      <td>`Export`, `Background`, `White`</td>
      <td>`bg_color white`</td>
    </tr>
    <tr>
      <td>Transparent background</td>
      <td>`Export`, `Background`, `Transparent`</td>
      <td>`set ray_opaque_background, off`</td>
    </tr>
    <tr>
      <td>Ray-traced lighting</td>
      <td>`Lighting`, `Ray traced`</td>
      <td>`ray`</td>
    </tr>
    <tr>
      <td>Save at 10 cm and 300 dpi</td>
      <td>`Export`, `Image`, `Custom`</td>
      <td>`png figure.png, 10cm, dpi=300, ray=1`</td>
    </tr>
  </tbody>

A complete PyMOL session for the opening figure reads:
```text
fetch 1hsg
remove solvent
orient
show cartoon, polymer
util.cbc
show sticks, resn MK1
bg_color white
png figure.png, 10cm, dpi=300, ray=1
```
PyMOL's reference gives `unset opaque_background` followed by `ray` as the route to a transparent background, and the PyMOL Wiki describes the same switch as `ray_opaque_background`, which when off treats the background as an alpha channel. The reference adds that PNG is the only image format PyMOL writes, so the TIFF step above applies there too.

## Common mistakes

  <caption><strong>Table 5. Mistakes that survive until a reviewer sees the figure.</strong></caption>
  <thead>
    <tr>
      <th scope="col">Problem</th>
      <th scope="col">What you see</th>
      <th scope="col">Fix</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Screenshot of the window instead of an export</td>
      <td>Toolbar and panel in the figure, pixelated at print size</td>
      <td>Use `Export`, `Image`; it renders the canvas alone at the size you choose</td>
    </tr>
    <tr>
      <td>Pixel width too small for the column</td>
      <td>A blurred figure once the layout program scales it to 89 mm</td>
      <td>Use the pixel widths in Table 3 or larger</td>
    </tr>
    <tr>
      <td>Transparent PNG sent to a journal</td>
      <td>An unexpected background after the file is flattened</td>
      <td>Export with a white background</td>
    </tr>
    <tr>
      <td>pLDDT colours on a crystal structure</td>
      <td>Meaningless blues and oranges taken from B-factors</td>
      <td>Use `B-factor` for crystal structures and `pLDDT` for predictions only</td>
    </tr>
    <tr>
      <td>Red and green used together</td>
      <td>A figure that readers with red-green colour blindness cannot parse</td>
      <td>Choose a blue, white, red palette</td>
    </tr>
    <tr>
      <td>No scale or range in the caption</td>
      <td>A B-factor or hydrophobicity figure no one can read quantitatively</td>
      <td>Give the attribute, scale and range in the caption</td>
    </tr>
  </tbody>

## After the figure

A still figure is one view. To show a structure from several sides in a talk, [make a protein animation](/guides/protein-animation) from the same scene. To hold it in your hand, [3D print the protein](/guides/3d-print-protein) from the viewer's STL export. The [PyMOL commands cheat sheet](/guides/pymol-commands) lists the rest of the syntax the viewer's command line understands, and the [pLDDT guide](/guides/plddt) helps you decide which parts of a prediction deserve a bright colour.

If the entry is the starting point rather than a file, [how to open a PDB file](/guides/open-pdb-file) covers every route in. For a flat contact diagram that a journal can print in black and white, [PLIP](/app/plip) draws protein-ligand interactions from the same structure.

## Frequently asked questions

### What resolution do journals want for protein figures?

Nature wants at least 300 dpi at the largest size a photographic image will be used, and Cell Press wants at least 300 dpi for colour figures at the desired print size. At 300 dpi an 89 mm column is 1,051 pixels wide.

### How do I make a transparent PNG of a protein?

In the PDB viewer, set `Background` to `Transparent` on the `Image` tab of `Export` and click `Download PNG`. In PyMOL, turn off `ray_opaque_background` and ray trace.

### What is the difference between ray and png in PyMOL?

`ray` renders the current view with PyMOL's ray tracer. `png` writes the image to disk, and its `ray=1` option runs the ray trace first at the size given.

### How do I colour a protein by B-factor?

In the PDB viewer, open `Color` and choose `B-factor`. In PyMOL, run `spectrum b, blue_white_red`.

### Should I use cartoon, surface or sticks?

Cartoon for the fold, surface for what a partner can touch and sticks for the few residues under discussion. Most figures combine a cartoon for the protein with sticks for one ligand.
