(use (prefix gnuplot-pipe gp:)) (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:send "set xlabel 'x'") (gp:send "plot sin(x)") (gp:save "1.png")) ;;; Plot x and y axes data as lines. (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:plot "title 'x^2'" '(1 2 3 4) '(1 4 9 16)) (gp:save "2.png")) ;;; Plot multiple curves. (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:plot '(("title 'x^2'" (1 2 3 4) (1 4 9 16)))) (gp:save "3.png")) (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:plot '(("title 'x^2'" (1 2 3 4) (1 4 9 16)) ("title 'x^3'" (1 2 3 4) (1 8 27 64)))) (gp:save "4.png")) (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:plot '(("title 'x'" (1 2 3 4) (1 2 3 4)) ("title 'x^2'" (1 2 3 4) (1 4 9 16)) ("title 'x^3'" (1 2 3 4) (1 8 27 64)))) (gp:save "5.png")) ;;; 3d plot. (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:send "unset key") (gp:send "set style data points") (gp:send "set title 'The valley of the Gnu'") (gp:plot3d "" '(0 0 0 1 1 1 2 2 2 3 3 3) '(0 1 2 0 1 2 0 1 2 0 1 2) '(10 10 10 10 5 10 10 1 10 10 0 10)) (gp:save "6.png")) (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:send "unset key") (gp:send "set style data points") (gp:send "set title 'The valley of the Gnu'") (gp:plot3d '(("" (0 0 0 1 1 1 2 2 2 3 3 3) (0 1 2 0 1 2 0 1 2 0 1 2) (10 10 10 10 5 10 10 1 10 10 0 10)))) (gp:save "7.png")) (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:send "set style data points") (gp:send "set title 'The valley of the Gnu'") (gp:plot3d '(("title 'series 1'" (0 0 0 1 1 1 2 2 2 3 3 3) (0 1 2 0 1 2 0 1 2 0 1 2) (10 10 10 10 5 10 10 1 10 10 0 10)) ("title 'series 2'" (0 0 0 1 1 1 2 2 2 3 3 3) (0 1 2 0 1 2 0 1 2 0 1 2) (10 10 10 10 5 10 10 1 10 10 0 10)))) (gp:save "8.png")) ;;; Pie chart. (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:send "set xrange [-15:15]") (gp:send "set style fill transparent solid 0.9 noborder") (gp:plot "using 1:2:3:4:5:6 with circles lc var" '(0 0 0 0 0) '(0 0 0 0 0) '(5 5 5 5 5) '(0 30 70 120 230) '(30 70 120 230 360) '(1 2 3 4 5)) (gp:save "9.png")) ;;; Matrix (gp:call/gnuplot (gp:send "set term wxt nopersist") (gp:plot "matrix with image" '(5 2 0 0) '(4 2 0 1) '(3 0 0 2) '(1 0 1 4) '(0 1 0 3)) (gp:end-data) (gp:save "10.png")) (define stdout (current-output-port)) (gp:call/gnuplot (display "This text must be directed towards stdout\n" stdout))