rdkit.Chem.Draw.rdMolDraw2D module — The RDKit 2025.09.6 documentation

# rdkit.Chem.Draw.rdMolDraw2D module

Module containing a C++ implementation of 2D molecule drawing

rdkit.Chem.Draw.rdMolDraw2D.ContourAndDrawGaussians((MolDraw2D)drawer, (object)locs, (object)heights, (object)widths[, (int)nContours=10[, (object)levels=None[, (ContourParams)params=<rdkit.Chem.Draw.rdMolDraw2D.ContourParams object at 0x7b87fc4ae110>[, (object)mol=None]]]]) → None :

  Generates and draws contours for a set of gaussians

  > - drawer: the MolDraw2D object to use

  > - locs: locations of the gaussians

  > - heights: the heights (or weights) of the gaussians

  > - widths: the standard deviations of the gaussians

  > - nContours: the number of contours to draw

  > - levels: the contours to use

  > - ps: additional parameters controlling the contouring.

  > - mol: molecule used to help set scale.

  > The values are calculated on a grid with spacing params.gridResolution. If params.setScale is set, the grid size will be calculated based on the locations of the gaussians and params.extraGridPadding. Otherwise the current size of the viewport will be used.

  > If the levels argument is empty, the contour levels will be determined automatically from the max and min values on the grid and levels will be updated to include the contour levels.

  > If params.fillGrid is set, the data on the grid will also be drawn using the color scheme in params.colourMap

  > If mol is not 0, uses the molecule to help set the scale, assuming that it will be drawn over the plot, so needs to fit on it.

  */

  C++ signature :

    void ContourAndDrawGaussians(RDKit::MolDraw2D {lvalue},boost::python::api::object,boost::python::api::object,boost::python::api::object [,unsigned int=10 [,boost::python::api::object=None [,RDKit::MolDraw2DUtils::ContourParams=<rdkit.Chem.Draw.rdMolDraw2D.ContourParams object at 0x7b87fc4ae110> [,boost::python::api::object=None]]]])

rdkit.Chem.Draw.rdMolDraw2D.ContourAndDrawGrid((MolDraw2D)drawer, (object)data, (object)xcoords, (object)ycoords[, (int)nContours=10[, (object)levels=None[, (ContourParams)params=<rdkit.Chem.Draw.rdMolDraw2D.ContourParams object at 0x7b87fc4ae200>[, (object)mol=None]]]]) → None :

  Generates and draws contours for data on a grid

  > - drawer: the MolDraw2D object to use

  > - data: numpy array with the data to be contoured

  > - xcoords: the x coordinates of the grid

  > - ycoords: the y coordinates of the grid

  > - nContours: the number of contours to draw

  > - levels: the contours to use

  > - ps: additional parameters controlling the contouring

  > - mol: molecule used to help set scale.

  > The values are calculated on a grid with spacing params.gridResolution. If params.setScale is set, the grid size will be calculated based on the locations of the gaussians and params.extraGridPadding. Otherwise the current size of the viewport will be used.

  > If the levels argument is empty, the contour levels will be determined automatically from the max and min values on the grid and levels will be updated to include the contour levels.

  > If params.fillGrid is set, the data on the grid will also be drawn using the color scheme in params.colourMap

  > If mol is not 0, uses the molecule to help set the scale, assuming that it will be drawn over the plot, so needs to fit on it.

  */

  C++ signature :

    void ContourAndDrawGrid(RDKit::MolDraw2D {lvalue},boost::python::api::object {lvalue},boost::python::api::object {lvalue},boost::python::api::object {lvalue} [,unsigned int=10 [,boost::python::api::object {lvalue}=None [,RDKit::MolDraw2DUtils::ContourParams=<rdkit.Chem.Draw.rdMolDraw2D.ContourParams object at 0x7b87fc4ae200> [,boost::python::api::object=None]]]])

class rdkit.Chem.Draw.rdMolDraw2D.ContourParams((object)self) → None :

  Bases: `instance`

  Parameters for drawing contours

  C++ signature :

    void __init__(_object*)

  property colourMap

    the color map to use when filling the grid

  property contourColour

    the color to use for drawing the contours

  property contourWidth

    line width of the contours

  property coordScaleForQuantization

    scaling factor used to convert coordinates to ints when forming the continuous lines

  property dashNegative

    use a dashed line for negative contours

  property drawAsLines

    draw the contours as continuous lines isntead of line segments

  property extraGridPadding

    extra space (in molecule coords) around the grid

  property fillGrid

    colors the grid in addition to drawing contours

  property fillThreshold

    magnitude threshold to determine if a grid point is filled

  property fillThresholdIsFraction

    if true, fillThreshold is a fraction of the range of the data

  property gridResolution

    set the resolution of the grid

  property isovalScaleForQuantization

    scaling factor used to convert isovalues to ints when forming the continuous lines

  setColourMap((ContourParams)self, (object)colours) → None :
    C++ signature :

      void setColourMap(RDKit::MolDraw2DUtils::ContourParams {lvalue},boost::python::api::object)

  setContourColour((ContourParams)self, (tuple)colour) → None :
    C++ signature :

      void setContourColour(RDKit::MolDraw2DUtils::ContourParams {lvalue},boost::python::tuple)

  property setScale

    set the scale of the drawing object (useful if you draw the grid/contours first)

  property useFillThreshold

    use a magnitude threshold to determine if a grid point is filled

