diff options
| author | Jay Belanger | 2007-08-03 05:25:03 +0000 |
|---|---|---|
| committer | Jay Belanger | 2007-08-03 05:25:03 +0000 |
| commit | 480e4ad15679ae8ac1a5cb04d1f65cd45559696e (patch) | |
| tree | 2085cc54bd90fdb09980fa41fb79f532443ca853 | |
| parent | 6a599ca51fa11aacb38da5bef9c6ffad5cb1ea36 (diff) | |
| download | emacs-480e4ad15679ae8ac1a5cb04d1f65cd45559696e.tar.gz emacs-480e4ad15679ae8ac1a5cb04d1f65cd45559696e.zip | |
(calc-graph-format-data,calc-graph-add-curve): Check for error forms.
(calc-graph-set-styles): Add option for error forms.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/calc/calc-graph.el | 74 |
2 files changed, 58 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 19014a996f9..2363853356c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2007-08-03 Jay Belanger <jay.p.belanger@gmail.com> | ||
| 2 | |||
| 3 | * calc/calc-ext.el (math-get-value,math-get-sdev) | ||
| 4 | (math-contains-sdev): New functions. | ||
| 5 | |||
| 6 | * calc/calc-graph.el (calc-graph-format-data) | ||
| 7 | (calc-graph-add-curve): Check for error forms. | ||
| 8 | (calc-graph-set-styles): Add option for error forms. | ||
| 9 | |||
| 1 | 2007-08-03 Miles Bader <miles@gnu.org> | 10 | 2007-08-03 Miles Bader <miles@gnu.org> |
| 2 | 11 | ||
| 3 | * vc-hooks.el (vc-handled-backends): Change capitalization of VC | 12 | * vc-hooks.el (vc-handled-backends): Change capitalization of VC |
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el index 48bdecf59a6..a7e85d9fa85 100644 --- a/lisp/calc/calc-graph.el +++ b/lisp/calc/calc-graph.el | |||
| @@ -218,7 +218,8 @@ | |||
| 218 | 0) | 218 | 0) |
| 219 | (or (and (Math-num-integerp pstyle) (math-trunc pstyle)) | 219 | (or (and (Math-num-integerp pstyle) (math-trunc pstyle)) |
| 220 | (if (eq (car-safe (calc-var-value (nth 2 ydata))) 'vec) | 220 | (if (eq (car-safe (calc-var-value (nth 2 ydata))) 'vec) |
| 221 | 0 -1))))) | 221 | 0 -1)) |
| 222 | (math-contains-sdev-p (eval (nth 2 ydata)))))) | ||
| 222 | 223 | ||
| 223 | (defun calc-graph-lookup (thing) | 224 | (defun calc-graph-lookup (thing) |
| 224 | (if (and (eq (car-safe thing) 'var) | 225 | (if (and (eq (car-safe thing) 'var) |
| @@ -792,6 +793,10 @@ | |||
| 792 | calc-graph-numsteps (1- (* calc-graph-numsteps (1+ calc-graph-numsteps3)))))) | 793 | calc-graph-numsteps (1- (* calc-graph-numsteps (1+ calc-graph-numsteps3)))))) |
| 793 | 794 | ||
| 794 | (defun calc-graph-format-data () | 795 | (defun calc-graph-format-data () |
| 796 | (if (math-contains-sdev-p calc-graph-yp) | ||
| 797 | (let ((yp calc-graph-yp)) | ||
| 798 | (setq calc-graph-yp (cons 'vec (mapcar 'math-get-value (cdr yp)))) | ||
| 799 | (setq calc-graph-zp (cons 'vec (mapcar 'math-get-sdev (cdr yp)))))) | ||
| 795 | (while (<= (setq calc-graph-stepcount (1+ calc-graph-stepcount)) calc-graph-numsteps) | 800 | (while (<= (setq calc-graph-stepcount (1+ calc-graph-stepcount)) calc-graph-numsteps) |
| 796 | (if calc-graph-xvec | 801 | (if calc-graph-xvec |
| 797 | (setq calc-graph-xp (cdr calc-graph-xp) | 802 | (setq calc-graph-xp (cdr calc-graph-xp) |
| @@ -1059,7 +1064,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1059 | (interactive "P") | 1064 | (interactive "P") |
| 1060 | (calc-graph-set-styles t (and style (prefix-numeric-value style)))) | 1065 | (calc-graph-set-styles t (and style (prefix-numeric-value style)))) |
| 1061 | 1066 | ||
| 1062 | (defun calc-graph-set-styles (lines points) | 1067 | (defun calc-graph-set-styles (lines points &optional yerr) |
| 1063 | (calc-graph-init) | 1068 | (calc-graph-init) |
| 1064 | (save-excursion | 1069 | (save-excursion |
| 1065 | (set-buffer calc-gnuplot-input) | 1070 | (set-buffer calc-gnuplot-input) |
| @@ -1067,7 +1072,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1067 | (error "No data points have been set!")) | 1072 | (error "No data points have been set!")) |
| 1068 | (let ((base (point)) | 1073 | (let ((base (point)) |
| 1069 | (mode nil) (lstyle nil) (pstyle nil) | 1074 | (mode nil) (lstyle nil) (pstyle nil) |
| 1070 | start end lenbl penbl) | 1075 | start end lenbl penbl errform) |
| 1071 | (re-search-forward "[,\n]") | 1076 | (re-search-forward "[,\n]") |
| 1072 | (forward-char -1) | 1077 | (forward-char -1) |
| 1073 | (setq end (point) start end) | 1078 | (setq end (point) start end) |
| @@ -1087,29 +1092,48 @@ This \"dumb\" driver will be present in Gnuplot 3.0." | |||
| 1087 | (setq pstyle (string-to-number | 1092 | (setq pstyle (string-to-number |
| 1088 | (buffer-substring (match-beginning 1) | 1093 | (buffer-substring (match-beginning 1) |
| 1089 | (match-end 1))))))) | 1094 | (match-end 1))))))) |
| 1090 | (setq lenbl (or (equal mode "lines") (equal mode "linespoints")) | 1095 | (unless yerr |
| 1091 | penbl (or (equal mode "points") (equal mode "linespoints"))) | 1096 | (setq lenbl (or (equal mode "lines") |
| 1092 | (if lines | 1097 | (equal mode "linespoints")) |
| 1093 | (or (eq lines t) | 1098 | penbl (or (equal mode "points") |
| 1094 | (setq lstyle lines | 1099 | (equal mode "linespoints"))) |
| 1095 | lenbl (>= lines 0))) | 1100 | (if lines |
| 1096 | (setq lenbl (not lenbl))) | 1101 | (or (eq lines t) |
| 1097 | (if points | 1102 | (setq lstyle lines |
| 1098 | (or (eq points t) | 1103 | lenbl (>= lines 0))) |
| 1099 | (setq pstyle points | 1104 | (setq lenbl (not lenbl))) |
| 1100 | penbl (>= points 0))) | 1105 | (if points |
| 1101 | (setq penbl (not penbl))) | 1106 | (or (eq points t) |
| 1102 | (delete-region start end) | 1107 | (setq pstyle points |
| 1108 | penbl (>= points 0))) | ||
| 1109 | (setq penbl (not penbl)))) | ||
| 1110 | (delete-region start end) | ||
| 1103 | (goto-char start) | 1111 | (goto-char start) |
| 1104 | (insert " with " | 1112 | (setq errform |
| 1105 | (if lenbl | 1113 | (condition-case nil |
| 1106 | (if penbl "linespoints" "lines") | 1114 | (math-contains-sdev-p |
| 1107 | (if penbl "points" "dots"))) | 1115 | (eval (intern |
| 1108 | (if (and pstyle (> pstyle 0)) | 1116 | (concat "var-" |
| 1109 | (insert " " (if (and lstyle (> lstyle 0)) (int-to-string lstyle) "1") | 1117 | (save-excursion |
| 1110 | " " (int-to-string pstyle)) | 1118 | (re-search-backward ":\\(.*\\)\\}") |
| 1111 | (if (and lstyle (> lstyle 0)) | 1119 | (match-string 1)))))) |
| 1112 | (insert " " (int-to-string lstyle)))))) | 1120 | (error nil))) |
| 1121 | (if yerr | ||
| 1122 | (insert " with yerrorbars") | ||
| 1123 | (insert " with " | ||
| 1124 | (if (and errform | ||
| 1125 | (equal mode "dots") | ||
| 1126 | (eq lines t)) | ||
| 1127 | "yerrorbars" | ||
| 1128 | (if lenbl | ||
| 1129 | (if penbl "linespoints" "lines") | ||
| 1130 | (if penbl "points" "dots")))) | ||
| 1131 | (if (and pstyle (> pstyle 0)) | ||
| 1132 | (insert " " | ||
| 1133 | (if (and lstyle (> lstyle 0)) (int-to-string lstyle) "1") | ||
| 1134 | " " (int-to-string pstyle)) | ||
| 1135 | (if (and lstyle (> lstyle 0)) | ||
| 1136 | (insert " " (int-to-string lstyle))))))) | ||
| 1113 | (calc-graph-view-commands)) | 1137 | (calc-graph-view-commands)) |
| 1114 | 1138 | ||
| 1115 | (defun calc-graph-zero-x (flag) | 1139 | (defun calc-graph-zero-x (flag) |