TFO Graphviz

Graphviz is a powerful tool for visualising network and tree structures that connect objects.

This WordPress plugin provides a shortcode mechanism to create Graphviz graphics within blogs, including image map generation and most other Graphviz features.


Installation is simple. Either install from directly within WordPress or:

  1. Download and unzip the plugin to the [cci]/wp-content/plugins/tfo-graphviz[/cci] directory within your WordPress installation.
  2. Make the directory [cci]/wp-content/tfo-graphviz[/cci] and make it writable by the web server – this is where generated images and image maps go.
  3. Activate the plugin through the ‘Plugins’ menu in WordPress.
  4. Choose a generation method on the plugin settings page.
  5. Use the [cci]

    Error generating Graphviz image:

    Graphviz cannot generate graph
    Command: /usr/bin/dot '-Kdot' '-Tpng' '-o/data/'
    Error: : syntax error in line 1 near '['
    Original DOT:
        1 [/cci] shortcode to generate graphs.
  6. 2
3 You need access to a Graphviz renderer: 4 5
  • By using a local installation of Graphviz and the [cci]dot[/cci] binary.
  • 7
  • By using a local installation and PHP bindings to the library.
  • 8
9 See the FAQ for more details on these options and for details on installing Graphviz on your web server. 10 11

Frequently Asked Questions


What is Graphviz?

13 Graphviz is a way of generating visualisations of structural relationships between objects. Almost any kind of diagram where something connects to something else can be drawn and automatically laid out using the language DOT. 14 15

How do I use this plugin?

16 Use the [cci][graphviz][/cci] shortcode. Various uses are explained in the "How to use" section. 17 18

How to I write DOT?

19 The online documentation for Graphviz is terse and not especially helpful, in particular the DOT language page is only helpful if you happen to be able to read an approximation of BNF. 20 21 There are however several other introductions to Graphviz and DOT, including an excerpt on the O'Reilly site. Another approach would be to look at the examples in the Graphviz gallery. 22 23

Where can I see examples?

24 28

Can I manipulate the rendered graph using CSS in my WordPress theme?

29 The [cci]img[/cci] elements are tagged with '[cci]class="graphviz"[/cci]'. 30 31

Nothing is being rendered, maybe my DOT is broken?

32 If you're using a local Graphviz renderer then errors from Graphviz should be presented where you expect the graph to appear. Note that because of how WordPress submits content to plugins the line numbering will not always match what you expect. 33 34 The error message when using the [cci]dot[/cci] binary will contain the command line used as well as a line-numbered copy of the DOT that was used. 35 36

I'm getting strange errors that make no sense, what gives?

37 WordPress encodes HTML entities inside the shortcode block which this plugin attempts to demangle. 38 39 Unfortunately WordPress can also try to do smart character replacement, such as "..." into a UNICODE ellipsis character. The Graphviz plugin contains a mapping of many of these back to their ASCII equivalents, but it may not be complete. Let us know if you think this is breaking your DOT. It's also possible that non-ASCII7 characters do strange things too. 40 41 Adding [cci]define("TFO_GV_DEBUG", true)[/cci] to [cci]wp_config.php[/cci] will cause the plugin to create some diagnostic files in your system [cci]tmp[/cci] directory. The file [cci][/cci] is the contents of the DOT as given to the plugin by WordPress, [cci][/cci] is the results of the plugin attempting to demangle it. The [cci]N[/cci] is a number that is incremented for each shortcode section interpreted. The plugin does not clean these files up. 42 43

How do I install the Graphviz program (not this plugin) locally?

44 This depends on your host. You will find some details at but many systems also have it in their own package management system, for example this is package [cci]graphviz[/cci] on Debian, Ubuntu and Fedora systems. 45 46


