Created
November 24, 2008 20:38
-
-
Save vyzo/28599 to your computer and use it in GitHub Desktop.
gnuplotting with plt-scheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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