I'm using a nice package from a Racket user called MetaPict, however, I don't know how to export the image produced. Here's some Racket code calling MetaPict:
#+begin_src scheme :session mainsession :exports both (require racket/draw metapict metapict/graph) (set-curve-pict-size 300 300) ; width and height of image (ahlength 1.0) ; size of arrow head (define (f x) (sin x)) (define p (with-window (window -12 12 -12 12) ; xmin, xmax, ymin, ymax (draw (draw-arrow (curve (pt -10 0) -- (pt 10 0))) ; x-axis (draw-arrow (curve (pt 0 -10) -- (pt 0 10))) ; y-axis (label-rt "x" (pt 10.2 0)) ; label for x axis (label-top "y" (pt 0 10.2)) ; label for y axis (color "blue" (draw (circle (pt 2 1) 3))) ; center (2,1) radius 3 (color "red" (draw (graph f -10 10 #:samples 50)))))) (define (save-pict-as-svg p width height filename [exists 'replace]) (define dc (new svg-dc% [width width] [height height] [output filename] [exists exists])) (send dc start-doc "An SVG Test") ; a message (send dc start-page) (draw-pict p dc 0 0) (send dc end-page) (send dc end-doc)) (save-pict-as-svg p 300 300 "images/outtestmetapict1.svg") #+end_src
No surprise, but orgmode doesn't know that the image output
(save-pict-as-svg p 300 300 "images/outtestmetapict1.svg")
should be the code block's results and then displaying it as an image. And adding
#+RESULTS: over a hand-added
[[file:images/outtestmetapict1.svg]] link makes it not display. I'm guessing this means orgmode does things internally with, say, gnuplot to make the generated image be the results, hence, obeying the
:exports both . . . Any ideas how I can get this gnuplot-like behavior with Racket MetaPict? I'm guessing there is no trick, just a customization of the underlying babel code being necessary. . . .