48 [graphviz lang="dot" output="svg" \ 49 simple="yes" imap="yes" href="self" \ 50 title="TFO Graphviz Demo"] 51 52 node [style="rounded,filled", color=lightblue2, 53 fontsize=10, shape=box]; 54 edge [arrowhead=vee, arrowsize=0.5]; 55 56 subgraph cluster_client { 57 node [label="File system", URL=""]; fs; 58 node [label="LVM", URL=""]; lvm; 59 node [label="Linux HBA driver", URL=""]; clienthba; 60 fs -> lvm -> clienthba; 61 bgcolor=lightgrey; 62 label = "Virtual Machine"; 63 URL = ""; 64 } 65 66 subgraph cluster_esxi { 67 node [label="Virtual HBA hardware"]; virtualhba; 68 node [label="VMDK file"]; vmdk; 69 node [label="vmfs"]; vmfs; 70 node [label="ESXi HBA driver"]; vmhba; 71 virtualhba -> vmdk -> vmfs -> vmhba; 72 bgcolor=white; 73 label = "Hypervisor"; 74 URL = ""; 75 } 76 77 subgraph cluster_hardware { 78 node [label="Physical HBA hardware", URL=""]; phba; 79 node [label="Physical disks", URL=""]; disks; 80 phba -> disks; 81 style=filled; bgcolor=lightgrey; 82 label = "Hardware"; 83 URL = ""; 84 } 85 86 style=filled; 87 bgcolor=aquamarine4; 88 fontsize=10; 89 labeljust=l; 90 91 clienthba -> virtualhba; 92 vmhba -> phba; 93 label = "I/O stack"; 94

TFO Graphviz Demo



  • Finally worked out how to disable [cci]wptexturize[/cci]! Less demangling now required.
  • Add an option to control whether we ever emit JavaScript.


  • Better diagnostic output when running [cci]dot[/cci] doesn't work, including the command line used and adding the DOT as submitted, with line numbers. (Joachim Durchholz)
  • Add more de-mangling rules, for smart quotes and ellipsis. (Joachim Durchholz)
  • Improve the newline de-mangling. (Joachim Durchholz)
  • Add the SVG output format. See for example. (Joachim Durchholz)
  • Add a fix for if the requires GV class isn't loadable, such as when GV gets upgraded on the system. (Sam Wilson)
  • Include some JavaScript when both an image map and width/height scaling is specified. This is required to scale the image map to whatever the image has been scaled to. Image map scaling code comes from


  • [cci]clean_url()[/cci] and [cci]attribute_escape()[/cci] have both been deprecated. Migrate to [cci]esc_url()[/cci] and [cci]esc_attr()[/cci]. (Sam Wilson)


  • Remove deprecated constructor definitions. (Sam Wilson)
  • Testing against 4.3.


  • Require at least WP 4.2 now.
  • Fix use of[cci]add_query_arg()[/cci] to escape its output; a possible XSS vector.


  • Make some debugging output conditional.
  • Fix where that debugging output is stored. (Sam Wilson)


  • Fix a packaging error in 1.7.
  • Fix use of hardcoded "/tmp" path. (Sam Wilson)


  • Test upto WP 4.2.2.
  • Change an [cci]exec("mv...")[/cci] to using [cci]rename()[/cci] instead. (Sam Wilson)
  • Code documentation improvement.
  • Some reformatting.


  • Fix some cosmetic documentation issues.


  • Update documentation for using the PHP gv bindings.


  • WordPress 4.0 support.
  • Fix for PHP Graphviz module loading; newer PHP's don't allow dl() at all in some cases, we should therefore detect this.
  • Use WP_Error properly.
  • Liberal use of try/catch to detect runtime issues.


  • No changes; version bump for the later 3.x series.


  • Removed leftover diagnostic code in PHP render class (which was appearing in posts!)
  • Added remote Graphviz rendering support. Note that this is still young and will add a mark to the graph indicating it was generated by this plugin.
  • Tested on WordPress 3.0.2 and 3.0.3.


  • Added support for locally installed PHP bindings to the Graphviz library. This only works if PHP either allows dl() to load a module or is staticly configured to load in php.ini.
  • Made render module selection somewhat more robust.
  • Attempt to create our wp-content/tfo-graphviz directory if it doesn't already exist.
  • Better (as in, "any at all") error generation in the shortcode handler.
  • Add content expiration - configurable. Will remove files from the wp-content/tfo-graphviz directory, but only if the threshold is >0 and older than the threshold.


  • First release.

