Debian Codegraph @

texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.ternary.code.tex

raw
1 %--------------------------------------------
2 %
3 % Package pgfplots, library for ternary plots (triangular axes).
4 %
5 % Copyright 2010 by Christian Feuersänger.
6 %
7 % This program is free software: you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation, either version 3 of the License, or
10 % (at your option) any later version.
11 %
12 % This program is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 % GNU General Public License for more details.
16 %
17 % You should have received a copy of the GNU General Public License
18 % along with this program. If not, see <http://www.gnu.org/licenses/>.
19 %
20 %
21 % This is a library to draw ternary diagrams.
22 %
23 % A ternary diagram visualizes percentages of three components in a
24 % triangle.
25 %
26 % Sometimes there is also contour data drawn on top of the ternary
27 % diagram, i.e. data (x,y,z, T(x,y,z) ), but I can't do that yet.
28 %
29 % How to read a ternary diagram: http://csmres.jmu.edu/geollab/fichter/SedRx/readternary.html
30 %
31 % Another usage example: http://www.sv.vt.edu/classes/MSE2094_NoteBook/96ClassProj/experimental/ternary2.html
32 %
33 % Drawing ternary diagrams: http://staff.aist.go.jp/a.noda/programs/ternary/ternary-en.html
34 %
35 % computing these coordinates: http://www.gamedev.net/community/forums/topic.asp?topic_id=451357
36 %
37
38 \pgfplotsdefineaxistype{ternary}{%
39 \pgfplots@ternary@activate
40 }%
41
42 \newif\ifpgfplots@ternary@rellimits
43
44
45 \pgfplotsset{
46 /pgfplots/ternary limits relative/.is if=pgfplots@ternary@rellimits,
47 /pgfplots/ternary limits relative=true,
48 /pgfplots/ternary limits relative/.default=true,
49 /pgfplots/ternary relative limits/.style={/pgfplots/ternary limits relative=#1},
50 /pgfplots/ternary start x/.initial=, % FIXME : implement
51 /pgfplots/ternary start y/.initial=,
52 /pgfplots/ternary start z/.initial=,
53 /pgfplots/every ternary axis/.style={
54 /pgfplots/tick align=outside,
55 grid=major,
56 xticklabel style={anchor=west},
57 % yticklabel style={anchor=south east},
58 % zticklabel style={anchor=north},
59 /pgfplots/every 3d description/.style={},
60 /pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},%
61 /pgfplots/every axis y label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},%
62 /pgfplots/every axis z label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},%
63 /pgfplots/every x tick scale label/.style={at={(xticklabel cs:0.95,5pt)},anchor=near xticklabel,inner sep=0pt},
64 /pgfplots/every y tick scale label/.style={at={(yticklabel cs:0.95,5pt)},anchor=near yticklabel,inner sep=0pt},
65 /pgfplots/every z tick scale label/.style={at={(yticklabel cs:0.95,5pt)},anchor=near yticklabel,inner sep=0pt},
66 /pgfplots/every axis title shift=15pt,
67 /pgfplots/every axis legend/.style={%
68 cells={anchor=center},
69 inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em},
70 shape=rectangle,%
71 fill=white,%
72 draw=black,
73 at={(1.03,1.03)},
74 anchor=north west,%
75 },
76 annot/point format 3d/.initial={(\%.2f, \%.2f, \%.2f)},
77 },
78 }
79
80 \def\pgfplots@ternary@activate{%
81 \let\pgfplotsqpointxy=\pgfplotsqpointxy@ternary
82 \let\pgfplotsqpointxy@orthogonal=\pgfplotsqpointxy
83 \let\pgfplotsqpointxyz=\pgfplotsqpointxyz@ternary
84 \let\pgfplots@draw@axis=\pgfplots@draw@axis@ternary
85 \def\pgfplots@drawaxis@outerlines@separate@onorientedsurf##1##2{}%
86 \def\pgfplots@drawaxis@innerlines@onorientedsurf##1##2##3{}%
87 \let\pgfplots@draw@axis@post=\pgfplots@draw@axis@post@ternary
88 \let\pgfplots@initsizes=\pgfplots@initsizes@ternary
89 \let\pgfplots@limits@ready=\pgfplots@limits@ready@ternary
90 \let\pgfplotspoint@initialisation@axes=\pgfplotspoint@initialisation@axes@ternary
91 \let\pgfplotspoint@initialisation@units=\pgfplotspoint@initialisation@units@ternary
92 \let\pgfplots@initsizes@setunitvector=\pgfplots@initsizes@setunitvector@ternary
93 \let\pgfplots@computeunitvectorlengths=\pgfplots@computeunitvectorlengths@ternary
94 \let\pgfplotspointouternormalvectorofaxis@=\pgfplotspointouternormalvectorofaxis@ternary
95 \let\pgfplots@prepare@ZERO@coordinates=\pgfplots@prepare@ZERO@coordinates@ternary
96 \def\pgfplots@scaleaxes@to@BB@##1##2{}%
97 \let\pgfplotsgetnormalforcurrentview=\relax
98 \def\pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf##1{}%
99 \let\pgfplots@clippath@prepare@for@axistype=\pgfplots@clippath@prepare@for@axistype@ternary
100 %
101 \pgfkeys{/pgfplots/oriented surf installed/.add={}{%
102 \let\pgfplotspointonorientedsurfaceab@ternary@orig=\pgfplotspointonorientedsurfaceab
103 \let\pgfplotspointonorientedsurfaceab=\pgfplotspointonorientedsurfaceab@ternary
104 }}%
105 \let\pgfplotspointonorientedsurfaceabwithbshift=\pgfplotspointonorientedsurfaceabwithbshift@ternary
106 \pgfkeyssetvalue{/pgfplots/view/az}{}%
107 \pgfkeyssetvalue{/pgfplots/view/el}{}%
108 \let\pgfplots@set@options@sanitize=\relax
109 \let\pgfplots@set@options@sanitizemode=\relax
110 %
111 \expandafter\def\expandafter\pgfplots@notify@options@are@set\expandafter{\pgfplots@notify@options@are@set
112 \ifpgfplots@ternary@rellimits
113 \pgfplotsset{scaled ticks=false,ticklabel style={/pgf/number format/precision=0}}%
114 \let\pgfplots@show@ticklabel@orig=\pgfplots@show@ticklabel@
115 \let\pgfplots@show@ticklabel@=\pgfplots@show@ticklabel@ternary@relative
116 \fi
117 }%
118 %
119 % this here is set *before* 'every ternary axis' is invoked.
120 \pgfplotsset{
121 /pgfplots/footnotesize/.append style= {/pgfplots/every axis title shift=15pt},%
122 /pgfplots/tiny/.append style= {/pgfplots/every axis title shift=15pt},%
123 enlargelimits=false,
124 xmin=0,xmax=1,
125 ymin=0,ymax=1,
126 zmin=0,zmax=1,
127 annot/point format/.style={/pgfplots/annot/point format 3d={##1}},
128 }%
129 \def\pgfplots@xticklabel@pos{}%
130 \def\pgfplots@yticklabel@pos{}%
131 \def\pgfplots@zticklabel@pos{}%
132 %\def\pgfplots@xaxislinesnum{1}%
133 %\def\pgfplots@yaxislinesnum{3}%
134 %\def\pgfplots@zaxislinesnum{3}%
135 \def\pgfplotsifaxissurfaceisforeground##1##2##3{##2}%
136 \def\pgfplots@init@ticklabelaxisspecfor##1##2{}%
137 \def\pgfplots@xticklabelaxisspec{v00}%
138 \def\pgfplots@yticklabelaxisspec{0v0}%
139 \def\pgfplots@zticklabelaxisspec{00v}%
140 \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@##1##2##3{%
141 \pgfplotspointonorientedsurfaceabtolinespec v##1%
142 \edef\pgfplots@loc@TMPe{\csname pgfplots@\pgfplotspointonorientedsurfaceA ticklabelaxisspec\endcsname}%
143 \ifx\pgfplots@loc@TMPe\pgfplotsretval
144 %\message{pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@{##1}---> TRUE.}%
145 ##2%
146 \else
147 %\message{pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@{##1}---> FALSE.}%
148 ##3%
149 \fi
150 }%
151 \def\pgfplots@ifgridlines@onorientedsurf@should@be@drawn##1##2{%
152 ##1% FIXME
153 }%
154 \def\pgfplotspointonorientedsurfaceabmatchaxisline##1##2{%
155 \pgfplotspointonorientedsurfaceabtolinespec v0% FIXME that's just a bad guess!
156 \edef\pgfplots@loc@TMPe{##1}%
157 \ifx\pgfplots@loc@TMPe\pgfplotsretval
158 \def##2{0}%
159 \else
160 \def##2{}%
161 \fi
162 }%
163 \let\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn=\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@%
164 %
165 %
166 % cartesian cs
167 \tikzdeclarecoordinatesystem{cartesian}{\edef\pgfplots@loc@TMPa{##1}\expandafter\pgfplotspointcartesian@\pgfplots@loc@TMPa\pgfplots@coord@end}
168 }%
169
170 \def\pgfplots@show@ticklabel@ternary@relative#1#2{%
171 \csname pgfplots@ternary@map@to@unit@#1\endcsname{#2}%
172 \pgfmathfloatparsenumber\pgfmathresult
173 \pgfmathfloatshift@\pgfmathresult{2}%
174 \let\tick=\pgfmathresult
175 }%
176
177 \def\pgfplotspointcartesian@#1,#2\pgfplots@coord@end{%
178 \pgfpointxy@orig{#1}{#2}%
179 }%
180
181 % This here is *the* key point why ternary axes can be processed with
182 % almost the same code as rectangular axes.
183 %
184 % Recall that rectangular axes are drawn using "oriented surfaces",
185 % the complete code is based on them. The "a" axis is the direction in
186 % which we have tick positions and the "b" axis is the direction in
187 % which tick lines (or grid lines) shall be drawn).
188 %
189 % Now, ternary axes do not directly fit into the "oriented surface"
190 % framework. But they have a lot of structure which allows to use it
191 % with a specialed "pointonorientedsurfaceab" routine: by noting that
192 % - there are only three axes,
193 % - the axis containing tick lines (and grid lines) *always* has one
194 % component set to 0 (lower limit), and the remaining two components
195 % sum to 1. Thus, we can simply use one value (for example the "a"
196 % value) and compute the remaining one,
197 % - \pgfplotspointonorientedsurfaceab is *always* invoked with
198 % b set to either the lower or the upper limit.
199 % The lower limit is easy, see above. The upper limit is mainly used
200 % for grid lines, more precisely it denotes the target point of the grid line.
201 % I use special handling to find this target point (by exchanging
202 % coordinate components, see the implementation).
203 %
204 % #1: the "a" value on the oriented surf
205 % #2: the "b" value. Note that *only* the lower *or* the upper limit
206 % on the "b" axis are supported here!
207 %
208 \def\pgfplotspointonorientedsurfaceab@ternary#1#2{%
209 \let\pgfplotspointonorientedsurfaceab@ternary@fixedx=\pgfplotspointonorientedsurfaceabsetupfor@fixedx
210 \let\pgfplotspointonorientedsurfaceab@ternary@fixedy=\pgfplotspointonorientedsurfaceabsetupfor@fixedy
211 \let\pgfplotspointonorientedsurfaceab@ternary@fixedz=\pgfplotspointonorientedsurfaceabsetupfor@fixedz
212 %
213 %\message{\string\pgfplotspointonorientedsurfaceab{#1}{#2} -----> }%
214 \ifpgfplots@ternary@next@is@unitinterval
215 \edef\pgfplotspointonorientedsurfaceab@ternary@A{#1}%
216 \edef\pgfplotspointonorientedsurfaceab@ternary@B{#2}%
217 \else
218 \csname pgfplots@ternary@map@to@unit@\pgfplotspointonorientedsurfaceA\endcsname{#1}%
219 \let\pgfplotspointonorientedsurfaceab@ternary@A=\pgfmathresult
220 %
221 \csname pgfplots@ternary@map@to@unit@\pgfplotspointonorientedsurfaceB\endcsname{#2}%
222 \let\pgfplotspointonorientedsurfaceab@ternary@B=\pgfmathresult
223 \fi
224 \if0\pgfplotspointonorientedsurfacespecsymbol
225 \else
226 \pgfplots@error{Internal processing error: only \string\pgfplotspointonorientedsurfaceab\space for ternary axes works only for oriented surfs fixed to LOWER or UPPER axis limits.}%
227 \fi
228 %\message{A=\pgfplotspointonorientedsurfaceab@ternary@A; B=\pgfplotspointonorientedsurfaceab@ternary@B -----> }%
229 \ifdim\pgfplotspointonorientedsurfaceab@ternary@B pt=0pt
230 \pgfmath@basic@subtract@{1}{\pgfplotspointonorientedsurfaceab@ternary@A}%
231 \let\pgfplotspointonorientedsurfaceab@ternary@B=\pgfmathresult
232 \expandafter\def\csname pgfplotspointonorientedsurfaceabsetupfor@fixed\pgfplotspointonorientedsurfaceN\endcsname{0}%
233 \else
234 %\let\pgfplots@loc@TMPa=\pgfplotspointonorientedsurfaceab@ternary@A
235 %\pgfmath@basic@subtract@{1}{\pgfplotspointonorientedsurfaceab@ternary@A}%
236 %\let\pgfplotspointonorientedsurfaceab@ternary@A=\pgfmathresult
237 %\let\pgfplotspointonorientedsurfaceab@ternary@B=\pgfplots@loc@TMPa
238 \pgfmath@basic@subtract@{1}{\pgfplotspointonorientedsurfaceab@ternary@A}%
239 \def\pgfplotspointonorientedsurfaceab@ternary@B{0}%
240 \expandafter\let\csname pgfplotspointonorientedsurfaceabsetupfor@fixed\pgfplotspointonorientedsurfaceN\endcsname=\pgfmathresult%
241 \fi
242 %
243 \global\pgfplots@ternary@next@is@unitintervaltrue
244 %\message{\string\pgfplotspointonorientedsurfaceab@orig{\pgfplotspointonorientedsurfaceab@ternary@A}{\pgfplotspointonorientedsurfaceab@ternary@B}[fixedsymbol=\pgfplotspointonorientedsurfacespecsymbol; a=\pgfplotspointonorientedsurfaceA,b=\pgfplotspointonorientedsurfaceB.]}%
245 \pgfplotspointonorientedsurfaceab@ternary@orig
246 {\pgfplotspointonorientedsurfaceab@ternary@A}%
247 {\pgfplotspointonorientedsurfaceab@ternary@B}%
248 %
249 \let\pgfplotspointonorientedsurfaceabsetupfor@fixedx=\pgfplotspointonorientedsurfaceab@ternary@fixedx
250 \let\pgfplotspointonorientedsurfaceabsetupfor@fixedy=\pgfplotspointonorientedsurfaceab@ternary@fixedy
251 \let\pgfplotspointonorientedsurfaceabsetupfor@fixedz=\pgfplotspointonorientedsurfaceab@ternary@fixedz
252 }%
253
254 \def\pgfplotspointonorientedsurfaceabwithbshift@ternary#1#2#3{%
255 % implement the shift in "b" direction explicitly:
256 %
257 \pgfplotspointonorientedsurfaceab@ternary{#1}{#2}%
258 \edef\pgfplots@loc@TMPe{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
259 \pgfpointadd
260 {\pgfplots@loc@TMPe}%
261 {%
262 \begingroup
263 % I need a '-' here because for ternary axes, the "b" axis
264 % points to the *outside* instead of the inside.
265 \pgf@xa=-#3\relax
266 \if r\pgfkeysvalueof{/pgfplots/\pgfplotspointonorientedsurfaceB\space dir/value}%
267 % oh. a reversed axis.
268 \pgf@xa=-\pgf@xa
269 \fi
270 \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber\pgf@xa}%
271 \pgfmath@basic@multiply@{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}{\pgfplots@loc@TMPa}%
272 \pgfmath@smuggleone\pgfmathresult
273 \endgroup
274 \let\pgfplots@loc@TMPa=\pgfmathresult
275 \pgfqpointscale{\pgfplots@loc@TMPa}{\csname pgfplotspointunit\pgfplotspointonorientedsurfaceB\endcsname}%
276 }%
277 }
278
279
280 \let\pgfplots@initsizes@ternary@orig=\pgfplots@initsizes
281 \def\pgfplots@initsizes@ternary{%
282 \ifpgfplots@threedim
283 \else
284 \pgfplots@error{Sorry, 'axis type=ternary' needs a three dimensional axes. Make sure you supplied three dimensional coordinates (using \string\addplot3, for example). This error is critical; I can't recover}%
285 \fi
286 %
287 \pgfplots@initsizes@get@width@withoutlabels
288 \pgf@x=\pgfmathresult
289 \edef\pgfplots@width@ternary{\pgf@sys@tonumber\pgf@x}%
290 %
291 \pgfplots@initsizes@ternary@orig
292 %
293 }%
294
295 \let\pgfplots@limits@ready@original=\pgfplots@limits@ready
296
297 \def\pgfplots@limits@ready@ternary{%
298 \pgfplots@limits@ready@original
299 %
300 %\message{ternary with limits x=[\pgfplots@xmin:\pgfplots@xmax], y=[\pgfplots@ymin:\pgfplots@ymax]; z=[\pgfplots@zmin:\pgfplots@zmax].}%
301 \pgfplots@ternary@init@map@to@unit x%
302 \pgfplots@ternary@init@map@to@unit y%
303 \pgfplots@ternary@init@map@to@unit z%
304 }%
305
306 \def\pgfplots@ternary@init@map@to@unit#1{%
307 \begingroup
308 \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@#1max\endcsname}%
309 \let\pgfplots@loc@TMPa=\pgfmathresult
310 \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@#1min\endcsname}%
311 \let\pgfplots@map@to@unit@scale@diff=\pgfmathresult
312 \pgfplotscoordmath{default}{op}{subtract}{{\pgfplots@loc@TMPa}{\pgfmathresult}}%
313 \pgfplotscoordmath{default}{op}{reciprocal}{{\pgfmathresult}}%
314 \let\pgfplots@map@to@unit@scale=\pgfmathresult
315 %
316 \expandafter\xdef\csname pgfplots@ternary@map@to@unit@#1\endcsname##1{%
317 \noexpand\pgfplotscoordmath{default}{parsenumber}{##1}%
318 \noexpand\pgfplotscoordmath{default}{op}{subtract}{{\noexpand\pgfmathresult}{\pgfplots@map@to@unit@scale@diff}}%
319 \noexpand\pgfplotscoordmath{default}{op}{multiply}{{\noexpand\pgfmathresult}{\pgfplots@map@to@unit@scale}}%
320 \noexpand\pgfplotscoordmath{default}{tofixed}{\noexpand\pgfmathresult}%
321 }%
322 \endgroup
323 }
324
325 \def\pgfplots@initsizes@setunitvector@ternary#1#2#3#4{%
326 % ternary axis are DIFFERENT here.
327 % They don't use the (xx,xy), (yx,yy), (zx,zy) vectors, so we can
328 % use them to implement *cartesian* coordinates.
329 %
330 % Thus, any \draw (0,0) inside of a ternary axis will yield
331 % cartesian coordinates.
332 %
333 % The relevant quantities to *draw* the diagram are the three
334 % axis, they are also prepared here.
335 %
336 \def#4{0}% whether we have (#1,0) or (0,#1)
337 \ifcase#2%
338 \pgfsetxvec{%
339 \pgfqpoint{\pgfplots@width@ternary pt}{0pt}%
340 }%
341 \pgfpointdiff
342 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary001}
343 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary100}%
344 \or
345 \pgfsetyvec{%
346 \pgfqpoint{0pt}{\pgfplots@width@ternary pt}%
347 }%
348 \pgfpointdiff
349 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary100}
350 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary010}%
351 \or
352 \pgfsetzvec{%
353 \pgfpointorigin
354 }%
355 \pgfpointdiff
356 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary010}
357 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary001}%
358 \fi
359 \expandafter\xdef\csname pgfplotspoint#1axis\endcsname{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
360 %
361 %\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).}%
362 }%
363
364 \def\pgfplots@computeunitvectorlengths@ternary{%
365 \pgfplots@computeunitvectorlengths@ternary@ x%
366 \pgfplots@computeunitvectorlengths@ternary@ y%
367 \pgfplots@computeunitvectorlengths@ternary@ z%
368 }
369 \def\pgfplots@computeunitvectorlengths@ternary@#1{%
370 \csname pgfplotspoint#1axis\endcsname
371 \pgfmathveclen{\pgf@x}{\pgf@y}%
372 \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult
373 \pgfplotsmath@ifzero{\pgfmathresult}{%
374 \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}%
375 }{%
376 \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}%
377 \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult
378 }%
379 \expandafter\xdef\csname pgfplotspoint#1axislength\endcsname{\pgfplots@x@veclength pt}%
380 %
381 }%
382
383 \newif\ifpgfplots@ternary@next@is@unitinterval
384
385 % Deduce z = 1-x-y after transformation to relative coordinates.
386 \def\pgfplotsqpointxy@ternary#1#2{%
387 \pgf@process{%
388 \ifpgfplots@ternary@next@is@unitinterval
389 \dimen1=#1pt
390 \dimen2=#2pt
391 \else
392 \pgfplots@ternary@map@to@unit@x{#1}%
393 \dimen1=\pgfmathresult pt
394 %
395 \pgfplots@ternary@map@to@unit@y{#2}%
396 \dimen2=\pgfmathresult pt
397 \fi
398 \dimen4=\dimen1
399 \advance\dimen4 by\dimen2
400 \dimen3=1pt
401 \advance\dimen3 by-\dimen4
402 %
403 \global\pgfplots@ternary@next@is@unitintervalfalse
404 \pgfplotsqpointxyz@ternary@
405 }%
406 }%
407 % gx(x,y,z) = 0.5 * (x + 2*z)/(x+y+z)
408 % gy(x,y,z) = (sqrt(3) / 2) * x / (x+y+z)
409 \def\pgfplotsqpointxyz@ternary#1#2#3{%
410 \pgf@process{%
411 \ifpgfplots@ternary@next@is@unitinterval
412 \dimen1=#1pt
413 \dimen2=#2pt
414 \dimen3=#3pt
415 \else
416 \pgfplots@ternary@map@to@unit@x{#1}%
417 \dimen1=\pgfmathresult pt
418 %
419 \pgfplots@ternary@map@to@unit@y{#2}%
420 \dimen2=\pgfmathresult pt
421 %
422 \pgfplots@ternary@map@to@unit@z{#3}%
423 \dimen3=\pgfmathresult pt
424 \fi
425 \global\pgfplots@ternary@next@is@unitintervalfalse
426 %
427 \pgfplotsqpointxyz@ternary@
428 }%
429 }%
430 \def\pgfplotsqpointxyz@ternary@{%
431 %\dimen1=#1
432 %\dimen2=#2
433 %\dimen3=#3
434 % FIXME . I didn't understand that stuff.
435 \if r\pgfkeysvalueof{/pgfplots/x dir/value}% reversed
436 %\multiply\dimen1 by-1
437 %\advance\dimen1 by1pt
438 %\dimen1=#2
439 %\dimen2=#3
440 %\dimen3=#1
441 \fi
442 %--------------------------------------------------
443 % \if r\pgfkeysvalueof{/pgfplots/y dir/value}% reversed
444 % \multiply\dimen2 by-1
445 % \advance\dimen2 by1pt
446 % \fi
447 % \if r\pgfkeysvalueof{/pgfplots/z dir/value}% reversed
448 % \multiply\dimen3 by-1
449 % \advance\dimen3 by1pt
450 % \fi
451 %--------------------------------------------------
452 \pgfplotsqpointxyz@ternary@@%
453 }%
454 \def\pgfplotsqpointxyz@ternary@@{%
455 % Disable renormalization!?
456 %\dimen4=\dimen1
457 %\advance\dimen4 by\dimen2
458 %\advance\dimen4 by\dimen3
459 %\edef\pgfplots@ternary@sum{\pgf@sys@tonumber{\dimen4}}%
460 %\pgfmathapproxequalto@{1}{\pgfplots@ternary@sum}%
461 \pgfmathcomparisontrue
462 \ifpgfmathcomparison
463 \let\pgfplots@ternary@scale=\pgfplots@width@ternary
464 \else
465 \pgfmath@basic@divide@
466 {\pgfplots@width@ternary}%
467 {\pgfplots@ternary@sum}%
468 \let\pgfplots@ternary@scale=\pgfmathresult
469 \fi
470 %
471 \dimen4=2\dimen3
472 \advance\dimen4 by \dimen1
473 \divide\dimen4 by2
474 \pgf@x=\pgfplots@ternary@scale\dimen4
475 %
476 \dimen4=\dimen1
477 \dimen4=0.866025403784\dimen4 % *= sqrt(3)/2
478 \pgf@y=\pgfplots@ternary@scale\dimen4
479 %
480 }%
481 \def\pgfplotspoint@initialisation@units@ternary{%
482 \let\pgfplotspointunitx\pgfplotspointxaxis
483 \let\pgfplotspointunity\pgfplotspointyaxis
484 \let\pgfplotsunitxlength=\pgfplots@x@veclength
485 \let\pgfplotsunitylength=\pgfplots@y@veclength
486 \let\pgfplotsunitxinvlength=\pgfplots@x@inverseveclength
487 \let\pgfplotsunityinvlength=\pgfplots@y@inverseveclength
488 \ifpgfplots@threedim
489 \let\pgfplotspointunitz=\pgfplotspointzaxis
490 \let\pgfplotsunitzlength=\pgfplots@z@veclength
491 \let\pgfplotsunitzinvlength=\pgfplots@z@inverseveclength
492 \fi
493 }%
494
495 % POSTCONDITION: the macros
496 % \pgfplotspointminminmin
497 % \pgfplotspoint[xyz]axis
498 % \pgfplotspoint[xyz]axislength
499 % are defined (globally).
500 \def\pgfplotspoint@initialisation@axes@ternary{%
501 \xdef\pgfplotspointminminmin{\noexpand\pgfpointorigin}%
502 %
503 \pgfpointdiff
504 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary001}
505 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary100}%
506 \if r\pgfkeysvalueof{/pgfplots/x dir/value}% reverse
507 \pgfqpointscale{-1}{}%
508 \fi
509 \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
510 \pgfmathveclen{\pgf@x}{\pgf@y}%
511 \expandafter\let\csname pgfplots@x@veclength\endcsname=\pgfmathresult
512 \pgfplotsmath@ifzero{\pgfmathresult}{%
513 \expandafter\def\csname pgfplots@x@inverseveclength\endcsname{infty}%
514 }{%
515 \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}%
516 \expandafter\let\csname pgfplots@x@inverseveclength\endcsname=\pgfmathresult
517 }%
518 \xdef\pgfplotspointxaxislength{\pgfplots@x@veclength pt}%
519 %
520 \pgfpointdiff
521 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary100}
522 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary010}%
523 \if r\pgfkeysvalueof{/pgfplots/y dir/value}% reverse
524 \pgfqpointscale{-1}{}%
525 \fi
526 \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
527 \pgfmathveclen{\pgf@x}{\pgf@y}%
528 \expandafter\let\csname pgfplots@y@veclength\endcsname=\pgfmathresult
529 \pgfplotsmath@ifzero{\pgfmathresult}{%
530 \expandafter\def\csname pgfplots@y@inverseveclength\endcsname{infty}%
531 }{%
532 \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}%
533 \expandafter\let\csname pgfplots@y@inverseveclength\endcsname=\pgfmathresult
534 }%
535 \xdef\pgfplotspointyaxislength{\pgfplots@y@veclength pt}%
536 %
537 \pgfpointdiff
538 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary010}
539 {\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary001}%
540 \if r\pgfkeysvalueof{/pgfplots/z dir/value}% reverse
541 \pgfqpointscale{-1}{}%
542 \fi
543 \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
544 \pgfmathveclen{\pgf@x}{\pgf@y}%
545 \expandafter\let\csname pgfplots@z@veclength\endcsname=\pgfmathresult
546 \pgfplotsmath@ifzero{\pgfmathresult}{%
547 \expandafter\def\csname pgfplots@z@inverseveclength\endcsname{infty}%
548 }{%
549 \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}%
550 \expandafter\let\csname pgfplots@z@inverseveclength\endcsname=\pgfmathresult
551 }%
552 \xdef\pgfplotspointzaxislength{\pgfplots@z@veclength pt}%
553 %
554 }
555 \def\pgfplots@prepare@ZERO@coordinates@ternary{%
556 \ifpgfplots@xislinear
557 \ifpgfplots@apply@datatrafo@x
558 \pgfplotscoordmath{x}{parsenumber}{0}%
559 \pgfplotscoordmath{x}{datascaletrafo}{\pgfmathresult}%
560 \global\let\pgfplots@logical@ZERO@x=\pgfmathresult
561 \else
562 \gdef\pgfplots@logical@ZERO@x{0}%
563 \fi
564 \pgfplotsmathmax{\pgfplots@logical@ZERO@x}{\pgfplots@xmin}%
565 \global\let\pgfplots@logical@ZERO@x=\pgfmathresult
566 \pgfplotsmathmin{\pgfplots@logical@ZERO@x}{\pgfplots@xmax}%
567 \global\let\pgfplots@logical@ZERO@x=\pgfmathresult
568 \else
569 \global\let\pgfplots@logical@ZERO@x=\pgfplots@xmin%
570 \fi
571 %
572 \ifpgfplots@yislinear
573 \ifpgfplots@apply@datatrafo@y
574 \pgfplotscoordmath{y}{parsenumber}{0}%
575 \pgfplotscoordmath{y}{datascaletrafo}{\pgfmathresult}%
576 \global\let\pgfplots@logical@ZERO@y=\pgfmathresult
577 \else
578 \gdef\pgfplots@logical@ZERO@y{0}%
579 \fi
580 \pgfplotsmathmax{\pgfplots@logical@ZERO@y}{\pgfplots@ymin}%
581 \global\let\pgfplots@logical@ZERO@y=\pgfmathresult
582 \pgfplotsmathmin{\pgfplots@logical@ZERO@y}{\pgfplots@ymax}%
583 \global\let\pgfplots@logical@ZERO@y=\pgfmathresult
584 \else
585 \global\let\pgfplots@logical@ZERO@y=\pgfplots@ymin%
586 \fi
587 %
588 \ifpgfplots@threedim
589 \ifpgfplots@zislinear
590 \ifpgfplots@apply@datatrafo@z
591 \pgfplotscoordmath{z}{parsenumber}{0}%
592 \pgfplotscoordmath{z}{datascaletrafo}{\pgfmathresult}%
593 \global\let\pgfplots@logical@ZERO@z=\pgfmathresult
594 \else
595 \gdef\pgfplots@logical@ZERO@z{0}%
596 \fi
597 \pgfplotsmathmax{\pgfplots@logical@ZERO@z}{\pgfplots@zmin}%
598 \global\let\pgfplots@logical@ZERO@z=\pgfmathresult
599 \pgfplotsmathmin{\pgfplots@logical@ZERO@z}{\pgfplots@zmax}%
600 \global\let\pgfplots@logical@ZERO@z=\pgfmathresult
601 \else
602 \global\let\pgfplots@logical@ZERO@z=\pgfplots@zmin%
603 \fi
604 \fi
605 %
606 %
607 \global\pgfplots@ternary@next@is@unitintervaltrue
608 \pgfplotsqpointxyz100%
609 \xdef\pgfplots@ZERO@x{\the\pgf@x}%
610 \xdef\pgfplots@ZERO@y{\the\pgf@y}%
611 \xdef\pgfplotspointaxisorigin{\noexpand\pgf@x=\pgfplots@ZERO@x\space\noexpand\pgf@y=\pgfplots@ZERO@y\space}%
612 }%
613
614
615 \def\pgfplots@draw@axis@ternary{%
616 %
617 % this should become the line for varying y:
618 \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}%
619 \pgfplots@draw@axis@insurface yxz
620 %
621 % this should become the line for varying z:
622 \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}%
623 \pgfplots@draw@axis@insurface zyx
624 %
625 %
626 % this should become the line for varying x:
627 \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}%
628 \pgfplots@draw@axis@insurface xzy
629 %
630 \pgfplots@ternary@draw@axislines
631 }%
632 \def\pgfplots@ternary@draw@axislines{%
633 \if r\pgfkeysvalueof{/pgfplots/x dir/value}% reverse
634 \pgfplots@separate@axis@linestrue
635 \fi
636 \if r\pgfkeysvalueof{/pgfplots/y dir/value}% reverse
637 \pgfplots@separate@axis@linestrue
638 \fi
639 \if r\pgfkeysvalueof{/pgfplots/z dir/value}% reverse
640 \pgfplots@separate@axis@linestrue
641 \fi
642 \ifpgfplots@separate@axis@lines
643 \scope[/pgfplots/every outer x axis line,
644 xdiscont,decoration={pre length=\csname xdisstart\endcsname, post length=\csname xdisend\endcsname}]
645 \draw decorate {
646 \pgfextra
647 \if r\pgfkeysvalueof{/pgfplots/x dir/value}% reverse
648 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz100}%
649 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz001}%
650 \else
651 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz001}%
652 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz100}%
653 \fi
654 \endpgfextra
655 };
656 \endscope
657 %
658 \scope[/pgfplots/every outer y axis line,
659 ydiscont,decoration={pre length=\csname ydisstart\endcsname, post length=\csname ydisend\endcsname}]
660 \draw decorate {
661 \pgfextra
662 \if r\pgfkeysvalueof{/pgfplots/y dir/value}% reverse
663 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz010}%
664 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz100}%
665 \else
666 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz100}%
667 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz010}%
668 \fi
669 \endpgfextra
670 };
671 \endscope
672 %
673 \scope[/pgfplots/every outer z axis line,
674 zdiscont,decoration={pre length=\csname zdisstart\endcsname, post length=\csname zdisend\endcsname}]
675 \draw decorate {
676 \pgfextra
677 \if r\pgfkeysvalueof{/pgfplots/z dir/value}% reverse
678 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz001}%
679 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz010}%
680 \else
681 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz010}%
682 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz001}%
683 \fi
684 \endpgfextra
685 };
686 \endscope
687 \else
688 \draw[
689 /pgfplots/every outer x axis line, % FIXME! these outer styles need much more attention :-(
690 /pgfplots/every outer y axis line]
691 \pgfextra{%
692 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz001}%
693 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz100}%
694 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz010}%
695 \pgfpathclose
696 };
697 \fi
698 }%
699 \def\pgfplots@clippath@prepare@for@axistype@ternary{%
700 \def\pgfplots@clippath@install##1{%
701 \pgfpathmoveto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz001}%
702 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz100}%
703 \pgfpathlineto{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz010}%
704 \pgfpathclose
705 \pgfplots@clippath@use@{##1}%
706 }%
707 }%
708
709 \def\pgfplots@draw@axis@post@ternary{%
710 % do nothing. There is no 3d box to draw here.
711 }%
712
713 \def\pgfplotspointouternormalvectorofaxis@ternary#1#2#3\relax{%
714 \edef\pgfplots@loc@TMPa{\if r\pgfkeysvalueof{/pgfplots/x dir/value}-\fi}% reverse
715 \edef\pgfplots@loc@TMPb{\if r\pgfkeysvalueof{/pgfplots/y dir/value}-\fi}% reverse
716 \edef\pgfplots@loc@TMPc{\if r\pgfkeysvalueof{/pgfplots/z dir/value}-\fi}% reverse
717 \if v#1%
718 \pgfpointadd
719 {\pgfqpointscale{\pgfplots@loc@TMPb-1}{\pgfplotspointyaxis}}%
720 {\pgfqpointscale{\pgfplots@loc@TMPc}{\pgfplotspointzaxis}}%
721 \else
722 \if v#2%
723 \pgfpointadd
724 {\pgfqpointscale{\pgfplots@loc@TMPa}{\pgfplotspointxaxis}}%
725 {\pgfqpointscale{\pgfplots@loc@TMPc-1}{\pgfplotspointzaxis}}%
726 \else
727 \pgfpointadd
728 {\pgfqpointscale{\pgfplots@loc@TMPa-1}{\pgfplotspointxaxis}}%
729 {\pgfqpointscale{\pgfplots@loc@TMPb}{\pgfplotspointyaxis}}%
730 \fi
731 \fi
732 \pgf@process{\pgfpointnormalised{}}%
733 \endgroup
734 }%
735
736
737 \def\pgfplotsclickable@check@enable@axistype@ternaryaxis{%
738 \def\pgfplotsretval{1}%
739 }%
740
741
742 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
743 % tieline plots
744 %
745 \pgfplotsset{
746 tieline/.code={%
747 \let\tikz@plot@handler=\pgfplotsplothandlertieline
748 \pgfkeysifdefined{/pgfplots/table/tie end x}{}{%
749 % provide these keys locally:
750 \pgfkeyslet{/pgfplots/table/tie end x}\pgfutil@empty%
751 \pgfkeyslet{/pgfplots/table/tie end y}\pgfutil@empty%
752 \pgfkeyslet{/pgfplots/table/tie end z}\pgfutil@empty%
753 \pgfkeyslet{/pgfplots/table/tie end x index}\pgfutil@empty%
754 \pgfkeyslet{/pgfplots/table/tie end y index}\pgfutil@empty%
755 \pgfkeyslet{/pgfplots/table/tie end z index}\pgfutil@empty%
756 }%
757 \pgfqkeys{/pgfplots/tieline}{#1}%
758 },
759 tieline/every tieline/.style={},
760 tieline/tieline style/.style={/pgfplots/tieline/every tieline/.append style={#1}},
761 tieline/every curve/.style={},
762 tieline/curve style/.style={/pgfplots/tieline/every curve/.append style={#1}},
763 tieline/each nth tie/.initial=,
764 }
765 \def\pgfplotsplothandlertieline{%
766 \pgfplotsresetplothandler
767 \let\pgf@plotstreamstart=\pgfplotsplothandlervisbegin@tieline
768 \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@tieline
769 \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@tieline
770 \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@tieline
771 }%
772 \def\pgfplotsplothandlervisbegin@tieline{%
773 \pgfplotsapplistXnewempty\pgfp@binodal@A
774 \pgfplotsapplistXnewempty\pgfp@ties
775 \pgfplotsprependlistXnewempty{pgfp@binodal@B@reverse}
776 \def\b@pgfplotsplothandlersurveystart@tieline@even{1}%
777 %
778 \global\let\pgf@plotstreampoint=\pgfplotsplothandlervis@streampoint@tieline
779 \global\let\pgf@plotstreamend=\pgfplotsplothandlervis@streamend@tieline
780 %
781 \pgfkeysgetvalue{/pgfplots/tieline/each nth tie}\pgfplots@eachnth@tie
782 \ifx\pgfplots@eachnth@tie\pgfutil@empty
783 \def\pgfplots@eachnth@tie{1}%
784 \fi
785 \let\c@pgfplots@tiecounter=\c@pgfplotstable@counta
786 \c@pgfplots@tiecounter=0
787 }%
788 \def\pgfplotsplothandlervis@streampoint@tieline#1{%
789 \pgf@process{#1}%
790 \edef\pgfplots@loc@TMPa{%
791 \noexpand\pgfplots@stream@withmeta@
792 {\pgfplots@current@point@coordindex}%
793 {\the\pgf@x}{\the\pgf@y}%
794 {\pgfplots@current@point@meta}%
795 }%
796 \if1\b@pgfplotsplothandlersurveystart@tieline@even
797 \let\pgfplotsplothandlervis@streampoint@tieline@last=\pgfplots@loc@TMPa
798 \expandafter\pgfplotsapplistXpushback\pgfplots@loc@TMPa\to\pgfp@binodal@A
799 \def\b@pgfplotsplothandlersurveystart@tieline@even{0}%
800 \else
801 \expandafter\pgfplotsprependlistXpushfront\pgfplots@loc@TMPa\to{pgfp@binodal@B@reverse}%
802 %
803 \advance\c@pgfplots@tiecounter by1
804 \ifnum\pgfplots@eachnth@tie=\c@pgfplots@tiecounter
805 \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}%
806 \t@pgfplots@tokb=\expandafter{\pgfplotsplothandlervis@streampoint@tieline@last}%
807 \edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka\the\t@pgfplots@tokb\noexpand\pgfplotsplothandlertieline@finishtie}%
808 \expandafter\pgfplotsapplistXpushback\pgfplots@loc@TMPa\to\pgfp@ties
809 \c@pgfplots@tiecounter=0
810 \fi
811 %
812 \def\b@pgfplotsplothandlersurveystart@tieline@even{1}%
813 \fi
814 }%
815 \def\pgfplotsplothandlervis@streamend@tieline{%
816 \begingroup
817 \pgfplots@drawmodes@appendtrue
818 \path[/pgfplots/tieline/every curve]%
819 \pgfextra
820 \ifx\tikz@plot@handler\pgfplotsplothandlertieline
821 \let\tikz@plot@handler\pgfplothandlerlineto
822 \fi
823 \pgfplotsresetplothandler
824 \tikz@plot@handler
825 \pgf@plotstreamstart
826 %
827 \pgfplotsapplistXlet\pgfplots@loc@TMPa=\pgfp@binodal@A
828 \pgfplots@loc@TMPa
829 \pgfplotsapplistXnewempty\pgfp@binodal@A
830 \pgfplotsprependlistXlet\pgfplots@loc@TMPa={pgfp@binodal@B@reverse}%
831 \pgfplots@loc@TMPa
832 \pgfplotsprependlistXnewempty{pgfp@binodal@B@reverse}%
833 %
834 \pgf@plotstreamend
835 \endpgfextra;
836 \endgroup
837 %
838 %
839 \pgfplotsset{/pgfplots/tieline/every tieline}%
840 \ifx\tikz@plot@handler\pgfplotsplothandlertieline
841 \let\tikz@plot@handler\pgfplothandlerlineto
842 \fi
843 \pgfplotsresetplothandler
844 \tikz@plot@handler
845 \pgf@plotstreamstart
846 %
847 \def\pgfplotsplothandlertieline@finishtie{%
848 \pgfplotsplothandlervisualizejump
849 }%
850 \pgfplotsapplistXlet\pgfplots@loc@TMPa=\pgfp@ties
851 \pgfplots@loc@TMPa
852 \pgfplotsapplistXnewempty\pgfp@ties
853 %
854 \pgf@plotstreamend
855 }%
856
857 \def\pgfplotsplothandlersurveystart@tieline{%
858 \def\pgfplots@loc@TMPa{table}%
859 \ifx\pgfplotssurveyphaseinputclass\pgfplots@loc@TMPa
860 \else
861 \pgfplots@error{Sorry, 'tieline' plots are currently only supported for \string\addplot\space table}%
862 \fi
863 \def\b@pgfplotsplothandlersurveystart@tieline@init{0}%
864 }%
865 \def\pgfplotsplothandlersurveyend@tieline{%
866 }%
867
868 \def\pgfplotsplothandlersurveypoint@tieline@init{%
869 \pgfplotsplothandlersurveypoint@tieline@init@find@tieendcolfor x\pgfplotsplothandlertieline@Bx
870 \pgfplotsplothandlersurveypoint@tieline@init@find@tieendcolfor y\pgfplotsplothandlertieline@By
871 \ifpgfplots@curplot@threedim
872 \pgfplotsplothandlersurveypoint@tieline@init@find@tieendcolfor z\pgfplotsplothandlertieline@Bz
873 \fi
874 %
875 \def\b@pgfplotsplothandlersurveystart@tieline@init{1}%
876 }%
877 \def\pgfplotsplothandlersurveypoint@tieline@init@find@tieendcolfor#1#2{%
878 \let#2=\relax
879 \pgfkeysgetvalue{/pgfplots/table/tie end #1}{\pgfplots@loc@TMPa}%
880 \ifx\pgfplots@loc@TMPa\pgfutil@empty
881 \pgfkeysgetvalue{/pgfplots/table/tie end #1 index}{\pgfplots@loc@TMPa}%
882 \ifx\pgfplots@loc@TMPa\pgfutil@empty
883 \else
884 \edef#2{\noexpand\getthisrowno{\pgfplots@loc@TMPa}\noexpand\pgfmathresult}%
885 \fi
886 \else
887 \edef#2{\noexpand\getthisrow{\pgfplots@loc@TMPa}\noexpand\pgfmathresult}%
888 \fi
889 \ifx#2\relax
890 \pgfplotsplothandlersurveypoint@tieline@init@find@colindex@for #1\pgfplots@loc@ind
891 \c@pgf@countd=\pgfplots@loc@ind\relax
892 \advance\c@pgf@countd by3
893 \ifnum\c@pgf@countd<\pgfplotstablecols\relax
894 \else
895 \c@pgf@countd=0
896 \pgfplots@error{Sorry, I can't find the 'tie end #1 index' automatically. Please provide 'table[tie end #1={<colname>}]' or 'table[tie end #1 index=<col index>]' manually and verify the all, x,y and z components are correct}%
897 \fi
898 \edef\pgfplots@loc@ind{\the\c@pgf@countd}%
899 \pgfkeyslet{/pgfplots/table/tie end #1 index}\pgfplots@loc@ind
900 \edef#2{\noexpand\getthisrowno{\pgfplots@loc@ind}\noexpand\pgfmathresult}%
901 \fi
902 }%
903
904 \def\pgfplotsplothandlersurveypoint@tieline@init@find@colindex@for#1#2{%
905 \pgfkeysgetvalue{/pgfplots/table/#1}{\pgfplots@loc@TMPa}%
906 \pgfkeysgetvalue{/pgfplots/table/#1 index}{\pgfplots@loc@TMPb}%
907 \ifx\pgfplots@loc@TMPa\pgfutil@empty
908 \let#2=\pgfplots@loc@TMPb
909 \else
910 \def\pgfplots@loc@TMPb{\expandafter\pgfplotstablegetcolumnindexforname\expandafter{\pgfplots@loc@TMPa}\of}%
911 \expandafter\pgfplots@loc@TMPb\pgfplotstablename\to#2%
912 \fi
913 }%
914
915 \def\pgfplotsplothandlersurveypoint@tieline{%
916 \if0\b@pgfplotsplothandlersurveystart@tieline@init
917 \pgfplotsplothandlersurveypoint@tieline@init
918 \fi
919 \pgfplotsplothandlersurveypoint@default
920 %
921 \pgfplotsplothandlertieline@Bx\let\pgfplots@current@point@x=\pgfmathresult
922 \pgfplotsplothandlertieline@By\let\pgfplots@current@point@y=\pgfmathresult
923 \ifpgfplots@curplot@threedim
924 \pgfplotsplothandlertieline@Bz\let\pgfplots@current@point@z=\pgfmathresult
925 \fi
926 \pgfplotsplothandlersurveypoint@default
927 }%
928 \endinput