# Graph visualisation in Julia

**URL:** <https://discourse.julialang.org/t/graph-visualisation-in-julia/7366>\
**Category:** General Usage\
**Created:** [November 28, 2017, 6:41pm UTC](https://discourse.julialang.org/t/graph-visualisation-in-julia/7366 "2017-11-28T18:41:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![veryevilwitch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/veryevilwitch/32/2764_2.png) [@veryevilwitch](https://discourse.julialang.org/u/veryevilwitch)\
**Post date:** [November 28, 2017, 6:41pm UTC](https://discourse.julialang.org/t/graph-visualisation-in-julia/7366/1 "2017-11-28T18:41:40Z")

</div>

Hi All!

I am trying to generate some Watts- Strogatz graphs in julia and I have a problem of a picture not showing up anywhere.  
I generated a network and tried to plot it using **gplot()**, but instead of a picture I get something that seems to be a description of a graph (pic. below). There were no errors/ warnings during compilation

![image](https://global.discourse-cdn.com/julialang/original/3X/d/c/dc9cbb7dcfec3bbae5f30e1377f4234e8a9815d8.png)

I tried running the code in Juno & Shell with similar results, but it works in Jupyter, so the code itself is probably fine.

Do you have some ideas as to where the problem is?

many thanks!

---

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [November 29, 2017, 5:16pm UTC](https://discourse.julialang.org/t/graph-visualisation-in-julia/7366/2 "2017-11-29T17:16:43Z")

</div>

`gplot` outputs a composition that can be interpreted in many environments (like iterm+TerminalExtensions, or Jupyter, for example). If you’d like to save the visualization to a file, what you want to do is this:

```julia
using Compose

draw(SVG("mygraph.svg", 4cm, 4cm), gplot(g))

```

---

<div class="post-metadata">

**Author:** ![veryevilwitch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/veryevilwitch/32/2764_2.png) [@veryevilwitch](https://discourse.julialang.org/u/veryevilwitch)\
**Post date:** [November 30, 2017, 3:57pm UTC](https://discourse.julialang.org/t/graph-visualisation-in-julia/7366/3 "2017-11-30T15:57:01Z")

</div>

Thanks! That explains a lot. But do you know how to visualize graphs without saving them to a file (i.e. make them appear in a separate window)? I’d like to see how my network evolves over time and it would be a lot easier that way.

---

<div class="post-metadata">

**Author:** ![anon94023334](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@anon94023334](https://discourse.julialang.org/u/anon94023334)\
**Post date:** [November 30, 2017, 5:20pm UTC](https://discourse.julialang.org/t/graph-visualisation-in-julia/7366/4 "2017-11-30T17:20:45Z")

</div>

It depends very much on the environment you’re using. As you showed, Jupyter can handle `gplot` natively. So can iTerm + TerminalExtensions.jl. VSCode does it as well. Not sure about other IDEs/environments.

---

<div class="post-metadata">

**Author:** ![veryevilwitch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/veryevilwitch/32/2764_2.png) [@veryevilwitch](https://discourse.julialang.org/u/veryevilwitch)\
**Post date:** [November 30, 2017, 7:41pm UTC](https://discourse.julialang.org/t/graph-visualisation-in-julia/7366/6 "2017-11-30T19:41:39Z")

</div>

Now it’s Juno. I could probably switch to something else, but I quite like it. So if there is a function/library I could use instead, it would be great

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [November 30, 2017, 8:21pm UTC](https://discourse.julialang.org/t/graph-visualisation-in-julia/7366/7 "2017-11-30T20:21:39Z")

</div>

`Gadfly` should work:

```julia
julia> using Gadfly, GraphPlot

julia> g = graphfamous("karate")
{34, 78} undirected simple Int64 graph

julia> gplot(g)

```
