... should create a PDF and open it. However, instead:
1. Unhandled java.lang.IllegalArgumentException
No value supplied for key: [:fmt :pdf]
Inspecting the code:
(defn render-to-bytes
"Renders the graph g in the image format using GraphViz and returns data
as a byte array.
Requires GraphViz's 'dot' (or a specified algorithm) to be installed in
the shell's path. Possible algorithms include :dot, :neato, :fdp, :sfdp,
:twopi, and :circo. Possible formats include :png, :ps, :pdf, and :svg."
[g & {:keys [alg fmt] :or {alg "dot" fmt :png} :as opts}]
(let [dot (apply dot-str g (apply concat opts))
{:keys [out]} (sh (name alg) (str "-T" (name fmt)) :in dot :out-enc :bytes)]
out))
(defn view
"Converts graph g to a temporary image file using GraphViz and opens it
in the current desktop environment's default viewer for said files.
Requires GraphViz's 'dot' (or a specified algorithm) to be installed in
the shell's path. Possible algorithms include :dot, :neato, :fdp, :sfdp,
:twopi, and :circo. Possible formats include :png, :ps, :pdf, and :svg."
[g & {:keys [fmt] :or {fmt :png} :as opts}]
(open-data (apply render-to-bytes g opts) fmt))
On the last line, (apply ... opts) -- opts should presumably be (apply concat opts). (This is why I don't like positional keyword arguments very much :))
I have created a PR fixing this issue. Workaround until then: add the labels you want to the graph directly instead of relying on passing opts to view. That is, until there's a new bugfix release :)
Trivial repro:
... should create a PDF and open it. However, instead:
Inspecting the code:
On the last line,
(apply ... opts)
--opts
should presumably be(apply concat opts)
. (This is why I don't like positional keyword arguments very much :))