Graphics
Catlab.Graphics.Graphviz
— ModuleAST and pretty printer for Graphviz's DOT language.
References:
- DOT grammar: http://www.graphviz.org/doc/info/lang.html
- DOT language guide: http://www.graphviz.org/pdf/dotguide.pdf
Catlab.Graphics.Graphviz.pprint
— MethodPretty-print the Graphviz expression.
Catlab.Graphics.Graphviz.run_graphviz
— MethodRun a Graphviz program.
Assumes that Graphviz is installed on the local system and invokes Graphviz through its command-line interface.
For bindings to the Graphviz C API, see the the GraphViz.jl package (https://github.com/Keno/GraphViz.jl). GraphViz.jl is unmaintained at the time of this writing.
Catlab.Graphics.Graphviz.to_graphviz
— MethodConvert an attributed graph (MetaGraph) to a Graphviz graph.
This method is usually more convenient than direct AST manipulation for creating Graphviz graphs. It supports graphs that are directed or undirected, simple or multi-edged. For more advanced features, like nested subgraphs, you must use the Graphviz AST directly.
Catlab.Graphics.GraphvizWiringDiagrams
— ModuleDraw wiring diagrams using Graphviz.
Catlab.Graphics.Graphviz.to_graphviz
— MethodDraw a wiring diagram using Graphviz.
The input f
can also be a morphism expression, which is converted into a wiring diagram.
Arguments
graph_name="G"
: name of Graphviz digraphorientation=TopToBottom
: orientation of layout. One ofLeftToRight
,RightToLeft
,TopToBottom
, orBottomToTop
.node_labels=true
: whether to label the nodeslabels=false
: whether to label the edgeslabel_attr=:label
: what kind of edge label to use (iflabels
is true). One of:label
,:xlabel
,:headlabel
, or:taillabel
.port_size="24"
: minimum size of ports on box, in pointsjunction_size="0.05"
: size of junction nodes, in inchesouter_ports=true
: whether to display the outer box's input and output ports. If disabled, no incoming or outgoing wires will be shown either!anchor_outer_ports=true
: whether to enforce ordering of the outer box's input and output, i.e., ordering of the incoming and outgoing wiresgraph_attrs=default_graph_attrs
: top-level graph attributesnode_attrs=default_node_attrs
: top-level node attributesedge_attrs=default_edge_attrs
: top-level edge attributescell_attrs=default_cell_attrs
: main cell attributes in node HTML-like label
Catlab.Graphics.TikZ
— ModuleAST and pretty printer for TikZ.
This module does not provide bindings to the TikZ LaTeX package. For that, see the TikzPictures.jl package: https://github.com/sisl/TikzPictures.jl
The AST is large but still incomplete! It supports:
- Nodes (
\node
) and edges (\draw
) - Nodes along edges (
\draw ... node ...
) - Graphs (
\graph
) - Matrices (
\matrix
) - Scopes and nested pictures
The AST is adapted from the (also incomplete) BNF grammar for TikZ in TikZit.
Catlab.Graphics.TikZ.pprint
— MethodPretty-print the TikZ expression.
Catlab.Graphics.TikZWiringDiagrams
— ModuleDraw wiring diagrams using TikZ.
Catlab.Graphics.TikZWiringDiagrams.layout_to_tikz
— MethodDraw a wiring diagram in TikZ using the given layout.
Catlab.Graphics.TikZWiringDiagrams.to_tikz
— MethodDraw a wiring diagram in TikZ.
Catlab.Graphics.YFilesWiringDiagrams
— ModuleDeserialize abstract wiring diagram from yFiles.
Reads a wiring diagram from the GraphML dialect used by yEd and yFiles. Unlike the GraphML spec, the yEd data model does not explicitly include ports:
- https://yed.yworks.com/support/qa/102/
- https://yed.yworks.com/support/qa/2531/
We infer the ports of boxes and their order from the geometry of the diagram. Thus, this module has the nature of a hack. While it may be useful for interactive and exploratory work, it should not be used in a production system.
Catlab.Graphics.YFilesWiringDiagrams.parse_yfiles_diagram
— MethodParse a wiring diagram from a GraphML string or XML doc created by yFiles.
Catlab.Graphics.YFilesWiringDiagrams.read_yfiles_diagram
— MethodRead a wiring diagram from a GraphML file created by yEd and yFiles.