Guile Plotutils has two components: one which basically does vector graphics onto image surfaces, and the other which graphs data.
For the plot component, the concept of operations is this
A simple example could be this below, which opens a bitmap surface, creates a virtual pen, and then draws on the surface. Upon completion, a PNG file is created.
(use-modules (plotutils plot)) (define fp (open-output-file "tmp.png" #:binary #t)) (define param (newplparams)) (setplparam! param "BITMAPSIZE" "400x400") (define plotter (newpl "png" fp (current-error-port) param)) (openpl! plotter) (space! plotter 0.0 0.0 1000.0 1000.0) (linewidth! plotter 0.25) (pencolorname! plotter "red") (erase! plotter) (move! plotter 600.0 300.0) (closepl! plotter) (close fp)
The graph component expresses GNU Plotutils’s graphing capabilities, which can plot data or functions on a set of xy axes.
(use-modules (plotutils graph))
(define xvalues (iota 101 0 0.1))
(with-output-to-port ``tmp.png''
(lambda ()
(graph xvalues yvalues
#:output-format ``png''
#:top-label ``Title''))
#:binary #t)