I'm trying to follow this tutorial which uses GraphViz to display a diagram. When running the first piece of code:
using Decapodes, Decapodes.Diagrams
using Catlab.Present, Catlab.Graphics
Variable = @decapode Decapodes2D begin
C::Form0{X}
end;
draw_equation(decapode) = to_graphviz(decapode, node_labels=true, prog="neato",
node_attrs=Dict(:shape=>"oval"),
graph_attrs=Dict(:nodesep=>"4.0"))
draw_equation(Variable)
I get the following output in the Julia REPL:
Catlab.Graphics.Graphviz.Graph("G", true, "neato", Catlab.Graphics.Graphviz.Statement[Catlab.Graphics.Graphviz.Node("n1", OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:label => "C:Ω₀"))], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:nodesep => "4.0", :rankdir => "LR"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:height => "0.05", :margin => "0", :shape => "oval", :width => "0.05"), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:arrowsize => "0.5"))
I expect the diagram to show up in another window, but no such window is created.
I'm running MacOS Monterey 12.4, Julia 1.7, and have GraphViz installed via Home-brew as well as the GraphViz.jl package. How can I view the diagram?
You need to use Graphviz to generate the image.
Assuming graphviz is in your system path you can do:
using Catlab
open("out.pdf","w") do f
write(f, Catlab.Graphics.Graphviz.run_graphviz(draw_equation(Variable);format="pdf"))
end