diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex | 178 |
1 files changed, 164 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex index 9d17a2e157d..d7352cc0970 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsplothandlers.code.tex @@ -429,24 +429,39 @@ \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}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsxbarwidth}{\pgfplots@bar@mathparse@{y}{bar width}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsybarwidth}{\pgfplots@bar@mathparse@{x}{bar width}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsxbarshift}{\pgfplots@bar@mathparse@{y}{bar shift}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsybarshift}{\pgfplots@bar@mathparse@{x}{bar shift}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsbarwidthgeneric}{\pgfplots@bar@mathparse@{N}{bar width}}% +\pgfplotsmathdeclarepseudoconstant{pgfplotsbarshiftgeneric}{\pgfplots@bar@mathparse@{N}{bar shift}}% \def\pgfplots@bar@mathparse@#1#2{% \pgfmathparse{\pgfkeysvalueof{/pgf/#2}}% \ifpgfmathunitsdeclared \else - \if N#1% + \edef\pgfplots@bar@direction@choice@{#1}% + \if N\pgfplots@bar@direction@choice@% + \if a\pgfplots@bar@direction@choice + \else + \if x\pgfplots@bar@direction@choice + \def\pgfplots@bar@direction@choice@{y}% + \else + \if y\pgfplots@bar@direction@choice + \def\pgfplots@bar@direction@choice@{x}% + \else + \pgfplotsthrow{invalid argument}{\pgfplots@bar@direction@choice@}{Sorry, the value of 'bar direction' is invalid}\pgfeov% + \fi + \fi + \fi + \fi + \if N\pgfplots@bar@direction@choice@% \pgfplots@bar@mathparse@error{#1}{#2}% \else \let\pgfplots@loc@TMPa=\pgfmathresult - \csname pgfplotstransformdirection#1\endcsname{\pgfplots@loc@TMPa}% + \csname pgfplotstransformdirection\pgfplots@bar@direction@choice@\endcsname{\pgfplots@loc@TMPa}% \let\pgfplots@loc@TMPa=\pgfmathresult - \if#1x% + \if\pgfplots@bar@direction@choice@ x% \pgfqpointxy{\pgfplots@loc@TMPa}{0}% \edef\pgfmathresult{\pgf@sys@tonumber\pgf@x}% \else @@ -460,7 +475,7 @@ }% \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'}% + \pgfplotsthrow{invalid argument}{\pgfplots@bar@direction@choice@}{Sorry, the value '#2=\pgfkeysvalueof{/pgf/#2}' is given in terms of a unit -- but I do not know which axis! Next steps: either (a) set one of 'xbar' or 'ybar' before evaluating the value of '#2' or (b) define 'bar direction=x or y'}\pgfeov% }% % Resets the plot handler routines. @@ -482,8 +497,14 @@ \let\pgfplotsplothandlersurveypointattime=\pgfplotsplothandlersurveypointattime@default \let\pgfplotsplothandlertransformslopedattime=\pgfplotsplothandlertransformslopedattime@default \let\pgfplotsplothandlerifcurrentpointcanbefirstlast=\pgfplotsplothandlerifcurrentpointcanbefirstlast@default + % + \let\pgfplotsplothandlersurveybeforesetpointmeta=\pgfplotsplothandlersurveybeforesetpointmeta@default + \let\pgfplotsplothandlersurveyaftersetpointmeta=\pgfplotsplothandlersurveyaftersetpointmeta@default }% +\def\pgfplotsplothandlersurveybeforesetpointmeta@default{} +\def\pgfplotsplothandlersurveyaftersetpointmeta@default{} + % \pgfplotsplothandlersurveystart \def\pgfplotsplothandlersurveystart@default{}% @@ -1253,7 +1274,7 @@ \pgfkeyslet{/data point/#1#2}\pgfplots@loc@TMPa \fi \def#3{% - \edef\pgfmathresult{\pgfkeysvalueof{/data point/#1#2}} + \edef\pgfmathresult{\pgfkeysvalueof{/data point/#1#2}}% %\message{parse coordinate #1#2 (\pgfmathresult) ...^^J}% }% % @@ -1583,6 +1604,7 @@ \tikz@plot@handler \pgf@plotstreamstart }% + \def\pgfplotsplothandlername{hist}% \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@hist \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@hist \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@hist @@ -1843,6 +1865,22 @@ \newif\ifpgfplotsplothandlercontour@labels \newif\ifpgfplotsplothandlercontour@filled +\def\pgfplotsplothandlercontour@axis@set@inverse#1#2#3#4{% + \pgfplotsutilifstringequal{#1}{#4}{% + \expandafter\def\csname pgfplotsplothandlercontour@axis@inv@#4\endcsname{x}% + }{% + \pgfplotsutilifstringequal{#2}{#4}{% + \expandafter\def\csname pgfplotsplothandlercontour@axis@inv@#4\endcsname{y}% + }{% + \pgfplotsutilifstringequal{#3}{#4}{% + \expandafter\def\csname pgfplotsplothandlercontour@axis@inv@#4\endcsname{z}% + }{% + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, the choice axes={#1}{#2}{#3} is illegal. Please use only values x, y, and z and ensure that there is a 1:1 correspondence}\pgfeov% + }% + }% + }% +} + \pgfplotsset{ contour prepared/.code={% \let\tikz@plot@handler=\pgfplotsplothandlercontourprepared @@ -1880,7 +1918,7 @@ inner sep=2pt, font=\scriptsize, every node/.style={mapped color!50!black,fill=white},% - /pgf/number format/relative={\pgfplotspointmetarangeexponent},% + /pgf/number format/relative*={\pgfplotspointmetarangeexponent},% %every node/.style={yshift=10pt},% }, contour/labels over line/.style={ @@ -1905,6 +1943,25 @@ contour/levels/.initial=, % % + contour/contour dir/.is choice, + contour/contour dir/x/.style={/pgfplots/contour/axes={y}{z}{x}}, + contour/contour dir/y/.style={/pgfplots/contour/axes={x}{z}{y}}, + contour/contour dir/z/.style={/pgfplots/contour/axes={x}{y}{z}}, + contour/axes/.code args={#1#2#3}{% + \edef\pgfplotsplothandlercontour@axis@x{#1}% + \edef\pgfplotsplothandlercontour@axis@y{#2}% + \edef\pgfplotsplothandlercontour@axis@z{#3}% + % + \edef\pgfplots@loc@TMPa{{\pgfplotsplothandlercontour@axis@x}{\pgfplotsplothandlercontour@axis@y}{\pgfplotsplothandlercontour@axis@z}}% + % + \expandafter\pgfplotsplothandlercontour@axis@set@inverse\pgfplots@loc@TMPa{x}% + \expandafter\pgfplotsplothandlercontour@axis@set@inverse\pgfplots@loc@TMPa{y}% + \expandafter\pgfplotsplothandlercontour@axis@set@inverse\pgfplots@loc@TMPa{z}% + % + },% + contour/contour dir=z, + % + % % Interface to external tools: contour external/.code={% \edef\tikz@plot@handler{\noexpand\pgfplotsplothandlercontourexternal}% @@ -1941,11 +1998,14 @@ }, }, }% + \def\pgfplotsplothandlercontourprepared{% \pgfplotsresetplothandler \pgfplotsset{empty line=jump}% \let\pgf@plotstreamstart=\pgfplotsplothandlervisstart@contour + \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@contour \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@contour + \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@contour \if m\pgfplotsplothandlercontourprepared@format \let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@contourmatlabformat \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@contourmatlabformat @@ -1954,7 +2014,29 @@ }% \fi \pgfplotsplothandlercontour@prepare@point@meta + \def\pgfplotsplothandlersurveybeforesetpointmeta{% + % ensure that 'point meta=z' respects 'axes={y}{z}{x}' -- it + % should assign the 'x' coordinate as point meta! + % To this end, we have to convert to reordered axes + % temporarily. + \pgfplotsplothandlersurveypoint@contour@axes@std@to@reordered + \pgfplotsplothandlersurveybeforesetpointmeta@default + }% + \def\pgfplotsplothandlersurveyaftersetpointmeta{% + \pgfplotsplothandlersurveyaftersetpointmeta@default + % ... and undo the reordering after point meta has been set: + \pgfplotsplothandlersurveypoint@contour@axes@reordered@to@std + } }% + +\def\pgfplotsplothandlersurveystart@contour{% + \pgfplotsplothandlersurveystart@default + % + \pgfplotsplothandlersurveypoint@contour@prepare@axes x% + \pgfplotsplothandlersurveypoint@contour@prepare@axes y% + \pgfplotsplothandlersurveypoint@contour@prepare@axes z% +}% + \def\pgfplotsplothandlercontour@prepare@point@meta{% \ifpgfplots@curplot@threedim \pgfplotsset{/pgfplots/set point meta if empty=z}% @@ -1984,6 +2066,8 @@ \def\c@pgfplotsplothandlercontourprepared@matlabformat@count{0}% \pgfmathfloatparsenumber{nan}% \let\pgfplotsplothandlercontourprepared@matlabformat@meta=\pgfmathresult + % + \pgfplotsplothandlersurveystart@contour } \def\pgfplotsplothandlersurveypoint@contourmatlabformat{% \ifnum\c@pgfplotsplothandlercontourprepared@matlabformat@cur=\c@pgfplotsplothandlercontourprepared@matlabformat@count\relax @@ -2005,10 +2089,18 @@ \else \let\pgfplots@current@point@z=\pgfplotsplothandlercontourprepared@matlabformat@meta \let\pgfplots@current@point@meta=\pgfplotsplothandlercontourprepared@matlabformat@meta - \pgfplotsplothandlersurveypoint@default + \pgfplotsplothandlersurveypoint@contour \pgfplotsutil@advancestringcounter\c@pgfplotsplothandlercontourprepared@matlabformat@cur \fi }% + +\def\pgfplotsplothandlersurveypoint@contour{% + % + \pgfplotsplothandlersurveypoint@contour@axes@reordered@to@std + % + \pgfplotsplothandlersurveypoint@default +} + \def\pgfplotsplothandlersurveyend@contour{% \pgfplotsplothandlercontour@init@limits \ifx\pgfplotsplothandlercontour@limits@low@meta\pgfutil@empty @@ -2485,7 +2577,60 @@ \let\pgfplotsplothandlersurveyend@tofile=\pgfplotsplothandlersurveyend \let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@contourexternal \let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@contourexternal + % + \pgfplotsplothandlersurveypoint@contour@prepare@axes x% + \pgfplotsplothandlersurveypoint@contour@prepare@axes y% + \pgfplotsplothandlersurveypoint@contour@prepare@axes z% +}% + +% #1: either x, y, or z +% POSTCONDITION: +% The following three macros are defined: +% \pgfplotsplothandlersurveypoint@contour@set@axes@x +% \pgfplotsplothandlersurveypoint@contour@set@axes@y +% \pgfplotsplothandlersurveypoint@contour@set@axes@z +% they take no arguments and assign their result to \pgfmathresult. +\def\pgfplotsplothandlersurveypoint@contour@prepare@axes#1{% + \expandafter\edef\csname pgfplotsplothandlersurveypoint@contour@set@axes@#1\endcsname{% + \noexpand\let\noexpand\pgfmathresult=\expandafter\noexpand\csname pgfplots@current@point@\csname pgfplotsplothandlercontour@axis@#1\endcsname\endcsname + }% + \expandafter\edef\csname pgfplotsplothandlersurveypoint@contour@set@axes@@#1\endcsname{% + \noexpand\let\noexpand\pgfmathresult=\expandafter\noexpand\csname pgfplots@current@point@\csname pgfplotsplothandlercontour@axis@inv@#1\endcsname\endcsname + }% + % +%\message{axes #1: STD -> \expandafter\meaning\csname pgfplotsplothandlersurveypoint@contour@set@axes@#1\endcsname^^J}% +%\message{axes #1: INV -> \expandafter\meaning\csname pgfplotsplothandlersurveypoint@contour@set@axes@@#1\endcsname^^J}% +} + +\def\pgfplotsplothandlersurveypoint@contour@axes@reordered@to@std{% + \pgfplotsplothandlersurveypoint@contour@set@axes@@x + \let\pgfplotsplothandlersurveypoint@contour@set@axes@x@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@@y + \let\pgfplotsplothandlersurveypoint@contour@set@axes@y@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@@z + \let\pgfplotsplothandlersurveypoint@contour@set@axes@z@=\pgfmathresult + % + \let\pgfplots@current@point@x=\pgfplotsplothandlersurveypoint@contour@set@axes@x@ + \let\pgfplots@current@point@y=\pgfplotsplothandlersurveypoint@contour@set@axes@y@ + \let\pgfplots@current@point@z=\pgfplotsplothandlersurveypoint@contour@set@axes@z@ }% +\def\pgfplotsplothandlersurveypoint@contour@axes@std@to@reordered{% + \pgfplotsplothandlersurveypoint@contour@set@axes@x + \let\pgfplotsplothandlersurveypoint@contour@set@axes@x@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@y + \let\pgfplotsplothandlersurveypoint@contour@set@axes@y@=\pgfmathresult + % + \pgfplotsplothandlersurveypoint@contour@set@axes@z + \let\pgfplotsplothandlersurveypoint@contour@set@axes@z@=\pgfmathresult + % + \let\pgfplots@current@point@x=\pgfplotsplothandlersurveypoint@contour@set@axes@x@ + \let\pgfplots@current@point@y=\pgfplotsplothandlersurveypoint@contour@set@axes@y@ + \let\pgfplots@current@point@z=\pgfplotsplothandlersurveypoint@contour@set@axes@z@ +}% + \def\pgfplotsplothandlersurveypoint@contourexternal{% % temporarily disable updates to point meta limits. They should be % updated during the contour prepared processing. @@ -2497,6 +2642,8 @@ % \let\pgfplots@set@perpointmeta@limits=\pgfplotsplothandlercontourexternal@orig@perpointlimits@limits % + \pgfplotsplothandlersurveypoint@contour@axes@std@to@reordered + % %\message{contour gnuplot: collecting point (\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z) [\pgfplots@current@point@meta]...}% \pgfplotsplothandlersurveypoint@tofile }% @@ -2542,7 +2689,10 @@ % % \pgfplotsplothandlercontourprepared - \let\pgfplots@coord@stream@start=\relax% has already been done. + % the PREPARE steps in the coord stream start/end have already + % been done. we only need to init the plot handler survey + % start/end: + \def\pgfplots@coord@stream@start{\pgfplotsplothandlersurveystart}% \def\pgfplots@coord@stream@end{\pgfplotsplothandlersurveyend}% \pgfkeysgetvalue{/pgfplots/contour external/output point meta}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty |