MoleculePlot

MoleculePlot[mol]

creates a two-dimensional structure diagram of the molecule mol.

MoleculePlot[mol,patt]

creates a diagram of mol where all atoms and bonds matching the pattern patt are highlighted.

Details and Options

  • MoleculePlot returns a Graphics expression.
  • If the molecule does not have structure diagram coordinates, they will be generated automatically.
  • Possible values for patt include any atom, bond or molecular pattern as recognized by FindMoleculeSubstructure.
  • MoleculePlot has the same options as Graphics, with the following additions and changes:
  • ColorRulesAutomatica list of rules {elem1->col1,} dictating which colors to use for atomic elements
    PlotLegendsNonelegends for highlights
    PlotTheme$PlotThemeoverall theme for the plot
  • Supported plot themes include:
  • "AllAtom"display all hydrogens
    "Aromatic"aromatic bonds are shown as dashed lines or circles
    "HeavyAtom"hydrogen atoms are elided or combined with the connected heavy atom
    "Monochrome"all text and graphics are shown in black
  • Typical settings for PlotLegends include:
  • Noneno legend
    Automaticautomatically determine legend
    {lbl1,lbl2,}use lbl1, lbl2, as legend labels
    Placed[lspec,]specify placement for legend

Examples

open all close all

Basic Examples  (1)

Create a molecule and plot it:

In[1]:=
Click for copyable input
Out[1]=

Highlight all carbon-sulfur bonds:

In[2]:=
Click for copyable input
Out[2]=

Highlight two different patterns:

In[3]:=
Click for copyable input
Out[3]=

Apply different styling to patterns:

In[4]:=
Click for copyable input
Out[4]=

Scope  (2)

Options  (3)

Introduced in 2019
(12.0)