|
@@ -181,9 +181,11 @@ and dependant variables."
|
|
(setf back-edge "") (setf front-edge "")))))
|
|
(setf back-edge "") (setf front-edge "")))))
|
|
row-vals))
|
|
row-vals))
|
|
|
|
|
|
-(defun org-plot/gnuplot-script (data-file num-cols params)
|
|
|
|
|
|
+(defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
|
|
"Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
|
|
"Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
|
|
-NUM-COLS controls the number of columns plotted in a 2-d plot."
|
|
|
|
|
|
+NUM-COLS controls the number of columns plotted in a 2-d plot.
|
|
|
|
+Optional argument PREFACE returns only option parameters in a
|
|
|
|
+manner suitable for prepending to a user-specified script."
|
|
(let* ((type (plist-get params :plot-type))
|
|
(let* ((type (plist-get params :plot-type))
|
|
(with (if (equal type 'grid)
|
|
(with (if (equal type 'grid)
|
|
'pm3d
|
|
'pm3d
|
|
@@ -238,7 +240,8 @@ NUM-COLS controls the number of columns plotted in a 2-d plot."
|
|
(add-to-script (concat "set timefmt \""
|
|
(add-to-script (concat "set timefmt \""
|
|
(or timefmt ;; timefmt passed to gnuplot
|
|
(or timefmt ;; timefmt passed to gnuplot
|
|
"%Y-%m-%d-%H:%M:%S") "\"")))
|
|
"%Y-%m-%d-%H:%M:%S") "\"")))
|
|
- (case type ;; plot command
|
|
|
|
|
|
+ (unless preface
|
|
|
|
+ (case type ;; plot command
|
|
('2d (dotimes (col num-cols)
|
|
('2d (dotimes (col num-cols)
|
|
(unless (and (equal type '2d)
|
|
(unless (and (equal type '2d)
|
|
(or (and ind (equal (+ 1 col) ind))
|
|
(or (and ind (equal (+ 1 col) ind))
|
|
@@ -259,8 +262,8 @@ NUM-COLS controls the number of columns plotted in a 2-d plot."
|
|
('grid
|
|
('grid
|
|
(setq plot-lines (list (format "'%s' with %s title ''"
|
|
(setq plot-lines (list (format "'%s' with %s title ''"
|
|
data-file with)))))
|
|
data-file with)))))
|
|
- (add-to-script
|
|
|
|
- (concat plot-cmd " " (mapconcat 'identity (reverse plot-lines) ",\\\n ")))
|
|
|
|
|
|
+ (add-to-script
|
|
|
|
+ (concat plot-cmd " " (mapconcat 'identity (reverse plot-lines) ",\\\n "))))
|
|
script)))
|
|
script)))
|
|
|
|
|
|
;;-----------------------------------------------------------------------------
|
|
;;-----------------------------------------------------------------------------
|
|
@@ -328,10 +331,13 @@ line directly before or after the table."
|
|
;; write script
|
|
;; write script
|
|
(with-temp-buffer
|
|
(with-temp-buffer
|
|
(if (plist-get params :script) ;; user script
|
|
(if (plist-get params :script) ;; user script
|
|
- (progn (insert-file-contents (plist-get params :script))
|
|
|
|
- (goto-char (point-min))
|
|
|
|
- (while (re-search-forward "$datafile" nil t)
|
|
|
|
- (replace-match data-file nil nil)))
|
|
|
|
|
|
+ (progn (insert
|
|
|
|
+ (org-plot/gnuplot-script data-file num-cols params t))
|
|
|
|
+ (insert "\n")
|
|
|
|
+ (insert-file-contents (plist-get params :script))
|
|
|
|
+ (goto-char (point-min))
|
|
|
|
+ (while (re-search-forward "$datafile" nil t)
|
|
|
|
+ (replace-match data-file nil nil)))
|
|
(insert
|
|
(insert
|
|
(org-plot/gnuplot-script data-file num-cols params)))
|
|
(org-plot/gnuplot-script data-file num-cols params)))
|
|
;; graph table
|
|
;; graph table
|