Instead of arbitrarily generating 2D coordinates (which can have any orientation), you probably want to use GenerateDepictionMatching2DStructure() to generate coordinates which match a common orientation for a substructure.
See http://www.rdkit.org/docs/GettingStartedInPython.html#drawing-molecules for an example of how to use it. Note that this does require you to have a common core with which to align the depictions, but some of that can be automated with FindMCS (see http://www.rdkit.org/docs/GettingStartedInPython.html#maximum-common-substructure ). On Thu, Sep 20, 2018 at 4:54 PM, Jason Klima <[email protected]> wrote: > Hi, > I would like to visualize the following resonance structures in the same > orientation (i.e. the same atomic coordinates), however, the image on the > right appears to be drawn upside down compared to the image on the left, > while the element names (e.g. N, O, and F) in both images are right side > up. Mirroring the image on the right about a horizontal axis can be > accomplished with ax.set_ylim([0,300]) however the element names are then > upside down. How can I mirror the drawing on the right about a horizontal > axis without mirroring element names? > > from rdkit import Chem > from rdkit.Chem import Draw > import matplotlib.pyplot as plt > def draw_structure(smiles_string, ax=None): > m = Chem.MolFromSmiles(smiles_string, sanitize=False) > m.UpdatePropertyCache() > Chem.SetHybridization(m) > # ax.set_ylim([0,300]) # Flips image but element names also flip > return ax.imshow(Draw.MolToImage(m), interpolation='bessel') > fig = plt.figure(figsize=(10,5)) > ax1 = plt.subplot2grid((1, 2), (0, 0)) > ax2 = plt.subplot2grid((1, 2), (0, 1)) > draw_structure('CN(C2=O)C(C)=N\C2=C/C1=CC(F)=C([o-])C(F)=C1', ax=ax1) > draw_structure('CN(C=2[o-])C(C)=N\C2C=C1/C=C(F)C(=O)C(F)=C1', ax=ax2) > plt.tight_layout() > plt.show() > > Output: > [image: image.png] > > Thanks, > Jason > > > _______________________________________________ > Rdkit-discuss mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > >
_______________________________________________ Rdkit-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

