forked from mirrors/org-mode
gnuplot: switching to using user defined variables for handling variables
This will require gnuplot version 4.2 or up
This commit is contained in:
parent
01c6bd2b33
commit
9bdddde454
|
@ -77,12 +77,13 @@ called by `org-babel-execute-src-block'."
|
|||
(y-labels (plist-get params :ylabels))
|
||||
(time-ind (plist-get params :timeind)))
|
||||
;; insert variables into code body
|
||||
(mapc
|
||||
(lambda (pair)
|
||||
(setq body
|
||||
(replace-regexp-in-string
|
||||
(regexp-quote (format "%s" (car pair))) (cdr pair) body)))
|
||||
vars)
|
||||
(setq body
|
||||
(concat
|
||||
(mapconcat
|
||||
(lambda (pair) (format "%s = \"%s\"" (car pair) (cdr pair)))
|
||||
vars "\n")
|
||||
"\n"
|
||||
body))
|
||||
;; append header argument settings to body
|
||||
(when title (add-to-script (format "set title '%s'" title))) ;; title
|
||||
(when lines (mapc (lambda (el) (add-to-script el)) lines)) ;; line
|
||||
|
|
|
@ -2119,12 +2119,14 @@ This could probably be added to [[file:lisp/org-babel-script.el][org-babel-scrip
|
|||
#+srcname: implementing-gnuplot
|
||||
#+begin_src gnuplot :var data=gnuplot-data
|
||||
set title "Implementing Gnuplot"
|
||||
plot "data" using 1:2 with lines
|
||||
plot data using 1:2 with lines
|
||||
#+end_src
|
||||
|
||||
|
||||
|
||||
**** DONE add variables
|
||||
gnuplot 4.2 and up support user defined variables. This is how
|
||||
we will handle variables with org-babel (meaning we will need to
|
||||
require gnuplot 4.2 and up for variable support).
|
||||
|
||||
- scalar variables should be replaced in the body of the gnuplot code
|
||||
- vector variables should be exported to tab-separated files, and
|
||||
the variable names should be replaced with the path to the files
|
||||
|
|
Loading…
Reference in a new issue