That's an interesting question. I think there probably are some ways of
tweaking this and improving things, but I don't have a convenient way to
test. If you can share the python (+data) you used to construct that PDF I
will see if I can come up with a solution.

-greg


On Thu, Aug 8, 2019 at 2:23 AM Wout Bittremieux <wbittremi...@ucsd.edu>
wrote:

> 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
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to