|
From: Akshay S. <ak...@us...> - 2013-02-26 06:33:59
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "matlisp".
The branch, tensor has been updated
via 8d1294ce927280b8f2633b1e8636bd8aacfbf45d (commit)
from 36eb4f85eaf7042a8f2bcf7a1af1f48dddd7bb45 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 8d1294ce927280b8f2633b1e8636bd8aacfbf45d
Author: Akshay Srinivasan <aks...@gm...>
Date: Mon Feb 25 22:33:15 2013 -0800
Minor changes to gnuplot.lisp.
diff --git a/lib-src/gnuplot/gnuplot.lisp b/lib-src/gnuplot/gnuplot.lisp
index e895bb4..4894a43 100644
--- a/lib-src/gnuplot/gnuplot.lisp
+++ b/lib-src/gnuplot/gnuplot.lisp
@@ -8,24 +8,30 @@
ccl:run-program
gnuplot-binary nil :input :stream :wait nil :output t))
-(defun plot2d (data &key (color (list "#FF0000")) (stream (#+:sbcl
- sb-ext:process-input
- #+:ccl
- ccl:external-process-input-stream
- *current-gnuplot-process*)))
- (with-open-file (s "/tmp/matlisp-gnuplot.out" :direction :output :if-exists :supersede :if-does-not-exist :create)
- (loop :for i :from 0 :below (loop :for x :in data :minimizing (number-of-elements x))
- :do (loop :for x :in data :do (format s "~a " (tensor-ref x i)) :finally (format s "~%"))))
- (format stream "plot '/tmp/matlisp-gnuplot.out' with lines linecolor rgb ~s~%" color)
- (finish-output stream))
+(defun plot2d (data &key (color (list "#FF0000")))
+ (unless *current-gnuplot-process*
+ (setf *current-gnuplot-process* (open-gnuplot-stream)))
+ (let ((stream (#+:sbcl
+ sb-ext:process-input
+ #+:ccl
+ ccl:external-process-input-stream
+ *current-gnuplot-process*)))
+ (with-open-file (s "/tmp/matlisp-gnuplot.out" :direction :output :if-exists :supersede :if-does-not-exist :create)
+ (loop :for i :from 0 :below (loop :for x :in data :minimizing (number-of-elements x))
+ :do (loop :for x :in data :do (format s "~a " (tensor-ref x i)) :finally (format s "~%"))))
+ (format stream "plot '/tmp/matlisp-gnuplot.out' with lines linecolor rgb ~s~%" color)
+ (finish-output stream)))
-(defun gnuplot-send (str &key (stream (#+:sbcl
- sb-ext:process-input
- #+:ccl
- ccl:external-process-input-stream
- *current-gnuplot-process*)))
- (format stream "~a~%" str)
- (finish-output stream))
+(defun gnuplot-send (str)
+ (unless *current-gnuplot-process*
+ (setf *current-gnuplot-process* (open-gnuplot-stream)))
+ (let (stream (#+:sbcl
+ sb-ext:process-input
+ #+:ccl
+ ccl:external-process-input-stream
+ *current-gnuplot-process*))
+ (format stream "~a~%" str)
+ (finish-output stream)))
;; (defclass gnuplot-plot-info ()
-----------------------------------------------------------------------
Summary of changes:
lib-src/gnuplot/gnuplot.lisp | 40 +++++++++++++++++++++++-----------------
1 files changed, 23 insertions(+), 17 deletions(-)
hooks/post-receive
--
matlisp
|