Mercurial > hg > octave-nkf
comparison scripts/plot/private/__errplot__.m @ 10573:d8894a2d0a03
Allow x, xy and box errorbars with different plotting syntax
author | David Bateman <dbateman@free.fr> |
---|---|
date | Mon, 26 Apr 2010 14:33:54 +0200 |
parents | 95c3e38098bf |
children | 3eba2cc7cbda |
comparison
equal
deleted
inserted
replaced
10572:148559d9d4ac | 10573:d8894a2d0a03 |
---|---|
77 | 77 |
78 switch (nargin - 2) | 78 switch (nargin - 2) |
79 case 1 | 79 case 1 |
80 error ("error plot requires 2, 3, 4 or 6 columns"); | 80 error ("error plot requires 2, 3, 4 or 6 columns"); |
81 case 2 | 81 case 2 |
82 set (hl, "xdata", (1:len)'); | 82 if (index (ifmt, "xerr")) |
83 set (hl, "ydata", a1(:,i)); | 83 set (hl, "xdata", (1:len)', "ydata", a1(:,i), "xldata", a2(:,i), |
84 set (hl, "ldata", a2(:,i)); | 84 "xudata", a2(:,i)); |
85 set (hl, "udata", a2(:,i)); | 85 elseif (index (ifmt, "yerr")) |
86 set (hl, "xdata", (1:len)', "ydata", a1(:,i), "ldata", a2(:,i), | |
87 "udata", a2(:,i)); | |
88 else | |
89 error ("2 column errorplot is only valid or xerr or yerr"); | |
90 endif | |
86 case 3 | 91 case 3 |
87 set (hl, "xdata", a1(:,i)); | 92 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
88 set (hl, "ydata", a2(:,i)); | 93 set (hl, "xdata", (1:len)', "ydata", a1(:,i), "xldata", a2(:,i), |
89 set (hl, "ldata", a3(:,i)); | 94 "xudata", a2(:,i), "ldata", a3(:,i), "udata", a3(:,i)); |
90 set (hl, "udata", a3(:,i)); | 95 elseif (index (ifmt, "xerr")) |
96 set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), | |
97 "xudata", a3(:,i)); | |
98 else | |
99 set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "ldata", a3(:,i), | |
100 "udata", a3(:,i)); | |
101 endif | |
91 case 4 | 102 case 4 |
92 set (hl, "xdata", a1(:,i)); | |
93 set (hl, "ydata", a2(:,i)); | |
94 | |
95 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) | 103 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
96 set (hl, "xldata", a3(:,i)); | 104 set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), |
97 set (hl, "xudata", a3(:,i)); | 105 "xudata", a3(:,i), "ldata", a4(:,i), "udata", a4(:,i)); |
98 set (hl, "ldata", a4(:,i)); | |
99 set (hl, "udata", a4(:,i)); | |
100 elseif (index (ifmt, "xerr")) | 106 elseif (index (ifmt, "xerr")) |
101 set (hl, "xldata", a3(:,i)); | 107 set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), |
102 set (hl, "xudata", a4(:,i)); | 108 "xudata", a4(:,i)); |
103 else | 109 else |
104 set (hl, "ldata", a3(:,i)); | 110 set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "ldata", a3(:,i), |
105 set (hl, "udata", a4(:,i)); | 111 "udata", a4(:,i)); |
106 endif | 112 endif |
107 case 5 | 113 case 5 |
108 error ("error plot requires 2, 3, 4 or 6 columns"); | 114 error ("error plot requires 2, 3, 4 or 6 columns"); |
109 case 6 | 115 case 6 |
110 set (hl, "xdata", a1(:,i)); | 116 if (index (ifmt, "boxxy") || index (ifmt, "xyerr")) |
111 set (hl, "ydata", a2(:,i)); | 117 set (hl, "xdata", a1(:,i), "ydata", a2(:,i), "xldata", a3(:,i), |
112 set (hl, "xldata", a3(:,i)); | 118 "xudata", a4(:,i), "ldata", a5(:,i), "udata", a6(:,i)); |
113 set (hl, "xudata", a4(:,i)); | 119 else |
114 set (hl, "ldata", a5(:,i)); | 120 error ("error plot with 6 columns only valid for boxxy and xyerr"); |
115 set (hl, "udata", a6(:,i)); | 121 endif |
116 endswitch | 122 endswitch |
117 | 123 |
118 addproperty ("color", hg, "linecolor", get (hl, "color")); | 124 addproperty ("color", hg, "linecolor", get (hl, "color")); |
119 addproperty ("linewidth", hg, "linelinewidth", get (hl, "linewidth")); | 125 addproperty ("linewidth", hg, "linelinewidth", get (hl, "linewidth")); |
120 addproperty ("linestyle", hg, "linelinestyle", get (hl, "linestyle")); | 126 addproperty ("linestyle", hg, "linelinestyle", get (hl, "linestyle")); |