class rdkit.Chem.Draw.rdMolDraw2D.DrawElement

  Bases: `enum`

  ALL = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ALL
  ANNOTATIONS = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ANNOTATIONS
  ATOMLABELS = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ATOMLABELS
  BONDS = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.BONDS
  HIGHLIGHTS = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.HIGHLIGHTS
  NONE = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.NONE
  POSTSHAPES = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.POSTSHAPES
  PRESHAPES = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.PRESHAPES
  RADICALS = rdkit.Chem.Draw.rdMolDraw2D.DrawElement.RADICALS
  names = {'ALL': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ALL, 'ANNOTATIONS': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ANNOTATIONS, 'ATOMLABELS': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ATOMLABELS, 'BONDS': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.BONDS, 'HIGHLIGHTS': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.HIGHLIGHTS, 'NONE': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.NONE, 'POSTSHAPES': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.POSTSHAPES, 'PRESHAPES': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.PRESHAPES, 'RADICALS': rdkit.Chem.Draw.rdMolDraw2D.DrawElement.RADICALS}
  values = {0: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.NONE, 1: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.PRESHAPES, 2: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.BONDS, 4: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ATOMLABELS, 8: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.HIGHLIGHTS, 16: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ANNOTATIONS, 32: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.RADICALS, 64: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.POSTSHAPES, 2147483647: rdkit.Chem.Draw.rdMolDraw2D.DrawElement.ALL}

rdkit.Chem.Draw.rdMolDraw2D.DrawMoleculeACS1996((MolDraw2D)drawer, (rdkit.Chem.rdchem.Mol)mol[, (str)legend=''[, (object)highlightAtoms=None[, (object)highlightBonds=None[, (object)highlightAtomColors=None[, (object)highlightBondColors=None[, (object)highlightAtomRadii=None[, (int)confId=-1]]]]]]]) → None :

  Draws molecule in ACS 1996 mode.

  C++ signature :

    void DrawMoleculeACS1996(RDKit::MolDraw2D {lvalue},RDKit::ROMol [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’ [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1]]]]]]])

class rdkit.Chem.Draw.rdMolDraw2D.IntStringMap((object)arg1) → None :

  Bases: `instance`

  C++ signature :

    void __init__(_object*)

rdkit.Chem.Draw.rdMolDraw2D.MeanBondLength((rdkit.Chem.rdchem.Mol)mol[, (int)confId=-1]) → float :

  Calculate the mean bond length for the molecule.

  C++ signature :

    double MeanBondLength(RDKit::ROMol [,int=-1])

