Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; This file: ;; http://anggtwu.net/LISP/2025-may-gnuplot.lisp.html ;; http://anggtwu.net/LISP/2025-may-gnuplot.lisp ;; (find-angg "LISP/2025-may-gnuplot.lisp") ;; From: https://screwlisp.small-web.org/programming/common-lisp-invoking-gnuplot/ ;; Author: screwlisp ;; Trivial changes by: Eduardo Ochs <eduardoochs@gmail.com> (require "asdf") (defun gnuplot (title &rest x-y-lists) "gnuplot (title &rest x-y-lists) Like (gnuplot \"Descriptive title\" '((1 2) (3 4)) '((5 6) (7 8))) Pops up ('persists') the plot. Simple default behaviour. " (let ((cmd (format nil "gnuplot -p -e \"~ set title '~a'; ~ unset key; ~ unset xtics; ~ set xrange [~,1f:~,1f]; ~ set yrange [~,1f:~,1f]; ~ plot ~{~1*'-' using 1:2 with lines~^,~^ ~};~ \"" title (apply 'min (mapcar 'car (apply 'append x-y-lists))) (1+ (apply 'max (mapcar 'car (apply 'append x-y-lists)))) (apply 'min (mapcar 'cadr (apply 'append x-y-lists))) (1+ (apply 'max (mapcar 'cadr (apply 'append x-y-lists)))) x-y-lists))) (with-input-from-string (in (format nil "~{~{~{~,1f ~,1f~}~%~}e~^~%~}" x-y-lists)) (uiop:run-program cmd :input in)))) #| * (eepitch-sbcl) * (eepitch-kill) * (eepitch-sbcl) (load "2025-may-gnuplot.lisp") (gnuplot "with a bad title" '((1 2) (3 4)) '((5 6) (7 8))) (apply 'gnuplot "with a bad title" '(((1 2) (3 4)) ((5 6) (7 8)))) |#