This cool trick (some would call it "dirty hack" ) by @plantarum can be used for #dot/#graphviz, as well:
(defun my-babel-execute-maybe ()
(interactive)
(org-mode)
(org-babel-execute-maybe)
(org-display-inline-images)
(normal-mode))
E.g. imagine this comment or doc string:
/*
#+BEGIN_SRC dot :file myfunction.svg :cmdline -Kdot -Tsvg
digraph {
a -> b;
}
#+END_SRC
*/