Below code will draw a tree graph with dot, it works fine but the output graph has been included in "".
#+NAME: nodes
| From | To | Weight |
|------+----+--------|
| A | B | 3 |
| A | C | 2 |
| B | D | 4 |
| B | E | 5 |
| C | F | 10 |
#+BEGIN_SRC elisp :results output :wrap image :var nodes=nodes
(defun rowfun(x)
(format "%s -> %s [label=%s];" (nth 0 x) (nth 1 x) (nth 2 x))
)
(defun dotgen(nodes)
(let ((dotbegin "digraph {\nnode [shape=circle]\n")
(dotend "\n}"))
(concat dotbegin
(mapconcat #'rowfun nodes "\n")
dotend)))
(setq dotname "test.dot")
(setq pngname (format "%s.png"
(replace-regexp-in-string "\.dot" "" dotname)))
(with-temp-file dotname (insert (dotgen nodes)))
(shell-command-to-string (format "dot -Tpng %s -o %s" dotname pngname))
(delete-file dotname)
(print (format "[[./%s]]" pngname))
#+END_SRC
#+RESULTS:
#+BEGIN_image
"[[./test.png]]"
#+END_image
The output:
How can I get a clean image without the extra "" printed before and end of the picture?
"[[./test.png]]"
to[[./test.png]]
(print (make-symbol "my-unquoted-string"))
). Unfortunately that doesn't work for your circumstance with square brackets.