Upgrade Notice

Upgrading from all previous versions strongly recommended; Earlier versions will not run on WordPress 4 or on older Apache/PHP installations.

How to use TFO Graphviz

The shortcode syntax is:


Error generating Graphviz image:

Graphviz cannot generate graph
Command: /usr/bin/dot '-Kdot' '-Tpng' '-o/data/'
Error: : syntax error in line 2 near '>'

Original DOT:


Where [cci][/cci] is anything from this list. All are entirely optional:

  • [cci]href="self|"[/cci]

    Encompasses the generated image with a link either to the image itself (with the [cci]self[/cci] value) or to the provided URL. If the option is empty (for example, [cci]href=""[/cci]) then no link is generated. This is the default.

  • [cci]id=""[/cci]

    Provides the identifier used to link the generated image to an image map. If you use the [cci]simple[/cci] option then it also provides the name of the generated DOT graph container (since Graphviz uses this to generate the image map). If not given then an identifier is generated with the form [cci]tfo_graphviz_N[/cci] whereN is an integer that starts at one when the plugin is loaded and is incremented with use.

  • [cci]imap="yes|no"[/cci]

    Graphviz can generate image maps using any URL's given in the DOT code so that clicking on objects in the resultant image will direct a web browser to a new page. The effect of this option is to both instruct Graphviz to generate a client-side image map and to also insert that map into the generated HTML. It will use the [cci]id[/cci] value as the name of the map (see the [cci]id[/cci] option for details). [cci]imap[/cci] defaults to [cci]no[/cci].

  • [cci]lang=""[/cci]

    Specifies the particular Graphviz interpreter to use. The default is [cci]dot[/cci].

  • [cci]output=""[/cci]

    Indicates the desired image format. Defaults to [cci]png[/cci].

  • [cci]simple="yes|no"[/cci]

    The [cci]simple[/cci] option provides a very basic DOT wrapper around your code such that the following is possible:



    The generated code would look like:

    digraph tfo_graphviz_1 {
    a -> b -> c;

    See the [cci]id[/cci] option for a description of where the name of the [cci]digraph[/cci] comes from. [cci]simple[/cci] defaults to [cci]no[/cci].

  • [cci]title=""[/cci] <p>Indicates the title of the image. This is used in the [cci]alt[/cci] and [cci]title[/cci] attributes of the image reference. This defaults to an empty string. Note that image maps may indicate a [cci]title[/cci] string which will appear in tool-tips. </li> </ul> <div class="lazysocialbuttons" data-float="left" data-buttons="google,twitter,facebook" data-twshareurl="" data-twtext="TFO Graphviz" data-shareurl="" data-fbhideflyout="false" data-backgroundtype="light"></div> </div><!-- .entry-content --> <footer class="entry-meta"> </footer><!-- .entry-meta --> </article><!-- #post --> <div id="comments" class="comments-area"> <h2 class="comments-title"> 3 thoughts on “<span>TFO Graphviz</span>” </h2> <ol class="commentlist"> <li class="pingback even thread-even depth-1" id="comment-10"> <p>Pingback: <a href='' rel='external nofollow' class='url'>Adding Graphviz - The Karalli Pages</a> </p> </li><!-- #comment-## --> <li class="pingback odd alt thread-odd thread-alt depth-1" id="comment-11"> <p>Pingback: <a href='' rel='external nofollow' class='url'>Promethean Chasms | Petty</a> </p> </li><!-- #comment-## --> <li class="pingback even thread-even depth-1" id="comment-12"> <p>Pingback: <a href='' rel='external nofollow' class='url'>Personal Dataflow | Petty</a> </p> </li><!-- #comment-## --> </ol><!-- .commentlist --> <div id="respond" class="comment-respond"> <h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/projects/tfo-graphviz/#respond" style="display:none;">Cancel reply</a></small></h3><p class="must-log-in">You must be <a href="">logged in</a> to post a comment.</p> </div><!-- #respond --> </div><!-- #comments .comments-area --> </div><!-- #content --> </div><!-- #primary --> <div id="secondary" class="widget-area" role="complementary"> <aside id="meta" class="widget widget_meta"> <h3 class="widget-title">Prunus sine via</h3> <ul> <li><a rel="nofollow" href="">Log in</a></li> <li><a href="" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li> <li><a href="" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li> </ul> </aside><aside id="archives-3" class="widget widget_archive"><h3 class="widget-title">Archives</h3> <ul> <li><a href=''>November 2015</a></li> <li><a href=''>April 2011</a></li> <li><a href=''>February 2011</a></li> <li><a href=''>January 2011</a></li> <li><a href=''>November 2010</a></li> <li><a href=''>October 2010</a></li> </ul> </aside><aside id="categories-3" class="widget widget_categories"><h3 class="widget-title">Categories</h3> <ul> <li class="cat-item cat-item-4"><a href="" title="Stuff from me, about me">Personal</a> </li> <li class="cat-item cat-item-8"><a href="" title="Technology items">Technology</a> <ul class='children'> <li class="cat-item cat-item-5"><a href="" title="Apple items">Apple</a> <ul class='children'> <li class="cat-item cat-item-3"><a href="" title="iOS software items, including development">iOS</a> </li> </ul> </li> <li class="cat-item cat-item-14"><a href="" title="WordPress stuff">WordPress</a> </li> </ul> </li> </ul> </aside><aside id="nktagcloud-3" class="widget widget_nktagcloud"><h3 class="widget-title">Tags</h3><a href='' class='tag-link-12 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>ABC of the Sea</a> <a href='' class='tag-link-81 nktagcloud-13' title='3' rel="tag" style='font-size: 13.6pt;'>Apple</a> <a href='' class='tag-link-30 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>automation</a> <a href='' class='tag-link-28 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>BetaBuilder</a> <a href='' class='tag-link-53 nktagcloud-13' title='3' rel="tag" style='font-size: 13.6pt;'>Dell</a> <a href='' class='tag-link-50 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>ESXi</a> <a href='' class='tag-link-69 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>Graphviz</a> <a href='' class='tag-link-32 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>Hunter Hillegas</a> <a href='' class='tag-link-80 nktagcloud-22' title='6' rel="tag" style='font-size: 22pt;'>iOS</a> <a href='' class='tag-link-24 nktagcloud-16' title='4' rel="tag" style='font-size: 16.4pt;'>iPad</a> <a href='' class='tag-link-23 nktagcloud-16' title='4' rel="tag" style='font-size: 16.4pt;'>iPhone</a> <a href='' class='tag-link-63 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>Linux</a> <a href='' class='tag-link-21 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>Objective C</a> <a href='' class='tag-link-17 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>Programming</a> <a href='' class='tag-link-52 nktagcloud-13' title='3' rel="tag" style='font-size: 13.6pt;'>RAID</a> <a href='' class='tag-link-59 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>RE4‑GP</a> <a href='' class='tag-link-27 nktagcloud-16' title='4' rel="tag" style='font-size: 16.4pt;'>shell script</a> <a href='' class='tag-link-49 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>VMware</a> <a href='' class='tag-link-58 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>Western Digital</a> <a href='' class='tag-link-84 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>WordPress</a> <a href='' class='tag-link-26 nktagcloud-10' title='2' rel="tag" style='font-size: 10.8pt;'>Xcode</a></aside><aside id="ws_widget__ad_squares-3" class="widget ad-squares"><div style="margin:0 auto 0 auto; text-align:center;"> <table cellpadding="0" cellspacing="0" style="border:0; margin:0 auto 0 auto;"> <tbody> <tr> <td style="padding:0 5px 0 0;"><script async src="//"></script> <!-- blog 120x600 --> <ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-1817095557389392" data-ad-slot="1037389671"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script></td> <td style="padding:0 0 0 0;"><script async src="//"></script> <!-- blog 120x600 --> <ins class="adsbygoogle" style="display:inline-block;width:120px;height:600px" data-ad-client="ca-pub-1817095557389392" data-ad-slot="1037389671"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script></td> </tr> </tbody> </table> </div> </aside><aside id="text-5" class="widget widget_text"> <div class="textwidget"><a href="">free spam filter</a></div> </aside> </div><!-- #secondary --> <div id='avatar_footer_credit' style='display: none;'>Avatars by <a href=''>Sterling Adventures</a></div> </div><!-- #main .wrapper --> <footer id="colophon" role="contentinfo"> <div class="site-info"> <a href="" title="Semantic Personal Publishing Platform">Proudly powered by WordPress</a> </div><!-- .site-info --> </footer><!-- #colophon --> </div><!-- #page --> <script type='text/javascript'> // **** Start Plugin Implementation **************************** // Uncomment the code line below to specify the path to the two images // under two circumstances: 1) you are using the HTML decoration auto-wireup // and 2) your images are not in the same root folder as the executing script // (which would be used automatically if not specified) var lazySocialButtonsImagePath = ''; // This is the asynchronous loader for the plugin script. // It also handles a ready callback if specified, by checking // to see if the plugin is fully loaded before trying to execute // the callback. (function (loaded){ var d = document, id = 'LazySocialButtonsScript', src = ''; var js, st = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) { return; } js = d.createElement('script'); = id; js.type = 'text/javascript'; js.async = true; js.src = src; st.parentNode.insertBefore(js, st); // if we have a callback, execute it if (typeof(loaded) === 'function') { (function checkLoaded() { if (!$.fn.lazySocialButtons) setTimeout(checkLoaded, 100); else loaded(); })(); } })(); </script> <!-- Plugin: WP Analytics Tracking --> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//','ga'); ga('create', 'UA-18916791-1', 'auto'); ga('require', 'displayfeatures'); ga('require', 'linkid', 'linkid.js'); ga('send', 'pageview'); </script><script type="text/javascript"> function tocToggle(toc, box) { var q = jQuery(toc); if (!q) return; q.slideToggle('fast', function() { jQuery(box).toggleClass('toc-collapsed', q.css('display') == 'none'); }); } </script> <div style="display:none"> </div> <script type='text/javascript' src=''></script> <script type='text/javascript' src=''></script> <script type='text/javascript'> /* <![CDATA[ */ var thickboxL10n = {"next":"Next >","prev":"< Prev","image":"Image","of":"of","close":"Close","noiframes":"This feature requires inline frames. You have iframes disabled or your browser does not support them.","loadingAnimation":"http:\/\/\/wp-includes\/js\/thickbox\/loadingAnimation.gif"}; /* ]]> */ </script> <script type='text/javascript' src=''></script> <script type='text/javascript' src=''></script> <script type='text/javascript' src=''></script> <script type='text/javascript' src=''></script> <script type='text/javascript' src=''></script> <!-- Begin Shadowbox JS v3.0.3.10 --> <!-- Selected Players: html, iframe, img, qt, swf, wmp --> <script type="text/javascript"> /* <![CDATA[ */ var shadowbox_conf = { autoDimensions: false, animateFade: true, animate: true, animSequence: "sync", autoplayMovies: true, continuous: false, counterLimit: 10, counterType: "default", displayCounter: true, displayNav: true, enableKeys: true, flashBgColor: "#000000", flashParams: {bgcolor:"#000000", allowFullScreen:true}, flashVars: {}, flashVersion: "9.0.0", handleOversize: "resize", handleUnsupported: "link", initialHeight: 160, initialWidth: 320, modal: false, overlayColor: "#000", showMovieControls: true, showOverlay: true, skipSetup: false, slideshowDelay: 0, useSizzle: false, viewportPadding: 20 }; Shadowbox.init(shadowbox_conf); /* ]]> */ </script> <!-- End Shadowbox JS --> <script type='text/javascript' src='' async defer></script> <script type='text/javascript'> _stq = window._stq || []; _stq.push([ 'view', {v:'ext',j:'1:4.6',blog:'16431922',post:'559',tz:'-5',srv:''} ]); _stq.push([ 'clickTrackerInit', '16431922', '559' ]); </script> </body> </html>