class rdkit.Chem.Draw.rdMolDraw2D.MolDraw2D

  Bases: `instance`

  Drawer abstract base class

  Raises an exception This class cannot be instantiated from Python

  ClearDrawing((MolDraw2D)self) → None :

    clears the drawing by filling it with the background color

    C++ signature :

      void ClearDrawing(RDKit::MolDraw2D {lvalue})

  DrawArc((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)center, (float)radius, (float)angle1, (float)angle2[, (bool)rawCoords=False]) → None :

    draws an arc with the current drawing style. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.The angles are in degrees; angle2 should be > angle1.

    C++ signature :

      void DrawArc(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,double,double,double [,bool=False])

  DrawArrow((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)cds1, (rdkit.Geometry.rdGeometry.Point2D)cds2[, (bool)asPolygon=False[, (float)frac=0.05[, (float)angle=0.5235987755982988[, (object)color=None[, (bool)rawCoords=False]]]]]) → None :

    draws an arrow with the current drawing style. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels. If asPolygon is true the head of the arrow will be drawn as a triangle, otherwise two lines are used. The fraction of the arrow length to use for the head is given by frac. The angle of the arrowhead (the angle between the main line and each arrowhead line) is given by angle. The color is a tuple of 3 floats (0-1) in red, green, blue (RGB) order.

    C++ signature :

      void DrawArrow(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,RDGeom::Point2D [,bool=False [,double=0.05 [,double=0.5235987755982988 [,boost::python::api::object=None [,bool=False]]]]])

  DrawAttachmentLine((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)cds1, (rdkit.Geometry.rdGeometry.Point2D)cds2, (tuple)color[, (float)len=1.0[, (int)nSegments=16[, (bool)rawCoords=False]]]) → None :

    draw a line indicating the presence of an attachment point (normally a squiggle line perpendicular to a bond). The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    C++ signature :

      void DrawAttachmentLine(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,RDGeom::Point2D,boost::python::tuple {lvalue} [,double=1.0 [,unsigned int=16 [,bool=False]]])

  DrawEllipse((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)cds1, (rdkit.Geometry.rdGeometry.Point2D)cds2[, (bool)rawCoords=False]) → None :

    draws a triangle with the current drawing style in the rectangle defined by the two points. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    C++ signature :

      void DrawEllipse(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,RDGeom::Point2D [,bool=False])

  DrawLine((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)cds1, (rdkit.Geometry.rdGeometry.Point2D)cds2[, (bool)rawCoords=False]) → None :

    draws a line with the current drawing style. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    C++ signature :

      void DrawLine(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,RDGeom::Point2D [,bool=False])

  DrawMolecule((MolDraw2D)self, (rdkit.Chem.rdchem.Mol)mol[, (object)highlightAtoms=None[, (object)highlightAtomColors=None[, (object)highlightAtomRadii=None[, (int)confId=-1[, (str)legend='']]]]]) → None :

    renders a molecule

    > C++ signature :

    >   void DrawMolecule(RDKit::MolDraw2D {lvalue},RDKit::ROMol [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1 [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’]]]]])

    DrawMolecule( (MolDraw2D)self, (rdkit.Chem.rdchem.Mol)mol, (object)highlightAtoms, (object)highlightBonds [, (object)highlightAtomColors=None [, (object)highlightBondColors=None [, (object)highlightAtomRadii=None [, (int)confId=-1 [, (str)legend=’’]]]]]) -> None :

      renders a molecule

      C++ signature :

        void DrawMolecule(RDKit::MolDraw2D {lvalue},RDKit::ROMol,boost::python::api::object,boost::python::api::object [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1 [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’]]]]])

  DrawMoleculeWithHighlights((MolDraw2D)self, (rdkit.Chem.rdchem.Mol)mol, (str)legend, (object)highlight_atom_map, (object)highlight_bond_map, (object)highlight_radii, (object)highlight_linewidth_multipliers[, (int)confId=-1]) → None :

    renders a molecule with multiple highlight colours

    C++ signature :

      void DrawMoleculeWithHighlights(RDKit::MolDraw2D {lvalue},RDKit::ROMol,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,boost::python::api::object,boost::python::api::object,boost::python::api::object,boost::python::api::object [,int=-1])

  DrawMolecules((MolDraw2D)self, (object)mols[, (object)highlightAtoms=None[, (object)highlightBonds=None[, (object)highlightAtomColors=None[, (object)highlightBondColors=None[, (object)highlightAtomRadii=None[, (object)confIds=None[, (object)legends=None]]]]]]]) → None :

    renders multiple molecules

    C++ signature :

      void DrawMolecules(RDKit::MolDraw2D {lvalue},boost::python::api::object [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None]]]]]]])

  DrawPolygon((MolDraw2D)self, (object)cds[, (bool)rawCoords=False]) → None :

    draws a polygon with the current drawing style. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    C++ signature :

      void DrawPolygon(RDKit::MolDraw2D {lvalue},boost::python::api::object [,bool=False])

  DrawReaction((MolDraw2D)self, (object)rxn[, (bool)highlightByReactant=False[, (object)highlightColorsReactants=None[, (object)confIds=None]]]) → None :

    renders a reaction

    C++ signature :

      void DrawReaction(RDKit::MolDraw2D {lvalue},RDKit::ChemicalReaction [,bool=False [,boost::python::api::object=None [,boost::python::api::object=None]]])

  DrawRect((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)cds1, (rdkit.Geometry.rdGeometry.Point2D)cds2[, (bool)rawCoords=False]) → None :

    draws a rectangle with the current drawing style in the rectangle defined by the two points. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    C++ signature :

      void DrawRect(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,RDGeom::Point2D [,bool=False])

  DrawString((MolDraw2D)self, (str)string, (rdkit.Geometry.rdGeometry.Point2D)pos[, (bool)rawCoords=False]) → None :

    add text to the canvas. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    > C++ signature :

    >   void DrawString(RDKit::MolDraw2D {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,RDGeom::Point2D [,bool=False])

    DrawString( (MolDraw2D)self, (str)string, (rdkit.Geometry.rdGeometry.Point2D)pos, (int)align [, (bool)rawCoords=False]) -> None :

      add aligned text to the canvas. The align argument can be 0 (=MIDDLE), 1 (=START), or 2 (=END).The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

      C++ signature :

        void DrawString(RDKit::MolDraw2D {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,RDGeom::Point2D,int [,bool=False])

  DrawTriangle((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)cds1, (rdkit.Geometry.rdGeometry.Point2D)cds2, (rdkit.Geometry.rdGeometry.Point2D)cds3[, (bool)rawCoords=False]) → None :

    draws a triangle with the current drawing style. The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    C++ signature :

      void DrawTriangle(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,RDGeom::Point2D,RDGeom::Point2D [,bool=False])

  DrawWavyLine((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)cds1, (rdkit.Geometry.rdGeometry.Point2D)cds2, (tuple)color1, (tuple)color2[, (int)nSegments=16[, (float)vertOffset=0.05[, (bool)rawCoords=False]]]) → None :

    draw a line indicating the presence of an attachment point (normally a squiggle line perpendicular to a bond). The coordinates are in the molecule frame unless rawCoords is true, in which case the coordinates are in pixels.

    C++ signature :

      void DrawWavyLine(RDKit::MolDraw2D {lvalue},RDGeom::Point2D,RDGeom::Point2D,boost::python::tuple {lvalue},boost::python::tuple {lvalue} [,unsigned int=16 [,double=0.05 [,bool=False]]])

  FillPolys((MolDraw2D)self) → bool :

    returns whether or not polygons are being filled

    C++ signature :

      bool FillPolys(RDKit::MolDraw2D {lvalue})

  FlexiMode((MolDraw2D)self) → bool :

    returns whether or not FlexiMode is being used

    C++ signature :

      bool FlexiMode(RDKit::MolDraw2D {lvalue})

  FontSize((MolDraw2D)self) → float :

    get the default font size. The units are, roughly, pixels.

    C++ signature :

      double FontSize(RDKit::MolDraw2D {lvalue})

  GetDrawCoords((MolDraw2D)self, (rdkit.Geometry.rdGeometry.Point2D)point) → rdkit.Geometry.rdGeometry.Point2D :

    get the coordinates in drawing space for a particular point in molecule space

    > C++ signature :

    >   RDGeom::Point2D GetDrawCoords(RDKit::MolDraw2D {lvalue},RDGeom::Point2D)

    GetDrawCoords( (MolDraw2D)self, (int)atomIndex) -> rdkit.Geometry.rdGeometry.Point2D :

      get the coordinates in drawing space for a particular atom

      C++ signature :

        RDGeom::Point2D GetDrawCoords(RDKit::MolDraw2D {lvalue},int)

  GetMolSize((MolDraw2D)self, (rdkit.Chem.rdchem.Mol)mol[, (object)highlightAtoms=None[, (object)highlightBonds=None[, (object)highlightAtomColors=None[, (object)highlightBondColors=None[, (object)highlightAtomRadii=None[, (int)confId=-1[, (str)legend='']]]]]]]) → tuple :

    returns the width and height required to draw a molecule at the current size

    C++ signature :

      boost::python::tuple GetMolSize(RDKit::MolDraw2D {lvalue},RDKit::ROMol [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1 [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’]]]]]]])

  Height((MolDraw2D)self) → int :

    get the height of the drawing canvas

    C++ signature :

      int Height(RDKit::MolDraw2D {lvalue})

  LineWidth((MolDraw2D)self) → float :

    returns the line width being used

    C++ signature :

      double LineWidth(RDKit::MolDraw2D {lvalue})

  Offset((MolDraw2D)self) → rdkit.Geometry.rdGeometry.Point2D :

    returns the offset (in drawing coordinates) for the drawing

    C++ signature :

      RDGeom::Point2D Offset(RDKit::MolDraw2D {lvalue})

  SetColour((MolDraw2D)self, (tuple)tpl) → None :

    set the color being used fr drawing and filling

    C++ signature :

      void SetColour(RDKit::MolDraw2D {lvalue},boost::python::tuple)

  SetDrawOptions((MolDraw2D)self, (MolDrawOptions)opts) → None :

    Copies the drawing options passed in over our drawing options

    C++ signature :

      void SetDrawOptions(RDKit::MolDraw2D {lvalue},RDKit::MolDrawOptions)

  SetFillPolys((MolDraw2D)self, (bool)val) → None :

    sets whether or not polygons are filled

    C++ signature :

      void SetFillPolys(RDKit::MolDraw2D {lvalue},bool)

  SetFlexiMode((MolDraw2D)self, (bool)mode) → None :

    when FlexiMode is set, molecules will always been drawn with the default values for bond length, font size, etc.

    C++ signature :

      void SetFlexiMode(RDKit::MolDraw2D {lvalue},bool)

  SetFontSize((MolDraw2D)self, (float)new_size) → None :

    change the default font size. The units are, roughly, pixels.

    C++ signature :

      void SetFontSize(RDKit::MolDraw2D {lvalue},double)

  SetLineWidth((MolDraw2D)self, (float)width) → None :

    set the line width being used

    C++ signature :

      void SetLineWidth(RDKit::MolDraw2D {lvalue},double)

  SetOffset((MolDraw2D)self, (int)x, (int)y) → None :

    set the offset (in drawing coordinates) for the drawing

    C++ signature :

      void SetOffset(RDKit::MolDraw2D {lvalue},int,int)

  SetScale((MolDraw2D)self, (int)width, (int)height, (rdkit.Geometry.rdGeometry.Point2D)minv, (rdkit.Geometry.rdGeometry.Point2D)maxv[, (object)mol=None]) → None :

    uses the values provided to set the drawing scaling

    C++ signature :

      void SetScale(RDKit::MolDraw2D {lvalue},int,int,RDGeom::Point2D,RDGeom::Point2D [,boost::python::api::object=None])

  Width((MolDraw2D)self) → int :

    get the width of the drawing canvas

    C++ signature :

      int Width(RDKit::MolDraw2D {lvalue})

  drawOptions((MolDraw2D)self) → MolDrawOptions :

    Returns a modifiable version of the current drawing options

    C++ signature :

      RDKit::MolDrawOptions {lvalue} drawOptions(RDKit::MolDraw2D {lvalue})

