<p>It looks like <code>rdkit</code> and <code>rdkit</code>'s <code>Chem</code> just use the <code>matplotlib</code>. So, if you import <code>matplotlib</code> you can edit your figure like any other <code>matplotlib</code> figure.</p>

<p>I produced this from the command line, so it may work differently in the Jupyter environment.</p>

<p>It looks like <code>Chem</code> doesn't properly scale the drawing based on how large the chemical is, so I added <code>plt.xlim</code> and <code>plt.ylim</code> to make the molecule larger in the frame.</p>

<pre class="lang-python prettyprint-override"><code>from rdkit import Chem
from rdkit.Chem import Draw
import matplotlib.pyplot as plt
smiles = 'CCC'
m = Chem.MolFromSmiles(smiles)
fig = Draw.MolToMPL(m)
plt.title('Test')
plt.axis('off')
coord_min = 0.35
coord_max = 0.65
plt.xlim((coord_min, coord_max))
plt.ylim((coord_min, coord_max))
fig.savefig('mol.jpeg', bbox_inches='tight')
</code></pre>

<p><a href="https://i.sstatic.net/RBrb2.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RBrb2.jpg" alt="enter image description here"></a></p>

CC BY-SA 4.0
2018-12-10T00:27:31.380Z
2018-12-10T00:34:44.660Z
2018-12-10T00:34:44.660Z
conchoecia
<p>RDKit can plot molecules, thought the structures are surrounded by an ugly frame with ticks. How can I turn that off and plot the molecules without that frame?</p>

<p>Note, the <code>%pylab inline</code> portion of this code is from the Jupyter environment.</p>

<pre><code>%pylab inline
from rdkit import Chem
from rdkit.Chem import Draw

smiles = 'CCC'
m = Chem.MolFromSmiles(smiles)
fig = Draw.MolToMPL(m)
title('Test')
</code></pre>

<p><a href="https://i.sstatic.net/gMDmg.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/gMDmg.jpg" alt="enter image description here"></a></p>

<python><visualization>
How to remove frame on RDKit figures?
# How to remove frame on RDKit figures?

(Asked by: username_0 on 2018-12-09)

RDKit can plot molecules, thought the structures are surrounded by an ugly frame with ticks. How can I turn that off and plot the molecules without that frame?
Note, the %pylab inline portion of this code is from the Jupyter environment.
%pylab inline
from rdkit import Chem
from rdkit.Chem import Draw

smiles = 'CCC'
m = Chem.MolFromSmiles(smiles)
fig = Draw.MolToMPL(m)
title('Test')

**Tags:** python, visualization

---

## 1 answers

### Answer by username_1 on 2018-12-10. Score: 2

It looks like rdkit and rdkit's Chem just use the matplotlib. So, if you import matplotlib you can edit your figure like any other matplotlib figure.
I produced this from the command line, so it may work differently in the Jupyter environment.
It looks like Chem doesn't properly scale the drawing based on how large the chemical is, so I added plt.xlim and plt.ylim to make the molecule larger in the frame.
from rdkit import Chem
from rdkit.Chem import Draw
import matplotlib.pyplot as plt
smiles = 'CCC'
m = Chem.MolFromSmiles(smiles)
fig = Draw.MolToMPL(m)
plt.title('Test')
plt.axis('off')
coord_min = 0.35
coord_max = 0.65
plt.xlim((coord_min, coord_max))
plt.ylim((coord_min, coord_max))
fig.savefig('mol.jpeg', bbox_inches='tight')


---

