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