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
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?
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:
using Compose
draw(SVG("mygraph.svg", 4cm, 4cm), gplot(g))
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.
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.
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