How to make publication quality images with PyMOL


If you’re into computational chemistry and want to share your research with the world, at some point you will need to know how to make publication-quality images.

High-quality images are essential for communicating your research findings to the scientific community. As a computational or non-computational chemist, you may be using molecular visualization software to generate images that represent the structures of molecules or proteins, and these images can be used in publications, presentations, and posters to illustrate your results.

Additionally, by creating clear and visually appealing images, you can make it easier for readers to understand the structure and function of the molecules you are studying, which can help to make your research more accessible to a wider audience.



When it comes to visualizing molecular structures for computational chemistry research, there are various software tools available in the market.

While each of these software tools has its own strengths and weaknesses, PyMOL is widely regarded as one of the most powerful and versatile tools for creating high-quality images of molecular structures. With PyMOL, you can produce a range of images, from simple small molecule representations to complex 3D macromolecule structures.

That being said, mastering PyMOL can be intimidating for beginners. But don’t worry, in this blog post, I will guide you through the process of creating publication-quality images in PyMOL. I will show some tips to create stunning images that are perfect for your research.

In this tutorial, I will take for granted that you know how PyMOL works and how to use the built-in command line. If you don’t, here is an introductory article to PyMOL.



The first thing you want to accomplish to generate an image is to adjust the view of the molecule or protein structure. You can use your mouse to get the view that best fits your needs but you can also use the command line to make sure that the system is properly oriented and centered in the interface. To this aim, we can use the orient and center commands in PyMOL.

To orient your system with the XYZ axis you can type:



If you want to center it you can use:



Both of these commands can be used with a selection meaning that you can choose a set of atoms and use them to orient or center your system based on them. If you are not familiar with the PyMOL selection tool you can find more info here


To center your view on residue 110:

center resi 110

To orient the view on a ligand named LIG you can use:

orient resn LIG



Here comes the best part. If you are here you are probably wondering how to render high-quality images with PyMOL. The good news is that this process is quite intuitive in PyMOL.

This is due to the built-in ray tracing technology that allows you to generate high-quality images of molecular structures with realistic shadows, reflections, and transparency effects. The kind of fancy images you generally find in papers and presentations.

As already mentioned, the procedure is quite easy.

You just need to set up the view according to your needs, and then you can simply type ray in the PyMOL command line and hit enter:



Easy as that. PyMOL will then start the ray tracing process and generate an image of the current scene, which you can export and use as you want.

Beware that the ray-tracing procedure may take some time depending on your computer and the complexity of the system you want to represent. Be patient.

You can also specify different parameters to control the ray-tracing process. Among others, you can choose to scale the width and height of the figure:

ray <width>, <height>


For instance:

ray 1280,720

will ray trace the current scene, but scaled to 1280x720 pixels.



It’s not over yet. PyMOL also offers different ray trace modalities.

You can choose them with the set ray_trace_mode command. Four modes are available and you can select them with 0, 1, 2, and 3. After the selection, you simply need to run the ray command to start the rendering.

Here is what they look like:

  • set ray_trace_mode, 0: The default rendering mode for PyMOL displaying natural colors.
Default ray trace mode of a protein in PyMOL.
  • set ray_trace_mode, 1: This mode gives natural colors with black outlines.
 Ray trace mode with the black outline of a protein in PyMOL
  • set ray_trace_mode, 2: Black outline with no colors.
 Black and white ray trace mode of a protein in PyMOL.
  • set ray_trace_mode, 3: quantized color with black outline.
 Ray trace mode of a protein in PyMOL with quantized colors plus black outline

Notice that you can change the color of the outline with the set ray_trace_color command.

set ray_trace_color, green
set ray_trace_mode, 3
 Ray trace mode of a protein in PyMOL with quantized colors plus green outline



A black background color is rarely useful for publication types of images. Therefore, while we already discuss how to change the color and the appearance of your system here, we still need to discuss how to change the background color in PyMOL.

To change the background color in PyMOL use the bg_color command followed by the color you want.

bg_color <color>


Some examples:

# Change the background color to white
bg_color white

# Change the background color to black
bg_color black

# Change the background color to green
bg_color green


In some cases, you may also want to create a representation of your system with an opaque background. This is especially useful when you want to overlay your molecular structure on top of another image or integrate it into a larger design (e.g., a poster or a presentation).

To achieve this you need to use the set ray_opaque_background command. You can set the opaque background on or off:

  • set ray_opaque_background, on $\Rightarrow$ Non-transparent background
  • set ray_opaque_background, off$\Rightarrow$ Transparent background


This will make the background transparent and export the image with a transparent background:

set ray_opaque_background, off


The image from PyMOL will be shown over a checkerboard and will only appear transparent once you export it.