summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex357
1 files changed, 206 insertions, 151 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
index e69591d0683..13b71f8e942 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
@@ -649,6 +649,13 @@
#3%
}%
}%
+\def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@allaxislinevariations#1#2#3{%
+ \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@{#1}{%
+ #2%
+ }{%
+ #3%
+ }%
+}%
% A sub-part of \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn
% which is /only/ based on foreground/background flags.
@@ -678,9 +685,9 @@
\def\pgfplots@ifgridlines@onorientedsurf@should@be@drawn#1#2{%
% grid lines shall be drawn
% if and only if BOTH adjacent axis lines shall be drawn:
- \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{%
+ \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@allaxislinevariations{0}{%
% remark: this is ALWAYS true for 2D plots.
- \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{%
+ \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@allaxislinevariations{1}{%
#1%
}{%
#2%
@@ -1131,6 +1138,7 @@
{\pgf@sys@tonumber{\pgf@ya}}{\pgf@sys@tonumber{\pgf@x}}{\pgfpointorigin}%
}
+
% Adds a further, temporary anchor to every node which will be
% processed. The anchor will be named '#3'. It is placed such that
% 1. the node's center is on a line in direction of the inwards normal
@@ -1147,143 +1155,7 @@
\def\pgfplotsdeclareborderanchorforaxis#1#2#3{%
%
%
- \pgfdeclaregenericanchor{#3}{%
- \begingroup
- \pgfutil@ifundefined{pgfreferencednodename}{%
- % use given transformation matrix.
- }{%
- \ifx\pgfreferencednodename\pgfutil@empty
- % just use the given transformation matrix - we are
- % typesetting an unlabeled node.
- \else
- \pgfsettransform{\csname pgf@sh@nt@\pgfreferencednodename\endcsname}%
- \fi
- }%
- % I only need to apply the trafo matrix to direction vectors. Eliminate
- % shifts.
- \pgf@pt@x=0pt
- \pgf@pt@y=0pt
- %
- % I'll apply the inverse transformation matrix to direction
- % vectors. To ensure the relative position of these vectors
- % and the anchors of the node, I have to invert the matrix:
- \pgftransforminvert
- %
- %
- % This here is the normal direction (points to the axis)
- \pgfqpointscale{-1}{\pgfplotspointouternormalvectorofaxis{#2}}%
- %
- % we apply the inverse CM onto it here:
- \pgf@pos@transform\pgf@x\pgf@y
- \edef\pgfplots@tmp@normaldir{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
- %
- % Now:
- % auto-determine the canonical (north, north east etc) anchor
- % at which the node touches the axis (remember: the axis is to
- % be found in direction of the normal vector). If we choose
- % this anchor, we *won't* penetrate the axis!
- %
- % This is a heuristicial procedure.
- %
- \def\pgfplots@thresh{0.17pt }% 80 degrees
- %\def\pgfplots@thresh{0.3pt }%
- %\def\pgfplots@thresh{0.707pt }% 45 degrees
- \ifdim\pgf@y>0pt
- \ifdim\pgf@y>\pgfplots@thresh
- % only north anchor
- \def\pgfplots@ycomp{north}%
- \else
- \def\pgfplots@ycomp{}%
- \fi
- \else
- \ifdim\pgf@y<-\pgfplots@thresh
- \def\pgfplots@ycomp{south}%
- % south anchor
- \else
- \def\pgfplots@ycomp{}%
- \fi
- \fi
- \ifdim\pgf@x>0pt
- \ifdim\pgf@x>\pgfplots@thresh
- \def\pgfplots@xcomp{east}%
- \else
- \def\pgfplots@xcomp{}%
- \fi
- \else
- \ifdim\pgf@x<-\pgfplots@thresh
- \def\pgfplots@xcomp{west}%
- \else
- \def\pgfplots@xcomp{}%
- \fi
- \fi
- \edef\pgfplots@anchor{%
- \pgfplots@ycomp
- \ifx\pgfplots@ycomp\pgfutil@empty
- \else
- \ifx\pgfplots@xcomp\pgfutil@empty
- \else
- \space
- \fi
- \fi
- \pgfplots@xcomp}%
- %
- %
- % Now, I'd like the 'center' of the node on one line with the
- % 'at={}' coordinate at which it shall be placed!
- % This can be done as follows:
- %
- % Now, compute two lines:
- % 1. a line parallel to the #1 axis which goes
- % through our recently identified anchor,
- % { x = x_a + r_1 * (#1 axis direction)
- % 2. a line from center in direction of the normal,
- % { x = x_c + r_2 n, r in R }
- %
- % Calculate the intersection point and return it! This
- % involves a lot of arithmetics :-(
- %
- % compute (unit#1 - normal):
- \pgfplots@tmp@normaldir
- \pgf@xb=\pgf@x
- \pgf@yb=\pgf@y
- %
- % and the axis direction (in fact, I use -axis dir. But that
- % doesn't matter).
- % Scale unit vector to length 1 to improve conditioning:
- \pgfqpointscale
- {\csname pgfplotsunit#1invlength\endcsname}
- {\csname pgfplotspointunit#1\endcsname}%
- \pgf@pos@transform\pgf@x\pgf@y
- %
- \edef\pgfplots@LEQ{%
- % solve linear system
- {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@x}%
- {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@y}%
- }%
- %
- % apply inverse matrix to right-hand-side (and compute RHS):
- \pgf@sh@reanchor{##1}{center}%
- \edef\pgfplots@loc@center{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
- \pgfpointdiff% {<start>}{<end>} -> computes <end> - <start>
- {\pgfplots@loc@center}%
- {\pgf@sh@reanchor{##1}{\pgfplots@anchor}}%
- \edef\pgfplots@RHS{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}%
- %
- \pgfutilsolvetwotwoleq{\pgfplots@LEQ}{\pgfplots@RHS}%
- \def\pgfplots@extract####1####2{%
- \def\pgfplots@r{####1}%
- }%
- \expandafter\pgfplots@extract\pgfmathresult
- % GOT IT!
- %
- % compute x_c + r*n:
- \pgfpointadd
- {\pgfplots@loc@center}%
- {\pgfqpointscale{\pgfplots@r}{\pgfplots@tmp@normaldir}}%
-%\message{==========>>>>>>>>>> I got finally (\the\pgf@x,\the\pgf@y). <<<<<<<<<===================}%
- \pgf@process{}% <- transport outside of group
- \endgroup
- }%
+ \pgfdeclaregenericanchor{#3}{\pgfplots@borderanchor@for@axis{#1}{#2}{##1}}
%
% This variant will ALWAYS be placed on the boundary of the node.
% It is deprecated, I am keeping it for some time....
@@ -1321,6 +1193,151 @@
}%
}%
+% this does the work for \pgfplotsdeclareborderanchorforaxis.
+% #1: either x,y or z the direction which varies
+% #2: a three-char-string uniquely identifying the axis line.
+% The parameter '#1' is redundand: it is the same as the 'v'
+% character in '#2'.
+% #3: the shape, provided as argument by the pgf routine invoking the
+% anchor.
+\def\pgfplots@borderanchor@for@axis#1#2#3{%
+ \begingroup
+ \pgfutil@ifundefined{pgfreferencednodename}{%
+ % use given transformation matrix.
+ }{%
+ \ifx\pgfreferencednodename\pgfutil@empty
+ % just use the given transformation matrix - we are
+ % typesetting an unlabeled node.
+ \else
+ \pgfsettransform{\csname pgf@sh@nt@\pgfreferencednodename\endcsname}%
+ \fi
+ }%
+ % I only need to apply the trafo matrix to direction vectors. Eliminate
+ % shifts.
+ \pgf@pt@x=0pt
+ \pgf@pt@y=0pt
+ %
+ % I'll apply the inverse transformation matrix to direction
+ % vectors. To ensure the relative position of these vectors
+ % and the anchors of the node, I have to invert the matrix:
+ \pgftransforminvert
+ %
+ %
+ % This here is the normal direction (points to the axis)
+ \pgfqpointscale{-1}{\pgfplotspointouternormalvectorofaxis{#2}}%
+ %
+ % we apply the inverse CM onto it here:
+ \pgf@pos@transform\pgf@x\pgf@y
+ \edef\pgfplots@tmp@normaldir{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
+ %
+ % Now:
+ % auto-determine the canonical (north, north east etc) anchor
+ % at which the node touches the axis (remember: the axis is to
+ % be found in direction of the normal vector). If we choose
+ % this anchor, we *won't* penetrate the axis!
+ %
+ % This is a heuristicial procedure.
+ %
+ \def\pgfplots@thresh{0.17pt }% 80 degrees
+ %\def\pgfplots@thresh{0.3pt }%
+ %\def\pgfplots@thresh{0.707pt }% 45 degrees
+ \ifdim\pgf@y>0pt
+ \ifdim\pgf@y>\pgfplots@thresh
+ % only north anchor
+ \def\pgfplots@ycomp{north}%
+ \else
+ \def\pgfplots@ycomp{}%
+ \fi
+ \else
+ \ifdim\pgf@y<-\pgfplots@thresh
+ \def\pgfplots@ycomp{south}%
+ % south anchor
+ \else
+ \def\pgfplots@ycomp{}%
+ \fi
+ \fi
+ \ifdim\pgf@x>0pt
+ \ifdim\pgf@x>\pgfplots@thresh
+ \def\pgfplots@xcomp{east}%
+ \else
+ \def\pgfplots@xcomp{}%
+ \fi
+ \else
+ \ifdim\pgf@x<-\pgfplots@thresh
+ \def\pgfplots@xcomp{west}%
+ \else
+ \def\pgfplots@xcomp{}%
+ \fi
+ \fi
+ \edef\pgfplots@anchor{%
+ \pgfplots@ycomp
+ \ifx\pgfplots@ycomp\pgfutil@empty
+ \else
+ \ifx\pgfplots@xcomp\pgfutil@empty
+ \else
+ \space
+ \fi
+ \fi
+ \pgfplots@xcomp}%
+ %
+ %
+ % Now, I'd like the 'center' of the node on one line with the
+ % 'at={}' coordinate at which it shall be placed!
+ % This can be done as follows:
+ %
+ % Now, compute two lines:
+ % 1. a line parallel to the #1 axis which goes
+ % through our recently identified anchor,
+ % { x = x_a + r_1 * (#1 axis direction)
+ % 2. a line from center in direction of the normal,
+ % { x = x_c + r_2 n, r in R }
+ %
+ % Calculate the intersection point and return it! This
+ % involves a lot of arithmetics :-(
+ %
+ % compute (unit#1 - normal):
+ \pgfplots@tmp@normaldir
+ \pgf@xb=\pgf@x
+ \pgf@yb=\pgf@y
+ %
+ % and the axis direction (in fact, I use -axis dir. But that
+ % doesn't matter).
+ % Scale unit vector to length 1 to improve conditioning:
+ \pgfqpointscale
+ {\csname pgfplotsunit#1invlength\endcsname}
+ {\csname pgfplotspointunit#1\endcsname}%
+ \pgf@pos@transform\pgf@x\pgf@y
+ %
+ \edef\pgfplots@LEQ{%
+ % solve linear system
+ {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@x}%
+ {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@y}%
+ }%
+ %
+ % apply inverse matrix to right-hand-side (and compute RHS):
+ \pgf@sh@reanchor{#3}{center}%
+ \edef\pgfplots@loc@center{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
+ \pgfpointdiff% {<start>}{<end>} -> computes <end> - <start>
+ {\pgfplots@loc@center}%
+ {\pgf@sh@reanchor{#3}{\pgfplots@anchor}}%
+ \edef\pgfplots@RHS{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}%
+ %
+ \pgfutilsolvetwotwoleq{\pgfplots@LEQ}{\pgfplots@RHS}%
+ \def\pgfplots@extract##1##2{%
+ \def\pgfplots@r{##1}%
+ }%
+ \expandafter\pgfplots@extract\pgfmathresult
+ % GOT IT!
+ %
+ % compute x_c + r*n:
+ \pgfpointadd
+ {\pgfplots@loc@center}%
+ {\pgfqpointscale{\pgfplots@r}{\pgfplots@tmp@normaldir}}%
+%\message{==========>>>>>>>>>> I got finally (\the\pgf@x,\the\pgf@y). <<<<<<<<<===================}%
+ \pgf@process{}% <- transport outside of group
+ \endgroup
+}%
+
% Takes azimuth (horizontal angle) '#1' and elongation (vertical
% angle) '#2' (both in degrees) and computes
% x,y and z vectors which define the view in the direction
@@ -1748,7 +1765,14 @@
},%
initfor={%
\pgfkeyssetvalue{/pgfplots/point meta/expr}{#1}%
- \let\pgfpmeta@expr@origchoice\pgfplotspointmetainputhandler
+ \def\pgfplots@loc@TMPa{expr}%
+ \ifx\pgfplots@loc@TMPa\pgfplotspointmetainputhandler
+ \else
+ \let\pgfpmeta@expr@origchoice\pgfplotspointmetainputhandler
+ \fi
+ \ifx\pgfpmeta@expr@origchoice\pgfplots@loc@TMPa
+ \let\pgfpmeta@expr@origchoice\pgfutil@empty
+ \fi
},
}%
\pgfkeyssetvalue{/pgfplots/point meta/expr}{}%
@@ -2650,7 +2674,7 @@
\noexpand\def\noexpand\pgfplotspointmetainputhandler{\pgfplotspointmetainputhandler}%
}%
{% draw command:
- \noexpand\draw%
+ \noexpand\path%
}%
}%
\pgfplotsapplistXXlet\pgfplots@coord@stream@recorded
@@ -3749,10 +3773,10 @@
% \pgfplots@plot@ydomain (will be set to \pgfplots@plot@domain if empty)
% \pgfplots@plot@samples@at
% \pgfplots@plot@samples@y (will be set to the x variant if empty)
-% \tikz@plot@var
-% \pgfplots@plot@var@nonmacro
-% \pgfplots@plot@var@y
-% \pgfplots@plot@var@y@nonmacro
+% \tikz@plot@var (will become a macro like '\x')
+% \pgfplots@plot@var@nonmacro (the same as \tikz@plot@var, but without backslash)
+% \pgfplots@plot@var@y (like \tikz@plot@var, but for y)
+% \pgfplots@plot@var@y@nonmacro (like \pgfplots@plot@var@nonmacro, but for y)
% 2. the following key-value things are set:
% /pgfplots/mesh/rows
% /pgfplots/mesh/cols
@@ -3764,7 +3788,7 @@
% if the expression plotter should sample a line
% and
% \def\b@pgfplots@should@sample@LINE{0}
-% if it should samples a mesh.
+% if it should sample a mesh.
\def\pgfplots@plot@expression@preparekeys{%
\pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain
\pgfkeysgetvalue{/pgfplots/samples y}\pgfplots@plot@samples@y
@@ -3784,6 +3808,15 @@
\let\pgfplots@plot@var@nonmacro=\pgfplots@glob@TMPa
\let\pgfplots@plot@var@y@nonmacro=\pgfplots@glob@TMPb
%
+ % make sure the 'plot vars' have a backslash (as it was in tikz
+ % plot expression):
+ \ifx\pgfplots@plot@var@nonmacro\tikz@plot@var
+ \edef\tikz@plot@var{\expandafter\noexpand\csname \tikz@plot@var\endcsname}%
+ \fi
+ \ifx\pgfplots@plot@var@y@nonmacro\pgfplots@plot@var@y
+ \edef\pgfplots@plot@var@y{\expandafter\noexpand\csname \pgfplots@plot@var@y\endcsname}%
+ \fi
+ %
% Check if we have to sample a line.
\def\b@pgfplots@should@sample@LINE{0}%
\ifpgfplots@curplot@threedim
@@ -4096,6 +4129,26 @@
\pgfplots@gettikzinternal@keyval{raw gnuplot}{iftikz@plot@raw@gnuplot}{\iffalse}%
\pgfplots@gettikzinternal@keyval{parametric}{iftikz@plot@parametric}{\iffalse}%
%
+ % determine dummy variables:
+ \iftikz@plot@parametric
+ \ifpgfplots@curplot@threedim
+ \pgfkeysgetvalue{/pgfplots/parametric/var 2d}\pgfplots@gnuplot@dummy%
+ \else
+ \pgfkeysgetvalue{/pgfplots/parametric/var 1d}\pgfplots@gnuplot@dummy%
+ \fi
+ \ifx\pgfplots@gnuplot@dummy\pgfutil@empty
+ \else
+ \expandafter\pgfutil@in@\expandafter,\expandafter{\pgfplots@gnuplot@dummy}%
+ \ifpgfutil@in@
+ \def\pgfplots@loc@TMPa##1,##2\pgfeov{\pgfplotsset{variable={##1},variable y={##2}}}%
+ \else
+ \def\pgfplots@loc@TMPa##1\pgfeov{\pgfplotsset{variable={##1}}}%
+ \fi
+ \expandafter\pgfplots@loc@TMPa\pgfplots@gnuplot@dummy\pgfeov
+ \fi
+ \fi
+ %
+ % prepare domain and samples, normalize dummy variables:
\pgfplots@plot@expression@preparekeys
%
% FIXME: what with 'samples at'!?
@@ -4112,7 +4165,7 @@
%
%
\iftikz@plot@raw@gnuplot%
- \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{\pgfplots@gnuplotcode}}%
+ \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{\pgfplots@gnuplot@format;\pgfplots@gnuplotcode}}%
\else%
% collect logs:
\def\pgfplots@gnuplot@logdirs{}%
@@ -4138,9 +4191,12 @@
\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.}%
\fi
\fi
+ \def\pgfplots@gnuplot@x{\pgfplots@plot@var@nonmacro}%
+ \def\pgfplots@gnuplot@y{\pgfplots@plot@var@y@nonmacro}%
\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;
\ifx\pgfplots@gnuplot@logdirs\pgfutil@empty
\else
set logscale \pgfplots@gnuplot@logdirs\space 2.71828182845905;
@@ -4151,13 +4207,13 @@
% Samples twodimensionally (a lattice):
% and the isosamples thing confuses me.
set isosamples \pgfkeysvalueof{/pgfplots/samples}\if0\b@pgfplots@should@sample@LINE, \pgfkeysvalueof{/pgfplots/samples y}\fi;
- splot [x=\pgfplots@plot@domain] [y=\pgfplots@plot@ydomain] \pgfplots@gnuplotcode;%
+ splot [\pgfplots@gnuplot@x=\pgfplots@plot@domain] [\pgfplots@gnuplot@y=\pgfplots@plot@ydomain] \pgfplots@gnuplotcode;%
\else
% *should* sample a line, but I don't know how.
- splot [x=\pgfplots@plot@domain] \pgfplots@gnuplotcode;%
+ splot [\pgfplots@gnuplot@x=\pgfplots@plot@domain] \pgfplots@gnuplotcode;%
\fi
\else
- plot [x=\pgfplots@plot@domain] \pgfplots@gnuplotcode;%
+ plot [\pgfplots@gnuplot@x=\pgfplots@plot@domain] \pgfplots@gnuplotcode;%
\fi
}}%
\fi%
@@ -4513,7 +4569,6 @@
%
%
% high level user interface functions:
- \def\coordindex{\pgfplotstablerow}%
\let\lineno=\coordindex% is the same here
%
% modify \pgfplots@plot@tbl@{x,y,z,meta} if there are