Hi Tim,

That's a nice one.

For people not familiar with the problem:
The RDKit coordinate generation prefers aligning molecules with the X axis;
this can lead to "sub-optimal" drawings if your drawing canvas is taller
than it is wide.

One easy solution is to just generate coordinates as usual and then rotate
them to favor the Y axis if your canvas is larger along Y.
Here's a gist showing how to do that:
https://gist.github.com/greglandrum/12b793b240d27e3c0899c9c6c62d4f30

-greg


On Fri, Feb 11, 2022 at 10:20 AM Tim Dudgeon <tdudgeon...@gmail.com> wrote:

> At Dave Cosgrove's suggestion I raise this as a new topic, though it was
> touched on briefly recently.
>
> I'd like to know if it's possible to depict a molecule in a way that takes
> into account the dimensions of the box it will appear in. In my case I have
> a rectangle that is short and wide (aspect ratio of 1:3) and the molecules
> are typically compressed because of the lack of available height. So is it
> possible to make the layout engine aware of the bounds it has available
> (e.g. in my example short and wide)?
>
> Thanks
> Tim
> _______________________________________________
> 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