Debian Codegraph @

texmf-dist/tex/generic/pgfplots/pgfplots.errorbars.code.tex

raw
1 %--------------------------------------------
2 %
3 % Package pgfplots
4 %
5 % Provides a user-friendly interface to create function plots (normal
6 % plots, semi-logplots and double-logplots).
7 %
8 % It is based on Till Tantau's PGF package.
9 %
10 % Copyright 2007-2013 by Christian Feuersänger.
11 %
12 % This program is free software: you can redistribute it and/or modify
13 % it under the terms of the GNU General Public License as published by
14 % the Free Software Foundation, either version 3 of the License, or
15 % (at your option) any later version.
16 %
17 % This program is distributed in the hope that it will be useful,
18 % but WITHOUT ANY WARRANTY; without even the implied warranty of
19 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 % GNU General Public License for more details.
21 %
22 % You should have received a copy of the GNU General Public License
23 % along with this program. If not, see <http://www.gnu.org/licenses/>.
24 %
25 %--------------------------------------------
26
27
28 % the \addplot commands assign
29 % \pgfplots@current@point@error@x@plus
30 % \pgfplots@current@point@error@x@minus
31 % \pgfplots@current@point@error@y@plus
32 % \pgfplots@current@point@error@y@minus
33 % \pgfplots@current@point@error@z@plus
34 % \pgfplots@current@point@error@z@minus
35 %
36 % the error bar processing takes these values as input, adds them to
37 % the current coordinates where applicable and according the the error
38 % bar configuration and overwrites these macros.
39 %
40 % Then, these values are registered as "visualization depends on",
41 % i.e. they will be available for every visualization phase.
42 %
43 % The visualization phase, in turn, expects these values. More
44 % precisely, a separate visualization phase called
45 % \pgfplotsaxis@visphase@name@errorbars is started. This installs the
46 % plot handler \pgfplots@errorbars@plot@handler and does the same job
47 % as it would for normal plot handlers.
48 %
49 \def\pgfplots@errorbars@survey@begin{%
50 %
51 \pgfplots@errorbars@prepare@value@serialization
52 %
53 % Now, prepare the coordinate processing for errorbars:
54 \pgfplots@PREPARE@errorbar@processing@in@dir x%
55 \pgfplots@PREPARE@errorbar@processing@in@dir y%
56 \ifpgfplots@curplot@threedim
57 \pgfplots@PREPARE@errorbar@processing@in@dir z%
58 \else
59 \let\pgfplots@PREPARE@errorbar@process@z=\relax
60 \fi
61 }
62
63 \def\pgfplots@errorbars@survey@end{%
64 \pgfplots@streamerrorbarend
65 }%
66
67 \def\pgfplots@errorbars@survey@point{%
68 % This thing gets the 'current@point@...' context,
69 % that means
70 % \pgfplots@current@point@[xy]
71 % \pgfplots@current@point@[xy]@error
72 % \pgfplots@current@point@[xy]@unfiltered
73 \pgfplots@PREPARE@errorbar@process@x%
74 \pgfplots@PREPARE@errorbar@process@y%
75 \pgfplots@PREPARE@errorbar@process@z%
76 }
77
78 \def\pgfplots@errorbars@visphase@begin{%
79 \pgfplots@errorbars@prepare@value@serialization
80 }
81
82 \def\pgfplots@errorbars@visphase@end{%
83 }%
84
85 \def\pgfplots@errorbars@visphase@point{%
86 }%
87
88 \def\pgfplots@errorbars@prepare@value@serialization{%
89 \if0\pgfplots@errorbars@xdirection
90 \else
91 \pgfplotsset{%
92 visualization depends on=value \pgfplots@current@point@error@x@plus\as\pgfplots@current@point@error@x@plus,
93 visualization depends on=value \pgfplots@current@point@error@x@minus\as\pgfplots@current@point@error@x@minus,
94 }%
95 \fi
96 \if0\pgfplots@errorbars@ydirection
97 \else
98 \pgfplotsset{%
99 visualization depends on=value \pgfplots@current@point@error@y@plus\as\pgfplots@current@point@error@y@plus,
100 visualization depends on=value \pgfplots@current@point@error@y@minus\as\pgfplots@current@point@error@y@minus,
101 }%
102 \fi
103 \ifpgfplots@curplot@threedim
104 \if0\pgfplots@errorbars@zdirection
105 \else
106 \pgfplotsset{%
107 visualization depends on=value \pgfplots@current@point@error@z@plus\as\pgfplots@current@point@error@z@plus,
108 visualization depends on=value \pgfplots@current@point@error@z@minus\as\pgfplots@current@point@error@z@minus,
109 }%
110 \fi
111 \fi
112 }%
113
114 % Prepares a macro \pgfplots@PREPARE@process@errorbar@for@dir##1
115 % which can then be used to process error bars. The macro will be
116 % \relax if error bars are disabled for #1.
117 %
118 % #1: either x, y or z.
119 %
120 % POSTCONDITION:
121 % the macro \pgfplots@PREPARE@errorbar@process@#1 will be defined.
122 % It is supposed to be used inside of the pgfplots streaming methods
123 % and depends on the arguments
124 % \pgfplots@current@point@[xyz]
125 % \pgfplots@current@point@[xyz]@unfiltered
126 % \pgfplots@current@point@[xyz]@error
127 % The '@unfilterered' arguments are needed for log plots. I do not
128 % want to compute exp(current@point@[xyz]) again.
129 \def\pgfplots@PREPARE@errorbar@processing@in@dir#1{%
130 \pgfplots@PREPARE@errorbar@processing@in@dir@reset#1%
131 %
132 \if0\csname pgfplots@errorbars@#1direction\endcsname
133 % no error bars. Ok. Do nothing here.
134 \expandafter\let\csname pgfplots@PREPARE@errorbar@process@#1\endcsname=\relax
135 \else
136 %
137 % The routine which is invoked for every reported input
138 % coordinate is \pgfplots@process@errorbar@for.
139 %
140 % This here prepares its helper macros for direction '#1':
141 %
142 % More precisely, it prepared
143 %
144 % ##1 is either '+' or '-':
145 % \pgfplots@PREPARE@errorbar@process@x@##1
146 % \pgfplots@PREPARE@errorbar@process@y@##1
147 % \pgfplots@PREPARE@errorbar@process@z@##1
148 %
149 \pgfplots@if{pgfplots@#1islinear}{%
150 \ifcase\csname pgfplots@errorbars@#1mode\endcsname\relax
151 % fixed absolute error.
152 \pgfplotscoordmath{#1}{parsenumber}{\csname pgfplots@errorbars@#1fixed\endcsname}%
153 \expandafter\let\csname pgfplots@error@coord@#1\endcsname=\pgfmathresult
154 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
155 \if +##1%
156 \def\pgfplots@loc@TMPb{add}%
157 \else
158 \def\pgfplots@loc@TMPb{subtract}%
159 \fi
160 \pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
161 {\csname pgfplots@current@point@#1\endcsname}%
162 {\csname pgfplots@error@coord@#1\endcsname}%
163 }%
164 \let\pgfplots@error@coord=\pgfmathresult
165 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
166 }%
167 \or% fixed relative error:
168 \pgfplotscoordmath{#1}{parsenumber}{\csname pgfplots@errorbars@#1rel\endcsname}%
169 \let\pgfplots@loc@TMPb=\pgfmathresult
170 %
171 % +1:
172 \pgfplotscoordmath{#1}{parsenumber}{1}%
173 \let\pgfplots@loc@TMPa=\pgfmathresult
174 %
175 % Prepare '1 + err':
176 \pgfplotscoordmath{#1}{op}{add}{%
177 {\pgfplots@loc@TMPa}%
178 {\pgfplots@loc@TMPb}%
179 }%
180 \expandafter\let\csname pgfplots@error@coord@#1@+\endcsname=\pgfmathresult
181 %
182 % Prepare '1 - err':
183 \pgfplotscoordmath{#1}{op}{subtract}{%
184 {\pgfplots@loc@TMPa}%
185 {\pgfplots@loc@TMPb}%
186 }%
187 \expandafter\let\csname pgfplots@error@coord@#1@-\endcsname=\pgfmathresult
188 %
189 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
190 \pgfplotscoordmath{#1}{op}{multiply}{%
191 {\csname pgfplots@current@point@#1\endcsname}
192 {\csname pgfplots@error@coord@#1@##1\endcsname}%
193 }%
194 \let\pgfplots@error@coord=\pgfmathresult
195 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
196 }%
197 \or% explicit absolute:
198 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
199 \edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
200 \ifx\pgfplots@error@coord\pgfutil@empty
201 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
202 \else
203 \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@error@coord}%
204 \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
205 \let\pgfplots@error@coord=\pgfmathresult
206 % remember result here - will be used in case
207 % of '+' AND '-' error bars:
208 %\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname=\pgfmathresult
209 \if +##1%
210 \def\pgfplots@loc@TMPb{add}%
211 \else
212 \def\pgfplots@loc@TMPb{subtract}%
213 \fi
214 \pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
215 {\csname pgfplots@current@point@#1\endcsname}%
216 {\pgfplots@error@coord}%
217 }%
218 \let\pgfplots@error@coord=\pgfmathresult
219 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
220 }{%
221 % input is unbounded. Skip it.
222 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
223 }%
224 \fi
225 }%
226 \or% explicit relative:
227 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
228 \edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
229 \ifx\pgfplots@error@coord\pgfutil@empty
230 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
231 \else
232 \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@error@coord}%
233 \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
234 \let\pgfplots@error@coord=\pgfmathresult
235 % compute ' 1 + value' or '1-value':
236 \pgfplotscoordmath{#1}{one}%
237 \if +##1%
238 \def\pgfplots@loc@TMPb{add}%
239 \else
240 \def\pgfplots@loc@TMPb{subtract}%
241 \fi
242 \pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
243 {\pgfmathresult}%
244 {\pgfplots@error@coord}%
245 }%
246 \let\pgfplots@error@coord=\pgfmathresult
247 \pgfplotscoordmath{#1}{op}{multiply}{%
248 {\csname pgfplots@current@point@#1\endcsname}
249 {\pgfplots@error@coord}%
250 }%
251 \let\pgfplots@error@coord=\pgfmathresult
252 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
253 }{%
254 % input is unbounded. Skip it.
255 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
256 }%
257 \fi
258 }%
259 \fi
260 }{%
261 % LOGARITHMIC scaling. All errors are interpreted as
262 % log(x +- e_x)
263 % or
264 % log( x*(1+-e_x) )
265 %
266 % That means any input argument is
267 % given in log base e and in fixed point.
268 % Furthermore, we expect the '@unfiltered' keys to be
269 % present (I don't want to apply 'exp' again!).
270 %
271 \ifcase\csname pgfplots@errorbars@#1mode\endcsname
272 % fixed absolute, log( x +- e_x )
273 %
274 \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@errorbars@#1fixed\endcsname}%
275 \expandafter\let\csname pgfplots@error@coord@#1\endcsname=\pgfmathresult
276 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
277 \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@current@point@#1@unfiltered\endcsname}%
278 \let\pgfplots@loc@TMPa=\pgfmathresult
279 \if +##1%
280 \def\pgfplots@loc@op{add}%
281 \else
282 \def\pgfplots@loc@op{subtract}%
283 \fi
284 \pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
285 {\pgfplots@loc@TMPa}%
286 {\csname pgfplots@error@coord@#1\endcsname}%
287 }%
288 \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
289 \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
290 \let\pgfplots@error@coord=\pgfmathresult
291 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
292 }%
293 \or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x)
294 \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@errorbars@#1rel\endcsname}%
295 \let\pgfplots@loc@TMPb=\pgfmathresult
296 %
297 % +1:
298 \pgfplotscoordmath{default}{one}%
299 \let\pgfplots@loc@TMPa=\pgfmathresult
300 %
301 % Prepare '1 + err':
302 \pgfplotscoordmath{default}{op}{add}{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}}%
303 \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
304 \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
305 \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
306 }{%
307 % 1 + err <= 0 and log(1+err) is undefined:
308 \pgfplotscoordmath{default}{tostring}{\pgfplots@loc@TMPb}%
309 \pgfplots@error{Sorry, log(1 + \pgfmathresult) is undefined. Please provide a different argument for '/pgfplots/error bar/#1 fixed relative'.}%
310 \let\pgfmathresult=\pgfutil@empty
311 }%
312 \expandafter\let\csname pgfplots@error@coord@#1@+\endcsname=\pgfmathresult
313 %
314 % Prepare '1 - err':
315 \pgfplotscoordmath{default}{op}{subtract}{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}}%
316 \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
317 \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
318 \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
319 }{%
320 % 1 - err <= 0 and log(1+err) is undefined:
321 \pgfplotscoordmath{default}{tostring}{\pgfplots@loc@TMPb}%
322 \pgfplots@error{Sorry, log(1 - \pgfmathresult) (\pgfplots@loc@TMPa - \pgfplots@loc@TMPb) is undefined. Please provide a different argument for '/pgfplots/error bar/#1 fixed relative'.}%
323 \let\pgfmathresult=\pgfutil@empty
324 }%
325 \expandafter\let\csname pgfplots@error@coord@#1@-\endcsname=\pgfmathresult
326 %
327 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
328 \expandafter\ifx\csname pgfplots@current@point@#1@##1\endcsname\pgfutil@empty
329 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
330 \else
331 \pgfmath@basic@add@
332 {\csname pgfplots@current@point@#1\endcsname}
333 {\csname pgfplots@error@coord@#1@##1\endcsname}%
334 \let\pgfplots@error@coord=\pgfmathresult
335 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
336 \fi
337 }%
338 \or% explicit absolute
339 % log( x +- e_x )
340 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
341 \edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
342 \ifx\pgfplots@error@coord\pgfutil@empty
343 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
344 \else
345 \pgfplotscoordmath{default}{parsenumber}{\pgfplots@error@coord}%
346 \pgfplotscoordmath{default}{if is bounded}{\pgfmathresult}{%
347 \let\pgfplots@error@coord=\pgfmathresult
348 % remember result here - will be used in case
349 % of '+' AND '-' error bars:
350 %\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname=\pgfmathresult
351 \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@current@point@#1@unfiltered\endcsname}%
352 \let\pgfplots@loc@TMPa=\pgfmathresult
353 \if +##1%
354 \def\pgfplots@loc@op{add}%
355 \else
356 \def\pgfplots@loc@op{subtract}%
357 \fi
358 \pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
359 {\pgfplots@loc@TMPa}%
360 {\pgfplots@error@coord}%
361 }%
362 \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
363 \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
364 \let\pgfplots@error@coord=\pgfmathresult
365 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
366 }{%
367 % input is unbounded. Skip it.
368 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
369 }%
370 \fi
371 }%
372 %
373 \or% explicit relative:
374 % log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x)
375 \expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
376 \edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
377 \ifx\pgfplots@error@coord\pgfutil@empty
378 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
379 \else
380 \pgfplotscoordmath{default}{parsenumber}{\pgfplots@error@coord}%
381 \pgfplotscoordmath{default}{if is bounded}{\pgfmathresult}{%
382 \let\pgfplots@error@coord=\pgfmathresult
383 % remember result here - will be used in case
384 % of '+' AND '-' error bars:
385 %\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname=\pgfmathresult
386 %
387 \pgfplotscoordmath{default}{one}%
388 \let\pgfplots@loc@TMPa=\pgfmathresult
389 \if +##1%
390 \def\pgfplots@loc@op{add}%
391 \else
392 \def\pgfplots@loc@op{subtract}%
393 \fi
394 \pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
395 {\pgfplots@loc@TMPa}%
396 {\pgfplots@error@coord}%
397 }%
398 \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
399 \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
400 \let\pgfplots@error@coord=\pgfmathresult
401 \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
402 \pgfplotscoordmath{#1}{op}{add}{%
403 {\csname pgfplots@current@point@#1\endcsname}
404 {\pgfplots@error@coord}%
405 }%
406 \let\pgfplots@error@coord=\pgfmathresult
407 \pgfplots@PREPARE@errorbar@stream@it@#1##1%
408 }{%
409 % -> log( <= 0 ) -> do nothing.
410 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
411 }%
412 }{%
413 % input is unbounded - do nothing.
414 \pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
415 }%
416 \fi
417 }%
418 %
419 \fi
420 }%
421 \ifcase\csname pgfplots@errorbars@#1direction\endcsname
422 % none
423 \or
424 % plus
425 \expandafter\edef\csname pgfplots@PREPARE@errorbar@process@#1\endcsname{%
426 \expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname+%
427 }%
428 \or
429 % minus
430 \expandafter\edef\csname pgfplots@PREPARE@errorbar@process@#1\endcsname{%
431 \expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname-%
432 }%
433 \or
434 % both
435 \expandafter\edef\csname pgfplots@PREPARE@errorbar@process@#1\endcsname{%
436 \expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname+%
437 \expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname-%
438 }%
439 \fi
440 \fi
441 }
442
443 \def\pgfplots@PREPARE@errorbar@processing@in@dir@reset#1{%
444 \expandafter\let\csname pgfplots@current@point@error@#1@plus\endcsname=\pgfutil@empty
445 \expandafter\let\csname pgfplots@current@point@error@#1@minus\endcsname=\pgfutil@empty
446 }%
447
448 % #1: one of x,y, or z
449 % #2: either '+' or '-', denotes the direction of the error
450 % bar
451 %
452 % PRECONDITION: \pgfplots@error@coord contains the value which is to
453 % be stored as \pgfplots@current@point@error@#1@plus or
454 % \pgfplots@current@point@error@#1@minus
455 %
456 % POSTCONDITION: limits updated and
457 % \pgfplots@current@point@error@#1@plus or
458 % \pgfplots@current@point@error@#1@minus
459 % is defined.
460 \def\pgfplots@PREPARE@errorbar@stream@it@#1#2{%
461 \ifx\pgfplots@error@coord\pgfutil@empty
462 \else
463 \expandafter\let\expandafter\pgfplots@current@point@@old\csname pgfplots@current@point@#1\endcsname
464 \expandafter\let\csname pgfplots@current@point@#1\endcsname=\pgfplots@error@coord
465 \pgfplotsaxisupdatelimitsforcoordinate\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@z
466 \expandafter\let\csname pgfplots@current@point@#1\endcsname=\pgfplots@current@point@@old
467 \fi
468 %
469 % ... and remember what we need! This value will be stored as
470 % "visualization depends on"
471 \expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus#2\endcsname=\pgfplots@error@coord
472 }%
473
474 \def\pgfplots@PREPARE@errorbar@stream@it@empty#1#2{%
475 % ... and remember what we need! This value will be stored as
476 % "visualization depends on"
477 \expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus#2\endcsname=\pgfutil@empty
478 }
479
480 \def\pgfplots@errorbars@plusminus#1{%
481 \if#1+%
482 plus%
483 \else
484 minus%
485 \fi
486 }%
487
488 % A dummy plot handler which is used in a special visualization phase
489 % for error bars.
490 \def\pgfplots@errorbars@plot@handler{%
491 \gdef\pgf@plotstreamstart{%
492 \pgfplots@streamerrorbar@directdraw
493 \global\let\pgf@plotstreampoint=\pgfplots@errorbars@plot@handler@point
494 \global\let\pgf@plotstreamspecial=\relax
495 \global\let\pgf@plotstreamend=\pgfplots@streamerrorbarend
496 \pgfplots@streamerrorbarstart
497 }%
498 }%
499
500 \def\pgfplots@errorbars@plot@handler@point#1{%
501 \pgf@process{#1}%
502 \edef\pgfplots@errorbars@src{(\the\pgf@x,\the\pgf@y)}%
503 %
504 % we want to allow scatter plots to vary depending on 'point
505 % meta'. This here does not hurt:
506 \pgfplotsaxisvisphasetransformpointmetaifany
507 %
508 \pgfplots@errorbars@plot@handler@point@dir x%
509 \pgfplots@errorbars@plot@handler@point@dir y%
510 \ifpgfplots@curplot@threedim
511 \pgfplots@errorbars@plot@handler@point@dir z%
512 \fi
513 }
514
515 % #1: one of x,y, or z
516 % #2: the error bar value in dir #1
517 % output: \pgfplots@errorbars@trg in the form (<x>,<y>,<z>)
518 \def\pgfplots@errorbars@to@pt#1#2{%
519 \begingroup
520 \expandafter\let\csname pgfplots@current@point@#1\endcsname=#2%
521 \ifpgfplots@curplot@threedim
522 \edef\pgfplotsretval{(\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z)}%
523 \else
524 \edef\pgfplotsretval{(\pgfplots@current@point@x,\pgfplots@current@point@y)}%
525 \fi
526 \global\let\pgfplots@errorbars@trg=\pgfplotsretval
527 \endgroup
528 }%
529
530 % #1: a <\macro> containing the value
531 % #2: either x,y, or z
532 \def\pgfplots@errorbars@plot@handler@point@dir@@#1#2{%
533 \ifx#1\pgfutil@empty
534 \else
535 \pgfplotsaxisvisphasetransformcoordinateentry{#2}{#1}%
536 \pgfplots@errorbars@to@pt{#2}{\pgfmathresult}%
537 \pgfplots@streamerrorbarcoords{\pgfplots@errorbars@src}{\pgfplots@errorbars@trg}%
538 \fi
539 }%
540
541 \def\pgfplots@errorbars@plot@handler@point@dir#1{%
542 \ifcase\csname pgfplots@errorbars@#1direction\endcsname
543 % none
544 \or
545 % plus
546 \expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@plus\endcsname#1%
547 \or
548 % minus
549 \expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@minus\endcsname#1%
550 \or
551 % both
552 \expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@plus\endcsname#1%
553 \expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@minus\endcsname#1%
554 \fi
555 }%
556
557 \def\pgfplots@streamerrorbarstart{%
558 }%
559 \def\pgfplots@streamerrorbarend{%
560 }%
561 \def\pgfplots@streamerrorbarcoords#1#2{%
562 }%
563
564 \def\pgfplots@streamerrorbar@directdraw{%
565 \def\pgfplots@streamerrorbarstart{}%
566 \def\pgfplots@streamerrorbarend{}%
567 \def\pgfplots@streamerrorbarcoords##1##2{%
568 \pgfplots@errorbar@draw{##1}{##2}%
569 }%
570 }
571
572 \newif\ifpgfplots@error@bars@allow@name@path
573
574
575 % This thing here shall draw all error bar commands listed in '#2'.
576 %
577 % It will be invoked when any plotting commands take effect (that
578 % means all limits are computed; the axis has been drawn,
579 % transformations are set up...)
580 \def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{%
581 \scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it uses the /pgfplots/.unknown handler
582 \ifpgfplots@error@bars@allow@name@path
583 \else
584 % 'name path=xxx' should NOT include errors bars! Only the
585 % main path.
586 \def\tikz@intersect@addto@path@names##1##2{}%
587 \fi
588 #2%
589 \endscope
590 }
591
592 \def\pgfplots@errorbar@draw#1#2{%
593 \begingroup
594 \pgfplots@restorepgfpoint
595 \pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov%
596 \endgroup
597 }%
598
599 \def\pgfplotsaxis@visphase@name@errorbars{errorbars}
600
601 \expandafter\def\csname pgfplots@visphase@\pgfplotsaxis@visphase@name@errorbars\endcsname{%
602 \pgfplots@errorbars@finishwithstyleoptions[]{%
603 \let\tikz@plot@handler=\pgfplots@errorbars@plot@handler
604 \pgfplots@coord@stream@finalize@storedcoords@START
605 }%
606 }%
607
608 \endinput