class rdkit.Chem.Draw.rdMolDraw2D.MolDraw2DCairo((object)self, (int)width, (int)height[, (int)panelWidth=-1[, (int)panelHeight=-1[, (bool)noFreetype=False]]]) → None :

  Bases: `MolDraw2D`

  Cairo molecule drawer

  C++ signature :

    void __init__(_object*,int,int [,int=-1 [,int=-1 [,bool=False]]])

  FinishDrawing((MolDraw2DCairo)self) → None :

    add the last bits to finish the drawing

    C++ signature :

      void FinishDrawing(RDKit::MolDraw2DCairo {lvalue})

  GetDrawingText((MolDraw2DCairo)self) → object :

    return the PNG data as a string

    C++ signature :

      boost::python::api::object GetDrawingText(RDKit::MolDraw2DCairo)

  WriteDrawingText((MolDraw2DCairo)self, (str)fName) → None :

    write the PNG data to the named file

    C++ signature :

      void WriteDrawingText(RDKit::MolDraw2DCairo {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

class rdkit.Chem.Draw.rdMolDraw2D.MolDraw2DSVG((object)self, (int)width, (int)height[, (int)panelWidth=-1[, (int)panelHeight=-1[, (bool)noFreetype=False]]]) → None :

  Bases: `MolDraw2D`

  SVG molecule drawer

  C++ signature :

    void __init__(_object*,int,int [,int=-1 [,int=-1 [,bool=False]]])

  AddMoleculeMetadata((MolDraw2DSVG)self, (rdkit.Chem.rdchem.Mol)mol[, (int)confId=-1]) → None :

    add RDKit-specific information to the bottom of the drawing

    C++ signature :

      void AddMoleculeMetadata(RDKit::MolDraw2DSVG {lvalue},RDKit::ROMol [,int=-1])

  FinishDrawing((MolDraw2DSVG)self) → None :

    add the last bits of SVG to finish the drawing

    C++ signature :

      void FinishDrawing(RDKit::MolDraw2DSVG {lvalue})

  GetDrawingText((MolDraw2DSVG)self) → str :

    return the SVG

    C++ signature :

      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > GetDrawingText(RDKit::MolDraw2DSVG {lvalue})

  TagAtoms((MolDraw2DSVG)self, (rdkit.Chem.rdchem.Mol)mol[, (float)radius=0.2[, (object)events=None]]) → None :

    allow atom selection in the SVG

    C++ signature :

      void TagAtoms(RDKit::MolDraw2DSVG {lvalue},RDKit::ROMol [,double=0.2 [,boost::python::api::object=None]])

class rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions((object)arg1) → None :

  Bases: `instance`

  Drawing options

  C++ signature :

    void __init__(_object*)

  property addAtomIndices

    adds atom indices to drawings. Default False.

  property addBondIndices

    adds bond indices to drawings. Default False.

  property addStereoAnnotation

    adds R/S and E/Z to drawings. Default False.

  property additionalAtomLabelPadding

    additional padding to leave around atom labels. Expressed as a fraction of the font size.

  property annotationColour

    the annotation colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property annotationFontScale

    Scale of font for atom and bond annotation relative to atomlabel font. Default=0.75.

  property atomHighlightsAreCircles

    forces atom highlights always to be circles.Default (false) is to put ellipses roundlonger labels.

  property atomLabelDeuteriumTritium

    labels deuterium as D and tritium as T

  property atomLabels

    maps indices to atom labels

  property atomNoteColour

    the atom note colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property atomRegions

    regions to outline

  property backgroundColour

    the background colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property baseFontSize

    relative size of font. Defaults to 0.6. -1 means use default.

  property bondLineWidth

    if positive, this overrides the default line width for bonds

  property bondNoteColour

    the bond note colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property bracketsAroundAtomLists

    Whether to put brackets round atom lists in query atoms. Default is true.

  property centreMoleculesBeforeDrawing

    Moves the centre of the drawn molecule to (0,0).Default False.

  property circleAtoms

    None( (rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions)arg1) -> bool:

    C++ signature :

      bool {lvalue} None(RDKit::MolDrawOptions {lvalue})

  property clearBackground

    clear the background before drawing a molecule

  property comicMode

    simulate hand-drawn lines for bonds. When combined with a font like Comic-Sans or Comic-Neue, this gives xkcd-like drawings. Default is false.

  property continuousHighlight

    None( (rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions)arg1) -> bool:

    C++ signature :

      bool {lvalue} None(RDKit::MolDrawOptions {lvalue})

  property drawMolsSameScale

    when drawing multiple molecules with DrawMolecules, forces them to use the same scale. Default is true.

  property drawingExtentsInclude

    Drawing extents are computed taking into account only selected DrawElement items. Default=DrawElement.ALL

  property dummiesAreAttachments

    None( (rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions)arg1) -> bool:

    C++ signature :

      bool {lvalue} None(RDKit::MolDrawOptions {lvalue})

  property dummyIsotopeLabels

    adds isotope labels on dummy atoms. Default True.

  property explicitMethyl

    Draw terminal methyls explictly. Default is false.

  property fillHighlights

    None( (rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions)arg1) -> bool:

    C++ signature :

      bool {lvalue} None(RDKit::MolDrawOptions {lvalue})

  property fixedBondLength

    If > 0.0, fixes bond length to this number of pixelsunless that would make it too big. Default -1.0 meansno fix. If both set, fixedScale takes precedence.

  property fixedFontSize

    font size in pixels. default=-1 means not fixed. If set, always used irrespective of scale, minFontSize and maxFontSize.

  property fixedScale

    If > 0.0, fixes scale to that fraction of width ofdraw window. Default -1.0 means adjust scale to fit.

  property flagCloseContactsDist

    None( (rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions)arg1) -> int:

    C++ signature :

      int {lvalue} None(RDKit::MolDrawOptions {lvalue})

  property fontFile

    Font file for use with FreeType text drawer. Can also be BuiltinTelexRegular (the default) or BuiltinRobotoRegular.

  getAnnotationColour((MolDrawOptions)self) → object :

    method returning the annotation colour

    C++ signature :

      boost::python::api::object getAnnotationColour(RDKit::MolDrawOptions)

  getAtomNoteColour((MolDrawOptions)self) → object :

    method returning the atom note colour

    C++ signature :

      boost::python::api::object getAtomNoteColour(RDKit::MolDrawOptions)

  getAtomPalette((MolDrawOptions)self) → dict :

    returns the current atom palette as a dictionary mapping ints to 4-tuples

    C++ signature :

      boost::python::dict getAtomPalette(RDKit::MolDrawOptions)

  getBackgroundColour((MolDrawOptions)self) → object :

    method returning the background colour

    C++ signature :

      boost::python::api::object getBackgroundColour(RDKit::MolDrawOptions)

  getBondNoteColour((MolDrawOptions)self) → object :

    method returning the bond note colour

    C++ signature :

      boost::python::api::object getBondNoteColour(RDKit::MolDrawOptions)

  getHighlightColour((MolDrawOptions)self) → object :

    method returning the highlight colour

    C++ signature :

      boost::python::api::object getHighlightColour(RDKit::MolDrawOptions)

  getLegendColour((MolDrawOptions)self) → object :

    method returning the legend colour

    C++ signature :

      boost::python::api::object getLegendColour(RDKit::MolDrawOptions)

  getQueryColour((MolDrawOptions)self) → object :

    method returning the query colour

    C++ signature :

      boost::python::api::object getQueryColour(RDKit::MolDrawOptions)

  getSymbolColour((MolDrawOptions)self) → object :

    method returning the symbol colour

    C++ signature :

      boost::python::api::object getSymbolColour(RDKit::MolDrawOptions)

  getVariableAttachmentColour((MolDrawOptions)self) → object :

    method for getting the colour of variable attachment points

    C++ signature :

      boost::python::api::object getVariableAttachmentColour(RDKit::MolDrawOptions)

  property highlightBondWidthMultiplier

    What to multiply default bond width by for highlighting bonds. Default-8.

  property highlightColour

    the highlight colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property highlightRadius

    Default radius for highlight circles.

  property includeAtomTags

    include atom tags in output

  property includeChiralFlagLabel

    add a molecule annotation with “ABS” if the chiral flag is set. Default is false.

  property includeMetadata

    When possible, include metadata about molecules and reactions to allow them to be reconstructed. Default is true.

  property includeRadicals

    include radicals in the drawing (it can be useful to turn this off for reactions and queries). Default is true.

  property isotopeLabels

    adds isotope labels on non-dummy atoms. Default True.

  property legendColour

    the legend colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property legendFontSize

    font size in pixels of the legend (if drawn)

  property legendFraction

    fraction of the draw panel to be used for the legend if present

  property maxFontSize

    maximum font size in pixels. default=40, -1 means no maximum.

  property minFontSize

    minimum font size in pixels. default=6, -1 means no minimum.

  property multiColourHighlightStyle

    Either ‘CircleAndLine’ or ‘Lasso’, to control style ofmulti-coloured highlighting in DrawMoleculeWithHighlights.Default is CircleAndLine.

  property multipleBondOffset

    offset for the extra lines in a multiple bond as a fraction of mean bond length

  property noAtomLabels

    disables inclusion of atom labels in the rendering

  property padding

    Fraction of empty space to leave around molecule. Default=0.05.

  property prepareMolsBeforeDrawing

    call prepareMolForDrawing() on each molecule passed to DrawMolecules()

  property queryColour

    the query colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property reagentPadding

    Fraction of empty space to leave around each component of a reaction drawing. Default=0.0.

  property rotate

    Rotates molecule about centre by this number of degrees,

  property scaleBondWidth

    Scales the width of drawn bonds using image scaling.

  property scaleHighlightBondWidth

    Scales the width of drawn highlighted bonds using image scaling.

  property scalingFactor

    scaling factor for pixels->angstrom when auto scalingbeing used. Default is 20.

  setAnnotationColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the annotation colour

    C++ signature :

      void setAnnotationColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setAtomNoteColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the atom note colour

    C++ signature :

      void setAtomNoteColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setAtomPalette((MolDrawOptions)self, (object)cmap) → None :

    sets the palette for atoms and bonds from a dictionary mapping ints to 3-tuples

    C++ signature :

      void setAtomPalette(RDKit::MolDrawOptions {lvalue},boost::python::api::object)

  setBackgroundColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the background colour

    C++ signature :

      void setBackgroundColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setBondNoteColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the bond note colour

    C++ signature :

      void setBondNoteColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setHighlightColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the highlight colour

    C++ signature :

      void setHighlightColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setLegendColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the legend colour

    C++ signature :

      void setLegendColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setQueryColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the query colour

    C++ signature :

      void setQueryColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setSymbolColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the symbol colour

    C++ signature :

      void setSymbolColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  setVariableAttachmentColour((MolDrawOptions)self, (tuple)tpl) → None :

    method for setting the colour of variable attachment points

    C++ signature :

      void setVariableAttachmentColour(RDKit::MolDrawOptions {lvalue},boost::python::tuple)

  property showAllCIPCodes

    show all defined CIP codes (no hiding!). Default False.

  property simplifiedStereoGroupLabel

    if all specified stereocenters are in a single StereoGroup, show a molecule-level annotation instead of the individual labels. Default is false.

  property singleColourWedgeBonds

    if true wedged and dashed bonds are drawn using symbolColour rather than inheriting their colour from the atoms. Default is false.

  property splitBonds

    None( (rdkit.Chem.Draw.rdMolDraw2D.MolDrawOptions)arg1) -> bool:

    C++ signature :

      bool {lvalue} None(RDKit::MolDrawOptions {lvalue})

  property standardColoursForHighlightedAtoms

    If true, highlighted hetero atoms are drawn in standard colours rather than black. Default=False

  property symbolColour

    the symbol colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property unspecifiedStereoIsUnknown

    if true, double bonds with unspecified stereo are drawn crossed, potential stereocenters with unspecified stereo are drawn with a wavy bond. Default is false.

  updateAtomPalette((MolDrawOptions)self, (object)cmap) → None :

    updates the palette for atoms and bonds from a dictionary mapping ints to 3-tuples

    C++ signature :

      void updateAtomPalette(RDKit::MolDrawOptions {lvalue},boost::python::api::object)

  useAvalonAtomPalette((MolDrawOptions)self) → None :

    use the Avalon renderer palette for atoms and bonds

    C++ signature :

      void useAvalonAtomPalette(RDKit::MolDrawOptions {lvalue})

  useBWAtomPalette((MolDrawOptions)self) → None :

    use a black and white palette for atoms and bonds

    C++ signature :

      void useBWAtomPalette(RDKit::MolDrawOptions {lvalue})

  useCDKAtomPalette((MolDrawOptions)self) → None :

    use the CDK palette for atoms and bonds

    C++ signature :

      void useCDKAtomPalette(RDKit::MolDrawOptions {lvalue})

  property useComplexQueryAtomSymbols

    replace any atom, any hetero, any halo queries with complex query symbols A, Q, X, M, optionally followed by H if hydrogen is included (except for AH, which stays *). Default is true

  useDefaultAtomPalette((MolDrawOptions)self) → None :

    use the default colour palette for atoms and bonds

    C++ signature :

      void useDefaultAtomPalette(RDKit::MolDrawOptions {lvalue})

  property useMolBlockWedging

    If the molecule came from a MolBlock, prefer the wedging information that provides. If false, use RDKit rules. Default false

  property variableAtomRadius

    radius value to use for atoms involved in variable attachment points.

  property variableAttachmentColour

    the variable attachment colour as an (R,G,B,A) tuple, values should be between 0 and 1

  property variableBondWidthMultiplier

    what to multiply standard bond width by for variable attachment points.

rdkit.Chem.Draw.rdMolDraw2D.MolToACS1996SVG((rdkit.Chem.rdchem.Mol)mol[, (str)legend=''[, (object)highlightAtoms=None[, (object)highlightBonds=None[, (object)highlightAtomColors=None[, (object)highlightBondColors=None[, (object)highlightAtomRadii=None[, (int)confId=-1]]]]]]]) → str :

  Returns ACS 1996 mode svg for a molecule

  C++ signature :

    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > MolToACS1996SVG(RDKit::ROMol [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’ [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1]]]]]]])

