class rmgpy.molecule.draw.MoleculeDrawer(options=None)

This class provides functionality for drawing the skeletal formula of molecules using the Cairo 2D graphics engine. The most common use case is simply:

MoleculeDrawer().draw(molecule, file_format='png', path='molecule.png')

where molecule is the Molecule object to draw. You can also pass a dict of options to the constructor to affect how the molecules are drawn.

draw(molecule, file_format, target=None)

Draw the given molecule using the given image file_format - pdf, svg, ps, or png. If path is given, the drawing is saved to that location on disk. The options dict is an optional set of key-value pairs that can be used to control the generated drawing.

This function returns the Cairo surface and context used to create the drawing, as well as a bounding box for the molecule being drawn as the tuple (left, top, width, height).

render(cr, offset=None)

Uses the Cairo graphics library to create a skeletal formula drawing of a molecule containing the list of atoms and dict of bonds to be drawn. The 2D position of each atom in atoms is given in the coordinates array. The symbols to use at each atomic position are given by the list symbols. You must specify the Cairo context cr to render to.