[Rdkit-discuss] High-quality matplotlib drawing?
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Wout B. <wbi...@uc...> - 2019-08-08 00:20:48
|
Dear RDKit team, I'm trying to draw a molecule on a spectrum plot from Matplotlib using MolToImage. This is some abbreviated code: ``` import matplotlib.pyplot as plt from rdkit import Chem from rdkit.Chem import Draw fig, ax = plt.subplots() ax.plot(...) im = Draw.MolToImage(Chem.MolFromSmiles(smiles)) ax.imshow(im, aspect='auto', extent=(x, x+width, y, y + height)) plt.savefig('fig.pdf') plt.close() ``` Unfortunately the quality of the molecule drawing is rather poor (see attachment; nonsensical spectrum and molecule). This seems to be true for non-SVG drawing in general, and unfortunately it's not really possible to combine SVG output with Matplotlib functionality. Is there any way I can improve the quality of the MolToImage output? I've tried to change some of the DrawingOptions, but the result always remains very pixelated and low quality. Thank you, Wout |