rdkit.Chem.Draw.rdMolDraw2D.MolToSVG((rdkit.Chem.rdchem.Mol)mol[, (int)width=300[, (int)height=300[, (object)highlightAtoms=None[, (bool)kekulize=True[, (int)lineWidthMult=1[, (bool)includeAtomCircles=True[, (int)confId=-1]]]]]]]) → str :

  Returns svg for a molecule

  C++ signature :

    std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > MolToSVG(RDKit::ROMol [,unsigned int=300 [,unsigned int=300 [,boost::python::api::object=None [,bool=True [,unsigned int=1 [,bool=True [,int=-1]]]]]]])

class rdkit.Chem.Draw.rdMolDraw2D.MultiColourHighlightStyle

  Bases: `enum`

  CircleAndLine = rdkit.Chem.Draw.rdMolDraw2D.MultiColourHighlightStyle.CircleAndLine
  Lasso = rdkit.Chem.Draw.rdMolDraw2D.MultiColourHighlightStyle.Lasso
  names = {'CircleAndLine': rdkit.Chem.Draw.rdMolDraw2D.MultiColourHighlightStyle.CircleAndLine, 'Lasso': rdkit.Chem.Draw.rdMolDraw2D.MultiColourHighlightStyle.Lasso}
  values = {0: rdkit.Chem.Draw.rdMolDraw2D.MultiColourHighlightStyle.CircleAndLine, 1: rdkit.Chem.Draw.rdMolDraw2D.MultiColourHighlightStyle.Lasso}

