Function: calc-graph-add-curve
calc-graph-add-curve is a byte-compiled function defined in
calc-graph.el.gz.
Signature
(calc-graph-add-curve XDATA YDATA &optional ZDATA)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-graph.el.gz
(defun calc-graph-add-curve (xdata ydata &optional zdata)
(let ((num (calc-graph-count-curves))
(pstyle (calc-var-value 'var-PointStyles))
(lstyle (calc-var-value 'var-LineStyles)))
(with-current-buffer calc-gnuplot-input
(goto-char (point-min))
(if (re-search-forward (if zdata "^plot[ \t]" "^splot[ \t]")
nil t)
(error "Can't mix 2d and 3d curves on one graph"))
(if (re-search-forward "^s?plot[ \t]" nil t)
(progn
(end-of-line)
(insert ", "))
(goto-char (point-max))
(or (eq (preceding-char) ?\n)
(insert "\n"))
(insert (if zdata "splot" "plot") " \n")
(forward-char -1))
(insert "{" (symbol-name (nth 1 xdata))
":" (symbol-name (nth 1 ydata)))
(if zdata
(insert ":" (symbol-name (nth 1 zdata))))
(insert "} "
"title \"" (symbol-name (nth 1 ydata)) "\" "
"with dots")
(setq pstyle (and (eq (car-safe pstyle) 'vec) (nth (1+ num) pstyle)))
(setq lstyle (and (eq (car-safe lstyle) 'vec) (nth (1+ num) lstyle))))
(calc-graph-set-styles
(or (and (Math-num-integerp lstyle) (math-trunc lstyle))
0)
(or (and (Math-num-integerp pstyle) (math-trunc pstyle))
(if (eq (car-safe (calc-var-value (nth 2 ydata))) 'vec)
0 -1))
(math-contains-sdev-p (eval (nth 2 ydata) t)))))