# Displaying an SVG without a notebook

**URL:** <https://discourse.julialang.org/t/displaying-an-svg-without-a-notebook/82684>\
**Category:** New to Julia\
**Tags:** question, plotting\
**Created:** [June 13, 2022, 3:04pm UTC](https://discourse.julialang.org/t/displaying-an-svg-without-a-notebook/82684 "2022-06-13T15:04:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [June 13, 2022, 3:04pm UTC](https://discourse.julialang.org/t/displaying-an-svg-without-a-notebook/82684/1 "2022-06-13T15:04:48Z")

</div>

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?

```julia
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.

```julia
open("mol.svg", "a") do io
    println(io, molsvg)
end

```

I’m sure this is really simple and I just am missing something obvious. 🙂

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [June 13, 2022, 3:28pm UTC](https://discourse.julialang.org/t/displaying-an-svg-without-a-notebook/82684/2 "2022-06-13T15:28:48Z")

</div>

[GitHub - queryverse/ElectronDisplay.jl: An Electron.jl based figure and table display.](https://github.com/queryverse/ElectronDisplay.jl) should be a pretty easy solution.

---

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [June 13, 2022, 3:37pm UTC](https://discourse.julialang.org/t/displaying-an-svg-without-a-notebook/82684/3 "2022-06-13T15:37:47Z")

</div>

That worked like a charm! Thanks @pfitzseb . The working code is given below.

```julia
using MolecularGraph
using ElectronDisplay

# (R)-(-)-Apomorphine hydrochloride
mol = smilestomol("CN1CCc2cccc-3c2[C@H]1Cc1ccc(O)c(O)c-31");
molsvg = drawsvg(mol, 500, 500);
display("image/svg+xml", molsvg)

```

This was also added to an [issue](https://github.com/mojaie/MolecularGraph.jl/issues/66) I followed at `MolecularGraphs.jl`
