Skip to content

How to draw reactions in black/white or gray scale? #5885

Answered by vfscalfani
ddsneo4j asked this question in General
Discussion options

You must be logged in to vote

Hi @ddsneo4j , try something like this and see if it is what you were looking for. The key piece is to set the drawOptions().useBWAtomPalette() option:

rxn_smi = "CCCCO.Br>>CCCCBr.O"
drawer = rdMolDraw2D.MolDraw2DCairo(900,300)
drawer.drawOptions().useBWAtomPalette()
drawer.DrawReaction(rdChemReactions.ReactionFromSmarts(rxn_smi, useSmiles=True))
drawer.FinishDrawing()
bio = io.BytesIO(drawer.GetDrawingText())
Image.open(bio)

Hope it helps.

Vin

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ddsneo4j
Comment options

Answer selected by ddsneo4j
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants