Debian Codegraph @

texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.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-2010 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 % This file contains the code to process coordinates
28 % - coordinate input: \addplot and its variants,
29 % - coordinate loops,
30 % - single coordinate processing
31 %
32 % -> see \pgfplots@addplot
33
34
35 % To be called inside of an axis as soon as the axis is ready and all
36 % point commands can be invoked.
37 \def\pgfplotspoint@initialisation{%
38 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@v00\endcsname\relax
39 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@v01\endcsname\relax
40 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@v10\endcsname\relax
41 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@v11\endcsname\relax
42 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@0v0\endcsname\relax
43 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@0v1\endcsname\relax
44 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@1v0\endcsname\relax
45 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@1v1\endcsname\relax
46 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@00v\endcsname\relax
47 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@01v\endcsname\relax
48 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@10v\endcsname\relax
49 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@11v\endcsname\relax
50 %
51 % Installs e_x, e_y and e_z such that (0,0) is the 'south west'
52 % anchor of the axis and (1,1) the 'north east'.
53 % It is used inside of descriptions.
54 \def\pgfplots@install@description@xyzvec{%
55 % this here is also used in color bars!
56 \ifpgfplots@deprecated@anchors
57 \pgfpointadd{\pgfplotspointxaxis}{\pgfplotspointyaxis}%
58 \else
59 \pgfplotspointbbdiagonal
60 \fi
61 \pgf@xa=\pgf@x
62 \pgf@ya=\pgf@y
63 % do not use \pgfqpoint here - it may have been replaced
64 % (compare \pgfplots@change@pgfpoints@to@descriptioncs)
65 \pgfsetxvec{\global\pgf@x=\pgf@xa \global\pgf@y=0pt }%
66 \pgfsetyvec{\global\pgf@x=0pt \global\pgf@y=\pgf@ya}%
67 \pgfsetzvec{\global\pgf@x=0pt \global\pgf@y=0pt }%
68 }%
69 %
70 % The \pgfplotsqpointxyz method (or its 2d counterpart) are THE
71 % point method. If you override them, all other coordinate systems
72 % should inherit the changes as well.
73 \edef\pgfplotsplothandlerpointxyz##1##2##3{%
74 \ifpgfplots@curplot@threedim
75 \noexpand\pgfplotsqpointxyz{##1}{##2}{##3}%
76 \else
77 \noexpand\pgfplotsqpointxy{##1}{##2}%
78 \fi
79 }%
80 %
81 % A point command such that (0,0) is the 'south west' and (1,1)
82 % the 'north east' point of an axis.
83 \def\pgfplotspointdescriptionxy##1##2{%
84 \pgf@process{%
85 \pgfplots@install@description@xyzvec
86 \pgfpointadd
87 {\ifpgfplots@deprecated@anchors
88 \pgfplotspointminminmin
89 \else
90 \pgfplotspointbblowerleft
91 \fi}%
92 {\pgfpointxy@orig{##1}{##2}}%
93 %I use the '@orig' variant here because descriptions may
94 %\let\pgfpointxy=\pgfplotspointdescriptionxy
95 }%
96 }%
97 % the 'q' variant:
98 \def\pgfplotsqpointdescriptionxy##1##2{%
99 \pgf@process{%
100 \pgfplots@install@description@xyzvec
101 \pgfpointadd
102 {\ifpgfplots@deprecated@anchors
103 \pgfplotspointminminmin
104 \else
105 \pgfplotspointbblowerleft
106 \fi}%
107 {\pgfqpointxy@orig{##1}{##2}}%
108 }%
109 }%
110 \pgfplotspoint@initialisation@axes
111 \pgfplotspoint@initialisation@units
112 \pgfplotspoint@initialisation@center
113 %
114 % declare the '[xyz]ticklabel cs'
115 \tikzdeclarecoordinatesystem{xticklabel}{\pgfplotspointticklabelcs{x}{##1}}%
116 \tikzdeclarecoordinatesystem{yticklabel}{\pgfplotspointticklabelcs{y}{##1}}%
117 \tikzdeclarecoordinatesystem{zticklabel}{\pgfplotspointticklabelcs{z}{##1}}%
118 \tikzdeclarecoordinatesystem{xticklabel*}{\pgfplotspointticklabelnoshiftcs{x}{##1}}%
119 \tikzdeclarecoordinatesystem{yticklabel*}{\pgfplotspointticklabelnoshiftcs{y}{##1}}%
120 \tikzdeclarecoordinatesystem{zticklabel*}{\pgfplotspointticklabelnoshiftcs{z}{##1}}%
121 %
122 % does also declare the 'near xticklabel*' variants.
123 \pgfplotsdeclareborderanchorforticklabelaxis{x}{near xticklabel}%
124 \pgfplotsdeclareborderanchorforticklabelaxis{y}{near yticklabel}%
125 \pgfplotsdeclareborderanchorforticklabelaxis{z}{near zticklabel}%
126 %
127 \pgfkeysdef{/tikz/sloped like x axis}{\tikz@addtransform{\pgfplotstransformtoaxisdirection[##1]{x}}}%
128 \pgfkeysdef{/tikz/sloped like y axis}{\tikz@addtransform{\pgfplotstransformtoaxisdirection[##1]{y}}}%
129 \pgfkeysdef{/tikz/sloped like z axis}{\tikz@addtransform{\pgfplotstransformtoaxisdirection[##1]{z}}}%
130 %
131 }%
132
133 % Determine final axes this does also fix the axis' dimension.
134 % There are the following cases:
135 % 1. the user really wants a fixed dimension,
136 % i.e. he used 'scale only axis'.
137 % Then, we have to work to get the correct dimension!
138 %
139 % Up to now, the scaling mechanism looses to many significant
140 % digits such that the final width/height differs by 1-2 pt.
141 %
142 % If I am not mistaken, this does ONLY affect the final size,
143 % not the relative plot precision.
144 %
145 % FIXME : really compute the plot precision!
146 %
147 % 2. The use specified width and/or height, but not 'scale only
148 % axis'. Accept inaccurate final widths/heights (see above).
149 %
150 % 3. The user supplied 'x' and or 'y'. Simply use them, its
151 % accurate.
152 % POSTCONDITION: the macros
153 % \pgfplotspointminminmin
154 % \pgfplotspoint[xyz]axis
155 % \pgfplotspoint[xyz]axislength
156 % are defined (globally).
157 %
158 \def\pgfplotspoint@initialisation@axes{%
159 \begingroup
160 \ifpgfplots@threedim
161 \def\pgfplotspointmaxminmin{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}%
162 \def\pgfplotspointminmaxmin{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}%
163 \pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}%
164 \else
165 \def\pgfplotspointmaxminmin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}%
166 \def\pgfplotspointminmaxmin{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}%
167 \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}%
168 \fi
169 \xdef\pgfplotspointminminmin{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
170 % ATTENTION: I re-use registers here! Make sure they won't be
171 % overwritten! \pgfpointdiff and \pgfplotsqpointxy are ok in this respect.
172 \let\pgfplots@xcoordminTEX=\pgf@xb
173 \let\pgfplots@ycoordminTEX=\pgf@yb
174 \pgfplots@xcoordminTEX=\pgf@x
175 \pgfplots@ycoordminTEX=\pgf@y
176 %
177 %--------------------------------------------------
178 % FIXME : WHAT IS THIS HERE FOR?
179 % \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}%
180 % \ifx\pgfplots@rectangle@width\pgfutil@empty
181 % \def\pgfplots@tmp@xmax@ymin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}%
182 % \else
183 % % this 'if' here should only make a difference of about
184 % % 1-2pt, not more.
185 % %
186 % % and I am quite sure that this inaccuracy (and this
187 % % work-around) only affects the
188 % % final size, not the relative plot accuracy.
189 % \pgf@x=\pgfplots@xcoordminTEX
190 % \advance\pgf@x by\pgfplots@width
191 % \edef\pgfplots@tmp@xmax@ymin{\noexpand\pgfqpoint{\the\pgf@x}{\noexpand\pgfplots@ycoordminTEX}}%
192 % \fi
193 % \ifx\pgfplots@rectangle@height\pgfutil@empty
194 % \def\pgfplots@tmp@xmin@ymax{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}%
195 % \else
196 % \pgf@x=\pgfplots@ycoordminTEX
197 % \advance\pgf@x\pgfplots@height
198 % \edef\pgfplots@tmp@xmin@ymax{\noexpand\pgfqpoint{\noexpand\pgfplots@xcoordminTEX}{\the\pgf@x}}%
199 % \fi
200 %--------------------------------------------------
201 \pgfpointdiff
202 {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}}
203 {\pgfplotspointmaxminmin}%
204 \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
205 \pgfmathveclen{\pgf@x}{\pgf@y}%
206 \xdef\pgfplotspointxaxislength{\pgfmathresult pt}%
207 %
208 \pgfpointdiff
209 {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}}
210 {\pgfplotspointminmaxmin}%
211 \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
212 \pgfmathveclen{\pgf@x}{\pgf@y}%
213 \xdef\pgfplotspointyaxislength{\pgfmathresult pt}%
214 %
215 \ifpgfplots@threedim
216 \pgfpointdiff
217 {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}}
218 {\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}%
219 \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
220 \pgfmathveclen{\pgf@x}{\pgf@y}%
221 \xdef\pgfplotspointzaxislength{\pgfmathresult pt}%
222 \else
223 \global\let\pgfplotspointzaxis=\pgfpointorigin
224 \gdef\pgfplotspointzaxislength{0pt}%
225 \fi
226 \endgroup
227 %
228 }
229
230 % PRECONDITION: called after \pgfplotspoint@initialisation@axes
231 % POSTCONDITION:
232 % \pgfplotspointcenter is defined.
233 \def\pgfplotspoint@initialisation@center{%
234 \begingroup
235 %
236 %
237 \ifpgfplots@threedim
238 %
239 \pgfpointscale
240 {0.5}%
241 {\pgfplotspointxaxis
242 \pgf@xa=\pgf@x
243 \pgf@xb=\pgf@y
244 \pgfplotspointyaxis%
245 \advance\pgf@xa by\pgf@x
246 \advance\pgf@xb by\pgf@y
247 \pgfplotspointzaxis%
248 \advance\pgf@xa by\pgf@x
249 \advance\pgf@xb by\pgf@y
250 \pgf@x=\pgf@xa
251 \pgf@y=\pgf@xb
252 }%
253 \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
254 \else
255 \pgfpointscale
256 {0.5}%
257 {\pgfpointadd
258 \pgfplotspointxaxis%
259 \pgfplotspointyaxis%
260 }%
261 \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
262 \fi
263 \endgroup
264 }
265
266 % PRECONDITION:
267 % the unit vectors are set up
268 %
269 % POSTCONDITION:
270 % \pgfplotspointunit[xyz]
271 % \pgfplotspointunit[xyz]length
272 % \pgfplotspointunit[xyz]invlength
273 % are all set up.
274 \def\pgfplotspoint@initialisation@units{%
275 \edef\pgfplotspointunitx{\pgf@x=\the\pgf@xx\space\pgf@y=\the\pgf@xy\space}%
276 \edef\pgfplotspointunity{\pgf@x=\the\pgf@yx\space\pgf@y=\the\pgf@yy\space}%
277 \let\pgfplotsunitxlength=\pgfplots@x@veclength
278 \let\pgfplotsunitylength=\pgfplots@y@veclength
279 \let\pgfplotsunitxinvlength=\pgfplots@x@inverseveclength
280 \let\pgfplotsunityinvlength=\pgfplots@y@inverseveclength
281 \ifpgfplots@threedim
282 \edef\pgfplotspointunitz{\pgf@x=\the\pgf@zx\space\pgf@y=\the\pgf@zy\space}%
283 \let\pgfplotsunitzlength=\pgfplots@z@veclength
284 \let\pgfplotsunitzinvlength=\pgfplots@z@inverseveclength
285 \fi
286 }%
287
288 % The idea here is the following:
289 %
290 % 1. A point coordinate (<x>,<y>) without units should use
291 % relative axis coordinate system.
292 %
293 % 2. Any other point coordinate should not be altered.
294 %
295 % Former versions installed a shift and changed e_x, e_y and
296 % e_z. However, that was misleading as it disabled point 2).
297 % So, my idea here is to replace \pgfpointxy and \pgfqpointxy
298 % such that they install the correct coordinate system before
299 % doing anything else.
300 \def\pgfplots@change@pgfpoints@to@descriptioncs{%
301 %
302 \let\pgfpointxy=\pgfplotspointdescriptionxy
303 \let\pgfqpointxy=\pgfplotsqpointdescriptionxy
304 % e_z is zero, so the xyz variants ignore z:
305 \def\pgfpointxyz##1##2##3{\pgfpointxy{##1}{##2}}%
306 \def\pgfqpointxyz##1##2##3{\pgfqpointxy{##1}{##2}}%
307 %
308 }%
309
310 % \pgfplotspointticklabelcs{<axis>}{<coordinate>}
311 % or
312 % \pgfplotspointticklabelcs[<default shift>]{<axis>}{<coordinate>}
313 %
314 % Yields a point in the '<axis>ticklabel cs'.
315 %
316 % The 'xticklabel cs' is a coordinate system which expects either one
317 % or two coordinates. The first is the coordinate on the axis where
318 % x tick label will be placed (or would be placed). The first
319 % coordinate '0' means the lower axis site and the value '1' the upper
320 % range. The second (optional) coordinate of 'xticklabel cs' is a
321 % shift in direction of the outer normal vector of the axis. The
322 % minimum shift is the largest' tick labels dimensions. If the second
323 % argument is omitted, the <default shift> will be used (0pt if this
324 % argument has been omitted as well).
325 %
326 % \pgfplotspointticklabelcs#1#2:
327 % #1 is the axis (either x,y or z)
328 % #2 is the coordinate (either <relative coord> or <relative coord>,<shift>)
329 %
330 % @see \pgfplotsvalueoflargesttickdimen
331 %
332 % This command actually boils down to a
333 % \pgfplotsqpointoutsideofticklabelaxisrel
334 % invocation which. Thus, you *can* get the *same* effect by using
335 % basic level commands -- and you are not restricted to the tick label
336 % axis.
337 % @see \pgfplotsqpointoutsideofaxisrel
338 \def\pgfplotspointticklabelcs{\pgfutil@ifnextchar[%
339 {\pgfplotspointticklabelcs@opt}%
340 {\pgfplotspointticklabelcs@opt[0pt]}%
341 }%
342 \def\pgfplotspointticklabelcs@opt[#1]#2#3{%
343 \pgfutil@in@{,}{#3}%
344 \ifpgfutil@in@
345 \edef\pgfplots@loc@TMPa{#3}%
346 \else
347 \edef\pgfplots@loc@TMPa{#3,#1}%
348 \fi
349 \def\pgfplots@loc@TMPb##1,##2\relax{%
350 % invoke
351 % \pgfplotsqpointoutsideofticklabelaxisrel{#2}{##1}{ticklabel dimen + ##2}:
352 \begingroup
353 \pgfmathparse{##2}%
354 \pgf@xa=\pgfmathresult pt\relax
355 \advance\pgf@xa by\pgfplotsvalueoflargesttickdimen{#2} %<- keep this space!
356 \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber\pgf@xa}%
357 \endgroup
358 \def\pgfplots@loc@TMPa{\pgfplotsqpointoutsideofticklabelaxisrel{#2}{##1}}%
359 \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@glob@TMPa}%
360 }%
361 \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax
362 }%
363
364 \def\pgfplotspointticklabelnoshiftcs#1#2{%
365 \pgfutil@in@{,}{#2}%
366 \ifpgfutil@in@
367 \edef\pgfplots@loc@TMPa{#2}%
368 \else
369 \edef\pgfplots@loc@TMPa{#2,0}%
370 \fi
371 \def\pgfplots@loc@TMPb##1,##2\relax{%
372 % invoke
373 % \pgfplotsqpointoutsideofticklabelaxisrel{#2}{##1}{##2}:
374 \pgfmathparse{##2}%
375 \def\pgfplots@loc@TMPa{\pgfplotsqpointoutsideofticklabelaxisrel{#1}{##1}}%
376 \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}%
377 }%
378 \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax
379 }%
380
381
382 % Converts a dimen (with unit!) to a corresponding x, y or z
383 % coordinate.
384 % The result will be written to \pgfmathresult (without units).
385 %
386 % It is possible to use the result within the \pointxyz command(s).
387 %
388 % #1: the axis (x,y or z)
389 % #2: the dimen
390 %
391 % example:
392 % \pgfplotsconvertunittocoordinate{x}{5pt}
393 \def\pgfplotsconvertunittocoordinate#1#2{%
394 \begingroup
395 \pgf@xa=#2\relax
396 \pgf@xa=\csname pgfplots@#1@inverseveclength\endcsname\pgf@xa
397 \edef\pgfmathresult{\pgf@sys@tonumber\pgf@xa}%
398 \pgfmath@smuggleone\pgfmathresult
399 \endgroup
400 }%
401
402 % This is the same as using \pgfplotsconvertunittocoordinate for each
403 % component #1, #2 and #3. The results are directly communicated to
404 % \pgfplotsqpointxyz.
405 %
406 % Expects #1, #2 and #3 to be numbers with units and issues a \pgfplotsqpointxyz
407 \def\pgfplotsqpointxyzabsolutesize#1#2#3{%
408 \begingroup
409 \pgf@xa=#1\relax
410 \pgf@xa=\pgfplots@x@inverseveclength\pgf@xa
411 \pgf@xb=#2\relax
412 \pgf@xb=\pgfplots@y@inverseveclength\pgf@xb
413 \pgf@ya=#3\relax
414 \pgf@ya=\pgfplots@z@inverseveclength\pgf@ya
415 \xdef\pgfplots@glob@TMPa{{\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@ya}}%
416 \endgroup
417 \expandafter\pgfplotsqpointxyz\pgfplots@glob@TMPa
418 }%
419
420 % Denotes a point in a twodimensional hyperplane. The hyperplane is
421 % one of the six planes of the threedimensional axis cube.
422 %
423 % The meaning of coordinates #1 and #2 will be redefined depending on
424 % which surface we are currently processing. You can get the axis
425 % names for '#1' (a) and '#2' (b) using the macros
426 % \pgfplotspointonorientedsurfaceA (one of the characters x,y or z)
427 % and
428 % \pgfplotspointonorientedsurfaceB.
429 % The surface normal direction is
430 % \pgfplotspointonorientedsurfaceN.
431 %
432 % Example:
433 % \pgfplotspointonorientedsurfaceabsetupfor xyz
434 % \pgfplotspointonorientedsurfaceabsetupforsetz{<lower z limit>}{0}
435 %
436 % ->
437 % \pgfplotspointonorientedsurfaceA = x
438 % \pgfplotspointonorientedsurfaceB = y
439 % \pgfplotspointonorientedsurfaceN = z
440 % \pgfplotspointonorientedsurfacespec = {ab0}
441 % \pgfplotspointonorientedsurfacespecunordered = {vv0}
442 % \pgfplotspointonorientedsurfaceab{3}{4} =\pgfqpointxyz{3}{4}{<lower z limit>}
443 %
444 % \pgfplotspointonorientedsurfaceabsetupfor yxz
445 % \pgfplotspointonorientedsurfaceabsetupforsetz{<lower z limit>}{0}
446 % ->
447 % \pgfplotspointonorientedsurfaceA = y
448 % \pgfplotspointonorientedsurfaceB = x
449 % \pgfplotspointonorientedsurfaceN = z
450 % \pgfplotspointonorientedsurfacespec = {ba0}
451 % \pgfplotspointonorientedsurfacespecunordered = {vv0}
452 % \pgfplotspointonorientedsurfaceab{3}{4} =\pgfqpointxyz{4}{3}{<lower z limit>}
453 %
454 % @see \pgfplotspointonorientedsurfaceabsetupfor xyz
455 \def\pgfplotspointonorientedsurfaceab#1#2{%
456 \pgfplots@error{Internal logic error: \string\pgfplotspointonorientedsurfaceab\ used although surface has not been declared! You need to call \string\pgfplotspointonorientedsurfaceabsetupfor xyz\ or its friends to do so.}%
457 }%
458
459 % This is a shortcut for
460 % \pgfpointadd
461 % {\pgfplotspointonorientedsurfaceab{#1}{#2}}
462 % {<shift in B direction of #3>}
463 %
464 % where #3 is a dimension (a number with unit).
465 \def\pgfplotspointonorientedsurfaceabwithbshift#1#2#3{%
466 \begingroup
467 \pgf@xa=#3\relax
468 \ifdim\pgf@xa=0pt
469 \else
470 \pgf@xa=\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname\pgf@xa
471 \fi
472 \advance\pgf@xa by#2pt
473 \edef\pgfplots@loc@b{\pgf@sys@tonumber\pgf@xa}%
474 \pgf@process{\pgfplotspointonorientedsurfaceab{#1}{\pgfplots@loc@b}}%
475 \endgroup
476 }
477
478 \pgfkeyssetvalue{/pgfplots/oriented surf installed}{}
479
480 % This macro will be defined after
481 % \pgfplotspointonorientedsurfaceabsetupfor...
482 % routines. It expands to a three-character string
483 % where the first character contains information about the x axis,
484 % the second about the y axis and the third about the z axis.
485 %
486 % The single characters can be one of
487 % - 'a' - the corresponding axis is the PRIMARY direction of the
488 % oriented surface.
489 % - 'b' - the corresponding axis is the SECONDARY direction of the
490 % oriented surface.
491 % - anything else - the characters provides as second argument for
492 % \pgfplotspointonorientedsurfaceabsetupforsetz{}{}, for example.
493 % Common choices are '0' for lower limit, '1' for upper limit and
494 % '2' for other.
495 \def\pgfplotspointonorientedsurfacespec{}%
496
497 % Similar to \pgfplotspointonorientedsurfacespec, this macro encodes
498 % the currently active oriented surface.
499 % However, it only contains the characters 'v', '0' and '1' and '2'.
500 % The distinction 'v in {a,b}' is eliminated.
501 \def\pgfplotspointonorientedsurfacespecunordered{}%
502
503 % As \pgfplotspointonorientedsurfacespec, this macro contains
504 % information about the current oriented surface: it contains the
505 % fixed symbol '0', '1' or '2' describing the only direction which is
506 % fixed.
507 \def\pgfplotspointonorientedsurfacespecsymbol{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}
508
509 \def\pgfplotspointonorientedsurfaceabsetupfor#1#2#3{%
510 \pgfutil@ifundefined{pgfplotspointonorientedsurfaceabsetupfor@@#1#2#3}{%
511 \pgfplots@error{Sorry, \string\pgfplotspointonorientedsurfaceabsetupfor\space#1#2#3 is not yet implemented.}%
512 }{
513 \csname pgfplotspointonorientedsurfaceabsetupfor@@#1#2#3\endcsname
514 }%
515 }%
516 %
517 % Initialises \pgfplotspointonorientedsurfaceab such that 'a' is the x
518 % axis and 'b' is the y axis and the z coordinate has been fixed with
519 % \pgfplotspointonorientedsurfaceabsetupforsetz{}.
520 %
521 % The Z value needs to be fixed with
522 % \pgfplotspointonorientedsurfaceabsetupforsetz .
523 \def\pgfplotspointonorientedsurfaceabsetupfor@@xyz{%
524 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##1}{##2}{\pgfplotspointonorientedsurfaceabsetupfor@fixedz}}%
525 \def\pgfplotspointonorientedsurfaceA{x}%
526 \def\pgfplotspointonorientedsurfaceB{y}%
527 \def\pgfplotspointonorientedsurfaceN{z}%
528 \edef\pgfplotspointonorientedsurfacespec{ab\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
529 \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
530 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
531 }%
532 \def\pgfplotspointonorientedsurfaceabsetupfor@@yxz{%
533 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##2}{##1}{\pgfplotspointonorientedsurfaceabsetupfor@fixedz}}%
534 \def\pgfplotspointonorientedsurfaceA{y}%
535 \def\pgfplotspointonorientedsurfaceB{x}%
536 \def\pgfplotspointonorientedsurfaceN{z}%
537 \edef\pgfplotspointonorientedsurfacespec{ba\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
538 \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
539 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
540 }%
541 \def\pgfplotspointonorientedsurfaceabsetupfor@@xzy{%
542 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##1}{\pgfplotspointonorientedsurfaceabsetupfor@fixedy}{##2}}%
543 \def\pgfplotspointonorientedsurfaceA{x}%
544 \def\pgfplotspointonorientedsurfaceB{z}%
545 \def\pgfplotspointonorientedsurfaceN{y}%
546 \edef\pgfplotspointonorientedsurfacespec{a\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol b}%
547 \edef\pgfplotspointonorientedsurfacespecunordered{v\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol v}%
548 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
549 }%
550 \def\pgfplotspointonorientedsurfaceabsetupfor@@zxy{%
551 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##2}{\pgfplotspointonorientedsurfaceabsetupfor@fixedy}{##1}}%
552 \def\pgfplotspointonorientedsurfaceA{z}%
553 \def\pgfplotspointonorientedsurfaceB{x}%
554 \def\pgfplotspointonorientedsurfaceN{y}%
555 \edef\pgfplotspointonorientedsurfacespec{b\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol a}%
556 \edef\pgfplotspointonorientedsurfacespecunordered{v\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol v}%
557 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
558 }%
559 \def\pgfplotspointonorientedsurfaceabsetupfor@@yzx{%
560 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{\pgfplotspointonorientedsurfaceabsetupfor@fixedx}{##1}{##2}}%
561 \def\pgfplotspointonorientedsurfaceA{y}%
562 \def\pgfplotspointonorientedsurfaceB{z}%
563 \def\pgfplotspointonorientedsurfaceN{x}%
564 \edef\pgfplotspointonorientedsurfacespec{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol ab}%
565 \edef\pgfplotspointonorientedsurfacespecunordered{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol vv}%
566 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
567 }%
568 \def\pgfplotspointonorientedsurfaceabsetupfor@@zyx{%
569 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{\pgfplotspointonorientedsurfaceabsetupfor@fixedx}{##2}{##1}}%
570 \def\pgfplotspointonorientedsurfaceA{z}%
571 \def\pgfplotspointonorientedsurfaceB{y}%
572 \def\pgfplotspointonorientedsurfaceN{x}%
573 \edef\pgfplotspointonorientedsurfacespec{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol ba}%
574 \edef\pgfplotspointonorientedsurfacespecunordered{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol vv}%
575 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
576 }%
577
578 % Fixes 'x' to #1 for use in
579 % \pgfplotspointonorientedsurfaceabsetupfor zyx and
580 % \pgfplotspointonorientedsurfaceabsetupfor yzx.
581 %
582 % #1: The fixed value for 'x' (a coordinate in transformed range).
583 % #2: a one-character symbol describing 'x'.
584 % Command characters are
585 % 0 : x is the lower x-axis range.
586 % 1 : x is the upper x-axis range.
587 % 2 : other.
588 \def\pgfplotspointonorientedsurfaceabsetupforsetx#1#2{%
589 \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedx{#1}%
590 \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}%
591 }%
592 \def\pgfplotspointonorientedsurfaceabsetupforsety#1#2{%
593 \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedy{#1}%
594 \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}%
595 }%
596 \def\pgfplotspointonorientedsurfaceabsetupforsetz#1#2{%
597 \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedz{#1}%
598 \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}%
599 }%
600
601 % Helper methods which should be used if no Z component exists (pure
602 % 2d plots).
603 \def\pgfplotspointonorientedsurfaceabsetupfor@@xy{%
604 \def\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{0}%
605 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxy{##1}{##2}}%
606 \def\pgfplotspointonorientedsurfaceA{x}%
607 \def\pgfplotspointonorientedsurfaceB{y}%
608 \def\pgfplotspointonorientedsurfaceN{z}%
609 \edef\pgfplotspointonorientedsurfacespec{ab\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
610 \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
611 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
612 }%
613 \def\pgfplotspointonorientedsurfaceabsetupfor@@yx{%
614 \def\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{0}%
615 \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxy{##2}{##1}}%
616 \def\pgfplotspointonorientedsurfaceA{y}%
617 \def\pgfplotspointonorientedsurfaceB{x}%
618 \def\pgfplotspointonorientedsurfaceN{z}%
619 \edef\pgfplotspointonorientedsurfacespec{ba\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
620 \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}%
621 \pgfkeysvalueof{/pgfplots/oriented surf installed}%
622 }%
623
624
625 % Assuming we have an oriented surface installed, this command defines
626 % \pgfplotsretval to be the three-char-string such that the 'a' axis
627 % if the oriented surface takes value '#1', the 'b' axis of the
628 % oriented surface takes '#2' and the remaining axis has its fixed
629 % symbol anyway.
630 \def\pgfplotspointonorientedsurfaceabtolinespec#1#2{%
631 \expandafter\pgfplotspointonorientedsurfaceabtolinespec@a\pgfplotspointonorientedsurfacespec\relax#1%
632 \expandafter\pgfplotspointonorientedsurfaceabtolinespec@b\pgfplotsretval\relax#2%
633 }%
634 \def\pgfplotspointonorientedsurfaceabtolinespec@a#1a#2\relax#3{\edef\pgfplotsretval{#1#3#2}}
635 \def\pgfplotspointonorientedsurfaceabtolinespec@b#1b#2\relax#3{\edef\pgfplotsretval{#1#3#2}}
636
637 % Assuming that an oriented surface has been initialised, say 'a0b',
638 % we have the following possible axis lines which can be drawn:
639 % - b=0: 'v00'
640 % - b=1: 'v01'
641 % - b=2: 'v02'
642 %
643 % To check which of them should be drawn, this macro here converts 'a'
644 % to 'v' and 'b' to '#1'. The remaining possible character will be
645 % copied as-is.
646 %
647 % The resulting three-character-string is written into '#2'.
648 %
649 % #1 : the replacement value which will be inserted instead of 'b' in
650 % the currently active oriented surface.
651 % #2 : the macro which will contain the output axis line specification
652 % (three-char-string).
653 %
654 % Example:
655 % \pgfplotspointonorientedsurfaceabsetupfor xyz
656 % \pgfplotspointonorientedsurfaceabsetupforsetz{<lower z limit>}{0}
657 % -> the oriented surface is 'ab0'
658 % ...
659 % \pgfplotspointonorientedsurfaceabgetcontainedaxisline{0}\pgfplotsretval
660 % -> \pgfplotsretval = 'v00'
661 % \pgfplotspointonorientedsurfaceabgetcontainedaxisline{1}\pgfplotsretval
662 % -> \pgfplotsretval = 'v10'
663 % \pgfplotspointonorientedsurfaceabgetcontainedaxisline{2}\pgfplotsretval
664 % -> \pgfplotsretval = 'v20'
665 \def\pgfplotspointonorientedsurfaceabgetcontainedaxisline#1#2{%
666 \expandafter\pgfplotspointonorientedsurfaceabgetcontainedaxisline@\pgfplotspointonorientedsurfacespec\relax{#1}%
667 \let#2=\pgfplots@loc@TMPa
668 }%
669 % writes into \pgfplots@loc@TMPa:
670 \def\pgfplotspointonorientedsurfaceabgetcontainedaxisline@#1#2#3\relax#4{%
671 \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#1}{#4}\to\pgfplots@loc@TMPa
672 \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#2}{#4}\to\pgfplots@loc@TMPb
673 \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#3}{#4}\to\pgfplots@loc@TMPc
674 \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa\pgfplots@loc@TMPb\pgfplots@loc@TMPc}%
675 }%
676 \def\pgfplotspointonorientedsurfaceabgetcontainedaxisline@single#1#2\to#3{%
677 \if#1a%
678 \def#3{v}%
679 \else
680 \if#1b%
681 \def#3{#2}%
682 \else
683 \def#3{#1}%
684 \fi
685 \fi
686 }%
687
688
689 % Finds the two surfaces which are adjacent to an axis line encoded as
690 % three-character-string.
691 %
692 % There are the following possibilities:
693 % #1 = 'v**' where '*' is not 'v'.
694 % -> #2 = 'vv*' and #3 = 'v*v'
695 %
696 % #1 = '*v*'
697 % -> #2 = 'vv*' and #3 = '*vv'
698 %
699 % #1 = '**v'
700 % -> #2 = 'v*v' and #3 = '*vv'
701 \def\pgfplotsgetadjacentsurfsforaxisline#1\to#2#3{%
702 \edef\pgfplots@loc@TMPa{#1}%
703 \expandafter\pgfplotsgetadjacentsurfsforaxisline@\pgfplots@loc@TMPa\relax{#2}{#3}%
704 }%
705 \def\pgfplotsgetadjacentsurfsforaxisline@#1#2#3\relax#4#5{%
706 \if#1v%
707 \def#4{vv#3}%
708 \def#5{v#2v}%
709 \else
710 \if#2v%
711 \def#4{vv#3}%
712 \def#5{#1vv}%
713 \else
714 \def#4{v#2v}%
715 \def#5{#1vv}%
716 \fi
717 \fi
718 }%
719
720 % Executes code '#2' if the axis surface denoted by the
721 % three-character-string '#1' is a foreground surface and code '#3' if
722 % the surface '#1' is a background surface.
723 %
724 % #1: a three-char-string with the keys
725 % 'v' = 'varying',
726 % '0' = 'lower axis limit',
727 % '1' = 'upper axis limit'.
728 % The string 'v0v' means that x and z are varying in that surface
729 % and 'y' is fixed to the lower axis limit.
730 % #2: code to execute if '#1' is foreground.
731 % #3: code to execute if '#1' is background.
732 \def\pgfplotsifaxissurfaceisforeground#1#2#3{%
733 \pgfutil@ifundefined{pgfplots@surfviewdepth@#1}{%
734 \pgfplots@error{\string\pgfplotsifaxissurfaceisforeground{#1}: undefined three-character-string '#1' provided.}%
735 #3%
736 }{%
737 \if f\csname pgfplots@surfviewdepth@#1\endcsname #2\else #3\fi
738 }%
739 }%
740
741 % As \pgfplotsifaxissurfaceisforeground, but for axis lines.
742 %
743 % #1: a three-character string with the same keys as in
744 % \pgfplotsifaxissurfaceisforeground. However, there should be only
745 % one varying direction as we are dealing with an axis line.
746 % #2: code to execute if '#1' is foreground.
747 % #3: code to execute if '#1' is background.
748 %
749 \def\pgfplotsifaxislineisforeground#1#2#3{%
750 \pgfplotsgetadjacentsurfsforaxisline#1\to\pgfplots@loc@TMPb\pgfplots@loc@TMPc
751 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPb}{%
752 #2%
753 }{%
754 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPc}{%
755 #2%
756 }{%
757 #3%
758 }%
759 }%
760 }%
761 % Executes code '#2' if the axis surface denoted by the
762 % three-char-string '#1' is on the convex hull of the projected axis
763 % cube or code '#3' if that is not the case.
764 %
765 % The arguments are the same as for \pgfplotsifaxislineisforeground:
766 % #1: a three-character string with the same keys as in
767 % \pgfplotsifaxissurfaceisforeground. However, there should be only
768 % one varying direction as we are dealing with an axis line.
769 % #2: code to execute if '#1' is foreground.
770 % #3: code to execute if '#1' is background.
771 \def\pgfplotsifaxislineisonconvexhull#1#2#3{%
772 \pgfplotsgetadjacentsurfsforaxisline#1\to\pgfplots@loc@TMPb\pgfplots@loc@TMPc
773 % '#1' is on the convex hull if ONE of the adjacent surfs is
774 % foreground and the other one is background.
775 \pgfplots@loc@tmpfalse
776 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPb}{%
777 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPc}{%
778 }{%
779 \pgfplots@loc@tmptrue
780 }%
781 }{%
782 }%
783 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPb}{%
784 }{%
785 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPc}{%
786 \pgfplots@loc@tmptrue
787 }{%
788 }%
789 }%
790 \ifpgfplots@loc@tmp #2\else #3\fi
791 }%
792
793 % Executes code '#2' if the axis line with 'b=#1' on the current
794 % oriented surface shall be drawn.
795 % If that is not the case, the code '#3' will be executed.
796 %
797 % Example:
798 % Let's assume the current oriented surface is 'b0a'.
799 % Then,
800 % \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{draw it!}{\relax}
801 % will check whether the line '00v' shall be drawn while
802 % \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{draw it!}{\relax}
803 % will check whether the line '10v' shall be drawn.
804 %
805 % The check is based on
806 % 1. foreground/background flags
807 % 2. the current configuration of the axis lines key(s)
808 %
809 % @see \pgfplotspointonorientedsurfaceabgetcontainedaxisline
810 \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn#1#2#3{%
811 \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@{#1}{%
812 \edef\pgfplots@loc@TMPe{\csname pgfplots@\pgfplotspointonorientedsurfaceA axislinesnum\endcsname}%
813 \if0\pgfplots@loc@TMPe
814 % boxed axis lines
815 #2%
816 \else
817 \if2\pgfplots@loc@TMPe
818 % centered axis lines
819 #2%
820 \else
821 % either the 'left' or 'right' positioned cases.
822 % These have exactly one line which is the one where
823 % tick labels will be placed. And this, in turn, is
824 % already known, even for 3D. Check if we have it:
825 \pgfplotspointonorientedsurfaceabtolinespec v#1%
826 \edef\pgfplots@loc@TMPe{\csname pgfplots@\pgfplotspointonorientedsurfaceA ticklabelaxisspec\endcsname}%
827 \ifx\pgfplots@loc@TMPe\pgfplotsretval
828 #2%
829 \else
830 #3%
831 \fi
832 \fi
833 \fi
834 }{%
835 #3%
836 }%
837 }%
838 \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@allaxislinevariations#1#2#3{%
839 \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@{#1}{%
840 #2%
841 }{%
842 #3%
843 }%
844 }%
845
846 % A sub-part of \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn
847 % which is /only/ based on foreground/background flags.
848 %
849 % @ATTENTION : this command will be always true for the 2D case. (it
850 % will be overwritten, see \pgfplots@decide@which@figure@surfaces@are@drawn)
851 \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@#1#2#3{%
852 \pgfplotspointonorientedsurfaceabgetcontainedaxisline#1\pgfplots@loc@TMPc
853 \pgfplotsgetadjacentsurfsforaxisline\pgfplots@loc@TMPc\to\pgfplots@loc@TMPb\pgfplots@loc@TMPc
854 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPb}{%
855 \pgfplotsifaxissurfaceisforeground{\pgfplots@loc@TMPc}{%
856 #3%
857 }{%
858 #2%
859 }%
860 }{%
861 #2%
862 }%
863 }%
864
865 % Similar to \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn,
866 % this thing here execute '#1' if grid lines on the currently
867 % initialised oriented surfaces shall be drawn and '#2' if not.
868 %
869 % This does only handle foreground/background issues; it has NOTHING
870 % to do with the actual checks if grid lines are active or not.
871 \def\pgfplots@ifgridlines@onorientedsurf@should@be@drawn#1#2{%
872 % grid lines shall be drawn
873 % if and only if BOTH adjacent axis lines shall be drawn:
874 \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@allaxislinevariations{0}{%
875 % remark: this is ALWAYS true for 2D plots.
876 \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@allaxislinevariations{1}{%
877 #1%
878 }{%
879 #2%
880 }%
881 }{%
882 #2%
883 }%
884 }%
885
886 % Checks whether the line specified by a three-character-string '#1'
887 % is inside of the currently set-up oriented surface.
888 %
889 % The return value is encoded as integer into the macro #2 as
890 % described below.
891 %
892 % #1 : a three-character string uniquely identifying an axis line.
893 % Each of the three characters can be 'v', '0' or '1'.
894 % The value '0' denotes the lower axis range while '1' denotes
895 % the upper axis range. The character 'v' stands for 'varying'
896 % and indicates the direction in which the line varies. The first
897 % character contains the values for the 'x' axis, the second
898 % character for the 'y' axis and the third character for the 'z'
899 % axis.
900 % Example:
901 % 'v01' is the axis line with 'y=lower y limit' and 'z=upper z limit'
902 % '10v' is the axis line with 'x=upper x limit' and 'y=lower y limit'
903 % The 'v' character indicates the varying component. There may be
904 % only one 'v'.
905 % #2 : a macro name. It will be empty if the line is NOT on the
906 % current surface. If will be non-empty if it IS on the current
907 % surface.
908 % To be more precise, If the line IS on the current surface, '#2' will be set to
909 % the character in '#1' which belongs to the second oriented
910 % surface axis (which is called the 'b' axis).
911 % Thus, the following values for '#2' can be expected:
912 % - '' (empty) if the line is not on the surface,
913 % - 'v' if the line IS on the surface, and '#1' contains a 'v'
914 % in direction of the surface's 'b' axis.
915 % - '0' if the line IS on the surface and '#1' contains a '0' in
916 % direction of the surface's 'b' axis,
917 % - '1' if the line IS on the surface and '#1' contains a '1' in
918 % direction of the surface's 'b' axis.
919 % No other values are possible.
920 %
921 % Example:
922 % \pgfplotspointonorientedsurfaceabsetupforsetz{\zmax}{1}
923 % \pgfplotspointonorientedsurfaceabsetupfor yxz
924 % \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result}
925 % -> \result will be 'v' because 'x=v' in '{v01}
926 %
927 % \pgfplotspointonorientedsurfaceabsetupforsety{\ymin}{0}
928 % \pgfplotspointonorientedsurfaceabsetupfor xzy
929 % \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result}
930 % -> \result will be '1' because 'z=1' in '{v01}
931 %
932 % \pgfplotspointonorientedsurfaceabsetupforsety{\ymax}{1}
933 % \pgfplotspointonorientedsurfaceabsetupfor xzy
934 % \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result}
935 % -> \result will be empty because 'y=0' in '{v01}
936 %
937 % \pgfplotspointonorientedsurfaceabsetupforsetx{\xmax}{1}
938 % \pgfplotspointonorientedsurfaceabsetupfor yzx
939 % \pgfplotspointonorientedsurfaceabmatchaxisline{10v}{\result}
940 % -> \result will be 'v' because 'z=v' in '{10v}
941 \def\pgfplotspointonorientedsurfaceabmatchaxisline#1#2{%
942 \pgfplotsmatchcubeparts{#1}{\pgfplotspointonorientedsurfacespec}{#2}%
943 }%
944
945 % Checks whether the line or surface specified by a three-character-string '#1'
946 % is inside of the surface designated by the three-character-string '#2'.
947 %
948 %
949 % Arguments:
950 % #1 a cube-part (axis line or surface) encoded as three character
951 % string. Can be '0v1' or 'vv0' or so (see above).
952 % #2 a surface, also encoded as three character string. Maybe
953 % oriented.
954 % #3 The return value is encoded as char into the macro #3 as
955 % described in \pgfplotspointonorientedsurfaceabmatchaxisline:
956 % '#3' will be EMPTY if '#1' is NOT in '#2'.
957 % '#3' will be NON-EMPTY if '#1' IS in '#2'.
958 \def\pgfplotsmatchcubeparts#1#2#3{%
959 \edef\pgfplots@loc@TMPa{#1:#2}%
960 \expandafter\pgfplotspointonorientedsurfaceabmatchaxisline@\pgfplots@loc@TMPa\pgfplots@EOI
961 \let#3=\pgfplots@loc@TMPa
962 }%
963
964 % IMPLEMENTATION:
965 % The return value is 'yes, #1#2#3 is on the oriented surface #4#5#6'
966 % if and only if for all three character pairs, the following single
967 % relations hold.
968 % Input char oriented surface char
969 % 'v' : is either a or b or v
970 % '0' : is either 0, a, b, v or 2 (i.e. NOT 1) FIXME : is the '2' correct here!?
971 % '1' : is either 1, a, b, v or 2 (i.e. NOT 0)
972 % '2' : is either 2, a, b, v (i.e. NOT 0 or 1)
973 % That's all.
974 %
975 % If the 'oriented surface char' is 'v', then we actually don't have
976 % an oriented surface but just a surface.
977 % So, 'a0b' is the same surface as 'v0v', but the first choice has
978 % designated orientations.
979 %
980 % @POST \pgfplots@loc@TMPa contains the return value macro.
981 % More precisely, \pgfplots@loc@TMPa will be EMPTY is #1#2#3 is NOT
982 % on #4#5#6 . It will contain the value on the surface if it IS on
983 % the surface
984 \def\pgfplotspointonorientedsurfaceabmatchaxisline@#1#2#3:#4#5#6\pgfplots@EOI{%
985 % Search for the 'b' character:
986 \if#4b%
987 \def\pgfplots@loc@TMPa{#1}%
988 \else
989 \if#5b%
990 \def\pgfplots@loc@TMPa{#2}%
991 \else
992 \if#6b%
993 \def\pgfplots@loc@TMPa{#3}%
994 \else
995 \def\pgfplots@loc@TMPa{v}% FALLBACK solution.
996 \fi
997 \fi
998 \fi
999 % Now, check whether we need to clear the return value (i.e.
1000 % return false)
1001 \pgfplotspointonorientedsurfaceabmatchaxisline@single{#1}{#4}%
1002 \pgfplotspointonorientedsurfaceabmatchaxisline@single{#2}{#5}%
1003 \pgfplotspointonorientedsurfaceabmatchaxisline@single{#3}{#6}%
1004 %\message{\string\pgfplotspointonorientedsurfaceabmatchaxisline@#1#2#3:#4#5#6 = '\pgfplots@loc@TMPa'.^^J}%
1005 }
1006 \def\pgfplotspointonorientedsurfaceabmatchaxisline@single#1#2{%
1007 \if#1v%
1008 \if#2a%
1009 \else
1010 \if#2b%
1011 \else
1012 \if#2v%
1013 \else
1014 \let\pgfplots@loc@TMPa=\pgfutil@empty
1015 \fi
1016 \fi
1017 \fi
1018 \else
1019 \if0#1%
1020 \if1#2%
1021 \let\pgfplots@loc@TMPa=\pgfutil@empty
1022 \fi
1023 \else
1024 \if1#1%
1025 \if0#2%
1026 \let\pgfplots@loc@TMPa=\pgfutil@empty
1027 \fi
1028 \else
1029 \if2#1%
1030 \if0#2%
1031 \let\pgfplots@loc@TMPa=\pgfutil@empty
1032 \fi
1033 \if1#2%
1034 \let\pgfplots@loc@TMPa=\pgfutil@empty
1035 \fi
1036 \else
1037 % return TRUE.
1038 % I admit I am not sure at all if this works in all
1039 % cases
1040 \pgfplotspointonorientedsurfaceabmatchaxisline@warn{#1}%
1041 \fi
1042 \fi
1043 \fi
1044 \fi
1045 }%
1046 \def\pgfplotspointonorientedsurfaceabmatchaxisline@warn#1{%
1047 \pgfplots@warning{The internal implementation is suspicious that something is wrong: \string\pgfplotspointonorientedsurfaceabmatchaxisline@warn: the character '#1' in a three-character axis line or surface description might not be fully supported...}%
1048 }%
1049
1050 % Provides a point on an arbitrary axis (identified by a
1051 % three-character-string) which can take any value on that axis and
1052 % which is shifted in the direction of the outer normal vector.
1053 %
1054 % #1: a three-character-string denoting the desired axis
1055 % #2: the coordinate on that axis (the coordinate for the 'v'
1056 % direction in '#1'). It needs to be given as it would be supplied to
1057 % an \addplot or 'axis cs' coordinate; any logs or data
1058 % transformations will be applied.
1059 % #3: the distance (a dimension) describing how much we should move
1060 % away from that axis. This points to the outside normal vector of the
1061 % axis cube.
1062 %
1063 % @see \pgfplotsqpointoutsideofticklabelaxis
1064 %
1065 % If, in addition, the boolean \ifpgfslopedattime is true, the same
1066 % transformations which would have been applied by
1067 % \pgftransformlineattime will be applied, that means the 'sloped'
1068 % feature of tikz is applied. FIXME : is that up-to-date!?
1069 %
1070 % @see \pgftransformlineattime -- it is quite similar.
1071 \def\pgfplotsqpointoutsideofaxis#1#2#3{%
1072 \begingroup
1073 \def\pgfplotspointoutsideofaxis@plug@trafo##1##2{\csname pgfplotstransformcoordinate##1\endcsname{##2}}%
1074 \let\pgfplotspointoutsideofaxis@plug@getlimit=\pgfplotspointoutsideofaxis@getlimit@
1075 \edef\pgfplots@loc@TMPa{#1}%
1076 \expandafter\pgfplotspointoutsideofaxis@\pgfplots@loc@TMPa\relax{#2}{#3}%
1077 }%
1078
1079 % A variant of \pgfplotsqpointoutsideofaxis with relative values for
1080 % #2.
1081 % That means
1082 % '#2 = 0' === lower axis limit
1083 % and
1084 % '#2 = 1' === upper axis limit.
1085 \def\pgfplotsqpointoutsideofaxisrel#1#2#3{%
1086 \begingroup
1087 \def\pgfplotspointoutsideofaxis@plug@trafo##1##2{%
1088 \begingroup
1089 % compute ##1min + ##2 * (##1max - ##1min) :
1090 %
1091 \afterassignment\pgfplots@gobble@until@relax
1092 \pgf@xa=##2pt\relax
1093 \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber\pgf@xa}%
1094 %
1095 \pgf@xa=\csname pgfplots@##1min\endcsname pt %
1096 \pgf@xb=\csname pgfplots@##1max\endcsname pt %
1097 \pgf@xc=\pgf@xb
1098 \ifpgfplots@allow@reversal@of@rel@axis@cs
1099 \if\pgfkeysvalueof{/pgfplots/##1 dir/value}r%
1100 % reverse: exchange min and max.
1101 \pgf@xb=\pgf@xa
1102 \pgf@xa=\pgf@xc
1103 \pgf@xc=\pgf@xb
1104 \fi
1105 \fi
1106 \advance\pgf@xc by-\pgf@xa
1107 \pgf@xc=\pgfplots@loc@TMPa\pgf@xc
1108 \advance\pgf@xc by\pgf@xa
1109 \edef\pgfmathresult{\pgf@sys@tonumber\pgf@xc}%
1110 \pgfmath@smuggleone\pgfmathresult
1111 \endgroup
1112 }%
1113 \let\pgfplotspointoutsideofaxis@plug@getlimit=\pgfplotspointoutsideofaxis@getlimit@
1114 \edef\pgfplots@loc@TMPa{#1}%
1115 \expandafter\pgfplotspointoutsideofaxis@\pgfplots@loc@TMPa\relax{#2}{#3}%
1116 }%
1117
1118 % A variant of \pgfplotsqpointoutsideofaxis which accepts transformed
1119 % values for '#2' (i.e. any data transformations and logs are already
1120 % applied).
1121 \def\pgfplotsqpointoutsideofaxistransformed#1#2#3{%
1122 \begingroup
1123 \def\pgfplotspointoutsideofaxis@plug@trafo##1##2{\def\pgfmathresult{##2}}%
1124 \let\pgfplotspointoutsideofaxis@plug@getlimit=\pgfplotspointoutsideofaxis@getlimit@
1125 \edef\pgfplots@loc@TMPa{#1}%
1126 \expandafter\pgfplotspointoutsideofaxis@\pgfplots@loc@TMPa\relax{#2}{#3}%
1127 }%
1128
1129 % Computes the unit outer normal vector of the axis identified by a
1130 % three-character-string '#1'.
1131 %
1132 % This is the same normal vector which is used inside of
1133 % \pgfplotsqpointoutsideofaxis and its variants.
1134 %
1135 % The output of this command will be cached and re-used during the
1136 % lifetime of an axis.
1137 %
1138 % The returned normal vector has length 1 (computed with
1139 % \pgfpointnormalised).
1140 %
1141 % NOTE: some specialized axis types support non-linear axes (for
1142 % example, polar axes). In that case, the outer normal vector *varies*
1143 % along the `v' direction (of the three-character-string `#1').
1144 % The value of `v' can be set using
1145 % \pgfplotspointouternormalvectorofaxissetv{<axis three char string>}{<transformed coordinate>}
1146 \def\pgfplotspointouternormalvectorofaxis#1{%
1147 \pgfplotspointouternormalvectorofaxis@ifdependson@v{#1}{%
1148 \expandafter\global\expandafter\let\csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname\relax
1149 }{%
1150 }%
1151 \expandafter\ifx\csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname\relax
1152 \begingroup
1153 \edef\pgfplots@loc@TMPa{#1}%
1154 \expandafter\pgfplotspointouternormalvectorofaxis@\pgfplots@loc@TMPa\relax%
1155 % \endgroup in \pgfplotspointouternormalvectorofaxis@.
1156 \expandafter\xdef\csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
1157 \else
1158 \csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname
1159 \fi
1160 }%
1161
1162 % Fixes the "v" value for successive calls to
1163 % \pgfplotspointouternormalvectorofaxis{#1}.
1164 %
1165 % #1 the three-character-string of an axis or the empty string.
1166 % If #1 is empty, the actual configuration of oriented surfaces may be
1167 % used to check which normal vector is intended.
1168 %
1169 % #2 the "v" value to store. It should be a transformed coordinate.
1170 \def\pgfplotspointouternormalvectorofaxissetv#1#2{%
1171 \edef\pgfplots@loc@TMPa{#1}%
1172 \ifx\pgfplots@loc@TMPa\pgfutil@empty
1173 \expandafter\edef\csname pgfplotspointouternormalvectorofaxis@v@\pgfplotspointonorientedsurfaceA\endcsname{#2}%
1174 \else
1175 \expandafter\edef\csname pgfplotspointouternormalvectorofaxis@v@#1\endcsname{#2}%
1176 \fi
1177 }%
1178
1179 % Defines \pgfplotsretval to contain the 'v' value for an outer normal
1180 % vector (if there is one known). If there is no such value,
1181 % \pgfplotsretval will be empty.
1182 % #1 a three-character-string
1183 %
1184 % see \pgfplotspointouternormalvectorofaxissetv
1185 \def\pgfplotspointouternormalvectorofaxisgetv#1{%
1186 \edef\pgfplots@loc@TMPa{#1}%
1187 \expandafter\pgfplotspointouternormalvectorofaxisgetv@\pgfplots@loc@TMPa\relax\relax\relax\relax
1188 }
1189 \def\pgfplotspointouternormalvectorofaxisgetv@#1#2#3\relax{%
1190 \pgfutil@ifundefined{pgfplotspointouternormalvectorofaxis@v@#1#2#3}{%
1191 % no value found so far.
1192 \if#1v%
1193 \def\pgfplotsretval{x}%
1194 \else
1195 \if#2v%
1196 \def\pgfplotsretval{y}%
1197 \else
1198 \def\pgfplotsretval{z}%
1199 \fi
1200 \fi
1201 \pgfutil@ifundefined{pgfplotspointouternormalvectorofaxis@v@\pgfplotsretval}{%
1202 \let\pgfplotsretval\pgfutil@empty
1203 }{%
1204 \edef\pgfplotsretval{\csname pgfplotspointouternormalvectorofaxis@v@\pgfplotsretval\endcsname}%
1205 }%
1206 }{%
1207 \edef\pgfplotsretval{\csname pgfplotspointouternormalvectorofaxis@v@#1#2#3\endcsname}%
1208 }%
1209 }%
1210
1211 % invokes #2 if the outer normal for the axis #1 (identified by a
1212 % three-character-string) depends on a coordinate on that axis and #3
1213 % otherwise.
1214 %
1215 % Overwrite in subclasses if necessary.
1216 \def\pgfplotspointouternormalvectorofaxis@ifdependson@v#1#2#3{#3}
1217
1218 \def\pgfplotspointouternormalvectorofaxis@#1#2#3\relax{%
1219 \if v#1%
1220 \def\pgfplots@loc@point@orthogonal@to@v##1##2{%
1221 \pgfplotsqpointxyz{0}{##1}{##2}%
1222 }%
1223 \def\pgfplots@loc@char@for@baxis{#2}%
1224 \def\pgfplots@loc@char@for@naxis{#3}%
1225 \def\pgfplots@loc@vaxis{x}%
1226 \def\pgfplots@loc@baxis{y}%
1227 \def\pgfplots@loc@naxis{z}%
1228 \else
1229 \if v#2%
1230 \def\pgfplots@loc@point@orthogonal@to@v##1##2{%
1231 \pgfplotsqpointxyz{##1}{0}{##2}%
1232 }%
1233 \def\pgfplots@loc@char@for@baxis{#1}%
1234 \def\pgfplots@loc@char@for@naxis{#3}%
1235 \def\pgfplots@loc@vaxis{y}%
1236 \def\pgfplots@loc@baxis{x}%
1237 \def\pgfplots@loc@naxis{z}%
1238 \else
1239 \def\pgfplots@loc@point@orthogonal@to@v##1##2{%
1240 \pgfplotsqpointxyz{##1}{##2}{0}%
1241 }%
1242 \def\pgfplots@loc@char@for@baxis{#1}%
1243 \def\pgfplots@loc@char@for@naxis{#2}%
1244 \def\pgfplots@loc@vaxis{z}%
1245 \def\pgfplots@loc@baxis{x}%
1246 \def\pgfplots@loc@naxis{y}%
1247 \fi
1248 \fi
1249 %
1250 \pgfplotspointouternormalvectorofaxis@get@otheraxis@sign{\pgfplots@loc@vaxis}{\pgfplots@loc@baxis}{\pgfplots@loc@char@for@baxis}%
1251 \let\pgfplots@loc@baxissign=\pgfplotsretval
1252 %
1253 \pgfplotspointouternormalvectorofaxis@get@otheraxis@sign{\pgfplots@loc@vaxis}{\pgfplots@loc@naxis}{\pgfplots@loc@char@for@naxis}%
1254 \let\pgfplots@loc@naxissign=\pgfplotsretval
1255 %
1256 %
1257 % ok, compute vector scales:
1258 \pgfplotsmath@ifzero{\csname pgfplots@\pgfplots@loc@baxis @veclength\endcsname}{%
1259 \def\pgfplots@loc@baxissign{0}%
1260 \def\pgfplots@loc@baxisscale{0}%
1261 }{%
1262 \edef\pgfplots@loc@baxisscale{\pgfplots@loc@baxissign\csname pgfplots@\pgfplots@loc@baxis @inverseveclength\endcsname}%
1263 }%
1264 \pgfplotsmath@ifzero{\csname pgfplots@\pgfplots@loc@naxis @veclength\endcsname}{%
1265 \def\pgfplots@loc@naxissign{0}%
1266 \def\pgfplots@loc@naxisscale{0}%
1267 }{%
1268 \edef\pgfplots@loc@naxisscale{\pgfplots@loc@naxissign\csname pgfplots@\pgfplots@loc@naxis @inverseveclength\endcsname}%
1269 }%
1270 %
1271 % Ok, compute and normalize the vector:
1272 \pgf@process{%
1273 \pgfpointnormalised
1274 {\pgfplots@loc@point@orthogonal@to@v{\pgfplots@loc@baxisscale}{\pgfplots@loc@naxisscale}}%
1275 }%
1276 \endgroup
1277 }%
1278
1279 % #1: the axis for which we want the "outer normal".
1280 % #2: the "other axis" for which we seek the sign.
1281 % #3: the entry in the three-char-identifier which corresponds to
1282 % "other axis".
1283 \def\pgfplotspointouternormalvectorofaxis@get@otheraxis@sign#1#2#3{%
1284 \ifcase#3\relax%
1285 % case 0:
1286 % this means : the '##1' direction of the surface
1287 % orthogonal to the 'v' vector is on the lower axis
1288 % limit. Since I need a vector pointing to the OUTSIDE of
1289 % the axis, I need sign = -1
1290 \def\pgfplotsretval{-}%
1291 \or
1292 % case 1:
1293 % in this case, the OUTSIDE area requires a plus sign - the b
1294 % axis already points to the inside.
1295 \def\pgfplotsretval{+}%
1296 \or
1297 % case 2: we have the 'axis lines=centered' case.
1298 %
1299 % This case is complicated. The problem is that we do not know
1300 % if we are at the top or bottom limit.
1301 %
1302 % BUT: we know what we would have done if this would be a
1303 % normal boxed axis!
1304 %
1305 % The idea is to return the same normal vector as if this would be a boxed axis.
1306 % To this end, we have to access the "ticklabel axis spec"
1307 % which would have been used in this case.
1308 %
1309 % We computed it at startup. Might be a hack ... :-(
1310 \edef\pgfplots@loc@TMPb{\csname pgfplots@#1ticklabelaxisspec@box\endcsname}%
1311 %
1312 % decode it: we have to replace '#3' by the value that it has
1313 % in that boxed ticklabel axis spec!
1314 \def\pgfplots@loc@TMPa##1##2##3{%
1315 % search for the correct entry.
1316 \if x#2\def\pgfplotsretval{##1}\fi
1317 \if y#2\def\pgfplotsretval{##2}\fi
1318 \if z#2\def\pgfplotsretval{##3}\fi
1319 }%
1320 \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb
1321 %
1322 \if 2\pgfplotsretval
1323 \pgfplots@error{internal assertion failed.}%
1324 \fi
1325 %
1326 % invoke it again!
1327 \pgfplotspointouternormalvectorofaxis@get@otheraxis@sign{#1}{#2}{\pgfplotsretval}%
1328 \fi
1329 }
1330
1331 % very-low-level internal routine. Never invoke it directly.
1332 % @PRECONDITION:
1333 % an \begingroup has been opened.
1334 % @POSTCONDITION
1335 % an \endgroup has been closed and \pgf@x and \pgf@y are assigned.
1336 %
1337 % This grouping stuff has the intention to keep the "plug" things
1338 % local.
1339 %
1340 % #1#2#3 are the three characters for the line, delimited by \relax.
1341 % #4: the argument supplied as coordinate on that axis.
1342 % #5: the shift along the outer unit normal.
1343 \def\pgfplotspointoutsideofaxis@#1#2#3\relax#4#5{%
1344 %
1345 \def\pgfplotspointoutsideofaxis@lineshift{}%
1346 %
1347 \if v#1%
1348 \pgfplotspointoutsideofaxis@plug@getlimit{y}{#2}\let\pgfplots@loc@TMPa=\pgfmathresult
1349 \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@loc@TMPa}{#2}%
1350 \def\pgfplotspointoutsideofaxis@lineshift{x}%
1351 %
1352 \pgfplotspointonorientedsurfaceabsetupfor xzy%
1353 \pgfplotspointoutsideofaxis@plug@trafo{x}{#4}\let\pgfplots@loc@A=\pgfmathresult
1354 \ifpgfplots@threedim
1355 \pgfplotspointoutsideofaxis@plug@getlimit{z}{#3}\let\pgfplots@loc@B=\pgfmathresult
1356 \else
1357 \def\pgfplots@loc@B{0}%
1358 \fi
1359 \else
1360 \if v#2%
1361 \ifpgfplots@threedim
1362 \pgfplotspointoutsideofaxis@plug@getlimit{z}{#3}\let\pgfplots@loc@TMPa=\pgfmathresult
1363 \else
1364 \def\pgfplots@loc@TMPa{0}%
1365 \fi
1366 \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@loc@TMPa}{#3}%
1367 %
1368 \pgfplotspointonorientedsurfaceabsetupfor yxz%
1369 \pgfplotspointoutsideofaxis@plug@trafo{y}{#4}\let\pgfplots@loc@A=\pgfmathresult
1370 \pgfplotspointoutsideofaxis@plug@getlimit{x}{#1}\let\pgfplots@loc@B=\pgfmathresult
1371 \def\pgfplotspointoutsideofaxis@lineshift{y}%
1372 \else
1373 \pgfplotspointoutsideofaxis@plug@getlimit{x}{#1}\let\pgfplots@loc@TMPa=\pgfmathresult
1374 \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@loc@TMPa}{#1}%
1375 %
1376 \pgfplotspointonorientedsurfaceabsetupfor zyx%
1377 \ifpgfplots@threedim
1378 \pgfplotspointoutsideofaxis@plug@trafo{z}{#4}\let\pgfplots@loc@A=\pgfmathresult
1379 \else
1380 \def\pgfplots@loc@A{0}%
1381 \fi
1382 \pgfplotspointoutsideofaxis@plug@getlimit{y}{#2}\let\pgfplots@loc@B=\pgfmathresult
1383 \def\pgfplotspointoutsideofaxis@lineshift{z}%
1384 \fi
1385 \fi
1386 %
1387 % read dimen argument #5:
1388 \afterassignment\pgfplots@gobble@until@relax
1389 \pgf@xa=#5pt\relax
1390 %
1391 \pgfkeysgetvalue{/pgfplots/axis \pgfplotspointoutsideofaxis@lineshift\space line shift}\pgfmathresult
1392 \ifx\pgfmathresult\pgfutil@empty
1393 \else
1394 \advance\pgf@xa by \pgfmathresult pt %
1395 \fi
1396 %
1397 \edef\pgfplots@loc@distalong@normal{\pgf@sys@tonumber\pgf@xa}%
1398 %
1399 %\message{pgfplotspointoutsideofaxis{#1#2#3}{#4}{#5}: A = \pgfplots@loc@A, B = \pgfplots@loc@B.^^J}%
1400 %
1401 \pgf@process{%
1402 \pgfpointadd
1403 {\pgfplotspointonorientedsurfaceab{\pgfplots@loc@A}{\pgfplots@loc@B}}
1404 {%
1405 \pgfplotspointouternormalvectorofaxissetv{#1#2#3}{\pgfplots@loc@A}%
1406 \pgfqpointscale
1407 {\pgfplots@loc@distalong@normal}%
1408 {\pgfplotspointouternormalvectorofaxis{#1#2#3}}%
1409 }%
1410 }%
1411 \endgroup
1412 }%
1413 %--------------------------------------------------
1414 % \def\pgfplotspointoutsideofaxis@#1#2#3\relax#4#5{%
1415 % \if v#1%
1416 % \def\pgfplots@loc@point@orthogonal@to@v{%
1417 % \pgfplotspointoutsideofaxis@plug@trafo{x}{#4}\let\pgfplots@loc@TMPa=\pgfmathresult
1418 % \pgfplotspointoutsideofaxis@plug@getlimit{y}{#2}\let\pgfplots@loc@TMPb=\pgfmathresult
1419 % \ifpgfplots@threedim
1420 % \pgfplotspointoutsideofaxis@plug@getlimit{z}{#3}\let\pgfplots@loc@TMPc=\pgfmathresult
1421 % \else
1422 % \def\pgfplots@loc@TMPc{0}%
1423 % \fi
1424 % \pgfplotsqpointxyz{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}%
1425 % }%
1426 % \else
1427 % \if v#2%
1428 % \def\pgfplots@loc@point@orthogonal@to@v{%
1429 % \pgfplotspointoutsideofaxis@plug@trafo{y}{#4}\let\pgfplots@loc@TMPa=\pgfmathresult
1430 % \pgfplotspointoutsideofaxis@plug@getlimit{x}{#1}\let\pgfplots@loc@TMPb=\pgfmathresult
1431 % \ifpgfplots@threedim
1432 % \pgfplotspointoutsideofaxis@plug@getlimit{z}{#3}\let\pgfplots@loc@TMPc=\pgfmathresult
1433 % \else
1434 % \def\pgfplots@loc@TMPc{0}%
1435 % \fi
1436 % \pgfplotsqpointxyz{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}%
1437 % }%
1438 % \else
1439 % \def\pgfplots@loc@point@orthogonal@to@v{%
1440 % \ifpgfplots@threedim
1441 % \pgfplotspointoutsideofaxis@plug@trafo{z}{#4}\let\pgfplots@loc@TMPa=\pgfmathresult
1442 % \else
1443 % \def\pgfplots@loc@TMPa{0}%
1444 % \fi
1445 % \pgfplotspointoutsideofaxis@plug@getlimit{x}{#1}\let\pgfplots@loc@TMPb=\pgfmathresult
1446 % \pgfplotspointoutsideofaxis@plug@getlimit{y}{#2}\let\pgfplots@loc@TMPc=\pgfmathresult
1447 % \pgfplotsqpointxyz{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}{\pgfplots@loc@TMPa}%
1448 % }%
1449 % \fi
1450 % \fi
1451 % %
1452 % % read dimen argument #5:
1453 % \afterassignment\pgfplots@gobble@until@relax
1454 % \pgf@xa=#5pt\relax
1455 % \edef\pgfplots@loc@distalong@normal{\pgf@sys@tonumber\pgf@xa}%
1456 % %
1457 % %
1458 % \pgf@process{%
1459 % \pgfpointadd
1460 % {\pgfplots@loc@point@orthogonal@to@v}
1461 % {%
1462 % \pgfqpointscale
1463 % {\pgfplots@loc@distalong@normal}%
1464 % {\pgfplotspointouternormalvectorofaxis{#1#2#3}}%
1465 % }%
1466 % }%
1467 % \endgroup
1468 % }%
1469 %--------------------------------------------------
1470
1471 % Helper method for \pgfplotsqpointoutsideofaxis and its variants.
1472 % #1: an axis (x,y or z)
1473 % #2: o(\pgfplots@loc@TMPa - \pgfplots@loc@TMPb) ne of '0', '1' or '2' where
1474 % 0 == add lower #1 axis limit,
1475 % 1 == add upper #1 axis limit,
1476 % 2 == add nothing.
1477 % #3: the value to add.
1478 \def\pgfplotspointoutsideofaxis@getlimit@#1#2{%
1479 \if#20%
1480 \expandafter\let\expandafter\pgfmathresult\csname pgfplots@#1min\endcsname
1481 \else
1482 \if#21%
1483 \expandafter\let\expandafter\pgfmathresult\csname pgfplots@#1max\endcsname
1484 \else
1485 \expandafter\let\expandafter\pgfmathresult\csname pgfplots@logical@ZERO@#1\endcsname
1486 \fi
1487 \fi
1488 }%
1489
1490 \newif\ifpgfplots@sloped
1491 \pgfplots@slopedtrue % its only purpose is to *DEACTIVATE* the sloped transformation after it has been activated.
1492 \newif\ifpgfplots@sloped@resets@nontranslations
1493 \newif\ifpgfplots@sloped@allowupsidedown
1494 \pgfkeys{
1495 /pgfplots/sloped/true/.code={\pgfplots@slopedtrue},
1496 /pgfplots/sloped/false/.code={\pgfplots@slopedfalse},
1497 /pgfplots/sloped/allow upside down/.is if=pgfplots@sloped@allowupsidedown,
1498 /pgfplots/sloped/allow upside down/.default=true,
1499 /pgfplots/sloped/execute for upside down/.initial=,
1500 /pgfplots/sloped/reset nontranslations/.is if=pgfplots@sloped@resets@nontranslations,
1501 /pgfplots/sloped/reset nontranslations/.default=true,
1502 %
1503 % only used by polar axes at the time of this writing:
1504 /pgfplots/sloped/at position/.initial=,
1505 }
1506 % Installs a rotation transformation matrix such that labels or
1507 % whatever are aligned precisely in direction of one of the two/three
1508 % coordinate directions.
1509 %
1510 % \pgfplotstransformtoaxisdirection[<options>]{<axis char>}
1511 %
1512 % <axis char>: the coordinate direction (one of x,y or z)
1513 %
1514 % The code is pretty much the same as \pgftransformlineattime, except
1515 % that the computation is considerably simpler as axis directions are
1516 % a well known quantity.
1517 %
1518 % This command uses \ifpgfplots@sloped@allowupsidedown (=false) and
1519 % \ifpgfplots@sloped@resets@nontranslations (= true). The default
1520 % setting is reinitialised before options are processed
1521 \def\pgfplotstransformtoaxisdirection{%
1522 \pgfutil@ifnextchar[{\pgfplotstransformtoaxisdirection@}{\pgfplotstransformtoaxisdirection@[]}%
1523 }%
1524 \def\pgfplotstransformtoaxisdirection@[#1]#2{%
1525 \pgfplots@sloped@allowupsidedownfalse
1526 \pgfplots@sloped@resets@nontranslationstrue
1527 %
1528 \def\pgfplots@loc@TMPa{#1}%
1529 \ifx\pgfplots@loc@TMPa\pgfutil@empty
1530 \else
1531 \pgfqkeys{/pgfplots/sloped}{#1}%
1532 \fi
1533 \ifpgfplots@sloped
1534 %
1535 \ifpgfplots@sloped@resets@nontranslations
1536 \pgftransformresetnontranslations
1537 \fi
1538 %
1539 % compute unit length vector pointing into the direction of
1540 % '#1#2#3':
1541 \pgfqpointscale{\csname pgfplotsunit#2invlength\endcsname}{\csname pgfplotspointunit#2\endcsname}%
1542 %
1543 \ifdim\pgf@x<0pt%
1544 % oh. upside down.
1545 \pgfkeysvalueof{/pgfplots/sloped/execute for upside down}%
1546 \ifpgfplots@sloped@allowupsidedown
1547 \else
1548 % do not allow upside down labels:
1549 \global\pgf@x=-\pgf@x%
1550 \global\pgf@y=-\pgf@y%
1551 \fi
1552 \fi%
1553 %
1554 \pgf@ya=-\pgf@y%
1555 % set up rotation matrix
1556 % [ cos(alpha) sin(alpha);
1557 % -sin(alpha) cos(alpha) ]
1558 % where cos(alpha) = n_x and sin(alpha) = n_y:
1559 \pgftransformcm%
1560 {\pgf@sys@tonumber{\pgf@x}}{\pgf@sys@tonumber{\pgf@y}}%
1561 {\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfpointorigin}%
1562 \fi
1563 }
1564
1565
1566 % Adds a further, temporary anchor to every node which will be
1567 % processed. The anchor will be named '#3'. It is placed such that
1568 % 1. the node's center is on a line in direction of the inwards normal
1569 % vector of the axis line denoted by '#2' and the 'at' position of the node,
1570 % 2. the node does not intrude the axis.
1571 %
1572 % #1: either x,y or z the direction which varies
1573 % #2: a three-char-string uniquely identifying the axis line.
1574 % The parameter '#1' is redundand: it is the same as the 'v'
1575 % character in '#2'.
1576 % #3: the newly defined anchor name.
1577 %
1578 % @see \pgfplotsdeclareborderanchorforticklabelaxis
1579 \def\pgfplotsdeclareborderanchorforaxis#1#2#3{%
1580 %
1581 %
1582 \pgfdeclaregenericanchor{#3}{\pgfplots@borderanchor@for@axis{#1}{#2}{##1}}%
1583 \pgfdeclaregenericanchor{#3 opposite}{\pgfplots@borderanchor@for@axis@{#1}{#2}{##1}{+1}}%
1584 %
1585 % This variant will ALWAYS be placed on the boundary of the node.
1586 % It is deprecated, I am keeping it for some time....
1587 \pgfdeclaregenericanchor{#3*}{%
1588 \csname pgf@anchor@##1@border\endcsname{%
1589 \pgf@process{%
1590 %
1591 % I want to rotate the node FIRST, then
1592 % I'd like to get the boundary anchor!
1593 %
1594 % My idea: apply the INVERSE transformation
1595 % matrix, then compute the boundary anchor.
1596 %
1597 % As soon as pgf draws the node, the
1598 % transformation matrix will be applied and
1599 % everything is fine.
1600 \pgfutil@ifundefined{pgfreferencednodename}{%
1601 % use given transformation matrix.
1602 }{%
1603 \ifx\pgfreferencednodename\pgfutil@empty
1604 % just use the given transformation matrix - we are
1605 % typesetting an unlabeled node.
1606 \else
1607 \pgfsettransform{\csname pgf@sh@nt@\pgfreferencednodename\endcsname}%
1608 \fi
1609 }%
1610 \pgftransforminvert
1611 %
1612 % This here is the anchor as such.
1613 \pgfqpointscale{-1}{\pgfplotspointouternormalvectorofaxis{#2}}%
1614 %
1615 \pgf@pos@transform\pgf@x\pgf@y
1616 }%
1617 }%
1618 }%
1619 }%
1620
1621 % this does the work for \pgfplotsdeclareborderanchorforaxis.
1622 %
1623 % It depends on \pgfplotspointunit[xyz] and
1624 % \pgfplotspointouternormalvectorofaxis
1625 %
1626 % #1: either x,y or z the direction which varies
1627 % #2: a three-char-string uniquely identifying the axis line.
1628 % The parameter '#1' is redundant: it is the same as the 'v'
1629 % character in '#2'.
1630 % #3: the shape, provided as argument by the pgf routine invoking the
1631 % anchor.
1632 \def\pgfplots@borderanchor@for@axis#1#2#3{%
1633 \pgfplots@borderanchor@for@axis@{#1}{#2}{#3}{-1}%
1634 }
1635 % same as \pgfplots@borderanchor@for@axis{#1}{#2}{3} except that #4 is
1636 % the SIGN for the outer normal.
1637 %
1638 % #4: the sign for the outer normal. #4=-1 means "use inner normal"
1639 % and +1 means "use outer normal"
1640 \def\pgfplots@borderanchor@for@axis@#1#2#3#4{%
1641 \begingroup
1642 \pgfutil@ifundefined{pgfreferencednodename}{%
1643 % use given transformation matrix.
1644 }{%
1645 \ifx\pgfreferencednodename\pgfutil@empty
1646 % just use the given transformation matrix - we are
1647 % typesetting an unlabeled node.
1648 \else
1649 \pgfsettransform{\csname pgf@sh@nt@\pgfreferencednodename\endcsname}%
1650 \fi
1651 }%
1652 % I only need to apply the trafo matrix to direction vectors. Eliminate
1653 % shifts.
1654 \pgf@pt@x=0pt %
1655 \pgf@pt@y=0pt %
1656 %
1657 % I'll apply the inverse transformation matrix to direction
1658 % vectors. To ensure the relative position of these vectors
1659 % and the anchors of the node, I have to invert the matrix:
1660 \pgftransforminvert
1661 %
1662 \pgfplotspointouternormalvectorofaxisgetv{#2}%
1663 \ifx\pgfplotsretval\pgfutil@empty
1664 \pgfkeysgetvalue{/pgfplots/near ticklabel at}\pgfplotsretval
1665 \ifx\pgfplotsretval\pgfutil@empty
1666 \else
1667 % ah - we have one!
1668 \csname pgfplotstransformcoordinate#1\endcsname{\pgfplotsretval}%
1669 \pgfplotspointouternormalvectorofaxissetv{#2}{\pgfmathresult}%
1670 \fi
1671 \fi
1672 %
1673 % This here is the normal direction (points to the axis)
1674 \pgfqpointscale{#4}{\pgfplotspointouternormalvectorofaxis{#2}}%
1675 %
1676 % we apply the inverse CM onto it here:
1677 \pgf@pos@transform\pgf@x\pgf@y
1678 \edef\pgfplots@tmp@normaldir{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
1679 %
1680 \pgfplots@borderanchor@snap@to@nearest@anchor{}% takes \pgf@x and \pgf@y
1681 \let\pgfplots@anchor=\pgfplotsretval
1682 %
1683 % Now, I'd like the 'center' of the node on one line with the
1684 % 'at={}' coordinate at which it shall be placed!
1685 % This can be done as follows:
1686 %
1687 % Compute two lines:
1688 % 1. a line parallel to the #1 axis which goes
1689 % through our recently identified anchor,
1690 % { x = x_a + r_1 * (#1 axis direction)
1691 % 2. a line from center in direction of the normal,
1692 % { x = x_c + r_2 n, r in R }
1693 %
1694 % Calculate the intersection point and return it! This
1695 % involves a lot of arithmetics :-(
1696 %
1697 % UPDATE: I realized that using the 'center' anchor might be too
1698 % restrictive. See the 'near ticklabel align' key.
1699 %
1700 % Note that this is actually too much work for the 2d case - I
1701 % guess it would be more efficient without it. But for 3d, it
1702 % really rocks.
1703 %
1704 % compute (unit#1 - normal):
1705 \pgfplots@tmp@normaldir
1706 \pgf@xb=\pgf@x
1707 \pgf@yb=\pgf@y
1708 %
1709 % and the axis direction (in fact, I use -axis dir. But that
1710 % doesn't matter for the intersection of two lines).
1711 % Scale unit vector to length 1 to improve conditioning:
1712 \pgfqpointscale
1713 {\csname pgfplotsunit#1invlength\endcsname}
1714 {\csname pgfplotspointunit#1\endcsname}%
1715 % FIXME : shouldn't the values be copied AFTER the CM!?
1716 \pgf@xa=\pgf@x
1717 \pgf@ya=\pgf@y
1718 \pgf@pos@transform\pgf@xa\pgf@ya
1719 %
1720 \ifcase\pgfplots@borderanchor@align\relax
1721 % near ticklabel align=inside:
1722 % make sure that we are close to the beginning of the axis
1723 % direction vector.
1724 \pgfplots@borderanchor@snap@to@nearest@anchor{%
1725 \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n%
1726 % simply take \pgf@x and \pgf@y as-is.
1727 \else
1728 \global\pgf@x=-\pgf@x
1729 \global\pgf@y=-\pgf@y
1730 \fi
1731 }%
1732 \or
1733 % near ticklabel align=center:
1734 \def\pgfplotsretval{center}% Ah. simple.
1735 \or
1736 % near ticklabel align=outside:
1737 % make sure that we are far away from the beginning of the
1738 % axis direction vector.
1739 \pgfplots@borderanchor@snap@to@nearest@anchor{%
1740 \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n%
1741 \global\pgf@x=-\pgf@x
1742 \global\pgf@y=-\pgf@y
1743 \else
1744 % simply take \pgf@x and \pgf@y as-is.
1745 \fi
1746 }%
1747 \fi
1748 \let\pgfplots@anchor@inner=\pgfplotsretval
1749 %
1750 %
1751 % verify that |n^T d |
1752 \pgf@xc=\pgf@sys@tonumber\pgf@xa\pgf@xb
1753 \advance\pgf@xc by\pgf@sys@tonumber\pgf@ya\pgf@yb
1754 \ifdim\pgf@xc<0pt \pgf@xc=-\pgf@xc \fi
1755 \ifdim\pgf@xc<0.8pt
1756 % ok. 'n' and 'd' are not parallel.
1757 %
1758 \edef\pgfplots@LEQ{%
1759 % solve linear system
1760 % a11 a12
1761 % a21 a22
1762 {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@xa}%
1763 {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@ya}%
1764 }%
1765 %
1766 % This here controls the anchor! Changing it might be more
1767 % useful than I thought in the first place...
1768 \pgf@sh@reanchor{#3}{\pgfplots@anchor@inner}%
1769 \edef\pgfplots@loc@center{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
1770 %
1771 % apply inverse matrix to right-hand-side (and compute RHS):
1772 \pgfpointdiff% {<start>}{<end>} -> computes <end> - <start>
1773 {\pgfplots@loc@center}%
1774 {\pgf@sh@reanchor{#3}{\pgfplots@anchor}}%
1775 \edef\pgfplots@RHS{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}%
1776 %
1777 \pgfutilsolvetwotwoleq{\pgfplots@LEQ}{\pgfplots@RHS}%
1778 \ifx\pgfmathresult\pgfutil@empty
1779 \pgfplots@error{Singular matrix encountered while computing boundary anchor. Please choose different values.}%
1780 \def\pgfmathresult{0}{0}%
1781 \fi
1782 \def\pgfplots@extract##1##2{%
1783 \def\pgfplots@r{##1}%
1784 }%
1785 \expandafter\pgfplots@extract\pgfmathresult
1786 % GOT IT!
1787 %
1788 % compute x_c + r*n:
1789 \pgfpointadd
1790 {\pgfplots@loc@center}%
1791 {\pgfqpointscale{\pgfplots@r}{\pgfplots@tmp@normaldir}}%
1792 \else
1793 \pgfplotswarning{ticklabel anchor undetermined}{#1}{\the\pgf@xb,\the\pgf@yb}{\the\pgf@xa,\the\pgf@ya}{\the\pgf@xc}\pgfeov
1794 % Something went awry: normal and unit#1 are almost parallel!?
1795 % just use the determined anchor.
1796 \def\pgfplots@r{0}%
1797 \pgf@sh@reanchor{#3}{\pgfplots@anchor}%
1798 \fi
1799 %\message{==========>>>>>>>>>> I got finally (\the\pgf@x,\the\pgf@y). <<<<<<<<<===================}%
1800 \pgf@process{}% <- transport outside of group
1801 \endgroup
1802 }%
1803
1804 % #1: a direction vector.
1805 %
1806 % assigns the resulting anchor to \pgfplotsretval
1807 \def\pgfplots@borderanchor@snap@to@nearest@anchor#1{%
1808 \begingroup
1809 #1%
1810 % Now:
1811 % auto-determine the canonical (north, north east etc) anchor
1812 % at which the node touches the axis (remember: the axis is to
1813 % be found in direction of the normal vector).
1814 %
1815 % This is kind of a snap-to-nearest-existing-anchor feature. But
1816 % it tends to move the node too far away. It is used as starting
1817 % point; we will refine it in the next step.
1818 %
1819 % This is a heuristicial procedure.
1820 %
1821 % Note that it does not hurt if there are "multiple best matches"
1822 % (for example because they lie on the same line).
1823 % The code below will move the final anchor point.
1824 %
1825 \def\pgfplots@thresh{0.17pt }% 80 degrees
1826 %\def\pgfplots@thresh{0.3pt }%
1827 %\def\pgfplots@thresh{0.707pt }% 45 degrees
1828 \ifdim\pgf@y>0pt
1829 \ifdim\pgf@y>\pgfplots@thresh
1830 % only north anchor
1831 \def\pgfplots@ycomp{north}%
1832 \else
1833 \def\pgfplots@ycomp{}%
1834 \fi
1835 \else
1836 \ifdim\pgf@y<-\pgfplots@thresh
1837 \def\pgfplots@ycomp{south}%
1838 % south anchor
1839 \else
1840 \def\pgfplots@ycomp{}%
1841 \fi
1842 \fi
1843 \ifdim\pgf@x>0pt
1844 \ifdim\pgf@x>\pgfplots@thresh
1845 \def\pgfplots@xcomp{east}%
1846 \else
1847 \def\pgfplots@xcomp{}%
1848 \fi
1849 \else
1850 \ifdim\pgf@x<-\pgfplots@thresh
1851 \def\pgfplots@xcomp{west}%
1852 \else
1853 \def\pgfplots@xcomp{}%
1854 \fi
1855 \fi
1856 \edef\pgfplotsretval{%
1857 \pgfplots@ycomp
1858 \ifx\pgfplots@ycomp\pgfutil@empty
1859 \else
1860 \ifx\pgfplots@xcomp\pgfutil@empty
1861 \else
1862 \space
1863 \fi
1864 \fi
1865 \pgfplots@xcomp
1866 }%
1867 \pgfmath@smuggleone\pgfplotsretval
1868 \endgroup
1869 }
1870
1871 \def\pgfplotspointviewdir{%
1872 %\pgfplotsmathvectordatascaletrafoinverse{\pgfplots@view@dir@threedim}{default}%
1873 \let\pgfplotsretval=\pgfplots@view@dir@threedim
1874 \pgfplotspointfromcsvvector{\pgfplotsretval}{default}%
1875 }%
1876
1877 \def\message@pgfplots@units{%
1878 \begingroup
1879 \pgfmathparse{veclen(\pgf@zx,\pgf@zy)}\let\Z=\pgfmathresult
1880 \ifdim\Z pt=0pt
1881 \def\Z{1}%
1882 \fi
1883 \pgfmathparse{veclen(\pgf@xx,\pgf@xy)/\Z}\let\X=\pgfmathresult
1884 \pgfmathparse{veclen(\pgf@yx,\pgf@yy)/\Z}\let\Y=\pgfmathresult
1885 \expandafter\ifx\csname pgfplots@view@dir@threedim\endcsname\relax
1886 \def\normal{view = (---),^^J}%
1887 \else
1888 \pgfplotsmathvectortostring{\pgfplots@view@dir@threedim}{default}%
1889 \edef\normal{view = (\pgfplotsretval),^^J}%
1890 \fi
1891 \message{^^J
1892 x = (\the\pgf@xx,\the\pgf@xy),^^J
1893 y =(\the\pgf@yx,\the\pgf@yy),^^J
1894 z = (\the\pgf@zx,\the\pgf@zy),^^J
1895 \normal
1896 unit vector ratio=[\X\space\Y\space 1],^^J}%
1897 \endgroup
1898 }%
1899
1900
1901 % ==================================================================================
1902 %
1903 % COORDINATE MATH.
1904 %
1905 % ==================================================================================
1906
1907 % Declares a new "subclass" to perform coordinate math.
1908 %
1909 % Coordinate math usually needs a more powerful number format than the pgf
1910 % basic layer, or at least a powerful mapping into the pgf basic
1911 % layer. Both cases are realized by the coordinate math class.
1912 %
1913 % Different coordinates can use different instances, and it is also
1914 % possible to use yet a further instance for point meta (or whatever).
1915 %
1916 % Coordinate math is used to compute axis limits and to map the range
1917 % into the pgf number format.
1918 %
1919 % It is *not* necessarily used for \pgfmathparse, since switching
1920 % the number format of \pgfmathparse is quite involved (at the time of
1921 % this writing). Instead, it is used for *single* operations (like
1922 % max, min, multiply, add).
1923 %
1924 % #1: the name of the coord math class
1925 % #2: methods to override the default.
1926 %
1927 % The available methods are documented and shown below in the
1928 % \pgfqkeys listing.
1929 %
1930 % @see the predefined examples, also shown below.
1931 \def\pgfplotsdeclarecoordmath#1#2{%
1932 \edef\pgfplotsdeclarecoordmath@{@#1@}%
1933 \pgfqkeys{/pgfplots/@declare coord math}{%
1934 initialise=,
1935 parse=\edef\pgfmathresult{##1}\expandafter\pgfmathparse\expandafter{\pgfmathresult},
1936 parse int={%
1937 \begingroup
1938 \pgfplotscoordmath{\pgfplotscoordmathid}{parse}{##1}%
1939 \pgfplotscoordmath{\pgfplotscoordmathid}{tofixed}{\pgfmathresult}%
1940 \afterassignment\pgfplots@gobble@until@relax
1941 \c@pgf@countd=\pgfmathresult\relax
1942 \edef\pgfmathresult{\the\c@pgf@countd}%
1943 \pgfmath@smuggleone\pgfmathresult
1944 \endgroup
1945 },
1946 parsenumber=\pgfmathfloatparsenumber{##1}\pgfmathfloattofixed{##1},%
1947 zero= \pgfplotscoordmath{\pgfplotscoordmathid}{parsenumber}{0},
1948 one= \pgfplotscoordmath{\pgfplotscoordmathid}{parsenumber}{1},
1949 -one= \pgfplotscoordmath{\pgfplotscoordmathid}{parsenumber}{-1},
1950 log e= \pgfmathlog@{##1},%
1951 log to display log=\pgfmath@basic@multiply@{##1}{2.3025851},% * log(10)
1952 log from display log=\pgfmath@basic@multiply@{##1}{0.434294},% / log(10)
1953 log unsigned int={%
1954 \edef\pgfmathresult{%
1955 \ifcase##1
1956 \or0
1957 \or0.693147
1958 \or1.098612
1959 \or1.386294
1960 \or1.60943791
1961 \or1.7917594
1962 \or1.94591014
1963 \or2.07944154
1964 \or2.197224
1965 \fi
1966 }%
1967 },
1968 set log basis=\edef\pgfmathresult{{#1}{##1}}\expandafter\pgfplotscoordmath@log@set@basis\pgfmathresult,
1969 exp e={%
1970 % make sure the exponential can be represented, i.e. use
1971 % 'float' in the default repr:
1972 \pgfmathfloatparsenumber{##1}%
1973 \pgfmathfloatexp@\pgfmathresult%
1974 \pgfplotscoordmath{\pgfplotscoordmathid}{parsenumber}{\pgfmathresult}%
1975 },
1976 tofixed= \edef\pgfmathresult{##1},%
1977 tostring= \edef\pgfmathresult{##1},%
1978 max= \pgfplotsmathmax{##1}{##2},%
1979 min= \pgfplotsmathmin{##1}{##2},%
1980 min limit= \def\pgfmathresult{-16300},%
1981 max limit= \def\pgfmathresult{16300},%
1982 if less than= {\pgfplotsmathlessthan{##1}{##2}\ifpgfmathfloatcomparison ##3\else ##4\fi},
1983 if is= {%
1984 \if##20%
1985 \ifdim##1pt=0pt ##3\else ##4\fi
1986 \else
1987 \if##2+\ifdim##1pt>0pt ##3\else ##4\fi
1988 \else
1989 \if##2-\ifdim##1pt<0pt ##3\else ##4\fi
1990 \else
1991 \def\pgfplots@loc@TMPd{##1}\ifx\pgfplots@loc@TMPd\pgfutil@empty ##3\else ##4\fi
1992 \fi
1993 \fi
1994 \fi
1995 },%
1996 if is bounded=\edef\pgfplotsretval{##1}\ifx\pgfplotsretval\pgfutil@empty ##3\else ##2\fi,
1997 suffix= #1,%
1998 datascaletrafo set params=,
1999 datascaletrafo get params= \def\pgfmathresult{{0}{0}}\def\pgfplotsretval{0}\def\pgfplotsretvalb{0},
2000 datascaletrafo= \edef\pgfmathresult{##1},
2001 datascaletrafo inverse= \edef\pgfmathresult{##1},
2002 datascaletrafo noshift inverse= \edef\pgfmathresult{##1},
2003 datascaletrafo inverse to fixed= \edef\pgfmathresult{##1},
2004 datascaletrafo noshift inverse to fixed= \edef\pgfmathresult{##1},
2005 datascaletrafo noshift= \edef\pgfmathresult{##1},
2006 datascaletrafo undo shift= \edef\pgfmathresult{##1},
2007 datascaletrafo redo shift= \edef\pgfmathresult{##1},
2008 #2%
2009 }%
2010 \expandafter\edef\csname pgfpmth\pgfplotsdeclarecoordmath@ op\endcsname##1##2{%
2011 \noexpand\edef\noexpand\pgfplotscoordmath@{##2}%
2012 \noexpand\expandafter\noexpand\expandafter\noexpand\csname pgfmath\csname pgfpmth@#1@suffix\endcsname ##1@\noexpand\endcsname\noexpand\pgfplotscoordmath@
2013 }%
2014 %
2015 %
2016 % these log function depend on the first argument of
2017 % \pgfplotscoordmath{}, which is available as
2018 % \pgfplotscoordmathid.
2019 \pgfplotsutilforeachcommasep{%
2020 exp,%
2021 log,%
2022 log to display log,%
2023 log from display log,%
2024 log to log 10,%
2025 log unsigned int}\as\pgfplots@loc@TMPa
2026 {%
2027 \expandafter\edef\csname pgfpmth\pgfplotsdeclarecoordmath@\pgfplots@loc@TMPa\endcsname{%
2028 % invoke \pgfpmth@#1@@<name>@<function>
2029 % for example
2030 % \pgfpmth@pgfbasic@@y@log
2031 \noexpand\csname pgfpmth\pgfplotsdeclarecoordmath@ @\noexpand\pgfplotscoordmathid @\pgfplots@loc@TMPa\noexpand\endcsname
2032 }%
2033 }%
2034 %
2035 \pgfutil@ifundefined{pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log}{%
2036 \pgfutil@namelet
2037 {pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log}
2038 {pgfpmth\pgfplotsdeclarecoordmath@ log e}%
2039 }{}%
2040 \pgfutil@ifundefined{pgfpmth\pgfplotsdeclarecoordmath@ tmpl@exp}{%
2041 \pgfutil@namelet
2042 {pgfpmth\pgfplotsdeclarecoordmath@ tmpl@exp}
2043 {pgfpmth\pgfplotsdeclarecoordmath@ exp e}%
2044 }{}%
2045 \pgfplotscoordmath@def@log@to@log@ten{#1}{}{tmpl}% empty arg
2046 %
2047 }%
2048 \pgfqkeys{/pgfplots/@declare coord math}{%
2049 initialise/.code=
2050 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ initialise\endcsname{#1%
2051 \pgfplotscoordmath@initialise@logs
2052 }},%
2053 % takes a number literal as input and defines \pgfmathresult to be
2054 % the parsed result.
2055 parsenumber/.code=
2056 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ parsenumber\endcsname##1{#1}},%
2057 %
2058 zero/.code=
2059 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ zero\endcsname{#1}},%
2060 one/.code=
2061 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ one\endcsname{#1}},%
2062 -one/.code=
2063 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ -one\endcsname{#1}},%
2064 %
2065 % Calls pgfmathparse. Note that this might need to switch to the
2066 % required math library (which is not necessarily cheap)
2067 parse/.code=
2068 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ parse\endcsname##1{#1}},%
2069 parse int/.code=
2070 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ parse int\endcsname##1{#1}},%
2071 %
2072 % takes a parsed number and returns a fixed point number:
2073 tofixed/.code=
2074 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tofixed\endcsname##1{#1}},%
2075 %
2076 % chooses a human readable string (which can be processed by parsenumber):
2077 tostring/.code=
2078 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tostring\endcsname##1{#1}},%
2079 %
2080 % defines a max routine which returns the max of *exactly* two numbers:
2081 max/.code=
2082 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ max\endcsname##1##2{#1}},%
2083 %
2084 % counterpart for max:
2085 min/.code=
2086 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ min\endcsname##1##2{#1}},%
2087 %
2088 % defines \pgfmathresult to be the largest supported number.
2089 max limit/.code=
2090 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ max limit\endcsname{#1}},%
2091 %
2092 % defines \pgfmathresult to be the smallest supported number.
2093 min limit/.code=
2094 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ min limit\endcsname{#1}},%
2095 %
2096 % computes ##1 < ##2 and invokes ##3 in the true case and ##4 in
2097 % the false case.
2098 if less than/.code=
2099 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ if less than\endcsname##1##2##3##4{#1}},%
2100 % checks if ##1 is 0, positive, negative or unbounded
2101 % ##1: the number to check
2102 % ##2: either 0 or + or - or u (u = unbounded)
2103 % ##3: true code
2104 % ##4: false code
2105 if is/.code=
2106 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ if is\endcsname##1##2##3##4{#1}},%
2107 %
2108 % Checks if the argument ##1 is bounded and invokes ##2 in that
2109 % case. IF the argument is unbounded, it invokes #3.
2110 if is bounded/.code=
2111 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ if is bounded\endcsname##1##2##3{#1}},%
2112 %
2113 % applies the natural logarithm. If the log is not defined, the
2114 % argument is "unbounded", see 'if is bounded'
2115 %
2116 % 'log' is special in that it accepts a number literal which may
2117 % be OUTSIDE of the accepted number format. The result, however, is
2118 % then in the accepted number format.
2119 log e/.code=
2120 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ log e\endcsname##1{#1}},%
2121 %
2122 % Similar, but the log basis can be set with 'set log basis'.
2123 % This allows \pgfplotscoordmath{x}{log}{} to use a different log
2124 % basis than \pgfplotscoordmath{y}{log}{} (with special handling)
2125 log/.code=
2126 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log\endcsname##1{#1}},%
2127 % applies a *scale* from the actual log basis to the actual
2128 % *display* log basis. The display log basis is usually 10, unless
2129 % the log basis has been changed.
2130 log to display log/.code=
2131 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log to display log\endcsname##1{#1}},%
2132 % applies a *scale* from the displau log basis to the actual
2133 % log basis (the inverse of `log to display log').
2134 log from display log/.code=
2135 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log from display log\endcsname##1{#1}},%
2136 log to log 10/.code=
2137 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log to log 10\endcsname##1{#1}},%
2138 % returns log(i) where i \in {1,2,3,...,basis-1}
2139 % currently, it is only invoked for log basis 10
2140 log unsigned int/.code=
2141 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log unsigned int\endcsname##1{#1}},%
2142 % sets (changes) the actual log basis.
2143 set log basis/.code=
2144 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ set log basis\endcsname##1{#1}},%
2145 %
2146 % The inverse to 'log e '.
2147 exp e/.code=
2148 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ exp e\endcsname##1{#1}},%
2149 %
2150 % The inverse to 'log'. It also uses the correct log basis.
2151 exp/.code=
2152 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ tmpl@exp\endcsname##1{#1}},%
2153 %
2154 % A macro taking two parameters:
2155 % #1: the EXPONENT (as integer)
2156 % #2: the SHIFT (as fixed point number)
2157 %
2158 % After any change, \pgfplotscoordmathnotifydatascalesetfor{<id>} will be
2159 % invoked where <id> is the argument to
2160 % \pgfplotscoordmath{<id>}...
2161 datascaletrafo set params/.code=
2162 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo set params\endcsname##1##2{%
2163 #1\relax\pgfplotscoordmathnotifydatascalesetfor{\pgfplotscoordmathid}%
2164 }},%
2165 datascaletrafo set shift/.code=
2166 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo set shift\endcsname##1{%
2167 #1\relax\pgfplotscoordmathnotifydatascalesetfor{\pgfplotscoordmathid}%
2168 }},%
2169 %
2170 % Defines \pgfmathresult to contain the two parameters in the form
2171 % {#1}{#2} required for 'datascaletrafo set params':
2172 % #1: the EXPONENT (as integer)
2173 % #2: the SHIFT (as fixed point number)
2174 % AND \pgfplotsretval as the EXPONENT and \pgfplotsretvalb as the SHIFT
2175 datascaletrafo get params/.code={%
2176 \expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo get params\endcsname{#1}%
2177 },%
2178 datascaletrafo/.code=
2179 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo\endcsname##1{#1}},%
2180 datascaletrafo inverse/.code=
2181 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo inverse\endcsname##1{#1}},%
2182 datascaletrafo noshift inverse/.code=
2183 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo noshift inverse\endcsname##1{#1}},%
2184 datascaletrafo inverse to fixed/.code=
2185 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo inverse to fixed\endcsname##1{#1}},%
2186 datascaletrafo noshift inverse to fixed/.code=
2187 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo noshift inverse to fixed\endcsname##1{#1}},%
2188 datascaletrafo noshift/.code=
2189 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo noshift\endcsname##1{#1}},%
2190 datascaletrafo noshift/.code=
2191 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo noshift\endcsname##1{#1}},%
2192 datascaletrafo undo shift/.code=
2193 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo undo shift\endcsname##1{#1}},%
2194 datascaletrafo redo shift/.code=
2195 {\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo redo shift\endcsname##1{#1}},%
2196 %
2197 % defines a suffix such that
2198 % \csname pgfmath<suffix><op>@\endcsname
2199 % exists. Example: <suffix>=float --> \pgfmathfloatmultiply@ for <op>=multiply
2200 suffix/.code=
2201 {\expandafter\edef\csname pgfpmth\pgfplotsdeclarecoordmath@ suffix\endcsname{#1}},%
2202 }%
2203
2204 \def\pgfplotscoordmath@initialise@logs{%
2205 \edef\pgfplotsdeclarecoordmath@{@\pgfplotscoordmathclassfor{\pgfplotscoordmathid}@}%
2206 \pgfutil@ifundefined{pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @log}{%
2207 \pgfplotsutilforeachcommasep{%
2208 exp,%
2209 log,%
2210 log to display log,%
2211 log from display log,%
2212 log to log 10,%
2213 log unsigned int}\as\pgfplots@loc@TMPa
2214 {%
2215 \pgfutil@namelet
2216 {pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @\pgfplots@loc@TMPa}
2217 {pgfpmth\pgfplotsdeclarecoordmath@ tmpl@\pgfplots@loc@TMPa}%
2218 }%
2219 }{}%
2220 }%
2221
2222 % shared implementation for 'set log basis' It works for every
2223 % subclass.
2224 \def\pgfplotscoordmath@log@set@basis#1#2{%
2225 \edef\pgfplotsdeclarecoordmath@{@#1@}%
2226 %
2227 \pgfplotscoordmath{\pgfplotscoordmathid}{log e}{#2}%
2228 \let\pgfplots@loc@TMPa=\pgfmathresult% TMPa = log_e(#2)
2229 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{reciprocal}{{\pgfmathresult}}%
2230 \let\pgfplots@loc@TMPb=\pgfmathresult% TMPb = 1/log_e(#2)
2231 %
2232 % log_a(x) = log_e(x) / log_e(a)
2233 \expandafter\edef\csname pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @log\endcsname##1{%
2234 \noexpand\pgfplotscoordmath{\pgfplotscoordmathid}{log e}{##1}%
2235 \noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty
2236 \noexpand\else
2237 \noexpand\pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{%
2238 {\noexpand\pgfmathresult}%
2239 {\pgfplots@loc@TMPb}%
2240 }%
2241 \noexpand\fi
2242 }%
2243 %
2244 % a^x = exp(log_e(a^x)) = exp(x*log_e(a))
2245 \expandafter\edef\csname pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @exp\endcsname##1{%
2246 \noexpand\edef\noexpand\pgfmathresult{##1}%
2247 \noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty
2248 \noexpand\else
2249 \noexpand\pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{%
2250 {\noexpand\pgfmathresult}%
2251 {\pgfplots@loc@TMPa}%
2252 }%
2253 \noexpand\pgfplotscoordmath{\pgfplotscoordmathid}{exp e}{\noexpand\pgfmathresult}%
2254 \noexpand\fi
2255 }%
2256 \expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @log to display log\endcsname##1{\edef\pgfmathresult{##1}}%
2257 \expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @log from display log\endcsname##1{\edef\pgfmathresult{##1}}%
2258 %
2259 % compute 'log unsigned int' for the new basis.
2260 %
2261 % Idea: re-scale the old implementation (of basis e for i = 1,...,9)
2262 % and re-compute i>=10 :
2263 \begingroup
2264 \expandafter\let\expandafter\logi\csname pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log unsigned int\endcsname
2265 \let\logscale=\pgfplots@loc@TMPb
2266 %
2267 \logi{1}%
2268 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2269 \expandafter\let\csname logi@@1\endcsname=\pgfmathresult
2270 %
2271 \logi{2}%
2272 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2273 \expandafter\let\csname logi@@2\endcsname=\pgfmathresult
2274 %
2275 \logi{3}%
2276 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2277 \expandafter\let\csname logi@@3\endcsname=\pgfmathresult
2278 %
2279 \logi{4}%
2280 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2281 \expandafter\let\csname logi@@4\endcsname=\pgfmathresult
2282 %
2283 \logi{5}%
2284 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2285 \expandafter\let\csname logi@@5\endcsname=\pgfmathresult
2286 %
2287 \logi{6}%
2288 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2289 \expandafter\let\csname logi@@6\endcsname=\pgfmathresult
2290 %
2291 \logi{7}%
2292 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2293 \expandafter\let\csname logi@@7\endcsname=\pgfmathresult
2294 %
2295 \logi{8}%
2296 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2297 \expandafter\let\csname logi@@8\endcsname=\pgfmathresult
2298 %
2299 \logi{9}%
2300 \pgfplotscoordmath{\pgfplotscoordmathid}{op}{multiply}{{\pgfmathresult}{\logscale}}%
2301 \expandafter\let\csname logi@@9\endcsname=\pgfmathresult
2302 %
2303 \xdef\pgfplots@glob@TMPa##1{%
2304 \noexpand\ifcase##1
2305 \noexpand\def\noexpand\pgfmathresult{}%
2306 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@1\endcsname}%
2307 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@2\endcsname}%
2308 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@3\endcsname}%
2309 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@4\endcsname}%
2310 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@5\endcsname}%
2311 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@6\endcsname}%
2312 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@7\endcsname}%
2313 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@8\endcsname}%
2314 \noexpand\or\noexpand\def\noexpand\pgfmathresult{\csname logi@@9\endcsname}%
2315 \noexpand\else
2316 \noexpand\pgfplotscoordmath{\pgfplotscoordmathid}{log}{##1}%
2317 \noexpand\fi
2318 }%
2319 \endgroup
2320 \expandafter\let\csname pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @log unsigned int\endcsname=\pgfplots@glob@TMPa
2321 \pgfplotscoordmath@def@log@to@log@ten{#1}\pgfplots@loc@TMPa{\pgfplotscoordmathid}%
2322 %
2323 \pgfutil@namelet
2324 {pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @log to log 10}
2325 {pgfpmth\pgfplotsdeclarecoordmath@ tmpl@log to log 10}%
2326 }%
2327 % #1: the coord math class
2328 % #2: either empty (basis e) or 1/ln(basis)
2329 % #3: either 'tmpl' or '\pgfplotscoordmathid. It defines the target
2330 % macro name (see the source code)
2331 \def\pgfplotscoordmath@def@log@to@log@ten#1#2#3{%
2332 \csname pgfpmth@#1@parsenumber\endcsname{0.434294}%
2333 \edef\pgfplots@loc@TMPa{#2}%
2334 \ifx\pgfplots@loc@TMPa\pgfutil@empty
2335 % log basis e ---> log basis 10
2336 % log_10 x = log x / log(10)
2337 \else
2338 % log basis a ---> log basis 10
2339 %
2340 % log_a x = log x / log a
2341 % log_10 x = log_a x * log a / log(10) = log x / log(10) [OK]
2342 \csname pgfpmth@#1@op\endcsname{multiply}{{#2}{\pgfmathresult}}%
2343 \fi
2344 \expandafter\edef\csname pgfpmth@#1@#3@log to log 10\endcsname##1{%
2345 \noexpand\pgfplotscoordmath{\noexpand\pgfplotscoordmathid}{op}{multiply}{{##1}{\pgfmathresult}}%
2346 }%
2347 }%
2348
2349 % Assumes that #2 is a macro, parses it as number with "coord math choice" #1, and overwrites it with the result.
2350 \def\pgfplotscoordmathparsemacro#1#2{%
2351 \pgfplotscoordmath{#1}{parsenumber}{#2}\let#2=\pgfmathresult
2352 }%
2353
2354
2355 \pgfplotsdeclarecoordmath{pgfbasic}{%
2356 parsenumber={%
2357 \pgfmathfloatparsenumber{#1}%
2358 \expandafter\pgfmathfloatgetflagstomacro\expandafter{\pgfmathresult}\pgfplotsretval
2359 \ifnum\pgfplotsretval>2
2360 \let\pgfmathresult=\pgfutil@empty
2361 \else
2362 \pgfmathfloattofixed\pgfmathresult
2363 \fi
2364 },
2365 suffix=@basic@,
2366 zero=\def\pgfmathresult{0},
2367 one=\def\pgfmathresult{1},
2368 -one=\def\pgfmathresult{-1},
2369 }
2370 \pgfplotsdeclarecoordmath{float}{%
2371 initialise=
2372 \pgfutil@ifundefined{pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid}{%
2373 \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname{0}%
2374 \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname{0}%
2375 }{},
2376 parsenumber=\pgfmathfloatparsenumber{#1},
2377 parse={%
2378 \begingroup
2379 \pgfkeys{/pgf/fpu,%
2380 /pgf/fpu/output format=float,%
2381 }%
2382 \edef\pgfmathresult{#1}%
2383 \expandafter\pgfmathparse\expandafter{\pgfmathresult}%
2384 \pgfmath@smuggleone\pgfmathresult
2385 \endgroup
2386 },
2387 zero=\pgfmathfloatcreate{0}{0.0}{0},%
2388 one=\pgfmathfloatcreate{1}{1.0}{0},%
2389 -one=\pgfmathfloatcreate{2}{1.0}{0},%
2390 tofixed=\pgfmathfloattofixed{#1},
2391 tostring=\pgfmathfloattosci{#1},
2392 max=\pgfplotsmathfloatmax{#1}{#2},%
2393 min=\pgfplotsmathfloatmin{#1}{#2},%
2394 max limit=\pgfmathfloatcreate{1}{1.0}{2147483645},%
2395 min limit=\pgfmathfloatcreate{2}{1.0}{2147483645},%
2396 log e=\pgfmathfloatparsenumber{#1}\pgfmathfloatln@{\pgfmathresult},%
2397 if less than=\pgfmathfloatlessthan@{#1}{#2}\ifpgfmathfloatcomparison #3\else #4\fi,
2398 if is bounded=%
2399 \expandafter\pgfmathfloatgetflagstomacro\expandafter{#1}\pgfplotsretval
2400 \ifnum\pgfplotsretval>2 #3\else #2\fi,
2401 if is=%
2402 \pgfmathfloatifflags{#1}{#2}{#3}{#4},
2403 log=\pgfmathlog@float{#1},%
2404 datascaletrafo set params={%
2405 \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname{#1}%
2406 \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname{#2}%
2407 },%
2408 datascaletrafo set shift={%
2409 \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname{#1}%
2410 },%
2411 datascaletrafo get params={%
2412 \edef\pgfplotsretval{\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}%
2413 \edef\pgfplotsretvalb{\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname}%
2414 \edef\pgfmathresult{%
2415 {\pgfplotsretval}%
2416 {\pgfplotsretvalb}%
2417 }%
2418 },%
2419 datascaletrafo={%
2420 \edef\pgfmathresult{#1}%
2421 \pgfmathfloatshift@\pgfmathresult{\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}%
2422 \pgfmathfloattofixed\pgfmathresult
2423 \expandafter\pgfmath@basic@subtract@\expandafter{\pgfmathresult}{\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname}%
2424 },%
2425 datascaletrafo noshift={%
2426 \edef\pgfmathresult{#1}%
2427 \pgfmathfloatshift@\pgfmathresult{\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}%
2428 \pgfmathfloattofixed{\pgfmathresult}%
2429 },%
2430 datascaletrafo undo shift=
2431 \pgfmath@basic@subtract@{#1}{\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname},%
2432 datascaletrafo redo shift=\pgfmath@basic@add@{#1}{\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname},%
2433 datascaletrafo inverse={%
2434 \pgfplotscoordmath@float@datascaletrafo@inverse{#1}%
2435 },%
2436 datascaletrafo inverse to fixed={%
2437 \pgfplotscoordmath@float@datascaletrafo@inverse{#1}%
2438 \pgfmathfloattofixed\pgfmathresult
2439 },%
2440 datascaletrafo noshift inverse={%
2441 \pgfmathfloatparsenumber{#1}%
2442 \pgfmathfloatshift@{\pgfmathresult}{-\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}%
2443 },%
2444 datascaletrafo noshift inverse to fixed={%
2445 \pgfmathfloatparsenumber{#1}%
2446 \pgfmathfloatshift@{\pgfmathresult}{-\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}%
2447 \pgfmathfloattofixed\pgfmathresult
2448 },%
2449 }
2450
2451 \def\pgfplotscoordmath@float@datascaletrafo@inverse#1{%
2452 \pgfmath@basic@add@{#1}{\csname pgfplots@data@scale@trafo@SHIFT@\pgfplotscoordmathid\endcsname}%
2453 \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult
2454 \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}%
2455 \ifpgfmathcomparison
2456 \pgfmathfloatcreate{0}{0.0}{0}%
2457 \else
2458 \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}%
2459 \pgfmathfloatshift@{\pgfmathresult}{-\csname pgfplots@data@scale@trafo@EXPONENT@\pgfplotscoordmathid\endcsname}%
2460 \fi
2461 }%
2462
2463 % Invokes a coordinate math routine.
2464 %
2465 % #1: the axis (x,y or z)
2466 % #2: a method name declared by \pgfplotsdeclarecoordmath (one of
2467 % 'op', 'parsenumber', 'tofixed' etc)
2468 % #3-#9: any further arguments required to perform the call to '#2'.
2469 %
2470 % \pgfplotscoordmath {x}{op}{multiply}{{<a>}{<b>}}
2471 % \pgfplotscoordmath {x}{parsenumber}{<a>}
2472 \def\pgfplotscoordmath#1#2{%
2473 \edef\pgfplotscoordmathid{#1}%
2474 \csname pgfpmth@\csname pgfcrdmth@#1\endcsname @#2\endcsname}%
2475
2476 \def\pgfplotscoordmathclassfor#1{\csname pgfcrdmth@#1\endcsname}%
2477
2478 \def\pgfplotscoordmathnotifydatascalesetfor#1{}%
2479
2480 % Enables a particular coordinate math class for the label `#1'.
2481 %
2482 % #1 a label (usually x,y or z)
2483 % #2 the coordinate math class (one prepare by
2484 % \pgfplotsdeclarecoordmath)
2485 %
2486 % From this point on, any call to \pgfplotscoordmath{#1}{...}
2487 % will use the selected math class.
2488 \def\pgfplotssetcoordmathfor#1#2{%
2489 \pgfutil@ifundefined{pgfpmth@#2@initialise}{%
2490 \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, \string\pgfplotssetcoordmathfor{#1}{#2} failed since `#2' is unknown. Maybe you misspelled it?}\pgfeov%
2491 }{%
2492 \expandafter\edef\csname pgfcrdmth@#1\endcsname{#2}%
2493 \pgfplotscoordmath{#1}{initialise}%
2494 }%
2495 }%
2496
2497 % Defines \pgfplotsretval to be the coordmath id for #1
2498 \def\pgfplotsgetcoordmathfor#1{%
2499 \pgfutil@ifundefined{pgfcrdmth@#1}{%
2500 \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, \string\pgfplotsgetcoordmathfor{#1} failed since `#1' is unknown. Maybe you misspelled it?}\pgfeov%
2501 }{%
2502 \pgfutil@namelet{pgfplotsretval}{pgfcrdmth@#1}%
2503 }%
2504 }%
2505 \pgfplotssetcoordmathfor{pgfbasic}{pgfbasic}%
2506 \pgfplotssetcoordmathfor{float}{float}%
2507 \pgfplotssetcoordmathfor{meta}{float}%
2508 \pgfplotssetcoordmathfor{default}{float}%
2509
2510
2511
2512 % ==================================================================================
2513
2514
2515
2516 % #1 the name of an input method for point meta. It must have been
2517 % declared by \pgfplotsdeclarepointmetasource first.
2518 % #2 any arguments supplied by the user (maybe empty).
2519 \def\pgfplotssetpointmetainput#1#2{%
2520 \csname pgfpmeta@#1@initfor\endcsname{#2}%
2521 %
2522 \edef\pgfplotspointmetainputhandler{#1}%
2523 }%
2524
2525 % Expands to the current value of 'point meta'.
2526 \def\pgfplotspointmetainputhandler{}
2527
2528 \def\pgfplotsaxisifhaspointmeta#1#2{%
2529 \ifx\pgfplotspointmetainputhandler\pgfutil@empty #2\else #1\fi
2530 }%
2531
2532 \newif\ifpgfplots@perpointmeta@expand
2533
2534 % Executes code '#2' if the point meta data #1 is bounded
2535 % and '#3' otherwise
2536 %
2537 % If the point meta is symbolic, it will always return true if and
2538 % only if the input is non-empty.
2539 \def\pgfplotsifpointmetaisbounded#1#2#3{%
2540 \ifpgfplots@perpointmeta@expand
2541 \edef\pgfplots@loc@TMPc{#1}%
2542 \else
2543 % symbolic point meta may have expansion issues -- but support one
2544 % level as we usually invoke it with a macro name:
2545 \expandafter\def\expandafter\pgfplots@loc@TMPc\expandafter{#1}%
2546 \fi
2547 \ifx\pgfplots@loc@TMPc\pgfutil@empty
2548 % an empty meta data is _never_ bounded.
2549 #3\relax
2550 \else
2551 \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname
2552 % a (non-empty, see above) symbolic meta data is "bounded"
2553 #2\relax
2554 \else
2555 % check the number:
2556 \pgfplotscoordmath{meta}{if is bounded}{\pgfplots@loc@TMPc}{#2}{#3}%
2557 \fi
2558 \fi
2559 }%
2560
2561 % Invokes '#1' if the axis contains the coordinate designated by
2562 % \pgfplots@current@point@[xyz] and '#2' if not.
2563 \def\pgfplotsaxisifcontainspoint#1#2{%
2564 \pgf@xa=\pgfplots@current@point@x pt % FIXME : SCOPE REGISTERS!?
2565 \pgf@ya=\pgfplots@current@point@y pt %
2566 \ifpgfplots@curplot@threedim
2567 \pgf@yb=\pgfplots@current@point@z pt %
2568 \fi
2569 \def\pgfplots@loc@TMPa{#2}%
2570 %
2571 % I assume that \pgfplots@[xyz]min@reg and min@reg are registers
2572 % containing the limits.
2573 \ifdim\pgf@xa<\pgfplots@xmin@reg
2574 \else
2575 \ifdim\pgf@xa>\pgfplots@xmax@reg
2576 \else
2577 \ifdim\pgf@ya<\pgfplots@ymin@reg
2578 \else
2579 \ifdim\pgf@ya>\pgfplots@ymax@reg
2580 \else
2581 \ifpgfplots@curplot@threedim
2582 \ifdim\pgf@yb<\pgfplots@zmin@reg
2583 \else
2584 \ifdim\pgf@yb>\pgfplots@zmax@reg
2585 \else
2586 \def\pgfplots@loc@TMPa{#1}%
2587 \fi
2588 \fi
2589 \else
2590 \def\pgfplots@loc@TMPa{#1}%
2591 \fi
2592 \fi
2593 \fi
2594 \fi
2595 \fi
2596 \pgfplots@loc@TMPa%
2597 }
2598
2599 % Declares a routine which can be used to get point meta input.
2600 %
2601 % Such a routine is invoked in a context where point coordinates are
2602 % processed, i.e. during 'plot coordinates', 'plot table' or the like.
2603 %
2604 % The routine is called `#1'. It consists of several methods, which
2605 % are described below, in the key definitions.
2606 %
2607 % #1: the name of the input routine.
2608 % #2: a sequence of key-value pairs which can be used to overwrite
2609 % 'assign', 'initfor' or the other components.
2610 % See the definitions below for examples.
2611 \def\pgfplotsdeclarepointmetasource#1#2{%
2612 \expandafter\def\csname pgfpmeta@#1@assign\endcsname{\let\pgfplots@current@point@meta=\pgfutil@empty}%
2613 \expandafter\def\csname pgfpmeta@#1@initfor\endcsname##1{%
2614 \pgfplots@pointmeta@set@expand{#1}%
2615 }%
2616 \expandafter\def\csname pgfpmeta@#1@issymbolic\endcsname{0}%
2617 \expandafter\def\csname pgfpmeta@#1@explicitinput\endcsname{0}%
2618 \expandafter\def\csname pgfpmeta@#1@activate\endcsname{}%
2619 \expandafter\def\csname pgfpmeta@#1@LUA class\endcsname{}%
2620 \expandafter\def\csname pgfpmeta@#1@tostring\endcsname{#1}%
2621 \edef\pgfplotsdeclarepointmetasource@{#1}%
2622 \pgfqkeys{/pgfplots/@declare point meta src}{#2}%
2623 }%
2624
2625 \def\pgfplots@pointmeta@set@expand#1{%
2626 \if1\csname pgfpmeta@#1@explicitinput\endcsname
2627 \pgfplots@perpointmeta@expandfalse
2628 \else
2629 \pgfplots@perpointmeta@expandtrue
2630 \fi
2631 }%
2632
2633 \pgfqkeys{/pgfplots/@declare point meta src}{%
2634 %
2635 % a macro used to initialise the point meta source when it is
2636 % selected.
2637 % This macro body is invoked by pgfplots when someone types
2638 % 'point meta=x' -> will invoke 'pgfpmeta@x@initfor{}'.
2639 % The first argument to initfor can be supplied by the user.
2640 % PRECONDITION for 'initfor':
2641 % - it will be invoked just before
2642 % '\pgfplotspointmetainputhandler' will be changed.
2643 % Default is to do nothing.
2644 initfor/.code=
2645 {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @initfor\endcsname##1{#1}},%
2646 %
2647 % Called during the survey phase before the first 'assign' call.
2648 % It is usually empty.
2649 activate/.code=
2650 {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @activate\endcsname{#1}},%
2651 %
2652 % During the survey phase, this macro is expected to assign
2653 % \pgfplots@current@point@meta
2654 % if it is a numeric input method, it should return a
2655 % floating point number.
2656 % It is allowed to return an empty string to say "there is no point
2657 % meta".
2658 % PRECONDITION for '@assign':
2659 % - the coordinate input method has already assigned its
2660 % '\pgfplots@current@point@meta' (probably as raw input string).
2661 % - the other input coordinates are already read.
2662 % POSTCONDITION for '@assign':
2663 % - \pgfplots@current@point@meta is ready for use:
2664 % - EITHER a parsed floating point number
2665 % - OR an empty string,
2666 % - OR a symbolic string (if the issymbolic boolean is true)
2667 % The default implementation is
2668 % \let\pgfplots@current@point@meta=\pgfutil@empty
2669 %
2670 assign/.code=
2671 {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @assign\endcsname{#1}},%
2672 %
2673 % expands to either '1' or '0'
2674 % A numeric source will be processed numerically in float
2675 % arithmetics. Thus, the output of the @assign routine should be
2676 % a macro \pgfplots@current@point@meta in float format.
2677 %
2678 % The output of a numeric point meta source will result in meta
2679 % limit updates and the final map to [0,1000] will be
2680 % initialised automatically.
2681 %
2682 % A symbolic input routine won't be processed.
2683 % Default is '0'
2684 %
2685 issymbolic/.code=
2686 {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @issymbolic\endcsname{#1}},%
2687 %
2688 % expands to either
2689 % '1' or '0'. In case '1', it expects explicit input from the
2690 % coordinate input routines. For example, 'plot file' will look for
2691 % further input after the x,y,z coordinates.
2692 % Default is '0'
2693 %
2694 explicitinput/.code=
2695 {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @explicitinput\endcsname{#1}},%
2696 %
2697 % the associated LUA class name (if any). Use an empty string if
2698 % there is none.
2699 LUA class/.code=
2700 {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @LUA class\endcsname{#1}},%
2701 %
2702 tostring/.code=
2703 {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @tostring\endcsname{#1}},%
2704 }%
2705
2706 % An empty one. This is simple to check with
2707 % \ifx\pgfplotspointmetainputhandler\pgfutil@empty:
2708 \pgfplotsdeclarepointmetasource{}{}
2709 \pgfplotsdeclarepointmetasource{x}{assign={%
2710 \let\pgfplots@current@point@meta=\pgfplots@current@point@x
2711 \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@current@point@meta}%
2712 \let\pgfplots@current@point@meta=\pgfmathresult
2713 },
2714 LUA class=pgfplots.XcoordAssignmentPointMetaHandler}
2715 \pgfplotsdeclarepointmetasource{y}{assign={%
2716 \let\pgfplots@current@point@meta=\pgfplots@current@point@y
2717 \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@current@point@meta}%
2718 \let\pgfplots@current@point@meta=\pgfmathresult
2719 },
2720 LUA class=pgfplots.YcoordAssignmentPointMetaHandler}
2721 \pgfplotsdeclarepointmetasource{z}{assign={%
2722 \let\pgfplots@current@point@meta=\pgfplots@current@point@z
2723 \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@current@point@meta}%
2724 \let\pgfplots@current@point@meta=\pgfmathresult
2725 },
2726 LUA class=pgfplots.ZcoordAssignmentPointMetaHandler}
2727
2728 \pgfplotsdeclarepointmetasource{explicit}{%
2729 assign={%
2730 \ifx\pgfplots@current@point@meta\pgfutil@empty
2731 \else
2732 \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@current@point@meta}%
2733 \let\pgfplots@current@point@meta=\pgfmathresult
2734 \fi
2735 },
2736 explicitinput=1,%
2737 LUA class=pgfplots.ExplicitPointMetaHandler.new(),
2738 }%
2739 \pgfplotsdeclarepointmetasource{explicit symbolic}{%
2740 assign={},% no math, simply collect.
2741 explicitinput=1,%
2742 issymbolic=1%
2743 }%
2744
2745 \pgfplotsdeclarepointmetasource{expr}{%
2746 assign={%
2747 \csname pgfpmeta@\pgfpmeta@expr@origchoice @assign\endcsname
2748 %
2749 \pgfkeysgetvalue{/pgfplots/point meta/expr}\pgfplots@loc@TMPa
2750 \ifx\pgfplots@loc@TMPa\pgfutil@empty
2751 \else
2752 \pgfmathparse{\pgfplots@loc@TMPa}%
2753 \pgfplotscoordmath{meta}{parsenumber}{\pgfmathresult}%
2754 \let\pgfplots@current@point@meta=\pgfmathresult
2755 \fi
2756 },%
2757 initfor={%
2758 \pgfkeyssetvalue{/pgfplots/point meta/expr}{#1}%
2759 \def\pgfplots@loc@TMPa{expr}%
2760 \ifx\pgfplots@loc@TMPa\pgfplotspointmetainputhandler
2761 \else
2762 \let\pgfpmeta@expr@origchoice\pgfplotspointmetainputhandler
2763 \fi
2764 \ifx\pgfpmeta@expr@origchoice\pgfplots@loc@TMPa
2765 \let\pgfpmeta@expr@origchoice\pgfutil@empty
2766 \fi
2767 %
2768 \pgfplotsutilifcontainsmacro{#1}{%
2769 % oh. The point meta expression contains a backslash - it
2770 % depends on a macro. This means: it depends on \thisrow
2771 % or similar TeX stuff - which must be evaluated by TeX.
2772 %
2773 % LUA cannot be used for this point meta handler.
2774 \let\pgfpmeta@expr@LUA@class\pgfutil@empty
2775 }{%
2776 \def\pgfpmeta@expr@LUA@class{pgfplots.ExpressionPointMetaHandler.new("#1")}%
2777 }%
2778 \pgfplots@perpointmeta@expandtrue
2779 },
2780 LUA class=\pgfpmeta@expr@LUA@class,
2781 }%
2782 \pgfkeyssetvalue{/pgfplots/point meta/expr}{}%
2783
2784 \pgfplotsdeclarepointmetasource{f(x)}{%
2785 activate={%
2786 \ifpgfplots@curplot@threedim
2787 \def\pgfplotspointmetainputhandler{z}%
2788 \else
2789 \def\pgfplotspointmetainputhandler{y}%
2790 \fi
2791 \csname pgfpmeta@\pgfplotspointmetainputhandler @activate\endcsname
2792 },
2793 }%
2794
2795 \pgfplotsdeclarepointmetasource{TeX code}{%
2796 assign={%
2797 \begingroup
2798 \let\pgfplotspointmeta=\pgfutil@empty
2799 \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/code/.@cmd}{}%
2800 \pgfplotscoordmath{meta}{parsenumber}{\pgfplotspointmeta}%
2801 \let\pgfplots@current@point@meta=\pgfmathresult
2802 \pgfmath@smuggleone\pgfplots@current@point@meta
2803 \endgroup
2804 },%
2805 initfor={%
2806 \pgfkeysdef{/pgfplots/point meta/code}{#1}%
2807 \pgfplots@perpointmeta@expandtrue
2808 },
2809 }%
2810 \pgfplotsdeclarepointmetasource{TeX code symbolic}{%
2811 assign={%
2812 \begingroup
2813 \let\pgfplotspointmeta=\pgfutil@empty
2814 \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/code/.@cmd}{}%
2815 \let\pgfplots@current@point@meta=\pgfplotspointmeta
2816 \pgfmath@smuggleone\pgfplots@current@point@meta
2817 \endgroup
2818 },%
2819 initfor={%
2820 \pgfkeysdef{/pgfplots/point meta/code}{#1}%
2821 \pgfplots@perpointmeta@expandfalse
2822 },
2823 issymbolic=1%
2824 }%
2825 \pgfkeysdef{/pgfplots/point meta/code}{}%
2826
2827 % Internal stream methods.
2828 %
2829 % Please overwrite
2830 % - \pgfplots@coord@stream@start@,
2831 % - \pgfplots@coord@stream@end@ and
2832 % - \pgfplots@coord@stream@coord@
2833 % if you implement streams.
2834 %
2835 % REMARK:
2836 % - the stream methods automatically collect first and last
2837 % coordinates.
2838 % - I have experimented with global \addplot accumulation to reduce
2839 % copy operations. That experiment was not successful (it was not
2840 % faster :-( ). However, the streaming methods still assign their
2841 % things globally...
2842 \def\pgfplots@coord@stream@start{%
2843 \let\pgfplots@current@point@x=\pgfutil@empty
2844 \let\pgfplots@current@point@y=\pgfutil@empty
2845 \let\pgfplots@current@point@z=\pgfutil@empty
2846 \let\pgfplots@current@point@meta=\pgfutil@empty
2847 \let\pgfplots@current@point@coordinatestyle=\pgfutil@empty
2848 \let\pgfplots@current@point@error@x@plus=\pgfutil@empty
2849 \let\pgfplots@current@point@error@x@minus=\pgfutil@empty
2850 \let\pgfplots@current@point@error@y@plus=\pgfutil@empty
2851 \let\pgfplots@current@point@error@y@minus=\pgfutil@empty
2852 \let\pgfplots@current@point@error@z@plus=\pgfutil@empty
2853 \let\pgfplots@current@point@error@z@minus=\pgfutil@empty
2854 \pgfplots@coord@stream@start@}%
2855 \def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@}
2856
2857 % Will be invoked for every point coordinate.
2858 %
2859 % It invokes \pgfplots@coord@stream@coord@.
2860 %
2861 % Arguments:
2862 % \pgfplots@current@point@[xyz]
2863 % \pgfplots@current@point@[xyz]@error (if in argument list)
2864 % \pgfplots@current@point@meta
2865 \def\pgfplots@coord@stream@coord{%
2866 \pgfplots@coord@stream@coord@%
2867 }%
2868 \def\pgfplotscoordstream@firstlast@init{%
2869 \global\let\pgfplots@currentplot@firstcoord@x=\pgfutil@empty
2870 \global\let\pgfplots@currentplot@firstcoord@y=\pgfutil@empty
2871 \global\let\pgfplots@currentplot@firstcoord@z=\pgfutil@empty
2872 \global\let\pgfplots@currentplot@lastcoord@x=\pgfutil@empty
2873 \global\let\pgfplots@currentplot@lastcoord@y=\pgfutil@empty
2874 \global\let\pgfplots@currentplot@lastcoord@z=\pgfutil@empty
2875 }%
2876 \def\pgfplotscoordstream@firstlast@update{%
2877 \ifx\pgfplots@current@point@x\pgfutil@empty
2878 % only one \if is enough as ONE empty coordinate causes all
2879 % others to be reset as well.
2880 \else
2881 \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty
2882 \global\let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x
2883 \global\let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y
2884 \global\let\pgfplots@currentplot@firstcoord@z=\pgfplots@current@point@z
2885 \fi
2886 \global\let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x
2887 \global\let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y
2888 \global\let\pgfplots@currentplot@lastcoord@z=\pgfplots@current@point@z
2889 \fi
2890 }%
2891
2892 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2893 %
2894 % Scanline management. The idea is to handle complete sequences of
2895 % input coordinates, which are usually separated by a blank line.
2896 %
2897 % This allows a simple syntax to provide matrix input - by means of scanlines.
2898 % Furthermore, 2d plots can use it to interrupt the display.
2899 %
2900 % An empty line in 'addplot coordinates {}' indicates the end of a
2901 % scan line. Similarly, an empty line in 'addplot file' or 'table'
2902 % also indicates the end of a scan line.
2903 %
2904 % The steps taken whenever a scan line is complete depend on the
2905 % configuration of the /pgfplots/empty line choice key (queried in
2906 % \pgfplotsscanlinelengthinitzero).
2907 %
2908 %
2909 % The following methods constitute the scanline interface.
2910 %
2911 % Usage:
2912 %
2913 % \pgfplotsscanlinelengthinitzero
2914 %
2915 % \pgfplotsscanlinelengthincrease
2916 % <process point>
2917 % \pgfplotsscanlinelengthincrease
2918 % <process point>
2919 % \pgfplotsscanlinelengthincrease
2920 % <process point>
2921 % \pgfplotsscanlinecomplete
2922 % \pgfplotsscanlinelengthincrease
2923 % <process point>
2924 % \pgfplotsscanlinelengthincrease
2925 % <process point>
2926 % \pgfplotsscanlinelengthincrease
2927 % <process point>
2928 % \pgfplotsscanlinecomplete
2929 % \pgfplotsscanlinelengthincrease
2930 % <process point>
2931 % \pgfplotsscanlinelengthincrease
2932 % <process point>
2933 % \pgfplotsscanlinelengthincrease
2934 % <process point>
2935 % \pgfplotsscanlinecomplete
2936 %
2937 % \pgfplotsscanlinelengthcleanup
2938 %
2939 % In other words, the \pgfplotsscanlinelengthincrease routine is
2940 % invoked *before* the point is processed. That's important.
2941 %
2942 % Now, \pgfplotsscanlinelength expands to either
2943 % a) a negative number in which case there is no
2944 % unique scanline length.
2945 % More precisely, -1 means "there was no end-of-scanline marker"
2946 % -2 means "there where end-of-scanline markers, but the scanlines
2947 % had different lengths.
2948 % b) the scanline length.
2949 \def\pgfplotsscanlinelengthinitzero{%
2950 \def\pgfplotsscanlinelength{-1}%
2951 \pgfkeysgetvalue{/pgfplots/empty line}\pgfplots@loc@TMPa%
2952 \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
2953 \def\pgfplots@loc@TMPb{auto}%
2954 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
2955 \pgfplotsdetermineemptylinehandler
2956 \pgfkeysgetvalue{/pgfplots/empty line}\pgfplots@loc@TMPa%
2957 \fi
2958 \def\pgfplots@loc@TMPb{jump}%
2959 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
2960 \def\pgfplots@loc@TMPa{nan}% alias for jump
2961 \fi
2962 \def\pgfplots@loc@TMPb{no op}%
2963 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
2964 \def\pgfplots@loc@TMPa{none}% alias for no op
2965 \fi
2966 \pgfutil@ifundefined{pgfplotsscanlinelength@\pgfplots@loc@TMPa @initzero}{%
2967 \pgfplots@error{Sorry, the choice `empty line=\pgfkeysvalueof{/pgfplots/empty line}' is unknown. Maybe you misspelled it}%
2968 }{}%
2969 \expandafter\let\expandafter\pgfplotsscanlinelength@initzero \csname pgfplotsscanlinelength@\pgfplots@loc@TMPa @initzero\endcsname
2970 \expandafter\let\expandafter\pgfplotsscanlinelengthincrease \csname pgfplotsscanlinelength@\pgfplots@loc@TMPa @increase\endcsname
2971 \edef\pgfplotsscanlinecomplete{%
2972 \expandafter\noexpand\csname pgfplotsscanlinelength@\pgfplots@loc@TMPa @complete\endcsname
2973 }%
2974 \expandafter\let\expandafter\pgfplotsscanlinelengthcleanup \csname pgfplotsscanlinelength@\pgfplots@loc@TMPa @cleanup\endcsname
2975 \pgfplotsscanlinelength@initzero
2976 }%
2977
2978 \newif\ifpgfplots@emptyline@compat
2979
2980 % Invoked for 'empty line=auto'.
2981 %
2982 % @POSTCONDITION: '/pgfplots/empty line' is set to something useful
2983 % (not auto)
2984 \def\pgfplotsdetermineemptylinehandler{%
2985 \if n\pgfplots@meshmode
2986 % no mesh/surf plot:
2987 \pgfkeyssetvalue{/pgfplots/empty line}{jump}%
2988 \ifpgfplots@emptyline@compat
2989 \pgfkeyssetvalue{/pgfplots/empty line}{none}% do nothing for backwards compatibility with 2D processing.
2990 \fi
2991 \else
2992 % it is a mesh or surf plot; use scanline:
2993 \pgfkeyssetvalue{/pgfplots/empty line}{scanline}%
2994 \fi
2995 }%
2996 \def\pgfplotsscanlinedisablechanges{%
2997 \let\pgfplotsscanlinecomplete=\relax
2998 \let\pgfplotsscanlinelengthincrease=\relax
2999 \let\pgfplotsscanlinelengthcleanup=\relax
3000 \let\pgfplotsscanlinelengthinitzero=\relax
3001 \let\pgfplotsscanlineendofinput=\relax
3002 }%
3003
3004 % -------------------------------------------------------------------------------
3005 % empty line=scanline
3006 % class:
3007 \def\pgfplotsscanlinelength@scanline@initzero{%
3008 \c@pgfplots@scanlineindex=0 % the index _inside_ of the current scanline
3009 \def\pgfplotsscanlinecurrentlength{\the\c@pgfplots@scanlineindex}%
3010 \def\pgfplotsscanlineindex{0}% 0 is the first scanline, 1 the second, and so on
3011 \def\pgfplots@scanlinelength{-1}%
3012 }
3013 \def\pgfplotsscanlinelength@scanline@increase{%
3014 \advance\c@pgfplots@scanlineindex by1
3015 }
3016 \def\pgfplotsscanlinelength@scanline@complete{%
3017 \ifnum\pgfplots@scanlinelength>0
3018 \ifnum\c@pgfplots@scanlineindex=0
3019 %
3020 % \pgfplotsscanlinecomplete
3021 % \pgfplotsscanlinecomplete
3022 % \pgfplotsscanlinecomplete
3023 % should have the same effect as a single statement. Do
3024 % nothing here.
3025 \else
3026 \ifnum\pgfplots@scanlinelength=\c@pgfplots@scanlineindex\relax
3027 \else
3028 %\message{Found inconsistent scan line length: \pgfplots@scanlinelength\space vs. \the\c@pgfplots@scanlineindex\space near line \pgfplotstablelineno.}%
3029 % special marker which means 'inconsistent scan line length found'
3030 \def\pgfplots@scanlinelength{-2}%
3031 \fi
3032 \pgfplotsplothandlernotifyscanlinecomplete
3033 \fi
3034 \else
3035 \ifnum\pgfplots@scanlinelength=-2
3036 \else
3037 \edef\pgfplots@scanlinelength{\the\c@pgfplots@scanlineindex}%
3038 \fi
3039 %
3040 \ifnum\c@pgfplots@scanlineindex>0
3041 \pgfplotsplothandlernotifyscanlinecomplete
3042 \fi
3043 \fi
3044 \c@pgfplots@scanlineindex=0
3045 \pgfplotsutil@advancestringcounter\pgfplotsscanlineindex%
3046 }
3047 \def\pgfplotsscanlinelength@scanline@cleanup{%
3048 \ifnum\c@pgfplots@scanlineindex=0
3049 % I assume the last scan line is already complete.
3050 \else
3051 \pgfplotsscanlinecomplete
3052 \fi
3053 \let\pgfplotsscanlinelength=\pgfplots@scanlinelength
3054 }
3055 % -------------------------------------------------------------------------------
3056 %
3057 % empty line=none class:
3058 %
3059 \let\pgfplotsscanlinelength@none@initzero=\pgfutil@empty
3060 \let\pgfplotsscanlinelength@none@increase=\relax
3061 \let\pgfplotsscanlinelength@none@complete=\relax
3062 \let\pgfplotsscanlinelength@none@cleanup=\relax
3063 % -------------------------------------------------------------------------------
3064 %
3065 % empty line=nan class:
3066 \def\pgfplotsscanlinelength@nan@initzero{%
3067 \def\pgfplotsscanlinelength@nan@isfirst{1}%
3068 \let\pgfplotsscanlinelength@nan@pendingwork=\relax
3069 \pgfplotsifinplot{}{%
3070 \let\pgfplotsaxisserializedatapoint=\relax
3071 }%
3072 }%
3073 \def\pgfplotsscanlinelength@nan@increase{%
3074 \def\pgfplotsscanlinelength@nan@isfirst{0}%
3075 \pgfplotsscanlinelength@nan@pendingwork
3076 }%
3077 \def\pgfplotsscanlinelength@nan@complete{%
3078 \if1\pgfplotsscanlinelength@nan@isfirst
3079 \else
3080 \pgfplotsifinplot{%
3081 \let\pgfplotsscanlinelength@nan@pendingwork=\pgfplotsscanlinelength@nan@pendingwork@PREPARED
3082 }{%
3083 \let\pgfplotsscanlinelength@nan@pendingwork=\relax
3084 }%
3085 \fi
3086 \def\pgfplotsscanlinelength@nan@isfirst{1}%
3087 }%
3088 \let\pgfplotsscanlinelength@nan@cleanup=\relax
3089 \def\pgfplotsscanlinelength@nan@pendingwork@PREPARED{%
3090 \pgfplotsplothandlerappendjumpmarker
3091 %
3092 \let\pgfplotsscanlinelength@nan@pendingwork=\relax
3093 }%
3094
3095 \def\pgfplotsplothandlerappendjumpmarker{%
3096 \ifpgfplots@LUA@backend@supported
3097 \pgfplotsutil@directlua{pgfplots.texSurveyAddJump()}%
3098 \else
3099 % this will be executed when the next point has been
3100 % found.
3101 \def\pgfplots@current@point@x{}%
3102 \def\pgfplots@current@point@y{}%
3103 \def\pgfplots@current@point@z{}%
3104 % simply serialize an empty point. That works -- the
3105 % visualization phase checks if the coordinates are empty and
3106 % visualizes them as "jump"
3107 %
3108 % Note that \pgfplotsplothandlersurveypoint is not a good
3109 % choice here unless one employs its 'unbounded coords=jump'
3110 % feature
3111 \def\pgfplotsaxisplothasjumps{1}%
3112 \pgfplotsaxisserializedatapoint
3113 \fi
3114 }%
3115 %
3116 % -------------------------------------------------------------------------------
3117
3118
3119 \def\pgfplotsaxisfilteredcoordsaway{0}%
3120 \def\pgfplotsaxisplothasjumps{0}%
3121 \def\pgfplotsaxisplothasunboundedpointmeta{0}%
3122 \newif\ifpgfplotsaxisparsecoordinateok
3123
3124 % Possibly values:
3125 % N = none, is not in \addplot
3126 % S = survey
3127 % V = visualization
3128 \def\pgfplotsaxisplotphase{N}
3129
3130 \def\pgfplotsifinplot#1#2{%
3131 \if\pgfplotsaxisplotphase N%
3132 #2%
3133 \else
3134 #1%
3135 \fi
3136 }%
3137
3138 % Initialises
3139 % \pgfplots@coord@stream@start
3140 % \pgfplots@coord@stream@coord
3141 % \pgfplots@coord@stream@end
3142 % such that a following coordinate stream is processed properly. The
3143 % following coordinate stream may come from different input methods.
3144 %
3145 % This coordinate stream is the first time a coordinate will be
3146 % reported and processed by pgfplots. The task of this first pass is
3147 % to
3148 % - compute and update any axis limits,
3149 % - collect and prepare ranges for color data,
3150 % - handle stacked plots and error bars,
3151 % - store the complete state of the plot's preprocessing in an
3152 % internal datastructure for later completion.
3153 % This involves a serialization of all processed points (i.e. the
3154 % generation of a long coordinate list)
3155 %
3156 % Any \addplot command should issue \pgfplots@PREPARE@COORD@STREAM
3157 % eventually.
3158 %
3159 % Arguments:
3160 % #1: any trailing path commands after the 'plot' command as such,
3161 % for example \addplot plot coordinates {...} -- (0,0);
3162 % would yield #1 =' -- (0,0)'
3163 %
3164 % PRECONDITION:
3165 % - needs to be called inside of \addplot.
3166 % - \pgfplots@addplot@survey@@optionlist contains the <options>
3167 % provided to \addplot (all of them, including automatically
3168 % determined ones)
3169 %
3170 % REMARK:
3171 % The following code is permissible:
3172 % \pgfplots@PREPARE@COORD@STREAM{...}
3173 % \pgfplots@coord@stream@start
3174 % ...
3175 % \pgfplots@coord@stream@coord
3176 % ..
3177 % \pgfplots@coord@stream@coord
3178 % ..
3179 % \pgfplots@coord@stream@end
3180 % -> All need to be the SAME LEVEL OF SCOPING! The '@coord' commands
3181 % may not be scoped deeper than 'begin' and 'end'!
3182 % - I had a version which allowed that. it was actually slower!
3183 % - For now, the following things are global / local:
3184 % - point coordinate list: local
3185 % - meta data limits: global,
3186 % - what about stacked plot stuff: appears to be a combination
3187 % of local/global.
3188 % - all that will be serialized and written into
3189 % \pgfplots@stored@plotlist in \pgfplots@coord@stream@end.
3190 % This list is global, so, if I am not mistaken, the scoping
3191 % level of the complete stream operation from setup to @end can
3192 % be as deep as necessary - as long as all operations have the
3193 % same level of scoping.
3194 %
3195 % @see the detailed documentation in pgfplotsplothandlers.code.tex
3196 \long\def\pgfplots@PREPARE@COORD@STREAM#1{%
3197 \ifpgfplots@curplot@threedim
3198 \global\pgfplots@threedimtrue
3199 \fi
3200 \def\pgfplotsaxisfilteredcoordsaway{0}%
3201 \def\pgfplotsaxisplothasjumps{0}%
3202 \def\pgfplotsaxisplothasunboundedpointmeta{0}%
3203 %
3204 % FIXME : these macros should not be redefined! They are defined
3205 % in \pgfplots@prepare@axis@API right during \begin{axis}... they
3206 % probably shouldn't be changed.
3207 \ifpgfplots@curplot@threedim
3208 \let\pgfplotsaxisupdatelimitsforcoordinate=\pgfplotsaxisupdatelimitsforcoordinatethreedim
3209 \let\pgfplotsaxisparsecoordinate=\pgfplotsaxisparsecoordinatethreedim
3210 \else
3211 \let\pgfplotsaxisupdatelimitsforcoordinate=\pgfplotsaxisupdatelimitsforcoordinatetwodim
3212 \let\pgfplotsaxisparsecoordinate=\pgfplotsaxisparsecoordinatetwodim
3213 \fi
3214 \begingroup
3215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3216 \let\E=\noexpand
3217 %
3218 %\message{Assembled update-limits \ifpgfplots@curplot@threedim 3D\else 2D\fi macro to {\meaning\pgfplotsaxisupdatelimitsforcoordinate}}%
3219 \ifpgfplots@bb@isactive
3220 \else
3221 % we are inside of
3222 % \pgfplotsinterruptdatabb
3223 % ..
3224 % \endpgfinterruptboundingbox
3225 % -> don't change data limits!
3226 \gdef\pgfplotsaxisupdatelimitsforcoordinate##1##2##3{}%
3227 \fi
3228 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3229 %
3230 %
3231 % Takes a coordinate which is already parsed and applies steps
3232 % such that it becomes its final values.
3233 %
3234 % This implements the stacked plot feature currently.
3235 %
3236 % PRECONDITION:
3237 % \pgfplotsaxisparsecoordinate has already been called.
3238 %
3239 % POSTCONDITION:
3240 % the point has its final coordinates; the axis won't change it
3241 % anymore.
3242 \xdef\pgfplotsaxispreparecoordinate{%
3243 \E\ifpgfplotsaxisparsecoordinateok
3244 % All following routines (limit updating/stacking/error
3245 % bars) will use float numerics if necessary (controlled
3246 % by ifs).
3247 \E\pgfplotsaxistransformfromdatacs
3248 \ifpgfplots@stackedmode
3249 \E\pgfplots@stacked@preparepoint@inmacro%
3250 \fi
3251 \E\fi
3252 }%
3253 %
3254 % A macro which should be called once for every data point during the
3255 % survey phase.
3256 %
3257 % The caller is the plot handler's point survey routine.
3258 %
3259 % A data point might be a complicated thing which contains
3260 % multiple coordinates. You need to invoke
3261 % \pgfplotsaxisparsecoordinate and
3262 % \pgfplotsaxispreparecoordinate for each of them. But
3263 % \pgfplotsaxisdatapointsurveyed is invoked once for the complete
3264 % set.
3265 %
3266 % @PRECONDITION
3267 % - \pgfplots@current@point@[xyz] contain final coordinates
3268 % (i.e. output of \pgfplotsaxispreparecoordinate)
3269 %
3270 % @POSTCONDITION
3271 % - stacked plot things,
3272 % - error bars,
3273 % - xtick=data
3274 % are all processed.
3275 %
3276 \xdef\pgfplotsaxisdatapointsurveyed{%
3277 \E\ifpgfplotsaxisparsecoordinateok
3278 % All following routines (limit updating/stacking/error
3279 % bars) will use float numerics if necessary (controlled
3280 % by ifs).
3281 %
3282 % Prepare \pgfplots@current@point@meta (see the preparation
3283 % routine above):
3284 \E\pgfplotsaxissurveysetpointmeta
3285 %
3286 \ifpgfplots@errorbars@enabled
3287 \E\pgfplots@errorbars@survey@point
3288 \fi
3289 %
3290 \if1\b@has@pgfplots@colordinate@style
3291 \E\pgfplots@get@matching@coordinate@styles@surveyphase
3292 \fi
3293 %
3294 \ifpgfplots@collect@firstplot@astick
3295 \ifnum\pgfplots@numplots=0
3296 \E\ifx\E\pgfplots@firstplot@coords@x\E\pgfutil@empty
3297 \E\t@pgfplots@tokc={}%
3298 \E\else
3299 \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@x,}%
3300 \E\fi
3301 \E\xdef\E\pgfplots@firstplot@coords@x{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@x}%
3302 \E\ifx\E\pgfplots@firstplot@coords@y\E\pgfutil@empty
3303 \E\t@pgfplots@tokc={}%
3304 \E\else
3305 \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@y,}%
3306 \E\fi
3307 \E\xdef\E\pgfplots@firstplot@coords@y{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@y}%
3308 %
3309 \ifpgfplots@curplot@threedim
3310 \E\ifx\E\pgfplots@firstplot@coords@z\E\pgfutil@empty
3311 \E\t@pgfplots@tokc={}%
3312 \E\else
3313 \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@z,}%
3314 \E\fi
3315 \E\xdef\E\pgfplots@firstplot@coords@z{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@z}%
3316 \fi
3317 \fi
3318 \fi
3319 \E\pgfplotscoordstream@firstlast@update
3320 \E\pgfplotsaxisserializedatapoint
3321 \E\else
3322 % COORDINATE HAS BEEN FILTERED AWAY:
3323 %
3324 % make ALL empty to simplify special case checking:
3325 \E\let\E\pgfplots@current@point@x=\E\pgfutil@empty
3326 \E\let\E\pgfplots@current@point@y=\E\pgfutil@empty
3327 \E\let\E\pgfplots@current@point@z=\E\pgfutil@empty
3328 % check whether we have UNBOUNDED or just unfiltered
3329 % coords:
3330 \if\pgfplots@unbounded@handler d% unbounded coords=discard
3331 \E\def\E\pgfplotsaxisfilteredcoordsaway{1}%
3332 \ifpgfplots@warn@for@filter@discards
3333 \E\pgfplots@message{%
3334 NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered\ifpgfplots@curplot@threedim,\E\pgfplots@current@point@z@unfiltered\fi)
3335 has been dropped because
3336 \E\ifx\E\pgfplots@unbounded@dir\E\pgfutil@empty
3337 of a coordinate filter.
3338 \E\else
3339 it is unbounded (in \E\pgfplots@unbounded@dir).
3340 \E\fi
3341 (see also unbounded coords=jump).
3342 }%
3343 \fi
3344 \else
3345 % unbounded coords=jump
3346 \E\ifx\E\pgfplots@unbounded@dir\E\pgfutil@empty
3347 \E\def\E\pgfplotsaxisfilteredcoordsaway{1}%
3348 \ifpgfplots@warn@for@filter@discards
3349 \E\pgfplots@message{%
3350 NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered\ifpgfplots@curplot@threedim,\E\pgfplots@current@point@z@unfiltered\fi)
3351 has been dropped because of a coordinate filter.
3352 }%
3353 \fi
3354 \E\else
3355 \E\def\E\pgfplotsaxisplothasjumps{1}%
3356 \E\pgfplotsaxisserializedatapoint
3357 \E\fi
3358 \fi
3359 \E\fi
3360 %
3361 % increase \pgfplots@current@point@coordindex:
3362 \E\advance\E\c@pgfplots@coordindex by1
3363 }%
3364 %
3365 %
3366 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3367 \endgroup
3368 %
3369 \def\pgfplotsaxissurveysetpointmeta{%
3370 \pgfplotsplothandlersurveybeforesetpointmeta
3371 \pgfplots@set@perpointmeta
3372 \pgfplotsplothandlersurveyaftersetpointmeta
3373 }%
3374 %
3375 %\message{Prepared macro \string\pgfplots@update@limits@for@one@point: {\meaning\pgfplotsaxisupdatelimitsforcoordinate}}%
3376 %\message{Prepared macro \string\pgfplots@process@one@point: {\meaning\pgfplots@process@one@point}}%
3377 %
3378 \let\pgfplots@coord@stream@start@=\pgfplots@PREPARE@COORD@STREAM@start@
3379 \def\pgfplots@coord@stream@coord@{%
3380 \def\pgfplots@set@perpointmeta@done{0}%
3381 % NOTE: this might call LUA (if supported):
3382 \pgfplotsplothandlersurveypoint
3383 }%
3384 \def\pgfplots@coord@stream@end@{\pgfplots@PREPARE@COORD@STREAM@end@{#1}}%
3385 }%
3386
3387 % The \pgfplots@coord@stream@start@ routine used inside of
3388 % \pgfplots@PREPARE@COORD@STREAM.
3389 %
3390 % It prepares everything for the first pass through all input
3391 % coordinates.
3392 \def\pgfplots@PREPARE@COORD@STREAM@start@{%
3393 % The current implementation of pgfplots stores the preprocessed
3394 % coordinate stream into a long list of coordinates.
3395 % Since macro append is an expensive operation, it uses the highly
3396 % optimized 'applistXX' structure:
3397 \pgfplotsapplistXXnewempty
3398 %
3399 \edef\plotnumofactualtype{\numplotsofactualtype}%
3400 \csname pgfpmeta@\pgfplotspointmetainputhandler @activate\endcsname
3401 \pgfplots@LUA@survey@start
3402 \pgfplotsplothandlersurveystart
3403 \pgfplotscoordstream@firstlast@init
3404 %
3405 \pgfkeyssetvalue{/data point/x}{\pgfplots@current@point@x}%
3406 \pgfkeyssetvalue{/data point/y}{\pgfplots@current@point@y}%
3407 \pgfkeyssetvalue{/data point/z}{\pgfplots@current@point@z}%
3408 \pgfkeyssetvalue{/data point/meta}{\pgfplots@current@point@meta}%
3409 %
3410 \ifpgfplots@stackedmode
3411 \pgfplots@stacked@beginplot
3412 \fi
3413 \ifpgfplots@errorbars@enabled
3414 % prepare error bar processing.
3415 \pgfplots@errorbars@survey@begin
3416 \fi
3417 %
3418 %
3419 \pgfplots@prepare@visualization@dependencies
3420 %
3421 % Inside of math expressions, 'x', 'y' and 'z' expand to the
3422 % current x,y and z coords respectively. Introduce these (and some
3423 % more) shortcuts:
3424 % FIXME : defining the resulting x/y coordinates as 'x' and 'y' constants was a really really bad idea in the first place :-(
3425 \pgfplotsmathdeclarepseudoconstant{x}{\let\pgfmathresult=\pgfplots@current@point@x}%
3426 \pgfplotsmathdeclarepseudoconstant{y}{\let\pgfmathresult=\pgfplots@current@point@y}%
3427 \pgfplotsmathdeclarepseudoconstant{z}{\let\pgfmathresult=\pgfplots@current@point@z}%
3428 \pgfplotsmathdeclarepseudoconstant{rawx}{\let\pgfmathresult=\pgfplots@current@point@x@unfiltered}%
3429 \pgfplotsmathdeclarepseudoconstant{rawy}{\let\pgfmathresult=\pgfplots@current@point@y@unfiltered}%
3430 \pgfplotsmathdeclarepseudoconstant{rawz}{\let\pgfmathresult=\pgfplots@current@point@z@unfiltered}%
3431 \pgfplotsmathdeclarepseudoconstant{meta}{%
3432 \let\pgfmathresult=\pgfplots@current@point@meta
3433 \ifx\pgfmathresult\pgfutil@empty
3434 \pgfplotscoordmath{meta}{parsenumber}{0}%
3435 \fi
3436 }%
3437 \pgfmathredeclarefunction{thisrow}{%
3438 \getthisrow{##1}\pgfmathresult
3439 % XXX : this does NOT allow to return string values,
3440 % unfortunately! the fpu makes garbage out of it.
3441 % I already tried to parse it here and return special string
3442 % markers, but that approach requires much more effort...
3443 }%
3444 \pgfmathredeclarefunction{thisrowno}{%
3445 \getthisrowno{##1}\pgfmathresult
3446 }%
3447 %
3448 % %%%%%%%%%%%%%%
3449 %
3450 % Define \pgfplots@set@perpointmeta properly:
3451 \def\pgfplots@set@perpointmeta{%
3452 \if0\pgfplots@set@perpointmeta@done
3453 \csname pgfpmeta@\pgfplotspointmetainputhandler @assign\endcsname
3454 \def\pgfplots@set@perpointmeta@done{1}%
3455 \pgfplots@set@perpointmeta@limits
3456 \fi
3457 }%
3458 % append limit updating to \pgfplots@set@perpointmeta :
3459 \if0\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname
3460 % We need to work with per point meta data.
3461 % So, also compute the data range on a per-plot basis!
3462 % These limits are important later.
3463 \pgfkeysgetvalue{/pgfplots/point meta min}\pgfplots@metamin
3464 \t@pgfplots@tokb={}%
3465 \ifx\pgfplots@metamin\pgfutil@empty
3466 \global\let\pgfplots@metamin=\pgfplots@invalidrange@metamin
3467 \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb
3468 \pgfplotscoordmath{meta}{min}{\pgfplots@metamin}{\pgfplots@current@point@meta}%
3469 \global\let\pgfplots@metamin=\pgfmathresult
3470 }%
3471 \else
3472 \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@metamin}%
3473 \global\let\pgfplots@metamin=\pgfmathresult
3474 \fi
3475 \pgfkeysgetvalue{/pgfplots/point meta max}\pgfplots@metamax
3476 \ifx\pgfplots@metamax\pgfutil@empty
3477 \global\let\pgfplots@metamax=\pgfplots@invalidrange@metamax
3478 \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb
3479 \pgfplotscoordmath{meta}{max}{\pgfplots@metamax}{\pgfplots@current@point@meta}%
3480 \global\let\pgfplots@metamax=\pgfmathresult
3481 }%
3482 \else
3483 \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@metamax}%
3484 \global\let\pgfplots@metamax=\pgfmathresult
3485 \fi
3486 %
3487 \edef\pgfplots@set@perpointmeta@limits{%
3488 \noexpand\pgfplotsifpointmetaisbounded{\noexpand\pgfplots@current@point@meta}{%
3489 \the\t@pgfplots@tokb
3490 }{%
3491 \noexpand\def\noexpand\pgfplotsaxisplothasunboundedpointmeta{1}%
3492 }%
3493 }%
3494 \else
3495 % there is no point meta:
3496 \global\let\pgfplots@metamin=\pgfutil@empty
3497 \global\let\pgfplots@metamax=\pgfutil@empty
3498 \def\pgfplots@set@perpointmeta@limits{%
3499 \pgfplotsifpointmetaisbounded{\pgfplots@current@point@meta}{%
3500 }{%
3501 \def\pgfplotsaxisplothasunboundedpointmeta{1}%
3502 }%
3503 }%
3504 \fi
3505 }%
3506
3507 \def\pgfplots@define@dummies@for@pseudoconstants{%
3508 \pgfmathdeclarefunction{thisrow}{1}{%
3509 \pgfplots@error{You cannot use 'thisrow' in the current context.}%
3510 }%
3511 \pgfmathdeclarefunction{thisrowno}{1}{%
3512 \pgfplots@error{You cannot use 'thisrowno' in the current context.}%
3513 }%
3514 }%
3515 \def\pgfplotsaxisupdatelimitsforpointmeta#1{%
3516 \begingroup
3517 \def\pgfplots@current@point@meta{#1}%
3518 \pgfplots@set@perpointmeta@limits
3519 \endgroup
3520 }%
3521 % This is the \pgfplots@coord@stream@end@ routine which is invoked by
3522 % \pgfplots@PREPARE@COORD@STREAM.
3523 %
3524 % It finalizes the first pass through the input coordinates and
3525 % remembers the preprocessed \addplot command.
3526 %
3527 % Technical note: The parameters provided to
3528 % \pgfplots@PREPARE@COORD@STREAM
3529 % are needed here. This doesn't fit directly into the framework of
3530 % coordinate streams, see \pgfplots@PREPARE@COORD@STREAM how this
3531 % invocation works.
3532 %
3533 % #1,#2: see \pgfplots@PREPARE@COORD@STREAM
3534 \def\pgfplots@PREPARE@COORD@STREAM@end@#1{%
3535 \pgfkeysvalueof{/pgfplots/execute at end survey}%
3536 \ifpgfplots@LUA@backend@supported
3537 \pgfplots@LUA@survey@end
3538 \fi
3539 % FIXME : move this the \pgfplotsplothandlersurveyend of mesh plot
3540 % handler:
3541 \pgfkeyssetvalue{/pgfplots/mesh/num points}{\pgfplots@current@point@coordindex}%
3542 %
3543 \pgfplotsplothandlersurveyend
3544 \ifx\pgfplots@metamin\pgfutil@empty
3545 \else
3546 \if\pgfplots@axiswide@metamin@autocompute1%
3547 \pgfplotscoordmath{meta}{min}{\pgfplots@axiswide@metamin}{\pgfplots@metamin}%
3548 \global\let\pgfplots@axiswide@metamin=\pgfmathresult
3549 \fi
3550 \if\pgfplots@axiswide@metamax@autocompute1%
3551 \pgfplotscoordmath{meta}{max}{\pgfplots@axiswide@metamax}{\pgfplots@metamax}%
3552 \global\let\pgfplots@axiswide@metamax=\pgfmathresult
3553 \fi
3554 \fi
3555 \if1\pgfplots@colorbar@set@src% this 0|1 switch is set in \pgfplots@start@plot@with@behavioroptions
3556 \ifx\pgfplots@metamin\pgfutil@empty
3557 \pgfplotsthrow{no such element}{\pgfplots@loc@TMPa}{Sorry, `colorbar source' can't be processed: the current \string\addplot\space command doesn't have point meta. Ignoring it.}\pgfeov%
3558 \else
3559 \global\let\pgfplots@colorbar@src@metamin=\pgfplots@metamin
3560 \global\let\pgfplots@colorbar@src@metamax=\pgfplots@metamax
3561 \fi
3562 \fi
3563 \ifpgfplots@autocompute@all@limits
3564 \global\let\pgfplots@data@xmin=\pgfplots@xmin
3565 \global\let\pgfplots@data@xmax=\pgfplots@xmax
3566 \global\let\pgfplots@data@ymin=\pgfplots@ymin
3567 \global\let\pgfplots@data@ymax=\pgfplots@ymax
3568 \global\let\pgfplots@data@zmin=\pgfplots@zmin
3569 \global\let\pgfplots@data@zmax=\pgfplots@zmax
3570 \fi
3571 \ifpgfplots@errorbars@enabled
3572 \pgfplots@errorbars@survey@end
3573 \fi
3574 \ifpgfplots@stackedmode
3575 \pgfplots@stacked@survey@endplot
3576 \fi
3577 \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty
3578 \pgfplotswarning{plot without coordinates}\pgfeov%
3579 \else
3580 % Idea: use
3581 % \scope[plot specification]
3582 % <any paths for error bars>
3583 % \endscope
3584 % \draw plot coordinates {...};
3585 % to share plot specifications between error bars and plot
3586 % coordinates. Unfortunately, it is NOT sufficient to use
3587 % \tikzset
3588 %
3589 %% FIXME : why is this here and not in the mesh plot handler!?
3590 \pgfplotspreparemeshkeydefaults%
3591 \pgfplots@PREPARE@COORD@STREAM@end@determinecoordsorting x%
3592 \pgfplots@PREPARE@COORD@STREAM@end@determinecoordsorting y%
3593 %
3594 \pgfplots@remember@survey@option@list
3595 %
3596 % warning: rememberplotspec calls list macros which
3597 % overwrite \t@pgfplots@toka
3598 \t@pgfplots@toka=\expandafter{\pgfplots@addplot@survey@@optionlist}%
3599 % ATTENTION: do NOT call list macros from here on!
3600 %
3601 \pgfplotsplothandlerserializestateto\pgfplots@loc@TMPa
3602 \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}%
3603 %
3604 \pgfplots@markers@survey@set@visphasename
3605 \let\pgfplots@markers@visphase@name=\pgfplotsretval
3606 %
3607 \pgfplotssurveyphase@set@visphase@names{#1}%
3608 \let\pgfplots@visphase@names=\pgfplotsretval
3609 %
3610 \t@pgfplots@tokc={#1}%
3611 %
3612 % SERIALIZE RESULT:
3613 %
3614 % everything which has been accumulated so far (including the
3615 % preprocessed coordinates) will be serialized into the
3616 % structure \pgfplots@stored@plotlist (globally).
3617 %
3618 % assemble a \pgfplots@addplot@enqueue@coords command ...
3619 % BEGIN HERE ...
3620 % vvvvvvvvvv
3621 \xdef\pgfplots@glob@TMPa{%
3622 \noexpand\pgfplots@addplot@enqueue@coords
3623 {% precommand(s):
3624 \expandafter\noexpand\csname pgfplots@curplot@threedim\ifpgfplots@curplot@threedim true\else false\fi\endcsname
3625 %
3626 % Did we prepare the data within LUA? remember that!
3627 \ifpgfplots@LUA@backend@supported
3628 \noexpand\pgfplots@LUA@backend@supportedtrue
3629 \pgfplots@LUA@backend@serialized@commands
3630 \else
3631 \noexpand\pgfplots@LUA@backend@supportedfalse
3632 \fi
3633 \noexpand\def\noexpand\plotnum{\plotnum}%
3634 %
3635 % store \plotnumofactualtype
3636 \noexpand\def\noexpand\plotnumofactualtype{\plotnumofactualtype}%
3637 % ... and make sure that it
3638 % remains the same type even if some plot handler uses
3639 % other plot handlers internally:
3640 \noexpand\def\noexpand\pgfplotsplothandlername@actual{\pgfplotsplothandlername@actual}%
3641 \noexpand\let\noexpand\numplotsofactualtype\noexpand\pgfplots@numplotsofactualtype@duringplot
3642 %
3643 \noexpand\def\noexpand\numcoords{\pgfplots@current@point@coordindex}%
3644 % \pgfplots@current@point@coordindex will always contain the current index.
3645 % Maybe overwritten if not provided using \c@pgfplots@coordindex.
3646 \noexpand\def\noexpand\pgfplots@current@point@coordindex{\noexpand\the\noexpand\c@pgfplots@coordindex}%
3647 \noexpand\def\noexpand\coordindex{\noexpand\pgfplots@current@point@coordindex}% valid inside of \addplot
3648 %
3649 \ifpgfplots@stackedmode
3650 \pgfplots@stacked@serialized@commands
3651 \fi
3652 %
3653 % save the possibly prepare/adjusted plot
3654 % variables [FIXME: move after \pgfplots@define@currentplotstyle@as ?]:
3655 \noexpand\pgfkeyssetvalue{/pgfplots/samples}{\pgfplots@plot@samples}%
3656 \noexpand\pgfkeyssetvalue{/pgfplots/domain}{\pgfplots@plot@domain}%
3657 \noexpand\pgfkeyssetvalue{/pgfplots/samples at}{\pgfplots@plot@samples@at}%
3658 \noexpand\pgfkeyssetvalue{/pgfplots/mesh/rows}{\pgfkeysvalueof{/pgfplots/mesh/rows}}%
3659 \noexpand\pgfkeyssetvalue{/pgfplots/mesh/cols}{\pgfkeysvalueof{/pgfplots/mesh/cols}}%
3660 \noexpand\pgfkeyssetvalue{/pgfplots/mesh/num points}{\pgfkeysvalueof{/pgfplots/mesh/num points}}%
3661 % either '+' or '-' :
3662 \noexpand\pgfkeyssetvalue{/pgfplots/x coord sorting}{\pgfkeysvalueof{/pgfplots/x coord sorting}}%
3663 \noexpand\pgfkeyssetvalue{/pgfplots/y coord sorting}{\pgfkeysvalueof{/pgfplots/y coord sorting}}%
3664 %
3665 % remember 'current plot style':
3666 \noexpand\pgfplots@define@currentplotstyle@as{%
3667 \the\t@pgfplots@toka
3668 }%
3669 % per-point meta data ranges which apply only to
3670 % this plot:
3671 \noexpand\xdef\noexpand\pgfplots@metamin{\pgfplots@metamin}%
3672 \noexpand\xdef\noexpand\pgfplots@metamax{\pgfplots@metamax}%
3673 \noexpand\def\noexpand\pgfplotspointmetainputhandler{\pgfplotspointmetainputhandler}%
3674 \noexpand\def\noexpand\pgfplots@serialized@state@plothandler{\the\t@pgfplots@tokb}%
3675 \noexpand\def\noexpand\pgfplots@markers@visphase@name{\pgfplots@markers@visphase@name}%
3676 \noexpand\def\noexpand\pgfplots@visphase@names{\pgfplots@visphase@names}%
3677 \noexpand\def\noexpand\pgfplotsaxisfilteredcoordsaway{\pgfplotsaxisfilteredcoordsaway}%
3678 \noexpand\def\noexpand\pgfplotsaxisplothasjumps{\pgfplotsaxisplothasjumps}%
3679 \noexpand\def\noexpand\pgfplotsaxisplothasunboundedpointmeta{\pgfplotsaxisplothasunboundedpointmeta}%
3680 \noexpand\pgfkeyssetvalue{/pgfplots/on layer}{\pgfkeysvalueof{/pgfplots/on layer}}%
3681 \noexpand\def\noexpand\pgfplots@serialized@afterpath{\the\t@pgfplots@tokc}%
3682 \noexpand\def\noexpand\pgfplots@addplot@point@meta@description@of@explicit@value{\pgfplots@addplot@point@meta@description@of@explicit@value}%
3683 }%
3684 {% draw command:
3685 \noexpand\path%
3686 }%
3687 }%
3688 \pgfplotsapplistXXlet\pgfplots@coord@stream@recorded
3689 \pgfplotsapplistXXclear
3690 \t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}%
3691 \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}%
3692 \xdef\pgfplots@glob@TMPa{%
3693 \the\t@pgfplots@toka
3694 {% coordinates which need to be processed in \endaxis.
3695 % See
3696 % \pgfplots@coord@stream@finalize@storedcoords@START
3697 % (will become available as \pgfplots@stored@current@data)
3698 \the\t@pgfplots@tokc
3699 }%
3700 }%
3701 %
3702 \pgfplots@glob@TMPa
3703 {%
3704 % Post commands are empty here.
3705 }%
3706 %^^^^^^^^^^^^ ... END of \pgfplots@addplot@enqueue@coords HERE
3707 \fi
3708 \pgfplots@end@plot
3709 }%
3710
3711 \def\pgfplots@remember@survey@option@list{%
3712 \t@pgfplots@tokc=\expandafter{\pgfplots@addplot@survey@@optionlist,%
3713 /pgfplots/.cd,/pgfplots/every axis plot post}%
3714 \edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc}%
3715 \edef\pgfplots@loc@TMPa{/pgfplots/every axis plot except legend/.code=,\the\t@pgfplots@tokc}%
3716 \ifpgfplots@curplot@isirrelevant
3717 % for \label commands:
3718 \expandafter\pgfplots@rememberplotspec@for@label\expandafter{\pgfplots@addplot@survey@@optionlist}%
3719 \else
3720 \expandafter\pgfplots@rememberplotspec\expandafter{\pgfplots@loc@TMPa}%
3721 \fi
3722 }%
3723
3724 \def\pgfplots@LUA@survey@log@deactivation#1{%
3725 \pgfplots@log{\pgfplots@LUA@loglevel@info}{Using 'lua backend=false' for plot \the\pgfplots@numplots\space (type '\pgfplotsplothandlername'): #1.}%
3726 \pgfplots@LUA@backend@failed
3727 }%
3728
3729 \def\pgfplots@LUA@survey@get@filter#1{%
3730 \begingroup
3731 \pgfkeysgetvalue{/pgfplots/#1 filter/.@cmd}\pgfplots@loc@TMPc
3732 \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key
3733 \let\pgfplotsretval=\pgfutil@empty
3734 \else
3735 \pgfplots@ifisfilterexpression{#1 filter}{%
3736 \pgfkeysgetvalue{/pgfplots/#1 filter/@expressionvalue}\pgfplotsretval
3737 \expandafter\pgfplotsutilifcontainsmacro\expandafter{\pgfplotsretval}{%
3738 \aftergroup\pgfplots@LUA@backend@supportedfalse
3739 \pgfplots@command@to@string\pgfplotsretval\pgfplots@loc@TMPa
3740 \pgfplots@LUA@survey@log@deactivation{#1 filter/.expression='\pgfplots@loc@TMPa' contains a TeX macro}%
3741 \let\pgfplotsretval=\pgfutil@empty
3742 }{%
3743 }%
3744 }{%
3745 \aftergroup\pgfplots@LUA@backend@supportedfalse
3746 \pgfplots@LUA@survey@log@deactivation{LUA does not support #1 filter (yet)}%
3747 \let\pgfplotsretval=\pgfutil@empty
3748 }%
3749 \fi
3750 \pgfmath@smuggleone\pgfplotsretval
3751 \endgroup
3752 }%
3753
3754 \def\pgfplots@LUA@survey@start{%
3755 \ifpgfplots@LUA@backend@supported
3756 \ifx\pgfplotsplothandlerLUAfactory\pgfutil@empty
3757 \pgfplots@LUA@survey@log@deactivation{plot handler does not support LUA}%
3758 \pgfplots@LUA@backend@supportedfalse
3759 \fi
3760 %
3761 \ifx\pgfplotspointmetainputhandler\pgfutil@empty
3762 \def\pgfplots@loc@TMPa{nil}%
3763 \else
3764 \edef\pgfplots@loc@TMPa{%
3765 \csname pgfpmeta@\pgfplotspointmetainputhandler @LUA class\endcsname}%
3766 \ifx\pgfplots@loc@TMPa\pgfutil@empty
3767 \pgfplots@LUA@survey@log@deactivation{point meta choice does not support LUA}%
3768 \pgfplots@LUA@backend@supportedfalse
3769 \fi
3770 \fi
3771 \ifpgfplots@stackedmode
3772 \pgfplots@LUA@survey@log@deactivation{LUA does not support stacked plots (yet)}%
3773 \pgfplots@LUA@backend@supportedfalse
3774 \fi
3775 \ifpgfplots@errorbars@enabled
3776 \pgfplots@LUA@survey@log@deactivation{LUA does not support error bars (yet)}%
3777 \pgfplots@LUA@backend@supportedfalse
3778 \fi
3779 \ifpgfplots@collect@firstplot@astick
3780 \pgfplots@LUA@survey@log@deactivation{LUA does not support xtick=data (yet)}%
3781 \pgfplots@LUA@backend@supportedfalse
3782 \fi
3783 \pgfkeysgetvalue{/pgfplots/pre filter/.@cmd}\pgfplots@loc@TMPc\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@survey@log@deactivation{LUA does not support filter (yet)}\fi
3784 \pgfplots@LUA@survey@get@filter x%
3785 \let\pgfplots@loc@filter@x=\pgfplotsretval
3786 \pgfplots@LUA@survey@get@filter y%
3787 \let\pgfplots@loc@filter@y=\pgfplotsretval
3788 \pgfplots@LUA@survey@get@filter z%
3789 \let\pgfplots@loc@filter@z=\pgfplotsretval
3790 \pgfkeysgetvalue{/pgfplots/filter point/.@cmd}\pgfplots@loc@TMPc\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@survey@log@deactivation{LUA does not support filter (yet)}\fi
3791 %
3792 \pgfkeysgetvalue{/pgfplots/execute for finished point}\pgfplots@loc@TMPc\ifx\pgfplots@loc@TMPc\pgfutil@empty\else \pgfplots@LUA@backend@supportedfalse\fi
3793 %
3794 \pgfkeysgetvalue{/pgfplots/visualization depends on/list}\pgfplots@loc@TMPc \ifx\pgfplots@loc@TMPc\pgfutil@empty\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@survey@log@deactivation{LUA does not support 'visualization depends on' (yet)} \fi
3795 %
3796 %
3797 \edef\pgfplots@loc@TMPc{\pgfkeysvalueof{/pgfplots/data cs}}%
3798 \edef\pgfplots@loc@TMPd{\pgfkeysvalueof{/pgfplots/@expected axis cs}}%
3799 \ifx\pgfplots@loc@TMPc\pgfplots@loc@TMPd\else\pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@survey@log@deactivation{LUA does not support 'data cs' (yet)}\fi
3800 %
3801 % hm. There are various cases which are supported during a
3802 % SURVEY -- but not during a visualization. Check that here:
3803 \if m\pgfplots@colormap@access
3804 \else
3805 \if c\pgfplots@colormap@access
3806 \else
3807 \pgfplots@LUA@survey@log@deactivation{color map access=direct not supported (yet)}%
3808 \pgfplots@LUA@backend@supportedfalse
3809 \fi
3810 \fi
3811 \pgfplotscolormapifisuniform{\pgfkeysvalueof{/pgfplots/colormap name}}{%
3812 }{%
3813 % FIXME : implement LUA for non-uniform colormaps
3814 \pgfplots@LUA@survey@log@deactivation{non-uniform color maps unsupported currently}%
3815 \pgfplots@LUA@backend@supportedfalse
3816 }%
3817 %
3818 \ifpgfplots@curplot@threedim
3819 \else
3820 \ifpgfplots@threedim
3821 \pgfplots@LUA@survey@log@deactivation{2d plots in 3d axis currently unsupported}%
3822 \pgfplots@LUA@backend@supportedfalse
3823 \fi
3824 \fi
3825 %
3826 \if1\b@has@pgfplots@colordinate@style
3827 \pgfplots@LUA@survey@log@deactivation{coordinate style currently unsupported}%
3828 \pgfplots@LUA@backend@supportedfalse
3829 \fi
3830 %
3831 \ifpgfplots@LUA@backend@supported
3832 \edef\pgfplots@LUA@backend@plotnum{\pgfutil@directlua{tex.sprint(\pgfplotsHASH pgfplots.gca.plothandlers)}}%
3833 \begingroup
3834 \pgfkeysgetvalue{/pgfplots/point meta min}\pgfplots@loc@metamin
3835 \pgfkeysgetvalue{/pgfplots/point meta max}\pgfplots@loc@metamax
3836 \pgfplots@log{\pgfplots@LUA@loglevel@debug}{lua backend=true: Activating LUA backend for plot \the\pgfplots@numplots\space (lua \pgfplots@LUA@backend@plotnum, type '\pgfplotsplothandlername').}%
3837 \edef\pgfplots@loc@TMPa{%
3838 local gca = pgfplots.gca;^^J%
3839 gca.min = {^^J%
3840 pgfplots.pgftonumber("\pgfplots@xmin"), ^^J%
3841 pgfplots.pgftonumber("\pgfplots@ymin"), ^^J%
3842 pgfplots.pgftonumber("\pgfplots@zmin")}; ^^J%
3843 gca.max = {^^J%
3844 pgfplots.pgftonumber("\pgfplots@xmax"), ^^J%
3845 pgfplots.pgftonumber("\pgfplots@ymax"), ^^J%
3846 pgfplots.pgftonumber("\pgfplots@zmax")}; ^^J%
3847 % FIXME : what about datamin/datamax!?
3848 local plothandlerFactory = \pgfplotsplothandlerLUAfactory; ^^J%
3849 local plothandler = plothandlerFactory(gca, \pgfplots@loc@TMPa);^^J% second arg: point meta handler
3850 \ifx\pgfplots@loc@metamin\pgfutil@empty
3851 \else
3852 plothandler.autocomputeMetaMin = false;^^J%
3853 plothandler.metamin = pgfplots.pgftonumber("\pgfplots@loc@metamin");^^J%
3854 \fi
3855 \ifx\pgfplots@loc@metamax\pgfutil@empty
3856 \else
3857 plothandler.autocomputeMetaMax = false;^^J%
3858 plothandler.metamax = pgfplots.pgftonumber("\pgfplots@loc@metamax");^^J%
3859 \fi
3860 local config = plothandler.config;^^J%
3861 config.unboundedCoords = "\pgfplots@unbounded@handler";^^J%
3862 config.warnForfilterDiscards = \pgfplots@boolval{pgfplots@warn@for@filter@discards};^^J%
3863 config.pointmetarel = \pgfplots@perpointmeta@rel@choice;^^J%
3864 config.updateLimits = \ifpgfplots@bb@isactive true\else false\fi;^^J%
3865 config.filterExpressionByDir = {^^J%
3866 "\pgfplots@loc@filter@x",^^J%
3867 "\pgfplots@loc@filter@y",^^J%
3868 "\pgfplots@loc@filter@z"};^^J%
3869 gca.plothandlers[\pgfplots@LUA@backend@plotnum+1]= plothandler;^^J%
3870 gca.currentPlotHandler = plothandler;^^J%
3871 plothandler:surveystart();^^J%
3872 }%
3873 %\message{Executing ^^J\pgfplots@loc@TMPa^^J^^J}%
3874 \pgfplotsutil@directlua{\pgfplots@loc@TMPa}%
3875 \endgroup
3876 \def\pgfplots@LUA@backend@serialized@commands{%
3877 \noexpand\def\noexpand\pgfplots@LUA@backend@plotnum{\pgfplots@LUA@backend@plotnum}%
3878 }%
3879 \def\pgfplotsapplistXXpushback##1{%
3880 \pgfplots@error{Illegal internal state encountered: lua backend should have been invoked at this point}%
3881 }%
3882 \fi
3883 \fi
3884 }%
3885
3886 \let\pgfplotsapplistXXpushback@orig=\pgfplotsapplistXXpushback
3887
3888 \def\pgfplots@LUA@survey@point{%
3889 \edef\pgfplots@loc@TMPa{pgfplots.texSurveyPoint("\pgfplots@current@point@x","\pgfplots@current@point@y","\pgfplots@current@point@z","\pgfplots@current@point@meta")}%
3890 \pgfplotsutil@directlua{\pgfplots@loc@TMPa}%
3891 % increase \pgfplots@current@point@coordindex:
3892 \advance\c@pgfplots@coordindex by1
3893 }%
3894
3895 \def\pgfplots@LUA@survey@end{%
3896 % LUA defines a couple of TeX macros here...
3897 \pgfplotsutil@directlua{pgfplots.texSurveyEnd()}%
3898 %
3899 \let\pgfplotsapplistXXpushback=\pgfplotsapplistXXpushback@orig
3900 \pgfplotsapplistXXpushback{--- acquire from LUA! --}%
3901 }%
3902
3903 % this appears to be necessary for the mesh legend...
3904 \def\b@pgfplots@LUA@visualization@enabled{0}%
3905
3906 % PRECONDITION : \pgfplots@LUA@visualization@init has already been
3907 % executed.
3908 \def\pgfplots@LUA@visualization@of@current@plot{%
3909 \def\b@pgfplots@LUA@visualization@enabled{0}%
3910 \ifpgfplots@LUA@backend@supported
3911 \pgfkeysgetvalue{/pgfplots/axis type}\pgfplots@loc@TMPa
3912 \def\pgfplots@loc@TMPb{rectangle}%
3913 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
3914 \else
3915 % disable visualizer - we cannot do this right now.
3916 \pgfplots@LUA@backend@failed
3917 \let\pgfplotsplothandlerLUAvisualizerfactory=\pgfutil@empty
3918 \fi
3919 %
3920 \ifx\pgfplotsplothandlerLUAvisualizerfactory\pgfutil@empty
3921 % hm. This plot cannot be visualized in LUA - BUT it has a
3922 % LUA survey! Ok, then: acquire the survey results.
3923 % Otherwise we would have nothing here.
3924 % FIXME : what about \pgfplots@LUA@backend@failed in this context!?
3925 \pgfplots@log{\pgfplots@LUA@loglevel@info}{Using 'lua backend=false' for visualization of plot \the\pgfplots@numplots\space (type '\pgfplotsplothandlername'): it has no LUA visualizer.}%
3926 % NOTE:
3927 % I use two levels of \expandafter here because 'lua debug =trace'
3928 % introduces another level of expansion. And I do not
3929 % want to use \edef... silly, perhaps..?
3930 \expandafter\expandafter\expandafter\def
3931 \expandafter\expandafter\expandafter\pgfplots@stored@current@data
3932 \expandafter\expandafter\expandafter{%
3933 \pgfplotsutil@directlua{pgfplots.texGetSurveyedCoordsToPgfplots()}%
3934 }%
3935 \else
3936 % visualize using LUA! ... and acquire the coordinates.
3937 % NOTE:
3938 % I use two levels of \expandafter here because 'lua debug =trace'
3939 % introduces another level of expansion. And I do not
3940 % want to use \edef... silly, perhaps..?
3941 \expandafter\expandafter\expandafter\def
3942 \expandafter\expandafter\expandafter\pgfplots@stored@current@data
3943 \expandafter\expandafter\expandafter{%
3944 \pgfplotsutil@directlua{pgfplots.texVisualizePlot(\pgfplotsplothandlerLUAvisualizerfactory)}%
3945 }%
3946 %\message{plot \plotnum: LUA backend returned \meaning\pgfplots@stored@current@data^^J}%
3947 %
3948 % ... and ensure that the resulting
3949 % \pgfplots@stored@current@data can be deserialized. It
3950 % contains the fully mapped X/Y coordinates as first item.
3951 \let\pgfplotsaxisdeserializedatapointfrom@private@nonLUA=\pgfplotsaxisdeserializedatapointfrom@private
3952 \def\pgfplotsaxisdeserializedatapointfrom@private##1{%
3953 \pgfplotsaxisdeserializedatapointfrom@private@LUA##1%
3954 }%
3955 \def\pgfplotsaxisdeserializedatapointfrom@private@LUA##1##2##3{%
3956 \global\pgf@x=##1pt %
3957 \global\pgf@y=##2pt %
3958 \pgfplotsaxisdeserializedatapointfrom@private@nonLUA{##3}%
3959 }%
3960 % FIXME : do I need to adopt the serializer as well!?
3961 %
3962 \def\b@pgfplots@LUA@visualization@enabled{1}%
3963 \fi
3964 \fi
3965 }%
3966
3967 % Defines \pgfplotsretval to contain a comma-separated-list of
3968 % visualization phase names. May be empty.
3969 %
3970 % These names will be stored as \pgfplots@visphase@names during the
3971 % visualization phase.
3972 %
3973 % The role of "visualization phases" is to call the plot
3974 % handler, and perhaps further visualization phases.
3975 %
3976 % This is entirely *independent* of plot marks which have their own,
3977 % very special visualization phase.
3978 %
3979 % It is allowed if a plot has an empty list of visualization phases
3980 % (common for 'only marks').
3981 %
3982 % #1: any tikz path instructions after the \addplot command but before
3983 % the semicolon.
3984 \def\pgfplotssurveyphase@set@visphase@names#1{%
3985 % 1. check if we need the 'default' visualization phase:
3986 \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler
3987 \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard
3988 % Ah - "only marks". In this case, we rely on the (special)
3989 % marker visualization phase - there is no need for a further
3990 % phase.
3991 \pgfplotsutil@trim{#1}%
3992 \ifx\pgfplotsretval\pgfutil@empty
3993 % OK, we do not have after-path instructions.
3994 % No need for this phase.
3995 \let\pgfplotsretval=\pgfutil@empty
3996 \else
3997 % Hm. We found after-path instructions! These *need* to be
3998 % done during the standard visualization phase. Ok, then
3999 % do it, even if it has no uses otherwise!
4000 \let\pgfplotsretval=\pgfplotsaxis@visphase@name@default
4001 \fi
4002 \else
4003 \let\pgfplotsretval=\pgfplotsaxis@visphase@name@default
4004 \fi
4005 %
4006 % 2. error bar phase:
4007 \ifpgfplots@errorbars@enabled
4008 \ifx\pgfplotsretval\pgfutil@empty
4009 \else
4010 \edef\pgfplotsretval{\pgfplotsretval,}%
4011 \fi
4012 %
4013 \edef\pgfplotsretval{\pgfplotsretval \pgfplotsaxis@visphase@name@errorbars}%
4014 \fi
4015 %
4016 % markers have the special phase \pgfplots@markers@visphase@name .
4017 }%
4018
4019 \def\pgfplotsaxis@visphase@name@default{default}
4020 \def\pgfplotsaxis@visphase@name@markers{markers}
4021
4022 % This defines \pgfplots@visphase@default:
4023 \expandafter\def\csname pgfplots@visphase@\pgfplotsaxis@visphase@name@default\endcsname{%
4024 \pgfplots@coord@stream@finalize@storedcoords@START
4025 }%
4026
4027 % A routine which transforms the current set of
4028 % \pgfplots@current@point@[xyz] values to the coordinate system
4029 % accepted by the actual axis.
4030 \def\pgfplotsaxistransformfromdatacs{%
4031 \pgfkeyslet{/data point/x}\pgfplots@current@point@x
4032 \pgfkeyslet{/data point/y}\pgfplots@current@point@y
4033 \pgfkeyslet{/data point/z}\pgfplots@current@point@z
4034 \pgfplotsaxistransformcs
4035 {\pgfkeysvalueof{/pgfplots/data cs}}
4036 {\pgfkeysvalueof{/pgfplots/@expected axis cs}}%
4037 \pgfkeysgetvalue{/data point/x}\pgfplots@current@point@x
4038 \pgfkeysgetvalue{/data point/y}\pgfplots@current@point@y
4039 \pgfkeysgetvalue{/data point/z}\pgfplots@current@point@z
4040 }%
4041
4042 % Changes '/data point/[xyz]' to the new coordinate system
4043 % (cs) designated by '#2'.
4044 %
4045 % #1: the actual coordinate system's name
4046 % #2: the desired coordinate system's name
4047 %
4048 % PRECONDITION: '/data point/[xyz]' contain the current
4049 % point's coordinates in the '#1' system. The z coordinate is ignored for 2d plots (or
4050 % for coordinate systems which are inherently two-dimensional).
4051 %
4052 % POSTCONDITION: 'data point/[xyz]' contain same point as
4053 % before, but represented in the '#2' system.
4054 %
4055 % The coordinate system transformations must be defined,
4056 % see \pgfplotsdefinecstransform.
4057 %
4058 % Example:
4059 % \pgfkeyssetvalue{/data point/x}{90}
4060 % \pgfkeyssetvalue{/data point/y}{1}
4061 % \pgfplotsaxistransformcs{polar}{cart}
4062 % -->
4063 % \pgfkeysvalueof{/data point/x}= 0
4064 % \pgfkeysvalueof{/data point/y}= 1
4065 \def\pgfplotsaxistransformcs#1#2{%
4066 \edef\pgfplots@loc@TMPa{#1}%
4067 \edef\pgfplots@loc@TMPb{#2}%
4068 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
4069 % nothing to do
4070 \else
4071 \pgfutil@ifundefined{pgfp@transform@\pgfplots@loc@TMPa @to@\pgfplots@loc@TMPb}{%
4072 \pgfutil@ifundefined{pgfp@transform@\pgfplots@loc@TMPa @to@cart}{%
4073 \pgfplotsaxistransformcs@error
4074 }{%
4075 \pgfplotsaxistransformcs{#1}{cart}%
4076 \pgfplotsaxistransformcs{cart}{#2}%
4077 }%
4078 }{%
4079 \csname pgfp@transform@\pgfplots@loc@TMPa @to@\pgfplots@loc@TMPb\endcsname
4080 }%
4081 \fi
4082 }%
4083
4084 % Defines a new coordinate transformation for use in
4085 % \pgfplotsaxistransformcs.
4086 % #1: the source coordinate system
4087 % #2: the target coordinate system
4088 % #3: the transformation code.
4089 %
4090 % @see \pgfplotsaxistransformcs for what #3 should do.
4091 %
4092 % This does also declare a coordinate system for use in 'data cs'.
4093 % The minimal requirements are to define the transformations from and
4094 % to "cart" (cartesian coordinates).
4095 %
4096 \def\pgfplotsdefinecstransform#1#2#3{%
4097 \expandafter\def\csname pgfp@transform@#1@to@#2\endcsname{#3}%
4098 }%
4099
4100 \pgfplotsdefinecstransform{polar}{cart}{%
4101 \pgfplotscoordmath{default}{parsenumber}{\pgfkeysvalueof{/data point/x}}%
4102 \let\pgfplots@current@point@x=\pgfmathresult
4103 \pgfplotscoordmath{default}{parsenumber}{\pgfkeysvalueof{/data point/y}}%
4104 \let\pgfplots@current@point@y=\pgfmathresult
4105 \pgfplotsmathpoltocart\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@x@\pgfplots@current@point@y@
4106 \pgfplotscoordmath{x}{parsenumber}{\pgfplots@current@point@x@}%
4107 \pgfkeyslet{/data point/x}\pgfmathresult
4108 \pgfplotscoordmath{y}{parsenumber}{\pgfplots@current@point@y@}%
4109 \pgfkeyslet{/data point/y}\pgfmathresult
4110 }%
4111 \pgfplotsdefinecstransform{cart}{polar}{%
4112 \pgfplotscoordmath{default}{parsenumber}{\pgfkeysvalueof{/data point/x}}%
4113 \let\pgfplots@current@point@x=\pgfmathresult
4114 \pgfplotscoordmath{default}{parsenumber}{\pgfkeysvalueof{/data point/y}}%
4115 \let\pgfplots@current@point@y=\pgfmathresult
4116 \pgfplotsmathcarttopol\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@x@\pgfplots@current@point@y@
4117 \pgfplotscoordmath{x}{parsenumber}{\pgfplots@current@point@x@}%
4118 \pgfkeyslet{/data point/x}\pgfmathresult
4119 \pgfplotscoordmath{y}{parsenumber}{\pgfplots@current@point@y@}%
4120 \pgfkeyslet{/data point/y}\pgfmathresult
4121 }%
4122
4123 \pgfplotsdefinecstransform{polarrad}{polar}{%
4124 \pgfplotsgetcoordmathfor{default}\let\pgfplots@coordmath@id=\pgfplotsretval
4125 \pgfutil@ifundefined{pgfp@polarradscale@\pgfplots@coordmath@id}{%
4126 \pgfplotscoordmath{default}{parsenumber}{57.2957795130823}%
4127 \expandafter\global\expandafter\let\csname pgfp@polarradscale@\pgfplots@coordmath@id\endcsname=\pgfmathresult
4128 }{}%
4129 %
4130 \pgfplotscoordmath{default}{parsenumber}{\pgfkeysvalueof{/data point/x}}%
4131 \pgfplotscoordmath{default}{op}{multiply}{{\pgfmathresult}{\csname pgfp@polarradscale@\pgfplots@coordmath@id\endcsname}}%
4132 \pgfkeyslet{/data point/x}\pgfmathresult
4133 }%
4134 \pgfplotsdefinecstransform{polar}{polarrad}{%
4135 \pgfplotsgetcoordmathfor{default}\let\pgfplots@coordmath@id=\pgfplotsretval
4136 \pgfutil@ifundefined{pgfp@polarradiscale@\pgfplots@coordmath@id}{%
4137 \pgfplotscoordmath{default}{parsenumber}{0.0174532925199433}%
4138 \expandafter\global\expandafter\let\csname pgfp@polarradiscale@\pgfplots@coordmath@id\endcsname=\pgfmathresult
4139 }{}%
4140 %
4141 \pgfplotscoordmath{default}{parsenumber}{\pgfkeysvalueof{/data point/x}}%
4142 \pgfplotscoordmath{default}{op}{multiply}{{\pgfmathresult}{\csname pgfp@polarradiscale@\pgfplots@coordmath@id\endcsname}}%
4143 }%
4144 \pgfplotsdefinecstransform{polarrad}{cart}{%
4145 \pgfplotsaxistransformcs{polarrad}{polar}%
4146 \pgfplotsaxistransformcs{polar}{cart}%
4147 }%
4148 \pgfplotsdefinecstransform{cart}{polarrad}{%
4149 \pgfplotsaxistransformcs{cart}{polar}%
4150 \pgfplotsaxistransformcs{polar}{polarrad}%
4151 }%
4152
4153 \def\pgfplotsaxistransformcs@error{%
4154 \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, I do not know how to transform the coordinate system '\pgfplots@loc@TMPa' to '\pgfplots@loc@TMPb'. Maybe you misspelled the 'data cs'? Or perhaps the feature is not yet implemented?}\pgfeov%
4155 }%
4156
4157 % Takes the current point and serializes it into \pgfplotsretval.
4158 %
4159 % The serialization includes the coordinates (as returned by the
4160 % current plot handler), the point meta, and any "visualization
4161 % depends on" keys.
4162 %
4163 % See \pgfplotsaxisdeserializedatapointfrom
4164 %
4165 % POSTCONDITION:
4166 % \pgfplotsretval contains everything that is needed to restore the
4167 % current coordinate. This includes
4168 % - the coordinate values for x,y, and z
4169 % - any special coordinate values reported by the plot handler
4170 % (like u,v,w for quiver plots)
4171 % - the point meta
4172 % - any 'visualization depends on' value
4173 % - anything which is needed for other purposes (stacked plots have
4174 % a plugin).
4175 %
4176 % The result has an EXTRA SET OF BRACES which needs to be dealt with.
4177 %
4178 % Example:
4179 % \pgfplotsaxisserializedatapointtostring
4180 %
4181 % \expandafter\pgfplotsaxisdeserializedatapointfrom\pgfplotsretval
4182 %
4183 % -> note the absence of extra braces for the deserialization!
4184 \def\pgfplotsaxisserializedatapointtostring{%
4185 \pgfplotsplothandlerserializepointto\pgfplotsaxisserializedatapoint@val
4186 \let\pgfplots@oldprotect=\protect
4187 \let\protect=\noexpand
4188 \pgfplotsaxisserializedatapoint@private
4189 \let\protect=\pgfplots@oldprotect
4190 \t@pgfplots@toka=\expandafter{\pgfplotsaxisserializedatapoint@val}%
4191 \t@pgfplots@tokb=\expandafter{\pgfplotsretval}%
4192 \if1\b@has@pgfplots@colordinate@style
4193 \t@pgfplots@tokc\expandafter{\expandafter{\pgfplots@current@point@coordinatestyle}}%
4194 \else
4195 \t@pgfplots@tokc={}%
4196 \fi
4197 \edef\pgfplotsretval{{\the\t@pgfplots@tokb;\the\t@pgfplots@tokc\the\t@pgfplots@toka}}%
4198 }%
4199
4200 \def\pgfplotsaxisserializedatapoint{%
4201 \pgfplotsaxisserializedatapointtostring
4202 \expandafter\pgfplotsapplistXXpushback\expandafter{\pgfplotsretval}%
4203 }%
4204 \def\pgfplotsaxisserializedatapoint@private{%
4205 \let\pgfplotsretval=\pgfplots@current@point@meta
4206 }%
4207 \def\pgfplotsaxisdeserializedatapointfrom@private#1{%
4208 \def\pgfplots@current@point@meta{#1}%
4209 }%
4210 % Restores the variables serialized in '#1'.
4211 %
4212 % As a side--effect, the macro
4213 % \pgfplotsaxisdeserializedatapointfrom@private@lastvalue will contain
4214 % the serialized part which is specific to pgfplots (i.e. the private
4215 % parts which can be read with
4216 % \pgfplotsaxisdeserializedatapointfrom@private)
4217 \def\pgfplotsaxisdeserializedatapointfrom#1{%
4218 \if1\b@has@pgfplots@colordinate@style
4219 \expandafter\pgfplotsaxisdeserializedatapointfrom@@#1\pgfplots@EOI
4220 \else
4221 \expandafter\pgfplotsaxisdeserializedatapointfrom@#1\pgfplots@EOI
4222 \fi
4223 }%
4224 \def\pgfplotsaxisdeserializedatapointfrom@@#1;#2#3\pgfplots@EOI{%
4225 \pgfplotsaxisdeserializedatapointfrom@{#1};{#3}\pgfplots@EOI
4226 \def\pgfplots@current@point@coordinatestyle{#2}%
4227 }%
4228 \def\pgfplotsaxisdeserializedatapointfrom@#1;#2\pgfplots@EOI{%
4229 \def\pgfplotsaxisdeserializedatapointfrom@private@lastvalue{#1}%
4230 \pgfplotsaxisdeserializedatapointfrom@private{#1}%
4231 \pgfplotsplothandlerdeserializepointfrom{#2}%
4232 }%
4233
4234 % Handle User-defined parts which should be serialized as well.
4235 % This preparation tool should be called at the start of both, survey
4236 % and visualization phase.
4237 %
4238 % @PRECONDITION
4239 % - the macros
4240 % \pgfplotsaxisserializedatapoint@private
4241 % \pgfplotsaxisdeserializedatapointfrom@private
4242 % are known and valid.
4243 % - '/pgfplots/visualization depends on' contains its correct value.
4244 %
4245 % @POSTCONDITION
4246 % Both,
4247 % \pgfplotsaxisserializedatapoint@private
4248 % and
4249 % \pgfplotsaxisdeserializedatapointfrom@private
4250 % have been patched to incorporate the '/pgfplots/visualization
4251 % depends on' feature.
4252 %
4253 \def\pgfplots@prepare@visualization@dependencies{%
4254 \pgfkeysgetvalue{/pgfplots/visualization depends on/list}\pgfplots@loc@TMPa
4255 \ifx\pgfplots@loc@TMPa\pgfutil@empty
4256 \else
4257 % SERIALIZATION format:
4258 % visualization depends on={{value1}\as \macro1, {<value2>}\as \macro2,...}
4259 % ->
4260 % {<original private data>}<\macro1>{<value1>}<\macro2>{<value2>}...<\macroN>{<valueN>}
4261 %
4262 % prepare
4263 % \t@pgfplots@tokb={<\macro1>{<value1>}<\macro2>{<value2>}...<\macroN>{<valueN>}}
4264 \t@pgfplots@tokb={}%
4265 %
4266 % prepare
4267 % \t@pgfplots@tokc={<\macro1><\macro2><\macro3>...}
4268 \t@pgfplots@tokc={}%
4269 \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplots@loc@TMPa}\as\pgfplots@loc@TMPa{%
4270 \ifx\pgfplots@loc@TMPa\pgfutil@empty
4271 \else
4272 \expandafter\pgfplots@prepare@visualization@depends@on\pgfplots@loc@TMPa\pgfplots@EOI%
4273 \fi
4274 }%
4275 % Step 1: modify the SERIALIZATION method:
4276 \t@pgfplots@toka=\expandafter{\pgfplotsaxisserializedatapoint@private}%
4277 \edef\pgfplotsaxisserializedatapoint@private{%
4278 \the\t@pgfplots@tokc
4279 \the\t@pgfplots@toka
4280 % nothing is expanded here, only \t@pgfplots@tokb
4281 \noexpand\t@pgfplots@toka=\noexpand\expandafter{\noexpand\pgfplotsretval}%
4282 \noexpand\edef\noexpand\pgfplotsretval{{\noexpand\the\t@pgfplots@toka},\the\t@pgfplots@tokb}%
4283 }%
4284 % Step 2: modify the DESERIALIZATION method:
4285 \let\pgfplotsaxisdeserializedatapointfrom@private@orig=\pgfplotsaxisdeserializedatapointfrom@private
4286 \let\pgfplotsaxisdeserializedatapointfrom@private=\pgfplotsaxisdeserializedatapointfrom@private@withdeplist
4287 \fi
4288 %
4289 \pgfkeysgetvalue{/pgfplots/execute for finished point}\pgfplots@loc@TMPa
4290 \ifx\pgfplots@loc@TMPa\pgfutil@empty
4291 \else
4292 \expandafter\def\expandafter\pgfplotsaxisserializedatapoint@private\expandafter{%
4293 \pgfplotsaxisserializedatapoint@private
4294 \pgfkeysvalueof{/pgfplots/execute for finished point}%
4295 }%
4296 \fi
4297 }%
4298 \def\pgfplots@prepare@visualization@depends@on#1\pgfplots@EOI{%
4299 \pgfutil@in@\as{#1}%
4300 \ifpgfutil@in@
4301 % ok, we have the '<content>\as<\macro>' syntax:
4302 \pgfplots@prepare@visualization@depends@on@#1\pgfplots@EOI
4303 \else
4304 \pgfplots@prepare@visualization@depends@on@preparetype@checkvalue#1value\pgfplots@EOI
4305 \ifpgfutil@in@
4306 % ok, then it should be 'value <\macro>'.
4307 % extract the <\macro>:
4308 \def\pgfplots@loc@TMPa value{\pgfplots@loc@TMPb}%
4309 \def\pgfplots@loc@TMPb##1{\pgfplots@loc@TMPc ##1}% this step should remove leading white spaces
4310 \def\pgfplots@loc@TMPc##1\pgfplots@EOI{%
4311 % sanitize: check if ##1 is a defined macro:
4312 \begingroup
4313 \escapechar=-1
4314 \xdef\pgfplots@glob@TMPa{\string##1}%
4315 \endgroup
4316 \pgfutil@ifundefined{\pgfplots@glob@TMPa}{%
4317 \begingroup
4318 \t@pgfplots@toka={##1}%
4319 \pgfplotsthrow{invalid argument}
4320 {\pgfplots@loc@TMPa}%
4321 {Sorry, `visualization depends on=value <\string\macro>' expected a defined control sequence name instead of `\the\t@pgfplots@toka'. Please make sure `\the\t@pgfplots@toka' is a properly defined macro or use the `visualization depends on=value <content> \string\as <\string\macro>' syntax instead}%
4322 \pgfeov
4323 \endgroup
4324 }{%
4325 \def\pgfplots@loc@TMPa{%
4326 \pgfplots@prepare@visualization@depends@on@ value}%
4327 \expandafter\pgfplots@loc@TMPa##1\as##1\pgfplots@EOI
4328 }%
4329 }%
4330 \pgfplots@loc@TMPa#1\pgfplots@EOI
4331 \else
4332 % then, I expect '<\macro>'.
4333 % sanitize: check if #1 is a defined macro:
4334 \begingroup
4335 \escapechar=-1
4336 \xdef\pgfplots@glob@TMPa{\string#1}%
4337 \endgroup
4338 \pgfutil@ifundefined{\pgfplots@glob@TMPa}{%
4339 \begingroup
4340 \t@pgfplots@toka={#1}%
4341 \pgfplotsthrow{invalid argument}
4342 {\pgfplots@loc@TMPa}%
4343 {Sorry, `visualization depends on' expected a defined control sequence name instead of `\the\t@pgfplots@toka'. Please make sure `\the\t@pgfplots@toka' is a properly defined macro or use the `visualization depends on=<expression> \string\as <\string\macro>' syntax instead}%
4344 \pgfeov
4345 \endgroup
4346 }{%
4347 \expandafter\pgfplots@prepare@visualization@depends@on@#1\as#1\pgfplots@EOI
4348 }%
4349 \fi
4350 \fi
4351 }%
4352 \def\pgfplots@prepare@visualization@depends@on@#1\as#2\pgfplots@EOI{%
4353 \pgfplots@prepare@visualization@depends@on@preparetype{#1}\as{#2}%
4354 % prepare the serialization:
4355 \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\noexpand#2{\csname\string#2@value\endcsname}}%
4356 \t@pgfplots@tokc=\expandafter{\the\t@pgfplots@tokc\csname assign@\string#2\endcsname}%
4357 }%
4358
4359 % task: define a macro '\csname assign@\string#2\endcsname' which, when executed,
4360 % defines \csname\string#2@value\endcsname such that it expands
4361 % to a the correct value.
4362 \def\pgfplots@prepare@visualization@depends@on@preparetype#1\as#2{%
4363 \pgfplots@prepare@visualization@depends@on@preparetype@checkvalue#1value\pgfplots@EOI
4364 \ifpgfutil@in@
4365 \pgfplots@prepare@visualization@depends@on@preparetype@value#1\as{#2}% no braces here.
4366 \else
4367 \pgfplots@prepare@visualization@depends@on@preparetype@expr{#1}\as{#2}%
4368 \fi
4369 }%
4370 \def\pgfplots@prepare@visualization@depends@on@preparetype@expr#1\as#2{%
4371 \pgflibraryfpuifactive{%
4372 \expandafter\def\csname assign@\string#2\endcsname{%
4373 \pgfmathparse{#1}%
4374 \pgfmathfloattofixed{\pgfmathresult}%
4375 \expandafter\let\csname \string#2@value\endcsname=\pgfmathresult
4376 }%
4377 }{%
4378 \expandafter\def\csname assign@\string#2\endcsname{%
4379 \pgfmathparse{#1}%
4380 \expandafter\let\csname \string#2@value\endcsname=\pgfmathresult
4381 }%
4382 }%
4383 }
4384 \def\pgfplots@prepare@visualization@depends@on@preparetype@checkvalue#1value#2\pgfplots@EOI{%
4385 \def\pgfplots@loc@TMPa{#1}%
4386 \ifx\pgfplots@loc@TMPa\pgfutil@empty
4387 \pgfutil@in@true
4388 \else
4389 \pgfutil@in@false
4390 \fi
4391 }%
4392 \def\pgfplots@prepare@visualization@depends@on@preparetype@value value#1\as#2{%
4393 % remove spaces from #1:
4394 \pgfkeys@spdef\pgfplots@loc@TMPa{#1}%
4395 %
4396 % ok, prepare the value.
4397 \def\pgfplots@loc@TMPb{#2}%
4398 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
4399 % oh - a special case! We have value\macro\as\macro.
4400 \expandafter\def\csname\string#2@value\endcsname{#2}%
4401 %
4402 % this is special; we do not need to EXECUTE assign@\string#2 to arrive at its value.
4403 % But we need to define #2@value as that will be stored.
4404 \expandafter\let\csname assign@\string#2\endcsname=\relax
4405 \else
4406 \begingroup
4407 \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}%
4408 \t@pgfplots@tokb=\expandafter{\csname\string#2@value\endcsname}%
4409 \xdef\pgfplots@glob@TMPa{%
4410 \noexpand\def\the\t@pgfplots@tokb{\the\t@pgfplots@toka}%
4411 }%
4412 \endgroup
4413 \expandafter\let\csname assign@\string#2\endcsname=\pgfplots@glob@TMPa
4414 \fi
4415 }
4416
4417 \def\pgfplotsaxisdeserializedatapointfrom@private@withdeplist#1{%
4418 \pgfplotsaxisdeserializedatapointfrom@private@withdeplist@#1\pgfplots@EOI
4419 }%
4420 \def\pgfplotsaxisdeserializedatapointfrom@private@withdeplist@#1,{%
4421 \pgfplotsaxisdeserializedatapointfrom@private@orig{#1}%
4422 \pgfplotsaxisdeserializedatapointfrom@private@withdeplist@@
4423 }%
4424 \def\pgfplotsaxisdeserializedatapointfrom@private@withdeplist@@#1{%
4425 \def\pgfplots@loc@TMPa{#1}%
4426 \ifx\pgfplots@loc@TMPa\pgfplots@EOI
4427 \else
4428 \afterassignment\pgfplotsaxisdeserializedatapointfrom@private@withdeplist@@
4429 \expandafter\def\expandafter#1%
4430 \fi
4431 }%
4432
4433 % PRECONDITION: must be called inside of
4434 % \pgfplots@PREPARE@COORD@STREAM@end@.
4435 %
4436 % POSTCONDITION:
4437 % assigns '/pgfplots/#1 coord sorting=[+-]'
4438 % i.e. whether #1 (x or y or z) coordinates are in ascending (+) ordering or in
4439 % descending order (-).
4440 \def\pgfplots@PREPARE@COORD@STREAM@end@determinecoordsorting#1{%
4441 \pgfplotscoordmath{#1}{if less than}
4442 {\csname pgfplots@currentplot@firstcoord@#1\endcsname}%
4443 {\csname pgfplots@currentplot@lastcoord@#1\endcsname}%
4444 {\pgfkeyssetvalue{/pgfplots/#1 coord sorting}{+}}%
4445 {\pgfkeyssetvalue{/pgfplots/#1 coord sorting}{-}}%
4446 }%
4447
4448 % Defines the linear transformation macro \pgfplots@perpointmeta@trafo,
4449 %
4450 % phi : [meta_min,meta,max] -> [0,10^k]
4451 %
4452 % which operates on the per-point meta data (if any).
4453 % The trafo will be skipped if there is no such data.
4454 %
4455 % The trafo is expected to prepare meta information before it is used
4456 % as input to \pgfplotscolormapaccess (or
4457 % \pgfplotscolormapdefinemappedcolor). Thus, the 10^k is chosen to be
4458 % the same as \pgfplotscolormaprange (which is 1000 per default).
4459 %
4460 % If there is no data range (for example because meta information is
4461 % not available or is not of numeric type), the trafo will simply
4462 % copy the input argument symbolically.
4463 %
4464 % Note: it does not hurt to call it multiple times. It checks automatically whether it already is up-to-date.
4465 \def\pgfplots@perpointmeta@preparetrafo{%
4466 \def\pgfplotspointmetarangeexponent{1}% pre-fill
4467 \pgfutil@ifundefined{pgfplots@perpointmeta@trafo}{%
4468 \edef\pgfplots@loc@TMPa{\pgfplotscolormaprange}%
4469 \ifnum\pgfplots@loc@TMPa=1000
4470 \else
4471 \pgfplots@error{LOGIC ERROR: sorry, I have hard-coded the assumption \string\pgfplotscolormaprange = 1000, but now it is \pgfplots@loc@TMPa.}%
4472 \fi
4473 %
4474 \let\pgfplots@current@point@meta=\pgfutil@empty
4475 \pgfutil@ifundefined{pgfplots@metamax}{\let\pgfplots@metamax=\pgfutil@empty}{}
4476 \ifpgfplots@warn@for@filter@discards
4477 \global\let\pgfplots@perpointmeta@unboundedwarning@stop=\relax
4478 \def\pgfplots@perpointmeta@unboundedwarning##1{%
4479 \ifx\pgfplots@perpointmeta@unboundedwarning@stop\relax
4480 \begingroup
4481 \pgfplotscoordmath{meta}{tostring}{##1}%
4482 \pgfplotswarning{point meta unbounded}{\pgfmathresult}{##1}\pgfeov
4483 \endgroup
4484 \gdef\pgfplots@perpointmeta@unboundedwarning@stop{1}%
4485 \fi
4486 }%
4487 \else
4488 \def\pgfplots@perpointmeta@unboundedwarning##1{}%
4489 \fi
4490 \if d\pgfplots@colormap@access
4491 % colormap access=direct
4492 \def\pgfplots@perpointmeta@trafo##1{%
4493 \pgfplotscoordmath{meta}{if is}{##1}{u}{%
4494 \pgfplotscolorzero{\pgfplotscolormapcolorcompsof{\pgfkeysvalueof{/pgfplots/colormap name}}}%
4495 \pgfplots@perpointmeta@unboundedwarning{##1}%
4496 }{%
4497 \pgfplotscoordmath{meta}{tofixed}{##1}%
4498 \pgfplotscolormapgetindex{\pgfmathresult}{\pgfkeysvalueof{/pgfplots/colormap name}}%
4499 }%
4500 }%
4501 \def\pgfplots@perpointmeta@traforange{0:0}%
4502 \edef\pgfplotspointmetarange{\pgfplots@metamin:\pgfplots@metamax}%
4503 \else
4504 % colormap access=map|piecewise constant
4505 \ifx\pgfplots@metamax\pgfutil@empty
4506 \def\pgfplots@perpointmeta@trafo##1{%
4507 \pgfplotscoordmath{meta}{if is}{##1}{u}
4508 {%
4509 \def\pgfmathresult{0}%
4510 \pgfplots@perpointmeta@unboundedwarning{##1}%
4511 }{%
4512 \pgfplotscoordmath{meta}{tofixed}{##1}%
4513 }%
4514 }%
4515 \def\pgfplots@perpointmeta@traforange{0:1000}%
4516 \edef\pgfplotspointmetarange{0:1000}%
4517 \else
4518 % The transformation is
4519 %
4520 % phi(m) = ( m- meta_min) * 1000/ (meta_max-meta_min).
4521 %
4522 % -> precompute the scaling factor!
4523 \if\pgfplots@perpointmeta@rel@choice0%
4524 % point meta rel=axis wide:
4525 \pgfplots@perpointmeta@preparetrafo@initfrom{pgfplots@axiswide@}%
4526 \else
4527 \pgfplots@perpointmeta@preparetrafo@initfrom{pgfplots@}%
4528 \fi
4529 \fi
4530 \fi
4531 \edef\pgfplotspointmetatransformedrange{\pgfplots@perpointmeta@traforange}%
4532 }{}%
4533 }%
4534
4535 % Employs \csname #1metamin\endcsname and its metamax counterpart to
4536 % initialize the trafo.
4537 %
4538 % This unifies the approaches for \pgfplots@axiswide@metamax and
4539 % \pgfplots@metamax.
4540 \def\pgfplots@perpointmeta@preparetrafo@initfrom#1{%
4541 \edef\pgfplotspointmetarange{\csname #1metamin\endcsname:\csname #1metamax\endcsname}%
4542 % Now, prepare the trafo as such.
4543 % It assigns \pgfmathresult (in fixed point).
4544 \ifpgfplots@LUA@backend@supported
4545 \def\pgfplots@perpointmeta@trafo##1{%
4546 \edef\pgfmathresult{%
4547 \pgfplotsutil@directlua{%
4548 pgfplots.texPerpointMetaTrafo("\pgfplots@current@point@meta")
4549 }%
4550 }%
4551 }%
4552 \else
4553 \def\pgfplots@perpointmeta@trafo##1{%
4554 \pgfplotscoordmath{meta}{if is}{##1}{u}{%
4555 \def\pgfmathresult{0}%
4556 \pgfplots@perpointmeta@unboundedwarning{##1}%
4557 }{%
4558 \pgfplotscoordmath{meta}{op}{subtract}{{##1}{\csname #1metamin\endcsname}}%
4559 \pgfplotscoordmath{meta}{op}{multiply}{{\pgfmathresult}{\pgfplots@perpointmeta@trafo@factor}}%
4560 \pgfplots@perpointmeta@trafo@clipresult
4561 \pgfplotscoordmath{meta}{tofixed}{\pgfmathresult}%
4562 }%
4563 }%
4564 \pgfplotscoordmath{meta}{op}{subtract}{{\csname #1metamax\endcsname}{\csname #1metamin\endcsname}}%
4565 \let\pgfplots@loc@TMPa=\pgfmathresult
4566 \pgfplotscoordmath{meta}{zero}%
4567 \let\pgfplots@perpointmeta@lowerrange=\pgfmathresult
4568 \pgfplotscoordmath{meta}{parsenumber}{1000}%
4569 \let\pgfplots@perpointmeta@upperrange=\pgfmathresult
4570 \pgfplotscoordmath{meta}{op}{divide}{{\pgfmathresult}{\pgfplots@loc@TMPa}}%
4571 \let\pgfplots@perpointmeta@trafo@factor=\pgfmathresult
4572 \fi
4573 %
4574 % Expands to the transformation range as 'a:b':
4575 \def\pgfplots@perpointmeta@traforange{0:1000}%
4576 %
4577 \expandafter\let\expandafter\pgfplots@loc@TMPa\csname #1metamax\endcsname
4578 \pgfplotscoordmath{meta}{tostring}{\pgfplots@loc@TMPa}%
4579 \pgfmathfloatparsenumber\pgfmathresult
4580 \pgfmathfloatgetexponent\pgfmathresult\c@pgf@countd
4581 \edef\pgfplotspointmetarangeexponent{\the\c@pgf@countd}%
4582 }
4583
4584 \def\pgfplots@perpointmeta@trafo@clipresult{%
4585 \let\pgfplots@loc@TMPa=\pgfmathresult
4586 \pgfplotscoordmath{meta}{if less than}{\pgfplots@loc@TMPa}{\pgfplots@perpointmeta@upperrange}{%
4587 \pgfplotscoordmath{meta}{if less than}{\pgfplots@loc@TMPa}{\pgfplots@perpointmeta@lowerrange}{%
4588 \let\pgfmathresult=\pgfplots@perpointmeta@lowerrange
4589 }{%
4590 \let\pgfmathresult=\pgfplots@loc@TMPa
4591 }%
4592 }{%
4593 \let\pgfmathresult=\pgfplots@perpointmeta@upperrange
4594 }%
4595 }%
4596
4597 % define it globally - this simplifies some mesh plots.
4598 \pgfplotscoordmath{meta}{one}%
4599 \let\pgfplotspointmeta=\pgfmathresult
4600 \def\pgfplotspointmetatransformed{1000}% use the maximum because it is usually divided by 1000
4601
4602 % A command which is readily available during the visualization phase of each plot.
4603 %
4604 % It takes existing point meta data and transforms it, i.e. it defines
4605 % \pgfplotspointmetatransformed.
4606 %
4607 % The command won't be invoked automatically, it is task of a plot
4608 % handler to decide if it is needed. It's application is relatively
4609 % fast, however.
4610 %
4611 % PRECONDITION:
4612 % - point meta has been set up during the survey phase (i.e. the
4613 % /pgfplots/point meta!=none),
4614 % - there *is* point meta data for the current data point.
4615 %
4616 % POSTCONDITION:
4617 % - the macros \pgfplotspointmeta and \pgfplotspointmetatransformed
4618 % are defined.
4619 %
4620 % @see also \pgfplotsaxisifhaspointmeta
4621 \def\pgfplotsaxisvisphasetransformpointmeta{%
4622 \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname
4623 % symbolic point meta may be empty.
4624 \let\pgfplotspointmeta=\pgfplots@current@point@meta
4625 \let\pgfplotspointmetatransformed=\pgfplotspointmeta
4626 \else
4627 % numeric point meta may NOT be empty.
4628 \ifx\pgfplots@current@point@meta\pgfutil@empty%
4629 \pgfplots@error{%
4630 could not access the 'point meta=\csname pgfpmeta@\pgfplotspointmetainputhandler @tostring\endcsname' for coordinate \the\c@pgfplots@coordindex: %
4631 its value is empty. %
4632 \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @explicitinput\endcsname%
4633 \pgfplots@addplot@point@meta@description@of@explicit@value
4634 \else
4635 Please ensure that the value exists and is not empty
4636 \fi
4637 }%
4638 \pgfplotscoordmath{meta}{one}%
4639 \let\pgfplotspointmeta=\pgfmathresult
4640 \def\pgfplotspointmetatransformed{1.0}%
4641 \else
4642 % prepare arguments:
4643 \let\pgfplotspointmeta=\pgfplots@current@point@meta
4644 \pgfplots@perpointmeta@trafo{\pgfplotspointmeta}%
4645 \let\pgfplotspointmetatransformed=\pgfmathresult
4646 \fi
4647 \fi
4648 }%
4649 \def\pgfplots@addplot@point@meta@description@of@explicit@value{%
4650 Please use an input stream which provides 'explicit point meta' like \string\addplot\space table or \string\addplot\space coordinates
4651 }
4652
4653 \def\pgfplotsaxisvisphasetransformpointmetaifany{%
4654 \pgfplotsaxisifhaspointmeta{\pgfplotsaxisvisphasetransformpointmeta}{}%
4655 }
4656
4657 % A looping method which applies
4658 % \pgfplots@coord@stream@start
4659 % for each coordinate '(x,y)' or '(x,y) +- (ex,ey)',
4660 % assign \pgfplots@current@point@[xyz]
4661 % assign \pgfplots@current@point@[xyz]@error (if in argument list)
4662 % assign \pgfplots@current@point@meta
4663 % call \pgfplots@coord@stream@coord
4664 % \pgfplots@coord@stream@end
4665 %
4666 % #1 a sequence of coordinates of the form
4667 % '(x,y)' or '(x,y,z)'
4668 % or
4669 % '(x,y[,z]) +- (ex,ey)'
4670 % or
4671 % '(x,y[,z]) += (ex+,ey+) -= (ex-,ey-)'
4672 % or
4673 % '(x,y) [meta]'
4674 % or
4675 % '(x,y) +- (ex,ey) [meta]'
4676 % separated by white-space.
4677 %
4678 \long\def\pgfplots@coord@stream@foreach#1{%
4679 \pgfplots@coord@stream@start
4680 \pgfplotsscanlinelengthinitzero
4681 \pgfplots@foreach@plot@coord@ITERATE#1\pgfplots@EOI%
4682 \pgfplotsscanlinelengthcleanup
4683 \pgfplots@coord@stream@end
4684 }%
4685
4686 \begingroup
4687 \def\\{\global\let\pgfplots@let@space@token= } \\ % now, \pgfplots@let@space@token is a space token
4688 \endgroup
4689
4690
4691 % A looping command to loop through plot coordinates.
4692 % For every point, \pgfplots@coord@stream@coord will be invoked.
4693 %
4694 % No scoping is used during this operation, so you can access outer
4695 % variables.
4696 \def\pgfplots@foreach@plot@coord@ITERATE{%
4697 \futurelet\pgfplots@foreach@plot@coord@ITERATE@tok\pgfplots@foreach@plot@coord@ITERATE@
4698 }%
4699 \long\def\pgfplots@foreach@plot@coord@ITERATE@#1{%
4700 \ifx\pgfplots@foreach@plot@coord@ITERATE@tok(%
4701 \pgfplotsscanlinelengthincrease
4702 \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@NEXT%
4703 \else
4704 \ifx\pgfplots@foreach@plot@coord@ITERATE@tok\pgfplots@let@space@token
4705 \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@ITERATE#1}%
4706 \else
4707 \ifx\pgfplots@foreach@plot@coord@ITERATE@tok\pgfplots@EOI
4708 % ok, do nothing more
4709 \let\pgfplots@loop@next=\relax
4710 \else
4711 \ifx\pgfplots@foreach@plot@coord@ITERATE@tok\par
4712 \pgfplotsscanlinecomplete
4713 \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@ITERATE
4714 \else
4715 \if\noexpand\pgfplots@foreach@plot@coord@ITERATE@tok\noexpand\anymacro
4716 % Ah. #1 has the same character (!) code as \anymacro,
4717 % that means it is a macro! Expand it:
4718 \def\pgfplots@loop@next{\expandafter\pgfplots@foreach@plot@coord@ITERATE#1}%
4719 \else
4720 \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@error#1}%
4721 \fi
4722 \fi
4723 \fi
4724 \fi
4725 \fi
4726 \pgfplots@loop@next
4727 }
4728
4729 \long\def\pgfplots@foreach@plot@coord@error#1\pgfplots@EOI{%
4730 \def\pgfplots@loc@TMPa{#1}%
4731 \pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPa
4732 \pgfplots@error{Sorry, I could not read the plot coordinates near '\pgfplots@loc@TMPa'. Please check for format mistakes}%
4733 }%
4734 \def\pgfplots@foreach@plot@coord@NEXT#1,#2){%
4735 \ifpgfplots@plot@coords@mathparser
4736 \pgfmathparse{#1}\let\pgfplots@current@point@x=\pgfmathresult
4737 \pgfmathparse{#2}\let\pgfplots@current@point@y=\pgfmathresult
4738 \else
4739 \def\pgfplots@current@point@x{#1}%
4740 \def\pgfplots@current@point@y{#2}%
4741 \fi
4742 \let\pgfplots@current@point@error@x@plus=\pgfutil@empty
4743 \let\pgfplots@current@point@error@x@minus=\pgfutil@empty
4744 \let\pgfplots@current@point@error@y@plus=\pgfutil@empty
4745 \let\pgfplots@current@point@error@y@minus=\pgfutil@empty
4746 \let\pgfplots@current@point@meta=\pgfutil@empty
4747 \pgfplots@foreach@plot@coord@NEXT@cont
4748 }
4749 \def\pgfplots@foreach@plot@coord@NEXT@cont{%
4750 \pgfutil@ifnextchar+{%
4751 \pgfplots@foreach@plot@coord@NEXT@plus%
4752 }{%
4753 \pgfutil@ifnextchar-{%
4754 \pgfplots@foreach@plot@coord@NEXT@minus%
4755 }{%
4756 \pgfutil@ifnextchar[{%
4757 \pgfplots@foreach@plot@coord@NEXT@meta
4758 }{%
4759 \pgfplots@coord@stream@coord
4760 \pgfplots@foreach@plot@coord@ITERATE
4761 }%
4762 }%
4763 }%
4764 }
4765 \def\pgfplots@foreach@plot@coord@NEXT@meta[#1]{%
4766 \def\pgfplots@current@point@meta{#1}%
4767 \pgfplots@coord@stream@coord
4768 \pgfplots@foreach@plot@coord@ITERATE
4769 }%
4770 \def\pgfplots@foreach@plot@coord@NEXT@plus+{%
4771 \pgfutil@ifnextchar={%
4772 \pgfplots@foreach@plot@coord@NEXT@pluseq%
4773 }{%
4774 \pgfplots@foreach@plot@coord@NEXT@plusminus%
4775 }%
4776 }
4777 \def\pgfplots@foreach@plot@coord@NEXT@minus-=#1({%
4778 \def\pgfplots@foreach@plot@coord@state{-}%
4779 \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@
4780 }
4781 \def\pgfplots@foreach@plot@coord@NEXT@pluseq=#1({%
4782 \def\pgfplots@foreach@plot@coord@state{+}%
4783 \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@
4784 }
4785 \def\pgfplots@foreach@plot@coord@NEXT@plusminus-#1({%
4786 \def\pgfplots@foreach@plot@coord@state{B}%
4787 \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@
4788 }
4789
4790 % processing something like '(x,y) +- (error_x,error_y)'
4791 \def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@#1,#2){%
4792 \ifpgfplots@plot@coords@mathparser
4793 \pgfmathparse{#1}%
4794 \let\pgfplots@loc@TMPb=\pgfmathresult
4795 \pgfmathparse{#2}%
4796 \let\pgfplots@loc@TMPc=\pgfmathresult
4797 \else
4798 \def\pgfplots@loc@TMPb{#1}%
4799 \def\pgfplots@loc@TMPc{#2}%
4800 \fi
4801 %
4802 \if +\pgfplots@foreach@plot@coord@state
4803 % ah, it was a "+=" item:
4804 \let\pgfplots@current@point@error@x@plus=\pgfplots@loc@TMPb
4805 \let\pgfplots@current@point@error@y@plus=\pgfplots@loc@TMPc
4806 \else
4807 \if -\pgfplots@foreach@plot@coord@state
4808 % ah, it was a "-=" item:
4809 \let\pgfplots@current@point@error@x@minus=\pgfplots@loc@TMPb
4810 \let\pgfplots@current@point@error@y@minus=\pgfplots@loc@TMPc
4811 \else
4812 % ah, it was a "+-" item:
4813 \let\pgfplots@current@point@error@x@plus=\pgfplots@loc@TMPb
4814 \let\pgfplots@current@point@error@x@minus=\pgfplots@loc@TMPb
4815 \let\pgfplots@current@point@error@y@plus=\pgfplots@loc@TMPc
4816 \let\pgfplots@current@point@error@y@minus=\pgfplots@loc@TMPc
4817 \fi
4818 \fi
4819 %
4820 \pgfplots@foreach@plot@coord@NEXT@cont
4821 }
4822
4823
4824 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
4825 % The same for three dim coords:
4826 \long\def\pgfplots@coord@stream@foreach@threedim#1{%
4827 \pgfplots@coord@stream@start
4828 \pgfplotsscanlinelengthinitzero
4829 \pgfplots@foreach@plot@coord@threedim@ITERATE#1\pgfplots@EOI%
4830 \pgfplotsscanlinelengthcleanup
4831 \pgfplots@coord@stream@end
4832 }%
4833 \def\pgfplots@foreach@plot@coord@threedim@ITERATE{%
4834 \futurelet\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\pgfplots@foreach@plot@coord@threedim@ITERATE@
4835 }%
4836 \long\def\pgfplots@foreach@plot@coord@threedim@ITERATE@#1{%
4837 \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok(%
4838 \pgfplotsscanlinelengthincrease
4839 \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@threedim@NEXT%
4840 \else
4841 \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\pgfplots@let@space@token
4842 \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@threedim@ITERATE#1}%
4843 \else
4844 \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\pgfplots@EOI
4845 % ok, do nothing more
4846 \let\pgfplots@loop@next=\relax
4847 \else
4848 \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\par
4849 \pgfplotsscanlinecomplete
4850 \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@threedim@ITERATE
4851 \else
4852 \if\noexpand\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\noexpand\anymacro
4853 % Ah. #1 has the same character (!) code as \anymacro,
4854 % that means it is a macro! Expand it:
4855 \def\pgfplots@loop@next{\expandafter\pgfplots@foreach@plot@coord@threedim@ITERATE#1}%
4856 \else
4857 \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@error#1}%
4858 \fi
4859 \fi
4860 \fi
4861 \fi
4862 \fi
4863 \pgfplots@loop@next
4864 }
4865 \def\pgfplots@foreach@plot@coord@threedim@NEXT#1,#2,#3){
4866 \ifpgfplots@plot@coords@mathparser
4867 \pgfmathparse{#1}\let\pgfplots@current@point@x=\pgfmathresult
4868 \pgfmathparse{#2}\let\pgfplots@current@point@y=\pgfmathresult
4869 \pgfmathparse{#3}\let\pgfplots@current@point@z=\pgfmathresult
4870 \else
4871 \def\pgfplots@current@point@x{#1}%
4872 \def\pgfplots@current@point@y{#2}%
4873 \def\pgfplots@current@point@z{#3}%
4874 \fi
4875 \let\pgfplots@current@point@error@x@plus=\pgfutil@empty
4876 \let\pgfplots@current@point@error@x@minus=\pgfutil@empty
4877 \let\pgfplots@current@point@error@y@plus=\pgfutil@empty
4878 \let\pgfplots@current@point@error@y@minus=\pgfutil@empty
4879 \let\pgfplots@current@point@error@z@plus=\pgfutil@empty
4880 \let\pgfplots@current@point@error@z@minus=\pgfutil@empty
4881 %
4882 \let\pgfplots@current@point@meta=\pgfutil@empty
4883 %
4884 \pgfplots@foreach@plot@coord@threedim@NEXT@cont
4885 }
4886 \def\pgfplots@foreach@plot@coord@threedim@NEXT@cont{%
4887 \pgfutil@ifnextchar+{%
4888 \pgfplots@foreach@plot@coord@threedim@NEXT@plus%
4889 }{%
4890 \pgfutil@ifnextchar-{%
4891 \pgfplots@foreach@plot@coord@threedim@NEXT@minus%
4892 }{%
4893 \pgfutil@ifnextchar[{%
4894 \pgfplots@foreach@plot@coord@threedim@NEXT@meta
4895 }{%
4896 \pgfplots@coord@stream@coord
4897 \pgfplots@foreach@plot@coord@threedim@ITERATE
4898 }%
4899 }%
4900 }%
4901 }
4902 \def\pgfplots@foreach@plot@coord@threedim@NEXT@meta[#1]{%
4903 \def\pgfplots@current@point@meta{#1}%
4904 \pgfplots@coord@stream@coord
4905 \pgfplots@foreach@plot@coord@threedim@ITERATE
4906 }%
4907
4908 \def\pgfplots@foreach@plot@coord@threedim@NEXT@plus+{%
4909 \pgfutil@ifnextchar={%
4910 \pgfplots@foreach@plot@coord@threedim@NEXT@pluseq%
4911 }{%
4912 \pgfplots@foreach@plot@coord@threedim@NEXT@plusminus%
4913 }%
4914 }
4915 \def\pgfplots@foreach@plot@coord@threedim@NEXT@minus-=#1({%
4916 \def\pgfplots@foreach@plot@coord@state{-}%
4917 \pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@
4918 }
4919 \def\pgfplots@foreach@plot@coord@threedim@NEXT@pluseq=#1({%
4920 \def\pgfplots@foreach@plot@coord@state{+}%
4921 \pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@
4922 }
4923 \def\pgfplots@foreach@plot@coord@threedim@NEXT@plusminus-#1({%
4924 \def\pgfplots@foreach@plot@coord@state{B}%
4925 \pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@
4926 }
4927 % processing something like '(x,y) +- (error_x,error_y)'
4928 \def\pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@#1,#2,#3){%
4929 \ifpgfplots@plot@coords@mathparser
4930 \pgfmathparse{#1}\let\pgfplots@loc@TMPb=\pgfmathresult
4931 \pgfmathparse{#2}\let\pgfplots@loc@TMPc=\pgfmathresult
4932 \pgfmathparse{#3}\let\pgfplots@loc@TMPd=\pgfmathresult
4933 \else
4934 \def\pgfplots@loc@TMPb{#1}%
4935 \def\pgfplots@loc@TMPc{#2}%
4936 \def\pgfplots@loc@TMPd{#3}%
4937 \fi
4938 %
4939 \if +\pgfplots@foreach@plot@coord@state
4940 % ah, it was a "+=" item:
4941 \let\pgfplots@current@point@error@x@plus=\pgfplots@loc@TMPb
4942 \let\pgfplots@current@point@error@y@plus=\pgfplots@loc@TMPc
4943 \let\pgfplots@current@point@error@z@plus=\pgfplots@loc@TMPd
4944 \else
4945 \if -\pgfplots@foreach@plot@coord@state
4946 % ah, it was a "-=" item:
4947 \let\pgfplots@current@point@error@x@minus=\pgfplots@loc@TMPb
4948 \let\pgfplots@current@point@error@y@minus=\pgfplots@loc@TMPc
4949 \let\pgfplots@current@point@error@z@minus=\pgfplots@loc@TMPd
4950 \else
4951 % ah, it was a "+-" item:
4952 \let\pgfplots@current@point@error@x@plus=\pgfplots@loc@TMPb
4953 \let\pgfplots@current@point@error@x@minus=\pgfplots@loc@TMPb
4954 \let\pgfplots@current@point@error@y@plus=\pgfplots@loc@TMPc
4955 \let\pgfplots@current@point@error@y@minus=\pgfplots@loc@TMPc
4956 \let\pgfplots@current@point@error@z@plus=\pgfplots@loc@TMPd
4957 \let\pgfplots@current@point@error@z@minus=\pgfplots@loc@TMPd
4958 \fi
4959 \fi
4960 %
4961 \pgfplots@foreach@plot@coord@threedim@NEXT@cont
4962 }
4963
4964 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
4965 %
4966 % A coordinate stream which works like this:
4967 %
4968 % -------------
4969 % \pgfplots@coord@stream@start
4970 %
4971 % foreach encoded coordinate:
4972 % \def\pgfplots@coord@stream@foreach@NORMALIZED@curencoded{<encoded data>}%
4973 % \def\pgfplots@coord@stream@foreach@NORMALIZED@curencoded@braced{{<encoded data>}}% note the extra braces.
4974 % \pgfplotsaxisdeserializedatapointfrom{<encoded data>}
4975 % \pgfplots@coord@stream@coord
4976 %
4977 % \pgfplots@coord@stream@end
4978 % -------------
4979 %
4980 % The format of #1 is
4981 % {<datapoint>}{<datapoint>}...{<datapoint>}
4982 % Each data point is decoded with
4983 % \pgfplotsaxisserializedatapoint
4984 % and then, \pgfplots@coord@stream@coord will be called.
4985 \long\def\pgfplots@coord@stream@foreach@NORMALIZED#1{%
4986 \pgfplots@coord@stream@start
4987 \pgfplotscoordstream@firstlast@init
4988 \pgfplots@foreach@plot@coord@NORMALIZED@ITERATE#1\pgfplots@EOI%
4989 \pgfplots@coord@stream@end
4990 }%
4991 % No scoping is used during this operation, so you can access outer
4992 % variables.
4993 \def\pgfplots@foreach@plot@coord@NORMALIZED@ITERATE#1{%
4994 \def\pgfplots@coord@stream@foreach@NORMALIZED@curencoded{#1}%
4995 \ifx\pgfplots@coord@stream@foreach@NORMALIZED@curencoded\pgfplots@EOI
4996 \else
4997 \def\pgfplots@coord@stream@foreach@NORMALIZED@curencoded@braced{{#1}}%
4998 \pgfplotsaxisdeserializedatapointfrom{#1}%
4999 \pgfplots@coord@stream@coord
5000 \pgfplotsplothandlerifcurrentpointcanbefirstlast{%
5001 \pgfplotscoordstream@firstlast@update
5002 }{}%
5003 \expandafter\pgfplots@foreach@plot@coord@NORMALIZED@ITERATE
5004 \fi
5005 }
5006
5007 % A common routine which resets internal data structures for the
5008 % survey phase, i.e. it is the shared implementation for all \addplot
5009 % variations.
5010 %
5011 % It takes all options which are provided to \addplot, sets them (at
5012 % least partially) and remembers them for the command serialization.
5013 %
5014 % #1: arguments to \addplot plot[#1]
5015 % -> these are called 'behavior' options in the manual; they are set
5016 % immediately.
5017 %
5018 % PRECONDITION:
5019 % \pgfplots@addplotimpl@plot@withoptions has already been invoked
5020 %
5021 % POSTCONDITION:
5022 % - internal datastructures are initialised (coordinate indexing, fpu)
5023 % - all keys which are required for the current plot are determined
5024 % (and set if necessary).
5025 % They are stored into
5026 % \pgfplots@addplot@survey@@optionlist.
5027 %
5028 \def\pgfplots@start@plot@with@behavioroptions#1{%
5029 %\begingroup%<-- has been moved to \pgfplots@addplotimpl@plot@withoptions
5030 \def\pgfplotsaxisplotphase{S}% "in survey"
5031 \c@pgfplots@coordindex=0
5032 \def\pgfplots@current@point@coordindex{\the\c@pgfplots@coordindex}% can be used inside of coordinate filters.
5033 \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot
5034 \def\pgfplots@addplot@running{1}%
5035 %
5036 \def\pgfplots@colorbar@set@src{0}%
5037 \pgfkeysdef{/pgfplots/colorbar source}{%
5038 \pgfplotsutilifstringequal{##1}{true}{%
5039 \def\pgfplots@colorbar@set@src{1}%
5040 }{%
5041 \pgfplotsutilifstringequal{##1}{false}{%
5042 \def\pgfplots@colorbar@set@src{0}%
5043 }{%
5044 \pgfplots@error{Sorry, I don't know the value `colorbar source={##1}' and I am going to ignore it. Maybe you misspelled it?}%
5045 }%
5046 }%
5047 }%
5048 %
5049 \pgfplots@start@plot@with@behavioroptions@setkeys{#1}%
5050 %
5051 % enable FPU after any \pgfplotsset operations. Otherwise things like
5052 % linewidth=... which use the math parser might fail.
5053 \ifpgfplots@usefpu
5054 \pgfkeys{/pgf/fpu=true,%
5055 /pgf/fpu/output format=float,%
5056 }%
5057 \fi
5058 %
5059 % make sure it is reset, just in case it is not supported by the
5060 % input method.
5061 \pgfplotsscanlinelengthinitzero
5062 %
5063 \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler
5064 \pgfplotsresetplothandler
5065 \pgfplots@basiclevel@plothandler
5066 %
5067 \pgfplots@countplots@init
5068 %
5069 % hooks:
5070 \pgfkeysvalueof{/pgfplots/execute at begin plot@@}%
5071 \pgfkeysvalueof{/pgfplots/execute at begin plot}%
5072 %
5073 \if1\pgfplots@colorbar@set@src
5074 \t@pgfplots@tokc={/pgfplots/point meta rel=per plot}%
5075 \t@pgfplots@toka=\expandafter{\pgfplots@addplot@survey@@optionlist}%
5076 \edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc,\the\t@pgfplots@toka}%
5077 \fi
5078 %
5079 %
5080 \pgfplots@validate@plot@domain@arguments
5081 }
5082
5083 \def\pgfplots@disable@non@survey@keys{%
5084 %
5085 % this here would try to compute something. DON'T DO THIS DURING
5086 % SURVEY!
5087 \pgfkeysdef{/tikz/name intersections}{}%
5088 \pgfkeysdef{/tikz/intersection segments}{}%
5089 %
5090 }%
5091
5092 \def\pgfplots@start@plot@with@behavioroptions@setkeys#1{%
5093 % these styles may contain behavior options (error bars,
5094 % samples,... ) activate them!
5095 %
5096 % As of february 20, 2009, #1 will contain BOTH, /pgfplots
5097 % and /tikz options. The /tikz ones are primarily for drawing
5098 % and are UNIMPORTANT at this stage of processing.
5099 % In fact, transparency etc. will only confuse everything.
5100 %
5101 % So: ignore them and set only /pgfplots keys here:
5102 % This may actually redefine styles, for example
5103 % \addplot[every mark/.append style={}] will use
5104 % /pgfplots/every mark/.append style.
5105 % But that doesn't hurt here.
5106 %
5107 % there are some exceptions like /tikz/id etc. These
5108 % exceptions need special styles in the /pgfplots root - or I
5109 % need to change the .unknown handler. See the available
5110 % compatibility styles!
5111 %
5112 % \pgfkeysdef{/pgfplots/.unknown}{%
5113 %\message{In \string\addplot[#1]: I am silently ignoring key `\pgfkeyscurrentkeyRAW' during the preparation phase.}%
5114 % }%
5115 % ATTENTION:
5116 % as of january 30, 2010, I will set /tikz keys as well. This won't hurt
5117 % too much, I hope... there are no graphics operations anyway. But it *is*
5118 % necessary since I *need* the plot handler for the new version. And the plot
5119 % handler is, most likely, a /tikz key.
5120 %
5121 % it is possible that '#1' contains 'forget plot'. So, we need to
5122 % set the options before checking \ifpgfplots@curplot@isirrelevant:
5123 \pgfplots@disable@non@survey@keys
5124 \pgfplotsset{/pgfplots/every axis plot,#1}%
5125 %
5126 \ifpgfplots@curplot@isirrelevant
5127 \def\pgfplots@addplot@survey@@optionlist{/pgfplots/every axis plot,/pgfplots/every forget plot}%
5128 \pgfplotsset{/pgfplots/every forget plot,/pgfplots/every axis plot post}%
5129 \else
5130 \edef\pgfplots@addplot@survey@@optionlist{%
5131 /pgfplots/every axis plot,%
5132 /pgfplots/every axis plot except legend,%
5133 /pgfplots/every axis plot no \the\pgfplots@numplots/.try}%
5134 \pgfplotsset{%
5135 /pgfplots/every axis plot except legend,
5136 /pgfplots/every axis plot no \the\pgfplots@numplots/.try,%
5137 /pgfplots/every axis plot post}%
5138 \fi
5139 %
5140 \t@pgfplots@tokc=\expandafter{\pgfplots@addplot@survey@@optionlist,#1}% this allows '#' inside of '#1'
5141 \edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc}%
5142 %
5143 \pgfplots@set@trig@format@plots
5144 }
5145
5146 \long\def\pgfplotssurveyphaseaddoptionsbeforesurveybegins#1{%
5147 \pgfplotsset{%
5148 /pgfplots/execute at end survey/.add={}{%
5149 \t@pgfplots@tokc=\expandafter{\pgfplots@addplot@survey@@optionlist,#1}% this allows '#' inside of '#1'
5150 \edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc}%
5151 },%
5152 #1%
5153 }%
5154 }%
5155 \long\def\pgfplotsplothandlersurveyaddoptions#1{%
5156 \t@pgfplots@tokc=\expandafter{\pgfplots@addplot@survey@@optionlist,#1}% this allows '#' inside of '#1'
5157 \edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc}%
5158 \pgfplotsset{#1}%
5159 }%
5160
5161
5162 % The main interface to draw a plot into an axis.
5163 %
5164 % Usage:
5165 % \addplot
5166 % plot coordinates {
5167 % (0,0)
5168 % (1,1)
5169 % };
5170 %
5171 % or
5172 %
5173 % \addplot[color=blue,mark=*]
5174 % plot coordinates {
5175 % (0,0)
5176 % (1,1)
5177 % };
5178 %
5179 % or one of the other input types.
5180 %
5181 % The first syntax will use the next plot specification in the list
5182 % \autoplotspeclist
5183 % and the first will use blue color and * markers.
5184 %
5185 % \addplot [<style options>] plot[<behavior options>] <input type and args> <post plot path> ;
5186 % \addplot3[<style options>] plot[<behavior options>] <input type and args> <post plot path> ;
5187 %
5188 % The complete accumulation is done GLOBALLY. It should be safe to put
5189 % '\addplot' into local groups.
5190 %
5191 %
5192 % The linespec. will be used in the legend.
5193 %
5194 % Low-level implementation:
5195 %
5196 % \pgfplots@addplot
5197 % \pgfplots@addplotimpl
5198 % \pgfplots@start@plot@with@behavioroptions <--- \begingroup
5199 % ...
5200 % ... remember options GLOBALLY
5201 % ... update limits GLOBALLY
5202 % ... \pgfplots@addplot@enqueue@coords GLOBALLY
5203 % ...
5204 % \pgfplots@end@plot <--- \endgroup
5205 \def\pgfplots@addplot{%
5206 \pgfutil@ifnextchar3{%
5207 \pgfplots@curplot@threedimtrue
5208 \pgfplots@addplot@three
5209 }{%
5210 \pgfplots@curplot@threedimfalse
5211 \pgfplots@addplot@
5212 }%
5213 }
5214 \def\pgfplots@addplot@three3{\pgfplots@addplot@}%
5215 \def\pgfplots@addplot@{%
5216 \pgfutil@ifnextchar+{%
5217 \pgfplots@getautoplotspec into\nextplotspec
5218 \pgfplots@addplotimplAPPEND
5219 }{%
5220 \pgfutil@ifnextchar[{%
5221 \pgfplots@addplotimpl%
5222 }{%
5223 \pgfplots@getautoplotspec into\nextplotspec
5224 % the space after ']' is required here:
5225 % FIXME:
5226 % - \addplot[]plot coordinates is NOT allowed!?
5227 \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec]%
5228 }%
5229 }%
5230 }
5231
5232 \def\pgfplots@addplotimplAPPEND+{\pgfutil@ifnextchar[{\pgfplots@addplotimplAPPEND@}{\pgfplots@addplotimplAPPEND@[]}}% this allows to gobble spaces and to skip the '[]'
5233 \def\pgfplots@addplotimplAPPEND@[{%
5234 \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec,%
5235 }
5236
5237 \long\def\pgfplots@addplotimpl[#1]{%
5238 \pgfplotsutil@ifnextchar p{%
5239 \pgfplots@addplotimpl@plot{#1}%
5240 }{%
5241 \pgfplots@addplotimpl@plot{#1}plot
5242 }%
5243 }
5244
5245 \long\def\pgfplots@addplotimpl@plot#1plot{%
5246 \pgfplotsutil@ifnextchar[{%
5247 \pgfplots@addplotimpl@plot@withoptions{#1}%
5248 }{%
5249 \pgfplots@addplotimpl@plot@withoptions{#1}[]%
5250 }%
5251 }
5252
5253 \long\def\pgfplots@addplotimpl@plot@withoptions#1[#2]{
5254 \begingroup% <-- This groups ends in \pgfplots@end@plot
5255 %
5256 \pgfplotsutil@ifnextchar c{%
5257 \pgfplots@addplotimpl@coordinates{#1}{#2}plot
5258 }{%
5259 \pgfplotsutil@ifnextchar f{%
5260 \pgfplots@addplotimpl@f{#1}{#2}%
5261 }{%
5262 \pgfplotsutil@ifnextchar t{%
5263 \def\pgfplotssurveyphaseinputclass{table}%
5264 \pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2}%
5265 \pgfplots@addplotimpl@table{#1,#2}%
5266 }{%
5267 \pgfplotsutil@ifnextchar ({%
5268 \pgfplots@addplotimpl@expression{#1}{#2}%
5269 }{%
5270 \pgfplotsutil@ifnextchar\bgroup{%
5271 \pgfplots@addplotimpl@expression@curly{#1}{#2}%
5272 }{%
5273 \pgfplotsutil@ifnextchar e{%
5274 \pgfplots@addplotimpl@expression@e{#1}{#2}%
5275 }{%
5276 \pgfplotsutil@ifnextchar g{%
5277 \pgfplots@addplotimpl@g{#1}{#2}%
5278 }{%
5279 \pgfplotsutil@ifnextchar s{%
5280 \pgfplots@addplotimpl@shell{#1}{#2}%
5281 }{%
5282
5283 \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots! Ignoring it.}%
5284 \pgfplots@gobble@until@semicolon
5285 }%
5286 }%
5287 }%
5288 }%
5289 }%
5290 }%
5291 }%
5292 }%
5293 }
5294 \long\def\pgfplots@addplotimpl@f#1#2f{%
5295 \pgfplotsutil@ifnextchar i{%
5296 \pgfplots@addplotimpl@fil{#1}{#2}%
5297 }{%
5298 \pgfplots@addplotimpl@function{#1}{#2}%
5299 }%
5300 }%
5301
5302 \long\def\pgfplots@addplotimpl@fil#1#2il{%
5303 \pgfplotsutil@ifnextchar e{%
5304 \pgfplots@addplotimpl@file{#1}{#2}%
5305 }{%
5306 \pgfplots@addplotimpl@fillbetween{#1}{#2}%
5307 }%
5308 }%
5309
5310 \def\pgfplots@addplotimpl@fillbetween#1#2l between{%
5311 \pgfplotsutil@ifnextchar[{%
5312 \pgfplots@addplotimpl@fillbetween@opt{#1}{#2}%
5313 }{%
5314 \pgfplots@addplotimpl@fillbetween@opt{#1}{#2}[]%
5315 }%
5316 }
5317 % \addplot[#1] [#2] fill between[#3] #4;
5318 \long\def\pgfplots@addplotimpl@fillbetween@opt#1#2[#3]#4;{\pgfplots@addplotimpl@fillbetween@opt@{#1}{#2}{#3}{#4}}%
5319
5320 \long\def\pgfplots@addplotimpl@fillbetween@opt@#1#2#3#4{%
5321 \pgfkeysifdefined{/tikz/fill between/of/.@cmd}{%
5322 \pgfplotslibraryfillbetween@addplot{#1,#2}{#3}{#4}%
5323 }{%
5324 \pgfplotsthrow{invalid argument}
5325 {\pgfplots@loc@TMPa}%
5326 {Please load \string\usepgfplotslibrary{fillbetween} in order to use `\string\addplot\space fill between'.}%
5327 \pgfeov
5328 }%
5329 %
5330 \pgfplots@end@plot%
5331 }%
5332
5333 \def\pgfplots@gobble@until@semicolon#1;{}
5334
5335 % PRECONDITION:
5336 % the key-value sets have all been set in the current scope.
5337 %
5338 % POSTCONDITION:
5339 % 1. the following macros are initialised and sanitized:
5340 % \pgfplots@plot@domain
5341 % \pgfplots@plot@ydomain (will be set to \pgfplots@plot@domain if empty)
5342 % \pgfplots@plot@samples@at
5343 % \pgfplots@plot@samples@y (will be set to the x variant if empty)
5344 % \tikz@plot@var (will become a macro like '\x')
5345 % \pgfplots@plot@var@nonmacro (the same as \tikz@plot@var, but without backslash)
5346 % \pgfplots@plot@var@y (like \tikz@plot@var, but for y)
5347 % \pgfplots@plot@var@y@nonmacro (like \pgfplots@plot@var@nonmacro, but for y)
5348 % 2. the following key-value things are set:
5349 % /pgfplots/mesh/rows
5350 % /pgfplots/mesh/cols
5351 % /pgfplots/samples y (will contain a value )
5352 % 3. the macro
5353 % \b@pgfplots@should@sample@LINE
5354 % will be
5355 % \def\b@pgfplots@should@sample@LINE{1}
5356 % if the expression plotter should sample a line
5357 % and
5358 % \def\b@pgfplots@should@sample@LINE{0}
5359 % if it should sample a mesh.
5360 \def\pgfplots@plot@expression@preparekeys{%
5361 \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain
5362 \pgfkeysgetvalue{/pgfplots/samples y}\pgfplots@plot@samples@y
5363 \pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at
5364 \pgfkeysgetvalue{/pgfplots/variable y}\pgfplots@plot@var@y
5365 %
5366 \ifx\pgfplots@plot@samples@y\pgfutil@empty
5367 \else
5368 \pgfplotscoordmath{default}{parse int}{\pgfplots@plot@samples@y}%
5369 \let\pgfplots@plot@samples@y=\pgfmathresult
5370 \pgfkeyslet{/pgfplots/samples y}{\pgfplots@plot@samples@y}%
5371 \fi
5372 %
5373 % \tikz@plot@var is '\x' be default:
5374 \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}%
5375 %
5376 \begingroup
5377 \escapechar=-1
5378 \xdef\pgfplots@glob@TMPa{\expandafter\string\tikz@plot@var}%
5379 \xdef\pgfplots@glob@TMPb{\expandafter\string\pgfplots@plot@var@y}%
5380 \endgroup
5381 % \pgfplots@plot@var@nonmacro is the value '\tikz@plot@var'
5382 % without the '\', i.e. 'x' by default:
5383 \let\pgfplots@plot@var@nonmacro=\pgfplots@glob@TMPa
5384 \let\pgfplots@plot@var@y@nonmacro=\pgfplots@glob@TMPb
5385 %
5386 % make sure the 'plot vars' have a backslash (as it was in tikz
5387 % plot expression):
5388 \edef\pgfplots@loc@TMPa{\expandafter\string\tikz@plot@var}%
5389 \ifx\pgfplots@plot@var@nonmacro\pgfplots@loc@TMPa
5390 \edef\tikz@plot@var{\expandafter\noexpand\csname \tikz@plot@var\endcsname}%
5391 \fi
5392 %
5393 \edef\pgfplots@loc@TMPa{\expandafter\string\pgfplots@plot@var@y}%
5394 \ifx\pgfplots@plot@var@y@nonmacro\pgfplots@loc@TMPa
5395 \edef\pgfplots@plot@var@y{\expandafter\noexpand\csname \pgfplots@plot@var@y\endcsname}%
5396 \fi
5397 %
5398 % Check if we have to sample a line or a matrix.
5399 %
5400 \pgfkeysgetvalue{/pgfplots/sample dim}\pgfplots@loc@TMPa
5401 \def\pgfplots@loc@TMPb{auto}%
5402 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
5403 \ifpgfplots@curplot@threedim
5404 \def\b@pgfplots@should@sample@LINE{0}%
5405 \else
5406 \def\b@pgfplots@should@sample@LINE{1}%
5407 \fi
5408 \else
5409 \ifcase\pgfplots@loc@TMPa\relax
5410 % sample dim=0 not useful!?
5411 \def\b@pgfplots@should@sample@LINE{1}%
5412 \or
5413 \def\b@pgfplots@should@sample@LINE{1}%
5414 \or
5415 \def\b@pgfplots@should@sample@LINE{0}%
5416 \else
5417 \pgfplots@error{Sorry, sample dim=\pgfplots@loc@TMPa\space is unsupported (use either 1 or 2)}%
5418 \fi
5419 \fi
5420 %
5421 \if0\b@pgfplots@should@sample@LINE
5422 % sample a matrix. Check the keys; if they are one
5423 % dimensional, switch back to line sampling:
5424 \pgfkeysgetvalue{/pgfplots/y domain}{\pgfplots@plot@ydomain}%
5425 \edef\pgfplots@plot@ydomain{\pgfplots@plot@ydomain}%
5426 \def\pgfplots@loc@TMPa{0:0}%
5427 \ifx\pgfplots@plot@ydomain\pgfplots@loc@TMPa
5428 \def\b@pgfplots@should@sample@LINE{1}%
5429 \fi
5430 \ifx\pgfplots@plot@ydomain\pgfutil@empty
5431 \let\pgfplots@plot@ydomain=\pgfplots@plot@domain
5432 \pgfkeyssetvalue{/pgfplots/y domain}{\pgfkeysvalueof{/pgfplots/domain}}%
5433 \fi
5434 \ifx\pgfplots@plot@samples@y\pgfutil@empty
5435 \else
5436 \ifnum\pgfplots@plot@samples@y<2
5437 \def\b@pgfplots@should@sample@LINE{1}%
5438 \fi
5439 \fi
5440 \else
5441 \def\b@pgfplots@should@sample@LINE{1}%
5442 \fi
5443 \ifx\pgfplots@plot@samples@y\pgfutil@empty
5444 \pgfkeyssetvalue{/pgfplots/samples y}{\pgfkeysvalueof{/pgfplots/samples}}%
5445 \pgfkeysgetvalue{/pgfplots/samples y}\pgfplots@plot@samples@y
5446 \fi
5447 %
5448 \iftikz@plot@raw@gnuplot
5449 % FIXME : verify this case
5450 \else
5451 \pgfkeyssetvalue{/pgfplots/mesh/rows}{\pgfkeysvalueof{/pgfplots/samples y}}%
5452 \ifx\pgfplots@plot@samples@at\pgfutil@empty
5453 \pgfkeyssetvalue{/pgfplots/mesh/cols}{\pgfkeysvalueof{/pgfplots/samples}}%
5454 \else
5455 % FIXME : count number of samples in 'samples at'!
5456 \fi
5457 \fi
5458 \if1\b@pgfplots@should@sample@LINE
5459 \pgfkeyssetvalue{/pgfplots/sample dim}{1}%
5460 \pgfkeyslet{/pgfplots/mesh/rows}\pgfplots@plot@samples
5461 \pgfkeyssetvalue{/pgfplots/mesh/cols}{1}%
5462 \else
5463 \pgfkeyssetvalue{/pgfplots/sample dim}{2}%
5464 \fi
5465 %
5466 }%
5467
5468 % Plot expression. It invokes the pgf math parser and a customized
5469 % pgfplots point sampling routine. Combined with the 'fixed point
5470 % library' of pgf, it results in highly accurate plots.
5471 %
5472 %
5473 \long\def\pgfplots@addplotimpl@expression#1#2(#3,#4)#5;{\pgfplots@addplotimpl@expression@{#1}{#2}{#3}{#4}{#5}}%
5474 % \addplot[#1] [#2] (#3,#4) #5;
5475 \long\def\pgfplots@addplotimpl@expression@#1#2#3#4#5{%
5476 \pgfplots@addplotimpl@expression@set@options{#1}{#2}%
5477 \pgfplots@addplotimpl@expression@@{#3}{#4}{#5}%
5478 }
5479
5480 \long\def\pgfplots@addplotimpl@expression@set@options#1#2{%
5481 \def\pgfplotssurveyphaseinputclass{expression}%
5482 \pgfplots@start@plot@with@behavioroptions{%
5483 #1,%
5484 /pgfplots/.cd,%
5485 #2,%
5486 /utils/exec={%
5487 \if0\pgfplotsplothandlermesh@matrixinput
5488 % mesh input=patches unsupported in this context.
5489 \pgfkeysalso{/pgfplots/mesh input=lattice}%
5490 \fi
5491 },%
5492 /pgfplots/mesh/ordering/x varies%
5493 }%
5494 \pgfplots@plot@expression@preparekeys
5495 }%
5496
5497 % \addplot (#1,#2) #3;
5498 \long\def\pgfplots@addplotimpl@expression@@#1#2#3{%
5499 %
5500 \pgfplots@PREPARE@COORD@STREAM{#3}%
5501 %
5502 \def\pgfplots@addplotimpl@expression@xEXPR{#1}%
5503 %
5504 % Determine whether the x range is parameterized or uniform and
5505 % prepare a macro which assigns \pgfplots@current@point@x:
5506 \def\pgfplots@addplotimpl@expression@prepare@x{%
5507 \pgfmathparse{#1}%
5508 \let\pgfplots@current@point@x=\pgfmathresult
5509 }%
5510 \def\pgfplots@addplotimpl@expression@prepare@y{%
5511 \pgfmathparse{\pgfplots@addplotimpl@expression@yEXPR}%
5512 \let\pgfplots@current@point@y=\pgfmathresult
5513 }%
5514 \def\pgfplots@addplotimpl@expression@hasuniform@x{0}%
5515 % do we have '\x' as x coordinate?
5516 \expandafter\def\expandafter\pgfplots@loc@TMPb\expandafter{\tikz@plot@var}%
5517 \ifx\pgfplots@addplotimpl@expression@xEXPR\pgfplots@loc@TMPb
5518 \def\pgfplots@addplotimpl@expression@hasuniform@x{1}%
5519 \else
5520 \edef\pgfplots@loc@TMPb{\pgfplots@plot@var@nonmacro}%
5521 % do we have 'x' as x coordinate?
5522 \ifx\pgfplots@addplotimpl@expression@xEXPR\pgfplots@loc@TMPb
5523 \def\pgfplots@addplotimpl@expression@hasuniform@x{1}%
5524 \fi
5525 \fi
5526 \if\pgfplots@addplotimpl@expression@hasuniform@x1%
5527 % if '#1' is '\x' or 'x', we don't need the math parser -
5528 % we can simply take \tikz@plot@var.
5529 \def\pgfplots@addplotimpl@expression@prepare@x{%
5530 \edef\pgfplots@current@point@x{\tikz@plot@var}%
5531 }%
5532 \fi
5533 %
5534 \def\pgfplots@addplotimpl@expression@hasuniform@y{0}%
5535 %
5536 %
5537 %
5538 % if(
5539 % x is logarithmic &&
5540 % #1 == '\x' &&
5541 % the 'samples at' key has not been used )
5542 % -> sample logarithmically!
5543 \def\pgfplots@samples@logarithmically@x{0}%
5544 \ifpgfplots@xislinear
5545 \else
5546 \if\pgfplots@addplotimpl@expression@hasuniform@x1%
5547 \ifx\pgfplots@plot@samples@at\pgfutil@empty
5548 % we don't have 'samples at' -> use domain!
5549 \def\pgfplots@samples@logarithmically@x{1}%
5550 \fi
5551 \fi
5552 \fi
5553 %
5554 \def\pgfplots@samples@logarithmically@y{0}%
5555 %
5556 % Now, prepare the loops.
5557 %
5558 % I am using \pgfplotsforeachungrouped in favor of
5559 % \foreach because \foreach does NOT allow extended
5560 % precision. Besides, \pgfplotsforeachungrouped avoids
5561 % scoping problems.
5562 \let\pgfplots@plot@data@notify@next@x=\relax
5563 \let\pgfplots@plot@data@notify@next@y=\relax
5564 %
5565 \ifpgfplots@curplot@threedim
5566 \def\pgfplots@addplotimpl@expression@split@yz##1,##2\pgfplots@EOI{%
5567 \def\pgfplots@addplotimpl@expression@yEXPR{##1}%
5568 \def\pgfplots@addplotimpl@expression@zEXPR{##2}%
5569 }%
5570 \pgfplots@addplotimpl@expression@split@yz#2\pgfplots@EOI%
5571 %
5572 % do we have '\y' as y coordinate?
5573 \expandafter\def\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@plot@var@y}%
5574 \ifx\pgfplots@addplotimpl@expression@yEXPR\pgfplots@loc@TMPb
5575 \def\pgfplots@addplotimpl@expression@hasuniform@y{1}%
5576 \def\pgfplots@addplotimpl@expression@prepare@y{%
5577 \edef\pgfplots@current@point@y{\pgfplots@plot@var@y}%
5578 }%
5579 \else
5580 \edef\pgfplots@loc@TMPb{\pgfplots@plot@var@y@nonmacro}%
5581 % do we have 'y' as y coordinate?
5582 \ifx\addplotimpl@expression@yEXPR\pgfplots@loc@TMPb
5583 \def\pgfplots@addplotimpl@expression@hasuniform@y{1}%
5584 \def\pgfplots@addplotimpl@expression@prepare@y{%
5585 \edef\pgfplots@current@point@y{\pgfplots@plot@var@y}%
5586 }%
5587 \fi
5588 \fi
5589 %
5590 \ifpgfplots@yislinear
5591 \else
5592 \if\pgfplots@addplotimpl@expression@hasuniform@y1%
5593 \def\pgfplots@samples@logarithmically@y{1}%
5594 \fi
5595 \fi
5596 %
5597 \ifpgfplots@threedim@log@sampling
5598 \else
5599 \def\pgfplots@samples@logarithmically@x{0}%
5600 \def\pgfplots@samples@logarithmically@y{0}%
5601 \fi
5602 %
5603 \if\pgfplots@samples@logarithmically@x1%
5604 \else
5605 \ifx\pgfplots@plot@samples@at\pgfutil@empty
5606 % we don't have 'samples at' -> use domain!
5607 \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@domain\relax{\pgfplots@plot@samples}%
5608 \let\pgfplots@expression@xdomain=\pgfplotsretval
5609 \else
5610 % use 'samples at':
5611 \let\pgfplots@expression@xdomain=\pgfplots@plot@samples@at
5612 \fi
5613 \fi
5614 %
5615 \if\pgfplots@samples@logarithmically@x1%
5616 \if\pgfplots@samples@logarithmically@y1%
5617 \pgfplots@warning{Sorry, 3d log sampling in BOTH x and y is not implemented yet}%
5618 \def\pgfplots@samples@logarithmically@y{0}%
5619 \fi
5620 \fi
5621 %
5622 \if0\b@pgfplots@should@sample@LINE
5623 % Samples twodimensionally (a lattice):
5624 \if\pgfplots@samples@logarithmically@y0%
5625 \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@ydomain\relax{\pgfplots@plot@samples@y}%
5626 \let\pgfplots@expression@ydomain=\pgfplotsretval
5627 \fi
5628 %
5629 % Assemble a
5630 % \pgfplots@plot@data##1 ->
5631 % \foreach \y in {-5,-4.6,...,5} {##1};
5632 % \foreach \x in {-5,-4.6,...,5}
5633 % macro:
5634 \if\pgfplots@samples@logarithmically@x0%
5635 \if\pgfplots@samples@logarithmically@y0%
5636 % standard case: no log sampling.
5637 \edef\pgfplots@plot@data##1{%
5638 \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\pgfplots@plot@var@y in {\pgfplots@expression@ydomain}
5639 {%
5640 \pgfplots@plot@data@notify@next@y
5641 \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@expression@xdomain} {%
5642 \pgfplots@plot@data@notify@next@x
5643 ##1%
5644 }%
5645 \noexpand\pgfplotsplothandlernotifyscanlinecomplete
5646 }%
5647 }%
5648 \fi
5649 \fi
5650 \if\pgfplots@samples@logarithmically@x1%
5651 \if\pgfplots@samples@logarithmically@y0%
5652 % sample logarithmically in X:
5653 \edef\pgfplots@plot@data##1{%
5654 \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\pgfplots@plot@var@y in {\pgfplots@expression@ydomain}
5655 {%
5656 \pgfplots@plot@data@notify@next@y
5657 %
5658 \noexpand\pgfplotsforeachlogarithmicungrouped[\pgfplots@plot@samples][x]
5659 \expandafter\noexpand\tikz@plot@var/\noexpand\pgfplots@current@point@x@log
5660 in {\pgfplots@plot@domain}%
5661 {%
5662 \pgfplots@plot@data@notify@next@x
5663 ##1%
5664 }%
5665 \noexpand\pgfplotsplothandlernotifyscanlinecomplete
5666 }%
5667 }%
5668 \fi
5669 \fi
5670 \if\pgfplots@samples@logarithmically@x0%
5671 \if\pgfplots@samples@logarithmically@y1%
5672 % sample logarithmically in Y:
5673 \edef\pgfplots@plot@data##1{%
5674 \noexpand\pgfplotsforeachlogarithmicungrouped[\pgfplots@plot@samples@y][y]
5675 \expandafter\noexpand\pgfplots@plot@var@y/\noexpand\pgfplots@current@point@y@log
5676 in {\pgfplots@plot@ydomain}%
5677 {%
5678 \pgfplots@plot@data@notify@next@y
5679 \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@expression@xdomain} {%
5680 \pgfplots@plot@data@notify@next@x
5681 ##1%
5682 }%
5683 \noexpand\pgfplotsplothandlernotifyscanlinecomplete
5684 }%
5685 }%
5686 \fi
5687 \fi
5688 \if\pgfplots@samples@logarithmically@x1%
5689 \if\pgfplots@samples@logarithmically@y1%
5690 % sample logarithmically in X and Y:
5691 % FIXME : IMPLEMENT!
5692 % FIXME : implementation UNFINISHED: also support log
5693 % sampling in BOTH 'x' 'y'!
5694 % requires to solve FIXME in \pgfplotsforeachlogarithmicungrouped)
5695 % -> also adopt unittest_log_sampling_3d.tex
5696 %
5697 \fi
5698 \fi
5699 \else
5700 % sample a line:
5701 \def\pgfplots@plot@ydomain{0:0}%
5702 \if\pgfplots@samples@logarithmically@x1%
5703 % sample logarithmically:
5704 \edef\pgfplots@plot@data##1{%
5705 \noexpand\pgfplotsforeachlogarithmicungrouped[\pgfplots@plot@samples][x]
5706 \expandafter\noexpand\tikz@plot@var/\noexpand\pgfplots@current@point@x@log
5707 in {\pgfplots@plot@domain}%
5708 {%
5709 \pgfplots@plot@data@notify@next@x
5710 ##1%
5711 }%
5712 }%
5713 \else
5714 \edef\pgfplots@plot@data##1{%
5715 \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@expression@xdomain} {%
5716 \pgfplots@plot@data@notify@next@x
5717 ##1%
5718 }%
5719 }%
5720 \fi
5721 %
5722 % If we have (\x,\y,f(x)), use (\x,0,f(x)) instead and
5723 % suppress the error message which would occur for \y.
5724 \if1\pgfplots@addplotimpl@expression@hasuniform@y
5725 \def\pgfplots@addplotimpl@expression@yEXPR{0}%
5726 \def\pgfplots@plot@var@y{0}%
5727 \else
5728 \expandafter\edef\pgfplots@plot@var@y{\pgfplots@plot@var@y@nonmacro}% this provides an error message, see above.
5729 \fi
5730 \fi
5731 \else
5732 % Assemble a
5733 % \pgfplots@plot@data##1 -> \foreach \x in {-5,-4.6,...,5} {##1} macro:
5734 \if\pgfplots@samples@logarithmically@x1%
5735 % sample logarithmically:
5736 \edef\pgfplots@plot@data##1{%
5737 \noexpand\pgfplotsforeachlogarithmicungrouped[\pgfplots@plot@samples][x]
5738 \expandafter\noexpand\tikz@plot@var/\noexpand\pgfplots@current@point@x@log
5739 in {\pgfplots@plot@domain}%
5740 {%
5741 \pgfplots@plot@data@notify@next@x
5742 ##1%
5743 }%
5744 }%
5745 \else
5746 \ifx\pgfplots@plot@samples@at\pgfutil@empty
5747 % we don't have 'samples at' -> use domain!
5748 \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@domain\relax{\pgfplots@plot@samples}%
5749 \let\pgfplots@loc@TMPa=\pgfplotsretval
5750 \else
5751 % use 'samples at':
5752 \let\pgfplots@loc@TMPa=\pgfplots@plot@samples@at
5753 \fi
5754 \edef\pgfplots@plot@data##1{%
5755 \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@loc@TMPa}%
5756 {%
5757 \pgfplots@plot@data@notify@next@x
5758 ##1%
5759 }%
5760 }%
5761 \fi
5762 \expandafter\def\pgfplots@plot@var@y{0}%
5763 \def\pgfplots@addplotimpl@expression@yEXPR{#2}%
5764 \def\pgfplots@addplotimpl@expression@zEXPR{}%
5765 \def\pgfplots@current@point@z{}%
5766 \fi
5767 %
5768 %
5769 \if\pgfplots@samples@logarithmically@x1%
5770 % we have a logarithmic sampling sequence,
5771 % \pgfplots@current@point@x@log is already available
5772 % logarithmic! We can safe time and accuracy for the x
5773 % coordinate by using that one instead of computing
5774 % log(exp(\x)) numerically:
5775 \pgfplots@disablelogfilter@xtrue
5776 \def\pgfplots@addplotimpl@expression@prepare@x{%
5777 \let\pgfplots@current@point@x=\pgfplots@current@point@x@log
5778 }%
5779 \pgflibraryfpuifactive
5780 {\relax}
5781 {%
5782 % ok, if the FPU is NOT active, we should return
5783 % results as fixed points.
5784 % We need to configure that for
5785 % \pgfplotsforeachlogarithmicungrouped manually:
5786 \pgfplotsforeachlogarithmicformatresultwith{%
5787 \pgfmathfloattofixed{\pgfmathresult}%
5788 }%
5789 }%
5790 \fi
5791 \if\pgfplots@samples@logarithmically@y1%
5792 % we have a logarithmic sampling sequence,
5793 % \pgfplots@current@point@y@log is already available
5794 % logarithmic! We can safe time and accuracy for the y
5795 % coordinate by using that one instead of computing
5796 % log(exp(\y)) numerically:
5797 \pgfplots@disablelogfilter@ytrue
5798 \def\pgfplots@addplotimpl@expression@prepare@y{%
5799 \let\pgfplots@current@point@y=\pgfplots@current@point@y@log
5800 }%
5801 \pgflibraryfpuifactive
5802 {\relax}
5803 {%
5804 % ok, if the FPU is NOT active, we should return
5805 % results as fixed points.
5806 % We need to configure that for
5807 % \pgfplotsforeachlogarithmicungrouped manually:
5808 \pgfplotsforeachlogarithmicformatresultwith{%
5809 \pgfmathfloattofixed{\pgfmathresult}%
5810 }%
5811 }%
5812 \fi
5813 % START:
5814 % (NOTE: this does also define 'x', 'y', and 'z' math
5815 % expressions!)
5816 \pgfplots@coord@stream@start
5817 %
5818 \pgfplots@addplotimpl@expression@check@LUA
5819 \if1\pgfplotsretval
5820 \pgfplots@log{\pgfplots@LUA@loglevel@debug}{lua backend=true: Activating LUA version of plot expression for plot \the\pgfplots@numplots\space (type '\pgfplotsplothandlername').}%
5821 \begingroup
5822 \expandafter\def\tikz@plot@var{\pgfplots@plot@var@nonmacro}%
5823 \expandafter\def\pgfplots@plot@var@y{\pgfplots@plot@var@y@nonmacro}%
5824 \expandafter\pgfplots@parse@domain\pgfplots@plot@domain\relax{pgfplots@plot@domain}%
5825 %
5826 \if0\b@pgfplots@should@sample@LINE
5827 \expandafter\pgfplots@parse@domain\pgfplots@plot@ydomain\relax{pgfplots@plot@ydomain}%
5828 \else
5829 \def\pgfplots@plot@ydomain@min{0}%
5830 \def\pgfplots@plot@ydomain@max{0}%
5831 \def\pgfplots@plot@samples@y{1}%
5832 \fi
5833 %
5834 % FIXME : there are some cases in which this here might be a
5835 % bad idea:
5836 % - if someone has redefined math functions on TeX
5837 % - if someone has defined his own math functions (only in
5838 % TeX)
5839 % - if a plot expression contains directlua -- the expansion will play
5840 % funny tricks in this case
5841 \xdef\pgfplotsglobalretval{%
5842 \pgfplotsutil@directlua{%
5843 pgfplots.texAddplotExpressionCoordinateGenerator(^^J%
5844 \ifpgfplots@curplot@threedim true \else false\fi,^^J%
5845 "#1", ^^J%
5846 "\pgfplots@addplotimpl@expression@yEXPR",^^J%
5847 "\pgfplots@addplotimpl@expression@zEXPR",^^J%
5848 \b@pgfplots@should@sample@LINE,^^J%
5849 "\pgfplots@plot@domain@min", "\pgfplots@plot@domain@max",^^J%
5850 "\pgfplots@plot@ydomain@min", "\pgfplots@plot@ydomain@max",^^J%
5851 "\pgfplots@plot@samples",^^J%
5852 "\pgfplots@plot@samples@y",^^J%
5853 "\pgfplots@plot@var@nonmacro",^^J%
5854 "\pgfplots@plot@var@y@nonmacro",
5855 "\pgfplots@plot@samples@at",
5856 "\pgfplots@LUA@backend@debugmode")^^J%
5857 }%
5858 }%
5859 \endgroup
5860 \if0\pgfplotsglobalretval
5861 \pgfplots@log{\pgfplots@LUA@loglevel@info}{lua backend=true: LUA version of plot expression failed. Using TeX version. (plot \the\pgfplots@numplots).}%
5862 \pgfplots@LUA@backend@failed
5863 \pgfplots@addplotimpl@expression@streamall
5864 \else
5865 \fi
5866 \else
5867 \pgfplots@addplotimpl@expression@streamall
5868 \fi
5869 %
5870 \pgfplots@coord@stream@end
5871 }%
5872
5873 % Defines \pgfplotsretval to be '1' if the pure LUA version of
5874 % \addplot expression is enabled. It defines \pgfplotsretval to be 0
5875 % if not.
5876 \def\pgfplots@addplotimpl@expression@check@LUA{%
5877 \def\pgfplotsretval{0}%
5878 \ifpgfplots@LUA@backend@supported
5879 \def\pgfplotsretval{1}%
5880 \ifpgfplotsplothandlermesh@patch@type@sampling
5881 \def\pgfplotsretval{0}%
5882 \pgfplots@LUA@plotexpression@log@deactivation{patch type sampling unsupported (yet)}%
5883 \fi
5884 %
5885 \if1\pgfplots@addplotimpl@expression@hasuniform@x
5886 \else
5887 \expandafter\pgfplotsutilifcontainsmacro\expandafter{\pgfplots@addplotimpl@expression@xEXPR}{%
5888 \def\pgfplotsretval{0}%
5889 \pgfplots@command@to@string\pgfplots@addplotimpl@expression@xEXPR\pgfplots@loc@TMPa
5890 \pgfplots@LUA@plotexpression@log@deactivation{x expression '\pgfplots@loc@TMPa' contains a TeX macro}%
5891 }{%
5892 }%
5893 \fi
5894 %
5895 \ifx\pgfplots@plot@samples@at\pgfutil@empty
5896 \else
5897 \def\pgfplotsretval{0}%
5898 \pgfplots@LUA@plotexpression@log@deactivation{samples at unsupported (yet)}%
5899 \fi
5900 %
5901 \if1\pgfplots@addplotimpl@expression@hasuniform@y
5902 \else
5903 \expandafter\pgfplotsutilifcontainsmacro\expandafter{\pgfplots@addplotimpl@expression@yEXPR}{%
5904 \def\pgfplotsretval{0}%
5905 \pgfplots@command@to@string\pgfplots@addplotimpl@expression@yEXPR\pgfplots@loc@TMPa
5906 \pgfplots@LUA@plotexpression@log@deactivation{y expression '\pgfplots@loc@TMPa' contains a TeX macro}%
5907 }{%
5908 }%
5909 \fi
5910 %
5911 \ifpgfplots@curplot@threedim
5912 \expandafter\pgfplotsutilifcontainsmacro\expandafter{\pgfplots@addplotimpl@expression@zEXPR}{%
5913 \def\pgfplotsretval{0}%
5914 \pgfplots@command@to@string\pgfplots@addplotimpl@expression@zEXPR\pgfplots@loc@TMPa
5915 \pgfplots@LUA@plotexpression@log@deactivation{z expression '\pgfplots@loc@TMPa' contains a TeX macro}%
5916 }{%
5917 }%
5918 \fi
5919 \fi
5920 }%
5921
5922 \def\pgfplots@LUA@plotexpression@log@deactivation#1{%
5923 \pgfplots@log{\pgfplots@LUA@loglevel@info}{Deactivating LUA version of plot expression for plot \the\pgfplots@numplots\space (type '\pgfplotsplothandlername'): #1.}%
5924 \pgfplots@LUA@backend@failed
5925 }
5926 \def\pgfplots@parse@domain#1:#2\relax#3{%
5927 \pgfmathparse{#1}%
5928 \expandafter\let\csname #3@min\endcsname=\pgfmathresult%
5929 \pgfmathparse{#2}%
5930 \expandafter\let\csname #3@max\endcsname=\pgfmathresult%
5931 }%
5932 \def\pgfplots@addplotimpl@expression@streamall{%
5933 % create a backup of the 'x' and 'y' math expressions which
5934 % have been defined in \pgfplots@coord@stream@start:
5935 \let\pgfplots@addplotimpl@expression@pseudoconst@old@x=\pgfmathx@
5936 \let\pgfplots@addplotimpl@expression@pseudoconst@old@y=\pgfmathy@
5937 %
5938 % Prepare 'x' and 'y' as pseudo constants in expressions:
5939 \gdef\pgfplots@noy@error{%
5940 \pgfplots@error{Sorry, you can't use 'y' in this context. PGFPlots expected to sample a line, not a mesh. Please use the [mesh] option combined with [samples y>0] and [domain y!=0:0] to indicate a twodimensional input domain}%
5941 \global\let\pgfplots@noy@error=\relax
5942 }%
5943 % Define a "function" x which sets \pgfmathresult := \x :
5944 \pgfplotsmathdeclarepseudoconstant{\pgfplots@plot@var@nonmacro}{\edef\pgfmathresult{\tikz@plot@var}}%
5945 \if0\b@pgfplots@should@sample@LINE
5946 % surface:
5947 \pgfplotsmathdeclarepseudoconstant{\pgfplots@plot@var@y@nonmacro}{\edef\pgfmathresult{\pgfplots@plot@var@y}}%
5948 \else
5949 \pgfplotsmathdeclarepseudoconstant{\pgfplots@plot@var@y@nonmacro}{\pgfplots@noy@error\def\pgfmathresult{0.0}}%
5950 \fi
5951 % remember them here:
5952 \let\pgfplots@addplotimpl@expression@pseudoconst@x=\pgfmathx@
5953 \let\pgfplots@addplotimpl@expression@pseudoconst@y=\pgfmathy@
5954 %
5955 % \if n\pgfplots@meshmode
5956 % mesh=false : ignore patch type sampling.
5957 % \else
5958 \ifpgfplotsplothandlermesh@patch@type@sampling
5959 \pgfplots@plot@expression@prepare@patch@type@sampling
5960 \fi
5961 % \fi
5962 %
5963 % Warning for use fpu=false: evaluation '\x^3' might be different from 'x^3' for
5964 % negative arguments:
5965 % \x^3 ---> -0.2^3 but x^3 = (-0.2)^3 .
5966 % This does not happen for use fpu=true.
5967 %
5968 \pgfplots@plot@data{%
5969 \let\pgfmathx@=\pgfplots@addplotimpl@expression@pseudoconst@x
5970 \let\pgfmathy@=\pgfplots@addplotimpl@expression@pseudoconst@y
5971 % eval expressions:
5972 \pgfplots@addplotimpl@expression@prepare@x%
5973 \pgfplots@addplotimpl@expression@prepare@y%
5974 \ifpgfplots@curplot@threedim
5975 \pgfmathparse{\pgfplots@addplotimpl@expression@zEXPR}%
5976 \let\pgfplots@current@point@z=\pgfmathresult
5977 \fi
5978 % restore 'x' and 'y':
5979 \let\pgfmathx@=\pgfplots@addplotimpl@expression@pseudoconst@old@x
5980 \let\pgfmathy@=\pgfplots@addplotimpl@expression@pseudoconst@old@y
5981 %
5982 %\pgfplots@expression@normalize@floats
5983 %
5984 % process coords as usual:
5985 \pgfplots@coord@stream@coord
5986 }%
5987 }
5988
5989 % Typically, the FPU will generate stuff like '1Y1.0e5'. Since such
5990 % internal representations will be available to API users (especially
5991 % 'x filter' and its variants, we want to simplify its output - by
5992 % normalizing it.
5993 %
5994 % This routine will convert any floats to scientific format, i.e.
5995 % 1.0e5 instead of 1Y1.0e5 (1Y means 'positive float', compare
5996 % pgfmathfloat.code.tex).
5997 \def\pgfplots@expression@normalize@floats{%
5998 \pgflibraryfpuifactive{%
5999 \ifx\pgfplots@current@point@x\pgfutil@empty\else
6000 \pgfmathfloattosci{\pgfplots@current@point@x}\let\pgfplots@current@point@x=\pgfmathresult
6001 \fi%
6002 \ifx\pgfplots@current@point@y\pgfutil@empty\else
6003 \pgfmathfloattosci{\pgfplots@current@point@y}\let\pgfplots@current@point@y=\pgfmathresult
6004 \fi%
6005 \ifx\pgfplots@current@point@z\pgfutil@empty\else
6006 \pgfmathfloattosci{\pgfplots@current@point@z}\let\pgfplots@current@point@z=\pgfmathresult
6007 \fi%
6008 }{%
6009 }%
6010 }%
6011
6012 % \addplot[#1] [#2] {#3} #4;
6013 \long\def\pgfplots@addplotimpl@expression@curly#1#2#3#4;{\pgfplots@addplotimpl@expression@curly@{#1}{#2}{#3}{#4}}%
6014 \long\def\pgfplots@addplotimpl@expression@curly@#1#2#3#4{%
6015 \pgfplots@addplotimpl@expression@set@options{#1}{#2}%
6016 \ifpgfplots@curplot@threedim
6017 \t@pgfplots@toka={,#3}%
6018 % the \pgfplots@plot@var@y will expand to the current value of
6019 % '/pgfplots/variable y'.
6020 % Keep it this way, \pgfplots@addplotimpl@expression@ checks
6021 % for that special string.
6022 \edef\pgfplots@loc@TMPb{%
6023 {\expandafter\noexpand\tikz@plot@var}%
6024 {\expandafter\noexpand\pgfplots@plot@var@y\the\t@pgfplots@toka}%
6025 }%
6026 \expandafter\pgfplots@addplotimpl@expression@@\pgfplots@loc@TMPb{#4}%
6027 \else
6028 \expandafter\pgfplots@addplotimpl@expression@@\expandafter{\tikz@plot@var}{#3}{#4}%
6029 \fi
6030 }%
6031 % \addplot[#1] [#2] expression[#3] {#4} #5;
6032 \def\pgfplots@addplotimpl@expression@e#1#2expression{%
6033 \pgfplotsutil@ifnextchar[{%
6034 \pgfplots@addplotimpl@expression@e@{#1}{#2}%
6035 }{%
6036 \pgfplots@addplotimpl@expression@e@{#1}{#2}[]%
6037 }%
6038 }%
6039 \def\pgfplots@addplotimpl@expression@e@#1#2[#3]{%
6040 \pgfplots@addplotimpl@expression@curly{#1}{#2,#3}%
6041 }%
6042
6043
6044 % This prepares the implementation for 'patch type sampling':
6045 \def\pgfplots@plot@expression@prepare@patch@type@sampling{%
6046 \pgfplotssurveyphaseaddoptionsbeforesurveybegins{
6047 mesh input=patches,%
6048 }%
6049 %
6050 \pgfkeysgetvalue{/pgfplots/patch type}\pgfplotsplothandlermesh@patchclass
6051 %
6052 \let\pgfplots@plot@data@@=\pgfplots@plot@data
6053 \let\pgfplots@plot@data@curx=\pgfutil@empty
6054 \let\pgfplots@plot@data@cury=\pgfutil@empty
6055 \let\pgfplots@plot@data@lastx=\pgfutil@empty
6056 \let\pgfplots@plot@data@lasty=\pgfutil@empty
6057 \let\pgfplots@plot@data@first@x=\pgfutil@empty
6058 \let\pgfplots@plot@data@first@y=\pgfutil@empty
6059 %
6060 \def\pgfplots@plot@data@notify@next@x{%
6061 \ifx\pgfplots@plot@data@first@x\pgfutil@empty
6062 \edef\pgfplots@plot@data@first@x{\tikz@plot@var}%
6063 \fi
6064 \let\pgfplots@plot@data@lastx=\pgfplots@plot@data@curx
6065 \edef\pgfplots@plot@data@curx{\tikz@plot@var}%
6066 }%
6067 \def\pgfplots@plot@data@notify@next@y{%
6068 \ifx\pgfplots@plot@data@first@y\pgfutil@empty
6069 \edef\pgfplots@plot@data@first@y{\pgfplots@plot@var@y}%
6070 \fi
6071 \let\pgfplots@plot@data@lasty=\pgfplots@plot@data@cury
6072 \edef\pgfplots@plot@data@cury{\pgfplots@plot@var@y}%
6073 }%
6074 \def\pgfplots@plot@data##1{%
6075 %
6076 \pgfplots@plot@data@@{%
6077 \let\tikz@plot@var@old=\tikz@plot@var
6078 \let\pgfplots@plot@var@y@old=\pgfplots@plot@var@y
6079 %
6080 %
6081 %
6082 % boolean 'if is first row || is first cell':
6083 \pgfplots@loc@tmpfalse
6084 \ifx\pgfplots@plot@data@curx\pgfplots@plot@data@first@x
6085 % ah - we have the first row.
6086 \pgfplots@loc@tmptrue
6087 \fi
6088 \if0\b@pgfplots@should@sample@LINE
6089 \ifx\pgfplots@plot@data@cury\pgfplots@plot@data@first@y
6090 % ah - we have the first cell.
6091 \pgfplots@loc@tmptrue
6092 \fi
6093 \fi
6094 %
6095 \ifpgfplots@loc@tmp
6096 \else
6097 \pgfmathparse{\pgfplots@plot@data@curx-\pgfplots@plot@data@lastx}%
6098 \let\pgfplots@plot@data@hx=\pgfmathresult
6099 %
6100 \if0\b@pgfplots@should@sample@LINE
6101 \pgfmathparse{\pgfplots@plot@data@cury-\pgfplots@plot@data@lasty}%
6102 \let\pgfplots@plot@data@hy=\pgfmathresult
6103 \fi
6104 %
6105 \def\pgfplotspatchready{\pgfplotsscanlinecomplete}%
6106 \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{sample in unit cube}{%
6107 \pgfmathparse{\pgfplots@plot@data@lastx + \pgfplotspatchclassx*\pgfplots@plot@data@hx}%
6108 \let\tikz@plot@var=\pgfmathresult
6109 %
6110 \if0\b@pgfplots@should@sample@LINE
6111 \pgfmathparse{\pgfplots@plot@data@lasty + \pgfplotspatchclassy*\pgfplots@plot@data@hy}%
6112 \let\pgfplots@plot@var@y=\pgfmathresult
6113 \fi
6114 %
6115 ##1%
6116 %
6117 \let\tikz@plot@var=\tikz@plot@var@old
6118 \let\pgfplots@plot@var@y=\pgfplots@plot@var@y@old
6119 }%
6120 \fi
6121 }%
6122 }%
6123 }%
6124
6125 \let\pgfplots@backupof@pgfplotxyfile=\pgfplotxyfile
6126
6127 % the following code
6128 % results finally in
6129 %
6130 % set format "%.7e";; set samples <...>; plot ...
6131 %
6132 % The windows port of gnuplot doesn't run without the second semicolon
6133 % - for whatever reason.
6134 {
6135 \catcode`\%=12
6136 \catcode`\"=12
6137 \catcode`\;=12
6138 \xdef\pgfplots@gnuplot@format{set format "%.7e";}
6139 }
6140 \def\pgfplots@addplotimpl@g#1#2g{%
6141 \pgfplotsutil@ifnextchar r{%
6142 \pgfplots@addplotimpl@graphics{#1}{#2}%
6143 }{%
6144 \pgfplots@addplotimpl@gnuplot{#1}{#2}%
6145 }%
6146 }%
6147
6148 % |\addplot gnuplot| is an alias to |\addplot function|
6149 \def\pgfplots@addplotimpl@gnuplot#1#2nuplot{\pgfplots@addplotimpl@function{#1}{#2}unction}%
6150
6151 % \addplot[#1] plot[#2] function[#3] {#4} #5;
6152 \def\pgfplots@addplotimpl@function#1#2unction{%
6153 \pgfplotsutil@ifnextchar[{%
6154 \pgfplots@addplotimpl@function@opt{#1}{#2}%
6155 }{%
6156 \pgfplots@addplotimpl@function@opt{#1}{#2}[]%
6157 }%
6158 }%
6159 \def\pgfplots@addplotimpl@function@opt#1#2[#3]#4#5;{\pgfplots@addplotimpl@function@opt@{#1}{#2}{#3}{#4}{#5}}%
6160 % \addplot[#1] [#2] function[#3] {#4} #5;
6161 \def\pgfplots@addplotimpl@function@opt@#1#2#3#4#5{%
6162 % FIXME : what about the key search paths if the user changes
6163 % them!?
6164 \def\pgfplotssurveyphaseinputclass{gnuplot}%
6165 \pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2,/pgfplots/.cd,#3,/pgfplots/mesh/ordering/x varies}%
6166 %
6167 \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}%
6168 \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-plot}%
6169 \pgfplots@gettikzinternal@keyval{raw gnuplot}{iftikz@plot@raw@gnuplot}{\iffalse}%
6170 \pgfplots@gettikzinternal@keyval{parametric}{iftikz@plot@parametric}{\iffalse}%
6171 %
6172 % determine dummy variables:
6173 \iftikz@plot@parametric
6174 \ifpgfplots@curplot@threedim
6175 \pgfkeysgetvalue{/pgfplots/parametric/var 2d}\pgfplots@gnuplot@dummy%
6176 \else
6177 \pgfkeysgetvalue{/pgfplots/parametric/var 1d}\pgfplots@gnuplot@dummy%
6178 \fi
6179 \ifx\pgfplots@gnuplot@dummy\pgfutil@empty
6180 \else
6181 \expandafter\pgfutil@in@\expandafter,\expandafter{\pgfplots@gnuplot@dummy}%
6182 \ifpgfutil@in@
6183 \def\pgfplots@loc@TMPa##1,##2\pgfeov{\pgfplotsset{variable={##1},variable y={##2}}}%
6184 \else
6185 \def\pgfplots@loc@TMPa##1\pgfeov{\pgfplotsset{variable={##1}}}%
6186 \fi
6187 \expandafter\pgfplots@loc@TMPa\pgfplots@gnuplot@dummy\pgfeov
6188 \fi
6189 \fi
6190 %
6191 % prepare domain and samples, normalize dummy variables:
6192 \pgfplots@plot@expression@preparekeys
6193 %
6194 % FIXME: what with 'samples at'!?
6195 \edef\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}%
6196 %
6197 \def\pgfplots@addplotimpl@gnuplotresult@isthreedim@withtwocoords{0}%
6198 %
6199 \edef\pgfplots@gnuplotcode{#4}%
6200 \ifpgfplots@translategnuplot
6201 \def\pgfplots@loc@TMPa{\pgfplotsutilstrreplace{^}{**}}%
6202 \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@gnuplotcode}%
6203 \let\pgfplots@gnuplotcode=\pgfplotsretval
6204 \fi
6205 %
6206 %
6207 \iftikz@plot@raw@gnuplot%
6208 \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{\pgfplots@gnuplot@format;\pgfplots@gnuplotcode}}%
6209 \else%
6210 % collect logs:
6211 \def\pgfplots@gnuplot@logdirs{}%
6212 \ifpgfplots@xislinear
6213 \else
6214 \pgfplots@identify@gnuplot@logbehavior x%
6215 \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs x}%
6216 \fi
6217 \ifpgfplots@yislinear
6218 \else
6219 \pgfplots@identify@gnuplot@logbehavior y%
6220 \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs y}%
6221 \fi
6222 \ifpgfplots@curplot@threedim
6223 \ifpgfplots@zislinear
6224 \else
6225 \pgfplots@identify@gnuplot@logbehavior z%
6226 \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs z}%
6227 \fi
6228 \fi
6229 %
6230 \ifpgfplots@curplot@threedim
6231 \if1\b@pgfplots@should@sample@LINE
6232 \pgfplots@error{Sorry, I do not know how to sample 3D LINE plots with gnuplot... I only know 2D line and 3D mesh. You may want to help the author of pgfplots to improve this feature.}%
6233 \fi
6234 \fi
6235 \def\pgfplots@gnuplot@x{\pgfplots@plot@var@nonmacro}%
6236 \def\pgfplots@gnuplot@y{\pgfplots@plot@var@y@nonmacro}%
6237 \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{%
6238 \pgfplots@gnuplot@format;
6239 set samples \pgfkeysvalueof{/pgfplots/samples}\if0\b@pgfplots@should@sample@LINE, \pgfkeysvalueof{/pgfplots/samples y}\fi;
6240 set dummy \pgfplots@gnuplot@x\if0\b@pgfplots@should@sample@LINE,\pgfplots@gnuplot@y\fi;
6241 \ifx\pgfplots@gnuplot@logdirs\pgfutil@empty
6242 \else
6243 set logscale \pgfplots@gnuplot@logdirs\space 2.71828182845905;
6244 \fi
6245 \iftikz@plot@parametric set parametric;\fi
6246 \ifpgfplots@curplot@threedim
6247 \if0\b@pgfplots@should@sample@LINE
6248 % Samples twodimensionally (a lattice):
6249 % and the isosamples thing confuses me.
6250 set isosamples \pgfkeysvalueof{/pgfplots/samples}\if0\b@pgfplots@should@sample@LINE, \pgfkeysvalueof{/pgfplots/samples y}\fi;
6251 splot [\pgfplots@gnuplot@x=\pgfplots@plot@domain] [\pgfplots@gnuplot@y=\pgfplots@plot@ydomain] \pgfplots@gnuplotcode;%
6252 \else
6253 % *should* sample a line, but I don't know how.
6254 splot [\pgfplots@gnuplot@x=\pgfplots@plot@domain] \pgfplots@gnuplotcode;%
6255 \fi
6256 \else
6257 plot [\pgfplots@gnuplot@x=\pgfplots@plot@domain] \pgfplots@gnuplotcode;%
6258 \fi
6259 }}%
6260 \fi%
6261 \def\pgfplotxyfile{\pgfplots@addplotimpl@gnuplotresult{#5}}%
6262 \pgfplots@plot@data
6263 \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile
6264 }%
6265
6266 \def\pgfplots@identify@gnuplot@logbehavior#1{%
6267 \pgfutil@ifundefined{pgfplots@gnuplot@logscale@writes@log}{%
6268 \pgfplots@identify@gnuplot@logbehavior@checkversion%
6269 }{}%
6270 \if1\pgfplots@gnuplot@logscale@writes@log
6271 \csname pgfplots@disablelogfilter@#1true\endcsname
6272 \fi
6273 }%
6274 \def\pgfplots@identify@gnuplot@logbehavior@checkversion{%
6275 \begingroup
6276 \pgfplots@shellescape{gnuplot -V >\pgfplots@[email protected]}%
6277 \openin\r@pgfplots@reada=\pgfplots@[email protected]\relax
6278 \ifeof\r@pgfplots@reada
6279 \pgfplotswarning{gnuplot -V impossible}\pgfeov
6280 \gdef\pgfplots@gnuplot@logscale@writes@log{1}% something doesn't work. set it somehow.
6281 \else
6282 \read\r@pgfplots@reada to\pgfplots@loc@TMPa
6283 \gdef\pgfplots@gnuplot@logscale@writes@log{1}%
6284 \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}%
6285 \immediate\write-1{Package pgfplots: checking gnuplot -V : `\the\t@pgfplots@toka' (if this fails, set `/pgfplots/gnuplot writes logscale=true|false')}%
6286 \expandafter\pgfplots@identify@gnuplot@logbehavior@checkversion@\pgfplots@loc@TMPa 0 0.0 0\relax
6287 \if0\pgfplots@gnuplot@logscale@writes@log
6288 \immediate\write-1{Package pgfplots: I found gnuplot version >= 4.4. This one doesn't write log() coordinates. I will apply log() manually.}%
6289 \else
6290 \immediate\write-1{Package pgfplots: I found gnuplot version < 4.4. This one writes log() coordinates. I'll handle it accordingly.}%
6291 \fi
6292 \closein\r@pgfplots@reada
6293 \fi
6294 \endgroup
6295 }%
6296 \long\def\pgfplots@identify@gnuplot@logbehavior@checkversion@{%
6297 \pgfutil@ifnextchar\par{%
6298 \pgfplotswarning{gnuplot -V format unknown}\pgfeov%
6299 \gdef\pgfplots@gnuplot@logscale@writes@log{1}%
6300 \pgfplots@identify@gnuplot@logbehavior@checkversion@@@
6301 }{%
6302 \pgfplots@identify@gnuplot@logbehavior@checkversion@@
6303 }%
6304 }%
6305 \long\def\pgfplots@identify@gnuplot@logbehavior@checkversion@@@#1\relax{%
6306 }%
6307 \long\def\pgfplots@identify@gnuplot@logbehavior@checkversion@@#1 #2.#3 #4\relax{%
6308 % starting with gnuplot 4.4, output files are no longer in
6309 % logarithmic scale for log plots.
6310 \ifnum#2<4
6311 % version 3.X
6312 \gdef\pgfplots@gnuplot@logscale@writes@log{1}%
6313 \else
6314 \ifnum#2>4
6315 % version 5.X
6316 \gdef\pgfplots@gnuplot@logscale@writes@log{0}%
6317 \else
6318 \ifnum#3<4
6319 % version 4.2 :
6320 \gdef\pgfplots@gnuplot@logscale@writes@log{1}%
6321 \else
6322 % version 4.4 or later :
6323 \gdef\pgfplots@gnuplot@logscale@writes@log{0}%
6324 \fi
6325 \fi
6326 \fi
6327 }%
6328
6329 \def\pgfplots@addplotimpl@gnuplotresult#1#2{%
6330 \begingroup
6331 \openin\r@pgfplots@reada=#2
6332 \ifeof\r@pgfplots@reada
6333 \pgfplots@error{Sorry, the gnuplot-result file '#2' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot <file>.gnuplot' manually on the respective gnuplot file.}%
6334 \aftergroup\pgfplots@loop@CONTINUEfalse
6335 \else
6336 \aftergroup\pgfplots@loop@CONTINUEtrue
6337 \fi
6338 \closein\r@pgfplots@reada
6339 \endgroup
6340 \ifpgfplots@loop@CONTINUE
6341 % Now, invoke 'plot file'.
6342 %
6343 % I invoke the private '@opt@' method because the semicolon ';'
6344 % character may cause problems due to catcode mismatches.
6345 % *sigh*.
6346 \let\pgfplots@addplotimpl@file@parsesingle@twodim=\pgfplots@addplotimpl@file@parsesingle@twodim@gnuplotformat
6347 \let\pgfplots@addplotimpl@file@parsesingle@threedim=\pgfplots@addplotimpl@file@parsesingle@threedim@gnuplotformat
6348 \pgfplots@addplotimpl@file@opt@@{}{}{#2}{#1}% this does not invoke the \pgfplots@start@plot@with@behavioroptions method.
6349 \else
6350 \expandafter\pgfplots@end@plot
6351 \fi
6352 }
6353
6354 % \addplot[#1] plot[#2] shell[#3] {#4} #5;
6355 \def\pgfplots@addplotimpl@shell#1#2shell{%
6356 \pgfplotsutil@ifnextchar[{%
6357 \pgfplots@addplotimpl@shell@opt{#1}{#2}%
6358 }{%
6359 \pgfplots@addplotimpl@shell@opt{#1}{#2}[]%
6360 }%
6361 }%
6362 \def\pgfplots@addplotimpl@shell@opt#1#2[#3]#4#5;{\pgfplots@addplotimpl@shell@opt@{#1}{#2}{#3}{#4}{#5}}%
6363 % \addplot[#1] [#2] shell[#3] {#4} #5;
6364 \def\pgfplots@addplotimpl@shell@opt@#1#2#3#4#5{%
6365 \def\pgfplotssurveyphaseinputclass{shell}%
6366 \pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2,/pgfplots/.cd,#3}%
6367 \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}%
6368 \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-shell}%
6369 %
6370 \def\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}%
6371 \def\pgfplots@plot@data{\pgfshell[\pgfplots@plot@filename]{#4}\pgfplotxyfile{\pgfplots@[email protected]}}%
6372 \def\pgfplotxyfile{\pgfplots@addplotimpl@shellresult{#5}}%
6373 \pgfplots@plot@data
6374 \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile
6375 }%
6376
6377 \def\pgfplots@addplotimpl@shellresult#1#2{%
6378 \begingroup
6379 \openin\r@pgfplots@reada=#2
6380 \ifeof\r@pgfplots@reada
6381 \pgfplots@error{Sorry, the shell-result file '#2' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> sh <file>.sh > <file>.out' manually on the respective shell file.}%
6382 \aftergroup\pgfplots@loop@CONTINUEfalse
6383 \else
6384 \aftergroup\pgfplots@loop@CONTINUEtrue
6385 \fi
6386 \closein\r@pgfplots@reada
6387 \endgroup
6388 \ifpgfplots@loop@CONTINUE
6389 % Now, invoke 'plot file'.
6390 %
6391 % I invoke the private '@opt@' method because the semicolon ';'
6392 % character may cause problems due to catcode mismatches.
6393 % *sigh*.
6394 \pgfplots@addplotimpl@file@opt@@{}{}{#2}{#1}%
6395 \else
6396 \expandafter\pgfplots@end@plot
6397 \fi
6398 }
6399
6400 % \addplot[#1] [#2] file{#3} #4;
6401 \def\pgfplots@addplotimpl@file#1#2e{%
6402 \pgfplotsutil@ifnextchar[{%
6403 \pgfplots@addplotimpl@file@opt{#1}{#2}%
6404 }{%
6405 \pgfplots@addplotimpl@file@opt{#1}{#2}[]%
6406 }%
6407 }
6408
6409 % \addplot[#1] [#2] file[#3] {#4} #5;
6410 \def\pgfplots@addplotimpl@file@opt#1#2[#3]#4#5;{\pgfplots@addplotimpl@file@opt@{#1}{#2}{#3}{#4}{#5}}%
6411 \def\pgfplots@addplotimpl@file@opt@#1#2#3#4#5{%
6412 % invoke this here - allows to share the 'plot file' impl with
6413 % 'plot gnuplot'.
6414 \def\pgfplotssurveyphaseinputclass{file}%
6415 \pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2}%
6416 \pgfplots@addplotimpl@file@opt@@{#1,#2}{#3}{#4}{#5}%
6417 }
6418 \def\pgfplots@addplotimpl@file@opt@@#1#2#3#4{%
6419 \begingroup
6420 \def\pgfplots@loc@TMPa{#2}%
6421 \ifx\pgfplots@loc@TMPa\pgfutil@empty
6422 \else
6423 \pgfqkeys{/pgfplots/plot file}{#2}%
6424 \fi
6425 \pgfplots@PREPARE@COORD@STREAM{#4}%
6426 \pgfplots@addplotimpl@file@streamit{#3}%
6427 \endgroup
6428 }%
6429 % #1: the file name
6430 \def\pgfplots@addplotimpl@file@streamit#1{%
6431 \pgfplots@coord@stream@start
6432 \pgfplotsscanlinelengthinitzero
6433 \openin\r@pgfplots@reada=#1
6434 \ifeof\r@pgfplots@reada
6435 \pgfplots@error{sorry, plot file{#1} could not be opened}%
6436 \else
6437 \pgfplots@logfileopen{#1}%
6438 \let\pgfplots@current@point@error@x@plus=\pgfutil@empty
6439 \let\pgfplots@current@point@error@x@minus=\pgfutil@empty
6440 \let\pgfplots@current@point@error@y@plus=\pgfutil@empty
6441 \let\pgfplots@current@point@error@y@minus=\pgfutil@empty
6442 \let\pgfplots@current@point@error@z@plus=\pgfutil@empty
6443 \let\pgfplots@current@point@error@z@minus=\pgfutil@empty
6444 \let\pgfplots@current@point@meta=\pgfutil@empty
6445 \ifpgfplots@curplot@threedim
6446 \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim
6447 \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @explicitinput\endcsname
6448 \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta
6449 \fi
6450 \else
6451 \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim
6452 \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @explicitinput\endcsname
6453 \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta
6454 \fi
6455 \fi
6456 \pgfplotstableinstallignorechars%
6457 \pgfplots@addplotimpl@file@readall
6458 \fi
6459 \pgfplotsscanlinelengthcleanup
6460 \pgfplots@coord@stream@end
6461 }%
6462 \def\pgfplots@addplotimpl@file@readall{%
6463 \read\r@pgfplots@reada to\pgfplots@file@LINE
6464 \expandafter\pgfplotstableread@checkspecial@line\pgfplots@file@LINE\pgfplotstable@EOI
6465 \ifpgfplotstableread@skipline
6466 \else
6467 \ifpgfplots@plot@file@skipfirst
6468 % Silently skip first data row, assuming it is a header.
6469 \pgfplots@plot@file@skipfirstfalse
6470 \else
6471 \pgfplotsscanlinelengthincrease
6472 \expandafter\pgfplots@addplotimpl@file@parsesingle\pgfplots@file@LINE 0 0 0 0 0\pgfplots@EOI
6473 \fi
6474 \fi
6475 \ifeof\r@pgfplots@reada
6476 \else
6477 \expandafter
6478 \pgfplots@addplotimpl@file@readall
6479 \fi
6480 }%
6481
6482 \def\pgfplots@gnuplot@unbounded{u}%
6483 \def\pgfplots@gnuplot@unbounded@handler@jump{jump}%
6484 \def\pgfplots@gnuplot@handle@unbounded{%
6485 \pgfkeysgetvalue{/pgfplots/empty line}\pgfplots@loc@TMPa%
6486 \ifx\pgfplots@loc@TMPa\pgfplots@gnuplot@unbounded@handler@jump
6487 \pgfplotsplothandlerappendjumpmarker
6488 \else
6489 \ifpgfplots@curplot@threedim
6490 \def\pgfplots@current@point@z{nan}%
6491 \else
6492 \def\pgfplots@current@point@y{nan}%
6493 \fi
6494 \pgfplots@coord@stream@coord%
6495 \fi
6496 }
6497 \def\pgfplots@addplotimpl@file@parsesingle@threedim@gnuplotformat#1 #2 #3 #4 #5\pgfplots@EOI{%
6498 \def\pgfplots@current@point@x{#1}%
6499 \def\pgfplots@current@point@y{#2}%
6500 \def\pgfplots@current@point@z{#3}%
6501 \def\pgfplots@loc@TMPa{#4}%
6502 \ifx\pgfplots@loc@TMPa\pgfplots@gnuplot@unbounded%
6503 % a special gnuplot "unbounded" marker
6504 \pgfplots@gnuplot@handle@unbounded
6505 \else
6506 \pgfplots@coord@stream@coord%
6507 \fi
6508 }%
6509 \def\pgfplots@addplotimpl@file@parsesingle@twodim@gnuplotformat#1 #2 #3 #4\pgfplots@EOI{%
6510 \def\pgfplots@current@point@x{#1}%
6511 \def\pgfplots@current@point@y{#2}%
6512 \def\pgfplots@loc@TMPa{#3}%
6513 \ifx\pgfplots@loc@TMPa\pgfplots@gnuplot@unbounded
6514 % a special gnuplot "unbounded" marker
6515 \pgfplots@gnuplot@handle@unbounded
6516 \else
6517 \pgfplots@coord@stream@coord%
6518 \fi
6519 }%
6520 \def\pgfplots@addplotimpl@file@parsesingle@threedim#1 #2 #3 #4\pgfplots@EOI{%
6521 \def\pgfplots@current@point@x{#1}%
6522 \def\pgfplots@current@point@y{#2}%
6523 \def\pgfplots@current@point@z{#3}%
6524 \pgfplots@coord@stream@coord%
6525 }%
6526 \def\pgfplots@addplotimpl@file@parsesingle@twodim#1 #2 #3\pgfplots@EOI{%
6527 \def\pgfplots@current@point@x{#1}%
6528 \def\pgfplots@current@point@y{#2}%
6529 \pgfplots@coord@stream@coord%
6530 }%
6531 \def\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta#1 #2 #3 #4 #5\pgfplots@EOI{%
6532 \def\pgfplots@current@point@x{#1}%
6533 \def\pgfplots@current@point@y{#2}%
6534 \def\pgfplots@current@point@z{#3}%
6535 \def\pgfplots@current@point@meta{#4}%
6536 \pgfplots@coord@stream@coord%
6537 }%
6538 \def\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta#1 #2 #3 #4\pgfplots@EOI{%
6539 \def\pgfplots@current@point@x{#1}%
6540 \def\pgfplots@current@point@y{#2}%
6541 \def\pgfplots@current@point@meta{#3}%
6542 \pgfplots@coord@stream@coord%
6543 }%
6544
6545
6546 \def\pgfplots@addplotimpl@graphics#1#2raphics{%
6547 \pgfplotsutil@ifnextchar[{%
6548 \pgfplots@addplotimpl@graphics@{#1}{#2}%
6549 }{%
6550 \pgfplots@addplotimpl@graphics@{#1}{#2}[]%
6551 }%
6552 }%
6553 % \addplot[#1] plot[#2] graphics[#3] {#4} #5;
6554 \long\def\pgfplots@addplotimpl@graphics@#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}%
6555 \long\def\pgfplots@addplotimpl@graphics@@#1#2#3#4#5{%
6556 \def\pgfplotssurveyphaseinputclass{graphics}%
6557 \pgfplots@start@plot@with@behavioroptions{%
6558 /pgfplots/filter discard warning=false,
6559 /pgfplots/mesh/rows=2,% allow \addplot[surf] graphics ... --> yields a good legend.
6560 /pgfplots/mesh/cols=2,
6561 /pgfplots/mesh/check=false,%
6562 #1,/pgfplots/.cd,#2,%
6563 /pgfplots/plot graphics/@prepare legend,
6564 /pgfplots/plot graphics,%
6565 /pgfplots/plot graphics/.cd,%
6566 #3,%
6567 /pgfplots/plot graphics/src={#4},%
6568 /tikz/mark=}%
6569 \pgfplots@PREPARE@COORD@STREAM{#5}%
6570 \pgfplots@coord@stream@start
6571 %
6572 \pgfkeysgetvalue{/pgfplots/plot graphics/points}{\pgfplots@current@point@points}%
6573 \ifx\pgfplots@current@point@points\pgfutil@empty
6574 \else
6575 \let\pgfplotsplothandlergraphicspointmappoint=\pgfplotsplothandlergraphics@survey@pointmappoint
6576 \expandafter\pgfplots@plot@handler@graphics@parsepointmap\expandafter{\pgfplots@current@point@points}%
6577 \ifpgfplots@plot@graphics@autoadjustaxis
6578 \pgfplotsplothandlergraphicspointmapcomputerequiredview
6579 \ifx\pgfplotsretval\pgfutil@empty
6580 \else
6581 \expandafter\pgfplotssetlateoptions\expandafter{\pgfplotsretval}%
6582 \fi
6583 \fi
6584 %
6585 \def\pgfplots@addplotimpl@graphics@@error##1{}%
6586 \fi
6587 %
6588 \pgfkeysgetvalue{/pgfplots/plot graphics/xmin}{\pgfplots@current@point@x}%
6589 \pgfkeysgetvalue{/pgfplots/plot graphics/ymin}{\pgfplots@current@point@y}%
6590 %
6591 % these sanity checks do nothing of the 'plot graphics/points' feature has been used:
6592 \ifx\pgfplots@current@point@x\pgfutil@empty\pgfplots@addplotimpl@graphics@@error{xmin}\fi
6593 \ifx\pgfplots@current@point@y\pgfutil@empty\pgfplots@addplotimpl@graphics@@error{ymin}\fi
6594 \ifpgfplots@curplot@threedim
6595 \pgfkeysgetvalue{/pgfplots/plot graphics/zmin}{\pgfplots@current@point@z}%
6596 \ifx\pgfplots@current@point@z\pgfutil@empty\pgfplots@addplotimpl@graphics@@error{zmin}\fi
6597 \fi
6598 \pgfplots@coord@stream@coord
6599 %
6600 \pgfkeysgetvalue{/pgfplots/plot graphics/xmax}{\pgfplots@current@point@x}%
6601 \pgfkeysgetvalue{/pgfplots/plot graphics/ymax}{\pgfplots@current@point@y}%
6602 \ifx\pgfplots@current@point@x\pgfutil@empty\pgfplots@addplotimpl@graphics@@error{xmax}\fi
6603 \ifx\pgfplots@current@point@y\pgfutil@empty\pgfplots@addplotimpl@graphics@@error{ymax}\fi
6604 \ifpgfplots@curplot@threedim
6605 \pgfkeysgetvalue{/pgfplots/plot graphics/zmax}{\pgfplots@current@point@z}%
6606 \ifx\pgfplots@current@point@z\pgfutil@empty\pgfplots@addplotimpl@graphics@@error{zmax}\fi
6607 \fi
6608 \pgfplots@coord@stream@coord
6609 %
6610 \pgfplots@coord@stream@end
6611 }%
6612 \def\pgfplots@addplotimpl@graphics@@error#1{%
6613 \begingroup
6614 \pgfplots@error{Sorry, but 'plot graphics' can't determine where to place the graphics file - (at least) the key '#1' is missing. Please verify that you provided all required limits, for example 'plot graphics[xmin=0,xmax=1,ymin=0,ymax=1] {<graphics>}'.}%
6615 \endgroup
6616 }%
6617
6618
6619
6620
6621 % \addplot[#1] table[#2] [from] {<\macro>} #4;
6622 % or
6623 % \addplot[#1] table[#2] {<filename>} #4;
6624 %
6625 % The distinction between <\macro> and <filename> is done
6626 % automatically.
6627 %
6628 % Input options can be provided in '#2' using
6629 % - column names,
6630 % for example '/pgfplots/table/x=firstcol' or just 'x=firstcol'
6631 %
6632 % - column indices,
6633 % for example '/pgfplots/table/x index=3' or just 'x index=3'
6634 %
6635 % - expressions involving any of the table's data cells in the
6636 % currently processed cell,
6637 % for example '/pgfplots/table/x expr={\columnx * \columny + \thisrow{columnxxx}/2}'
6638 % During expr, the following (non-exhaustive) list of macros is
6639 % available:
6640 % - \columnx, \columny, \columnz, \columnmeta, \columnerrorx,
6641 % \columnerrory, \columnerrorz
6642 % Provide access to the cell content which would be used without
6643 % 'expr'.
6644 % The first three access the input coordinate columns, \meta the meta column
6645 % (if any) and the last three the error data (if any).
6646 %
6647 % That means it is allowed to provide both, 'x' and 'x expr':
6648 % 'x expr' can use the (old) value stored in 'x'. the final x
6649 % coordinate will be that returned of 'x expr'.
6650 %
6651 % - \coordindex
6652 %
6653 % - \lineno (physical line numbers including comments etc)
6654 %
6655 % - \thisrow{<colname>}
6656 % allows access to any columns.
6657 %
6658 % - \getthisrow{<colname>}{<\macro>}
6659 % this is a fragile command! Don't use it directly inside of
6660 % a math expression, prefer \thisrow.
6661 %
6662 % The FPU will be used to evaluate any expressions.
6663 %
6664 % @REMARKS the implementation for '* expr' differs for the '<\macro>'
6665 % and '<filename>' input types:
6666 % - for '{<filename>}', only the current row is available.
6667 % - for '{<\macro>}', the `create on use' framework of the table
6668 % package is used - with all its features, including comfortable
6669 % access to the previous and next row and accumulation features.
6670 \def\pgfplots@addplotimpl@table#1table{%
6671 \pgfplotsutil@ifnextchar[{%
6672 \pgfplots@addplotimpl@table@getopts{#1}%
6673 }{%
6674 \pgfplots@addplotimpl@table@getopts{#1}[]%
6675 }%
6676 }%
6677
6678 \def\pgfplots@addplotimpl@table@getopts#1[#2]{%
6679 % set options outside of the following group.
6680 % They may contain behavior options.
6681 \pgfplots@addplotimpl@table@installkeypath
6682 \pgfplotstableset{#2}%
6683 %
6684 \pgfplotsutil@ifnextchar s{%
6685 \pgfplots@addplotimpl@table@fromshell{#1}{#2}%
6686 }{%
6687 \pgfplotsutil@ifnextchar f{%
6688 \pgfplots@addplotimpl@table@fromstructure@gobble@space{#1}{#2}%
6689 }{%
6690 \pgfplots@addplotimpl@table@fromfile@gobble@space{#1}{#2}%
6691 }%
6692 }%
6693 }
6694
6695 % this macro simply invokes the "correct" table processing routine.
6696 % The distinction between 'table from {<\macro>}' and 'table
6697 % {<filename>}' is deprecated; it is done automatically now.
6698 %
6699 % \addplot[#1] table[#2] [from] {#3} #4;
6700 \def\pgfplots@addplotimpl@table@startprocessing#1#2#3#4{%
6701 \pgfplotstable@isloadedtable{#3}{%
6702 \pgfplots@addplotimpl@table@fromstructure@{#1}{#2}{#3}{#4}%
6703 }{%
6704 \pgfplots@addplotimpl@table@fromfile@{#1}{#2}{#3}{#4}%
6705 }%
6706 }%
6707
6708 % \addplot[#1] table[#2] from {#3} #4;
6709 %
6710 % #1: arguments to \addplot[...]
6711 % #2: arguments to table[...] (already processed!)
6712 % #3: the argument of plot table{...}
6713 % #4: trailing path arguments after plot table{...}#4;
6714 \long\def\pgfplots@addplotimpl@table@fromstructure@gobble@space#1#2from{%
6715 \pgfplotstablecollectoneargwithpreparecatcodes{%
6716 \pgfplots@addplotimpl@table@fromstructure{#1}{#2}from%
6717 }%
6718 }%
6719
6720 \def\pgfplots@addplot@table@fromstructure@preparecolname#1#2#3#4{%
6721 \pgfkeysgetvalue{/pgfplots/table/#1}{\pgfplots@loc@TMPa}%
6722 %
6723 \ifx\pgfplots@loc@TMPa\pgfutil@empty
6724 \pgfkeysgetvalue{/pgfplots/table/#1 index}{\pgfplots@loc@TMPa}%
6725 \ifx\pgfplots@loc@TMPa\pgfutil@empty
6726 \else
6727 \pgfplotstablegetcolumnnamebyindex\pgfplots@loc@TMPa\of#2\to\pgfplots@loc@TMPa
6728 \fi
6729 \fi
6730 \let#3=\pgfplots@loc@TMPa
6731 %
6732 % modify \pgfplots@plot@tbl@{x,y,z,meta} if there are
6733 % corresponding '#1 expr' statements:
6734 \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for{#1}{#3}{#4}%
6735 }
6736
6737 % Invokes `#1' if the command is invoked within
6738 % \addplot table {<\macro>};
6739 % and `#2' if not.
6740 \def\pgfplotsifinaddplottablestruct#1#2{%
6741 \pgfutil@ifundefined{pgfplots@plot@tbl@meta}{#2}{#1}%
6742 }%
6743
6744 \long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}%
6745 % \addplot[#1] table[#2] from {#3} #4 ;
6746 \long\def\pgfplots@addplotimpl@table@fromstructure@#1#2#3#4{%
6747 \begingroup
6748 \def\pgfplotstablename{#3}% store the name of the currently processed table.
6749 \pgfplotstablegetscanlinelength{#3}{\pgfplotsscanlinelength}%
6750 % FIXME : this thing here has runtime O(N^2) !
6751 % I fear it is faster to simply reload the data .... !?
6752 %
6753 % well, for a lot of columns which are used in different contexts
6754 % and few rows, this here IS more efficient.
6755 %
6756 \pgfplots@addplot@table@fromstructure@preparecolname{x}{#3}\pgfplots@plot@tbl@x\columnx
6757 \pgfplots@addplot@table@fromstructure@preparecolname{y}{#3}\pgfplots@plot@tbl@y\columny
6758 \ifpgfplots@curplot@threedim
6759 \pgfplots@addplot@table@fromstructure@preparecolname{z}{#3}\pgfplots@plot@tbl@z\columnz
6760 \fi
6761 \pgfplots@addplot@table@fromstructure@preparecolname{meta}{#3}\pgfplots@plot@tbl@meta\columnmeta
6762 %
6763 %
6764 % high level user interface functions:
6765 \let\pgfplotstable@coordindex@old=\coordindex
6766 \def\coordindex{\pgfplotstablerow}%
6767 \def\lineno{\coordindex}% is the same here
6768 % The normal implementation of \thisrow is not accessible here. And the
6769 % worst is: error messages are impossible either because they are
6770 % not executed... we resort to the associated math functions:
6771 \def\thisrow##1{thisrow("##1")}% let us hope that math parsing is active!
6772 \def\thisrowno##1{thisrowno(##1)}%
6773 % this should work.
6774 \def\getthisrow##1##2{\pgfplotstablegetelem{\coordindex}{##1}\of{#3}\let##2=\pgfplotsretval}%
6775 \def\getthisrowno##1##2{\pgfplotstablegetelem{\coordindex}{[index]##1}\of{#3}\let##2=\pgfplotsretval}%
6776 %
6777 \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@x}\of#3\to\addplot@tbl@x
6778 \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@y}\of#3\to\addplot@tbl@y
6779 \ifpgfplots@curplot@threedim
6780 \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@z}\of#3\to\addplot@tbl@z
6781 \fi
6782 %
6783 \let\addplot@tbl@meta=\pgfutil@empty
6784 \ifx\pgfplots@plot@tbl@meta\pgfutil@empty
6785 \else
6786 \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@meta}\of#3\to\addplot@tbl@meta
6787 \fi
6788 %
6789 %
6790 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@init x{#3}{plus}%
6791 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@init x{#3}{minus}%
6792 %
6793 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@init y{#3}{plus}%
6794 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@init y{#3}{minus}%
6795 %
6796 \ifpgfplots@curplot@threedim
6797 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@init z{#3}{plus}%
6798 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@init z{#3}{minus}%
6799 \fi
6800 %
6801 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@load x{#3}{plus}%
6802 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@load x{#3}{minus}%
6803 %
6804 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@load y{#3}{plus}%
6805 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@load y{#3}{minus}%
6806 \ifpgfplots@curplot@threedim
6807 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@load z{#3}{plus}%
6808 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@load z{#3}{minus}%
6809 \fi
6810 %
6811 \let\coordindex=\pgfplotstable@coordindex@old
6812 %
6813 \pgfplots@PREPARE@COORD@STREAM{#4}%
6814 \pgfplots@coord@stream@start
6815 \pgfutil@loop
6816 \pgfplotslistcheckempty\addplot@tbl@x
6817 \ifpgfplotslistempty
6818 \pgfplots@loop@CONTINUEfalse
6819 \else
6820 % This here is just for sanity checking: if the 'y' column is
6821 % - for whatever reasons - invalid; provide good error
6822 % recovery.
6823 \pgfplotslistcheckempty\addplot@tbl@y
6824 \ifpgfplotslistempty
6825 \pgfplots@loop@CONTINUEfalse
6826 \else
6827 \pgfplots@loop@CONTINUEtrue
6828 \fi
6829 \fi
6830 \ifpgfplots@loop@CONTINUE
6831 \pgfplotslistpopfront\addplot@tbl@x\to\pgfplots@current@point@x
6832 \pgfplotslistpopfront\addplot@tbl@y\to\pgfplots@current@point@y
6833 \ifpgfplots@curplot@threedim
6834 \pgfplotslistpopfront\addplot@tbl@z\to\pgfplots@current@point@z
6835 \fi
6836 \ifx\addplot@tbl@meta\pgfutil@empty
6837 \else
6838 \pgfplotslistpopfront\addplot@tbl@meta\to\pgfplots@current@point@meta
6839 \fi
6840 \ifpgfplots@errorbars@enabled
6841 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@getnext x{plus}%
6842 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@getnext x{minus}%
6843 %
6844 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@getnext y{plus}%
6845 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@getnext y{minus}%
6846 %
6847 \ifpgfplots@curplot@threedim
6848 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@getnext z{plus}%
6849 \pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@getnext z{minus}%
6850 \fi
6851 \fi
6852 \pgfplots@coord@stream@coord
6853 \pgfutil@repeat
6854 \pgfplots@coord@stream@end
6855 \pgfmath@smuggleone\pgfplotsscanlinelength
6856 \endgroup
6857 }
6858
6859 % #1: x, y, or z
6860 % #2: the table name
6861 % #3: either "plus" or "minus"
6862 \def\pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@init#1#2#3{%
6863 \expandafter\let\csname addplot@tbl@error@#1@#3\endcsname=\pgfutil@empty
6864 \expandafter\let\csname pgfplots@current@point@error@#1@#3\endcsname=\pgfutil@empty
6865 \ifpgfplots@errorbars@enabled
6866 % prepare with suitable expansion:
6867 \def\pgfplots@loc@TMPa{%
6868 \pgfplots@addplot@table@fromstructure@preparecolname{#1 error #3}{#2}}%
6869 \edef\pgfplots@loc@TMPb{%
6870 \expandafter\noexpand\csname pgfplots@plot@tbl@error@#1@#3\endcsname
6871 % FIXME : these macros are UNDOCUMENTED! I suppose they are dead code...
6872 \expandafter\noexpand\csname columnerror#1\endcsname
6873 }%
6874 % execute prepared statement:
6875 % = \pgfplots@addplot@table@fromstructure@preparecolname
6876 % {x error plus}{#2}{\pgfplots@plot@tbl@error@x@plus}{\columnerrorx}
6877 \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb
6878 %
6879 \fi
6880 }%
6881
6882 % #1: x, y, or z
6883 % #2: the table name
6884 % #3: either "plus" or "minus"
6885 \def\pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@load#1#2#3{%
6886 \ifpgfplots@errorbars@enabled
6887 \expandafter\ifx\csname pgfplots@plot@tbl@error@#1@#3\endcsname\pgfutil@empty
6888 % ok, we do not have this error kind.
6889 \else
6890 % assemble the statement
6891 % \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@error@x@plus}\of#2\to\addplot@tbl@error@x@plus
6892 % -> but with suitable expansion restrictions.
6893 \edef\pgfplots@loc@TMPa{\expandafter\noexpand\csname pgfplots@plot@tbl@error@#1@#3\endcsname}%
6894 %
6895 \def\pgfplots@loc@TMPb{%
6896 \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@loc@TMPa}\of#2\to
6897 }%
6898 \expandafter\pgfplots@loc@TMPb\csname addplot@tbl@error@#1@#3\endcsname
6899 \fi
6900 \fi
6901 }%
6902
6903 % #1: x, y, or z
6904 % #2: either "plus" or "minus"
6905 \def\pgfplots@addplotimpl@table@fromstructure@prepare@errorbar@getnext#1#2{%
6906 \expandafter\ifx\csname addplot@tbl@error@#1@#2\endcsname\pgfutil@empty
6907 \expandafter\let\csname pgfplots@current@point@error@#1@#2\endcsname=\pgfutil@empty
6908 \else
6909 \expandafter\pgfplotslistpopfront\csname addplot@tbl@error@#1@#2\endcsname\to\pgfplots@loc@TMPa
6910 \expandafter\let\csname pgfplots@current@point@error@#1@#2\endcsname=\pgfplots@loc@TMPa
6911 \fi
6912 }%
6913
6914 % A private helper macro which initialises the '#1 expr' keys for plot
6915 % table from structure.
6916 %
6917 % PRECONDITION:
6918 % \pgfplots@plot@tbl@#1 contains the column name which would be used
6919 % if '#1 expr' is empty.
6920 %
6921 % POSTCONDITION:
6922 % \pgfplots@plot@tbl@#1 will be CHANGED to use the 'expr' column (a
6923 % temporary name).
6924 % The old value of \pgfplots@plot@tbl@#1 is available as column
6925 % alias.
6926 % the high level user interface command '#3' will be set correctly.
6927 %
6928 % #1: the key name of the current entity, for example 'x' for
6929 % '/pgfplots/table/x'
6930 % #2: the low level column name representing the data which is already
6931 % defined somehow
6932 % #3: a high level user interface command
6933 \def\pgfplots@addplotimpl@table@fromstructure@prepareexpr@for#1#2#3{%
6934 % get old column name into a register:
6935 \t@pgfplots@tokb=\expandafter{#2}%
6936 %
6937 % high level user interface command:
6938 \edef#3{\noexpand\thisrow{\the\t@pgfplots@tokb}}%
6939 %
6940 \pgfkeysgetvalue{/pgfplots/table/#1 expr}{\pgfplots@loc@TMPa}%
6941 \ifx\pgfplots@loc@TMPa\pgfutil@empty
6942 \else
6943 % get expression into register:
6944 \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}%
6945 %
6946 %
6947 % assemble pgfkeys statement which expands the names above
6948 % just one time:
6949 \edef\pgfplots@loc@TMPa{%
6950 /pgfplots/table/create on use/#1expr@tempcol/.style={%
6951 /pgfplots/table/create col/expr={\the\t@pgfplots@toka}%
6952 },%
6953 /pgfplots/table/alias/#1/.initial={\the\t@pgfplots@tokb}%
6954 }%
6955 \expandafter\pgfkeysalso\expandafter{\pgfplots@loc@TMPa}%
6956 %
6957 % tell `plot table' which column should be used for '#1': the
6958 % temporary column.
6959 \def#2{#1expr@tempcol}%
6960 \fi
6961 }%
6962
6963
6964 % \addplot[#1] table[#2] {#3} #4;
6965 %
6966 % This here is the (probably) faster input method from tables.
6967 %
6968 % It has linear complexity in the number of rows (as long as the
6969 % number of rows is less than about 110000).
6970 %
6971 % #1: arguments to \addplot[...]
6972 % #2: arguments to table[...] (already processed!)
6973 % #3: the argument of plot table{...}
6974 % #4: trailing path arguments after plot table{...}#4;
6975 %
6976 \long\def\pgfplots@addplotimpl@table@fromfile@gobble@space#1#2{%
6977 \pgfplotstablecollectoneargwithpreparecatcodes{%
6978 \pgfplots@addplotimpl@table@fromfile{#1}{#2}%
6979 }%
6980 }%
6981 \long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}%
6982 % \addplot[#1] table[#2] {#3} {#4};
6983 \long\def\pgfplots@addplotimpl@table@fromfile@#1#2#3#4{%
6984 \if1\pgfplots@addplotimpl@readcompletely@auto
6985 \pgfplots@addplotimpl@table@check@createonuse@for{x}%
6986 \pgfplots@addplotimpl@table@check@createonuse@for{y}%
6987 \ifpgfplots@curplot@threedim
6988 \pgfplots@addplotimpl@table@check@createonuse@for{z}%
6989 \fi
6990 \pgfplots@addplotimpl@table@check@createonuse@for{x error plus}%
6991 \pgfplots@addplotimpl@table@check@createonuse@for{x error minus}%
6992 \pgfplots@addplotimpl@table@check@createonuse@for{y error plus}%
6993 \pgfplots@addplotimpl@table@check@createonuse@for{y error minus}%
6994 \ifpgfplots@curplot@threedim
6995 \pgfplots@addplotimpl@table@check@createonuse@for{z error plus}%
6996 \pgfplots@addplotimpl@table@check@createonuse@for{z error minus}%
6997 \fi
6998 \pgfplots@addplotimpl@table@check@createonuse@for{meta}%
6999 \fi
7000 %
7001 \let\pgfplots@addplot@point@meta@description@of@explicit@value=\pgfplots@addplot@point@meta@description@of@explicit@value@table%
7002 %
7003 \ifpgfplots@addplotimpl@readcompletely
7004 \pgfplotstableread{#3}\pgfplots@table
7005 \pgfplots@addplotimpl@table@fromstructure@{#1}{}{\pgfplots@table}{#4}%
7006 \else
7007 \pgfplotsapplistXXglobalnewempty
7008 %
7009 % these data pointers will be prepared to allow fast access
7010 % into the current row while we read rows succesively from
7011 % disk.
7012 % Note: their initialisation must be postponed until
7013 % \pgfplotstableread is running - otherwise, we can't query
7014 % pointers into the table. See below.
7015 \let\pgfplots@table@PTR@x=\pgfutil@empty
7016 \let\pgfplots@table@PTR@y=\pgfutil@empty
7017 \let\pgfplots@table@PTR@z=\pgfutil@empty
7018 \let\pgfplots@table@PTR@meta=\pgfutil@empty
7019 %
7020 %
7021 \let\pgfplots@current@point@meta=\pgfutil@empty
7022 \let\pgfplots@current@point@z=\pgfutil@empty
7023 %
7024 % high level user interface functions:
7025 \def\lineno{\pgfplotstablelineno}%
7026 \def\columnx{\pgfplotstablereadvalueofptr{\pgfplots@table@PTR@x}}%
7027 \def\columny{\pgfplotstablereadvalueofptr{\pgfplots@table@PTR@y}}%
7028 \def\columnz{\pgfplotstablereadvalueofptr{\pgfplots@table@PTR@z}}%
7029 \def\columnmeta{\pgfplotstablereadvalueofptr{\pgfplots@table@PTR@meta}}%
7030 %
7031 \pgfplots@PREPARE@COORD@STREAM{#4}%
7032 \pgfplots@coord@stream@start
7033 \ifpgfplots@errorbars@enabled
7034 % more fast-access pointers for error data:
7035 \let\pgfplots@table@ERRPTR@x=\pgfutil@empty
7036 \let\pgfplots@table@ERRPTR@y=\pgfutil@empty
7037 \let\pgfplots@table@ERRPTR@z=\pgfutil@empty
7038 %
7039 % prepare:
7040 \let\pgfplots@current@point@error@x@plus=\pgfutil@empty
7041 \let\pgfplots@current@point@error@x@minus=\pgfutil@empty
7042 \let\pgfplots@current@point@error@y@plus=\pgfutil@empty
7043 \let\pgfplots@current@point@error@y@minus=\pgfutil@empty
7044 \let\pgfplots@current@point@error@z@plus=\pgfutil@empty
7045 \let\pgfplots@current@point@error@z@minus=\pgfutil@empty
7046 %
7047 % high level user interface functions:
7048 % FIXME : these macros are UNDOCUMENTED! I suppose they are dead code...
7049 \def\columnerrorx{\pgfplotstablereadvalueofptr{\pgfplots@table@ERRPTR@x}}%
7050 \def\columnerrory{\pgfplotstablereadvalueofptr{\pgfplots@table@ERRPTR@y}}%
7051 \def\columnerrorz{\pgfplotstablereadvalueofptr{\pgfplots@table@ERRPTR@z}}%
7052 %
7053 \pgfplotstableread*{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL
7054 \else
7055 \pgfplotstableread*{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED
7056 \fi
7057 \pgfplots@coord@stream@end
7058 \fi
7059 }
7060 \def\pgfplots@addplot@point@meta@description@of@explicit@value@table{%
7061 Please add a non-empty value for \string\addplot\space table[meta=...]
7062 }%
7063 \def\pgfplots@addplotimpl@table@check@createonuse@for#1{%
7064 \pgfkeysgetvalue{/pgfplots/table/#1}\pgfplots@addplotimpl@table@check@createonuse@for@
7065 \expandafter\pgfplotstableifiscreateonuse\expandafter{\pgfplots@addplotimpl@table@check@createonuse@for@}{%
7066 \pgfplots@addplotimpl@readcompletelytrue
7067 }{%
7068 }%
7069 }%
7070 \def\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED{%
7071 \pgfplots@addplotimpl@table@fromfile@listener@
7072 \pgfplots@coord@stream@coord
7073 }
7074 \def\pgfplots@addplotimpl@table@fromfile@listener@PREPARE{%
7075 % this here is only evaluated ONCE.
7076 \pgfkeysgetvalue{/pgfplots/table/x}{\pgfplots@plot@tbl@x}%
7077 \pgfkeysgetvalue{/pgfplots/table/x index}{\pgfplots@plot@tbl@xindex}%
7078 \pgfkeysgetvalue{/pgfplots/table/y}{\pgfplots@plot@tbl@y}%
7079 \pgfkeysgetvalue{/pgfplots/table/y index}{\pgfplots@plot@tbl@yindex}%
7080 \pgfkeysgetvalue{/pgfplots/table/z}{\pgfplots@plot@tbl@z}%
7081 \pgfkeysgetvalue{/pgfplots/table/z index}{\pgfplots@plot@tbl@zindex}%
7082 \pgfkeysgetvalue{/pgfplots/table/meta}{\pgfplots@plot@tbl@meta}%
7083 \pgfkeysgetvalue{/pgfplots/table/meta index}{\pgfplots@plot@tbl@metaindex}%
7084 %
7085 \pgfkeysgetvalue{/pgfplots/table/x expr}{\pgfplots@loc@TMPa}%
7086 \ifx\pgfplots@loc@TMPa\pgfutil@empty
7087 \def\pgfplots@dereferencepointer@and@ASSIGN@x{%
7088 \pgfplotstablereadevalptr\pgfplots@table@PTR@x\pgfplots@current@point@x
7089 }%
7090 \else
7091 \def\pgfplots@dereferencepointer@and@ASSIGN@x{%
7092 \pgfmathparse{\pgfkeysvalueof{/pgfplots/table/x expr}}%
7093 \let\pgfplots@current@point@x=\pgfmathresult
7094 }%
7095 \fi
7096 %
7097 \pgfkeysgetvalue{/pgfplots/table/y expr}{\pgfplots@loc@TMPa}%
7098 \ifx\pgfplots@loc@TMPa\pgfutil@empty
7099 \def\pgfplots@dereferencepointer@and@ASSIGN@y{%
7100 \pgfplotstablereadevalptr\pgfplots@table@PTR@y\pgfplots@current@point@y
7101 }%
7102 \else
7103 \def\pgfplots@dereferencepointer@and@ASSIGN@y{%
7104 \pgfmathparse{\pgfkeysvalueof{/pgfplots/table/y expr}}%
7105 \let\pgfplots@current@point@y=\pgfmathresult
7106 }%
7107 \fi
7108 %
7109 \ifx\pgfplots@plot@tbl@x\pgfutil@empty
7110 \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@xindex}{\pgfplots@table@PTR@x}%
7111 \else
7112 \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@x}{\pgfplots@table@PTR@x}%
7113 \fi
7114 \ifx\pgfplots@plot@tbl@y\pgfutil@empty
7115 \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@yindex}{\pgfplots@table@PTR@y}%
7116 \else
7117 \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@y}{\pgfplots@table@PTR@y}%
7118 \fi
7119 \ifpgfplots@curplot@threedim
7120 %
7121 \pgfkeysgetvalue{/pgfplots/table/z expr}{\pgfplots@loc@TMPa}%
7122 \ifx\pgfplots@loc@TMPa\pgfutil@empty
7123 \def\pgfplots@dereferencepointer@and@ASSIGN@z{%
7124 \pgfplotstablereadevalptr\pgfplots@table@PTR@z\pgfplots@current@point@z
7125 }%
7126 \else
7127 \def\pgfplots@dereferencepointer@and@ASSIGN@z{%
7128 \pgfmathparse{\pgfkeysvalueof{/pgfplots/table/z expr}}%
7129 \let\pgfplots@current@point@z=\pgfmathresult
7130 }%
7131 \fi
7132 \ifx\pgfplots@plot@tbl@z\pgfutil@empty
7133 \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@zindex}{\pgfplots@table@PTR@z}%
7134 \else
7135 \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@z}{\pgfplots@table@PTR@z}%
7136 \fi
7137 \else
7138 \let\pgfplots@dereferencepointer@and@ASSIGN@z=\relax
7139 \fi
7140 %
7141 %
7142 \def\pgfplots@dereferencepointer@and@ASSIGN@meta{%
7143 \pgfplotstablereadevalptr\pgfplots@table@PTR@meta\pgfplots@current@point@meta
7144 }%
7145 \ifx\pgfplots@plot@tbl@meta\pgfutil@empty
7146 \ifx\pgfplots@plot@tbl@metaindex\pgfutil@empty
7147 \let\pgfplots@dereferencepointer@and@ASSIGN@meta=\relax
7148 \else
7149 \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@metaindex}{\pgfplots@table@PTR@meta}%
7150 \fi
7151 \else
7152 \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@meta}{\pgfplots@table@PTR@meta}%
7153 \fi
7154 \pgfkeysgetvalue{/pgfplots/table/meta expr}{\pgfplots@loc@TMPa}%
7155 \ifx\pgfplots@loc@TMPa\pgfutil@empty
7156 \else
7157 \def\pgfplots@dereferencepointer@and@ASSIGN@meta{%
7158 \pgfmathparse{\pgfkeysvalueof{/pgfplots/table/meta expr}}%
7159 \let\pgfplots@current@point@meta=\pgfmathresult
7160 }%
7161 \fi
7162 \let\pgfplots@addplotimpl@table@fromfile@listener@PREPARE=\relax
7163 }%
7164 \def\pgfplots@addplotimpl@table@fromfile@listener@{%
7165 \pgfplots@addplotimpl@table@fromfile@listener@PREPARE
7166 \pgfplots@dereferencepointer@and@ASSIGN@x
7167 \pgfplots@dereferencepointer@and@ASSIGN@y
7168 \pgfplots@dereferencepointer@and@ASSIGN@z
7169 \pgfplots@dereferencepointer@and@ASSIGN@meta
7170 }%
7171
7172 % #1: x, y, or z
7173 % #2: either "plus" or "minus"
7174 \def\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare@#1#2{%
7175 \pgfkeysgetvalue{/pgfplots/table/#1 error #2 index}\pgfplots@plot@tbl@error@index
7176 \pgfkeysgetvalue{/pgfplots/table/#1 error #2}\pgfplots@plot@tbl@error
7177 %
7178 \expandafter\def\csname pgfplots@table@ERRPTR@#1@#2\endcsname{#1 error #2}%
7179 %
7180 \expandafter\def\csname pgfplots@dereferencepointer@and@ASSIGN@error@#1@#2\endcsname{%
7181 \expandafter\pgfplotstablereadevalptr\csname pgfplots@table@ERRPTR@#1@#2\endcsname\pgfmathresult
7182 \expandafter\let\csname pgfplots@current@point@error@#1@#2\endcsname=\pgfmathresult
7183 }%
7184 %
7185 \ifx\pgfplots@plot@tbl@error\pgfutil@empty
7186 \ifx\pgfplots@plot@tbl@error@index\pgfutil@empty
7187 \let\pgfplotsretval=\relax
7188 \expandafter\let\csname pgfplots@dereferencepointer@and@ASSIGN@error@#1@#2\endcsname=\relax
7189 \else
7190 \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@index}{\pgfplotsretval}%
7191 \fi
7192 \else
7193 \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error}{\pgfplotsretval}%
7194 \fi
7195 \expandafter\let\csname pgfplots@table@ERRPTR@#1@#2\endcsname=\pgfplotsretval
7196 %
7197 \pgfkeysgetvalue{/pgfplots/table/#1 error #2 expr}{\pgfplots@loc@TMPa}%
7198 \ifx\pgfplots@loc@TMPa\pgfutil@empty
7199 \else
7200 \expandafter\def\csname pgfplots@dereferencepointer@and@ASSIGN@error@#1@#2\endcsname{%
7201 \pgfmathparse{\pgfkeysvalueof{/pgfplots/table/#1 error #2 expr}}%
7202 \expandafter\let\csname pgfplots@current@point@error@#1@#2\endcsname=\pgfmathresult
7203 }%
7204 \fi
7205 }%
7206
7207 \def\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare{%
7208 % this here is only evaluated ONCE.
7209 \pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare@ x{plus}%
7210 \pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare@ x{minus}%
7211 \pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare@ y{plus}%
7212 \pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare@ y{minus}%
7213 %
7214 \ifpgfplots@curplot@threedim
7215 \pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare@ z{plus}%
7216 \pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare@ z{minus}%
7217 \else
7218 \let\pgfplots@dereferencepointer@and@ASSIGN@error@z@plus=\relax
7219 \let\pgfplots@dereferencepointer@and@ASSIGN@error@z@minus=\relax
7220 \fi
7221 \let\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare=\relax
7222 }
7223 \def\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL{%
7224 \pgfplots@addplotimpl@table@fromfile@listener@
7225 \pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL@prepare
7226 %
7227 \pgfplots@dereferencepointer@and@ASSIGN@error@x@plus
7228 \pgfplots@dereferencepointer@and@ASSIGN@error@x@minus
7229 %
7230 \pgfplots@dereferencepointer@and@ASSIGN@error@y@plus
7231 \pgfplots@dereferencepointer@and@ASSIGN@error@y@minus
7232 %
7233 \ifpgfplots@curplot@threedim
7234 \pgfplots@dereferencepointer@and@ASSIGN@error@z@plus
7235 \pgfplots@dereferencepointer@and@ASSIGN@error@z@minus
7236 \fi
7237 \pgfplots@coord@stream@coord
7238 }%
7239 \def\pgfplots@addplotimpl@table@installkeypath{%
7240 \pgfkeysdef{/pgfplots/table/.unknown}{%
7241 \let\pgfplots@table@curkeyname=\pgfkeyscurrentname
7242 \pgfqkeys{/pgfplots}{\pgfplots@table@curkeyname=##1}%
7243 }%
7244 }%
7245
7246 % \addplot[#1] table[#2] shell{#3} #4;
7247 %
7248 % #1: arguments to \addplot[...]
7249 % #2: arguments to table[...]
7250 % #3: the argument of plot table shell{...}
7251 % #4: trailing path arguments after plot table shell{...}#4;
7252 \long\def\pgfplots@addplotimpl@table@fromshell#1#2shell#3#4;{%
7253 \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}%
7254 \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-shell}%
7255 %
7256 \def\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}%
7257 \pgfshell[\pgfplots@plot@filename]{#3}\pgfplots@addplotimpl@table@fromfile{#1}{#2}{\pgfplots@[email protected]}#4;%
7258 }%
7259
7260 % This is a backwards-compatibility method to ensure that
7261 % \axis[ybar]
7262 % and
7263 % \addplot[ybar]
7264 % work as documented.
7265 %
7266 % The problem: earlier versions used /pgfplots/ybar for the global
7267 % setting and /tikz/ybar for the local one. Now, both contexts yield
7268 % /pgfplots/ybar in contradiction to the manual.
7269 %
7270 % So, this macro install special handlers to restore the old setting.
7271 \def\pgfplots@install@local@bar@handlers{%
7272 \pgfkeysgetvalue{/pgfplots/xbar/.@cmd}\pgfplotskeys@orig@xbar
7273 \pgfkeysgetvalue{/pgfplots/ybar/.@cmd}\pgfplotskeys@orig@ybar
7274 \pgfkeysgetvalue{/pgfplots/xbar interval/.@cmd}\pgfplotskeys@orig@xbari
7275 \pgfkeysgetvalue{/pgfplots/ybar interval/.@cmd}\pgfplotskeys@orig@ybari
7276 \pgfkeysdef{/pgfplots/xbar}{%
7277 \ifpgfkeysaddeddefaultpath
7278 \pgfkeysalso{/tikz/xbar}%
7279 \else
7280 \pgfplotskeys@orig@xbar##1\pgfeov
7281 \fi
7282 }%
7283 \pgfkeysdef{/pgfplots/ybar}{%
7284 \ifpgfkeysaddeddefaultpath
7285 \pgfkeysalso{/tikz/ybar}%
7286 \else
7287 \pgfplotskeys@orig@ybar##1\pgfeov
7288 \fi
7289 }%
7290 \pgfkeysdef{/pgfplots/xbar interval}{%
7291 \ifpgfkeysaddeddefaultpath
7292 \pgfkeysalso{/tikz/xbar interval}%
7293 \else
7294 \pgfplotskeys@orig@xbari##1\pgfeov
7295 \fi
7296 }%
7297 \pgfkeysdef{/pgfplots/ybar interval}{%
7298 \ifpgfkeysaddeddefaultpath
7299 \pgfkeysalso{/tikz/ybar interval}%
7300 \else
7301 \pgfplotskeys@orig@ybari##1\pgfeov
7302 \fi
7303 }%
7304 }%
7305
7306 \def\pgfplots@end@plot{%
7307 \ifpgfplots@curplot@isirrelevant
7308 \else
7309 \pgfplots@countplots@advance
7310 \fi
7311 \pgfkeysvalueof{/pgfplots/execute at end plot@@}%
7312 \pgfkeysvalueof{/pgfplots/execute at end plot}%
7313 \endgroup%<-- close the \begingroup of \pgfplots@addplotimpl@plot@withoptions
7314 }
7315
7316 % \numplotsofactualtype
7317 % Expands to the number of plots which have been seen in the current
7318 % axis and which have the same type as the actual plot handler.
7319 %
7320 % See also \plotnumofactualtype
7321 \def\pgfplots@numplotsofactualtype{%
7322 \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername}{%
7323 0%
7324 }{%
7325 \csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername\endcsname
7326 }%
7327 }%
7328 % use this only inside of \addplot or during the visualization phase
7329 % of a plot.
7330 \def\pgfplots@numplotsofactualtype@duringplot{%
7331 \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername@actual}{%
7332 0%
7333 }{%
7334 \csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname
7335 }%
7336 }%
7337 %
7338 %
7339 \def\pgfplots@countplots@init{%
7340 %
7341 %
7342 \pgfplotssurveyphase@setactiveplothandlers
7343 %
7344 \def\plotnum{\the\pgfplots@numplots}%
7345 \let\numplotsofactualtype=\pgfplots@numplotsofactualtype@duringplot
7346 %
7347 % Store this name during the \addplot command. Thus, even if the
7348 % plot handler changes, we will keep this one.
7349 \edef\pgfplotsplothandlername@actual{\pgfplotsplothandlername}%
7350 %
7351 \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername@actual}{%
7352 % oh. This is the first time \pgfplotsplothandlername was used
7353 % in this axis. Set its counter to 0 and remember that it has
7354 % been initialised.
7355 \expandafter\xdef\csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname{0}%
7356 \t@pgfplots@toka=\expandafter{\pgfplotssurveyphase@setactiveplothandlers}%
7357 \t@pgfplots@tokb=\expandafter{\pgfplotsplothandlername@actual}%
7358 \xdef\pgfplotssurveyphase@setactiveplothandlers{%
7359 \the\t@pgfplots@toka
7360 \noexpand\expandafter\noexpand\def\noexpand\csname pgfplotssurveyphase@setactiveplothandlers@\the\t@pgfplots@tokb\noexpand\endcsname{1}%
7361 }%
7362 \expandafter\def\csname pgfplotssurveyphase@setactiveplothandlers@\the\t@pgfplots@tokb\endcsname{1}%
7363 }{%
7364 % ok. do nothing.
7365 }%
7366 %
7367 }%
7368 \def\pgfplots@countplots@advance{%
7369 \global\advance\pgfplots@numplots by1\relax%
7370 %
7371 \expandafter\pgfplotsutil@advancestringcounter@global\csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname
7372 }%
7373
7374 % \addplot[#1] [#2] {#3} #4;
7375 \long\def\pgfplots@addplotimpl@coordinates#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}%
7376 % \addplot[#1] [#2] coordinates {#3} #4;
7377 \long\def\pgfplots@addplotimpl@coordinates@#1#2#3#4{%
7378 \def\pgfplotssurveyphaseinputclass{coordinates}%
7379 \pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2}%
7380 \pgfplots@PREPARE@COORD@STREAM{#4}%
7381 \ifpgfplots@curplot@threedim
7382 \let\pgfplots@addplot@point@meta@description@of@explicit@value=\pgfplots@addplot@point@meta@description@of@explicit@value@coordinates@threedim
7383 \pgfplots@coord@stream@foreach@threedim{#3}%
7384 \else
7385 \let\pgfplots@addplot@point@meta@description@of@explicit@value=\pgfplots@addplot@point@meta@description@of@explicit@value@coordinates@twodim
7386 \pgfplots@coord@stream@foreach{#3}%
7387 \fi
7388 }%
7389
7390 \def\pgfplots@addplot@point@meta@description@of@explicit@value@coordinates@twodim{%
7391 Please add suffixes for every coordinate in order to specify explicit point meta. The suffixes must have the form '(x,y) [meta]'
7392 }%
7393 \def\pgfplots@addplot@point@meta@description@of@explicit@value@coordinates@threedim{%
7394 Please add suffixes for every coordinate in order to specify explicit point meta. The suffixes must have the form '(x,y,z) [meta]'
7395 }%
7396
7397 {
7398 % A block which handles active semicolons.
7399 %
7400 % ATTENTION: this block does only work if
7401 % \pgfplots@addplotimpl.... changes are reflected here!
7402 %
7403 \catcode`\;=\active
7404 \globaldefs=1
7405 % 'AS' == 'active semicolon'
7406 % 'IS' == 'inactive semicolon'
7407 \let\pgfplots@gobble@until@semicolon@IS=\pgfplots@gobble@until@semicolon
7408 \let\pgfplots@addplotimpl@expression@IS=\pgfplots@addplotimpl@expression
7409 \let\pgfplots@addplotimpl@expression@curly@IS=\pgfplots@addplotimpl@expression@curly
7410 \let\pgfplots@addplotimpl@function@opt@IS=\pgfplots@addplotimpl@function@opt
7411 \let\pgfplots@addplotimpl@file@opt@IS=\pgfplots@addplotimpl@file@opt
7412 \let\pgfplots@addplotimpl@fillbetween@opt@IS=\pgfplots@addplotimpl@fillbetween@opt
7413 \let\pgfplots@addplotimpl@table@fromstructure@IS=\pgfplots@addplotimpl@table@fromstructure
7414 \let\pgfplots@addplotimpl@table@fromfile@IS=\pgfplots@addplotimpl@table@fromfile
7415 \let\pgfplots@addplotimpl@graphics@IS=\pgfplots@addplotimpl@graphics@
7416 \let\pgfplots@addplotimpl@coordinates@IS=\pgfplots@addplotimpl@coordinates
7417 %
7418 \def\pgfplots@gobble@until@semicolon@AS#1;{}
7419 \long\def\pgfplots@addplotimpl@expression@AS#1#2(#3,#4)#5;{\pgfplots@addplotimpl@expression@{#1}{#2}{#3}{#4}{#5}}%
7420 \long\def\pgfplots@addplotimpl@expression@curly@AS#1#2#3#4;{\pgfplots@addplotimpl@expression@curly@{#1}{#2}{#3}{#4}}%
7421 \def\pgfplots@addplotimpl@function@opt@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@function@opt@{#1}{#2}{#3}{#4}{#5}}%
7422 \def\pgfplots@addplotimpl@file@opt@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@file@opt@{#1}{#2}{#3}{#4}{#5}}%
7423 \long\def\pgfplots@addplotimpl@fillbetween@opt@AS#1#2[#3]#4;{\pgfplots@addplotimpl@fillbetween@opt@{#1}{#2}{#3}{#4}}%
7424 \long\def\pgfplots@addplotimpl@table@fromstructure@AS#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}%
7425 \long\def\pgfplots@addplotimpl@table@fromfile@AS#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}%
7426 \long\def\pgfplots@addplotimpl@coordinates@AS#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}%
7427 \long\def\pgfplots@addplotimpl@graphics@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}%
7428 %
7429 % Checks whether ';' is an active character and, if that is the
7430 % case, modifies all public macros for it.
7431 \pgfplots@appendto@activesemicolon@switcher{%
7432 \let\pgfplots@gobble@until@semicolon=\pgfplots@gobble@until@semicolon@AS
7433 \let\pgfplots@addplotimpl@expression=\pgfplots@addplotimpl@expression@AS
7434 \let\pgfplots@addplotimpl@expression@curly=\pgfplots@addplotimpl@expression@curly@AS
7435 \let\pgfplots@addplotimpl@function@opt=\pgfplots@addplotimpl@function@opt@AS
7436 \let\pgfplots@addplotimpl@file@opt=\pgfplots@addplotimpl@file@opt@AS
7437 \let\pgfplots@addplotimpl@fillbetween@opt=\pgfplots@addplotimpl@fillbetween@opt@AS
7438 \let\pgfplots@addplotimpl@table@fromstructure=\pgfplots@addplotimpl@table@fromstructure@AS
7439 \let\pgfplots@addplotimpl@table@fromfile=\pgfplots@addplotimpl@table@fromfile@AS
7440 \let\pgfplots@addplotimpl@coordinates=\pgfplots@addplotimpl@coordinates@AS
7441 \let\pgfplots@addplotimpl@graphics@=\pgfplots@addplotimpl@graphics@AS
7442 }%
7443 }
7444
7445 \newif\ifpgfplots@update@limits@for@one@point@ISCLIPPED
7446 \def\pgfplots@math@ONE{1.0}%
7447
7448 \def\pgfplots@invoke@prefilter{%
7449 \pgfkeysvalueof{/pgfplots/pre filter/.@cmd}\pgfeov%
7450 }%
7451 \def\pgfplots@invoke@filter#1#2{%
7452 \pgfkeysvalueof{/pgfplots/#2 filter/.@cmd}#1\pgfeov%
7453 }%
7454 \def\pgfplots@invoke@filter@xyz{%
7455 \pgfkeysgetvalue{/pgfplots/filter point/.@cmd}\pgfplots@loc@TMPa
7456 \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key
7457 \else
7458 \pgfkeyslet{/data point/x}\pgfplots@current@point@x
7459 \pgfkeyslet{/data point/y}\pgfplots@current@point@y
7460 \pgfkeyslet{/data point/z}\pgfplots@current@point@z
7461 \pgfplots@loc@TMPa\pgfeov%
7462 \pgfkeysgetvalue{/data point/x}\pgfplots@current@point@x
7463 \pgfkeysgetvalue{/data point/y}\pgfplots@current@point@y
7464 \pgfkeysgetvalue{/data point/z}\pgfplots@current@point@z
7465 \fi%
7466 }%
7467
7468 % #1 the target which will contain the filter
7469 % #2 a math expression.
7470 \def\pgfplots@install@filter@expression#1#2{%
7471 \pgfkeysdef{/pgfplots/#1}{%
7472 % DO NOT MODIFY THIS VALUE without also modifying
7473 % \pgfplots@ifisfilterexpression!
7474 \pgfplots@filter@expression{#1}%
7475 }%
7476 %
7477 % remember for lua backend:
7478 \pgfkeyssetvalue{/pgfplots/#1/@expressionvalue}{#2}%
7479 }%
7480 % #1 the target which will contain the filter
7481 % #2 a math expression.
7482 \def\pgfplots@install@filter@expression@append#1#2{%
7483 \pgfkeysgetvalue{/pgfplots/#1/.@cmd}\pgfplots@loc@TMPc
7484 \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key
7485 % ok, this is the first filter. Make sure it can also be
7486 % processed by the lua backend
7487 \pgfplots@install@filter@expression{#1}{#2}%
7488 \else
7489 % there is a subtle difference to /.expression: this here CANNOT
7490 % be processed by the lua backend!
7491 \pgfkeysalso{/pgfplots/#1/.append code={\pgfplots@filter@expression@{#1}{#2}}}%
7492 \fi
7493 }%
7494
7495 % Executes #2 if the filter key was defined by
7496 % \pgfplots@install@filter@expression.
7497 %
7498 % #1 the target which will contain the filter (like 'x filter')
7499 % #2: true code
7500 % #3: false code
7501 \def\pgfplots@ifisfilterexpression#1#2#3{%
7502 \pgfkeysgetvalue{/pgfplots/#1/.@cmd}\pgfplots@loc@TMPc
7503 \long\def\pgfplots@loc@TMPd##1\pgfeov{\pgfplots@filter@expression{#1}}%
7504 \ifx\pgfplots@loc@TMPc\pgfplots@loc@TMPd
7505 #2\relax
7506 \else
7507 #3\relax
7508 \fi
7509 }%
7510
7511 % #1 the key name (example: 'x filter')
7512 \def\pgfplots@filter@expression#1{%
7513 \pgfplots@filter@expression@{#1}{\pgfkeysvalueof{/pgfplots/#1/@expressionvalue}}%
7514 }%
7515 % #1 the key name (example: 'x filter')
7516 % #2 the expression
7517 \def\pgfplots@filter@expression@#1#2{%
7518 \begingroup
7519 \pgfkeys{/pgf/fpu=true,%
7520 /pgf/fpu/output format=float,%
7521 }%
7522 \pgfmathparse{#2}%
7523 \pgfmath@smuggleone\pgfmathresult
7524 \endgroup
7525 }%
7526
7527 % this is a convenience macro to save storage in the long coordinate
7528 % lists.
7529 \def\pgfplots@stream#1#2{\pgfplotstreampoint{\pgfqpoint{#1}{#2}}}
7530 \def\pgfplots@stream@#1#2#3{\def\pgfplots@current@point@coordindex{#1}\pgfplots@stream{#2}{#3}}
7531 \def\pgfplots@stream@withmeta#1#2#3{\def\pgfplots@current@point@meta{#3}\pgfplotstreampoint{\pgfqpoint{#1}{#2}}}
7532 \def\pgfplots@stream@withmeta@#1#2#3#4{\def\pgfplots@current@point@coordindex{#1}\pgfplots@stream@withmeta{#2}{#3}{#4}}
7533
7534 \def\pgfplots@stream@decode@and@apply#1#2#3#4{%
7535 \def\pgfplots@current@point@coordindex{#1}%
7536 \pgfplotsaxisdeserializedatapointfrom@private{#2}%
7537 \pgfplotstreampoint{\pgfqpoint{#3}{#4}}%
7538 }
7539
7540 % Takes a sequence of PREPARED coordinates which are given in floating
7541 % point representation and applies the data scaling trafo (if
7542 % necessary).
7543 %
7544 % Any coordinate will be plotted with the selected PGF plot handler.
7545 %
7546 % This stream is designed to be done at the end of an axis.
7547 % See \pgfplots@coord@stream@finalize@storedcoords@START
7548 %
7549 \def\pgfplots@coord@stream@INIT@finalize@storedcoords{%
7550 %
7551 % Init the plot handlers:
7552 \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler
7553 \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}%
7554 %
7555 \ifpgfplots@threedim
7556 \pgfplots@apply@zbuffer
7557 \fi
7558 %
7559 \pgfplots@perpointmeta@preparetrafo
7560 %
7561 \ifpgfplots@stackedmode
7562 \pgfplots@stacked@visphase@beginplot
7563 \fi
7564 \ifpgfplots@errorbars@enabled
7565 \pgfplots@errorbars@visphase@begin
7566 \fi
7567 \pgfplots@prepare@visualization@dependencies
7568 %
7569 \def\pgfplots@loc@TMPa{0}% <-- if (collectmark positions)
7570 \ifpgfplots@scatterplotenabled
7571 \def\pgfplots@loc@TMPa{1}% collect mark positions even if 'mark=none'! scatter might not even use markers.
7572 \fi
7573 \ifx\tikz@plot@mark\pgfutil@empty
7574 \else
7575 \def\pgfplots@loc@TMPa{1}%
7576 \fi
7577 %
7578 % OK, initialize the plot handler.
7579 \pgfplotsresetplothandler
7580 \pgfplots@basiclevel@plothandler
7581 \expandafter\pgfplotsplothandlerdeserializestatefrom\expandafter{\pgfplots@serialized@state@plothandler}%
7582 %
7583 \pgfplots@LUA@visualization@of@current@plot
7584 %
7585 \pgfplotstreamstart
7586 %
7587 % Now, set up coordinate streams.
7588 \def\pgfplots@coord@stream@start@{%
7589 \let\pgfplots@data@scaletrafo@result=\pgfutil@empty
7590 \c@pgfplots@coordindex=0
7591 }%
7592 \def\pgfplots@coord@stream@end@{%
7593 \ifpgfplots@stackedmode
7594 \pgfplots@stacked@visphase@endplot
7595 \fi
7596 \ifpgfplots@errorbars@enabled
7597 \pgfplots@errorbars@visphase@end
7598 \fi
7599 \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa
7600 \pgfplots@loc@TMPa
7601 \pgfplotstreamend
7602 }%
7603 \begingroup
7604 \let\E=\noexpand
7605 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7606 \pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro
7607 %
7608 % Will be inserted in one of two possible places below (to collect
7609 % marker positions)
7610 % This finalize command maps the logical coordinate into PGF's
7611 % point space. Furthermore, it collects marker coordinates
7612 % (properly clipped by position) if markers are required (see
7613 % above).
7614 %
7615 % It is prepared here to eliminate if's.
7616 \gdef\pgfplots@coord@stream@finalize@currentpt{%
7617 %
7618 % NOTE: this here INVALIDATES \pgfplotlastpoint. However, we assign a correct value
7619 % for that macro after all coordinates have been assigned - and we do it in a way
7620 % which respects the special coordinates of 'patch plots'.
7621 %
7622 \pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y!
7623 %
7624 \advance\c@pgfplots@coordindex by1
7625 }%
7626 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7627 \endgroup
7628 %
7629 %\message{Prepared macro \string \pgfplotsaxisvisphasetransformcoordinate {\meaning\pgfplotsaxisvisphasetransformcoordinate}}%
7630 %\message{Prepared macro \string \pgfplots@coord@stream@finalize@currentpt {\meaning\pgfplots@coord@stream@finalize@currentpt}}%
7631 \if1\b@pgfplots@LUA@visualization@enabled
7632 \def\pgfplots@coord@stream@coord@{%
7633 \ifx\pgfplots@current@point@x\pgfutil@empty% this implements `unbounded coords=jump', for example
7634 \pgfplotsplothandlervisualizejump
7635 \else
7636 \pgfplotscoordmath{x}{tofixed}{\pgfplots@current@point@x}\let\pgfplots@current@point@x=\pgfmathresult
7637 \pgfplotscoordmath{y}{tofixed}{\pgfplots@current@point@y}\let\pgfplots@current@point@y=\pgfmathresult
7638 \ifpgfplots@curplot@threedim
7639 \pgfplotscoordmath{z}{tofixed}{\pgfplots@current@point@z}\let\pgfplots@current@point@z=\pgfmathresult
7640 \fi
7641 % no need to call this here -- we got them from LUA:
7642 % \pgfplotsaxis@toPGF@coords
7643 \pgfplots@coord@stream@finalize@currentpt
7644 \fi
7645 }%
7646 \else
7647 \def\pgfplots@coord@stream@coord@{%
7648 \ifpgfplots@stackedmode
7649 \pgfplots@stacked@visphase@stream@coord@
7650 \fi
7651 \ifx\pgfplots@current@point@x\pgfutil@empty% this implements `unbounded coords=jump', for example
7652 \pgfplotsplothandlervisualizejump
7653 \else
7654 \pgfplotsaxisvisphasegetpoint
7655 \pgfplots@coord@stream@finalize@currentpt
7656 \fi
7657 }%
7658 \fi
7659 }
7660
7661 \def\pgfplots@LUA@visualization@init{%
7662 \ifpgfplots@LUA@backend@supported
7663 \edef\pgfplots@loc@TMPa{%
7664 \pgfplotsutil@directlua{pgfplots.texVisualizationInit(\pgfplots@LUA@backend@plotnum, \ifpgfplots@curplot@threedim true\else false\fi)}%
7665 }%
7666 \if1\pgfplots@loc@TMPa
7667 \pgfplots@log{\pgfplots@LUA@loglevel@debug}{lua backend=true: Activating partial LUA backend for visualization of plot \plotnum\space (lua: \pgfplots@LUA@backend@plotnum).}%
7668 \else
7669 \pgfplots@LUA@backend@supportedfalse
7670 \fi
7671 \fi
7672 }%
7673
7674 % Takes the current point (defined by a set of macros) as input and defines \pgf@x and \pgf@y
7675 % as the output point. It also defines
7676 % \pgfplots@current@point@x and its variants to contain the
7677 % transformed canvas coords (those which can be given to
7678 % \pgfplotsqpointxyz).
7679 %
7680 \def\pgfplotsaxisvisphasegetpoint{%
7681 \pgfplotsaxisvisphasetransformcoordinate\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@z%
7682 \pgfplotsaxisvisphasepreparedatapoint
7683 \pgfplotsaxis@toPGF@coords
7684 }%
7685
7686 \def\pgfplotsaxis@toPGF@coords{%
7687 \ifpgfplots@curplot@threedim
7688 \pgfplotsqpointxyz{\pgfplots@current@point@x}{\pgfplots@current@point@y}{\pgfplots@current@point@z}%
7689 \else
7690 \pgfplotsqpointxy{\pgfplots@current@point@x}{\pgfplots@current@point@y}%
7691 \fi
7692 }%
7693
7694 % A command which returns high-level (logical) coordinates into the keys
7695 % /data point/x
7696 % /data point/y
7697 % /data point/z
7698 % /data point/meta
7699 % /data point/index
7700 %
7701 % The command has two modes:
7702 %
7703 % 1. without arguments. In this case, it reads the "current" point
7704 % from the plot handler.
7705 %
7706 % 2. with an argument in curly braces. In this case, it expects one of
7707 % the following:
7708 % a) a \pgfpoint instruction (i.e. some code which assigns \pgf@x and
7709 % \pgf@y) and returns the associated logical (high-level) coordinates.
7710 % b) a TikZ point starting with '('.
7711 %
7712 % Examples:
7713 % * \pgfplotspointgetcoordinates
7714 % -> useful for nodes near coords
7715 % * \pgfplotspointgetcoordinates{\pgfpoint{200pt}{100pt}}
7716 % * \pgfplotspointgetcoordinates{(5,3)}
7717 %
7718 %
7719 % This works for 2D axes only.
7720 %
7721 \def\pgfplotspointgetcoordinates{%
7722 \pgfutil@ifnextchar\bgroup{%
7723 \pgfplotspointgetcoordinates@frompgfpoint
7724 }{%
7725 \pgfplotspointgetcoordinates@currentpoint
7726 }%
7727 }%
7728 \def\pgfplotspointgetcoordinates@frompgfpoint#1{%
7729 \pgfplotspointgetnormalizedcoordinates{#1}%
7730 \pgfplotspointgetcoordinatesfromnormalized
7731 }%
7732 \def\pgfplotspointgetcoordinates@currentpoint{%
7733 \pgfplotspointgetnormalizedcoordinates
7734 \pgfplotspointgetcoordinatesfromnormalized
7735 }%
7736
7737 \def\pgfplotspointgetnormalizedcoordinates@@@x{undefined}
7738 \def\pgfplotspointgetnormalizedcoordinates@@@y{undefined}
7739 \def\pgfplotspointgetnormalizedcoordinates@@@z{undefined}
7740 \let\pgfplotspointgetnormalizedcoordinates@@@index=\pgfutil@empty
7741 \let\pgfplotspointgetnormalizedcoordinates@@@meta=\pgfutil@empty
7742
7743 % PRECONDITION: \pgfplots@current@point@x and its variants is given in
7744 % TRANSFORMED format, i.e. we assume that we are in the visualization
7745 % phase after the coordinates have been prepared.
7746 % POSTCONDITION: the untransformed #1 coordinate is assigned to
7747 % \pgfplotsretval
7748 \def\pgfplotspointgetnormalizedcoordinates@#1{%
7749 % XXX : this is slower than it used to be - in 1.11, I simply
7750 % remembered 'x untransformed'! I switched it to this lazy
7751 % computation due to the LUA backend in which case remembering it
7752 % leads to extensive (=expensive?) communication between lua and
7753 % TeX. Does it hurt here? Scatter plots compute this stuff...
7754 \expandafter\let\expandafter\pgfplotsretval\csname pgfplotspointgetnormalizedcoordinates@@@#1\endcsname
7755 \ifx\pgfplotsretval\pgfutil@empty
7756 \else
7757 \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
7758 \pgfplotscoordmath{#1}{datascaletrafo inverse}{\pgfplotsretval}%
7759 \let\pgfplotsretval=\pgfmathresult
7760 }{}%
7761 \fi
7762 }%
7763
7764 % Same as \pgfplotspointgetcoordinates, but the resulting values are
7765 % for use in 'normalized axis cs'.
7766 \def\pgfplotspointgetnormalizedcoordinates{%
7767 \pgfutil@ifnextchar\bgroup{%
7768 \pgfplotspointgetnormalizedcoordinates@frompgfpoint
7769 }{%
7770 \pgfplotspointgetnormalizedcoordinates@currentpoint
7771 }%
7772 }
7773 \def\pgfplotspointgetnormalizedcoordinates@frompgfpoint#1{%
7774 \pgfplotspointgetnormalizedcoordinates@frompgfpoint@#1\pgfplots@EOI
7775 }
7776 \def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@{%
7777 \pgfutil@ifnextchar({\pgfplotspointgetnormalizedcoordinates@frompgfpoint@tikz}{\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@}%
7778 }%
7779 \def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@tikz#1\pgfplots@EOI{%
7780 \def\pgfplots@loc@TMPa{#1}%
7781 \def\pgfplots@loc@TMPb{(.)}%
7782 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
7783 \pgfplotspointgetnormalizedcoordinates@frompgfpoint@@\tikz@last@position\pgfplots@EOI
7784 \else
7785 \tikz@scan@one@point\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@@#1\relax
7786 \fi
7787 }%
7788 \def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@@#1{%
7789 \pgfplotspointgetnormalizedcoordinates@frompgfpoint@@#1\pgfplots@EOI
7790 }
7791 \def\pgfplotspointgetnormalizedcoordinates@frompgfpoint@@#1\pgfplots@EOI{%
7792 \pgf@process{#1}%
7793 \pgfplotsconvertunittocoordinate{x}{\pgf@x}%
7794 \let\pgfplotspointgetnormalizedcoordinates@@@x=\pgfmathresult
7795 \pgfplotsconvertunittocoordinate{y}{\pgf@y}%
7796 \let\pgfplotspointgetnormalizedcoordinates@@@y=\pgfmathresult
7797 \let\pgfplotspointgetnormalizedcoordinates@@@z=\pgfutil@empty
7798 \let\pgfplotspointgetnormalizedcoordinates@@@index=\pgfutil@empty
7799 \let\pgfplotspointgetnormalizedcoordinates@@@meta=\pgfutil@empty
7800 %
7801 \pgfplotspointgetnormalizedcoordinates@internal%
7802 }%
7803
7804 \def\pgfplotspointgetnormalizedcoordinates@currentpoint{%
7805 \let\pgfplotspointgetnormalizedcoordinates@@@x=\pgfplots@current@point@x
7806 \let\pgfplotspointgetnormalizedcoordinates@@@y=\pgfplots@current@point@y
7807 \let\pgfplotspointgetnormalizedcoordinates@@@z=\pgfplots@current@point@z
7808 \let\pgfplotspointgetnormalizedcoordinates@@@meta=\pgfplots@current@point@meta
7809 \let\pgfplotspointgetnormalizedcoordinates@@@index=\pgfplots@current@point@coordindex
7810 \pgfplotspointgetnormalizedcoordinates@internal
7811 }
7812 \def\pgfplotspointgetnormalizedcoordinates@internal{%
7813 \pgfplotspointgetnormalizedcoordinates@ x%
7814 \pgfkeyslet{/data point/x}\pgfplotsretval
7815 %
7816 \pgfplotspointgetnormalizedcoordinates@ y%
7817 \pgfkeyslet{/data point/y}\pgfplotsretval
7818 %
7819 \ifpgfplots@curplot@threedim
7820 \pgfplotspointgetnormalizedcoordinates@ z%
7821 \pgfkeyslet{/data point/z}\pgfplotsretval
7822 \else
7823 \pgfkeyslet{/data point/z}\pgfutil@empty
7824 \fi
7825 %
7826 \pgfkeyslet{/data point/meta}\pgfplotspointgetnormalizedcoordinates@@@meta
7827 \edef\pgfplots@loc@TMPa{\pgfplotspointgetnormalizedcoordinates@@@index}%
7828 \pgfkeyslet{/data point/index}\pgfplots@loc@TMPa
7829 }%
7830
7831 % Assumes that we are given normalized coordinates (i.e. those for use
7832 % in 'normalized axis cs') and transforms them into those which are
7833 % for use in 'axis cs'.
7834 %
7835 % Accepts an optional argument in square brackets, namely one or more
7836 % options in the /pgfplots/coords key path (see below).
7837 \def\pgfplotspointgetcoordinatesfromnormalized{%
7838 \pgfutil@ifnextchar[{\pgfplotspointgetcoordinatesfromnormalized@opt}{\pgfplotspointgetcoordinatesfromnormalized@opt[]}%
7839 }%
7840
7841 % Defines where to expect INPUT coordinates
7842 % \pgfplotspointgetcoordinatesfromnormalized[path=/data point/
7843 % would expect input coordinates
7844 % /data point/x
7845 % /data point/y
7846 % /data point/z
7847 \pgfkeyssetvalue{/pgfplots/coords/path}{/data point}
7848
7849 % \pgfplotspointgetcoordinatesfromnormalized[target path=/data point/zero/
7850 % would write output coordinates
7851 % /data point/zero/x
7852 % /data point/zero/y
7853 % /data point/zero/z
7854 \pgfkeyssetvalue{/pgfplots/coords/target path}{\pgfkeysvalueof{/pgfplots/coords/path}}
7855
7856 \def\pgfplotspointgetcoordinatesfromnormalized@opt[#1]{%
7857 \begingroup
7858 \pgfqkeys{/pgfplots/coords}{#1}%
7859 \pgfkeysgetvalue{/pgfplots/coords/path}\pgfplots@path
7860 \pgfkeysgetvalue{/pgfplots/coords/target path}\pgfplots@path@trg
7861 \pgfkeysifdefined{\pgfplots@path/x}{}{%
7862 \pgfplots@error{Illegal argument: '\pgfplots@path' is no valid data point path (\pgfplots@path/x does not exist)}%
7863 }%
7864 \pgfkeysgetvalue{\pgfplots@path/x}\pgfplots@loc@x
7865 \pgfkeysgetvalue{\pgfplots@path/y}\pgfplots@loc@y
7866 \pgfkeysgetvalue{\pgfplots@path/z}\pgfplots@loc@z
7867 %
7868 \pgfplotspointgetcoordinatesfromnormalized@transform x\pgfplots@loc@x%
7869 \pgfplotspointgetcoordinatesfromnormalized@transform y\pgfplots@loc@y%
7870 \ifpgfplots@threedim
7871 \pgfplotspointgetcoordinatesfromnormalized@transform z\pgfplots@loc@z%
7872 \fi
7873 \xdef\pgfplots@glob@TMPa{%
7874 \noexpand\pgfkeyssetvalue{\pgfplots@path@trg/x}{\pgfplots@loc@x}%
7875 \noexpand\pgfkeyssetvalue{\pgfplots@path@trg/y}{\pgfplots@loc@y}%
7876 \noexpand\pgfkeyssetvalue{\pgfplots@path@trg/z}{\pgfplots@loc@z}%
7877 }%
7878 \endgroup
7879 \pgfplots@glob@TMPa
7880 }%
7881 \def\pgfplotspointgetcoordinatesfromnormalized@transform#1#2{%
7882 \edef\pgfplots@loc@TMPa{#2}%
7883 \ifx\pgfplots@loc@TMPa\pgfutil@empty
7884 \else
7885 \pgfplots@if{pgfplots@#1islinear}{%
7886 \pgfplotscoordmath{#1}{tofixed}{#2}%
7887 }{%
7888 \pgfplotscoordmath{#1}{exp}{#2}%
7889 }%
7890 \let#2=\pgfmathresult
7891 \pgfplots@coord@inv@trafo@apply{#1}{#2}%
7892 \let#2=\pgfmathresult
7893 \fi
7894 }%
7895
7896 % Defines an optimized and matching \pgfplotsaxisvisphasetransformcoordinate
7897 % during the coordinate finalization step in \end{axis}.
7898 \def\pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro{%
7899 \begingroup
7900 \let\E=\noexpand
7901 %
7902 % \pgfplotsaxisvisphasetransformcoordinate
7903 % Maps a point to the low level xyz coordinate system by applying
7904 % data scaling transformations.
7905 %
7906 % This method should be invoked for every coordinate before it can
7907 % be drawn.
7908 %
7909 % It is prepared here to eliminate if's.
7910 %
7911 % Arguments:
7912 % #1 : a MACRO containing the x value
7913 % #2 : a MACRO containing the y value
7914 % #3 : a MACRO containing the z value
7915 %
7916 % PRECONDITION:
7917 % - the visualization phase is running.
7918 % - #1,#2,#3 are defined and contain
7919 % values resulting from the survey phase.
7920 %
7921 % POSTCONDITION
7922 % - #1,#2,#3 will be redefined to contain data which is
7923 % readily usable by low level pgf plot handlers for
7924 % visualization.
7925 %
7926 % @see \pgfplotsaxisvisphasepreparedatapoint
7927 \xdef\pgfplotsaxisvisphasetransformcoordinate##1##2##3{%
7928 \ifpgfplots@apply@datatrafo@x
7929 \E\pgfplotscoordmath{x}{datascaletrafo}{##1}%
7930 \E\let##1=\E\pgfmathresult
7931 \fi
7932 \ifpgfplots@apply@datatrafo@y
7933 \E\pgfplotscoordmath{y}{datascaletrafo}{##2}%
7934 \E\let##2=\E\pgfmathresult
7935 \fi
7936 \ifpgfplots@curplot@threedim
7937 \ifpgfplots@apply@datatrafo@z
7938 \E\pgfplotscoordmath{z}{datascaletrafo}{##3}%
7939 \E\let##3=\E\pgfmathresult
7940 \fi
7941 \fi
7942 % \t@pgfplots@tokc=\expandafter{\pgfplots@data@scaletrafo@result}%
7943 % \edef\pgfplots@data@scaletrafo@result{\the\t@pgfplots@tokc(\pgfplots@current@point@x,\pgfplots@current@point@y)}%
7944 }%
7945 %
7946 % Just before the visualization phase can call the low level
7947 % interface, this method is called to handle final changes.
7948 % It is currently only used by the stacked plot interface.
7949 \xdef\pgfplotsaxisvisphasepreparedatapoint{%
7950 \ifpgfplots@stackedmode
7951 % all these calls work with pgfmath; no more floating point
7952 % arithmetics are applied.
7953 \E\pgfplots@stacked@visphasepreparedatapoint%
7954 \fi
7955 }%
7956 %
7957 \endgroup
7958 }
7959
7960 % Defines \pgfmathresult to contain the transformed coordinate entry
7961 % #1: one of x,y ,or z
7962 % #2: the input value
7963 \def\pgfplotsaxisvisphasetransformcoordinateentry#1#2{%
7964 \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
7965 \pgfplotscoordmath{#1}{datascaletrafo}{#2}%
7966 }{%
7967 \edef\pgfmathresult{#2}%
7968 }%
7969 }%
7970
7971 \def\pgfplots@addplot@define@plot@cycle@threedim{%
7972 \def\pgfplots@path@closed@cycle@std{%
7973 \pgfextra{%
7974 \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}{\pgfplots@logical@ZERO@z}}%
7975 \pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}{\pgfplots@logical@ZERO@z}}%
7976 }%
7977 -- cycle
7978 }%
7979 }%
7980 \def\pgfplots@addplot@get@named@startendpoints@command#1{%
7981 \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty
7982 % empty plot.
7983 \def#1{%
7984 \pgfcoordinate{current plot begin}{\pgfplotspointaxisorigin}%
7985 \pgfcoordinate{current plot end}{\pgfplotspointaxisorigin}%
7986 }%
7987 \else
7988 \ifpgfplots@curplot@threedim
7989 \edef#1{%
7990 \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfplotsqpointxyz{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}{\pgfplots@currentplot@firstcoord@z}}%
7991 \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfplotsqpointxyz{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}{\pgfplots@currentplot@lastcoord@z}}%
7992 }%
7993 % FIXME : wouldn't this be a good idea for 2d axes as
7994 % well!?
7995 \pgfplots@addplot@define@plot@cycle@threedim
7996 \else
7997 \edef#1{%
7998 \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfplotsqpointxy{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}}%
7999 \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfplotsqpointxy{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}}%
8000 }%
8001 \fi
8002 \fi
8003 }%
8004
8005 % This is the pgfplots implementation for 'node[pos=<fraction>]'.
8006 % Besides modifications of the transformation matrix, it also defines the COORDINATES of the point to
8007 % /data point/x
8008 % /data point/y
8009 % /data point/z
8010 % (or more keys which depend on the plot handler).
8011 \def\pgfplots@plot@timer{%
8012 \pgfplotstransformplotattime{\tikz@time}%
8013 }
8014
8015 % Installs a transformation matrix such that (0,0) is the point of the
8016 % current plot with fraction #1.
8017 %
8018 % This does actually nothing more than using
8019 % \pgfplotspointplotattime{#1} as shift and using the slope of the
8020 % curve at that point to set up the 'sloped' rotation (if enabled).
8021 \def\pgfplotstransformplotattime#1{%
8022 \pgftransformshift{\pgfplotspointplotattime{#1}}%
8023 \ifpgfresetnontranslationattime%
8024 \pgftransformresetnontranslations%
8025 \fi%
8026 \ifpgfslopedattime%
8027 \pgfplotsplothandlertransformslopedattime{#1}{\pgfplotspointplotattimefirst}{\pgfplotspointplotattimesecond}%
8028 \fi%
8029 }
8030
8031 \def\pgfplotspointplotattimeclearcache{%
8032 \global\let\pgfplotspointplotattime@cache=\pgfutil@empty
8033 \gdef\pgfplotspointplotattime@cachesize{0}%
8034 }%
8035 \pgfplotspointplotattimeclearcache
8036 \def\pgfplotspointplotattime@cachesize@max{20}
8037
8038 % Checks if the cache for \pgfplotspointplotattime has a cached entry for '#1'.
8039 % POSTCONDITION:
8040 % if \ifpgfplots@loc@tmp is true, the value(s) from the cache have been retrieved successfully.
8041 % if \ifpgfplots@loc@tmp is false, there is not hit.
8042 \def\pgfplotspointplotattimegetfromcache#1{%
8043 \pgf@xa=#1pt %
8044 \pgfplotspointplotattime@cache
8045 \pgfkeysifdefined{/data point/@pos \the\pgf@xa/segment \pgfkeysvalueof{/tikz/pos segment}}{%
8046 \pgfkeysvalueof{/data point/@pos \the\pgf@xa/segment \pgfkeysvalueof{/tikz/pos segment}}%
8047 \pgfplots@loc@tmptrue
8048 }{%
8049 \pgfplots@loc@tmpfalse
8050 }%
8051 }%
8052 \def\pgfplotspointplotattimeaddtocache#1{%
8053 \pgfplotsutil@advancestringcounter@global\pgfplotspointplotattime@cachesize
8054 \ifnum\pgfplotspointplotattime@cachesize=\pgfplotspointplotattime@cachesize@max
8055 \pgfplotspointplotattimeclearcache
8056 \fi
8057 \pgf@xa=#1pt %
8058 \edef\pgfplots@loc@TMPa{%
8059 \noexpand\gdef\noexpand\pgfplotspointplotattimefirst{\pgfplotspointplotattimefirst}%
8060 \noexpand\gdef\noexpand\pgfplotspointplotattimesecond{\pgfplotspointplotattimesecond}%
8061 \noexpand\gdef\noexpand\pgfplotspointplotattimecoords{\pgfplotspointplotattimecoords}%
8062 \noexpand\pgf@x=\the\pgf@x\space% attempt to fix bugs/94/ aka q/271792/.
8063 \noexpand\pgf@y=\the\pgf@y\space% sometimes there are \noexpand sometimes there are not.
8064 }%
8065 \t@pgfplots@toka=\expandafter{\pgfplotspointplotattime@cache}%
8066 \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}%
8067 \xdef\pgfplotspointplotattime@cache{%
8068 \the\t@pgfplots@toka
8069 \noexpand\pgfkeyssetvalue{/data point/@pos \the\pgf@xa/segment \pgfkeysvalueof{/tikz/pos segment}}{\the\t@pgfplots@tokb}%
8070 }%
8071 }
8072
8073 % Sets (\pgf@x,\pgf@y) to the point of the current plot with fraction #1.
8074 % For #1 = 0, this is the first point.
8075 % For #1 = 1, this is the last point.
8076 % For #1 = 0.5, it is the middle of the plot.
8077 % The argument '#1' is optional: if you leave it away, the current value of the 'pos' key will be used.
8078 % This method will work for most plot handlers, although some of them might be unsupported.
8079 %
8080 % As a side-effect, it defines the (global) macros
8081 % - \pgfplotspointplotattimefirst the start coordinate of the line segment containing #1
8082 % - \pgfplotspointplotattimesecond the end coordinate of the line segment containing #1
8083 % - \pgfplotspointplotattimecoords the coordinates of #1
8084 % The first two are interesting in order to allow the computation of gradients.
8085 % \pgfplotsplothandlerpointtokeys{/data point}%
8086 % for the \pgfplotspointplotattimecoords point
8087 %
8088 % Any of these macros can be decoded using
8089 % \pgfplotsplothandlerdeserializepointfrom\pgfplotspointplotattimesecond
8090 % \pgfplotsaxisvisphasegetpoint
8091 %
8092 % @see \pgfplotsplothandlerpointtokeys
8093 \def\pgfplotspointplotattime{%
8094 \pgfutil@ifnextchar\bgroup{\pgfplotspointplotattime@}{\pgfplotspointplotattime@{\tikz@time}}%
8095 }
8096 \def\pgfplotspointplotattime@#1{%
8097 \edef\pgfplots@loc@TMPa{#1}%
8098 \ifx\pgfplots@loc@TMPa\pgfutil@empty
8099 \pgfplots@error{Sorry, the provided fraction of the plot is empty (maybe the argument of 'pos' has been cleared by the tikz node processing). Please provide a valid 'pos' argument}%
8100 \else
8101 \pgfplotspointplotattimegetfromcache{#1}%
8102 \ifpgfplots@loc@tmp
8103 % CACHE HIT!
8104 %\message{CACHE HIT for \string\pgfplotspointplotattime{#1}^^J}%
8105 \else
8106 %\message{NO cache hit for \string\pgfplotspointplotattime{#1}^^J}%
8107 \begingroup
8108 %
8109 \if1\b@pgfplots@LUA@visualization@enabled
8110 \ifx\pgfplots@plot@timer@args\relax
8111 \expandafter\gdef\expandafter\pgfplots@plot@timer@args\expandafter{%
8112 \pgfplotsutil@directlua{pgfplots.texGetSurveyedCoordsToPgfplots()}%
8113 }%
8114 \fi
8115 \let\pgfplotsaxisdeserializedatapointfrom@private=\pgfplotsaxisdeserializedatapointfrom@private@nonLUA
8116 \else
8117 \global\let\pgfplots@plot@timer@args=\pgfplots@stored@current@data
8118 \fi
8119 %
8120 %
8121 \edef\pgfplots@time{#1}%
8122 \pgfplotscoordmathparsemacro{default}{\pgfplots@time}%
8123 \pgfkeysgetvalue{/tikz/pos segment}\pgfplots@pos@segment
8124 %
8125 \iffalse
8126 % this here is a simple experiment which finds x or y
8127 % values. IMPLEMENT IT!
8128 \def\pgfplotspointattime@do@set@current@value{%
8129 \pgfplotscoordmath{default}{parsenumber}{\pgfplots@current@point@y}%
8130 \let\pgfplotspointattime@value@current=\pgfmathresult
8131 }%
8132 \def\pgfplotspointattime@do@set@target@value{%
8133 \let\pgfplotspointattime@value@target=\pgfplots@time
8134 }%
8135 \def\pgfplots@ifpointattime@do@set@current@value@accumulates##1##2{##2}%
8136 \fi
8137 %
8138 \let\pgfplotspointattime@do=\relax
8139 \let\pgfplots@coord@stream@start@=\pgfplots@coord@stream@start@plot@at@time
8140 \let\pgfplots@coord@stream@coord@=\pgfplots@coord@stream@coord@plot@at@time
8141 \def\pgfplots@coord@stream@end@{}%
8142 \pgfplots@ifpointattime@do@set@current@value@accumulates{%
8143 % 1. compute the total length of the plot (by integrating along a linear spline)
8144 %
8145 % we need to compute the TOTAL length in order to set the
8146 % target values.
8147 \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@plot@timer@args}%
8148 }{}%
8149 %
8150 \pgfplotspointattime@do@set@target@value
8151 %
8152 \pgfplotscoordmath{default}{zero}%
8153 \let\pgfplots@len@last=\pgfmathresult
8154 \let\pgfplots@len@last@last=\pgfplots@len@last
8155 %\message{plot at time (#1, segment \pgfplots@pos@segment): total length=\pgfplotspointattime@value@current; target len \pgfplotspointattime@value@target\space (#1)^^J}%
8156 %
8157 \def\pgfplots@HIT{0}%
8158 \let\pgfplots@last@last=\pgfutil@empty
8159 \let\pgfplots@coord@stream@coord@=\pgfplots@coord@stream@coord@plot@at@time
8160 \let\pgfplotspointattime@do=\pgfplotspointattime@do@find@target@value
8161 \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@plot@timer@args}%
8162 \if\pgfplots@HIT0%
8163 \let\pgfplots@last@processed=\pgfplots@last@last
8164 \let\pgfplots@len@last=\pgfplots@len@last@last
8165 \pgfplotspointattime@pointbetween@two
8166 \fi
8167 \endgroup
8168 \pgfplotspointplotattimeaddtocache{#1}%
8169 \fi
8170 \pgfplotsplothandlerdeserializepointfrom\pgfplotspointplotattimecoords
8171 \pgfplotscoordmath{x}{tofixed}{\pgfplots@current@point@x}%
8172 \pgfplots@coord@inv@trafo@apply{x}{\pgfmathresult}%
8173 \let\pgfplots@current@point@x=\pgfmathresult
8174 \pgfplotscoordmath{y}{tofixed}{\pgfplots@current@point@y}%
8175 \pgfplots@coord@inv@trafo@apply{y}{\pgfmathresult}%
8176 \let\pgfplots@current@point@y=\pgfmathresult
8177 \ifpgfplots@curplot@threedim
8178 \pgfplotscoordmath{z}{tofixed}{\pgfplots@current@point@z}%
8179 \pgfplots@coord@inv@trafo@apply{z}{\pgfmathresult}%
8180 \let\pgfplots@current@point@z=\pgfmathresult
8181 \fi
8182 \pgfplotsplothandlerpointtokeys{/data point}%
8183 \fi
8184 }
8185
8186 % coordinate streaming method for use in
8187 % \pgfplotspointplotattime
8188 \def\pgfplots@coord@stream@start@plot@at@time{%
8189 \ifx\pgfplots@pos@segment\pgfutil@empty
8190 \let\c@pgfplots@segments=\pgfutil@empty
8191 \else
8192 \def\c@pgfplots@segments{0}%
8193 \c@pgf@countd=\pgfplots@pos@segment\relax
8194 \edef\pgfplots@pos@segment{\the\c@pgf@countd}%
8195 \fi
8196 \pgfplotscoordmath{default}{zero}%
8197 \let\pgfplotspointattime@value@current=\pgfmathresult
8198 \let\pgfplots@last@processed=\pgfutil@empty
8199 \def\pgfplots@last@was@empty{1}%
8200 }%
8201
8202
8203 % coordinate streaming method for use in
8204 % \pgfplotspointplotattime
8205 %
8206 % It invokes \pgfplotspointattime@do{} whenever is has found a line
8207 % segment.
8208 \def\pgfplots@coord@stream@coord@plot@at@time{%
8209 %\message{plot at time (#1, segment \pgfplots@pos@segment): processing (\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z)^^J}%
8210 \ifx\pgfplots@current@point@x\pgfutil@empty
8211 \if1\pgfplots@last@was@empty
8212 \else
8213 % oh. a jump... start new length segment
8214 \ifx\c@pgfplots@segments\pgfutil@empty
8215 \else
8216 \ifx\pgfplots@pos@segment\c@pgfplots@segments
8217 \let\pgfplots@coord@stream@coord@=\relax
8218 \fi
8219 \pgfplotsutil@advancestringcounter\c@pgfplots@segments
8220 \fi
8221 \fi
8222 \let\pgfplots@last@processed=\pgfutil@empty
8223 \def\pgfplots@last@was@empty{1}%
8224 \else
8225 \ifx\pgfplots@pos@segment\c@pgfplots@segments
8226 \pgfplotsplothandlerserializepointto{\pgfplots@cur}%
8227 \pgfplotspointattime@do@set@current@value
8228 %
8229 \ifx\pgfplots@last@processed\pgfutil@empty
8230 \else
8231 \pgfplotspointattime@do
8232 \fi
8233 %
8234 \let\pgfplots@len@last@last=\pgfplots@len@last
8235 \let\pgfplots@len@last=\pgfplotspointattime@value@current
8236 \let\pgfplots@last@last=\pgfplots@last@processed
8237 \let\pgfplots@last@processed=\pgfplots@cur
8238 \fi
8239 \def\pgfplots@last@was@empty{0}%
8240 \fi
8241 }%
8242
8243 % A macro which is invoked whenever \pgfplotspointplotattime found a
8244 % line segment.
8245 %
8246 % INPUT:
8247 % - \pgfplots@cur : serialized current point. This current point's
8248 % properties are available in the macros
8249 % \pgfplots@current@point@[xyz] etc.
8250 % - \pgfplots@last@processed : serialized last point
8251 % - \pgfplotspointattime@value@current : the accumulated length so far
8252 %
8253 \def\pgfplotspointattime@do{}
8254
8255 % \pgfplots@ifpointattime@do@set@current@value@accumulates{<true code>}{<false code>}
8256 %
8257 % is invokes to test if \pgfplotspointattime@do@set@current@value
8258 % accumulates stuff. If so, it will invoke <true code>. If it does NOT
8259 % accumulate stuff, it will invoke <false code>
8260 \def\pgfplots@ifpointattime@do@set@current@value@accumulates#1#2{%
8261 % the default "time fraction" implementation accumulates:
8262 #1\relax
8263 }
8264
8265 \def\pgfplotspointattime@do@set@current@value{%
8266 \ifx\pgfplots@last@processed\pgfutil@empty
8267 \else
8268 \pgfplotsplothandlersurveydifflen{\pgfplots@last@processed}{\pgfplots@cur}%
8269 \pgfplotscoordmath{default}{op}{add}{{\pgfmathresult}{\pgfplotspointattime@value@current}}%
8270 \let\pgfplotspointattime@value@current=\pgfmathresult
8271 \fi
8272 %\message{plot at time (#1, segment \pgfplots@pos@segment): length \pgfplotspointattime@value@current^^J}%
8273 }%
8274
8275 % Needs to define \pgfplotspointattime@value@target .
8276 %
8277 % This value is the search target: once the loop realizes that it
8278 % passed \pgfplotspointattime@value@target, it will report a hit in the current
8279 % interval.
8280 \def\pgfplotspointattime@do@set@target@value{%
8281 \pgfplotscoordmath{default}{op}{multiply}{{\pgfplots@time}{\pgfplotspointattime@value@current}}%
8282 \let\pgfplotspointattime@value@target=\pgfmathresult
8283 }%
8284
8285 \def\pgfplotspointattime@do@find@target@value{%
8286 % compare \pgfplotspointattime@value@target and \pgfplotspointattime@value@current to see if
8287 % we passed the target interval:
8288 \pgfplotscoordmath{default}{if less than}
8289 {\pgfplotspointattime@value@target}
8290 {\pgfplotspointattime@value@current}
8291 {% HIT!
8292 \def\pgfplots@HIT{1}%
8293 \pgfplotspointattime@pointbetween@two
8294 %
8295 % we cannot stop the loop; what we can turn it into no-op:
8296 \let\pgfplots@coord@stream@coord@=\relax
8297 }{%
8298 }%
8299 }%
8300
8301 \def\pgfplotspointattime@pointbetween@two{%
8302 \pgfplotscoordmath{default}{op}{subtract}{{\pgfplotspointattime@value@target}{\pgfplots@len@last}}%
8303 \let\pgfplots@tmp=\pgfmathresult
8304 \pgfplotscoordmath{default}{op}{subtract}{{\pgfplotspointattime@value@current}{\pgfplots@len@last}}%
8305 \pgfplotscoordmath{default}{op}{divide}{{\pgfplots@tmp}{\pgfmathresult}}%
8306 \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
8307 \let\pgfplots@time@between@two=\pgfmathresult
8308 %\message{HIT of \pgfplotspointattime@value@target\space between \pgfplots@len@last\space and \pgfplotspointattime@value@current\space (\pgfplots@time@between@two)^^J}%
8309 \ifx\pgfplots@last@processed\pgfutil@empty
8310 \pgfplotsplothandlerserializepointto{\pgfplots@cur}%
8311 \else
8312 \pgfplotsplothandlersurveypointattime{\pgfplots@time@between@two}{\pgfplots@last@processed}{\pgfplots@cur}%
8313 \fi
8314 \pgfplotsplothandlerserializepointto\pgfplots@loc@TMPa
8315 \global\let\pgfplotspointplotattimecoords=\pgfplots@loc@TMPa
8316 \pgfplotsaxisvisphasegetpoint
8317 \global\let\pgfplotspointplotattimefirst=\pgfplots@last@processed
8318 \global\let\pgfplotspointplotattimesecond=\pgfplots@cur
8319 }%
8320
8321
8322 % #1 : either x,y, or z
8323 % #2 : the argument on which the inv trafo shall be applied. It has to
8324 % be a fixed point number.
8325 \def\pgfplots@coord@inv@trafo@apply#1#2{%
8326 \edef\pgfmathresult{#2}%
8327 \pgfkeysgetvalue{/pgfplots/#1 coord inv trafo/.@cmd}\pgfplots@loc@TMPa
8328 \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key
8329 \else
8330 \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}\pgfeov
8331 \fi
8332 }%
8333
8334 % INPUT:
8335 % either floating point or fixed point coordinates (depending on the
8336 % state of the \ifpgfplots@apply@datatrafo boolean)
8337 %
8338 \long\def\pgfplots@coord@stream@finalize@storedcoords@START{%
8339 % de-activate the FPU here! I fear its number
8340 % format may cause errors when used in low-level
8341 % routines.
8342 \pgfkeys{/pgf/fpu=false}%
8343 %
8344 \pgfplots@assert@tikzinternal@exists{tikz@make@last@position}%
8345 %
8346 \ifpgfplots@clip
8347 \else
8348 % "clip marker paths=true" actually doesn't checks anything --
8349 % it leaves the checks to the clip path. But since there is no
8350 % clip path, it is adequate to use it here:
8351 \pgfplots@clip@marker@pathstrue
8352 \fi
8353 %
8354 \pgfplots@stored@current@cmd%[current plot style] <--- options are already set
8355 \pgfextra
8356 %
8357 \tikzset{every plot/.try}%
8358 \pgfplots@coord@stream@INIT@finalize@storedcoords%
8359 %
8360 \iffalse
8361 %\ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard
8362 % discard!? Well, no need to loop through the elements.
8363 % But there may be a good reason that we entered the phase!
8364 % keep it.
8365 % FIXME : this does not work, although it might be desirable.
8366 % It fails because we need the named start/end points.
8367 \pgfplots@coord@stream@start
8368 \pgfplots@coord@stream@end
8369 \else
8370 \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@stored@current@data}%
8371 \fi
8372 %
8373 % This here ensures that the LAST position of the path is the last plotted point.
8374 % However, the "last plotted point" is not necessarily the LAST in the sequence.
8375 % This here is the last plotted point:
8376 \xdef\pgfplotlastpoint{\noexpand\pgfpointanchor{current plot end}{center}}%
8377 \tikz@make@last@position{\pgfplotlastpoint}%
8378 %
8379 % the coordinate stream will be assigned as soon as it is needed:
8380 \global\let\pgfplots@plot@timer@args=\relax
8381 \pgfplotspointplotattimeclearcache
8382 \let\tikz@timer=\pgfplots@plot@timer%
8383 \pgfplotsaxisvisphase@get@afterpath%
8384 \expandafter
8385 \endpgfextra
8386 \pgfplotsretval
8387 ;%
8388 %
8389 \pgfplotspointplotattimeclearcache
8390 \global\let\pgfplots@plot@timer@args=\relax
8391 %
8392 }%
8393
8394 % Defines \pgfplotsretval to contain the "after path", i.e. the
8395 % standard tikz instructions which are to be carried out after the
8396 % plot path. This depends on the current visualization phase and the
8397 % available visualization phases.
8398 \def\pgfplotsaxisvisphase@get@afterpath{%
8399 \ifx\pgfplots@visphase@name\pgfplotsaxis@visphase@name@default
8400 % ah - we have the standard visualization phase. Draw them
8401 % here.
8402 %
8403 % Note that the existence of (nontrivial) after path
8404 % instructions ALWAYS implies the existence of a standard
8405 % visualization phase (compare \pgfplotssurveyphase@set@visphase@names)
8406 \let\pgfplotsretval=\pgfplots@serialized@afterpath%
8407 \else
8408 \let\pgfplotsretval=\pgfutil@empty
8409 \fi
8410 }%
8411
8412
8413 % This routine is called at the begin of every plot.
8414 % It initialises a zero level stream.
8415 %
8416 % The default is to use '0' as zero level streams.
8417 %
8418 % This method is called as "precommand"; before any Tikz drawing
8419 % commands have been started.
8420 \def\pgfplots@initzerolevelhandler{%
8421 \ifpgfplots@stackedmode
8422 % ATTENTION: this thing here says:
8423 % "draw zero level coordinates from list XYZ."
8424 % But at the time of this initialisation, the list will be EMPTY!
8425 %
8426 % It will be filled later. That's ok, because
8427 % \pgfplots@initzerolevelhandler will be
8428 % used as 'precommand', that means before Tikz sees any
8429 % coordinates.
8430 \pgfplots@stacked@initzerolevelhandler
8431 \else
8432 \ifpgfplots@threedim
8433 \def\pgfplotxzerolevelstreamstart{}%
8434 \def\pgfplotxzerolevelstreamend{}%
8435 \def\pgfplotxzerolevelstreamnext{%
8436 \begingroup
8437 \pgf@xa=\pgf@y
8438 \pgfplotsqpointxyz{\pgfplots@logical@ZERO@x}{\pgfplots@current@point@y}{\ifpgfplots@curplot@threedim\pgfplots@current@point@z\else\pgfplots@logical@ZERO@z\fi}%
8439 \global\pgf@x=\pgf@x
8440 \global\pgf@y=\pgf@xa
8441 \endgroup
8442 }%
8443 %
8444 \def\pgfplotyzerolevelstreamstart{}%
8445 \def\pgfplotyzerolevelstreamend{}%
8446 \def\pgfplotyzerolevelstreamnext{%
8447 \begingroup
8448 \pgf@xa=\pgf@y
8449 \pgfplotsqpointxyz{\pgfplots@current@point@x}{\pgfplots@current@point@y}{\pgfplots@logical@ZERO@z}%
8450 \global\pgf@x=\pgf@y
8451 \global\pgf@y=\pgf@xa
8452 \endgroup
8453 }%
8454 \else
8455 \pgfplotspointaxisorigin
8456 \expandafter\pgfplotxzerolevelstreamconstant\expandafter{\the\pgf@x}%
8457 \expandafter\pgfplotyzerolevelstreamconstant\expandafter{\the\pgf@y}%
8458 \fi
8459 \fi
8460 }
8461
8462 % This code is mainly interesting for bar plots.
8463 %
8464 % It precomputes x = 0 and y = 0 - which is not necessarily
8465 % trivial in case of data scaling. Furthermore, it applies
8466 % coordinate clipping to the resulting values and multiplies them
8467 % with x- and y scale vectors.
8468 \def\pgfplots@prepare@ZERO@coordinates{%
8469 \ifpgfplots@xislinear
8470 \ifpgfplots@apply@datatrafo@x
8471 \pgfplotscoordmath{x}{parsenumber}{0}%
8472 \pgfplotscoordmath{x}{datascaletrafo}{\pgfmathresult}%
8473 \global\let\pgfplots@logical@ZERO@x=\pgfmathresult
8474 \else
8475 \gdef\pgfplots@logical@ZERO@x{0}%
8476 \fi
8477 % this works in standard fixed pt math:
8478 \pgfplotsmathmax{\pgfplots@logical@ZERO@x}{\pgfplots@xmin}%
8479 \global\let\pgfplots@logical@ZERO@x=\pgfmathresult
8480 \pgfplotsmathmin{\pgfplots@logical@ZERO@x}{\pgfplots@xmax}%
8481 \global\let\pgfplots@logical@ZERO@x=\pgfmathresult
8482 \else
8483 \if\pgfplots@log@origin@choice@x0%
8484 \global\let\pgfplots@logical@ZERO@x=\pgfplots@xmin%
8485 \else
8486 \gdef\pgfplots@logical@ZERO@x{0}%
8487 \fi
8488 \fi
8489 %
8490 \ifpgfplots@yislinear
8491 \ifpgfplots@apply@datatrafo@y
8492 \pgfplotscoordmath{y}{parsenumber}{0}%
8493 \pgfplotscoordmath{y}{datascaletrafo}{\pgfmathresult}%
8494 \global\let\pgfplots@logical@ZERO@y=\pgfmathresult
8495 \else
8496 \gdef\pgfplots@logical@ZERO@y{0}%
8497 \fi
8498 \pgfplotsmathmax{\pgfplots@logical@ZERO@y}{\pgfplots@ymin}%
8499 \global\let\pgfplots@logical@ZERO@y=\pgfmathresult
8500 \pgfplotsmathmin{\pgfplots@logical@ZERO@y}{\pgfplots@ymax}%
8501 \global\let\pgfplots@logical@ZERO@y=\pgfmathresult
8502 \else
8503 \if\pgfplots@log@origin@choice@y0%
8504 \global\let\pgfplots@logical@ZERO@y=\pgfplots@ymin%
8505 \else
8506 \gdef\pgfplots@logical@ZERO@y{0}%
8507 \fi
8508 \fi
8509 %
8510 \ifpgfplots@threedim
8511 \ifpgfplots@zislinear
8512 \ifpgfplots@apply@datatrafo@z
8513 \pgfplotscoordmath{z}{parsenumber}{0}%
8514 \pgfplotscoordmath{z}{datascaletrafo}{\pgfmathresult}%
8515 \global\let\pgfplots@logical@ZERO@z=\pgfmathresult
8516 \else
8517 \gdef\pgfplots@logical@ZERO@z{0}%
8518 \fi
8519 \pgfplotsmathmax{\pgfplots@logical@ZERO@z}{\pgfplots@zmin}%
8520 \global\let\pgfplots@logical@ZERO@z=\pgfmathresult
8521 \pgfplotsmathmin{\pgfplots@logical@ZERO@z}{\pgfplots@zmax}%
8522 \global\let\pgfplots@logical@ZERO@z=\pgfmathresult
8523 \else
8524 \if\pgfplots@log@origin@choice@z0%
8525 \global\let\pgfplots@logical@ZERO@z=\pgfplots@zmin%
8526 \else
8527 \gdef\pgfplots@logical@ZERO@z{0}%
8528 \fi
8529 \fi
8530 \fi
8531 %
8532 %
8533 \ifpgfplots@threedim
8534 \pgfplotsqpointxyz{\pgfplots@logical@ZERO@x}{\pgfplots@logical@ZERO@y}{\pgfplots@logical@ZERO@z}%
8535 \else
8536 \pgfplotsqpointxy{\pgfplots@logical@ZERO@x}{\pgfplots@logical@ZERO@y}%
8537 \fi
8538 \xdef\pgfplots@ZERO@x{\the\pgf@x}%
8539 \xdef\pgfplots@ZERO@y{\the\pgf@y}%
8540 \xdef\pgfplotspointaxisorigin{\noexpand\global\pgf@x=\pgfplots@ZERO@x\space\noexpand\global\pgf@y=\pgfplots@ZERO@y\space}%
8541 %
8542 %
8543 %--------------------------------------------------
8544 % \pgfkeyslet{/pgfplots/axis/zero/x}\pgfplots@logical@ZERO@x
8545 % \pgfkeyslet{/pgfplots/axis/zero/y}\pgfplots@logical@ZERO@y
8546 % \ifpgfplots@threedim
8547 % \pgfkeyslet{/pgfplots/axis/zero/z}\pgfplots@logical@ZERO@z
8548 % \fi
8549 %--------------------------------------------------
8550 }%
8551
8552
8553
8554 % the low-level Tikz command which implements 'plot graphics'.
8555 %
8556 % It's current state is described by some pgfkeys options and two
8557 % coordinates.
8558 \def\pgfplotsplothandlergraphics{%
8559 \def\pgf@plotstreamstart{%
8560 \gdef\pgfplots@plot@handler@graphics@bb@first{\pgf@x=16000pt \pgf@y=16000pt }%
8561 \gdef\pgfplots@plot@handler@graphics@bb@second{\pgf@x=-16000pt \pgf@y=-16000pt }%
8562 \global\let\pgf@plotstreampoint=\pgfplots@plot@handler@graphics@collectbb%
8563 \global\let\pgf@plotstreamspecial=\pgfutil@gobble%
8564 \global\let\pgf@plotstreamend=\pgfplots@plot@handler@graphics@finish%
8565 \def\pgfplotsplothandlervisualizejump{%
8566 \pgfplots@error{Sorry, plot graphics does not support 'unbounded coords=jump'.}%
8567 }%
8568 }%
8569 \def\pgfplotsplothandlername{graphics}%
8570 }%
8571 \def\pgfplots@plot@handler@graphics@collectbb#1{%
8572 \pgf@process{#1}%
8573 \pgf@xa=\pgf@x
8574 \pgf@ya=\pgf@y
8575 \pgfplots@plot@handler@graphics@bb@first
8576 \ifdim\pgf@xa<\pgf@x \pgf@x=\pgf@xa\fi
8577 \ifdim\pgf@ya<\pgf@y \pgf@y=\pgf@ya\fi
8578 \xdef\pgfplots@plot@handler@graphics@bb@first{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
8579 %
8580 \pgfplots@plot@handler@graphics@bb@second
8581 \ifdim\pgf@xa>\pgf@x \pgf@x=\pgf@xa\fi
8582 \ifdim\pgf@ya>\pgf@y \pgf@y=\pgf@ya\fi
8583 \xdef\pgfplots@plot@handler@graphics@bb@second{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
8584 %
8585 }%
8586 \def\pgfplots@plot@handler@graphics@finish{%
8587 \let\pgfplots@plot@handler@graphics@pointmap@B@canvas\pgfutil@empty
8588 %
8589 % check if we have a pointmap. If so, the pointmap should be used
8590 % to place the graphics.
8591 \pgfkeysgetvalue{/pgfplots/plot graphics/points}\pgfplots@plot@handler@graphics@pointmap
8592 \ifx\pgfplots@plot@handler@graphics@pointmap\pgfutil@empty
8593 \else
8594 \let\pgfplots@plot@handler@graphics@parsepointmap@error=\relax
8595 \expandafter\pgfplots@plot@handler@graphics@parsepointmap\expandafter{\pgfplots@plot@handler@graphics@pointmap}%
8596 \fi
8597 %
8598 %
8599 \ifx\pgfplots@plot@handler@graphics@pointmap@B@canvas\pgfutil@empty
8600 % no pointmap. Good; then squeze graphics into the bounding
8601 % box:
8602 \pgfplots@plot@handler@graphics@usebb
8603 \else
8604 % oh, a pointmap! Process it.
8605 \pgfplots@plot@handler@graphics@process@pointmap
8606 \fi
8607 }%
8608
8609 % Parses the argument of '/pgfplots/plot graphics/points'.
8610 %
8611 % #1: the argument of the key above.
8612 \def\pgfplots@plot@handler@graphics@parsepointmap#1{%
8613 \let\pgfplots@plot@handler@graphics@pointmap@A@canvas\pgfutil@empty
8614 \let\pgfplots@plot@handler@graphics@pointmap@A@img\pgfutil@empty
8615 \let\pgfplots@plot@handler@graphics@pointmap@B@canvas\pgfutil@empty
8616 \let\pgfplots@plot@handler@graphics@pointmap@B@img\pgfutil@empty
8617 \let\pgfplots@plot@handler@graphics@pointmap@C@canvas\pgfutil@empty
8618 \let\pgfplots@plot@handler@graphics@pointmap@C@img\pgfutil@empty
8619 \let\pgfplots@plot@handler@graphics@pointmap@D@canvas\pgfutil@empty
8620 \let\pgfplots@plot@handler@graphics@pointmap@D@img\pgfutil@empty
8621 \pgfplots@plot@handler@graphics@parsepointmap@loop#1\pgfplots@EOI
8622 \ifpgfplots@plot@graphics@autoadjustaxis
8623 \ifx\pgfplots@plot@handler@graphics@pointmap@A@img\pgfutil@empty
8624 \else
8625 \ifx\pgfplots@plot@handler@graphics@pointmap@D@img\pgfutil@empty
8626 \def\pgfplots@loc@TMPa{#1}%
8627 \pgfplots@plot@handler@graphics@parsepointmap@error
8628 \fi
8629 \fi
8630 \fi
8631 }%
8632 \def\pgfplots@plot@handler@graphics@parsepointmap@error{%
8633 \pgfplots@error{plot graphics/points={\pgfplots@loc@TMPa} cannot be processed: I need at least *four* inner anchor points to automatically adjust the axis, i.e. 4 points of the form (x,y,z) => (imgx,imgy). Use 'plot graphics/auto adjust axis=false' to disable this feature}%
8634 }%
8635 \def\pgfplots@plot@handler@graphics@parsepointmap@loop{%
8636 \pgfutil@ifnextchar\pgfplots@EOI{%
8637 \pgfplots@gobble@until@EOI
8638 }{%
8639 \pgfplots@plot@handler@graphics@parsepointmap@loop@
8640 }%
8641 }%
8642 \def\pgfplots@plot@handler@graphics@parsepointmap@loop@(#1,#2){%
8643 \pgfutil@ifnextchar={%
8644 \pgfplots@plot@handler@graphics@parsepointmap@loop@@(#1,#2)%
8645 }{%
8646 \pgfplots@plot@handler@graphics@parsepointmap@loop@@(#1,#2)=>(,)%
8647 }%
8648 }%
8649 \def\pgfplots@plot@handler@graphics@parsepointmap@loop@@(#1,#2)=>{%
8650 \pgfutil@ifnextchar({%
8651 \pgfplots@plot@handler@graphics@parsepointmap@loop@@@(#1,#2)%
8652 }{%
8653 \pgfplots@error{Syntax error for plot graphics/pointmap: expected '(#1,#2) => (...,...)'}%
8654 \pgfplots@gobble@until@EOI
8655 }%
8656 }
8657 \def\pgfplots@plot@handler@graphics@parsepointmap@loop@@@(#1,#2)(#3,#4){%
8658 \def\pgfplotsplothandlergraphicspointmappointindex{}%
8659 \def\pgfplots@loc@TMPc{#4}%
8660 \ifx\pgfplots@loc@TMPc\pgfutil@empty
8661 \else
8662 \ifx\pgfplots@plot@handler@graphics@pointmap@A@img\pgfutil@empty
8663 \def\pgfplotsplothandlergraphicspointmappointindex{A}%
8664 \else
8665 \ifx\pgfplots@plot@handler@graphics@pointmap@B@img\pgfutil@empty
8666 \def\pgfplotsplothandlergraphicspointmappointindex{B}%
8667 \else
8668 \ifx\pgfplots@plot@handler@graphics@pointmap@C@img\pgfutil@empty
8669 \def\pgfplotsplothandlergraphicspointmappointindex{C}%
8670 \else
8671 \ifx\pgfplots@plot@handler@graphics@pointmap@D@img\pgfutil@empty
8672 \def\pgfplotsplothandlergraphicspointmappointindex{D}%
8673 \else
8674 \def\pgfplotsplothandlergraphicspointmappointindex{*}%
8675 %\pgfplots@error{Sorry, the argument '(#1,#2) => (#3,#4)' of plot graphics/pointmap is superfluous; ignoring it.}%
8676 \fi
8677 \fi
8678 \fi
8679 \fi
8680 \pgfmathparse{#3}%
8681 \let\pgfplots@loc@TMPb=\pgfmathresult
8682 %
8683 \pgfmathparse{#4}%
8684 \expandafter\edef\csname pgfplots@plot@handler@graphics@pointmap@\pgfplotsplothandlergraphicspointmappointindex @img\endcsname{{\pgfplots@loc@TMPb}{\pgfmathresult}}%
8685 \fi
8686 %
8687 %
8688 \pgfutil@in@,{#2}%
8689 \ifpgfutil@in@
8690 \def\pgfplots@loc@TMPa##1,##2\relax{%
8691 \expandafter\edef\csname pgfplots@plot@handler@graphics@pointmap@\pgfplotsplothandlergraphicspointmappointindex @logical\endcsname{{#1}{##1}{##2}}%
8692 %
8693 \pgfplotsplothandlergraphicspointmappoint(#1,##1,##2)(#3,#4)
8694 }%
8695 \pgfplots@loc@TMPa#2\relax
8696 \else
8697 \expandafter\edef\csname pgfplots@plot@handler@graphics@pointmap@\pgfplotsplothandlergraphicspointmappointindex @logical\endcsname{{#1}{#2}{}}%
8698 \pgfplotsplothandlergraphicspointmappoint(#1,#2,)(#3,#4)
8699 \fi
8700 \pgfplots@plot@handler@graphics@parsepointmap@loop
8701 }
8702
8703 \def\pgfplotsplothandlergraphics@survey@pointmappoint(#1,#2,#3)(#4,#5){%
8704 \def\pgfplots@current@point@x{#1}%
8705 \def\pgfplots@current@point@y{#2}%
8706 \def\pgfplots@current@point@z{#3}%
8707 \pgfplots@coord@stream@coord
8708 }%
8709
8710 % PRECONDITION:
8711 % \pgfplotsplothandlergraphicspointmappointindex is
8712 % empty if and only if (#4,#5) is empty
8713 % or it is an index among all points with non--empty (#4,#5) image
8714 % coordinates.
8715 \def\pgfplotsplothandlergraphicspointmappoint(#1,#2,#3)(#4,#5){%
8716 \ifx\pgfplotsplothandlergraphicspointmappointindex\pgfutil@empty
8717 \else
8718 \def\pgfplots@loc@TMPc{#3}%
8719 \ifx\pgfplots@loc@TMPc\pgfutil@empty
8720 \pgfplotspointaxisxy{#1}{#2}%
8721 \else
8722 \pgfplotspointaxisxyz{#1}{#2}{#3}%
8723 \fi
8724 \expandafter\edef\csname pgfplots@plot@handler@graphics@pointmap@\pgfplotsplothandlergraphicspointmappointindex @canvas\endcsname{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
8725 \fi
8726 }%
8727
8728 % Computes view-related keys which should be communicated to the axis
8729 % in order to render the plot graphics correctly.
8730 %
8731 % @POSTCONDITION: \pgfplotsretval contains any required keys.
8732 \def\pgfplotsplothandlergraphicspointmapcomputerequiredview{%
8733 \begingroup
8734 \let\pgfplotsretval=\pgfutil@empty
8735 \ifx\pgfplots@plot@handler@graphics@pointmap@D@img\pgfutil@empty
8736 \else
8737 \pgfkeysgetvalue{/pgfplots/plot graphics/debug}\pgfplots@loc@TMPa
8738 \def\pgfplots@loc@TMPb{false}%
8739 \ifx\pgfplots@loc@TMPa\pgfutil@empty
8740 \let\pgfplots@loc@TMPa=\pgfplots@loc@TMPb
8741 \fi
8742 \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
8743 \def\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug{0}%
8744 \else
8745 \def\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug{1}%
8746 \fi
8747 % The following implementation computes the 'unit vector
8748 % ratio' of the IMAGE.
8749 %
8750 % It then tells PGFPlots to use the very same unit vector
8751 % ratio for its axis.
8752 %
8753 %
8754 % The actual implementation is dumb; it requires 4 (!) points for
8755 % which BOTH, the 3D coordinates and the projected 2D
8756 % coordinates relative to the image's lower left corner are
8757 % available.
8758 %
8759 % Since the 2D projected coordinates are generated by the map
8760 %
8761 % T(x,y,z) = o + x e_x + y e_y + z e_z in R^2
8762 % with o,e_x,e_y,e_z in R^2,
8763 %
8764 % I have 8 degrees of freedom (two for each of the four
8765 % involved vectors). Thus, a simple approach is to provide 4
8766 % linearly independent points to get 8 equations.
8767 %
8768 % Then, I solve for o,e_x,e_y,e_z
8769 %
8770 \pgfplotsmatrixnewempty\pgfplotsmatrix
8771 \pgfplotsmatrixresize\pgfplotsmatrix88%
8772 %
8773 \pgfplotsarraynewempty\pgfplotsE
8774 \pgfplotsarrayresize\pgfplotsE8%
8775 %
8776 \def\pgfplots@extractimg##1##2{%
8777 \def\pgfplots@img@x{##1}%
8778 \def\pgfplots@img@y{##2}%
8779 }%
8780 \def\pgfplots@extractlogical##1##2##3{%
8781 \def\pgfplots@logical@x{##1}%
8782 \def\pgfplots@logical@y{##2}%
8783 \def\pgfplots@logical@z{##3}%
8784 }%
8785 % Assemble the linear system such that
8786 % x = [
8787 % exx
8788 % exy
8789 % eyx
8790 % eyy
8791 % ezx
8792 % ezy
8793 % ox
8794 % oy]
8795 % are the degrees of freedom.
8796 \c@pgfplots@coordindex=0
8797 \pgfplotsutilforeachcommasep{A,B,C,D}\as\pgfplots@loc@TMPa{%
8798 \expandafter\expandafter\expandafter\pgfplots@extractimg\csname pgfplots@plot@handler@graphics@pointmap@\pgfplots@loc@TMPa @img\endcsname
8799 \expandafter\expandafter\expandafter\pgfplots@extractlogical\csname pgfplots@plot@handler@graphics@pointmap@\pgfplots@loc@TMPa @logical\endcsname
8800 \ifx\pgfplots@logical@z\pgfutil@empty
8801 \else
8802 %
8803 \pgfplotsmatrixletentry \the\c@pgfplots@coordindex,0\of\pgfplotsmatrix=\pgfplots@logical@x%
8804 \pgfplotsmatrixset \the\c@pgfplots@coordindex,1\of\pgfplotsmatrix\to{0}%
8805 \pgfplotsmatrixletentry \the\c@pgfplots@coordindex,2\of\pgfplotsmatrix=\pgfplots@logical@y%
8806 \pgfplotsmatrixset \the\c@pgfplots@coordindex,3\of\pgfplotsmatrix\to{0}%
8807 \pgfplotsmatrixletentry \the\c@pgfplots@coordindex,4\of\pgfplotsmatrix=\pgfplots@logical@z%
8808 \pgfplotsmatrixset \the\c@pgfplots@coordindex,5\of\pgfplotsmatrix\to{0}%
8809 \pgfplotsmatrixset \the\c@pgfplots@coordindex,6\of\pgfplotsmatrix\to{1}%
8810 \pgfplotsmatrixset \the\c@pgfplots@coordindex,7\of\pgfplotsmatrix\to{0}%
8811 %
8812 \pgfplotsarrayletentry\c@pgfplots@coordindex\of\pgfplotsE=\pgfplots@img@x
8813 %
8814 \advance\c@pgfplots@coordindex by1
8815 \pgfplotsmatrixset \the\c@pgfplots@coordindex,0\of\pgfplotsmatrix\to{0}%
8816 \pgfplotsmatrixletentry \the\c@pgfplots@coordindex,1\of\pgfplotsmatrix=\pgfplots@logical@x%
8817 \pgfplotsmatrixset \the\c@pgfplots@coordindex,2\of\pgfplotsmatrix\to{0}%
8818 \pgfplotsmatrixletentry \the\c@pgfplots@coordindex,3\of\pgfplotsmatrix=\pgfplots@logical@y%
8819 \pgfplotsmatrixset \the\c@pgfplots@coordindex,4\of\pgfplotsmatrix\to{0}%
8820 \pgfplotsmatrixletentry \the\c@pgfplots@coordindex,5\of\pgfplotsmatrix=\pgfplots@logical@z%
8821 \pgfplotsmatrixset \the\c@pgfplots@coordindex,6\of\pgfplotsmatrix\to{0}%
8822 \pgfplotsmatrixset \the\c@pgfplots@coordindex,7\of\pgfplotsmatrix\to{1}%
8823 %
8824 \pgfplotsarrayletentry\c@pgfplots@coordindex\of\pgfplotsE=\pgfplots@img@y
8825 %
8826 \advance\c@pgfplots@coordindex by1
8827 \fi
8828 }%
8829 \ifx\pgfplots@logical@z\pgfutil@empty
8830 \else
8831 \if1\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug
8832 \pgfplotsplothandlergraphics@debug@matrix@to@string
8833 \fi
8834 %
8835 %
8836 \pgfplotsmatrixsolveLEQS\pgfplotsmatrix=\pgfplotsE
8837 %
8838 \edef\pgfmathresult{\pgfplotsarrayvalueofelem0\of\pgfplotsE}%
8839 \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
8840 \let\pgfplots@xx=\pgfmathresult
8841 \edef\pgfmathresult{\pgfplotsarrayvalueofelem1\of\pgfplotsE}%
8842 \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
8843 \let\pgfplots@xy=\pgfmathresult
8844 \if r\pgfkeysvalueof{/pgfplots/x dir/value}%
8845 % they will be reversed again during the final
8846 % processing:
8847 \edef\pgfplots@xx{-\pgfplots@xx}%
8848 \edef\pgfplots@xy{-\pgfplots@xy}%
8849 \fi
8850 %
8851 \edef\pgfmathresult{\pgfplotsarrayvalueofelem2\of\pgfplotsE}%
8852 \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
8853 \let\pgfplots@yx=\pgfmathresult
8854 \edef\pgfmathresult{\pgfplotsarrayvalueofelem3\of\pgfplotsE}%
8855 \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
8856 \let\pgfplots@yy=\pgfmathresult
8857 \if r\pgfkeysvalueof{/pgfplots/y dir/value}%
8858 % they will be reversed again during the final
8859 % processing:
8860 \edef\pgfplots@yx{-\pgfplots@yx}%
8861 \edef\pgfplots@yy{-\pgfplots@yy}%
8862 \fi
8863 %
8864 \edef\pgfmathresult{\pgfplotsarrayvalueofelem4\of\pgfplotsE}%
8865 \pgfkeysgetvalue{/pgfplots/plot graphics/snap z}\pgfplots@loc@TMPa
8866 \ifx\pgfplots@loc@TMPa\pgfutil@empty
8867 \else
8868 \let\pgfplots@zx=\pgfmathresult
8869 \pgfplotscoordmath{default}{op}{veclen}{%
8870 {\pgfplotsarrayvalueofelem4\of\pgfplotsE}%
8871 {\pgfplotsarrayvalueofelem5\of\pgfplotsE}%
8872 }%
8873 \let\pgfplotszlen=\pgfmathresult
8874 %
8875 % compute 'snap z' relative to
8876 % '\pgfplotszlen'
8877 \pgfplotscoordmath{default}{parsenumber}{\pgfplots@loc@TMPa}%
8878 \pgfplotscoordmath{default}{op}{multiply}{{\pgfmathresult}{\pgfplotszlen}}%
8879 \let\pgfplots@loc@TMPa=\pgfmathresult
8880 %
8881 \pgfplotscoordmath{default}{op}{abs}{{\pgfplots@zx}}%
8882 \pgfplotscoordmath{default}{if less than}{\pgfmathresult}{\pgfplots@loc@TMPa}{%
8883 \pgfplotscoordmath{default}{zero}%
8884 }{%
8885 \let\pgfmathresult=\pgfplots@zx
8886 }%
8887 \fi
8888 \pgfplotscoordmath{default}{tofixed}\pgfmathresult%
8889 \let\pgfplots@zx=\pgfmathresult
8890 %
8891 \edef\pgfmathresult{\pgfplotsarrayvalueofelem5\of\pgfplotsE}%
8892 \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
8893 \let\pgfplots@zy=\pgfmathresult
8894 \if r\pgfkeysvalueof{/pgfplots/z dir/value}%
8895 % they will be reversed again during the final
8896 % processing:
8897 \edef\pgfplots@zx{-\pgfplots@zx}%
8898 \edef\pgfplots@zy{-\pgfplots@zy}%
8899 \fi
8900 %
8901 %
8902 \if1\b@pgfplots@compat@plot@graphics@threedim
8903 \pgfplotswarning{plot3 graphics compatibility mode}\pgfeov%
8904 \else
8905 \fi
8906 %
8907 \edef\pgfplotsretval{%
8908 x={(\pgfplots@xx,\pgfplots@xy)},%
8909 y={(\pgfplots@yx,\pgfplots@yy)},%
8910 z={(\pgfplots@zx,\pgfplots@zy)},%
8911 scale mode=scale uniformly,%
8912 \if1\b@pgfplots@compat@plot@graphics@threedim
8913 % this is the only strategy pre 1.6
8914 scale uniformly strategy=change vertical limits,%
8915 \fi
8916 }%
8917 %
8918 \if1\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug
8919 \pgfplotsplothandlergraphicspointmapcomputerequiredview@debug@output
8920 \fi
8921 %
8922 \ifx\pgfplotsretval\pgfutil@empty
8923 \pgfplots@error{plot graphics failed to perform the 'auto adjust axis' feature \csname on@line\endcsname\space\space (compare 'plot graphics[debug]). The graphics might be scaled incorrectly. Perhaps the provided 'points' are not linearly independent?}%
8924 \else
8925 \begingroup
8926 \pgfkeysgetvalue{/pgfplots/plot graphics/src}\pgfplots@loc@TMPa
8927 \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}%
8928 \immediate\write
8929 \if1\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug 16\else -1\fi
8930 {PGFPlots plot graphics[auto adjust axis=true] {\the\t@pgfplots@tokc} \csname on@line\endcsname: determined options '\pgfplotsretval'.
8931 \if1\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug
8932 See \the\t@[email protected] for debug output.
8933 \else
8934 Use 'plot graphics[debug]' or 'plot graphics[debug=visual]' to generate debug output files.
8935 \fi
8936 ^^J}%
8937 \endgroup
8938 \fi
8939 %
8940 \fi
8941 \fi
8942 \pgfmath@smuggleone\pgfplotsretval
8943 \endgroup
8944 }%
8945 \def\pgfplotsplothandlergraphics@debug@matrix@to@string{%
8946 \pgfplotsmatrixtotext\pgfplotsmatrix
8947 \let\pgfplotsmatrix@text=\pgfplotsretval
8948 \pgfplotsarraytotext\pgfplotsE
8949 \let\pgfplotsrhs@text=\pgfplotsretval
8950 }%
8951 \def\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug@output{%
8952 \begingroup
8953 \immediate\openout\w@pgf@writea=\pgfkeysvalueof{/pgfplots/plot graphics/src}.dat
8954 \pgfplotsarrayselect0\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPa=\pgfmathresult
8955 \pgfplotsarrayselect1\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPb=\pgfmathresult
8956 \immediate\write\w@pgf@writea{img x unit=\pgfplots@loc@TMPa\space\pgfplots@loc@TMPb\if r\pgfkeysvalueof{/pgfplots/x dir/value}(reversed due to x dir=reverse)\fi,}%
8957 \pgfplotsarrayselect2\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPa=\pgfmathresult
8958 \pgfplotsarrayselect3\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPb=\pgfmathresult
8959 \immediate\write\w@pgf@writea{img y unit=\pgfplots@loc@TMPa\space\pgfplots@loc@TMPb\if r\pgfkeysvalueof{/pgfplots/y dir/value}(reversed due to y dir=reverse)\fi,}%
8960 \pgfplotsarrayselect4\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPa=\pgfmathresult
8961 \pgfplotsarrayselect5\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPb=\pgfmathresult
8962 \immediate\write\w@pgf@writea{img z unit=\pgfplots@loc@TMPa\space\pgfplots@loc@TMPb,}%
8963 \pgfplotsarrayselect6\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPa=\pgfmathresult
8964 \pgfplotsarrayselect7\of\pgfplotsE\to\pgfmathresult \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}\let\pgfplots@loc@TMPb=\pgfmathresult
8965 \immediate\write\w@pgf@writea{img origin=\pgfplots@loc@TMPa\space\pgfplots@loc@TMPb\if r\pgfkeysvalueof{/pgfplots/z dir/value}(reversed due to z dir=reverse)\fi,}%
8966 \def\n{^^J}%
8967 \def\t{^^I}%
8968 \immediate\write\w@pgf@writea{canvasmapmatrix=[\pgfplotsmatrix@text];^^Jcanvasmaprhs = [\pgfplotsrhs@text];^^J}%
8969 %
8970 \immediate\write\w@pgf@writea{key configuration = \pgfplotsretval;^^J}%
8971 \immediate\write\w@pgf@writea{use debug=visual to see the mapped keys.^^J}%
8972 \immediate\closeout\w@pgf@writea
8973 \endgroup
8974 }%
8975
8976 \def\pgfplots@plot@handler@graphics@process@pointmap{%
8977 \begingroup
8978 % determine natural size:
8979 \pgfplots@invoke@pgfkeyscode{/pgfplots/plot graphics/lowlevel get natural size/.@cmd}{}%
8980 \def\pgfplots@loc@TMPa##1##2{%
8981 \global\pgf@x=##1
8982 \global\pgf@y=##2
8983 }%
8984 \expandafter\pgfplots@loc@TMPa\pgfmathresult
8985 \edef\pgfplots@W{\pgf@sys@tonumber\pgf@x}% natural WIDTH
8986 \edef\pgfplots@H{\pgf@sys@tonumber\pgf@y}% natural HEIGHT
8987 %
8988 \def\pgfplots@extractimg##1##2{%
8989 \def\pgfplots@img@x{##1}%
8990 \def\pgfplots@img@y{##2}%
8991 }%
8992 \def\pgfplots@extractimgaspoint##1##2{%
8993 \pgfqpoint{##1pt}{##2pt}%
8994 }%
8995 \expandafter\pgfplots@extractimg\pgfplots@plot@handler@graphics@pointmap@A@img% anchor 1 in image
8996 \let\pgfplots@Ax=\pgfplots@img@x
8997 \let\pgfplots@Ay=\pgfplots@img@y
8998 %
8999 \pgfplots@plot@handler@graphics@pointmap@A@canvas% the canvas coordinate corresponding to 'A'
9000 \edef\pgfplots@ax{\pgf@sys@tonumber\pgf@x}% call it 'a'
9001 \edef\pgfplots@ay{\pgf@sys@tonumber\pgf@y}%
9002 %
9003 % compute the CANVAS diagonal between the two anchors points a,b,
9004 % dd := b-a
9005 \pgfpointdiff
9006 \pgfplots@plot@handler@graphics@pointmap@A@canvas
9007 \pgfplots@plot@handler@graphics@pointmap@B@canvas
9008 \edef\pgfplots@ddx{\pgf@sys@tonumber\pgf@x}%
9009 \edef\pgfplots@ddy{\pgf@sys@tonumber\pgf@y}%
9010 %
9011 % compute the IMAGE diagonal between the two image anchor points A,B,
9012 % DD := B - A
9013 \pgfpointdiff
9014 {\expandafter\pgfplots@extractimgaspoint\pgfplots@plot@handler@graphics@pointmap@A@img}
9015 {\expandafter\pgfplots@extractimgaspoint\pgfplots@plot@handler@graphics@pointmap@B@img}%
9016 \pgfplots@loop@CONTINUEtrue
9017 \ifdim\pgf@x=0pt \pgfplots@loop@CONTINUEfalse \fi
9018 \ifdim\pgf@y=0pt \pgfplots@loop@CONTINUEfalse \fi
9019 \ifpgfplots@loop@CONTINUE
9020 \else
9021 \pgfplots@error{Sorry, the first two points with '=>' in plot graphics[points={}] are expected to have different image Y coordinates. Please reorder the sequence.}%
9022 \fi
9023 \edef\pgfplots@DDx{\pgf@sys@tonumber\pgf@x}%
9024 \edef\pgfplots@DDy{\pgf@sys@tonumber\pgf@y}%
9025 %
9026 % What I need now is a shift and the CANVAS dimensions of the
9027 % image. Both can be computed using the relative sizes dd/DD.
9028 %
9029 % The shift is needed to compute the lower left corner of the
9030 % CANVAS image. thus, the lower left CANVAS image corresponds to
9031 % the (0,0) coordinate in the IMAGE.
9032 %
9033 % Remember that 'A' is the anchor 1 in IMAGE coordinates. It is a
9034 % vector from (0,0) --> (A_x,A_y) in IMAGE coordinates.
9035 %
9036 % Now, I want a vector (v_x,v_y) such that q + v = a in CANVAS
9037 % coordinates. Here, 'q' is the lower left corner; it corresponds
9038 % to the (0,0) in IMAGE coordinates. Thus, we have
9039 % v = (a-q). Taking the relative sizes of dd and DD, we find
9040 %
9041 % DD_x / A_x = dd_x / v_x
9042 % DD_y / A_y = dd_y / v_y
9043 %
9044 % and finally q = a-v is the lower left CANVAS coordinate.
9045 \pgfmath@basic@divide@{\pgfplots@ddx}{\pgfplots@DDx}%
9046 \let\pgfplots@x@rel=\pgfmathresult
9047 %
9048 \pgfmath@basic@divide@{\pgfplots@ddy}{\pgfplots@DDy}%
9049 \let\pgfplots@y@rel=\pgfmathresult
9050 %
9051 \pgfmath@basic@multiply@{\pgfplots@Ax}{\pgfplots@x@rel}%
9052 \let\pgfplots@vx=\pgfmathresult
9053 %
9054 \pgfmath@basic@multiply@{\pgfplots@Ay}{\pgfplots@y@rel}%
9055 \let\pgfplots@vy=\pgfmathresult
9056 %
9057 %
9058 %
9059 %
9060 % now, the canvas width. It is even simpler because it holds
9061 %
9062 % DD_x / dd_x = W / w
9063 % DD_y / dd_y = H / h
9064 %
9065 % where (W,H) is the natural size (i.e. in IMAGE coordinates) of the picture and
9066 % (w,h) is the size the picture will occupy in CANVAS coordinates.
9067 %
9068 \pgfmath@basic@multiply@{\pgfplots@x@rel}{\pgfplots@W}%
9069 \let\pgfplots@w=\pgfmathresult
9070 %
9071 \pgfmath@basic@multiply@{\pgfplots@y@rel}{\pgfplots@H}%
9072 \let\pgfplots@h=\pgfmathresult
9073 %
9074 \edef\pgfplots@plot@handler@graphics@DRAW@{%
9075 \noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/plot graphics/lowlevel draw/.@cmd}{%
9076 {\pgfplots@w pt}% width
9077 {\pgfplots@h pt}% height
9078 }%
9079 }%
9080 \pgfpointadd
9081 {\pgfplots@plot@handler@graphics@pointmap@A@canvas}% the canvas coordinate corresponding to 'A'
9082 {\pgfqpointscale{-1}
9083 {\pgfqpoint{\pgfplots@vx pt}{\pgfplots@vy pt}}%
9084 }%
9085 \edef\pgfplots@plot@handler@graphics@pointmap@lowerleft@canvas{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
9086 %
9087 %
9088 %
9089 \begingroup
9090 \pgftransformshift{}% simply take \pgf@x and \pgf@y
9091 %
9092 \node[/pgfplots/plot graphics/node] {%
9093 \pgfplots@plot@handler@graphics@DRAW@
9094 };%
9095 \endgroup
9096 %
9097 %
9098 \pgfkeysgetvalue{/pgfplots/plot graphics/debug}\pgfplots@loc@TMPa
9099 \edef\pgfplots@loc@TMPb{visual}%
9100 \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
9101 % debug = visual: "sanitize" also triggers the visualization.
9102 \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling{A}%
9103 \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling{B}%
9104 \fi
9105 %
9106 %
9107 \ifx\pgfplots@plot@handler@graphics@pointmap@C@canvas\pgfutil@empty
9108 \ifpgfplots@threedim
9109 \pgfplotswarning{plot3 graphics too few inner anchors}\pgfeov%
9110 \fi
9111 \else
9112 \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling{C}%
9113 \ifx\pgfplots@plot@handler@graphics@pointmap@D@canvas\pgfutil@empty
9114 \else
9115 \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling{D}%
9116 \fi
9117 \fi
9118 \endgroup
9119 }%
9120
9121 % Checks if the logical and canvas coordinates of the point identified
9122 % by #1 are correct.
9123 %
9124 % #1: a character in {A,B,C...}.
9125 %
9126 \def\pgfplots@plot@handler@graphics@pointmap@sanitize@scaling#1{%
9127 \begingroup
9128 \expandafter\let\expandafter\pgfplots@point@img\csname pgfplots@plot@handler@graphics@pointmap@#1@img\endcsname
9129 \expandafter\let\expandafter\pgfplots@point@canvas\csname pgfplots@plot@handler@graphics@pointmap@#1@canvas\endcsname
9130 \expandafter\let\expandafter\pgfplots@point@logical\csname pgfplots@plot@handler@graphics@pointmap@#1@logical\endcsname
9131 \expandafter\pgfplots@extractimgaspoint\pgfplots@point@img% anchor 3 in image
9132 \edef\pgfplots@Cx{\pgf@sys@tonumber\pgf@x}%
9133 \edef\pgfplots@Cy{\pgf@sys@tonumber\pgf@y}%
9134 %
9135 \pgfmath@basic@multiply@{\pgfplots@Cx}{\pgfplots@x@rel}%
9136 \let\pgfplots@Cx=\pgfmathresult
9137 %
9138 \pgfmath@basic@multiply@{\pgfplots@Cy}{\pgfplots@y@rel}%
9139 \let\pgfplots@Cy=\pgfmathresult
9140 \pgfpointadd
9141 {\pgfplots@plot@handler@graphics@pointmap@lowerleft@canvas}%
9142 {\pgfpoint\pgfplots@Cx\pgfplots@Cy}%
9143 \edef\pgfplots@point@canvas@check{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
9144 \pgfpointdiff
9145 {\pgfplots@point@canvas@check}%
9146 {\pgfplots@point@canvas}%
9147 \ifdim\pgf@x<0pt \pgf@x=-\pgf@x\fi
9148 \ifdim\pgf@y<0pt \pgf@y=-\pgf@y\fi
9149 \def\pgfplots@is@the@same@point{1}%
9150 \ifdim\pgf@x>\pgfkeysvalueof{/pgfplots/plot graphics/squeeze tol}
9151 \def\pgfplots@is@the@same@point{0}%
9152 \else
9153 \ifdim\pgf@y>\pgfkeysvalueof{/pgfplots/plot graphics/squeeze tol}
9154 \def\pgfplots@is@the@same@point{0}%
9155 \fi
9156 \fi
9157 \if0\pgfplots@is@the@same@point
9158 %
9159 \begingroup
9160 \pgfkeysgetvalue{/pgfplots/plot graphics/src}\pgfplots@loc@TMPa
9161 \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}%
9162 \def\pgfplots@extractcoord##1##2##3{##1,##2,##3}%
9163 \pgfplots@error{sorry, I can't fix the scaling of 'plot graphics {\the\t@pgfplots@tokc}'.
9164 The points (\expandafter\pgfplots@extractcoord\pgfplots@plot@handler@graphics@pointmap@A@logical) and (\expandafter\pgfplots@extractcoord\pgfplots@plot@handler@graphics@pointmap@B@logical) are correct, but the point (\expandafter\pgfplots@extractcoord\pgfplots@point@logical) is wrong (its position vector has an error of (\the\pgf@x,\the\pgf@y) which is larger than 'squeeze tol=\pgfkeysvalueof{/pgfplots/plot graphics/squeeze tol}'). This is probably caused by improper relations between the axis' unit vectors because the view is incorrect.^^J
9165 - Is the 'view' argument correct (matlab: [h,v] = view)? ^^J
9166 - Does your image have a non-trivial 'plot box ratio' (matlab: ratio = pbaspect)?^^J
9167 Please refer to the pgfplots manual for details. If you continue now, I'll show the points in the image}%
9168 \endgroup
9169 %
9170 \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling@draw
9171 %
9172 \fi
9173 \pgfkeysgetvalue{/pgfplots/plot graphics/debug}\pgfplots@loc@TMPa
9174 \edef\pgfplots@loc@TMPb{visual}%
9175 \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
9176 \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling@draw
9177 \fi
9178 \endgroup
9179 }
9180
9181 \def\pgfplots@plot@handler@graphics@pointmap@sanitize@scaling@draw{%
9182 \scope
9183 \pgfsetstrokecolor{black}%
9184 \pgfsetfillcolor{red}%
9185 \pgfpathcircle{\pgfplots@point@canvas@check}{2pt}%
9186 \pgfusepath{stroke,fill}%
9187 \pgfsetfillcolor{green}%
9188 \pgfpathcircle{\pgfplots@point@canvas}{2pt}%
9189 \pgfusepath{stroke,fill}%
9190 \draw[->,red]
9191 \pgfextra{
9192 \pgfpathmoveto{\pgfplots@point@canvas@check}%
9193 \pgfpathlineto{\pgfplots@point@canvas}};
9194 \endscope
9195 }%
9196
9197 \def\pgfplots@plot@handler@graphics@usebb{%
9198 \pgfpointdiff{\pgfplots@plot@handler@graphics@bb@first}{\pgfplots@plot@handler@graphics@bb@second}%
9199 \def\pgfplots@plot@handler@graphics@finish@ok{1}%
9200 \ifdim\pgf@x=0pt
9201 \def\pgfplots@plot@handler@graphics@finish@ok{0}%
9202 \else
9203 \ifdim\pgf@y=0pt
9204 \def\pgfplots@plot@handler@graphics@finish@ok{0}%
9205 \fi
9206 \fi
9207 \if0\pgfplots@plot@handler@graphics@finish@ok
9208 \pgfplots@error{Error using 'plot graphics': I got too few coordinates! I expected the lower left and upper right corners!}%
9209 \xdef\pgfplots@plot@handler@graphics@bb@first{\noexpand\pgfqpoint{0pt}{0pt}}%
9210 \xdef\pgfplots@plot@handler@graphics@bb@first{\noexpand\pgfqpoint{0pt}{0pt}}%
9211
9212 \fi
9213 \begingroup
9214 % determine the lower left / upper right corners.
9215 \pgfplots@plot@handler@graphics@bb@first
9216 \pgf@xa=\pgf@x
9217 \pgf@ya=\pgf@y
9218 \pgfplots@plot@handler@graphics@bb@second
9219 \pgf@xb=\pgf@x
9220 \pgf@yb=\pgf@y
9221 %
9222 % xc,yc = lower left corner
9223 % x,y = upper right
9224 \ifdim\pgf@xa<\pgf@xb
9225 \pgf@xc=\pgf@xa
9226 \pgf@x=\pgf@xb
9227 \else
9228 \pgf@xc=\pgf@xb
9229 \pgf@x=\pgf@xa
9230 \fi
9231 \ifdim\pgf@ya<\pgf@yb
9232 \pgf@yc=\pgf@ya
9233 \pgf@y=\pgf@yb
9234 \else
9235 \pgf@yc=\pgf@yb
9236 \pgf@y=\pgf@ya
9237 \fi
9238 \advance\pgf@x by-\pgf@xc
9239 \advance\pgf@y by-\pgf@yc
9240 \edef\pgfplots@plot@handler@graphics@DRAW@{%
9241 \noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/plot graphics/lowlevel draw/.@cmd}{%
9242 {\the\pgf@x}% width
9243 {\the\pgf@y}% height
9244 }%
9245 }%
9246 \pgf@x=\pgf@xc
9247 \pgf@y=\pgf@yc
9248 \pgftransformshift{}%
9249 \node[/pgfplots/plot graphics/node] {%
9250 \pgfplots@plot@handler@graphics@DRAW@
9251 };%
9252 \endgroup
9253 }%
9254 % initial value for /pgfplots/plots graphics/lowlevel draw:
9255 \def\pgfplots@plot@handler@graphics@DRAW#1#2{%
9256 \pgfkeysgetvalue{/pgfplots/plot graphics/includegraphics}{\pgfplots@loc@TMPc}%
9257 \pgfkeysgetvalue{/pgfplots/plot graphics/src}{\pgfplots@loc@TMPd}%
9258 \ifx\pgfplots@loc@TMPd\pgfutil@empty
9259 \pgfplots@error{Error using 'plot graphics': I don't have a graphics file name! Please set the '/pgfplots/plot graphics/src' key to the image file name. Skipping this plot.}%
9260 \else
9261 \begingroup
9262 \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPc}%
9263 %
9264 \def\pgfplots@loc@TMPa{#1}%
9265 \def\pgfplots@loc@TMPb{#2}%
9266 %
9267 \edef\pgfplots@loc@TMPc{%
9268 \the\t@pgfplots@toka,%
9269 \ifx\pgfplots@loc@TMPa\pgfutil@empty\else width=#1,\fi
9270 \ifx\pgfplots@loc@TMPb\pgfutil@empty\else height=#2,\fi
9271 }%
9272 \pgfmath@smuggleone\pgfplots@loc@TMPc
9273 \endgroup
9274 %
9275 \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPc}%
9276 \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPd}%
9277 \edef\pgfplots@loc@TMPc{%
9278 \noexpand\pgfkeysvalueof{/pgfplots/plot graphics/includegraphics cmd}%
9279 [\the\t@pgfplots@toka]
9280 {\the\t@pgfplots@tokb}}%
9281 \pgfplots@loc@TMPc
9282 \fi
9283 }%
9284
9285 \def\pgfplots@plot@handler@graphics@getnaturalsize{%
9286 \begingroup
9287 \setbox0=\hbox{%
9288 \pgfplots@invoke@pgfkeyscode{/pgfplots/plot graphics/lowlevel draw/.@cmd}{{}{}}%
9289 }%
9290 \pgf@x=\wd0
9291 \pgf@y=\ht0
9292 \ifdim\dp0>0pt
9293 \advance\pgf@y by\dp0
9294 \else
9295 \ifdim\dp0<0pt
9296 \advance\pgf@y by-\dp0
9297 \fi
9298 \fi
9299 \xdef\pgfplots@glob@TMPb{{\the\pgf@x}{\the\pgf@y}}%
9300 \endgroup
9301 \let\pgfmathresult=\pgfplots@glob@TMPb
9302 }%
9303
9304 % legends for plot graphics should not use 'plot graphics' themselves
9305 % (for obvious reasons).
9306 % This key handles that. Furthermore, it remembers the plot mark for
9307 % the legend -- although no plot mark is allowed for plot graphics as
9308 % such.
9309 \pgfkeysdef{/pgfplots/plot graphics/@prepare legend}{%
9310 \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}%
9311 %
9312 \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler
9313 \t@pgfplots@tokc=\expandafter{\pgfplots@basiclevel@plothandler}%
9314 %
9315 \edef\pgfplots@loc@TMPa{%
9316 \noexpand\pgfkeys{/pgfplots/every legend image post/.append code={%
9317 \noexpand\def\noexpand\tikz@plot@handler{\the\t@pgfplots@tokc}%
9318 \ifx\tikz@plot@mark\pgfutil@empty
9319 \else
9320 \noexpand\pgfkeysalso{/tikz/mark=\tikz@plot@mark}%
9321 \fi
9322 }%
9323 }%
9324 }%
9325 \pgfplots@loc@TMPa
9326 }
9327
9328
9329
9330 % Input : \pgfplots@stored@current@data contains the coordinate stream
9331 % Output: \pgfplots@stored@current@data contains the (modified)
9332 % coordinate stream
9333 \def\pgfplots@apply@zbuffer{%
9334 \ifcase\pgfplotsplothandlermesh@zbuffer@choice\relax
9335 % none.
9336 \or
9337 % reverse x seq: only for 'mesh'
9338 \if\pgfplots@meshmode n%
9339 \pgfplots@error{Sorry, `/pgfplots/z buffer=reverse x seq' can only be used for mesh/surf plots.}%
9340 \else
9341 \pgfplotsautocompletemeshkeys
9342 \if\pgfplots@plot@mesh@ordering0%
9343 % ordering = rowwise -> scanline is cols!
9344 \pgfkeysgetvalue{/pgfplots/mesh/cols}\pgfplotsscanlinelength
9345 \pgfplots@apply@zbuffer@reversescanline%
9346 \else
9347 % ordering = colwise: scanline is rows!
9348 \pgfkeysgetvalue{/pgfplots/mesh/rows}\pgfplotsscanlinelength
9349 \pgfplots@apply@zbuffer@reversetransposed%
9350 \fi
9351 \fi
9352 \or
9353 % reverse y seq: only for 'mesh'
9354 \if\pgfplots@meshmode n%
9355 \pgfplots@error{Sorry, `/pgfplots/z buffer=reverse y seq' can only be used for mesh/surf plots.}%
9356 \else
9357 \pgfplotsautocompletemeshkeys
9358 \if\pgfplots@plot@mesh@ordering0%
9359 % ordering = rowwise -> scanline is cols!
9360 \pgfkeysgetvalue{/pgfplots/mesh/cols}\pgfplotsscanlinelength
9361 \pgfplots@apply@zbuffer@reversetransposed%
9362 \else
9363 % ordering = colwise: scanline is rows!
9364 \pgfkeysgetvalue{/pgfplots/mesh/rows}\pgfplotsscanlinelength
9365 \pgfplots@apply@zbuffer@reversescanline%
9366 \fi
9367 \fi
9368 \or
9369 % reverse xy seq:
9370 \ifpgfplots@LUA@backend@supported
9371 \pgfplotsutil@directlua{pgfplots.texApplyZBufferReverseStream()}%
9372 \else
9373 \begingroup
9374 \def\pgfplots@coord@stream@start{%
9375 \pgfplotsprependlistXnewempty{reversed}%
9376 }%
9377 \def\pgfplots@coord@stream@coord{%
9378 \expandafter\pgfplotsprependlistXpushfront\expandafter{\pgfplots@coord@stream@foreach@NORMALIZED@curencoded@braced}\to{reversed}%
9379 }%
9380 \def\pgfplots@coord@stream@end{%
9381 \pgfplotsprependlistXlet\pgfplots@loc@TMPa={reversed}%
9382 \pgfplotsprependlistXnewempty{reversed}% clear it
9383 \global\let\pgfplotsglobalretval=\pgfplots@loc@TMPa
9384 }%
9385 \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@stored@current@data}%
9386 \endgroup
9387 \let\pgfplots@stored@current@data=\pgfplotsglobalretval
9388 \global\let\pgfplotsglobalretval=\pgfutil@empty
9389 \fi
9390 \or
9391 % sort.
9392 \if\pgfplots@meshmode n%
9393 \ifpgfplots@LUA@backend@supported
9394 \pgfplotsutil@directlua{pgfplots.texApplyZBufferSort()}%
9395 \else
9396 \pgfplots@apply@zbuffer@sort@coordinates
9397 \fi
9398 \else
9399 % meshmode handles sort separately!
9400 \fi
9401 \or
9402 % z buffer=auto
9403 %
9404 % I can decide for each axis if coordinate reversal is
9405 % necessary.
9406 % Idea: check if axis side planes are on foreground or not (a
9407 % very simple task)! I
9408 % only need to know whether [xy] coordinates are sorted
9409 % ascending or descending. This information is already ready.
9410 %
9411 \ifcase\pgfplotsplothandlermesh@matrixinput
9412 % mesh input=patches
9413 \ifpgfplots@threedim
9414 \if\pgfplots@meshmode n%
9415 \else
9416 \pgfkeys{/pgfplots/z buffer=sort}%
9417 \fi
9418 \else
9419 \pgfkeys{/pgfplots/z buffer=none}%
9420 \fi
9421 \else
9422 % mesh input=lattice|image
9423 \begingroup
9424 \if+\pgfkeysvalueof{/pgfplots/x coord sorting}%
9425 \def\pgfplots@minmaxvalue@x{0}%
9426 \else
9427 \def\pgfplots@minmaxvalue@x{0}%
9428 \fi
9429 \if+\pgfkeysvalueof{/pgfplots/y coord sorting}%
9430 \def\pgfplots@minmaxvalue@y{0}%
9431 \else
9432 \def\pgfplots@minmaxvalue@y{1}%
9433 \fi
9434 \pgfplotsifaxissurfaceisforeground{\pgfplots@minmaxvalue@x vv}{%
9435 \def\pgfplots@reverse@x{1}%
9436 }{%
9437 \def\pgfplots@reverse@x{0}%
9438 }%
9439 \pgfplotsifaxissurfaceisforeground{v\pgfplots@minmaxvalue@y v}{%
9440 \def\pgfplots@reverse@y{1}%
9441 }{%
9442 \def\pgfplots@reverse@y{0}%
9443 }%
9444 \if1\pgfplots@reverse@x
9445 \if1\pgfplots@reverse@y
9446 \pgfkeys{/pgfplots/z buffer=reverse xy seq}%
9447 \else
9448 \pgfkeys{/pgfplots/z buffer=reverse x seq}%
9449 \fi
9450 \else
9451 \if1\pgfplots@reverse@y
9452 \pgfkeys{/pgfplots/z buffer=reverse y seq}%
9453 \else
9454 \pgfkeys{/pgfplots/z buffer=none}%
9455 \fi
9456 \fi
9457 %\message{z buffer=auto mode chose z buffer= \ifcase\pgfplotsplothandlermesh@zbuffer@choice NONE \or reverse x seq \or reverse y seq \or reverse xy seq \or sort\or default \fi. mesh ordering = \ifcase\pgfplots@plot@mesh@ordering x varies/rowwise\or y varies/colwise\fi}%
9458 \pgfmath@smuggleone\pgfplotsplothandlermesh@zbuffer@choice
9459 \endgroup
9460 % 'z buffer' is no longer 'auto' now:
9461 \pgfplots@apply@zbuffer
9462 \fi
9463 \or
9464 % z buffer=default.
9465 \if\pgfplots@meshmode n%
9466 % mesh mode deactivated!
9467 \else
9468 % mesh=true
9469 \if2\pgfplotsplothandlermesh@matrixinput
9470 % mesh input=image
9471 % we do not want z buffering by default because it
9472 % leads to undefined color associations.
9473 % Use 'z buffer=auto' to re-enable it
9474 \pgfkeys{/pgfplots/z buffer=none}%
9475 \else
9476 \pgfkeysalso{/pgfplots/z buffer=auto}%
9477 \fi
9478 \pgfplots@apply@zbuffer%
9479 \fi
9480 \fi
9481 }%
9482
9483 \def\pgfplots@apply@zbuffer@sort@coordinates{%
9484 \begingroup
9485 \def\pgfplots@coord@stream@start{%
9486 \pgfplotsarraynewempty\pgfplots@zbuffer@local
9487 \pgfplotsarrayresize\pgfplots@zbuffer@local{\numcoords}%
9488 \c@pgfplots@scanlineindex=0
9489 \def\pgfplots@zbuffer@local@SETCUR####1{%
9490 \expandafter\pgfplotsarrayset\c@pgfplots@scanlineindex\of\pgfplots@zbuffer@local\to{####1}%
9491 }%
9492 }%
9493 \def\pgfplots@coord@stream@coord{%
9494 \expandafter\pgfplots@zbuffer@local@SETCUR\expandafter{\pgfplots@coord@stream@foreach@NORMALIZED@curencoded}%
9495 \advance\c@pgfplots@scanlineindex by1
9496 }%
9497 \def\pgfplots@coord@stream@end{%
9498 \ifnum\c@pgfplots@scanlineindex=\numcoords
9499 \else
9500 \pgfplotsarrayresize\pgfplots@zbuffer@local{\c@pgfplots@scanlineindex}%
9501 \fi
9502 \pgfkeyslet{/pgfplots/iflessthan/.@cmd}\pgfplots@apply@zbuffer@SORT@iflessthan
9503 \pgfkeysdef{/pgfplots/array/unscope pre}{%
9504 \pgfplotsapplistXnewempty{\pgfp@sortedlist}%
9505 \pgfplotsarrayforeachungrouped\pgfplots@zbuffer@local\as\curelem{%
9506 \expandafter\pgfplotsapplistXpushback\expandafter{\expandafter{\curelem}}\to{\pgfp@sortedlist}%
9507 }%
9508 \pgfplotsapplistXlet\pgfplots@loc@TMPa={\pgfp@sortedlist}%
9509 \global\let\pgfplotsglobalretval=\pgfplots@loc@TMPa
9510 }%
9511 \pgfkeysdef{/pgfplots/array/unscope post}{}%
9512 \pgfplotsarraysort\pgfplots@zbuffer@local
9513 }%
9514 \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@stored@current@data}%
9515 \endgroup
9516 \let\pgfplots@stored@current@data=\pgfplotsglobalretval
9517 \global\let\pgfplotsglobalretval=\pgfutil@empty
9518 }%
9519 % Defines \pgfplotsglobalretval (globally) to be a partial reversion of the
9520 % (normalized) 2d coordinate sequence '#1'.
9521 %
9522 % In other words, the normalized coordinate sequence '#1' is visited
9523 % linearly and while we go, each scanline is reversed. The result is
9524 % collected into \pgfplotsglobalretval.
9525 %
9526 % This implements the 'z buffer=reverse x seq' feature for
9527 % ordering=y varies.
9528 %
9529 % PRECONDITION:
9530 % \pgfplotsscanlinelength contains the scanline length
9531 % POSTCONDITION:
9532 % \pgfplotsglobalretval contains the partial reversion.
9533 \def\pgfplots@apply@zbuffer@reversescanline{%
9534 \ifpgfplots@LUA@backend@supported
9535 \pgfplotsutil@directlua{pgfplots.texApplyZBufferReverseScanline(\pgfplotsscanlinelength)}%
9536 \else
9537 \begingroup
9538 \def\pgfplots@coord@stream@start{%
9539 \pgfplotsprependlistXnewempty{reversedscanline}%
9540 \c@pgfplots@scanlineindex=0
9541 \pgfplotsapplistXnewempty{\resultlist}%
9542 }%
9543 \def\pgfplots@coord@stream@coord{%
9544 \expandafter\pgfplotsprependlistXpushfront\expandafter{\pgfplots@coord@stream@foreach@NORMALIZED@curencoded@braced}\to{reversedscanline}%
9545 \advance\c@pgfplots@scanlineindex by1
9546 \ifnum\c@pgfplots@scanlineindex=\pgfplotsscanlinelength\relax
9547 \pgfplotsprependlistXlet\pgfplots@loc@TMPa={reversedscanline}%
9548 \expandafter\pgfplotsapplistXpushback\expandafter{\pgfplots@loc@TMPa}\to\resultlist
9549 \pgfplotsprependlistXnewempty{reversedscanline}%
9550 \c@pgfplots@scanlineindex=0
9551 \fi
9552 }%
9553 \def\pgfplots@coord@stream@end{%
9554 \pgfplotsprependlistXlet\pgfplots@loc@TMPa={reversedscanline}%
9555 \ifx\pgfplots@loc@TMPa\pgfutil@empty
9556 \else
9557 \pgfplots@zbuffer@error
9558 \fi
9559 \pgfplotsapplistXlet\pgfplots@loc@TMPa={\resultlist}%
9560 \global\let\pgfplotsglobalretval=\pgfplots@loc@TMPa
9561 }%
9562 \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@stored@current@data}%
9563 \endgroup
9564 \let\pgfplots@stored@current@data=\pgfplotsglobalretval
9565 \global\let\pgfplotsglobalretval=\pgfutil@empty
9566 \fi
9567 %\message{I have performed partial reversion of '#1' and got '\pgfplotsglobalretval'!}%
9568 }%
9569
9570 % A very similar method of \pgfplots@apply@zbuffer@reversescanline,
9571 % but this one keeps everything inside of each scanline in the
9572 % original ordering, and reverses the ordering in which whole
9573 % scanlines occur.
9574 \def\pgfplots@apply@zbuffer@reversetransposed{%
9575 \ifpgfplots@LUA@backend@supported
9576 \pgfplotsutil@directlua{pgfplots.texApplyZBufferReverseTransposed(\pgfplotsscanlinelength)}%
9577 \else
9578 \begingroup
9579 \def\pgfplots@coord@stream@start{%
9580 \pgfplotsapplistXnewempty{\scanline}%
9581 \c@pgfplots@scanlineindex=0
9582 \pgfplotsprependlistXnewempty{resultlist}%
9583 }%
9584 \def\pgfplots@coord@stream@coord{%
9585 \expandafter\pgfplotsapplistXpushback\expandafter{\pgfplots@coord@stream@foreach@NORMALIZED@curencoded@braced}\to{\scanline}%
9586 \advance\c@pgfplots@scanlineindex by1
9587 \ifnum\c@pgfplots@scanlineindex=\pgfplotsscanlinelength\relax
9588 \pgfplotsapplistXlet\pgfplots@loc@TMPa={\scanline}%
9589 \expandafter\pgfplotsprependlistXpushfront\expandafter{\pgfplots@loc@TMPa}\to{resultlist}
9590 \pgfplotsapplistXnewempty{\scanline}%
9591 \c@pgfplots@scanlineindex=0
9592 \fi
9593 }%
9594 \def\pgfplots@coord@stream@end{%
9595 \pgfplotsapplistXlet\pgfplots@loc@TMPa={\scanline}%
9596 \ifx\pgfplots@loc@TMPa\pgfutil@empty
9597 \else
9598 \pgfplots@zbuffer@error
9599 \fi
9600 \pgfplotsprependlistXlet\pgfplots@loc@TMPa={resultlist}%
9601 \global\let\pgfplotsglobalretval=\pgfplots@loc@TMPa
9602 }%
9603 \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@stored@current@data}%
9604 \endgroup
9605 \let\pgfplots@stored@current@data=\pgfplotsglobalretval
9606 \global\let\pgfplotsglobalretval=\pgfutil@empty
9607 \fi
9608 %\message{I have performed partial reversion (reverse transposed) of '#1' and got '\pgfplotsglobalretval'!}%
9609 }%
9610 \def\pgfplots@zbuffer@error{%
9611 \pgfplots@error{An internal error occurred during z buffer reorderings: the rows/cols where not balanced! I have rows= \pgfkeysvalueof{/pgfplots/mesh/rows}, cols=\pgfkeysvalueof{/pgfplots/mesh/cols}. If this happens to be wrong, you might want to provide rows and cols manually.}%
9612 }
9613
9614 % A special '<' operation which returns true if the point coordinate
9615 % '#1' is BEHIND #2 with respect to the current 3D view.
9616 \def\pgfplots@apply@zbuffer@SORT@iflessthan#1#2#3#4\pgfeov{%
9617 \pgfplotsaxisdeserializedatapointfrom{#1}%
9618 \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}%
9619 \pgfplotsmathvectorscalarproduct{\pgfplots@view@dir@threedim}{\pgfplotsretval}{default}%
9620 \let\pgfplots@apply@zbuffer@SORT@iflessthan@a=\pgfplotsretval
9621 %
9622 \pgfplotsaxisdeserializedatapointfrom{#2}%
9623 \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}%
9624 \pgfplotsmathvectorscalarproduct{\pgfplots@view@dir@threedim}{\pgfplotsretval}{default}%
9625 \let\pgfplots@apply@zbuffer@SORT@iflessthan@b=\pgfplotsretval
9626 %
9627 \pgfplotscoordmath{default}{if less than}{\pgfplots@apply@zbuffer@SORT@iflessthan@b}{\pgfplots@apply@zbuffer@SORT@iflessthan@a}{%
9628 #3\relax
9629 }{%
9630 #4\relax
9631 }%
9632 }%
9633
9634
9635 % Defines \pgfmathresult to be the view depth of a three component
9636 % vector. The third component will be used if and only if the boolean
9637 % \ifpgfplots@curplot@threedim is true.
9638 % The return value will be assigned in floating point.
9639 %
9640 % The arguments need to be numbers (will be parsed with
9641 % \pgfmathfloatparsenumber).
9642 % @see \pgfplotsmathviewdepthxyz
9643 % DEPRECATED use \pgfplotsmathvectorviewdepth instead!
9644 \def\pgfplotsmathfloatviewdepthxyz#1#2#3{%
9645 \begingroup
9646 \pgfmathfloatparsenumber{#1}\let\pgfplots@loc@TMPa=\pgfmathresult
9647 \pgfmathfloatparsenumber{#2}\let\pgfplots@loc@TMPb=\pgfmathresult
9648 \pgfmathfloatparsenumber{#3}\let\pgfplots@loc@TMPc=\pgfmathresult
9649 \edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}}%
9650 \expandafter\pgfplotsmathfloatviewdepthxyz@\pgfplots@loc@TMPa
9651 \pgfmath@smuggleone\pgfmathresult
9652 \endgroup
9653 }%
9654
9655 % #1: a 3d vector of the form x,y,z in 'default' coordmath format
9656 % defines \pgfplotsretval to the view depth
9657 % of the point
9658 %
9659 % Use \pgfplotsmathvectorfromstring{x,y,z}{default} to transform a
9660 % vector into the requested format.
9661 %
9662 % Use \pgfplotscoordmath{default}{tofixed}{\pgfplotsretval} to
9663 % transform the result into fixed point representation.
9664 \def\pgfplotsmathvectorviewdepth#1{%
9665 \pgfplotsmathvectorscalarproduct{#1}{\pgfplots@view@dir@threedim}{default}%
9666 }%
9667
9668 \def\pgfplotsmathfloatviewdepthxyz@#1#2#3{%
9669 \pgfplots@error{Sorry, you can't use \string\pgfplotsmathfloatviewdepthxyz\space in this context.}%
9670 }%
9671 \def\pgfplotsmathfloatviewdepthxyz@infigure#1#2#3{%
9672 \pgfplotsmathvectorfromstring{\pgfplots@view@dir@threedim}{float}%
9673 \pgfplotsmathvectorscalarproduct{#1,#2,#3}{\pgfplotsretval}{float}% FIXME : \pgfplots@view@dir@threedim might have a different math format!
9674 \let\pgfmathresult=\pgfplotsretval
9675 }%
9676
9677 % Similar to \pgfplotsmathfloatviewdepthxyz, but this always relies on
9678 % fixed point arithmetics.
9679 % DEPRECATED use \pgfplotsmathvectorviewdepth instead
9680 \def\pgfplotsmathviewdepthxyz#1#2#3{\pgfplotsmathviewdepthxyz@{#1}{#2}{#3}}
9681 \def\pgfplotsmathviewdepthxyz@#1#2#3{%
9682 \pgfplots@error{Sorry, you can't use \string\pgfplotsmathviewdepthxyz\space in this context.}%
9683 }
9684 \def\pgfplotsmathviewdepthxyz@infigure#1#2#3{%
9685 \pgfplotsmathvectorfromstring{\pgfplots@view@dir@threedim@unitlength}{pgfbasic}%
9686 \pgfplotsmathvectorscalarproduct{#1,#2,#3}{\pgfplotsretval}{pgfbasic}% FIXME : \pgfplots@view@dir@threedim might have a different math format!
9687 \let\pgfmathresult=\pgfplotsretval
9688 }%
9689
9690
9691 % Evaluate shell commands.
9692 %
9693 % #1 = filename prefix for .sh and .out files (optional,
9694 % default is \jobname)
9695 % #2 = shell command text
9696 %
9697 % Description:
9698 %
9699 % This command will write the command text to a file called
9700 % #1.sh. Then it calls sh (using the \write18 mechanism) to
9701 % execute the file and redirect the output to a file called
9702 % #1.out.
9703 % In contrast to pgfplotgnuplot the result has to be read
9704 % from #1.out later using \pgfplotxyfile. (This allows
9705 % using the function from within the plot table functions
9706 % as well.)
9707 %
9708 % Example:
9709 %
9710 % \pgfplothandlerlineto
9711 % \pgfshell[\jobname]{cat table.dat}
9712 % \pgfplotxyfile{\jobname.out}
9713
9714 \pgfutil@IfUndefined{w@pgf@writea}{%
9715 \csname newwrite\endcsname\pgf@shellwrite
9716 }{%
9717 \let\pgf@shellwrite=\w@pgf@writea
9718 }
9719 \newif\ifpgf@resample@shell
9720
9721 \def\pgfshell{\pgfutil@ifnextchar[{\pgf@shell}{\pgf@shell[\jobname]}}%}
9722 \def\pgf@shell[#1]#2{%
9723 \pgf@resample@shelltrue%
9724 % Check, whether it is up-to-date
9725 \openin\pgfutil@inputcheck=#1.sh
9726 \ifeof\pgfutil@inputcheck%
9727 \else%
9728 \read\pgfutil@inputcheck to\pgf@shell@line%
9729 \edef\pgf@plot@code{#2\space}%
9730 \ifx\pgf@plot@code\pgf@shell@line%
9731 \openin\pgfutil@inputcheck=#1.out
9732 \ifeof\pgfutil@inputcheck%
9733 \else%
9734 \pgf@resample@shellfalse
9735 \fi%
9736 \fi%
9737 \fi
9738 \ifpgf@resample@shell%
9739 \immediate\openout\pgf@shellwrite=#1.sh
9740 \immediate\write\pgf@shellwrite{#2}%
9741 \immediate\closeout\pgf@shellwrite%
9742 \pgfplots@shellescape{sh #1.sh > #1.out}
9743 \fi%
9744 }
9745
9746 % Defines \pgfplots@current@point@coordinatestyle to be the list of options resulting from the evaluation of all matching 'coordinate style' expressions.
9747 \def\pgfplots@get@matching@coordinate@styles@surveyphase{%
9748 \let\pgfplots@current@point@coordinatestyle=\pgfutil@empty
9749 % ##1: operation mode
9750 % ##2: key
9751 % ##3: value
9752 \def\pgfplots@coordinate@style@process##1##2##3{%
9753 \if E##1% Ah : an expression.
9754 \pgfmathifexpression{##2}{%
9755 \expandafter\def\expandafter\pgfplots@current@point@coordinatestyle\expandafter{\pgfplots@current@point@coordinatestyle,%
9756 ##3%
9757 }%
9758 }{}%
9759 \else
9760 \if V##1% Ah : an .from
9761 \edef\pgfplots@loc@TMPc{##2}%
9762 \t@pgfplots@toka=\expandafter{\pgfplots@current@point@coordinatestyle}%
9763 \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPc}%
9764 \edef\pgfplots@current@point@coordinatestyle{%
9765 \the\t@pgfplots@toka,%
9766 \the\t@pgfplots@tokb
9767 }%
9768 \else
9769 \pgfplots@get@matching@coordinate@styles@surveyphase@err{##1}%
9770 \fi
9771 \fi
9772 }%
9773 \pgfplotsapplistXlet\pgfplots@loc@TMPb=\pgfplots@coordinate@style@list
9774 \expandafter\pgfplotsutilforeachcommasep\pgfplots@loc@TMPb\as\pgfplots@loc@TMPa{%
9775 \ifx\pgfplots@loc@TMPa\pgfutil@empty
9776 \else
9777 \expandafter\pgfplots@coordinate@style@process\pgfplots@loc@TMPa
9778 \fi
9779 }%
9780 }%
9781 \def\pgfplots@get@matching@coordinate@styles@surveyphase@err#1#2#3{%
9782 \pgfplots@error{Encountered unexpected internal value of 'coordinate style: #1}%
9783 }