Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz (DOT) Captions

Tags:

graphviz

dot

I need to print a large number of graphs using Graphviz DOT. To distinguish which input each graph corresponds to, I want to also have a caption for each graph. Is there anyway to embed this into the DOT representation of the graphs.

like image 418
myahya Avatar asked Jan 17 '11 14:01

myahya


People also ask

What is the DOT language called?

Braille is a system of touch reading and writing for blind persons in which raised dots represent the letters of the alphabet. It also contains equivalents for punctuation marks and provides symbols to show letter groupings. Braille is read by moving the hand or hands from left to right along each line.

How do I open a Graphviz DOT graph?

For windows: dl the msi and install; Find gvedit.exe in your programs list; Open . dot file in question; Click running person on toolbar; Go to graph -> settings ; change Output file type to file type of your liking and press ok..

What is Pydot in Python?

Pydot is a Python library, also written in Python, that "serves as a graphical interface to Graphviz, an open source graph visualization software. GraphViz is written in DOT language, but Pydot provides the ability to parse and dump data, between Python and DOT."[


2 Answers

You can use label to add a caption to the graph.

Example:

digraph {     A -> B;     label="Graph";     labelloc=top;     labeljust=left; } 

labelloc and labeljust can be used to determine top/bottom and left/right position of the graph label.

All the details and other attributes that can be used to modify the label (font etc) in the graphviz attribute reference.

Tip: Define the graph label end of your dot file, otherwise subgraphs will inherit those properties.

like image 142
marapet Avatar answered Oct 06 '22 01:10

marapet


Graph's can have attributes just like nodes and edges do:

digraph {     graph [label="The Tale of Two Cities", labelloc=t, fontsize=30];     node [color=blue];     rankdir = LR;     London -> Paris;     Paris -> London; } 

That dot file produces this graph.

enter image description here

like image 36
Raymond Hettinger Avatar answered Oct 05 '22 23:10

Raymond Hettinger