rdkit.Chem.Draw.rdMolDraw2D.PrepareAndDrawMolecule((MolDraw2D)drawer, (rdkit.Chem.rdchem.Mol)mol[, (str)legend=''[, (object)highlightAtoms=None[, (object)highlightBonds=None[, (object)highlightAtomColors=None[, (object)highlightBondColors=None[, (object)highlightAtomRadii=None[, (int)confId=-1[, (bool)kekulize=True]]]]]]]]) → None :

  Preps a molecule for drawing and actually draws it

  C++ signature :

    void PrepareAndDrawMolecule(RDKit::MolDraw2D {lvalue},RDKit::ROMol [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’ [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,boost::python::api::object=None [,int=-1 [,bool=True]]]]]]]])

rdkit.Chem.Draw.rdMolDraw2D.PrepareMolForDrawing((rdkit.Chem.rdchem.Mol)mol[, (bool)kekulize=True[, (bool)addChiralHs=True[, (bool)wedgeBonds=True[, (bool)forceCoords=False[, (bool)wavyBonds=False]]]]]) → rdkit.Chem.rdchem.Mol :

  Does some cleanup operations on the molecule to prepare it to draw nicely. The operations include: kekulization, addition of chiral Hs (so that we can draw wedges to them), wedging of bonds at chiral centers, and generation of a 2D conformation if the molecule does not already have a conformation

  Returns a modified copy of the molecule.

  C++ signature :

    RDKit::ROMol* PrepareMolForDrawing(RDKit::ROMol const* [,bool=True [,bool=True [,bool=True [,bool=False [,bool=False]]]]])

