summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-08-06 22:47:59 +0000
committerKarl Berry <karl@freefriends.org>2014-08-06 22:47:59 +0000
commit1da164bf9c4fed03b30b98439a239f5a1873f9ae (patch)
tree2ed76752cb203cacf4135b821206b45c24b1a534 /Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
parente16354c1642ffdd8e82798c9f0f60108e85059c6 (diff)
pgfplots (6aug14)
git-svn-id: svn://tug.org/texlive/trunk@34851 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex214
1 files changed, 144 insertions, 70 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
index 02ff3e96b1b..6b64807a05c 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
@@ -58,12 +58,13 @@
\else
\pgfplotspointbbdiagonal
\fi
- \pgf@xx=\pgf@x
- \pgf@xy=0pt
- \pgf@yx=0pt
- \pgf@yy=\pgf@y
- \pgf@zx=0pt
- \pgf@zy=0pt
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ % do not use \pgfqpoint here - it may have been replaced
+ % (compare \pgfplots@change@pgfpoints@to@descriptioncs)
+ \pgfsetxvec{\global\pgf@x=\pgf@xa \global\pgf@y=0pt }%
+ \pgfsetyvec{\global\pgf@x=0pt \global\pgf@y=\pgf@ya}%
+ \pgfsetzvec{\global\pgf@x=0pt \global\pgf@y=0pt }%
}%
%
% The \pgfplotsqpointxyz method (or its 2d counterpart) are THE
@@ -3462,7 +3463,6 @@
\noexpand\pgfkeyssetvalue{/pgfplots/x coord sorting}{\pgfkeysvalueof{/pgfplots/x coord sorting}}%
\noexpand\pgfkeyssetvalue{/pgfplots/y coord sorting}{\pgfkeysvalueof{/pgfplots/y coord sorting}}%
%
- \noexpand\pgfplots@initzerolevelhandler
% remember 'current plot style':
\noexpand\pgfplots@define@currentplotstyle@as{%
\the\t@pgfplots@toka
@@ -3573,6 +3573,7 @@
\def\pgfplotsaxis@visphase@name@default{default}
\def\pgfplotsaxis@visphase@name@markers{markers}
+% This defines \pgfplots@visphase@default:
\expandafter\def\csname pgfplots@visphase@\pgfplotsaxis@visphase@name@default\endcsname{%
\expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI
}%
@@ -4197,37 +4198,55 @@
\pgfplots@coord@stream@end
}%
+\begingroup
+\def\\{\global\let\pgfplots@let@space@token= } \\ % now, \pgfplots@let@space@token is a space token
+\endgroup
+
+
% A looping command to loop through plot coordinates.
-% For every point, #1{X}{Y} will be invoked.
+% For every point, \pgfplots@coord@stream@coord will be invoked.
%
% No scoping is used during this operation, so you can access outer
% variables.
\def\pgfplots@foreach@plot@coord@ITERATE{%
- \pgfutil@ifnextchar\pgfplots@EOI{%
- \pgfplots@foreach@plot@coord@FINISH%
- }{%
- \pgfutil@ifnextchar\par{%
- \pgfplotsscanlinecomplete
- \pgfplots@foreach@plot@coord@ITERATE@gobbleone
- }{%
- \pgfutil@ifnextchar({%
- \pgfplotsscanlinelengthincrease
- \pgfplots@foreach@plot@coord@NEXT%
- }{%
- \pgfplots@foreach@plot@coord@error
- }%
- }%
- }%
+ \futurelet\pgfplots@foreach@plot@coord@ITERATE@tok\pgfplots@foreach@plot@coord@ITERATE@
+}%
+\long\def\pgfplots@foreach@plot@coord@ITERATE@#1{%
+ \ifx\pgfplots@foreach@plot@coord@ITERATE@tok(%
+ \pgfplotsscanlinelengthincrease
+ \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@NEXT%
+ \else
+ \ifx\pgfplots@foreach@plot@coord@ITERATE@tok\pgfplots@let@space@token
+ \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@ITERATE#1}%
+ \else
+ \ifx\pgfplots@foreach@plot@coord@ITERATE@tok\pgfplots@EOI
+ % ok, do nothing more
+ \let\pgfplots@loop@next=\relax
+ \else
+ \ifx\pgfplots@foreach@plot@coord@ITERATE@tok\par
+ \pgfplotsscanlinecomplete
+ \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@ITERATE
+ \else
+ \if\noexpand\pgfplots@foreach@plot@coord@ITERATE@tok\noexpand\anymacro
+ % Ah. #1 has the same character (!) code as \anymacro,
+ % that means it is a macro! Expand it:
+ \def\pgfplots@loop@next{\expandafter\pgfplots@foreach@plot@coord@ITERATE#1}%
+ \else
+ \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@error#1}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfplots@loop@next
}
+
\long\def\pgfplots@foreach@plot@coord@error#1\pgfplots@EOI{%
- \pgfplots@error{Sorry, I could not read the plot coordinates near '#1'. Please check for format mistakes.}%
+ \def\pgfplots@loc@TMPa{#1}%
+ \pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPa
+ \pgfplots@error{Sorry, I could not read the plot coordinates near '\pgfplots@loc@TMPa'. Please check for format mistakes}%
}%
-\long\def\pgfplots@foreach@plot@coord@ITERATE@gobbleone#1{\pgfplots@foreach@plot@coord@ITERATE}%
-\def\pgfplots@foreach@plot@coord@NEXT(#1){%
- \edef\pgfmathresult{#1}%
- \expandafter\pgfplots@foreach@plot@coord@NEXT@\expandafter(\pgfmathresult)%
-}
-\def\pgfplots@foreach@plot@coord@NEXT@(#1,#2){%
+\def\pgfplots@foreach@plot@coord@NEXT#1,#2){%
\ifpgfplots@plot@coords@mathparser
\pgfmathparse{#1}\let\pgfplots@current@point@x=\pgfmathresult
\pgfmathparse{#2}\let\pgfplots@current@point@y=\pgfmathresult
@@ -4315,7 +4334,6 @@
%
\pgfplots@foreach@plot@coord@NEXT@cont
}
-\def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
@@ -4328,28 +4346,38 @@
\pgfplots@coord@stream@end
}%
\def\pgfplots@foreach@plot@coord@threedim@ITERATE{%
- \pgfutil@ifnextchar\pgfplots@EOI{%
- \pgfplots@foreach@plot@coord@FINISH%
- }{%
- \pgfutil@ifnextchar\par{%
- \pgfplotsscanlinecomplete
- \pgfplots@foreach@plot@coord@threedim@ITERATE@gobbleone
- }{%
- \pgfutil@ifnextchar({%
- \pgfplotsscanlinelengthincrease
- \pgfplots@foreach@plot@coord@threedim@NEXT%
- }{%
- \pgfplots@foreach@plot@coord@error
- }%
- }%
- }%
-}
-\long\def\pgfplots@foreach@plot@coord@threedim@ITERATE@gobbleone#1{\pgfplots@foreach@plot@coord@threedim@ITERATE}%
-\def\pgfplots@foreach@plot@coord@threedim@NEXT(#1){%
- \edef\pgfmathresult{#1}%
- \expandafter\pgfplots@foreach@plot@coord@threedim@NEXT@\expandafter(\pgfmathresult)%
+ \futurelet\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\pgfplots@foreach@plot@coord@threedim@ITERATE@
+}%
+\long\def\pgfplots@foreach@plot@coord@threedim@ITERATE@#1{%
+ \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok(%
+ \pgfplotsscanlinelengthincrease
+ \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@threedim@NEXT%
+ \else
+ \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\pgfplots@let@space@token
+ \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@threedim@ITERATE#1}%
+ \else
+ \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\pgfplots@EOI
+ % ok, do nothing more
+ \let\pgfplots@loop@next=\relax
+ \else
+ \ifx\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\par
+ \pgfplotsscanlinecomplete
+ \let\pgfplots@loop@next=\pgfplots@foreach@plot@coord@threedim@ITERATE
+ \else
+ \if\noexpand\pgfplots@foreach@plot@coord@threedim@ITERATE@tok\noexpand\anymacro
+ % Ah. #1 has the same character (!) code as \anymacro,
+ % that means it is a macro! Expand it:
+ \def\pgfplots@loop@next{\expandafter\pgfplots@foreach@plot@coord@threedim@ITERATE#1}%
+ \else
+ \def\pgfplots@loop@next{\pgfplots@foreach@plot@coord@error#1}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \pgfplots@loop@next
}
-\def\pgfplots@foreach@plot@coord@threedim@NEXT@(#1,#2,#3){%
+\def\pgfplots@foreach@plot@coord@threedim@NEXT#1,#2,#3){
\ifpgfplots@plot@coords@mathparser
\pgfmathparse{#1}\let\pgfplots@current@point@x=\pgfmathresult
\pgfmathparse{#2}\let\pgfplots@current@point@y=\pgfmathresult
@@ -4564,6 +4592,15 @@
\pgfplots@validate@plot@domain@arguments
}
+\def\pgfplots@disable@non@survey@keys{%
+ %
+ % this here would try to compute something. DON'T DO THIS DURING
+ % SURVEY!
+ \pgfkeysdef{/tikz/name intersections}{}%
+ \pgfkeysdef{/tikz/intersection segments}{}%
+ %
+}%
+
\def\pgfplots@start@plot@with@behavioroptions@setkeys#1{%
% these styles may contain behavior options (error bars,
% samples,... ) activate them!
@@ -4595,6 +4632,7 @@
%
% it is possible that '#1' contains 'forget plot'. So, we need to
% set the options before checking \ifpgfplots@curplot@isirrelevant:
+ \pgfplots@disable@non@survey@keys
\pgfplotsset{/pgfplots/every axis plot,#1}%
%
\ifpgfplots@curplot@isirrelevant
@@ -4608,6 +4646,7 @@
\t@pgfplots@tokc=\expandafter{\pgfplots@addplot@survey@@optionlist,#1}% this allows '#' inside of '#1'
\edef\pgfplots@addplot@survey@@optionlist{\the\t@pgfplots@tokc}%
%
+ \pgfplots@set@trig@format@plots
}
\long\def\pgfplotssurveyphaseaddoptionsbeforesurveybegins#1{%
@@ -4833,11 +4872,11 @@
% \tikz@plot@var is '\x' be default:
\pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}%
%
- {%
+ \begingroup
\escapechar=-1
\xdef\pgfplots@glob@TMPa{\expandafter\string\tikz@plot@var}%
\xdef\pgfplots@glob@TMPb{\expandafter\string\pgfplots@plot@var@y}%
- }%
+ \endgroup
% \pgfplots@plot@var@nonmacro is the value '\tikz@plot@var'
% without the '\', i.e. 'x' by default:
\let\pgfplots@plot@var@nonmacro=\pgfplots@glob@TMPa
@@ -4845,10 +4884,13 @@
%
% make sure the 'plot vars' have a backslash (as it was in tikz
% plot expression):
- \ifx\pgfplots@plot@var@nonmacro\tikz@plot@var
+ \edef\pgfplots@loc@TMPa{\expandafter\string\tikz@plot@var}%
+ \ifx\pgfplots@plot@var@nonmacro\pgfplots@loc@TMPa
\edef\tikz@plot@var{\expandafter\noexpand\csname \tikz@plot@var\endcsname}%
\fi
- \ifx\pgfplots@plot@var@y@nonmacro\pgfplots@plot@var@y
+ %
+ \edef\pgfplots@loc@TMPa{\expandafter\string\pgfplots@plot@var@y}%
+ \ifx\pgfplots@plot@var@y@nonmacro\pgfplots@loc@TMPa
\edef\pgfplots@plot@var@y{\expandafter\noexpand\csname \pgfplots@plot@var@y\endcsname}%
\fi
%
@@ -4925,20 +4967,29 @@
\long\def\pgfplots@addplotimpl@expression#1#2(#3,#4)#5;{\pgfplots@addplotimpl@expression@{#1}{#2}{#3}{#4}{#5}}%
% \addplot[#1] [#2] (#3,#4) #5;
\long\def\pgfplots@addplotimpl@expression@#1#2#3#4#5{%
+ \pgfplots@addplotimpl@expression@set@options{#1}{#2}%
+ \pgfplots@addplotimpl@expression@@{#3}{#4}{#5}%
+}
+
+\long\def\pgfplots@addplotimpl@expression@set@options#1#2{%
\def\pgfplotssurveyphaseinputclass{expression}%
\pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2,/pgfplots/mesh input=lattice,/pgfplots/mesh/ordering/x varies}%
\pgfplots@plot@expression@preparekeys
+}%
+
+% \addplot (#1,#2) #3;
+\long\def\pgfplots@addplotimpl@expression@@#1#2#3{%
%
- \pgfplots@PREPARE@COORD@STREAM{#5}%
+ \pgfplots@PREPARE@COORD@STREAM{#3}%
%
% Determine whether the x range is parameterized or uniform and
% prepare a macro which assigns \pgfplots@current@point@x:
\def\pgfplots@addplotimpl@expression@prepare@x{%
- \pgfmathparse{#3}%
+ \pgfmathparse{#1}%
\let\pgfplots@current@point@x=\pgfmathresult
}%
\def\pgfplots@addplotimpl@expression@hasuniform@x{0}%
- \def\pgfplots@loc@TMPa{#3}%
+ \def\pgfplots@loc@TMPa{#1}%
% do we have '\x' as x coordinate?
\expandafter\def\expandafter\pgfplots@loc@TMPb\expandafter{\tikz@plot@var}%
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
@@ -4951,7 +5002,7 @@
\fi
\fi
\if\pgfplots@addplotimpl@expression@hasuniform@x1%
- % if '#3' is '\x' or 'x', we don't need the math parser -
+ % if '#1' is '\x' or 'x', we don't need the math parser -
% we can simply take \tikz@plot@var.
\def\pgfplots@addplotimpl@expression@prepare@x{%
\edef\pgfplots@current@point@x{\tikz@plot@var}%
@@ -4973,7 +5024,7 @@
\def\pgfplots@addplotimpl@expression@yEXPR{##1}%
\def\pgfplots@addplotimpl@expression@zEXPR{##2}%
}%
- \pgfplots@addplotimpl@expression@split@yz#4\pgfplots@EOI%
+ \pgfplots@addplotimpl@expression@split@yz#2\pgfplots@EOI%
%
% we don't have 'samples at' for 3D plots -> use domain!
\expandafter\pgfplots@domain@to@foreach\pgfplots@plot@domain\relax{\pgfplots@plot@samples}%
@@ -5025,7 +5076,7 @@
%
% if(
% x is logarithmic &&
- % #3 == '\x' &&
+ % #1 == '\x' &&
% the 'samples at' key has not been used )
% -> sample logarithmically!
\def\pgfplots@samples@logarithmically{0}%
@@ -5088,7 +5139,7 @@
}%
\fi
\expandafter\def\pgfplots@plot@var@y{0}%
- \def\pgfplots@addplotimpl@expression@yEXPR{#4}%
+ \def\pgfplots@addplotimpl@expression@yEXPR{#2}%
\def\pgfplots@current@point@z{}%
\fi
%
@@ -5147,18 +5198,43 @@
\let\pgfmathx@=\pgfplots@addplotimpl@expression@pseudoconst@old@x
\let\pgfmathy@=\pgfplots@addplotimpl@expression@pseudoconst@old@y
%
+ %\pgfplots@expression@normalize@floats
+ %
% process coords as usual:
\pgfplots@coord@stream@coord
}%
\pgfplots@coord@stream@end
}%
+
+% Typically, the FPU will generate stuff like '1Y1.0e5'. Since such
+% internal representations will be available to API users (especially
+% 'x filter' and its variants, we want to simplify its output - by
+% normalizing it.
+%
+% This routine will convert any floats to scientific format, i.e.
+% 1.0e5 instead of 1Y1.0e5 (1Y means 'positive float', compare
+% pgfmathfloat.code.tex).
+\def\pgfplots@expression@normalize@floats{%
+ \pgflibraryfpuifactive{%
+ \ifx\pgfplots@current@point@x\pgfutil@empty\else
+ \pgfmathfloattosci{\pgfplots@current@point@x}\let\pgfplots@current@point@x=\pgfmathresult
+ \fi%
+ \ifx\pgfplots@current@point@y\pgfutil@empty\else
+ \pgfmathfloattosci{\pgfplots@current@point@y}\let\pgfplots@current@point@y=\pgfmathresult
+ \fi%
+ \ifx\pgfplots@current@point@z\pgfutil@empty\else
+ \pgfmathfloattosci{\pgfplots@current@point@z}\let\pgfplots@current@point@z=\pgfmathresult
+ \fi%
+ }{%
+ }%
+}%
+
% \addplot[#1] [#2] {#3} #4;
\long\def\pgfplots@addplotimpl@expression@curly#1#2#3#4;{\pgfplots@addplotimpl@expression@curly@{#1}{#2}{#3}{#4}}%
\long\def\pgfplots@addplotimpl@expression@curly@#1#2#3#4{%
- \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}%
+ \pgfplots@addplotimpl@expression@set@options{#1}{#2}%
\ifpgfplots@curplot@threedim
\t@pgfplots@toka={,#3}%
- \def\pgfplots@loc@TMPa{\pgfplots@addplotimpl@expression@{#1}{#2}}%
% the \pgfplots@plot@var@y will expand to the current value of
% '/pgfplots/variable y'.
% Keep it this way, \pgfplots@addplotimpl@expression@ checks
@@ -5167,11 +5243,9 @@
{\expandafter\noexpand\tikz@plot@var}%
{\noexpand\pgfplots@plot@var@y\the\t@pgfplots@toka}%
}%
- \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb{#4}%
+ \expandafter\pgfplots@addplotimpl@expression@@\pgfplots@loc@TMPb{#4}%
\else
- \t@pgfplots@tokc={\pgfplots@addplotimpl@expression@{#1}{#2}}%
- \def\pgfplots@loc@TMPa{\the\t@pgfplots@tokc}% this construction allows '#' in either '#1' or '#2'
- \expandafter\pgfplots@loc@TMPa\expandafter{\tikz@plot@var}{#3}{#4}%
+ \expandafter\pgfplots@addplotimpl@expression@@\expandafter{\tikz@plot@var}{#3}{#4}%
\fi
}%
% \addplot[#1] [#2] expression[#3] {#4} #5;
@@ -5383,7 +5457,7 @@
\def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{%
\pgfplots@gnuplot@format;
set samples \pgfkeysvalueof{/pgfplots/samples}\if0\b@pgfplots@should@sample@LINE, \pgfkeysvalueof{/pgfplots/samples y}\fi;
- set dummy \pgfplots@gnuplot@x,\pgfplots@gnuplot@y;
+ set dummy \pgfplots@gnuplot@x\if0\b@pgfplots@should@sample@LINE,\pgfplots@gnuplot@y\fi;
\ifx\pgfplots@gnuplot@logdirs\pgfutil@empty
\else
set logscale \pgfplots@gnuplot@logdirs\space 2.71828182845905;