From 4147899f17a6e0b0dde20f309845c4fc0032bce9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 26 Oct 2012 21:36:14 +0000 Subject: pgfplots (26oct12) git-svn-id: svn://tug.org/texlive/trunk@28094 c570f23f-e606-0410-a88d-b1316a301751 --- .../libs/tikzlibrarypgfplots.patchplots.code.tex | 708 ++++++- .../tex/generic/pgfplots/lua/pgfplots.lua | 30 + .../pgfplots/numtable/pgfplotstable.code.tex | 4 +- .../pgfplotsoldpgfsupp_loader.code.tex | 4 +- .../pgfplotsoldpgfsupp_misc.code.tex | 20 + .../pgfplotsoldpgfsupp_pgfcoreexternal.code.tex | 2 +- .../pgfplotsoldpgfsupp_pgfcorelayers.code.tex | 2 +- .../pgfplotsoldpgfsupp_pgfcorescopes.code.tex | 2 +- .../pgfplotsoldpgfsupp_pgfkeys.code.tex | 4 +- .../pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex | 2 +- .../pgfplotsoldpgfsupp_pgflibraryfpu.code.tex | 2 +- ...plotsoldpgfsupp_pgflibraryplothandlers.code.tex | 23 +- .../pgfplotsoldpgfsupp_pgfmanual.code.tex | 2 +- .../pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex | 2 +- ...lotsoldpgfsupp_pgfmanual.prettyprinter.code.tex | 2 +- .../pgfplotsoldpgfsupp_pgfmathfloat.code.tex | 53 +- .../pgfplotsoldpgfsupp_tikzexternal.sty | 2 +- .../pgfplotsoldpgfsupp_tikzexternalshared.code.tex | 2 +- ...pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex | 2 +- .../tex/generic/pgfplots/pgfplots.code.tex | 389 +++- .../tex/generic/pgfplots/pgfplots.revision.tex | 16 +- .../tex/generic/pgfplots/pgfplots.scaling.code.tex | 33 +- .../pgfplots/pgfplotscoordprocessing.code.tex | 187 +- .../tex/generic/pgfplots/pgfplotscore.code.tex | 15 +- .../pgfplots/pgfplotsmeshplothandler.code.tex | 1976 +++++++++++--------- .../generic/pgfplots/pgfplotsplothandlers.code.tex | 76 +- .../generic/pgfplots/pgfplotsstackedplots.code.tex | 12 +- ...gflibrarypgfplots.surfshading.pgfsys-pdftex.def | 2 +- .../pgfplots/sys/pgfplotssysgeneric.code.tex | 2 +- .../generic/pgfplots/util/pgfplotsbinary.code.tex | 2 +- .../generic/pgfplots/util/pgfplotsutil.code.tex | 66 +- .../libs/tikzlibrarypgfplots.clickable.code.tex | 2 +- Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty | 13 +- .../tex/latex/pgfplots/pgfplotstable.sty | 7 +- 34 files changed, 2594 insertions(+), 1072 deletions(-) create mode 100644 Master/texmf-dist/tex/generic/pgfplots/lua/pgfplots.lua (limited to 'Master/texmf-dist/tex') 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 79990ec1fb8..933f48854d2 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 @@ -56,9 +56,18 @@ +% A quadratic spline in the ordering +% +% +% +% where is the function value at the left end of the spline +% segmment, the function value at the right end, and +% the function value in the middle of the spline segment. \pgfplotsdeclarepatchclass{quadratic spline}{% allow matrix=0, uses view depth=0, + get dimension=1, + supports global path=1, new=\def\pgfplotspatchclass@qspline@no{A}, set next vertex={% % EXPECTED ORDERING: first 2 corners, then 1 mid nodes @@ -72,6 +81,31 @@ \expandafter\let\expandafter\pgfplotspatchclass@qspline@no\csname pgfpptchindexnext@\pgfplotspatchclass@qspline@no\endcsname \fi }, + if current point can be first last={% + \pgfplots@loc@tmptrue + \if A\pgfplotspatchclass@qspline@no + % Ah - the current point is the 'C' point, i.e. the + % control point (we have advanced the '@no' counter) + \pgfplots@loc@tmpfalse + \fi + \ifpgfplots@loc@tmp + #1\relax% + \else + #2\relax + \fi + }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{0}% + #1% + \pgfplotspatchready + },% first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@A\endvertex, foreach vertex={% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qspline@A\endvertex #1% @@ -93,7 +127,7 @@ % in does the same. \def\pgfplots@edge{% \ifx\pgfplotspatchclass@qspline@A\PA - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}% + \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\PA\endvertex}% \fi \pgfpathcurveto {% \pgfpointadd @@ -111,6 +145,7 @@ \let\PB=\pgfplotspatchclass@qspline@C \let\PC=\pgfplotspatchclass@qspline@B \pgfplots@edge + \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\PC\endvertex}% \endgroup }, triangulate class=line, @@ -156,6 +191,8 @@ \pgfplotsdeclarepatchclass{cubic spline}{% allow matrix=0, uses view depth=0, + get dimension=1, + supports global path=1, new=\def\pgfplotspatchclass@cspline@no{A}, set next vertex={% % EXPECTED ORDERING: first 2 corners, then 1 mid nodes @@ -169,6 +206,39 @@ \expandafter\let\expandafter\pgfplotspatchclass@cspline@no\csname pgfpptchindexnext@\pgfplotspatchclass@cspline@no\endcsname \fi }, + if current point can be first last={% + \pgfplots@loc@tmpfalse + \if B\pgfplotspatchclass@cspline@no + % Ah - the current point is the 'A' point (we have + % advanced the '@no' counter) + \pgfplots@loc@tmptrue + \fi + \if C\pgfplotspatchclass@cspline@no + % Ah - the current point is the 'B' point (we have + % advanced the '@no' counter) + \pgfplots@loc@tmptrue + \fi + \ifpgfplots@loc@tmp + #1\relax% + \else + #2\relax + \fi + }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0.3333333}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0.6666666}% + \def\pgfplotspatchclassy{0}% + #1% + \pgfplotspatchready + },% first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex, foreach vertex={% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@cspline@A\endvertex #1% @@ -178,32 +248,13 @@ }, fill path={% % Draw the patch boundary using a bezier curve. - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@A\endvertex}% - % switch basis from lagrange to bezier (see formular on top of - % this file) - \pgfpathcurveto {% - \begingroup - \pgfplotspatchvertexaccumstart - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@A\times{-0.833333}% - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@C\times{3}% - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@D\times{-1.5}% - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@B\times{0.3333333}% - \pgfplotspatchvertexfinish\pgfplots@loc@TMPa - \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex - \endgroup - }{% - \begingroup - \pgfplotspatchvertexaccumstart - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@A\times{0.333333}% - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@C\times{-1.5}% - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@D\times{3}% - \expandafter\pgfplotspatchvertexaddXY\pgfplotspatchclass@cspline@B\times{-0.833333}% - \pgfplotspatchvertexfinish\pgfplots@loc@TMPa - \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex - \endgroup - }{% - \expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex - }% + \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@A\endvertex}% + \pgfplotspathcubicfrominterpolation + {\pgfplotspatchclass@cspline@A}% + {\pgfplotspatchclass@cspline@C}% + {\pgfplotspatchclass@cspline@D}% + {\pgfplotspatchclass@cspline@B}% + \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@cspline@B\endvertex}% }, triangulate class=line, triangulate={% @@ -299,6 +350,34 @@ get num vertices=4, }% +\def\pgfplotspathcubicfrominterpolation#1#2#3#4{% + % switch basis from lagrange to bezier (see formular on top of + % this file) + \pgfpathcurveto {% + \begingroup + \pgfplotspatchvertexaccumstart + \expandafter\pgfplotspatchvertexaddXY#1\times{-0.833333}% + \expandafter\pgfplotspatchvertexaddXY#2\times{3}% + \expandafter\pgfplotspatchvertexaddXY#3\times{-1.5}% + \expandafter\pgfplotspatchvertexaddXY#4\times{0.3333333}% + \pgfplotspatchvertexfinish\pgfplots@loc@TMPa + \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex + \endgroup + }{% + \begingroup + \pgfplotspatchvertexaccumstart + \expandafter\pgfplotspatchvertexaddXY#1\times{0.333333}% + \expandafter\pgfplotspatchvertexaddXY#2\times{-1.5}% + \expandafter\pgfplotspatchvertexaddXY#3\times{3}% + \expandafter\pgfplotspatchvertexaddXY#4\times{-0.833333}% + \pgfplotspatchvertexfinish\pgfplots@loc@TMPa + \expandafter\pgfplotspointpatchvertex\pgfplots@loc@TMPa\endvertex + \endgroup + }{% + \expandafter\pgfplotspointpatchvertex#4\endvertex + }% +}% + % make a linearized sequence around the edge of the quad.triangle. % note the ordering: first 3 corners, then 3 mid nodes: \def\pgfplots@qtri@next@A{D}% @@ -342,6 +421,50 @@ \expandafter\let\expandafter\pgfplotspatchclass@qtri@no\csname pgfpptchindexnext@\pgfplotspatchclass@qtri@no\endcsname \fi }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + % + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{0.5}% + #1% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0.5}% + #1% + \pgfplotspatchready + % + % + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{1}% + #1% + % + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{0.5}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0.5}% + #1% + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{1}% + #1% + \pgfplotspatchready + },% first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex, foreach vertex={% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@qtri@A\endvertex #1% @@ -797,6 +920,21 @@ \pgfplotspatchready% \fi }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + \pgfplotspatchready + },% first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex, foreach vertex={% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex #1% @@ -1145,6 +1283,36 @@ \expandafter\let\expandafter\pgfplotspatchclass@biquad@no\csname pgfpptchindexnext@\pgfplotspatchclass@biquad@no\endcsname \fi }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0.5}% + #1% + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0.5}% + #1% + \def\pgfplotspatchclassx{0.5}% + \def\pgfplotspatchclassy{0.5}% + #1% + \pgfplotspatchready + },% first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex, foreach vertex={% \expandafter\pgfplotspatchvertex\pgfplotspatchclass@biquad@A\endvertex #1% @@ -1833,3 +2001,489 @@ get num vertices=16, get num cdata vertices=4, }% + +% A bicubic patch with 16 points. +% +% It expects points in the order (i.e. in matrix ordering, row-wise): +% +% AD BD CD DD +% AC BC CC DC +% AB BB CB DB +% AA BA CA DA +% +\pgfplotsdeclarepatchclass{bicubic}{% + allow matrix=0, + new=\def\pgfplotspatchclass@bicubic@row{A}\def\pgfplotspatchclass@bicubic@col{A}, + set next vertex={% + % defines \pgfplotspatchclass@bicubic@AA ... \pgfplotspatchclass@bicubic@DD (16 points) + \expandafter\edef\csname pgfplotspatchclass@bicubic@\pgfplotspatchclass@bicubic@row\pgfplotspatchclass@bicubic@col\endcsname{#1}% + \if D\pgfplotspatchclass@bicubic@row + \def\pgfplotspatchclass@bicubic@row{A}% + \if D\pgfplotspatchclass@bicubic@col + \def\pgfplotspatchclass@bicubic@col{A}% + \pgfplotspatchready + \else + \expandafter\let\expandafter\pgfplotspatchclass@bicubic@col\csname pgfpptchindexnext@\pgfplotspatchclass@bicubic@col\endcsname + \fi + \else + \expandafter\let\expandafter\pgfplotspatchclass@bicubic@row\csname pgfpptchindexnext@\pgfplotspatchclass@bicubic@row\endcsname + \fi + }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0.333333333}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0.666666666}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + % + % + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0.333333333}% + #1% + \def\pgfplotspatchclassx{0.333333333}% + \def\pgfplotspatchclassy{0.333333333}% + #1% + \def\pgfplotspatchclassx{0.666666666}% + \def\pgfplotspatchclassy{0.333333333}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0.333333333}% + #1% + % + % + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0.666666666}% + #1% + \def\pgfplotspatchclassx{0.333333333}% + \def\pgfplotspatchclassy{0.666666666}% + #1% + \def\pgfplotspatchclassx{0.666666666}% + \def\pgfplotspatchclassy{0.666666666}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0.666666666}% + #1% + % + % + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{0.333333333}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{0.666666666}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{1}% + #1% + % + % + % + \pgfplotspatchready + },% + first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex, + foreach vertex={% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BA\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CA\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DA\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AB\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BB\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CB\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DB\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AC\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BC\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CC\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DC\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AD\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@BD\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@CD\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DD\endvertex #1% + }, + foreach cdata vertex={% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AA\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DA\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@DD\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@bicubic@AD\endvertex #1% + }, + fill path={% + % Visualize the patch boundary using four bezier curves. + % + % This involves a change from Lagrange to bezier + % representation of the boundary curves. + % + \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@bicubic@AA\endvertex}% + \pgfplotspathcubicfrominterpolation + {\pgfplotspatchclass@bicubic@AA} + {\pgfplotspatchclass@bicubic@BA} + {\pgfplotspatchclass@bicubic@CA} + {\pgfplotspatchclass@bicubic@DA} + \pgfplotspathcubicfrominterpolation + {\pgfplotspatchclass@bicubic@DA} + {\pgfplotspatchclass@bicubic@DB} + {\pgfplotspatchclass@bicubic@DC} + {\pgfplotspatchclass@bicubic@DD} + \pgfplotspathcubicfrominterpolation + {\pgfplotspatchclass@bicubic@DD} + {\pgfplotspatchclass@bicubic@CD} + {\pgfplotspatchclass@bicubic@BD} + {\pgfplotspatchclass@bicubic@AD} + \pgfplotspathcubicfrominterpolation + {\pgfplotspatchclass@bicubic@AD} + {\pgfplotspatchclass@bicubic@AC} + {\pgfplotspatchclass@bicubic@AB} + {\pgfplotspatchclass@bicubic@AA} + \pgfpathclose + }, + stream to shader={% + \begingroup + % + % AD BD CD DD + % AC BC CC DC + % AB BB CB DB + % AA BA CA DA + % + % STEP 1: ensure that the patch's coordinates are streamed in + % a sequence which is compatible with the DEPTH of the + % corners. + % + % we use + % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth + % which works for bilinear, biquadratic, and bicubic + % + % define helper macros which are input for + % \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth: + \let\pgfplotspatchclass@rect@A=\pgfplotspatchclass@bicubic@AA + \let\pgfplotspatchclass@rect@B=\pgfplotspatchclass@bicubic@DA + \let\pgfplotspatchclass@rect@C=\pgfplotspatchclass@bicubic@DD + \let\pgfplotspatchclass@rect@D=\pgfplotspatchclass@bicubic@AD + \pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth + {pgfplotspatchclass@rect@}{\Pcur}{\Pnextseq}% + % + %\message{using \Pcur\space(set = \Pnextseq)^^J}% + % now, translate the result into our matrix form. + % This means to (a) identify the FIRST point which needs to be + % streamed (it is stored in \Pcur as 'A', 'B', 'C', or 'D') + % and (b) keep in mind that we have to take care of the + % sequence in which points are streamed ("forward" means to + % rotate the matrix elements and "backward" means to transpose + % the "forward" result). + % + \if A\Pcur + % Ah - the point "AA" needs to be streamed as first. + % + % Well, this is simple: take the matrix as-is! + % simply copy 1:1 + \let\P@AA=\pgfplotspatchclass@bicubic@AA + \let\P@BA=\pgfplotspatchclass@bicubic@BA + \let\P@CA=\pgfplotspatchclass@bicubic@CA + \let\P@DA=\pgfplotspatchclass@bicubic@DA + \let\P@AB=\pgfplotspatchclass@bicubic@AB + \let\P@BB=\pgfplotspatchclass@bicubic@BB + \let\P@CB=\pgfplotspatchclass@bicubic@CB + \let\P@DB=\pgfplotspatchclass@bicubic@DB + \let\P@AC=\pgfplotspatchclass@bicubic@AC + \let\P@BC=\pgfplotspatchclass@bicubic@BC + \let\P@CC=\pgfplotspatchclass@bicubic@CC + \let\P@DC=\pgfplotspatchclass@bicubic@DC + \let\P@AD=\pgfplotspatchclass@bicubic@AD + \let\P@BD=\pgfplotspatchclass@bicubic@BD + \let\P@CD=\pgfplotspatchclass@bicubic@CD + \let\P@DD=\pgfplotspatchclass@bicubic@DD + \fi + \if B\Pcur + % the "DA" point needs to be streamed as first. + % + % Reorder + % AD BD CD DD + % AC BC CC DC + % AB BB CB DB + % AA BA CA DA + % to + % AA AB AC AD + % BA BB BC BD + % CA CB CC CD + % DA DB DC DD + % + \let\P@AA=\pgfplotspatchclass@bicubic@DA + \let\P@BA=\pgfplotspatchclass@bicubic@DB + \let\P@CA=\pgfplotspatchclass@bicubic@DC + \let\P@DA=\pgfplotspatchclass@bicubic@DD + \let\P@AB=\pgfplotspatchclass@bicubic@CA + \let\P@BB=\pgfplotspatchclass@bicubic@CB + \let\P@CB=\pgfplotspatchclass@bicubic@CC + \let\P@DB=\pgfplotspatchclass@bicubic@CD + \let\P@AC=\pgfplotspatchclass@bicubic@BA + \let\P@BC=\pgfplotspatchclass@bicubic@BB + \let\P@CC=\pgfplotspatchclass@bicubic@BC + \let\P@DC=\pgfplotspatchclass@bicubic@BD + \let\P@AD=\pgfplotspatchclass@bicubic@AA + \let\P@BD=\pgfplotspatchclass@bicubic@AB + \let\P@CD=\pgfplotspatchclass@bicubic@AC + \let\P@DD=\pgfplotspatchclass@bicubic@AD + \fi + \if C\Pcur + % the "DD" point needs to be streamed as first. + % + % Reorder + % AD BD CD DD + % AC BC CC DC + % AB BB CB DB + % AA BA CA DA + % to + % DA CA BA AA + % DB CB BB AB + % DC CC BC AC + % DD CD BD AD + % + \let\P@AA=\pgfplotspatchclass@bicubic@DD + \let\P@BA=\pgfplotspatchclass@bicubic@CD + \let\P@CA=\pgfplotspatchclass@bicubic@BD + \let\P@DA=\pgfplotspatchclass@bicubic@AD + \let\P@AB=\pgfplotspatchclass@bicubic@DC + \let\P@BB=\pgfplotspatchclass@bicubic@CC + \let\P@CB=\pgfplotspatchclass@bicubic@BC + \let\P@DB=\pgfplotspatchclass@bicubic@AC + \let\P@AC=\pgfplotspatchclass@bicubic@DB + \let\P@BC=\pgfplotspatchclass@bicubic@CB + \let\P@CC=\pgfplotspatchclass@bicubic@BB + \let\P@DC=\pgfplotspatchclass@bicubic@AB + \let\P@AD=\pgfplotspatchclass@bicubic@DA + \let\P@BD=\pgfplotspatchclass@bicubic@CA + \let\P@CD=\pgfplotspatchclass@bicubic@BA + \let\P@DD=\pgfplotspatchclass@bicubic@AA + \fi + \if D\Pcur + % the "AD" point needs to be streamed as first. + % + % Reorder + % AD BD CD DD + % AC BC CC DC + % AB BB CB DB + % AA BA CA DA + % to + % DD DC DB DA + % CD CC CB CA + % BD BC BB BA + % AD AC AB AA + % + \let\P@AA=\pgfplotspatchclass@bicubic@AD + \let\P@BA=\pgfplotspatchclass@bicubic@AC + \let\P@CA=\pgfplotspatchclass@bicubic@AB + \let\P@DA=\pgfplotspatchclass@bicubic@AA + \let\P@AB=\pgfplotspatchclass@bicubic@BD + \let\P@BB=\pgfplotspatchclass@bicubic@BC + \let\P@CB=\pgfplotspatchclass@bicubic@BB + \let\P@DB=\pgfplotspatchclass@bicubic@BA + \let\P@AC=\pgfplotspatchclass@bicubic@CD + \let\P@BC=\pgfplotspatchclass@bicubic@CC + \let\P@CC=\pgfplotspatchclass@bicubic@CB + \let\P@DC=\pgfplotspatchclass@bicubic@CA + \let\P@AD=\pgfplotspatchclass@bicubic@DD + \let\P@BD=\pgfplotspatchclass@bicubic@DC + \let\P@CD=\pgfplotspatchclass@bicubic@DB + \let\P@DD=\pgfplotspatchclass@bicubic@DA + \fi + \ifx\Pnextseq\pgfutil@empty + \else + % reverse the ordering. This means to transpose the + % matrix: + \pgfplotspatchclass@bicubic@transpose + \fi + % + % Step: convert to tensor bezier representation. + % + % Converting a 2d tensor product lagrangian interpoland to a + % 2d tensor product bezier interpoland can be achieved by + % means of 1d algorithms along LINES in the matrix. + % + % The underlying proof for this is related to the tensor + % product form: the U and V coordinates are orthogonal to each + % other, so we can redistribute all intermediate results. (I + % do not have the real proof, so this hand-waving argument has + % to be enough). I verified its results experimentally. + % + % Note that the underlying 1d operation is the same as for + % 'patch type=cubic spline' . We only need to apply it to all + % lines in U direction and afterwards to all lines in V + % direction. + % + \def\pgfplotspatchvertexaddXY@expanded##1\times{% + \edef\pgfplots@loc@TMPa{##1}% + \expandafter\pgfplotspatchvertexaddXY\pgfplots@loc@TMPa\times + }% + % + % this macro operates on \pgfplots@line{[ABCD]}, see below: + \def\pgfplots@apply@to@line{% + \pgfplotspatchvertexaccumstart + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{-0.833333}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{3}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{-1.5}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{D}\times{0.3333333}% + \pgfplotspatchvertexfinish\pgfplots@controlpoint@A + % + \pgfplotspatchvertexaccumstart + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{A}\times{0.333333}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{B}\times{-1.5}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{C}\times{3}% + \pgfplotspatchvertexaddXY@expanded\pgfplots@line{D}\times{-0.833333}% + \pgfplotspatchvertexfinish\pgfplots@controlpoint@B + % + \expandafter\expandafter\expandafter\let\pgfplots@line{B}=\pgfplots@controlpoint@A + \expandafter\expandafter\expandafter\let\pgfplots@line{C}=\pgfplots@controlpoint@B + }% + % + \def\pgfplots@line##1{\csname P@##1A\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@##1B\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@##1C\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@##1D\endcsname}% + \pgfplots@apply@to@line + % + % + \def\pgfplots@line##1{\csname P@A##1\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@B##1\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@C##1\endcsname}% + \pgfplots@apply@to@line + % + \def\pgfplots@line##1{\csname P@D##1\endcsname}% + \pgfplots@apply@to@line + % + % OK. The tensor product representation is READY. + % + % Stream it to the shader. Note that the shader has a + % DIFFERENT ordering; it expects points in the cyclic ordering + % + % AA BA CA DA DB DC DD CD BD AD AC AB BB CB CC BC + % + % note furthermore that only the corners have "point meta" in + % this shading :-( + % + \expandafter\pgfplotspatchvertex\P@AA\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BA\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CA\endvertex}{\pgfplotspointmetatransformed}% + \expandafter\pgfplotspatchvertex\P@DA\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + % + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DB\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@DC\endvertex}{\pgfplotspointmetatransformed}% + \expandafter\pgfplotspatchvertex\P@DD\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + % + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CD\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BD\endvertex}{\pgfplotspointmetatransformed}% + \expandafter\pgfplotspatchvertex\P@AD\endvertex + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{\pgfqpoint\pgfplotspatchvertexx\pgfplotspatchvertexy}{\pgfplotspointmetatransformed}% + % + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AC\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@AB\endvertex}{\pgfplotspointmetatransformed}% + % + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BB\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CB\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@CC\endvertex}{\pgfplotspointmetatransformed}% + \pgfplotslibrarysurfstreamcoord{\expandafter\pgfplotspointpatchvertex\P@BC\endvertex}{\pgfplotspointmetatransformed}% + \endgroup + }, + triangulate={% + \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass + \def\pgfplotsplothandlermesh@patchclass{triangle}% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}% + % Ok. Now create a lot of triangles. + % + % FIXME: The ordering is not arbitrary (unless z buffer=sort is in effect). + % + % ##1: the row index of the cell to be triangulated (either A,B,or C) + % ##2: the col index of the cell to be triangulated (either A,B,or C) + % ##3: the 1. 'set edge visible' value for the first triangle + % ##4: the 2. 'set edge visible' value for the first triangle + % ##5: the 3. 'set edge visible' value for the first triangle + % ##6: the 1. 'set edge visible' value for the second triangle + % ##7: the 2. 'set edge visible' value for the second triangle + % ##8: the 3. 'set edge visible' value for the second triangle + \def\pgfplots@bicubic@triangulate@cell##1##2##3##4##5##6##7##8{% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}0##3% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}1##4% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}2##5% + \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1##2\endcsname}% + \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname##2\endcsname}% + \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname \csname pgfpptchindexnext@##2\endcsname\endcsname}% + % + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}0##6% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}1##7% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}2##8% + \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1\csname pgfpptchindexnext@##2\endcsname\endcsname}% + \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@##1##2\endcsname}% + \pgfplotsplothandlermesh@setnextvertex{\csname pgfplotspatchclass@bicubic@\csname pgfpptchindexnext@##1\endcsname \csname pgfpptchindexnext@##2\endcsname\endcsname}% + % + }% + % + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}10% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20% + \pgfplots@bicubic@triangulate@cell AA100 100% + \pgfplots@bicubic@triangulate@cell BA100 000% + \pgfplots@bicubic@triangulate@cell CA110 000% + % + \pgfplots@bicubic@triangulate@cell AB000 100% + \pgfplots@bicubic@triangulate@cell BB000 000% + \pgfplots@bicubic@triangulate@cell CB010 000% + % + \pgfplots@bicubic@triangulate@cell AC000 101% + \pgfplots@bicubic@triangulate@cell BC000 001% + \pgfplots@bicubic@triangulate@cell CC010 001% + \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@ + },% + serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% + deserialize except vertices=, + get pdf shading type=7, + get num vertices=16, + get num cdata vertices=4, +}% + +% Transpose a bicubic matrix (4x4). +% +% Reorder +% AD BD CD DD +% AC BC CC DC +% AB BB CB DB +% AA BA CA DA +% to +% DA DB DC DD +% CA CB CC CD +% BA BB BC BD +% AA AB AC AD +\def\pgfplotspatchclass@bicubic@transpose{% + \pgfplotsutil@swap\P@AB\P@BA + \pgfplotsutil@swap\P@CA\P@AC + \pgfplotsutil@swap\P@DA\P@AD + \pgfplotsutil@swap\P@CB\P@BC + \pgfplotsutil@swap\P@BD\P@DB + \pgfplotsutil@swap\P@DC\P@CD +} +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/lua/pgfplots.lua b/Master/texmf-dist/tex/generic/pgfplots/lua/pgfplots.lua new file mode 100644 index 00000000000..8242222e8d6 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/lua/pgfplots.lua @@ -0,0 +1,30 @@ + +pgfplotsGetLuaBinaryStringFromCharIndicesChunkSize = 7000; + +-- Takes a table containing an arbitrary number of integers in the range 0..255 and converts it +-- into a binary stream of the corresponding binary chars. +-- +-- @param charIndices a table containing 0...N arguments; each in the range 0..255 +-- +-- @return a string containing binary content, one byte for each input integer. +function pgfplotsGetLuaBinaryStringFromCharIndices(charIndices) + -- unpack extracts only the indices (we can't provide a table to string.char). + -- note that pdf.immediateobj has been designed to avoid sanity checking for invalid UTF strings - + -- in other words: it accepts binary strings. + -- + -- unfortunately, this here fails for huge input tables: + -- pgfplotsretval=string.char(unpack(charIndices)); + -- we have to create it incrementally using chunks: + local len = #charIndices; + local chunkSize = pgfplotsGetLuaBinaryStringFromCharIndicesChunkSize; + local buf = {}; + -- ok, append all full chunks of chunkSize first: + local numFullChunks = math.floor(len/chunkSize); + for i = 0, numFullChunks-1, 1 do + table.insert(buf, string.char(unpack(charIndices, 1+i*chunkSize, (i+1)*chunkSize))); + end + -- append the rest: + table.insert(buf, string.char(unpack(charIndices, 1+numFullChunks*chunkSize))); + return table.concat(buf); +end + 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 91677f6e15e..54c29ff4959 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -58,7 +58,7 @@ % just make sure no-one complaints if manual example are used without % booktabs loaded: -\pgfutil@ifundefined{toprule}{% +\pgfutil@IfUndefined{toprule}{% \def\toprule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\toprule}}% \def\midrule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\midrule}}% \def\bottomrule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\bottomrule}}% @@ -2955,7 +2955,7 @@ \pgfplotstable@copy@globalbuffers@to{#1}% }% -\pgfutil@ifundefined{pgfcalendardatetojulian}{% +\pgfutil@IfUndefined{pgfcalendardatetojulian}{% \def\pgfcalendardatetojulian#1#2{\pgfplots@error{Sorry, you need to use \string\usepackage{pgfcalendar} before using date specific methods}}% }{}% \endinput 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 48bb178afbc..3c8fde67285 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 @@ -25,7 +25,7 @@ % #2: for normal processing. \def\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero#1#2{% %\pgfkeysifdefined{/pgf/number format/sci precision/.@cmd}{#2}{#1}% - \pgfutil@ifundefined{pgfplothandlerjumpmarkmid}{#1}{#2}% + \pgfutil@ifundefined{pgfmathprintnumber@RELATIVE@choice@roundtofixed}{#1}{#2}% }% \let\pgfplots@ifneedspgfcompabitibilitycode=\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero @@ -39,8 +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 + \input pgfplotsoldpgfsupp_pgfcorelayers.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 6a9a4cc2b5a..f9f260b1d7d 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 @@ -8,6 +8,26 @@ }{}% } +% check if \endtikzpicture deals with layerlist: +\expandafter\pgfutil@in@\expandafter\pgf@remember@layerlist@globally\expandafter{\endtikzpicture}% +\ifpgfutil@in@ +\else + \def\endtikzpicture{% + \tikz@atend@picture% + \global\let\pgf@shift@baseline@smuggle=\pgf@baseline% + \global\let\pgf@trimleft@final@smuggle=\pgf@trimleft% + \global\let\pgf@trimright@final@smuggle=\pgf@trimright% + \global\let\pgf@remember@smuggle=\ifpgfrememberpicturepositiononpage% + \pgf@remember@layerlist@globally + \endscope% + \let\pgf@baseline=\pgf@shift@baseline@smuggle% + \let\pgf@trimleft=\pgf@trimleft@final@smuggle% + \let\pgf@trimright=\pgf@trimright@final@smuggle% + \let\ifpgfrememberpicturepositiononpage=\pgf@remember@smuggle% + \pgf@restore@layerlist@from@global + \endpgfpicture} +\fi + % ====================================================== % 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 5ad04db77bb..487856a5a01 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% 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 index bd8a45071ee..8379e1d4f1a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorelayers.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% 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 index 5c9a407b9c6..e2b22b73890 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcorescopes.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% 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 c933914a9c4..3afa39b2a2d 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% @@ -711,8 +711,6 @@ \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5}% \or \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6}% - \or - \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6}% \or \pgfkeyssetvalue{#1/.@args}{##1##2##3##4##5##6##7}% \or 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 51a3f911a57..cdbb8e0b541 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 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 be3a2179c6b..efb75e10b9c 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% 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 22127f8f1d3..6801918d200 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% @@ -27,7 +27,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.16 2011/12/28 18:51:18 ludewich Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.17 2012/09/11 20:03:46 ludewich Exp $ \newif\ifpgf@plot@started @@ -395,12 +395,19 @@ \pgfplotyzerolevelstreamconstant{0pt}% \def\pgfplotbarwidth{\pgfkeysvalueof{/pgf/bar width}} +\def\pgfplotbarshift{\pgfkeysvalueof{/pgf/bar shift}} \pgfqkeys{/pgf}{% bar width/.initial=10pt, bar shift/.initial=0pt, bar interval width/.initial=1, bar interval shift/.initial=0.5, + % + % hook which is executed right before a new bar is begun. + at begin bar/.initial=, + % hook which is executed right after a bar path has been finished. + % In this context, the bar's path has not been used. + at end bar/.initial=, } % This handler places a rectangle at each point in the plot stream, a @@ -422,13 +429,14 @@ \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend% \pgfmathparse{\pgfplotbarwidth}% \xdef\pgfplotbarwidth@{\pgfmathresult pt}% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}% + \pgfmathparse{\pgfplotbarshift}% \xdef\pgfplotbarshift@{\pgfmathresult pt}% \pgfplotyzerolevelstreamstart }% } \def\pgf@plot@ybar@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@y \expandafter\pgf@xb\pgfplotbarwidth@\relax @@ -443,6 +451,7 @@ \pgfpathrectangle {\pgfqpoint{\pgf@xc}{\pgf@yb}}% {\pgfqpoint{\pgf@xb}{\pgf@ya}}% + \pgfkeysvalueof{/pgf/at end bar}% } % This handler places a rectangle at each point in the plot stream, a @@ -464,13 +473,14 @@ \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend% \pgfmathparse{\pgfplotbarwidth}% \xdef\pgfplotbarwidth@{\pgfmathresult pt}% - \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}% + \pgfmathparse{\pgfplotbarshift}% \xdef\pgfplotbarshift@{\pgfmathresult pt}% \pgfplotxzerolevelstreamstart }% } \def\pgf@plot@xbar@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@x \expandafter\pgf@xb\pgfplotbarwidth@\relax @@ -485,6 +495,7 @@ \pgfpathrectangle {\pgfqpoint{\pgf@yb}{\pgf@xc}}% {\pgfqpoint{\pgf@ya}{\pgf@xb}}% + \pgfkeysvalueof{/pgf/at end bar}% } % This handler is a variant of \pgfplothandlerybar which works with @@ -540,6 +551,7 @@ \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler% } \def\pgf@plot@ybarinterval@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@plot@barinterval@bar \xdef\pgf@plot@barinterval@bar{\the\pgf@y}% @@ -558,6 +570,7 @@ \pgfpathrectangle {\pgfqpoint{\pgf@xc}{\pgf@yb}}% {\pgfqpoint{\pgf@xb}{\pgf@ya}}% + \pgfkeysvalueof{/pgf/at end bar}% } % Like \pgfplothandlerybarinterval but for xbar. @@ -581,6 +594,7 @@ \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler% } \def\pgf@plot@xbarinterval@handler#1{% + \pgfkeysvalueof{/pgf/at begin bar}% \pgf@process{#1}% \pgf@ya=\pgf@plot@barinterval@bar \xdef\pgf@plot@barinterval@bar{\the\pgf@x}% @@ -599,6 +613,7 @@ \pgfpathrectangle {\pgfqpoint{\pgf@yb}{\pgf@xc}}% {\pgfqpoint{\pgf@ya}{\pgf@xb}}% + \pgfkeysvalueof{/pgf/at end bar}% } 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 d553f4c4272..0532c6876b2 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 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 c9eacad8bf6..d7df866355c 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 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 51a4122f811..8b0770245c8 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 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 4a795f89cd5..10aeaa849fb 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% @@ -932,6 +932,11 @@ \let\pgfmathround@@orig=\pgfmathround@ +% 2 = compatible +% 0 = no +% 1 = yes +\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{2}% + \newif\ifpgfmathprintnumber@thousand@sep@in@fractional \pgfkeys{% /pgf/number format/.is family, @@ -940,6 +945,10 @@ sci/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI}, std/.code= {\pgfmath@set@number@printer{pgfmathprintnumber@STD}\pgfmathprintnumber@STD@setparam{#1}}, std/.default=,% + relative round mode/.is choice, + relative round mode/fixed/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{1}}, + relative round mode/mantissa/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{0}}, + relative round mode/compatible/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{2}}, % relative={} relative/.code= {% \pgfmath@set@number@printer{pgfmathprintnumber@RELATIVE}% @@ -948,7 +957,9 @@ \let\pgfmathprintnumber@RELATIVE@param=\pgfmathresult },% relative/.value required, + relative*/.style={/pgf/number format/relative={#1},/pgf/number format/relative round mode=fixed}, every relative/.style=std, + relative style/.style={/pgf/number format/every relative/.append style={#1}}, fixed relative/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED@RELATIVE}, int detect/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@DETECT}, int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC}, @@ -982,13 +993,13 @@ sci precision=, fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT}, set decimal separator/.initial=, - dec sep/.style={/pgf/number format/set decimal separator=#1}, + dec sep/.style={/pgf/number format/set decimal separator={#1}}, @dec sep mark/.initial=, @sci exponent mark/.initial=, set thousands separator/.initial=, 1000 sep in fractionals/.is if=pgfmathprintnumber@thousand@sep@in@fractional, 1000 sep in fractionals/.default=true, - 1000 sep/.style={/pgf/number format/set thousands separator=#1}, + 1000 sep/.style={/pgf/number format/set thousands separator={#1}}, min exponent for 1000 sep/.initial=0, use period/.style= {/pgf/number format/set decimal separator={.},/pgf/number format/set thousands separator={{{,}}}}, use comma/.style= {/pgf/number format/set decimal separator={{{,}}},/pgf/number format/set thousands separator={.}}, @@ -1103,6 +1114,11 @@ \expandafter\pgfmathprintnumber@RELATIVE@issci\pgfmathresult\relax } +\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn{% + \immediate\write16{! Package pgf warning: the use of /pgf/number format/relative is discouraged (buggy). Please use 'relative*' instead or type \string\pgfkeys{/pgf/number format/relative round mode=fixed} into your preamble.}% + \global\let\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn=\relax +} + \def\pgfmathprintnumber@RELATIVE@issci#1#2e#3\relax{% \begingroup % format X / 10^{relative}: @@ -1110,16 +1126,35 @@ \advance\c@pgf@counta by-\pgfmathprintnumber@RELATIVE@param\relax \pgfmathfloatcreate{#1}{#2}{\the\c@pgf@counta}% % OK, round it to the desired precision: - \ifnum\c@pgf@counta>0 - % hm. for positive exponents, we should round the - % mantissa rather than only the fractional part. - \expandafter\pgfmathfloatround\expandafter{\pgfmathresult}% - \else - % negative exponent -> round fixed representation: + \if0\pgfmathprintnumber@RELATIVE@choice@roundtofixed + % relative round mode=mantissa + \def\b@round@fixed{0}% + \else + \if1\pgfmathprintnumber@RELATIVE@choice@roundtofixed + % relative round mode=fixed + \def\b@round@fixed{1}% + \else + \pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn + % relative round mode=compatible + \ifnum\c@pgf@counta>0 + % hm. for positive exponents, we should round the + % mantissa rather than only the fractional part. + \def\b@round@fixed{0}% + \else + % negative exponent -> round fixed representation: + \def\b@round@fixed{1}% + \fi + \fi + \fi + \if1\b@round@fixed + % round fixed representation: \pgfmathfloattofixed\pgfmathresult \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% \pgfmathfloatparsenumber{\pgfmathresult}% \pgfmathfloatroundhasperiodtrue% make sure the code below works: + \else + % round the mantissa: + \expandafter\pgfmathfloatround\expandafter{\pgfmathresult}% \fi % Now, compute result * 10^{relative} and format the result: \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E 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 cbd3b957c6e..7f42aaec1b8 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 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 17feb576361..eabbcad77b7 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 CEST 2012 %%% 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 aca706b459f..49a7f10f8a4 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: Fr 17. Aug 20:12:53 CEST 2012 %%% +%%% Date of this copy: Sa 22. Sep 18:44:37 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 7bf4e86b27a..7edbb15a4c3 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -65,11 +65,14 @@ \newdimen\pgfplots@zmax@reg \newif\ifpgfplots@warn@for@filter@discards \newif\ifpgfplots@isuniformtick +\newif\ifpgfplotsplothandlermesh@patch@type@sampling \newif\ifpgfplots@clip@limits \newif\ifpgfplots@clip \newif\ifpgfplots@plot@coords@mathparser \pgfplots@plot@coords@mathparsertrue \newif\ifpgfplots@enlargelimits +\newif\ifpgfplots@enlargelimits@respect@figure@size +\pgfplots@enlargelimits@respect@figure@sizetrue \newif\ifpgfplots@enlargelimits@rel@thresh \newif\ifpgfplots@enlargelimits@auto \newif\ifpgfplots@tickshow @@ -138,7 +141,7 @@ % Invokes '#2' if a cycle list named '#1' exists and '#3' if not. \long\def\pgfplotsifcyclelistexists#1#2#3{% - \pgfutil@ifundefined{pgfp@cyclist@\string#1@}{#3}{#2}% + \pgfutil@IfUndefined{pgfp@cyclist@\string#1@}{#3}{#2}% }% % Creates a named plot cycle list. @@ -1183,12 +1186,6 @@ /pgfplots/scale ticks below exponent/.store in= \pgfplots@scale@ticks@below@exponent, /pgfplots/scale ticks below exponent/.belongs to family=/pgfplots/tick, /pgfplots/scale ticks below exponent=-1, - /pgfplots/subtickwidth/.store in= \pgfplots@subtickwidth, - /pgfplots/subtickwidth/.belongs to family=/pgfplots/tick, - /pgfplots/subtickwidth=0.1cm, - /pgfplots/tickwidth/.store in= \pgfplots@tickwidth, - /pgfplots/tickwidth/.belongs to family=/pgfplots/tick, - /pgfplots/tickwidth=0.15cm, /pgfplots/minor x tick num/.initial=0, /pgfplots/minor x tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor y tick num/.initial=0, @@ -1213,10 +1210,14 @@ /pgfplots/minor ztick={#1}, }, /pgfplots/minor tick/.belongs to family=/pgfplots/tick, - /pgfplots/minor tick length/.estore in=\pgfplots@subtickwidth, + % + /pgfplots/subtickwidth/.style= {/pgfplots/minor tick length={#1}}, + /pgfplots/tickwidth/.style= {/pgfplots/major tick length={#1}}, /pgfplots/minor tick length/.belongs to family=/pgfplots/tick, - /pgfplots/major tick length/.estore in=\pgfplots@tickwidth, + /pgfplots/minor tick length/.initial=0.1cm, /pgfplots/major tick length/.belongs to family=/pgfplots/tick, + /pgfplots/major tick length/.initial=0.15cm, + % /pgfplots/max space between ticks/.estore in=\axisdefaulttickwidth, /pgfplots/max space between ticks/.belongs to family=/pgfplots/tick, /pgfplots/max space between ticks=35,% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt') @@ -1880,7 +1881,7 @@ /pgfplots/prefix/.code={\pgfkeysalso{/tikz/prefix={#1}}}, /pgfplots/raw gnuplot/.code={\pgfkeysalso{/tikz/raw gnuplot={#1}}}, /pgfplots/parametric/.code={\pgfkeysalso{/tikz/parametric={#1}}},% - % + % /pgfplots/width/.initial=,% /pgfplots/width/.belongs to family=/pgfplots, /pgfplots/height/.initial=,% @@ -1909,6 +1910,7 @@ /pgfplots/enlarge z limits=#1,% },% /pgfplots/enlargelimits/.default=true, + /pgfplots/enlargelimits respects figure size/.is if=pgfplots@enlargelimits@respect@figure@size, /pgfplots/update limits/.is if=pgfplots@bb@isactive, /pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/x/.belongs to family=/pgfplots, @@ -2674,14 +2676,14 @@ % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% - \draw[xshift={\pgfkeysvalueof{/pgf/bar shift}}] + \draw[xshift={\pgfplotbarshift}] ##1 -- ##2 node[pos=1,sloped,allow upside down] {% \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% \pgfusepath{stroke}}% }; },% - /pgfplots/every node near coord/.append style={xshift={\pgfkeysvalueof{/pgf/bar shift}}},% + /pgfplots/every node near coord/.append style={xshift={\pgfplotbarshift}},% /tikz/ybar, }, /pgfplots/ybar/.default=2pt, @@ -2706,14 +2708,14 @@ % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% - \draw[yshift={\pgfkeysvalueof{/pgf/bar shift}}] + \draw[yshift={\pgfplotbarshift}] ##1 -- ##2 node[pos=1,sloped,allow upside down] {% \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% \pgfusepath{stroke}}% }; },% - /pgfplots/every node near coord/.append style={yshift={\pgfkeysvalueof{/pgf/bar shift}}},% + /pgfplots/every node near coord/.append style={yshift={\pgfplotbarshift}},% /tikz/xbar, }, /pgfplots/xbar/.default=2pt, @@ -2817,6 +2819,7 @@ /pgfplots/plot graphics/auto adjust axis/.is if=pgfplots@plot@graphics@autoadjustaxis, /pgfplots/plot graphics/auto adjust axis=true, /pgfplots/plot graphics/snap z/.initial=0.02, + % possible values: debug=|false|true|visual /pgfplots/plot graphics/debug/.initial=, /pgfplots/plot graphics/debug/.default=true, /pgfplots/plot graphics/squeeze tol/.initial=2pt, @@ -2892,6 +2895,7 @@ \pgfkeysalso{/pgfplots/point meta/explicit}% }, /pgfplots/patch type/.initial=, + /pgfplots/patch type sampling/.is if=pgfplotsplothandlermesh@patch@type@sampling, /pgfplots/patch internal depth/.is if=pgfplotsplothandlermesh@internaldepth, /pgfplots/patch internal depth=true, /pgfplots/patch to triangles/.is choice, @@ -3335,6 +3339,7 @@ /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/1.7/.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},% % @@ -3345,6 +3350,7 @@ /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/1.7/.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},% % @@ -3355,6 +3361,7 @@ /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/1.6/.style= {/pgfplots/compat/path replacement/1.5.1}, + /pgfplots/compat/path replacement/1.7/.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, @@ -3370,6 +3377,7 @@ /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/1.7/.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 :-( % @@ -3394,6 +3402,7 @@ \def\pgfplots@compat@scaling@coordmath{float}% \def\pgfplots@compat@scaling@coordmath@final{float}% }, + /pgfplots/compat/scaling/1.7/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4}, % @@ -3404,6 +3413,7 @@ /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/1.7/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/newest/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/default/.style={/pgfplots/compat/scale mode/1.5}, % @@ -3415,6 +3425,7 @@ /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/1.7/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/newest/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/default/.style= {/pgfplots/compat/plot3graphics/1.5},% % @@ -3445,6 +3456,16 @@ % % Sorry. % + /pgfplots/compat/bar width by units/.is choice, + /pgfplots/compat/bar width by units/pre 1.3/.code= {\def\b@pgfplots@compat@bar@width@units{1}},% + /pgfplots/compat/bar width by units/1.3/.style= {/pgfplots/compat/bar width by units/pre 1.3}, + /pgfplots/compat/bar width by units/1.4/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.5/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.5.1/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.6/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.7/.code= {\def\b@pgfplots@compat@bar@width@units{0}},% + /pgfplots/compat/bar width by units/newest/.style= {/pgfplots/compat/bar width by units/1.7}, + /pgfplots/compat/bar width by units/default/.style={/pgfplots/compat/bar width by units/pre 1.3}, % /pgfplots/compat/general/.is choice, /pgfplots/compat/general/pre 1.3/.style={/pgfplots/log origin=infty},% @@ -3453,13 +3474,14 @@ /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/1.7/.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/mostrecent/.initial=1.7, /pgfplots/compat/.style={% % ATTENTION: *every* /pgfplots/compat/ setting needs to accept % the same choices due to this construction: @@ -3472,6 +3494,7 @@ /pgfplots/compat/general=#1,% /pgfplots/compat/path replacement=#1,% /pgfplots/compat/plot3graphics=#1,% + /pgfplots/compat/bar width by units=#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. @@ -3552,6 +3575,10 @@ },% } +% backwards compatibility: +\def\pgfplots@tickwidth{\pgfkeysvalueof{/pgfplots/major tick length}}% +\def\pgfplots@subtickwidth{\pgfkeysvalueof{/pgfplots/minor tick length}}% + \pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@colorbar@draw@defaultimpl % call @@ -4593,7 +4620,7 @@ \fi } -\pgfutil@ifundefined{AtBeginDocument}{}{% +\pgfutil@IfUndefined{AtBeginDocument}{}{% \AtBeginDocument{% \let\pgfplots@original@LaTeX@label@loadtime=\label }% @@ -4613,7 +4640,7 @@ \string\protect \string\csname\space #3#2\string\endcsname }% - \pgfutil@ifundefined{hyper@makecurrent}{}{% + \pgfutil@IfUndefined{hyper@makecurrent}{}{% \hyper@makecurrent{pgfplotslink}% \hyper@anchorstart{\@currentHref}{}\hyper@anchorend \pgfplotsutil@advancestringcounter@global\c@pgfplots@label @@ -4623,7 +4650,7 @@ % \label in sub \let\sf@@memsub@label=\pgfplots@original@LaTeX@label@loadtime % - \pgfutil@ifundefined{label}{% + \pgfutil@IfUndefined{label}{% }{% \def\pgfplots@loc@TMPa{\label #1}% \expandafter\pgfplots@loc@TMPa\expandafter{#2}% the \expandafter is a convenience method; the name should be expandable anyway @@ -4638,8 +4665,8 @@ \pgfplots@texdist@protect\pgfplotslegendfromname@{#1}% }% \def\pgfplotslegendfromname@#1{% - \pgfutil@ifundefined{pgfplots@legend@to@name@#1}{% - \pgfutil@ifundefined{ref}{% + \pgfutil@IfUndefined{pgfplots@legend@to@name@#1}{% + \pgfutil@IfUndefined{ref}{% \pgfplots@warning{There is no `legend to name=#1', sorry. I am skipping it}% \string\pgfplotslegendfromname{#1}: ??% }{% @@ -4654,8 +4681,8 @@ \pgfplots@texdist@protect\pgfplotscolorbarfromname@{#1}% }% \def\pgfplotscolorbarfromname@#1{% - \pgfutil@ifundefined{pgfplots@colorbar@to@name@#1}{% - \pgfutil@ifundefined{ref}{% + \pgfutil@IfUndefined{pgfplots@colorbar@to@name@#1}{% + \pgfutil@IfUndefined{ref}{% \pgfplots@warning{There is no `colorbar to name=#1', sorry. I am skipping it}% \string\pgfplotscolorbarfromname{#1}: ??% }{% @@ -4670,8 +4697,8 @@ \pgfplots@texdist@protect\pgfplotsplotfromname@{#1}% }% \def\pgfplotsplotfromname@#1{% - \pgfutil@ifundefined{pgfplots@show@ref@#1}{% - \pgfutil@ifundefined{ref}{% + \pgfutil@IfUndefined{pgfplots@show@ref@#1}{% + \pgfutil@IfUndefined{ref}{% \pgfplots@warning{There is no \string\addplot\space label `#1', sorry. I am skipping it}% \string\pgfplotsplotfromname{#1}: ??% }{% @@ -4683,7 +4710,7 @@ }% \def\pgfplots@ifintikzpicture#1#2{% - \pgfutil@ifundefined{filldraw}{#2}{#1}% + \ifpgfpicture #1\else #2\fi }% % DEPRECATED. @@ -4761,19 +4788,43 @@ }{}% \fi }% + +\def\pgfplots@enlargelimits@rel@unitserror#1{% + \pgfplots@error{enlarge limits only supports values with units for 'abs=#1' and/or 'abs value=#1'. Ignoring unit}% +}% \pgfkeysdef{/pgfplots/@enlargelimits/value}{% \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgfplots@enlargelimits@rel@unitserror{#1}% + \fi \let\pgfplots@enlargelimits@relthresh=\pgfmathresult \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty }% \pgfkeysdef{/pgfplots/@enlargelimits/rel}{\pgfkeysalso{true,value={#1}}}% \pgfkeysdef{/pgfplots/@enlargelimits/abs value}{% \begingroup - \pgfplotscoordmath{\pgfplots@enlargelimits@curaxis}{datascaletrafo set shift}{0}% - \expandafter\csname pgfplotstransformcoordinate\pgfplots@enlargelimits@curaxis\endcsname{#1}% - \pgfmath@smuggleone\pgfmathresult + \ifpgfplots@usefpu + \pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}% + \fi + \pgfmathparse{#1}% + \xdef\pgfplots@glob@TMPa{% + \ifpgfmathunitsdeclared + \noexpand\pgfmathunitsdeclaredtrue + \else + \noexpand\pgfmathunitsdeclaredfalse + \fi + \noexpand\def\noexpand\pgfmathresult{\pgfmathresult}% + }% \endgroup - \let\pgfplots@enlargelimits@absthresh=\pgfmathresult + \pgfplots@glob@TMPa + \ifpgfmathunitsdeclared + \edef\pgfplots@enlargelimits@absdimension{\pgfmathresult pt}% + \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty + \else + \let\pgfplots@enlargelimits@absdimension=\pgfutil@empty + \csname pgfplotstransformdirection\pgfplots@enlargelimits@curaxis\endcsname{\pgfmathresult}% + \let\pgfplots@enlargelimits@absthresh=\pgfmathresult + \fi \let\pgfplots@enlargelimits@relthresh=\pgfutil@empty }% \pgfkeysdef{/pgfplots/@enlargelimits/abs}{\pgfkeysalso{true,abs value={#1}}}% @@ -4781,10 +4832,31 @@ \def\pgfplots@enlarge@limit@ifconfigured#1{% \begingroup + % ATTENTION: this uses similar access patterns as + % \pgfplots@enlarge@limit@by@dimension \def\bool@pgfplots@loc@enlargelimits@min{0}% \def\bool@pgfplots@loc@enlargelimits@max{0}% + % + % we can either enlarge + % ... using a relative limit (like 0.1 -> 10%) \def\pgfplots@enlargelimits@relthresh{0.1}% the default + % ...or an absolute limit ( like 4 units) \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty + % or an absolute dimension (like 1cm). + % + % Relative and absolute values are relatively simple: we only need to compute and + % add the changes to the already existing limits. The value with + % an absolute dimension is surprisingly complicated. + % + % The problem is: enlargelimits has to be computed before the + % image has been scaled into its final size. This is not merely a + % technical problem; this is how one wants it to be! + % + % The solution taken here is to communicate such an absolute + % dimension to the scaling routines. The scaling routines will + % handle the case; we don't change limits here. + % + \let\pgfplots@enlargelimits@absdimension=\pgfutil@empty \def\pgfplots@enlargelimits@curaxis{#1}% % \pgfkeysgetvalue{/pgfplots/enlarge #1 limits}{\pgfplots@loc@TMPa}% @@ -4803,13 +4875,230 @@ \pgfplots@enlarge@limit@for{#1}% \fi \global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany - % assignments are made globally. + % limits assignments are made globally. + \xdef\pgfplots@glob@TMPb{% + \noexpand\pgfplots@enlargelimits@remember@abs@dimension{#1}% + {\bool@pgfplots@loc@enlargelimits@min}% + {\bool@pgfplots@loc@enlargelimits@max}% + {\pgfplots@enlargelimits@absdimension}% + }% \endgroup + \pgfplots@glob@TMPb \if1\pgfplots@glob@TMPa \pgfplots@visphase@notify@changeofcanvaslimits{#1}% \fi } +% Reconfigures the scaling routines such that following calls to +% \pgfplots@scaleaxes@to@BB@ will enlarge the limit for a specific +% axis by an absolute dimension. +% +% This enlargement is different from standard limit enlargement: +% Standart limit enlargement is typically applied (and finished) long +% before the scaling routines start. In fact, the result of +% enlargelimits is typically the input argument for the scaling +% (compare the pgfplots manual (pdf)). +% +% This here needs a different treatment because "enlarge x limits={abs=1cm}" +% has to be applied AFTER the scaling is complete. To this end, it is +% applied as the very last scaling step. It is applied after any post +% scales, and it only modifies axis limits. +% +% #1: x,y, or z +% #2: 1 if the lower limit shall be enlarged, 0 if not +% #3: 1 if the upper limit shall be enlarged, 0 if not +% #4: some absolute dimension (like 1cm) by which we want to enlarge +% axis limits. +\def\pgfplots@enlargelimits@remember@abs@dimension#1#2#3#4{% + \expandafter\edef\csname pgfplots@enlargelimits@absdimension@#1\endcsname{#4}% + \expandafter\edef\csname pgfplots@enlargelimits@absdimension@#1@minmax\endcsname{{#2}{#3}}% +}% +\let\pgfplots@enlargelimits@absdimension@x=\pgfutil@empty +\let\pgfplots@enlargelimits@absdimension@y=\pgfutil@empty +\let\pgfplots@enlargelimits@absdimension@z=\pgfutil@empty + +% Called as soon as the scaling is completely set up and any +% "enlarge #1 limits={abs=1cm}" +% enlargements shall be done, i.e. enlargement by unit. +% +% #1: x,y, or z +\def\pgfplots@scaling@apply@enlargelimits@by@dimension#1{% + \expandafter\ifx\csname pgfplots@enlargelimits@absdimension@#1\endcsname\pgfutil@empty + \else + \pgfplotsconvertunittocoordinate{#1}{\csname pgfplots@enlargelimits@absdimension@#1\endcsname}% + \edef\pgfplots@loc@TMPa{% + \noexpand\pgfplots@enlarge@limit@by@dimension{#1} + \csname pgfplots@enlargelimits@absdimension@#1@minmax\endcsname + {\pgfmathresult}% + }% + \pgfplots@loc@TMPa + \fi +}% + + +% PRECONDITION: +% 1. width/height are set +% 2. the unit vectors point indicate whether the axis is a standard +% box or some skewed plot (their precise direction and magnitude is +% irrelevant) +% 3. the enlargelimits code has already evaluated the case +% "enlargelimits={abs=1cm}" +% +% POSTCONDITION: +% width and/or height might be modified +\def\pgfplots@scaling@changewidthheight@for@enlargelimits@by@dimension{% + \ifpgfplots@enlargelimits@respect@figure@size + % + % decide if we need to do anything at all, i.e. if there IS + % some option 'enlarge * limits={abs=1cm}' : + \pgfplots@loc@tmpfalse + \ifx\pgfplots@enlargelimits@absdimension@x\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + \ifx\pgfplots@enlargelimits@absdimension@y\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + \ifx\pgfplots@enlargelimits@absdimension@z\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + % + \ifpgfplots@loc@tmp + \def\pgfplotsretval{}% + % ok. We encountered an option 'enlarge * limits={abs=1cm}' for at least one axis. + % and we WANT to keep 'width', 'height'. + % + % This is not quite trivial because in order to compute + % enlarge-by-dimension, we NEED the unit vectors. But the + % unit vectors need the limits - a nonlinear problem. + % + % Since this here is not really a common use-case, I + % decided to implement a heuristics which works in most + % common cases: for standard 2d axes. It might fail for + % skewed axes and it will probably fail for 3d axes. + % + % My idea is to change width and/or height BEFORE the unit + % vectors have been computed. + % + % First: check if we HAVE a standard 2d axis. + \pgfplots@loc@tmpfalse + \ifpgfplots@threedim + \else + \ifdim\pgf@xx=0sp % + \else + \ifdim\pgf@xy=0sp % + \ifdim\pgf@yx=0sp % + \ifdim\pgf@yy=0sp % + \else + \pgfplots@loc@tmptrue + \fi + \fi + \fi + \fi + \fi + % + \ifpgfplots@loc@tmp + \def\pgfplots@loc@TMPc{{1}{1}}% + % + % ah - we really *have* a standard boxed axis. + % Compute + % newwidth = width - enlargevalue + % newheight = height - enlargevalue + % + % newwidth will be stored in \pgfplots@loc@TMPa + % and newheight in \pgfplots@loc@TMPb + \ifx\pgfplots@enlargelimits@absdimension@x\pgfutil@empty + \let\pgfplots@loc@TMPa=\pgfplots@width + \else + \ifx\pgfplots@enlargelimits@absdimension@x@minmax\pgfplots@loc@TMPc + \def\pgfmathresult{2}% + \else + \def\pgfmathresult{1}% + \fi + \pgfmathparse{\pgfplots@width - \pgfmathresult * \pgfplots@enlargelimits@absdimension@x}% + \edef\pgfplots@loc@TMPa{\pgfmathresult pt}% + \fi + % + \ifx\pgfplots@enlargelimits@absdimension@y\pgfutil@empty + \let\pgfplots@loc@TMPb=\pgfplots@height + \else + \ifx\pgfplots@enlargelimits@absdimension@y@minmax\pgfplots@loc@TMPc + \def\pgfmathresult{2}% + \else + \def\pgfmathresult{1}% + \fi + \pgfmathparse{\pgfplots@height - \pgfmathresult * \pgfplots@enlargelimits@absdimension@y}% + \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% + \fi + % + % OK. if( newwidth>0 && newheight>0 ), we can proceed. + \pgfplots@loc@tmpfalse + \ifdim\pgfplots@loc@TMPa>10pt % + \ifdim\pgfplots@loc@TMPb>10pt % + \pgfplots@loc@tmptrue + \fi + \fi + \ifpgfplots@loc@tmp + % Ah: newheight>0 && newheight>0 . Good. + \let\pgfplots@width=\pgfplots@loc@TMPa + \let\pgfplots@height=\pgfplots@loc@TMPb + \else + \def\pgfplotsretval{enlarge value are bigger than old picture size}% + \fi + \else + \def\pgfplotsretval{size adjust is unavailable for non-standard axes}% + \fi + \ifx\pgfplotsretval\pgfutil@empty + \else + \pgfplots@warning{enlargelimits respects figure size=true: could not respect the prescribed width/height (\pgfplotsretval). The size and/or aspect ratio of your image will be different than expected. You can try to modify BOTH width and height.}% + \fi + \fi + \fi +} + +% this here applies changes required for 'enlarge #1 limits={abs=1cm}', i.e. +% for the case of numbers with units. +% +% The main difference is that it is applied AFTER the scaling of the +% axis is complete. +% +% #1: x,y,or z +% #2: 1 if lower limit shall be changed +% #3: 1 if upper limit shall be changed +% #4: the absolute value +\def\pgfplots@enlarge@limit@by@dimension#1#2#3#4{% + \begingroup + % ATTENTION: this uses similar access patterns as + % \pgfplots@enlarge@limit@ifconfigured + \def\bool@pgfplots@loc@enlargelimits@min{#2}% + \def\bool@pgfplots@loc@enlargelimits@max{#3}% + % + \let\pgfplots@enlargelimits@relthresh=\pgfutil@empty + \def\pgfplots@enlargelimits@absthresh{#4} + \def\pgfplots@enlargelimits@curaxis{#1}% + % + \def\bool@pgfplots@loc@enlargeany{0}% + \if1\bool@pgfplots@loc@enlargelimits@min + \def\bool@pgfplots@loc@enlargeany{1}% + \else + \if1\bool@pgfplots@loc@enlargelimits@max + \def\bool@pgfplots@loc@enlargeany{1}% + \fi + \fi + \if1\bool@pgfplots@loc@enlargeany + \pgfplots@enlarge@limit@for{#1}% + \fi + \global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany + % limits assignments are made globally. + \endgroup + \if1\pgfplots@glob@TMPa + \pgfplots@visphase@notify@changeofcanvaslimits{#1}% + \fi +} + + % Helper method inside of \pgfplots@enlarge@limit@ifconfigured. % % It modifies '#1min' and '#1max' (globally!) according to the already prepared @@ -4819,9 +5108,16 @@ \expandafter\let\expandafter\pgfplots@@min\csname pgfplots@#1min\endcsname \expandafter\let\expandafter\pgfplots@@max\csname pgfplots@#1max\endcsname \ifx\pgfplots@enlargelimits@relthresh\pgfutil@empty - % we have an absolute enlarge value: - \let\enlargeabsolute=\pgfplots@enlargelimits@absthresh - \pgf@xb=\pgfplots@enlargelimits@absthresh pt + \ifx\pgfplots@enlargelimits@absthresh\pgfutil@empty + % ups. No enlargement!? OK, can happen for 'abs=1cm' ... + % numbers with unit are processed later (after the scaling + % is set up) + \pgf@xb=0pt % + \else + % we have an absolute enlarge value: + \let\enlargeabsolute=\pgfplots@enlargelimits@absthresh + \pgf@xb=\pgfplots@enlargelimits@absthresh pt + \fi \else % we have a relative enlarge value: \pgfmathsubtract@\pgfplots@@max\pgfplots@@min% @@ -6087,7 +6383,7 @@ }% \def\pgfplotssetaxistype#1{% - \pgfutil@ifundefined{pgfplots@axistype@#1}{% + \pgfutil@IfUndefined{pgfplots@axistype@#1}{% \pgfplots@error{Sorry, 'axis type=#1' is unknown. Maybe you need to load a proper library first or you misspelled the name? Ignoring it}% }{% \csname pgfplots@axistype@#1\endcsname @@ -6895,7 +7191,7 @@ \def\pgfplots@prepare@layered@graphics{% % check if there are no layers at all. \ifpgfplots@layered@graphics - \pgfutil@ifundefined{pgf@layerlist}{% + \pgfutil@IfUndefined{pgf@layerlist}{% }{% \ifx\pgf@layerlist\pgfutil@empty \pgfplots@layered@graphicsfalse @@ -7070,7 +7366,7 @@ \else % cell picture=false | cell picture=if necessary \edef\pgfplots@shapename{pgfplots@low@level@shape@INNER}% - \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% + \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... @@ -8649,6 +8945,15 @@ \pgfkeyssetfamily{/tikz/alias}{/pgfplots/naming commands}% \pgfkeyssetfamily{/tikz/overlay}{/pgfplots/shared with tikz}% \pgfkeyssetfamily{/tikz/variable}{/pgfplots}% + % + % ... we need to set these options during the survey phase + % (because it might be interesting for enlarge limits to depend + % upon their value): + \pgfkeysdef{/pgfplots/bar width}{\pgfkeysalso{/pgf/bar width={##1}}}% + \pgfkeysdef{/pgfplots/bar shift}{\pgfkeysalso{/pgf/bar shift={##1}}}% + \pgfkeyssetfamily{/pgf/bar width}{/pgfplots}% + \pgfkeyssetfamily{/pgf/bar shift}{/pgfplots}% + % \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@rmopts}% % \let\tikz@alias=\pgfutil@empty @@ -9517,7 +9822,7 @@ \pgfplots@autocompute@all@limitsfalse \fi % - \pgfutil@ifundefined{pgfmathdeclarefunction}{% + \pgfutil@IfUndefined{pgfmathdeclarefunction}{% % SKIP: \pgfmathdeclarefunction is unavailable in pgf 2.00 . % UPGRADE TO PGF 2.10 to use these math functions. }{% @@ -9553,7 +9858,7 @@ \pgfplots@stacked@reversefalse \fi % - \pgfutil@ifundefined{label}{\relax}{% + \pgfutil@IfUndefined{label}{\relax}{% \let\pgfplots@original@LaTeX@label=\label \let\label=\pgfplots@plot@label }% @@ -9599,7 +9904,7 @@ % creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% \def\pgfplots@phase@name{v}% - \pgfutil@ifundefined{label}{\relax}{% + \pgfutil@IfUndefined{label}{\relax}{% % restore. \let\label=\pgfplots@original@LaTeX@label }% @@ -9717,7 +10022,7 @@ \tikz@fig@mustbenamed % \edef\pgfplots@shapename{pgfplots@low@level@shape\ifpgfplots@deprecated@anchors @deprecated\fi}% - \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% + \pgfutil@IfUndefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% % Oh. Well, suppose \pgfplots@anchorname is associated to an % INNER node. \def\pgfplots@loc@TMPa##1{% @@ -9837,7 +10142,7 @@ \else %\message{Attempting to correct '\pgfplots@child@node@name' position by \meaning\pgfplots@offset\space (the node is inside of an axis).}% \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% - \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% + \pgfutil@IfUndefined{pgf@sh@nt@\pgfplots@child@node@name}{% \pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}% }{% \pgf@shift@node{\pgfplots@child@node@name}{\pgfplots@offset}% @@ -9883,7 +10188,7 @@ } -\pgfutil@ifundefined{tikzaddtikzonlycommandshortcutlet}{% +\pgfutil@IfUndefined{tikzaddtikzonlycommandshortcutlet}{% \def\tikzaddtikzonlycommandshortcutlet#1#2{% \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands \let#1=#2 diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex index aee93120a5e..442887292cb 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex @@ -1,3 +1,13 @@ -\def\pgfplotsrevision{% -1.6.1 -} +\begingroup +\catcode`\-=12 +\catcode`\/=12 +\catcode`\.=12 +\catcode`\:=12 +\catcode`\+=12 +\catcode`\-=12 +\gdef\pgfplotsrevision{1.7-2-ge24fff4} +\gdef\pgfplotsversion{1.7} +\gdef\pgfplotsversiondatetime{2012-10-26 12:43:51 +0200} +\gdef\pgfplots@glob@TMPa#1-#2-#3 #4\relax{#1/#2/#3} +\xdef\pgfplotsversiondate{\expandafter\pgfplots@glob@TMPa\pgfplotsversiondatetime\relax} +\endgroup diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex index 79a4e5a11de..2560d084fef 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex @@ -93,22 +93,36 @@ \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@scaling@changewidthheight@for@enlargelimits@by@dimension% + % \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@scaling@changewidthheight@for@enlargelimits@by@dimension% + % \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 }% + \pgfplots@computeunitvectorlengths + % + \pgfplots@scaling@apply@enlargelimits@by@dimension{x}% + \pgfplots@scaling@apply@enlargelimits@by@dimension{y}% + \ifpgfplots@threedim + \pgfplots@scaling@apply@enlargelimits@by@dimension{z}% + \fi + % + \ifpgfplots@threedim + \pgfplotsgetnormalforcurrentview + \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). Limits are x=\pgfplots@xmin:\pgfplots@xmax, y=\pgfplots@ymin:\pgfplots@ymax^^J }% % \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure @@ -381,10 +395,11 @@ \def\pgfplots@scale@mode@choice{2}% stretch to fill \fi \pgfplots@scaleaxes@to@BB@{#1}{#2}% - \pgfplots@computeunitvectorlengths - \pgfplots@rescale@view@dir + % NOTE: we have not yet computed the lengths of unit vectors. In + % addition, we have not yet updated the normal vector. }% +% DEPRECATED: \def\pgfplots@rescale@view@dir{% \expandafter\ifx\csname pgfplots@view@dir@threedim\endcsname\relax \else @@ -531,6 +546,7 @@ \fi } + \def\pgfplots@scaleaxes@to@BB@#1#2{% \begingroup % @@ -613,6 +629,7 @@ \ifpgfplots@threedim \pgfplots@axis@apply@post@scale{z}% \fi + % % and finally, resize limits appropriately and add all cumulative limit compensations: \xdef\pgfplots@glob@TMPa{% % @@ -790,6 +807,10 @@ % #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{% + % ##1: the axis (x,y,or z) + % ##2: the horizontal scale + % ##3: the vertical scale + % ##4: the inverse unit scale for this axis \def\pgfplots@loc@TMPa##1##2##3##4{% \pgfplotscoordmath{\pgfplots@compat@scaling@coordmath}{parsenumber}{##2}% \let\xscale@@=\pgfmathresult diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex index a80e77884ce..a6fa1eae255 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex @@ -2609,7 +2609,7 @@ }% \def\pgfplotscoordstream@firstlast@update{% \ifx\pgfplots@current@point@x\pgfutil@empty - % only one \if is enough as ONE empty coordinate results all + % only one \if is enough as ONE empty coordinate causes all % others to be reset as well. \else \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty @@ -4509,12 +4509,13 @@ \def\pgfplots@coord@stream@foreach@NORMALIZED@curencoded@braced{{#1}}% \pgfplotsaxisdeserializedatapointfrom{#1}% \pgfplots@coord@stream@coord - \pgfplotscoordstream@firstlast@update + \pgfplotsplothandlerifcurrentpointcanbefirstlast{% + \pgfplotscoordstream@firstlast@update + }{}% \expandafter\pgfplots@foreach@plot@coord@NORMALIZED@ITERATE \fi } - % A common routine which resets internal data structures for the % survey phase, i.e. it is the shared implementation for all \addplot % variations. @@ -4946,6 +4947,8 @@ % \foreach because \foreach does NOT allow extended % precision. Besides, \pgfplotsforeachungrouped avoids % scoping problems. + \let\pgfplots@plot@data@notify@next@x=\relax + \let\pgfplots@plot@data@notify@next@y=\relax % \ifpgfplots@curplot@threedim \def\pgfplots@addplotimpl@expression@split@yz##1,##2\pgfplots@EOI{% @@ -4971,7 +4974,11 @@ \edef\pgfplots@plot@data##1{% \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\pgfplots@plot@var@y in {\pgfplots@expression@ydomain} {% - \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@expression@xdomain} {##1}% + \pgfplots@plot@data@notify@next@y + \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@expression@xdomain} {% + \pgfplots@plot@data@notify@next@x + ##1% + }% \noexpand\pgfplotsplothandlernotifyscanlinecomplete }% }% @@ -4979,7 +4986,11 @@ % sample a line: \def\pgfplots@plot@ydomain{0:0}% \edef\pgfplots@plot@data##1{% - \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@expression@xdomain} {##1}}% + \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@expression@xdomain} {% + \pgfplots@plot@data@notify@next@x + ##1% + }% + }% % % If we have (\x,\y,f(x)), use (\x,0,f(x)) instead and % suppress the error message which would occur for \y. @@ -5015,7 +5026,12 @@ \edef\pgfplots@plot@data##1{% \noexpand\pgfplotsforeachlogarithmicungrouped[\pgfplots@plot@samples] \expandafter\noexpand\tikz@plot@var/\noexpand\pgfplots@current@point@x@log - in {\pgfplots@plot@domain} {##1}}% + in {\pgfplots@plot@domain}% + {% + \pgfplots@plot@data@notify@next@x + ##1% + }% + }% % we have a logarithmic sampling sequence, % \pgfplots@current@point@x@log is already available % logarithmic! We can safe time and accuracy for the x @@ -5045,8 +5061,13 @@ % use 'samples at': \let\pgfplots@loc@TMPa=\pgfplots@plot@samples@at \fi - \edef\pgfplots@plot@data##1{ - \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@loc@TMPa} {##1}}% + \edef\pgfplots@plot@data##1{% + \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@loc@TMPa}% + {% + \pgfplots@plot@data@notify@next@x + ##1% + }% + }% \fi \expandafter\def\pgfplots@plot@var@y{0}% \def\pgfplots@addplotimpl@expression@yEXPR{#4}% @@ -5080,6 +5101,13 @@ \let\pgfplots@addplotimpl@expression@pseudoconst@x=\pgfmathx@ \let\pgfplots@addplotimpl@expression@pseudoconst@y=\pgfmathy@ % +% \if n\pgfplots@meshmode + % mesh=false : ignore patch type sampling. +% \else + \ifpgfplotsplothandlermesh@patch@type@sampling + \pgfplots@plot@expression@prepare@patch@type@sampling + \fi +% \fi % % Warning for use fpu=false: evaluation '\x^3' might be different from 'x^3' for % negative arguments: @@ -5141,6 +5169,87 @@ }% +% This prepares the implementation for 'patch type sampling': +\def\pgfplots@plot@expression@prepare@patch@type@sampling{% + \pgfplotsplothandlersurveyaddoptions{ + mesh input=patches,% + }% + % + \pgfkeysgetvalue{/pgfplots/patch type}\pgfplotsplothandlermesh@patchclass + % + \let\pgfplots@plot@data@@=\pgfplots@plot@data + \let\pgfplots@plot@data@curx=\pgfutil@empty + \let\pgfplots@plot@data@cury=\pgfutil@empty + \let\pgfplots@plot@data@lastx=\pgfutil@empty + \let\pgfplots@plot@data@lasty=\pgfutil@empty + \let\pgfplots@plot@data@first@x=\pgfutil@empty + \let\pgfplots@plot@data@first@y=\pgfutil@empty + % + \def\pgfplots@plot@data@notify@next@x{% + \ifx\pgfplots@plot@data@first@x\pgfutil@empty + \edef\pgfplots@plot@data@first@x{\tikz@plot@var}% + \fi + \let\pgfplots@plot@data@lastx=\pgfplots@plot@data@curx + \edef\pgfplots@plot@data@curx{\tikz@plot@var}% + }% + \def\pgfplots@plot@data@notify@next@y{% + \ifx\pgfplots@plot@data@first@y\pgfutil@empty + \edef\pgfplots@plot@data@first@y{\pgfplots@plot@var@y}% + \fi + \let\pgfplots@plot@data@lasty=\pgfplots@plot@data@cury + \edef\pgfplots@plot@data@cury{\pgfplots@plot@var@y}% + }% + \def\pgfplots@plot@data##1{% + % + \pgfplots@plot@data@@{% + \let\tikz@plot@var@old=\tikz@plot@var + \let\pgfplots@plot@var@y@old=\pgfplots@plot@var@y + % + % + % + % boolean 'if is first row || is first cell': + \pgfplots@loc@tmpfalse + \ifx\pgfplots@plot@data@curx\pgfplots@plot@data@first@x + % ah - we have the first row. + \pgfplots@loc@tmptrue + \fi + \if0\b@pgfplots@should@sample@LINE + \ifx\pgfplots@plot@data@cury\pgfplots@plot@data@first@y + % ah - we have the first cell. + \pgfplots@loc@tmptrue + \fi + \fi + % + \ifpgfplots@loc@tmp + \else + \pgfmathparse{\pgfplots@plot@data@curx-\pgfplots@plot@data@lastx}% + \let\pgfplots@plot@data@hx=\pgfmathresult + % + \if0\b@pgfplots@should@sample@LINE + \pgfmathparse{\pgfplots@plot@data@cury-\pgfplots@plot@data@lasty}% + \let\pgfplots@plot@data@hy=\pgfmathresult + \fi + % + \def\pgfplotspatchready{\pgfplotsscanlinecomplete}% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{sample in unit cube}{% + \pgfmathparse{\pgfplots@plot@data@lastx + \pgfplotspatchclassx*\pgfplots@plot@data@hx}% + \let\tikz@plot@var=\pgfmathresult + % + \if0\b@pgfplots@should@sample@LINE + \pgfmathparse{\pgfplots@plot@data@lasty + \pgfplotspatchclassy*\pgfplots@plot@data@hy}% + \let\pgfplots@plot@var@y=\pgfmathresult + \fi + % + ##1% + % + \let\tikz@plot@var=\tikz@plot@var@old + \let\pgfplots@plot@var@y=\pgfplots@plot@var@y@old + }% + \fi + }% + }% +}% + \let\pgfplots@backupof@pgfplotxyfile=\pgfplotxyfile % the following code @@ -7018,7 +7127,7 @@ \tikzset{every plot/.try}% \pgfplots@coord@stream@INIT@finalize@storedcoords\pgfplots@recorded@marker@stream% \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@coord@stream@finalize@storedcoords@START@coords}% - \pgfutil@ifundefined{pgfplotlastpoint}{}{% + \pgfutil@IfUndefined{pgfplotlastpoint}{}{% \tikz@make@last@position{\pgfplotlastpoint}% }% \let\pgfplots@plot@timer@args=\pgfplots@coord@stream@finalize@storedcoords@START@coords @@ -7608,11 +7717,14 @@ \ifx\pgfplots@plot@handler@graphics@pointmap@D@img\pgfutil@empty \else \pgfkeysgetvalue{/pgfplots/plot graphics/debug}\pgfplots@loc@TMPa - \def\pgfplots@loc@TMPb{true}% + \def\pgfplots@loc@TMPb{false}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \let\pgfplots@loc@TMPa=\pgfplots@loc@TMPb + \fi \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \def\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug{1}% - \else \def\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug{0}% + \else + \def\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug{1}% \fi % The following implementation computes the 'unit vector % ratio' of the IMAGE. @@ -7802,7 +7914,7 @@ \if1\pgfplotsplothandlergraphicspointmapcomputerequiredview@debug See \the\t@pgfplots@tokc.dat for debug output. \else - Use 'plot graphics[debug] to generate debug output files. + Use 'plot graphics[debug]' or 'plot graphics[debug=visual]' to generate debug output files. \fi ^^J}% \endgroup @@ -7839,6 +7951,7 @@ \immediate\write\w@pgf@writea{canvasmapmatrix=[\pgfplotsmatrix@text];^^Jcanvasmaprhs = [\pgfplotsrhs@text];^^J}% % \immediate\write\w@pgf@writea{key configuration = \pgfplotsretval;^^J}% + \immediate\write\w@pgf@writea{use debug=visual to see the mapped keys.^^J}% \immediate\closeout\w@pgf@writea \endgroup }% @@ -7963,6 +8076,17 @@ \pgfplots@plot@handler@graphics@DRAW@ };% \endgroup + % + % + \pgfkeysgetvalue{/pgfplots/plot graphics/debug}\pgfplots@loc@TMPa + \edef\pgfplots@loc@TMPb{visual}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + % debug = visual: "sanitize" also triggers the visualization. + \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling{A}% + \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling{B}% + \fi + % + % \ifx\pgfplots@plot@handler@graphics@pointmap@C@canvas\pgfutil@empty \ifpgfplots@threedim \pgfplots@warning{plot graphics in 3D axis has just two inner anchors (those with '(x,y,z)=>(imgx,imgy)'). You should provide a third one such that I can check for correct scaling.}% @@ -8026,24 +8150,33 @@ Please refer to the pgfplots manual for details. If you continue now, I'll show the points in the image}% \endgroup % + \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling@draw % - \scope - \pgfsetstrokecolor{black}% - \pgfsetfillcolor{red}% - \pgfpathcircle{\pgfplots@point@canvas@check}{2pt}% - \pgfusepath{stroke,fill}% - \pgfsetfillcolor{green}% - \pgfpathcircle{\pgfplots@point@canvas}{2pt}% - \pgfusepath{stroke,fill}% - \draw[->,red] - \pgfextra{ - \pgfpathmoveto{\pgfplots@point@canvas@check}% - \pgfpathlineto{\pgfplots@point@canvas}}; - \endscope + \fi + \pgfkeysgetvalue{/pgfplots/plot graphics/debug}\pgfplots@loc@TMPa + \edef\pgfplots@loc@TMPb{visual}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + \pgfplots@plot@handler@graphics@pointmap@sanitize@scaling@draw \fi \endgroup } +\def\pgfplots@plot@handler@graphics@pointmap@sanitize@scaling@draw{% + \scope + \pgfsetstrokecolor{black}% + \pgfsetfillcolor{red}% + \pgfpathcircle{\pgfplots@point@canvas@check}{2pt}% + \pgfusepath{stroke,fill}% + \pgfsetfillcolor{green}% + \pgfpathcircle{\pgfplots@point@canvas}{2pt}% + \pgfusepath{stroke,fill}% + \draw[->,red] + \pgfextra{ + \pgfpathmoveto{\pgfplots@point@canvas@check}% + \pgfpathlineto{\pgfplots@point@canvas}}; + \endscope +}% + \def\pgfplots@plot@handler@graphics@usebb{% \pgfpointdiff{\pgfplots@plot@handler@graphics@bb@first}{\pgfplots@plot@handler@graphics@bb@second}% \def\pgfplots@plot@handler@graphics@finish@ok{1}% @@ -8527,7 +8660,7 @@ % \pgfshell[\jobname]{cat table.dat} % \pgfplotxyfile{\jobname.out} -\pgfutil@ifundefined{w@pgf@writea}{% +\pgfutil@IfUndefined{w@pgf@writea}{% \csname newwrite\endcsname\pgf@shellwrite }{% \let\pgf@shellwrite=\w@pgf@writea diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex index 35f64d032dd..5cd2d0b50be 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex @@ -35,8 +35,19 @@ \immediate\write16{#1}% }% +% This is *identical* to \pgfutil@IfUndefined . I copied it here +% because pgf up to and including version 2.10 does not contain it. +\def\pgfplotsutil@IfUndefined#1{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\pgfutil@firstoftwo + \else + \expandafter\pgfutil@secondoftwo + \fi +} +\pgfplotsutil@IfUndefined{pgfutil@IfUndefined}{\let\pgfutil@IfUndefined=\pgfplotsutil@IfUndefined}{} -\pgfutil@ifundefined{pgfkeys}{% +\pgfutil@IfUndefined{pgfkeys}{% \pgfplots@error{It seems your version of PGF/Tikz is older than 2.00. Unfortunately, pgfplots requires at least version 2.00 ... you may need to update your TeX-Distribution or install PGF manually, sorry}% }{\relax} @@ -141,7 +152,7 @@ \newdimen\pgfplots@tmpa \newcount\c@pgfplots@coordindex \newcount\c@pgfplots@scanlineindex -\pgfutil@ifundefined{r@pgf@reada}{% +\pgfutil@IfUndefined{r@pgf@reada}{% \csname newread\endcsname\r@pgfplots@reada }{% \let\r@pgfplots@reada=\r@pgf@reada diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex index 8641fed58aa..9bef1959fba 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsmeshplothandler.code.tex @@ -24,281 +24,549 @@ % %-------------------------------------------- -% Assigns default values to 'rows' and 'cols' in case -% their values are empty. +% The low-level tikz plot handler for 3D mesh and surface plots. % -% PRECONDITION: -% The values of -% - '/pgfplots/mesh/rows' -% - '/pgfplots/mesh/cols' -% - '/pgfplots/mesh/num points' -% - \pgfplotsscanlinelength -% - '/pgfplots/mesh/ordering' -% are assigned properly. +% It expects +% a) a coordinate stream which is a linearized matrix, iterated either +% rowwise or column wise, +% b) the current set of options in /pgfplots/mesh/. % -% POSTCONDITION: -% 'rows' and 'cols' now incorporates \pgfplotsscanlinelength if -% their values had been empty. However, there may still be empty -% values. % -% @see \pgfplotsautocompletemeshkeys -\def\pgfplotspreparemeshkeydefaults{% - \pgfplots@autocomplete@meshkeys0% -}% - -% Completes and sanitizes 'mesh/rows' and 'mesh/cols' such that they -% have useful integer values afterwards. +% ATTENTION: +% this handler is NOT as general as the others. In particular, it +% can't be interrupted by TeX groups: every single statement, +% starting with streamstart and ending with stream end, must be in +% the same scope! % -% This method works similarly to \pgfplotspreparemeshkeydefaults. -% However, it really completes values and issues error messages if -% that proves to be impossible. +% As a consequence, you can't use this handler inside of (all) TikZ +% input streams. Try it out. It will work in pgfplots, however. % -% PRECONDITION: -% The values of -% - '/pgfplots/mesh/rows' -% - '/pgfplots/mesh/cols' -% - '/pgfplots/mesh/num points' -% - '/pgfplots/mesh/ordering' -% are assigned properly. -% If -% - \pgfplotsscanlinelength -% exists and is positive, it may also be used. +% Furthermore, it relies on a couple of pgfplots macros. This may +% change in future versions. +% It relies on: +% - \ifpgfplots@curplot@threedim +% - \pgfplots@current@point@meta +% -> it also invokes \pgfplots@perpointmeta@preparetrafo and its +% @APPLY counterpart which checks for +% - \pgfplots@metamax +% If you use it outside of pgfplots, use +% \global\let\pgfplots@metamax=\pgfutil@empty +% This is can be used without an initialised +% pgfplots axes - as long as \pgfplots@current@point@meta is in +% the range [0,1000]. +% - for the case 'shader=interp', a bounding box must be established +% before the plot is finished. This must be done using +% \def\pgfplotspointbbupperright{\pgfqpointxyz{2}{2}{0.9}} +% \def\pgfplotspointbblowerleft {\pgfqpointxyz{0}{0}{0.1}} +% or something like that. % -% POSTCONDITION: -% 'rows' and 'cols' have useful integer values. -\def\pgfplotsautocompletemeshkeys{% - \pgfplots@autocomplete@meshkeys1% -}% -\def\pgfplots@autocomplete@meshkeys#1{% - % For #1 = 0, the values are only partially completed (which is - % also compatible with patch plots) - \pgfkeysgetvalue{/pgfplots/mesh/rows}\pgfplotsplothandlermesh@rows - \pgfkeysgetvalue{/pgfplots/mesh/cols}\pgfplotsplothandlermesh@cols - \pgfkeysgetvalue{/pgfplots/mesh/num points}\pgfplotsplothandlermesh@numpoints - \edef\pgfplotsplothandlermesh@numpoints{\pgfplotsplothandlermesh@numpoints}% - \edef\pgfplotsplothandlermesh@cols{\pgfplotsplothandlermesh@cols}% - \edef\pgfplotsplothandlermesh@rows{\pgfplotsplothandlermesh@rows}% +% Besides these internals, it also relies on all public /pgfplots +% configuration keys related to mesh/surface plots. +% +% Please note that the 'z buffer' feature will not work without +% pgfplots (especially the z buffer=sort feature). +% +% Here is an example which compiles without a pgfplots axes: +% ---------------------------------------------------------- +% \begin{tikzpicture} +% \scope[ +% /pgfplots/.cd, +% surf, +% shader=faceted, +% mesh/rows=4, +% mesh/cols=4, +% mesh/num points=, +% /tikz/x={(0.44237cm,-0.07439cm)}, +% /tikz/y={(0.30942cm,0.23932cm)}, +% /tikz/z={(0.0cm,1.5cm)}, +% ] +% \makeatletter +% +% \global\let\pgfplots@metamax=\pgfutil@empty +% \pgfplots@curplot@threedimtrue +% +% \pgfplotsplothandlermesh +% \pgfplotstreamstart +% +% \def\rangea{0.21}% +% \def\rangeb{0.9}% +% +% \pgfmathparse{1000/(\rangeb-\rangea)} +% \let\factor=\pgfmathresult +% +% \def\simplecoordinate(#1,#2,#3){% +% \pgfmathparse{\factor*(#3 - \rangea)}% +% \let\pgfplots@current@point@meta=\pgfmathresult +% \pgfplotstreampoint{\pgfqpointxyz{#1}{#2}{#3}}% +% }% +% % for the case 'shaer=interp': +% \def\pgfplotspointbbupperright{\pgfqpointxyz{2}{2}{0.9}} +% \def\pgfplotspointbblowerleft {\pgfqpointxyz{0}{0}{0.1}} +% +% \simplecoordinate(0,3,0.7) +% \simplecoordinate(1,3,0.5) +% \simplecoordinate(2,3,0.58) +% \simplecoordinate(3,3,0.9) +% +% \simplecoordinate(0,2,0.68) +% \simplecoordinate(1,2,0.22) +% \simplecoordinate(2,2,0.25) +% \simplecoordinate(3,2,0.4) +% +% \simplecoordinate(0,1,0.6) +% \simplecoordinate(1,1,0.3) +% \simplecoordinate(2,1,0.21) +% \simplecoordinate(3,1,0.3) +% +% \simplecoordinate(0,0,0.8) +% \simplecoordinate(1,0,0.56) +% \simplecoordinate(2,0,0.5) +% \simplecoordinate(3,0,0.75) +% +% +% \pgfplotstreamend +% \pgfusepath{stroke} +% +% \endscope +% \end{tikzpicture} +% ---------------------------------------------------------- +% END OF EXAMPLE +% -> see also the legend image for mesh plots. +% +\def\pgfplotsplothandlermesh{% + \pgfkeysgetvalue{/pgfplots/patch type}\pgfplotsplothandlermesh@patchclass + \ifx\pgfplotsplothandlermesh@patchclass\pgfplotsplothandlermesh@patchclass@defaulttext + \let\pgfplotsplothandlermesh@patchclass=\pgfutil@empty + \fi + % FIXME : detect 1d mode here! + \ifx\pgfplotsplothandlermesh@patchclass\pgfutil@empty + % assign default patch class. + \if1\pgfplotsplothandlermesh@matrixinput + \def\pgfplotsplothandlermesh@patchclass{rectangle}% + \else + \def\pgfplotsplothandlermesh@patchclass{triangle}% + \fi + \pgfkeyslet{/pgfplots/patch type}\pgfplotsplothandlermesh@patchclass + \fi % - \def\pgfplots@loc@TMPa{0}% - \ifpgfplots@curplot@threedim - \def\pgfplots@loc@TMPa{1}% + \if0\pgfplotsplothandlermesh@matrixinput + % mesh input=patches: simply skip empty input lines: + \pgfkeyssetvalue{/pgfplots/empty line}{none}% + \fi + % + \pgfkeysgetvalue{/pgfplots/patch table/value}\pgfplotsplothandlermesh@patchtable + \ifx\pgfplotsplothandlermesh@patchtable\pgfutil@empty \else - \if s\pgfplots@meshmode - % we have a 'surf' plot. That doesn't make sense unless - % one has a matrix, even for a two--dimensional plot. Try it. - \def\pgfplots@loc@TMPa{1}% - \fi + \def\pgfplotsplothandlermesh@matrixinput{0}% implies 'patch input=patches' + \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@mesh@patchtable + \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@mesh@patchtable + \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@mesh@patchtable \fi - \if1\pgfplots@loc@TMPa - \ifx\pgfplotsplothandlermesh@rows\pgfutil@empty - \ifx\pgfplotsplothandlermesh@cols\pgfutil@empty - \pgfutil@ifundefined{pgfplotsscanlinelength}{\def\pgfplotsscanlinelength{-1}}{}% - \ifpgfplots@scanline@verbose - \ifnum\pgfplotsscanlinelength>0 - % we have scanlinelength set! Use it: - \message{PGFPlots: Scanline length is \pgfplotsscanlinelength.}% - \else - \ifnum\pgfplotsscanlinelength=-2 - \message{PGFPlots: Scanline length could not be determined since multiple, different scan line lengths have been found.}% - \else - \message{PGFPlots: No end-of-scanline marker found in input stream.}% - \fi - \fi - \fi - \ifnum\pgfplotsscanlinelength>0 - % we have scanlinelength set! Use it: - \if\pgfplots@plot@mesh@ordering0% - % ordering = x varies= rowwise -> scanline is cols! - \edef\pgfplotsplothandlermesh@cols{\pgfplotsscanlinelength}% - \else - % ordering = y varies = colwise: scanline is rows! - \edef\pgfplotsplothandlermesh@rows{\pgfplotsscanlinelength}% - \fi - \else - \if1#1% - % try to get reasonable values: - \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty - \pgfplots@error{Sorry, a mesh needs either '[mesh/rows=]' or '[mesh/cols=]' set - or at least '[mesh/num points=]'. But it did not find any of them...}% - \def\pgfplotsplothandlermesh@cols{5}% - \def\pgfplotsplothandlermesh@rows{5}% - \else - % We don't have rows/cols. Well, try using - % sqrt(num points) for both of them! - \ifnum\pgfplotsplothandlermesh@numpoints<16380 - \pgfmath@basic@sqrt@{\pgfplotsplothandlermesh@numpoints}% - \else - \pgfmathfloatparsenumber{\pgfplotsplothandlermesh@numpoints}% - \pgfmathfloatsqrt@{\pgfmathresult}% - \pgfmathfloattofixed{\pgfmathresult}% - \fi - \begingroup - % Try whether this rows*rows yields numpoints: - \afterassignment\pgfplots@gobble@until@relax - \c@pgf@counta=\pgfmathresult\relax - \c@pgf@countb=\c@pgf@counta - \multiply\c@pgf@counta by\c@pgf@counta - \def\pgfplotsretval{1}% - \ifnum\c@pgf@counta=\pgfplotsplothandlermesh@numpoints\relax - % ok, rows*rows = numpoints. - \edef\pgfplotsplothandlermesh@rows{\the\c@pgf@countb}% - \else - % oh. Did not work. Check for rounding errors: - \c@pgf@counta=\c@pgf@countb - \advance\c@pgf@counta by1 - \c@pgf@countb=\c@pgf@counta - \multiply\c@pgf@counta by\c@pgf@counta - \ifnum\c@pgf@counta=\pgfplotsplothandlermesh@numpoints - % ok, (rows+1)*(rows+1) = numpoints. - \edef\pgfplotsplothandlermesh@rows{\the\c@pgf@countb}% - \else - % no... did not work. num points doesn't - % appear to be a squared number. - \def\pgfplotsretval{0}% - \edef\pgfplotsplothandlermesh@rows{5}% - \fi - \fi - \if\pgfplotsretval1 - \pgfplots@warning{% - mesh processing did not find '[mesh/rows=]' or '[mesh/cols=]'. - Assuming [mesh/rows=\pgfplotsplothandlermesh@rows,mesh/cols=\pgfplotsplothandlermesh@rows] - as sqrt(num points) = sqrt(\pgfplotsplothandlermesh@numpoints) [ = \pgfmathresult].}% - \else - \pgfplots@error{Sorry, 'plot mesh' needs either '[mesh/rows=]' or '[mesh/cols=]' set, - but it did not find any of them. - I also tried rows = sqrt(num points) = sqrt(\pgfplotsplothandlermesh@numpoints) = \pgfmathresult\space without success.}% - \fi - \pgfmath@smuggleone\pgfplotsplothandlermesh@rows - \endgroup - \let\pgfplotsplothandlermesh@cols=\pgfplotsplothandlermesh@rows - \fi - \else - % #1=0 -> leave them empty. - \fi - \fi - \fi + \def\pgf@plotstreamstart{% +% \scope + % + % this shouldn't be necessary, but it doesn't hurt either. + \pgfplots@perpointmeta@preparetrafo + % + \def\pgfplotsplothandlermesh@ONEDIMMODE{0}% + \pgfplotsplothandlermesh@init@meshkeys + % + % + \let\pgfplotsplothandlermesh@patchclass@input=\pgfplotsplothandlermesh@patchclass + \let\pgfplotsplothandlermesh@patchclass@output=\pgfplotsplothandlermesh@patchclass@input + \if0\pgfplotsplothandlermesh@triangulate + \else + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@input}{triangulate class}% + \let\pgfplotsplothandlermesh@patchclass@output=\pgfplotsretval \fi - \if1#1% - \ifx\pgfplotsplothandlermesh@rows\pgfutil@empty - \ifx\pgfplotsplothandlermesh@cols\pgfutil@empty - \else - % Compute 'rows' out of 'num points' and 'cols': - \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty - \pgfplots@error{Sorry, matrix input needs a valid '[mesh/num points=]' variable if only one of '[mesh/rows=]' or '[mesh/cols=]' is given.}% - \def\pgfplotsplothandlermesh@numpoints{100}% - \fi - \begingroup - \c@pgf@counta=\pgfplotsplothandlermesh@numpoints\relax - \divide\c@pgf@counta by\pgfplotsplothandlermesh@cols\relax - \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% - \endgroup - \let\pgfplotsplothandlermesh@rows=\pgfplots@glob@TMPa - \fi + % + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@input}{init}% + \ifx\pgfplotsplothandlermesh@patchclass@input\pgfplotsplothandlermesh@patchclass@output + \else + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{init}% + \fi + % + % assign boolean: + \let\b@pgfplotsplothandlermesh@matrixoutput=\pgfplotsplothandlermesh@matrixinput + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{allow matrix}% + \if0\pgfplotsretval + \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + \fi + \ifnum\pgfkeysvalueof{/pgfplots/patch refines}>0 + \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + \fi + \if1\pgfplotsaxisplothasjumps + \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + \fi + \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 - \ifx\pgfplotsplothandlermesh@cols\pgfutil@empty - % Compute 'cols' out of 'num points' and 'rows': - \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty - \pgfplots@error{Sorry, matrix input needs a valid '[mesh/num points=]' variable if only one of '[mesh/cols=]' or '[mesh/rows=]' is given.}% - \def\pgfplotsplothandlermesh@numpoints{100}% - \fi - \begingroup - \c@pgf@counta=\pgfplotsplothandlermesh@numpoints\relax - \divide\c@pgf@counta by\pgfplotsplothandlermesh@rows\relax - \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% - \endgroup - \let\pgfplotsplothandlermesh@cols=\pgfplots@glob@TMPa - \fi - \fi - \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty - \c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@rows\relax - \multiply\c@pgfplots@scanlineindex by \pgfplotsplothandlermesh@cols\relax - \edef\pgfplotsplothandlermesh@numpoints{\the\c@pgfplots@scanlineindex}% + \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 - % - \c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@rows\relax - \multiply\c@pgfplots@scanlineindex by\pgfplotsplothandlermesh@cols\relax - \ifnum\c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@numpoints\relax + \fi + \if2\pgfplotsplothandlermesh@shader + \else + % 'shader!=interp' + \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + \fi + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get pdf shading type}% + \if4\pgfplotsretval + \else + \if5\pgfplotsretval \else - \ifcase\pgfplots@mesh@checkmode\relax - % mesh/check=false - \def\pgfplots@loc@TMPa##1{}% - \or - % mesh/check=warning - \def\pgfplots@loc@TMPa##1{\pgfplots@warning{##1}}% - \or - % mesh/check=error - \def\pgfplots@loc@TMPa##1{\pgfplots@error{##1}}% + \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + \fi + \fi + % + % special handling: check if Type=5 shadings need to be + % converted to Type=4 + \if0\b@pgfplotsplothandlermesh@matrixoutput + % no matrix output possible + \if5\pgfplotsretval + % pdf shading type=5 (matrix output) + \if2\pgfplotsplothandlermesh@shader + % shader=interp + % + % oh. shading type=5 is *essentially* the same as + % matrix output, but matrix output is forbidden. + % In that case, triangulate the matrix and shade the + % 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 - \pgfplots@loc@TMPa{the arguments of [mesh/rows=\pgfplotsplothandlermesh@rows,mesh/cols=\pgfplotsplothandlermesh@cols] assume \the\c@pgfplots@scanlineindex\space points, but I got actually N = \pgfplotsplothandlermesh@numpoints\space points! The data matrix appears to be incomplete or overcomplete!? [Use mesh/check=false to disable this message]}% \fi \fi - \else - % 2d visualization has no mesh: - \edef\pgfplotsplothandlermesh@rows{\pgfplotsplothandlermesh@numpoints}% - \def\pgfplotsplothandlermesh@cols{1}% - \fi + % + \pgfplotsplothandlermesh@init@DECODE + \pgfplotsplothandlermesh@init@REFINE + % + \pgfutil@IfUndefined{pgfplots@drawmodes}{% + \let\pgfplots@drawmodes=\tikz@mode + \let\pgfplots@drawoptions=\tikz@options + }{}% + % + % + % Prepare color data source: + \ifx\pgfplotspointmetainputhandler\pgfutil@empty% + % oh. There is no color data!? + \pgfplotsplothandlermesh@init@path@without@point@meta + % + \else + \pgfplotsplothandlermesh@init@cdata + \pgfplotsplothandlermesh@init@shader + \pgfplotsplothandlermesh@init@flat@color + \fi + % PREPARE THE STREAM PROCESSING: + % 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 + % + \pgfplotsplothandlermesh@init@mesh@stream + % + \c@pgfplots@scanlineindex=0 + }% % - \def\pgfplots@loc@TMPa{\pgfkeyssetvalue{/pgfplots/mesh/rows}}% - \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplotsplothandlermesh@rows}% - \def\pgfplots@loc@TMPa{\pgfkeyssetvalue{/pgfplots/mesh/cols}}% - \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplotsplothandlermesh@cols}% + \let\pgfplotsplothandlerifcurrentpointcanbefirstlast=\pgfplotsplothandlerifcurrentpointcanbefirstlast@mesh }% -%% -%% Helper structs for patch plots (surfaces) - -% #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:#5\endvertex{% - \global\pgf@x=#1 - \global\pgf@y=#2 +\def\pgfplotsplothandlerifcurrentpointcanbefirstlast@mesh#1#2{% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{if current point can be first last}{#1}{#2}% }% -% Allows to combined different vertices in the form -% \pgfplotspatchvertexaccumstart -% \expandafter\pgfplotspatchvertexadd\vertexA\times{0.25}% -% \expandafter\pgfplotspatchvertexadd\vertexB\times{0.5}% -% \expandafter\pgfplotspatchvertexadd\vertexC\times{0.75}% -% \pgfplotspatchvertexfinish\finalvertex -% --> now, \finalvertex contains the result vertex, 0.25*A + 0.5*B + 0.75*C . +% Assigns default values to 'rows' and 'cols' in case +% their values are empty. % -% THERE MUST NOT BE MATH INBETWEEN. -% More precisely, this overwrites the macros -% \pgf@x,\pgf@y, \pgf@xa,\pgf@ya, \pgf@yb, \pgfmathresult and \pgfplotspatchvertexdepth -\def\pgfplotspatchvertexaccumstart{% - \pgf@xa=0pt - \pgf@ya=0pt - \pgf@yb=0pt - \pgfplotscoordmath{meta}{zero}% -}% -\def\pgfplotspatchvertexadd#1#2#3#4:#5\times#6{% - \global\pgf@x=#1 - \global\pgf@y=#2 - \advance\pgf@xa by#6\pgf@x - \advance\pgf@ya by#6\pgf@y - \let\pgfmathresult@=\pgfmathresult - \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#6\pgf@y - \fi +% PRECONDITION: +% The values of +% - '/pgfplots/mesh/rows' +% - '/pgfplots/mesh/cols' +% - '/pgfplots/mesh/num points' +% - \pgfplotsscanlinelength +% - '/pgfplots/mesh/ordering' +% are assigned properly. +% +% POSTCONDITION: +% 'rows' and 'cols' now incorporates \pgfplotsscanlinelength if +% their values had been empty. However, there may still be empty +% values. +% +% @see \pgfplotsautocompletemeshkeys +\def\pgfplotspreparemeshkeydefaults{% + \pgfplots@autocomplete@meshkeys0% }% -\def\pgfplotspatchvertexfinish#1{% - \edef#1{{\the\pgf@xa}{\the\pgf@ya}{\pgfmathresult}\ifx\pgfplotspatchvertexdepth\pgfutil@empty\else\pgf@sys@tonumber\pgf@yb\fi:}% + +% Completes and sanitizes 'mesh/rows' and 'mesh/cols' such that they +% have useful integer values afterwards. +% +% This method works similarly to \pgfplotspreparemeshkeydefaults. +% However, it really completes values and issues error messages if +% that proves to be impossible. +% +% PRECONDITION: +% The values of +% - '/pgfplots/mesh/rows' +% - '/pgfplots/mesh/cols' +% - '/pgfplots/mesh/num points' +% - '/pgfplots/mesh/ordering' +% are assigned properly. +% If +% - \pgfplotsscanlinelength +% exists and is positive, it may also be used. +% +% POSTCONDITION: +% 'rows' and 'cols' have useful integer values. +\def\pgfplotsautocompletemeshkeys{% + \pgfplots@autocomplete@meshkeys1% +}% +\def\pgfplots@autocomplete@meshkeys#1{% + % For #1 = 0, the values are only partially completed (which is + % also compatible with patch plots) + \pgfkeysgetvalue{/pgfplots/mesh/rows}\pgfplotsplothandlermesh@rows + \pgfkeysgetvalue{/pgfplots/mesh/cols}\pgfplotsplothandlermesh@cols + \pgfkeysgetvalue{/pgfplots/mesh/num points}\pgfplotsplothandlermesh@numpoints + \edef\pgfplotsplothandlermesh@numpoints{\pgfplotsplothandlermesh@numpoints}% + \edef\pgfplotsplothandlermesh@cols{\pgfplotsplothandlermesh@cols}% + \edef\pgfplotsplothandlermesh@rows{\pgfplotsplothandlermesh@rows}% + % + \def\pgfplots@loc@TMPa{0}% + \ifpgfplots@curplot@threedim + \def\pgfplots@loc@TMPa{1}% + \else + \if s\pgfplots@meshmode + % we have a 'surf' plot. That doesn't make sense unless + % one has a matrix, even for a two--dimensional plot. Try it. + \def\pgfplots@loc@TMPa{1}% + \fi + \fi + \if1\pgfplots@loc@TMPa + \ifx\pgfplotsplothandlermesh@rows\pgfutil@empty + \ifx\pgfplotsplothandlermesh@cols\pgfutil@empty + \pgfutil@ifundefined{pgfplotsscanlinelength}{\def\pgfplotsscanlinelength{-1}}{}% + \ifpgfplots@scanline@verbose + \ifnum\pgfplotsscanlinelength>0 + % we have scanlinelength set! Use it: + \message{PGFPlots: Scanline length is \pgfplotsscanlinelength.}% + \else + \ifnum\pgfplotsscanlinelength=-2 + \message{PGFPlots: Scanline length could not be determined since multiple, different scan line lengths have been found.}% + \else + \message{PGFPlots: No end-of-scanline marker found in input stream.}% + \fi + \fi + \fi + \ifnum\pgfplotsscanlinelength>0 + % we have scanlinelength set! Use it: + \if\pgfplots@plot@mesh@ordering0% + % ordering = x varies= rowwise -> scanline is cols! + \edef\pgfplotsplothandlermesh@cols{\pgfplotsscanlinelength}% + \else + % ordering = y varies = colwise: scanline is rows! + \edef\pgfplotsplothandlermesh@rows{\pgfplotsscanlinelength}% + \fi + \else + \if1#1% + % try to get reasonable values: + \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty + \pgfplots@error{Sorry, a mesh needs either '[mesh/rows=]' or '[mesh/cols=]' set - or at least '[mesh/num points=]'. But it did not find any of them...}% + \def\pgfplotsplothandlermesh@cols{5}% + \def\pgfplotsplothandlermesh@rows{5}% + \else + % We don't have rows/cols. Well, try using + % sqrt(num points) for both of them! + \ifnum\pgfplotsplothandlermesh@numpoints<16380 + \pgfmath@basic@sqrt@{\pgfplotsplothandlermesh@numpoints}% + \else + \pgfmathfloatparsenumber{\pgfplotsplothandlermesh@numpoints}% + \pgfmathfloatsqrt@{\pgfmathresult}% + \pgfmathfloattofixed{\pgfmathresult}% + \fi + \begingroup + % Try whether this rows*rows yields numpoints: + \afterassignment\pgfplots@gobble@until@relax + \c@pgf@counta=\pgfmathresult\relax + \c@pgf@countb=\c@pgf@counta + \multiply\c@pgf@counta by\c@pgf@counta + \def\pgfplotsretval{1}% + \ifnum\c@pgf@counta=\pgfplotsplothandlermesh@numpoints\relax + % ok, rows*rows = numpoints. + \edef\pgfplotsplothandlermesh@rows{\the\c@pgf@countb}% + \else + % oh. Did not work. Check for rounding errors: + \c@pgf@counta=\c@pgf@countb + \advance\c@pgf@counta by1 + \c@pgf@countb=\c@pgf@counta + \multiply\c@pgf@counta by\c@pgf@counta + \ifnum\c@pgf@counta=\pgfplotsplothandlermesh@numpoints + % ok, (rows+1)*(rows+1) = numpoints. + \edef\pgfplotsplothandlermesh@rows{\the\c@pgf@countb}% + \else + % no... did not work. num points doesn't + % appear to be a squared number. + \def\pgfplotsretval{0}% + \edef\pgfplotsplothandlermesh@rows{5}% + \fi + \fi + \if\pgfplotsretval1 + \pgfplots@warning{% + mesh processing did not find '[mesh/rows=]' or '[mesh/cols=]'. + Assuming [mesh/rows=\pgfplotsplothandlermesh@rows,mesh/cols=\pgfplotsplothandlermesh@rows] + as sqrt(num points) = sqrt(\pgfplotsplothandlermesh@numpoints) [ = \pgfmathresult].}% + \else + \pgfplots@error{Sorry, 'plot mesh' needs either '[mesh/rows=]' or '[mesh/cols=]' set, + but it did not find any of them. + I also tried rows = sqrt(num points) = sqrt(\pgfplotsplothandlermesh@numpoints) = \pgfmathresult\space without success.}% + \fi + \pgfmath@smuggleone\pgfplotsplothandlermesh@rows + \endgroup + \let\pgfplotsplothandlermesh@cols=\pgfplotsplothandlermesh@rows + \fi + \else + % #1=0 -> leave them empty. + \fi + \fi + \fi + \fi + \if1#1% + \ifx\pgfplotsplothandlermesh@rows\pgfutil@empty + \ifx\pgfplotsplothandlermesh@cols\pgfutil@empty + \else + % Compute 'rows' out of 'num points' and 'cols': + \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty + \pgfplots@error{Sorry, matrix input needs a valid '[mesh/num points=]' variable if only one of '[mesh/rows=]' or '[mesh/cols=]' is given.}% + \def\pgfplotsplothandlermesh@numpoints{100}% + \fi + \begingroup + \c@pgf@counta=\pgfplotsplothandlermesh@numpoints\relax + \divide\c@pgf@counta by\pgfplotsplothandlermesh@cols\relax + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \let\pgfplotsplothandlermesh@rows=\pgfplots@glob@TMPa + \fi + \else + \ifx\pgfplotsplothandlermesh@cols\pgfutil@empty + % Compute 'cols' out of 'num points' and 'rows': + \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty + \pgfplots@error{Sorry, matrix input needs a valid '[mesh/num points=]' variable if only one of '[mesh/cols=]' or '[mesh/rows=]' is given.}% + \def\pgfplotsplothandlermesh@numpoints{100}% + \fi + \begingroup + \c@pgf@counta=\pgfplotsplothandlermesh@numpoints\relax + \divide\c@pgf@counta by\pgfplotsplothandlermesh@rows\relax + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \let\pgfplotsplothandlermesh@cols=\pgfplots@glob@TMPa + \fi + \fi + \ifx\pgfplotsplothandlermesh@numpoints\pgfutil@empty + \c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@rows\relax + \multiply\c@pgfplots@scanlineindex by \pgfplotsplothandlermesh@cols\relax + \edef\pgfplotsplothandlermesh@numpoints{\the\c@pgfplots@scanlineindex}% + \fi + % + \c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@rows\relax + \multiply\c@pgfplots@scanlineindex by\pgfplotsplothandlermesh@cols\relax + \ifnum\c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@numpoints\relax + \else + \ifcase\pgfplots@mesh@checkmode\relax + % mesh/check=false + \def\pgfplots@loc@TMPa##1{}% + \or + % mesh/check=warning + \def\pgfplots@loc@TMPa##1{\pgfplots@warning{##1}}% + \or + % mesh/check=error + \def\pgfplots@loc@TMPa##1{\pgfplots@error{##1}}% + \fi + \pgfplots@loc@TMPa{the arguments of [mesh/rows=\pgfplotsplothandlermesh@rows,mesh/cols=\pgfplotsplothandlermesh@cols] assume \the\c@pgfplots@scanlineindex\space points, but I got actually N = \pgfplotsplothandlermesh@numpoints\space points! The data matrix appears to be incomplete or overcomplete!? [Use mesh/check=false to disable this message]}% + \fi + \fi + \else + % 2d visualization has no mesh: + \edef\pgfplotsplothandlermesh@rows{\pgfplotsplothandlermesh@numpoints}% + \def\pgfplotsplothandlermesh@cols{1}% + \fi + % + \def\pgfplots@loc@TMPa{\pgfkeyssetvalue{/pgfplots/mesh/rows}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplotsplothandlermesh@rows}% + \def\pgfplots@loc@TMPa{\pgfkeyssetvalue{/pgfplots/mesh/cols}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplotsplothandlermesh@cols}% +}% + +%% +%% Helper structs for patch plots (surfaces) + +% #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:#5\endvertex{% + \global\pgf@x=#1 + \global\pgf@y=#2 +}% + +% Allows to combined different vertices in the form +% \pgfplotspatchvertexaccumstart +% \expandafter\pgfplotspatchvertexadd\vertexA\times{0.25}% +% \expandafter\pgfplotspatchvertexadd\vertexB\times{0.5}% +% \expandafter\pgfplotspatchvertexadd\vertexC\times{0.75}% +% \pgfplotspatchvertexfinish\finalvertex +% --> now, \finalvertex contains the result vertex, 0.25*A + 0.5*B + 0.75*C . +% +% THERE MUST NOT BE MATH INBETWEEN. +% More precisely, this overwrites the macros +% \pgf@x,\pgf@y, \pgf@xa,\pgf@ya, \pgf@yb, \pgfmathresult and \pgfplotspatchvertexdepth +\def\pgfplotspatchvertexaccumstart{% + \pgf@xa=0pt + \pgf@ya=0pt + \pgf@yb=0pt + \pgfplotscoordmath{meta}{zero}% +}% +\def\pgfplotspatchvertexadd#1#2#3#4:#5\times#6{% + \global\pgf@x=#1 + \global\pgf@y=#2 + \advance\pgf@xa by#6\pgf@x + \advance\pgf@ya by#6\pgf@y + \let\pgfmathresult@=\pgfmathresult + \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#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:}% } % Same as \pgfplotspatchvertexadd, but it only adds the X and Y % coordinates (ignoring the rest). @@ -332,6 +600,7 @@ }% }% +% #1: will be expanded with \edef \def\pgfplotsplothandlermesh@setnextvertex#1{% \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set next vertex}{#1}% }% @@ -383,8 +652,11 @@ \pgfpathclose }, get num cdata vertices=\pgfplotspatchclass{\pgfplotspatchclassname}{get vertices}, + get dimension=2, + supports global path=0, set edge visible=\expandafter\edef\csname pgfppatchedge@##1\endcsname{##2}, uses view depth=0, + if current point can be first last=##1, serialize except vertices=\let\pgfplotsretval\pgfutil@empty, deserialize except vertices=##1, serialize={% @@ -424,6 +696,9 @@ compute normal={% \pgfplotsplothandlermesh@compute@normal@default },% + sample in unit cube={% + \pgfplots@error{sample in unit cube: not implemented for \pgfplotspatchclassname}% + }, }% }{}% % @@ -453,6 +728,9 @@ {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ allow matrix\endcsname{\def\pgfplotsretval{#1}}},% uses view depth/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ uses view depth\endcsname{\def\pgfplotsretval{#1}}},% + % + % creates a new patch. The vertices need to be added by 'set next + % vertex' new/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ new\endcsname{#1}},% % @@ -468,6 +746,37 @@ set next vertex/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ set next vertex\endcsname##1{#1}},% % + % + % Creates a new patch by means of sampling. The sampling is + % applied in the unit cube [0,1]x[0,1] (unit interval if this is an 1d patch + % type). + % + % 'sample in unit cube={}' + % + % It will invoke once for + % every sampled vertex. The complete unit cube will be covered. + % Depending on the patch type, either one or more patches are + % required to fill the unit cube. As soon as one patch is ready, + % \pgfplotspatchready will be invoked. + % + % + % PRECONDITION: + % -\pgfplotspatchready is defined. + % + % Arguments: + % #1: code which will be invoked whenever a new coordinate is + % ready. Inside of #1, the macros \pgfplotspatchclassx and + % \pgfplotspatchclassy result in the x and y coordinate (inside + % of the unit cube), in fixed point representation. + % + % Example: + % \def\pgfplotspatchready{} + % \pgfplotspatchclass{biquadratic}{sample in unit cube}{% + % point ready at (\pgfplotspatchclassx, \pgfplotspatchclassy) + % } + sample in unit cube/.code= + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ sample in unit cube\endcsname##1{#1}},% + % % declares whether a single edge is visible or not. % #1: an integer denoting the edge, either 0,1,2,...,N-1 where N = num verts % #2: 0 if the edge is not to be stroked and 1 if it is stroked. @@ -537,16 +846,32 @@ stream to shader/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ stream to shader\endcsname{#1}},% % - % expands to the number of vertices. + % defines \pgfplotsretval to contain the number of vertices. get num vertices/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get num vertices\endcsname{\def\pgfplotsretval{#1}}},% % - % expands to the number of vertices which have color data + % defines \pgfplotsretval to contain the number of vertices which have color data % attached. This is usually the same as 'get num vertices' (but % see coons patches). get num cdata vertices/.code= {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get num cdata vertices\endcsname{\def\pgfplotsretval{#1}}},% % + % defines \pgfplotsretval to contain the dimension of this patch + % (either 1 for lines or 2 for patches). + get dimension/.code= + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ get dimension\endcsname{\def\pgfplotsretval{#1}}},% + % + % defines \pgfplotsretval to be 1 if and only if the patch class + % supports global paths. + % A global path is one which is drawn as one huge, uninterrupted + % PGF path (except for jumps perhaps). Its area can be filled, + % i.e. it behaves exactly like the 'sharp' plot handler. This is + % used implicitly if 'point meta=none' (if there is point meta + % data, we always want individual path segments and \pgfusepath + % them after each segment). + supports global path/.code= + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ supports global path\endcsname{\def\pgfplotsretval{#1}}},% + % % Approximates the given patch by at least one triangle. % For every finished triangle, \pgfplotspatchready will be invoked % and \pgfplotsplothandlermesh@patchclass will be set to triangle. @@ -597,6 +922,11 @@ % 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}},% + % + % executes '##1' if the current point can be the first or last + % point of the patch. Executes ##2 if that is not the case. + if current point can be first last/.code= + {\expandafter\def\csname pgfpptch\pgfplotsdeclarepatchclass@ if current point can be first last\endcsname##1##2{#1}},% } % This implements 'compute normal' : @@ -685,667 +1015,518 @@ \def\pgfplotspatchclass@recursiverefine@{% \pgfplotspatchclass{\pgfplotspatchclassname}{recursive refine@}% }% - - -% sequence macros preferred over integer indices. -% using characters avoids the extensive use of \csname ...\endcsname -% and \expandafter which would be necessary for integer indices. -\def\pgfpptchindexnext@A{B}% 0->1 -\def\pgfpptchindexnext@B{C}% 1->2 -\def\pgfpptchindexnext@C{D}% 2->3 -\def\pgfpptchindexnext@D{E}% 3->4 -\def\pgfpptchindexnext@E{F}% 4->5 -\def\pgfpptchindexnext@F{G}% 5->6 -\def\pgfpptchindexnext@G{H}% 6->7 -\def\pgfpptchindexnext@H{I}% 7->8 -\def\pgfpptchindexnext@I{J}% 8->9 -\def\pgfpptchindexnext@J{K}% 9->10 -\def\pgfpptchindexnext@K{L}% 10->11 -\def\pgfpptchindexnext@L{M}% 11->12 -\def\pgfpptchindexnext@M{N}% 12->13 -\def\pgfpptchindexnext@N{O}% 13->14 -\def\pgfpptchindexnext@O{P}% 14->15 -\def\pgfpptchindexnext@P{Q}% 15->16 -\def\pgfpptchindexnext@Q{R}% 16->17 - -\pgfplotsdeclarepatchclass{line}{% - allow matrix=0, - new=\def\pgfplotspatchclass@line@no{0}, - set next vertex={% - \if0\pgfplotspatchclass@line@no\relax - \edef\pgfplotspatchclass@line@A{#1}% - \def\pgfplotspatchclass@line@no{1}% - \else - \edef\pgfplotspatchclass@line@B{#1}% - \def\pgfplotspatchclass@line@no{0}% - \pgfplotspatchready% - \fi - }, - first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@A\endvertex, - foreach vertex={% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@A\endvertex #1% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@B\endvertex #1% - }, - fill path={% - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@line@A\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@line@B\endvertex}% - }, - serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% - deserialize except vertices=, - get num vertices=2, - get pdf shading type=0, -}% - -\pgfplotsdeclarepatchclass{triangle}{% - allow matrix=0, - new=\def\pgfplotspatchclass@tri@no{0}\let\pgfplotspatchclass@trie@AB\relax, - set next vertex={% - \ifcase\pgfplotspatchclass@tri@no\relax - \edef\pgfplotspatchclass@tri@A{#1}% - \def\pgfplotspatchclass@tri@no{1}% - \or - \edef\pgfplotspatchclass@tri@B{#1}% - \def\pgfplotspatchclass@tri@no{2}% - \or - \edef\pgfplotspatchclass@tri@C{#1}% - \def\pgfplotspatchclass@tri@no{0}% - \pgfplotspatchready% - \fi - }, - first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@A\endvertex, - foreach vertex={% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@A\endvertex #1% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@B\endvertex #1% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@C\endvertex #1% - }, - fill path={% - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% - \pgfpathclose - }, - stroke path={% - \ifx\pgfplotspatchclass@trie@AB\relax - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% - \pgfpathclose - \else - \if1\pgfplotspatchclass@trie@AB - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% - \fi - \if1\pgfplotspatchclass@trie@BC - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% - \fi - \if1\pgfplotspatchclass@trie@CA - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% - \fi - \fi - }, - triangulate=\pgfplotspatchready, - set edge visible={% - \ifcase#1 - \edef\pgfplotspatchclass@trie@AB{#2}% - \or - \edef\pgfplotspatchclass@trie@BC{#2}% - \or - \edef\pgfplotspatchclass@trie@CA{#2}% - \fi - }, - serialize except vertices={% - \ifx\pgfplotspatchclass@trie@AB\relax - \let\pgfplotsretval\pgfutil@empty% - \else - \edef\pgfplotsretval{% - \noexpand\def\noexpand\pgfplotspatchclass@trie@AB{\pgfplotspatchclass@trie@AB}% - \noexpand\def\noexpand\pgfplotspatchclass@trie@BC{\pgfplotspatchclass@trie@BC}% - \noexpand\def\noexpand\pgfplotspatchclass@trie@CA{\pgfplotspatchclass@trie@CA}% - }% - \fi - },% - recursive refine@={% - % - \pgfplotspatchclass{\pgfplotspatchclassname}{new}% - % - % Perform longest edge bisection. - \pgfpointdiff - {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% - {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% - \edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% - \expandafter\pgfmath@basic@veclen@\pgfplots@loc@TMPa - \pgf@xa=\pgfmathresult pt - \pgf@yc=\pgf@xa % "max so far" - \def\pgfplotspatch@tri@longestedgestart{A}% - % - \pgfpointdiff - {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% - {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% - \edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% - \expandafter\pgfmath@basic@veclen@\pgfplots@loc@TMPa - \pgf@xa=\pgfmathresult pt - \ifdim\pgf@xa>\pgf@yc - \pgf@yc=\pgf@xa - \def\pgfplotspatch@tri@longestedgestart{B}% - \fi - % - \pgfpointdiff - {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% - {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% - \edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% - \expandafter\pgfmath@basic@veclen@\pgfplots@loc@TMPa - \pgf@xa=\pgfmathresult pt - \ifdim\pgf@xa>\pgf@yc - \def\pgfplotspatch@tri@longestedgestart{C}% - \fi - % The ordering is not arbitrary - % (unless z buffer=sort is in effect). Let's assume that the - % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then - % this sequence here should have approximately the same depth - % ordering: - % - \pgfplotspatchvertexaccumstart - \if A\pgfplotspatch@tri@longestedgestart - \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@A\times{0.5}% - \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@B\times{0.5}% - \def\pgfplots@loc@TMPa{ACM,BCM}% - \else - \if B\pgfplotspatch@tri@longestedgestart - \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@B\times{0.5}% - \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@C\times{0.5}% - \def\pgfplots@loc@TMPa{ABM,ACM}% - \else - \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@C\times{0.5}% - \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@A\times{0.5}% - \def\pgfplots@loc@TMPa{ABM,BCM}% - \fi - \fi - \pgfplotspatchvertexfinish\pgfplotspatchclass@tri@M - \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa;\pgfplotspatchclass@tri@M}% - % - % invoke helper method such that I don't need to restore or - % recompute \pgfplotspatchclass@tri@M during recursion. - \expandafter\pgfplotspatchclass@tri@recursiverefine@@\pgfplots@loc@TMPa\relax{#1}% - }, - deserialize except vertices=% - \let\pgfplotspatchclass@trie@AB\relax - #1, - get pdf shading type=4, - get num vertices=3, -}% -\def\pgfplotspatchclass@tri@recursiverefine@@#1#2M,#3#4M;#5\relax#6{% - \expandafter\let\expandafter\pgfplotspatchclass@tri@A@\csname pgfplotspatchclass@tri@#1\endcsname - \expandafter\let\expandafter\pgfplotspatchclass@tri@B@\csname pgfplotspatchclass@tri@#2\endcsname - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@A@}% - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@B@}% - \pgfplotsplothandlermesh@setnextvertex{#5}% - #6% - % - \expandafter\let\expandafter\pgfplotspatchclass@tri@A@\csname pgfplotspatchclass@tri@#3\endcsname - \expandafter\let\expandafter\pgfplotspatchclass@tri@B@\csname pgfplotspatchclass@tri@#4\endcsname - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@A@}% - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@B@}% - \pgfplotsplothandlermesh@setnextvertex{#5}% - #6% -}% - - -% A rectangle specified in the sequence -% D <-- C -% | ^ -% v | -% A --> B -% -\pgfplotsdeclarepatchclass{rectangle}{% - allow matrix=1, - new=\def\pgfplotspatchclass@rect@no{0}, - set next vertex={% - \ifcase\pgfplotspatchclass@rect@no\relax - \edef\pgfplotspatchclass@rect@A{#1}% - \def\pgfplotspatchclass@rect@no{1}% - \or - \edef\pgfplotspatchclass@rect@B{#1}% - \def\pgfplotspatchclass@rect@no{2}% - \or - \edef\pgfplotspatchclass@rect@C{#1}% - \def\pgfplotspatchclass@rect@no{3}% - \or - \edef\pgfplotspatchclass@rect@D{#1}% - \def\pgfplotspatchclass@rect@no{0}% - \pgfplotspatchready% - \fi - }, - first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex, - foreach vertex={% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex #1% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex #1% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex #1% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex #1% - }, - stream to shader={% - % a 'foreach vertex' with slightly different sequence: - \def\pgfplots@foreachvertex@@{% - \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta - \pgfplotsaxisvisphasetransformpointmeta - \pgfplotslibrarysurfstreamcoord{% - \global\pgf@x=\pgfplotspatchvertexx\space - \global\pgf@y=\pgfplotspatchvertexy\space - }{\pgfplotspointmetatransformed}% - }% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex\pgfplots@foreachvertex@@% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex\pgfplots@foreachvertex@@% - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex\pgfplots@foreachvertex@@% EXCHANGED SEQUENCE - \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex\pgfplots@foreachvertex@@% - },% - fill path={% - \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@A\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@B\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@C\endvertex}% - \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@D\endvertex}% - \pgfpathclose - }, - init pdf shading={% - \if0\b@pgfplotsplothandlermesh@matrixoutput - \ifnum\pgfkeysvalueof{/pgfplots/surf shading/cols}=2 - \else - \pgfplots@error{Sorry, (patch type=rectangle) and (rectangular patch shadings with more than one rectangle) is not supported (got \pgfkeysvalueof{/pgfplots/surf shading/cols} x * input points). - It is supported if z buffer!=sort. Consider using 'patch to triangles=true' to combine it with z buffer=sort}% - \fi - \fi - }, - recursive refine@={% - \pgfplots@error{Please use \string\usepgfplotslibrary{patchplots} in order to use 'refine,patch type=\pgfplotspatchclassname'}% - }, - triangulate={% - \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass - \def\pgfplotsplothandlermesh@patchclass{triangle}% - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}% - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01% - \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@B}% - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}% - % - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01% - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}11% - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20% - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@B}% - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@C}% - \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}% - \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@ - },% - serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% - deserialize except vertices=, - get pdf shading type=5, - get num vertices=4, -}% - -\def\pgfplots@rect@next@A{B} -\def\pgfplots@rect@next@B{C} -\def\pgfplots@rect@next@C{D} -\def\pgfplots@rect@next@D{A} - -\def\pgfplots@rect@rnext@A{D} -\def\pgfplots@rect@rnext@B{A} -\def\pgfplots@rect@rnext@C{B} -\def\pgfplots@rect@rnext@D{C} - -% Ideas: make sure that the foreground edge is the 'v=1' -% edge of the coons patch, i.e. that it is drawn on top of -% the rest. -% -% Furthermore, for fixed v, the 'u=1' point should belong -% to the foreground (as it is drawn on top of u=0). -% -% In other words, if the coons patch looks like -% -% BB-------CC <--v=1 -% | | -% | | -% | | -% AA-------DD <--v=0 -% | | -% u=0 u=1 -% -% where the AA,BB,CC,DD are the corners of the coons -% patch, The FOREGROUND POINT of our visualization here should be CC, -% the second most foreground point BB (assuming that -% foreground point and second most foreground point are -% adjacent). -% -% Thus, if 'CC' is behind of 'BB' in the A,B,C,D ordering: -% start the coons patch with AA := BB-1 in forward -% direction. -% else -% start the coons patch with AA := BB+1 in reverse -% direction. -% -% #1: the vertex prefix for the rectangular shape. -% Thus, \csname #1A\endcsname is the first vertex, \csname #1B\endcsname the second -% and #1C, #1D the third and fourth. -% -% #2: A macro name. It will be defined to be either A,B,C or D. -% #3: A macro name. It will be defined to be either empty or 'r'. If -% it is empty, the coons patch shall be in the sequence -% #2,next(#2),next(next(#2),.... -% If it is 'r', the coons patch shall be in the sequence -% #2,prev(#2),prev(prev(#2),... -% -% Note that this method works also for biquadratic patches since these -% patches also have #1A, #1B, #1C and #1D as their corners. -% -\def\pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth#1#2#3{% - \def#2{A}% - \def#3{}% - % - \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1A\endcsname\endvertex - \ifx\pgfplotspatchvertexdepth\pgfutil@empty - \else - % aaah -- we have z buffer information. Then we will use it! - \edef\PA{\pgfplotspatchvertexdepth pt A}% - \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1B\endcsname\endvertex - \edef\PB{\pgfplotspatchvertexdepth pt B}% - \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1C\endcsname\endvertex - \edef\PC{\pgfplotspatchvertexdepth pt C}% - \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1D\endcsname\endvertex - \edef\PD{\pgfplotspatchvertexdepth pt D}% - \pgfplotsutilsortfour\PA\PB\PC\PD - \def\toCHAR##1pt ##2{##2}% get original index - % - % - \edef\PA{\expandafter\toCHAR\PA}%% - \edef#2{\expandafter\toCHAR\PB}%% - \edef\Pnext{\csname pgfplots@rect@next@#2\endcsname}% this here uses only A,B,C and D (also for biquadratic patches!) - \if\Pnext\PA - % ok, next(BB) = CC. - % that means we have to advance forward. - \def#3{}% - \edef#2{\csname pgfplots@rect@rnext@#2\endcsname}% - \else - \edef#2{\csname pgfplots@rect@next@#2\endcsname}% - \def#3{r}% - \fi -%\message{^^JDEPTH SEQUENCE for rectangle: \PA, \PB, \PC, \PD^^J}% -%\message{COONS PATH ORDERING: starts with #2, direction: \ifx#3\pgfutil@empty forward\else backward\fi^^J}% - \fi -}% - -\def\pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth@no@op#1#2#3{% - \def#2{A}% - \def#3{}% -} - -% The low-level tikz plot handler for 3D mesh and surface plots. -% -% It expects -% a) a coordinate stream which is a linearized matrix, iterated either -% rowwise or column wise, -% b) the current set of options in /pgfplots/mesh/. -% -% -% ATTENTION: -% this handler is NOT as general as the others. In particular, it -% can't be interrupted by TeX groups: every single statement, -% starting with streamstart and ending with stream end, must be in -% the same scope! -% -% As a consequence, you can't use this handler inside of (all) TikZ -% input streams. Try it out. It will work in pgfplots, however. -% -% Furthermore, it relies on a couple of pgfplots macros. This may -% change in future versions. -% It relies on: -% - \ifpgfplots@curplot@threedim -% - \pgfplots@current@point@meta -% -> it also invokes \pgfplots@perpointmeta@preparetrafo and its -% @APPLY counterpart which checks for -% - \pgfplots@metamax -% If you use it outside of pgfplots, use -% \global\let\pgfplots@metamax=\pgfutil@empty -% This is can be used without an initialised -% pgfplots axes - as long as \pgfplots@current@point@meta is in -% the range [0,1000]. -% - for the case 'shader=interp', a bounding box must be established -% before the plot is finished. This must be done using -% \def\pgfplotspointbbupperright{\pgfqpointxyz{2}{2}{0.9}} -% \def\pgfplotspointbblowerleft {\pgfqpointxyz{0}{0}{0.1}} -% or something like that. -% -% Besides these internals, it also relies on all public /pgfplots -% configuration keys related to mesh/surface plots. -% -% Please note that the 'z buffer' feature will not work without -% pgfplots (especially the z buffer=sort feature). -% -% Here is an example which compiles without a pgfplots axes: -% ---------------------------------------------------------- -% \begin{tikzpicture} -% \scope[ -% /pgfplots/.cd, -% surf, -% shader=faceted, -% mesh/rows=4, -% mesh/cols=4, -% mesh/num points=, -% /tikz/x={(0.44237cm,-0.07439cm)}, -% /tikz/y={(0.30942cm,0.23932cm)}, -% /tikz/z={(0.0cm,1.5cm)}, -% ] -% \makeatletter -% -% \global\let\pgfplots@metamax=\pgfutil@empty -% \pgfplots@curplot@threedimtrue -% -% \pgfplotsplothandlermesh -% \pgfplotstreamstart -% -% \def\rangea{0.21}% -% \def\rangeb{0.9}% -% -% \pgfmathparse{1000/(\rangeb-\rangea)} -% \let\factor=\pgfmathresult -% -% \def\simplecoordinate(#1,#2,#3){% -% \pgfmathparse{\factor*(#3 - \rangea)}% -% \let\pgfplots@current@point@meta=\pgfmathresult -% \pgfplotstreampoint{\pgfqpointxyz{#1}{#2}{#3}}% -% }% -% % for the case 'shaer=interp': -% \def\pgfplotspointbbupperright{\pgfqpointxyz{2}{2}{0.9}} -% \def\pgfplotspointbblowerleft {\pgfqpointxyz{0}{0}{0.1}} -% -% \simplecoordinate(0,3,0.7) -% \simplecoordinate(1,3,0.5) -% \simplecoordinate(2,3,0.58) -% \simplecoordinate(3,3,0.9) -% -% \simplecoordinate(0,2,0.68) -% \simplecoordinate(1,2,0.22) -% \simplecoordinate(2,2,0.25) -% \simplecoordinate(3,2,0.4) -% -% \simplecoordinate(0,1,0.6) -% \simplecoordinate(1,1,0.3) -% \simplecoordinate(2,1,0.21) -% \simplecoordinate(3,1,0.3) -% -% \simplecoordinate(0,0,0.8) -% \simplecoordinate(1,0,0.56) -% \simplecoordinate(2,0,0.5) -% \simplecoordinate(3,0,0.75) -% -% -% \pgfplotstreamend -% \pgfusepath{stroke} -% -% \endscope -% \end{tikzpicture} -% ---------------------------------------------------------- -% END OF EXAMPLE -% -> see also the legend image for mesh plots. -% -\def\pgfplotsplothandlermesh{% - \pgfkeysgetvalue{/pgfplots/patch type}\pgfplotsplothandlermesh@patchclass - \ifx\pgfplotsplothandlermesh@patchclass\pgfplotsplothandlermesh@patchclass@defaulttext - \let\pgfplotsplothandlermesh@patchclass=\pgfutil@empty - \fi - % FIXME : detect 1d mode here! - \ifx\pgfplotsplothandlermesh@patchclass\pgfutil@empty - % assign default patch class. - \if1\pgfplotsplothandlermesh@matrixinput - \def\pgfplotsplothandlermesh@patchclass{rectangle}% + + +% sequence macros preferred over integer indices. +% using characters avoids the extensive use of \csname ...\endcsname +% and \expandafter which would be necessary for integer indices. +\def\pgfpptchindexnext@A{B}% 0->1 +\def\pgfpptchindexnext@B{C}% 1->2 +\def\pgfpptchindexnext@C{D}% 2->3 +\def\pgfpptchindexnext@D{E}% 3->4 +\def\pgfpptchindexnext@E{F}% 4->5 +\def\pgfpptchindexnext@F{G}% 5->6 +\def\pgfpptchindexnext@G{H}% 6->7 +\def\pgfpptchindexnext@H{I}% 7->8 +\def\pgfpptchindexnext@I{J}% 8->9 +\def\pgfpptchindexnext@J{K}% 9->10 +\def\pgfpptchindexnext@K{L}% 10->11 +\def\pgfpptchindexnext@L{M}% 11->12 +\def\pgfpptchindexnext@M{N}% 12->13 +\def\pgfpptchindexnext@N{O}% 13->14 +\def\pgfpptchindexnext@O{P}% 14->15 +\def\pgfpptchindexnext@P{Q}% 15->16 +\def\pgfpptchindexnext@Q{R}% 16->17 + +\pgfplotsdeclarepatchclass{line}{% + allow matrix=0, + new=\def\pgfplotspatchclass@line@no{0}, + set next vertex={% + \if0\pgfplotspatchclass@line@no\relax + \edef\pgfplotspatchclass@line@A{#1}% + \def\pgfplotspatchclass@line@no{1}% \else - \def\pgfplotsplothandlermesh@patchclass{triangle}% + \edef\pgfplotspatchclass@line@B{#1}% + \def\pgfplotspatchclass@line@no{0}% + \pgfplotspatchready% + \fi + }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \pgfplotspatchready + },% + get dimension=1, + supports global path=1, + first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@A\endvertex, + foreach vertex={% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@A\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@line@B\endvertex #1% + }, + fill path={% + \pgfplotsplothandlermesh@pathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@line@A\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@line@B\endvertex}% + \pgfplotsplothandlermesh@setlastpoint{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@line@B\endvertex}% + }, + serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% + deserialize except vertices=, + get num vertices=2, + get pdf shading type=0, +}% + +\def\pgfplotsplothandlermesh@last@x{-16000pt} +\def\pgfplotsplothandlermesh@last@y{-16000pt} + +\def\pgfplotsplothandlermesh@pathmoveto#1{% + \pgf@process{#1}% + \pgfpathmoveto{}% +} +\def\pgfplotsplothandlermesh@setlastpoint#1{% +} + +% Applies a moveto to #1 - but only if #1 is NOT the last used path +% segment. +\def\pgfplotsplothandlermesh@pathmoveto@globalpath#1{% + \pgf@process{#1}% + \pgfplots@loc@tmptrue + \ifdim\pgf@x=\pgfplotsplothandlermesh@last@x\relax + \ifdim\pgf@y=\pgfplotsplothandlermesh@last@y\relax + \pgfplots@loc@tmpfalse \fi - \pgfkeyslet{/pgfplots/patch type}\pgfplotsplothandlermesh@patchclass - \fi - % - \if0\pgfplotsplothandlermesh@matrixinput - % mesh input=patches: simply skip empty input lines: - \pgfkeyssetvalue{/pgfplots/empty line}{none}% \fi - % - \pgfkeysgetvalue{/pgfplots/patch table/value}\pgfplotsplothandlermesh@patchtable - \ifx\pgfplotsplothandlermesh@patchtable\pgfutil@empty - \else - \def\pgfplotsplothandlermesh@matrixinput{0}% implies 'patch input=patches' - \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@mesh@patchtable - \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@mesh@patchtable - \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@mesh@patchtable + \ifpgfplots@loc@tmp + \pgfpathmoveto{}% \fi - \def\pgf@plotstreamstart{% -% \scope - % - % this shouldn't be necessary, but it doesn't hurt either. - \pgfplots@perpointmeta@preparetrafo - % - \def\pgfplotsplothandlermesh@ONEDIMMODE{0}% - \pgfplotsplothandlermesh@init@meshkeys +}% + +\def\pgfplotsplothandlermesh@setlastpoint@globalpath#1{% + \pgf@process{#1}% + \xdef\pgfplotsplothandlermesh@last@x{\the\pgf@x}% + \xdef\pgfplotsplothandlermesh@last@y{\the\pgf@y}% +}% + +\pgfplotsdeclarepatchclass{triangle}{% + allow matrix=0, + new=\def\pgfplotspatchclass@tri@no{0}\let\pgfplotspatchclass@trie@AB\relax, + set next vertex={% + \ifcase\pgfplotspatchclass@tri@no\relax + \edef\pgfplotspatchclass@tri@A{#1}% + \def\pgfplotspatchclass@tri@no{1}% + \or + \edef\pgfplotspatchclass@tri@B{#1}% + \def\pgfplotspatchclass@tri@no{2}% + \or + \edef\pgfplotspatchclass@tri@C{#1}% + \def\pgfplotspatchclass@tri@no{0}% + \pgfplotspatchready% + \fi + }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + \pgfplotspatchready % % - \let\pgfplotsplothandlermesh@patchclass@input=\pgfplotsplothandlermesh@patchclass - \let\pgfplotsplothandlermesh@patchclass@output=\pgfplotsplothandlermesh@patchclass@input - \if0\pgfplotsplothandlermesh@triangulate + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{1}% + #1% + \pgfplotspatchready + },% + first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@A\endvertex, + foreach vertex={% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@A\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@B\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@tri@C\endvertex #1% + }, + fill path={% + \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% + \pgfpathclose + }, + stroke path={% + \ifx\pgfplotspatchclass@trie@AB\relax + \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% + \pgfpathclose \else - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@input}{triangulate class}% - \let\pgfplotsplothandlermesh@patchclass@output=\pgfplotsretval + \if1\pgfplotspatchclass@trie@AB + \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% + \fi + \if1\pgfplotspatchclass@trie@BC + \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% + \fi + \if1\pgfplotspatchclass@trie@CA + \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% + \fi \fi - % - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@input}{init}% - \ifx\pgfplotsplothandlermesh@patchclass@input\pgfplotsplothandlermesh@patchclass@output + }, + triangulate=\pgfplotspatchready, + set edge visible={% + \ifcase#1 + \edef\pgfplotspatchclass@trie@AB{#2}% + \or + \edef\pgfplotspatchclass@trie@BC{#2}% + \or + \edef\pgfplotspatchclass@trie@CA{#2}% + \fi + }, + serialize except vertices={% + \ifx\pgfplotspatchclass@trie@AB\relax + \let\pgfplotsretval\pgfutil@empty% \else - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{init}% + \edef\pgfplotsretval{% + \noexpand\def\noexpand\pgfplotspatchclass@trie@AB{\pgfplotspatchclass@trie@AB}% + \noexpand\def\noexpand\pgfplotspatchclass@trie@BC{\pgfplotspatchclass@trie@BC}% + \noexpand\def\noexpand\pgfplotspatchclass@trie@CA{\pgfplotspatchclass@trie@CA}% + }% \fi + },% + recursive refine@={% % - % assign boolean: - \let\b@pgfplotsplothandlermesh@matrixoutput=\pgfplotsplothandlermesh@matrixinput - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{allow matrix}% - \if0\pgfplotsretval - \def\b@pgfplotsplothandlermesh@matrixoutput{0}% - \fi - \ifnum\pgfkeysvalueof{/pgfplots/patch refines}>0 - \def\b@pgfplotsplothandlermesh@matrixoutput{0}% - \fi - \if1\pgfplotsaxisplothasjumps - \def\b@pgfplotsplothandlermesh@matrixoutput{0}% - \fi - \if\pgfplotsplothandlermesh@zbuffer@choice4% 'z buffer=sort': - \def\b@pgfplotsplothandlermesh@matrixoutput{0}% - \fi + \pgfplotspatchclass{\pgfplotspatchclassname}{new}% % - \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 + % Perform longest edge bisection. + \pgfpointdiff + {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% + {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% + \edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmath@basic@veclen@\pgfplots@loc@TMPa + \pgf@xa=\pgfmathresult pt + \pgf@yc=\pgf@xa % "max so far" + \def\pgfplotspatch@tri@longestedgestart{A}% + % + \pgfpointdiff + {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@B\endvertex}% + {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% + \edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmath@basic@veclen@\pgfplots@loc@TMPa + \pgf@xa=\pgfmathresult pt + \ifdim\pgf@xa>\pgf@yc + \pgf@yc=\pgf@xa + \def\pgfplotspatch@tri@longestedgestart{B}% \fi - \if2\pgfplotsplothandlermesh@shader - \else - % 'shader!=interp' - \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + % + \pgfpointdiff + {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@C\endvertex}% + {\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@tri@A\endvertex}% + \edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + \expandafter\pgfmath@basic@veclen@\pgfplots@loc@TMPa + \pgf@xa=\pgfmathresult pt + \ifdim\pgf@xa>\pgf@yc + \def\pgfplotspatch@tri@longestedgestart{C}% \fi - \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{get pdf shading type}% - \if4\pgfplotsretval + % The ordering is not arbitrary + % (unless z buffer=sort is in effect). Let's assume that the + % AB edge is BACKGROUND and the CD edge is FOREGROUND. Then + % this sequence here should have approximately the same depth + % ordering: + % + \pgfplotspatchvertexaccumstart + \if A\pgfplotspatch@tri@longestedgestart + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@A\times{0.5}% + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@B\times{0.5}% + \def\pgfplots@loc@TMPa{ACM,BCM}% \else - \if5\pgfplotsretval + \if B\pgfplotspatch@tri@longestedgestart + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@B\times{0.5}% + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@C\times{0.5}% + \def\pgfplots@loc@TMPa{ABM,ACM}% \else - \def\b@pgfplotsplothandlermesh@matrixoutput{0}% + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@C\times{0.5}% + \expandafter\pgfplotspatchvertexadd\pgfplotspatchclass@tri@A\times{0.5}% + \def\pgfplots@loc@TMPa{ABM,BCM}% \fi \fi - % - % special handling: check if Type=5 shadings need to be - % converted to Type=4 + \pgfplotspatchvertexfinish\pgfplotspatchclass@tri@M + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa;\pgfplotspatchclass@tri@M}% + % + % invoke helper method such that I don't need to restore or + % recompute \pgfplotspatchclass@tri@M during recursion. + \expandafter\pgfplotspatchclass@tri@recursiverefine@@\pgfplots@loc@TMPa\relax{#1}% + }, + deserialize except vertices=% + \let\pgfplotspatchclass@trie@AB\relax + #1, + get pdf shading type=4, + get num vertices=3, +}% +\def\pgfplotspatchclass@tri@recursiverefine@@#1#2M,#3#4M;#5\relax#6{% + \expandafter\let\expandafter\pgfplotspatchclass@tri@A@\csname pgfplotspatchclass@tri@#1\endcsname + \expandafter\let\expandafter\pgfplotspatchclass@tri@B@\csname pgfplotspatchclass@tri@#2\endcsname + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@A@}% + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@B@}% + \pgfplotsplothandlermesh@setnextvertex{#5}% + #6% + % + \expandafter\let\expandafter\pgfplotspatchclass@tri@A@\csname pgfplotspatchclass@tri@#3\endcsname + \expandafter\let\expandafter\pgfplotspatchclass@tri@B@\csname pgfplotspatchclass@tri@#4\endcsname + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@A@}% + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@tri@B@}% + \pgfplotsplothandlermesh@setnextvertex{#5}% + #6% +}% + + +% A rectangle specified in the sequence +% D <-- C +% | ^ +% v | +% A --> B +% +\pgfplotsdeclarepatchclass{rectangle}{% + allow matrix=1, + new=\def\pgfplotspatchclass@rect@no{0}, + set next vertex={% + \ifcase\pgfplotspatchclass@rect@no\relax + \edef\pgfplotspatchclass@rect@A{#1}% + \def\pgfplotspatchclass@rect@no{1}% + \or + \edef\pgfplotspatchclass@rect@B{#1}% + \def\pgfplotspatchclass@rect@no{2}% + \or + \edef\pgfplotspatchclass@rect@C{#1}% + \def\pgfplotspatchclass@rect@no{3}% + \or + \edef\pgfplotspatchclass@rect@D{#1}% + \def\pgfplotspatchclass@rect@no{0}% + \pgfplotspatchready% + \fi + }, + sample in unit cube={% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{0}% + #1% + \def\pgfplotspatchclassx{1}% + \def\pgfplotspatchclassy{1}% + #1% + \def\pgfplotspatchclassx{0}% + \def\pgfplotspatchclassy{1}% + #1% + \pgfplotspatchready + },% + first vertex=\expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex, + foreach vertex={% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex #1% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex #1% + }, + stream to shader={% + % a 'foreach vertex' with slightly different sequence: + \def\pgfplots@foreachvertex@@{% + \let\pgfplots@current@point@meta=\pgfplotspatchvertexmeta + \pgfplotsaxisvisphasetransformpointmeta + \pgfplotslibrarysurfstreamcoord{% + \global\pgf@x=\pgfplotspatchvertexx\space + \global\pgf@y=\pgfplotspatchvertexy\space + }{\pgfplotspointmetatransformed}% + }% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@A\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@B\endvertex\pgfplots@foreachvertex@@% + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@D\endvertex\pgfplots@foreachvertex@@% EXCHANGED SEQUENCE + \expandafter\pgfplotspatchvertex\pgfplotspatchclass@rect@C\endvertex\pgfplots@foreachvertex@@% + },% + fill path={% + \pgfpathmoveto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@A\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@B\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@C\endvertex}% + \pgfpathlineto{\expandafter\pgfplotspointpatchvertex\pgfplotspatchclass@rect@D\endvertex}% + \pgfpathclose + }, + init pdf shading={% \if0\b@pgfplotsplothandlermesh@matrixoutput - % no matrix output possible - \if5\pgfplotsretval - % pdf shading type=5 (matrix output) - \if2\pgfplotsplothandlermesh@shader - % shader=interp - % - % oh. shading type=5 is *essentially* the same as - % matrix output, but matrix output is forbidden. - % In that case, triangulate the matrix and shade the - % 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 + \ifnum\pgfkeysvalueof{/pgfplots/surf shading/cols}=2 + \else + \pgfplots@error{Sorry, (patch type=rectangle) and (rectangular patch shadings with more than one rectangle) is not supported (got \pgfkeysvalueof{/pgfplots/surf shading/cols} x * input points). + It is supported if z buffer!=sort. Consider using 'patch to triangles=true' to combine it with z buffer=sort}% \fi \fi + }, + recursive refine@={% + \pgfplots@error{Please use \string\usepgfplotslibrary{patchplots} in order to use 'refine,patch type=\pgfplotspatchclassname'}% + }, + triangulate={% + \let\pgfplotsplothandlermesh@patchclass@=\pgfplotsplothandlermesh@patchclass + \def\pgfplotsplothandlermesh@patchclass{triangle}% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{new}% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01% + \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@B}% + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}% % - \pgfplotsplothandlermesh@init@DECODE - \pgfplotsplothandlermesh@init@REFINE - % - \pgfutil@ifundefined{pgfplots@drawmodes}{% - \let\pgfplots@drawmodes=\tikz@mode - \let\pgfplots@drawoptions=\tikz@options - }{}% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}01% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}11% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{set edge visible}20% + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@B}% + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@C}% + \expandafter\pgfplotsplothandlermesh@setnextvertex\expandafter{\pgfplotspatchclass@rect@D}% + \let\pgfplotsplothandlermesh@patchclass=\pgfplotsplothandlermesh@patchclass@ + },% + serialize except vertices=\let\pgfplotsretval\pgfutil@empty,% + deserialize except vertices=, + get pdf shading type=5, + get num vertices=4, +}% + +\def\pgfplots@rect@next@A{B} +\def\pgfplots@rect@next@B{C} +\def\pgfplots@rect@next@C{D} +\def\pgfplots@rect@next@D{A} + +\def\pgfplots@rect@rnext@A{D} +\def\pgfplots@rect@rnext@B{A} +\def\pgfplots@rect@rnext@C{B} +\def\pgfplots@rect@rnext@D{C} + +% Ideas: make sure that the foreground edge is the 'v=1' +% edge of the coons patch, i.e. that it is drawn on top of +% the rest. +% +% Furthermore, for fixed v, the 'u=1' point should belong +% to the foreground (as it is drawn on top of u=0). +% +% In other words, if the coons patch looks like +% +% BB-------CC <--v=1 +% | | +% | | +% | | +% AA-------DD <--v=0 +% | | +% u=0 u=1 +% +% where the AA,BB,CC,DD are the corners of the coons +% patch, The FOREGROUND POINT of our visualization here should be CC, +% the second most foreground point BB (assuming that +% foreground point and second most foreground point are +% adjacent). +% +% Thus, if 'CC' is behind of 'BB' in the A,B,C,D ordering: +% start the coons patch with AA := BB-1 in forward +% direction. +% else +% start the coons patch with AA := BB+1 in reverse +% direction. +% +% #1: the vertex prefix for the rectangular shape. +% Thus, \csname #1A\endcsname is the first vertex, \csname #1B\endcsname the second +% and #1C, #1D the third and fourth. +% +% [output] #2: A macro name which will be filled with the FIRST point +% to stream to the shader. It will be defined to be either A,B,C or D. +% [output] #3: A macro name which indicates whether the stream shall +% be forward or backward. It will be defined to be either empty or 'r'. If +% it is empty, the coons patch shall be in the sequence +% #2,next(#2),next(next(#2),.... +% If it is 'r', the coons patch shall be in the sequence +% #2,prev(#2),prev(prev(#2),... +% +% Note that this method works also for biquadratic patches since these +% patches also have #1A, #1B, #1C and #1D as their corners. +% +\def\pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth#1#2#3{% + \def#2{A}% + \def#3{}% + % + \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1A\endcsname\endvertex + \ifx\pgfplotspatchvertexdepth\pgfutil@empty + \else + % aaah -- we have z buffer information. Then we will use it! + \edef\PA{\pgfplotspatchvertexdepth pt A}% + \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1B\endcsname\endvertex + \edef\PB{\pgfplotspatchvertexdepth pt B}% + \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1C\endcsname\endvertex + \edef\PC{\pgfplotspatchvertexdepth pt C}% + \expandafter\expandafter\expandafter\pgfplotspatchvertex\csname #1D\endcsname\endvertex + \edef\PD{\pgfplotspatchvertexdepth pt D}% + \pgfplotsutilsortfour\PA\PB\PC\PD + \def\toCHAR##1pt ##2{##2}% get original index % % - % Prepare color data source: - \ifx\pgfplotspointmetainputhandler\pgfutil@empty% - % oh. There is no color data!? Well... then use a constant - % color. - % - % This activates tikz colors: - %\tikz@options - \def\pgfplotsplothandlermesh@definecolor{% - \pgfplots@drawoptions - }% + \edef\PA{\expandafter\toCHAR\PA}%% + \edef#2{\expandafter\toCHAR\PB}%% + \edef\Pnext{\csname pgfplots@rect@next@#2\endcsname}% this here uses only A,B,C and D (also for biquadratic patches!) + \if\Pnext\PA + % ok, next(BB) = CC. + % that means we have to advance forward. + \def#3{}% + \edef#2{\csname pgfplots@rect@rnext@#2\endcsname}% \else - \pgfplotsplothandlermesh@init@cdata - \pgfplotsplothandlermesh@init@shader - \pgfplotsplothandlermesh@init@flat@color - \fi - % PREPARE THE STREAM PROCESSING: - % 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 + \edef#2{\csname pgfplots@rect@next@#2\endcsname}% + \def#3{r}% \fi - % - % z buffering: - \pgfplotsplothandlermesh@init@zbuffer - % - \pgfplotsplothandlermesh@init@mesh@stream - % - \c@pgfplots@scanlineindex=0 - }% +%\message{^^JDEPTH SEQUENCE for rectangle: \PA, \PB, \PC, \PD^^J}% +%\message{COONS PATH ORDERING: starts with #2, direction: \ifx#3\pgfutil@empty forward\else backward\fi^^J}% + \fi }% + +\def\pgfplotspatchclass@rect@to@coonspatch@findshadingsequence@for@depth@no@op#1#2#3{% + \def#2{A}% + \def#3{}% +} + \def\pgfplotsplothandlermesh@patchclass@defaulttext{default}% +% This is a VERY special case. The idea is to switch to +% "normal" path mode: +% \pgfpathmoveto \pgfpathlineto \pgfpathlineto +% \pgfpathlineto \pgfusepath. +% +% Note that the mesh handler's default is to issue +% \pgfusepath after *each* elementary patch. +% +% This special use-case might not cover all aspects of the +% mesh/surf/patch plot handler. +\def\pgfplotsplothandlermesh@init@path@without@point@meta{% + % + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass@output}{supports global path}% + \ifnum\pgfplotsretval=1 % + \def\pgfplotsplothandlermesh@definecolor{% + % no-op + }% + % FIXME : this does not handle separate edges, i.e. + % \pgfplotsplothandlermesh@VISUALIZE@std@separate@fillstroke + \def\pgfplotsplothandlermesh@VISUALIZE{\pgfplotsplothandlermesh@VISUALIZE@globalpath@fill@andor@stroke}% + \let\pgfplotsplothandlermesh@pathmoveto=\pgfplotsplothandlermesh@pathmoveto@globalpath + \let\pgfplotsplothandlermesh@setlastpoint=\pgfplotsplothandlermesh@setlastpoint@globalpath + % + % This activates tikz colors: + %\tikz@options + \pgfplots@drawoptions + % Acquire the values for \tikz@mode@* [used for faceted] + \pgfplots@drawmodes + \else + \pgfplots@error{Please provide 'point meta' for your plot. Omitting point meta is only supported for 1d patch types.}% + \fi +} + % implements 'show normals'. Keep in mind that this is more-or-less a % debugging helper, not productive code. \def\pgfplotsplothandlermesh@show@normals{% @@ -1502,9 +1683,17 @@ \pgfplotsplothandlermesh@usepath \pgfplotsplothandlermesh@show@normals@if@configured }% -\let\pgfplotsplothandlermesh@VISUALIZE@std=\pgfplotsplothandlermesh@VISUALIZE@std@fill@andor@stroke -\let\pgfplotsplothandlermesh@VISUALIZE=\pgfplotsplothandlermesh@VISUALIZE@std +% a special VISUALIZE implementation which allows to draw a CONTINUOS +% global path, i.e. one which is not "\pgfusepath"ed after each patch +% segment. This is only used if 'point meta=none' +\def\pgfplotsplothandlermesh@VISUALIZE@globalpath@fill@andor@stroke{% + \pgfplotspatchclass{\pgfplotsplothandlermesh@patchclass}{fill path}% +}% + +\def\pgfplotsplothandlermesh@VISUALIZE@std{\pgfplotsplothandlermesh@VISUALIZE@std@fill@andor@stroke} + +\def\pgfplotsplothandlermesh@VISUALIZE{\pgfplotsplothandlermesh@VISUALIZE@std} \let\pgfplotsplothandlermesh@show@normals@if@configured\relax @@ -1765,6 +1954,12 @@ % mesh input=patches \pgfkeys{/pgfplots/mesh/ordering/x varies}% disable any special handling. \fi + % + \pgfplotspatchclass{\pgfkeysvalueof{/pgfplots/patch type}}{get dimension}% + \ifnum\pgfplotsretval=1 % + \def\pgfplots@meshmode{m}% mesh. + \fi + % }% \let\pgfplotsplothandlermesh@interior@exterior@hook=\relax @@ -1904,9 +2099,6 @@ \def\pgfplotsplothandlermesh@init@shader{% % % Now, process the 'shader' key here: - \if\pgfplotsplothandlermesh@ONEDIMMODE1 - \def\pgfplots@meshmode{m}% 'mesh' - \fi \if\pgfplots@meshmode m% mesh % this is processed by the 'shader=flat' code below. \def\pgfplotsplothandlermesh@shader{0}% 'flat' @@ -2276,7 +2468,7 @@ \pgfmathparse{1000/(\rangeb-\rangea)} \let\factor=\pgfmathresult - \pgfutil@ifundefined{pgfqpointxyz@orig}{% + \pgfutil@IfUndefined{pgfqpointxyz@orig}{% \let\pgfqpointxyz@orig=\pgfqpointxyz }{}% % diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex index 961362a1857..9d17a2e157d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex @@ -404,7 +404,63 @@ \expandafter\pgfplotsplothandlers@init@\expandafter{\pgfplots@loc@TMPa}% }% % + \if1\b@pgfplots@compat@bar@width@units + \else + \def\pgfplotbarwidth{\pgfplots@bar@width@not@in@context}% + \def\pgfplotbarshift{\pgfplots@bar@shift@not@in@context}% + \pgfplotsutil@add@to@macro\pgfplothandlerxbar{% + \def\pgfplotbarwidth{\pgfplots@xbar@width}% + \def\pgfplotbarshift{\pgfplots@xbar@shift}% + }% + \pgfplotsutil@add@to@macro\pgfplothandlerybar{% + \def\pgfplotbarwidth{\pgfplots@ybar@width}% + \def\pgfplotbarshift{\pgfplots@ybar@shift}% + }% + \fi + % \pgfplotsplothandlers@init@map@to@patched@versions + % +}% + +\def\pgfplots@xbar@width{pgfplotsxbarwidth} +\def\pgfplots@ybar@width{pgfplotsybarwidth} +\def\pgfplots@xbar@shift{pgfplotsxbarshift} +\def\pgfplots@ybar@shift{pgfplotsybarshift} +\def\pgfplots@bar@width@not@in@context{pgfplotsbarwidthgeneric} +\def\pgfplots@bar@shift@not@in@context{pgfplotsbarshiftgeneric} + +\pgfmathdeclarefunction{pgfplotsxbarwidth}{0}{\pgfplots@bar@mathparse@{y}{bar width}}% +\pgfmathdeclarefunction{pgfplotsybarwidth}{0}{\pgfplots@bar@mathparse@{x}{bar width}}% +\pgfmathdeclarefunction{pgfplotsxbarshift}{0}{\pgfplots@bar@mathparse@{y}{bar shift}}% +\pgfmathdeclarefunction{pgfplotsybarshift}{0}{\pgfplots@bar@mathparse@{x}{bar shift}}% +\pgfmathdeclarefunction{pgfplotsbarwidthgeneric}{0}{\pgfplots@bar@mathparse@{N}{bar width}}% +\pgfmathdeclarefunction{pgfplotsbarshiftgeneric}{0}{\pgfplots@bar@mathparse@{N}{bar shift}}% + +\def\pgfplots@bar@mathparse@#1#2{% + \pgfmathparse{\pgfkeysvalueof{/pgf/#2}}% + \ifpgfmathunitsdeclared + \else + \if N#1% + \pgfplots@bar@mathparse@error{#1}{#2}% + \else + \let\pgfplots@loc@TMPa=\pgfmathresult + \csname pgfplotstransformdirection#1\endcsname{\pgfplots@loc@TMPa}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \if#1x% + \pgfqpointxy{\pgfplots@loc@TMPa}{0}% + \edef\pgfmathresult{\pgf@sys@tonumber\pgf@x}% + \else + \pgfqpointxy{0}{\pgfplots@loc@TMPa}% + \edef\pgfmathresult{\pgf@sys@tonumber\pgf@y}% + \fi + %\edef\pgfplots@loc@TMPa{{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}}% + %\expandafter\pgfmathveclen@\pgfplots@loc@TMPa + \fi + \fi +}% + +\def\pgfplots@bar@mathparse@error#1#2{% + \pgfplots@error{Sorry, the value '#2=\pgfkeysvalueof{/pgf/#2}' is given in terms of a unit -- but I do not know which axis! Please set one of 'xbar' or 'ybar' before evaluating the value of '#2'}% }% % Resets the plot handler routines. @@ -425,6 +481,7 @@ \let\pgfplotsplothandlersurveydifflen=\pgfplotsplothandlersurveydifflen@default \let\pgfplotsplothandlersurveypointattime=\pgfplotsplothandlersurveypointattime@default \let\pgfplotsplothandlertransformslopedattime=\pgfplotsplothandlertransformslopedattime@default + \let\pgfplotsplothandlerifcurrentpointcanbefirstlast=\pgfplotsplothandlerifcurrentpointcanbefirstlast@default }% % \pgfplotsplothandlersurveystart @@ -435,6 +492,13 @@ [tikz@plot@handler: \meaning\pgf@plotstreamstart]% }% +% \pgfplotsplothandlerifcurrentpointcanbefirstlast : can be used to +% check if the current point of a plot handler can be the global first +% or last segment. +% It will execute #1 if that is the case and #2 if not. +\def\pgfplotsplothandlerifcurrentpointcanbefirstlast@default#1#2{#1}% + + % \pgfplotsplothandlersurveyend % Called at the end of each survey phase. \def\pgfplotsplothandlersurveyend@default{} @@ -1852,6 +1916,7 @@ contour external/scanline marks/required/.code={\def\pgfplotsplothandlercontourexternal@scanlinemode{2}}, contour external/scanline marks/true/.code={\def\pgfplotsplothandlercontourexternal@scanlinemode{2}}, contour external/scanline marks/if in input, + contour external/output point meta/.initial=, contour external/file/.initial=,% auto-generate contour external/script extension/.initial=script, contour external/script/.initial=,% not yet initialised @@ -2479,10 +2544,15 @@ \pgfplotsplothandlercontourprepared \let\pgfplots@coord@stream@start=\relax% has already been done. \def\pgfplots@coord@stream@end{\pgfplotsplothandlersurveyend}% - \ifpgfplots@curplot@threedim - \pgfplotssetpointmetainput{z}{}% + \pgfkeysgetvalue{/pgfplots/contour external/output point meta}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \ifpgfplots@curplot@threedim + \pgfplotssetpointmetainput{z}{}% + \else + \pgfplotssetpointmetainput{explicit}{}% + \fi \else - \pgfplotssetpointmetainput{explicit}{}% + \expandafter\pgfplots@pgfkeys@set@point@meta@value\expandafter{\pgfplots@loc@TMPa}% \fi \pgfplots@addplotimpl@file@streamit{\pgfplotsplothandlercontourexternal@file.table}% \closein\r@pgfplots@reada diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex index b908154f070..a76168b25db 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex @@ -266,12 +266,12 @@ {\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}% + % FIXME : this might work, but is is hackery - because the + % coordmath framework handles log bases in a very stupid way. + % improve it somehow! + \edef\pgfmathresult{\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}% + \pgfplotscoordmath{\pgfplots@stacked@dir}{exp}{\pgfmathresult}% + \pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}% \expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname=\pgfmathresult \pgfplotscoordmath{default}{op}{\pgfplots@stacked@op}{% {\csname pgfplots@stacked@zerolevelpoint@\pgfplots@stacked@dir\endcsname}% 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 e8e9a4568a4..d28777ad4dd 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 @@ -98,7 +98,7 @@ }% % % \pgfplots@loc@TMPb := final boolean luaBinaryEncoding; - \pgfutil@ifundefined{directlua}{% + \pgfutil@IfUndefined{directlua}{% \def\pgfplots@loc@TMPb{0}% }{% \ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty 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 f4bd3054304..155e05d9aee 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/sys/pgfplotssysgeneric.code.tex @@ -76,7 +76,7 @@ \fi } -\pgfutil@ifundefined{AtBeginDocument}{% +\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 c9baffcb6dd..6414f57a9a8 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex @@ -220,7 +220,7 @@ % % The standard method - it results in binary encoded numbers. binary encoding/.code={% - \pgfutil@ifundefined{directlua}{% + \pgfutil@IfUndefined{directlua}{% \let\pgfplotscharno=\pgfplotscharno@bincatcode }{% % Ah - we use LuaTeX! 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 0c1f8dc41fe..0ef2cb01c8d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex @@ -83,16 +83,16 @@ % #1: the required LaTeX package % #2: the feature which requires this package \def\pgfplots@assert@LaTeX@package@loaded#1#2{% - \pgfutil@ifundefined{@ifpackageloaded}{% + \pgfutil@IfUndefined{@ifpackageloaded}{% \pgfplots@error{Sorry, #2 only works with LaTeX (it relies on the LaTeX package #1)}% }{% - \pgfutil@ifundefined{ver@#1.sty}% this here has been extracted from ltclass.dtx. \@ifpackageloaded is only usable in preamble. + \pgfutil@IfUndefined{ver@#1.sty}% this here has been extracted from ltclass.dtx. \@ifpackageloaded is only usable in preamble. {\pgfplots@error{Sorry, use need \string\usepackage{#1} in your preamble for '#2'}}% {\relax}% }% }% \def\pgfplots@assert@tikzinternal@exists#1{% - \pgfutil@ifundefined{#1}{% + \pgfutil@IfUndefined{#1}{% \pgfplots@error{Sorry, pgfplots relies on the existance of the tikz internal macro '#1'. Unfortunately, this does no longer exist ... you will need to get an updated version of pgfplots to fix this problem.}% \expandafter\let\csname #1\endcsname=\pgfutil@empty @@ -119,7 +119,7 @@ % #2: a macro name WITHOUT backslash. % #3: the default value if everything fails. \def\pgfplots@gettikzinternal@keyval#1#2#3{% - \pgfutil@ifundefined{#2}{% + \pgfutil@IfUndefined{#2}{% \pgfkeysifdefined{/tikz/#1}{% \pgfkeysgetvalue{/tikz/#1}\pgfplots@TMP \expandafter\let\csname #1\endcsname=\pgfplots@TMP @@ -138,7 +138,7 @@ }% \def\pgfplots@getcurrent@plothandler#1{% - \pgfutil@ifundefined{tikz@plot@handler}{% + \pgfutil@IfUndefined{tikz@plot@handler}{% \pgfplots@error{Sorry, can't get the current plot handler. It appears that tikz and pgfplots is no longer compatible!? You will need to get a newer version of pgfplots.}% \let#1=\pgfplothandlerlineto }{% @@ -212,7 +212,7 @@ }% \pgfplots@command@to@string\pgfplotsutil@@arg@ifdefined\pgfplotsutil@@arg@ifdefined \expandafter\pgfplotsutil@trim\expandafter{\pgfplotsutil@@arg@ifdefined}% - \pgfutil@ifundefined{\pgfplotsretval}{#3}{#2}% + \pgfutil@IfUndefined{\pgfplotsretval}{#3}{#2}% }% % The same as \pgfplotsutil@ifdefinedui but appends the suffix '#2' to % '#1' after '#1' has been normalized. @@ -223,7 +223,7 @@ }% \pgfplots@command@to@string\pgfplotsutil@@arg@ifdefined\pgfplotsutil@@arg@ifdefined \expandafter\pgfplotsutil@trim\expandafter{\pgfplotsutil@@arg@ifdefined}% - \pgfutil@ifundefined{\pgfplotsretval #2}{#4}{#3}% + \pgfutil@IfUndefined{\pgfplotsretval #2}{#4}{#3}% }% % Writes the command name of '#1' without the leading backslash to @@ -804,6 +804,18 @@ % \edef\pgfplots@loc@TMPb{#4}% \expandafter\pgfplotsforeachlogarithmicungrouped@readdomain\pgfplots@loc@TMPb\relax + \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{if is bounded}{\pgfplots@foreach@loc@TMPb}{% + }{% + \pgfplotsforeachlogarithmicmath@unbounded@domain{#4}% + \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{-10000}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult + }% + \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{if is bounded}{\pgfplots@foreach@loc@TMPa}{% + }{% + \pgfplotsforeachlogarithmicmath@unbounded@domain{#4}% + \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{parsenumber}{-10000}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + }% % compute mesh width into \pgfplots@foreach@loc@TMPc: % \pgfplots@foreach@loc@TMPc := h := ( log(xmax) - log(xmin) ) / (N-1) \pgfplotscoordmath{\pgfplotsforeachlogarithmicmathid}{op}{subtract}{{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}}% @@ -841,6 +853,11 @@ % restore scoped variables: \pgfplots@foreach@loc@TMPd } + +\def\pgfplotsforeachlogarithmicmath@unbounded@domain#1{% + \pgfplots@error{Sorry, the provided domain #1 is unsuitable for logarithmic sampling (applying the log results in unbounded values)}% +}% + % can be used to convert the number format from float to something % else. \def\pgfplotsforeachlogarithmicungrouped@finalizeresult{}% @@ -930,7 +947,7 @@ } \def\pgfplots@logfileopen#1{% \immediate\write-1{PGFPlots: reading {#1}}% - \pgfutil@ifundefined{tikzifexternalizingcurrent}{% + \pgfutil@IfUndefined{tikzifexternalizingcurrent}{% % version not up-to-date or external lib not loaded? }{% % adjust the .dep file only if we are externalizing. @@ -1162,7 +1179,7 @@ -\pgfutil@ifundefined{pgfmathdeclarefunction}{% +\pgfutil@IfUndefined{pgfmathdeclarefunction}{% % BACKWARDS COMPATIBILITY: We have PGF 2.00 : \def\pgfplotsmathdeclarepseudoconstant#1#2{% \t@pgfplots@toka=\expandafter{\csname pgfmath#1@\endcsname}% @@ -1459,12 +1476,12 @@ % defines \pgfplotsretval to be % -% \tikzifinpicture{#1}{#2} +% \ifpgfpicture #1\else #2\fi % % and handles the '/pgfplots/invoke before crossref tikzpicture' key. % -% #1 first argument to \tikzifinpicture -% #2 second argument to \tikzifinpicture +% #1 first argument to \ifpgfpicture +% #2 second argument to \ifpgfpicture \def\pgfplots@assemble@ref@picture#1#2{% \begingroup \pgfkeysgetvalue{/pgfplots/invoke before crossref tikzpicture}\pgfplots@loc@TMPa @@ -1474,13 +1491,13 @@ \toks2={#2}% \toks3=\expandafter{\pgfplots@loc@TMPb}% \xdef\pgfplots@glob@TMPa{% - \noexpand\tikzifinpicture - {\the\toks0}% - {% - \the\toks1 - \the\toks2 - \the\toks3 - }% + \noexpand\ifpgfpicture + \the\toks0 % + \noexpand\else + \the\toks1 + \the\toks2 + \the\toks3 + \noexpand\fi }% \endgroup \let\pgfplotsretval=\pgfplots@glob@TMPa @@ -1491,7 +1508,7 @@ \immediate\write\@auxout{#1}% \fi }% -\pgfutil@ifundefined{if@filesw}{% +\pgfutil@IfUndefined{if@filesw}{% \def\pgfplots@auxwrite#1{}% }{% \let\pgfplots@auxwrite=\pgfplots@auxwrite@latex @@ -1958,10 +1975,17 @@ \gdef\pgfplotsHASH{#}% \catcode`\%=12 \gdef\pgfplotsPERCENT{%}} -\pgfutil@ifundefined{directlua}{}{% +\pgfutil@IfUndefined{directlua}{}{% \directlua{require(\pgfplotsDQ pgfplots.lua\pgfplotsDQ)}% }% +% swaps the content of two macros +\def\pgfplotsutil@swap#1#2{% + \let\pgfplotsutil@swap@=#1% + \let#1=#2% + \let#2=\pgfplotsutil@swap@ +}% + \input pgfplotsliststructure.code.tex \input pgfplotsliststructureext.code.tex \input pgfplotsarray.code.tex diff --git a/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex b/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex index 416f0f22836..5fce5642009 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex +++ b/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex @@ -195,7 +195,7 @@ \iwvo{\endgroup} \iwvo{\string\endinput}% } -\pgfutil@ifundefined{write@objs}{}{% +\pgfutil@IfUndefined{write@objs}{}{% \ifx\write@objs\write@objs@BUGGY \let\write@objs=\write@objs@CORRECT \fi diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty index b394ca10f7e..1f4f8113da6 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty @@ -23,13 +23,12 @@ % along with this program. If not, see . % %-------------------------------------------- -\def\pgfplotsversion{1.6.1} -\IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {\def\pgfplotsrevision{}} -\ifx\pgfplotsrevision\pgfutil@empty -\else - \edef\pgfplotsrevision{\space(git show \pgfplotsrevision)}% -\fi -\ProvidesPackage{pgfplots}[2012/08/23 v\pgfplotsversion\pgfplotsrevision] +\IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {% + \def\pgfplotsrevision{???}% + \def\pgfplotsversion{???}% + \def\pgfplotsversiondate{???}% +} +\ProvidesPackage{pgfplots}[\pgfplotsversiondate\space v\pgfplotsversion\space Data Visualization (\pgfplotsrevision)] % ATTENTION: % you MAY need one of diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty index e5cbf82e730..ac619f7fd1b 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty @@ -18,7 +18,12 @@ % along with this program. If not, see . % %-------------------------------------------- -\ProvidesPackage{pgfplotstable}[2012/08/23 Part of pgfplots] +\IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {% + \def\pgfplotsrevision{???}% + \def\pgfplotsversion{???}% + \def\pgfplotsversiondate{???}% +} +\ProvidesPackage{pgfplotstable}[\pgfplotsversiondate\space v\pgfplotsversion\space Table typesetting and Pretty-printing (\pgfplotsrevision)] \RequirePackage{pgfplots} -- cgit v1.2.3