Difference between revisions of "Dot"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 6: Line 6:
  
 
'''source.txt'''
 
'''source.txt'''
 +
<source>
 
  digraph "Wikimap" {
 
  digraph "Wikimap" {
 
   "OS" -> "OpenSource"
 
   "OS" -> "OpenSource"
Line 13: Line 14:
 
   "BSD" -> "FreeBSD"
 
   "BSD" -> "FreeBSD"
 
  }
 
  }
 +
</source>
 
create the graphical map
 
create the graphical map
  $ dot -Tps -o mindmap.ps source.txt
+
<source>
 +
  dot -Tps -o mindmap.ps source.txt
 +
</source>
 
view the graphical map
 
view the graphical map
  $ konqueror mindmap.ps
+
<source>
 +
  konqueror mindmap.ps
 +
</source>
  
 
= remove arrows =
 
= remove arrows =
Line 23: Line 29:
  
 
'''source.txt'''
 
'''source.txt'''
 +
<source>
 
  digraph "Wikimap" {
 
  digraph "Wikimap" {
 
   "cloud" -> "public" [arrowhead=none]
 
   "cloud" -> "public" [arrowhead=none]
Line 31: Line 38:
 
   "public" -> "ownCloud" [arrowhead=none]
 
   "public" -> "ownCloud" [arrowhead=none]
 
  }
 
  }
 +
<source>
 
create the graphical map
 
create the graphical map
 +
<source>
 
  $ dot -Tps -o mindmap.ps source.txt
 
  $ dot -Tps -o mindmap.ps source.txt
 +
<source>
 
view the graphical map
 
view the graphical map
 +
<source>
 
  $ konqueror mindmap.ps
 
  $ konqueror mindmap.ps
 +
<source>
  
 
= Layout =
 
= Layout =
Line 42: Line 54:
  
 
Sourcecode for the above:
 
Sourcecode for the above:
<pre>
+
<source>
 
digraph "Wikimap" {
 
digraph "Wikimap" {
 
   layout=neato
 
   layout=neato
Line 52: Line 64:
 
   "BSD" -> "FreeBSD"
 
   "BSD" -> "FreeBSD"
 
}
 
}
</pre>
+
<source>
  
 
= See also =
 
= See also =

Revision as of 13:28, 24 April 2020

Dot is a program from the graphviz package to draw graphs from the command line. It can, among other usages, be used to create MindMaps.

Mindmap

A mindmap created by the program dot.

Here's how you create a mindmap with dot:

source.txt <source>

digraph "Wikimap" {
  "OS" -> "OpenSource"
  "OpenSource" -> "Linux"
  "OpenSource" -> "BSD"
  "BSD" -> "NetBSD"
  "BSD" -> "FreeBSD"
}

</source> create the graphical map <source>

dot -Tps -o mindmap.ps source.txt

</source> view the graphical map <source>

konqueror mindmap.ps

</source>

remove arrows

A mindmap created by the program dot.

Here is how you draw a mindmap without arrows, you use "arrowhead=none":

source.txt <source>

digraph "Wikimap" {
  "cloud" -> "public" [arrowhead=none]
  "cloud" -> "private" [arrowhead=none]
  "cloud" -> "data" [arrowhead=none]
  "cloud" -> "virtual machines" [arrowhead=none]
  "data" -> "ownCloud" [arrowhead=none]
  "public" -> "ownCloud" [arrowhead=none]
}

<source> create the graphical map <source>

$ dot -Tps -o mindmap.ps source.txt

<source> view the graphical map <source>

$ konqueror mindmap.ps

<source>

Layout

You can use several layouts: dot, twopi, neato and circo. Here is the neato layout:

Layout-neato.png

Sourcecode for the above: <source> digraph "Wikimap" {

 layout=neato
 overlap=false
 "OS" -> "OpenSource"
 "OpenSource" -> "Linux"
 "OpenSource" -> "BSD"
 "BSD" -> "NetBSD"
 "BSD" -> "FreeBSD"

} <source>

See also