I’m using the excellent MolecularGraph.jl
package to generate a molecular graph representation of a SMILES string. The following code works in a notebook to display the molecule, but since I’m not using notebooks I get an error. How can I show this molecule in a regular plot window?
using MolecularGraph
# (R)-(-)-Apomorphine hydrochloride
mol = smilestomol("CN1CCc2cccc-3c2[C@H]1Cc1ccc(O)c(O)c-31")
molsvg = drawsvg(mol, 200, 200)
display("image/svg+xml", molsvg)
This produces: ERROR: MethodError: no method matching show(::Base.TTY, ::MIME{Symbol("image/svg+xml")}, ::String)
.
I tried saving the svg
to a file and load it with Images.jl
but this library does not support svg
files.
open("mol.svg", "a") do io
println(io, molsvg)
end
I’m sure this is really simple and I just am missing something obvious.