rdkit.Chem.Draw.rdMolDraw2D.SetACS1996Mode((MolDrawOptions)drawOptions, (float)meanBondLength) → None :

  Set the draw options to produce something as close as possible to the ACS 1996 guidelines as described at https://en.wikipedia.org/wiki/Wikipedia:Manual_of_Style/Chemistry/Structure_drawing

  > - MolDrawOptions opt - the options what will be changed

  > - float meanBondLength - mean bond length of the molecule

  > Works best if the MolDraw2D object is created with width and height -1 (a flexiCanvas). The mean bond length may be calculated with MeanBondLength. It is used to calculate the offset for the lines in multiple bonds.

  > Options changed are:

  >   bondLineWidth = 0.6 scaleBondWidth = false scalingFactor = 14.4 / meanBondLen multipleBondOffset = 0.18 highlightBondWidthMultiplier = 32 setMonochromeMode - black and white fixedFontSize = 10 additionalAtomLabelPadding = 0.066 fontFile - if it isn’t set already, then if RDBASE is set and the file

  >   > exists, uses $RDBASE/Data/Fonts/FreeSans.ttf. Otherwise uses BuiltinRobotoRegular.

  > */

  C++ signature :

    void SetACS1996Mode(RDKit::MolDrawOptions {lvalue},double)

