I'm trying to draw some silly diagrams with dot, based on code stolen from tutorials here: http://irreal.org/blog/?p=2866 and here: http://orgmode.org/worg/org-tutorials/org-dot-diagrams.html The code won't work, though I can generate the diagram using a somewhat clumsier method from here: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-dot.html Here are my two tables, one for nodes and one for edges (the real ones are longer, with something like 30 or 40 nodes): #+name: students-table | *node* | *label* | *shape* | *fillcolor* | |--------+-----------+---------+-------------| | a | Omar | ellipse | green | | b | Hindia | ellipse | orange | | c | Yuvrai | ellipse | purple | #+name: students-graph | a | b | | a | c | | b | c | I can generate my table using these two code blocks: #+name: make-dot #+BEGIN_SRC emacs-lisp :var table=students-table graph=students-graph :results output :exports none (mapcar #'(lambda (x) (princ (format "%s [label=\"%s\" shape=%s style=\"filled\" fillcolor=\"%s\"];\n" (car x) (second x) (nth 2 x) (nth 3 x) ))) table) (mapcar #'(lambda (x) (princ (format "%s -- %s;\n" (first x) (second x)))) graph) #+END_SRC #+BEGIN_SRC dot :file Images/test-dot.png :var input=make-dot :exports results graph { rankdir=TB $input } #+END_SRC I would, however, like to avoid the clumsy intermediate step and use something like this instead: #+name: graph-from-tables #+HEADER: :var nodes=students-table graph=students-graph horiz='t #+BEGIN_SRC emacs-lisp :file ~/example-diagram.png :colnames yes :exports results (org-babel-execute:dot (concat "graph {\n" (when horiz "rankdir=LR;\n") ;up-down or left-right (mapconcat (lambda (x) (format "%s [label=\"%s\" shape=%s style=\"filled\" fillcolor=\"%s\"]" (car x) (nth 1 x) (if (string= "" (nth 2 x)) "box" (nth 2 x)) (if (string= "" (nth 3 x)) "none" (nth 3 x)) )) nodes "\n") "\n" (mapconcat (lambda (x) (format "%s -- %s;" (car x) (nth 1 x) )) graph "\n") "}\n") params) #+END_SRC However, this just creates a file ~/example-diagram.png whose content is "nil%". I'm not sure how to debug the problem. Any suggestions? Does this code work for you guys? I am using an uptodate arch linux, emacs 25, and a recent graphviz. thanks as always for the help. Also -- WISHLIST: instead of a manually-entered list of edges, I'd like to randomly create a random set of connections between the nodes. I can easily create a list of nodes: (let ((names () )) (dolist (x nodes) (push (nth 1 x ) names) ) ... do some stuff here) but generating a list of unique edges -- that is, node pairs where (a . b) and (b . a) are considered equivalent -- is somewhat beyond me. Again, many thanks, Matt