Skip to content

Instantly share code, notes, and snippets.

@vyzo
Created November 24, 2008 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyzo/28599 to your computer and use it in GitHub Desktop.
Save vyzo/28599 to your computer and use it in GitHub Desktop.
gnuplotting with plt-scheme
(require (planet vyzo/gnuplot))
(define gplot (gnuplot-spawn))
;; data for x, x^2, 2^x
(define data
(gnuplot-data
(build-list 100
(lambda (x) (let ((x (/ x 10.))) (list x (expt x 2) (expt 2 x)))))))
;; on screen plot
(gnuplot-set gplot '(title (str "growth curves")))
(gnuplot-plot gplot
(gnuplot-item data '(using (seq: 1 1) title (str "x") with line))
(gnuplot-item data '(using (seq: 1 2) title (str "x^2") with line))
(gnuplot-item data '(using (seq: 1 3) title (str "2^x") with line)))
;; replot to png
(gnuplot-hardcopy gplot "/tmp/grow.png" #:term '(png))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment