summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-08-30 00:13:50 +0000
committerKarl Berry <karl@freefriends.org>2012-08-30 00:13:50 +0000
commit8231318d57cff4a8f9fcd70d387a3f00f4513428 (patch)
treee99336aabe9de04bad055bcf07814a1a00474a38 /Master/texmf-dist/tex/generic/pgfplots
parentc16497900d7216f5269a43b9c18ae469820d3cd2 (diff)
pgfplots 1.6.1 (29aug12)
git-svn-id: svn://tug.org/texlive/trunk@27550 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex23
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex3
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex14
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.polar.code.tex137
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex165
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.ternary.code.tex32
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex6
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex14
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex8
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex9
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex50
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex212
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex603
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex17
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex3
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex41
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex136
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex2555
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex2
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex3332
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex1197
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex10
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex340
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex205
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex4
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex85
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def47
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex56
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex368
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.data.code.tex291
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex423
39 files changed, 7400 insertions, 3004 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex
index c45b5a613f0..63f24068c41 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex
@@ -56,6 +56,13 @@
/pgfplots/surf shading/north east corner/.initial={\pgfqpoint{6cm}{6cm}},%
/pgfplots/surf shading/anchor/.initial=\pgfpointorigin,%
/pgfplots/surf shading/shading type/.initial=5,% triangles in form of lattice
+ %
+ % can only have values '' (empty) for binary encoding or
+ % ASCIIHexEncode for base 16 encoding. Use this if some driver
+ % cannot produce binary encoding. This is undocumented; for use in
+ % emergency only.
+ /pgfplots/surf shading/pdf stream filter/.initial=,%
+ %
/pgfplots/surf shading/precision/.is choice,
/pgfplots/surf shading/precision/pdf/.code={%
% Lossless coordinate output.
@@ -129,7 +136,15 @@
\newcount\c@pgfplotslibrarysurf@no
% driver specific:
-\def\pgfplotslibrarysurf@initstream{}
+\def\pgfplotslibrarysurf@initstream{%
+ \edef\pgfplots@loc@TMPa{\pgfkeysvalueof{/pgfplots/surf shading/pdf stream filter}}%
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \else
+ \let\pgfplotslibrarysurf@filter@encode=\pgfplots@loc@TMPa
+ \let\pgfplotslibrarysurf@filter@decode=\pgfplotslibrarysurf@filter@encode
+ \fi
+}
+
\def\pgfplotslibrarysurf@advancestreamlen#1{}%
\def\pgfplotslibrarysurfstreamstart{%
@@ -139,9 +154,9 @@
\pgfplotsapplistXglobalnewempty\pgfplotslibrarysurf@binarystream@accum
\pgfplotslibrarysurf@initstream
\ifx\pgfplotslibrarysurf@filter@encode\pgfutil@empty
- \else
- \pgfkeysalso{/pgfplots/bin/\pgfplotslibrarysurf@filter@encode}%
+ \def\pgfplotslibrarysurf@filter@encode{binary encoding}%
\fi
+ \pgfkeysalso{/pgfplots/bin/\pgfplotslibrarysurf@filter@encode}%
\ifcase\pgfplotslibrarysurf@type\relax
% 0
\pgfplotslibrarysurf@initstream@wrongtype
@@ -172,7 +187,7 @@
\fi
}%
\def\pgfplotslibrarysurf@initstream@wrongtype{%
- \pgfplots@error{CRITICAL: shader=interp: got unsupported pdf shading type '\pgfplotslibrarysurf@type'. This may correct your pdf!}%
+ \pgfplots@error{CRITICAL: shader=interp: got unsupported pdf shading type '\pgfplotslibrarysurf@type'. This may corrupt your pdf!}%
}%
\def\pgfplotslibrarysurfstreamend{%
\pgfplotsapplistXgloballet\pgfplotslibrarysurf@binarystream=\pgfplotslibrarysurf@binarystream@accum
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex
index 7e7e5232fc0..146153fca9b 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex
@@ -134,8 +134,9 @@
\endgroup
}%
\pgfkeysdef{/pgfplots/#1 coord inv trafo}{%
+ \edef\pgfplotstempjuliandatenumeric{##1}%
\begingroup
- \pgfplotslibdateplot@number@to@julian@and@time##1\julianto{\c@pgf@counta}\hourto\Hour\minuteto\Minute%
+ \expandafter\pgfplotslibdateplot@number@to@julian@and@time\pgfplotstempjuliandatenumeric\julianto{\c@pgf@counta}\hourto\Hour\minuteto\Minute%
\advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax
\expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day
\xdef\pgfplotslibdateplot@TMP{%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex
index 227f5c1a5a4..4923e310c5b 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex
@@ -32,8 +32,18 @@
%
\pgfplotsiffileexists{tikzlibraryexternal.code.tex}{%
- \usetikzlibrary{external}%
+ \pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero{%
+ \def\pgfplots@glob@TMPa{0}%
+ }{%
+ \def\pgfplots@glob@TMPa{1}%
+ }%
}{%
+ \def\pgfplots@glob@TMPa{0}%
+}%
+\if1\pgfplots@glob@TMPa
+ \usetikzlibrary{external}%
+\else
+ \immediate\write16{Package pgfplots external lib: loading complementary code for your PGF version...}
% Backwards compatibility:
\let\pgfplots@backw@compat@AtBeginDocument=\AtBeginDocument
\def\AtBeginDocument#1{}%
@@ -41,6 +51,6 @@
\let\AtBeginDocument=\pgfplots@backw@compat@AtBeginDocument
%
\input pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
-}%
+\fi
\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
index f3e4674f9e6..79990ec1fb8 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.patchplots.code.tex
@@ -888,7 +888,7 @@
\divide\pgf@ya by4
\divide\pgf@yb by4
\pgfplotscoordmath{meta}{op}{multiply}{{\pgfmathresult}{\pgfplots@loc@scale}}%
- \edef\pgfplotspatchclass@rect@M{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else \pgf@sys@tonumber\pgf@yb\fi}%
+ \edef\pgfplotspatchclass@rect@M{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else \pgf@sys@tonumber\pgf@yb\fi:}%
%
\let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass
\def\pgfplotsplothandlermesh@patchclass{triangle}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.polar.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.polar.code.tex
index 24292d1354c..2e6f13df3e0 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.polar.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.polar.code.tex
@@ -71,6 +71,7 @@
\let\pgfplots@prepare@axis@API=\pgfplots@prepare@axis@API@polar
\def\axisdefaultheight{\axisdefaultwidth}%
\let\pgfplots@initsizes=\pgfplots@initsizes@polar
+ \let\pgfplots@BB@for@plotbox@get@unit@scales@for@limits=\pgfplots@BB@for@plotbox@get@unit@scales@for@limits@polar
\let\pgfplots@limits@ready=\pgfplots@limits@ready@polar
\let\pgfplots@assign@default@tick@foraxis@normalizetickdist=\pgfplots@assign@default@tick@foraxis@normalizetickdist@polar
\let\pgfplots@show@ticklabel@=\pgfplots@show@ticklabel@@polar
@@ -476,6 +477,8 @@
\fi
}%
+\let\pgfplots@initsizes@original=\pgfplots@initsizes
+
\def\pgfplots@initsizes@polar{%
% I copy-pasted most of this code, up to just one position where
% I introduced the modified scaling for polar axes
@@ -493,119 +496,35 @@
\def\b@pgfplots@polar@limit@around@zero{1}%
\fi
%
- \pgfplots@xmin@reg=\pgfplots@xmin pt %
- \pgfplots@xmax@reg=\pgfplots@xmax pt %
- %
- %
- \pgfplots@ymin@reg=\pgfplots@ymin pt %
- \pgfplots@ymax@reg=\pgfplots@ymax pt %
- \ifpgfplots@threedim
- \pgfplots@zmin@reg=\pgfplots@zmin pt %
- \pgfplots@zmax@reg=\pgfplots@zmax pt %
- \fi
- %
- %
- %-----------------------------------------
- % PROCESS THE 'width' and 'height' options
- %-----------------------------------------
- %
- %
- \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}%
- \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}%
- \ifpgfplots@threedim
- \def\pgfplots@tmpZscale{1pt}%
- \else
- \def\pgfplots@tmpZscale{0pt}%
- \let\pgfplots@view@el=\pgfutil@empty
- \let\pgfplots@view@az=\pgfutil@empty
- \fi
- \ifx\pgfplots@view@az\pgfutil@empty
- %\let\pgfplots@rectangle@width=\pgfutil@empty
- %\let\pgfplots@rectangle@height=\pgfutil@empty
- \def\pgfplots@view@dir@threedim@x{0}%
- \def\pgfplots@view@dir@threedim@y{0}%
- \def\pgfplots@view@dir@threedim@z{1}%
- %
- % FIXME HERE COMES THE polar MODIFICATION
- %--------------------------------------------------
- % \pgfpointdiff
- % {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}
- % {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}%
- %--------------------------------------------------
- % instead of scaling from (min) (max), we only need the UPPER
- % bound -- in both, x and y directions (since we have a cycle.
- % Furthermore, we need it twice since we are interested in the
- % diameter, not the radius.
- \global\pgf@x=\pgfplots@ymax pt % radius
- \global\multiply\pgf@x by2 % diameter
- \global\pgf@y=\pgf@x % same for y
- %
- % only used temporarily in this macro to compute the correct
- % length for unit vectors:
- \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}%
- \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}%
- %
- \ifx\pgfplots@x\pgfutil@empty
- \ifx\pgfplots@width\pgfutil@empty
- \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}%
- \fi
- \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale
- %\ifpgfplots@scale@only@axis
- % \let\pgfplots@rectangle@width=\pgfplots@width
- %\fi
- \else
- \def\pgfplots@tmpXscale{1}%
- \fi
- %
- \ifx\pgfplots@y\pgfutil@empty
- \ifx\pgfplots@height\pgfutil@empty
- \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}%
- \fi
- \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale
- %\ifpgfplots@scale@only@axis
- % \let\pgfplots@rectangle@height=\pgfplots@height
- %\fi
- \else
- \def\pgfplots@tmpYscale{1}%
- \fi
+ \pgfplots@initsizes@original
+}%
+
+\def\pgfplots@BB@for@plotbox@get@unit@scales@for@limits@polar#1#2#3{%
+ % #1 is the angle ... and that does not need to be squeezed into
+ % the box.
+ %
+ % use only y (the radius).
+ \if1\b@pgfplots@plotbox@yisunit
+ % we do not need to compute max-min as for standard axes (because the inner part
+ % characterized by ymin does not enter the scaling).
%
- \edef\pgfplots@tmpXscale{\pgfplots@tmpXscale pt}%
- \edef\pgfplots@tmpYscale{\pgfplots@tmpYscale pt}%
+ % However, we have to keep in mind that our range is TWICE as
+ % large because [0,ymax] is just a radius, and we have to
+ % scale for the diameter.
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{2}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
%
- \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}%
- \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}%
- \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}%
- \else
- % 3D case is currently always initialised by `view':
- \let\pgfplots@x=\pgfutil@empty
- \let\pgfplots@y=\pgfutil@empty
- \let\pgfplots@z=\pgfutil@empty
- \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}%
- \if1\pgfplots@tmp@xisaxisparallel%
- \def\pgfplots@tmp@yisaxisparallel{1}%
- \fi
- \fi
-%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy). }%
- %
- \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure
- \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure
- %
- \pgfplotsmath@ifzero{\pgfplots@x@veclength}{\pgfplots@hide@xtrue\pgfplots@shownothingof@xtrue}{}%
- \pgfplotsmath@ifzero{\pgfplots@y@veclength}{\pgfplots@hide@ytrue\pgfplots@shownothingof@ytrue}{}%
- \ifpgfplots@threedim
- \pgfplotsmath@ifzero{\pgfplots@z@veclength}{\pgfplots@hide@ztrue\pgfplots@shownothingof@ztrue}{}%
+ \let\pgfmathresult=\pgfplots@ymax
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{\pgfmathresult}%
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{op}{multiply}{{\pgfmathresult}{\pgfplots@loc@TMPa}}%
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{tofixed}{\pgfmathresult}%
\else
- \if1\pgfplots@tmp@xisaxisparallel%
- \if1\pgfplots@tmp@yisaxisparallel%
- % Optimize for axis-parallel case!
- % puh. Did not make any measureable difference!? Ok...
- \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal
- \fi
- \fi
+ \def\pgfmathresult{2}% not 1: the factor 2 is for 2*radius
\fi
- %
- % FIXME : unit vector ratio / axis equal
-}
+ \let#1=\pgfmathresult
+ \let#2=\pgfmathresult
+ \def#3{1}% FIXME : z ?
+}%
\def\pgfplots@handle@invalid@range@defaultlimits@polar{%
\def\pgfplots@loc@TMPa{0}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex
index 7d24c53216d..e1561bb96ac 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.smithchart.code.tex
@@ -213,6 +213,30 @@
%font=\tiny,
}
},
+ yticklabel around circle/.style={
+ ytick align=center,
+ yticklabel style={
+ rotate=90,
+ sloped like y axis={%
+ execute for upside down={\tikzset{anchor=south west}},
+ %allow upside down,
+ reset nontranslations=false},
+ anchor=south east,
+ %font=\tiny,
+ }
+ },
+ yticklabel around circle*/.style={
+ ytick align=center,
+ yticklabel style={
+ rotate=90,
+ sloped like y axis={%
+ execute for upside down={\tikzset{anchor=north west}},
+ %allow upside down,
+ reset nontranslations=false},
+ anchor=north east,
+ %font=\tiny,
+ }
+ }
}
\def\pgfplots@smithchartaxis@activate{%
@@ -259,7 +283,7 @@
\fi
}%
\def\axisdefaultheight{\axisdefaultwidth}%
- \let\pgfplots@initsizes=\pgfplots@initsizes@smithchart
+ \let\pgfplots@BB@for@plotbox@get@unit@scales@for@limits=\pgfplots@BB@for@plotbox@get@unit@scales@for@limits@smithchart
%\let\pgfplots@limits@ready=\pgfplots@limits@ready@smithchart
%\let\pgfplots@show@ticklabel@=\pgfplots@show@ticklabel@@smithchart
%\def\pgfplots@xtick@disable@last@tick{0}%
@@ -1513,134 +1537,17 @@
\fi
}%
-\def\pgfplots@initsizes@smithchart{%
- % I copy-pasted most of this code, up to just one position where
- % I introduced the modified scaling for smithchart axes
- %----------------------------------
- % INIT.
- %
- %
- \def\pgfplots@minmax@reg@forbidden{\pgfplots@error{Sorry, an internal logic error occured during smithchart processing (a routine tried to access \string\pgfplots@xmin@reg\space or its variants). Please report this as bug, sorry}}%
- \iffalse
- \pgfplots@xmin@reg=\pgfplots@xmin pt %
- \pgfplots@xmax@reg=\pgfplots@xmax pt %
- \pgfplots@ymin@reg=\pgfplots@ymin pt %
- \pgfplots@ymax@reg=\pgfplots@ymax pt %
- \ifpgfplots@threedim
- \pgfplots@zmin@reg=\pgfplots@zmin pt %
- \pgfplots@zmax@reg=\pgfplots@zmax pt %
- \fi
- \else
- \let\pgfplots@xmin@reg=\pgfplots@minmax@reg@forbidden
- \let\pgfplots@xmax@reg=\pgfplots@minmax@reg@forbidden
- \let\pgfplots@ymin@reg=\pgfplots@minmax@reg@forbidden
- \let\pgfplots@ymax@reg=\pgfplots@minmax@reg@forbidden
- \let\pgfplots@zmin@reg=\pgfplots@minmax@reg@forbidden
- \let\pgfplots@zmax@reg=\pgfplots@minmax@reg@forbidden
- \fi
- %
- %
- %-----------------------------------------
- % PROCESS THE 'width' and 'height' options
- %-----------------------------------------
- %
- %
- \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}%
- \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}%
- \ifpgfplots@threedim
- \def\pgfplots@tmpZscale{1pt}%
- \else
- \def\pgfplots@tmpZscale{0pt}%
- \let\pgfplots@view@el=\pgfutil@empty
- \let\pgfplots@view@az=\pgfutil@empty
- \fi
- \ifx\pgfplots@view@az\pgfutil@empty
- %\let\pgfplots@rectangle@width=\pgfutil@empty
- %\let\pgfplots@rectangle@height=\pgfutil@empty
- \def\pgfplots@view@dir@threedim@x{0}%
- \def\pgfplots@view@dir@threedim@y{0}%
- \def\pgfplots@view@dir@threedim@z{1}%
- %
- % FIXME HERE COMES THE smithchart MODIFICATION
- %--------------------------------------------------
- % \pgfpointdiff
- % {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}
- % {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}%
- %--------------------------------------------------
- % instead of scaling from (min) (max), we only need the UPPER
- % bound -- in both, x and y directions (since we have a cycle.
- % Furthermore, we need it twice since we are interested in the
- % diameter, not the radius.
- \global\pgf@x=2 pt % radius
- \global\pgf@y=\pgf@x % same for y
- %
- % only used temporarily in this macro to compute the correct
- % length for unit vectors:
- \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}%
- \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}%
- %
- \ifx\pgfplots@x\pgfutil@empty
- \ifx\pgfplots@width\pgfutil@empty
- \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}%
- \fi
- \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale
- %\ifpgfplots@scale@only@axis
- % \let\pgfplots@rectangle@width=\pgfplots@width
- %\fi
- \else
- \def\pgfplots@tmpXscale{1}%
- \fi
- %
- \ifx\pgfplots@y\pgfutil@empty
- \ifx\pgfplots@height\pgfutil@empty
- \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}%
- \fi
- \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale
- %\ifpgfplots@scale@only@axis
- % \let\pgfplots@rectangle@height=\pgfplots@height
- %\fi
- \else
- \def\pgfplots@tmpYscale{1}%
- \fi
- %
- \edef\pgfplots@tmpXscale{\pgfplots@tmpXscale pt}%
- \edef\pgfplots@tmpYscale{\pgfplots@tmpYscale pt}%
- %
- \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}%
- \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}%
- \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}%
- \else
- % 3D case is currently always initialised by `view':
- \let\pgfplots@x=\pgfutil@empty
- \let\pgfplots@y=\pgfutil@empty
- \let\pgfplots@z=\pgfutil@empty
- \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}%
- \if1\pgfplots@tmp@xisaxisparallel%
- \def\pgfplots@tmp@yisaxisparallel{1}%
- \fi
- \fi
-%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy). }%
- %
- \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure
- \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure
- %
- \pgfplotsmath@ifzero{\pgfplots@x@veclength}{\pgfplots@hide@xtrue\pgfplots@shownothingof@xtrue}{}%
- \pgfplotsmath@ifzero{\pgfplots@y@veclength}{\pgfplots@hide@ytrue\pgfplots@shownothingof@ytrue}{}%
- \ifpgfplots@threedim
- \pgfplotsmath@ifzero{\pgfplots@z@veclength}{\pgfplots@hide@ztrue\pgfplots@shownothingof@ztrue}{}%
- \else
- \if1\pgfplots@tmp@xisaxisparallel%
- \if1\pgfplots@tmp@yisaxisparallel%
- % Optimize for axis-parallel case!
- % puh. Did not make any measureable difference!? Ok...
- \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal
- \fi
- \fi
- \fi
- %
- % FIXME : unit vector ratio / axis equal
- %
-}
+\def\pgfplots@BB@for@plotbox@get@unit@scales@for@limits@smithchart#1#2#3{%
+ % In a smith chart, the size of the image is unrelated to the
+ % involved data limits.
+ %
+ % The factor 2 is because we want to fit the DIAMETER into the
+ % prescribed dimensions, not just the radius.
+ \def\pgfmathresult{2}%
+ \let#1=\pgfmathresult
+ \let#2=\pgfmathresult
+ \def#3{1}%
+}%
\def\pgfplots@handle@invalid@range@defaultlimits@smithchart{%
\pgfplotscoordmath{x}{parsenumber}{0}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.ternary.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.ternary.code.tex
index dfb520af190..7000f8c13cf 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.ternary.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.ternary.code.tex
@@ -86,11 +86,14 @@
\def\pgfplots@drawaxis@innerlines@onorientedsurf##1##2##3{}%
\let\pgfplots@draw@axis@post=\pgfplots@draw@axis@post@ternary
\let\pgfplots@initsizes=\pgfplots@initsizes@ternary
+ \let\pgfplots@limits@ready=\pgfplots@limits@ready@ternary
\let\pgfplotspoint@initialisation@axes=\pgfplotspoint@initialisation@axes@ternary
\let\pgfplotspoint@initialisation@units=\pgfplotspoint@initialisation@units@ternary
\let\pgfplots@initsizes@setunitvector=\pgfplots@initsizes@setunitvector@ternary
+ \let\pgfplots@computeunitvectorlengths=\pgfplots@computeunitvectorlengths@ternary
\let\pgfplotspointouternormalvectorofaxis@=\pgfplotspointouternormalvectorofaxis@ternary
\let\pgfplots@prepare@ZERO@coordinates=\pgfplots@prepare@ZERO@coordinates@ternary
+ \def\pgfplots@scaleaxes@to@BB@##1##2{}%
\let\pgfplotsgetnormalforcurrentview=\relax
\def\pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf##1{}%
\let\pgfplots@clippath@prepare@for@axistype=\pgfplots@clippath@prepare@for@axistype@ternary
@@ -280,10 +283,6 @@
\else
\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}%
\fi
-%\message{ternary with limits x=[\pgfplots@xmin:\pgfplots@xmax], y=[\pgfplots@ymin:\pgfplots@ymax]; z=[\pgfplots@zmin:\pgfplots@zmax].}%
- \pgfplots@ternary@init@map@to@unit x
- \pgfplots@ternary@init@map@to@unit y
- \pgfplots@ternary@init@map@to@unit z
%
\pgfplots@initsizes@get@width@withoutlabels
\pgf@x=\pgfmathresult
@@ -293,6 +292,17 @@
%
}%
+\let\pgfplots@limits@ready@original=\pgfplots@limits@ready
+
+\def\pgfplots@limits@ready@ternary{%
+ \pgfplots@limits@ready@original
+ %
+%\message{ternary with limits x=[\pgfplots@xmin:\pgfplots@xmax], y=[\pgfplots@ymin:\pgfplots@ymax]; z=[\pgfplots@zmin:\pgfplots@zmax].}%
+ \pgfplots@ternary@init@map@to@unit x%
+ \pgfplots@ternary@init@map@to@unit y%
+ \pgfplots@ternary@init@map@to@unit z%
+}%
+
\def\pgfplots@ternary@init@map@to@unit#1{%
\begingroup
\pgfmath@basic@subtract@
@@ -311,7 +321,7 @@
\def\pgfplots@initsizes@setunitvector@ternary#1#2#3#4{%
% ternary axis are DIFFERENT here.
% They don't use the (xx,xy), (yx,yy), (zx,zy) vectors, so we can
- % use them to realize *cartesian* coordinates.
+ % use them to implement *cartesian* coordinates.
%
% Thus, any \draw (0,0) inside of a ternary axis will yield
% cartesian coordinates.
@@ -343,6 +353,17 @@
{\global\pgfplots@ternary@next@is@unitintervaltrue\pgfplotsqpointxyz@ternary001}%
\fi
\expandafter\xdef\csname pgfplotspoint#1axis\endcsname{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}%
+ %
+%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).}%
+}%
+
+\def\pgfplots@computeunitvectorlengths@ternary{%
+ \pgfplots@computeunitvectorlengths@ternary@ x%
+ \pgfplots@computeunitvectorlengths@ternary@ y%
+ \pgfplots@computeunitvectorlengths@ternary@ z%
+}
+\def\pgfplots@computeunitvectorlengths@ternary@#1{%
+ \csname pgfplotspoint#1axis\endcsname
\pgfmathveclen{\pgf@x}{\pgf@y}%
\expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult
\pgfplotsmath@ifzero{\pgfmathresult}{%
@@ -353,7 +374,6 @@
}%
\expandafter\xdef\csname pgfplotspoint#1axislength\endcsname{\pgfplots@x@veclength pt}%
%
-%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).}%
}%
\newif\ifpgfplots@ternary@next@is@unitinterval
diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex
index 34cb67bfe02..3b964264327 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex
@@ -417,14 +417,14 @@
% -> iterate through argument until \pgfplotslistforeachungrouped@EOI
% comes.
\long\def\pgfplotslistforeachungrouped@#1#2\pgfpl@@#3{%
- \def\pgfplotslist@loc@TMPa{#3}%
+ \t@pgfplots@tokc={#3}% this allows '#' inside of '#3'
+ \edef\pgfplotslist@loc@TMPa{\the\t@pgfplots@tokc}%
\ifx\pgfplotslist@loc@TMPa\pgfplotslistforeachungrouped@EOI
% ok, terminate loop.
\let\pgfplotslistforeachungrouped@next=\relax
\else
% perform loop iteration ...
- \t@pgfplots@tokc={#3}%
- \edef#1{\the\t@pgfplots@tokc}% this allows '#' inside of '#3'
+ \let#1=\pgfplotslist@loc@TMPa
#2\relax
% and continue iterating.
\def\pgfplotslistforeachungrouped@next{\pgfplotslistforeachungrouped@{#1}{#2}}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex
index 1cde825708d..91677f6e15e 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex
@@ -914,6 +914,12 @@
\pgfkeyssetvalue{/pgfplots/table/@cell content}{#1&}%
\fi
},
+ % this can be omitted to omit the header row:
+ /pgfplots/table/output empty row/.style={%
+ /pgfplots/table/typeset cell/.code={%
+ \pgfkeyslet{/pgfplots/table/@cell content}\pgfutil@empty%
+ }%
+ },
/pgfplots/table/reset styles/.style={
/pgfplots/table/every table/.code=,
/pgfplots/table/every odd column/.code=,
@@ -1930,8 +1936,11 @@
\noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}%
\noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}%
}%
+ \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa
+ \global\let\pgfplots@glob@TMPd=\pgfplots@loc@TMPa
\endgroup
\pgfplots@glob@TMPc
+ \let\pgfplotstable@headrow@typesetcell=\pgfplots@glob@TMPd
% insert 'before row' here:
\t@pgfplots@toka=\expandafter{\pgfplotstable@before}%
\t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}%
@@ -1942,8 +1951,7 @@
%
\advance\c@pgfplotstable@colindex by1\relax
% typeset the cell:
- \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa
- \expandafter\pgfplots@loc@TMPa\pgfplotstable@colname@out\pgfeov
+ \expandafter\pgfplotstable@headrow@typesetcell\pgfplotstable@colname@out\pgfeov
\pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult
%
% append this cell:
@@ -2693,7 +2701,7 @@
\else
\ifx\pgfplotstable@variance@table\pgfutil@empty
\t@pgfplots@toka=\expandafter{\pgfplotstable@table}%
- \t@pgfplots@tokb=\expandafter{\pgfplotstable@variance@table}%
+ \t@pgfplots@tokb=\expandafter{\pgfplotstable@variance@colname}%
\edef\pgfplots@loc@TMPa{{\the\t@pgfplots@tokb}\noexpand\of{\the\t@pgfplots@toka}}%
\expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPa\to\pgfplotstable@VARIANCE
\else
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex
index 74cb909c646..48bb178afbc 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex
@@ -19,15 +19,17 @@
% check whether we need to load supplementary code.
% The development of pgfplots and pgf is intermingled, so pgfplots
% always uses up-to-date pgf CVS versions - the relevant complements between
-% PGF 2.00 and PGF CVS are loaded here:
+% PGF 2.10 and PGF CVS are loaded here:
%
% #1: for backwards compatibility
% #2: for normal processing.
-\def\pgfplots@ifneedspgfcompabitibilitycode#1#2{%
+\def\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero#1#2{%
%\pgfkeysifdefined{/pgf/number format/sci precision/.@cmd}{#2}{#1}%
\pgfutil@ifundefined{pgfplothandlerjumpmarkmid}{#1}{#2}%
}%
+\let\pgfplots@ifneedspgfcompabitibilitycode=\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero
+
\pgfplots@ifneedspgfcompabitibilitycode
{%
\immediate\write16{Package pgfplots: loading complementary code for your PGF version...}
@@ -37,6 +39,8 @@
\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex
\input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
+ \input pgfplotsoldpgfsupp_pgfcorelayers.code.tex
+ \input pgfplotsoldpgfsupp_pgfcorescopes.code.tex
}%
{%
\pgfplots@iffileexists{pgflibraryfpu.code.tex}{%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex
index 64570e7fdc3..6a9a4cc2b5a 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex
@@ -1,3 +1,12 @@
+% ======================================================
+% compatibility with PGF 2.10
+% ======================================================
+\def\pgfdeclarelayer#1{%
+ \pgfutil@ifundefined{pgf@layerbox@#1}{%
+ \expandafter\pgf@newbox\csname pgf@layerbox@#1\endcsname%
+ \expandafter\pgf@newbox\csname pgf@layerboxsaved@#1\endcsname%
+ }{}%
+}
% ======================================================
% compatibility with PGF 2.0
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex
index ae77a8e84fc..5ad04db77bb 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
@@ -27,7 +27,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.17 2010/09/01 08:56:40 ludewich Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.19 2012/06/18 20:39:58 ludewich Exp $
@@ -127,10 +127,32 @@
\ifpgfexternal@aux@in@dpth
\csname newwrite\endcsname\w@pgfexternal@auxout
\fi
+ \pgfexternal@geometry@compatibility
\fi%
\gdef\pgfrealjobname##1{}% avoid multiple calls.
}
+\def\pgfexternal@geometry@compatibility{%
+ % check if \usepackage{geometry} is loaded:
+ \pgfutil@ifundefined{geometry}{%
+ }{%
+ % The geometry package hooks into \begin{document}, evaluates
+ % its driver -- and generates \special instructions to set the
+ % paper size.
+ %
+ % Unfortunately, this confuses dvips utterly - and perhaps
+ % other drivers as well.
+ %
+ % Thus, if we currently about to generate some external
+ % graphics, we WANT to disable geometry (it has no purpose in
+ % this context anyway).
+ %
+ % This here works well:
+ \immediate\write16{Package TikZ externalization: calling \string\geometry{driver=none} during externalization.^^J}%
+ \geometry{driver=none}%
+ }%
+}%
+
\def\pgfexternal@nofiles{%
% replace \relax. The \nofiles macros does
% \let\makeglossary=\relax
@@ -258,13 +280,23 @@
\endgroup
}
-% Defines \pgfexternaldepth to be the depth of the external picture
-% '#1' and \pgfexternaltrimleft / \pgfexternaltrimright to be the 'hbaseline' shift.
-%
+% Reads the .dpth file which contains meta data of the external
+% picture.
+%
+% This command handles the following stuff:
+% - it defines \pgfexternaldepth . The macro contains the contents of
+% a line which does not start with a control sequence (for example a
+% line containing '50pt')
+% - it defines \pgfexternaltrimleft and \pgfexternaltrimright
+% - it checks if the .dpth file contains content stored by means of
+% \pgfexternalstorecommand. If so, the argument of
+% \pgfexternalstorecommand will be restored.
+% - anything else will be appended to the main .aux file, assuming that
+% it contains \label or \ref information (only if the LaTeX switch
+% \if@filesw is \iftrue).
%
-% Furthermore, it handles any auxiliary information stored in the
-% .dpth file (it appends it to the main aux file).
%
+% #1: the image file name (such that #1.dpth exists)
\def\pgfexternalreaddpth#1{%
% no \begingroup. Handle that manually:
\edef\pgfexternalreaddpth@restore{%
@@ -311,6 +343,10 @@
% the .aux file.
%
\expandafter\ifx\pgf@first\pgfexternal@restore
+ % if the first line in the .dpth file starts with the
+ % magic string \pgfexternal@restore, the complete line
+ % will be executed as-is. Example:
+ % \pgfexternal@restore{\def\somevalue{1}}
#1%
\else
% do NOT execute #1! many LaTeX commands don't support it (\label for example)
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex
new file mode 100644
index 00000000000..bd8a45071ee
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex
@@ -0,0 +1,212 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% This file is a copy of some part of PGF/Tikz.
+%%% It has been copied here to provide :
+%%% - compatibility with older PGF versions
+%%% - availability of PGF contributions by Christian Feuersaenger
+%%% which are necessary or helpful for pgfplots.
+%%%
+%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
+%%% PGF parts. The copyrights are as they appear in PGF.
+%%%
+%%% Note that pgfplots has compatible licenses.
+%%%
+%%% This copy has been modified in the following ways:
+%%% - nested \input commands have been updated
+%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
+
+
+
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.4 2011/10/02 17:36:05 ludewich Exp $
+
+
+% Creates a new pgf layer
+%
+% #1 = layer name
+%
+% Declares a new layer for pgf.
+%
+% Example:
+%
+% \pgfdeclarelayer{background}
+
+\def\pgfdeclarelayer#1{%
+ \pgfutil@ifundefined{pgf@layerbox@#1}{%
+ \expandafter\pgf@newbox\csname pgf@layerbox@#1\endcsname%
+ \expandafter\pgf@newbox\csname pgf@layerboxsaved@#1\endcsname%
+ }{}%
+}
+\let\pgf@newbox=\newbox % avoid plain TeX outer problem
+
+% Sets the layers that compose the picture
+%
+% #1 = List of layers
+%
+% Description:
+%
+% Sets the list of layers that make up the picture. The layers will be
+% put on top of each other in the order given.
+%
+% This command can also be given inside of a picture in which case it
+% applies only to that very picture.
+%
+% Example:
+%
+% \pgfsetlayers{background,main}
+
+\def\pgfsetlayers#1{\edef\pgf@layerlist{#1}}
+\pgfsetlayers{main}
+
+% Adds code to a layer
+%
+% #1 = layer name
+%
+% Note:
+%
+% You cannot add anything to the ``main'' layer using this command.
+%
+% Example:
+%
+% \begin{pgfonlayer}{background}
+% \fill[red] (0,0) -- (1,1);
+% \end{pgfonlayer}
+
+\def\pgfonlayer@name{main}
+
+\def\pgfonlayer#1{%
+ \pgfutil@ifundefined{pgf@layerbox@#1}{%
+ \PackageError{pgf}{Sorry, the requested layer '#1' could not be found. Maybe you misspelled it?}{}%
+ \bgroup
+ \begingroup
+ }{%
+ \begingroup
+ \edef\pgf@temp{#1}%
+ \ifx\pgf@temp\pgfonlayer@name
+ % we are already on this layer.
+ \def\pgf@temp{%
+ \bgroup
+ \begingroup
+ }%
+ \else
+ \let\pgfonlayer@name=\pgf@temp
+ \pgfonlayer@assert@is@active
+ \def\pgf@temp{%
+ \expandafter\global\expandafter%
+ \setbox\csname pgf@layerbox@#1\endcsname=\hbox to 0pt%
+ \bgroup%
+ \expandafter\box\csname pgf@layerbox@#1\endcsname%
+ \begingroup%
+ }%
+ \fi
+ \pgf@temp
+ }%
+}
+\def\endpgfonlayer{%
+ \endgroup%
+ \hss
+ \egroup%
+ \endgroup
+}
+
+\let\startpgfonlayer=\pgfonlayer
+\let\stoppgfonlayer=\endpgfonlayer
+
+\def\pgfdiscardlayername{discard}
+
+\def\pgfonlayer@assert@is@active{%
+ \ifx\pgfonlayer@name\pgfdiscardlayername
+ % this special layer name can be used as /dev/null without
+ % warning.
+ \else
+ \begingroup
+ \def\pgfonlayer@isactive{0}%
+ \expandafter\pgf@assert@layer@is@active@loop\pgf@layerlist,,\relax%
+ \if0\pgfonlayer@isactive
+ \pgfonlayer@assert@fail
+ \fi
+ \endgroup
+ \fi
+}%
+\def\pgfonlayer@assert@fail{%
+ \PackageError{pgf}{Sorry, the requested layer '\pgfonlayer@name' is not
+ part of the layer list. Please verify that you provided
+ \string\pgfsetlayers\space and that '\pgfonlayer@name' is part of this list}{}%
+}%
+\def\pgf@assert@layer@is@active@loop#1,#2,\relax{%
+ \edef\pgf@test{#1}%
+ \ifx\pgf@test\pgfonlayer@name
+ \def\pgfonlayer@isactive{1}%
+ \else
+ \def\pgf@test{#2}%
+ \ifx\pgf@test\pgfutil@empty%
+ \else%
+ \pgf@assert@layer@is@active@loop#2,\relax%
+ \fi%
+ \fi
+}
+
+% Hooks into the scoping:
+
+\def\pgf@insertlayers{%
+ \expandafter\pgf@dolayer\pgf@layerlist,,\relax%
+}
+\def\pgf@maintext{main}%
+\def\pgf@dolayer#1,#2,\relax{%
+ \def\pgf@test{#1}%
+ \ifx\pgf@test\pgf@maintext%
+ \box\pgf@layerbox@main%
+ \else%
+ \pgfsys@beginscope%
+ \expandafter\box\csname pgf@layerbox@#1\endcsname%
+ \pgfsys@endscope%
+ \fi%
+ \def\pgf@test{#2}%
+ \ifx\pgf@test\pgfutil@empty%
+ \else%
+ \pgf@dolayer#2,\relax%
+ \fi%
+}
+
+\def\pgf@savelayers{%
+ \expandafter\pgf@dosavelayer\pgf@layerlist,,\relax%
+}
+\def\pgf@dosavelayer#1,#2,\relax{%
+ \def\pgf@test{#1}%
+ \ifx\pgf@test\pgf@maintext%
+ \else%
+ \setbox\csname pgf@layerboxsaved@#1\endcsname=\box\csname pgf@layerbox@#1\endcsname%
+ \fi%
+ \def\pgf@test{#2}%
+ \ifx\pgf@test\pgfutil@empty%
+ \else%
+ \pgf@dosavelayer#2,\relax%
+ \fi%
+}
+
+\def\pgf@restorelayers{%
+ \expandafter\pgf@dorestorelayer\pgf@layerlist,,\relax%
+}
+\def\pgf@dorestorelayer#1,#2,\relax{%
+ \def\pgf@test{#1}%
+ \ifx\pgf@test\pgf@maintext%
+ \else%
+ \global\setbox\csname pgf@layerbox@#1\endcsname=\box\csname pgf@layerboxsaved@#1\endcsname%
+ \fi%
+ \def\pgf@test{#2}%
+ \ifx\pgf@test\pgfutil@empty%
+ \else%
+ \pgf@dorestorelayer#2,\relax%
+ \fi%
+}
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex
new file mode 100644
index 00000000000..5c9a407b9c6
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex
@@ -0,0 +1,603 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% This file is a copy of some part of PGF/Tikz.
+%%% It has been copied here to provide :
+%%% - compatibility with older PGF versions
+%%% - availability of PGF contributions by Christian Feuersaenger
+%%% which are necessary or helpful for pgfplots.
+%%%
+%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
+%%% PGF parts. The copyrights are as they appear in PGF.
+%%%
+%%% Note that pgfplots has compatible licenses.
+%%%
+%%% This copy has been modified in the following ways:
+%%% - nested \input commands have been updated
+%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
+
+
+
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.37 2011/10/01 16:25:25 ludewich Exp $
+
+% Globals
+
+\newbox\pgfpic
+\newbox\pgf@hbox
+
+\newbox\pgf@layerbox@main
+
+\newcount\pgf@picture@serial@count
+
+
+
+% This if decides whether the position of pictures on the page is
+% protocolled or not. Normally,
+% this is switched off as it works only with certain drivers and it
+% causes external files to be written. When switched on, the position
+% of pgfpictures are protocolled and can be referenced using
+% \pgfsys@getposition{XXX} where XXX is the value of \pgfpictureid
+% inside the picture.
+\newif\ifpgfrememberpicturepositiononpage
+
+
+
+
+% Scopes
+
+
+% Pgf scope environment. All changes of the graphic state are local to
+% the scope.
+%
+% Example:
+%
+% \begin{pgfscope}
+% \pgfsetlinewidth{3pt}
+% \pgfline{\pgfxy(0,0)}{\pgfxy(3,3)}
+% \end{pgfscope}
+
+\def\pgfscope{%
+ \pgfsyssoftpath@setcurrentpath\pgfutil@empty%
+ \pgfsys@beginscope%
+ \pgf@resetpathsizes%
+ \edef\pgfscope@linewidth{\the\pgflinewidth}%
+ \begingroup}
+\def\endpgfscope{%
+ \endgroup%
+ \global\pgflinewidth=\pgfscope@linewidth%
+ \pgfsys@endscope}
+
+
+
+
+% Quickly insert a box can contain normal TeX text at the origin.
+%
+% #1 = box of width/height and depth 0pt
+%
+% Example:
+%
+% \pgfqbox{\mybox}
+
+\def\pgfqbox#1{%
+ \pgfsys@hbox#1%
+}
+
+
+% Insert a box that can contain normal TeX text at the origin, but
+% with the current coordinate transformation matrix synced with the
+% low-level transformation matrix.
+%
+% #1 = box of width/height and depth 0pt
+%
+% In essence, this command does the same as if you first said
+% \pgflowlevelsynccm and then \pgfqbox. However, pgf will use a
+% ``TeX-translation'' for the translation part of the transformation
+% cm. This will ensure that hyperlinks ``survive'' at least
+% translations.
+%
+% Example:
+%
+% \pgfqboxsynced{\mybox}
+
+\def\pgfqboxsynced#1{%
+ \pgfsys@hboxsynced#1%
+}
+
+
+% Puts some text in a box and inserts it with the current
+% transformations applied.
+%
+% #1 = List of optional positioning. Possible values are ``left'', ``right'',
+% ``top'', ``bottom'' and ``base''.
+% #2 = TeX text. May contain verbatims.
+%
+% Example:
+%
+% \pgftransformshift{\pgfpoint{1cm}{0cm}}
+% \pgftext{Hello World!}
+
+\def\pgftext{\pgfutil@ifnextchar[\pgf@text{\pgf@text[]}}%
+\def\pgf@text[#1]{%
+ \def\pgf@text@options{#1}%
+ \pgf@maketext\pgf@after@text}
+\def\pgf@after@text{%
+ {%
+ \def\pgf@text@hshift{center}%
+ \def\pgf@text@vshift{center}%
+ \expandafter\pgf@text@setkeys\expandafter{\pgf@text@options}%
+ \csname pgf@halign\pgf@text@hshift\endcsname%
+ \csname pgf@valign\pgf@text@vshift\endcsname%
+ % Protocol sizes:
+ \pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\dp\pgf@hbox}}}%
+ \pgf@protocolsizes{\pgf@x}{\pgf@y}%
+ \pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\dp\pgf@hbox}}}%
+ \pgf@protocolsizes{\pgf@x}{\pgf@y}%
+ \pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\ht\pgf@hbox}}}%
+ \pgf@protocolsizes{\pgf@x}{\pgf@y}%
+ \pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\ht\pgf@hbox}}}%
+ \pgf@protocolsizes{\pgf@x}{\pgf@y}%
+ \pgfqboxsynced{\pgf@hbox}%
+ }%
+}
+\def\pgf@text@setkeys{\pgfqkeys{/pgf/text}}%
+
+\pgfkeys{/pgf/text/left/.code=\def\pgf@text@hshift{left}}
+\pgfkeys{/pgf/text/center/.code=}
+\pgfkeys{/pgf/text/right/.code=\def\pgf@text@hshift{right}}
+\pgfkeys{/pgf/text/top/.code=\def\pgf@text@vshift{top}}
+\pgfkeys{/pgf/text/bottom/.code=\def\pgf@text@vshift{bottom}}
+\pgfkeys{/pgf/text/base/.code=\def\pgf@text@vshift{base}}
+\pgfkeys{/pgf/text/at/.cd,.code=\pgftransformshift{#1},.value required}
+\pgfkeys{/pgf/text/x/.cd,.code=\pgftransformxshift{#1},.value required}
+\pgfkeys{/pgf/text/y/.cd,.code=\pgftransformyshift{#1},.value required}
+\pgfkeys{/pgf/text/rotate/.cd,.code=\pgftransformrotate{#1},.value required}
+
+\def\pgf@halignleft{}% do nothing
+\def\pgf@haligncenter{\pgftransformxshift{+-.5\wd\pgf@hbox}}
+\def\pgf@halignright{\pgftransformxshift{+-\wd\pgf@hbox}}%
+\def\pgf@valignbase{}% do nothing
+\def\pgf@valignbottom{\pgftransformyshift{+\dp\pgf@hbox}}%
+\def\pgf@valigncenter{\pgftransformyshift{+.5\dp\pgf@hbox}\pgftransformyshift{+-.5\ht\pgf@hbox}}%
+\def\pgf@valigntop{\pgftransformyshift{+-\ht\pgf@hbox}}%
+
+
+% Internal function for creating a hbox.
+\def\pgf@maketext#1{%
+ \def\pgf@@maketextafter{#1}%
+ \setbox\pgf@hbox=\hbox\bgroup%
+ \pgfinterruptpicture%
+ \bgroup%
+ \aftergroup\pgf@collectresetcolor%
+ \let\next=%
+}
+\def\pgf@collectresetcolor{%
+ \pgfutil@ifnextchar\reset@color%
+ {\reset@color\afterassignment\pgf@collectresetcolor\let\pgf@temp=}%
+ {\pgf@textdone}%
+}
+\def\pgf@textdone{%
+ \endpgfinterruptpicture%
+ \egroup%
+ \pgf@@maketextafter%
+}
+
+\long\def\pgf@makehbox#1{%
+ \setbox\pgf@hbox=\hbox{{%
+ \pgfinterruptpicture%
+ #1%
+ \endpgfinterruptpicture%
+ }}}
+
+
+
+% Picture environment
+%
+% Example:
+%
+% \begin{pgfpicture}
+% \pgfsetendarrow{\pgfarrowto}
+% \pgfpathmoveto{\pgfpointxy{-0.9}{0.2}}
+% \pgfpathlineto{\pgfpointxy{0.9}{0.4}}
+% \pgfusepath{stroke}
+% \end{pgfpicture}
+
+\newif\ifpgfpicture
+
+\def\pgfresetboundingbox{%
+ \global\pgf@picmaxx=-16000pt\relax%
+ \global\pgf@picminx=16000pt\relax%
+ \global\pgf@picmaxy=-16000pt\relax%
+ \global\pgf@picminy=16000pt\relax%
+}%
+
+\def\pgfpicture{%
+ \begingroup%
+ \pgfpicturetrue%
+ \global\advance\pgf@picture@serial@count by1\relax%
+ \edef\pgfpictureid{pgfid\the\pgf@picture@serial@count}%
+ \let\pgf@nodecallback=\pgfutil@gobble%
+ \pgf@picmaxx=-16000pt\relax%
+ \pgf@picminx=16000pt\relax%
+ \pgf@picmaxy=-16000pt\relax%
+ \pgf@picminy=16000pt\relax%
+ \pgf@relevantforpicturesizetrue%
+ \pgf@resetpathsizes%
+ \pgfutil@ifnextchar\bgroup\pgf@oldpicture\pgf@picture}
+\def\pgf@oldpicture#1#2#3#4{%
+ \pgfmathsetlength\pgf@picminx{#1}%
+ \pgfmathsetlength\pgf@picminy{#2}%
+ \pgfmathsetlength\pgf@picmaxx{#3}%
+ \pgfmathsetlength\pgf@picmaxy{#4}%
+ \pgf@relevantforpicturesizefalse%
+ \pgf@picture}
+
+\def\pgf@picture{%
+ \setbox\pgfpic\hbox to0pt\bgroup%
+ \begingroup%
+ \pgfsys@beginpicture%
+ \pgfsys@beginscope%
+ \begingroup%
+ \pgfsetcolor{.}%
+ \pgfsetlinewidth{0.4pt}%
+ \pgftransformreset%
+ \pgfsyssoftpath@setcurrentpath\pgfutil@empty%
+ \begingroup%
+ \let\pgf@setlengthorig=\setlength%
+ \let\pgf@addtolengthorig=\addtolength%
+ \let\pgf@selectfontorig=\selectfont%
+ \let\setlength=\pgf@setlength%
+ \let\addtolength=\pgf@addtolength%
+ \let\selectfont=\pgf@selectfont%
+ \nullfont\spaceskip0pt\xspaceskip0pt%
+ \setbox\pgf@layerbox@main\hbox to0pt\bgroup%
+ \begingroup%
+ }
+\def\endpgfpicture{%
+ \ifpgfrememberpicturepositiononpage%
+ \hbox to0pt{\pgfsys@markposition{\pgfpictureid}}%
+ \fi%
+ % ok, now let's position the box
+ \ifdim\pgf@picmaxx=-16000pt\relax%
+ % empty picture. make size 0.
+ \global\pgf@picmaxx=0pt\relax%
+ \global\pgf@picminx=0pt\relax%
+ \global\pgf@picmaxy=0pt\relax%
+ \global\pgf@picminy=0pt\relax%
+ \fi%
+ % Shift baseline outside:
+ \pgf@relevantforpicturesizefalse%
+ \pgf@process{\pgf@baseline}%
+ \xdef\pgf@shift@baseline{\the\pgf@y}%
+ %
+ \pgf@process{\pgf@trimleft}%
+ \global\advance\pgf@x by-\pgf@picminx
+ % prepare \hskip\pgf@trimleft@final.
+ % note that \pgf@trimleft@final is also queried
+ % by the pgf image externalization.
+ \xdef\pgf@trimleft@final{-\the\pgf@x}%
+ %
+ \pgf@process{\pgf@trimright}%
+ \global\advance\pgf@x by-\pgf@picmaxx
+ % prepare \hskip\pgf@trimright@final.
+ % note that \pgf@trimright@final is also queried
+ % by the pgf image externalization.
+ \xdef\pgf@trimright@final{\the\pgf@x}%
+ %
+ \pgf@remember@layerlist@globally
+ \endgroup%
+ \hss%
+ \egroup%
+ \pgf@restore@layerlist@from@global
+ \pgf@insertlayers%
+ \endgroup%
+ \pgfsys@discardpath%
+ \endgroup%
+ \pgfsys@endscope%
+ \pgfsys@endpicture%
+ \endgroup%
+ \hss
+ \egroup%
+ \pgfsys@typesetpicturebox\pgfpic%
+ \endgroup%
+}
+
+\def\pgf@remember@layerlist@globally{%
+ \global\let\pgf@layerlist@=\pgf@layerlist
+}%
+\def\pgf@restore@layerlist@from@global{%
+ \let\pgf@layerlist=\pgf@layerlist@
+}%
+\def\pgf@insertlayers{%
+ \box\pgf@layerbox@main%
+}
+
+\def\pgf@selectfont{\pgf@selectfontorig\nullfont}
+
+\def\pgf@setlength#1#2{% these will be used only when \nullfont is active
+ \begingroup% keep font setting local
+ \pgfutil@selectfont% restore font
+ \pgf@setlengthorig#1{#2}% calculate dimension (possibly using calc)
+ \expandafter%
+ \endgroup%
+ \expandafter#1\expandafter=\the#1\relax}
+\def\pgf@addtolength#1#2{%
+ \begingroup% keep font setting local
+ \pgfutil@selectfont% restore font
+ \pgf@addtolengthorig#1{#2}% calculate dimension (possibly using calc)
+ \expandafter%
+ \endgroup%
+ \expandafter#1\expandafter=\the#1\relax}
+
+
+% Sets the baseline at the y-coordinate of a given point
+%
+% #1 = point
+%
+% Sets the baseline of the picture to the y-coordinate of a given
+% point. However, the point will be evaluated *at the end of the
+% picture*.
+%
+% Example:
+%
+% \pgfsetbaselinepointlater{\pgfpointanchor{mynode}{base}}
+
+\def\pgfsetbaselinepointlater#1{\def\pgf@baseline{#1}}
+
+
+% Sets the baseline at the y-coordinate of a given point, now
+%
+% #1 = point
+%
+% Sets the baseline of the picture to the y-coordinate of a given
+% point.
+%
+% Example:
+%
+% \pgfsetbaselinepointnow{\pgfpoint{1cm}{2pt}}
+
+\def\pgfsetbaselinepointnow#1{%
+ \pgf@process{#1}%
+ \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfsetbaselinepointlater{\pgf@setter@baseline}%
+}
+
+\def\pgf@default@text{default}%
+
+% Sets the baseline
+%
+% #1 = baseline
+%
+% Sets the baseline of the picture. Default is the lower border, which
+% is the same as \pgf@picminy
+%
+% Example:
+%
+% \pgfsetbaseline{1cm+2pt}
+% \pgfsetbaseline{default}% resets to default value
+
+\def\pgfsetbaseline#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgf@default@text
+ \pgfsetbaseline{\pgf@picminy}%
+ \else
+ \pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}%
+ \fi
+}
+\pgfsetbaseline{\pgf@picminy}
+
+% controls how the image externalization implements trim:
+\newif\ifpgf@trim@lowlevel
+\pgfkeys{
+ /pgf/trim lowlevel/.is if=pgf@trim@lowlevel,
+ /pgf/trim lowlevel/.default=true,
+}
+
+% Same as the y-baseline for horizontal alignment.
+% The effect is different, though: it is some kind of trimming which
+% leaves the bounding box intact.
+\def\pgfsettrimleftpointlater#1{\def\pgf@trimleft{#1}}
+\def\pgfsettrimleftpointnow#1{%
+ \pgf@process{#1}%
+ \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfsettrimleftpointlater{\pgf@setter@baseline}%
+}
+% \pgfsettrimleft{<x coord>}
+% or
+% \pgfsettrimleft{default}
+\def\pgfsettrimleft#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgf@default@text
+ \pgfsettrimleft{\pgf@picminx}
+ \else
+ \pgfsettrimleftpointlater{\pgfpoint{#1}{0pt}}%
+ \fi
+}
+\pgfsettrimleft{\pgf@picminx}
+
+\def\pgfsettrimrightpointlater#1{\def\pgf@trimright{#1}}
+\def\pgfsettrimrightpointnow#1{%
+ \pgf@process{#1}%
+ \edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
+ \pgfsettrimrightpointlater{\pgf@setter@baseline}%
+}
+% \pgfsettrimright{<x coord>}
+% or
+% \pgfsettrimright{default}
+\def\pgfsettrimright#1{%
+ \def\pgf@temp{#1}%
+ \ifx\pgf@temp\pgf@default@text
+ \pgfsettrimright{\pgf@picmaxx}%
+ \else
+ \pgfsettrimrightpointlater{\pgfpoint{#1}{0pt}}%
+ \fi
+}
+\pgfsettrimright{\pgf@picmaxx}
+
+
+% Interrupt path
+%
+% Description:
+%
+% The environment can be used to insert some drawing commands while
+% constructing a path. The drawing commands inside the environment
+% will not interfere with the path being constructed ``outside.''
+% However, you must ward against graphic state changes using a scope.
+%
+% Example: Draw two parallel lines
+%
+% \pgfmoveto{\pgfpoint{0cm}{0cm}}
+% \begin{pgfinterruptpath}
+% \pgfmoveto{\pgfpoint{1cm}{0cm}}
+% \pgfmoveto{\pgfpoint{1cm}{1cm}}
+% \pgfusepath{stroke}
+% \end{pgfinterruptpath}
+% \pgflineto{\pgfpoint{0cm}{1cm}}
+% \pgfusepath{stroke}
+
+\def\pgfinterruptpath
+{%
+ \begingroup%
+ % save all sorts of things...
+ \edef\pgf@interrupt@savex{\the\pgf@path@lastx}%
+ \edef\pgf@interrupt@savey{\the\pgf@path@lasty}%
+ \pgf@getpathsizes\pgf@interrupt@pathsizes%
+ \pgfsyssoftpath@getcurrentpath\pgf@interrupt@path%
+ \pgfsyssoftpath@setcurrentpath\pgfutil@empty%
+ \edef\pgfscope@linewidth{\the\pgflinewidth}%
+ \let\pgf@interrupt@lastmoveto=\pgfsyssoftpath@lastmoveto%
+ \begingroup%
+}
+\def\endpgfinterruptpath
+{%
+ \endgroup%
+ \global\pgflinewidth=\pgfscope@linewidth%
+ \pgfsyssoftpath@setcurrentpath\pgf@interrupt@path%
+ \pgf@setpathsizes\pgf@interrupt@pathsizes%
+ \global\pgf@path@lastx=\pgf@interrupt@savex%
+ \global\pgf@path@lasty=\pgf@interrupt@savey%
+ \global\let\pgfsyssoftpath@lastmoveto=\pgf@interrupt@lastmoveto%
+ \endgroup%
+}
+
+
+
+% Interrupt bounding box
+%
+% Description:
+%
+% The environment can be used to temporarily setup a new bounding box
+% computation. The bounding box will be made empty at the beginning of
+% the environment and will be reset to its old value after the
+% environment.
+%
+% Example:
+%
+% \begin{pgfinterruptboundinbox}
+% \pgfmoveto{\pgfpoint{1cm}{0cm}}
+% \pgfmoveto{\pgfpoint{1cm}{1cm}}
+% \pgfusepath{stroke}
+% \end{pgfinterruptboundinbox}
+
+\def\pgfinterruptboundingbox
+{%
+ \begingroup%
+ \edef\pgf@interrupt@savemaxx{\the\pgf@picmaxx}%
+ \edef\pgf@interrupt@saveminx{\the\pgf@picminx}%
+ \edef\pgf@interrupt@savemaxy{\the\pgf@picmaxy}%
+ \edef\pgf@interrupt@saveminy{\the\pgf@picminy}%
+ \pgf@picmaxx=-16000pt\relax%
+ \pgf@picminx=16000pt\relax%
+ \pgf@picmaxy=-16000pt\relax%
+ \pgf@picminy=16000pt\relax%
+ \pgf@size@hookedfalse%
+ \let\pgf@path@size@hook=\pgfutil@empty%
+}
+\def\endpgfinterruptboundingbox
+{%
+ \global\pgf@picmaxx=\pgf@interrupt@savemaxx%
+ \global\pgf@picmaxy=\pgf@interrupt@savemaxy%
+ \global\pgf@picminx=\pgf@interrupt@saveminx%
+ \global\pgf@picminy=\pgf@interrupt@saveminy%
+ \endgroup%
+}
+
+
+
+
+
+% Interrupts a picture
+%
+% Description:
+%
+% This environment interrupts a picture and temporarily returns to
+% normal TeX mode. All sorts of things are saved and restored by this
+% environment.
+%
+% WARNING: Using this environment in conjuction with low level
+% transformations can *strongly* upset the typesetting. Typically, the
+% contents of this environment should have size/height/depth 0pt in
+% the end.
+%
+% WARNING: This environment should only be used inside typesetting a
+% box and this box must in turn be inserted using \pgfqbox.
+%
+% Example: Draw two parallel lines
+%
+% \pgfmoveto{\pgfpoint{0cm}{0cm}}
+% \setbox\mybox=\hbox{
+% \begin{pgfinterruptpicture}
+% This is normal text.
+% \begin{pgfpicture} % a subpicture
+% \pgfmoveto{\pgfpoint{1cm}{0cm}}
+% \pgfmoveto{\pgfpoint{1cm}{1cm}}
+% \pgfusepath{stroke}
+% \end{pgfpicture}
+% More text.
+% \end{pgfinterruptpicture}
+% }
+% \ht\mybox=0pt
+% \wd\mybox=0pt
+% \dp\mybox=0pt
+% \pgfqbox{\mybox}%
+% \pgfpathlineto{\pgfpoint{0cm}{1cm}}
+% \pgfusepath{stroke}
+
+\def\pgfinterruptpicture
+{%
+ \begingroup%
+ \pgfinterruptboundingbox%
+ \pgftransformreset%
+ \pgfinterruptpath%
+ \ifx\pgf@selectfontorig\@undefined%
+ \else%
+ \let\setlength\pgf@setlengthorig%
+ \let\addtolength\pgf@addtolengthorig%
+ \let\selectfont\pgf@selectfontorig%
+ \fi%
+ \pgfutil@selectfont%
+ \pgfpicturefalse%
+ \let\pgf@positionnodelater@macro\relax%
+ \pgf@savelayers%
+}
+\def\endpgfinterruptpicture
+{%
+ \pgf@restorelayers%
+ \endpgfinterruptpath%
+ \endpgfinterruptboundingbox%
+ \endgroup%
+}
+
+\let\pgf@savelayers=\relax
+\let\pgf@restorelayers=\relax
+
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex
index 02fe32acd2b..c933914a9c4 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
@@ -466,8 +466,7 @@
#1% ok, always true if the USER explicitly provided the full key path.
\fi
}%
-\def\pgfkeysaddhandlyonlyexistingexception#1{\expandafter\def\csname pgfk@excpt@#1\endcsname{1}}%
-
+\def\pgfkeysaddhandleonlyexistingexception#1{\expandafter\def\csname pgfk@excpt@#1\endcsname{1}}%
\def\pgfkeys@unknown{%
\pgfkeysifdefined{\pgfkeyscurrentpath/.unknown/.@cmd}%
@@ -1051,13 +1050,13 @@
\let\pgfkeys@case@three=\pgfkeys@case@three@handle@restricted
\let\pgfkeys@ifexecutehandler=\pgfkeys@ifexecutehandler@handlefullorexisting
},
- /handler config/only existing/add exception/.code={\pgfkeysaddhandlyonlyexistingexception{#1}},
+ /handler config/only existing/add exception/.code={\pgfkeysaddhandleonlyexistingexception{#1}},
}%
-\pgfkeysaddhandlyonlyexistingexception{.cd}%
-\pgfkeysaddhandlyonlyexistingexception{.try}%
-\pgfkeysaddhandlyonlyexistingexception{.retry}%
-\pgfkeysaddhandlyonlyexistingexception{.lastretry}%
-\pgfkeysaddhandlyonlyexistingexception{.unknown}%
+\pgfkeysaddhandleonlyexistingexception{.cd}%
+\pgfkeysaddhandleonlyexistingexception{.try}%
+\pgfkeysaddhandleonlyexistingexception{.retry}%
+\pgfkeysaddhandleonlyexistingexception{.lastretry}%
+\pgfkeysaddhandleonlyexistingexception{.unknown}%
\input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
index 5d9ad0a5504..51a3f911a57 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
index 5183f85fc8e..be3a2179c6b 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
@@ -591,6 +591,7 @@
\let\pgfmath@basic@lessthan@=\pgfmathlessthan@
\let\pgfmath@basic@greaterthan@=\pgfmathgreaterthan@
\let\pgfmath@basic@equalto@=\pgfmathequalto@
+\let\pgfmath@basic@equal@=\pgfmathequal@
\let\pgfmath@basic@true@=\pgfmathtrue@
\let\pgfmath@basic@false@=\pgfmathfalse@
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
index e95a9a9957c..22127f8f1d3 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex
index 4d59a1cba1b..d553f4c4272 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex
index 75a23d73422..c9eacad8bf6 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex
index e3280455bb4..51a4122f811 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex
index 2f2ce4d9716..4a795f89cd5 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
@@ -30,7 +30,28 @@
% This file contains methods for basic floating point arithmetics, rounding
% to arbitrary precision and number pretty printing.
%
-% Version 1.0 2008/09/17
+
+
+\pgfkeys{
+ % The bug 3430171 (wrong minus sign spacing in pgfmathprintnumber)
+ % has been fixed in 2.10 CVS. Since it changes the spacing, its
+ % effects can be undone with this compatibility switch.
+ /pgf/compat/number printer/.is choice,
+ /pgf/compat/number printer/2.10/.code={%
+ \def\pgfmathprintnumber@begingroup{\bgroup}%
+ \def\pgfmathprintnumber@endgroup{\egroup}%
+ },
+ % I do not know the version number of the next release at this
+ % time. Please be so kind and KEEP THIS NAME INTACT. Add an alias
+ % if needed.
+ /pgf/compat/number printer/next after 2.10/.code={%
+ \def\pgfmathprintnumber@begingroup{\begingroup}%
+ \def\pgfmathprintnumber@endgroup{\endgroup}%
+ },
+ % activate the fix by default.
+ /pgf/compat/number printer/next after 2.10,%
+}
+
\global\newif\ifpgfmathfloatcomparison
\newif\ifpgfmathfloatroundhasperiod
@@ -817,23 +838,23 @@
% #1: the part before the exponent code
% #2: the part for the exponent code.
\def\pgfmathfloatrounddisplaystyle@shared@impl@#1#2{%
- \begingroup
+ \pgfmathprintnumber@begingroup
\toks0={#1}%
\toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
\xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
- \endgroup
+ \pgfmathprintnumber@endgroup
\let\pgfmathresult=\pgfmathfloat@glob@TMP
}%
% Same as \pgfmathfloatrounddisplaystyle@shared@impl@, but it also
% inserts the '@dec sep mark' at the end.
\def\pgfmathfloatrounddisplaystyle@shared@impl@@#1#2{%
- \begingroup
+ \pgfmathprintnumber@begingroup
\toks0={#1}%
\toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
\pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK
\toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}%
\xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }%
- \endgroup
+ \pgfmathprintnumber@endgroup
\let\pgfmathresult=\pgfmathfloat@glob@TMP
}
@@ -848,11 +869,11 @@
}
\def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{%
\ifnum#3<0\relax
- \begingroup
+ \pgfmathprintnumber@begingroup
\count0=#3\relax
\multiply\count0 by-1
\xdef\pgfmathfloat@glob@TMP{e{-}\the\count0}%
- \endgroup%
+ \pgfmathprintnumber@endgroup%
\let\pgfmathresult=\pgfmathfloat@glob@TMP
\else
\def\pgfmathresult{e{+}#3}%
@@ -862,11 +883,11 @@
}
\def\pgfmathfloatrounddisplaystyle@E#1#2e#3\relax{%
\ifnum#3<0\relax
- \begingroup
+ \pgfmathprintnumber@begingroup
\count0=#3\relax
\multiply\count0 by-1
\xdef\pgfmathfloat@glob@TMP{E{-}\the\count0}%
- \endgroup%
+ \pgfmathprintnumber@endgroup%
\let\pgfmathresult=\pgfmathfloat@glob@TMP
\else
\def\pgfmathresult{E{+}#3}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty
index 550951ca3b5..cbd3b957c6e 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex
index d49d8d634c4..17feb576361 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
@@ -47,6 +47,7 @@
\toksdef\t@tikzexternal@tmpb=1
\newif\iftikzexternal@nestedflag
+\newif\iftikzexternal@verboseuptodate
\newif\iftikzexternal@verboseio
\newif\iftikzexternal@genfigurelist
\newif\iftikzexternal@onlynamed
@@ -170,9 +171,11 @@
verbose IO/.default=true,
verbose IO=true,
verbose optimize/.is if=tikzexternal@verbose@optimize,
+ verbose up to date/.is if=tikzexternal@verboseuptodate,
verbose/.style={
verbose IO=#1,
verbose optimize=#1,
+ verbose up to date=#1,
},
shell escape/.initial=-shell-escape,
read main aux/.is if=pgfexternalreadmainaux,
@@ -271,6 +274,18 @@
\expandafter\gdef\csname c@tikzext@no@#1\endcsname{0}%
},%
prefix/.code={\tikzsetexternalprefix{#1}},
+ up to date check/.is choice,
+ up to date check/simple/.code={\def\tikzexternal@uptodate@mode{0}},
+ % md5 relies on \pdfmdfivesum of pdftex. It uses 'diff' as fallback if we do not have that command.
+ up to date check/md5/.code={%
+ \pgfutil@ifundefined{pdfmdfivesum}{%
+ \pgfkeys{/tikz/external/up to date check=diff}%
+ }{%
+ \def\tikzexternal@uptodate@mode{1}%
+ }%
+ },
+ up to date check/diff/.code={\def\tikzexternal@uptodate@mode{2}},
+ up to date check=md5,
}
\def\tikzsetfigurename#1{\pgfkeyssetvalue{/tikz/external/figure name}{#1}}%
@@ -1103,7 +1118,7 @@
}%
\long\def\tikzexternal@optimize@away@latex@env@close#1{%
\iftikzexternal@verbose@optimize
- \immediate\write16{The complete contents of \string\begin{tikzexternal@optimize@away@latex@env@} up to the next \end{tikzexternal@optimize@away@latex@env@} has been optimized away because it does not contribute to exported PDF. Use '/tikz/external/optimize=false' to disable this.}%
+ \immediate\write16{The complete contents of \string\begin{tikzexternal@optimize@away@latex@env@} up to the next \end{tikzexternal@optimize@away@latex@env@} has been optimized away because it does not contribute to the exported PDF. Use '/tikz/external/optimize=false' to disable this.}%
\fi
\endgroup
% we still need to invoke \end{<name>} in latex because \begin{<name>}
@@ -1181,7 +1196,8 @@
\def\tikzexternal@forcegraphics{%
\tikzexternal@TEXDIALECT@collectpicture\tikzexternal@forcegraphics@@
}
-\long\def\tikzexternal@forcegraphics@@#1{%
+\long\def\tikzexternal@forcegraphics@@#1{\tikzexternal@forcegraphics@@@}%
+\def\tikzexternal@forcegraphics@@@{%
\expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}%
\tikzexternal@closeenvironments
}
@@ -1191,7 +1207,8 @@
\def\tikzexternal@listmodepicture{%
\tikzexternal@TEXDIALECT@collectpicture\tikzexternal@listmodepicture@@
}
-\long\def\tikzexternal@listmodepicture@@#1{%
+\long\def\tikzexternal@listmodepicture@@#1{\tikzexternal@listmodepicture@@@}
+\def\tikzexternal@listmodepicture@@@{%
\pgfkeysvalueof{/tikz/external/image discarded text}%
\tikzexternal@closeenvironments
}
@@ -1199,15 +1216,21 @@
% check if there is already a file.
% In that case, use it. If not, skip it.
\def\tikzexternal@list@and@makefile@mode@picture{%
+ \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@list@and@makefile@mode@picture@
+}%
+\long\def\tikzexternal@list@and@makefile@mode@picture@#1{%
+ %
+ \tikzexternal@check@uptodate@mode{#1}%
+ %
\gdef\pgf@filename{}%
\xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}%
\pgf@tempa
\ifx\pgf@filename\pgfutil@empty%
% Note: since we have no 'GRAB' mode, we do not have to deal with optimization.
% there is no graphics.
- \expandafter\tikzexternal@listmodepicture
+ \expandafter\tikzexternal@listmodepicture@@@
\else
- \expandafter\tikzexternal@forcegraphics
+ \expandafter\tikzexternal@forcegraphics@@@
\fi
}%
@@ -1309,7 +1332,7 @@
\endgroup
}%
\long\def\tikzexternal@externalizefig@systemcall@@#1{%
- \tikzexternal@externalizefig@systemcall@uptodatecheck%
+ \tikzexternal@externalizefig@systemcall@uptodatecheck{#1}%
\iftikzexternal@file@isuptodate
\iftikzexternal@verboseio
\immediate\write16{===== Image '\tikzexternal@curfilename' is up-to-date. ======}%
@@ -1376,6 +1399,99 @@
\fi
}
+\long\def\tikzexternal@computemdfivesum#1{%
+ \t@tikzexternal@tmpb={#1}%
+ \edef\tikzexternal@temp{\the\t@tikzexternal@tmpb}%
+ % \meaning results in a string of catcode 12 - which is expandable.
+ \edef\pgfretval{\pdfmdfivesum{\meaning\tikzexternal@temp}}%
+}
+\long\def\tikzexternal@computemdfivesum@diff@fallback#1{%
+ \t@tikzexternal@tmpb={#1}%
+ \edef\tikzexternal@temp{\the\t@tikzexternal@tmpb}%
+ % \meaning results in a string of catcode 12 - which is expandable.
+ \edef\pgfretval{\meaning\tikzexternal@temp}%
+}
+
+% Will be set dynamically, depending on 'up to date check'.
+%
+% It expands to code such that \tikzexternallastkey contains the
+% serialized version of '#1'.
+%
+% It is used as argument for \write{..}
+%
+% #1 the hash key to serialize.
+% \def\tikzexternal@hashfct@serialize
+\long\def\tikzexternal@hashfct@serialize@std#1{%
+ \noexpand\def\noexpand\tikzexternallastkey{#1}%
+}%
+
+% serializes using temporary token registers. Necessary if #1 contains
+% executable code.
+\long\def\tikzexternal@hashfct@serialize@tok#1{%
+ \noexpand\begingroup
+ % in order to allow '#' inside of the body, we have to use token registers:
+ \noexpand\toks0={#1}%
+ \noexpand\xdef\noexpand\tikzexternallastkey{\noexpand\the\noexpand\toks0 }%
+ \noexpand\endgroup
+}%
+
+\def\tikzexternal@check@uptodate@ext{.md5}
+
+% assigns the boolean \iftikzexternal@file@isuptodate
+\long\def\tikzexternal@check@uptodate@mode#1{%
+ \ifcase\tikzexternal@uptodate@mode
+ % up to date check=simple
+ % nothing to do -- file existance is checked anyway.
+ \let\tikzexternal@hashfct=\pgfutil@empty
+ \let\tikzexternal@hashfct@serialize=\pgfutil@empty
+ \or
+ % up to date check=md5
+ \let\tikzexternal@hashfct=\tikzexternal@computemdfivesum
+ \let\tikzexternal@hashfct@serialize=\tikzexternal@hashfct@serialize@std
+ \or
+ \let\tikzexternal@hashfct=\tikzexternal@computemdfivesum@diff@fallback
+ \let\tikzexternal@hashfct@serialize=\tikzexternal@hashfct@serialize@tok
+ \fi
+ \ifx\tikzexternal@hashfct\pgfutil@empty
+ \else
+ \tikzpicturedependsonfile{\tikzexternal@curfilename\tikzexternal@check@uptodate@ext}%
+ \tikzexternal@hashfct{#1}%
+ \let\tikzexternal@lastkey@new=\pgfretval
+ \begingroup
+ % no '@' token in this macro: avoid messing up the catcodes in input files:
+ \global\let\tikzexternallastkey=\pgfutil@empty
+ \openin\r@pgf@reada=\tikzexternal@curfilename\tikzexternal@check@uptodate@ext\relax %
+ \ifeof\r@pgf@reada
+ \else
+ % read first line...
+ \read\r@pgf@reada to\pgf@tempa
+ % ... and execute it.
+ \pgf@tempa
+ % it should contain a definition of \tikzexternallastkey.
+ \fi
+ \closein\r@pgf@reada
+ %
+ \let\tikzexternal@lastkey=\tikzexternallastkey
+ \pgfmath@smuggleone\tikzexternal@lastkey
+ \endgroup
+ % normalize catcodes. Unfortunately, they cannot be expected to be the same.
+ % \meaning will use catcode 12 for each token:
+ \edef\tikzexternal@lastkey@normalized{\meaning\tikzexternal@lastkey}%
+ \edef\tikzexternal@lastkey@new@normalized{\meaning\tikzexternal@lastkey@new}%
+ \iftikzexternal@verboseuptodate
+ \immediate\write16{Up-to-date check of \tikzexternal@curfilename: new \tikzexternal@lastkey@new@normalized; old \tikzexternal@lastkey@normalized.^^J}%
+ \fi
+ \ifx\tikzexternal@lastkey@normalized\tikzexternal@lastkey@new@normalized
+ \tikzexternal@file@isuptodatetrue
+ \else
+ \tikzexternal@file@isuptodatefalse
+ \immediate\openout\w@pgf@writea=\tikzexternal@curfilename\tikzexternal@check@uptodate@ext\relax%
+ \immediate\write\w@pgf@writea{\tikzexternal@hashfct@serialize{\tikzexternal@lastkey@new}}%
+ \immediate\closeout\w@pgf@writea
+ \fi
+ \fi
+}
+
% Checks whether the current picture needs to be externalized.
%
% This is the case if
@@ -1383,9 +1499,13 @@
% b) the picture has been invalidated manually.
%
% It returns \iftikzexternal@file@isuptodate accordingly.
-\def\tikzexternal@externalizefig@systemcall@uptodatecheck{%
+% #1: the picture-content
+\long\def\tikzexternal@externalizefig@systemcall@uptodatecheck#1{%
\tikzexternal@checkforceremake
\iftikzexternal@file@isuptodate
+ \tikzexternal@check@uptodate@mode{#1}%
+ \fi
+ \iftikzexternal@file@isuptodate
% check if there is already a file.
% In that case, use it. If that is not the case, generate it and include it afterwards.
\gdef\pgf@filename{}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
index b83ab9123e5..aca706b459f 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
@@ -14,7 +14,7 @@
%%% - nested \input commands have been updated
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%% Date of this copy: Do 29. Dez 12:39:03 CET 2011 %%%
+%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex
index 7e2316ee45a..7bf4e86b27a 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex
@@ -34,6 +34,7 @@
\input pgfplotscolormap.code.tex
\input pgfplotsstackedplots.code.tex
\input pgfplotsplothandlers.code.tex
+\input pgfplots.scaling.code.tex
\input pgfplotscoordprocessing.code.tex
\input pgfplotsticks.code.tex
\input pgfplots.paths.code.tex
@@ -49,12 +50,12 @@
\newif\ifpgfplots@has@label@information
\newif\ifpgfplots@yislinear
\newif\ifpgfplots@zislinear
-\newif\ifpgfplots@unit@vector@rescale@keep@size
\newif\ifpgfplots@reverse@legend
\newif\ifpgfplots@transpose@legend
\newif\ifpgfplots@allow@reversal@of@rel@axis@cs
\newif\ifpgfplots@scanline@verbose
\newif\ifpgfplots@plot@graphics@autoadjustaxis
+\newif\ifpgfplots@scaleuniformly@warning
\newcount\pgfplots@numplots
\newdimen\pgfplots@xmin@reg
\newdimen\pgfplots@xmax@reg
@@ -68,7 +69,6 @@
\newif\ifpgfplots@clip
\newif\ifpgfplots@plot@coords@mathparser
\pgfplots@plot@coords@mathparsertrue
-\pgfplots@cliptrue
\newif\ifpgfplots@enlargelimits
\newif\ifpgfplots@enlargelimits@rel@thresh
\newif\ifpgfplots@enlargelimits@auto
@@ -121,6 +121,7 @@
\let\pgfnodepartimagebox=\pgfnodeparttextbox
\newif\ifpgfplotsplothandlermesh@internaldepth
\newif\ifpgfplotsplothandlermesh@hide@refined@edges
+\newif\ifpgfplots@has@cell@picture
\newif\ifpgfplots@collect@firstplot@astick
\newif\ifpgfplots@units@use
@@ -485,6 +486,16 @@
%
}%
+\newif\ifpgfplotsplothandlermesh@shownormals
+
+\pgfkeys{%
+ % <key name>/.define layer set={<layer list>}{<style definition>}
+ /handlers/.define layer set/.code 2 args={%
+ \pgfkeyssetvalue{\pgfkeyscurrentpath/list}{#1}%
+ \pgfkeysdef{\pgfkeyscurrentpath}{\pgfkeysalso{#2}}%
+ }%
+}
+
\pgfkeys{%
/pgfplots/search path for tikz/.search also={/tikz,/pgfplots},
/pgfplots/.is family,
@@ -497,6 +508,73 @@
/pgfplots/naming commands/.is family,
/pgfplots/shared with tikz/.is family,
/pgfplots/error bars/.is family,
+ %
+ % pgfplots uses the following (implicit) layers:
+ % context: & associated layer name: \\
+ % background path & axis background \\
+ % grid lines & axis grid \\
+ % tick lines & axis ticks \\
+ % axis lines & axis lines \\
+ % tick labels & axis tick labels \\
+ % plots & main \\
+ % axis descriptions & axis descriptions \\
+ % plot marks & (see 'mark layer')\\
+ % the 'axis on top' key will change that order by moving all plot- and mark-related paths upwards (they are drawn earlier).
+ % None of these layers is mandatory; each can be omitted.
+ % The magic layer name 'discard' can be used as /dev/null layer.
+ %
+ % the <layer set name> must be defined
+ % set layers={<layer set name>}
+ /pgfplots/set layers/.code={%
+ \def\pgfplots@loc@TMPa{#1}%
+ \def\pgfplots@loc@TMPb{none}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ \pgfkeysalso{%
+ /pgfplots/activate layers=false,
+ /pgfplots/set layers*={},
+ }%
+ \else
+ \pgfkeysalso{%
+ /pgfplots/activate layers=true,
+ /pgfplots/set layers*={#1},
+ }%
+ \pgfplotsifinaxis{%
+ \pgfkeysalso{/pgfplots/cell picture=if necessary}%
+ }{%
+ % we wrote it outside of an axis. In this case, we can
+ % assume that it prepares multiple axis - which
+ % REQUIRES to disable cell pictures.
+ \pgfkeysalso{/pgfplots/cell picture=false}%
+ }%
+ \fi
+ },
+ % 'activate layers=false' is the same as 'set layers=none'.
+ % However, 'activate layers=true' does not work unless a 'set layers'
+ % has been installed as well.
+ /pgfplots/activate layers/.is if=pgfplots@layered@graphics,
+ /pgfplots/activate layers/.default=true,
+ /pgfplots/set layers*/.code=\pgfplots@key@set@layers{#1},
+ /pgfplots/set layers*/.default={/pgfplots/layers/standard},
+ /pgfplots/@set layers arg/.initial=,
+ /pgfplots/layers/.search also=/pgfplots,
+ /pgfplots/layers/standard/.define layer set={axis background,axis grid,axis ticks,axis lines,axis tick labels,main,axis descriptions,axis foreground}{
+ grid style= {/pgfplots/on layer=axis grid},
+ tick style= {/pgfplots/on layer=axis ticks},
+ axis line style= {/pgfplots/on layer=axis lines},
+ label style= {/pgfplots/on layer=axis descriptions},
+ legend style= {/pgfplots/on layer=axis descriptions},
+ title style= {/pgfplots/on layer=axis descriptions},
+ colorbar style= {/pgfplots/on layer=axis descriptions},
+ ticklabel style= {/pgfplots/on layer=axis tick labels},
+ axis background@ style={/pgfplots/on layer=axis background},
+ 3d box foreground style={/pgfplots/on layer=axis foreground},
+ },
+ /pgfplots/layers/axis on top/.define layer set={axis background,main,axis grid,axis ticks,axis lines,axis tick labels,axis descriptions,axis foreground}{
+ /pgfplots/layers/standard
+ },
+ /pgfplots/on layer/.initial=,
+ % mark layer can be 'auto', 'like plot', or a layer name.
+ /pgfplots/mark layer/.initial=,
/pgfplots/every axis/.style={},
/pgfplots/every axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis}},
/pgfplots/every axis/.belongs to family=/pgfplots/style commands,
@@ -1349,6 +1427,11 @@
/pgfplots/anchor/.belongs to family=/pgfplots,
/pgfplots/anchor/.store in= \pgfplots@anchorname,
/pgfplots/anchor=south west,
+ /pgfplots/cell picture/.is choice,
+ /pgfplots/cell picture/false/.code=\def\pgfplots@cell@picture@mode{0},
+ /pgfplots/cell picture/true/.code=\def\pgfplots@cell@picture@mode{1},
+ /pgfplots/cell picture/if necessary/.code=\def\pgfplots@cell@picture@mode{2},
+ /pgfplots/cell picture/true, % backwards compatibility
/pgfplots/log origin x/.is choice,
/pgfplots/log origin x/infty/.code={\def\pgfplots@log@origin@choice@x{0}},
/pgfplots/log origin x/0/.code={\def\pgfplots@log@origin@choice@x{1}},
@@ -1570,8 +1653,25 @@
/pgfplots/clip limits=true,
/pgfplots/clip limits/.belongs to family=/pgfplots,
/pgfplots/clip/.is if=pgfplots@clip,
+ /pgfplots/clip/.default=true,
+ /pgfplots/clip=true,
+ /pgfplots/clip mode/.is choice,
+ /pgfplots/clip mode/global/.code= \def\pgfplots@clipmode{1},
+ % this choice is implemented partially only (only for plots, not for
+ % graphical elements):
+ /pgfplots/clip mode/individual/.code= \def\pgfplots@clipmode{2},
+ /pgfplots/clip mode=global,
% will be used if it exists:
- %/pgfplots/axis background/.style={},
+ /pgfplots/axis background/.style={},
+ /pgfplots/axis background style/.style={/pgfplots/axis background/.append style={#1}},
+ %
+ % the 'axis background@' style is an optimization: it will only be
+ % used if 'axis background' is non-empty.
+ % The motivation is that once 'axis background' is non-empty, a
+ % background path will be generated whereas the 'axis background@'
+ % style can be changed at will.
+ /pgfplots/axis background@/.style={},
+ /pgfplots/axis background@ style/.style={/pgfplots/axis background@/.append style={#1}},
%
% 2d: 'unit vector ratio=2 1 is relative to y axis (x is twice as large as y)
% 3d: 'unit vector ratio=2 2 1 is relative to z axis (x and y are both twice as large as z)
@@ -1582,9 +1682,12 @@
/pgfplots/unit vector ratio={#1},
/pgfplots/unit rescale keep size=false,
},
- /pgfplots/unit rescale keep size/.is if=pgfplots@unit@vector@rescale@keep@size,
+ /pgfplots/unit rescale keep size/.is choice,
+ /pgfplots/unit rescale keep size/true/.code={\def\pgfplots@unit@vector@rescale@keep@size{1}},
+ /pgfplots/unit rescale keep size/false/.code={\def\pgfplots@unit@vector@rescale@keep@size{0}},
+ /pgfplots/unit rescale keep size/unless limits declared/.code={\def\pgfplots@unit@vector@rescale@keep@size{2}},
/pgfplots/unit rescale keep size/.default=true,
- /pgfplots/unit rescale keep size=true,
+ /pgfplots/unit rescale keep size=unless limits declared,
/pgfplots/axis equal/.is choice,
/pgfplots/axis equal/true/.style={
/pgfplots/unit vector ratio=1 1 1,
@@ -1672,27 +1775,32 @@
\def\pgfplots@loc@TMPb##1:##2\relax{%
\pgfkeysalso{%
/pgfplots/#1 filter/.append code={%
+ \pgfplots@warn@if@log@basis@unset{#1}{domain restriction}%
\let\pgfplots@restrict@to@domain@orig=\pgfmathresult
- \def\pgfplots@restrict@to@domain@tmp{#2}%
- \ifx\pgfplots@restrict@to@domain@tmp\pgfutil@empty
- % we don't have an expression.
+ \ifx\pgfmathresult\pgfutil@empty
+ % the input value is empty... skip it!
\else
- % evaluate the expression!
- \pgfmathparse{#2}%
+ \def\pgfplots@restrict@to@domain@tmp{#2}%
+ \ifx\pgfplots@restrict@to@domain@tmp\pgfutil@empty
+ % we don't have an expression.
+ \else
+ % evaluate the expression!
+ \pgfmathparse{#2}%
+ \fi
+ \pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}%
+ \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult
+ %
+ \pgfplotscoordmath{default}{if less than}
+ {\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument
+ {%
+ \edef\pgfmathresult{\if0#4inf\else ##1\fi}%
+ }{%
+ \pgfplotscoordmath{default}{if less than}
+ {##2}{\pgfplots@restrict@to@domain@tmp}
+ {\edef\pgfmathresult{\if0#4-inf\else ##2\fi}}
+ {\let\pgfmathresult=\pgfplots@restrict@to@domain@orig}%
+ }%
\fi
- \pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}%
- \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult
- %
- \pgfplotscoordmath{default}{if less than}
- {\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument
- {%
- \edef\pgfmathresult{\if0#4inf\else ##1\fi}%
- }{%
- \pgfplotscoordmath{default}{if less than}
- {##2}{\pgfplots@restrict@to@domain@tmp}
- {\edef\pgfmathresult{\if0#4-inf\else ##2\fi}}
- {\let\pgfmathresult=\pgfplots@restrict@to@domain@orig}%
- }%
}%
}%
}%
@@ -1829,6 +1937,21 @@
/pgfplots/scale mode/stretch to fill/.code={\def\pgfplots@scale@mode@choice{2}},
/pgfplots/scale mode/scale uniformly/.code={\def\pgfplots@scale@mode@choice{3}},
/pgfplots/scale mode/auto,
+ /pgfplots/scale uniformly strategy/.is choice,
+ % chooses one of the other choices depending on the target
+ % width/height:
+ /pgfplots/scale uniformly strategy/auto/.code= {\def\pgfplots@scaleuniformly@choice{0}},
+ % scales units only, but does not compensate limits:
+ /pgfplots/scale uniformly strategy/units only/.code= {\def\pgfplots@scaleuniformly@choice{1}},
+ % changes only vertical limits, no horizontal limits:
+ /pgfplots/scale uniformly strategy/change vertical limits/.code= {\def\pgfplots@scaleuniformly@choice{2}},
+ % changes X and Y limits, but not Z limits - adjusts scale accordingly:
+ /pgfplots/scale uniformly strategy/change horizontal limits/.code= {\def\pgfplots@scaleuniformly@choice{3}},
+ /pgfplots/scale uniformly strategy/auto,
+ /pgfplots/scale uniformly warning/.is if=pgfplots@scaleuniformly@warning,
+ /pgfplots/scale uniformly warning=false,
+ % number of iterations for the nonlinear method involved
+ /pgfplots/scale uniformly strategy iter/.initial=9,
/pgfplots/allow reversal of rel axis cs/.is if=pgfplots@allow@reversal@of@rel@axis@cs,%
/pgfplots/allow reversal of rel axis cs/.default=true,%
/pgfplots/allow reversal of rel axis cs=true,%
@@ -2789,6 +2912,21 @@
/pgfplots/mesh/cols/.initial=,
/pgfplots/mesh/scanline verbose/.is if=pgfplots@scanline@verbose,%
/pgfplots/mesh/scanline verbose/.default=true,
+ %
+ % this is currently only a debug feature. Perhaps it will never
+ % reach production state because of the lacking z buffering for
+ % this technique.
+ /pgfplots/mesh/show normals/.is if=pgfplotsplothandlermesh@shownormals,
+ /pgfplots/mesh/show normals/.default=true,
+ /pgfplots/mesh/show normals length factor/.initial=50,
+ /pgfplots/every patch normal/.style={-stealth,red},
+ %
+ /pgfplots/mesh/interior colormap/.code 2 args={%
+ \pgfplotscreatecolormap{#1}{#2}%
+ \pgfkeysalso{/pgfplots/mesh/interior colormap name=#1}%
+ },
+ /pgfplots/mesh/interior colormap name/.initial=,
+ /pgfplots/mesh/interior colormap thresh/.initial=0,
/pgfplots/mesh/check/.code={%
\pgfplotsutilifstringequal{#1}{false}{%
\def\pgfplots@mesh@checkmode{0}%
@@ -2849,6 +2987,7 @@
/pgfplots/shader/faceted interp/.code={\def\pgfplotsplothandlermesh@shader{3}},
/pgfplots/shader/faceted,
/pgfplots/faceted color/.initial=mapped color!80!black,
+ /pgfplots/marker layer/.initial=auto,
/pgfplots/clip marker paths/.is if=pgfplots@clip@marker@paths,
/pgfplots/clip marker paths/.default=true,
/pgfplots/axis on top/.is if=pgfplots@axis@on@top,
@@ -3195,6 +3334,7 @@
/pgfplots/compat/anchors/1.4/.style= {/pgfplots/compat/anchors/1.3},%
/pgfplots/compat/anchors/1.5/.style= {/pgfplots/compat/anchors/1.3},%
/pgfplots/compat/anchors/1.5.1/.style= {/pgfplots/compat/anchors/1.3},%
+ /pgfplots/compat/anchors/1.6/.style= {/pgfplots/compat/anchors/1.3},%
/pgfplots/compat/anchors/newest/.style= {/pgfplots/compat/anchors/1.3},%
/pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},%
%
@@ -3202,10 +3342,11 @@
/pgfplots/compat/empty line/pre 1.3/.code={\pgfplots@emptyline@compattrue},% FIXME: WAS \global
/pgfplots/compat/empty line/1.3/.style= {/pgfplots/compat/empty line/pre 1.3},%
/pgfplots/compat/empty line/1.4/.code= {\pgfplots@emptyline@compatfalse},%
- /pgfplots/compat/empty line/1.5/.style= {/pgfplots/compat/empty line/1.4},%
- /pgfplots/compat/empty line/1.5.1/.style= {/pgfplots/compat/empty line/1.4},%
- /pgfplots/compat/empty line/newest/.style= {/pgfplots/compat/empty line/1.4},%
- /pgfplots/compat/empty line/default/.style={/pgfplots/compat/empty line/1.4},%
+ /pgfplots/compat/empty line/1.5/.style= {/pgfplots/compat/empty line/1.4},%
+ /pgfplots/compat/empty line/1.5.1/.style= {/pgfplots/compat/empty line/1.4},%
+ /pgfplots/compat/empty line/1.6/.style= {/pgfplots/compat/empty line/1.4},%
+ /pgfplots/compat/empty line/newest/.style= {/pgfplots/compat/empty line/1.4},%
+ /pgfplots/compat/empty line/default/.style= {/pgfplots/compat/empty line/1.4},%
%
/pgfplots/compat/path replacement/.is choice,
/pgfplots/compat/path replacement/pre 1.3/.code= {\pgfplots@path@replace@ellipsefalse},
@@ -3213,8 +3354,9 @@
/pgfplots/compat/path replacement/1.4/.style= {/pgfplots/compat/path replacement/pre 1.3},
/pgfplots/compat/path replacement/1.5/.style= {/pgfplots/compat/path replacement/pre 1.3},%
/pgfplots/compat/path replacement/1.5.1/.code= {\pgfplots@path@replace@ellipsetrue},%
- /pgfplots/compat/path replacement/newest/.style= {/pgfplots/compat/path replacement/1.5.1},%
- /pgfplots/compat/path replacement/default/.style={/pgfplots/compat/path replacement/pre 1.3},%
+ /pgfplots/compat/path replacement/1.6/.style= {/pgfplots/compat/path replacement/1.5.1},
+ /pgfplots/compat/path replacement/newest/.style= {/pgfplots/compat/path replacement/1.5.1},%
+ /pgfplots/compat/path replacement/default/.style= {/pgfplots/compat/path replacement/pre 1.3},%
%ellipse/.is if=pgfplots@path@replace@ellipse,
%
/pgfplots/compat/labels/.is choice,
@@ -3227,6 +3369,7 @@
/pgfplots/compat/labels/1.4/.style= {/pgfplots/compat/labels/1.3},%
/pgfplots/compat/labels/1.5/.style= {/pgfplots/compat/labels/1.3},%
/pgfplots/compat/labels/1.5.1/.style= {/pgfplots/compat/labels/1.3},%
+ /pgfplots/compat/labels/1.6/.style= {/pgfplots/compat/labels/1.3},%
/pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.3},%
/pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-(
%
@@ -3235,33 +3378,100 @@
/pgfplots/compat/scaling/.is choice,
/pgfplots/compat/scaling/pre 1.3/.code={%
\def\pgfplots@compat@scaling@zunitfix@enable{0}%
- \def\pgfplots@compat@scaling@coordmath{pgfbasic}},
+ \def\pgfplots@compat@scaling@coordmath{pgfbasic}%
+ \def\pgfplots@compat@scaling@coordmath@final{pgfbasic}%
+ },
/pgfplots/compat/scaling/1.3/.style={/pgfplots/compat/scaling/pre 1.3},
/pgfplots/compat/scaling/1.4/.code={%
\def\pgfplots@compat@scaling@zunitfix@enable{1}%
- \def\pgfplots@compat@scaling@coordmath{float}},
+ \def\pgfplots@compat@scaling@coordmath{float}%
+ \def\pgfplots@compat@scaling@coordmath@final{pgfbasic}%
+ },
/pgfplots/compat/scaling/1.5/.style={/pgfplots/compat/scaling/1.4},
/pgfplots/compat/scaling/1.5.1/.style={/pgfplots/compat/scaling/1.4},
- /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.4},
+ /pgfplots/compat/scaling/1.6/.code={%
+ \def\pgfplots@compat@scaling@zunitfix@enable{1}%
+ \def\pgfplots@compat@scaling@coordmath{float}%
+ \def\pgfplots@compat@scaling@coordmath@final{float}%
+ },
+ /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.6},
/pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4},
%
+ /pgfplots/compat/scale mode/.is choice,
+ /pgfplots/compat/scale mode/pre 1.3/.code=\def\pgfplots@compat@scale@mode@compatible@mode{1},%
+ /pgfplots/compat/scale mode/1.3/.style= {/pgfplots/compat/scale mode/pre 1.3},
+ /pgfplots/compat/scale mode/1.4/.style= {/pgfplots/compat/scale mode/pre 1.3},
+ /pgfplots/compat/scale mode/1.5/.style= {/pgfplots/compat/scale mode/pre 1.3},
+ /pgfplots/compat/scale mode/1.5.1/.style= {/pgfplots/compat/scale mode/pre 1.3},
+ /pgfplots/compat/scale mode/1.6/.code=\def\pgfplots@compat@scale@mode@compatible@mode{0},
+ /pgfplots/compat/scale mode/newest/.style={/pgfplots/compat/scale mode/1.6},
+ /pgfplots/compat/scale mode/default/.style={/pgfplots/compat/scale mode/1.5},
+ %
+ %
+ /pgfplots/compat/plot3graphics/.is choice,
+ /pgfplots/compat/plot3graphics/pre 1.3/.style= {/pgfplots/compat/plot3graphics/1.5},
+ /pgfplots/compat/plot3graphics/1.3/.style= {/pgfplots/compat/plot3graphics/1.5},
+ /pgfplots/compat/plot3graphics/1.4/.style= {/pgfplots/compat/plot3graphics/1.5},%
+ /pgfplots/compat/plot3graphics/1.5/.code= {\def\b@pgfplots@compat@plot@graphics@threedim{1}},%
+ /pgfplots/compat/plot3graphics/1.5.1/.style= {/pgfplots/compat/plot3graphics/1.5},%
+ /pgfplots/compat/plot3graphics/1.6/.code= {\def\b@pgfplots@compat@plot@graphics@threedim{2}},%
+ /pgfplots/compat/plot3graphics/newest/.style= {/pgfplots/compat/plot3graphics/1.6},%
+ /pgfplots/compat/plot3graphics/default/.style= {/pgfplots/compat/plot3graphics/1.5},%
+ %
+ % ATTENTION: there is a compatibility issue which slipped through
+ % the quality assurance: if tick labels where generated in scientific notation
+ % (NOT log tick labels; these are special), and the numbers were
+ % negative, the spacing changed as follows:
+ % pre 1.3: - 1*10^5 (binary minus sign)
+ % 1.3: - 1*10^5 (binary minus sign)
+ % 1.4: - 1*10^5 (binary minus sign)
+ % 1.5: -1*10^5 (unary minus sign - correct!)
+ % 1.6: -1*10^5 (unary minus sign - correct!)
+ % This is (was) a bug in the PGF number printer which has been
+ % fixed in the meantime; it occurred only if
+ % $\pgfmathprintnumber{-1e5}$ was used (i.e. with the '$' signs).
+ % Unfortunately, version 1.5 has been released without realizing
+ % the changes; I detected them right before the release of 1.6.
+ % Consequently, I cannot introduce compatibity switches without
+ % loosing compatibility.
+ %
+ % I chose to keep the correct unary minus sign. If you ever want
+ % to revert to the old version in order to keep spacing intact, use
+ %
+ % \pgfkeys{/pgf/compat/number printer=2.10}
+ %
+ % Risk: the size of such tick labels changed and the
+ % figure has been moved somewhat.
+ %
+ % Sorry.
+ %
+ %
/pgfplots/compat/general/.is choice,
/pgfplots/compat/general/pre 1.3/.style={/pgfplots/log origin=infty},%
- /pgfplots/compat/general/1.3/.style={/pgfplots/compat/general/pre 1.3},
- /pgfplots/compat/general/1.4/.style={/pgfplots/compat/general/pre 1.3},%
- /pgfplots/compat/general/1.5/.style={/pgfplots/compat/general/newest},%
- /pgfplots/compat/general/1.5.1/.style={/pgfplots/compat/general/newest},%
- /pgfplots/compat/general/newest/.style={/pgfplots/log origin=0},
+ /pgfplots/compat/general/1.3/.style= {/pgfplots/compat/general/pre 1.3},
+ /pgfplots/compat/general/1.4/.style= {/pgfplots/compat/general/pre 1.3},%
+ /pgfplots/compat/general/1.5/.style= {/pgfplots/compat/general/newest},%
+ /pgfplots/compat/general/1.5.1/.style= {/pgfplots/compat/general/newest},%
+ /pgfplots/compat/general/1.6/.style= {/pgfplots/compat/general/newest},%
+ /pgfplots/compat/general/newest/.style= {/pgfplots/log origin=0},
/pgfplots/compat/general/default/.style={/pgfplots/compat/general/newest},
+ %
+ /pgfplots/compat/show suggested version/.is if=pgfplots@show@suggested@version,
+ /pgfplots/compat/show suggested version=true,
+ /pgfplots/compat/current/.initial=,
+ /pgfplots/compat/mostrecent/.initial=1.6,
/pgfplots/compat/.style={%
% ATTENTION: *every* /pgfplots/compat/ setting needs to accept
% the same choices due to this construction:
+ /pgfplots/compat/current=#1,% remember the value
/pgfplots/compat/anchors=#1,%
/pgfplots/compat/labels=#1,%
/pgfplots/compat/empty line=#1,%
/pgfplots/compat/scaling=#1,%
+ /pgfplots/compat/scale mode=#1,%
/pgfplots/compat/general=#1,%
/pgfplots/compat/path replacement=#1,%
+ /pgfplots/compat/plot3graphics=#1,%
},%
/pgfplots/compat/.default=pre 1.3,% this is used if you type '\pgfplotsset{compat}' without value
/pgfplots/compat=default,% this is the initial config.
@@ -3454,6 +3664,22 @@
\pgfplots@error{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}%
}
+% #1: axis (x, y, or z)
+% #2: display name of context information
+\def\pgfplots@warn@if@log@basis@unset#1#2{%
+ \pgfplots@if{pgfplots@#1islinear}{%
+ }{%
+ \pgfplots@warn@if@log@basis@unset@{#1}{#2}%
+ }%
+}%
+\def\pgfplots@warn@if@log@basis@unset@#1#2{%
+ \pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \pgfplots@warning{Some input argument (#2) explicitly relies on the log basis of #1 (which is e). Please verify that this is intended and set 'log basis #1=10' otherwise. This warning will be shown only once per document.}%
+ \fi
+ \gdef\pgfplots@warn@if@log@basis@unset##1##2{}%
+}%
+
% #1 axis (x or y)
% #2 the label
@@ -3751,19 +3977,37 @@
\axispath\path#1;%
}
\def\pgfplots@replacement@for@scope{\pgfutil@ifnextchar[{\pgfplots@replacement@for@scope@}{\pgfplots@replacement@for@scope@[]}}%
-\def\pgfplots@replacement@for@scope@[#1]{%
+\long\def\pgfplots@replacement@for@scope@[#1]{%
\pgfplotsextra{\scope[#1]}%
\begingroup
% I need to apply anything which might be relevant for \addplot
% here.
% But I do NOT want \scope since this might already affect the low
- % level output. Try this:
+ % level output.
+ %
+ % This here works:
+ % 1. set them to activate plot handlers and parameters like
+ % samples and domain:
\tikzset{#1}%
+ %
+ % 2. we need to remember all these options inside of
+ % 'current plot style' -- otherwise, they would not appear
+ % inside of legend images and markers.
+ \pgfplotsplothandlersurveyaddoptions{#1}%
}%
\def\pgfplots@replacement@for@endscope{%
\endgroup
- \pgfplotsextra\endscope%
+ \pgfplotsextra{\endscope}%
+}%
+
+\def\pgfplots@replacement@for@onlayer#1{%
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplots@replacement@for@onlayer@{#1}%
+}
+\def\pgfplots@replacement@for@onlayer@#1{%
+ \pgfplotsextra{\pgfonlayer{#1}}%
}%
+\def\pgfplots@replacement@for@endonlayer{\pgfplotsextra{\endpgfonlayer}}%
{
% A block which handles active semicolons.
@@ -3885,7 +4129,15 @@
% before.
%
% In contrast to \path, \pgfplotsextra can contain any command(s).
-\let\pgfplotsextra=\pgfplots@path@enqueue
+%
+% Syntax: either
+% \pgfplotsextra{<argument>}
+% or
+% \pgfplotsextra <argument> \endpgfplotsextra
+\def\pgfplotsextra{%
+ \pgfutil@ifnextchar\bgroup{\pgfplots@path@enqueue}{\pgfplotsextra@}%
+}%
+\long\def\pgfplotsextra@#1\endpgfplotsextra{\pgfplots@path@enqueue{#1}}%
% Assigns a legend.
@@ -4099,6 +4351,10 @@
% settings like stroke colors or the-like.
\def\pgfplots@restore@state@before@legend@style{%
\pgfsetfillcolor{black}%
+ % disable the transformations of pgfplots. This is only used by
+ % pgfplots-specific plot handlers which work only if used inside
+ % of an axis... disable it.
+ \def\pgfplotsaxisvisphasetransformcoordinate##1##2##3{}%
}%
\def\pgfplots@split@opts{%
@@ -4284,10 +4540,12 @@
\let\pgfplots@already@computed@legend@node=\pgfplots@glob@TMPa
\fi
\fi
-%\message{Vor legende: \meaning\pgfplots@already@computed@legend@node^^J}%
\ifx\pgfplots@createlegend@toname\pgfutil@empty
% DRAW:
+ \pgfplotsgetlayerforstyle{every axis legend}%
+ \pgfplotsonlayer\pgfplotsretval{legend style}%
\pgfplots@already@computed@legend@node
+ \endpgfplotsonlayer
\else
% apply the 'legend to name' feature:
%
@@ -4590,202 +4848,24 @@
}
-% helper for \pgfplots@check@and@apply@datatrafo@for.
-\def\pgfplots@compute@number@order@for@trafo@isdimen#1\tocount#2{%
- \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{#1}}%
- \pgfmathfloatparsenumber{\pgfplots@loc@TMPa}%
- \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2
- \advance#2 by1\relax
-}
-
-% helper for \pgfplots@check@and@apply@datatrafo@for.
-%
-\def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{%
- \pgfmathfloatparsenumber{#1}%
- \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2\relax
- \advance#2 by1\relax
-}
-
% Initialises the data scale transformation and applies it to any
% user specified options.
%
% PRECONDITION:
-% - all axis limits are available in float representation
+% - all axis limits are already transformed
% - \pgfplots@set@default@size@options has been called before
+% - the scaling transformation for direction x is set up
+% (\pgfplots@set@optimal@datatrafo@for@),
% POSTCONDITION:
-% - the scaling transformation is set up,
-% - all axis limits are transformed,
% - any user input (like ticks and tick labels)
% EXCEPT unit vectors will reflect the changes.
%
% Unit vectors will be scaled later.
+% @see \pgfplots@apply@datatrafo@to@axis@limits
\def\pgfplots@check@and@apply@datatrafo@for#1{%
\pgfplots@if{pgfplots@apply@datatrafo@#1}{%
- \pgfplots@letcsname pgfplots@#1min@unscaled@as@float={pgfplots@#1min}%
- \pgfplots@letcsname pgfplots@#1max@unscaled@as@float={pgfplots@#1max}%
- % initialise data scale transformation
- % T(x) = 10^{q-m} * x
- %
- \ifpgfplots@disabledatascaling
- % this here is a waste of time, I know it. One could really
- % safe a lot of CPU time when disabledatascaling is enabled...
- % but it requires so much extra cases; I really don't want
- % that!
- \gdef\pgfplots@glob@TMPa{0}%
- \gdef\pgfplots@glob@TMPb{0}%
- \else
- \begingroup
- \let\data@max@order=\c@pgf@counta
- \let\data@cur@order=\c@pgf@countb
- \let\data@dimen=\pgf@xa
- \let\data@tmp=\pgf@xb
- \let\data@dimen@order=\c@pgf@countc
- \let\data@EXPONENT=\c@pgf@countd
- \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname
- \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname
- \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname
- \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname
- \ifpgfplots@autocompute@all@limits
- \else
- \pgfplotscoordmath{#1}{max}{\pgfplots@display@max@float}{\pgfplots@data@max@float}%
- \let\pgfplots@data@max@float=\pgfmathresult
- \pgfplotscoordmath{#1}{min}{\pgfplots@display@min@float}{\pgfplots@data@min@float}%
- \let\pgfplots@data@min@float=\pgfmathresult
- \fi
- %
-%\message{minmax = [\pgfplots@data@min@float,\pgfplots@data@max@float]}%
- % Step 1: compute 'm', the data order
- \pgfplots@compute@number@order@for@trafo@isfloat
- \pgfplots@data@min@float
- \tocount\data@cur@order
- %
- \data@max@order=\data@cur@order
- %
- \pgfplots@compute@number@order@for@trafo@isfloat
- \pgfplots@data@max@float
- \tocount\data@cur@order
- %
- \ifnum\data@cur@order>\data@max@order
- \data@max@order=\data@cur@order
- \fi
- %
- % Step 2: compute 'q', the #1-size of the axis.
- %\expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty
- % We have 'width' or 'height' (I always have them).
- %
- % Use the order of these parameters.
- \def\pgfplots@loc@TMPa{#1}%
- \def\pgfplots@loc@TMPb{x}%
- \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
- \data@dimen=\pgfplots@width\relax
- \else
- \if1\pgfplots@compat@scaling@zunitfix@enable
- \data@dimen=\pgfplots@height\relax
- \else
- % this code here belongs to versions up to
- % 1.3.1.
- % It is now deprecated and produces small
- % pixel differences.
- \def\pgfplots@loc@TMPb{y}%
- \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
- \data@dimen=\pgfplots@height\relax
- \else
- \data@dimen=42pt % this is actually different from 1.3.1: there, it was UNDEFINED.
- \fi
- \fi
- \fi
- \pgfplots@compute@number@order@for@trafo@isdimen
- \data@dimen
- \tocount\data@dimen@order
- % This here is to avoid inaccuracies in the final
- % axis rectangle size, see \pgfplots@initsizes:
- %\advance\data@dimen@order by-1
- %\else
- % FIXME:
- % we have either the 'x=1cm' or 'y=1cm' option!
- % How should I initialise the trafo!?
- % \data@dimen@order=3
- %\fi
- %
-%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }%
- \data@EXPONENT=\data@dimen@order
- \advance\data@EXPONENT by-\data@max@order
- % Now, I introduce a loop which shall avoid cancellation of
- % significant digits.
- %
- % Harmless Example:
- % if we have data shift = -3 and
- % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok.
- % In this case, the loop won't change anything.
- %
- % Critical Example:
- % if we have data shift = -3 and
- % max = 1980, min = 1930 then
- % T(max) = 1.98 and T(min) = 1.93
- % and thus T(max)-T(min) = 0.05 .
- % Considering that this is the axis range
- % in which tick labels and plot points need to be computed, we
- % only have two or three digits left! That happens because the
- % prefix '19' is common and is cancelled in the subtraction.
- % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1
- % (and make sure that T(max) < MAX_VALID_TEX_NUMBER).
- %
- \def\pgfplotscoordmathnotifydatascalesetfor##1{}% disable temporarily. We are just testing it.
- \pgfplots@loop@CONTINUEtrue
- \pgfutil@loop
- \pgfplotscoordmath{#1}{datascaletrafo set params}{\the\data@EXPONENT}{0}%
- \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@min@float}%
- \let\pgfplots@min@fixed=\pgfmathresult
- \ifpgfplots@loop@CONTINUE
- \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@max@float}%
- \let\pgfplots@max@fixed=\pgfmathresult
- \data@tmp=\pgfplots@max@fixed pt
-%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}%
- \ifdim\data@tmp<0pt
- % I need absolute values here:
- \multiply\data@tmp by-1\relax
- \fi
- \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}%
- \data@dimen=\pgfmathresult pt
- \pgfplots@loop@CONTINUEfalse
- \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit.
- \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy
- \ifdim\data@dimen<0.0001pt
- \else
- \advance\data@EXPONENT by1
- \pgfplots@loop@CONTINUEtrue
- \fi
- \fi
- \fi
- %--------------------------------------------------
- % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT!
- % \ifdim\data@dimen>7999pt
- % \advance\data@EXPONENT by-2
- % \else
- % \advance\data@EXPONENT by-1
- % \fi
- % \pgfplots@loop@CONTINUEfalse
- % \fi
- %--------------------------------------------------
- \pgfutil@repeat
- \xdef\pgfplots@glob@TMPa{\the\data@EXPONENT}%
- \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}%
- \endgroup
- \fi
- % COMPLETE INITIALISATION:
-%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}%
- \pgfplotscoordmath{#1}{datascaletrafo set params}{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}%
+ % Transform axis limits: ALREADY DONE.
%
- % ... and apply transformation to any user input
- %
- % Transform axis limits:
-%\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}%
- \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1min\endcsname}%
- \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
- %
- \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1max\endcsname}%
- \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult
-%\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}%
% Transform tick limits (if they are set):
%\message{#1- display tick limits BEFORE data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}%
\expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty
@@ -4849,11 +4929,9 @@
\pgfkeyslet{/pgfplots/minor #1tick}\pgfplots@loc@TMPc
\fi
%
- % Transform any explicit axis unit scalings:
- % WILL BE DONE LATER!
+ % Transform any explicit axis unit scalings: ALREADY DONE
}{%
% case apply trafo == false:
- \pgfplotscoordmath{#1}{datascaletrafo set params}{0}{0}%
\def\pgfplots@loc@TMPb{data}%
\expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfplots@loc@TMPb
\edef\pgfplots@loc@TMPa{\csname pgfplots@firstplot@coords@#1\endcsname}%
@@ -4870,8 +4948,6 @@
\pgfkeyslet{/pgfplots/minor #1tick}\pgfplotsretval
\fi
\fi
- \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfutil@empty
- \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfutil@empty
}%
}
@@ -5005,15 +5081,18 @@
\pgfplotsthreedimfalse
\fi
%
- \pgfplots@check@and@apply@datatrafo@for x%
- \pgfplots@check@and@apply@datatrafo@for y%
+ \pgfplots@set@optimal@datatrafos@allaxes
+ %
+ % Now, the data scaling has been set up.
+ % However, it may need to be changed if axis equal and/or unit
+ % vector ratio changes the axis limits considerably. If so, it
+ % will be done in \pgfplots@initsizes
+ \pgfplots@apply@datatrafo@to@axis@limits x%
+ \pgfplots@apply@datatrafo@to@axis@limits y%
\ifpgfplots@threedim
- \pgfplots@check@and@apply@datatrafo@for z%
+ \pgfplots@apply@datatrafo@to@axis@limits z%
\fi
- % clear structure:
- \global\let\pgfplots@firstplot@coords@x=\pgfutil@empty
- \global\let\pgfplots@firstplot@coords@y=\pgfutil@empty
- \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty
+ %
\pgfplots@datascaletrafo@initialisedtrue
%\message{transformed: x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax].}%
%
@@ -5032,6 +5111,16 @@
%
\pgfplots@initsizes
%
+ \pgfplots@check@and@apply@datatrafo@for x%
+ \pgfplots@check@and@apply@datatrafo@for y%
+ \ifpgfplots@threedim
+ \pgfplots@check@and@apply@datatrafo@for z%
+ \fi
+ % clear structure:
+ \global\let\pgfplots@firstplot@coords@x=\pgfutil@empty
+ \global\let\pgfplots@firstplot@coords@y=\pgfutil@empty
+ \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty
+ %
\pgfplots@limits@ready
\pgfplotspoint@initialisation
%
@@ -5166,100 +5255,6 @@
\pgfkeyslet{/pgfplots/#1#2}\pgfmathresult
}%
-% Defines \pgfmathresult to be the desired width without axis labels.
-%
-\def\pgfplots@initsizes@get@width@withoutlabels{%
- \pgfplots@initsizes@handle@label@const{\pgfplots@width}{45pt}{width}%
-}
-
-% Defines \pgfmathresult to be the desired height without axis labels.
-\def\pgfplots@initsizes@get@height@withoutlabels{%
- \pgfplots@initsizes@handle@label@const{\pgfplots@height}{45pt}{height}%
-}
-\def\pgfplots@initsizes@handle@label@const#1#2#3{%
- \begingroup
- \pgf@xa=#1\relax
- % EXPECTED WIDTH = X = \pgfplots@width
- % ACTUAL WIDTH = c + x * (xmax-xmin)
- % where c is a CONSTANT (for the axis labels/tick labels).
- % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin))
- %
- % \pgf@xa := X-c:
- \ifpgfplots@scale@only@axis
- \else
- \advance\pgf@xa by-#2 % FIXME determine 'c' correctly!
- \fi
- \ifdim\pgf@xa<0pt
- \pgfplots@error{Error: Plot #3 `#1' is too small. This can't be realised while maintaining constant size for labels. Sorry, label sizes are only approximate. You will need to adjust your #3.}%
- \pgf@xa=0pt
- \fi
- \edef\pgfmathresult{\the\pgf@xa}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
-}%
-
-% Helper method for initsizes.
-%
-% It computes a scaling such that \pgfplots@width = SCALE * ACTUAL WIDTH.
-%
-% The actual width is
-% c + x*(xmax-xmin)
-% based on
-% - c = estimated, a constant for the axis label/tick labels
-%
-% Arguments:
-% #1: is expected to be x*(xmax-xmin) measured in pt.
-% #2: the output argument for the SCALE.
-\def\pgfplots@initsizes@getXscale#1\into#2{%
- \begingroup
- \pgfplots@initsizes@get@width@withoutlabels
- % EXPECTED WIDTH = X = \pgfplots@width
- % ACTUAL WIDTH = c + x * (xmax-xmin)
- % where c is a CONSTANT (for the axis labels/tick labels).
- % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin))
- %
- % \pgf@xa := X-c:
- % \pgf@xb := x*(xmax-xmin):
- \pgf@xa=\pgfmathresult\relax
- \pgf@xb=#1\relax
- \pgfmathlog@invoke@expanded\pgfmathdivide@{%
- {\pgf@sys@tonumber\pgf@xa}%
- {\pgf@sys@tonumber\pgf@xb}%
- }%
-%--------------------------------------------------
-% \message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)';
-% c=estimated,
-% width-c =\the\pgf@xa,
-% x*(xmax - xmin)]) = \the\pgf@xb
-% -> x-scale =\pgfmathresult }%
-%--------------------------------------------------
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
- \let#2=\pgfmathresult
-}
-
-% The same as \pgfplots@initsizes@getXscale, just for the height.
-\def\pgfplots@initsizes@getYscale#1\into#2{%
- \begingroup
- \pgfplots@initsizes@get@height@withoutlabels
- % \pgf@xb := y*(ymax-ymin):
- \pgf@xa=\pgfmathresult\relax
- \pgf@xb=#1%
- \pgfmathlog@invoke@expanded\pgfmathdivide@{%
- {\pgf@sys@tonumber\pgf@xa}%
- {\pgf@sys@tonumber\pgf@xb}%
- }%
-%\pgfplots@message{pgfplots.sty: Computing 'y' such that 'height = c + y*(ymax-ymin)';
-% height=\pgfplots@height,
-% c=estimated,
-% height-c =\the\pgf@xa,
-% y*(ymax[=\the\pgfplots@ycoordmaxTEX] - ymin[=\the\pgfplots@ycoordminTEX)]) = \the\pgf@xb
-% -> y-scale =#2 }%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
- \let#2=\pgfmathresult
-}
-
\newif\ifpgfplots@avoid@emptyrange@@range@is@approx@equal
% Checks whether axis limits in coordinate #1 are approximately equal.
@@ -5295,7 +5290,13 @@
\fi
\fi
\ifpgfplots@avoid@emptyrange@@range@is@approx@equal
- \pgfplots@warning{Axis range for axis #1 is approximately empty; enlarging it.}%
+ \begingroup
+ \pgfplotscoordmath{#1}{datascaletrafo inverse to fixed}{\csname pgfplots@#1min\endcsname}%
+ \let\pgfplots@min=\pgfmathresult
+ \pgfplotscoordmath{#1}{datascaletrafo inverse to fixed}{\csname pgfplots@#1max\endcsname}%
+ \let\pgfplots@max=\pgfmathresult
+ \pgfplots@warning{Axis range for axis #1 is approximately empty; enlarging it (it is [\pgfplots@min:\pgfplots@max])}%
+ \endgroup
% the case \pgfplots@@min ~= \pgfplots@@max
%
% enlarge \pgfplots@@max and shrink \min:
@@ -5389,756 +5390,6 @@
\expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb
}
-% PRECONDITION:
-% none
-% POSTCONDITION:
-% \pgfplots@default@aspect@ratio is set.
-\def\pgfplots@compute@default@aspect@ratio{%
- \expandafter\pgfmath@x\axisdefaultwidth
- \expandafter\pgfmath@y\axisdefaultheight
- \pgfmathlog@invoke@expanded\pgfmathdivide@{%
- {\pgf@sys@tonumber{\pgfmath@x}}%
- {\pgf@sys@tonumber{\pgfmath@y}}%
- }%
- \let\pgfplots@default@aspect@ratio=\pgfmathresult
-}
-
-\def\pgfplots@set@default@size@options{%
- % The axes 'x' and 'y' vectors will be scaled such that the total
- % size is (\axisdefaultwidth, \axisdefaultheight).
- %
- % If the user specifies ONE of width OR height,
- % the plot will be resized; keeping the aspect ratio.
- %
- \let\pgfplots@default@aspect@ratio=\pgfutil@empty
- \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}%
- \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}%
- \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}%
- %\pgfkeysgetvalue{/pgfplots/viewdir}{\pgfplots@viewdir}%
- \pgfkeysgetvalue{/pgfplots/width}{\pgfplots@width}%
- \pgfkeysgetvalue{/pgfplots/height}{\pgfplots@height}%
- \ifx\pgfplots@width\pgfutil@empty
- \def\pgfplots@user@provided@width{0}%
- \else
- \def\pgfplots@user@provided@width{1}%
- \pgfmathparse{\pgfplots@width}%
- \edef\pgfplots@width{\pgfmathresult pt}%
- \fi
- \ifx\pgfplots@height\pgfutil@empty
- \def\pgfplots@user@provided@height{0}%
- \else
- \def\pgfplots@user@provided@height{1}%
- \pgfmathparse{\pgfplots@height}%
- \edef\pgfplots@height{\pgfmathresult pt}%
- \fi
- %
- % CASES:
- % W := 'width' option non-empty
- % H := 'height' option non-empty
- %
- % W H
- % 0 0 -> \axisdefaultwidth
- % 0 1 -> determine width out of H and the default aspect ratio
- % 1 X -> ok, use the user parameter.
- % -> KEEP ASPECT RATIO if just one W, or H is given!
- \ifx\pgfplots@width\pgfutil@empty
- \ifx\pgfplots@height\pgfutil@empty
- % The case W=0 H=0:
- \let\pgfplots@width=\axisdefaultwidth
- \let\pgfplots@height=\axisdefaultheight
- \else
- % The case W=0 H=1:
- \pgfplots@compute@default@aspect@ratio
- \expandafter\pgfmath@y\pgfplots@height
- \pgfmathlog@invoke@expanded\pgfmathmultiply@{%
- {\pgf@sys@tonumber{\pgfmath@y}}%
- {\pgfplots@default@aspect@ratio}%
- }%
- \edef\pgfplots@width{\pgfmathresult pt}%
- \fi
- \else
- \ifx\pgfplots@height\pgfutil@empty
- % The case W=1 H=0:
- \pgfplots@compute@default@aspect@ratio
- \expandafter\pgfmath@x\pgfplots@width
- \pgfmathlog@invoke@expanded\pgfmathdivide@{%
- {\pgf@sys@tonumber{\pgfmath@x}}%
- {\pgfplots@default@aspect@ratio}%
- }%
- \edef\pgfplots@height{\pgfmathresult pt}%
- \else
- % The case W=1 H=1:
- \fi
- \fi
- \pgfkeyslet{/pgfplots/width}{\pgfplots@width}%
- \pgfkeyslet{/pgfplots/height}{\pgfplots@height}%
- %
- \ifpgfplots@threedim
- \pgfplots@set@default@size@options@threedim
- \fi
-}
-\def\pgfplots@set@default@size@options@threedim{%
- \pgfplots@loc@tmpfalse
- \ifx\pgfplots@x\pgfutil@empty
- \else
- \pgfplots@loc@tmptrue
- \fi
- \ifx\pgfplots@y\pgfutil@empty
- \else
- \pgfplots@loc@tmptrue
- \fi
- \ifx\pgfplots@z\pgfutil@empty
- \else
- \pgfplots@loc@tmptrue
- \fi
- \ifpgfplots@loc@tmp
- % oh - we have at least one of the [xyz] unit vectors!
- % make sure all of them are there
- \ifx\pgfplots@x\pgfutil@empty
- \pgfplots@set@default@size@options@threedim@{x}{(1pt,0pt)}%
- \fi
- \ifx\pgfplots@y\pgfutil@empty
- \pgfplots@set@default@size@options@threedim@{y}{(0pt,1pt)}%
- \fi
- \ifx\pgfplots@z\pgfutil@empty
- \pgfplots@set@default@size@options@threedim@{z}{(0pt,1pt)}%
- \fi
- \pgfkeyslet{/pgfplots/view/az}\pgfutil@empty
- \pgfkeyslet{/pgfplots/view/el}\pgfutil@empty
- \fi
-}
-\def\pgfplots@set@default@size@options@threedim@#1#2{%
- \pgfplots@error{Sorry, a 3D axis needs either NONE or ALL of "x,y,z". I found partial information, but (at least) '#1' is lacking... please add '#1'}%
- \expandafter\def\csname pgfplots@#1\endcsname{#2}%
-}
-
-% A helper method for \pgfplots@initsizes which
-% - applies the data scaling trafo to user arguments
-% - sets calls pgfset#1vec
-% - computes \pgfplots@#1@veclength
-% - computes \pgfplots@#1@inverseveclength
-%
-% #1: the vector to set (either 'x' or 'y')
-% #2: the index of the vector to set (either 0 or 1)
-% #3: the already precomputed temporary scale (see pgfplots@initsizes)
-% #4: an output argument. It is a macro name which will be defined to
-% '1' if and only if the finally set vector is parallel to the #1 axis
-% of PGF, that means (x,0) for #1=x and (0,y) for #2=y.
-\def\pgfplots@initsizes@setunitvector#1#2#3#4{%
- \pgfkeysgetvalue{/pgfplots/#1 dir/value}\pgfplots@loc@dirvalue
- \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@#1\endcsname
- \ifx\pgfplots@loc@TMPb\pgfutil@empty
- \def#4{1}% we have (#1,0) or (0,#1)
- %
-%\message{Setting unitvector(#1) to auto-computed multiple of e_#2 ...}%
- \edef\pgfplots@loc@TMPa{#3}%
- \if r\pgfplots@loc@dirvalue
- \edef\pgfplots@loc@TMPa{-#3}%
- \fi
- \begingroup
- \pgf@xa=#3\relax
- \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}%
- \endgroup
-% FIXME : '\pgfplots@loc@TMPa' contains 'pt' leading to missing
-% character warning!
- \ifcase#2\relax
- \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPa}{0pt}}%
- \pgfmathabs@{\pgfplots@glob@TMPb}%
- \or
- \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPa}}%
- \pgfmathabs@{\pgfplots@glob@TMPb}%
- \or
- \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}}%
- \ifdim\pgfplots@loc@TMPa=0pt
- \def\pgfmathresult{0}%
- \else
- \edef\pgf@marshal{%
- {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}%
- {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}%
- }%
- \expandafter\pgfmathveclen\pgf@marshal
- \fi
- \fi
- % The numbers 1/||e_x|| and 1/||e_y|| are used by the tick
- % placement code to convert between logical and physical
- % coordinates.
- \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult
- \pgfplotsmath@ifzero{\pgfmathresult}{%
- \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}%
- }{%
- \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}%
- \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult
- }%
- \else
- % Ok, we have a user-defined unit vector.
- %
- % That means we also need to apply the scaling trafo!
- %
- \if r\pgfplots@loc@dirvalue
- \def\pgfplots@loc@dirvalue{-}%
- \else
- \def\pgfplots@loc@dirvalue{}%
- \fi
- %
- % 1. Check whether we have a complete vector of type (x,y):
- \expandafter\pgfutil@in@\expandafter(\expandafter{\pgfplots@loc@TMPb}%
- \ifpgfutil@in@
- % YES: we have (x,y):
- %
- \def#4{0}% we DON'T have (#1,0) or (0,#1). At least I think so.
- %
-%\message{Setting unitvector(#1) to non-standard \csname pgfplots@#1\endcsname ...}%
- \def\pgfplots@loc@TMPa(##1,##2){%
- \pgfplotscoordmath{default}{parse}{##1}%
- \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \pgfplotscoordmath{default}{parse}{##2}%
- \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
- \let\pgfplots@loc@TMPc=\pgfmathresult
- %
- \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
- \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPb}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPc}%
- \let\pgfplots@loc@TMPc=\pgfmathresult
- }{}%
- \csname pgfset#1vec\endcsname{%
- \pgfqpoint
- {\pgfplots@loc@dirvalue\pgfplots@loc@TMPb pt}
- {\pgfplots@loc@dirvalue\pgfplots@loc@TMPc pt}}%
- }%
- \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb%
- %
- \edef\pgf@marshal{%
- {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}%
- {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}%
- }%
- \expandafter\pgfmath@basic@veclen@\pgf@marshal
- %
- \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult
- \pgfplotsmath@ifzero{\pgfmathresult}{%
- \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}%
- }{%
- \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
- \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult
- }%
- \else
- % NO we simply have a scalar value.
- \def#4{1}% we have (#1,0) or (0,#1)
-%\message{Setting unitvector(#1) to \csname pgfplots@#1\endcsname * e_{#2}...}%
- \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
- \pgfplotscoordmath{default}{parse}{\csname pgfplots@#1\endcsname}%
- \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
- \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfmathresult}%
- \edef\pgfplots@loc@TMPb{\pgfmathresult pt}%
- }{\relax}%
- \begingroup
- \pgf@xa=\pgfplots@loc@TMPb\relax
- \if r\pgfplots@loc@dirvalue
- \multiply\pgf@xa by-1
- \fi
- \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}%
- \endgroup
- \ifcase#2\relax
- \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}%
- \pgfmath@basic@abs@{\pgfplots@glob@TMPb}%
- \or
- \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPb}}%
- \pgfmath@basic@abs@{\pgfplots@glob@TMPb}%
- \or
- \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}%
- \ifdim\pgfplots@loc@TMPb=0pt
- \def\pgfmathresult{0}%
- \else
- \edef\pgf@marshal{%
- {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}%
- {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}%
- }%
- \expandafter\pgfmath@basic@veclen@\pgf@marshal
- \fi
- \fi
- \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult
- \pgfplotsmath@ifzero{\pgfmathresult}{%
- \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}%
- }{%
- \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
- \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult
- }%
- \fi
- \fi
-%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).^^J}%
-}%
-
-% Applies the 'axis equal' feature.
-%
-% PRECONDITION:
-% - final unit vectors have been set
-% - final axis limits are given in transformed range
-% - \pgfplots@set@default@size@options has been invoked before
-%
-% POSTCONDITION:
-% - unit vectors have been set to equal length,
-% - axis limits have been rescaled such that the axis dimensions
-% remain fixed
-%
-% There is just one algorithmic difficulty: the data scaling
-% transformation. All unit vector length above are only meaningful in
-% the UNTRANSFORMED range, so we have to mingle with the scaling
-% transformation.
-\def\pgfplots@apply@unit@ratio{%
- \pgfkeysgetvalue{/pgfplots/unit vector ratio}\pgfplots@unit@vector@ratio
- \ifx\pgfplots@unit@vector@ratio\pgfutil@empty
- \else
- \edef\pgfplots@unit@vector@ratio{\pgfplots@unit@vector@ratio\space1 1 }%
- %
- % Step 1: compute the unit vector which STAYS CONSTANT.
- %
- \pgfkeysgetvalue{/pgfplots/unit vector ratio axis}\pgfplots@apply@unit@ratio@reference
- \ifx\pgfplots@apply@unit@ratio@reference\pgfutil@empty
- \pgfplots@apply@unit@ratio@find@reference%
- \fi
- %
- % FIXME : I could spent some attention here to save work:
- % both, unit ratios and the resulting scales are computed at
- % least twice (once in \pgfplots@apply@unit@ratio@find@reference and once in the
- % following).
- \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI
- %
-%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@apply@unit@ratio@reference; ratio \pgfplots@unit@ratio@x\space \pgfplots@unit@ratio@y\space \pgfplots@unit@ratio@z.^^J}%
- %
- % Step 2: apply the scaling:
- \pgfplots@rescale@unit@vector@reltoreference{x}{\pgfplots@unit@ratio@x}%
- \pgfplots@rescale@unit@vector@reltoreference{y}{\pgfplots@unit@ratio@y}%
- \ifpgfplots@threedim
- \pgfplots@rescale@unit@vector@reltoreference{z}{\pgfplots@unit@ratio@z}%
- \fi
- \fi
-}%
-
-% This macro determines the reference axis for unit vector rescaling.
-% The reference axis remains unscaled (it gets scaling factor 1 if you
-% want it this way).
-%
-% The other axes are scaled such that the desired unit vector ratios
-% are fulfilled.
-%
-% The idea to select a reference axis is as follows:
-% 1. Every unit vector scaling factor s should fulfill s <= 1.
-% 2. Choose the reference axis such that the minimal amount of scaling
-% is performed.
-%
-% The motivation for (1) is: if all involved scaling factors are at
-% most 1, the resulting picture will only become *smaller*.
-% Consequently, we can simply enlarge axis limits to restore the
-% original width/height!
-%
-% The motivation for (2) is: a huge amount of scaling might reduce the
-% size of the image too much. Of course, the figure will be enlarged
-% to fit the original width/height, but most of it will be empty. So,
-% use the smallest scaling.
-%
-% @POSTCONDITION The reference axis is stored in
-% \pgfplots@apply@unit@ratio@reference .
-%
-% @see the key 'unit vector ratio axis=y' which allows to manually
-% select the reference axis. This will illustrate what happens here.
-\def\pgfplots@apply@unit@ratio@find@reference{%
- %
- \begingroup
- \let\pgfplots@ONE=\pgf@x
- \global\pgfplots@ONE=1.002pt
- %
- \def\pgfplots@optimum@sofar@axis{}%
- \let\pgfplots@optimum@sofar@value=\pgf@y
- \global\pgfplots@optimum@sofar@value=16000pt
- %
- %\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits
- %
- \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty
- % set \pgfplots@loc@TMPa := 1 if and only if the axis is 3d
- \def\pgfplots@loc@TMPa{0}%
- \ifpgfplots@threedim
- % ah, it IS 3d!
- \ifdim\pgfplots@z@veclength pt=0pt
- % hm. It has view = {0}{90} (i.e. it is 2d)
- \def\pgfplots@loc@TMPa{0}%
- \else
- \def\pgfplots@loc@TMPa{1}%
- \fi
- \fi
- \if1\pgfplots@loc@TMPa
- % 3D is more complicated than 2D:
- % for every fixed reference axis, we have to check *two*
- % scaling factors.
- %
- % Furthermore, the optimality condition (2) needs to be
- % performed on the maximum max{1-s_a, 1-s_b} provided both of
- % these numbers are positive.
- %
- \def\pgfplots@check@##1##2{%
- % PRECONDITION: \pgfplots@apply@unit@ratio@reference is defined.
- %
- % renormalize \pgfplots@unit@[xyz] :
- \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI
- %
- % compute s_a :
- \pgfplots@getscale@unit@vector@reltoreference ##1{\csname pgfplots@unit@ratio@##1\endcsname}%
- \let\pgfplots@scale@a=\pgfmathresult
- %
- % compute s_b :
- \pgfplots@getscale@unit@vector@reltoreference ##2{\csname pgfplots@unit@ratio@##2\endcsname}%
- \let\pgfplots@scale@b=\pgfmathresult
- %
- % check if the actual choice of
- % \pgfplots@apply@unit@ratio@reference is FEASIBLE.
- % That is the case if s_a <= 1 && s_b <= 1.
- % We check
- % (1 - s_a >= 0 ) && ( 1 - s_b >= 0 )
- % instead, since I need the value
- % max( 1-s_a, 1-s_b )
- % anyway.
- \def\pgfplots@ref@is@feasible{1}%
- \pgf@xa=\pgfplots@ONE \advance\pgf@xa by-\pgfplots@scale@a pt
- \ifdim\pgf@xa<0sp
- \def\pgfplots@ref@is@feasible{0}%
- \else
- \pgf@xb=\pgfplots@ONE \advance\pgf@xb by-\pgfplots@scale@b pt
- \ifdim\pgf@xb<0sp
- \def\pgfplots@ref@is@feasible{0}%
- \fi
- \fi
- % compute max(1-s_a,1-s_b) into \pgf@xa:
- % pgf@xa= max(pgf@xa,pgf@xb):
- \ifdim\pgf@xb>\pgf@xa \pgf@xa=\pgf@xb \fi
- \if1\pgfplots@ref@is@feasible
- \ifdim\pgf@xa<\pgfplots@optimum@sofar@value
- % Ah, ok. The actual choice is BETTER as it
- % involves less scaling.
- %
- % Remember it!
- \let\pgfplots@optimum@sofar@axis=\pgfplots@apply@unit@ratio@reference
- \global\pgfplots@optimum@sofar@value=\pgf@xa
- \fi
- \fi
-%\message{^^Junit vector ratio 3D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfplots@ref@is@feasible. \if1\pgfplots@ref@is@feasible max=\the\pgf@xa. \fi Optimum so far: value =\the\pgfplots@optimum@sofar@value\space for axis \pgfplots@optimum@sofar@axis.^^J}%
- }%
- %
- % Check 'x' as reference :
- \def\pgfplots@apply@unit@ratio@reference{x}%
- \pgfplots@check@ yz%
- %
- % Check 'y' as reference :
- \def\pgfplots@apply@unit@ratio@reference{y}%
- \pgfplots@check@ xz%
- %
- % Check 'z' as reference :
- \def\pgfplots@apply@unit@ratio@reference{z}%
- \pgfplots@check@ xy%
- %
- \else
- % 2D is much simpler: find the scale s which fulfills s <= 1.
- % One of them MUST fulfill it.
- %
- % try 'x' axis as reference:
- \def\pgfplots@apply@unit@ratio@reference{x}%
- %
- % renormalize:
- \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI
- %
- % compute scaling factor:
- \pgfplots@getscale@unit@vector@reltoreference y\pgfplots@unit@ratio@y%
- %
-%\message{^^Junit vector ratio 2D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfmathresult < 1: \ifdim\pgfmathresult pt <\pgfplots@ONE YES-> use x\else NO->use y\fi^^J}%
- % and check (1). The condition (2) is irrelevant; it is met
- % anyway.
- \ifdim\pgfmathresult pt<\pgfplots@ONE
- \def\pgfplots@optimum@sofar@axis{x}%
- \else
- \def\pgfplots@optimum@sofar@axis{y}%
- \fi
- \fi
- \else
-%\message{^^Junit vector ratio chose \pgfplots@optimum@sofar@axis\space to fulfill explicitly provided limits (at least partially).^^J}%
- \fi
- %
- \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty
- \ifpgfplots@threedim
- \ifdim\pgfplots@z@veclength pt=0pt
- \def\pgfplots@optimum@sofar@axis{y}%
- \else
- \def\pgfplots@optimum@sofar@axis{z}%
- \fi
- \else
- \def\pgfplots@optimum@sofar@axis{y}%
- \fi
- \pgfplots@warning{The algorithm to implement 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=\pgfplots@optimum@sofar@axis'.}%
- \fi
- \let\pgfplots@apply@unit@ratio@reference=\pgfplots@optimum@sofar@axis
- \pgfmath@smuggleone\pgfplots@apply@unit@ratio@reference
- \endgroup
-}%
-\def\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits{%
- \ifpgfplots@autocompute@ymax \else \def\pgfplots@optimum@sofar@axis{y}\fi
- \ifpgfplots@autocompute@ymin \else \def\pgfplots@optimum@sofar@axis{y}\fi
- \ifpgfplots@autocompute@xmax \else \def\pgfplots@optimum@sofar@axis{x}\fi
- \ifpgfplots@autocompute@xmin \else \def\pgfplots@optimum@sofar@axis{x}\fi
- \ifpgfplots@threedim
- \ifpgfplots@autocompute@zmax \else \def\pgfplots@optimum@sofar@axis{z}\fi
- \ifpgfplots@autocompute@zmin \else \def\pgfplots@optimum@sofar@axis{z}\fi
- \fi
-}%
-
-\def\pgfplots@apply@unit@ratio@prepareratios#1 #2 #3 #4\pgfplots@EOI{%
- \def\pgfplots@unit@ratio@x{#1}%
- \def\pgfplots@unit@ratio@y{#2}%
- \def\pgfplots@unit@ratio@z{#3}%
- %
- % 'unit vector ratio' is measured relative to the y axis for 2d
- % and relative to the z axis for 3d plots.
- % renormalize such that it is relative to
- % \pgfplots@apply@unit@ratio@reference.
- %
- % Furthermore, renormalize such that
- % unit@ratio@\pgfplots@apply@unit@ratio@reference is 1.
- \pgfmathreciprocal@{\csname pgfplots@unit@ratio@\pgfplots@apply@unit@ratio@reference\endcsname}%
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \ifpgfplots@threedim
- \if z\pgfplots@apply@unit@ratio@reference
- \else
- \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}%
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \fi
- %
- \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}%
- \let\pgfplots@unit@ratio@x=\pgfmathresult
- %
- \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}%
- \let\pgfplots@unit@ratio@y=\pgfmathresult
- %
- \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}%
- \let\pgfplots@unit@ratio@z=\pgfmathresult
- \else
- \if y\pgfplots@apply@unit@ratio@reference
- \else
- \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}%
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \fi
- %
- \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}%
- \let\pgfplots@unit@ratio@x=\pgfmathresult
- %
- \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}%
- \let\pgfplots@unit@ratio@y=\pgfmathresult
- %
- \def\pgfplots@unit@ratio@z{<unused>}%
- \fi
- %
-}%
-
-
-% Computes a new unit vector E_#1 for direction #1 such that
-% ||E_#1|| = #2 * ||e_reference||.
-% Here, #2 is a scaling factor and e_reference is a reference axis.
-% The reference axis is stored in
-% \pgfplots@apply@unit@ratio@reference, the macro contains one of
-% {x,y,z}.
-%
-% The data limits for '#1' will be enlarged as well (for 'unit rescale
-% keep size').
-%
-% #1 is the axis which should be scaled (i.e. #1 in {x,y,z}).
-% It is allowed if #1 = \pgfplots@apply@unit@ratio@reference. In this
-% case, you can provide a scale '#2' to rescale the axis.
-%
-% #2 is a desired scale, relative to
-% \pgfplots@apply@unit@ratio@reference. #2 should be a number without
-% unit.
-%
-% The parameter \pgfplots@apply@unit@ratio@reference is also one of
-% {x,y,z}.
-%
-\def\pgfplots@rescale@unit@vector@reltoreference#1#2{%
- \def\pgfplots@loc@TMPa{0}%
- \if#1\pgfplots@apply@unit@ratio@reference
- \pgfplotsmath@ifapproxequal@dim{#2pt}{1pt}{0.0002pt}{%
- }{%
- \def\pgfplots@loc@TMPa{1}%
- }%
- \else
- \def\pgfplots@loc@TMPa{1}%
- \fi
- \ifdim\csname pgfplots@#1@veclength\endcsname pt=0pt
- \def\pgfplots@loc@TMPa{0}%
- \fi
- \if1\pgfplots@loc@TMPa
- %
- \pgfplots@getscale@unit@vector@reltoreference{#1}{#2}%
- \global\let\pgfplots@glob@TMPa=\pgfmathresult
- %
-%\message{Rescaling '#1' by \pgfplots@glob@TMPa.^^J}%
- \if x#1
- \pgfsetxvec{\pgfplotsqpointxy{\pgfplots@glob@TMPa}{0}}%
- \else
- \if y#1
- \pgfsetyvec{\pgfplotsqpointxy{0}{\pgfplots@glob@TMPa}}%
- \else
- \if z#1
- \pgfsetzvec{\pgfplotsqpointxyz{0}{0}{\pgfplots@glob@TMPa}}%
- \fi
- \fi
- \fi
- %
- \pgfmathmultiply@{\csname pgfplots@#1@veclength\endcsname}{\pgfplots@glob@TMPa}%
- \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult
- %
- \pgfmathreciprocal@\pgfplots@glob@TMPa
- \global\let\pgfplots@glob@TMPb=\pgfmathresult
- %
- \pgfmathmultiply@{\csname pgfplots@#1@inverseveclength\endcsname}{\pgfplots@glob@TMPb}%
- \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult
- %
- %
- \pgfplots@apply@unit@vector@rescale@keep@size{#1}{\pgfplots@glob@TMPb}%
- %
- \fi
-}
-
-% Updates the #1 axis limits such that the axis' dimensions
-% stay the same after scaling the #1 unit vector by a scale 's'.
-%
-% PRECONDITION:
-% - the #1 unit vector has been rescaled by a factor s.
-% For example, e_xnew := e_x * 0.5 .
-%
-% POSTCONDITION:
-% - the axis limits are enlarged by a factor 1/s such that
-% 1/s (#1max - #1min) * e_xnew = (#1max- #1min) * e_x.
-%
-% In other words, the unit vector rescale is componensated by
-% modifying the axis limits.
-%
-% My idea is to add half of the new range to 'max' and
-% subtract the other half from 'min':
-% 1/s( xmax - xmin) = (xmax+0.5d) - (xmin-0.5d) = xmax - xmin +d
-% with d = 1/s (xmax-xmin) - (xmax-xmin) = (1/s - 1) (xmax-xmin)
-%
-% #1: either x, y or z. It denotes the direction which has been
-% modified.
-% #2: the INVERSE of the scaling factor, #2 = 1/s .
-%
-\def\pgfplots@apply@unit@vector@rescale@keep@size#1#2{%
- \ifpgfplots@unit@vector@rescale@keep@size
- %
-%\message{'unit rescale keep size': Resizing data range for #1: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}%
- \pgfmathsubtract@{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#1min\endcsname}%
- \begingroup
- \pgf@xa=\pgfmathresult pt
- \pgfmathsubtract@{#2}{1.0}%
- \pgf@xa=\pgfmathresult \pgf@xa
- \divide\pgf@xa by2
- \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}%
- \endgroup
- \pgfmathsubtract@{\csname pgfplots@#1min\endcsname}{\pgfplots@glob@TMPb}%
- \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
- \pgfmathadd@{\csname pgfplots@#1max\endcsname}{\pgfplots@glob@TMPb}%
- \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult
-%\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [+- \pgfplots@glob@TMPb]}%
- %
- % Update auxiliary data members:
- \pgfplots@visphase@notify@changeofcanvaslimits{#1}%
- \fi
-}%
-
-% #1: an axis which should be scaled
-% #2: the desired final ratio ||e_#1||/||e_ref||
-\def\pgfplots@getscale@unit@vector@reltoreference#1#2{%
- %
- % If the datascaling transformation is active (which is almost
- % everytime the case here), we have a transformation
- % T^{-1}(x)= 10^scale * x
- % with different scales for every axis.
- %
- % If the datascaling transformation is NOT active, scale is 0
- % and T^{-1} = Identity.
- %
- % Note that the datascaling transformation also has
- % translations (shifts). These are not important here.
- %
- % Goal:
- % compute E_#1 such that
- % #2* || T^{-1} e_ref || = || T^{-1} E_#1 ||
- % where T^{-1} is the data scaling transformation and e_ref the
- % reference unit vector. Keep in mind that there are
- % *different* data scaling transformations for each axis.
- %
- % We are given e_ref and e_#1 and the desired aspect ratio
- % between e_ref and E_#1, which is available as #2.
- %
- % So: T^{-1} E_#1 := s* T^{-1} e_#1 where
- % s = #2 * ||T^{-1} e_ref|| / || T^{-1} e_#1 ||
- % = |10^{scale_ref}| / |10^{scale_#1}| * #2 * || e_ref|| / ||e_#1||.
- %
- % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1.
- %
- % -> compute 's'!
- %
- % Part 1: compute
- % #2 * ||e_ref|| / ||e_#1||.
- %
- \def\pgfplots@loc@TMPa{1}%
- \ifdim\csname pgfplots@#1@veclength\endcsname pt=0pt
- \def\pgfplots@loc@TMPa{0}%
- \else
- \ifdim\csname pgfplots@\pgfplots@apply@unit@ratio@reference @veclength\endcsname pt=0pt
- \def\pgfplots@loc@TMPa{0}%
- \fi
- \fi
- \if0\pgfplots@loc@TMPa
- \def\pgfmathresult{16001}%
- \else
- \pgfmathmultiply@
- {\csname pgfplots@\pgfplots@apply@unit@ratio@reference @veclength\endcsname}
- {\csname pgfplots@#1@inverseveclength\endcsname}%
- \pgfmathmultiply@
- {\pgfmathresult}%
- {#2}%
- \global\let\pgfplots@glob@TMPa=\pgfmathresult
- %
- % also compute 1/s, required as temporary value:
- %\pgfmathmultiply@
- % {\csname pgfplots@\pgfplots@apply@unit@ratio@reference @inverseveclength\endcsname}
- % {\csname pgfplots@#1@veclength\endcsname}%
- %\ifdim#2pt=1pt
- %\else
- % \pgfmathdivide@{\pgfmathresult}{#2}%
- %\fi
- %\global\let\pgfplots@glob@TMPb=\pgfmathresult
- %
- % Part 2: handle data scaling trafo scales:
- \begingroup
- \def\pgfplots@tmp@exponentref{0}%
- \def\pgfplots@tmp@exponentK{0}%
- \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@apply@unit@ratio@reference }{%
- \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@apply@unit@ratio@reference }%
- }{}%
- \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
- \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}%
- }{}%
- \c@pgf@counta=\pgfplots@tmp@exponentref\relax
- \advance\c@pgf@counta by-\pgfplots@tmp@exponentK\relax
- \ifnum\c@pgf@counta=0
- \else
- \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}%
- \global\let\pgfplots@glob@TMPa=\pgfmathresult
- % \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}%
- % \global\let\pgfplots@glob@TMPb=\pgfmathresult
- \fi
- \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}%
- \endgroup
- \let\pgfmathresult=\pgfplots@glob@TMPa
- \fi
-%\message{\string\pgfplots@getscale@unit@vector@reltoreference{#1}{#2} (reference \pgfplots@apply@unit@ratio@reference) = \pgfmathresult.^^J}%
-}
% should be invoked whenever \pgfplots@#1min or \pgfplots@#1max have
% been changed during the visualization phase (for example, axis equal
@@ -6206,171 +5457,8 @@
\if1\pgfplots@glob@TMPc #3\else #4\fi
}%
-% PRECONDITION:
-% - final axis limits are given in transformed range
-% - \pgfplots@set@default@size@options has been invoked before
-% POSTCONDITION:
-% - the current x,y and z unit vectors are defined properly;
-% - the fast-access registers are initialised for the axis limits,
-% - the following macros are assigned:
-% \pgfplots@[xyz]@veclength
-% \pgfplots@[xyz]@inverseveclength
-% \pgfplotspointxaxis
-% \pgfplotspointyaxis
-% \pgfplotspointzaxis
-% \pgfplotspointcenter
-% \pgfplotspointminminmin
-%
-\def\pgfplots@initsizes{%
- % INIT.
- %
- %
- \pgfplots@xmin@reg=\pgfplots@xmin pt %
- \pgfplots@xmax@reg=\pgfplots@xmax pt %
- \pgfplots@ymin@reg=\pgfplots@ymin pt %
- \pgfplots@ymax@reg=\pgfplots@ymax pt %
- \ifpgfplots@threedim
- \pgfplots@zmin@reg=\pgfplots@zmin pt %
- \pgfplots@zmax@reg=\pgfplots@zmax pt %
- \fi
- %
- %
- %-----------------------------------------
- % PROCESS THE 'width' and 'height' options
- %-----------------------------------------
- %
- %
- \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}%
- \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}%
- \ifpgfplots@threedim
- \def\pgfplots@tmpZscale{1pt}%
- \else
- \def\pgfplots@tmpZscale{0pt}%
- % FIXME
- \let\pgfplots@view@el=\pgfutil@empty
- \let\pgfplots@view@az=\pgfutil@empty
- \fi
- \ifx\pgfplots@view@az\pgfutil@empty
- % Note that in presence of "x,y,z" options, the
- % \pgfplots@set@default@size@options RESETS /pgfplots/view/az.
- %
- %\let\pgfplots@rectangle@width=\pgfutil@empty
- %\let\pgfplots@rectangle@height=\pgfutil@empty
- \def\pgfplots@view@dir@threedim@x{0}%
- \def\pgfplots@view@dir@threedim@y{0}%
- \def\pgfplots@view@dir@threedim@z{1}%
- %
- \pgfpointdiff
- {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}
- {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}%
- % only used temporarily in this macro to compute the correct
- % length for unit vectors:
- \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}%
- \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}%
- %
- \ifx\pgfplots@x\pgfutil@empty
- \ifx\pgfplots@width\pgfutil@empty
- \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}%
- \fi
- \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale
- %\ifpgfplots@scale@only@axis
- % \let\pgfplots@rectangle@width=\pgfplots@width
- %\fi
- \else
- \def\pgfplots@tmpXscale{1}%
- \fi
- %
- \ifx\pgfplots@y\pgfutil@empty
- \ifx\pgfplots@height\pgfutil@empty
- \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}%
- \fi
- \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale
- %\ifpgfplots@scale@only@axis
- % \let\pgfplots@rectangle@height=\pgfplots@height
- %\fi
- \else
- \def\pgfplots@tmpYscale{1}%
- \fi
- %
- \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}%
- \edef\pgfplots@tmpXscale{\the\pgf@x}%
- \edef\pgfplots@tmpYscale{\the\pgf@y}%
- %
- \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}%
- \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}%
- \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}%
- \ifcase\pgfplots@scale@mode@choice\relax
- % scale mode=auto : do nothing in this context.
- \else
- \pgfplots@scale@axisbox@to@widthheight
- \fi
- \ifpgfplots@threedim
- \pgfplotsgetnormalforcurrentview
- \fi
- \else
- % 3D case by `view':
- \let\pgfplots@x=\pgfutil@empty
- \let\pgfplots@y=\pgfutil@empty
- \let\pgfplots@z=\pgfutil@empty
- % this invokes \pgfplots@scale@plotbox@to@widthheight automatically.
- \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}%
- \if1\pgfplots@tmp@xisaxisparallel%
- \def\pgfplots@tmp@yisaxisparallel{1}%
- \fi
- \fi
-%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy), n = (\pgfplots@view@dir@threedim@x,\pgfplots@view@dir@threedim@y,\pgfplots@view@dir@threedim@z).^^J }%
- %
- \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure
- \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure
- %
- \pgfplotsmath@ifzero{\pgfplots@x@veclength}{\pgfplots@hide@xtrue\pgfplots@shownothingof@xtrue}{}%
- \pgfplotsmath@ifzero{\pgfplots@y@veclength}{\pgfplots@hide@ytrue\pgfplots@shownothingof@ytrue}{}%
- \ifpgfplots@threedim
- \pgfplotsmath@ifzero{\pgfplots@z@veclength}{\pgfplots@hide@ztrue\pgfplots@shownothingof@ztrue}{}%
- \else
- \if1\pgfplots@tmp@xisaxisparallel%
- \if1\pgfplots@tmp@yisaxisparallel%
- % Optimize for axis-parallel case!
- % puh. Did not make any measureable difference!? Ok...
- \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal
- \fi
- \fi
- \fi
- \pgfplots@apply@unit@ratio
- %
- \pgfplots@axis@apply@post@scale x
- \pgfplots@axis@apply@post@scale y
- \ifpgfplots@threedim
- \pgfplots@axis@apply@post@scale z
- \fi
-}
-\def\pgfplots@axis@apply@post@scale#1{%
- %
- \pgfkeysgetvalue{/pgfplots/#1 post scale}\pgfmathresult
- \ifx\pgfmathresult\pgfutil@empty
- \else
- \pgfmathparse{\pgfmathresult}%
- \ifdim\pgfmathresult pt=1pt
- \else
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \csname pgf@#1x\endcsname=\pgfmathresult\csname pgf@#1x\endcsname
- \csname pgf@#1y\endcsname=\pgfmathresult\csname pgf@#1y\endcsname
- %
- \pgfmathmultiply@{\csname pgfplots@#1@veclength\endcsname}{\pgfplots@loc@TMPa}%
- \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult
- %
- \pgfmathdivide@{\csname pgfplots@#1@inverseveclength\endcsname}{\pgfplots@loc@TMPa}%
- \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult
- \fi
- \fi
-}
-% This here is a low-weight node. It can ONLY be used during axis
-% descriptions and is completely useless otherwise.
-%
-% See pgfplots@low@level@shape below.
-\pgfdeclareshape{pgfplots@low@level@shape@INNER}{%
- \nodeparts{image}%
+\def\pgfplots@low@level@shape@INNER@define{%
\anchor{image}{\pgfpointorigin}%
%
%
@@ -6413,8 +5501,17 @@
{\pgfplotsqpointdescriptionxy{0}{0}}
{\pgfplotsqpointdescriptionxy{1}{0}}%
}%
+}
+
+% This here is a low-weight node. It can ONLY be used during axis
+% descriptions and is completely useless otherwise.
+%
+% See pgfplots@low@level@shape below.
+\pgfdeclareshape{pgfplots@low@level@shape@INNER}{%
+ \nodeparts{image}%
%%
%%
+ \pgfplots@low@level@shape@INNER@define
%%
%%
\anchorborder{}%
@@ -6432,12 +5529,14 @@
% of anchors.
\pgfdeclareshape{pgfplots@low@level@shape}{%
% The '(0,0)' point is the LOWER LEFT OUTER CORNER.
- \savedanchor\upperrightcorner{
- \global\pgf@x=\wd\pgfnodepartimagebox
- \global\pgf@y=\ht\pgfnodepartimagebox
+ \savedanchor\upperrightcorner{%
+ % FIXME : is this correct?
+ \pgfplotspointupperrightcorner
+ %\global\pgf@x=\wd\pgfnodepartimagebox
+ %\global\pgf@y=\ht\pgfnodepartimagebox
}%
\savedanchor\lowerleftinnercorner{%
- \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}%
+ \pgfplotspointlowerleftinnercorner%
}%
\savedanchor\innerdiagonal{\pgfplotspointbbdiagonal}%
\savedanchor\origin{%
@@ -6450,7 +5549,6 @@
\global\pgf@y=0pt %
}%
%
- %
\anchor{center}{%
\pgfpointadd
{\lowerleftinnercorner}%
@@ -6695,11 +5793,13 @@
\pgfdeclareshape{pgfplots@low@level@shape@deprecated}{%
% The '(0,0)' point is the LOWER LEFT OUTER CORNER.
\savedanchor\upperrightcorner{
- \global\pgf@x=\wd\pgfnodepartimagebox
- \global\pgf@y=\ht\pgfnodepartimagebox
+ % FIXME : is this correct?
+ \pgfplotspointupperrightcorner
+ %\global\pgf@x=\wd\pgfnodepartimagebox
+ %\global\pgf@y=\ht\pgfnodepartimagebox
}%
\savedanchor\lowerleftinnercorner{%
- \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}%
+ \pgfplotspointlowerleftinnercorner%
}%
\savedanchor\xaxisvec{\pgfplotspointxaxis}%
\savedanchor\yaxisvec{\pgfplotspointyaxis}%
@@ -7122,7 +6222,10 @@
\pgfplots@error{Sorry, your choice for '3d box' and 'axis x line' is incompatible.}%
\else
% 3d box=complete or complete*
+ \pgfplotsgetlayerforstyle{every 3d box foreground}%
+ \pgfplotsonlayer{\pgfplotsretval}{every 3d box foreground}%
\begingroup
+ \pgfplots@layered@graphicsfalse% no distinction of layers here.
\pgfplotsset{every 3d box foreground}%
\let\pgfplots@drawticklabels@onorientedsurf=\relax
\if2\pgfplots@threedimbox@choice
@@ -7189,6 +6292,7 @@
}{}%
%\fi
\endgroup
+ \endpgfplotsonlayer
% end of 3d box=complete
\fi
\fi
@@ -7319,7 +6423,7 @@
% will be initialised.
%
% ABOUT THE ALGORITHM:
-% Given \pgfplots@view@dir@threedim@[xyz], we know the view direction (in 3D!).
+% Given \pgfplots@view@dir@threedim, we know the view direction (in 3D!).
% Now, we compute the scalar products <n,(1,0,0)'> <n,(0,1,0)'> and
% <n,(0,0,1)'> between the view direction n and the unit vectors in 3D
% space. Of course, these scalar products are just specific components
@@ -7338,29 +6442,30 @@
\expandafter\def\csname pgfplots@surfviewdepth@v2v\endcsname{f}%
\expandafter\def\csname pgfplots@surfviewdepth@vv2\endcsname{f}%
\ifpgfplots@threedim
+ \pgfplotsmathvectortocomponents\pgfplots@view@dir@threedim{pgfplots@loc@}{default}%
% respect reversed axes here. If I am not mistaken, it should
% be completely sufficient to flip signs here:
- \ifdim\pgfplots@view@dir@threedim@x pt\if\pgfkeysvalueof{/pgfplots/x dir/value}n>\else<\fi0pt
+ \pgfplotscoordmath{default}{if is}{\pgfplots@loc@x}{\if\pgfkeysvalueof{/pgfplots/x dir/value}n+\else-\fi}{%
\expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{f}% foreground
\expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{b}% background
- \else
+ }{%
\expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}%
\expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}%
- \fi
- \ifdim\pgfplots@view@dir@threedim@y pt\if\pgfkeysvalueof{/pgfplots/y dir/value}n>\else<\fi0pt
+ }%
+ \pgfplotscoordmath{default}{if is}{\pgfplots@loc@y}{\if\pgfkeysvalueof{/pgfplots/y dir/value}n+\else-\fi}{%
\expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{f}% foreground
\expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{b}% background
- \else
+ }{%
\expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}%
\expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}%
- \fi
- \ifdim\pgfplots@view@dir@threedim@z pt\if\pgfkeysvalueof{/pgfplots/z dir/value}n>\else<\fi0pt
+ }%
+ \pgfplotscoordmath{default}{if is}{\pgfplots@loc@z}{\if\pgfkeysvalueof{/pgfplots/z dir/value}n+\else-\fi}{%
\expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{f}% foreground
\expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{b}% background
- \else
+ }{%
\expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}%
\expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}%
- \fi
+ }%
\else
% FIXME : it might be better to implement that stuff here
% implicilty using the 3D algorithms.
@@ -7448,51 +6553,64 @@
\def\pgfplots@loc@axischar@for@first{x}%
\fi
\fi
- \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 00}{%
- % -> both, v00 or v11 are on CH.
- %
- % Decide whether the '{0.5}{0}{0}' point is above or below
- % the {0.5}{0.5}{0.5}
- % point. This '<' operation is based on the '#1ticklabel pos'
- % key, the 2D projection of the axis and the argument '#2'.
- \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 00}%
- \pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}%
- \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax
- \if u\csname pgfplots@#1ticklabel@pos\endcsname
- \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}%
- \fi
- \else
- \if l\csname pgfplots@#1ticklabel@pos\endcsname
- \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}%
- \fi
- \fi
- }{%
- % -> both, v01 or v10 are on CH
- %--------------------------------------------------
- % \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 01}{% FIXME : eliminate sanity assertion if possible
- % }{%
- % \pgfplots@error{INTERNAL ERROR}%
- % }%
- %--------------------------------------------------
- % Decide whether the '{0.5}{1}{0}' point is above or below
- % the {0.5}{0.5}{0.5} point. Again, the '<' operation is based
- % on the '#1ticklabel pos' key, the projection and #2.
- \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 10}%
- % compute the middle point on \pgfplots@loc@to@threedim 10
- \pgfpointadd
- {\csname pgfplotspoint\pgfplots@loc@axischar@for@first axis\endcsname}
- {\pgfpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}}%
+ %\if2\csname pgfplots@#1axislinesnum\endcsname
+ % axis #1 lines=center .
+ \iffalse
+ % FIXME : while this here seems reasonable, it is not fully
+ % implemented. The "outer normal" is missing and one other
+ % component produces a NYI-warning
%
- \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax
- \if u\csname pgfplots@#1ticklabel@pos\endcsname
- \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}%
+ % well, for 3d, this implies that all others also have
+ % "center". And since "0" == lower, "1" == upper", "2" ==
+ % center, we have to use center:
+ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 22}%
+ \else
+ \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 00}{%
+ % -> both, v00 or v11 are on CH.
+ %
+ % Decide whether the '{0.5}{0}{0}' point is above or below
+ % the {0.5}{0.5}{0.5}
+ % point. This '<' operation is based on the '#1ticklabel pos'
+ % key, the 2D projection of the axis and the argument '#2'.
+ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 00}%
+ \pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}%
+ \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax
+ \if u\csname pgfplots@#1ticklabel@pos\endcsname
+ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}%
+ \fi
+ \else
+ \if l\csname pgfplots@#1ticklabel@pos\endcsname
+ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}%
+ \fi
\fi
- \else
- \if l\csname pgfplots@#1ticklabel@pos\endcsname
- \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}%
+ }{%
+ % -> both, v01 or v10 are on CH
+ %--------------------------------------------------
+ % \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 01}{% FIXME : eliminate sanity assertion if possible
+ % }{%
+ % \pgfplots@error{INTERNAL ERROR}%
+ % }%
+ %--------------------------------------------------
+ % Decide whether the '{0.5}{1}{0}' point is above or below
+ % the {0.5}{0.5}{0.5} point. Again, the '<' operation is based
+ % on the '#1ticklabel pos' key, the projection and #2.
+ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 10}%
+ % compute the middle point on \pgfplots@loc@to@threedim 10
+ \pgfpointadd
+ {\csname pgfplotspoint\pgfplots@loc@axischar@for@first axis\endcsname}
+ {\pgfpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}}%
+ %
+ \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax
+ \if u\csname pgfplots@#1ticklabel@pos\endcsname
+ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}%
+ \fi
+ \else
+ \if l\csname pgfplots@#1ticklabel@pos\endcsname
+ \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}%
+ \fi
\fi
- \fi
- }%
+ }%
+ \fi
}%
\def\pgfplots@init@ticklabelaxisspec@twodim@for#1#2{%
\if#1x%
@@ -7677,11 +6795,321 @@
\pgfkeyslet{/pgfplots/.unknown/.@cmd}\pgfplots@BEGIN@prepare@description@styles@oldhandler
}%
-\def\pgfplots@BEGIN@init@and@draw@axis{%
- \pgfplots@determinedefaultvalues
+\newif\ifpgfplots@layered@graphics
+
+
+% Shortcut for '\pgfplotsset{set layers={#1}}'.
+%
+% USAGE:
+% 1. \pgfplotssetlayers{<layer config name>} (one declared with /.define layer set)
+% 2. \pgfplotssetlayers (no braces)
+% 3. \pgfplotssetlayers{<comma-separated-list-of-layers>}
+%
+% This command immediately installs a \pgfsetlayers command. It also prepares following axes.
+% ATTENTION: this might affect tikzpictures as well.
+%
+\def\pgfplotssetlayers{%
+ \pgfutil@ifnextchar\bgroup{\pgfplotssetlayers@}{\pgfplotsset{set layers}}%
+}%
+\def\pgfplotssetlayers@#1{%
+ \pgfplotsset{set layers={#1}}%
+}%
+
+% This method checks if '#1' is a well-known layer set. If that is the case, the layer set is initialized.
+% If there is no such layer set, #1 is assumed to be a comma-separated-list of layer names.
+% These layers are defined if they do not exist already.
+%
+% POSTCONDITION:
+% - a \pgfsetlayers{<list>} is issued (immediately)
+% - '/pgfplots/@set layers arg' is defined such that any following axes can initialized their layers.
+\def\pgfplots@key@set@layers#1{%
+ %
+ % auto detect if '#1' is a defined layer set:
+ \pgfkeysifdefined{#1/list}{%
+ \def\pgfkeyscurrentname{#1}%
+ }{%
+ \pgfkeysifdefined{/pgfplots/layers/#1/list}{%
+ \edef\pgfkeyscurrentname{/pgfplots/layers/#1}%
+ }{%
+ \let\pgfkeyscurrentname\pgfutil@empty
+ }%
+ }%
+ \ifx\pgfkeyscurrentname\pgfutil@empty
+ % OK. The argument is NO layer set configuration.
+ \pgfplots@key@set@layers@{#1}%
+ \pgfkeyslet{/pgfplots/@set layers arg}\pgfutil@empty%
+ \else
+ % OK, The argument is the key name of some '/.define layer set' key.
+ % Remember it for later and initialize the layers:
+ \pgfkeyslet{/pgfplots/@set layers arg}\pgfkeyscurrentname%
+ \pgfkeysgetvalue{\pgfkeyscurrentname/list}\pgfplots@loc@TMPa
+ \expandafter\pgfplots@key@set@layers@\expandafter{\pgfplots@loc@TMPa}%
+ \fi
+}
+% a simple method which (immediately) invokes \pgfsetlayers{#1}.
+%
+% The only difference is that it creates missing layers on-the-fly.
+\def\pgfplots@key@set@layers@#1{%
+ \edef\pgfplots@loc@TMPa{#1}%
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ % DEFAULT.
+ \pgfsetlayers{main}%
+ \else
+ \def\pgfplots@loc@TMPb{false}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ % "use layers=false"
+ \pgfsetlayers{main}%
+ \else
+ \def\pgfplots@loc@TMPb{main}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ % "use layers=main"
+ \pgfsetlayers{main}%
+ \else
+ % declare all layers, and collect the normalised list
+ % into \pgfplots@loc@TMPd
+ \def\pgfplots@loc@TMPd{}%
+ \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplots@loc@TMPa}\as\pgfplots@loc@TMPa{%
+ % normalize argument:
+ \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
+ \expandafter\pgfplotsutil@trim\expandafter{\pgfplots@loc@TMPa}%
+ \let\pgfplots@loc@TMPa=\pgfplotsretval
+ %
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \else
+ \def\pgfplots@loc@TMPb{main}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ \else
+ \expandafter\pgfdeclarelayer\expandafter{\pgfplots@loc@TMPa}%
+ \fi
+ \edef\pgfplots@loc@TMPd{\ifx\pgfplots@loc@TMPd\pgfutil@empty\else\pgfplots@loc@TMPd,\fi\pgfplots@loc@TMPa}%
+ \fi
+ }%
+ % activate layers:
+ \pgfplots@log3{Setting layers '\pgfplots@loc@TMPd'...}%
+ \expandafter\pgfsetlayers\expandafter{\pgfplots@loc@TMPd}%
+ \fi
+ \fi
+ \fi
+}%
+
+\def\pgfplots@prepare@layered@graphics{%
+ % check if there are no layers at all.
+ \ifpgfplots@layered@graphics
+ \pgfutil@ifundefined{pgf@layerlist}{%
+ }{%
+ \ifx\pgf@layerlist\pgfutil@empty
+ \pgfplots@layered@graphicsfalse
+ \else
+ \def\pgfplots@loc@TMPa{main}%
+ \ifx\pgf@layerlist\pgfplots@loc@TMPa
+ \pgfplots@layered@graphicsfalse
+ \fi
+ \fi
+ }%
+ \fi
+}%
+
+% validates 'mark layer' such that it can be queried afterwards.
+\def\pgfplots@prepare@layered@graphics@marks{%
+ \ifpgfplots@layered@graphics
+ \pgfkeysgetvalue{/pgfplots/mark layer}\pgfplots@loc@TMPa
+ \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \def\pgfplots@loc@TMPa{auto}%
+ \fi
+ \def\pgfplots@loc@TMPb{auto}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ % COMBINATION: 'activate layers,mark layer=auto' --> keep
+ % backwards compatibility with 'clip marker paths'
+ % -> nothing to do.
+ \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
+ \else
+ % mark layer=like plot
+ \def\pgfplots@loc@TMPb{like plot}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ % draw markers together with their plot (no matter
+ % on which layer):
+ \pgfplots@clip@marker@pathstrue
+ \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
+ \else
+ \edef\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/on layer}}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ % nothing to do; they are on the same layer
+ % anyway: (this is the same as 'like plot'
+ \pgfplots@clip@marker@pathstrue
+ \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
+ \else
+ % OK, marks will be plotted on their own layer.
+ \fi
+ \fi
+ \fi
+ \else
+ % reset its value:
+ \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
+ \fi
+}%
+
+% #2: context information (for improved error recovery), optional
+\def\pgfplotsonlayer#1{%
+ \pgfutil@ifnextchar\bgroup{\pgfplotsonlayer@{#1}}{\pgfplotsonlayer@{#1}{}}%
+}
+\def\pgfplotsonlayer@#1#2{%
+ \begingroup
+ \def\b@pgfplotsonlayer@started{0}%
+ \ifpgfplots@layered@graphics
+ \edef\pgfplots@loc@TMPa{#1}%
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \else
+ \def\b@pgfplotsonlayer@started{1}%
+ \pgfonlayer{#1}%
+ \fi
+ \fi
+}%
+\def\endpgfplotsonlayer{%
+ \ifpgfplots@layered@graphics
+ \if1\b@pgfplotsonlayer@started
+ \endpgfonlayer
+ \fi
+ \fi
+ \endgroup
+}%
+
+
+% Searches for the layers of a (set of) style name(s).
+%
+% #1 is a style name like 'every major grid'. It can also be a list of
+% style names.
+%
+% The last "on layer" key found in these styles will be used here.
+%
+% Note that the "on layer" keys have already been extracted in during
+% the key filtering procedure.
+\def\pgfplotsgetlayerforstyle#1{%
+ \let\pgfplotsretval=\pgfutil@empty
+ \ifpgfplots@layered@graphics
+ % this here is the return value:
+ \let\pgfplots@loc@TMPc=\pgfutil@empty
+ %
+ % search list:
+ \pgfplotsutilforeachcommasep{#1}\as\pgfplots@loc@TMPa{%
+ \pgfkeysifdefined{/pgfplots/layers for styles/\pgfplots@loc@TMPa}{%
+ % oh, good: I have already processed the requested
+ % style, and I already know if it has a particular
+ % layer.
+ \pgfkeysgetvalue{/pgfplots/layers for styles/\pgfplots@loc@TMPa}\pgfplots@loc@TMPb
+ }{%
+ % hm. Ok, then process the style. Throw everything
+ % away, keep only the layer.
+ \begingroup
+ \pgfkeyslet{/pgfplots/on layer}\pgfutil@empty
+ \pgfkeysdef{/handlers/.unknown}{}% do nothing
+ \pgfkeysdef{/tikz/.unknown}{}% also, do nothing.
+ \pgfplotsset{#1}% let's hope this works with unknown keys...
+ \pgfkeysgetvalue{/pgfplots/on layer}\pgfplots@loc@TMPb
+ \pgfmath@smuggleone\pgfplots@loc@TMPb
+ \endgroup
+ }%
+ \ifx\pgfplots@loc@TMPb\pgfutil@empty
+ \else
+ % update return value:
+ \let\pgfplots@loc@TMPc=\pgfplots@loc@TMPb
+ \fi
+ }%
+ \let\pgfplotsretval=\pgfplots@loc@TMPc
+%\message{\string\pgfplotsgetlayerforstyle{#1} = '\pgfplotsretval'^^J}%
+ \fi
+}%
+
+% The purpose of this method is to check for the cases where no cell picture is necessary.
+% The idea behind this anchor is to insert the axis DIRECTLY into the embedding tikzpicture, without
+% a posteriori shifting.
+%
+% A posteriori shifting == anchors whose dimensions are not fixed
+% until the complete axis has been "typeset".
+%
+% Disabling the cell picture will still prepare ALL anchors correctly,
+% but it disables many of the anchor choices when it comes to the
+% alignment of the current axis (in other words: other node can align
+% using the anchors of this axis, but this axis cannot be aligned based on its anchors).
+%
+% The motivation for this feature is to implement multi-axis support together with layered graphics.
+%
+% The 'cell picture=false' feature may be interesting for SVG export as
+% well.
+\def\pgfplots@prepare@cell@picture{%
+ \pgfplots@ifcellpicture@required{%
+ \pgfplots@has@cell@picturetrue
+ }{%
+ % cell picture=false or cell picture=if necessary
+ %
+ % anchor processing is special in this case! The standard
+ % anchor processing uses a posteriori shifts. This feature
+ % here REQUIRES a priori shifts.
+ % Prepare special handling for these shifts:
+ \pgfplots@has@cell@picturefalse
+ \edef\pgfplots@anchorname@internal{\pgfplots@anchorname}%
+ %\def\pgfplots@anchorname{image}%
+ %
+ \let\pgfplots@BEGIN@cell@picture=\pgfplots@BEGIN@cell@picture@DISABLED
+ \let\pgfplots@END@cell@picture=\pgfplots@END@cell@picture@DISABLED
+ \def\pgfplots@add@named@child@node##1{}% do nothing here
+ \let\pgfplots@finally@correct@child@node@positions=\relax
+ %
+ % translate the coordinate system before the 'current axis'
+ % node is generated.
+ \expandafter\def\expandafter\pgfplots@beforenode\expandafter{\pgfplots@beforenode
+ \setbox\pgfnodepartimagebox=\hbox{}%
+ }%
+ }%
+}
+
+\long\def\pgfplots@ifcellpicture@required#1#2{%
+ \if1\pgfplots@cell@picture@mode
+ % cell picture=true
+ #1\relax
+ \else
+ % cell picture=false | cell picture=if necessary
+ \edef\pgfplots@shapename{pgfplots@low@level@shape@INNER}%
+ \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{%
+ % we need to compute the anchor a posteriorily.
+ \if0\pgfplots@cell@picture@mode
+ % cell picture=false is forbidden here...
+ \pgfplots@error{Sorry, 'cell picture=false' is UNSUPPORTED for 'anchor=\pgfplots@anchorname'.}%
+ \fi
+ \if2\pgfplots@cell@picture@mode
+ \pgfplots@log3{'cell picture=if necessary' resulted in 'cell picture=true'}%
+ \fi
+ #1\relax
+ }{%
+ \pgfplots@log3{'cell picture=if necessary' resulted in 'cell picture=false'}%
+ % OK, an a priori anchor is available - we do not really need
+ % a cell picture and this is compatible with the input
+ % options:
+ #2\relax
+ }%
+ \fi
+}%
+
+\def\pgfplots@define@preliminary@current@axis@node{%
+ \begingroup
+ \pgfplots@sys@beforenode
+ % create a leight-weight 'current axis' node for anchor references
+ % (which may happen during both, the axis descriptions or any
+ % path/plot commands).
+ \pgfmultipartnode{pgfplots@low@level@shape@INNER}{image}{current axis}{\pgfusepath{discard}}%
+ \endgroup
+}%
+
+\def\pgfplots@BEGIN@cell@picture[#1]{%
+ %
+ \pgfplots@define@preliminary@current@axis@node
+ %
+ \pgfplotsutil@BEGIN@cell@picture[#1]%
+}%
+\def\pgfplotsutil@BEGIN@cell@picture[#1]{%
\setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup
\pgfinterruptpicture
- \tikzpicture[/pgfplots/every axis]%
+ \tikzpicture[#1]%
% set baseline for sub-picture to default value.
% the baseline option will be applied to the OUTER picture.
\pgfsetbaseline{\pgf@picminy}%
@@ -7698,15 +7126,142 @@
\xdef\pgfplots@glob@TMPa{{\aa}{\ab}{\ba}{\bb}}%
\endgroup
\expandafter\pgfsettransformentries\pgfplots@glob@TMPa{0pt}{0pt}%
+}
+
+\def\pgfplotsutil@END@cell@picture#1{%
+ \endtikzpicture%
+ \begingroup
+ \ifdim\pgf@picmaxx=-16000pt\relax%
+ \pgf@picmaxx=0pt\relax%
+ \pgf@picminx=0pt\relax%
+ \pgf@picmaxy=0pt\relax%
+ \pgf@picminy=0pt\relax%
+ \fi%
+ #1
+ \endgroup
+ \endpgfinterruptpicture
+ \egroup\egroup% end of pgfnodepartimagebox
+ %
+ % restore any shift transformations provided to an axis.
+ % These would be lost otherwise.
+ \pgftransformshift{\pgfplots@savedtransformshift}%
+ %
+ % allow positioning of colorbars with this hook.
+ % It is \relax unless this here is a color bar axis.
+ % Its intention is to re-define `\pgfplots@at':
+ \pgfplots@colorbar@position@hook%
+ %
+ \pgftransformshift{\pgfplots@at}%
+ %
+}%
+\def\pgfplots@END@cell@picture{%
+ \pgfplotsutil@END@cell@picture{\pgfplots@END@cell@picture@preparepoints}%
+}%
+
+\def\pgfplots@END@cell@picture@preparepoints{%
+ % Protocol sizes for the axis-shape.
+ % That needs to be done globally, do avoid all those
+ % \endgroup's in and after \endpgfinterruptpicture ...
+ %
+ \xdef\pgfplotspointorigininternal{\global\pgf@x=\the\pgf@picminx\space\global\pgf@y=\the\pgf@picminy\space}%
+ %
+ \ifpgfplots@deprecated@anchors
+ \pgfplotspointminminmin
+ \else
+ \pgfplotspointbblowerleft
+ \fi
+ \pgf@xa=\pgf@x
+ \pgf@ya=\pgf@y
+ \pgf@pos@transform\pgf@xa\pgf@ya
+ \advance\pgf@xa by-\pgf@picminx
+ \advance\pgf@ya by-\pgf@picminy
+ \xdef\pgfplotspointlowerleftinnercorner{%
+ \global\pgf@x=\the\pgf@xa\space
+ \global\pgf@y=\the\pgf@ya\space
+ }%
+ %
+ \global\pgf@x=\pgf@picmaxx
+ \global\pgf@y=\pgf@picmaxy
+ \global\advance\pgf@x by-\pgf@picminx
+ \global\advance\pgf@y by-\pgf@picminy
+ \xdef\pgfplotspointupperrightcorner{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
+ %
+ \pgfplotspointaxisorigin
+ \pgf@pos@transform\pgf@x\pgf@y
+ \global\advance\pgf@x by-\pgf@picminx
+ \global\advance\pgf@y by-\pgf@picminy
+ \xdef\pgfplotspointaxisorigin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
+}
+
+% this here is essentially the same as
+% \pgfpointanchor{current axis}{#1}
+% but it does not need a node.
+\def\pgfplotspointdescriptionbyanchor#1{%
+ \begingroup
+ \edef\pgfplotspointdescriptionbyanchor@{#1}%
+ \gdef\pgfplots@glob@TMPa{0}%
+ % do a linear search through all anchors of
+ % shape pgfplots@low@level@shape@INNER :
+ \def\anchor##1##2{%
+ \def\pgfplots@loc@TMPa{##1}%
+ \ifx\pgfplots@loc@TMPa\pgfplotspointdescriptionbyanchor@
+ \pgf@process{##2}%
+ \gdef\pgfplots@glob@TMPa{1}%
+ \fi
+ }%
+ \pgfplots@low@level@shape@INNER@define
+ \if0\pgfplots@glob@TMPa
+ \pgfplots@error{The anchor '#1' is unsupported in this context.}%
+ \fi
+ \endgroup
+}%
+
+\def\pgfplots@BEGIN@cell@picture@DISABLED[#1]{%
+ \begingroup
+ \pgfinterruptboundingbox
+ %
+ %
+ % allow positioning of colorbars with this hook.
+ % It is \relax unless this here is a color bar axis.
+ % Its intention is to re-define `\pgfplots@at':
+ \pgfplots@colorbar@position@hook%
+ %
+ \pgftransformshift{\pgfplots@at}%
+ %
+ % prepare a priori anchor transformation (see
+ % \pgfplots@prepare@cell@picture for details):
+ \pgftransformshift{%
+ \pgfqpointscale{-1}{\pgfplotspointdescriptionbyanchor{\pgfplots@anchorname@internal}}%
+ }%
+ %
+ \pgfplots@define@preliminary@current@axis@node
+ %
+ \scope[#1]%
+}%
+\def\pgfplots@END@cell@picture@DISABLED{%
+ \endscope%
+ \begingroup
+ \pgfplots@END@cell@picture@preparepoints%
+ \endgroup
+ \endpgfinterruptboundingbox
+ \endgroup
+}%
+
+\def\pgfplots@BEGIN@init@and@draw@axis{%
%
%
\pgfplots@draw@axis@pre
\pgfplots@draw@axis@is@prepared
\scope
%
- \pgfkeysifdefined{/pgfplots/axis background/.@cmd}{%
- \path[/pgfplots/axis background] \pgfextra{\pgfplots@clippath@install{}};%
- }{}%
+ \pgfkeysgetvalue{/pgfplots/axis background/.@cmd}\pgfplots@loc@TMPa
+ \ifx\pgfplots@loc@TMPa\pgfplots@empty@style@key
+ \else
+ \pgfplotsgetlayerforstyle{/pgfplots/axis background,/pgfplots/axis background@}%
+ \pgfplotsonlayer{\pgfplotsretval}{axis background}%
+ \path[/pgfplots/axis background,/pgfplots/axis background@] \pgfextra{\pgfplots@clippath@install{}};%
+ \endpgfplotsonlayer
+ \fi
%
\ifpgfplots@axis@on@top
\else
@@ -7714,7 +7269,10 @@
\fi
% CLIPPING:
\ifpgfplots@clip
- \pgfplots@clippath@install{\pgfusepath{clip}}%
+ \if1\pgfplots@clipmode
+ % 'clip=true' and 'clip/mode=global':
+ \pgfplots@clippath@install{\pgfusepath{clip}}%
+ \fi
\fi
\pgfplotspointbb@assertvaluesexist%
}
@@ -7986,7 +7544,7 @@
% clip path routine; it will be used quite often.
%
\let\pgfplots@clippath@install@pathcmd=\pgfplots@clippath@install
- \iffalse% FIXME : this needs to be fixed
+ \iffalse
\pgf@resetpathsizes% FIXME: this here should not be necessary!
\pgfsysprotocol@getcurrentprotocol\pgfplots@loc@TMPa%
\begingroup
@@ -8004,7 +7562,7 @@
\endgroup
\let\pgfplots@clippath@install@clip@protocolled=\pgfplots@glob@TMPa
\pgfsysprotocol@setcurrentprotocol\pgfplots@loc@TMPa%
- \fi
+ \fi
%
% Replace \pgfplots@clippath@install by one which makes use of the
% optimized version (if ##1=\pgfusepath{clip})
@@ -8062,6 +7620,16 @@
\pgfplots@error{Can't install a clippath here - the command has not yet been prepared.}%
}%
+
+% Generates a path representing the outline of the axis.
+% Example:
+%
+% \pgfplotspathaxisoutline
+% \pgfusepath{clip}
+\def\pgfplotspathaxisoutline{%
+ \pgfplots@clippath@install{}%
+}%
+
% This is the counterpart for \pgfplots@BEGIN@init@and@draw@axis
\def\pgfplots@END@init@and@draw@axis{%
\endscope%
@@ -8071,19 +7639,25 @@
\fi
\pgfplots@draw@axis@post
%
+ % Draw any markers for which drawing has been postponed.
+ %
+ % The motivation here is that markers should be drawn on top of
+ % their plots, and AFTER the clip path.
+ %
+ % If the plotting logic added serialized marker streams to
+ % \pgfplots@stored@markerlist, these markers will be plotted here.
+ %
+ % Note that this list will be EMPTY if
+ % \ifpgfplots@clip@marker@paths is true.
+ %
% whats the better sequence for \ifpgfplots@axis@on@top and \ifpgfplots@clip@marker@paths !?
% This here looks better, I think... markers should not be obscured by descriptions.
- \ifpgfplots@clip@marker@paths
- \else
- \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{%
- \scope% make sure that 'fill opacity' and 'dotted' styles remain local!
+ \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{%
%\message{Executing marker stuff: \meaning\pgfplots@loc@TMPa]]]]]}%
%\tracingmacros=2\tracingcommands=2
- \pgfplots@loc@TMPa
- \endscope
- }%
- \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear.
- \fi
+ \pgfplots@loc@TMPa
+ }%
+ \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear.
%
\begingroup
\pgfkeysvalueof{/pgfplots/after end axis/.@cmd}\pgfeov%
@@ -8436,6 +8010,11 @@
%
\pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa%
\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
+ \def\pgfplots@loc@TMPb{e}%
+ \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
+ % log basis x=e : same as empty value.
+ \let\pgfplots@loc@TMPa=\pgfutil@empty
+ \fi
\ifx\pgfplots@loc@TMPa\pgfutil@empty
% log basis x={} (initial setting:)
\else
@@ -8816,6 +8395,13 @@
% confused if the catcodes change... this here is a
% work-around for babel support.
\let\pgfplots@checkandpreparefor@active@semicolon\relax
+ %
+ % make sure that 'every colorbar' is checked by the key-filtering
+ % stuff: we want to find 'ymode=log' inside of it.
+ % Note that we have to change it here because only the colorbar
+ % should expand 'every colorbar' that early in the processing:
+ \pgfkeys{/pgfplots/every colorbar/.belongs to family=/pgfplots/scale}%
+ %
\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\pgfeov
}
\pgfkeysdef{/pgfplots/colorbar to name/at}{%
@@ -8896,6 +8482,22 @@
\pgfplots@set@keymacro@to@style\pgfplots@rmopts{#1}%
}
+% Invokes \pgfplots@set@keys@from@tikz@style and handles the "on
+% layer" key.
+%
+% More precisely, it stores any "on layer" value found in style "#1"
+% in
+% /pgfplots/layers for styles/#1.
+%
+% If there is no such value, it will store the empty string (main
+% layer)
+\def\pgfplots@set@keys@from@tikz@style@and@handle@layer#1{%
+ \pgfkeyslet{/pgfplots/on layer}\pgfutil@empty
+ \pgfplots@set@keys@from@tikz@style{#1}%
+ \pgfkeysgetvalue{/pgfplots/on layer}\pgfplots@loc@TMPa
+ \pgfkeyslet{/pgfplots/layers for styles/#1}\pgfplots@loc@TMPa
+}%
+
% The same as \pgfplots@set@keys@from@tikz@style but this one appends
% unmatched options to style #2.
%
@@ -9102,6 +8704,20 @@
\pgfkeysdeactivatefamily{/pgfplots/naming commands}%
\pgfkeysdeactivatefamily{/pgfplots/shared with tikz}%
%
+ \ifpgfplots@axis@on@top
+ \ifpgfplots@layered@graphics
+ \pgfplots@log3{the combination of 'axis on top' and 'activate layers' implies 'set layers=axis on top'. Deactivate 'axis on top' if you want other layers.}%
+ \pgfplotsset{set layers=axis on top}%
+ \fi
+ \fi
+ % retrieve layer configurations (the one set with 'set layers*').
+ \pgfkeysgetvalue{/pgfplots/@set layers arg}\pgfplots@loc@TMPa
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \else
+ % ah, yes: then set its style:
+ \pgfqkeys{/pgfplots/layers}{\pgfplots@loc@TMPa}% note that this here should not need key filtering; it adjusts only styles (hopefully ;) )
+ \fi
+ %
% Now, any 'name' and 'alias' options have been processed.
%
% Remember their current meaning and reset the tikz options!
@@ -9118,16 +8734,16 @@
\pgfkeysgetvalue{/tikz/alias/.@cmd}\pgfplots@old@alias@impl
}{}%
\pgfkeysdef{/tikz/name}{%
- \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{##1}}%
+ \pgfplots@add@named@child@node{##1}%
\pgfplots@old@name@impl##1\pgfeov
}%
\pgfkeysdef{/tikz/alias}{%
- \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{##1}}%
+ \pgfplots@add@named@child@node{##1}%
\pgfplots@old@alias@impl##1\pgfeov
}%
%
% Now, continue to process the 'every' styles. Please note that
- % the 'legend style={}' like options have already been processed;
+ % options like 'legend style={}' have already been processed;
% their values are already inside of the associated 'every'
% styles.
%
@@ -9140,7 +8756,7 @@
% 'legend style={legend pos=outer north east}':
\pgfkeysdef{/pgfplots/every axis legend/.append style}{\pgfkeysalso{##1}}%
%
- \pgfplots@set@keys@from@tikz@style{every axis legend}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every axis legend}%
%
% restore:
\pgfkeysdef{/pgfplots/every axis legend/.append style}{%
@@ -9159,12 +8775,12 @@
%\pgfkeysdeactivatefamily{/pgfplots/descriptions}%
%
\pgfkeysactivatefamily{/pgfplots/tick}%
- \pgfplots@set@keys@from@tikz@style{every tick}%
- \pgfplots@set@keys@from@tikz@style{every minor tick}%
- \pgfplots@set@keys@from@tikz@style{every major tick}%
- \pgfplots@set@keys@from@tikz@style{every axis grid}%
- \pgfplots@set@keys@from@tikz@style{every minor grid}%
- \pgfplots@set@keys@from@tikz@style{every major grid}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every tick}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every minor tick}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every major tick}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every axis grid}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every minor grid}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every major grid}%
\pgfkeysdeactivatefamily{/pgfplots/tick}%
%
%--------------------------------------------------
@@ -9178,9 +8794,9 @@
% ensure that \axis[<options>] take higher precedence).
%\pgfkeysactivatefamily{/pgfplots/descriptions}%
\pgfkeysactivatefamily{/pgfplots/tick}%
- \pgfplots@set@keys@from@tikz@style{every x tick label}%
- \pgfplots@set@keys@from@tikz@style{every y tick label}%
- \pgfplots@set@keys@from@tikz@style{every tick label}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every x tick label}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every y tick label}%
+ \pgfplots@set@keys@from@tikz@style@and@handle@layer{every tick label}%
\pgfkeysdeactivatefamily{/pgfplots/tick}%
%\pgfkeysdeactivatefamily{/pgfplots/descriptions}%
%
@@ -9240,10 +8856,24 @@
\global\let\pgfplots@firstplot@coords@z=\pgfutil@empty
\pgfkeysalso{/pgfplots/.search also=/tikz}%
%
+ \pgfkeysifdefined{/tikz/on layer}{}{%
+ % make sure assignments 'on layer' in the /tikz/ prefix
+ % doesn't hurt.
+ % this may happen, for example with
+ % 'x grid style={on layer=...}'
+ % because 'x grid style' is not processed by the key filtering
+ % above (it is extracted later).
+ \pgfkeyslet{/tikz/on layer}\pgfutil@empty%
+ }%
+ %
\pgfplots@set@options@sanitize
\pgfplots@notify@options@are@set
}
+\def\pgfplots@add@named@child@node#1{%
+ \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{#1}}%
+}%
+
\def\pgfplots@notify@options@are@set{}%
\def\pgfplots@install@abbrev@commands{
@@ -9386,6 +9016,9 @@
{/pgf/key filters/defined}}%
\def\pgfplots@label@tikzopts{}%
\pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}%
+ % FIXME : this fails if 'error bars/.cd,/pgfplots/.cd' is used inside of #1 --
+ % the second /pgfplots/.cd will be applied, but the error bars
+ % command not
\pgfqkeysfiltered{/tikz}{#1}%
%
\pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}%
@@ -9797,6 +9430,9 @@
%
\pgfplots@set@options{#1}%
%
+ \pgfplots@prepare@layered@graphics
+ %
+ \pgfplots@prepare@cell@picture
%
%
%
@@ -9881,7 +9517,12 @@
\pgfplots@autocompute@all@limitsfalse
\fi
%
- \pgfplots@declare@mathfunctions
+ \pgfutil@ifundefined{pgfmathdeclarefunction}{%
+ % SKIP: \pgfmathdeclarefunction is unavailable in pgf 2.00 .
+ % UPGRADE TO PGF 2.10 to use these math functions.
+ }{%
+ \pgfplots@declare@mathfunctions
+ }%
%
% check for axis-wide 'point meta min' :
\pgfkeysgetvalue{/pgfplots/point meta min}\pgfplots@loc@TMPa
@@ -9938,6 +9579,18 @@
\let\scope=\pgfplots@replacement@for@scope
\let\endscope=\pgfplots@replacement@for@endscope
%
+ \let\pgfplots@orig@pgfonlayer=\pgfonlayer
+ \let\pgfplots@orig@endpgfonlayer=\endpgfonlayer
+ \let\pgfonlayer=\pgfplots@replacement@for@onlayer
+ \let\endpgfonlayer=\pgfplots@replacement@for@endonlayer
+ %
+ \let\pgfplots@orig@pgfplotsonlayer=\pgfplotsonlayer
+ \let\pgfplots@orig@endpgfplotsonlayer=\endpgfplotsonlayer
+ \let\pgfplotsonlayer=\pgfplots@replacement@for@onlayer
+ \let\endpgfplotsonlayer=\pgfplots@replacement@for@endonlayer
+ %
+ % allow layer changes within the environment; reset:
+ \pgfkeyslet{/pgfplots/on layer}\pgfutil@empty
}
% \end{axis} :
@@ -9959,6 +9612,10 @@
\let\plot=\pgfplots@orig@plot
\let\scope=\pgfplots@orig@scope
\let\endscope=\pgfplots@orig@endscope
+ \let\pgfonlayer=\pgfplots@orig@pgfonlayer
+ \let\endpgfonlayer=\pgfplots@orig@endpgfonlayer
+ \let\pgfplotsonlayer=\pgfplots@orig@pgfplotsonlayer
+ \let\endpgfplotsonlayer=\pgfplots@orig@endpgfplotsonlayer
%
\pgfplotssurveyphase@setactiveplothandlers
%
@@ -9966,131 +9623,99 @@
%
%\end{axis}:
%
- \begingroup
- \pgfplots@sys@beforenode
- % create a leight-weight 'current axis' node for anchor references
- % (which may happen during both, the axis descriptions or any
- % path/plot commands).
- \pgfmultipartnode{pgfplots@low@level@shape@INNER}{image}{current axis}{\pgfusepath{discard}}%
- \endgroup
- %
% --------------------
% All plotting commands have been read.
% -> apply postponed drawing commands!
% --------------------
- \pgfplots@BEGIN@init@and@draw@axis
- %
- % replace some of tikz's paths (like ellipse and path): make them
- % aware of any transformations:
- \pgfplots@install@path@replacements
- %
- \pgfplots@stacked@initialise
- \global\pgfplotslistnewempty\pgfplots@stored@markerlist
- \ifpgfplots@stacked@reverse
- % This here applies any scaling trafos and assembles a
- % NEW \pgfplots@stored@plotlist!
- \pgfplots@stacked@finalize@stored@plots
- \fi
- \pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{%
- \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa
+ \pgfplots@determinedefaultvalues
+ \pgfplots@BEGIN@cell@picture[/pgfplots/every axis]%
+ \pgfplots@BEGIN@init@and@draw@axis
+ %
+ % replace some of tikz's paths (like ellipse and path): make them
+ % aware of any transformations:
+ \pgfplots@install@path@replacements
+ %
+ \pgfplots@stacked@initialise
+ \global\pgfplotslistnewempty\pgfplots@stored@markerlist
+ \ifpgfplots@stacked@reverse
+ % This here applies any scaling trafos and assembles a
+ % NEW \pgfplots@stored@plotlist!
+ \pgfplots@stacked@finalize@stored@plots
+ \fi
+ \pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{%
+ \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa
%\message{^^JProcessing stored plot with precommand '\meaning\pgfplots@stored@current@precmd';^^J pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd'^^J postcommand '\meaning\pgfplots@stored@current@postcmd'^^J}%
%\message{DATA: '\meaning\pgfplots@stored@current@data';^^J}%
- % The precmd sets all required variables needed to
- % finalize a plot.
- \ifx\pgfplots@stored@current@cmd\pgfutil@empty
- \pgfplots@stored@current@data%
- \else
- \begingroup
+ % The precmd sets all required variables needed to
+ % finalize a plot.
% @see the stream preparation routines.
\pgfplots@stored@current@precmd
- \pgfkeysvalueof{/pgfplots/execute at begin plot visualization}%
- \ifpgfplots@threedim
- \else
- % axis = 2d and plot=3d is forbidden here.
- \pgfplots@curplot@threedimfalse
- \fi
- %
- % this code here means we REALLY have a plotting
- % command!
- \scope[current plot style] % this sets BOTH pgfplots and tikz options.
- % FIXME : what, precisely, was the motivation to use a
- % scope here? It causes a lot of problems and
- % work-arounds. Is it worth the effort!?
- %
- % de-activate the FPU here! I fear its number
- % format may cause errors when used in low-level
- % routines.
- \pgfkeys{/pgf/fpu=false}%
- %
- \ifpgfplots@stacked@reverse
- % has already been processed above, in \pgfplots@stacked@finalize@stored@plots.
- \pgfplots@stacked@draw@reversed@plot
+ \ifx\pgfplots@stored@current@cmd\pgfutil@empty
+ % Ah: some \pgfplotsextra command like \draw,\path,
+ % \node or even \scope or \endscope.
+ %
+ % do NOT call \pgfplotsonlayer here! We MUST NOT
+ % destroy grouping levels here.
+ \pgfplots@stored@current@data%
\else
- % modifies \pgfplots@stored@markerlist if necessary.
- \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI
+ %
+ % this code here means we REALLY have a plotting
+ % command!
+ \begingroup
+ \pgfplotsonlayer{\pgfkeysvalueof{/pgfplots/on layer}}{a plot or graphical element (or inherited from the axis)}%
+ \pgfkeysvalueof{/pgfplots/execute at begin plot visualization}%
+ \ifpgfplots@threedim
+ \else
+ % axis = 2d and plot=3d is forbidden here.
+ \pgfplots@curplot@threedimfalse
+ \fi
+ \pgfplots@execute@at@begin@plot@visualization@internal
+ \scope[current plot style] % this does set BOTH pgfplots and tikz options.
+ % FIXME : what, precisely, was the motivation to use a
+ % scope here? It causes a lot of problems and
+ % work-arounds. Is it worth the effort!?
+ \ifpgfplots@clip
+ \if2\pgfplots@clipmode
+ % clip=true and 'clip mode=individual'
+ \pgfplots@clippath@install{\pgfusepath{clip}}%
+ \fi
+ \fi
+ %
+ \pgfplots@prepare@layered@graphics@marks
+ %
+ % de-activate the FPU here! I fear its number
+ % format may cause errors when used in low-level
+ % routines.
+ \pgfkeys{/pgf/fpu=false}%
+ %
+ \ifpgfplots@stacked@reverse
+ % has already been processed above, in \pgfplots@stacked@finalize@stored@plots.
+ \pgfplots@stacked@draw@reversed@plot
+ \else
+ % modifies \pgfplots@stored@markerlist if necessary.
+ \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI
+ \fi
+ \endscope
+ \pgfplots@execute@at@end@plot@visualization@internal
+ \pgfkeysvalueof{/pgfplots/execute at end plot visualization}%
+ \endpgfplotsonlayer
+ \endgroup
\fi
- \endscope
- \pgfkeysvalueof{/pgfplots/execute at end plot visualization}%
\pgfplots@stored@current@postcmd
- \endgroup
- \fi
- }%
- \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents.
- %
- \pgfplots@END@init@and@draw@axis
- %
- \pgfplots@create@axis@descriptions
- %
- \endtikzpicture%
- \begingroup
- % Protocol sizes for the axis-shape.
- % That needs to be done globally, do avoid all those
- % \endgroup's in and after \endpgfinterruptpicture ...
- \ifdim\pgf@picmaxx=-16000pt\relax%
- \pgf@picmaxx=0pt\relax%
- \pgf@picminx=0pt\relax%
- \pgf@picmaxy=0pt\relax%
- \pgf@picminy=0pt\relax%
- \fi%
- %
- \xdef\pgfplots@saveddimen@picminx{\the\pgf@picminx}%
- \xdef\pgfplots@saveddimen@picminy{\the\pgf@picminy}%
- %
- \ifpgfplots@deprecated@anchors
- \pgfplotspointminminmin
- \else
- \pgfplotspointbblowerleft
- \fi
- \pgf@xa=\pgf@x
- \advance\pgf@xa by-\pgf@picminx
- \xdef\pgfplots@savedanchor@inner@lowerleft@x{\the\pgf@xa}%
+ }%
+ \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents.
%
- \pgf@xa=\pgf@y
- \advance\pgf@xa by-\pgf@picminy
- \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}%
+ \pgfplots@END@init@and@draw@axis
%
- \pgfplotspointaxisorigin
- \global\advance\pgf@x by-\pgf@picminx
- \global\advance\pgf@y by-\pgf@picminy
- \xdef\pgfplotspointaxisorigin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
- \endgroup
- \endpgfinterruptpicture
- \egroup\egroup% end of pgfnodepartimagebox
+ \pgfplots@create@axis@descriptions
+ %
+ % this here does \endtikzpicture\endpgfinterruptpicture
+ % (and stores sizes):
+ \pgfplots@END@cell@picture
%
\let\tikz@fig@name=\pgfplots@fig@name
\tikz@fig@mustbenamed
%
- % restore any shift transformations provided to an axis.
- % These would be lost otherwise.
- \pgftransformshift{\pgfplots@savedtransformshift}%
- %
- % allow positioning of colorbars with this hook.
- % It is \relax unless this here is a color bar axis.
- % Its intention is to re-define `\pgfplots@at':
- \pgfplots@colorbar@position@hook%
- %
- \pgftransformshift{\pgfplots@at}%
- %
\edef\pgfplots@shapename{pgfplots@low@level@shape\ifpgfplots@deprecated@anchors @deprecated\fi}%
\pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{%
% Oh. Well, suppose \pgfplots@anchorname is associated to an
@@ -10102,7 +9727,7 @@
% \pgfplots@finally@correct@child@node@positions).
% Do that here with \pgfplots@saveddimen@picminx:
\pgfpointdiff
- {\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}}
+ {\pgfplotspointorigininternal}
{##1}%
\global\pgf@x=-\pgf@x \global\pgf@y=-\pgf@y
}%
@@ -10112,7 +9737,7 @@
}{}%
%
\begingroup
- \pgfplots@sys@beforenode
+ \pgfplots@beforenode
%
\ifpgfplots@deprecated@anchors
\pgfplots@restore@deprecated@lowlevel@shape
@@ -10132,10 +9757,40 @@
\else
\global\let\pgfplots@glob@TMPa=\relax
\fi
+ %
+ % transport the current layer config - but only if nessary!
+ \def\pgfplots@loc@TMPa{0}%
+ \ifpgfplots@has@cell@picture
+ % layers are used for the cell picture only- no need to
+ % communicate them.
+ \else
+ \ifpgfplots@layered@graphics
+ \def\pgfplots@loc@TMPa{1}%
+ \else
+ % there are no layers.
+ \fi
+ \fi
+ \if1\pgfplots@loc@TMPa
+ % Ah - we need to transport the current layer config!
+ \pgf@remember@layerlist@globally
+ \aftergroup\pgf@restore@layerlist@from@global
+ \else
+ % Hm. No layers to transport. Make sure that the second
+ % \aftergroup does not hurt:
+ \aftergroup\pgf@remember@layerlist@globally
+ \fi
\endgroup
\pgfplots@glob@TMPa
+ %
+ % once more again - just to be sure that it works with LaTeX which
+ % introduces a further grouping level:
+ \aftergroup\pgf@restore@layerlist@from@global
}
+\def\pgfplots@beforenode{%
+ \pgfplots@sys@beforenode
+}%
+
% Now, we need to process all named nodes inside of our
% axis-image.
%
@@ -10170,7 +9825,7 @@
\pgfpointanchor{\tikz@fig@name}{image}%
\pgf@xa=\pgf@x
\pgf@xb=\pgf@y
- \pgf@process{\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}}%
+ \pgf@process{\pgfplotspointorigininternal}%
\advance\pgf@xa by-\pgf@x
\advance\pgf@xb by-\pgf@y
\global\pgf@x=\pgf@xa
@@ -10248,6 +9903,8 @@
\tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis
\tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis
+%\input pgfplots.multiaxis.code.tex
+
\pgfplotsdefineaxistype{rectangle}{%
% do nothing, this is the default anyway.
}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex
index 7ecfb8a5957..aee93120a5e 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex
@@ -1,3 +1,3 @@
\def\pgfplotsrevision{%
-1.5.1-4-g53e640f
+1.6.1
}
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex
new file mode 100644
index 00000000000..79a4e5a11de
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex
@@ -0,0 +1,3332 @@
+%--------------------------------------------
+%
+% Package pgfplots
+%
+% Provides a user-friendly interface to create function plots (normal
+% plots, semi-logplots and double-logplots).
+%
+% It is based on Till Tantau's PGF package.
+%
+% Copyright 2007-2012 by Christian Feuersänger.
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%--------------------------------------------
+
+% PRECONDITION:
+% - final axis limits are given in transformed range
+% - \pgfplots@set@default@size@options has been invoked before
+% POSTCONDITION:
+% - the current x,y and z unit vectors are defined properly;
+% - the fast-access registers are initialised for the axis limits,
+% - the following macros are assigned:
+% \pgfplots@[xyz]@veclength
+% \pgfplots@[xyz]@inverseveclength
+% \pgfplotspointxaxis
+% \pgfplotspointyaxis
+% \pgfplotspointzaxis
+% \pgfplotspointcenter
+% \pgfplotspointminminmin
+%
+\def\pgfplots@initsizes{%
+ % INIT.
+ %
+ %
+ \pgfplots@xmin@reg=\pgfplots@xmin pt %
+ \pgfplots@xmax@reg=\pgfplots@xmax pt %
+ \pgfplots@ymin@reg=\pgfplots@ymin pt %
+ \pgfplots@ymax@reg=\pgfplots@ymax pt %
+ \ifpgfplots@threedim
+ \pgfplots@zmin@reg=\pgfplots@zmin pt %
+ \pgfplots@zmax@reg=\pgfplots@zmax pt %
+ \fi
+ %
+ %-----------------------------------------
+ % PROCESS THE 'width' and 'height' options
+ %-----------------------------------------
+ %
+ %
+ \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}%
+ \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}%
+ \ifpgfplots@threedim
+ \else
+ \let\pgfplots@view@el=\pgfutil@empty
+ \let\pgfplots@view@az=\pgfutil@empty
+ \fi
+ \ifx\pgfplots@view@az\pgfutil@empty
+ % Note that in presence of "x,y,z" options, the
+ % \pgfplots@set@default@size@options RESETS /pgfplots/view/az.
+ %
+ %\let\pgfplots@rectangle@width=\pgfutil@empty
+ %\let\pgfplots@rectangle@height=\pgfutil@empty
+ \pgfplotsmathvectorfromstring{0,0,1}{default}%
+ \let\pgfplots@view@dir@threedim=\pgfplotsretval
+ %
+ \ifx\pgfplots@x\pgfutil@empty
+ \ifx\pgfplots@width\pgfutil@empty
+ \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}%
+ \fi
+ \fi
+ %
+ \ifx\pgfplots@y\pgfutil@empty
+ \ifx\pgfplots@height\pgfutil@empty
+ \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}%
+ \fi
+ \fi
+ \ifpgfplots@threedim
+ \def\pgfplots@tmp@Zscale{1}%
+ \else
+ \def\pgfplots@tmp@Zscale{0}%
+ \fi
+ %
+ \pgfplots@initsizes@setunitvector{x}{0}{1}{\pgfplots@tmp@xisaxisparallel}%
+ \pgfplots@initsizes@setunitvector{y}{1}{1}{\pgfplots@tmp@yisaxisparallel}%
+ \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmp@Zscale}{\pgfplots@loc@TMPc}%
+ \pgfplots@scale@plotbox@to@widthheight
+ \ifpgfplots@threedim
+ \pgfplotsgetnormalforcurrentview
+ \fi
+ \else
+ % 3D case by `view':
+ \let\pgfplots@x=\pgfutil@empty
+ \let\pgfplots@y=\pgfutil@empty
+ \let\pgfplots@z=\pgfutil@empty
+ \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}%
+ \pgfplots@scale@plotbox@to@widthheight
+ \if1\pgfplots@tmp@xisaxisparallel%
+ \def\pgfplots@tmp@yisaxisparallel{1}%
+ \fi
+ \fi
+%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy), n = (\pgfplots@view@dir@threedim).^^J }%
+ %
+ \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure
+ \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure
+ %
+ \pgfplotsmath@ifzero{\pgfplots@x@veclength}{\pgfplots@hide@xtrue\pgfplots@shownothingof@xtrue}{}%
+ \pgfplotsmath@ifzero{\pgfplots@y@veclength}{\pgfplots@hide@ytrue\pgfplots@shownothingof@ytrue}{}%
+ \ifpgfplots@threedim
+ \pgfplotsmath@ifzero{\pgfplots@z@veclength}{\pgfplots@hide@ztrue\pgfplots@shownothingof@ztrue}{}%
+ \else
+ \if1\pgfplots@tmp@xisaxisparallel%
+ \if1\pgfplots@tmp@yisaxisparallel%
+ % Optimize for axis-parallel case!
+ % puh. Did not make any measureable difference!? Ok...
+ \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal
+ \fi
+ \fi
+ \fi
+}
+
+% Defines \pgfmathresult to be the desired width without axis labels.
+%
+\def\pgfplots@initsizes@get@width@withoutlabels{%
+ \pgfplots@initsizes@handle@label@const{\pgfplots@width}{45pt}{width}%
+}
+
+% Defines \pgfmathresult to be the desired height without axis labels.
+\def\pgfplots@initsizes@get@height@withoutlabels{%
+ \pgfplots@initsizes@handle@label@const{\pgfplots@height}{45pt}{height}%
+}
+
+\def\pgfplots@initsizes@handle@label@const#1#2#3{%
+ \begingroup
+ \pgf@xa=#1\relax
+ % EXPECTED WIDTH = X = \pgfplots@width
+ % ACTUAL WIDTH = c + x * (xmax-xmin)
+ % where c is a CONSTANT (for the axis labels/tick labels).
+ % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin))
+ %
+ % \pgf@xa := X-c:
+ \ifpgfplots@scale@only@axis
+ \else
+ \advance\pgf@xa by-#2 % FIXME determine 'c' correctly!
+ \fi
+ \ifdim\pgf@xa<0pt
+ \pgfplots@error{Error: Plot #3 `#1' is too small. This cannot be implemented while maintaining constant size for labels. Sorry, label sizes are only approximate. You will need to adjust your #3.}%
+ \pgf@xa=0pt
+ \fi
+ \edef\pgfmathresult{\the\pgf@xa}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% #1: axis
+\def\pgfplots@axis@apply@post@scale#1{%
+ %
+ \pgfkeysgetvalue{/pgfplots/#1 post scale}\pgfplots@loc@TMPd
+ \ifx\pgfplots@loc@TMPd\pgfutil@empty
+ \else
+ \pgfmathparse{\csname pgfplots@target@unit@scale@#1x\endcsname*\pgfplots@loc@TMPd}%
+ \expandafter\let\csname pgfplots@target@unit@scale@#1x\endcsname=\pgfmathresult
+ %
+ \pgfmathparse{\csname pgfplots@target@unit@scale@#1y\endcsname*\pgfplots@loc@TMPd}%
+ \expandafter\let\csname pgfplots@target@unit@scale@#1y\endcsname=\pgfmathresult
+ \fi
+}
+
+% 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
+% defined by '#1' and '#2'.
+%
+% 'azimuth' means a rotation around the viewport's x axis. 'elongation' means
+% a rotation around the original coordinate system's z axis.
+%
+% The method works by computing
+% Az = [ cos(azimuth) -sin(azimuth) 0; ...
+% sin(azimuth) cos(azimuth) 0; ...
+% 0 0 1 ];
+%
+%
+% Ax = [ 1 0 0; ...
+% 0 cos(elevation) -sin(elevation) ;...
+% 0 sin(elevation) cos(elevation) ];
+%
+% v= Ax * Az;
+% = [ ...
+% cosaz -sinaz cosel sinaz sinel; ...
+% sinaz cosaz cosel -sinel cosaz; ...
+% 0 sinel cosel ];
+%
+% Then, we use the rotated XZ plane as viewport, that means
+% xvec = v * [1 0 0]' = <first column of v>
+% zvec = v * [0 0 1]' = <third column of v>
+% and we define the projection onto the twodimensional surface
+% spanned by 'xvec' and 'zvec' as
+% P( q ) = [ q^T xvec, q^T zvec ]'
+% for q in R^3.
+% As a consequence, we compute the three unit vectors as
+% x = P( [1 0 0] )
+% = [ cosaz, sinaz sinel ]'
+% y = P( [0 1 0] )
+% = [ sinaz, -sinel cosaz ]'
+% z = P( [0 0 1] )
+% = [ 0, cosel]'
+%
+% Furthermore, the 3D view vector which points into the direction of the view
+% is
+% n = v * [0 1 0 ]' = <second column of v> = [-sinaz cosel, cosaz cosel, sinel]'
+% because the normal view point was the XZ plane with y as its normal
+% vector.
+% The 3D vector n is returned by this routine as well - it is
+% necessary for some kind of z buffering (determining what is
+% foreground and what is background).
+%
+% INPUT:
+% - #1 : azimuth ("yaw")
+% - #2 : elevation ("pitch")
+% OUTPUT:
+% - #3 : a macro which will be set to '1' if and only if
+% the viewport is the standard XY axis (i.e. azimuth=0, elevation=90).
+% - [xyz] vectors,
+% \pgfplots@view@dir@threedim will contain the three components
+% of 'n' (without the suffix 'pt', but in units of 'pt') (see
+% \pgfplotsmathvectorfromstring).
+\def\pgfplotssetaxesfromazel#1#2#3{%
+ \begingroup
+ \pgfmathparse{#1}%
+ \let\pgfplots@az=\pgfmathresult
+ \pgfmathparse{#2}%
+ \edef\pgfplots@el{-\pgfmathresult}%
+ \pgfmathsin@{\pgfplots@az}%
+ \let\sinaz=\pgfmathresult
+ \pgfmathcos@{\pgfplots@az}%
+ \let\cosaz=\pgfmathresult
+ \pgfmathsin@{\pgfplots@el}%
+ \let\sinel=\pgfmathresult
+ \pgfmathcos@{\pgfplots@el}%
+ \let\cosel=\pgfmathresult
+ % x:
+ \pgfmathmultiply@{\sinaz}{\sinel}%
+ \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpoint{\cosaz pt}{\pgfmathresult pt}}%
+ % y:
+ \pgfmathmultiply@{-\sinel}{\cosaz}%
+ \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpoint{\sinaz pt}{\pgfmathresult pt}}%
+ % z:
+ \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpoint{0pt}{\cosel pt}}%
+ %
+ \pgfkeysgetvalue{/pgfplots/x dir/value}\pgfplots@loc@dirvalue@x
+ \pgfkeysgetvalue{/pgfplots/y dir/value}\pgfplots@loc@dirvalue@y
+ \pgfkeysgetvalue{/pgfplots/z dir/value}\pgfplots@loc@dirvalue@z
+ \if r\pgfplots@loc@dirvalue@x
+ \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}%
+ \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpointscale{-1}{\the\t@pgfplots@toka}}%
+ \fi
+ \if r\pgfplots@loc@dirvalue@y
+ \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPb}%
+ \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpointscale{-1}{\the\t@pgfplots@toka}}%
+ \fi
+ \if r\pgfplots@loc@dirvalue@z
+ \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPc}%
+ \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpointscale{-1}{\the\t@pgfplots@toka}}%
+ \fi
+ %
+ % Process 'plot box ratio':
+ \def\pgfplots@extract@plot@box@ratio##1##2##3##4\pgfplots@EOI{%
+ \pgfmathparse{##1}\let\pgfplots@plotboxratio@x=\pgfmathresult
+ \pgfmathparse{##2}\let\pgfplots@plotboxratio@y=\pgfmathresult
+ \pgfmathparse{##3}\let\pgfplots@plotboxratio@z=\pgfmathresult
+ }%
+ \def\pgfplots@extract@plot@box@ratio@spaces##1 ##2 ##3 ##4\pgfplots@EOI{%
+ \pgfplots@extract@plot@box@ratio{##1}{##2}{##3}{##4}\pgfplots@EOI
+ }%
+ \pgfkeysgetvalue{/pgfplots/plot box ratio}\pgfplots@loc@TMPa
+ % Auto-determine input format which is either '{x}{y}{z}' or 'x y z'
+ \def\pgfplots@loc@TMPb{%
+ \pgfutil@ifnextchar\bgroup{%
+ \pgfplots@loc@tmptrue
+ \pgfplots@gobble@until@EOI
+ }{%
+ \pgfplots@loc@tmpfalse
+ \pgfplots@gobble@until@EOI
+ }%
+ }%
+ \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfplots@EOI
+ \ifpgfplots@loc@tmp
+ % Ah- braces format.
+ \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa{1}{1}{1}}%
+ \expandafter\pgfplots@extract@plot@box@ratio\pgfplots@loc@TMPa\pgfplots@EOI
+ \else
+ % Ah- space-separated
+ \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa\space 1 1 1}%
+ \expandafter\pgfplots@extract@plot@box@ratio@spaces\pgfplots@loc@TMPa\pgfplots@EOI
+ \fi
+ %
+ % process it:
+ \ifdim\pgfplots@plotboxratio@x pt=1pt
+ \else
+ \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}%
+ \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpointscale{\pgfplots@plotboxratio@x}{\the\t@pgfplots@toka}}%
+ \fi
+ \ifdim\pgfplots@plotboxratio@y pt=1pt
+ \else
+ \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPb}%
+ \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpointscale{\pgfplots@plotboxratio@y}{\the\t@pgfplots@toka}}%
+ \fi
+ \ifdim\pgfplots@plotboxratio@z pt=1pt
+ \else
+ \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPc}%
+ \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpointscale{\pgfplots@plotboxratio@z}{\the\t@pgfplots@toka}}%
+ \fi
+ %
+ % n (3D!)
+ \pgfmathmultiply@{-\sinaz}{\cosel}%
+ \let\pgfmathresultNx=\pgfmathresult
+ \pgfmathmultiply@{\cosaz}{\cosel}%
+ \xdef\pgfplots@glob@TMPd{{\pgfmathresultNx}{\pgfmathresult}{\sinel}}%
+ \endgroup
+%\message{Setting x,y and z from {#1}{#2} to^^J x = \meaning\pgfplots@glob@TMPa,^^J y = \meaning\pgfplots@glob@TMPb,^^J z = \meaning\pgfplots@glob@TMPc,^^J n = \pgfplots@glob@TMPd.^^J}%
+ \pgfsetxvec{\pgfplots@glob@TMPa}%
+ \pgfsetyvec{\pgfplots@glob@TMPb}%
+ \pgfsetzvec{\pgfplots@glob@TMPc}%
+ \def\pgfplots@loc@TMPa##1##2##3{%
+ \pgfplotsmathvectorfromstring{##1,##2,##3}{default}%
+ \let\pgfplots@view@dir@threedim=\pgfplotsretval
+ }%
+ \expandafter\pgfplots@loc@TMPa\pgfplots@glob@TMPd\relax
+ \def#3{0}%
+}%
+
+% Takes the current plot box, defined by the actual PGF x,y and z unit
+% vectors, and re-scales it such that it fits into the
+% width and height of the axis (as they have been provided by the
+% user).
+%
+% @see \pgfplots@scale@axisbox@to@widthheight
+% @see\pgfplots@scaleaxes@to@BB
+\def\pgfplots@scale@plotbox@to@widthheight{%
+ \pgfplots@initsizes@get@width@withoutlabels
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \pgfplots@initsizes@get@height@withoutlabels
+ %
+ \edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}{\pgfmathresult}}%
+ \expandafter\pgfplots@scaleaxes@to@BB\pgfplots@loc@TMPa
+}
+
+
+% Takes the current PGF x,y and z unit vectors and scales them such
+% that the bounding box of the final image has width #1 and height #2.
+%
+% The relative length of the input vectors is important for the 3D case: it
+% will be scaled as-is.
+%
+% PRECONDITION
+% - the x, y and z unit vectors have been set to the proper
+% DIRECTIONS. Their relative vector lengths are set-up properly
+% (i.e. y is twice as large as x and half as large as z or so).
+% - the \ifpgfplots@threedim boolean is set.
+% - the data limits have been initialised and transformed according
+% to the data transformation.
+% - the data transformation has ONLY been applied to the axis limits
+% (not other axis inputs). It may be changed by this method.
+%
+% POSTCONDITION
+% - the unit vectors have been re-scaled such that the final plot
+% has the desired dimensions.
+% - the @veclength and @inverseveclength have been initialized
+\def\pgfplots@scaleaxes@to@BB#1#2{%
+ \if0\pgfplots@scale@mode@choice
+ % scale mode=auto
+ \def\pgfplots@scale@mode@choice{2}% stretch to fill
+ \fi
+ \pgfplots@scaleaxes@to@BB@{#1}{#2}%
+ \pgfplots@computeunitvectorlengths
+ \pgfplots@rescale@view@dir
+}%
+
+\def\pgfplots@rescale@view@dir{%
+ \expandafter\ifx\csname pgfplots@view@dir@threedim\endcsname\relax
+ \else
+ % At this point, we ALREADY HAVE a normal vector. However, it
+ % might be skewed due to the scaling.
+ %
+ % -> recompute normal vector. In earlier versions, I tried to
+ % rescale it - but that was too complicated (for me). This
+ % here produces correct results, and it is a correct approach
+ % anyway.
+ \pgfplotsgetnormalforcurrentview
+ \fi
+}%
+
+% \pgfplots@BB@for@plotbox@get@unit@scales@for@limits{#1}{#2}{#3}:
+% a helper tool which computes individual unit vector scales in order
+% to respect the limits.
+%
+% This method ignores width/height; its purpose is only to make sure
+% that [xmin,xmax] fits into the CURRENT plot box.
+%
+% In this context, each unit vector is supposed to be scaled such that
+% width/height fit if xmin=0 and xmax=1.
+%
+% #1 [output] a macro name which will contain the INVERSE scale for x
+% #2 [output] a macro name which will contain the INVERSE scale for y
+% #3 [output] a macro name which will contain the INVERSE scale for z
+%
+\def\pgfplots@BB@for@plotbox@get@unit@scales@for@limits#1#2#3{%
+ \if1\b@pgfplots@plotbox@xisunit
+ % Consequently, we have to multiply with 1/(max-min):
+ % compute 1/(xmax - xmin) in float for more recent versions (see /pgfplots/compat/scaling).
+ % I observed that it is much more accurate
+ \pgfmathsubtract@{\pgfplots@xmax}{\pgfplots@xmin}%
+ \else
+ \def\pgfmathresult{1}%
+ \fi
+ \let#1=\pgfmathresult
+ %
+ \if1\b@pgfplots@plotbox@yisunit
+ \pgfmathsubtract@{\pgfplots@ymax}{\pgfplots@ymin}%
+ \else
+ \def\pgfmathresult{1}%
+ \fi
+ \let#2=\pgfmathresult
+ %
+ \ifpgfplots@threedim
+ \if1\b@pgfplots@plotbox@zisunit
+ \pgfmathsubtract@{\pgfplots@zmax}{\pgfplots@zmin}%
+ \else
+ \def\pgfmathresult{1}%
+ \fi
+ \else
+ \def\pgfmathresult{1}%
+ \fi
+ \let#3=\pgfmathresult
+}%
+\def\pgfplots@BB@for@plotbox{%
+ \ifpgfplots@threedim
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmin\pgfplots@plotbox@ymin\pgfplots@plotbox@zmin}%
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmin\pgfplots@plotbox@ymin\pgfplots@plotbox@zmax}%
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmin\pgfplots@plotbox@ymax\pgfplots@plotbox@zmin}%
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmin\pgfplots@plotbox@ymax\pgfplots@plotbox@zmax}%
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmax\pgfplots@plotbox@ymin\pgfplots@plotbox@zmin}%
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmax\pgfplots@plotbox@ymin\pgfplots@plotbox@zmax}%
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmax\pgfplots@plotbox@ymax\pgfplots@plotbox@zmin}%
+ \pgfpathmoveto{\pgfqpointxyz\pgfplots@plotbox@xmax\pgfplots@plotbox@ymax\pgfplots@plotbox@zmax}%
+ \else
+ \pgfpathmoveto{\pgfqpointxy\pgfplots@plotbox@xmin\pgfplots@plotbox@ymin}%
+ \pgfpathmoveto{\pgfqpointxy\pgfplots@plotbox@xmin\pgfplots@plotbox@ymax}%
+ \pgfpathmoveto{\pgfqpointxy\pgfplots@plotbox@xmax\pgfplots@plotbox@ymin}%
+ \pgfpathmoveto{\pgfqpointxy\pgfplots@plotbox@xmax\pgfplots@plotbox@ymax}%
+ \fi
+}%
+
+
+
+% Returns width and height of the current plot box
+% (the path produced by \pgfplots@BB@for@plotbox).
+%
+% PRECONDITION: \pgfplots@BB@for@plotbox is defined to produce a path
+% for the plot box
+%
+% POSTCONDITION: \pgfplotsretval contains the with and
+% \pgfplotsretvalb contains the height
+\def\pgfplots@get@dimension@of@BB{%
+ \begingroup
+ \pgfinterruptboundingbox
+ %
+ % the result of this call will be used to scale to target
+ % dimensions. If we omit \pgftransformreset here, we might
+ % accidentally UNDO the PGF transformation matrix (compare by
+ % writing \tikzpicture[scale=0.5] before the axis).
+ \pgftransformreset
+ %
+ % STEP 1: compute the bounding box for the plot box.
+ \pgfplots@BB@for@plotbox
+ %
+ % TMPa = width
+ \pgf@xa=\pgf@pathmaxx
+ \advance\pgf@xa by-\pgf@pathminx
+ % TMPb = height
+ \pgf@xb=\pgf@pathmaxy
+ \advance\pgf@xb by-\pgf@pathminy
+ \xdef\pgfplots@glob@TMPa{%
+ \def\noexpand\pgfplotsretval{\the\pgf@xa}%
+ \def\noexpand\pgfplotsretvalb{\the\pgf@xb}%
+ }%
+ \pgfusepath{discard}%
+ \endpgfinterruptboundingbox
+ \endgroup
+ \pgfplots@glob@TMPa
+}%
+
+\def\pgfplots@scaleaxes@to@BB@prepare@plotbox@limits{%
+ \def\b@pgfplots@rescale@x{1}%
+ \def\b@pgfplots@rescale@y{1}%
+ \def\b@pgfplots@rescale@z{1}%
+ %
+ \pgfplots@scaleaxes@to@BB@prepare@plotbox@limits@ x%
+ \pgfplots@scaleaxes@to@BB@prepare@plotbox@limits@ y%
+ \pgfplots@scaleaxes@to@BB@prepare@plotbox@limits@ z%
+}%
+
+\def\pgfplots@scaleaxes@to@BB@prepare@plotbox@limits@#1{%
+ \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty
+ \expandafter\def\csname pgfplots@plotbox@#1min\endcsname{0}%
+ \expandafter\def\csname pgfplots@plotbox@#1max\endcsname{1}%
+ \expandafter\def\csname b@pgfplots@plotbox@#1isunit\endcsname{1}%
+ \else
+ \pgfutil@namelet{pgfplots@plotbox@#1min}{pgfplots@#1min}%
+ \pgfutil@namelet{pgfplots@plotbox@#1max}{pgfplots@#1max}%
+ \expandafter\def\csname b@pgfplots@plotbox@#1isunit\endcsname{0}%
+ \if2\pgfplots@scale@mode@choice
+ % scale mode=stretch to fill
+ \expandafter\def\csname b@pgfplots@rescale@#1\endcsname{0}%
+ \fi
+ \fi
+ \expandafter\def\csname b@pgfplots@unitvec@is@zero@#1\endcsname{0}%
+ \ifdim\csname pgf@#1x\endcsname=0pt %
+ \ifdim\csname pgf@#1y\endcsname=0pt %
+ \expandafter\def\csname b@pgfplots@unitvec@is@zero@#1\endcsname{1}%
+ \fi
+ \fi
+}
+
+\def\pgfplots@scaleaxes@to@BB@#1#2{%
+ \begingroup
+ %
+ \pgfplots@scaleaxes@to@BB@prepare@plotbox@limits
+ \def\pgfplots@target@limitrescale@x{1}%
+ \def\pgfplots@target@limitrescale@y{1}%
+ \def\pgfplots@target@limitrescale@z{1}%
+ \if1\pgfplots@scale@mode@choice
+ % scale mode=none
+ \def\xscale{1}%
+ \def\yscale{1}%
+ \def\pgfplots@target@unit@scale@inv@x{1}%
+ \def\pgfplots@target@unit@scale@inv@y{1}%
+ \def\pgfplots@target@unit@scale@inv@z{1}%
+ \else
+ %
+ % This here CAN cause anisotropic (different) scaling factors.
+ \pgfplots@BB@for@plotbox@get@unit@scales@for@limits
+ {\pgfplots@target@unit@scale@inv@x}
+ {\pgfplots@target@unit@scale@inv@y}
+ {\pgfplots@target@unit@scale@inv@z}%
+ %
+%\message{got scales to fit limits into BB: x=1/\pgfplots@target@unit@scale@inv@x, y=1/\pgfplots@target@unit@scale@inv@y, z=1/\pgfplots@target@unit@scale@inv@z^^J}%
+ %
+ \if3\pgfplots@scale@mode@choice
+ % scale mode=scale uniformly
+ %
+ % We need to recompensate in case the previous method chose
+ % different unit scaling scalings:
+ \pgfplots@BB@for@plotbox@get@unit@scales@compensated@axis@limits
+ {\pgfplots@target@unit@scale@inv@x}
+ {\pgfplots@target@unit@scale@inv@y}
+ {\pgfplots@target@unit@scale@inv@z}
+ {\pgfplots@target@limitrescale@x}{\pgfplots@target@limitrescale@y}{\pgfplots@target@limitrescale@z}%
+ %
+ %\pgfplots@BB@update@cumulative@limit@compensations
+ \fi
+%\message{adjusted scales for 'scale mode': x=1/\pgfplots@target@unit@scale@inv@x, y=1/\pgfplots@target@unit@scale@inv@y, z=1/\pgfplots@target@unit@scale@inv@z; ^^J axis limit componsation scales x=\pgfplots@target@limitrescale@x, y=\pgfplots@target@limitrescale@y, z=\pgfplots@target@limitrescale@z^^J}%
+ %
+ % ATTENTION: this MODIFIES \pgfplots@target@limitrescale@x and its
+ % variants directly - and it needs the input values.
+ \pgfplots@get@scale@horiz@and@vert
+ {#1}%
+ {#2}%
+ {\xscale}%
+ {\yscale}% yscale
+ {\pgfplots@target@limitrescale@x}%
+ {\pgfplots@target@limitrescale@y}%
+ {\pgfplots@target@limitrescale@z}%
+%\message{Got W/H scale for all x components: \xscale; for all y components: \xscale; ^^J axis limit componsation scales x=1/\pgfplots@target@limitrescale@x, y=1/\pgfplots@target@limitrescale@y, z=1/\pgfplots@target@limitrescale@z^^J}%
+ % Ok, we know the W,H scalings now.
+ %
+ %
+ %
+ \pgfplots@apply@unit@ratio
+ {\pgfplots@target@unit@scale@inv@x}
+ {\pgfplots@target@unit@scale@inv@y}
+ {\pgfplots@target@unit@scale@inv@z}
+ {\pgfplots@target@limitrescale@x@}{\pgfplots@target@limitrescale@y@}{\pgfplots@target@limitrescale@z@}%
+ \pgfplots@BB@update@cumulative@limit@compensations
+ %
+%\message{adjusted scales for 'unit vector ratio': x=1/\pgfplots@target@unit@scale@inv@x, y=1/\pgfplots@target@unit@scale@inv@y, z=1/\pgfplots@target@unit@scale@inv@z; ^^J axis limit componsation scales x=\pgfplots@target@limitrescale@x, y=\pgfplots@target@limitrescale@y, z=\pgfplots@target@limitrescale@z^^J}%
+ \fi
+ %
+ %
+ \pgfplots@scaling@minimize@limitrescale%
+ %
+ %
+ \pgfplots@scaling@adjust@datascaling%
+%\message{adjusted scales for data scale trafo: x=1/\pgfplots@target@unit@scale@inv@x, y=1/\pgfplots@target@unit@scale@inv@y, z=1/\pgfplots@target@unit@scale@inv@z; ^^J axis limit componsation scales x=\pgfplots@target@limitrescale@x, y=\pgfplots@target@limitrescale@y, z=\pgfplots@target@limitrescale@z;^^J data scale trafo exponents x=\pgfplots@target@datascaletrafo@x@exponent@old -> \pgfplots@target@datascaletrafo@x@exponent, y=\pgfplots@target@datascaletrafo@y@exponent@old -> \pgfplots@target@datascaletrafo@y@exponent, z=\pgfplots@target@datascaletrafo@z@exponent@old -> \pgfplots@target@datascaletrafo@z@exponent^^J}%
+ %
+ \pgfplots@scaling@compute@final@scales%
+ {\xscale}{\yscale}%
+ {\pgfplots@target@unit@scale@inv@x}%
+ {\pgfplots@target@unit@scale@inv@y}%
+ {\pgfplots@target@unit@scale@inv@z}%
+ %
+ \pgfplots@axis@apply@post@scale{x}%
+ \pgfplots@axis@apply@post@scale{y}%
+ \ifpgfplots@threedim
+ \pgfplots@axis@apply@post@scale{z}%
+ \fi
+ % and finally, resize limits appropriately and add all cumulative limit compensations:
+ \xdef\pgfplots@glob@TMPa{%
+ %
+ \pgf@xx=\pgfplots@target@unit@scale@xx\pgf@xx
+ \pgf@xy=\pgfplots@target@unit@scale@xy\pgf@xy
+ %
+ \pgf@yx=\pgfplots@target@unit@scale@yx\pgf@yx
+ \pgf@yy=\pgfplots@target@unit@scale@yy\pgf@yy
+ %
+ \ifpgfplots@threedim
+ \pgf@zx=\pgfplots@target@unit@scale@zx\pgf@zx
+ \pgf@zy=\pgfplots@target@unit@scale@zy\pgf@zy
+ \fi
+ %
+ \noexpand\pgfplots@apply@datascaletrafo@change@{x}{\pgfplots@target@datascaletrafo@x@exponent}%
+ \noexpand\pgfplots@apply@datascaletrafo@change@{y}{\pgfplots@target@datascaletrafo@y@exponent}%
+ \noexpand\pgfplots@apply@datascaletrafo@change@{z}{\pgfplots@target@datascaletrafo@z@exponent}%
+ %
+ \noexpand\pgfplots@apply@unit@vector@rescale@keep@size{x}{\pgfplots@target@limitrescale@x}%
+ \noexpand\pgfplots@apply@unit@vector@rescale@keep@size{y}{\pgfplots@target@limitrescale@y}%
+ \noexpand\pgfplots@apply@unit@vector@rescale@keep@size{z}{\pgfplots@target@limitrescale@z}%
+ %
+ \noexpand\pgfplots@notify@final@scalings{%
+ x unit scale=\pgfplots@target@unit@scale@x,%
+ y unit scale=\pgfplots@target@unit@scale@y,%
+ z unit scale=\pgfplots@target@unit@scale@z,%
+ x datatrafo exponent=\pgfplots@target@datascaletrafo@x@exponent,%
+ y datatrafo exponent=\pgfplots@target@datascaletrafo@y@exponent,%
+ z datatrafo exponent=\pgfplots@target@datascaletrafo@z@exponent,%
+ x limit rescale=\pgfplots@target@limitrescale@x,%
+ y limit rescale=\pgfplots@target@limitrescale@y,%
+ z limit rescale=\pgfplots@target@limitrescale@z,%
+ }%
+ }%
+ \endgroup
+ \pgfplots@glob@TMPa
+}%
+
+% Checks for the case the ALL (visible) limit compensation scales are
+% bigger than one (for example x = 1.22, y = 2). In such a case, we
+% want to MINIMIZE the rescaling. This can happen if unit vector ratio
+% is active.
+%
+% In our example, we want to use limit rescaling factors x = 1, y = 2/1.22
+% and, consequently, unit rescaling factors x *= 1.22, y *= 1.22 .
+%
+% This method checks for the case and applies the rescaling if
+% necessary.
+%
+\def\pgfplots@scaling@minimize@limitrescale{%
+ % boolean allLimitScalesAreBiggerThanOne;
+ \pgfplots@loc@tmptrue
+ \if0\b@pgfplots@unitvec@is@zero@x
+ \ifdim\pgfplots@target@limitrescale@x pt<1.002pt %
+ \pgfplots@loc@tmpfalse
+ \fi
+ \fi
+ \if0\b@pgfplots@unitvec@is@zero@y
+ \ifdim\pgfplots@target@limitrescale@y pt<1.002pt %
+ \pgfplots@loc@tmpfalse
+ \fi
+ \fi
+ \if0\b@pgfplots@unitvec@is@zero@z
+ \ifdim\pgfplots@target@limitrescale@z pt<1.002pt %
+ \pgfplots@loc@tmpfalse
+ \fi
+ \fi
+ %
+ \ifpgfplots@loc@tmp
+ \begingroup
+ % Ah -- all non-vanishing limit rescaling factors are BIGGER
+ % THAN ONE.
+ % In this case, we can save some rescalings!
+ %
+ % Search for the smallest rescaling factor.
+ \let\pgfplots@smallest=\pgf@x
+ \pgfplots@smallest=16000pt %
+ \def\pgfplots@smallest@arg{}%
+ \if0\b@pgfplots@unitvec@is@zero@x
+ \pgf@xa=\pgfplots@target@limitrescale@x pt %
+ \ifdim\pgf@xa<\pgfplots@smallest%
+ \pgfplots@smallest=\pgf@xa
+ \def\pgfplots@smallest@arg{x}%
+ \fi
+ \fi
+ \if0\b@pgfplots@unitvec@is@zero@y
+ \pgf@xa=\pgfplots@target@limitrescale@y pt %
+ \ifdim\pgf@xa<\pgfplots@smallest%
+ \pgfplots@smallest=\pgf@xa
+ \def\pgfplots@smallest@arg{y}%
+ \fi
+ \fi
+ \if0\b@pgfplots@unitvec@is@zero@z
+ \pgf@xa=\pgfplots@target@limitrescale@z pt %
+ \ifdim\pgf@xa<\pgfplots@smallest%
+ \pgfplots@smallest=\pgf@xa
+ \def\pgfplots@smallest@arg{z}%
+ \fi
+ \fi
+ %
+ % OK. We have the smallest scaling factor. It is > 1.
+ \pgfplotscoordmath{default}{parsenumber}{\pgfplots@target@limitrescale@x}%
+ \let\pgfplots@target@limitrescale@x=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\pgfplots@target@limitrescale@y}%
+ \let\pgfplots@target@limitrescale@y=\pgfmathresult
+ %
+ %
+ \pgfplotscoordmath{default}{parsenumber}{\pgfplots@target@unit@scale@inv@x}%
+ \let\pgfplots@target@unit@scale@inv@x=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\pgfplots@target@unit@scale@inv@y}%
+ \let\pgfplots@target@unit@scale@inv@y=\pgfmathresult
+ %
+ \if0\b@pgfplots@unitvec@is@zero@z
+ \pgfplotscoordmath{default}{parsenumber}{\pgfplots@target@limitrescale@z}%
+ \let\pgfplots@target@limitrescale@z=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\pgfplots@target@unit@scale@inv@z}%
+ \let\pgfplots@target@unit@scale@inv@z=\pgfmathresult
+ \fi
+ %
+ \pgfplotscoordmath{default}{op}{reciprocal}{{\csname pgfplots@target@limitrescale@\pgfplots@smallest@arg\endcsname}}%
+ \let\scale=\pgfmathresult
+ %
+ \pgfplotsforeachentryinCSV\value{%
+ \pgfplots@target@unit@scale@inv@x,%
+ \pgfplots@target@unit@scale@inv@y,%
+ \pgfplots@target@limitrescale@x,%
+ \pgfplots@target@limitrescale@y%
+ }{%
+ \pgfplotscoordmath{default}{op}{multiply}{{\scale}{\value}}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
+ \expandafter\let\value=\pgfmathresult
+ }%
+ \if0\b@pgfplots@unitvec@is@zero@z
+ \pgfplotsforeachentryinCSV\value{%
+ \pgfplots@target@unit@scale@inv@z,%
+ \pgfplots@target@limitrescale@z%
+ }{%
+ \pgfplotscoordmath{default}{op}{multiply}{{\scale}{\value}}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
+ \expandafter\let\value=\pgfmathresult
+ }%
+ \fi
+ %
+ \xdef\pgfplots@glob@TMPa{%
+ \noexpand\def\noexpand\pgfplots@target@unit@scale@inv@x{\pgfplots@target@unit@scale@inv@x}%
+ \noexpand\def\noexpand\pgfplots@target@unit@scale@inv@y{\pgfplots@target@unit@scale@inv@y}%
+ \noexpand\def\noexpand\pgfplots@target@unit@scale@inv@z{\pgfplots@target@unit@scale@inv@z}%
+ \noexpand\def\noexpand\pgfplots@target@limitrescale@x{\pgfplots@target@limitrescale@x}%
+ \noexpand\def\noexpand\pgfplots@target@limitrescale@y{\pgfplots@target@limitrescale@y}%
+ \noexpand\def\noexpand\pgfplots@target@limitrescale@z{\pgfplots@target@limitrescale@z}%
+ }%
+ \endgroup
+ \pgfplots@glob@TMPa
+%
+%\message{adjusted scales by minimizing common scaling factors: x=1/\pgfplots@target@unit@scale@inv@x, y=1/\pgfplots@target@unit@scale@inv@y, z=1/\pgfplots@target@unit@scale@inv@z; ^^J axis limit componsation scales x=\pgfplots@target@limitrescale@x, y=\pgfplots@target@limitrescale@y, z=\pgfplots@target@limitrescale@z;^^J}%
+ \fi
+}%
+
+% Defines
+% \pgfplots@target@unit@scale@xx
+% \pgfplots@target@unit@scale@xy
+% \pgfplots@target@unit@scale@yx
+% \pgfplots@target@unit@scale@yy
+% \pgfplots@target@unit@scale@zx
+% \pgfplots@target@unit@scale@zy
+% %
+% \pgfplots@target@unit@scale@x
+% \pgfplots@target@unit@scale@y
+% \pgfplots@target@unit@scale@z
+% by combining the input args.
+%
+% #1: the scale to be applied to ALL x components
+% #2: the scale to be applied to ALL y components
+% #3: the scale to be applied to x unit
+% #4: the scale to be applied to y unit
+% #5: the scale to be applied to z unit
+\def\pgfplots@scaling@compute@final@scales#1#2#3#4#5{%
+ \def\pgfplots@loc@TMPa##1##2##3##4{%
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{##2}%
+ \let\xscale@@=\pgfmathresult
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{##3}%
+ \let\yscale@@=\pgfmathresult
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{##4}%
+ \let\unitscale@inv@@=\pgfmathresult
+ %
+ % NOTE : it *would* be more efficient to use
+ % 1/\unitscale@inv@@ in the routines above. BUT THAT IS NOT BACKWARDS COMPATIBLE.
+ % Leave it this way!
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{op}{reciprocal}{{\unitscale@inv@@}}%
+ \let\unitscale@@=\pgfmathresult
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{tofixed}{\pgfmathresult}%
+ \expandafter\let\csname pgfplots@target@unit@scale@##1\endcsname=\pgfmathresult
+ %
+ %
+ \ifx\pgfplots@compat@scaling@coordmath@final\pgfplots@compat@scaling@coordmath
+ \else
+ % backwards compatibility is such a burden.... :-(
+ %
+ % earlier versions relied on TeX's dimen arithmetics to
+ % multiply the final scales. Make sure we do the same -
+ % rounding errors on unit vectors are instable, i.e. the
+ % errors add up considerably.
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{parsenumber}{\xscale@@}%
+ \let\xscale@@=\pgfmathresult
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{parsenumber}{\yscale@@}%
+ \let\yscale@@=\pgfmathresult
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{parsenumber}{\unitscale@@}%
+ \let\unitscale@@=\pgfmathresult
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{parsenumber}{\unitscale@inv@@}%
+ \let\unitscale@inv@@=\pgfmathresult
+ \fi
+ %
+ \ifpgfplots@threedim
+ % backw. compatibility: this is how it used to be in 3d
+ % axes:
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{op}{multiply}{{\xscale@@}{\unitscale@@}}%
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{tofixed}{\pgfmathresult}%
+ \expandafter\let\csname pgfplots@target@unit@scale@##1x\endcsname=\pgfmathresult
+ %
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{op}{multiply}{{\yscale@@}{\unitscale@@}}%
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{tofixed}{\pgfmathresult}%
+ \expandafter\let\csname pgfplots@target@unit@scale@##1y\endcsname=\pgfmathresult
+ \else
+ % backw. compatibility: 2d axes used divide in earlier
+ % versions, not reciprocal. Believe it or not; for
+ % \pgfplots@compat@scaling@coordmath=pgfbasic, it makes a
+ % visible difference of about 2-3pt in the complete figure
+ % size.
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{op}{divide}{{\xscale@@}{\unitscale@inv@@}}%
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{tofixed}{\pgfmathresult}%
+ \expandafter\let\csname pgfplots@target@unit@scale@##1x\endcsname=\pgfmathresult
+ %
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{op}{divide}{{\yscale@@}{\unitscale@inv@@}}%
+ \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath@final}{tofixed}{\pgfmathresult}%
+ \expandafter\let\csname pgfplots@target@unit@scale@##1y\endcsname=\pgfmathresult
+ \fi
+ %
+ }%
+ \if1\b@pgfplots@rescale@x
+ \pgfplots@loc@TMPa{x}{\xscale}{\yscale}{#3}%
+ \else
+ \pgfplots@loc@TMPa{x}{1}{1}{#3}%
+ \fi
+ %
+ \if1\b@pgfplots@rescale@y
+ \pgfplots@loc@TMPa{y}{\xscale}{\yscale}{#4}%
+ \else
+ \pgfplots@loc@TMPa{y}{1}{1}{#4}%
+ \fi
+ %
+ \ifpgfplots@threedim
+ \if1\b@pgfplots@rescale@z
+ \pgfplots@loc@TMPa{z}{\xscale}{\yscale}{#5}%
+ \else
+ \pgfplots@loc@TMPa{z}{1}{1}{#5}%
+ \fi
+ \else
+ \def\pgfplots@target@unit@scale@z{0}%
+ \def\pgfplots@target@unit@scale@zx{0}%
+ \def\pgfplots@target@unit@scale@zy{0}%
+ \def\pgfplots@target@unit@scale@inv@z{inf}%
+ \fi
+ %
+}%
+
+\def\pgfplots@notify@final@scalings#1{%
+ \pgfkeys{/pgfplots/scaling/.cd,
+ .unknown/.code={%
+%\message{setting key '\pgfkeyscurrentkey' to {##1}^^J}
+ \pgfkeyssetvalue{\pgfkeyscurrentkey}{##1}%
+ },
+ #1%
+ }%
+}%
+
+% #1: either x,y, or z
+% #2: the new exponent
+\def\pgfplots@apply@datascaletrafo@change@#1#2{%
+ \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
+ \pgfplotscoordmath{#1}{datascaletrafo get params}%
+ \edef\pgfplots@loc@TMPa{\expandafter\pgfutil@firstoftwo\pgfmathresult}%
+ \edef\pgfplots@loc@TMPb{#2}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ % ok; the data scale trafo did not change at all - we
+ % still have the same exponent.
+ \else
+ % Ah - we have a new data scale trafo!
+ \pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1min\endcsname}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1max\endcsname}%
+ \let\pgfplots@loc@TMPb=\pgfmathresult
+ %
+ % first: determine the optimal shift (which is the
+ % transformed lower limit):
+ \pgfplotscoordmath{#1}{datascaletrafo set params}{#2}{0}%
+ \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@loc@TMPa}%
+ %
+ % ok, finalize the data trafo:
+ \pgfplotscoordmath{#1}{datascaletrafo set params}{#2}{\pgfmathresult}%
+ %
+ % ... and recompute axis limits:
+ \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@loc@TMPa}%
+ \expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
+ \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@loc@TMPb}%
+ \expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult
+ \fi
+ }{}%
+}%
+
+% Inspects the limit enlargement factors and reinitializes the data
+% scale transformations.
+%
+% The purpose of this method is to avoid "dimension too large" if the
+% factors exceed certain limits.
+%
+% INPUT:
+% \pgfplots@target@limitrescale@x and its variants for y and z
+% \pgfplots@target@unit@scale@inv@x and its variants for y and z
+%
+% OUTPUT:
+% \pgfplots@target@datascaletrafo@x@exponent and its variants for y and z
+% -> contains NEW datascaletrafo exponents
+% \pgfplots@target@datascaletrafo@x@exponent@old and its variants for y and z
+% -> contains OLD datascaletrafo exponents
+% \pgfplots@target@unit@scale@inv@x and its variants for y and z
+% -> contains (modified) unit vector scales
+\def\pgfplots@scaling@adjust@datascaling{%
+ \pgfplots@scaling@adjust@datascaling@for x%
+ \pgfplots@scaling@adjust@datascaling@for y%
+ \pgfplots@scaling@adjust@datascaling@for z%
+}
+\def\pgfplots@scaling@adjust@datascaling@for#1{%
+ \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
+ \pgfplotscoordmath{#1}{datascaletrafo get params}%
+ \def\pgfplots@loc@TMPa##1##2{%
+ \expandafter\def\csname pgfplots@target@datascaletrafo@#1@exponent\endcsname{##1}%
+ \expandafter\def\csname pgfplots@target@datascaletrafo@#1@exponent@old\endcsname{##1}%
+ }%
+ \expandafter\pgfplots@loc@TMPa\pgfmathresult
+ \pgf@xa=\csname pgfplots@target@limitrescale@#1\endcsname pt
+ \ifdim\pgf@xa>5pt %
+ % We want to enlarge axis limits considerably!
+ %
+ \pgfplots@scaling@adjust@datascaling@for@get@compensation{\pgf@xa}%
+ %
+ % Ok, make sure that we do not get "dimension too large"
+ % by adjusting the data scale trafo.
+ %
+ % Note that the data scale trafo has (only) been applied
+ % to axis limits, so we have to reapply it before these
+ % changes can take effect:
+ \pgf@xa=\csname pgfplots@target@unit@scale@inv@#1\endcsname pt
+ \divide\pgf@xa by\pgfplotsretval\relax %
+ \expandafter\edef\csname pgfplots@target@unit@scale@inv@#1\endcsname{\pgf@sys@tonumber\pgf@xa}%
+ %
+ \c@pgf@countd=\csname pgfplots@target@datascaletrafo@#1@exponent\endcsname\relax
+ \advance\c@pgf@countd by-\pgfplotsretvalb\relax %
+ \expandafter\edef\csname pgfplots@target@datascaletrafo@#1@exponent\endcsname{\the\c@pgf@countd}%
+ \fi
+ }{%
+ \expandafter\def\csname pgfplots@target@datascaletrafo@#1@exponent\endcsname{0}%
+ \expandafter\def\csname pgfplots@target@datascaletrafo@#1@exponent@old\endcsname{0}%
+ }%
+}
+
+% Returns
+% \pgfplotsretval -> the absolute scaling
+% \pgfplotsretvalb -> the log10 of the scaling
+\def\pgfplots@scaling@adjust@datascaling@for@get@compensation#1{
+ \ifdim#1<100pt %
+ \def\pgfplotsretval{10}%
+ \def\pgfplotsretvalb{1}%
+ \else
+ \ifdim#1<1000pt %
+ \def\pgfplotsretval{100}%
+ \def\pgfplotsretvalb{2}%
+ \else
+ \ifdim#1<10000pt %
+ \def\pgfplotsretval{1000}%
+ \def\pgfplotsretvalb{3}%
+ \else
+ % too much for this approach anyway... and probably no
+ % use-case at all.
+ \def\pgfplotsretval{1000}%
+ \def\pgfplotsretvalb{3}%
+ \fi
+ \fi
+ \fi
+}%
+
+% Computes the initial scale from a plot box of unit size to the
+% desired with and height.
+%
+% #1 the desired width
+% #2 the desired height
+% #3 [output] a macro which will contain the horizontal (x) scale
+% #4 [output] a macro which will contain the vertical (y) scale
+% #5 [input/output] a macro which, on input, contains the x axis limit compensation scale
+% which is required to select a single unit vector scale without
+% reducing the plots dimension (without actually respecting the
+% final dimension). On output, the input has been multiplied by
+% some additional x limit componensation scale (selected by scale
+% uniformly strategy).
+% #6 [input/output] a macro which will contain a y axis limit
+% compensation scale; it works in the same way as #5
+% #7 [input/output] a macro which will contain a z axis limit
+% compensation scale; it works in the same way as #5
+\def\pgfplots@get@scale@horiz@and@vert#1#2#3#4#5#6#7{%
+ \begingroup
+ \edef\pgfplots@target@limitrescale@x{#5}%
+ \edef\pgfplots@target@limitrescale@y{#6}%
+ \edef\pgfplots@target@limitrescale@z{#7}%
+ \pgfplots@get@dimension@of@BB
+ \pgf@xa=\pgfplotsretval\relax
+ \pgf@xb=\pgfplotsretvalb\relax
+ \pgf@ya=#1\relax
+ \pgf@yb=#2\relax
+ \edef\w{\pgf@sys@tonumber\pgf@xa}%
+ \edef\h{\pgf@sys@tonumber\pgf@xb}%
+ \edef\W{\pgf@sys@tonumber\pgf@ya}%
+ \edef\H{\pgf@sys@tonumber\pgf@yb}%
+%\message{PGFPLOTS: the current unit vectors result in a UNIT BB of (\the\pgf@xa,\the\pgf@xb). Scaling it to (\the\pgf@ya,\the\pgf@yb)...^^J}%
+ \ifcase\pgfplots@scale@mode@choice
+ % scale mode=auto does not happen here
+ \or
+ % scale mode=none does not happen here
+ \or
+ % scale mode=stretch to fill
+ %
+ % This is very simple:
+ %
+ % Compute individual scaling factors for X and Y
+ % such that the UNIT-BB will have size #1,#2. Keep limits.
+ \pgfmathdivide@{\W}{\w}%
+ \let\scalex=\pgfmathresult
+ %
+ \pgfmathdivide@{\H}{\h}%
+ \let\scaley=\pgfmathresult
+ %
+ % no changes to the axis limits - we only rescale units.
+ \def\pgfplots@target@limitrescale@x@{1}%
+ \def\pgfplots@target@limitrescale@y@{1}%
+ \def\pgfplots@target@limitrescale@z@{1}%
+ \pgfplots@BB@update@cumulative@limit@compensations
+ \or
+ % scale mode=scale uniformly
+ % compute ONE common scale for both, X and Y - and satisfy
+ % width/height constraints by adjusting the axis limits.
+ %
+ % The idea is as follows:
+ % we WANT to have width W and height H.
+ % The constraint is that each unit vector must get the same
+ % scale -- but the axis limits can receive individual
+ % compensation scales. But it should "look reasonable well".
+ %
+ % currently, we have
+ % w = r_x e_xx + r_y e_yx + rz e_zx (with e_zx = 0 typically)
+ % h = r_x e_xy + r_y e_yy + rz e_zy
+ %
+ % where r_x, r_y, r_z are the maximal range of the data in
+ % x,y,z respectively. Depending on the context of this method,
+ % they are either 1 (relative coords) or
+ % (xmax-xmin) (absolute coords).
+ %
+ % Now, search for a set of real numbers
+ % Rx, Ry, Rz, s
+ % such that
+ % W = (Rx r_x) (s e_xx) + (Ry r_y) (s e_yx) + (Rz r_z) (s e_zx)
+ % H = (Rx r_x) (s e_xy) + (Ry r_y) (s e_yy) + (Rz r_z) (s e_zy)
+ %
+ % clearly, the solution is not unique.
+ % ONE choice is to employ the fact that e_zx = 0 (or, for 2d
+ % plots, e_zx=0, e_zy=0 and e_yx=0):
+ %
+ % in that case, we can compute s such that the equation for W
+ % is satisfied and compensate only the limit r_z, i.e. to
+ % choose
+ % s := W / w, (scale to satisfy width constraint)
+ % Rx := Ry := 1 (keep limits in X and Y)
+ % Rz = ( H - s (w - r_z e_zy) ) / (s r_z e_zy) (adjust z limit to satisfy height constraint)
+ %
+ % This approach works well if W < H . If W > H, it will look
+ % bad: Rz will be less than 1, causing the limit to become
+ % smaller. This, in turn, will clip away parts of the image.
+ %
+ %
+ %
+ % Another solution is to make it the other way: to keep the
+ % limit r_z, but to reduce the size and enlarge the other
+ % limits to satisfy the size constraints. This solution is
+ % considerably more involved; it requires to solve a nonlinear
+ % set of equations.
+ %
+ % Formally, this second solution uses
+ % Rz := 1 (no limit componensation scale for z -- keep z limit)
+ % R:= Rx := Ry (same limit componensation scale for both X and Y)
+ % R and s still need to be determined from the two equations for W
+ % and H.
+ %
+ % Substituting the given choices into the equations for W and H, we find
+ %
+ % R = W / (s w)
+ %
+ % s = H * (R * (h-r_z e_zy) + r_z e_zy)^-1
+ %
+ % Here, we employed the definition of 'h', see above. The
+ % equations are non-linear.
+ %
+ % ATTENTION: we assume that the datascaletrafo set params
+ % method has been called with THE SAME SCALE IN EACH
+ % DIRECTION.
+ \if0\pgfplots@scaleuniformly@choice
+ % scale uniformly strategy=auto
+ \pgfplots@get@scale@horiz@and@vert@scaleuniformly@of@optimal@strategy
+ \else
+ \pgfplots@get@scale@horiz@and@vert@scaleuniformly
+ \pgfplots@BB@update@cumulative@limit@compensations
+ \fi
+ \fi
+ %
+ \xdef\pgfplots@glob@TMPa{%
+ \noexpand\def\noexpand#3{\scalex}%
+ \noexpand\def\noexpand#4{\scaley}%
+ \noexpand\def\noexpand#5{\pgfplots@target@limitrescale@x}%
+ \noexpand\def\noexpand#6{\pgfplots@target@limitrescale@y}%
+ \noexpand\def\noexpand#7{\pgfplots@target@limitrescale@z}%
+ }%
+ \endgroup
+ \pgfplots@glob@TMPa
+}%
+
+% This is the implementation for 'scale uniformly strategy=auto'.
+%
+% It works by finding the strategy which involves the minimal scaling
+% overhead.
+%
+% To this end, it computes the result for each 'scale uniformly
+% strategy', and computes a cost function. The one with optimal cost
+% function wins, and its results are returned.
+%
+% The cost function is the overal scaling which is applied to AXIS
+% LIMITS. It works as follows:
+% 1. if a choice requires to REDUCE the axis limits in order to
+% fulfill all constraints, it is neglected (using maximal cost 16000).
+% Reducing axis limits may clip away information.
+%
+% 2. if a choice requires to ENLARGE some axis limits, its cost is the
+% sum of the individual scaling factors (even if they are are one -
+% who cares).
+%
+% Note that this method *is* relevant and the optimization appears to
+% be necessary.
+% Examples are
+% unittest_scalemode_2d_standard_1.tex
+% and perhaps
+% unittest_scalemode_2d_standard_0.tex
+% and more involved 3d examples are also available.
+%
+% My first guess was that it is sufficient to decide the optimal
+% strategy in advance by comparing the target width and the target
+% height - but that proved to be insufficient: it leads to correct
+% results, but wastes too much space (i.e. enlarges limits too much).
+%
+% ATTENTION: the cost function INCLUDES RESULTS OF
+% \pgfplots@BB@for@plotbox@get@unit@scales@for@limits and its
+% corrector
+% \pgfplots@BB@for@plotbox@get@unit@scales@compensated@axis@limits.
+%
+% More precisely, it relies on already computes limit compensation
+% factors which do not depend on the target width/target height: both
+% \pgfplots@BB@for@plotbox@get@unit@scales@compensated@axis@limits and
+% this implementation of 'scale uniformly strategy' can be used to compute
+% the cost of a strategy.
+%
+\def\pgfplots@get@scale@horiz@and@vert@scaleuniformly@of@optimal@strategy{%
+ \begingroup
+ \def\mathclass{default}%
+ \pgfplotscoordmath{\mathclass}{max limit}%
+ \let\pgfplots@cost@for@choice@superhigh=\pgfmathresult%
+ %
+ % private helpers to compute the cost.
+ \def\pgfplots@scalestrategy@compute@cost{%
+ \begingroup
+ % ATTENTION: this call changes
+ % '\pgfplots@target@limitrescale@x' and its variants.
+ % Restore its value after the iteration:
+ \pgfplots@BB@update@cumulative@limit@compensations
+ \pgfplotscoordmath{\mathclass}{one}%
+ \let\ONE=\pgfmathresult
+ \pgfplotscoordmath{\mathclass}{parsenumber}{\pgfplots@target@limitrescale@x}%
+ \let\X=\pgfmathresult
+ \pgfplotscoordmath{\mathclass}{parsenumber}{\pgfplots@target@limitrescale@y}%
+ \let\Y=\pgfmathresult
+ \ifpgfplots@threedim
+ \pgfplotscoordmath{\mathclass}{parsenumber}{\pgfplots@target@limitrescale@z}%
+ \let\Z=\pgfmathresult
+ \else
+ \let\Z=\pgfplots@target@limitrescale@z
+ \fi
+ %
+ % If one of the resulting limit compensation scales is
+ % less than 1, we can immediately skip it - we do not want
+ % to risk to clip away image content.
+ \pgfplotscoordmath{\mathclass}{if less than}{\X}{\ONE}{%
+ \let\pgfplots@cost@for@choice=\pgfplots@cost@for@choice@superhigh
+ }{%
+ \pgfplotscoordmath{\mathclass}{if less than}{\Y}{\ONE}{%
+ \let\pgfplots@cost@for@choice=\pgfplots@cost@for@choice@superhigh
+ }{%
+ \ifpgfplots@threedim
+ \pgfplotscoordmath{\mathclass}{if less than}{\Z}{\ONE}{%
+ \let\pgfplots@cost@for@choice=\pgfplots@cost@for@choice@superhigh
+ }{%
+ % ah - 3 limit scales >= 1. Good, assign cost:
+ \pgfplots@scalestrategy@compute@cost@
+ }%
+ \else
+ % ah - all limit scales >=1. Good, assign cost:
+ \pgfplots@scalestrategy@compute@cost@
+ \fi
+ }%
+ }%
+%\message{scale uniformly strategy=auto: '\pgfplots@tostring@scaleuniformlystrategy{\pgfplots@scaleuniformly@choice}' has cost \pgfplots@cost@for@choice\space(limit rescaling factors x=\X, y=\Y, z=\Z)^^J}%
+ \xdef\pgfplots@glob@TMPa{%
+ \noexpand\def\noexpand\pgfplots@scaleuniformly@choice{\pgfplots@scaleuniformly@choice}%
+ \noexpand\def\noexpand\scalex{\scalex}%
+ \noexpand\def\noexpand\scaley{\scaley}%
+ \noexpand\def\noexpand\pgfplots@target@limitrescale@x{\pgfplots@target@limitrescale@x}%
+ \noexpand\def\noexpand\pgfplots@target@limitrescale@y{\pgfplots@target@limitrescale@y}%
+ \noexpand\def\noexpand\pgfplots@target@limitrescale@z{\pgfplots@target@limitrescale@z}%
+ }%
+ \pgfmath@smuggleone\pgfplots@cost@for@choice
+ % keep in mind that this scope IS NECESSARY: we have
+ % changed the target quantities
+ % \pgfplots@target@limitrescale@x and its variants!
+ \endgroup
+ \let\pgfplots@scalestrategy@values=\pgfplots@glob@TMPa
+ }%
+ \def\pgfplots@scalestrategy@compute@cost@{%
+ \pgfplotscoordmath{\mathclass}{op}{add}{{\X}{\Y}}%
+ \ifpgfplots@threedim
+ \pgfplotscoordmath{\mathclass}{op}{add}{{\pgfmathresult}{\Z}}%
+ \fi
+ \let\pgfplots@cost@for@choice=\pgfmathresult
+ }%
+ %
+ % compute initial cost:
+ \def\pgfplots@scaleuniformly@choice{3}% change horizontal limits
+ \pgfplots@get@scale@horiz@and@vert@scaleuniformly
+ \pgfplots@scalestrategy@compute@cost
+ %
+ % init minimum:
+ \let\pgfplots@cost@for@choice@arg=\pgfplots@scalestrategy@values
+ \let\pgfplots@cost@for@choice@sofar=\pgfplots@cost@for@choice%
+ %
+ % compute cost of next strategy:
+ \def\pgfplots@scaleuniformly@choice{2}% change vertical limits
+ \pgfplots@get@scale@horiz@and@vert@scaleuniformly
+ \pgfplots@scalestrategy@compute@cost
+ %
+ % update minimum:
+ \pgfplotscoordmath{\mathclass}{if less than}{\pgfplots@cost@for@choice}{\pgfplots@cost@for@choice@sofar}{%
+ \let\pgfplots@cost@for@choice@arg=\pgfplots@scalestrategy@values
+ \let\pgfplots@cost@for@choice@sofar=\pgfplots@cost@for@choice%
+ }{%
+ }%
+ %
+ \ifx\pgfplots@cost@for@choice@sofar\pgfplots@cost@for@choice@superhigh
+ % the algorithm discarded every available strategy.
+ \def\pgfplots@scaleuniformly@choice{1}% fall back to 'units only'
+ \pgfplots@get@scale@horiz@and@vert@scaleuniformly
+ \pgfplots@scalestrategy@compute@cost
+ \let\pgfplots@cost@for@choice@arg=\pgfplots@scalestrategy@values
+ \let\pgfplots@cost@for@choice@sofar=\pgfplots@cost@for@choice%
+ \fi
+ %
+ %
+ \global\let\pgfplots@glob@TMPa=\pgfplots@cost@for@choice@arg
+ \endgroup
+ \pgfplots@glob@TMPa
+%\message{scale uniformly strategy=auto: choosing '\pgfplots@tostring@scaleuniformlystrategy{\pgfplots@scaleuniformly@choice}'^^J}%
+}
+
+\def\pgfplots@tostring@scaleuniformlystrategy#1{%
+ % scale uniformly strategy:
+ \ifcase#1\relax
+ auto
+ \or
+ units only
+ \or
+ change vertical limits
+ \or
+ change horizontal limits
+ \fi
+}
+% Does the work for 'scale mode=scale uniformly' inside of
+% \pgfplots@get@scale@horiz@and@vert.
+%
+% It returns its result into \pgfplots@target@limitrescale@x@ (i.e.
+% with an extra '@')
+\def\pgfplots@get@scale@horiz@and@vert@scaleuniformly{%
+ \ifcase\pgfplots@scaleuniformly@choice\relax
+ % scale uniformly strategy=auto does not happen here.
+ \or
+ % scale uniformly strategy=units only
+ \pgfplots@scaleuniformly@onlyunits
+ \or
+ % scale uniformly strategy=change vertical limits
+ %
+ % first, scale to the width ...
+ \pgfplots@scaleuniformly@onlyunits@{\w}{\W}%
+ % ... and change (only) vertical limits to get the "correct"
+ % height:
+ \ifdim\pgf@zy=0pt
+ \ifdim\pgf@yx=0pt
+ \pgfplots@prepare@vertical@rescaling@for@scale@uniformly@in@dir{y}\returninto\pgfplots@target@limitrescale@y@
+ \else
+ \pgfplots@scale@uniformly@fallback
+ \fi
+ \else
+ \ifdim\pgf@zx=0pt
+ \pgfplots@prepare@vertical@rescaling@for@scale@uniformly@in@dir{z}\returninto\pgfplots@target@limitrescale@z@
+ \else
+ \pgfplots@scale@uniformly@fallback
+ \fi
+ \fi
+ \or
+ % scale uniformly strategy=change horizontal limits
+ \ifdim\pgf@zy=0pt
+ \ifdim\pgf@yx=0pt
+ \ifdim\pgf@xy=0pt
+ % special 2d routine with explicit solution
+ \pgfplots@scaleuniformly@change@horizontal@limits@twodim
+ {\scalex}
+ {\pgfplots@target@limitrescale@x@}
+ {\pgfplots@target@limitrescale@y@}
+ {\pgfplots@target@limitrescale@z@}%
+ \else
+ \pgfplots@scale@uniformly@fallback
+ \fi
+ \else
+ \pgfplots@scale@uniformly@fallback
+ \fi
+ \else
+ \ifdim\pgf@zx=0pt
+ \pgfplots@scaleuniformly@change@horizontal@limits
+ {\scalex}
+ {\pgfplots@target@limitrescale@x@}
+ {\pgfplots@target@limitrescale@y@}
+ {\pgfplots@target@limitrescale@z@}%
+ \else
+ \pgfplots@scale@uniformly@fallback
+ \fi
+ \fi
+ \let\scaley=\scalex
+ \fi
+}
+
+\def\pgfplots@scaleuniformly@onlyunits{%
+ % scale to the smaller target dimension:
+ \ifdim\W pt<\H pt %
+ \pgfplots@scaleuniformly@onlyunits@{\w}{\W}%
+ \else
+ \pgfplots@scaleuniformly@onlyunits@{\h}{\H}%
+ \fi
+}%
+
+% #1 : the actual dimension
+% #2 : the target dimension
+\def\pgfplots@scaleuniformly@onlyunits@#1#2{%
+ \def\pgfplots@target@limitrescale@x@{1}%
+ \def\pgfplots@target@limitrescale@y@{1}%
+ \def\pgfplots@target@limitrescale@z@{1}%
+ \pgfmathdivide@{#2}{#1}%
+ \let\scalex=\pgfmathresult
+ \let\scaley=\scalex % we *need* the same unit scale.
+}%
+
+% Computes 'scale uniformly strategy=change horizontal limits'.
+% This is a complicated solution, see the documentation in the
+% implementation for
+% 'scale mode=scale uniformly'
+%
+% #1 [output] a macro which will contain the (uniform) scale for the
+% unit vectors
+% #2 [output] a macro which will contain a x axis limit compensation scale
+% #3 [output] a macro which will contain a x axis limit compensation scale
+% #4 [output] a macro which will contain a x axis limit compensation scale
+\def\pgfplots@scaleuniformly@change@horizontal@limits#1#2#3#4{%
+ \begingroup
+ %
+ \pgfplots@BB@for@plotbox@getunitheight{\pgf@xc}{z}%
+ %
+ % compute the rest in floating point - intermediate results may
+ % become too huge for TeX.
+ \pgfplotscoordmath{default}{parsenumber}{\expandafter\pgf@sys@tonumber\csname pgf@xc\endcsname}%
+ \let\M=\pgfmathresult
+ %
+ \pgfplotscoordmath{default}{parsenumber}{\w}%
+ \let\w=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\W}%
+ \let\W=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\h}%
+ \let\h=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\H}%
+ \let\H=\pgfmathresult
+ \pgfplotscoordmath{default}{op}{divide}{{\W}{\w}}%
+ \let\Wwinv=\pgfmathresult
+ \pgfplotscoordmath{default}{op}{subtract}{{\h}{\M}}%
+ \let\hminusM=\pgfmathresult
+ %
+ \pgfplotscoordmath{default}{one}%
+ \let\S=\pgfmathresult%
+ \let\R=\pgfmathresult%
+ \let\Rx=\pgfmathresult
+ \def\Rz{1}%
+ %
+ \def\pgfplots@hold@S@get@R{%
+ \pgfplotscoordmath{default}{op}{divide}{{\Wwinv}{\S}}%
+ \let\R=\pgfmathresult
+%\message{updated R = \R\space ( S = \S ) ^^J}%
+ }%
+ \def\pgfplots@hold@R@get@S{%
+ \pgfplotscoordmath{default}{op}{multiply}{{\R}{\hminusM}}%
+ \pgfplotscoordmath{default}{op}{add}{{\pgfmathresult}{\M}}%
+ \pgfplotscoordmath{default}{op}{divide}{{\H}{\pgfmathresult}}%
+ \let\S=\pgfmathresult
+%\message{updated S = \S\space ( R = \R ) ^^J}%
+ }%
+ %
+ % This is the (most stupid) nonlinear method which is at hand:
+ % fix point iteration.
+ % choose R arbitrarily (R=1 seems adequate), solve for s.
+ % Then, fix s and solve for R. Then, fix R and
+ % solve for s until convergence.
+ \c@pgf@countc=0
+ \pgfplotsloop{%
+ \ifnum\c@pgf@countc<\pgfkeysvalueof{/pgfplots/scale uniformly strategy iter} %
+ \pgfplotsloopcontinuetrue
+ \else
+ \pgfplotsloopcontinuefalse
+ \fi
+ }{%
+ \pgfplots@hold@R@get@S \pgfplots@hold@S@get@R
+ \advance\c@pgf@countc by1 %
+ }%
+ %
+ \pgfplotscoordmath{default}{tofixed}{\R}\let\R=\pgfmathresult
+ \pgfplotscoordmath{default}{tofixed}{\S}\let\S=\pgfmathresult
+ \xdef\pgfplots@glob@TMPa{%
+ \noexpand\def\noexpand#1{\S}%
+ \noexpand\def\noexpand#2{\R}%
+ \noexpand\def\noexpand#3{\R}%
+ \noexpand\def\noexpand#4{\Rz}%
+ }%
+ \endgroup
+ %
+ \pgfplots@glob@TMPa
+}%
+
+% Computes 'scale uniformly strategy=change horizontal limits'.
+%
+% This is a simplified closed solution assuming that e_xy=0 and e_yx = 0
+%
+% #1 [output] a macro which will contain the (uniform) scale for the
+% unit vectors
+% #2 [output] a macro which will contain a x axis limit compensation scale
+% #3 [output] a macro which will contain a x axis limit compensation scale
+% #4 [output] a macro which will contain a x axis limit compensation scale
+\def\pgfplots@scaleuniformly@change@horizontal@limits@twodim#1#2#3#4{%
+ \begingroup
+ % Assuming that we have a standard 2d axis, i.e.
+ % e_zx = e_zy = 0, e_xy = 0, and e_yx =0,
+ % we can immediately compute a solution.
+ %
+ % In this case, we have the actual width
+ % w = r_x e_xx + r_y e_yx + rz e_zx
+ % = r_x e_xx
+ % and actual height
+ % h = r_x e_xy + r_y e_yy + rz e_zy
+ % = r_y e_yy
+ % and, consequently, desired width
+ % W = (Rx r_x) (s e_xx) + (Ry r_y) (s e_yx) + (Rz r_z) (s e_zx)
+ % = (Rx r_x) (s e_xx)
+ % and desired height
+ % H = (Rx r_x) (s e_xy) + (Ry r_y) (s e_yy) + (Rz r_z) (s e_zy)
+ % = (Ry r_y) (s e_yy).
+ % since this strategy changes horizontal limits (only), we have
+ % Ry := 1.
+ % We find
+ % s : = H/h
+ % and
+ % Rx : = W/w /s .
+ %
+ \pgfplotscoordmath{default}{parsenumber}{\w}%
+ \let\w=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\W}%
+ \let\W=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\h}%
+ \let\h=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\H}%
+ \let\H=\pgfmathresult
+ \pgfplotscoordmath{default}{op}{divide}{{\H}{\h}}%
+ \let\S=\pgfmathresult
+ \pgfplotscoordmath{default}{op}{divide}{{\W}{\w}}%
+ \pgfplotscoordmath{default}{op}{divide}{{\pgfmathresult}{\S}}%
+ \let\Rx=\pgfmathresult
+ \def\Ry{1}%
+ \def\Rz{1}%
+ %
+ \pgfplotscoordmath{default}{tofixed}{\Rx}\let\Rx=\pgfmathresult
+ \pgfplotscoordmath{default}{tofixed}{\S}\let\S=\pgfmathresult
+ \xdef\pgfplots@glob@TMPa{%
+ \noexpand\def\noexpand#1{\S}%
+ \noexpand\def\noexpand#2{\Rx}%
+ \noexpand\def\noexpand#3{\Ry}%
+ \noexpand\def\noexpand#4{\Rz}%
+ }%
+ \endgroup
+ %
+ \pgfplots@glob@TMPa
+}%
+
+\def\pgfplots@BB@update@cumulative@limit@compensations{%
+%\message{ -> additional limit componensation scales x=\pgfplots@target@limitrescale@x@, y=\pgfplots@target@limitrescale@y@, z=\pgfplots@target@limitrescale@z@^^J}%
+ % add limit compensation to what we have from earlier
+ % operations:
+ \pgfplotscoordmath{pgfbasic}{op}{multiply}{{\pgfplots@target@limitrescale@x@}{\pgfplots@target@limitrescale@x}}%
+ \let\pgfplots@target@limitrescale@x=\pgfmathresult
+ \pgfplotscoordmath{pgfbasic}{op}{multiply}{{\pgfplots@target@limitrescale@y@}{\pgfplots@target@limitrescale@y}}%
+ \let\pgfplots@target@limitrescale@y=\pgfmathresult
+ \pgfplotscoordmath{pgfbasic}{op}{multiply}{{\pgfplots@target@limitrescale@z@}{\pgfplots@target@limitrescale@z}}%
+ \let\pgfplots@target@limitrescale@z=\pgfmathresult
+}%
+
+\def\pgfplots@scale@uniformly@fallback{%
+ \ifpgfplots@scaleuniformly@warning
+ \pgfplots@warning{Sorry, 'scale uniformly' failed because its actual implementation works only if y_x = 0 and x_y = 0 (for 2d axes) or if z_x = 0 (for 3d axes). The result will not fill the prescribed dimensions. Falling back to 'scale uniformly strategy=units only. (use scale uniformly warning=false to disable this warning)}%
+ \fi
+ \pgfplots@scaleuniformly@onlyunits
+}%
+
+% This is part of the implementation of 'scale mode=scale uniformly'.
+%
+% Its purpose it to set up the initial scaling such that
+% 1. each unit vector gets the same scale
+% 2. the axis limits are resized (enlarged) to keep the plot box ratio
+% (as far as possible)
+%
+% It repairs the outcome of
+% \pgfplots@BB@for@plotbox@get@unit@scales@for@limits .
+%
+% The assumption is that on input #1, #2, and #3 are the factors which
+% would be used by stretch-to-fill in order to squeze the axis limits
+% into the plot box defined by e_x, e_y, and e_z (the unit vectors).
+%
+% On output, #1, #2, and #3 will be modified such that *each has the
+% same value*. The value will be chosen with care. More precisely, it
+% is the *minimum* of {#1,#2,#3}.
+%
+% Clearly, 'scale mode=scale uniformly' has less freedom than
+% strech-to-fill. In order to keep the plot box ratio intact (as far
+% as possible), the axis limits will be rescaled to componsate for the
+% ignored scaling factors. More precisely, if direction i is not the
+% extremal value (as discussed in the last paragraph), the axis limits
+% will be rescaled by #i/extremum .
+%
+%
+%
+% #1: on input, it contains the x unit scale which would be taken without the
+% compensation. On output, it contains the x unit scale which *will* be
+% used.
+% #2: same as #1, but for y
+% #3: same as #1, but for z
+% #4: [output] a scale for use as argument of \pgfplots@apply@unit@vector@rescale@keep@size{x}{<arg>}
+% #5: [output] a scale for use as argument of \pgfplots@apply@unit@vector@rescale@keep@size{y}{<arg>}
+% #6: [output] a scale for use as argument of \pgfplots@apply@unit@vector@rescale@keep@size{z}{<arg>}
+%
+% The output arguments need to be applied before they take effect.
+\def\pgfplots@BB@for@plotbox@get@unit@scales@compensated@axis@limits#1#2#3#4#5#6{%
+ \begingroup
+ % ATTENTION : this code ASSUMES that the datascaling trafo is
+ % initialized with THE SAME SCALE IN EACH DIRECTION.
+ % The data scaling also leads to (potentially non-uniform) scaling per component.
+ %
+ % Note that we could handle the datascaling here -- but we would
+ % leave the supported number range easily. That's why that part of
+ % the 'scale mode=scale uniformly' implementation has been moved
+ % to \pgfplots@set@optimal@datatrafos@allaxes
+ %
+ % This here handles the limits only.
+ \edef\pgfplots@scale@unitx{#1}%
+ \edef\pgfplots@scale@unity{#2}%
+ \edef\pgfplots@scale@unitz{#3}%
+ %
+ % compute extreme + arg extreme of these scales:
+ \def\pgfplots@extreme@scale{-16300}%
+ \def\pgfplots@extreme@scale@arg{NONE}%
+ %
+ \if0\b@pgfplots@unitvec@is@zero@x
+ \ifdim\pgfplots@extreme@scale pt<\pgfplots@scale@unitx pt
+ \let\pgfplots@extreme@scale=\pgfplots@scale@unitx
+ \def\pgfplots@extreme@scale@arg{x}%
+ \fi
+ \fi
+ \if0\b@pgfplots@unitvec@is@zero@y
+ \ifdim\pgfplots@extreme@scale pt<\pgfplots@scale@unity pt
+ \let\pgfplots@extreme@scale=\pgfplots@scale@unity
+ \def\pgfplots@extreme@scale@arg{y}%
+ \fi
+ \fi
+ \if0\b@pgfplots@unitvec@is@zero@z
+ \ifdim\pgfplots@extreme@scale pt<\pgfplots@scale@unitz pt
+ \let\pgfplots@extreme@scale=\pgfplots@scale@unitz
+ \def\pgfplots@extreme@scale@arg{z}%
+ \fi
+ \fi
+ %
+ % Now, adjust axis limits to compensate for the effect: we still
+ % want to have a plot box which is as close as possible to the
+ % target plot box.
+ \def\pgfplots@loc@TMPa##1##2{%
+ \if0\csname b@pgfplots@unitvec@is@zero@##1\endcsname
+ \if1\pgfplots@scaleuniformly@choice % FIXME : this appears to be too much. Disable this!?
+ % ok, nothing to do for this direction.
+ \pgfplotscoordmath{pgfbasic}{one}%
+ \let##2=\pgfmathresult
+ \else
+ \if\pgfplots@extreme@scale@arg ##1%
+ % ok, nothing to do for this direction.
+ \pgfplotscoordmath{pgfbasic}{one}%
+ \let##2=\pgfmathresult
+ \else
+ \pgfplotscoordmath{pgfbasic}{op}{divide}{{\pgfplots@extreme@scale}{\csname pgfplots@scale@unit##1\endcsname}}%
+ % do not call apply@unit@rescale immediately because the
+ % unit vectors may not be in their final state. Postpone until
+ % they are final.
+ \edef##2{\pgfmathresult}%
+ \fi
+ \fi
+ \else
+ \def##2{1}%
+ \fi
+ }%
+ \pgfplots@loc@TMPa{x}{#4}%
+ \pgfplots@loc@TMPa{y}{#5}%
+ \pgfplots@loc@TMPa{z}{#6}%
+ %
+ \toks0=\expandafter{#4}%
+ \toks1=\expandafter{#5}%
+ \toks2=\expandafter{#6}%
+ \xdef\pgfplots@glob@TMPa{%
+ % same scale in each dir:
+ \def\noexpand#1{\pgfplots@extreme@scale}%
+ \def\noexpand#2{\pgfplots@extreme@scale}%
+ \def\noexpand#3{\pgfplots@extreme@scale}%
+ \def\noexpand#4{\the\toks0}%
+ \def\noexpand#5{\the\toks1}%
+ \def\noexpand#6{\the\toks2}%
+ }%
+ \endgroup
+ \pgfplots@glob@TMPa
+}
+
+% #1 : a dimen register
+% #2 : x, y, or z
+\def\pgfplots@BB@for@plotbox@getunitheight#1#2{%
+ #1=\csname pgfplots@plotbox@#2max\endcsname\csname pgf@#2y\endcsname
+ \advance#1 by -\csname pgfplots@plotbox@#2min\endcsname\csname pgf@#2y\endcsname
+ \ifdim#1<0pt %
+ % we want to return a height. It is also bigger than 0.
+ % the difference above may be negative if the unit points
+ % downward (special combinations of view/h and view/v)
+ #1=-#1\relax
+ \fi
+}%
+
+
+% Modifies the AXIS LIMITS to ensure that a suitable width/height is
+% achieved.
+%
+% This does NOT introduce a further scale to the unit vectors.
+%
+% #1: a direction (x,y, or z)
+% #2: a macro name. It will be assigned globally. It will contain
+% EXECUTABLE instructions which will modify the axis limits to fit the
+% scaling.
+%
+% PRECONDITION:
+% - \pgfplots@glob@TMPa contains the already computed
+% scaling factor for 'scale uniformly'
+% - \pgf@xb is the actual height and \pgf@yb is the desired height
+% (set as in the scaling routine)
+%
+% POSTCONDITION:
+% #2 will contain the argument <arg> for \pgfplots@apply@unit@vector@rescale@keep@size{#1}{<arg>}
+\def\pgfplots@prepare@vertical@rescaling@for@scale@uniformly@in@dir#1\returninto#2{%
+ % The strategy is as follows:
+ % 1. I want to fit the axis into width #1 (\pgf@ya) and
+ % height #1 (\pgf@yb).
+ % 2. I want to MAINTAIN the unit vector ratio.
+ % 3. I want to MAINTAIN the unit vector directions.
+ %
+ % I already know the scaling factor to fit the width (it
+ % is stored in \scalex = \scaley).
+ % Let's call it "s".
+ %
+ % Consequently, a uniform scaling by "s" leads to the image
+ % height
+ % h = s* (r_x * e_xy + r_y * e_yy + r_z * e_zy)
+ % where r_i = (imax - imin). This here is essentially the
+ % same as the bounding box computation above (at least for
+ % standart orthographic 3D axes).
+ %
+ % What I want now is to enlarge the limits such that I
+ % have BOTH, width #1 AND height #2, without obscuring the
+ % unit vector ratio. Recall that width #1 is already
+ % given.
+ %
+ % This strategy achieves this goal by
+ % modifying axis limits for an axis whose unit vector is
+ % parallel to the canvas y axis, i.e. e_i = (0,*).
+ %
+ % That means I have to introduce a SECOND scale s_z which
+ % applies only to the Z unit vector (since e_z = (0,*) ).
+ % If H = #2 is the desired height, I find the target
+ % equation for s_z,
+ %
+ % H = s* r_x e_xy + s * r_y e_yy + s_z * s * r_z * e_zy
+ % =>
+ % s_z = ( H- s*r_x e_xy - s*r_y e_yy) / ( s * r_z * e_zy).
+ %
+ % Remember that
+ % s = \scalex
+ % H = \H
+ % h = r_x * e_xy + r_y * e_yy + r_z * e_zy = \h
+ % =>
+ % s_z = ( H- s*( h - r_z * e_zy) ) / ( s * r_z * e_zy).
+ %
+ \begingroup
+ \pgfplots@BB@for@plotbox@getunitheight{\pgf@xc}{#1}%
+ %
+ % compute the rest in floating point - intermediate results may
+ % become too huge for TeX.
+ \pgfplotscoordmath{default}{parsenumber}{\expandafter\pgf@sys@tonumber\csname pgf@xc\endcsname}%
+ \let\pgfplots@diff=\pgfmathresult
+ %
+ \pgfplotscoordmath{default}{parsenumber}{\scalex}%
+ \let\pgfplots@s=\pgfmathresult
+ %
+ % this is a precondition of this method:
+ \pgfplotscoordmath{default}{parsenumber}{\h}%
+ \let\h=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\H}%
+ \let\H=\pgfmathresult
+ %
+ % compute counter := H - s * (h - (max-min))
+ \pgfplotscoordmath{default}{op}{subtract}{{\h}{\pgfplots@diff}}%
+ \pgfplotscoordmath{default}{op}{multiply}{{\pgfplots@s}{\pgfmathresult}}%
+ \pgfplotscoordmath{default}{op}{subtract}{{\H}{\pgfmathresult}}%
+ \let\pgfplots@counter=\pgfmathresult
+ %
+ % computer denom := s * (max-min)
+ \pgfplotscoordmath{default}{op}{multiply}{{\pgfplots@s}{\pgfplots@diff}}%
+ \let\pgfplots@denom=\pgfmathresult
+ %
+ \pgfplotscoordmath{default}{op}{divide}{{\pgfplots@counter}{\pgfplots@denom}}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
+ %
+ % Now, s_z = \pgfmathresult .
+ %
+ % Now, adjust the z limits.
+ % Note that \pgfplots@apply@unit@vector@rescale@keep@size
+ % has a slightly different context; it assumes that the
+ % unit vector has been rescaled, not the axis limits.
+ % Consequently, the inverse of the scaling factor enters.
+ % Since \pgfplots@apply@unit@vector@rescale@keep@size
+ % expects the inverse of the scale, we can provide
+ % \pgfmathresult:
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+ \let#2=\pgfmathresult
+}
+
+\def\pgfplots@computeunitvectorlengths{%
+ \pgfplotsutil@edef@invoke\pgfmathveclen@{%
+ {\pgf@sys@tonumber\pgf@xx}%
+ {\pgf@sys@tonumber\pgf@xy}%
+ }%
+ \let\pgfplots@x@veclength=\pgfmathresult
+ \pgfplotsmath@ifzero{\pgfplots@x@veclength}{%
+ \def\pgfmathresult{infty}%
+ % this case will be caught in \pgfplots@initsizes
+ }{%
+ \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
+ }%
+ \let\pgfplots@x@inverseveclength=\pgfmathresult
+ %
+ \pgfplotsutil@edef@invoke\pgfmathveclen@{%
+ {\pgf@sys@tonumber\pgf@yx}%
+ {\pgf@sys@tonumber\pgf@yy}%
+ }%
+ \let\pgfplots@y@veclength=\pgfmathresult
+ \pgfplotsmath@ifzero{\pgfplots@y@veclength}{%
+ \def\pgfmathresult{infty}%
+ % this case will be caught in \pgfplots@initsizes
+ }{%
+ \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
+ }%
+ \let\pgfplots@y@inverseveclength=\pgfmathresult
+ %
+ \ifpgfplots@threedim
+ \pgfplotsutil@edef@invoke\pgfmathveclen@{%
+ {\pgf@sys@tonumber\pgf@zx}%
+ {\pgf@sys@tonumber\pgf@zy}%
+ }%
+ \let\pgfplots@z@veclength=\pgfmathresult
+ \pgfplotsmath@ifzero{\pgfplots@z@veclength}{%
+ \def\pgfmathresult{infty}%
+ % this case will be caught in \pgfplots@initsizes
+ }{%
+ \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
+ }%
+ \let\pgfplots@z@inverseveclength=\pgfmathresult
+ \else
+ \def\pgfplots@z@veclength{0}%
+ \def\pgfplots@z@inverseveclength{infty}%
+ \fi
+}%
+
+% Defines \pgfplots@view@dir@threedim according to the actual
+% configuration of x,y,z (2d) unit vectors, assuming the associated
+% unit vectors form a right-handed-system.
+%
+% The algorithm works for standard three dimensional axes. It works as
+% follows:
+%
+% First, observe that we have a normal direction N if all its
+% multiples are mapped onto the same point in 2D canvas
+% coordinates. In other words: all 3D coordinates which are mapped
+% onto an arbitrary point in 2D canvas coordinates (take, for example,
+% the origin (0,0) ) are on a line in direction of N.
+%
+% We use this observation to compute the normal axis, i.e. we search
+% for all points which are mapped onto the 2D canvas coordinate (0,0):
+% N_x e_xx + N_y e_yx + N_z e_zx = 0
+% N_x e_xy + N_y e_yy + N_z e_zy = 0.
+% All solutions make up a linear space of dimension 1 (up to special
+% cases). In the general case, we can chose an arbitrary N_z != 0
+% and reduce the linear system to
+% N_x e_xx + N_y e_yx = - N_z e_zx
+% N_x e_xy + N_y e_yy = - N_z e_zy.
+% Choosing *any* N_z != 0, say, N_z=-1 (which corresponds to view
+% from above) will lead to a vector parallel to the normal direction.
+% But it might have the wrong sign.
+%
+% FIXME : this fails if one of e_x or e_y is zero.
+%
+% To find the correct sign for N, I have made several case
+% distinctions to identify the cases when we have to multiply with -1.
+% The key idea is to assume a right-handed-system of unit vectors;
+% this is the condition which allows to determine the sign.
+%
+% Furthermore, I assume that e_z points to the top, i.e. that e_zy >0.
+% Then, there are (mainly) four conditions on the signs of e_x and e_y
+% which indicate that we are viewing from below and should switch the
+% sign of N (keep in mind that our initial choice was N_z =-1, see above).
+%
+% The conditions can be identified by drawing a 3D box and
+% identifying the corner which represents the lower left 3D limits.
+%
+% You can visualize these cases using
+%--------------------------------------------------
+% \pgfplotsset{
+% separate axis lines,
+% every outer x axis line/.append style= {-stealth},
+% every outer y axis line/.append style= {-stealth},
+% every outer z axis line/.append style= {-stealth},
+% samples=2,shader=interp,title={view=\h,\v},
+% domain=0:1,
+% enlargelimits=false,
+% view=\h\v,xlabel=x,ylabel=y,
+% extra description/.code={%
+% \node[draw,fill=white] at (axis cs:0,0,0) {};
+% },
+% }
+%
+% \def\v{30}
+% \foreach \h in {30,120,210,300} {
+% \message{VIEW={\h}{\v}^^J}
+% \begin{tikzpicture}
+% \begin{axis}
+% \addplot3[surf] {x};
+% \end{axis}
+% \end{tikzpicture}
+%
+% }
+%
+% \def\v{-30}
+% \foreach \h in {30,120,210,300} {
+% \message{VIEW={\h}{\v}^^J}
+% \begin{tikzpicture}
+% \begin{axis}
+% \addplot3[surf] {x};
+% \end{axis}
+% \end{tikzpicture}
+%
+% }
+%--------------------------------------------------
+% The precise formulas can be found below in the source code.
+%
+% You can override this function by the /pgfplots/view dir key.
+\def\pgfplotsgetnormalforcurrentview{%
+ \pgfkeysgetvalue{/pgfplots/view dir}\pgfplots@loc@TMPc
+ \ifx\pgfplots@loc@TMPc\pgfutil@empty
+ \begingroup
+ % temporarily undo the effects of reversed axes -- we *really*
+ % need a right-handed-coordinate system here:
+ \if r\pgfkeysvalueof{/pgfplots/x dir/value}%
+ \pgf@xx=-\pgf@xx
+ \pgf@xy=-\pgf@xy
+ \fi
+ \if r\pgfkeysvalueof{/pgfplots/y dir/value}%
+ \pgf@yx=-\pgf@yx
+ \pgf@yy=-\pgf@yy
+ \fi
+ \if r\pgfkeysvalueof{/pgfplots/z dir/value}%
+ \pgf@zx=-\pgf@zx
+ \pgf@zy=-\pgf@zy
+ \fi
+ % FIRST: check for special cases.
+ \let\pgfplots@view@dir@threedim=\pgfutil@empty%
+ % Special case:
+ % e_xx = e_xy = 0
+ %
+ % i.e.:
+ %
+ % ^
+ % | |---|
+ % z | |
+ % |---|
+ % y->
+ %
+ % In this case, N must be the x axis.
+ \ifdim\pgf@xx=0pt %
+ \ifdim\pgf@xy=0pt %
+ \def\pgfplots@view@dir@threedim{-1,0,0}%
+ \fi
+ \fi
+ % Special case:
+ % e_yx = e_yy = 0
+ %
+ % i.e.:
+ %
+ % ^
+ % | |---|
+ % z | |
+ % |---|
+ % x->
+ %
+ % In this case, N must be the y axis.
+ \ifdim\pgf@yx=0pt %
+ \ifdim\pgf@yy=0pt %
+ \def\pgfplots@view@dir@threedim{0,1,0}%
+ \fi
+ \fi
+ % Special case:
+ % e_xy = e_yy = 0 (i.e. one row)
+ %
+ % that is hard to draw, use view={30}{0} to see it.
+ %
+ % In this case, N_z must be 0 and we have a different system.
+ \ifdim\pgf@xy=0pt %
+ \ifdim\pgf@yy=0pt %
+ \ifx\pgfplots@view@dir@threedim\pgfutil@empty
+ % we have N_x e_xx + N_y e_yx = 0
+ % Note that e_xx != 0 and e_yx != 0 (otherwise one
+ % of our other special cases above would have
+ % caught the case)
+ % -> we have N_x = -N_y e_yx / e_xx and N_y
+ % arbitrary. only the sign needs to be fixed.
+ \def\pgfplots@view@dir@threedim@z{0}%
+ \def\pgfplots@view@dir@threedim@y{1}% fix it somehow. We correct the sign later.
+ \edef\pgfplots@loc@TMPa{-(\pgfplots@view@dir@threedim@y) * \pgf@sys@tonumber\pgf@yx / (\pgf@sys@tonumber\pgf@xx)}%
+ \pgfmathparse{\pgfplots@loc@TMPa}%
+ \let\pgfplots@view@dir@threedim@x=\pgfmathresult
+ %
+ \def\pgfplots@scale{1}%
+ % I identified these cases by comparing the
+ % results with \pgfplots@scale{1} with those of
+ % the view dir generated by
+ % \pgfplotssetaxesfromazel (which has the correct quality of solution)
+ \ifdim\pgf@zy>0pt %
+ \ifdim\pgf@xx<0pt %
+ \def\pgfplots@scale{-1}%
+ \fi
+ \else
+ \ifdim\pgf@xx>0pt %
+ \def\pgfplots@scale{-1}%
+ \fi
+ \fi
+ \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@x}%
+ \let\pgfplots@view@dir@threedim@x\pgfmathresult
+ \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@y}%
+ \let\pgfplots@view@dir@threedim@y\pgfmathresult
+ \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@z}%
+ \let\pgfplots@view@dir@threedim@z\pgfmathresult
+ %
+ \edef\pgfplots@view@dir@threedim{\pgfplots@view@dir@threedim@x,\pgfplots@view@dir@threedim@y,\pgfplots@view@dir@threedim@z}%
+ \else
+ % Ah - we already caught that special case above.
+ \fi
+ \fi
+ \fi
+ %
+ % NOTE : the case e_xx = e_yx = 0 IS NO USE-CASE (would
+ % require a rotated z axis which is forbidden currently)
+ %
+ \ifx\pgfplots@view@dir@threedim\pgfutil@empty
+ \def\pgfplots@view@dir@threedim@z{-1}% hold it at some arbitrary value
+ \pgf@xa=-\pgfplots@view@dir@threedim@z\pgf@zx
+ \pgf@ya=-\pgfplots@view@dir@threedim@z\pgf@zy
+ \edef\pgfplots@loc@TMPa{%
+ {%
+ {\pgf@sys@tonumber\pgf@xx}{\pgf@sys@tonumber\pgf@yx}%
+ {\pgf@sys@tonumber\pgf@xy}{\pgf@sys@tonumber\pgf@yy}%
+ }%
+ {%
+ {\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@ya}%
+ }%
+ }%
+ \expandafter\pgfutilsolvetwotwoleq\pgfplots@loc@TMPa
+ \def\pgfplots@loc@TMPb##1##2{%
+ \def\pgfplots@view@dir@threedim@x{##1}%
+ \def\pgfplots@view@dir@threedim@y{##2}%
+ }%
+ \expandafter\pgfplots@loc@TMPb\pgfmathresult
+ %
+ % Identify if we need to switch the sign.
+ % To verify that these cases are useful, I suggest visualizing
+ % that stuff using the TeX code from above...
+ %
+ % I guess it is correct up to collapsing views (as you see, I
+ % did not properly identify the cases with "=0" )
+ \def\pgfplots@scale{1}%
+ \ifdim\pgf@xx>0pt
+ \ifdim\pgf@yx<0pt
+ \else
+ %
+ \ifdim\pgf@xy<0pt
+ \else
+ \ifdim\pgf@yy<0pt
+ \def\pgfplots@scale{-1}%
+ \fi
+ \fi
+ %
+ \fi
+ \else
+ \ifdim\pgf@xx<0pt
+ \ifdim\pgf@yx>0pt
+ \else
+ %
+ \ifdim\pgf@xy>0pt
+ \else
+ \ifdim\pgf@yy>0pt
+ \def\pgfplots@scale{-1}%
+ \fi
+ \fi
+ %
+ \fi
+ \fi
+ \fi
+ \ifdim\pgf@xy>0pt
+ \ifdim\pgf@yy<0pt
+ \else
+ %
+ \ifdim\pgf@xx>0pt
+ \else
+ \ifdim\pgf@yx>0pt
+ \def\pgfplots@scale{-1}%
+ \fi
+ \fi
+ %
+ \fi
+ \else
+ \ifdim\pgf@xy<0pt
+ \ifdim\pgf@yy>0pt
+ \else
+ %
+ \ifdim\pgf@xx<0pt
+ \else
+ \ifdim\pgf@yx<0pt
+ \def\pgfplots@scale{-1}%
+ \fi
+ \fi
+ %
+ \fi
+ \fi
+ \fi
+ \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@x}%
+ \let\pgfplots@view@dir@threedim@x\pgfmathresult
+ \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@y}%
+ \let\pgfplots@view@dir@threedim@y\pgfmathresult
+ \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@z}%
+ \let\pgfplots@view@dir@threedim@z\pgfmathresult
+ %
+ \pgfplotsmathvectorfromstring{\pgfplots@view@dir@threedim@x,\pgfplots@view@dir@threedim@y,\pgfplots@view@dir@threedim@z}{default}%
+ \let\pgfplots@view@dir@threedim=\pgfplotsretval
+ % normalize. This is not absolutely required -- but it is used
+ % to accumulate point depth (for the mesh handler) in pgfmath
+ % arithmetics. At least \pgfplotsmathviewdepthxyz should use
+ % a properly scaled view dir.
+ \pgfplotsmathvectorlength{\pgfplotsretval}{default}%
+ \pgfplotscoordmath{default}{op}{reciprocal}{{\pgfplotsretval}}%
+ \pgfplotsmathvectorscale{\pgfplots@view@dir@threedim}{\pgfmathresult}{default}%
+ \else
+ \pgfplotsmathvectorfromstring{\pgfplots@view@dir@threedim}{default}%
+ \fi
+ %
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+ \let\pgfplots@view@dir@threedim=\pgfplotsretval
+ \else
+ \def\pgfplots@loc@TMPb##1##2##3{%
+ \pgfplotsmathvectorfromstring{##1,##2,##3}{default}%
+ \let\pgfplots@view@dir@threedim=\pgfplotsretval
+ }%
+ \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPc
+ \fi
+%\message{\string\pgfplotsgetnormalforcurrentview: got (\pgfplots@view@dir@threedim)^^J}%
+}%
+
+% PRECONDITION:
+% none
+% POSTCONDITION:
+% \pgfplots@default@aspect@ratio is set.
+\def\pgfplots@compute@default@aspect@ratio{%
+ \expandafter\pgfmath@x\axisdefaultwidth
+ \expandafter\pgfmath@y\axisdefaultheight
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{%
+ {\pgf@sys@tonumber{\pgfmath@x}}%
+ {\pgf@sys@tonumber{\pgfmath@y}}%
+ }%
+ \let\pgfplots@default@aspect@ratio=\pgfmathresult
+}
+
+\def\pgfplots@ifneeds@one@uniform@datascale#1#2{%
+ \if3\pgfplots@scale@mode@choice
+ % scale mode=scale uniformly
+ \def\pgfplots@loc@TMPa{1}%
+ %
+ % if we have at least one unit vector given explicitly, the
+ % meaning changes: in that case, we can (and probably should)
+ % use different data scale factors in each direction.
+ \ifx\pgfplots@x\pgfutil@empty
+ \else
+ \def\pgfplots@loc@TMPa{0}%
+ \fi
+ \ifx\pgfplots@y\pgfutil@empty
+ \else
+ \def\pgfplots@loc@TMPa{0}%
+ \fi
+ \ifx\pgfplots@z\pgfutil@empty
+ \else
+ \def\pgfplots@loc@TMPa{0}%
+ \fi
+ \else
+ \def\pgfplots@loc@TMPa{0}%
+ \fi
+ \if1\pgfplots@loc@TMPa
+ #1%
+ \else
+ #2%
+ \fi
+}%
+
+\def\pgfplots@set@default@size@options{%
+ % The axes 'x' and 'y' vectors will be scaled such that the total
+ % size is (\axisdefaultwidth, \axisdefaultheight).
+ %
+ % If the user specifies ONE of width OR height,
+ % the plot will be resized; keeping the aspect ratio.
+ %
+ \let\pgfplots@default@aspect@ratio=\pgfutil@empty
+ \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}%
+ \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}%
+ \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}%
+ %\pgfkeysgetvalue{/pgfplots/viewdir}{\pgfplots@viewdir}%
+ \pgfkeysgetvalue{/pgfplots/width}{\pgfplots@width}%
+ \pgfkeysgetvalue{/pgfplots/height}{\pgfplots@height}%
+ \ifx\pgfplots@width\pgfutil@empty
+ \def\pgfplots@user@provided@width{0}%
+ \else
+ \def\pgfplots@user@provided@width{1}%
+ \pgfmathparse{\pgfplots@width}%
+ \edef\pgfplots@width{\pgfmathresult pt}%
+ \fi
+ \ifx\pgfplots@height\pgfutil@empty
+ \def\pgfplots@user@provided@height{0}%
+ \else
+ \def\pgfplots@user@provided@height{1}%
+ \pgfmathparse{\pgfplots@height}%
+ \edef\pgfplots@height{\pgfmathresult pt}%
+ \fi
+ %
+ % CASES:
+ % W := 'width' option non-empty
+ % H := 'height' option non-empty
+ %
+ % W H
+ % 0 0 -> \axisdefaultwidth
+ % 0 1 -> determine width out of H and the default aspect ratio
+ % 1 X -> ok, use the user parameter.
+ % -> KEEP ASPECT RATIO if just one W, or H is given!
+ \ifx\pgfplots@width\pgfutil@empty
+ \ifx\pgfplots@height\pgfutil@empty
+ % The case W=0 H=0:
+ \let\pgfplots@width=\axisdefaultwidth
+ \let\pgfplots@height=\axisdefaultheight
+ \else
+ % The case W=0 H=1:
+ \pgfplots@compute@default@aspect@ratio
+ \expandafter\pgfmath@y\pgfplots@height
+ \pgfmathlog@invoke@expanded\pgfmathmultiply@{%
+ {\pgf@sys@tonumber{\pgfmath@y}}%
+ {\pgfplots@default@aspect@ratio}%
+ }%
+ \edef\pgfplots@width{\pgfmathresult pt}%
+ \fi
+ \else
+ \ifx\pgfplots@height\pgfutil@empty
+ % The case W=1 H=0:
+ \pgfplots@compute@default@aspect@ratio
+ \expandafter\pgfmath@x\pgfplots@width
+ \pgfmathlog@invoke@expanded\pgfmathdivide@{%
+ {\pgf@sys@tonumber{\pgfmath@x}}%
+ {\pgfplots@default@aspect@ratio}%
+ }%
+ \edef\pgfplots@height{\pgfmathresult pt}%
+ \else
+ % The case W=1 H=1:
+ \fi
+ \fi
+ \pgfkeyslet{/pgfplots/width}{\pgfplots@width}%
+ \pgfkeyslet{/pgfplots/height}{\pgfplots@height}%
+ %
+ \ifpgfplots@threedim
+ \pgfplots@set@default@size@options@threedim
+ \fi
+ %
+ \pgfplots@set@scale@mode
+}
+
+% This method must be called BEFORE THE DATASCALING is initialized.
+\def\pgfplots@set@scale@mode{%
+ \pgfkeysgetvalue{/pgfplots/unit vector ratio}\pgfplots@loc@TMPb
+ \ifx\pgfplots@loc@TMPb\pgfutil@empty
+ \else
+ \ifcase\pgfplots@scale@mode@choice
+ % 'scale mode'=auto
+ \def\pgfplots@scale@mode@choice{3}% set to 'scale uniformly'
+ %
+ \if1\pgfplots@compat@scale@mode@compatible@mode
+ % backwards compatibility mode...
+ \ifpgfplots@threedim
+ % ... for 3d: there is no backwards compatibility
+ % mode here; it was plain wrong for 3d axes:
+ % neither lengths nor angles have been correct.
+ \pgfplots@compat@scale@mode@compatible@mode@warning
+ \fi
+ \fi
+ \or
+ % scale mode=none: keep it this way.
+ \immediate\write-1{PGFPlots: scale mode=none and unit vector ratio is incompatible. Ignoring unit vector ratio.^^J}%
+ \or
+ % scale mode=stretch to fill
+ \immediate\write-1{PGFPlots: scale mode=stretch to fill and unit vector ratio might produce unexpected results. Consider using scale mode=auto^^J}%
+ \fi
+ \fi
+ %
+}
+
+\def\pgfplots@compat@scale@mode@compatible@mode@warning{%
+ \pgfplots@warning{The content of your 3d axis has CHANGED compared to previous versions of pgfplots. Please review it. ^^J %
+ [continued] Explanation: you have a 3d axis with 'axis equal' and/or 'unit vector ratio' which has (probably) been optimized for an older version of pgfplots. Any version older than 1.6 produced wrong output.^^J %
+ [continued] To remove this warning, write \string\pgfplotsset{compat=1.6} (or newer) in your preamble (may change all figures in your document) or by adding that to the affected axis.}%
+}%
+
+\def\pgfplots@set@default@size@options@threedim{%
+ \pgfplots@loc@tmpfalse
+ \ifx\pgfplots@x\pgfutil@empty
+ \else
+ \pgfplots@loc@tmptrue
+ \fi
+ \ifx\pgfplots@y\pgfutil@empty
+ \else
+ \pgfplots@loc@tmptrue
+ \fi
+ \ifx\pgfplots@z\pgfutil@empty
+ \else
+ \pgfplots@loc@tmptrue
+ \fi
+ \ifpgfplots@loc@tmp
+ % oh - we have at least one of the [xyz] unit vectors!
+ % make sure all of them are there
+ \ifx\pgfplots@x\pgfutil@empty
+ \pgfplots@set@default@size@options@threedim@{x}{(1pt,0pt)}%
+ \fi
+ \ifx\pgfplots@y\pgfutil@empty
+ \pgfplots@set@default@size@options@threedim@{y}{(0pt,1pt)}%
+ \fi
+ \ifx\pgfplots@z\pgfutil@empty
+ \pgfplots@set@default@size@options@threedim@{z}{(0pt,1pt)}%
+ \fi
+ \pgfkeyslet{/pgfplots/view/az}\pgfutil@empty
+ \pgfkeyslet{/pgfplots/view/el}\pgfutil@empty
+ \fi
+}
+\def\pgfplots@set@default@size@options@threedim@#1#2{%
+ \pgfplots@error{Sorry, a 3D axis needs either NONE or ALL of "x,y,z". I found partial information, but (at least) '#1' is lacking... please add '#1'}%
+ \expandafter\def\csname pgfplots@#1\endcsname{#2}%
+}
+
+% A helper method for \pgfplots@initsizes which
+% - applies the data scaling trafo to user arguments
+% - sets calls pgfset#1vec
+%
+% #1: the vector to set (either 'x' or 'y')
+% #2: the index of the vector to set (either 0 or 1)
+% #3: the already precomputed temporary scale (see pgfplots@initsizes)
+% #4: an output argument. It is a macro name which will be defined to
+% '1' if and only if the finally set vector is parallel to the #1 axis
+% of PGF, that means (x,0) for #1=x and (0,y) for #2=y.
+\def\pgfplots@initsizes@setunitvector#1#2#3#4{%
+ \pgfkeysgetvalue{/pgfplots/#1 dir/value}\pgfplots@loc@dirvalue
+ \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@#1\endcsname
+ \ifx\pgfplots@loc@TMPb\pgfutil@empty
+ \def#4{1}% we have (#1,0) or (0,#1)
+ %
+%\message{Setting unitvector(#1) to auto-computed multiple of e_#2 ...}%
+ \edef\pgfplots@loc@TMPa{#3}%
+ \if r\pgfplots@loc@dirvalue
+ \edef\pgfplots@loc@TMPa{-#3}%
+ \fi
+ \ifcase#2\relax
+ \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPa pt}{0pt}}%
+ \or
+ \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPa pt}}%
+ \or
+ \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPa pt}{\pgfplots@loc@TMPa pt}}%
+ \fi
+ \else
+ % Ok, we have a user-defined unit vector.
+ %
+ % That means we also need to apply the scaling trafo!
+ %
+ % 1. Check whether we have a complete vector of type (x,y):
+ \expandafter\pgfutil@in@\expandafter(\expandafter{\pgfplots@loc@TMPb}%
+ \ifpgfutil@in@
+ % YES: we have (x,y):
+ %
+ \def#4{0}% we DON'T have (#1,0) or (0,#1). At least I think so.
+ %
+%\message{Setting unitvector(#1) to non-standard \csname pgfplots@#1\endcsname ...}%
+ \def\pgfplots@loc@TMPa(##1,##2){%
+ \pgfplotscoordmath{default}{parse}{##1}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
+ \let\pgfplots@loc@TMPb=\pgfmathresult
+ \pgfplotscoordmath{default}{parse}{##2}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
+ \let\pgfplots@loc@TMPc=\pgfmathresult
+ %
+ \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
+ \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPb}%
+ \let\pgfplots@loc@TMPb=\pgfmathresult
+ \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPc}%
+ \let\pgfplots@loc@TMPc=\pgfmathresult
+ }{}%
+ \csname pgfset#1vec\endcsname{%
+ \pgfqpoint
+ {\if r\pgfplots@loc@dirvalue -\fi\pgfplots@loc@TMPb pt}
+ {\if r\pgfplots@loc@dirvalue -\fi\pgfplots@loc@TMPc pt}}%
+ }%
+ \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb%
+ %
+ \else
+ % NO we simply have a scalar value.
+ \def#4{1}% we have (#1,0) or (0,#1)
+%\message{Setting unitvector(#1) to \csname pgfplots@#1\endcsname * e_{#2}...}%
+ \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
+ \pgfplotscoordmath{default}{parse}{\csname pgfplots@#1\endcsname}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
+ \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfmathresult}%
+ \edef\pgfplots@loc@TMPb{\pgfmathresult pt}%
+ }{\relax}%
+ \edef\pgfplots@loc@TMPb{\if r\pgfplots@loc@dirvalue -\fi\pgfplots@loc@TMPb}%
+ \begingroup
+ \pgf@xa=\pgfplots@loc@TMPb\relax
+ \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}%
+ \endgroup
+ \ifcase#2\relax
+ \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}%
+ \or
+ \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPb}}%
+ \or
+ \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}%
+ \fi
+ \fi
+ \fi
+%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).^^J}%
+}%
+
+% Applies the 'axis equal' feature.
+%
+% PRECONDITION:
+% - #1, #2, #3 contains the current scaling
+% factors in x,y, z, resp. which are to be applied to unit vectors
+% - neither unit vectors nor limits are in their final shape
+% - \pgfplots@set@default@size@options has been invoked before
+%
+% POSTCONDITION:
+% - #1, #2, #3 have been changed to accomodate unit vector ratio
+% - #4, #5, #6 [output] contain axis limit compensation scales
+%
+% There is just one algorithmic difficulty: the data scaling
+% transformation. All unit vector length above are only meaningful in
+% the UNTRANSFORMED range, so we have to mingle with the scaling
+% transformation.
+\def\pgfplots@apply@unit@ratio#1#2#3#4#5#6{%
+ \begingroup
+ \edef\pgfplots@target@unit@scale@inv@x{#1}%
+ \edef\pgfplots@target@unit@scale@inv@y{#2}%
+ \edef\pgfplots@target@unit@scale@inv@z{#3}%
+ \def\pgfplots@target@limitrescale@x@{1}%
+ \def\pgfplots@target@limitrescale@y@{1}%
+ \def\pgfplots@target@limitrescale@z@{1}%
+ %
+ \pgfkeysgetvalue{/pgfplots/unit vector ratio}\pgfplots@unit@vector@ratio
+ \ifx\pgfplots@unit@vector@ratio\pgfutil@empty
+ \else
+ \edef\pgfplots@unit@vector@ratio{\pgfplots@unit@vector@ratio\space1 1 }%
+ %
+ \expandafter\pgfplots@unit@vector@ratio@check@nop\pgfplots@unit@vector@ratio\pgfplots@EOI
+ \ifpgfplots@loc@tmp
+ %
+ % Step 1: compute the unit vector which STAYS CONSTANT.
+ %
+ \pgfkeysgetvalue{/pgfplots/unit vector ratio axis}\pgfplots@apply@unit@ratio@reference
+ \ifx\pgfplots@apply@unit@ratio@reference\pgfutil@empty
+ \pgfplots@apply@unit@ratio@find@reference%
+ \fi
+ %
+ % FIXME : I could spent some attention here to save work:
+ % both, unit ratios and the resulting scales are computed at
+ % least twice (once in \pgfplots@apply@unit@ratio@find@reference and once in the
+ % following).
+ \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI
+ %
+%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@apply@unit@ratio@reference; ratio \pgfplots@unit@ratio@x\space \pgfplots@unit@ratio@y\space \pgfplots@unit@ratio@z.^^J}%
+ %
+ % Step 2: apply the scaling:
+ \pgfplots@rescale@unit@vector@reltoreference{x}{\pgfplots@unit@ratio@x}%
+ \pgfplots@rescale@unit@vector@reltoreference{y}{\pgfplots@unit@ratio@y}%
+ \ifpgfplots@threedim
+ \pgfplots@rescale@unit@vector@reltoreference{z}{\pgfplots@unit@ratio@z}%
+ \fi
+ %
+ \else
+%\message{Skipped application of 'unit vector ratio=\pgfkeysvalueof{/pgfplots/unit vector ratio}': it is already done by 'scale uniformly'.^^J}%
+ \fi
+ \fi
+ \xdef\pgfplots@glob@TMPa{%
+ \noexpand\def\noexpand#1{\pgfplots@target@unit@scale@inv@x}%
+ \noexpand\def\noexpand#2{\pgfplots@target@unit@scale@inv@y}%
+ \noexpand\def\noexpand#3{\pgfplots@target@unit@scale@inv@z}%
+ \noexpand\def\noexpand#4{\pgfplots@target@limitrescale@x@}%
+ \noexpand\def\noexpand#5{\pgfplots@target@limitrescale@y@}%
+ \noexpand\def\noexpand#6{\pgfplots@target@limitrescale@z@}%
+ }%
+ \endgroup
+ \pgfplots@glob@TMPa
+}%
+
+\def\pgfplots@appy@unit@ratio@reciprocal#1{%
+ \pgfplotscoordmath{default}{parsenumber}{#1}%
+ \pgfplotscoordmath{default}{op}{reciprocal}{{\pgfmathresult}}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}%
+}%
+
+% Defines \ifpgfplots@loc@tmp := need to modify scaling factors
+\def\pgfplots@unit@vector@ratio@check@nop#1 #2 #3 #4\pgfplots@EOI{%
+ \pgfplots@loc@tmptrue
+ \if3\pgfplots@scale@mode@choice
+ % scale mode=scale uniformly
+ \ifpgfplots@threedim
+ \ifdim#1pt=#2pt
+ \ifdim#1pt=#3pt
+ % 'axis equal' is implicitly done by 'scale mode=scale
+ % uniformly' anyway
+ \pgfplots@loc@tmpfalse
+ \fi
+ \fi
+ \else
+ \ifdim#1pt=#2pt
+ % 'axis equal' is implicitly done by 'scale mode=scale
+ % uniformly' anyway
+ \pgfplots@loc@tmpfalse
+ \fi
+ \fi
+ \fi
+ % activate the following line to deactivate optimization: [FIXME]
+ %\pgfplots@loc@tmpfalse
+}%
+
+% This macro determines the reference axis for unit vector rescaling.
+% The reference axis remains unscaled (it gets scaling factor 1 if you
+% want it this way).
+%
+% The other axes are scaled such that the desired unit vector ratios
+% are fulfilled.
+%
+% The idea to select a reference axis is as follows:
+% 1. Every unit vector scaling factor s should fulfill s <= 1.
+% 2. Choose the reference axis such that the minimal amount of scaling
+% is performed.
+%
+% The motivation for (1) is: if all involved scaling factors are at
+% most 1, the resulting picture will only become *smaller*.
+% Consequently, we can simply enlarge axis limits to restore the
+% original width/height!
+%
+% The motivation for (2) is: a huge amount of scaling might reduce the
+% size of the image too much. Of course, the figure will be enlarged
+% to fit the original width/height, but most of it will be empty. So,
+% use the smallest scaling.
+%
+% @POSTCONDITION The reference axis is stored in
+% \pgfplots@apply@unit@ratio@reference .
+%
+% @see the key 'unit vector ratio axis=y' which allows to manually
+% select the reference axis. This will illustrate what happens here.
+\def\pgfplots@apply@unit@ratio@find@reference{%
+ %
+ \begingroup
+ \let\pgfplots@ONE=\pgf@x
+ \global\pgfplots@ONE=1.002pt
+ %
+ \def\pgfplots@optimum@sofar@axis{}%
+ \let\pgfplots@optimum@sofar@value=\pgf@y
+ \global\pgfplots@optimum@sofar@value=16000pt
+ %
+ %\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits
+ %
+ \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty
+ % set \pgfplots@loc@TMPa := 1 if and only if the axis is 3d
+ \def\pgfplots@loc@TMPa{0}%
+ \if0\b@pgfplots@unitvec@is@zero@z
+ % ah, it IS 3d!
+ \def\pgfplots@loc@TMPa{1}%
+ \else
+ % ok, 2d mode (includes view={0}{90})
+ \def\pgfplots@loc@TMPa{0}%
+ \fi
+ \if1\pgfplots@loc@TMPa
+ % 3D is more complicated than 2D:
+ % for every fixed reference axis, we have to check *two*
+ % scaling factors.
+ %
+ % Furthermore, the optimality condition (2) needs to be
+ % performed on the maximum max{1-s_a, 1-s_b} provided both of
+ % these numbers are positive.
+ %
+ \def\pgfplots@check@##1##2{%
+ % PRECONDITION: \pgfplots@apply@unit@ratio@reference is defined.
+ %
+ % renormalize \pgfplots@unit@[xyz] :
+ \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI
+ %
+ % compute s_a :
+ \pgfplots@getscale@unit@vector@reltoreference ##1{\csname pgfplots@unit@ratio@##1\endcsname}%
+ \let\pgfplots@scale@a=\pgfmathresult
+ %
+ % compute s_b :
+ \pgfplots@getscale@unit@vector@reltoreference ##2{\csname pgfplots@unit@ratio@##2\endcsname}%
+ \let\pgfplots@scale@b=\pgfmathresult
+ %
+ % check if the actual choice of
+ % \pgfplots@apply@unit@ratio@reference is FEASIBLE.
+ % That is the case if s_a <= 1 && s_b <= 1.
+ % We check
+ % (1 - s_a >= 0 ) && ( 1 - s_b >= 0 )
+ % instead, since I need the value
+ % max( 1-s_a, 1-s_b )
+ % anyway.
+ \def\pgfplots@ref@is@feasible{1}%
+ \pgf@xa=\pgfplots@ONE \advance\pgf@xa by-\pgfplots@scale@a pt
+ \ifdim\pgf@xa<0sp
+ \def\pgfplots@ref@is@feasible{0}%
+ \else
+ \pgf@xb=\pgfplots@ONE \advance\pgf@xb by-\pgfplots@scale@b pt
+ \ifdim\pgf@xb<0sp
+ \def\pgfplots@ref@is@feasible{0}%
+ \fi
+ \fi
+ % compute max(1-s_a,1-s_b) into \pgf@xa:
+ % pgf@xa= max(pgf@xa,pgf@xb):
+ \ifdim\pgf@xb>\pgf@xa \pgf@xa=\pgf@xb \fi
+ \if1\pgfplots@ref@is@feasible
+ \ifdim\pgf@xa<\pgfplots@optimum@sofar@value
+ % Ah, ok. The actual choice is BETTER as it
+ % involves less scaling.
+ %
+ % Remember it!
+ \let\pgfplots@optimum@sofar@axis=\pgfplots@apply@unit@ratio@reference
+ \global\pgfplots@optimum@sofar@value=\pgf@xa
+ \fi
+ \fi
+%\message{^^Junit vector ratio 3D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfplots@ref@is@feasible. \if1\pgfplots@ref@is@feasible max=\the\pgf@xa. \fi Optimum so far: value =\the\pgfplots@optimum@sofar@value\space for axis \pgfplots@optimum@sofar@axis.^^J}%
+ }%
+ %
+ % Check 'x' as reference :
+ \def\pgfplots@apply@unit@ratio@reference{x}%
+ \pgfplots@check@ yz%
+ %
+ % Check 'y' as reference :
+ \def\pgfplots@apply@unit@ratio@reference{y}%
+ \pgfplots@check@ xz%
+ %
+ % Check 'z' as reference :
+ \def\pgfplots@apply@unit@ratio@reference{z}%
+ \pgfplots@check@ xy%
+ %
+ \else
+ % 2D is much simpler: find the scale s which fulfills s <= 1.
+ % One of them MUST fulfill it.
+ %
+ % try 'x' axis as reference:
+ \def\pgfplots@apply@unit@ratio@reference{x}%
+ %
+ % renormalize:
+ \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI
+ %
+ % compute scaling factor:
+ \pgfplots@getscale@unit@vector@reltoreference y\pgfplots@unit@ratio@y%
+ %
+%\message{^^Junit vector ratio 2D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfmathresult < 1: \ifdim\pgfmathresult pt <\pgfplots@ONE YES-> use x\else NO->use y\fi^^J}%
+ % and check (1). The condition (2) is irrelevant; it is met
+ % anyway.
+ \ifdim\pgfmathresult pt<\pgfplots@ONE
+ \def\pgfplots@optimum@sofar@axis{x}%
+ \else
+ \def\pgfplots@optimum@sofar@axis{y}%
+ \fi
+ \fi
+ \else
+%\message{^^Junit vector ratio chose \pgfplots@optimum@sofar@axis\space to fulfill explicitly provided limits (at least partially).^^J}%
+ \fi
+ %
+ \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty
+ \if1\b@pgfplots@unitvec@is@zero@z
+ \def\pgfplots@optimum@sofar@axis{y}%
+ \else
+ \def\pgfplots@optimum@sofar@axis{z}%
+ \fi
+ \pgfplots@warning{The algorithm to implement 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=\pgfplots@optimum@sofar@axis'.}%
+ \fi
+ \let\pgfplots@apply@unit@ratio@reference=\pgfplots@optimum@sofar@axis
+ \pgfmath@smuggleone\pgfplots@apply@unit@ratio@reference
+ \endgroup
+}%
+\def\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits{%
+ \ifpgfplots@autocompute@ymax \else \def\pgfplots@optimum@sofar@axis{y}\fi
+ \ifpgfplots@autocompute@ymin \else \def\pgfplots@optimum@sofar@axis{y}\fi
+ \ifpgfplots@autocompute@xmax \else \def\pgfplots@optimum@sofar@axis{x}\fi
+ \ifpgfplots@autocompute@xmin \else \def\pgfplots@optimum@sofar@axis{x}\fi
+ \ifpgfplots@threedim
+ \ifpgfplots@autocompute@zmax \else \def\pgfplots@optimum@sofar@axis{z}\fi
+ \ifpgfplots@autocompute@zmin \else \def\pgfplots@optimum@sofar@axis{z}\fi
+ \fi
+}%
+
+% This is ONLY applied to the value of 'unit vector ratio'. It does
+% not touch the current axis scaling factors.
+\def\pgfplots@apply@unit@ratio@prepareratios#1 #2 #3 #4\pgfplots@EOI{%
+ \def\pgfplots@unit@ratio@x{#1}%
+ \def\pgfplots@unit@ratio@y{#2}%
+ \def\pgfplots@unit@ratio@z{#3}%
+ %
+ % 'unit vector ratio' is measured relative to the y axis for 2d
+ % and relative to the z axis for 3d plots.
+ % renormalize such that it is relative to
+ % \pgfplots@apply@unit@ratio@reference.
+ %
+ % Furthermore, renormalize such that
+ % unit@ratio@\pgfplots@apply@unit@ratio@reference is 1.
+ \pgfmathreciprocal@{\csname pgfplots@unit@ratio@\pgfplots@apply@unit@ratio@reference\endcsname}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \ifpgfplots@threedim
+ \if z\pgfplots@apply@unit@ratio@reference
+ \else
+ \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \fi
+ %
+ \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}%
+ \let\pgfplots@unit@ratio@x=\pgfmathresult
+ %
+ \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}%
+ \let\pgfplots@unit@ratio@y=\pgfmathresult
+ %
+ \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}%
+ \let\pgfplots@unit@ratio@z=\pgfmathresult
+ \else
+ \if y\pgfplots@apply@unit@ratio@reference
+ \else
+ \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \fi
+ %
+ \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}%
+ \let\pgfplots@unit@ratio@x=\pgfmathresult
+ %
+ \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}%
+ \let\pgfplots@unit@ratio@y=\pgfmathresult
+ %
+ \def\pgfplots@unit@ratio@z{<unused>}%
+ \fi
+ %
+}%
+
+
+% Computes a new unit vector E_#1 for direction #1 such that
+% ||E_#1|| = #2 * ||e_reference||.
+% Here, #2 is a scaling factor and e_reference is a reference axis.
+% The reference axis is stored in
+% \pgfplots@apply@unit@ratio@reference, the macro contains one of
+% {x,y,z}.
+%
+% The data limits for '#1' will be enlarged as well (for 'unit rescale
+% keep size').
+%
+% #1 is the axis which should be scaled (i.e. #1 in {x,y,z}).
+% It is allowed if #1 = \pgfplots@apply@unit@ratio@reference. In this
+% case, you can provide a scale '#2' to rescale the axis.
+%
+% #2 is a desired scale, relative to
+% \pgfplots@apply@unit@ratio@reference. #2 should be a number without
+% unit.
+%
+% The parameter \pgfplots@apply@unit@ratio@reference is also one of
+% {x,y,z}.
+%
+\def\pgfplots@rescale@unit@vector@reltoreference#1#2{%
+ \def\pgfplots@loc@TMPa{0}%
+ \if#1\pgfplots@apply@unit@ratio@reference
+ \pgfplotsmath@ifapproxequal@dim{#2pt}{1pt}{0.0002pt}{%
+ }{%
+ \def\pgfplots@loc@TMPa{1}%
+ }%
+ \else
+ \def\pgfplots@loc@TMPa{1}%
+ \fi
+ \if1\csname b@pgfplots@unitvec@is@zero@#1\endcsname
+ \def\pgfplots@loc@TMPa{0}%
+ \fi
+ \if1\pgfplots@loc@TMPa
+ %
+ \pgfplots@getscale@unit@vector@reltoreference{#1}{#2}%
+ \global\let\pgfplots@glob@TMPa=\pgfmathresult
+ %
+%\message{Rescaling '#1' by \pgfplots@glob@TMPa.^^J}%
+ %
+ \pgfmathdivide@{\csname pgfplots@target@unit@scale@inv@#1\endcsname}{\pgfplots@glob@TMPa}%
+ \expandafter\let\csname pgfplots@target@unit@scale@inv@#1\endcsname=\pgfmathresult
+ %
+ \pgfmathreciprocal@\pgfplots@glob@TMPa
+ \expandafter\let\csname pgfplots@target@limitrescale@#1@\endcsname=\pgfmathresult
+ %
+ \fi
+}
+
+% Updates the #1 axis limits such that the axis' dimensions
+% stay the same after scaling the #1 unit vector by a scale 's'.
+%
+% PRECONDITION:
+% - the #1 unit vector has been rescaled by a factor s.
+% For example, e_xnew := e_x * 0.5 .
+%
+% POSTCONDITION:
+% - the axis limits are enlarged by a factor 1/s such that
+% 1/s (#1max - #1min) * e_xnew = (#1max- #1min) * e_x.
+%
+% In other words, the unit vector rescale is componensated by
+% modifying the axis limits: we want to add an absolute component 'd'
+% to the range:
+% 1/s (xmax - xmin ) = xmax - xmin +d
+% =>
+% d = (1/s - 1) * (xmax - xmin)
+%
+% The only remaining thing to do is to distribute 'd' to 'xmax' and
+% 'xmin'. Typically, 50% to each will be fine, I guess...
+%
+% #1: either x, y or z. It denotes the direction which has been
+% modified.
+% #2: the INVERSE of the scaling factor, #2 = 1/s .
+%
+\def\pgfplots@apply@unit@vector@rescale@keep@size#1#2{%
+ \ifdim#2pt=1pt
+ \else
+ \if0\pgfplots@unit@vector@rescale@keep@size
+ % unit rescale keep size=false : do nothing. Ignore the
+ % scaling request.
+ \else
+ % unit rescale keep size=true|unless limits declared
+ %
+%\message{'unit rescale keep size': Resizing data range for #1 by #2: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}%
+ \pgfmathsubtract@{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#1min\endcsname}%
+ \begingroup
+ \pgf@xa=\pgfmathresult pt
+ \pgfmathsubtract@{#2}{1.0}%
+ \pgf@xa=\pgfmathresult \pgf@xa% this is 'd'
+ %
+ % \pgfplots@glob@TMPb : will be subtracted from #1min
+ % \pgfplots@glob@TMPc : will be added to #1max
+ \pgfplots@if{pgfplots@autocompute@#1min}{%
+ \pgfplots@if{pgfplots@autocompute@#1max}{%
+ \pgf@xa=0.5 \pgf@xa
+ \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}%
+ \xdef\pgfplots@glob@TMPc{\pgfplots@glob@TMPb}%
+ }{%
+ \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}%
+ \xdef\pgfplots@glob@TMPc{0.0}%
+ }%
+ }{%
+ \pgfplots@if{pgfplots@autocompute@#1max}{%
+ \xdef\pgfplots@glob@TMPb{0.0}%
+ \xdef\pgfplots@glob@TMPc{\pgf@sys@tonumber{\pgf@xa}}%
+ }{%
+ \if1\pgfplots@unit@vector@rescale@keep@size
+ % unit rescale keep size=true : FORCE
+ % enlargement!
+ \pgf@xa=0.5 \pgf@xa
+ \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}%
+ \xdef\pgfplots@glob@TMPc{\pgfplots@glob@TMPb}%
+ \else
+ % unit rescale keep size=unless limits declared:
+ % do not scale - all limits are declared
+ % explicitly
+ \xdef\pgfplots@glob@TMPb{0.0}%
+ \xdef\pgfplots@glob@TMPc{0.0}%
+ \fi
+ }%
+ }%
+ \endgroup
+ \pgfmathsubtract@{\csname pgfplots@#1min\endcsname}{\pgfplots@glob@TMPb}%
+ \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
+ \pgfmathadd@{\csname pgfplots@#1max\endcsname}{\pgfplots@glob@TMPc}%
+ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult
+%\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [- \pgfplots@glob@TMPb; + \pgfplots@glob@TMPc]^^J}%
+ %
+ % Update auxiliary data members:
+ \pgfplots@visphase@notify@changeofcanvaslimits{#1}%
+ \fi
+ \fi
+}%
+
+% #1: an axis which should be scaled
+% #2: the desired final ratio ||e_#1||/||e_ref||
+\def\pgfplots@getscale@unit@vector@reltoreference#1#2{%
+ %
+ % If the datascaling transformation is active (which is almost
+ % everytime the case here), we have a transformation
+ % T^{-1}(x)= 10^scale * x
+ % with different scales for every axis.
+ %
+ % If the datascaling transformation is NOT active, scale is 0
+ % and T^{-1} = Identity.
+ %
+ % Note that the datascaling transformation also has
+ % translations (shifts). These are not important here.
+ %
+ % Goal:
+ % compute E_#1 such that
+ % #2* || T^{-1} e_ref || = || T^{-1} E_#1 ||
+ % where T^{-1} is the data scaling transformation and e_ref the
+ % reference unit vector. Keep in mind that there are
+ % *different* data scaling transformations for each axis.
+ %
+ % We are given e_ref and e_#1 and the desired aspect ratio
+ % between e_ref and E_#1, which is available as #2.
+ %
+ % So: T^{-1} E_#1 := s* T^{-1} e_#1 where
+ % s = #2 * ||T^{-1} e_ref|| / || T^{-1} e_#1 ||
+ % = |10^{scale_ref}| / |10^{scale_#1}| * #2 * || e_ref|| / ||e_#1||.
+ %
+ % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1.
+ %
+ % -> compute 's'!
+ %
+ % Part 1: compute
+ % #2 * ||e_ref|| / ||e_#1||.
+ %
+ \def\pgfplots@loc@TMPa{1}%
+ \if1\csname b@pgfplots@unitvec@is@zero@#1\endcsname
+ \def\pgfplots@loc@TMPa{0}%
+ \else
+ \if1\csname b@pgfplots@unitvec@is@zero@\pgfplots@apply@unit@ratio@reference\endcsname
+ \def\pgfplots@loc@TMPa{0}%
+ \fi
+ \fi
+ \if0\pgfplots@loc@TMPa
+ \def\pgfmathresult{16001}%
+ \else
+ % note that x^{-1} / y^{-1} == ( x/y )^{-1} == y/x .
+ % consequently, we can use our @inv@[xyz] values here:
+ \pgfmathdivide@
+ {\csname pgfplots@target@unit@scale@inv@#1\endcsname}%
+ {\csname pgfplots@target@unit@scale@inv@\pgfplots@apply@unit@ratio@reference\endcsname}
+ \pgfmathmultiply@
+ {\pgfmathresult}%
+ {#2}%
+ \global\let\pgfplots@glob@TMPa=\pgfmathresult
+ %
+ % also compute 1/s, required as temporary value:
+ %\pgfmathmultiply@
+ % {\csname pgfplots@\pgfplots@apply@unit@ratio@reference @inverseveclength\endcsname}
+ % {\csname pgfplots@target@unit@scale@#1\endcsname}%
+ %\ifdim#2pt=1pt
+ %\else
+ % \pgfmathdivide@{\pgfmathresult}{#2}%
+ %\fi
+ %\global\let\pgfplots@glob@TMPb=\pgfmathresult
+ %
+ % Part 2: handle data scaling trafo scales:
+ \begingroup
+ \def\pgfplots@tmp@exponentref{0}%
+ \def\pgfplots@tmp@exponentK{0}%
+ \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@apply@unit@ratio@reference }{%
+ \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@apply@unit@ratio@reference }%
+ }{}%
+ \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
+ \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}%
+ }{}%
+ \c@pgf@counta=\pgfplots@tmp@exponentref\relax
+ \advance\c@pgf@counta by-\pgfplots@tmp@exponentK\relax
+ \ifnum\c@pgf@counta=0
+ \else
+ \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}%
+ \global\let\pgfplots@glob@TMPa=\pgfmathresult
+ % \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}%
+ % \global\let\pgfplots@glob@TMPb=\pgfmathresult
+ \fi
+ \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}%
+ \endgroup
+ \let\pgfmathresult=\pgfplots@glob@TMPa
+ \fi
+%\message{\string\pgfplots@getscale@unit@vector@reltoreference{#1}{#2} (reference \pgfplots@apply@unit@ratio@reference) = \pgfmathresult.^^J}%
+}
+
+% helper for \pgfplots@check@and@apply@datatrafo@for.
+\def\pgfplots@compute@number@order@for@trafo@isdimen#1\tocount#2{%
+ \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{#1}}%
+ \pgfmathfloatparsenumber{\pgfplots@loc@TMPa}%
+ \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2
+ \advance#2 by1\relax
+}
+
+% helper for \pgfplots@check@and@apply@datatrafo@for.
+%
+\def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{%
+ \pgfmathfloatparsenumber{#1}%
+ \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2\relax
+ \advance#2 by1\relax
+}
+
+% Initialises the data scale transformation such that it is optimal
+% for direction #1 (using its axis limits and the target scaling size).
+%
+% Note that it will not be applied in any way; and it may still be
+% modified.
+%
+% PRECONDITION:
+% - all axis limits are available in float representation
+% - \pgfplots@set@default@size@options has been called before
+% POSTCONDITION:
+% - the scaling transformation is set up,
+\def\pgfplots@set@optimal@datatrafo@for@#1{%
+ \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
+ % initialise data scale transformation
+ % T(x) = 10^{q-m} * x
+ %
+ \ifpgfplots@disabledatascaling
+ % this here is a waste of time, because the NO-OP trafo
+ % will be applied to all coordinates. One could really
+ % safe a lot of CPU time when disabledatascaling is enabled...
+ % but it requires so much extra cases; I really don't want
+ % that!
+ \gdef\pgfplots@glob@TMPa{0}%
+ \gdef\pgfplots@glob@TMPb{0}%
+ \else
+ \begingroup
+ \let\data@max@order=\c@pgf@counta
+ \let\data@cur@order=\c@pgf@countb
+ \let\data@dimen=\pgf@xa
+ \let\data@tmp=\pgf@xb
+ \let\data@dimen@order=\c@pgf@countc
+ \let\data@EXPONENT=\c@pgf@countd
+ \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname
+ \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname
+ \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname
+ \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname
+ \ifpgfplots@autocompute@all@limits
+ \else
+ \pgfplotscoordmath{#1}{max}{\pgfplots@display@max@float}{\pgfplots@data@max@float}%
+ \let\pgfplots@data@max@float=\pgfmathresult
+ \pgfplotscoordmath{#1}{min}{\pgfplots@display@min@float}{\pgfplots@data@min@float}%
+ \let\pgfplots@data@min@float=\pgfmathresult
+ \fi
+ %
+%\message{minmax = [\pgfplots@data@min@float,\pgfplots@data@max@float]}%
+ % Step 1: compute 'm', the data order
+ \pgfplots@compute@number@order@for@trafo@isfloat
+ \pgfplots@data@min@float
+ \tocount\data@cur@order
+ %
+ \data@max@order=\data@cur@order
+ %
+ \pgfplots@compute@number@order@for@trafo@isfloat
+ \pgfplots@data@max@float
+ \tocount\data@cur@order
+ %
+ \ifnum\data@cur@order>\data@max@order
+ \data@max@order=\data@cur@order
+ \fi
+ %
+ % Step 2: compute 'q', the #1-size of the axis.
+ %\expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty
+ % We have 'width' or 'height' (I always have them).
+ %
+ % Use the order of these parameters.
+ \def\pgfplots@loc@TMPa{#1}%
+ \def\pgfplots@loc@TMPb{x}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ \data@dimen=\pgfplots@width\relax
+ \else
+ \if1\pgfplots@compat@scaling@zunitfix@enable
+ \data@dimen=\pgfplots@height\relax
+ \else
+ % this code here belongs to versions up to
+ % 1.3.1.
+ % It is now deprecated and produces small
+ % pixel differences.
+ \def\pgfplots@loc@TMPb{y}%
+ \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
+ \data@dimen=\pgfplots@height\relax
+ \else
+ \data@dimen=42pt % this is actually different from 1.3.1: there, it was UNDEFINED.
+ \fi
+ \fi
+ \fi
+ \pgfplots@compute@number@order@for@trafo@isdimen
+ \data@dimen
+ \tocount\data@dimen@order
+ % This here is to avoid inaccuracies in the final
+ % axis rectangle size, see \pgfplots@initsizes:
+ %\advance\data@dimen@order by-1
+ %\else
+ % FIXME:
+ % we have either the 'x=1cm' or 'y=1cm' option!
+ % How should I initialise the trafo!?
+ % \data@dimen@order=3
+ %\fi
+ %
+%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }%
+ \data@EXPONENT=\data@dimen@order
+ \advance\data@EXPONENT by-\data@max@order
+ % Now, I introduce a loop which shall avoid cancellation of
+ % significant digits.
+ %
+ % Harmless Example:
+ % if we have data shift = -3 and
+ % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok.
+ % In this case, the loop won't change anything.
+ %
+ % Critical Example:
+ % if we have data shift = -3 and
+ % max = 1980, min = 1930 then
+ % T(max) = 1.98 and T(min) = 1.93
+ % and thus T(max)-T(min) = 0.05 .
+ % Considering that this is the axis range
+ % in which tick labels and plot points need to be computed, we
+ % only have two or three digits left! That happens because the
+ % prefix '19' is common and is cancelled in the subtraction.
+ % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1
+ % (and make sure that T(max) < MAX_VALID_TEX_NUMBER).
+ %
+ \def\pgfplotscoordmathnotifydatascalesetfor##1{}% disable temporarily. We are just testing it.
+ \pgfplots@loop@CONTINUEtrue
+ \pgfutil@loop
+ \pgfplotscoordmath{#1}{datascaletrafo set params}{\the\data@EXPONENT}{0}%
+ \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@min@float}%
+ \let\pgfplots@min@fixed=\pgfmathresult
+ \ifpgfplots@loop@CONTINUE
+ \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@max@float}%
+ \let\pgfplots@max@fixed=\pgfmathresult
+ \data@tmp=\pgfplots@max@fixed pt
+%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}%
+ \ifdim\data@tmp<0pt
+ % I need absolute values here:
+ \multiply\data@tmp by-1\relax
+ \fi
+ \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}%
+ \data@dimen=\pgfmathresult pt
+ \pgfplots@loop@CONTINUEfalse
+ \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit.
+ \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy
+ \ifdim\data@dimen<0.0001pt
+ \else
+ \advance\data@EXPONENT by1
+ \pgfplots@loop@CONTINUEtrue
+ \fi
+ \fi
+ \fi
+ %--------------------------------------------------
+ % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT!
+ % \ifdim\data@dimen>7999pt
+ % \advance\data@EXPONENT by-2
+ % \else
+ % \advance\data@EXPONENT by-1
+ % \fi
+ % \pgfplots@loop@CONTINUEfalse
+ % \fi
+ %--------------------------------------------------
+ \pgfutil@repeat
+ \xdef\pgfplots@glob@TMPa{\the\data@EXPONENT}%
+ \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}%
+ \endgroup
+ \fi
+ % COMPLETE INITIALISATION:
+%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...^^J}%
+ \pgfplotscoordmath{#1}{datascaletrafo set params}{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}%
+ }{%
+ % case apply trafo == false:
+ \pgfplotscoordmath{#1}{datascaletrafo set params}{0}{0}%
+ }%
+}
+
+
+\def\pgfplots@set@optimal@datatrafos@allaxes{%
+ \pgfplots@letcsname pgfplots@xmin@unscaled@as@float={pgfplots@xmin}%
+ \pgfplots@letcsname pgfplots@xmax@unscaled@as@float={pgfplots@xmax}%
+ %
+ \pgfplots@letcsname pgfplots@ymin@unscaled@as@float={pgfplots@ymin}%
+ \pgfplots@letcsname pgfplots@ymax@unscaled@as@float={pgfplots@ymax}%
+ %
+ \pgfplots@letcsname pgfplots@zmin@unscaled@as@float={pgfplots@zmin}%
+ \pgfplots@letcsname pgfplots@zmax@unscaled@as@float={pgfplots@zmax}%
+ %
+ \pgfplots@ifneeds@one@uniform@datascale{%
+ % Ah - we have to ensure that there is ONE common scale for
+ % each unit (x, y, and z have the same).
+ %
+ % In this case, we need to choose one of the transformations
+ % and apply it to all axes -- such that each axis gets the
+ % same scale.
+ %
+ % this mode is used for axis equal and its variants.
+ %
+ % The strategy to fix the transformation is as follows:
+ % 1. we assume that axis limits will be enlarged in order to
+ % satisfy 'scale uniformly'.
+ % 2. we assume that the LARGEST axis limit dominates the
+ % others.
+ % 3. if one of the axes does not have datascaling (i.e. is
+ % log scale), we disable all other datascalings.
+ %
+ % Consequently, we search for the axis with the largest limit
+ % - and copy its data scaling to all other axes. If one of the
+ % axes is log, that one overrules it and all data scaling
+ % effects are disabled..
+ \begingroup
+ \let\pgfplots@data@scale@trafo@EXPONENT@common=\pgfutil@empty
+ \def\pgfplots@data@scale@trafo@EXPONENT@common@arg{-}% this should not match anything in this context.
+ \pgfplots@if{pgfplots@apply@datatrafo@x}{%
+ }{%
+ \def\pgfplots@data@scale@trafo@EXPONENT@common{{0}{0}}% disable scaling!
+ }%
+ \pgfplots@if{pgfplots@apply@datatrafo@y}{%
+ }{%
+ \def\pgfplots@data@scale@trafo@EXPONENT@common{{0}{0}}% disable scaling!
+ }%
+ \ifpgfplots@threedim
+ \pgfplots@if{pgfplots@apply@datatrafo@z}{%
+ }{%
+ \def\pgfplots@data@scale@trafo@EXPONENT@common{{0}{0}}% disable scaling!
+ }%
+ \fi
+ \ifx\pgfplots@data@scale@trafo@EXPONENT@common\pgfutil@empty
+ % ah - we still need to compute one. ok, search for the
+ % largest limit.
+ %
+ \pgfplots@get@axis@with@largest@limits
+ \let\pgfplots@data@scale@trafo@EXPONENT@common@arg=\pgfplotsretval
+ %
+ % ok, compute data scaling transformation for the target axis:
+ \expandafter\pgfplots@set@optimal@datatrafo@for@\pgfplots@data@scale@trafo@EXPONENT@common@arg%
+ %
+ \pgfplotscoordmath{\pgfplots@data@scale@trafo@EXPONENT@common@arg}{datascaletrafo get params}%
+ \let\pgfplots@data@scale@trafo@EXPONENT@common=\pgfmathresult%
+ \else
+ % hm. early-out - we already have the scaling trafo.
+ % return it.
+ \fi
+ \global\let\pgfplots@glob@TMPa=\pgfplots@data@scale@trafo@EXPONENT@common
+ \global\let\pgfplots@glob@TMPb=\pgfplots@data@scale@trafo@EXPONENT@common@arg
+ \endgroup
+ %
+ \xdef\pgfplots@glob@TMPc{\expandafter\pgfutil@firstoftwo\pgfplots@glob@TMPa}%
+%\message{using datascaletrafo of axis '\pgfplots@glob@TMPb' for each axis.^^J}%
+ %
+ \def\pgfplots@loc@TMPd##1{%
+ \if ##1\pgfplots@glob@TMPb
+ % we need to set the scaling trafo for the target direction
+ % (was lost after \endgroup)
+ \def\pgfplots@loc@TMPa{\pgfplotscoordmath{##1}{datascaletrafo set params}}%
+ \expandafter\pgfplots@loc@TMPa\pgfplots@glob@TMPa%
+ \else
+ \pgfplotscoordmath{##1}{datascaletrafo set params}{\pgfplots@glob@TMPc}{0}%
+ \pgfplotscoordmath{##1}{datascaletrafo}{\csname pgfplots@##1min\endcsname}%
+%\message{Initialising the data scale transformation in direction ##1 to 10^\pgfplots@glob@TMPc*##1 - \pgfmathresult...^^J}%
+ \pgfplotscoordmath{##1}{datascaletrafo set params}{\pgfplots@glob@TMPc}{\pgfmathresult}%
+ \fi
+ }%
+ \pgfplots@loc@TMPd x%
+ \pgfplots@loc@TMPd y%
+ \ifpgfplots@threedim
+ \pgfplots@loc@TMPd z%
+ \fi
+ }{%
+ % optimize individually:
+ \pgfplots@set@optimal@datatrafo@for@ x%
+ \pgfplots@set@optimal@datatrafo@for@ y%
+ \ifpgfplots@threedim
+ \pgfplots@set@optimal@datatrafo@for@ z%
+ \fi
+ }%
+ %
+}%
+
+% Defines \pgfplotsretval to be one of x, y, or z, such that the
+% return value indicates the axis with largest untransformed axis
+% limits.
+\def\pgfplots@get@axis@with@largest@limits{%
+ \begingroup
+ \let\pgfplotsretval@extreme=\pgfutil@empty
+ \let\pgfplotsretval@extreme@arg=\pgfutil@empty
+ \def\pgfplots@@##1{%
+ % compute axis range for axis ##1 ...
+ \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@##1min\endcsname}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@##1max\endcsname}%
+ \pgfplotscoordmath{default}{op}{subtract}{{\pgfmathresult}{\pgfplots@loc@TMPa}}%
+ % ... ok, it is in \pgfmathresult.
+ \let\candidate=\pgfmathresult
+ \ifx\pgfplotsretval@extreme@arg\pgfutil@empty
+ % ah: no extreme value so far. use ours.
+ \def\pgfplotsretval@extreme@arg{##1}%
+ \let\pgfplotsretval@extreme=\candidate
+ \else
+ \pgfplotscoordmath{default}{if less than}{\pgfplotsretval@extreme}{\candidate}{%
+ % update extreme value:
+ \def\pgfplotsretval@extreme@arg{##1}%
+ \let\pgfplotsretval@extreme=\candidate
+ }{%
+ }%
+ \fi
+ }%
+ \pgfplots@@ x%
+ \pgfplots@@ y%
+ \ifpgfplots@threedim
+ \pgfplots@@ z%
+ \fi
+ \let\pgfplotsretval=\pgfplotsretval@extreme@arg
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% Initialises the data scale transformation and applies it to any
+% user specified options.
+%
+% PRECONDITION:
+% - all axis limits are available in float representation
+% - \pgfplots@set@default@size@options has been called before
+% - the scaling transformation for direction x is set up
+% (\pgfplots@set@optimal@datatrafo@for@),
+% POSTCONDITION:
+% - all axis limits are transformed, but no other axis inputs.
+%
+% Unit vectors and other axis input parameters will be scaled later.
+%
+% @see \pgfplots@check@and@apply@datatrafo@for
+\def\pgfplots@apply@datatrafo@to@axis@limits#1{%
+ \pgfplots@if{pgfplots@apply@datatrafo@#1}{%
+ % Transform axis limits:
+%\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]^^J}%
+ \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1min\endcsname}%
+ \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
+ %
+ \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1max\endcsname}%
+ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult
+%\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]^^J}%
+ }{%
+ % case apply trafo == false:
+ \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfutil@empty
+ \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfutil@empty
+ }%
+}
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
index d230e0d1ed7..a80e77884ce 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex
@@ -64,7 +64,9 @@
\pgf@zy=0pt
}%
%
- %
+ % The \pgfplotsqpointxyz method (or its 2d counterpart) are THE
+ % point method. If you override them, all other coordinate systems
+ % should inherit the changes as well.
\edef\pgfplotsplothandlerpointxyz##1##2##3{%
\ifpgfplots@curplot@threedim
\noexpand\pgfplotsqpointxyz{##1}{##2}{##3}%
@@ -765,33 +767,6 @@
\ifpgfplots@loc@tmp #2\else #3\fi
}%
-% Returns either '' (empty) or '-' (minus) for each of the two variing sides of the
-% oriented surface described by #1.
-%
-% The output value #2 = '' means that the positive b axis points to
-% the direction of the convex hull of the projected figure.
-%
-% The output value #2 = '-' means that the NEGATIVE b axis points to
-% the direction of the convex hull of the projected figure.
-%
-% The output value #3 is also either '' or '-'. It refers to the
-% direction of the 'n' axis of the surface which points to the convex
-% hull of the projected figure.
-%
-% The returned values are used to decide how to align tick labels such
-% that they are always outside of the convex hull of the projected
-% axis.
-%
-% #1: three characters denoting an oriented surface.
-% #2: a macro name. Will be filled either with '' (empty string) or
-% '-', encoding the direction of the 'b' axis of surface #1 which
-% points to the convex hull.
-% #3: a macro name. It takes the same values as '#2', but it refers to
-% the 'n' axis of surface #1.
-\def\pgfplotsgetdirectionstoconvexhullforsurf#1#2#3{%
- \pgfplotsgetdirectionstoconvexhullforsurf@#1\relax{#2}{#3}%
-}
-
% Executes code '#2' if the axis line with 'b=#1' on the current
% oriented surface shall be drawn.
% If that is not the case, the code '#3' will be executed.
@@ -1231,16 +1206,22 @@
\def\pgfplots@loc@naxis{y}%
\fi
\fi
- \if0\pgfplots@loc@char@for@baxis%
+ \ifcase\pgfplots@loc@char@for@baxis\relax%
+ % case 0:
% this means : the '##1' direction of the surface
% orthogonal to the 'v' vector is on the lower axis
% limit. Since I need a vector pointing to the OUTSIDE of
% the axis, I need sign = -1
\def\pgfplots@loc@baxissign{-}%
- \else
+ \or
+ % case 1:
% in this case, the OUTSIDE area requires a plus sign - the b
% axis already points to the inside.
\def\pgfplots@loc@baxissign{+}%
+ \or
+ % case 2: we have the 'axis lines=centered' case.
+ % FIXME :
+ \def\pgfplots@loc@baxissign{+}%
\fi
\pgfplotsmath@ifzero{\csname pgfplots@\pgfplots@loc@baxis @veclength\endcsname}{%
\def\pgfplots@loc@baxissign{0}%
@@ -1250,16 +1231,22 @@
}%
%
% Now the same game for the other axis:
- \if0\pgfplots@loc@char@for@naxis%
+ \ifcase\pgfplots@loc@char@for@naxis\relax
+ % case 0:
% this means : the '##2' direction of the surface
% orthogonal to the 'v' vector is on the lower axis
% limit. Since I need a vector pointing to the OUTSIDE of
% the axis, I need sign = -1
\def\pgfplots@loc@naxissign{-}%
- \else
+ \or
+ % case 1:
% in this case, the OUTSIDE area requires a plus sign - the n
% axis already points to the inside.
\def\pgfplots@loc@naxissign{+}%
+ \or
+ % case 2: centered.
+ % FIXME
+ \def\pgfplots@loc@naxissign{+}%
\fi
\pgfplotsmath@ifzero{\csname pgfplots@\pgfplots@loc@naxis @veclength\endcsname}{%
\def\pgfplots@loc@naxissign{0}%
@@ -1331,6 +1318,7 @@
\pgf@xa=#5pt\relax
\edef\pgfplots@loc@distalong@normal{\pgf@sys@tonumber\pgf@xa}%
%
+%\message{pgfplotspointoutsideofaxis{#1#2#3}{#4}{#5}: A = \pgfplots@loc@A, B = \pgfplots@loc@B.^^J}%
%
\pgf@process{%
\pgfpointadd
@@ -1415,6 +1403,8 @@
\else
\if#21%
\expandafter\let\expandafter\pgfmathresult\csname pgfplots@#1max\endcsname
+ \else
+ \expandafter\let\expandafter\pgfmathresult\csname pgfplots@logical@ZERO@#1\endcsname
\fi
\fi
}%
@@ -1714,171 +1704,11 @@
\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
-% defined by '#1' and '#2'.
-%
-% 'azimuth' means a rotation around the viewport's x axis. 'elongation' means
-% a rotation around the original coordinate system's z axis.
-%
-% The method works by computing
-% Az = [ cos(azimuth) -sin(azimuth) 0; ...
-% sin(azimuth) cos(azimuth) 0; ...
-% 0 0 1 ];
-%
-%
-% Ax = [ 1 0 0; ...
-% 0 cos(elevation) -sin(elevation) ;...
-% 0 sin(elevation) cos(elevation) ];
-%
-% v= Ax * Az;
-% = [ ...
-% cosaz -sinaz cosel sinaz sinel; ...
-% sinaz cosaz cosel -sinel cosaz; ...
-% 0 sinel cosel ];
-%
-% Then, we use the rotated XZ plane as viewport, that means
-% xvec = v * [1 0 0]' = <first column of v>
-% zvec = v * [0 0 1]' = <third column of v>
-% and we define the projection onto the twodimensional surface
-% spanned by 'xvec' and 'zvec' as
-% P( q ) = [ q^T xvec, q^T zvec ]'
-% for q in R^3.
-% As a consequence, we compute the three unit vectors as
-% x = P( [1 0 0] )
-% = [ cosaz, sinaz sinel ]'
-% y = P( [0 1 0] )
-% = [ sinaz, -sinel cosaz ]'
-% z = P( [0 0 1] )
-% = [ 0, cosel]'
-%
-% Furthermore, the 3D view vector which points into the direction of the view
-% is
-% n = v * [0 1 0 ]' = <second column of v> = [-sinaz cosel, cosaz cosel, sinel]'
-% because the normal view point was the XZ plane with y as its normal
-% vector.
-% The 3D vector n is returned by this routine as well - it is
-% necessary for some kind of z buffering (determining what is
-% foreground and what is background).
-%
-% INPUT:
-% - #1 : azimuth ("yaw")
-% - #2 : elevation ("pitch")
-% OUTPUT:
-% - #3 : a macro which will be set to '1' if and only if
-% the viewport is the standard XY axis (i.e. azimuth=0, elevation=90).
-% - [xyz] vectors,
-% \pgfplots@[xyz]@veclength,
-% \pgfplots@[xyz]@inverseveclength
-% are set properly
-% \pgfplots@view@dir@threedim@[xyz] will contain the three components
-% of 'n' (without the suffix 'pt', but in units of 'pt').
-\def\pgfplotssetaxesfromazel#1#2#3{%
- \begingroup
- \pgfmathparse{#1}%
- \let\pgfplots@az=\pgfmathresult
- \pgfmathparse{#2}%
- \edef\pgfplots@el{-\pgfmathresult}%
- \pgfmathsin@{\pgfplots@az}%
- \let\sinaz=\pgfmathresult
- \pgfmathcos@{\pgfplots@az}%
- \let\cosaz=\pgfmathresult
- \pgfmathsin@{\pgfplots@el}%
- \let\sinel=\pgfmathresult
- \pgfmathcos@{\pgfplots@el}%
- \let\cosel=\pgfmathresult
- % x:
- \pgfmathmultiply@{\sinaz}{\sinel}%
- \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpoint{\cosaz pt}{\pgfmathresult pt}}%
- % y:
- \pgfmathmultiply@{-\sinel}{\cosaz}%
- \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpoint{\sinaz pt}{\pgfmathresult pt}}%
- % z:
- \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpoint{0pt}{\cosel pt}}%
- %
- \pgfkeysgetvalue{/pgfplots/x dir/value}\pgfplots@loc@dirvalue@x
- \pgfkeysgetvalue{/pgfplots/y dir/value}\pgfplots@loc@dirvalue@y
- \pgfkeysgetvalue{/pgfplots/z dir/value}\pgfplots@loc@dirvalue@z
- \if r\pgfplots@loc@dirvalue@x
- \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}%
- \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpointscale{-1}{\the\t@pgfplots@toka}}%
- \fi
- \if r\pgfplots@loc@dirvalue@y
- \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPb}%
- \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpointscale{-1}{\the\t@pgfplots@toka}}%
- \fi
- \if r\pgfplots@loc@dirvalue@z
- \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPc}%
- \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpointscale{-1}{\the\t@pgfplots@toka}}%
- \fi
- %
- % Process 'plot box ratio':
- \def\pgfplots@extract@plot@box@ratio##1##2##3##4\pgfplots@EOI{%
- \pgfmathparse{##1}\let\pgfplots@plotboxratio@x=\pgfmathresult
- \pgfmathparse{##2}\let\pgfplots@plotboxratio@y=\pgfmathresult
- \pgfmathparse{##3}\let\pgfplots@plotboxratio@z=\pgfmathresult
- }%
- \def\pgfplots@extract@plot@box@ratio@spaces##1 ##2 ##3 ##4\pgfplots@EOI{%
- \pgfplots@extract@plot@box@ratio{##1}{##2}{##3}{##4}\pgfplots@EOI
- }%
- \pgfkeysgetvalue{/pgfplots/plot box ratio}\pgfplots@loc@TMPa
- % Auto-determine input format which is either '{x}{y}{z}' or 'x y z'
- \def\pgfplots@loc@TMPb{%
- \pgfutil@ifnextchar\bgroup{%
- \pgfplots@loc@tmptrue
- \pgfplots@gobble@until@EOI
- }{%
- \pgfplots@loc@tmpfalse
- \pgfplots@gobble@until@EOI
- }%
- }%
- \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfplots@EOI
- \ifpgfplots@loc@tmp
- % Ah- braces format.
- \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa{1}{1}{1}}%
- \expandafter\pgfplots@extract@plot@box@ratio\pgfplots@loc@TMPa\pgfplots@EOI
- \else
- % Ah- space-separated
- \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa\space 1 1 1}%
- \expandafter\pgfplots@extract@plot@box@ratio@spaces\pgfplots@loc@TMPa\pgfplots@EOI
- \fi
- %
- % process it:
- \ifdim\pgfplots@plotboxratio@x pt=1pt
- \else
- \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}%
- \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpointscale{\pgfplots@plotboxratio@x}{\the\t@pgfplots@toka}}%
- \fi
- \ifdim\pgfplots@plotboxratio@y pt=1pt
- \else
- \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPb}%
- \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpointscale{\pgfplots@plotboxratio@y}{\the\t@pgfplots@toka}}%
- \fi
- \ifdim\pgfplots@plotboxratio@z pt=1pt
- \else
- \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPc}%
- \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpointscale{\pgfplots@plotboxratio@z}{\the\t@pgfplots@toka}}%
- \fi
- %
- % n (3D!)
- \pgfmathmultiply@{-\sinaz}{\cosel}%
- \let\pgfmathresultNx=\pgfmathresult
- \pgfmathmultiply@{\cosaz}{\cosel}%
- \xdef\pgfplots@glob@TMPd{{\pgfmathresultNx}{\pgfmathresult}{\sinel}}%
- \endgroup
-%\message{Setting x,y and z from {#1}{#2} to^^J x = \meaning\pgfplots@glob@TMPa,^^J y = \meaning\pgfplots@glob@TMPb,^^J z = \meaning\pgfplots@glob@TMPc,^^J n = \pgfplots@glob@TMPd.^^J}%
- \pgfsetxvec{\pgfplots@glob@TMPa}%
- \pgfsetyvec{\pgfplots@glob@TMPb}%
- \pgfsetzvec{\pgfplots@glob@TMPc}%
- \def\pgfplots@loc@TMPa##1##2##3{%
- \def\pgfplots@view@dir@threedim@x{##1}%
- \def\pgfplots@view@dir@threedim@y{##2}%
- \def\pgfplots@view@dir@threedim@z{##3}%
- }%
- \expandafter\pgfplots@loc@TMPa\pgfplots@glob@TMPd\relax
- \def#3{0}%
- \pgfplots@scale@plotbox@to@widthheight
+
+\def\pgfplotspointviewdir{%
+ %\pgfplotsmathvectordatascaletrafoinverse{\pgfplots@view@dir@threedim}{default}%
+ \let\pgfplotsretval=\pgfplots@view@dir@threedim
+ \pgfplotspointfromcsvvector{\pgfplotsretval}{default}%
}%
\def\message@pgfplots@units{%
@@ -1889,542 +1719,21 @@
\fi
\pgfmathparse{veclen(\pgf@xx,\pgf@xy)/\Z}\let\X=\pgfmathresult
\pgfmathparse{veclen(\pgf@yx,\pgf@yy)/\Z}\let\Y=\pgfmathresult
+ \expandafter\ifx\csname pgfplots@view@dir@threedim\endcsname\relax
+ \def\normal{view = (---),^^J}%
+ \else
+ \pgfplotsmathvectortostring{\pgfplots@view@dir@threedim}{default}%
+ \edef\normal{view = (\pgfplotsretval),^^J}%
+ \fi
\message{^^J
x = (\the\pgf@xx,\the\pgf@xy),^^J
y =(\the\pgf@yx,\the\pgf@yy),^^J
z = (\the\pgf@zx,\the\pgf@zy),^^J
- \expandafter\ifx\csname pgfplots@view@dir@threedim@x\endcsname\relax
- \else
- n = (\pgfplots@view@dir@threedim@x,\pgfplots@view@dir@threedim@y,\pgfplots@view@dir@threedim@z),^^J
- \fi
+ \normal
unit vector ratio=[\X\space\Y\space 1],^^J}%
\endgroup
}%
-% Takes the current plot box, defined by the actual PGF x,y and z unit
-% vectors, and re-scales it such that it fits into the
-% width and height of the axis (as they have been provided by the
-% user).
-%
-% @see \pgfplots@scale@axisbox@to@widthheight
-% @see\pgfplots@scaleaxes@to@BB
-\def\pgfplots@scale@plotbox@to@widthheight{%
- \pgfplots@initsizes@get@width@withoutlabels
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \pgfplots@initsizes@get@height@withoutlabels
- \edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}{\pgfmathresult}}%
- \let\pgfplots@BB@for@plotbox=\pgfplots@BB@for@plotbox@relative
- \let\pgfplots@BB@for@plotbox@compute@post@scales=\pgfplots@BB@for@plotbox@compute@post@scales@relative
- \expandafter\pgfplots@scaleaxes@to@BB\pgfplots@loc@TMPa
-}
-
-
-% A variant of \pgfplots@scale@plotbox@to@widthheight which does not
-% use the given x,y,z vectors to define the plot box. Instead, it uses
-% the lower and upper axis limits.
-\def\pgfplots@scale@axisbox@to@widthheight{%
- \pgfplots@initsizes@get@width@withoutlabels
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \pgfplots@initsizes@get@height@withoutlabels
- \edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}{\pgfmathresult}}%
- \let\pgfplots@BB@for@plotbox=\pgfplots@BB@for@plotbox@computelimits
- \let\pgfplots@BB@for@plotbox@compute@post@scales=\pgfplots@BB@for@plotbox@compute@post@scales@NOP
- \expandafter\pgfplots@scaleaxes@to@BB\pgfplots@loc@TMPa
-}
-
-
-% Takes the current PGF x,y and z unit vectors and scales them such
-% that the bounding box of the final image has width #1 and height #2.
-%
-% The relative length of the input vectors is important for the 3D case: it
-% will be scaled as-is.
-%
-% PRECONDITION
-% - the x, y and z unit vectors have been set to the proper
-% DIRECTIONS. Their relative vector lengths are set-up properly
-% (i.e. y is twice as large as x and half as large as z or so).
-% - \pgfplots@[xyz]@veclength and
-% \pgfplots@[xyz]@inverseveclength
-% are set correctly.
-% - the \ifpgfplots@threedim boolean is set.
-% - the data limits have been initialised and transformed according
-% to the data transformation.
-%
-% POSTCONDITION
-% - the unit vectors have been re-scaled such that the final plot
-% has the desired dimensions.
-% - the @veclength and @inverseveclength have been re-scaled as
-% well.
-\def\pgfplots@scaleaxes@to@BB#1#2{%
-%\message{before scaling:}\message@pgfplots@units
- \if0\pgfplots@scale@mode@choice
- % scale mode=auto
- \def\pgfplots@scale@mode@choice{2}% stretch to fill
- \fi
- \if1\pgfplots@scale@mode@choice
- % scale mode=none
- \else
- \pgfplots@scaleaxes@to@BB@{#1}{#2}%
- \fi
- % FIXME
- % I suppose I should call \pgfplotsgetnormalforcurrentview now?
- \pgfplots@computeunitvectorlengths
-%\message{after scaling:}\message@pgfplots@units
-}%
-\def\pgfplots@BB@for@plotbox@relative{%
- % We just need the
- % relative sizes, i.e.
- % "0" == lower axis limit
- % "1" == upper axis limit
- %
- \ifpgfplots@threedim
- \pgfpathmoveto{\pgfqpointxyz000}%
- \pgfpathmoveto{\pgfqpointxyz001}%
- \pgfpathmoveto{\pgfqpointxyz010}%
- \pgfpathmoveto{\pgfqpointxyz011}%
- \pgfpathmoveto{\pgfqpointxyz100}%
- \pgfpathmoveto{\pgfqpointxyz101}%
- \pgfpathmoveto{\pgfqpointxyz110}%
- \pgfpathmoveto{\pgfqpointxyz111}%
- \else
- \pgfpathmoveto{\pgfqpointxy00}%
- \pgfpathmoveto{\pgfqpointxy01}%
- \pgfpathmoveto{\pgfqpointxy10}%
- \pgfpathmoveto{\pgfqpointxy11}%
- \fi
-}%
-\let\pgfplots@BB@for@plotbox=\pgfplots@BB@for@plotbox@relative
-\def\pgfplots@BB@for@plotbox@compute@post@scales@relative#1#2#3{%
- % Consequently, we have to multiply with 1/(max-min):
- \pgfmathsubtract@{\pgfplots@xmax}{\pgfplots@xmin}%
- % compute 1/(xmax - xmin) in float for more recent versions (see /pgfplots/compat/scaling).
- % I observed that it is much more accurate
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{\pgfmathresult}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{op}{reciprocal}{{\pgfmathresult}}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{tofixed}{\pgfmathresult}%
- \let#1=\pgfmathresult
- %
- \pgfmathsubtract@{\pgfplots@ymax}{\pgfplots@ymin}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{\pgfmathresult}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{op}{reciprocal}{{\pgfmathresult}}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{tofixed}{\pgfmathresult}%
- \let#2=\pgfmathresult
- %
- \ifpgfplots@threedim
- \pgfmathsubtract@{\pgfplots@zmax}{\pgfplots@zmin}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{\pgfmathresult}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{op}{reciprocal}{{\pgfmathresult}}%
- \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{tofixed}{\pgfmathresult}%
- \else
- \def\pgfmathresult{1}%
- \fi
- \let#3=\pgfmathresult
-}%
-\let\pgfplots@BB@for@plotbox@compute@post@scales=\pgfplots@BB@for@plotbox@compute@post@scales@relative
-\def\pgfplots@BB@for@plotbox@computelimits{%
- \ifpgfplots@threedim
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmin\pgfplots@ymin\pgfplots@zmin}%
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmin\pgfplots@ymin\pgfplots@zmax}%
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmin\pgfplots@ymax\pgfplots@zmin}%
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmin\pgfplots@ymax\pgfplots@zmax}%
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmax\pgfplots@ymin\pgfplots@zmin}%
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmax\pgfplots@ymin\pgfplots@zmax}%
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmax\pgfplots@ymax\pgfplots@zmin}%
- \pgfpathmoveto{\pgfqpointxyz\pgfplots@xmax\pgfplots@ymax\pgfplots@zmax}%
- \else
- \pgfpathmoveto{\pgfqpointxy\pgfplots@xmin\pgfplots@ymin}%
- \pgfpathmoveto{\pgfqpointxy\pgfplots@xmin\pgfplots@ymax}%
- \pgfpathmoveto{\pgfqpointxy\pgfplots@xmax\pgfplots@ymin}%
- \pgfpathmoveto{\pgfqpointxy\pgfplots@xmax\pgfplots@ymax}%
- \fi
-}%
-\def\pgfplots@BB@for@plotbox@compute@post@scales@NOP#1#2#3{%
- \let#1=\pgfutil@empty
- \let#2=\pgfutil@empty
- \let#3=\pgfutil@empty
-}%
-\def\pgfplots@scaleaxes@to@BB@#1#2{%
- \begingroup
- \pgfinterruptboundingbox
- % STEP 1: compute the bounding box for the plot box.
- \pgfplots@BB@for@plotbox
- %
- % TMPa = width
- \pgf@xa=\pgf@pathmaxx
- \advance\pgf@xa by-\pgf@pathminx
- % TMPb = height
- \pgf@xb=\pgf@pathmaxy
- \advance\pgf@xb by-\pgf@pathminy
- \pgf@ya=#1\relax
- \pgf@yb=#2\relax
-%\message{PGFPLOTS: the current unit vectors result in a UNIT BB of (\the\pgf@xa,\the\pgf@xb). Scaling it to (\the\pgf@ya,\the\pgf@yb)...}%
- \ifcase\pgfplots@scale@mode@choice
- % scale mode=auto does not happen here
- \or
- % scale mode=none does not happen here
- \or
- % scale mode=stretch to fill
- % Compute individual scaling factors for X and Y
- % such that the UNIT-BB will have size #1,#2:
- \pgfplotsutil@edef@invoke\pgfmathdivide@{%
- {\pgf@sys@tonumber\pgf@ya}%
- {\pgf@sys@tonumber\pgf@xa}%
- }%
- % TMPa = scalex
- \global\let\pgfplots@glob@TMPa=\pgfmathresult
- \pgfplotsutil@edef@invoke\pgfmathdivide@{%
- {\pgf@sys@tonumber\pgf@yb}%
- {\pgf@sys@tonumber\pgf@xb}%
- }%
- % TMPb = scaley
- \global\let\pgfplots@glob@TMPb=\pgfmathresult
- \global\let\pgfplots@glob@TMPc=\relax
- \or
- % scale mode=scale uniformly
- % compute ONE common scale for both, X and Y.
- %
- \pgfplotsutil@edef@invoke\pgfmathdivide@{%
- {\pgf@sys@tonumber\pgf@ya}%
- {\pgf@sys@tonumber\pgf@xa}%
- }%
- \global\let\pgfplots@glob@TMPa=\pgfmathresult
- \global\let\pgfplots@glob@TMPb=\pgfplots@glob@TMPa
- \global\let\pgfplots@glob@TMPc=\relax
- \ifdim\pgf@zy=0pt
- \ifdim\pgf@yx=0pt
- \pgfplots@prepare@vertical@rescaling@for@scale@uniformly@in@dir{y}\returninto\pgfplots@glob@TMPc
- \else
- \pgfplots@error@scale@uniformly@failed
- \fi
- \else
- \ifdim\pgf@zx=0pt
- \pgfplots@prepare@vertical@rescaling@for@scale@uniformly@in@dir{z}\returninto\pgfplots@glob@TMPc
- \else
- \pgfplots@error@scale@uniformly@failed
- \fi
- \fi
- \fi
- \pgfusepath{discard}%
- \endpgfinterruptboundingbox
- \endgroup
- % Ok, we know the W,H scalings now.
- %
- % But remember that we have worked with RELATIVE scales up to now.
- % We have to convert them now, by interpreting "1 == upper limit"
- % and "0 == lower limit" for every direction.
- %
- \pgfplots@BB@for@plotbox@compute@post@scales{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}%
- %
- % ok. Now apply all scalings.
- % Let's hope all these temporary macros are still valid!
-%\message{got scaleW = \pgfplots@glob@TMPa\space and scaleH = \pgfplots@glob@TMPb; scalex=\pgfplots@loc@TMPa, scaley=\pgfplots@loc@TMPb, scalez=\pgfplots@loc@TMPc.}%
- \pgf@xx=\pgfplots@glob@TMPa\pgf@xx
- \pgf@xy=\pgfplots@glob@TMPb\pgf@xy
- \pgf@xx=\pgfplots@loc@TMPa\pgf@xx
- \pgf@xy=\pgfplots@loc@TMPa\pgf@xy
- %
- \pgf@yx=\pgfplots@glob@TMPa\pgf@yx
- \pgf@yy=\pgfplots@glob@TMPb\pgf@yy
- \pgf@yx=\pgfplots@loc@TMPb\pgf@yx
- \pgf@yy=\pgfplots@loc@TMPb\pgf@yy
- %
- \ifpgfplots@threedim
- \pgf@zx=\pgfplots@glob@TMPa\pgf@zx
- \pgf@zy=\pgfplots@glob@TMPb\pgf@zy
- \pgf@zx=\pgfplots@loc@TMPc\pgf@zx
- \pgf@zy=\pgfplots@loc@TMPc\pgf@zy
- \fi
- \pgfplots@glob@TMPc
-}%
-
-\def\pgfplots@error@scale@uniformly@failed{%
- \pgfplots@error{Sorry, 'scale uniformly' failed because its actual implementation works only if y_x = 0 (for 2d axes) or if z_x = 0 (for 3d axes). The result will not fill the prescribed dimensions. For 2d axes, you may also want to consider the 'unit vector ratio' key}%
-}%
-\def\pgfplots@prepare@vertical@rescaling@for@scale@uniformly@in@dir#1\returninto#2{%
- % The strategy is as follows:
- % 1. I want to fit the axis into width #1 (\pgf@ya) and
- % height #1 (\pgf@yb).
- % 2. I want to MAINTAIN the unit vector ratio.
- % 3. I want to MAINTAIN the unit vector directions.
- %
- % I already know the scaling factor to fit the width (it
- % is stored in \pgfplots@glob@TMPa = \pgfplots@glob@TMPb).
- % Let's call it "s".
- %
- % Consequently, a uniform scaling by "s" leads the image
- % height
- % h = s* (r_x * e_xy + r_y * e_yy + r_z * e_zy)
- % where r_i = (imax - imin). This here is essentially the
- % same as the bounding box computation above (at least for
- % standart orthographic 3D axes).
- %
- % What I want now is to enlarge the limits such that I
- % have BOTH, width #1 AND height #2, without obscuring the
- % unit vector ratio. Recall that width #1 is already
- % given.
- %
- % In my opinion the ONLY way to achieve this goal is to
- % modify axis limits for an axis whose unit vector is
- % parallel to the canvas y axis, i.e. e_i = (0,*). To see
- % this, remember that a rescaling of the other limits will
- % also modify the width.
- %
- % That means I have to introduce a SECOND scale s_z which
- % applies only to the Z unit vector (since e_z = (0,*) ).
- % If H = #2 is the desired height, I find the target
- % equation for s_z,
- %
- % H = s* r_x e_xy + s * r_y e_yy + s_z * s * r_z * e_zy
- % =>
- % s_z = ( H- s*r_x e_xy - s*r_y e_yy) / ( s * r_z * e_zy).
- %
- % Remember that
- % s = \pgfplots@glob@TMPa
- % and
- % \pgfplots@glob@TMPa * \pgf@xb = s*h
- %
- \pgf@xc=\csname pgfplots@#1max\endcsname\csname pgf@#1y\endcsname% FIXME : what if we are working with relative coords?
- \advance\pgf@xc by -\csname pgfplots@#1min\endcsname\csname pgf@#1y\endcsname
- %
- \advance\pgf@xb by-\pgf@xc
- \pgf@xb=\pgfplots@glob@TMPa\pgf@xb
- \advance\pgf@yb by-\pgf@xb
- \pgf@xb=\pgfplots@glob@TMPa\pgf@xc
- \pgfplotsutil@edef@invoke\pgfmathdivide@{%
- {\pgf@sys@tonumber\pgf@yb}%
- {\pgf@sys@tonumber\pgf@xb}%
- }%
- % Now, s_z = \pgfmathresult .
- %
- % Now, adjust the z limits.
- % Note that \pgfplots@apply@unit@vector@rescale@keep@size
- % has a slightly different context; it assumes that the
- % unit vector has been rescaled, not the axis limits.
- % Consequently, the inverse of the scaling factor enters.
- % Since \pgfplots@apply@unit@vector@rescale@keep@size
- % expects the inverse of the scale, we can provide
- % \pgfmathresult:
- \xdef#2{%
- \noexpand\pgfplots@apply@unit@vector@rescale@keep@size{#1}{\pgfmathresult}%
- }%
-}
-
-\def\pgfplots@computeunitvectorlengths{%
- \pgfplotsutil@edef@invoke\pgfmathveclen@{%
- {\pgf@sys@tonumber\pgf@xx}%
- {\pgf@sys@tonumber\pgf@xy}%
- }%
- \let\pgfplots@x@veclength=\pgfmathresult
- \pgfplotsmath@ifzero{\pgfplots@x@veclength}{%
- \def\pgfmathresult{infty}%
- % this case will be caught in \pgfplots@initsizes
- }{%
- \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
- }%
- \let\pgfplots@x@inverseveclength=\pgfmathresult
- %
- \pgfplotsutil@edef@invoke\pgfmathveclen@{%
- {\pgf@sys@tonumber\pgf@yx}%
- {\pgf@sys@tonumber\pgf@yy}%
- }%
- \let\pgfplots@y@veclength=\pgfmathresult
- \pgfplotsmath@ifzero{\pgfplots@y@veclength}{%
- \def\pgfmathresult{infty}%
- % this case will be caught in \pgfplots@initsizes
- }{%
- \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
- }%
- \let\pgfplots@y@inverseveclength=\pgfmathresult
- %
- \ifpgfplots@threedim
- \pgfplotsutil@edef@invoke\pgfmathveclen@{%
- {\pgf@sys@tonumber\pgf@zx}%
- {\pgf@sys@tonumber\pgf@zy}%
- }%
- \let\pgfplots@z@veclength=\pgfmathresult
- \pgfplotsmath@ifzero{\pgfplots@z@veclength}{%
- \def\pgfmathresult{infty}%
- % this case will be caught in \pgfplots@initsizes
- }{%
- \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}%
- }%
- \let\pgfplots@z@inverseveclength=\pgfmathresult
- \fi
-}%
-
-% Defines \pgfplots@view@dir@threedim@[xyz] according to the actual
-% configuration of x,y,z (2d) unit vectors, assuming the associated
-% unit vectors form a right-handed-system.
-%
-% The algorithm works for standard three dimensional axes. It works as
-% follows:
-%
-% First, observe that we have a normal direction N if all its
-% multiples are on the mapped onto the same point in 2D canvas
-% coordinates. In other words: all 3D coordinates which are mapped
-% onto an arbitrary point in 2D canvas coordinates (take, for example,
-% the origin (0,0) ) are on a line in direction of N.
-%
-% We use this observation to compute the normal axis, i.e. we search
-% for all points which are mapped onto the 2D canvas coordinate (0,0):
-% N_x e_xx + N_y e_yx + N_z e_zx = 0
-% N_x e_xy + N_y e_yy + N_z e_zy = 0.
-% All solutions make up a linear space of dimension 1 (up to special
-% cases). In the general case, we can chose an arbitrary N_z != 0
-% and reduce the linear system to
-% N_x e_xx + N_y e_yx = - N_z e_zx
-% N_x e_xy + N_y e_yy = - N_z e_zy.
-% Choosing *any* N_z != 0, say, N_z=-1 (which corresponds to view
-% from above) will lead to a vector parallel to the normal direction.
-% But it might have the wrong sign.
-%
-% To find the correct sign for N, I have made several case
-% distinctions to identify the cases when we have to multiply with -1.
-% The key idea is to assume a right-handed-system of unit vectors;
-% this is the condition which allows to determine the sign.
-%
-% Furthermore, I assume that e_z points to the top, i.e. that e_zy >0.
-% Then, there are (mainly) four conditions on the signs of e_x and e_y
-% which indicate that we are viewing from below and should switch the
-% sign of N (keep in mind that our initial choice was N_z =-1, see above).
-%
-% The conditions can be identified by drawing a 3D box and
-% identifying the corner which represents the lower left 3D limits.
-%
-% You can visualize these cases using
-%--------------------------------------------------
-% \pgfplotsset{
-% separate axis lines,
-% every outer x axis line/.append style= {-stealth},
-% every outer y axis line/.append style= {-stealth},
-% every outer z axis line/.append style= {-stealth},
-% samples=2,shader=interp,title={view=\h,\v},
-% domain=0:1,
-% enlargelimits=false,
-% view=\h\v,xlabel=x,ylabel=y,
-% extra description/.code={%
-% \node[draw,fill=white] at (axis cs:0,0,0) {};
-% },
-% }
-%
-% \def\v{30}
-% \foreach \h in {30,120,210,300} {
-% \message{VIEW={\h}{\v}^^J}
-% \begin{tikzpicture}
-% \begin{axis}
-% \addplot3[surf] {x};
-% \end{axis}
-% \end{tikzpicture}
-%
-% }
-%
-% \def\v{-30}
-% \foreach \h in {30,120,210,300} {
-% \message{VIEW={\h}{\v}^^J}
-% \begin{tikzpicture}
-% \begin{axis}
-% \addplot3[surf] {x};
-% \end{axis}
-% \end{tikzpicture}
-%
-% }
-%--------------------------------------------------
-% The precise formulas can be found below in the source code.
-%
-% You can override this function by the /pgfplots/view dir key.
-\def\pgfplotsgetnormalforcurrentview{%
- \pgfkeysgetvalue{/pgfplots/view dir}\pgfplots@loc@TMPc
- \ifx\pgfplots@loc@TMPc\pgfutil@empty
- \begingroup
- \xdef\pgfplots@view@dir@threedim@z{-1}% hold it at some arbitrary value
- \pgf@xa=-\pgfplots@view@dir@threedim@z\pgf@zx
- \pgf@ya=-\pgfplots@view@dir@threedim@z\pgf@zy
- \edef\pgfplots@loc@TMPa{%
- {%
- {\pgf@sys@tonumber\pgf@xx}{\pgf@sys@tonumber\pgf@yx}%
- {\pgf@sys@tonumber\pgf@xy}{\pgf@sys@tonumber\pgf@yy}%
- }%
- {%
- {\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@ya}%
- }%
- }%
- \expandafter\pgfutilsolvetwotwoleq\pgfplots@loc@TMPa
- \def\pgfplots@loc@TMPb##1##2{%
- \xdef\pgfplots@view@dir@threedim@x{##1}%
- \xdef\pgfplots@view@dir@threedim@y{##2}%
- }%
- \expandafter\pgfplots@loc@TMPb\pgfmathresult
- %
- % Identify if we need to switch the sign.
- % To verify that these cases are useful, I suggest visualizing
- % that stuff using the TeX code from above...
- %
- % I guess it is correct up to collapsing views (as you see, I
- % did not properly identify the cases with "=0" )
- \def\pgfplots@scale{1}%
- \ifdim\pgf@xx>0pt
- \ifdim\pgf@yx>0pt
- %
- \ifdim\pgf@xy>0pt
- \ifdim\pgf@yy<0pt
- \def\pgfplots@scale{-1}%
- \fi
- \fi
- %
- \fi
- \else
- \ifdim\pgf@xx<0pt
- \ifdim\pgf@yx<0pt
- %
- \ifdim\pgf@xy<0pt
- \ifdim\pgf@yy>0pt
- \def\pgfplots@scale{-1}%
- \fi
- \fi
- %
- \fi
- \fi
- \fi
- \ifdim\pgf@xy>0pt
- \ifdim\pgf@yy>0pt
- %
- \ifdim\pgf@xx<0pt
- \ifdim\pgf@yx>0pt
- \def\pgfplots@scale{-1}%
- \fi
- \fi
- %
- \fi
- \else
- \ifdim\pgf@xy<0pt
- \ifdim\pgf@yy<0pt
- %
- \ifdim\pgf@xx>0pt
- \ifdim\pgf@yx<0pt
- \def\pgfplots@scale{-1}%
- \fi
- \fi
- %
- \fi
- \fi
- \fi
- \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@x}%
- \global\let\pgfplots@view@dir@threedim@x\pgfmathresult
- \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@y}%
- \global\let\pgfplots@view@dir@threedim@y\pgfmathresult
- \pgfmathmultiply@{\pgfplots@scale}{\pgfplots@view@dir@threedim@z}%
- \global\let\pgfplots@view@dir@threedim@z\pgfmathresult
- \endgroup
- \else
- \def\pgfplots@loc@TMPb##1##2##3{%
- \xdef\pgfplots@view@dir@threedim@x{##1}%
- \xdef\pgfplots@view@dir@threedim@y{##2}%
- \xdef\pgfplots@view@dir@threedim@z{##3}%
- }%
- \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPc
- \fi
-%\message{\string\pgfplotsgetnormalforcurrentview: got (\pgfplots@view@dir@threedim@x,\pgfplots@view@dir@threedim@y,\pgfplots@view@dir@threedim@z)^^J}%
-}%
% ==================================================================================
%
@@ -2513,7 +1822,7 @@
if is bounded=\edef\pgfplotsretval{##1}\ifx\pgfplotsretval\pgfutil@empty ##3\else ##2\fi,
suffix= #1,%
datascaletrafo set params=,
- datascaletrafo get params= \def\pgfmathresult{{}{}},
+ datascaletrafo get params= \def\pgfmathresult{{0}{0}},
datascaletrafo= \edef\pgfmathresult{##1},
datascaletrafo inverse= \edef\pgfmathresult{##1},
datascaletrafo noshift inverse= \edef\pgfmathresult{##1},
@@ -2680,8 +1989,10 @@
#1\relax\pgfplotscoordmathnotifydatascalesetfor{\pgfplotscoordmathid}%
}},%
%
- % Defines \pgfmathresult to contain the two parameters required
- % for 'datascaletrafo set params'.
+ % Defines \pgfmathresult to contain the two parameters in the form
+ % {#1}{#2} required for 'datascaletrafo set params':
+ % #1: the EXPONENT (as integer)
+ % #2: the SHIFT (as fixed point number)
datascaletrafo get params/.code=
{\expandafter\def\csname pgfpmth\pgfplotsdeclarecoordmath@ datascaletrafo get params\endcsname{#1}},%
datascaletrafo/.code=
@@ -2738,6 +2049,7 @@
\pgfplotscoordmath{\pgfplotscoordmathid}{op}{reciprocal}{{\pgfmathresult}}%
\let\pgfplots@loc@TMPb=\pgfmathresult% TMPb = 1/log_e(#2)
%
+ % log_a(x) = log_e(x) / log_e(a)
\expandafter\edef\csname pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @log\endcsname##1{%
\noexpand\pgfplotscoordmath{\pgfplotscoordmathid}{log e}{##1}%
\noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty
@@ -2748,6 +2060,8 @@
}%
\noexpand\fi
}%
+ %
+ % a^x = exp(log_e(a^x)) = exp(x*log_e(a))
\expandafter\edef\csname pgfpmth\pgfplotsdeclarecoordmath@ @\pgfplotscoordmathid @exp\endcsname##1{%
\noexpand\edef\noexpand\pgfmathresult{##1}%
\noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty
@@ -2859,7 +2173,15 @@
\pgfplotsdeclarecoordmath{pgfbasic}{%
- parsenumber=\pgfmathfloatparsenumber{#1}\pgfmathfloattofixed\pgfmathresult,
+ parsenumber={%
+ \pgfmathfloatparsenumber{#1}%
+ \expandafter\pgfmathfloatgetflagstomacro\expandafter{\pgfmathresult}\pgfplotsretval
+ \ifnum\pgfplotsretval>2
+ \let\pgfmathresult=\pgfutil@empty
+ \else
+ \pgfmathfloattofixed\pgfmathresult
+ \fi
+ },
suffix=@basic@,
zero=\def\pgfmathresult{0},
one=\def\pgfmathresult{1},
@@ -3998,7 +3320,10 @@
\noexpand\pgfkeyssetvalue{/pgfplots/y coord sorting}{\pgfkeysvalueof{/pgfplots/y coord sorting}}%
%
\noexpand\pgfplots@initzerolevelhandler
- \noexpand\pgfplots@define@currentplotstyle@as{\the\t@pgfplots@toka}% remember 'current plot style'
+ % remember 'current plot style':
+ \noexpand\pgfplots@define@currentplotstyle@as{%
+ \the\t@pgfplots@toka
+ }%
% per-point meta data ranges which apply only to
% this plot:
\noexpand\xdef\noexpand\pgfplots@metamin{\pgfplots@metamin}%
@@ -4007,6 +3332,7 @@
\noexpand\def\noexpand\pgfplots@serialized@state@plothandler{\the\t@pgfplots@tokb}%
\noexpand\def\noexpand\pgfplotsaxisfilteredcoordsaway{\pgfplotsaxisfilteredcoordsaway}%
\noexpand\def\noexpand\pgfplotsaxisplothasjumps{\pgfplotsaxisplothasjumps}%
+ \noexpand\pgfkeyssetvalue{/pgfplots/on layer}{\pgfkeysvalueof{/pgfplots/on layer}}%
}%
{% draw command:
\noexpand\path%
@@ -4471,7 +3797,7 @@
\fi
\fi
\begingroup
- % no, assemble the macro which will invoke
+ % now, assemble the macro which will invoke
% \pgfplots@streamerrorbarcoords:
\let\E=\noexpand
\expandafter\xdef\csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname{%
@@ -4545,21 +3871,25 @@
\ifx\pgfplots@error@coord\pgfutil@empty
\else
\pgfplotscoordmath{#1}{parsenumber}{\pgfplots@error@coord}%
- \let\pgfplots@error@coord=\pgfmathresult
- % remember result here - will be used in case
- % of '+' AND '-' error bars:
- \expandafter\let\csname pgfplots@current@point@#1@error\endcsname=\pgfmathresult
- \if +##1%
- \def\pgfplots@loc@TMPb{add}%
- \else
- \def\pgfplots@loc@TMPb{subtract}%
- \fi
- \pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
- {\csname pgfplots@current@point@#1\endcsname}%
- {\pgfplots@error@coord}%
+ \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
+ \let\pgfplots@error@coord=\pgfmathresult
+ % remember result here - will be used in case
+ % of '+' AND '-' error bars:
+ \expandafter\let\csname pgfplots@current@point@#1@error\endcsname=\pgfmathresult
+ \if +##1%
+ \def\pgfplots@loc@TMPb{add}%
+ \else
+ \def\pgfplots@loc@TMPb{subtract}%
+ \fi
+ \pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
+ {\csname pgfplots@current@point@#1\endcsname}%
+ {\pgfplots@error@coord}%
+ }%
+ \let\pgfplots@error@coord=\pgfmathresult
+ \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
+ }{%
+ % input is unbounded. Skip it.
}%
- \let\pgfplots@error@coord=\pgfmathresult
- \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
\fi
}%
\or% explicit relative:
@@ -4567,14 +3897,30 @@
\edef\pgfplots@error@coord{\csname pgfplots@current@point@#1@error\endcsname}%
\ifx\pgfplots@error@coord\pgfutil@empty
\else
- \pgfmathparse{1##1\pgfplots@error@coord}%
- \let\pgfplots@error@coord=\pgfmathresult
- \pgfplotscoordmath{#1}{multiply}{%
- {\csname pgfplots@current@point@#1\endcsname}
- {\pgfplots@error@coord}%
+ \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@error@coord}%
+ \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
+ \let\pgfplots@error@coord=\pgfmathresult
+ % compute ' 1 + value' or '1-value':
+ \pgfplotscoordmath{#1}{one}%
+ \if +##1%
+ \def\pgfplots@loc@TMPb{add}%
+ \else
+ \def\pgfplots@loc@TMPb{subtract}%
+ \fi
+ \pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
+ {\pgfmathresult}%
+ {\pgfplots@error@coord}%
+ }%
+ \let\pgfplots@error@coord=\pgfmathresult
+ \pgfplotscoordmath{#1}{multiply}{%
+ {\csname pgfplots@current@point@#1\endcsname}
+ {\pgfplots@error@coord}%
+ }%
+ \let\pgfplots@error@coord=\pgfmathresult
+ \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
+ }{%
+ % input is unbounded. Skip it.
}%
- \let\pgfplots@error@coord=\pgfmathresult
- \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
\fi
}%
\fi
@@ -4662,25 +4008,29 @@
\ifx\pgfplots@error@coord\pgfutil@empty
\else
\pgfplotscoordmath{default}{parsenumber}{\pgfplots@error@coord}%
- \let\pgfplots@error@coord=\pgfmathresult
- % remember result here - will be used in case
- % of '+' AND '-' error bars:
- \expandafter\let\csname pgfplots@current@point@#1@error\endcsname=\pgfmathresult
- \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@current@point@#1@unfiltered\endcsname}%
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \if +##1%
- \def\pgfplots@loc@op{add}%
- \else
- \def\pgfplots@loc@op{subtract}%
- \fi
- \pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
- {\pgfplots@loc@TMPa}%
- {\pgfplots@error@coord}%
+ \pgfplotscoordmath{default}{if is bounded}{\pgfmathresult}{%
+ \let\pgfplots@error@coord=\pgfmathresult
+ % remember result here - will be used in case
+ % of '+' AND '-' error bars:
+ \expandafter\let\csname pgfplots@current@point@#1@error\endcsname=\pgfmathresult
+ \pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@current@point@#1@unfiltered\endcsname}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \if +##1%
+ \def\pgfplots@loc@op{add}%
+ \else
+ \def\pgfplots@loc@op{subtract}%
+ \fi
+ \pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
+ {\pgfplots@loc@TMPa}%
+ {\pgfplots@error@coord}%
+ }%
+ \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
+ \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
+ \let\pgfplots@error@coord=\pgfmathresult
+ \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
+ }{%
+ % input is unbounded. Skip it.
}%
- \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
- \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
- \let\pgfplots@error@coord=\pgfmathresult
- \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
\fi
}%
%
@@ -4691,34 +4041,38 @@
\ifx\pgfplots@error@coord\pgfutil@empty
\else
\pgfplotscoordmath{default}{parsenumber}{\pgfplots@error@coord}%
- \let\pgfplots@error@coord=\pgfmathresult
- % remember result here - will be used in case
- % of '+' AND '-' error bars:
- \expandafter\let\csname pgfplots@current@point@#1@error\endcsname=\pgfmathresult
- %
- \pgfplotscoordmath{default}{one}%
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \if +##1%
- \def\pgfplots@loc@op{add}%
- \else
- \def\pgfplots@loc@op{subtract}%
- \fi
- \pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
- {\pgfplots@loc@TMPa}%
- {\pgfplots@error@coord}%
- }%
- \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
- \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
- \let\pgfplots@error@coord=\pgfmathresult
- \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
- \pgfplotscoordmath{#1}{op}{add}{%
- {\csname pgfplots@current@point@#1\endcsname}
+ \pgfplotscoordmath{default}{if is bounded}{\pgfmathresult}{%
+ \let\pgfplots@error@coord=\pgfmathresult
+ % remember result here - will be used in case
+ % of '+' AND '-' error bars:
+ \expandafter\let\csname pgfplots@current@point@#1@error\endcsname=\pgfmathresult
+ %
+ \pgfplotscoordmath{default}{one}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \if +##1%
+ \def\pgfplots@loc@op{add}%
+ \else
+ \def\pgfplots@loc@op{subtract}%
+ \fi
+ \pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
+ {\pgfplots@loc@TMPa}%
{\pgfplots@error@coord}%
}%
+ \pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
+ \pgfplotscoordmath{#1}{log}{\pgfmathresult}%
\let\pgfplots@error@coord=\pgfmathresult
- \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
+ \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
+ \pgfplotscoordmath{#1}{op}{add}{%
+ {\csname pgfplots@current@point@#1\endcsname}
+ {\pgfplots@error@coord}%
+ }%
+ \let\pgfplots@error@coord=\pgfmathresult
+ \csname pgfplots@PREPARE@errorbar@stream@it@#1\endcsname
+ }{%
+ % -> log( <= 0 ) -> do nothing.
+ }%
}{%
- % -> log( <= 0 ) -> do nothing.
+ % input is unbounded - do nothing.
}%
\fi
}%
@@ -4838,7 +4192,7 @@
% This unifies the approaches for \pgfplots@axiswide@metamax and
% \pgfplots@metamax.
\def\pgfplots@perpointmeta@preparetrafo@initfrom#1{%
- \edef\pgfplotspointmetarange{\csname #1metamin\endcsname:\csname #1max\endcsname}%
+ \edef\pgfplotspointmetarange{\csname #1metamin\endcsname:\csname #1metamax\endcsname}%
% Now, prepare the trafo as such.
% It assigns \pgfmathresult (in fixed point).
\def\pgfplots@perpointmeta@trafo##1{%
@@ -4848,12 +4202,16 @@
}{%
\pgfplotscoordmath{meta}{op}{subtract}{{##1}{\csname #1metamin\endcsname}}%
\pgfplotscoordmath{meta}{op}{multiply}{{\pgfmathresult}{\pgfplots@perpointmeta@trafo@factor}}%
+ \pgfplots@perpointmeta@trafo@clipresult
\pgfplotscoordmath{meta}{tofixed}{\pgfmathresult}%
}%
}%
\pgfplotscoordmath{meta}{op}{subtract}{{\csname #1metamax\endcsname}{\csname #1metamin\endcsname}}%
\let\pgfplots@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{meta}{zero}%
+ \let\pgfplots@perpointmeta@lowerrange=\pgfmathresult
\pgfplotscoordmath{meta}{parsenumber}{1000}%
+ \let\pgfplots@perpointmeta@upperrange=\pgfmathresult
\pgfplotscoordmath{meta}{op}{divide}{{\pgfmathresult}{\pgfplots@loc@TMPa}}%
\let\pgfplots@perpointmeta@trafo@factor=\pgfmathresult
%
@@ -4867,6 +4225,24 @@
\edef\pgfplotspointmetarangeexponent{\the\c@pgf@countd}%
}
+\def\pgfplots@perpointmeta@trafo@clipresult{%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{meta}{if less than}{\pgfplots@loc@TMPa}{\pgfplots@perpointmeta@upperrange}{%
+ \pgfplotscoordmath{meta}{if less than}{\pgfplots@loc@TMPa}{\pgfplots@perpointmeta@lowerrange}{%
+ \let\pgfmathresult=\pgfplots@perpointmeta@lowerrange
+ }{%
+ \let\pgfmathresult=\pgfplots@loc@TMPa
+ }%
+ }{%
+ \let\pgfmathresult=\pgfplots@perpointmeta@upperrange
+ }%
+}%
+
+% define it globally - this simplifies some mesh plots.
+\pgfplotscoordmath{meta}{one}%
+\let\pgfplotspointmeta=\pgfmathresult
+\def\pgfplotspointmetatransformed{1000}% use the maximum because it is usually divided by 1000
+
% A command which is readily available during the visualization phase of each plot.
%
% It takes existing point meta data and transforms it, i.e. it defines
@@ -6548,6 +5924,11 @@
\ifpgfplots@curplot@threedim
\pgfplots@addplotimpl@table@check@createonuse@for{z}%
\fi
+ \pgfplots@addplotimpl@table@check@createonuse@for{x error}%
+ \pgfplots@addplotimpl@table@check@createonuse@for{y error}%
+ \ifpgfplots@curplot@threedim
+ \pgfplots@addplotimpl@table@check@createonuse@for{z error}%
+ \fi
\pgfplots@addplotimpl@table@check@createonuse@for{meta}%
\fi
%
@@ -7094,14 +6475,6 @@
\pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}%
%
%
- \ifpgfplots@clip@limits
- \else
- % "clip marker paths=true" actually doesn't checks anything --
- % it leaves the checks to the clip path. But since there is no
- % clip path, it is adequate to use it here:
- \pgfplots@clip@marker@pathstrue
- \fi
- %
\pgfplots@perpointmeta@preparetrafo
%
\pgfplots@prepare@visualization@dependencies
@@ -7120,22 +6493,29 @@
\pgfplots@record@marker@streamfalse
\else
% we need markers.
- \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard
- \ifpgfplots@clip@marker@paths
- % only marks: draw markers directly; no need for the
- % two-pass-approach.
- \let\pgfplots@basiclevel@plothandler=\relax
- \pgfplots@install@plotmark@handler
- \pgfplots@record@marker@streamfalse
+ \pgfkeysgetvalue{/pgfplots/mark layer}\pgfplots@loc@TMPa
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ % no special mark layer. Good!
+ \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard
+ \ifpgfplots@clip@marker@paths
+ % only marks: draw markers directly; no need for the
+ % two-pass-approach.
+ \let\pgfplots@basiclevel@plothandler=\relax
+ \pgfplots@install@plotmark@handler
+ \pgfplots@record@marker@streamfalse
+ \else
+ % collect mark positions... they will be drawn after
+ % the clipped axis range. Clipping will only be
+ % applied to their *positions*, not their paths.
+ \pgfplots@record@marker@streamtrue
+ \fi
\else
- % collect mark positions... they will be drawn after
- % the clipped axis range. Clipping will only be
- % applied to their *positions*, not their paths.
+ % ok, mark!=none and we also have a plot handler.
+ % So, collect mark positions!
\pgfplots@record@marker@streamtrue
\fi
\else
- % ok, mark!=none and we also have a plot handler.
- % So, collect mark positions!
+ % we need to prepare for a separate mark layer:
\pgfplots@record@marker@streamtrue
\fi
\fi
@@ -7234,8 +6614,17 @@
}
% Takes the current point (defined by a set of macros) as input and defines \pgf@x and \pgf@y
-% as the output point.
+% as the output point. It also defines
+% \pgfplots@current@point@x and its variants to contain the
+% transformed canvas coords (those which can be given to
+% \pgfplotsqpointxyz).
+%
+% Furthermore, it defines keys '/data point/x untransformed' to
+% contain the untransformed coords.
\def\pgfplotsaxisvisphasegetpoint{%
+ \pgfkeyslet{/data point/x untransformed}\pgfplots@current@point@x
+ \pgfkeyslet{/data point/y untransformed}\pgfplots@current@point@y
+ \pgfkeyslet{/data point/z untransformed}\pgfplots@current@point@z
\pgfplotsaxisvisphasetransformcoordinate\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@z%
\pgfplotsaxisvisphasepreparedatapoint
\ifpgfplots@curplot@threedim
@@ -7615,6 +7004,15 @@
\def\pgfplots@coord@stream@finalize@storedcoords@START@coords{#1}%
\fi
\pgfplots@assert@tikzinternal@exists{tikz@make@last@position}%
+ %
+ \ifpgfplots@clip
+ \else
+ % "clip marker paths=true" actually doesn't checks anything --
+ % it leaves the checks to the clip path. But since there is no
+ % clip path, it is adequate to use it here:
+ \pgfplots@clip@marker@pathstrue
+ \fi
+ %
\pgfplots@stored@current@cmd%[current plot style] <--- options are already set
\pgfextra
\tikzset{every plot/.try}%
@@ -7633,19 +7031,30 @@
%
\ifx\pgfplots@recorded@marker@stream\pgfutil@empty
\else
- \ifpgfplots@clip@marker@paths
- % Draw markers on top of the plot lines:
- %
- \pgfplots@stored@current@cmd%[current plot style] <--- options are already set
- \pgfextra
- \pgfplots@install@plotmark@handler
- \pgfplots@recorded@marker@stream
- \endpgfextra
- ;
+ \pgfkeysgetvalue{/pgfplots/mark layer}\pgfplots@loc@TMPa
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \ifpgfplots@clip@marker@paths
+ % Draw markers on top of the plot lines:
+ %
+ \pgfplots@stored@current@cmd%[current plot style] <--- options are already set
+ \pgfextra
+ \pgfplots@install@plotmark@handler
+ \pgfplots@recorded@marker@stream
+ \endpgfextra
+ ;
+ \else
+ % sigh... ok, store the marker list (once more again).
+ % They need to be drawn after the clipped area.
+ %
+ % fortunately, the serialization is not expensive.
+ \pgfplots@stored@REMEMBER@MARK@COMMAND
+ \fi
\else
- % sigh... ok, store the marker list (once more again).
- % They need to be drawn after the clipped area.
- \pgfplots@stored@REMEMBER@MARK@COMMAND
+ % oh - we need a mark layer!
+ \pgfplotsonlayer{\pgfkeysvalueof{/pgfplots/mark layer}}{mark layer}%
+ \pgfplots@serialize@mark@command
+ \pgfplotsretval
+ \endpgfplotsonlayer
\fi
\fi
\gdef\pgfplots@recorded@marker@stream{}% clear
@@ -7658,6 +7067,33 @@
% - pgfplots@recorded@marker@stream exists
% - current plot style is valid
\def\pgfplots@stored@REMEMBER@MARK@COMMAND{%
+ \pgfplots@serialize@mark@command
+ \ifpgfplots@clip
+ \if2\pgfplots@clipmode
+ % clip mode=individual:
+ \global\let\pgfplots@stored@markerlist@last=\pgfplotsretval
+ \else
+ % clip mode=global
+ \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotsretval}\to\pgfplots@stored@markerlist
+ \fi
+ \fi
+}%
+
+\def\pgfplots@execute@at@begin@plot@visualization@internal{%
+ \global\let\pgfplots@stored@markerlist@last=\relax
+}%
+
+\def\pgfplots@execute@at@end@plot@visualization@internal{%
+ \ifpgfplots@clip
+ \if2\pgfplots@clipmode
+ % clip=true and 'clip mode=individually'
+ \pgfplots@stored@markerlist@last
+ \global\let\pgfplots@stored@markerlist@last=\relax
+ \fi
+ \fi
+}%
+
+\def\pgfplots@serialize@mark@command{%
\pgfkeysgetvalue{/tikz/current plot style/.@cmd}{\pgfplots@loc@TMPa}%
\t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\pgfeov}%
\t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@cmd[current plot style]}%
@@ -7685,8 +7121,11 @@
}%
\t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}%
\t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@precmd}%
- \edef\pgfplots@loc@TMPa{\the\t@pgfplots@tokb\the\t@pgfplots@toka}%
- \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}\to\pgfplots@stored@markerlist
+ \edef\pgfplotsretval{%
+ \noexpand\scope% make sure that 'fill opacity' and 'dotted' styles remain local!
+ \the\t@pgfplots@tokb
+ \the\t@pgfplots@toka
+ \noexpand\endscope}%
}%
\def\pgfplots@install@plotmark@handler{%
@@ -7759,11 +7198,17 @@
\the\t@pgfplots@tokc
}%
\fi
- \ifx\tikz@mark@list\pgfutil@empty%
- \expandafter\pgfplothandlermark\expandafter{\pgfplots@loc@TMPa}%
- \else
- \expandafter\pgfplothandlermarklisted\expandafter{\pgfplots@loc@TMPa}{\tikz@mark@list}%
- \fi
+ \def\pgfplots@loc@TMPb##1{%
+ \ifx\tikz@mark@list\pgfutil@empty%
+ \pgfplothandlermark{##1}%
+ \else
+ \pgfplothandlermarklisted{##1}{\tikz@mark@list}%
+ \fi
+ }%
+ \t@pgfplots@tokc=\expandafter\expandafter\expandafter{\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}}%
+ \edef\pgfplots@basiclevel@plothandler{\the\t@pgfplots@tokc}%
+ %
+ \pgfplots@basiclevel@plothandler
}%
@@ -7980,7 +7425,7 @@
-% the low-level Tikz command which realizes 'plot graphics'.
+% the low-level Tikz command which implements 'plot graphics'.
%
% It's current state is described by some pgfkeys options and two
% coordinates.
@@ -8324,11 +7769,21 @@
\fi
%
%
+ \if1\b@pgfplots@compat@plot@graphics@threedim
+ \pgfplots@warning{plot3 graphics is running in backwards compatibility mode. %
+ Use \string\pgfplotsset{compat=1.6} or higher to benefit from upgraded scaling capabilites.}%
+ \else
+ \fi
+ %
\edef\pgfplotsretval{%
x={(\pgfplots@xx,\pgfplots@xy)},%
y={(\pgfplots@yx,\pgfplots@yy)},%
z={(\pgfplots@zx,\pgfplots@zy)},%
scale mode=scale uniformly,%
+ \if1\b@pgfplots@compat@plot@graphics@threedim
+ % this is the only strategy pre 1.6
+ scale uniformly strategy=change vertical limits,%
+ \fi
}%
%
\if1\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug
@@ -8382,6 +7837,8 @@
\def\n{^^J}%
\def\t{^^I}%
\immediate\write\w@pgf@writea{canvasmapmatrix=[\pgfplotsmatrix@text];^^Jcanvasmaprhs = [\pgfplotsrhs@text];^^J}%
+ %
+ \immediate\write\w@pgf@writea{key configuration = \pgfplotsretval;^^J}%
\immediate\closeout\w@pgf@writea
\endgroup
}%
@@ -8860,6 +8317,7 @@
%\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}%
% 'z buffer' is no longer 'auto' now:
\pgfplots@apply@zbuffer{#1}%
+ \pgfmath@smuggleone\pgfplotsplothandlermesh@zbuffer@choice
\endgroup
\else
% mesh input=patches
@@ -8973,19 +8431,20 @@
% '#1' is BEHIND #2 with respect to the current 3D view.
\def\pgfplots@apply@zbuffer@SORT@iflessthan#1#2#3#4\pgfeov{%
\pgfplotsaxisdeserializedatapointfrom{#1}%
- \pgfplotsmathfloatviewdepthxyz{\pgfplots@current@point@x}{\pgfplots@current@point@y}{\pgfplots@current@point@z}%
- \let\pgfplots@apply@zbuffer@SORT@iflessthan@a=\pgfmathresult
+ \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}%
+ \pgfplotsmathvectorscalarproduct{\pgfplots@view@dir@threedim}{\pgfplotsretval}{default}%
+ \let\pgfplots@apply@zbuffer@SORT@iflessthan@a=\pgfplotsretval
%
\pgfplotsaxisdeserializedatapointfrom{#2}%
- \pgfplotsmathfloatviewdepthxyz{\pgfplots@current@point@x}{\pgfplots@current@point@y}{\pgfplots@current@point@z}%
- \let\pgfplots@apply@zbuffer@SORT@iflessthan@b=\pgfmathresult
+ \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}%
+ \pgfplotsmathvectorscalarproduct{\pgfplots@view@dir@threedim}{\pgfplotsretval}{default}%
+ \let\pgfplots@apply@zbuffer@SORT@iflessthan@b=\pgfplotsretval
%
- \pgfmathfloatlessthan@{\pgfplots@apply@zbuffer@SORT@iflessthan@b}{\pgfplots@apply@zbuffer@SORT@iflessthan@a}%
- \ifpgfmathfloatcomparison
+ \pgfplotscoordmath{default}{if less than}{\pgfplots@apply@zbuffer@SORT@iflessthan@b}{\pgfplots@apply@zbuffer@SORT@iflessthan@a}{%
#3\relax
- \else
+ }{%
#4\relax
- \fi
+ }%
}%
@@ -8997,53 +8456,51 @@
% The arguments need to be numbers (will be parsed with
% \pgfmathfloatparsenumber).
% @see \pgfplotsmathviewdepthxyz
+% DEPRECATED use \pgfplotsmathvectorviewdepth instead!
\def\pgfplotsmathfloatviewdepthxyz#1#2#3{%
+ \begingroup
\pgfmathfloatparsenumber{#1}\let\pgfplots@loc@TMPa=\pgfmathresult
\pgfmathfloatparsenumber{#2}\let\pgfplots@loc@TMPb=\pgfmathresult
\pgfmathfloatparsenumber{#3}\let\pgfplots@loc@TMPc=\pgfmathresult
\edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}}%
\expandafter\pgfplotsmathfloatviewdepthxyz@\pgfplots@loc@TMPa
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}%
+
+% #1: a 3d vector of the form x,y,z in 'default' coordmath format
+% defines \pgfplotsretval to the view depth
+% of the point
+%
+% Use \pgfplotsmathvectorfromstring{x,y,z}{default} to transform a
+% vector into the requested format.
+%
+% Use \pgfplotscoordmath{default}{tofixed}{\pgfplotsretval} to
+% transform the result into fixed point representation.
+\def\pgfplotsmathvectorviewdepth#1{%
+ \pgfplotsmathvectorscalarproduct{#1}{\pgfplots@view@dir@threedim}{default}%
}%
\def\pgfplotsmathfloatviewdepthxyz@#1#2#3{%
\pgfplots@error{Sorry, you can't use \string\pgfplotsmathfloatviewdepthxyz\space in this context.}%
}%
\def\pgfplotsmathfloatviewdepthxyz@infigure#1#2#3{%
- \pgfmathfloatmultiplyfixed@{#1}{\pgfplots@view@dir@threedim@x}%
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \pgfmathfloatmultiplyfixed@{#2}{\pgfplots@view@dir@threedim@y}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \pgfmathfloatadd@{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \ifpgfplots@curplot@threedim
- \pgfmathfloatmultiplyfixed@{#3}{\pgfplots@view@dir@threedim@z}%
- \let\pgfplots@loc@TMPc=\pgfmathresult
- \pgfmathfloatadd@{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \fi
- \let\pgfmathresult=\pgfplots@loc@TMPb
+ \pgfplotsmathvectorfromstring{\pgfplots@view@dir@threedim}{float}%
+ \pgfplotsmathvectorscalarproduct{#1,#2,#3}{\pgfplotsretval}{float}% FIXME : \pgfplots@view@dir@threedim might have a different math format!
+ \let\pgfmathresult=\pgfplotsretval
}%
% Similar to \pgfplotsmathfloatviewdepthxyz, but this always relies on
% fixed point arithmetics.
+% DEPRECATED use \pgfplotsmathvectorviewdepth instead
\def\pgfplotsmathviewdepthxyz#1#2#3{\pgfplotsmathviewdepthxyz@{#1}{#2}{#3}}
\def\pgfplotsmathviewdepthxyz@#1#2#3{%
\pgfplots@error{Sorry, you can't use \string\pgfplotsmathviewdepthxyz\space in this context.}%
}
\def\pgfplotsmathviewdepthxyz@infigure#1#2#3{%
- \pgfmath@basic@multiply@{#1}{\pgfplots@view@dir@threedim@x}%
- \let\pgfplots@loc@TMPa=\pgfmathresult
- \pgfmath@basic@multiply@{#2}{\pgfplots@view@dir@threedim@y}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \pgfmath@basic@add@{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \ifpgfplots@curplot@threedim
- \pgfmath@basic@multiply@{#3}{\pgfplots@view@dir@threedim@z}%
- \let\pgfplots@loc@TMPc=\pgfmathresult
- \pgfmath@basic@add@{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPc}%
- \let\pgfplots@loc@TMPb=\pgfmathresult
- \fi
- \let\pgfmathresult=\pgfplots@loc@TMPb
+ \pgfplotsmathvectorfromstring{\pgfplots@view@dir@threedim@unitlength}{pgfbasic}%
+ \pgfplotsmathvectorscalarproduct{#1,#2,#3}{\pgfplotsretval}{pgfbasic}% FIXME : \pgfplots@view@dir@threedim might have a different math format!
+ \let\pgfmathresult=\pgfplotsretval
}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex
index fe6106f4380..35f64d032dd 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex
@@ -27,6 +27,7 @@
\def\pgfplotsset#{\pgfqkeys{/pgfplots}}
+\def\pgfplots@log#1#2{\immediate\write-1{Package pgfplots info: #2}}%
\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}%
\def\pgfplotstable@error@pkg#1{\PackageError{pgfplotstable}{#1}{}}%
\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}%
@@ -90,6 +91,15 @@
\fi
\let#1=\pgfutil@empty
},%
+ % #1 : the layer name
+ % #2 : additional context information (message)
+ /pgfplots/exception/inactive layer/.code 2 args={%
+ \ifx\pgfplotsexceptionmsg\relax
+ \pgfplots@error{Sorry, the layer '#1' has not been activated but it is referenced in #2. Perhaps you misspelled it? Each referenced layer must be activated (expect for layer 'discard').}%
+ \else
+ \pgfplots@error{\pgfplotsexceptionmsg}%
+ \fi
+ },%
% #1: the argument which should have been assigned.
% #2: an error message.
/pgfplots/exception/no such element/.code 2 args={%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
index 5084cd21b1e..8641fed58aa 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex
@@ -246,14 +246,20 @@
%%
%% Helper structs for patch plots (surfaces)
-\def\pgfplotspatchvertex#1#2#3#4\endvertex{%
- \def\pgfplotspatchvertexstruct{{#1}{#2}{#3}#4}%
+% #1: the canvas x coordinate
+% #2: the canvas y coordinate
+% #3: the point meta data (cdata)
+% #4: the vertex'es depth (if required)
+% #5: the 3d coordinates of the vertex (will only be stored if it is deemed necessary)
+\def\pgfplotspatchvertex#1#2#3#4:#5\endvertex{%
+ \def\pgfplotspatchvertexstruct{{#1}{#2}{#3}#4:#5}%
\def\pgfplotspatchvertexx{#1}%
\def\pgfplotspatchvertexy{#2}%
\def\pgfplotspatchvertexmeta{#3}%
\def\pgfplotspatchvertexdepth{#4}%
+ \def\pgfplotspatchvertexcoords{#5}%
}%
-\def\pgfplotspointpatchvertex#1#2#3#4\endvertex{%
+\def\pgfplotspointpatchvertex#1#2#3#4:#5\endvertex{%
\global\pgf@x=#1
\global\pgf@y=#2
}%
@@ -275,36 +281,36 @@
\pgf@yb=0pt
\pgfplotscoordmath{meta}{zero}%
}%
-\def\pgfplotspatchvertexadd#1#2#3#4\times#5{%
+\def\pgfplotspatchvertexadd#1#2#3#4:#5\times#6{%
\global\pgf@x=#1
\global\pgf@y=#2
- \advance\pgf@xa by#5\pgf@x
- \advance\pgf@ya by#5\pgf@y
+ \advance\pgf@xa by#6\pgf@x
+ \advance\pgf@ya by#6\pgf@y
\let\pgfmathresult@=\pgfmathresult
- \pgfplotscoordmath{meta}{parsenumber}{#5}%
+ \pgfplotscoordmath{meta}{parsenumber}{#6}%
\pgfplotscoordmath{meta}{op}{multiply}{{#3}{\pgfmathresult}}%
\pgfplotscoordmath{meta}{op}{add}{{\pgfmathresult@}{\pgfmathresult}}%
\def\pgfplotspatchvertexdepth{#4}%
\ifx\pgfplotspatchvertexdepth\pgfutil@empty
\else
\global\pgf@y=#4pt
- \advance\pgf@yb by#5\pgf@y
+ \advance\pgf@yb by#6\pgf@y
\fi
}%
\def\pgfplotspatchvertexfinish#1{%
- \edef#1{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else\pgf@sys@tonumber\pgf@yb\fi}%
+ \edef#1{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else\pgf@sys@tonumber\pgf@yb\fi:}%
}
% Same as \pgfplotspatchvertexadd, but it only adds the X and Y
% coordinates (ignoring the rest).
-\def\pgfplotspatchvertexaddXY#1#2#3#4\times#5{%
+\def\pgfplotspatchvertexaddXY#1#2#3#4:#5\times#6{%
\global\pgf@x=#1
\global\pgf@y=#2
- \advance\pgf@xa by#5\pgf@x
- \advance\pgf@ya by#5\pgf@y
+ \advance\pgf@xa by#6\pgf@x
+ \advance\pgf@ya by#6\pgf@y
}%
% Same as \pgfplotspatchvertexfinish, but it only saves X and Y.
\def\pgfplotspatchvertexfinishXY#1{%
- \edef#1{{\the\pgf@xa}{\the\pgf@ya}{}}%
+ \edef#1{{\the\pgf@xa}{\the\pgf@ya}{}:}%
}
% #1 class name
@@ -415,6 +421,9 @@
recursive refine@={%
\pgfplots@error{refine: not yet implemented for \pgfplotspatchclassname}%
},%
+ compute normal={%
+ \pgfplotsplothandlermesh@compute@normal@default
+ },%
}%
}{}%
%
@@ -580,8 +589,80 @@
get pdf shading type/.style={get pdf shading type*={\def\pgfplotsretval{#1}}},
get pdf shading type*/.code=
{\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get pdf shading type\endcsname{#1}},%
+ %
+ % A method which defines \pgfplotsretval to be the normal of the current segment.
+ % The values will be given in a format understood by
+ % \pgfplotsmathvectortostring{\pgfplotsretval}{default}
+ %
+ % This method REQUIRES that 3d coordinates are stored (see \pgfplotsplothandlermesh@serialize@logical@coords).
+ compute normal/.code=
+ {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ compute normal\endcsname{#1}},%
}
+% This implements 'compute normal' :
+\def\pgfplotsplothandlermesh@compute@normal@default{%
+ \begingroup
+ \c@pgf@countd=0
+ \pgfplotspatchclass{\pgfplotspatchclassname}{foreach vertex}{%
+ \ifx\pgfplotspatchvertexcoords\pgfutil@empty
+ \pgfplotsplothandlermesh@compute@normal@error
+ \fi
+ \pgfplotsmathvectorfromstring{\pgfplotspatchvertexcoords}{default}%
+ \expandafter\let\csname point\the\c@pgf@countd\endcsname=\pgfplotsretval
+ \let\pointlast=\pgfplotsretval
+ \advance\c@pgf@countd by1 %
+ }%
+ \pgfplotsmathvectorsubtract{\csname point1\endcsname}{\csname point0\endcsname}{default}%
+ \let\diffA=\pgfplotsretval
+ % Hm. usually, I would use \point2 here... but it turned out that
+ % the result looks ugly for rectangular patches -- so I used the
+ % last point instead (which is, at least, consistent with the
+ % patch boundaries)
+ \pgfplotsmathvectorsubtract{\csname pointlast\endcsname}{\csname point0\endcsname}{default}%
+ \let\diffB=\pgfplotsretval
+ \pgfplotsmathvectorcrossprod{\diffA}{\diffB}{default}%
+ \let\crossAB=\pgfplotsretval
+ % this here is an experiment to use the MEAN of two normal
+ % vectors for rectangular patches... but it did not work as good
+ % as expected:
+ % \pgfplotspatchclass{\pgfplotspatchclassname}{get num vertices}%
+ % \ifnum\pgfplotsretval=4
+ % \pgfplotsmathvectorsubtract{\csname point3\endcsname}{\csname point0\endcsname}{default}%
+ % \let\diffC=\pgfplotsretval
+ % \pgfplotsmathvectorcrossprod{\diffB}{\diffC}{default}%
+ % \let\crossBC=\pgfplotsretval
+ % \pgfplotsmathvectoradd{\crossAB}{\crossBC}{default}%
+ % \pgfplotscoordmath{default}{parsenumber}{0.5}%
+ % \pgfplotsmathvectorscale{\pgfplotsretval}{\pgfmathresult}{default}%
+ % \let\normal=\pgfplotsretval
+ % \else
+ \let\normal=\crossAB
+ %\fi
+ %
+ % specific choices of z buffering change the sequence of points.
+ % If the number of reversals is off, we need to switch the
+ % normal's sign:
+ \def\pgfplots@switch@normal@dir{0}%
+ \if1\pgfplotsplothandlermesh@zbuffer@choice
+ % z buffer=reverse x seq
+ \def\pgfplots@switch@normal@dir{1}%
+ \else
+ \if2\pgfplotsplothandlermesh@zbuffer@choice
+ % z buffer=reverse y seq
+ \def\pgfplots@switch@normal@dir{1}%
+ \fi
+ \fi
+ \if1\pgfplots@switch@normal@dir
+ \pgfplotscoordmath{default}{parsenumber}{-1}%
+ \pgfplotsmathvectorscale{\normal}{\pgfmathresult}{default}%
+ \fi
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+\def\pgfplotsplothandlermesh@compute@normal@error{%
+ \pgfplots@error{Cannot compute normal vectors: due to some reason, only canvas coordinates of the involved patch are available in this context, but the original input coordinates are required. This indicates an incompatible combination of variables (sorry). Please report this as a bug}%
+}%
+
\def\pgfplotspatchclass@recursiverefine#1{%
\c@pgf@counta=#1
\ifnum\c@pgf@counta=1
@@ -885,8 +966,8 @@
\pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}10%
\pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}21%
\expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@A}%
- \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}%
\expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@B}%
+ \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}%
%
\pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01%
\pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}11%
@@ -1174,6 +1255,17 @@
\if\pgfplotsplothandlermesh@zbuffer@choice4% 'z buffer=sort':
\def\b@pgfplotsplothandlermesh@matrixoutput{0}%
\fi
+ %
+ \if2\pgfplotsplothandlermesh@shader
+ % shader=interp
+ %
+ \pgfkeysgetvalue{/pgfplots/mesh/interior colormap name}\pgfplots@loc@TMPc
+ \ifx\pgfplots@loc@TMPc\pgfutil@empty
+ \else
+ \pgfplots@warning{the combination 'shader=interp,interior colormap name' is inefficient (it uses 'shader=faceted interp,faceted color=none') and may slow down the *display* of your document}%
+ \pgfplotsset{shader=faceted interp,faceted color=none}%
+ \fi
+ \fi
\if2\pgfplotsplothandlermesh@shader
\else
% 'shader!=interp'
@@ -1194,8 +1286,8 @@
% no matrix output possible
\if5\pgfplotsretval
% pdf shading type=5 (matrix output)
- \ifnum\pgfplotsplothandlermesh@shader>1
- % shader=interp or shader=faceted interp
+ \if2\pgfplotsplothandlermesh@shader
+ % shader=interp
%
% oh. shading type=5 is *essentially* the same as
% matrix output, but matrix output is forbidden.
@@ -1203,6 +1295,9 @@
% triangles:
\def\pgfplotsplothandlermesh@triangulate{1}%
\def\pgfplotsplothandlermesh@patchclass@output{triangle}%
+ % Note shader=faceted interp can be written as
+ % matrix -- it shades individual elements anyway;
+ % and one single patch can be written as matrix.
\fi
\fi
\fi
@@ -1235,6 +1330,12 @@
% handling of jumps.
\pgfplotsplothandlermesh@init@jumphandling
%
+ \ifpgfplotsplothandlermesh@shownormals
+ \let\pgfplotsplothandlermesh@show@normals@if@configured=\pgfplotsplothandlermesh@show@normals
+ % actually store 3d coordinates:
+ \let\pgfplotsplothandlermesh@serialize@logical@coords=\pgfplotsplothandlermesh@serialize@logical@coords@doit
+ \fi
+ %
% z buffering:
\pgfplotsplothandlermesh@init@zbuffer
%
@@ -1245,6 +1346,46 @@
}%
\def\pgfplotsplothandlermesh@patchclass@defaulttext{default}%
+% implements 'show normals'. Keep in mind that this is more-or-less a
+% debugging helper, not productive code.
+\def\pgfplotsplothandlermesh@show@normals{%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{compute normal}%
+ \let\pgfplots@normal@vector=\pgfplotsretval
+%\pgfplotsmathvectortostring\pgfplots@normal@vector{default}%
+%\message{got normal \pgfplotsretval^^J}%
+ \pgfplotsmathvectorlength{\pgfplots@normal@vector}{default}%
+ \pgfplotscoordmath{default}{parsenumber}{\pgfkeysvalueof{/pgfplots/mesh/show normals length factor}}% FIXME
+ \pgfplotscoordmath{default}{op}{divide}{{\pgfmathresult}{\pgfplotsretval}}%
+ \pgfplotsmathvectorscale{\pgfplots@normal@vector}{\pgfmathresult}{default}%
+ %\pgfplotsmathvectoradd{\pgfplotspatchvertexcoords}{\pgfplotsretval}{default}%
+ \let\pgfplots@normal@vector=\pgfplotsretval
+ %
+ \draw[/pgfplots/every patch normal]
+ \pgfextra{%
+ \pgfpathmoveto
+ {%
+ \pgf@process{%
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{get num vertices}%
+ \pgfmath@basic@reciprocal@{\pgfplotsretval}%
+ \let\scale=\pgfmathresult
+ \pgfplotspatchvertexaccumstart
+ \pgfplotspatchclass{\pgfplotspatchclassname}{foreach vertex}{%
+ \expandafter\pgfplotspatchvertexadd\pgfplotspatchvertexstruct\times{\scale}%
+ }%
+ \pgfplotspatchvertexfinishXY{\pgfplots@loc@TMPa}%
+ \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex%
+ }%
+ }%
+ \edef\pgfplots@loc@TMPa{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
+ %
+ \pgfpathlineto{%
+ \pgfpointadd
+ {\pgfplots@loc@TMPa}
+ {\pgfplotspointfromcsvvector\pgfplots@normal@vector{default}}%
+ }%
+ }%
+ ;
+}%
% Defines \pgfplotsretval to be either empty or the current point's
% depth according to z buffer information.
@@ -1255,10 +1396,44 @@
% contain the view depth.
%
\def\pgfplotsplothandlermesh@compute@vertex@depth@doit{%
- \pgfplotsmathviewdepthxyz{\pgfplots@current@point@x}{\pgfplots@current@point@y}{\pgfplots@current@point@z}% FIXME relies on pgfplots macros
+ \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}%
+ \pgfplotsmathvectorviewdepth{\pgfplotsretval}%
+ \pgfplotscoordmath{default}{tofixed}{\pgfplotsretval}%
\edef\pgfplotsretval{\pgfmathresult}%
}%
+% A command which defines \pgfplotsretval to be either empty or to
+% the (x,y,z) 3d coordinates of the data point. Usually, the data
+% scaling transformation will already be applied to these points.
+%
+% Note that this is unnecessary for most applications of mesh plots.
+%
+% The resulting value will be available as \pgfplotspatchvertexcoords
+\def\pgfplotsplothandlermesh@serialize@logical@coords{%
+ % empty by default
+ \let\pgfplotsretval=\pgfutil@empty
+}%
+\def\pgfplotsplothandlermesh@serialize@logical@coords@doit{%
+ \ifx\pgfplots@current@point@x\pgfutil@empty
+ \let\pgfplotsretval=\pgfutil@empty
+ \else
+ % note that these points are the result of the data scaling
+ % trafo. That is OK because the view normal is also in the
+ % same coordinate space.
+ \pgfplotsmathvectorfromstring{\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z}{default}%
+ \fi
+}
+
+% the inverse for \pgfplotsplothandlermesh@serialize@logical@coords: it defines \pgfplots@current@point@[xyz].
+% You should only call it if you know that there IS something to deserialize.
+\def\pgfplotsplothandlermesh@deserialize@logical@coords#1{%
+ \expandafter\pgfplotsplothandlermesh@deserialize@logical@coords@#1\relax
+}%
+\def\pgfplotsplothandlermesh@deserialize@logical@coords@#1,#2,#3\relax{%
+ \def\pgfplots@current@point@x{#1}%
+ \def\pgfplots@current@point@y{#2}%
+ \def\pgfplots@current@point@z{#3}%
+}%
% The patch visualization works like a PIPELINE:
%
@@ -1285,9 +1460,11 @@
\def\pgfplotsplothandlermesh@PIPE@DECODE#1{%
\let\pgfplotsplothandlermesh@patchclass\pgfplotsplothandlermesh@patchclass@input
\pgfplotsplothandlermesh@compute@vertex@depth% <-- this modifies \pgfplotsretval
+ \let\pgfplots@view@depth=\pgfplotsretval
\pgf@process{#1}%
% calls \pgfplotspatchready when ready
- \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set next vertex}{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplotsretval}%%
+ \pgfplotsplothandlermesh@serialize@logical@coords
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set next vertex}{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplots@view@depth:\pgfplotsretval}%%
}%
\def\pgfplotspatchready{%
\pgfplotsplothandlermesh@PIPE@CHECKJUMP
@@ -1310,6 +1487,11 @@
% invoked when a patch is completely processed.
% This might be replaced by the z buffering algorithm
\def\pgfplotsplothandlermesh@PIPE@FINISH{%
+ \pgfplotsplothandlermesh@PIPE@interior@exterior@styles
+}%
+
+\def\pgfplotsplothandlermesh@PIPE@interior@exterior@styles{%
+ \pgfplotsplothandlermesh@interior@exterior@hook
\pgfplotsplothandlermesh@VISUALIZE
}%
@@ -1318,11 +1500,14 @@
\pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{fill path}%
\pgfplotsplothandlermesh@definecolor
\pgfplotsplothandlermesh@usepath
+ \pgfplotsplothandlermesh@show@normals@if@configured
}%
\let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@fill@andor@stroke
\let\pgfplotsplothandlermesh@VISUALIZE=\pgfplotsplothandlermesh@VISUALIZE@std
+\let\pgfplotsplothandlermesh@show@normals@if@configured\relax
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\pgfplotsplothandlermesh@init@DECODE{%
@@ -1582,10 +1767,87 @@
\fi
}%
+\let\pgfplotsplothandlermesh@interior@exterior@hook=\relax
+\def\pgfplotsplothandlermesh@interior@exterior@hook@active@zerothresh{%
+ \begingroup
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{compute normal}%
+% \let\pgfplots@normal=\pgfplotsretval
+% \pgfplotsmathvectorlength{\pgfplotsretval}{default}%
+% \pgfplotscoordmath{default}{op}{reciprocal}{{\pgfplotsretval}}%
+% \pgfplotsmathvectorscale{\pgfplots@normal}{\pgfmathresult}{default}%
+ %
+ \pgfplotsmathvectorscalarproduct{\pgfplots@view@dir@threedim}{\pgfplotsretval}{default}%
+ \pgfplotscoordmath{default}{if is}{\pgfplotsretval}{-}{%
+ % <0:
+ \global\let\pgfplots@glob@TMPc\pgfplotsplothandlermesh@is@interior
+ }{%
+ % >=0:
+ \global\let\pgfplots@glob@TMPc\pgfplotsplothandlermesh@is@exterior
+ }%
+ \endgroup
+ \pgfplots@glob@TMPc
+}%
+
+\def\pgfplotsplothandlermesh@interior@exterior@hook@active{%
+ \begingroup
+ \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{compute normal}%
+ \let\pgfplots@normal=\pgfplotsretval
+ \pgfplotsmathvectorlength{\pgfplotsretval}{default}%
+ \let\pgfplots@normal@len=\pgfplotsretval
+ %
+ \pgfplotsmathvectorscalarproduct{\pgfplots@view@dir@threedim}{\pgfplots@normal}{default}%
+ \let\pgfplots@dot=\pgfplotsretval
+ \pgfplotscoordmath{default}{op}{multiply}{{\pgfplots@view@dir@threedim@len}{\pgfplots@normal@len}}%
+ \pgfplotscoordmath{default}{op}{divide}{{\pgfplots@dot}{\pgfmathresult}}%
+
+ \pgfplotscoordmath{default}{if less than}{\pgfmathresult}{\pgfplotsplothandlermesh@interior@thresh}{%
+ % <0:
+ \global\let\pgfplots@glob@TMPc\pgfplotsplothandlermesh@is@interior
+ }{%
+ % >=0:
+ \global\let\pgfplots@glob@TMPc\pgfplotsplothandlermesh@is@exterior
+ }%
+ \endgroup
+ \pgfplots@glob@TMPc
+}%
+
+
+% only used if
+% \pgfplotsplothandlermesh@interior@exterior@hook@active is
+% active
+\def\pgfplotsplothandlermesh@is@interior{%
+%\def\pgfplotsplothandlermesh@usepath{\pgfusepath{discard}}%
+ \pgfkeyslet{/pgfplots/colormap name}\pgfplotsplothandlermesh@colormapname@interior
+ \pgfkeyslet{/pgfplots/surf shading/colormap}\pgfplotsplothandlermesh@shader@colormap@interior
+}%
+\def\pgfplotsplothandlermesh@is@exterior{%
+%\let\pgfplotsplothandlermesh@usepath=\pgfusepathqfillstroke
+ \pgfkeyslet{/pgfplots/colormap name}\pgfplotsplothandlermesh@colormapname
+ \pgfkeyslet{/pgfplots/surf shading/colormap}\pgfplotsplothandlermesh@shader@colormap
+}%
\def\pgfplotsplothandlermesh@init@cdata{%
% Ok, we have color data.
%
+ \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplotsplothandlermesh@colormapname
+ %
+ \pgfkeysgetvalue{/pgfplots/mesh/interior colormap name}\pgfplotsplothandlermesh@colormapname@interior
+ \ifx\pgfplotsplothandlermesh@colormapname@interior\pgfutil@empty
+ \else
+ \pgfkeysgetvalue{/pgfplots/mesh/interior colormap thresh}\pgfplotsplothandlermesh@interior@thresh
+ \pgfplotscoordmath{default}{parsenumber}{\pgfplotsplothandlermesh@interior@thresh}%
+ \let\pgfplotsplothandlermesh@interior@thresh=\pgfmathresult
+ \pgfplotscoordmath{default}{if is}{\pgfplotsplothandlermesh@interior@thresh}{0}{%
+ \let\pgfplotsplothandlermesh@interior@exterior@hook=\pgfplotsplothandlermesh@interior@exterior@hook@active@zerothresh
+ }{%
+ \pgfplotsmathvectorlength{\pgfplots@view@dir@threedim}{default}% should be 1, but never mind
+ \let\pgfplots@view@dir@threedim@len=\pgfplotsretval
+ \let\pgfplotsplothandlermesh@interior@exterior@hook=\pgfplotsplothandlermesh@interior@exterior@hook@active
+ }%
+ % actually store 3d coordinates:
+ \let\pgfplotsplothandlermesh@serialize@logical@coords=\pgfplotsplothandlermesh@serialize@logical@coords@doit
+ \fi
+ %
% Prepare:
\def\pgfplotsplothandlermesh@definecolor{%
\pgfplotsplothandlermesh@get@flat@color
@@ -1684,9 +1946,21 @@
\pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get pdf shading type}%
\fi
\pgfkeyslet{/pgfplots/surf shading/shading type}\pgfplotsretval%
+ %
+ \pgfplotsplothandlermesh@set@shader@colormap
+ \pgfkeysgetvalue{/pgfplots/mesh/interior colormap name}\pgfplots@loc@TMPa
+ \ifx\pgfplots@loc@TMPa\pgfutil@empty
+ \else
+ \let\pgfplotsplothandlermesh@shader@colormap=\pgfplotsretval
+ \begingroup
+ \pgfkeyslet{/pgfplots/colormap name}\pgfplots@loc@TMPa
+ \pgfplotsplothandlermesh@set@shader@colormap
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+ \let\pgfplotsplothandlermesh@shader@colormap@interior=\pgfplotsretval
+ \fi
+ %
\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa
- \expandafter\pgfplotscolormaptopdffunction\expandafter{\pgfplots@loc@TMPa}%
- \pgfkeyslet{/pgfplots/surf shading/colormap}\pgfplotsretval
\pgfplotscolormapgetcolorspace\pgfplots@loc@TMPa
\pgfkeyslet{/pgfplots/surf shading/colorspace}\pgfplotsretval
\if2\pgfplotsplothandlermesh@shader
@@ -1909,6 +2183,12 @@
%
\let\pgfplotsplothandlermesh@compute@vertex@depth=\pgfplotsplothandlermesh@compute@vertex@depth@doit%
%
+ % the "element depth" is defined to be the MEAN of all
+ % vertex depths.
+ % And since the mean is 1/n * sum_{i=1}^n V_i, we can
+ % directly omit the 1/n --- it is the same for every
+ % vertex anyway, and we only want to compare the depth
+ % values.
\let\pgfplotsplothandlermesh@accum@element@depth=\pgfmath@basic@add@
%
% and collect each point into the z buffer
@@ -1955,6 +2235,12 @@
\pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}%
}
+\def\pgfplotsplothandlermesh@set@shader@colormap{%
+ \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa
+ \expandafter\pgfplotscolormaptopdffunction\expandafter{\pgfplots@loc@TMPa}%
+ \pgfkeyslet{/pgfplots/surf shading/colormap}\pgfplotsretval
+}%
+
{
\dimen0=-16000.0pt
\xdef\pgfplotsplothandlermesh@check@unbounded@text{\the\dimen0}%
@@ -2031,7 +2317,7 @@
\pgfkeyslet{/pgfplots/iflessthan/.@cmd}\pgfplotsplothandlermesh@zbuffer@sort@iflessthen
\pgfkeysdef{/pgfplots/array/unscope pre}{%
\let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@output
- \def\pgfplotspatchready{\pgfplotsplothandlermesh@VISUALIZE}%
+ \def\pgfplotspatchready{\pgfplotsplothandlermesh@PIPE@interior@exterior@styles}%
\pgfplotsarrayforeachungrouped\pgfplots@zbuffer@local\as\curelem{%
\expandafter\pgfplotsplothandlermesh@draw@zbufferelement\curelem%
}%
@@ -2063,8 +2349,10 @@
\def\pgfplotsplothandlermesh@PIPE@DECODE@matrix@ONEDIMMODE#1{%
\let\pgfplotsplothandlermesh@patchclass\pgfplotsplothandlermesh@patchclass@input
\pgfplotsplothandlermesh@compute@vertex@depth% <-- this modifies \pgfplotsretval
+ \let\pgfplots@view@depth=\pgfplotsretval
\pgf@process{#1}%
- \edef\pgfplotsplothandlermesh@i{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplotsretval}%
+ \pgfplotsplothandlermesh@serialize@logical@coords
+ \edef\pgfplotsplothandlermesh@i{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplots@view@depth:\pgfplotsretval}%
\ifnum\c@pgfplots@scanlineindex>0
\expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotsplothandlermesh@im}%
\expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotsplothandlermesh@i}%
@@ -2077,8 +2365,10 @@
% the pgf@plotstreampoint routine for the first scan line:
\def\pgfplotsplothandlermesh@PIPE@DECODE@matrix@fillscanline#1{%
\pgfplotsplothandlermesh@compute@vertex@depth% <-- this modifies \pgfplotsretval
+ \let\pgfplots@view@depth=\pgfplotsretval
\pgf@process{#1}%
- \edef\pgfplots@loc@TMPa{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplotsretval}%
+ \pgfplotsplothandlermesh@serialize@logical@coords
+ \edef\pgfplots@loc@TMPa{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplots@view@depth:\pgfplotsretval}%
\expandafter\pgfplotsdequepushback\pgfplots@loc@TMPa\to{lastscanline}%
\advance\c@pgfplots@scanlineindex by1
\ifnum\c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@scanlinelength\relax
@@ -2114,8 +2404,10 @@
% 'im == (i-1)'
% 'jm == (j-1)'
\pgfplotsplothandlermesh@compute@vertex@depth% <-- this modifies \pgfplotsretval
+ \let\pgfplots@view@depth=\pgfplotsretval
\pgf@process{#1}%
- \edef\pgfplotsplothandlermesh@i@j{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplotsretval}% FIXME relies on pgfplots macros
+ \pgfplotsplothandlermesh@serialize@logical@coords
+ \edef\pgfplotsplothandlermesh@i@j{{\the\pgf@x}{\the\pgf@y}{\pgfplots@current@point@meta}\pgfplots@view@depth:\pgfplotsretval}% FIXME relies on pgfplots macros
%\message{##\the\c@pgfplots@scanlineindex: prepare rectangle with corner \meaning\pgfplotsplothandlermesh@i@j.}%
\pgfplotsdequepopfront{lastscanline}\to\pgfplotsplothandlermesh@im@j
\expandafter\pgfplotsdequepushback\pgfplotsplothandlermesh@i@j\to{lastscanline}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex
index 724f1546e22..961362a1857 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex
@@ -302,17 +302,109 @@
\def\pgfplotssurveyphaseinputclass{direct}
+\def\pgfplotsplothandlers@tikz@with@snap@to@nearest{%
+ \pgfplothandlerdiscard,%
+ \pgfplothandlermark,%
+ \pgfplothandlermarklisted,%
+ \pgfplothandlerxbar,%
+ \pgfplothandlerybar,%
+ \pgfplothandlerxbarinterval,%
+ \pgfplothandlerybarinterval%
+}%
+
+\def\pgfplotsplothandlers@tikz@std{%
+ \pgfplothandlerdiscard,%
+ \pgfplothandlermark,%
+ \pgfplothandlermarklisted,%
+ \pgfplothandlerxbar,%
+ \pgfplothandlerybar,%
+ \pgfplothandlerxbarinterval,%
+ \pgfplothandlerybarinterval,%
+ \pgfplothandlerlineto,%
+ \pgfplothandlercurveto,%
+ \pgfplothandlerconstantlineto,%
+ \pgfplothandlerconstantlinetomarkright,%
+ \pgfplothandlerconstantlinetomarkmid,%
+ \pgfplothandlerpolarcomb,%
+ \pgfplothandlerjumpmarkmid,%
+ \pgfplothandlerjumpmarkleft,%
+ \pgfplothandlerjumpmarkright%
+}%
+
+% Defines \pgfplotsretval to be the csname for the BACKUP of plot
+% handler #1.
+%
+% For example:
+% \pgfplotsplothandlers@get@tikz@backup@name{\pgfplothandlerlineto}
+% will return \pgfplotsretval={\\pgfplothandlerlineto@tikz}
+% (up to \escapechar)
+\def\pgfplotsplothandlers@get@tikz@backup@name#1{%
+ \begingroup
+ %\escapechar=-1 % drop the leading backslash
+ \expandafter\gdef\expandafter\pgfplotsretval\expandafter{\csname \string#1@tikz\endcsname}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% Takes the CURRENT \tikz@plot@handler and checks if it is an UNPATCHED tikz plot
+% handler. If so, it replaced it with the correct patched version.
+%
+% The motivation is that uf \tikz@plot@handler has been set outside of
+% an axis, it will not reflect the most recent changes (which are only
+% applied within an axis).
+\def\pgfplotsplothandlers@init@map@to@patched@versions{%
+ % iterate through all tikz plot handlers...
+ \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsplothandlers@tikz@std}%
+ \as\pgfplots@loc@TMPa{%
+ % ... get the name of the backup (see \pgfplotsplothandlers@init)
+ \expandafter\pgfplotsplothandlers@get@tikz@backup@name\pgfplots@loc@TMPa
+ \expandafter\ifx\pgfplotsretval\tikz@plot@handler
+ % AH! \tikz@plot@handler is the same as some backup name!
+ % Replace it:
+ \expandafter\let\expandafter\tikz@plot@handler\pgfplots@loc@TMPa
+ \fi
+ }%
+}%
+
\def\pgfplotsplothandlers@init{%
\def\pgfplotsplothandlers@init@##1{%
- \expandafter\def\expandafter##1\expandafter{%
- ##1%
+ \pgfplotsutil@add@to@macro##1{%
\let\pgfplotsplothandlersurveydifflen=\pgfplotsplothandlersurveydifflen@snaptonearest
\let\pgfplotsplothandlersurveypointattime=\pgfplotsplothandlersurveypointattime@snaptonearest
}%
}%
- \pgfplotsutilforeachcommasep{\pgfplothandlerdiscard,\pgfplothandlerxbar,\pgfplothandlerybar,\pgfplothandlerxbarinterval,\pgfplothandlerybarinterval}\as\pgfplots@loc@TMPa{%
+ \def\pgfplotsplothandlers@init@@##1{%
+ % create backup:
+ %
+ % if ##1 = \pgfplothandlerlineto, this defines
+ % \pgfplothandlerlineto@tikz as backup.
+ \pgfplotsplothandlers@get@tikz@backup@name{##1}%
+ \expandafter\let\pgfplotsretval=##1%
+ %
+ %
+ % assign more suitable names:
+ \pgfplotsutil@add@to@macro##1{%
+ \begingroup
+ \escapechar=-1 % drop the leading backslash
+ \edef\pgfplotsplothandlername{\string##1}%
+ \pgfmath@smuggleone\pgfplotsplothandlername
+ \endgroup
+ }%
+ }%
+ % Patch all TikZ plot handlers:
+ % this here also creates backups
+ \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsplothandlers@tikz@std}%
+ \as\pgfplots@loc@TMPa{%
+ \expandafter\pgfplotsplothandlers@init@@\expandafter{\pgfplots@loc@TMPa}%
+ }%
+ %
+ % Patch only selected ones:
+ \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsplothandlers@tikz@with@snap@to@nearest}%
+ \as\pgfplots@loc@TMPa{%
\expandafter\pgfplotsplothandlers@init@\expandafter{\pgfplots@loc@TMPa}%
}%
+ %
+ \pgfplotsplothandlers@init@map@to@patched@versions
}%
% Resets the plot handler routines.
@@ -924,12 +1016,12 @@
%
\E\ifx\E\pgfplots@current@point@x\E\pgfutil@empty
\E\else
- \ifpgfplots@xislinear
- \E\pgfplotscoordmath{x}{parsenumber}{\E\pgfplots@current@point@x}%
- \E\let\E\pgfplots@current@point@x=\E\pgfmathresult
- \else
- % logs are already parsed (in prepare routine)
- \fi
+ % parse for numbers. Note that this might cause
+ % unnecessary overhead of logs (which are already
+ % normalized unless someone provided filters). But do it
+ % anyway to ensure that filters produce valid output.
+ \E\pgfplotscoordmath{x}{parsenumber}{\E\pgfplots@current@point@x}%
+ \E\let\E\pgfplots@current@point@x=\E\pgfmathresult
\E\pgfplotscoordmath{x}{if is bounded}{\E\pgfplots@current@point@x}%
{}%
{% this clears nan, inf and -inf points.
@@ -940,12 +1032,8 @@
%
\E\ifx\E\pgfplots@current@point@y\E\pgfutil@empty
\E\else
- \ifpgfplots@yislinear
- \E\pgfplotscoordmath{y}{parsenumber}{\E\pgfplots@current@point@y}%
- \E\let\E\pgfplots@current@point@y=\E\pgfmathresult
- \else
- % logs are already parsed (in prepare routine)
- \fi
+ \E\pgfplotscoordmath{y}{parsenumber}{\E\pgfplots@current@point@y}%
+ \E\let\E\pgfplots@current@point@y=\E\pgfmathresult
\E\pgfplotscoordmath{y}{if is bounded}{\E\pgfplots@current@point@y}%
{}%
{% this clears nan, inf and -inf points.
@@ -958,12 +1046,8 @@
%
\E\ifx\E\pgfplots@current@point@z\E\pgfutil@empty
\E\else
- \ifpgfplots@zislinear
- \E\pgfplotscoordmath{z}{parsenumber}{\E\pgfplots@current@point@z}%
- \E\let\E\pgfplots@current@point@z=\E\pgfmathresult
- \else
- % logs are already parsed (in prepare routine)
- \fi
+ \E\pgfplotscoordmath{z}{parsenumber}{\E\pgfplots@current@point@z}%
+ \E\let\E\pgfplots@current@point@z=\E\pgfmathresult
\E\pgfplotscoordmath{z}{if is bounded}{\E\pgfplots@current@point@z}%
{}%
{% this clears nan, inf and -inf points.
@@ -1014,7 +1098,7 @@
% for 'v' and 'w' instead of 'u'.
quiver/.code={%
\let\tikz@plot@handler=\pgfplotsplothandlerquiver
- \pgfqkeys{/pgfplots/quiver}{#1}%
+ \pgfqkeys{/pgfplots/quiver}{quiver legend,#1}%
},%
quiver/u value*/.initial=0,
quiver/v value*/.initial=0,
@@ -1022,6 +1106,25 @@
quiver/u value is expr/.initial=0,
quiver/v value is expr/.initial=0,
quiver/w value is expr/.initial=0,
+ quiver/quiver legend/.style={
+ /pgfplots/legend image code/.code={%
+ \draw[x=0.6cm,y=0cm,z=0pt,##1,
+ /pgfplots/quiver/before arrow/.add code={}{
+ % quiver is a pgfplots-specific plot-handler. We need to
+ % fix the additional input data somehow.
+ %
+ % this is an *absolute* coordinate, interpreted
+ % relative to 'x', 'y', 'z'
+ \def\pgfplots@quiver@u{1}%
+ \def\pgfplots@quiver@v{1}%
+ \def\pgfplots@quiver@w{1}%
+ },%
+ ]
+ plot coordinates {
+ (0cm,0cm)
+ };%
+ }%
+ },
quiver/u filter/.code=,
quiver/v filter/.code=,
quiver/w filter/.code=,
@@ -1380,6 +1483,7 @@
\newif\ifpgfplotsplothandlerhistogram@intervals
\newif\ifpgfplotsplothandlerhistogram@cumulative
+\newif\ifpgfplotsplothandlerhistogram@density
\pgfplotsset{
hist/.code={%
\let\tikz@plot@handler=\pgfplotsplothandlerhistogram
@@ -1398,6 +1502,9 @@
hist/intervals=true,
hist/cumulative/.is if=pgfplotsplothandlerhistogram@cumulative,
hist/cumulative/.default=true,
+ hist/density/.is if=pgfplotsplothandlerhistogram@density,
+ hist/density/.default=true,
+ hist/density=false,
hist/handler/.style={/tikz/ybar interval},
hist/symbolic coords/.style={%
/pgfplots/symbolic coords={hist/data}{A,B,C,D,E,F,G,H,I,J},
@@ -1521,15 +1628,52 @@
\expandafter\pgfplotsplothandlersurveyend@hist@loop\pgfplots@hist@data\pgfplots@EOI
\let\pgfplots@hist@data=\relax
%
+
+ % Calculate total count
+ \c@pgf@counta=0
+ \pgfplotsarrayforeachungrouped{pgfp@hist}\as\pgfplots@hist@count{%
+ \advance\c@pgf@counta by\pgfplots@hist@count\relax
+ \def\pgfplots@loc@TMPa{\pgfplotsarrayset{\pgfplotsarrayforeachindex}\of{pgfp@hist}\to}%
+ }%
+ \pgfmathfloatparsenumber{\the\c@pgf@counta}%
+ \let\pgfp@hist@totalcount=\pgfmathresult
+ \pgfmathfloatreciprocal@{\pgfp@hist@totalcount}%
+ \let\pgfp@hist@totalcount@inv=\pgfmathresult
+ %
\ifpgfplotsplothandlerhistogram@cumulative
\c@pgf@counta=0
\pgfplotsarrayforeachungrouped{pgfp@hist}\as\pgfplots@hist@count{%
\advance\c@pgf@counta by\pgfplots@hist@count\relax
\def\pgfplots@loc@TMPa{\pgfplotsarrayset{\pgfplotsarrayforeachindex}\of{pgfp@hist}\to}%
- \expandafter\pgfplots@loc@TMPa\expandafter{\the\c@pgf@counta}%
+ \ifpgfplotsplothandlerhistogram@density
+ \pgfmathfloatparsenumber{\the\c@pgf@counta}%
+ \pgfmathfloatmultiply@{\pgfmathresult}{\pgfp@hist@totalcount@inv}%
+ \pgfmathfloattosci@{\pgfmathresult}%
+ \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}%
+ \else
+ \expandafter\pgfplots@loc@TMPa\expandafter{\the\c@pgf@counta}%
+ \fi
}%
+ \fi%
+ %
+ %% Density histogram
+ % Divide count in each bin by (totalcount*range/bins)
+ \ifpgfplotsplothandlerhistogram@density
+ \ifpgfplotsplothandlerhistogram@cumulative
+ \else
+ \pgfmathfloatmultiply@{\pgfp@hist@totalcount@inv}{\pgfplotsplothandlerhistogram@invh}%
+ \let\pgfp@hist@totalcount@times@h@inv=\pgfmathresult
+ \pgfplotsarrayforeachungrouped{pgfp@hist}\as\pgfplots@hist@count{%
+ \pgfmathfloatparsenumber{\pgfplots@hist@count}%
+ \pgfmathfloatmultiply@{\pgfmathresult}{\pgfp@hist@totalcount@times@h@inv}%
+ \pgfmathfloattosci@{\pgfmathresult}%
+ \def\pgfplots@loc@TMPa{\pgfplotsarrayset{\pgfplotsarrayforeachindex}\of{pgfp@hist}\to}%
+ \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}%
+ }%
+ \fi
\fi
%
+ %% End density histogram
\pgfplots@curplot@threedimfalse
%
\pgfplotsset{/pgfplots/hist/handler}%
@@ -1694,6 +1838,7 @@
%
% Shared parameters:
contour/number/.initial=5,
+ contour/levels/.initial=,
%
%
% Interface to external tools:
@@ -1715,7 +1860,17 @@
contour gnuplot/.style={
contour external={%
scanline marks=required,
- script={unset surface; set cntrparam levels \pgfkeysvalueof{/pgfplots/contour/number}; set contour; set table \"\outfile\"; splot \"\infile\";},
+ script={
+ unset surface;
+ \ifx\thecontourlevels\empty
+ set cntrparam levels \thecontournumber;
+ \else
+ set cntrparam levels discrete \thecontourlevels;
+ \fi
+ set contour;
+ set table \"\outfile\";
+ splot \"\infile\";
+ },
cmd={gnuplot \"\script\"},
#1,%
},
@@ -2311,6 +2466,8 @@
\edef\infile{\pgfplotsplothandlercontourexternal@file.dat}%
\edef\outfile{\pgfplotsplothandlercontourexternal@file.table}%
\edef\script{\pgfplotsplothandlercontourexternal@file.\pgfkeysvalueof{/pgfplots/contour external/script extension}}%
+ \edef\thecontourlevels{\pgfkeysvalueof{/pgfplots/contour/levels}}%
+ \edef\thecontournumber{\pgfkeysvalueof{/pgfplots/contour/number}}%
\immediate\openout\w@pgf@writea=\script
\immediate\write\w@pgf@writea{\pgfkeysvalueof{/pgfplots/contour external/script}}%
\immediate\closeout\w@pgf@writea
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex
index 15e78f6c8fd..b908154f070 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex
@@ -266,6 +266,10 @@
{\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}}%
}{%
% LOG. we need to compute log(zerolevel + current):
+ % FIXME : this is WRONG!
+ % 1. I need 'default' because I need to deal with arbitrary floats.
+ % 2. I need the correct log basis -- which, however, is only
+ % available as argument for coordmath \pgfplots@stacked@dir!
\pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}%
\pgfplotscoordmath{default}{exp}{\pgfmathresult}%
\expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname=\pgfmathresult
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex
index c2a06a6b44c..98cb20753e4 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex
@@ -403,7 +403,7 @@
\pgfplotsscalarproductofvectors
{\pgfplots@loc@vector@to@outside}%
{\pgfpointdiff
- {#2}%
+ {#2\pgf@pos@transform\pgf@x\pgf@y}%
{\pgfplots@loc@ticklabel@bb@corner}}%
\ifdim\pgf@x>\csname pgfplots@maxtickdimen@#1\endcsname\relax
\expandafter\xdef\csname pgfplots@maxtickdimen@#1\endcsname{\the\pgf@x}%
@@ -1051,6 +1051,17 @@
\pgfplots@if{pgfplots@#1majorgrids}{\pgfplots@loop@CONTINUEtrue}{}%
\pgfplots@if{pgfplots@#1minorgrids}{\pgfplots@loop@CONTINUEtrue}{}%
\ifpgfplots@loop@CONTINUE
+ % I support only ONE layer for both, minor and major
+ % grid lines -- no distinction! I am lazy... FIXME
+ \pgfplotsgetlayerforstyle{%
+ every axis grid,%
+ every minor grid,%
+ every axis #1 grid,%
+ every major grid,%
+ every minor #1 grid,%
+ every major #1 grid%
+ }%
+ \pgfplotsonlayer{\pgfplotsretval}{#1 grid style}%
\scope
\pgfplots@drawgridlines@INSTALLCLIP@onorientedsurf#1%
%
@@ -1083,6 +1094,7 @@
}{}%
%
\endscope
+ \endpgfplotsonlayer
\fi
}{}%
\endgroup
@@ -1167,7 +1179,7 @@
\pgfplots@if{pgfplots@shownothingof@\pgfplotspointonorientedsurfaceB}{%
\relax
}{%
- \scope
+ \begingroup
\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{%
\def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{1}%
}{%
@@ -1212,6 +1224,19 @@
\fi
\expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname
\expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname
+ %
+ % There is only ONE layer for both, minor and major
+ % tick lines -- no distinction!
+ \pgfplotsgetlayerforstyle{%
+ every tick,%
+ every minor tick,%
+ every #1 tick,%
+ every major tick,%
+ every minor #1 tick,%
+ every major #1 tick%
+ }%
+ \pgfplotsonlayer{\pgfplotsretval}{#1tick style}%
+ \scope
\pgfplots@drawticklines@INSTALLCLIP@onorientedsurf#1
%
\pgfplots@if{pgfplots@#1minorticks}{%
@@ -1257,6 +1282,8 @@
}{}%
%
\endscope
+ \endpgfplotsonlayer
+ \endgroup
}%
}
@@ -1319,6 +1346,8 @@
\pgfplots@init@scaled@tick@for{#1}%
}{\relax}%
\begingroup
+ \pgfplotsgetlayerforstyle{every tick label,every #1 tick label}%
+ \pgfplotsonlayer\pgfplotsretval{#1tick label style}%
\pgfkeysalso{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}%
\pgfplots@drawticklabels@onorientedsurf@prepareanchor#1%
%
@@ -1342,7 +1371,7 @@
\expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname%
% FIXME : that stuff here does not respect
% '[xyz]tickpos num' keys!
- \pgfplots@tickposchoiceb
+ \pgfplots@tickposchoiceb%<-- backw. compat, is usually empty.
\if r\pgfkeysvalueof{/pgfplots/\pgfplotspointonorientedsurfaceB\space dir/value}%
% special handling for reversed axes.
\pgfmathmultiply{-1}{\pgfplots@tick@offset}%
@@ -1353,18 +1382,22 @@
\else
\if0\pgfplots@ticklabelside
\expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname%
- \pgfplots@tickposchoiceb
+ \pgfplots@tickposchoiceb%<-- backw. compat, is usually empty.
%\pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}%
\edef\pgfplots@tick@offset{-\pgfplots@tick@offset}%
\else
\if1\pgfplots@ticklabelside
\expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname%
- \pgfplots@tickposchoicea
+ \pgfplots@tickposchoicea%<-- backw. compat, is usually empty.
%\pgfmathadd@{\pgfplots@tick@origin}{\pgfplots@tick@offset}%
\else
+ % FIXME : ticklabelside == 2 is, in principle,
+ % a valid choice. It is the case handled with
+ % "if 2 == pgfplots@#1axislinesnum" above,
+ % isn't it!?
\expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname%
% FIXME : is that correct!?
- \pgfplots@tickposchoiceb
+ \pgfplots@tickposchoiceb%<-- backw. compat, is usually empty.
%\pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}%
%\edef\pgfplots@tick@offset{-\pgfplots@tick@offset}%
%
@@ -1395,6 +1428,7 @@
{\pgfplots@ticknum}%
}%
\pgfplots@ticklabel@maxtickdimen@finish{#1}%
+ \endpgfplotsonlayer
\endgroup
\pgfplots@draw@tick@scale@label@for #1%
}%
@@ -1761,11 +1795,11 @@
\H=\MAX
\advance\H by-\MIN
\ifdim\H<0pt \H=-1\H \fi
-%\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.}%
+%\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.^^J}%
\c@pgf@counta=\desirednumticks
\advance\c@pgf@counta by-1 %
\divide\H by\c@pgf@counta
-%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}%
+%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H^^J}%
%
% SEARCH for the NEXT FEASABLE H.
\edef\Hmacro{\pgf@sys@tonumber\H}%
@@ -1779,11 +1813,12 @@
\pgfmathfloatparsenumber{\Hmacro}%
\let\Hmacro=\pgfmathresult
\fi
-%\message{Got T^{-1}(H#1) = \Hmacro}%
+%\message{Got T^{-1}(H#1) = \Hmacro^^J}%
%
\pgfplots@assign@default@tick@foraxis@normalizetickdist#1\Hmacro
\let\Hmacro=\pgfmathresult
%
+%\message{snapped-to-nicest = \Hmacro^^J}%
\aftergroup\pgfplots@isuniformticktrue
% The following code is carried out in floating point
% arithmetics because it requires large data ranges.
@@ -1914,21 +1949,33 @@
% MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by
% construction, but I don't care about this case).
% So: check only the second condition.
+%\message{Got MIN=\pgf@sys@tonumber\MIN; H=\pgf@sys@tonumber\H; MAX=\pgf@sys@tonumber\MAX.^^J}%
\def\pgfplots@tick@returnval@ready{0}%
\pgfplots@tmpa=\MINH
\advance\pgfplots@tmpa by\H
\ifdim\MAX<\pgfplots@tmpa
\pgfplots@if{pgfplots@#1islinear}{%
- \def\pgfplots@tick@returnval@ready{1}%
\begingroup
- \c@pgf@counta=\axisdefaulttryminticks\relax
- \advance\c@pgf@counta by1
- \edef\axisdefaulttryminticks{\the\c@pgf@counta}%
-%\message{**TOO FEW TICK LABELS. RECURSION with try min ticks=\axisdefaulttryminticks.**}%
- % recurse.
- \pgfplots@assign@default@tick@foraxis{#1}%
- \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname
- \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPb\csname pgfplots@tick@distance@#1\endcsname
+ \def\pgfplots@tick@returnval@ready{1}%
+ \pgfutil@ifundefined{pgfplots@assign@default@tick@foraxis@recurselevel}{%
+ \def\pgfplots@assign@default@tick@foraxis@recurselevel{1}%
+ }{%
+ \pgfplotsutil@advancestringcounter\pgfplots@assign@default@tick@foraxis@recurselevel
+ }%
+ \ifnum\pgfplots@assign@default@tick@foraxis@recurselevel<15
+ \c@pgf@counta=\axisdefaulttryminticks\relax
+ \advance\c@pgf@counta by1
+ \edef\axisdefaulttryminticks{\the\c@pgf@counta}%
+%\message{**TOO FEW TICK LABELS FOR #1. RECURSION with try min ticks=\axisdefaulttryminticks.**^^J}%
+ % recurse.
+ \pgfplots@assign@default@tick@foraxis{#1}%
+ \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname
+ \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPb\csname pgfplots@tick@distance@#1\endcsname
+ \else
+ \pgfplots@warning{Tick computation for direction #1 failed; there are always too few tick labels (try min ticks has already been advanced to \axisdefaulttryminticks)}%
+ \def\pgfplots@tick@returnval@ready{0}%
+ \fi
+ \pgfmath@smuggleone\pgfplots@tick@returnval@ready
\endgroup
}{%
% Case logarithmic axes and too few ticks.
@@ -2025,7 +2072,7 @@
%
% Example:
% \pgfmathfloatparsenumber{x}{1234}
-% \pgfplots@assign@default@tick@foraxis@normalizetickdist\pgfmathresult
+% \pgfplots@assign@default@tick@foraxis@normalizetickdist{x}{\pgfmathresult}
% \pgfmathfloatotfixed\pgfmathresult
% -->
%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def
index c94f05e585e..e8e9a4568a4 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def
+++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgflibrarypgfplots.surfshading.pgfsys-pdftex.def
@@ -25,7 +25,6 @@
%
%--------------------------------------------
-
% The lowlevel call for surface shadings. It uses a pattern type 2
% dictionary as fill color and has thus several things to do. This is
% a little bit more complicated than using the '/sh' operator (as
@@ -54,7 +53,7 @@
\pgfusepath{fill}%
\endpgfpicture
}%
- \pdfxform resources{
+ \immediate\pdfxform resources{
/Pattern << \pgfplots@glob@TMPa >> % write the pattern resource dictionary
}\pgfutil@tempboxa
\leavevmode
@@ -71,7 +70,15 @@
%
%
\def\pgfplotssys@do@surfshading@fillpaths#1{%
- \immediate\pdfobj stream attr {%
+ \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty
+ \else
+ % Unfortunately, there is a bug in pdftex/luatex: if we
+ % provide a /Filter as attr, and pdftex compresses the stream,
+ % it overwrites the /Filter argument -- and the viewer cannot
+ % decode the stream. We have to deactivate compression here:
+ \pdfcompresslevel=0
+ \fi
+ \def\pgfplots@loc@TMPa{%
% stream length will be computed automatically
/ShadingType \pgfplotslibrarysurf@type\space
/BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space
@@ -88,10 +95,38 @@
\else
/Filter /\pgfplotslibrarysurf@filter@decode\space
\fi
- } {%
- \pgfplotslibrarysurf@binarystream
}%
- \edef\pgfplots@loc@TMPa{\the\pdflastobj}%
+ %
+ % \pgfplots@loc@TMPb := final boolean luaBinaryEncoding;
+ \pgfutil@ifundefined{directlua}{%
+ \def\pgfplots@loc@TMPb{0}%
+ }{%
+ \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty
+ % ah - we have binary encoding (the standard).
+ \def\pgfplots@loc@TMPb{1}%
+ \else
+ % ah - base 16 ASCII encoding:
+ \def\pgfplots@loc@TMPb{0}%
+ \fi
+ }%
+ \if0\pgfplots@loc@TMPb
+ % no lua binary encoding. Use standard pdftex operations:
+ \immediate\pdfobj stream attr {%
+ \pgfplots@loc@TMPa
+ } {%
+ \pgfplotslibrarysurf@binarystream
+ }%
+ \edef\pgfplots@loc@TMPa{\the\pdflastobj}%
+ \else
+ % special handling for luatex binary encoding (see docs for \pgfplotsbinarytoluabinary):
+ \pgfplotsbinarytoluabinary{\pgfplotslibrarysurf@binarystream}%
+ \edef\pgfplots@loc@TMPa{%
+ \directlua{%
+ tex.print(pdf.immediateobj(\pgfplotsDQ stream\pgfplotsDQ , pgfplotsretval, \pgfplotsDQ \pgfplots@loc@TMPa\pgfplotsDQ ));
+ pgfplotsretval=nil;
+ }%
+ }%
+ \fi
\pgf@process{\pgfpointdiff{\pgfplotslibrarysurf@corner@sw}{\pgfkeysvalueof{/pgfplots/surf shading/anchor}}}%
\pgf@sys@bp@correct\pgf@x%
\pgf@sys@bp@correct\pgf@y%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex b/Master/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex
index cc79af2d013..f4bd3054304 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex
@@ -23,8 +23,62 @@
%
%--------------------------------------------
+% NOTE: tex4ht support is lousy. For example, \tikz \node {$10^{-6}$};
+% will already break -- because SVG does not support the html tag
+% &minus; produced by tex4ht (and TikZ apparently does not know how to
+% escape it somehow).
\def\pgfplots@sys@beforenode{%
\pgfkeysifdefined{/tikz/tex4ht node/escape/.@cmd}{%
- \tikzset{tex4ht node/escape=true}%
+ \ifpgfplots@has@cell@picture
+ \tikzset{tex4ht node/escape=true}%
+ \pgfplots@warning{ATTENTION: you may want to use '\string\pgfplotsset{cell picture=false}' in your preamble. Otherwise, tex4ht will produce TWO SVG files per plot.^^J}%
+ \fi
}{}%
}%
+
+% see compat/show suggested version
+\newif\ifpgfplots@show@suggested@version
+\pgfplots@show@suggested@versiontrue
+
+\def\pgfplots@show@suggested@compat@value{%
+ \ifpgfplots@show@suggested@version
+ \begingroup
+ \pgfkeysgetvalue{/pgfplots/compat/current}\current
+ \pgfkeysgetvalue{/pgfplots/compat/mostrecent}\mostrecent
+ %
+ \def\b@isnewest{0}%
+ \def\b@shouldupgrade{0}%
+ \ifx\current\mostrecent
+ \def\b@isnewest{1}%
+ \else
+ \def\pgfplots@loc@TMPa{newest}%
+ \ifx\current\pgfplots@loc@TMPa
+ \def\b@isnewest{1}%
+ \else
+ \expandafter\pgfplotsutilifstringequal\expandafter{\current}{pre 1.3}{%
+ \def\b@shouldupgrade{1}%
+ }{}%
+ \expandafter\pgfplotsutilifstringequal\expandafter{\current}{default}{%
+ \def\b@shouldupgrade{1}%
+ }{}%
+ \fi
+ \fi
+ \if1\b@isnewest
+ \pgfplots@message{Package pgfplots notification 'compat/show suggested version=true': document has been generated with the most recent feature set (\string\pgfplotsset{compat=\mostrecent}).^^J}%
+ \else
+ \if1\b@shouldupgrade
+ \pgfplots@warning{running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \string\pgfplotsset{compat=\mostrecent} into your preamble.^^J}%
+ \else
+ \pgfplots@message{Package pgfplots notification 'compat/show suggested version=true': you might benefit from \string\pgfplotsset{compat=\mostrecent} (current compat level: \current).^^J}%
+ \fi
+ \fi
+ \endgroup
+ \fi
+}
+
+\pgfutil@ifundefined{AtBeginDocument}{%
+}{%
+ \AtBeginDocument{%
+ \pgfplots@show@suggested@compat@value
+ }%
+}%
diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
index df3f66d0dd7..c9baffcb6dd 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex
@@ -35,295 +35,6 @@
\edef\pgfplotsbinaryatcode{\the\catcode`\@ }
\catcode`\@=11
-\begingroup
-% prepare ONE-BYTE conversion [0-255] -> binary character:
-\count0=0
-\countdef\counter=0
-\catcode`\^^00=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^00}\advance\counter by1
-\catcode`\^^01=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^01}\advance\counter by1
-\catcode`\^^02=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^02}\advance\counter by1
-\catcode`\^^03=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^03}\advance\counter by1
-\catcode`\^^04=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^04}\advance\counter by1
-\catcode`\^^05=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^05}\advance\counter by1
-\catcode`\^^06=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^06}\advance\counter by1
-\catcode`\^^07=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^07}\advance\counter by1
-\catcode`\^^08=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^08}\advance\counter by1
-\begingroup
-\catcode`\^^09=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^09}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^0a=11\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0a}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^0b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0b}\endgroup\advance\counter by1
-\catcode`\^^0c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0c}\advance\counter by1
-\begingroup
-\catcode`\^^0d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0d}\endgroup\advance\counter by1
-\catcode`\^^0e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0e}\advance\counter by1
-\catcode`\^^0f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0f}\advance\counter by1
-\catcode`\^^10=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^10}\advance\counter by1
-\catcode`\^^11=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^11}\advance\counter by1
-\catcode`\^^12=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^12}\advance\counter by1
-\catcode`\^^13=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^13}\advance\counter by1
-\catcode`\^^14=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^14}\advance\counter by1
-\catcode`\^^15=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^15}\advance\counter by1
-\catcode`\^^16=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^16}\advance\counter by1
-\catcode`\^^17=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^17}\advance\counter by1
-\catcode`\^^18=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^18}\advance\counter by1
-\catcode`\^^19=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^19}\advance\counter by1
-\catcode`\^^1a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1a}\advance\counter by1
-\catcode`\^^1b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1b}\advance\counter by1
-\catcode`\^^1c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1c}\advance\counter by1
-\catcode`\^^1d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1d}\advance\counter by1
-\catcode`\^^1e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1e}\advance\counter by1
-\catcode`\^^1f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1f}\advance\counter by1
-\begingroup
-\catcode`\^^20=11^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\counter^^I\endcsname{^^20}\endgroup\advance\counter by1
-\catcode`\^^21=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^21}\advance\counter by1
-\catcode`\^^22=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^22}\advance\counter by1
-\catcode`\^^23=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^23}\advance\counter by1
-\catcode`\^^24=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^24}\advance\counter by1
-\catcode`\^^25=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^25}\advance\counter by1
-\catcode`\^^26=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^26}\advance\counter by1
-\catcode`\^^27=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^27}\advance\counter by1
-\catcode`\^^28=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^28}\advance\counter by1
-\catcode`\^^29=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^29}\advance\counter by1
-\catcode`\^^2a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2a}\advance\counter by1
-\catcode`\^^2b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2b}\advance\counter by1
-\catcode`\^^2c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2c}\advance\counter by1
-\catcode`\^^2d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2d}\advance\counter by1
-\catcode`\^^2e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2e}\advance\counter by1
-\catcode`\^^2f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2f}\advance\counter by1
-\begingroup
-\catcode`\^^30=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^30}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^31=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^31}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^32=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^32}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^33=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^33}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^34=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^34}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^35=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^35}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^36=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^36}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^37=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^37}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^38=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^38}\endgroup\advance\counter by1
-\begingroup
-\catcode`\^^39=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^39}\endgroup\advance\counter by1
-\catcode`\^^3a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3a}\advance\counter by1
-\catcode`\^^3b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3b}\advance\counter by1
-\catcode`\^^3c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3c}\advance\counter by1
-\begingroup
-\catcode`\^^3d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3d}\endgroup\advance\counter by1
-\catcode`\^^3e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3e}\advance\counter by1
-\catcode`\^^3f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3f}\advance\counter by1
-\catcode`\^^40=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^40}\advance\counter by1
-\catcode`\^^41=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^41}\advance\counter by1
-\catcode`\^^42=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^42}\advance\counter by1
-\catcode`\^^43=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^43}\advance\counter by1
-\catcode`\^^44=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^44}\advance\counter by1
-\catcode`\^^45=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^45}\advance\counter by1
-\catcode`\^^46=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^46}\advance\counter by1
-\catcode`\^^47=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^47}\advance\counter by1
-\catcode`\^^48=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^48}\advance\counter by1
-\catcode`\^^49=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^49}\advance\counter by1
-\catcode`\^^4a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4a}\advance\counter by1
-\catcode`\^^4b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4b}\advance\counter by1
-\catcode`\^^4c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4c}\advance\counter by1
-\catcode`\^^4d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4d}\advance\counter by1
-\catcode`\^^4e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4e}\advance\counter by1
-\catcode`\^^4f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4f}\advance\counter by1
-\catcode`\^^50=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^50}\advance\counter by1
-\catcode`\^^51=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^51}\advance\counter by1
-\catcode`\^^52=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^52}\advance\counter by1
-\catcode`\^^53=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^53}\advance\counter by1
-\catcode`\^^54=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^54}\advance\counter by1
-\catcode`\^^55=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^55}\advance\counter by1
-\catcode`\^^56=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^56}\advance\counter by1
-\catcode`\^^57=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^57}\advance\counter by1
-\catcode`\^^58=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^58}\advance\counter by1
-\catcode`\^^59=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^59}\advance\counter by1
-\catcode`\^^5a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5a}\advance\counter by1
-\catcode`\^^5b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5b}\advance\counter by1
-\begingroup
-\catcode`\|=0
-\catcode`\\=11 |expandafter|xdef|csname pgfp@bin@|the|counter|endcsname{^^5c}|endgroup \advance\counter by1
-\catcode`\^^5d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5d}\advance\counter by1
-\begingroup
-\catcode`\^^5e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^}\endgroup\advance\counter by1
-\catcode`\^^5f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5f}\advance\counter by1
-\begingroup
-\catcode`\^^60=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^60}\endgroup\advance\counter by1
-\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^61}\advance\counter by1
-\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^62}\advance\counter by1
-\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^63}\advance\counter by1
-\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^64}\advance\counter by1
-\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^65}\advance\counter by1
-\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^66}\advance\counter by1
-\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^67}\advance\counter by1
-\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^68}\advance\counter by1
-\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^69}\advance\counter by1
-\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6a}\advance\counter by1
-\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6b}\advance\counter by1
-\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6c}\advance\counter by1
-\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6d}\advance\counter by1
-\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6e}\advance\counter by1
-\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6f}\advance\counter by1
-\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^70}\advance\counter by1
-\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^71}\advance\counter by1
-\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^72}\advance\counter by1
-\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^73}\advance\counter by1
-\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^74}\advance\counter by1
-\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^75}\advance\counter by1
-\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^76}\advance\counter by1
-\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^77}\advance\counter by1
-\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^78}\advance\counter by1
-\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^79}\advance\counter by1
-\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7a}\advance\counter by1
-\begingroup
-\catcode`\q=1
-\catcode`\^^7b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname q^^7b}\endgroup\advance\counter by1
-\catcode`\^^7c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7c}\advance\counter by1
-\begingroup
-\catcode`\q=2
-\catcode`\^^7d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7dq\endgroup\advance\counter by1
-\catcode`\^^7e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7e}\advance\counter by1
-\catcode`\^^7f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7f}\advance\counter by1
-\catcode`\^^80=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^80}\advance\counter by1
-\catcode`\^^81=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^81}\advance\counter by1
-\catcode`\^^82=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^82}\advance\counter by1
-\catcode`\^^83=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^83}\advance\counter by1
-\catcode`\^^84=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^84}\advance\counter by1
-\catcode`\^^85=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^85}\advance\counter by1
-\catcode`\^^86=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^86}\advance\counter by1
-\catcode`\^^87=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^87}\advance\counter by1
-\catcode`\^^88=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^88}\advance\counter by1
-\catcode`\^^89=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^89}\advance\counter by1
-\catcode`\^^8a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8a}\advance\counter by1
-\catcode`\^^8b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8b}\advance\counter by1
-\catcode`\^^8c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8c}\advance\counter by1
-\catcode`\^^8d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8d}\advance\counter by1
-\catcode`\^^8e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8e}\advance\counter by1
-\catcode`\^^8f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8f}\advance\counter by1
-\catcode`\^^90=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^90}\advance\counter by1
-\catcode`\^^91=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^91}\advance\counter by1
-\catcode`\^^92=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^92}\advance\counter by1
-\catcode`\^^93=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^93}\advance\counter by1
-\catcode`\^^94=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^94}\advance\counter by1
-\catcode`\^^95=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^95}\advance\counter by1
-\catcode`\^^96=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^96}\advance\counter by1
-\catcode`\^^97=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^97}\advance\counter by1
-\catcode`\^^98=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^98}\advance\counter by1
-\catcode`\^^99=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^99}\advance\counter by1
-\catcode`\^^9a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9a}\advance\counter by1
-\catcode`\^^9b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9b}\advance\counter by1
-\catcode`\^^9c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9c}\advance\counter by1
-\catcode`\^^9d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9d}\advance\counter by1
-\catcode`\^^9e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9e}\advance\counter by1
-\catcode`\^^9f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9f}\advance\counter by1
-\catcode`\^^a0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a0}\advance\counter by1
-\catcode`\^^a1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a1}\advance\counter by1
-\catcode`\^^a2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a2}\advance\counter by1
-\catcode`\^^a3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a3}\advance\counter by1
-\catcode`\^^a4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a4}\advance\counter by1
-\catcode`\^^a5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a5}\advance\counter by1
-\catcode`\^^a6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a6}\advance\counter by1
-\catcode`\^^a7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a7}\advance\counter by1
-\catcode`\^^a8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a8}\advance\counter by1
-\catcode`\^^a9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a9}\advance\counter by1
-\catcode`\^^aa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^aa}\advance\counter by1
-\catcode`\^^ab=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ab}\advance\counter by1
-\catcode`\^^ac=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ac}\advance\counter by1
-\catcode`\^^ad=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ad}\advance\counter by1
-\catcode`\^^ae=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ae}\advance\counter by1
-\catcode`\^^af=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^af}\advance\counter by1
-\catcode`\^^b0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b0}\advance\counter by1
-\catcode`\^^b1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b1}\advance\counter by1
-\catcode`\^^b2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b2}\advance\counter by1
-\catcode`\^^b3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b3}\advance\counter by1
-\catcode`\^^b4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b4}\advance\counter by1
-\catcode`\^^b5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b5}\advance\counter by1
-\catcode`\^^b6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b6}\advance\counter by1
-\catcode`\^^b7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b7}\advance\counter by1
-\catcode`\^^b8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b8}\advance\counter by1
-\catcode`\^^b9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b9}\advance\counter by1
-\catcode`\^^ba=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ba}\advance\counter by1
-\catcode`\^^bb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bb}\advance\counter by1
-\catcode`\^^bc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bc}\advance\counter by1
-\catcode`\^^bd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bd}\advance\counter by1
-\catcode`\^^be=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^be}\advance\counter by1
-\catcode`\^^bf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bf}\advance\counter by1
-\catcode`\^^c0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c0}\advance\counter by1
-\catcode`\^^c1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c1}\advance\counter by1
-\catcode`\^^c2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c2}\advance\counter by1
-\catcode`\^^c3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c3}\advance\counter by1
-\catcode`\^^c4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c4}\advance\counter by1
-\catcode`\^^c5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c5}\advance\counter by1
-\catcode`\^^c6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c6}\advance\counter by1
-\catcode`\^^c7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c7}\advance\counter by1
-\catcode`\^^c8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c8}\advance\counter by1
-\catcode`\^^c9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c9}\advance\counter by1
-\catcode`\^^ca=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ca}\advance\counter by1
-\catcode`\^^cb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cb}\advance\counter by1
-\catcode`\^^cc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cc}\advance\counter by1
-\catcode`\^^cd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cd}\advance\counter by1
-\catcode`\^^ce=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ce}\advance\counter by1
-\catcode`\^^cf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cf}\advance\counter by1
-\catcode`\^^d0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d0}\advance\counter by1
-\catcode`\^^d1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d1}\advance\counter by1
-\catcode`\^^d2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d2}\advance\counter by1
-\catcode`\^^d3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d3}\advance\counter by1
-\catcode`\^^d4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d4}\advance\counter by1
-\catcode`\^^d5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d5}\advance\counter by1
-\catcode`\^^d6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d6}\advance\counter by1
-\catcode`\^^d7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d7}\advance\counter by1
-\catcode`\^^d8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d8}\advance\counter by1
-\catcode`\^^d9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d9}\advance\counter by1
-\catcode`\^^da=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^da}\advance\counter by1
-\catcode`\^^db=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^db}\advance\counter by1
-\catcode`\^^dc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dc}\advance\counter by1
-\catcode`\^^dd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dd}\advance\counter by1
-\catcode`\^^de=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^de}\advance\counter by1
-\catcode`\^^df=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^df}\advance\counter by1
-\catcode`\^^e0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e0}\advance\counter by1
-\catcode`\^^e1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e1}\advance\counter by1
-\catcode`\^^e2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e2}\advance\counter by1
-\catcode`\^^e3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e3}\advance\counter by1
-\catcode`\^^e4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e4}\advance\counter by1
-\catcode`\^^e5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e5}\advance\counter by1
-\catcode`\^^e6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e6}\advance\counter by1
-\catcode`\^^e7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e7}\advance\counter by1
-\catcode`\^^e8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e8}\advance\counter by1
-\catcode`\^^e9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e9}\advance\counter by1
-\catcode`\^^ea=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ea}\advance\counter by1
-\catcode`\^^eb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^eb}\advance\counter by1
-\catcode`\^^ec=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ec}\advance\counter by1
-\catcode`\^^ed=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ed}\advance\counter by1
-\catcode`\^^ee=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ee}\advance\counter by1
-\catcode`\^^ef=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ef}\advance\counter by1
-\catcode`\^^f0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f0}\advance\counter by1
-\catcode`\^^f1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f1}\advance\counter by1
-\catcode`\^^f2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f2}\advance\counter by1
-\catcode`\^^f3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f3}\advance\counter by1
-\catcode`\^^f4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f4}\advance\counter by1
-\catcode`\^^f5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f5}\advance\counter by1
-\catcode`\^^f6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f6}\advance\counter by1
-\catcode`\^^f7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f7}\advance\counter by1
-\catcode`\^^f8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f8}\advance\counter by1
-\catcode`\^^f9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f9}\advance\counter by1
-\catcode`\^^fa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fa}\advance\counter by1
-\catcode`\^^fb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fb}\advance\counter by1
-\catcode`\^^fc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fc}\advance\counter by1
-\catcode`\^^fd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fd}\advance\counter by1
-\catcode`\^^fe=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fe}\advance\counter by1
-\catcode`\^^ff=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ff}\advance\counter by1
-\ifnum\counter=256
-\else
- \pgfplots@error{Internal logic Error: initialisation failed. I have only \the\counter\space bytes initialised.}
-\fi
-\endgroup
% Returns a single character, which has the
% binary ASCII code '#1', with catcode 11.
@@ -334,6 +45,35 @@
% but can't be used inside of \edef (it is not expandable) whereas
% \pgfplotscharno is.
\def\pgfplotscharno#1{\csname pgfp@bin@#1\endcsname}%
+\let\pgfplotscharno@bincatcode=\pgfplotscharno
+
+\def\pgfplotscharno@lualatex#1{#1,}
+
+\input pgfplotsbinary.data.code.tex
+
+% Defines the LUA (!) value pgfplotsretval to be a binary string
+% containing the pgfplots binary value #1.
+%
+% #1 a pgfplots binary value collected with \pgfplotscharno.
+% More precisely, it should be a comma-separated sequence of numbers
+% of the form '0,255,2,128,' (can be terminated by comma). It will be
+% converted to the respective binary numbers 0x0, 0xff, 0x02,..
+%
+% example:
+% \pgfplotsbinarytoluabinary{0, 255,2,128}
+% \directlua{
+% pdf.immediateobj{"stream", pgfplotsretval,"/DataWithBinaryStream"}
+% }
+\def\pgfplotsbinarytoluabinary#1{%
+ % lualatex does not support binary chars as pdftex does - so we have to resort to LUA
+ % methods. The idea is to use
+ % string.char(1,2,3) which results in a binary string with chars 0x01, 0x02, 0x03 etc.
+ % I only need to get the integer numbers. To this end, I patch \pgfplotscharno
+ % and create the binary string here:
+ \directlua{%
+ pgfplotsretval = pgfplotsGetLuaBinaryStringFromCharIndices({#1});
+ }%
+}%
% Defines \pgfplotsretval to be the ASCII character for #1, with
% catcode 11.
@@ -351,7 +91,7 @@
\def\pgfplotsgetchar#1{%
\begingroup
\count0=#1\relax
- \edef\pgfplotsretval{\csname pgfp@bin@\the\count0 \endcsname}%
+ \edef\pgfplotsretval{\pgfplotscharno{\the\count0 }}%
\pgfmath@smuggleone\pgfplotsretval
\endgroup
}%
@@ -480,8 +220,27 @@
%
% The standard method - it results in binary encoded numbers.
binary encoding/.code={%
- \expandafter\let\expandafter\pgfplotsbinary@ZERO\csname pgfp@bin@0\endcsname
- \expandafter\let\expandafter\pgfplotsbinary@ZERO@LINEARMAP\csname pgfp@bin@128\endcsname
+ \pgfutil@ifundefined{directlua}{%
+ \let\pgfplotscharno=\pgfplotscharno@bincatcode
+ }{%
+ % Ah - we use LuaTeX!
+ % At the time of this writing, LUA does not allow binary output which has been
+ % created by means of catcode modifications & TeX string concatenation.
+ % binary output in LUA needs to be (re)implemented in LUA (see inline code
+ % comments below).
+ %
+ % There are two possible work-arounds:
+ % (a) Base64 encoding
+ % (b) binary encoding using special LUA handling.
+ % This is what I do. Set the 'encode filter' such that it reinitializes the encoder:
+ % we patch \pgfplotscharno with a special routine which collects
+ % only the integer indices:
+ \let\pgfplotscharno=\pgfplotscharno@lualatex
+ % later, the user has to convert this list into a binary lua
+ % string before he can use it. See \pgfplotsbinarytoluabinary
+ }%
+ \edef\pgfplotsbinary@ZERO{\pgfplotscharno0}%
+ \edef\pgfplotsbinary@ZERO@LINEARMAP{\pgfplotscharno{128}}%
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
\def\pgfplotsbinary@basis{256}%
\let\pgfplotsbinary@hook=\relax
@@ -489,7 +248,7 @@
\ifnum\c@pgfplotsbin@byteno=0
\advance\c@pgfplotsbin@input by128
\ifnum\c@pgfplotsbin@input>255
- \pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
+ \pgfplotsbinary@hook@signed@linearmap@error
\fi
\fi
}%
@@ -509,8 +268,9 @@
% Please note that 'bytes' sets the number of binary bytes - the
% actual encoding length is exactly twice as large.
ASCIIHexEncode/.code={%
- \expandafter\let\expandafter\pgfplotsbinary@ZERO\csname pgfp@bin@48\endcsname
- \expandafter\let\expandafter\pgfplotsbinary@ZERO@LINEARMAP\csname pgfp@bin@56\endcsname
+ \let\pgfplotscharno=\pgfplotscharno@bincatcode
+ \edef\pgfplotsbinary@ZERO{\pgfplotscharno{48}}%
+ \edef\pgfplotsbinary@ZERO@LINEARMAP{\pgfplotscharno{56}}%
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
\pgfkeysalso{/pgfplots/bin/ordering/big endian}%
\def\pgfplotsbinary@basis{16}%
@@ -526,7 +286,7 @@
\ifnum\c@pgfplotsbin@byteno=0
\advance\c@pgfplotsbin@input by8
\ifnum\c@pgfplotsbin@input>16
- \pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
+ \pgfplotsbinary@hook@signed@linearmap@error
\fi
\fi
\pgfplotsbinary@hook@hex
@@ -558,8 +318,9 @@
% @ATTENTION bytes is ALWAYS 4, regardless of the setting of
% 'bytes'!
ASCII85Encode/.code={%
- \expandafter\let\expandafter\pgfplotsbinary@ZERO\csname pgfp@bin@33\endcsname
- \expandafter\let\expandafter\pgfplotsbinary@ZERO@LINEARMAP\csname pgfp@bin@42\endcsname
+ \let\pgfplotscharno=\pgfplotscharno@bincatcode
+ \edef\pgfplotsbinary@ZERO{\pgfplotscharno{33}}%
+ \edef\pgfplotsbinary@ZERO@LINEARMAP{\pgfplotscharno{42}}%
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
\pgfkeysalso{/pgfplots/bin/ordering/big endian}%
\edef\pgfplotsbinary@ASCII@specialzero{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
@@ -579,7 +340,7 @@
\ifnum\c@pgfplotsbin@byteno=0
\advance\c@pgfplotsbin@input by42
\ifnum\c@pgfplotsbin@input>85
- \pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
+ \pgfplotsbinary@hook@signed@linearmap@error
\fi
\fi
}%
@@ -603,7 +364,7 @@
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
\def\pgfplotsbinary@ZERO@LINEARMAP{[Pad-128]}%
\def\pgfplotsbinary@apphighorderbytes##1{%
- \pgfutil@ifnextchar\csname{%
+ \pgfutil@ifnextchar\pgfplotscharno{%
\pgfplotsbinary@apphighorderbytes@DEBUG@csname
}{%
\pgfplotsbinary@apphighorderbytes@DEBUG@normal
@@ -633,8 +394,11 @@
}
+\def\pgfplotsbinary@hook@signed@linearmap@error{%
+ \pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
+}%
-\def\pgfplotsbinary@apphighorderbytes@DEBUG@csname \csname pgfp@bin@#1\endcsname\relax{%
+\def\pgfplotsbinary@apphighorderbytes@DEBUG@csname\pgfplotscharno#1\relax{%
\pgfplotsbinary@apphighorderbytes@ORIG{[#1]}%
}%
\def\pgfplotsbinary@apphighorderbytes@DEBUG@normal#1\relax{%
@@ -678,7 +442,7 @@
\advance\c@pgfplotsbin@input by -\c@pgfplotsbin@tmpa\relax
\advance\c@pgfplotsbin@byteno by-1
\pgfplotsbinary@hook% hooks for modifications.
- \pgfplotsbinary@apphighorderbytes{\csname pgfp@bin@\the\c@pgfplotsbin@input\endcsname}%
+ \pgfplotsbinary@apphighorderbytes{\pgfplotscharno{\the\c@pgfplotsbin@input}}%
\c@pgfplotsbin@input=\c@pgfplotsbin@tmpb
%\message{RESULT SO FAR byte no \the\c@pgfplotsbin@byteno: \pgfplotsbinaryresult}%
\expandafter\pgfplotsbinaryencode@badic@unsigned@
diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.data.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.data.code.tex
new file mode 100644
index 00000000000..6483daf68f3
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.data.code.tex
@@ -0,0 +1,291 @@
+\begingroup
+% prepare ONE-BYTE conversion [0-255] -> binary character:
+\count0=0
+\countdef\counter=0
+\catcode`\^^00=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^00}\advance\counter by1
+\catcode`\^^01=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^01}\advance\counter by1
+\catcode`\^^02=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^02}\advance\counter by1
+\catcode`\^^03=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^03}\advance\counter by1
+\catcode`\^^04=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^04}\advance\counter by1
+\catcode`\^^05=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^05}\advance\counter by1
+\catcode`\^^06=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^06}\advance\counter by1
+\catcode`\^^07=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^07}\advance\counter by1
+\catcode`\^^08=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^08}\advance\counter by1
+\begingroup
+\catcode`\^^09=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^09}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^0a=11\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0a}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^0b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0b}\endgroup\advance\counter by1
+\catcode`\^^0c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0c}\advance\counter by1
+\begingroup
+\catcode`\^^0d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0d}\endgroup\advance\counter by1
+\catcode`\^^0e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0e}\advance\counter by1
+\catcode`\^^0f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0f}\advance\counter by1
+\catcode`\^^10=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^10}\advance\counter by1
+\catcode`\^^11=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^11}\advance\counter by1
+\catcode`\^^12=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^12}\advance\counter by1
+\catcode`\^^13=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^13}\advance\counter by1
+\catcode`\^^14=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^14}\advance\counter by1
+\catcode`\^^15=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^15}\advance\counter by1
+\catcode`\^^16=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^16}\advance\counter by1
+\catcode`\^^17=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^17}\advance\counter by1
+\catcode`\^^18=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^18}\advance\counter by1
+\catcode`\^^19=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^19}\advance\counter by1
+\catcode`\^^1a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1a}\advance\counter by1
+\catcode`\^^1b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1b}\advance\counter by1
+\catcode`\^^1c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1c}\advance\counter by1
+\catcode`\^^1d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1d}\advance\counter by1
+\catcode`\^^1e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1e}\advance\counter by1
+\catcode`\^^1f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1f}\advance\counter by1
+\begingroup
+\catcode`\^^20=11^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\counter^^I\endcsname{^^20}\endgroup\advance\counter by1
+\catcode`\^^21=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^21}\advance\counter by1
+\catcode`\^^22=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^22}\advance\counter by1
+\catcode`\^^23=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^23}\advance\counter by1
+\catcode`\^^24=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^24}\advance\counter by1
+\catcode`\^^25=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^25}\advance\counter by1
+\catcode`\^^26=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^26}\advance\counter by1
+\catcode`\^^27=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^27}\advance\counter by1
+\catcode`\^^28=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^28}\advance\counter by1
+\catcode`\^^29=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^29}\advance\counter by1
+\catcode`\^^2a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2a}\advance\counter by1
+\catcode`\^^2b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2b}\advance\counter by1
+\catcode`\^^2c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2c}\advance\counter by1
+\catcode`\^^2d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2d}\advance\counter by1
+\catcode`\^^2e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2e}\advance\counter by1
+\catcode`\^^2f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2f}\advance\counter by1
+\begingroup
+\catcode`\^^30=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^30}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^31=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^31}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^32=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^32}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^33=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^33}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^34=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^34}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^35=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^35}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^36=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^36}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^37=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^37}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^38=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^38}\endgroup\advance\counter by1
+\begingroup
+\catcode`\^^39=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^39}\endgroup\advance\counter by1
+\catcode`\^^3a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3a}\advance\counter by1
+\catcode`\^^3b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3b}\advance\counter by1
+\catcode`\^^3c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3c}\advance\counter by1
+\begingroup
+\catcode`\^^3d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3d}\endgroup\advance\counter by1
+\catcode`\^^3e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3e}\advance\counter by1
+\catcode`\^^3f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3f}\advance\counter by1
+\catcode`\^^40=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^40}\advance\counter by1
+\catcode`\^^41=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^41}\advance\counter by1
+\catcode`\^^42=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^42}\advance\counter by1
+\catcode`\^^43=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^43}\advance\counter by1
+\catcode`\^^44=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^44}\advance\counter by1
+\catcode`\^^45=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^45}\advance\counter by1
+\catcode`\^^46=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^46}\advance\counter by1
+\catcode`\^^47=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^47}\advance\counter by1
+\catcode`\^^48=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^48}\advance\counter by1
+\catcode`\^^49=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^49}\advance\counter by1
+\catcode`\^^4a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4a}\advance\counter by1
+\catcode`\^^4b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4b}\advance\counter by1
+\catcode`\^^4c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4c}\advance\counter by1
+\catcode`\^^4d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4d}\advance\counter by1
+\catcode`\^^4e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4e}\advance\counter by1
+\catcode`\^^4f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4f}\advance\counter by1
+\catcode`\^^50=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^50}\advance\counter by1
+\catcode`\^^51=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^51}\advance\counter by1
+\catcode`\^^52=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^52}\advance\counter by1
+\catcode`\^^53=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^53}\advance\counter by1
+\catcode`\^^54=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^54}\advance\counter by1
+\catcode`\^^55=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^55}\advance\counter by1
+\catcode`\^^56=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^56}\advance\counter by1
+\catcode`\^^57=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^57}\advance\counter by1
+\catcode`\^^58=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^58}\advance\counter by1
+\catcode`\^^59=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^59}\advance\counter by1
+\catcode`\^^5a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5a}\advance\counter by1
+\catcode`\^^5b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5b}\advance\counter by1
+\begingroup
+\catcode`\|=0
+\catcode`\\=11 |expandafter|xdef|csname pgfp@bin@|the|counter|endcsname{^^5c}|endgroup \advance\counter by1
+\catcode`\^^5d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5d}\advance\counter by1
+\begingroup
+\catcode`\^^5e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^}\endgroup\advance\counter by1
+\catcode`\^^5f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5f}\advance\counter by1
+\begingroup
+\catcode`\^^60=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^60}\endgroup\advance\counter by1
+\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^61}\advance\counter by1
+\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^62}\advance\counter by1
+\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^63}\advance\counter by1
+\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^64}\advance\counter by1
+\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^65}\advance\counter by1
+\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^66}\advance\counter by1
+\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^67}\advance\counter by1
+\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^68}\advance\counter by1
+\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^69}\advance\counter by1
+\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6a}\advance\counter by1
+\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6b}\advance\counter by1
+\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6c}\advance\counter by1
+\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6d}\advance\counter by1
+\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6e}\advance\counter by1
+\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6f}\advance\counter by1
+\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^70}\advance\counter by1
+\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^71}\advance\counter by1
+\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^72}\advance\counter by1
+\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^73}\advance\counter by1
+\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^74}\advance\counter by1
+\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^75}\advance\counter by1
+\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^76}\advance\counter by1
+\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^77}\advance\counter by1
+\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^78}\advance\counter by1
+\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^79}\advance\counter by1
+\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7a}\advance\counter by1
+\begingroup
+\catcode`\q=1
+\catcode`\^^7b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname q^^7b}\endgroup\advance\counter by1
+\catcode`\^^7c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7c}\advance\counter by1
+\begingroup
+\catcode`\q=2
+\catcode`\^^7d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7dq\endgroup\advance\counter by1
+\catcode`\^^7e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7e}\advance\counter by1
+\catcode`\^^7f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7f}\advance\counter by1
+\catcode`\^^80=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^80}\advance\counter by1
+\catcode`\^^81=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^81}\advance\counter by1
+\catcode`\^^82=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^82}\advance\counter by1
+\catcode`\^^83=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^83}\advance\counter by1
+\catcode`\^^84=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^84}\advance\counter by1
+\catcode`\^^85=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^85}\advance\counter by1
+\catcode`\^^86=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^86}\advance\counter by1
+\catcode`\^^87=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^87}\advance\counter by1
+\catcode`\^^88=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^88}\advance\counter by1
+\catcode`\^^89=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^89}\advance\counter by1
+\catcode`\^^8a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8a}\advance\counter by1
+\catcode`\^^8b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8b}\advance\counter by1
+\catcode`\^^8c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8c}\advance\counter by1
+\catcode`\^^8d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8d}\advance\counter by1
+\catcode`\^^8e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8e}\advance\counter by1
+\catcode`\^^8f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8f}\advance\counter by1
+\catcode`\^^90=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^90}\advance\counter by1
+\catcode`\^^91=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^91}\advance\counter by1
+\catcode`\^^92=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^92}\advance\counter by1
+\catcode`\^^93=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^93}\advance\counter by1
+\catcode`\^^94=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^94}\advance\counter by1
+\catcode`\^^95=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^95}\advance\counter by1
+\catcode`\^^96=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^96}\advance\counter by1
+\catcode`\^^97=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^97}\advance\counter by1
+\catcode`\^^98=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^98}\advance\counter by1
+\catcode`\^^99=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^99}\advance\counter by1
+\catcode`\^^9a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9a}\advance\counter by1
+\catcode`\^^9b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9b}\advance\counter by1
+\catcode`\^^9c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9c}\advance\counter by1
+\catcode`\^^9d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9d}\advance\counter by1
+\catcode`\^^9e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9e}\advance\counter by1
+\catcode`\^^9f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9f}\advance\counter by1
+\catcode`\^^a0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a0}\advance\counter by1
+\catcode`\^^a1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a1}\advance\counter by1
+\catcode`\^^a2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a2}\advance\counter by1
+\catcode`\^^a3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a3}\advance\counter by1
+\catcode`\^^a4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a4}\advance\counter by1
+\catcode`\^^a5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a5}\advance\counter by1
+\catcode`\^^a6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a6}\advance\counter by1
+\catcode`\^^a7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a7}\advance\counter by1
+\catcode`\^^a8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a8}\advance\counter by1
+\catcode`\^^a9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a9}\advance\counter by1
+\catcode`\^^aa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^aa}\advance\counter by1
+\catcode`\^^ab=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ab}\advance\counter by1
+\catcode`\^^ac=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ac}\advance\counter by1
+\catcode`\^^ad=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ad}\advance\counter by1
+\catcode`\^^ae=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ae}\advance\counter by1
+\catcode`\^^af=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^af}\advance\counter by1
+\catcode`\^^b0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b0}\advance\counter by1
+\catcode`\^^b1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b1}\advance\counter by1
+\catcode`\^^b2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b2}\advance\counter by1
+\catcode`\^^b3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b3}\advance\counter by1
+\catcode`\^^b4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b4}\advance\counter by1
+\catcode`\^^b5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b5}\advance\counter by1
+\catcode`\^^b6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b6}\advance\counter by1
+\catcode`\^^b7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b7}\advance\counter by1
+\catcode`\^^b8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b8}\advance\counter by1
+\catcode`\^^b9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b9}\advance\counter by1
+\catcode`\^^ba=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ba}\advance\counter by1
+\catcode`\^^bb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bb}\advance\counter by1
+\catcode`\^^bc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bc}\advance\counter by1
+\catcode`\^^bd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bd}\advance\counter by1
+\catcode`\^^be=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^be}\advance\counter by1
+\catcode`\^^bf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bf}\advance\counter by1
+\catcode`\^^c0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c0}\advance\counter by1
+\catcode`\^^c1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c1}\advance\counter by1
+\catcode`\^^c2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c2}\advance\counter by1
+\catcode`\^^c3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c3}\advance\counter by1
+\catcode`\^^c4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c4}\advance\counter by1
+\catcode`\^^c5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c5}\advance\counter by1
+\catcode`\^^c6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c6}\advance\counter by1
+\catcode`\^^c7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c7}\advance\counter by1
+\catcode`\^^c8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c8}\advance\counter by1
+\catcode`\^^c9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c9}\advance\counter by1
+\catcode`\^^ca=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ca}\advance\counter by1
+\catcode`\^^cb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cb}\advance\counter by1
+\catcode`\^^cc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cc}\advance\counter by1
+\catcode`\^^cd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cd}\advance\counter by1
+\catcode`\^^ce=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ce}\advance\counter by1
+\catcode`\^^cf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cf}\advance\counter by1
+\catcode`\^^d0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d0}\advance\counter by1
+\catcode`\^^d1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d1}\advance\counter by1
+\catcode`\^^d2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d2}\advance\counter by1
+\catcode`\^^d3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d3}\advance\counter by1
+\catcode`\^^d4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d4}\advance\counter by1
+\catcode`\^^d5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d5}\advance\counter by1
+\catcode`\^^d6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d6}\advance\counter by1
+\catcode`\^^d7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d7}\advance\counter by1
+\catcode`\^^d8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d8}\advance\counter by1
+\catcode`\^^d9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d9}\advance\counter by1
+\catcode`\^^da=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^da}\advance\counter by1
+\catcode`\^^db=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^db}\advance\counter by1
+\catcode`\^^dc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dc}\advance\counter by1
+\catcode`\^^dd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dd}\advance\counter by1
+\catcode`\^^de=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^de}\advance\counter by1
+\catcode`\^^df=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^df}\advance\counter by1
+\catcode`\^^e0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e0}\advance\counter by1
+\catcode`\^^e1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e1}\advance\counter by1
+\catcode`\^^e2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e2}\advance\counter by1
+\catcode`\^^e3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e3}\advance\counter by1
+\catcode`\^^e4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e4}\advance\counter by1
+\catcode`\^^e5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e5}\advance\counter by1
+\catcode`\^^e6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e6}\advance\counter by1
+\catcode`\^^e7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e7}\advance\counter by1
+\catcode`\^^e8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e8}\advance\counter by1
+\catcode`\^^e9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e9}\advance\counter by1
+\catcode`\^^ea=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ea}\advance\counter by1
+\catcode`\^^eb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^eb}\advance\counter by1
+\catcode`\^^ec=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ec}\advance\counter by1
+\catcode`\^^ed=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ed}\advance\counter by1
+\catcode`\^^ee=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ee}\advance\counter by1
+\catcode`\^^ef=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ef}\advance\counter by1
+\catcode`\^^f0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f0}\advance\counter by1
+\catcode`\^^f1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f1}\advance\counter by1
+\catcode`\^^f2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f2}\advance\counter by1
+\catcode`\^^f3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f3}\advance\counter by1
+\catcode`\^^f4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f4}\advance\counter by1
+\catcode`\^^f5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f5}\advance\counter by1
+\catcode`\^^f6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f6}\advance\counter by1
+\catcode`\^^f7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f7}\advance\counter by1
+\catcode`\^^f8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f8}\advance\counter by1
+\catcode`\^^f9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f9}\advance\counter by1
+\catcode`\^^fa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fa}\advance\counter by1
+\catcode`\^^fb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fb}\advance\counter by1
+\catcode`\^^fc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fc}\advance\counter by1
+\catcode`\^^fd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fd}\advance\counter by1
+\catcode`\^^fe=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fe}\advance\counter by1
+\catcode`\^^ff=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ff}\advance\counter by1
+\ifnum\counter=256
+\else
+ \pgfplots@error{Internal logic Error: initialisation failed. I have only \the\counter\space bytes initialised.}
+\fi
+\endgroup
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
index 2dacf8f7458..0c1f8dc41fe 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex
@@ -144,7 +144,8 @@
}{%
\let#1=\tikz@plot@handler
}%
-}%
+}
+
% Converts an arbitrary command (without arguments) to a string in which all characters
@@ -426,16 +427,20 @@
\expandafter\let\csname #1\endcsname=\pgfplots@loc@TMPc
}%
-% I have introduced this macro to allow optimizations of (x,y)
-% coordinate processing. Use it for everything which is directly plot
-% related.
-%
-% @see \pgfplotsqpointxy@orthogonal
+% Inside of a pgfplots axis, this method (together with
+% \pgfplotsqpointxyz for 3d axes) is THE
+% point method. If you override the mapping to PGF coordinates here,
+% all other \pgfplotspoint* commands should inherit the changes as well.
\def\pgfplotsqpointxy#1#2{%
\global\pgf@x=#1\pgf@xx%
\global\advance\pgf@x by #2\pgf@yx%
\global\pgf@y=#1\pgf@xy%
\global\advance\pgf@y by #2\pgf@yy}
+
+% Inside of a pgfplots axis, this method (together with
+% \pgfplotsqpointxy for 2d axes) is THE
+% point method. If you override the mapping to PGF coordinates here,
+% all other \pgfplotspoint* commands should inherit the changes as well.
\def\pgfplotsqpointxyz#1#2#3{%
\global\pgf@x=#1\pgf@xx%
\global\advance\pgf@x by #2\pgf@yx%
@@ -860,6 +865,69 @@
\ifx\pgfplots@loc@TMPa\pgfutil@empty #2\else #3\fi
}%
+{
+ \catcode`\#=12
+ \catcode`\1=12
+ \gdef\pgfplotsutil@add@to@macro@@one{#1}%
+ \gdef\pgfplotsutil@add@to@macro@@two{#1#2}%
+}
+
+\def\pgfplotsutil@ifmacrodependsononearg#1#2#3{%
+ \edef\pgfplots@loc@TMPa{\noexpand\pgfutil@in@{\pgfplotsutil@add@to@macro@@one}{\meaning#1}}%
+ \pgfplots@loc@TMPa
+ \ifpgfutil@in@
+ #2%
+ \else
+ #3%
+ \fi
+}%
+
+\def\pgfplotsutil@ifmacrodependsontwoargs#1#2#3{%
+ \edef\pgfplots@util@add@to@macro@@{\noexpand\pgfutil@in@{\pgfplotsutil@add@to@macro@@two}{\meaning#1}}%
+ \pgfplots@util@add@to@macro@@
+ \ifpgfutil@in@
+ #2%
+ \else
+ #3%
+ \fi
+}%
+
+% Appends '#2' to macro '#1'.
+%
+% #1: a macro which takes either no arguments or exactly one.
+% #2: some token text. May depend on '#1' if #1 is a macro which
+% depends on one arg.
+\def\pgfplotsutil@add@to@macro#1#2{%
+ \pgfplotsutil@ifmacrodependsononearg#1{%
+ \pgfplotsutil@ifmacrodependsontwoargs#1{%
+ \pgfplotsutil@add@to@macro@twoargs{#1}{#2}%
+ }{%
+ \pgfplotsutil@add@to@macro@onearg{#1}{#2}%
+ }%
+ }{%
+ \pgfplotsutil@add@to@macro@noargs{#1}{#2}%
+ }%
+}%
+
+\def\pgfplotsutil@add@to@macro@twoargs#1#2{%
+ \t@pgfplots@tokc=\expandafter{#1{##1}{##2}}%
+ \t@pgfplots@tokb={#2}%
+ \edef\pgfplots@util@add@to@macro@@{\the\t@pgfplots@tokc\the\t@pgfplots@tokb}%
+ \expandafter\def\expandafter#1\expandafter##\expandafter1\expandafter##\expandafter2\expandafter{\pgfplots@util@add@to@macro@@}%
+}
+
+\def\pgfplotsutil@add@to@macro@onearg#1#2{%
+ \t@pgfplots@tokc=\expandafter{#1{##1}}%
+ \t@pgfplots@tokb={#2}%
+ \edef\pgfplots@util@add@to@macro@@{\the\t@pgfplots@tokc\the\t@pgfplots@tokb}%
+ \expandafter\def\expandafter#1\expandafter##\expandafter1\expandafter{\pgfplots@util@add@to@macro@@}%
+}
+
+\def\pgfplotsutil@add@to@macro@noargs#1#2{%
+ \t@pgfplots@tokc=\expandafter{#1}%
+ \t@pgfplots@tokb=\expandafter{#2}%
+ \edef#1{\the\t@pgfplots@tokc\the\t@pgfplots@tokb}%
+}
\def\pgfplots@logfileopen#1{%
\immediate\write-1{PGFPlots: reading {#1}}%
\pgfutil@ifundefined{tikzifexternalizingcurrent}{%
@@ -1551,6 +1619,349 @@
\def\:{\pgfplotsutil@xifnch} \expandafter\gdef\: {\futurelet\pgfplotsutil@let@token\pgfplotsutil@ifnch}
}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% basic 3d linear algebra utils.
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Converts a 3d vectors to string.
+% #1: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain the result vector.
+% #3: the argument for \pgfplotscoordmath (such as 'default')
+%
+\def\pgfplotsmathvectortostring#1#2{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplotsmathvectorcompwiseop@unary\pgfplots@loc@TMPa\pgfplots@EOI{#2}{{tostring}}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% Reads a 3d vector's coordinates.
+% #1: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain the result vector.
+% #2: the argument for \pgfplotscoordmath (such as 'default')
+%
+% Example:
+% \pgfplotsmathvectorfromstring{1,4,5}{default}
+% will parse each component
+\def\pgfplotsmathvectorfromstring#1#2{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplotsmathvectorcompwiseop@unary\pgfplots@loc@TMPa\pgfplots@EOI{#2}{{parsenumber}}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% Takes two 3d vectors and subtracts them.
+% #1: a vector which expands to the form 'x,y,z'
+% #2: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain the difference vector.
+% #3: the argument for \pgfplotscoordmath (such as 'default')
+%
+\def\pgfplotsmathvectorsubtract#1#2#3{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1:#2}%
+ \expandafter\pgfplotsmathvectorcompwiseop@binary\pgfplots@loc@TMPa\pgfplots@EOI{#3}{subtract}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+\def\pgfplotsmathvectorcompwiseop@binary#1,#2,#3:#4,#5,#6\pgfplots@EOI#7#8{%
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ \def\Bx{#4}%
+ \def\By{#5}%
+ \def\Bz{#6}%
+ \pgfplotscoordmath{#7}{op}{#8}{{\Ax}{\Bx}}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{#8}{{\Ay}{\By}}%
+ \let\pgfplots@loc@TMPb=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{#8}{{\Az}{\Bz}}%
+ \let\pgfplots@loc@TMPc=\pgfmathresult
+ \edef\pgfplotsretval{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc}%
+}%
+
+% #5: an operation ENCLOSED IN BRACES!
+% like '{tostring}' or '{op}{<someunaryop>}'
+\def\pgfplotsmathvectorcompwiseop@unary#1,#2,#3\pgfplots@EOI#4#5{%
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ \pgfplotscoordmath{#4}#5{\Ax}%
+ \let\pgfplots@loc@TMPa=\pgfmathresult
+ \pgfplotscoordmath{#4}#5{\Ay}%
+ \let\pgfplots@loc@TMPb=\pgfmathresult
+ \pgfplotscoordmath{#4}#5{\Az}%
+ \let\pgfplots@loc@TMPc=\pgfmathresult
+ \edef\pgfplotsretval{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc}%
+}%
+
+% Takes two 3d vectors and adds them.
+% #1: a vector which expands to the form 'x,y,z'
+% #2: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain the added vector.
+% #3: the argument for \pgfplotscoordmath (such as 'default')
+%
+\def\pgfplotsmathvectoradd#1#2#3{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1:#2}%
+ \expandafter\pgfplotsmathvectorcompwiseop@binary\pgfplots@loc@TMPa\pgfplots@EOI{#3}{add}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% Takes two 3d vectors and applies a component-wise operation.
+% #1: a vector which expands to the form 'x,y,z'
+% #2: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain a boolean vector with three
+% entries.
+% #3: a scalar operation which takes two arguments (such as "add", "subtract", "equal")
+% #4 the argument for \pgfplotscoordmath (such as 'default')
+%
+% Example: \pgfplotsmathvectorcompwise{1,1,1}{0,1,0}{add}{pgfbasic}
+% -> \pgfplotsretval={1.0,2.0,1.0}
+\def\pgfplotsmathvectorcompwise#1#2#3#4{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1:#2}%
+ \expandafter\pgfplotsmathvectorcompwiseop@binary\pgfplots@loc@TMPa\pgfplots@EOI{#4}{#3}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% Defines \pgfplotsretval to x+y+z
+% #1: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain the result scalar.
+% #2: the argument for \pgfplotscoordmath (such as 'default')
+%
+% Example:
+% \pgfplotsmathvectorsum{1,4,5}{default}
+% \pgfplotsretval = 10 (in that format)
+\def\pgfplotsmathvectorsum#1#2{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplotsmathvectorsum@\pgfplots@loc@TMPa\pgfplots@EOI{#2}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+\def\pgfplotsmathvectorsum@#1,#2,#3\pgfplots@EOI#4{%
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ \pgfplotscoordmath{#4}{op}{add}{{\Ax}{\Ay}}%
+ \let\pgfplotsretval=\pgfmathresult
+ \pgfplotscoordmath{#4}{op}{add}{{\pgfplotsretval}{\Az}}%
+ \let\pgfplotsretval=\pgfmathresult
+}%
+
+% Computes the euclidean scalar product of two 3d vectors #1 and #2 in math
+% format #3.
+\def\pgfplotsmathvectorscalarproduct#1#2#3{%
+ \pgfplotsmathvectorscaleindividually{#1}{#2}{#3}%
+ \pgfplotsmathvectorsum{\pgfplotsretval}{#3}%
+}%
+
+% takes a vector #1 and defines three new macros
+% \csname #2x\endcsname,
+% \csname #2y\endcsname,
+% \csname #2z\endcsname,
+% with the components.
+% #3: the math format
+\def\pgfplotsmathvectortocomponents#1#2#3{%
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplotsmathvectortocomponents@\pgfplots@loc@TMPa\pgfplots@EOI{#3}{#2}%
+}%
+\def\pgfplotsmathvectortocomponents@#1,#2,#3\pgfplots@EOI#4#5{%
+ \expandafter\def\csname #5x\endcsname{#1}%
+ \expandafter\def\csname #5y\endcsname{#2}%
+ \expandafter\def\csname #5z\endcsname{#3}%
+}%
+
+
+% Takes two 3d vectors and computes their cross product.
+% #1: a vector which expands to the form 'x,y,z'
+% #2: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain the result vector.
+% #3: the argument for \pgfplotscoordmath (such as 'default')
+%
+\def\pgfplotsmathvectorcrossprod#1#2#3{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1:#2}%
+ \expandafter\pgfplotsmathvectorcrossprod@\pgfplots@loc@TMPa\pgfplots@EOI{#3}%
+%\message{\string\pgfplotsmathvectorcrossprod{#1}{#2} = \pgfplotsretval^^J}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+\def\pgfplotsmathvectorcrossprod@#1,#2,#3:#4,#5,#6\pgfplots@EOI#7{%
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ \def\Bx{#4}%
+ \def\By{#5}%
+ \def\Bz{#6}%
+ %
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Ay}{\Bz}}\let\AyBz=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Az}{\By}}\let\AzBy=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Az}{\Bx}}\let\AzBx=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Ax}{\Bz}}\let\AxBz=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Ax}{\By}}\let\AxBy=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Ay}{\Bx}}\let\AyBx=\pgfmathresult
+ %
+ \pgfplotscoordmath{#7}{op}{subtract}{{\AyBz}{\AzBy}}\let\pgfplots@loc@TMPa=\pgfmathresult%
+ \pgfplotscoordmath{#7}{op}{subtract}{{\AzBx}{\AxBz}}\let\pgfplots@loc@TMPb=\pgfmathresult%
+ \pgfplotscoordmath{#7}{op}{subtract}{{\AxBy}{\AyBx}}\let\pgfplots@loc@TMPc=\pgfmathresult%
+ \edef\pgfplotsretval{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc}%
+}%
+
+% Takes two 3d vectors and defines a new vector (Ax*Bx,Ay*By,Az*Bz)
+% #1: a vector which expands to the form 'x,y,z'
+% #2: a vector which expands to the form 'x,y,z'
+% on output, \pgfplotsretval will contain the result vector.
+% #3: the argument for \pgfplotscoordmath (such as 'default')
+%
+\def\pgfplotsmathvectorscaleindividually#1#2#3{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1:#2}%
+ \expandafter\pgfplotsmathvectorscaleindividually@\pgfplots@loc@TMPa\pgfplots@EOI{#3}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+\def\pgfplotsmathvectorscaleindividually@#1,#2,#3:#4,#5,#6\pgfplots@EOI#7{%
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ \def\Bx{#4}%
+ \def\By{#5}%
+ \def\Bz{#6}%
+ %
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Ax}{\Bx}}\let\Cx=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Ay}{\By}}\let\Cy=\pgfmathresult
+ \pgfplotscoordmath{#7}{op}{multiply}{{\Az}{\Bz}}\let\Cz=\pgfmathresult
+ %
+ \edef\pgfplotsretval{\Cx,\Cy,\Cz}%
+}%
+
+% #1 a vector as x,y,z
+% #2 the math format of its components
+\def\pgfplotspointfromcsvvector#1#2{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplotspointfromcsvvector@\pgfplots@loc@TMPa\pgfplots@EOI{#2}
+ \endgroup
+}%
+\def\pgfplotspointfromcsvvector@#1,#2,#3\pgfplots@EOI#4{%
+ \pgfplotscoordmath{#4}{tofixed}{#1}\let\Ax=\pgfmathresult
+ \pgfplotscoordmath{#4}{tofixed}{#2}\let\Ay=\pgfmathresult
+ \pgfplotscoordmath{#4}{tofixed}{#3}\let\Az=\pgfmathresult
+ \pgfplotsqpointxyz\Ax\Ay\Az
+ \pgf@process{}%
+}%
+
+% #1 a vector as (x,y,z)
+% #2 a coordmath value
+% defines \pgfplotsretval to contain the vector length
+\def\pgfplotsmathvectorlength#1#2{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplotsmathvectorlength@\pgfplots@loc@TMPa\pgfplots@EOI{#2}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+\def\pgfplotsmathvectorlength@#1,#2,#3\pgfplots@EOI#4{%
+ \begingroup
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ %
+ \pgfplotscoordmath{#4}{op}{multiply}{{\Ax}{\Ax}}\let\Axx=\pgfmathresult
+ \pgfplotscoordmath{#4}{op}{multiply}{{\Ay}{\Ay}}\let\Ayy=\pgfmathresult
+ \pgfplotscoordmath{#4}{op}{multiply}{{\Az}{\Az}}\let\Azz=\pgfmathresult
+ %
+ \pgfplotscoordmath{#4}{op}{add}{{\Axx}{\Ayy}}%
+ \pgfplotscoordmath{#4}{op}{add}{{\Azz}{\pgfmathresult}}%
+ \pgfplotscoordmath{#4}{op}{sqrt}{{\pgfmathresult}}%
+ \let\pgfplotsretval=\pgfmathresult
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% #1 a vector as (x,y,z)
+% #2 a scale
+% #3 a coordmath value
+% defines \pgfplotsretval to contain the scaled vector
+\def\pgfplotsmathvectorscale#1#2#3{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1:#2}%
+ \expandafter\pgfplotsmathvectorscale@\pgfplots@loc@TMPa\pgfplots@EOI{#3}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+\def\pgfplotsmathvectorscale@#1,#2,#3:#4\pgfplots@EOI#5{%
+ \begingroup
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ \pgfplotscoordmath{#5}{parsenumber}{#4}\let\S\pgfmathresult
+ %
+ \pgfplotscoordmath{#5}{op}{multiply}{{\Ax}{\S}}\let\Ax=\pgfmathresult
+ \pgfplotscoordmath{#5}{op}{multiply}{{\Ay}{\S}}\let\Ay=\pgfmathresult
+ \pgfplotscoordmath{#5}{op}{multiply}{{\Az}{\S}}\let\Az=\pgfmathresult
+ %
+ \edef\pgfplotsretval{\Ax,\Ay,\Az}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+% Takes an input vector #1 = x,y,z and applies the inverse data scale
+% trafo.
+%
+% The result is \pgfplotsretval; it will be in '#2' coordmath for
+% every component.
+\def\pgfplotsmathvectordatascaletrafoinverse#1#2{%
+ \begingroup
+ \edef\pgfplots@loc@TMPa{#1}%
+ \expandafter\pgfplotsmathvectordatascaletrafoinverse@\pgfplots@loc@TMPa\pgfplots@EOI{#2}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}
+\def\pgfplotsmathvectordatascaletrafoinverse@#1,#2,#3\pgfplots@EOI#4{%
+ \begingroup
+ \def\Ax{#1}%
+ \def\Ay{#2}%
+ \def\Az{#3}%
+ \ifpgfplots@apply@datatrafo@x
+ \pgfplotscoordmath{x}{datascaletrafo inverse}{\Ax}\let\Ax=\pgfmathresult
+ \fi
+ \ifpgfplots@apply@datatrafo@y
+ \pgfplotscoordmath{y}{datascaletrafo inverse}{\Ay}\let\Ay=\pgfmathresult
+ \fi
+ \ifpgfplots@curplot@threedim
+ \ifpgfplots@apply@datatrafo@z
+ \pgfplotscoordmath{z}{datascaletrafo inverse}{\Az}\let\Az=\pgfmathresult
+ \fi
+ \fi
+ \pgfplotsmathvectorfromstring{\Ax,\Ay,\Az}{#4}%
+ \pgfmath@smuggleone\pgfplotsretval
+ \endgroup
+}%
+
+
+{
+\catcode`\"=12
+\gdef\pgfplotsDQ{"}%
+\catcode`\|=12
+\gdef\pgfplotsVERTBAR{|}%
+\catcode`\#=12
+\gdef\pgfplotsHASH{#}%
+\catcode`\%=12 \gdef\pgfplotsPERCENT{%}}
+
+\pgfutil@ifundefined{directlua}{}{%
+ \directlua{require(\pgfplotsDQ pgfplots.lua\pgfplotsDQ)}%
+}%
+
\input pgfplotsliststructure.code.tex
\input pgfplotsliststructureext.code.tex
\input pgfplotsarray.code.tex