Difference between revisions of "Dot"

From Linuxintro
imported>ThorstenStaerk
m
 
(9 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  
 
'''source.txt'''
 
'''source.txt'''
<source>
 
 
  digraph "Wikimap" {
 
  digraph "Wikimap" {
 
   "OS" -> "OpenSource"
 
   "OS" -> "OpenSource"
Line 14: Line 13:
 
   "BSD" -> "FreeBSD"
 
   "BSD" -> "FreeBSD"
 
  }
 
  }
</source>
 
 
create the graphical map
 
create the graphical map
<source>
+
  dot -Tpdf -o mindmap.pdf source.txt
  dot -Tps -o mindmap.ps source.txt
 
</source>
 
 
view the graphical map
 
view the graphical map
<source>
+
  xdg-open mindmap.pdf
  konqueror mindmap.ps
 
</source>
 
  
 
= remove arrows =
 
= remove arrows =
Line 29: Line 23:
  
 
'''source.txt'''
 
'''source.txt'''
<source>
+
 
 
  digraph "Wikimap" {
 
  digraph "Wikimap" {
 
   "cloud" -> "public" [arrowhead=none]
 
   "cloud" -> "public" [arrowhead=none]
Line 38: Line 32:
 
   "public" -> "ownCloud" [arrowhead=none]
 
   "public" -> "ownCloud" [arrowhead=none]
 
  }
 
  }
<source>
 
 
create the graphical map
 
create the graphical map
<source>
+
  $ dot -Tpdf -o mindmap.pdf source.txt
  $ dot -Tps -o mindmap.ps source.txt
 
<source>
 
 
view the graphical map
 
view the graphical map
<source>
+
  $ xdg-open mindmap.pdf
  $ konqueror mindmap.ps
 
<source>
 
  
 
= Layout =
 
= Layout =
Line 54: Line 43:
  
 
Sourcecode for the above:
 
Sourcecode for the above:
<source>
+
digraph "Wikimap" {
digraph "Wikimap" {
+
  layout=neato
  layout=neato
+
  overlap=false
  overlap=false
+
  "OS" -> "OpenSource"
  "OS" -> "OpenSource"
+
  "OpenSource" -> "Linux"
  "OpenSource" -> "Linux"
+
  "OpenSource" -> "BSD"
  "OpenSource" -> "BSD"
+
  "BSD" -> "NetBSD"
  "BSD" -> "NetBSD"
+
  "BSD" -> "FreeBSD"
  "BSD" -> "FreeBSD"
+
}
}
 
<source>
 
  
 
= See also =
 
= See also =

Latest revision as of 06:39, 24 May 2024

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

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

create the graphical map

dot -Tpdf -o mindmap.pdf source.txt

view the graphical map

xdg-open mindmap.pdf

remove arrows

A mindmap created by the program dot.

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

source.txt

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]
}

create the graphical map

$ dot -Tpdf -o mindmap.pdf source.txt

view the graphical map

$ xdg-open mindmap.pdf

Layout

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

Layout-neato.png

Sourcecode for the above:

digraph "Wikimap" {
  layout=neato
  overlap=false
  "OS" -> "OpenSource"
  "OpenSource" -> "Linux"
  "OpenSource" -> "BSD"
  "BSD" -> "NetBSD"
  "BSD" -> "FreeBSD"
}

See also