Next: , Up: Language Quirks   [Contents]


4.1 Gnuplot

Guile Blocks has two language procedures for Gnuplot. One is gnuplot-raw, in which no special formatting is added by Guile Blocks and the code field is sent unmodified by Gnuplot (beyond normal pipeline/combination rules).

Alternatively, one can use the gnuplot language procedure. Both gnuplot-raw and gnuplot take an output keyword argument to set the block result field. gnuplot takes two additional keyword arguments: term and terminate-data?. term is used as a shorthand to set the output terminal type. For example:

(make-block* #:language (gnuplot #:output "foo.png" #:term "png")
             #:code "...")
;; Results in the following Gnuplot script:
;;
;; set term png
;; set output foo.png
;; ...

terminate-data? appends an e character to the end of the script. This is useful when Gnuplot is run in a pipeline with another block providing input. Instead of fetching data from a temporary file, the data can be spliced into the Gnuplot script. When Gnuplot plots the special character '-' it will read the data from the script, only stopping when encountering an e character.

(make-block* #:language (gnuplot #:output "foo.png"
                                 #:term "png"
                                 #:terminate-data? #t)
             #:code "
plot '-' with lines
%code%")
;; Results in the following Gnuplot script
;;
;; set term png
;; set output foo.png
;; plot '-' with lines
;; %code% # <- replaced with previous block's result
;; e