rdkit.Chem.Draw.rdMolDraw2D.SetDarkMode((MolDrawOptions)d2d) → None :

  set dark mode for a MolDrawOptions object

  > C++ signature :

  >   void SetDarkMode(RDKit::MolDrawOptions {lvalue})

  SetDarkMode( (MolDraw2D)d2d) -> None :

    set dark mode for a MolDraw2D object

    C++ signature :

      void SetDarkMode(RDKit::MolDraw2D {lvalue})

rdkit.Chem.Draw.rdMolDraw2D.SetMonochromeMode((MolDrawOptions)options, (tuple)fgColour, (tuple)bgColour) → None :

  set monochrome mode for a MolDrawOptions object

  > C++ signature :

  >   void SetMonochromeMode(RDKit::MolDrawOptions {lvalue},boost::python::tuple,boost::python::tuple)

  SetMonochromeMode( (MolDraw2D)drawer, (tuple)fgColour, (tuple)bgColour) -> None :

    set monochrome mode for a MolDraw2D object

    C++ signature :

      void SetMonochromeMode(RDKit::MolDraw2D {lvalue},boost::python::tuple,boost::python::tuple)

rdkit.Chem.Draw.rdMolDraw2D.UpdateDrawerParamsFromJSON((MolDraw2D)drawer, (str)json) → None :
  C++ signature :

    void UpdateDrawerParamsFromJSON(RDKit::MolDraw2D {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

rdkit.Chem.Draw.rdMolDraw2D.UpdateMolDrawOptionsFromJSON((MolDrawOptions)opts, (str)json) → None :
  C++ signature :

    void UpdateMolDrawOptionsFromJSON(RDKit::MolDrawOptions {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

class rdkit.Chem.Draw.rdMolDraw2D.map_indexing_suite_IntStringMap_entry((object)arg1) → None :

  Bases: `instance`

  C++ signature :

    void __init__(_object*)

  data((map_indexing_suite_IntStringMap_entry)arg1) → str :
    C++ signature :

      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > data(std::pair<int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > {lvalue})

  key((map_indexing_suite_IntStringMap_entry)arg1) → int :
    C++ signature :

      int key(std::pair<int const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > {lvalue})