<> ---- **Name** ''tdot'' - Thingy DOT writer - package to create dot files and image files for the [Graphviz] tools with a syntax close to Tcl and to the [dot] language. **Description** [DDG] 2021-09-06: The package provides one command ''tdot'' which can hold currently just a single dot code collection. All commands will be evaluated within the ''tdot'' namespace. In comparison to the Graphviz [tcldot] and the gvtcl packages this package uses directly the Graphviz executables and has a syntax very close to the dot language. So there is no need to consult special API pages for the interface. It is therefore enough to consult the few methods in the documentation and the standard https://www.graphviz.org/pdf/dotguide.pdf%|%dot%|% or https://www.graphviz.org/pdf/dotguide.pdf%|%neato%|% documentation. There are a few restrictions because of this, for instance you can’t delete nodes and edges, you can only use ''shape=invis'' to hide a node or edge at a later point for instance. **Links** * Homepage: https://github.com/mittelmark/DGTcl * Download: (Gitdown) https://downgit.github.io/#/home?url=https://github.com/mittelmark/DGTcl/tree/master/lib/tdot * Manual: https://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/tdot/tdot.html * Version: 0.3.0 - 2021-09-26 * License: MIT **Example** Below a few examples from the https://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/tdot/tdot.html%|%Manual%|%: ====== # demo: synopsis package require tdot tdot set type "strict digraph G" tdot graph margin=0.2 tdot node width=1 height=0.7 style=filled fillcolor=salmon shape=box tdot block rank=same A B C tdot addEdge A -> B tdot node A label="Hello" tdot node B label="World" fillcolor=skyblue tdot edge dir=back tdot addEdge B -> C tdot node C label="Powered by\n tdot" tdot write tdot-synopsis.png ====== [tdot-synopsis2] Using the Tk [canvas] as output: ====== # demo: write package require Tk pack [canvas .can -background white] -side top -fill both -expand true package require tdot tdot set code "" tdot graph margin=0.4 tdot node style=filled fillcolor=salmon shape=hexagon tdot addEdge A -> B tdot node A label="tdot" tdot node B label="Hello World!" tdot write .can .can create rect 10 10 290 250 -outline red ;# standard canvas commands still work ====== [tdot-canvas] Switch to neato layout: ====== tdot set code "" tdot set type "graph N" ;# switch to neato as layout engine tdot addEdge n0 -- n1 -- n2 -- n3 -- n0; tdot node n0 color=red style=filled fillcolor=salmon tdot write dot-neato.png ====== [tdot-neato] Switch to circo layout: ====== tdot set code "" tdot set type "strict digraph G" ; # back to dot tdot graph layout=circo ;# switch to circo (circular layout engine) tdot addEdge A -> B -> C -> D -> A tdot write dot-circle2.png ====== [tdot-circo] Now a longer example which is possible with version 0.3.0 showing the history of Tcl/Tk ... and tdot ;) ====== tdot set code "" tdot set type "digraph Tk" tdot graph margin=0.3 tdot graph size="8\;7" ;# semikolon must be backslashed due to thingy tdot node shape=box style=filled fillcolor=grey width=1 tdot addEdge 1988 -> 1993 -> 1995 -> 1997 -> 1999 \ -> 2000 -> 2002 -> 2007 -> 2012 -> future tdot node fillcolor="#ff9999" tdot edge style=invis tdot addEdge Tk -> Bytecode -> Unicode -> TEA -> vfs -> \ Tile -> TclOO -> zipvfs tdot edge style=filled tdot node fillcolor="salmon" tdot addEdge "Tcl/Tk" -> 7.3 -> 7.4 -> 8.0 -> 8.1 -> 8.3 \ -> 8.4 -> 8.5 -> 8.6 -> 8.7; tdot node fillcolor=cornsilk tdot addEdge 7.3 -> Itcl -> 8.6 tdot addEdge Tk -> 7.4 -> Otcl -> XOTcl -> NX tdot addEdge Otcl -> Thingy -> tdot tdot addEdge Bytecode -> 8.0 tdot addEdge 8.0 -> Namespace dir=back tdot addEdge Unicode -> 8.1 tdot addEdge 8.1 -> Wiki tdot addEdge TEA -> 8.3 tdot addEdge 8.3 -> Tcllib -> Tklib tdot addEdge 8.4 -> Starkit -> Snit -> Dict -> 8.5 tdot addEdge vfs -> 8.4 tdot addEdge Tile -> 8.5 tdot addEdge TclOO -> 8.6 -> TDBC tdot addEdge zipvfs -> 8.7 ;# Null is just a placeholder for the history tdot block rank=same 1988 "Tcl/Tk" group=g1 tdot block rank=same 1993 7.3 group=g1 Itcl tdot block rank=same 1995 Tk group=g0 7.4 group=g1 Otcl group=g2 tdot block rank=same 1997 Bytecode group=g0 8.0 group=g1 Namespace tdot block rank=same 1999 Unicode group=g0 8.1 group=g1 Wiki tdot block rank=same 2000 TEA group=g0 8.3 group=g1 Tcllib \ Tklib Thingy group=g3 XOTcl group=g2 tdot block rank=same 2002 vfs group=g0 8.4 group=g1 Starkit Dict Snit tdot block rank=same 2007 Tile group=g0 8.5 group=g1 tdot block rank=same 2012 TclOO group=g0 8.6 group=g1 TDBC NX group=g2 tdot block rank=same future zipvfs group=g0 8.7 group=g1 Null group=g2 tdot group=g3 # specific node settings tdot node History label="History of Tcl/Tk\nand tdot" shape=doubleoctagon color="salmon" penwidth=5 \ fillcolor="white" fontsize=26 fontname="Monaco" tdot node Namespace fillcolor="#ff9999" tdot node future label=2021 tdot node 8.7 label="\[ 8.7a5 \]" # arranging the History in the middle tdot addEdge 8.7 -> Null style=invis tdot addEdge Null -> History style=invis tdot node Null style=invis tdot write tdot-history.png ====== [tdot-history] For more examples see the https://htmlpreview.github.io/?https://github.com/mittelmark/DGTcl/blob/master/lib/tdot/tdot.html%|%manual page%|%. **Changelog** * Version 0.2.0 (2021-09-14) - adding dotstring function to directly load graphs from standard dot texts * Version 0.3.0 (2021-09-26) - subgraphs, header method, space-issue fix, quoted node names, blocks with attributes, extended history example ---- **See also** * [Thingy: a one-liner OO system] - the little OO behind the ''tdot'' package * [tcldot] - the [Graphviz] provided Tcl interface library. ---- **Discussion** Please discuss here ... <> Package | Graphics | Graphviz | SVG