emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc-graph.el,v


From: Jay Belanger
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-graph.el,v
Date: Fri, 03 Aug 2007 05:22:49 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Jay Belanger <jpb>      07/08/03 05:22:49

Index: calc-graph.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc-graph.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- calc-graph.el       26 Jul 2007 05:26:40 -0000      1.25
+++ calc-graph.el       3 Aug 2007 05:22:48 -0000       1.26
@@ -218,7 +218,8 @@
          0)
      (or (and (Math-num-integerp pstyle) (math-trunc pstyle))
          (if (eq (car-safe (calc-var-value (nth 2 ydata))) 'vec)
-             0 -1)))))
+             0 -1))
+     (math-contains-sdev-p (eval (nth 2 ydata))))))
 
 (defun calc-graph-lookup (thing)
   (if (and (eq (car-safe thing) 'var)
@@ -792,6 +793,10 @@
          calc-graph-numsteps (1- (* calc-graph-numsteps (1+ 
calc-graph-numsteps3))))))
 
 (defun calc-graph-format-data ()
+  (if (math-contains-sdev-p calc-graph-yp)
+      (let ((yp calc-graph-yp))
+        (setq calc-graph-yp (cons 'vec (mapcar 'math-get-value (cdr yp))))
+        (setq calc-graph-zp (cons 'vec (mapcar 'math-get-sdev (cdr yp))))))
   (while (<= (setq calc-graph-stepcount (1+ calc-graph-stepcount)) 
calc-graph-numsteps)
     (if calc-graph-xvec
        (setq calc-graph-xp (cdr calc-graph-xp)
@@ -1059,7 +1064,7 @@
   (interactive "P")
   (calc-graph-set-styles t (and style (prefix-numeric-value style))))
 
-(defun calc-graph-set-styles (lines points)
+(defun calc-graph-set-styles (lines points &optional yerr)
   (calc-graph-init)
   (save-excursion
     (set-buffer calc-gnuplot-input)
@@ -1067,7 +1072,7 @@
        (error "No data points have been set!"))
     (let ((base (point))
          (mode nil) (lstyle nil) (pstyle nil)
-         start end lenbl penbl)
+         start end lenbl penbl errform)
       (re-search-forward "[,\n]")
       (forward-char -1)
       (setq end (point) start end)
@@ -1087,8 +1092,11 @@
                (setq pstyle (string-to-number
                              (buffer-substring (match-beginning 1)
                                                (match-end 1)))))))
-      (setq lenbl (or (equal mode "lines") (equal mode "linespoints"))
-           penbl (or (equal mode "points") (equal mode "linespoints")))
+      (unless yerr
+        (setq lenbl (or (equal mode "lines") 
+                        (equal mode "linespoints"))
+              penbl (or (equal mode "points") 
+                        (equal mode "linespoints")))
       (if lines
          (or (eq lines t)
              (setq lstyle lines
@@ -1098,18 +1106,34 @@
          (or (eq points t)
              (setq pstyle points
                    penbl (>= points 0)))
-       (setq penbl (not penbl)))
+          (setq penbl (not penbl))))
       (delete-region start end)
       (goto-char start)
+      (setq errform
+            (condition-case nil
+                (math-contains-sdev-p
+                 (eval (intern 
+                        (concat "var-"
+                                (save-excursion
+                                  (re-search-backward ":\\(.*\\)\\}")
+                                  (match-string 1))))))
+              (error nil)))
+      (if yerr
+          (insert " with yerrorbars")
       (insert " with "
+                (if (and errform
+                         (equal mode "dots")
+                         (eq lines t))
+                    "yerrorbars"
              (if lenbl
                  (if penbl "linespoints" "lines")
-               (if penbl "points" "dots")))
+                    (if penbl "points" "dots"))))
       (if (and pstyle (> pstyle 0))
-         (insert " " (if (and lstyle (> lstyle 0)) (int-to-string lstyle) "1")
+            (insert " " 
+                    (if (and lstyle (> lstyle 0)) (int-to-string lstyle) "1")
                  " " (int-to-string pstyle))
        (if (and lstyle (> lstyle 0))
-           (insert " " (int-to-string lstyle))))))
+              (insert " " (int-to-string lstyle)))))))
   (calc-graph-view-commands))
 
 (defun calc-graph-zero-x (flag)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]