# Getting Graphical Output from Catlab.jl

**URL:** <https://discourse.julialang.org/t/getting-graphical-output-from-catlab-jl/131014>\
**Category:** General Usage\
**Tags:** question, package, plotting\
**Created:** [July 24, 2025, 4:11pm UTC](https://discourse.julialang.org/t/getting-graphical-output-from-catlab-jl/131014 "2025-07-24T16:11:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogms223](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rogms223/32/210819_2.png) [@rogms223](https://discourse.julialang.org/u/rogms223)\
**Post date:** [July 24, 2025, 4:11pm UTC](https://discourse.julialang.org/t/getting-graphical-output-from-catlab-jl/131014/1 "2025-07-24T16:11:28Z")

</div>

## :::::::::::::: Project.toml :::::::::::::: [deps] Catlab = “134e5e36-593f-5add-ad60-77f754baafbe” GATlab = “f0ffcf3b-d13a-433e-917c-cc44ccf5ead2”

can supply Manifest.toml if of interest

# 

# running snippet below

# 

# from : [The Category of Graphs · Catlab.jl](https://algebraicjulia.github.io/Catlab.jl/dev/generated/graphs/graphs/#Graph-Homomorphisms)

using GATlab, Catlab.Theories  
using Catlab.CategoricalAlgebra  
using Catlab.Graphs  
using Catlab.Graphics

draw(g; kw…) = to\_graphviz(g; graph\_attrs, node\_attrs, kw…)  
draw(f::ACSetTransformation; kw…) =  
to\_graphviz(f; node\_labels=true, edge\_labels=true, draw\_codom=false, kw…)

to\_graphviz(SchGraph)

# 

# produces output

# 

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 =\> “V”)), Catlab.Graphics.Graphviz.Node(“n2”, OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:label =\> “E”)), Catlab.Graphics.Graphviz.Edge(Catlab.Graphics.Graphviz.NodeID[Catlab.Graphics.Graphviz.NodeID(“n2”, “”, “”), Catlab.Graphics.Graphviz.NodeID(“n1”, “”, “”)], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:label =\> “src”)), Catlab.Graphics.Graphviz.Edge(Catlab.Graphics.Graphviz.NodeID[Catlab.Graphics.Graphviz.NodeID(“n2”, “”, “”), Catlab.Graphics.Graphviz.NodeID(“n1”, “”, “”)], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:label =\> “tgt”))], OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}(:margin =\> “0”, :shape =\> “ellipse”), OrderedCollections.OrderedDict{Symbol, Union{String, Catlab.Graphics.Graphviz.Html}}())

# 

# which looks pretty well formed …

# How does one get a persistent image, say graphics format file or pdf file from the above output?

# 

## Catlab info from Manifest.toml - deps do not appear to contain graphics/plotting support [[deps.Catlab]] deps = [“Compose”, “DataStructures”, “GeneralizedGenerated”, “JSON”, “LightXML”, “LinearAlgebra”, “Logging”, “MLStyle”, “Pkg”, “PrettyTables”, “Random”, “Reexport”, “Requires”, “SparseArrays”, “StaticArrays”, “Statistics”, “StructEquality”, “Tables”] git-tree-sha1 = “40552f780d19dff2bfbcad8e810fac53b28c5264” uuid = “134e5e36-593f-5add-ad60-77f754baafbe” version = “0.14.2”

sensible paths seem to be  
add package Graphviz\_jll to use Julia implemented Graphviz  
or install Graphviz externally and use it’s plotting capabilities  
Cairo graphics seem associated with external Graphviz  
( I am mostly interested in using the Julia - Catlab environnent to  
support learning about and using applied category theory. )  
Thanks in advance,  
Roger Smith

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 24, 2025, 4:45pm UTC](https://discourse.julialang.org/t/getting-graphical-output-from-catlab-jl/131014/2 "2025-07-24T16:45:19Z")

</div>

Welcome! May I suggest some formatting to make your post more accessible?  
Three backticks are used for code blocks.

```julia
function here(is)
    some_code = is
end

```

By the way, almost everyone is at Julia con 2025, so an answer to your question may be delayed by a few minutes. 😉

---

<div class="post-metadata">

**Author:** ![jpfairbanks](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jpfairbanks/32/4500_2.png) [@jpfairbanks](https://discourse.julialang.org/u/jpfairbanks)\
**Post date:** [July 24, 2025, 7:04pm UTC](https://discourse.julialang.org/t/getting-graphical-output-from-catlab-jl/131014/3 "2025-07-24T19:04:36Z")

</div>

You need to have Graphviz installed on your system path. If you follow the standard instructions for installing graphviz on your operating system, it should work.

---

<div class="post-metadata">

**Author:** ![rogms223](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rogms223/32/210819_2.png) [@rogms223](https://discourse.julialang.org/u/rogms223)\
**Post date:** [July 24, 2025, 9:53pm UTC](https://discourse.julialang.org/t/getting-graphical-output-from-catlab-jl/131014/4 "2025-07-24T21:53:40Z")

</div>

an idiom that does the trick, with the Graphviz Bin in the system path

# 

open(“t1.pdf”,“w”) do f  
write(f, Catlab.Graphics.Graphviz.run\_graphviz( to\_graphviz(SchGraph); format=“pdf” ) )  
end

# 

thanks,  
roger
