diff options
author | Karl Berry <karl@freefriends.org> | 2011-08-01 00:47:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-08-01 00:47:16 +0000 |
commit | aec2bbc3994991ebc6c5f4dbc90ad15c55f1a1fb (patch) | |
tree | 8940f33f6b173fb5cc630cc58ed4b791ad29e3fe /Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex | |
parent | 868233e6288b5e35a7d7aabd79bf8e56a802bc12 (diff) |
pgfplots 1.5 (29jul11)
git-svn-id: svn://tug.org/texlive/trunk@23292 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex | 2999 |
1 files changed, 1756 insertions, 1243 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 14e4d2e9c3d..bca33bab29e 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -33,6 +33,7 @@ \input pgfplotsutil.code.tex \input pgfplotscolormap.code.tex \input pgfplotsstackedplots.code.tex +\input pgfplotsplothandlers.code.tex \input pgfplotscoordprocessing.code.tex \input pgfplotsticks.code.tex @@ -47,12 +48,12 @@ \newif\ifpgfplots@has@label@information \newif\ifpgfplots@yislinear \newif\ifpgfplots@zislinear -\newif\ifpgfplots@axis@equal -\newif\ifpgfplots@axis@equal@image +\newif\ifpgfplots@unit@vector@rescale@keep@size \newif\ifpgfplots@reverse@legend \newif\ifpgfplots@transpose@legend \newif\ifpgfplots@allow@reversal@of@rel@axis@cs \newif\ifpgfplots@scanline@verbose +\newif\ifpgfplots@plot@graphics@autoadjustaxis \newcount\pgfplots@numplots \newdimen\pgfplots@xmin@reg \newdimen\pgfplots@xmax@reg @@ -109,6 +110,7 @@ \newif\ifpgfplots@stacked@plus \newif\ifpgfplots@plot@file@skipfirst \newif\ifpgfplots@threedim +\newif\ifpgfplots@curplot@threedim \newif\ifpgfplotsthreedim \newif\ifpgfplots@curplot@isirrelevant \newif\ifpgfplots@colorbar @@ -116,6 +118,8 @@ \newif\ifpgfplots@translategnuplot \pgfplots@translategnuplottrue \let\pgfnodepartimagebox=\pgfnodeparttextbox +\newif\ifpgfplotsplothandlermesh@internaldepth +\newif\ifpgfplotsplothandlermesh@hide@refined@edges \newif\ifpgfplots@collect@firstplot@astick \newif\ifpgfplots@units@use @@ -127,6 +131,8 @@ \def\axisdefaultwidth{240pt} \def\axisdefaultheight{207pt} +\def\pgfplotsifaxisthreedim#1#2{\ifpgfplots@threedim #1\else #2\fi}% +\def\pgfplotsifcurplotthreedim#1#2{\ifpgfplots@curplot@threedim #1\else #2\fi}% % Invokes '#2' if a cycle list named '#1' exists and '#3' if not. \long\def\pgfplotsifcyclelistexists#1#2#3{% @@ -167,19 +173,34 @@ red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% } \pgfplotscreateplotcyclelist{linestyles}{solid,dashed,dotted} +\pgfplotscreateplotcyclelist{linestyles*}{solid,dashed,dotted,dashdotted,dashdotdotted} \pgfplotscreateplotcyclelist{color list}{red,blue,black,yellow,brown,teal,orange,violet,cyan,green!70!black,magenta,gray} \pgfplotscreateplotcyclelist{mark list}{% - every mark/.append style={fill=.!80!black},mark=*\\% - every mark/.append style={fill=.!80!black},mark=square*\\% - every mark/.append style={fill=.!80!black},mark=triangle*\\% - mark=star\\% - every mark/.append style={fill=.!80!black},mark=diamond*\\% - every mark/.append style={fill=.!80!black},mark=otimes*\\% - mark=|\\% - every mark/.append style={fill=.!80!black},mark=pentagon*\\% - mark=text,text mark=p\\% - mark=text,text mark=a\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=square*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=triangle*\\% + every mark/.append style={solid},mark=star\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=diamond*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill!40},mark=otimes*\\% + every mark/.append style={solid},mark=|\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=pentagon*\\% + every mark/.append style={solid},mark=text,text mark=p\\% + every mark/.append style={solid},mark=text,text mark=a\\% +} +\pgfplotscreateplotcyclelist{mark list*}{% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=square*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=triangle*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfsquare*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=pentagon*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfcircle*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill,rotate=180},mark=halfdiamond*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill!40},mark=otimes*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=diamond*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfsquare right*\\% + every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfsquare left*\\% } +\def\pgfplots@mark@list@fill{\pgfkeysvalueof{/pgfplots/mark list fill}} \pgfplotscreateplotcyclelist{exotic}{% teal,every mark/.append style={fill=teal!80!black},mark=*\\% orange,every mark/.append style={fill=orange!80!black},mark=square*\\% @@ -200,8 +221,6 @@ \pgfplots@letcsname{pgfp@cyclist@\string\coloredplotspeclist @}={pgfp@cyclist@color@}% %%%% -\def\pgfplotsset#{\pgfqkeys{/pgfplots}} - \def\pgfplotsdeprecatedstylecheck#1{% \pgfkeysifdefined{#1/.@cmd}{% \begingroup @@ -568,12 +587,12 @@ }, /pgfplots/outer axis line style/.style={ /pgfplots/every outer x axis line/.append style={#1}, - /pgfplots/every outer y axis line/.append style={#1}% + /pgfplots/every outer y axis line/.append style={#1},% /pgfplots/every outer z axis line/.append style={#1}% }, /pgfplots/inner axis line style/.style={ /pgfplots/every inner x axis line/.append style={#1}, - /pgfplots/every inner y axis line/.append style={#1}% + /pgfplots/every inner y axis line/.append style={#1},% /pgfplots/every inner z axis line/.append style={#1}% }, /pgfplots/axis line style/.style={ @@ -717,6 +736,15 @@ /pgfplots/every axis legend/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis legend}}, /pgfplots/every axis legend/.belongs to family=/pgfplots/style commands, % + % axis type: + /pgfplots/axis type/.initial=rectangle, + /pgfplots/axis type/.belongs to family=/pgfplots/scale, + /pgfplots/@expected axis cs/.initial=cart, + /pgfplots/every rectangle axis/.style={}, + % + % see \pgfplotsdefinecstransform{<from>}{<to>}{<code>} + /pgfplots/data cs/.initial=cart,% the coordinate system of provided data. Will be transformed to the axis' internal coordinate system (@expected axis cs). + % % Colorbar interface: /pgfplots/colorbar/.is if=pgfplots@colorbar, /pgfplots/colorbar/.default=true, @@ -838,13 +866,6 @@ /pgfplots/colorbar/width/.initial=0.5cm, /pgfplots/colorbar addplot/.initial=\addplot graphics {};, /pgfplots/colorbar/draw/.code={% - % FIXME : the semicolon after ';' has a fixed catcode, namely - % the one assigned while pgfplots.code.tex has been read. - % - % The \pgfplots@checkandpreparefor@active@semicolon gets - % confused if the catcodes change... this here is a - % work-around for babel support. - \let\pgfplots@checkandpreparefor@active@semicolon=\relax \axis[every colorbar,colorbar shift,colorbar=false] \pgfkeysvalueof{/pgfplots/colorbar addplot}% \endaxis @@ -1101,6 +1122,17 @@ /pgfplots/minor z tick num=#1, }, /pgfplots/minor tick num/.belongs to family=/pgfplots/tick, + /pgfplots/minor xtick/.initial=, + /pgfplots/minor xtick/.belongs to family=/pgfplots/tick, + /pgfplots/minor ytick/.initial=, + /pgfplots/minor ytick/.belongs to family=/pgfplots/tick, + /pgfplots/minor ztick/.initial=, + /pgfplots/minor ztick/.belongs to family=/pgfplots/tick, + /pgfplots/minor tick/.style={ + /pgfplots/minor xtick={#1}, + /pgfplots/minor ytick={#1}, + /pgfplots/minor ztick={#1}, + }, /pgfplots/minor tick length/.estore in=\pgfplots@subtickwidth, /pgfplots/minor tick length/.belongs to family=/pgfplots/tick, /pgfplots/major tick length/.estore in=\pgfplots@tickwidth, @@ -1285,6 +1317,21 @@ /pgfplots/anchor/.belongs to family=/pgfplots, /pgfplots/anchor/.store in= \pgfplots@anchorname, /pgfplots/anchor=south west, + /pgfplots/log origin x/.is choice, + /pgfplots/log origin x/infty/.code={\def\pgfplots@log@origin@choice@x{0}}, + /pgfplots/log origin x/0/.code={\def\pgfplots@log@origin@choice@x{1}}, + /pgfplots/log origin y/.is choice, + /pgfplots/log origin y/infty/.code={\def\pgfplots@log@origin@choice@y{0}}, + /pgfplots/log origin y/0/.code={\def\pgfplots@log@origin@choice@y{1}}, + /pgfplots/log origin z/.is choice, + /pgfplots/log origin z/infty/.code={\def\pgfplots@log@origin@choice@z{0}}, + /pgfplots/log origin z/0/.code={\def\pgfplots@log@origin@choice@z{1}}, + /pgfplots/log origin/.style={% + /pgfplots/log origin x={#1}, + /pgfplots/log origin y={#1}, + /pgfplots/log origin z={#1}, + }, + /pgfplots/log origin=0, % tick options: /pgfplots/ticks/.is choice, /pgfplots/ticks/.belongs to family=/pgfplots/tick, @@ -1462,8 +1509,6 @@ /pgfplots/ylabel shift={#1}, /pgfplots/zlabel shift={#1}, },% - /pgfplots/before end axis/.code=, - /pgfplots/after end axis/.code=, /pgfplots/extra description/.code=, % axis options: /pgfplots/at/.code={% @@ -1493,9 +1538,36 @@ /pgfplots/clip/.is if=pgfplots@clip, % will be used if it exists: %/pgfplots/axis background/.style={}, - /pgfplots/axis equal/.is if=pgfplots@axis@equal, + % + % 2d: 'unit vector ratio=2 1 is relative to y axis (x is twice as large as y) + % 3d: 'unit vector ratio=2 2 1 is relative to z axis (x and y are both twice as large as z) + % missing values are assumed to be 1. + /pgfplots/unit vector ratio/.initial=,% empty means 'disable rescale'. + /pgfplots/unit vector ratio axis/.initial=,% DEBUG. This is the reference axis which won't be scaled down. This key might vanish. + /pgfplots/unit vector ratio*/.style={% + /pgfplots/unit vector ratio={#1}, + /pgfplots/unit rescale keep size=false, + }, + /pgfplots/unit rescale keep size/.is if=pgfplots@unit@vector@rescale@keep@size, + /pgfplots/unit rescale keep size/.default=true, + /pgfplots/unit rescale keep size=true, + /pgfplots/axis equal/.is choice, + /pgfplots/axis equal/true/.style={ + /pgfplots/unit vector ratio=1 1 1, + /pgfplots/unit rescale keep size=true + }, + /pgfplots/axis equal/false/.style={ + /pgfplots/unit vector ratio=, + }, /pgfplots/axis equal/.default=true, - /pgfplots/axis equal image/.is if=pgfplots@axis@equal@image, + /pgfplots/axis equal image/.is choice, + /pgfplots/axis equal image/true/.style={% + /pgfplots/unit vector ratio=1 1 1, + /pgfplots/unit rescale keep size=false + }, + /pgfplots/axis equal image/false/.style={% + /pgfplots/unit vector ratio=, + }, /pgfplots/axis equal image/.default=true, /pgfplots/xmin/.initial=, /pgfplots/xmax/.initial=, @@ -1503,6 +1575,8 @@ /pgfplots/ymax/.initial=, /pgfplots/zmin/.initial=, /pgfplots/zmax/.initial=, + /pgfplots/min/.style={xmin={#1},ymin={#1},zmin={#1}}, + /pgfplots/max/.style={xmax={#1},ymax={#1},zmax={#1}}, /pgfplots/xtickmin/.initial=, /pgfplots/xtickmax/.initial=, /pgfplots/ytickmin/.initial=, @@ -1533,6 +1607,7 @@ /pgfplots/stack dir=plus, /pgfplots/filter discard warning/.is if=pgfplots@warn@for@filter@discards, /pgfplots/filter discard warning=true, + /pgfplots/pre filter/.code={}, /pgfplots/x filter/.code={}, /pgfplots/x filter/.belongs to family=/pgfplots, /pgfplots/y filter/.code={}, @@ -1548,9 +1623,9 @@ /pgfplots/restrict y to domain*/.style={/pgfplots/@restrict to domain={y}{}{#1}{1}},% /pgfplots/restrict z to domain*/.style={/pgfplots/@restrict to domain={z}{}{#1}{1}},% /pgfplots/restrict expr to domain*/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}{1}},% - % '#1': the filter to install + % '#1': the filter to install (like 'x', 'y', or even 'hist/data') % '#2': a mathematical expression (or empty) - % '#3': the interval. must be numeric currently. + % '#3': the interval. must be numeric currently, and of the form min:max % '#4': bAssignLimits=0|1. if #4=1, any coordinate outside of the % allowed domain will take the domain boundary as value. If #4=0, % any coordinate outside of the allowed domain will get 'inf' or @@ -1567,31 +1642,31 @@ \def\pgfplots@restrict@to@domain@tmp{#2}% \ifx\pgfplots@restrict@to@domain@tmp\pgfutil@empty % we don't have an expression. - \pgfmathfloatparsenumber{\pgfmathresult}% \else % evaluate the expression! \pgfmathparse{#2}% \fi + \pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}% \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult - \pgfmathfloatlessthan@{\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument - \ifpgfmathfloatcomparison - \edef\pgfmathresult{\if0#4inf\else ##1\fi}% - \else - \pgfmathfloatgreaterthan@{\pgfplots@restrict@to@domain@tmp}{##2}% - \ifpgfmathfloatcomparison - \edef\pgfmathresult{\if0#4-inf\else ##2\fi}% - \else - \let\pgfmathresult=\pgfplots@restrict@to@domain@orig - \fi - \fi + % + \pgfplotscoordmath{default}{if less than} + {\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument + {% + \edef\pgfmathresult{\if0#4inf\else ##1\fi}% + }{% + \pgfplotscoordmath{default}{if less than} + {##2}{\pgfplots@restrict@to@domain@tmp} + {\edef\pgfmathresult{\if0#4-inf\else ##2\fi}} + {\let\pgfmathresult=\pgfplots@restrict@to@domain@orig}% + }% }% }% }% % when invoked, ##1 and ##2 will be the user-supplied args. \def\pgfplots@loc@TMPc##1:##2\relax{% - \pgfmathfloatparsenumber{##1}% + \pgfplotscoordmath{default}{parsenumber}{##1}% \let\pgfplots@rangea=\pgfmathresult - \pgfmathfloatparsenumber{##2}% + \pgfplotscoordmath{default}{parsenumber}{##2}% \edef\pgfplots@loc@TMPc{\pgfplots@rangea:\pgfmathresult}% \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPc\relax }% @@ -1599,11 +1674,14 @@ \expandafter\pgfplots@loc@TMPc\pgfplots@loc@TMPa\relax },% % -> keeps only the nth point, all other ones will get ''. - /pgfplots/each nth point/.style={% - /pgfplots/x filter/.append code={% + /pgfplots/each nth point/.style={/pgfplots/each nth point*={x}{#1}},% + % #1: the filter name: x, y, z, or something exotic like hist/data + % #2: the N of 'each nth' + /pgfplots/each nth point*/.style 2 args={% + /pgfplots/#1 filter/.append code={% \ifnum\coordindex=0 \def\c@pgfplots@eachnthpoint@xfilter{0}% - \edef\c@pgfplots@eachnthpoint@xfilter@cmp{#1}% + \edef\c@pgfplots@eachnthpoint@xfilter@cmp{#2}% \else \pgfplotsutil@advancestringcounter\c@pgfplots@eachnthpoint@xfilter \ifx\c@pgfplots@eachnthpoint@xfilter@cmp\c@pgfplots@eachnthpoint@xfilter @@ -1614,11 +1692,14 @@ \fi }% }, - /pgfplots/skip coords between index/.style 2 args={% - /pgfplots/x filter/.append code={% - \ifnum\coordindex<#1\relax + /pgfplots/skip coords between index/.style 2 args={/pgfplots/skip coords between index*={x}{#1}{#2}},% + % #1: the filter name + % #2,#3: from 'skip coords between index' + /pgfplots/skip coords between index*/.style n args={3}{% + /pgfplots/#1 filter/.append code={% + \ifnum\coordindex<#2\relax \else - \ifnum\coordindex<#2\relax + \ifnum\coordindex<#3\relax \let\pgfmathresult=\pgfutil@empty \fi \fi} @@ -1647,6 +1728,7 @@ /pgfplots/samples y/.initial=,% empty -> use the same as 'samples'. For use in mesh plots. /pgfplots/variable/.code={\pgfkeysalso{/tikz/variable={#1}}}, /pgfplots/variable y/.initial=\y,% + /pgfplots/sample dim/.initial=auto, % and provide aliases in the '/pgfplots/' tree to avoid % search path problems just for the following options: /pgfplots/name/.code={\pgfkeysalso{/tikz/name={#1}}}, @@ -1662,9 +1744,17 @@ /pgfplots/height/.initial=,% /pgfplots/height/.belongs to family=/pgfplots, /pgfplots/execute at begin plot/.initial=, + /pgfplots/execute at begin plot visualization/.initial=, /pgfplots/execute at begin plot@@/.initial=,% an internal variant /pgfplots/execute at end plot/.initial=, + /pgfplots/execute at end plot visualization/.initial=, /pgfplots/execute at end plot@@/.initial=,% an internal variant + /pgfplots/execute at end survey/.initial=,% + /pgfplots/execute at begin axis/.initial=, + /pgfplots/execute at end axis/.initial=, + /pgfplots/execute for finished point/.initial=, + /pgfplots/before end axis/.code=, + /pgfplots/after end axis/.code=, /pgfplots/enlarge x limits/.initial=auto, /pgfplots/enlarge x limits/.default=true, /pgfplots/enlarge y limits/.initial=auto, @@ -1684,16 +1774,31 @@ /pgfplots/y/.belongs to family=/pgfplots, /pgfplots/z/.initial=, /pgfplots/z/.belongs to family=/pgfplots, + /pgfplots/view dir/.initial=,% DEBUG /pgfplots/x dir/.code={\pgfplots@setkey@axisdir@for x{#1}},% /pgfplots/y dir/.code={\pgfplots@setkey@axisdir@for y{#1}},% /pgfplots/z dir/.code={\pgfplots@setkey@axisdir@for z{#1}},% /pgfplots/x dir=normal,% /pgfplots/y dir=normal,% /pgfplots/z dir=normal,% + /pgfplots/x post scale/.initial=, + /pgfplots/y post scale/.initial=, + /pgfplots/z post scale/.initial=, + /pgfplots/scale/.style={% + /pgfplots/x post scale={#1},% + /pgfplots/y post scale={#1},% + /pgfplots/z post scale={#1},% + }, + /pgfplots/scale mode/.is choice, + /pgfplots/scale mode/auto/.code={\def\pgfplots@scale@mode@choice{0}}, + /pgfplots/scale mode/none/.code={\def\pgfplots@scale@mode@choice{1}}, + /pgfplots/scale mode/stretch to fill/.code={\def\pgfplots@scale@mode@choice{2}}, + /pgfplots/scale mode/scale uniformly/.code={\def\pgfplots@scale@mode@choice{3}}, + /pgfplots/scale mode/auto, /pgfplots/allow reversal of rel axis cs/.is if=pgfplots@allow@reversal@of@rel@axis@cs,% /pgfplots/allow reversal of rel axis cs/.default=true,% /pgfplots/allow reversal of rel axis cs=true,% - /pgfplots/plot box ratio/.initial={1}{1}{1},% + /pgfplots/plot box ratio/.initial=1 1 1,% /pgfplots/view/az/.initial=25,% /pgfplots/view/h/.code={\pgfkeyssetvalue{/pgfplots/view/az}{#1}},% /pgfplots/view/el/.initial=30,% @@ -1720,6 +1825,7 @@ /pgfplots/cycle list name/.belongs to family=/pgfplots, /pgfplots/cycle list name=color, /pgfplots/cycle list shift/.initial=, + /pgfplots/mark list fill/.initial=.!80!black, % accepts arguments of the form % <first list spec>\nextlist <second list spec>\nextlist .... % where each list spec is EITHER a cycle list name OR a cycle list @@ -2278,7 +2384,7 @@ \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname% \def\pgfplots@nodes@near@coords@align{above}% \else - \pgfmathfloatifflags{\pgfplotspointmeta}{2}{% + \pgfplotscoordmath{meta}{if is}{\pgfplotspointmeta}{-}{% % \pgfplotspointmeta < 0 \def\pgfplots@nodes@near@coords@align{left}% }{% @@ -2292,7 +2398,7 @@ \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname% \def\pgfplots@nodes@near@coords@align{above}% \else - \pgfmathfloatifflags{\pgfplotspointmeta}{2}{% + \pgfplotscoordmath{meta}{if is}{\pgfplotspointmeta}{-}{% % \pgfplotspointmeta < 0 \def\pgfplots@nodes@near@coords@align{below}% }{% @@ -2333,11 +2439,17 @@ },% },% /pgfplots/nodes near coords*/.default={\pgfmathprintnumber\pgfplotspointmeta}, + /pgfplots/visualization depends on/list/.initial=,% + /pgfplots/visualization depends on/.style={% + /pgfplots/visualization depends on/list/.add={}{,{#1}}% + }, /pgfplots/bar cycle list/.style={/pgfplots/cycle list={% {blue,fill=blue!30!white,mark=none},% {red,fill=red!30!white,mark=none},% {brown!60!black,fill=brown!30!white,mark=none},% {black,fill=gray,mark=none},% + {violet!80!black,fill=violet,mark=none},% + {green,fill=green!80!black,mark=none}% } }, /pgfplots/area cycle list/.style={bar cycle list}, @@ -2354,6 +2466,9 @@ /pgfplots/ybar legend/.style={ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, }, + /pgfplots/single ybar legend/.style={ + /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=6pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0pt,0.8em)};}, + }, /pgfplots/ybar/.style={ bar cycle list, xtick align=outside, @@ -2383,6 +2498,9 @@ /pgfplots/xbar legend/.style={ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, }, + /pgfplots/single xbar legend/.style={ + /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=6pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0pt,0.8em)};}, + }, /pgfplots/xbar/.style={ bar cycle list, ytick align=outside, @@ -2444,6 +2562,7 @@ /pgfplots/xbar stacked/.style={ /pgfplots/set point meta if empty=x,% bar cycle list, + single xbar legend, stack plots=x, stack dir=#1, /tikz/xbar, @@ -2452,6 +2571,7 @@ /pgfplots/ybar stacked/.style={ /pgfplots/set point meta if empty=f(x),% bar cycle list, + single ybar legend, stack plots=y, stack dir=#1, /tikz/ybar, @@ -2460,6 +2580,7 @@ /pgfplots/xbar interval stacked/.style={ /pgfplots/set point meta if empty=x,% bar cycle list, + single xbar legend, stack plots=x, stack dir=#1, /tikz/xbar interval, @@ -2468,6 +2589,7 @@ /pgfplots/ybar interval stacked/.style={ /pgfplots/set point meta if empty=f(x),% bar cycle list, + single ybar legend, stack plots=y, stack dir=#1, /tikz/ybar interval, @@ -2496,6 +2618,29 @@ /pgfplots/plot graphics/ymax/.initial=, /pgfplots/plot graphics/zmin/.initial=, /pgfplots/plot graphics/zmax/.initial=, + % + % a) to provide a bounding box: points={(0,1) (0,2)} + % or b) to squeeze the graphics into internal image coordinates: + % points={(0,1,0) => (0,4) (0,0,1) => (40,600)} + % or c) both of them. + /pgfplots/plot graphics/points/.initial=, + /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, + /pgfplots/plot graphics/debug/.initial=, + /pgfplots/plot graphics/debug/.default=true, + /pgfplots/plot graphics/squeeze tol/.initial=2pt, + % + % this command key should defined \pgfmathresult to be + % \pgfmathresult -> {{<wd>}{<ht>}} + % where <wd> is the natural width of the input image and + % <ht> is the natural height. + % The input image file name is available as 'plot graphics/src'. + % The default implementation invoked 'lowlevel draw={}{}' and + % measures the resulting dimensions. + /pgfplots/plot graphics/lowlevel get natural size/.code={% + \pgfplots@plot@handler@graphics@getnaturalsize + }, /pgfplots/plot graphics/lowlevel draw/.code 2 args={% \pgfplots@plot@handler@graphics@DRAW{#1}{#2}% },% @@ -2508,6 +2653,9 @@ at={(0pt,0pt)}, rectangle }, + % empty line=none|auto|scanline|nan|jump + % nan and jump is the same. + /pgfplots/empty line/.initial=auto, % 'mesh' plots. % The macro \pgfplots@meshmode is % n if meshmode == false, @@ -2531,6 +2679,44 @@ \pgfkeysalso{/pgfplots/mesh=#1}% \def\pgfplots@meshmode{s}% },% + /pgfplots/patch/.code={% + \pgfkeysalso{/pgfplots/surf=#1,/pgfplots/mesh input=patches,/pgfplots/every patch}% + },% + /pgfplots/every patch/.style={miter limit=1}, + /pgfplots/patch table/value/.initial=, + /pgfplots/patch table/.code={ + \pgfkeyssetvalue{/pgfplots/patch table/value}{#1}% + \pgfplotsplothandlermesh@patchtable@hascdatafalse + }, + /pgfplots/patch table with point meta/.code={% + \pgfkeyssetvalue{/pgfplots/patch table/value}{#1}% + \pgfplotsplothandlermesh@patchtable@hascdatatrue + \pgfplotsplothandlermesh@patchtable@cdata@individualfalse + \pgfkeysalso{/pgfplots/point meta/explicit}% + }, + /pgfplots/patch table with individual point meta/.code={% + \pgfkeyssetvalue{/pgfplots/patch table/value}{#1}% + \pgfplotsplothandlermesh@patchtable@hascdatatrue + \pgfplotsplothandlermesh@patchtable@cdata@individualtrue + \pgfkeysalso{/pgfplots/point meta/explicit}% + }, + /pgfplots/patch type/.initial=, + /pgfplots/patch internal depth/.is if=pgfplotsplothandlermesh@internaldepth, + /pgfplots/patch internal depth=true, + /pgfplots/patch to triangles/.is choice, + /pgfplots/patch to triangles/false/.code= {\def\pgfplotsplothandlermesh@triangulate{0}}, + /pgfplots/patch to triangles/true/.code= {\def\pgfplotsplothandlermesh@triangulate{1}}, + /pgfplots/patch to triangles/true with edges/.code= {\def\pgfplotsplothandlermesh@triangulate{2}}, + /pgfplots/patch to triangles=false, + /pgfplots/patch to triangles/.default=true, + /pgfplots/mesh input/.is choice, + /pgfplots/mesh input/lattice/.code= {\def\pgfplotsplothandlermesh@matrixinput{1}}, + /pgfplots/mesh input/patches/.code= {\def\pgfplotsplothandlermesh@matrixinput{0}}, + /pgfplots/mesh input/lattice, + /pgfplots/patch refines/.initial=0, + /pgfplots/hide refined edges/.is if=pgfplotsplothandlermesh@hide@refined@edges, + /pgfplots/hide refined edges/.default=true, + /pgfplots/mesh/refines/.style={/pgfplots/patch refines={#1}}, /pgfplots/mesh/rows/.initial=, /pgfplots/mesh/cols/.initial=, /pgfplots/mesh/scanline verbose/.is if=pgfplots@scanline@verbose,% @@ -2566,7 +2752,7 @@ \pgfplotsplothandlermesh@defaultlegend@img{##1}% }% }, - /pgfplots/mesh/num points/.initial=\numcoords,% this is NOT part of the public interface. Don't change it. + /pgfplots/mesh/num points/.initial=,%\numcoords,% this is NOT part of the public interface. Don't change it. /pgfplots/z buffer/.is choice,% /pgfplots/z buffer/none/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{0}},% /pgfplots/z buffer/reverse x seq/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{1}},% @@ -2592,6 +2778,7 @@ /pgfplots/shader/flat/.style={/pgfplots/shader/flat mean},% /pgfplots/shader/faceted/.code={\def\pgfplotsplothandlermesh@shader{1}}, /pgfplots/shader/interp/.code={\def\pgfplotsplothandlermesh@shader{2}}, + /pgfplots/shader/faceted interp/.code={\def\pgfplotsplothandlermesh@shader{3}}, /pgfplots/shader/faceted, /pgfplots/faceted color/.initial=mapped color!80!black, /pgfplots/clip marker paths/.is if=pgfplots@clip@marker@paths, @@ -2636,19 +2823,22 @@ /pgfplots/z coord trafo/.code={}, /pgfplots/z coord inv trafo/.code={}, % - % #1 = {<symbol1>,<symbol2>,....<symboln>} + % #1 : the coordinate in question. Can be x,y,z, or even hist/data + % or similar constructs. + % #2 : {<symbol1>,<symbol2>,....<symboln>} /pgfplots/symbolic coords/.code 2 args={% - \pgfplotsarraynew\pgfplots@symbolic@coords@inverse{#2}% - \pgfplotsarrayforeachungrouped\pgfplots@symbolic@coords@inverse\as\pgfplots@loc@TMPa{% - \expandafter\edef\csname pgfp@symb@coords@\pgfplots@loc@TMPa\endcsname{\pgfplotsarrayforeachindex}% + \expandafter\pgfplotsarraynew\csname pgfplots@symbolic@coords@#1@inverse\endcsname{#2}% + \expandafter\pgfplotsarrayforeachungrouped\csname pgfplots@symbolic@coords@#1@inverse\endcsname\as\pgfplots@loc@TMPa{% + \expandafter\edef\csname pgfp@symb@coords@#1@\pgfplots@loc@TMPa\endcsname{\pgfplotsarrayforeachindex}% }% \pgfkeysdef{/pgfplots/#1 coord trafo}{% - \pgfutil@ifundefined{pgfp@symb@coords@##1}{% + \pgfutil@ifundefined{pgfp@symb@coords@#1@##1}{% \pgfplots@error{Sorry, the input coordinate `##1' has not been defined with 'symbolic #1 coords={#2}... Maybe it has been misspelled?}% \def\pgfmathresult{0}% }{% - \edef\pgfmathresult{\csname pgfp@symb@coords@##1\endcsname}% + \edef\pgfmathresult{\csname pgfp@symb@coords@#1@##1\endcsname}% }% +%\message{#1 coord trafo{##1} --> \pgfmathresult^^J}% }% \pgfkeysdef{/pgfplots/#1 coord inv trafo}{% \begingroup @@ -2659,22 +2849,38 @@ \ifnum\count0<0 \count0=0 \else - \count1=\pgfplotsarraysizeof\pgfplots@symbolic@coords@inverse\relax + \edef\pgfplots@loc@TMPa{\expandafter\pgfplotsarraysizeof\csname pgfplots@symbolic@coords@#1@inverse\endcsname}% + \count1=\pgfplots@loc@TMPa\relax \ifnum\count0<\count1 \else \count0=\count1 \advance\count0 by-1 \fi \fi - \pgfplotsarrayselect\count0 \of\pgfplots@symbolic@coords@inverse\to\pgfmathresult + \expandafter\pgfplotsarrayselect\expandafter\count\expandafter0\expandafter\of\csname pgfplots@symbolic@coords@#1@inverse\endcsname\to\pgfmathresult +%\message{#1 coord inv trafo{##1} -->\the\count0 --> \pgfmathresult^^J}% \pgfmath@smuggleone\pgfmathresult \endgroup }% - \pgfkeysalso{% - /pgfplots/#1ticklabel={\tick},% - /pgfplots/scaled #1 ticks=false,% - /pgfplots/plot coordinates/math parser=false,% + \pgfkeysifdefined{/pgfplots/#1ticklabel/.@cmd}{% + \pgfkeysalso{% + /pgfplots/#1ticklabel={\tick},% + /pgfplots/scaled #1 ticks=false,% + /pgfplots/plot coordinates/math parser=false,% + }% + }{% + % OK. The style can be used for other coordinates as well + % (like hist/data) }% + % + \pgfkeysifdefined{/pgfplots/#1 is expr}{% + \pgfkeyssetvalue{/pgfplots/#1 is expr}{0}% + }{}% + % + % Allow a callback (optional) + \pgfkeysifdefined{/pgfplots/#1/@execute on coord trafo changed/.@cmd}{% + \pgfkeysalso {/pgfplots/#1/@execute on coord trafo changed}% + }{}% },% /pgfplots/symbolic x coords/.style={symbolic coords={x}{#1}},% /pgfplots/symbolic y coords/.style={symbolic coords={y}{#1}},% @@ -2712,6 +2918,7 @@ /pgfplots/colormap access/direct/.code={\def\pgfplots@colormap@access{d}},% /pgfplots/colormap access/map/.code={\def\pgfplots@colormap@access{m}},% /pgfplots/colormap access/map,% + %/pgfplots/colormap default colorspace/.initial=auto,% declared in pgfplotscolormap.code.tex /pgfplots/colormap/.code 2 args={% \pgfplotscreatecolormap{#1}{#2}% \pgfkeysalso{/pgfplots/colormap name=#1}% @@ -2719,6 +2926,9 @@ /pgfplots/colormap/hot/.style={ colormap name=hot }, + /pgfplots/colormap/hot2/.style={ + /pgfplots/colormap={hot2}{[1cm]rgb255(0cm)=(0,0,0) rgb255(3cm)=(255,0,0) rgb255(6cm)=(255,255,0) rgb255(8cm)=(255,255,255)} + }, /pgfplots/colormap/bluered/.style={ /pgfplots/colormap={bluered}{rgb255(0cm)=(0,0,180); rgb255(1cm)=(0,255,255); rgb255(2cm)=(100,255,0); rgb255(3cm)=(255,255,0); rgb255(4cm)=(255,0,0); rgb255(5cm)=(128,0,0)} }, @@ -2737,6 +2947,12 @@ /pgfplots/colormap/violet/.style={ colormap={violet}{rgb255=(25,25,122) color=(white) rgb255=(238,140,238)} }, + /pgfplots/colormap/jet/.style={ + /pgfplots/colormap={jet}{rgb255(0cm)=(0,0,128) rgb255(1cm)=(0,0,255) rgb255(3cm)=(0,255,255) rgb255(5cm)=(255,255,0) rgb255(7cm)=(255,0,0) rgb255(8cm)=(128,0,0)} + }, + % + % + %% /pgfplots/scatter/.is choice, /pgfplots/scatter/false/.code={% \pgfplots@scatterplotenabledfalse @@ -2909,8 +3125,18 @@ /pgfplots/compat/anchors/pre 1.3/.code={\pgfplots@deprecated@anchorstrue},% FIXME: WAS \global /pgfplots/compat/anchors/1.3/.code= {\pgfplots@deprecated@anchorsfalse},% /pgfplots/compat/anchors/1.4/.style= {/pgfplots/compat/anchors/1.3},% + /pgfplots/compat/anchors/1.5/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/newest/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},% + % + /pgfplots/compat/empty line/.is choice, + /pgfplots/compat/empty line/pre 1.3/.code={\pgfplots@emptyline@compattrue},% FIXME: WAS \global + /pgfplots/compat/empty line/1.3/.style= {/pgfplots/compat/empty line/pre 1.3},% + /pgfplots/compat/empty line/1.4/.code= {\pgfplots@emptyline@compatfalse},% + /pgfplots/compat/empty line/1.5/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/newest/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/default/.style={/pgfplots/compat/empty line/1.4},% + % /pgfplots/compat/labels/.is choice, /pgfplots/compat/labels/pre 1.3/.style={% /pgfplots/xlabel absolute, @@ -2919,14 +3145,41 @@ /pgfplots/xlabel near ticks, /pgfplots/ylabel near ticks},% /pgfplots/compat/labels/1.4/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/1.5/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( + % + % search for the \pgfplots@compat@scaling@coordmath -- using float + % is much more accurate. But it changes the spacing slightly. + /pgfplots/compat/scaling/.is choice, + /pgfplots/compat/scaling/pre 1.3/.code={% + \def\pgfplots@compat@scaling@zunitfix@enable{0}% + \def\pgfplots@compat@scaling@coordmath{pgfbasic}}, + /pgfplots/compat/scaling/1.3/.style={/pgfplots/compat/scaling/pre 1.3}, + /pgfplots/compat/scaling/1.4/.code={% + \def\pgfplots@compat@scaling@zunitfix@enable{1}% + \def\pgfplots@compat@scaling@coordmath{float}}, + /pgfplots/compat/scaling/1.5/.style={/pgfplots/compat/scaling/1.4}, + /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.4}, + /pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4}, + /pgfplots/compat/general/.is choice, + /pgfplots/compat/general/pre 1.3/.style={/pgfplots/log origin=infty},% + /pgfplots/compat/general/1.3/.style={/pgfplots/compat/general/pre 1.3}, + /pgfplots/compat/general/1.4/.style={/pgfplots/compat/general/pre 1.3},% + /pgfplots/compat/general/1.5/.style={/pgfplots/compat/general/newest},% + /pgfplots/compat/general/newest/.style={/pgfplots/log origin=0}, + /pgfplots/compat/general/default/.style={/pgfplots/compat/general/newest}, /pgfplots/compat/.style={% + % ATTENTION: *every* /pgfplots/compat/ setting needs to accept + % the same choices due to this construction: /pgfplots/compat/anchors=#1,% /pgfplots/compat/labels=#1,% + /pgfplots/compat/empty line=#1,% + /pgfplots/compat/scaling=#1,% + /pgfplots/compat/general=#1,% },% - /pgfplots/compat/.default=pre 1.3,% - /pgfplots/compat=default,% + /pgfplots/compat/.default=pre 1.3,% this is used if you type '\pgfplotsset{compat}' without value + /pgfplots/compat=default,% this is the initial config. % /pgfplots/show outer normals/.style={% extra description/.append code={ @@ -3004,6 +3257,8 @@ },% } +\pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@colorbar@draw@defaultimpl + % call % \pgfkeyslet{.../.@cmd}\pgfplots@cant@set@in@this@context % to replace a key with a generic error message. @@ -3014,10 +3269,10 @@ { -\pgfkeysdef{/pgfplots/empty command key}{}% -\pgfkeysgetvalue{/pgfplots/empty command key/.@cmd}\pgfplots@loc@TMPa +\pgfkeysdef{/empty}{}% +\pgfkeysgetvalue{/empty/.@cmd}\pgfplots@loc@TMPa \global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa - +% \pgfkeys{/empty/.style={}}% \pgfkeysgetvalue{/empty/.@cmd}\pgfplots@loc@TMPa \global\let\pgfplots@empty@style@key=\pgfplots@loc@TMPa @@ -3138,7 +3393,7 @@ % \pgfkeysgetvalue{/tikz/sloped/.@cmd}\pgfplots@loc@TMPa \pgfkeyslet{/tikz/sloped/orig/.@cmd}\pgfplots@loc@TMPa - \pgfkeysdef{/tikz/sloped}{\pgfkeysalso{/tikz/sloped like #1 axis}}% + \pgfkeysdef{/tikz/sloped}{\pgfkeysalso{/tikz/sloped like #1 axis={##1}}}% % \node [/pgfplots/every axis label,% @@ -3186,16 +3441,18 @@ \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% \draw decorate { \pgfextra - \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2min\endcsname}}% - \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% + % exchange roles of A <-> B axes: + \pgfplotspointonorientedsurfaceabsetupfor{#2}{#1}{\pgfplotspointonorientedsurfaceN}% + \pgfplots@drawgridlines@onorientedsurf@fromto{\csname pgfplots@#2min\endcsname}% \endpgfextra }; }{}% \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% \draw decorate { \pgfextra - \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2max\endcsname}}% - \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% + % exchange roles of A <-> B axes: + \pgfplotspointonorientedsurfaceabsetupfor{#2}{#1}{\pgfplotspointonorientedsurfaceN}% + \pgfplots@drawgridlines@onorientedsurf@fromto{\csname pgfplots@#2max\endcsname}% \endpgfextra }; }{}% @@ -3215,52 +3472,50 @@ % drawn as box. \def\pgfplots@drawaxis@outerlines@cycledpath{% \draw[ - /pgfplots/every outer x axis line, % FIXME! these outer styles need much more attention :-( + /pgfplots/every outer x axis line, % using these outer styles is only useful in conjunction with 'separate axis lines=true' /pgfplots/every outer y axis line] - % FIXME : replace this here with basic layer! This should also - % allow closed paths: - (\pgfplots@xmin, \pgfplots@ymin) + \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra \ifpgfplots@hide@y - { (\pgfplots@xmin, \pgfplots@ymax) } + { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra } \else - \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } - \or decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } - \or { (\pgfplots@xmin, \pgfplots@ymax) } - \or { (\pgfplots@xmin, \pgfplots@ymax) } - \fi + decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] + % { -- (\pgfplots@xmin, \pgfplots@ymax) } + { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra } \fi \ifpgfplots@hide@x - { (\pgfplots@xmax, \pgfplots@ymax) } + %{ (\pgfplots@xmax, \pgfplots@ymax) } + { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra } \else - \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } - \or { (\pgfplots@xmax, \pgfplots@ymax) } - \or { (\pgfplots@xmax, \pgfplots@ymax) } - \or decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } - \fi + decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] + %{ -- (\pgfplots@xmax, \pgfplots@ymax) } + { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra } \fi \ifpgfplots@hide@y - { (\pgfplots@xmax, \pgfplots@ymin) } + %{ (\pgfplots@xmax, \pgfplots@ymin) } + { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra } \else - \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } - \or { (\pgfplots@xmax, \pgfplots@ymin) } - \or { (\pgfplots@xmax, \pgfplots@ymin) } - \or decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } - \fi + decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] + %{ -- (\pgfplots@xmax, \pgfplots@ymin) } + { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra } \fi \ifpgfplots@hide@x - { (\pgfplots@xmin, \pgfplots@ymin) } + %{ (\pgfplots@xmin, \pgfplots@ymin) } + { \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra } \else - \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } - \or decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } - \or { (\pgfplots@xmin, \pgfplots@ymin) } - \or { (\pgfplots@xmin, \pgfplots@ymin) } - \fi% can't use cycle here! + decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] + %{ -- (\pgfplots@xmin, \pgfplots@ymin) } + { \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra } \fi - ; % -- cycle; + % make sure that we do not have any of the axis discontinuities + % here - they should not be closed. + \if0\pgfplots@xaxisdiscontnum + \else + \if0\pgfplots@yaxisdiscontnum + \else + -- cycle + \fi + \fi + ;% }% % Assigns the macros @@ -3311,12 +3566,13 @@ \fi }% -\def\pgfplots@rememberplotspec@for@label{\pgfutil@ifnextchar[{\pgfplots@rememberplotspec@for@label@}{\pgfplots@rememberplotspec@for@label@[]}}% +\def\pgfplots@rememberplotspec@for@label{\pgfplotsutil@ifnextchar[{\pgfplots@rememberplotspec@for@label@}{\pgfplots@rememberplotspec@for@label@[]}}% \def\pgfplots@rememberplotspec@for@label@[#1]#2{% - \expandafter\gdef\csname pgfplots@last@plot@style@#1\endcsname{#2}% + \t@pgfplots@tokc={#2}% this token register stuff allows '#' inside of '#2' + \expandafter\xdef\csname pgfplots@last@plot@style@#1\endcsname{\the\t@pgfplots@tokc}% \global\pgfplots@has@label@informationtrue }% -\def\pgfplots@rememberplotspec{\pgfutil@ifnextchar[{\pgfplots@rememberplotspec@opt}{\pgfplots@rememberplotspec@opt[]}}% +\def\pgfplots@rememberplotspec{\pgfplotsutil@ifnextchar[{\pgfplots@rememberplotspec@opt}{\pgfplots@rememberplotspec@opt[]}}% \def\pgfplots@rememberplotspec@opt[#1]#2{% \pgfplots@rememberplotspec@for@label[#1]{#2}% \pgfplotslistpushbackglobal{#2}\to\pgfplots@plotspeclist @@ -3410,8 +3666,19 @@ \axispath\path#1;% } \def\pgfplots@replacement@for@scope{\pgfutil@ifnextchar[{\pgfplots@replacement@for@scope@}{\pgfplots@replacement@for@scope@[]}}% -\def\pgfplots@replacement@for@scope@[#1]{\pgfplotsextra{\scope[#1]}}% -\def\pgfplots@replacement@for@endscope{\pgfplotsextra\endscope}% +\def\pgfplots@replacement@for@scope@[#1]{% + \pgfplotsextra{\scope[#1]}% + \begingroup + % I need to apply anything which might be relevant for \addplot + % here. + % But I do NOT want \scope since this might already affect the low + % level output. Try this: + \tikzset{#1}% +}% +\def\pgfplots@replacement@for@endscope{% + \endgroup + \pgfplotsextra\endscope% +}% { % A block which handles active semicolons. @@ -3463,23 +3730,54 @@ % Remembers the plotting command #2 and '#3=plot coordinates {...} ...'; % for later postprocessing of the coordinates. % -% #1: commands which should be executed before issueing the plotting +% #1: pre-commands which should be executed before issueing the plotting % command #2 #3. -% #2: -% the command which is responsable for drawing. +% #2: the drawing-command. % - If #2 is NOT '\pgfutil@empty', we expect #3 to contain only % EXPANDABLE DATA. % That's important for postponed floating point arithmetics in #3. % - If #2='\pgfutil@empty', we don't make any assumption about #3 % and process it as-is. % -% #3: see above. +% #3: the plot data. If #2 is empty, this can be any command. % % #4: commands which should be executed after '#2 #3'. % \long\def\pgfplots@path@enqueue@coords#1#2#3#4{% - \pgfplotslistpushbackglobal{#1}{#2}{#3}{#4}\to\pgfplots@stored@plotlist + \begingroup + \def\pgfplots@loc@TMPa{#2}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@stored@current@precmd{#1}% + \def\pgfplots@stored@current@cmd{#2}% + \def\pgfplots@stored@current@data{#3}% + \def\pgfplots@stored@current@postcmd{#4}% + \ifx\pgfplots@stored@current@precmd\pgfutil@empty + \else + \pgfplots@wrong@plotlist@format@error + \fi + \ifx\pgfplots@stored@current@postcmd\pgfutil@empty + \else + \pgfplots@wrong@plotlist@format@error + \fi + \pgfplotslistpushbackglobal{#1}{#2}{#3}{#4}\to\pgfplots@stored@plotlist + \else + \pgfkeysgetvalue{/pgfplots/execute at begin plot visualization}\pgfplots@loc@TMPa + \pgfkeysgetvalue{/pgfplots/execute at end plot visualization}\pgfplots@loc@TMPb + \t@pgfplots@toka={#1}% + \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}% + \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPb}% + \edef\pgfplots@loc@TMPa{% + \noexpand\pgfkeyssetvalue{/pgfplots/execute at begin plot visualization}{\the\t@pgfplots@tokb}% + \noexpand\pgfkeyssetvalue{/pgfplots/execute at end plot visualization}{\the\t@pgfplots@tokc}% + \the\t@pgfplots@toka + }% + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}{#2}{#3}{#4}\to\pgfplots@stored@plotlist + \fi + \endgroup } +\def\pgfplots@wrong@plotlist@format@error{% + \pgfplots@error{Internal logic error: someone used \string \pgfplots@path@enqueue@coords\space in an unexpected way: if the second argument is empty, ONLY the third argument should be non-empty.^^J I found: pre command (1st arg): \meaning\pgfplots@stored@current@precmd;^^J command (2nd arg): \meaning\pgfplots@stored@current@cmd;^^J data (3rd arg): \meaning\pgfplots@stored@current@data^^J; post cmd (4th arg): \meaning\pgfplots@stored@current@postcmd^^J}% +}% % this was formerly slightly different than % \pgfplots@path@enqueue@coords, but it is now the same. @@ -3909,16 +4207,24 @@ {\tikz[/pgfplots/every legend to name picture/.try]{\pgfplots@legend@to@name}}% \t@pgfplots@tokc=\expandafter{\pgfplotsretval}% % + \begingroup + \pgfkeysgetvalue{/pgfplots/every legend image post/.@cmd}\pgfplots@loc@TMPa + % steal \toks0 temporarily. Within this group, it won't be + % used by any LaTeX code: + \toks0=\expandafter{\pgfplots@loc@TMPa\pgfeov}% + % \expandafter\xdef\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname{% \noexpand\begingroup \noexpand\def\noexpand\pgfplots@legend@to@name{% \noexpand\pgfkeysdef{/pgfplots/every axis legend}{\the\t@pgfplots@tokb}% + \noexpand\pgfkeysdef{/pgfplots/every legend image post}{\the\toks0 }% \noexpand\def\noexpand\numplots{\numplots}% \the\t@pgfplots@toka }% \the\t@pgfplots@tokc \noexpand\endgroup }% + \endgroup \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname}% \pgfplots@auxwrite{% \noexpand\expandafter @@ -3934,22 +4240,41 @@ \fi } +\pgfutil@ifundefined{AtBeginDocument}{}{% + \AtBeginDocument{% + \let\pgfplots@original@LaTeX@label@loadtime=\label + }% +} + % Defines a new \label{#1}. When \ref{#1} is used, the code -% \csname #2#1\endcsname +% \csname #3#2\endcsname % will be invoked. -\def\pgfplots@label#1#2{% +% \pgfplots@label[<optional prefix>]{<label name>}{<command prefix>} +% invokes +% \label<optional prefix>{<label name>} +\def\pgfplots@label{\pgfutil@ifnextchar[{\pgfplots@label@@}{\pgfplots@label@@[]}}% +\def\pgfplots@label@@[#1]#2#3{% \begingroup \edef\@currentlabel{% \string\expandafter \string\protect - \string\csname\space #2#1\string\endcsname + \string\csname\space #3#2\string\endcsname }% \pgfutil@ifundefined{hyper@makecurrent}{}{% \hyper@makecurrent{pgfplotslink}% \hyper@anchorstart{\@currentHref}{}\hyper@anchorend \pgfplotsutil@advancestringcounter@global\c@pgfplots@label }% - \expandafter\label\expandafter{#1}% + % + % this is a work-around to support the memoir class (it overwrites + % \label in sub + \let\sf@@memsub@label=\pgfplots@original@LaTeX@label@loadtime + % + \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 + }% \endgroup }% \gdef\c@pgfplots@label{0}% @@ -3988,6 +4313,22 @@ }% }% +\def\pgfplotsplotfromname#1{% + \pgfplots@texdist@protect\pgfplotsplotfromname@{#1}% +}% +\def\pgfplotsplotfromname@#1{% + \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}: ??% + }{% + \ref{\string\pgfplotsplotfromname{#1}}% + }% + }{% + \csname pgfplots@show@ref@#1\endcsname + }% +}% + \def\pgfplots@ifintikzpicture#1#2{% \pgfutil@ifundefined{filldraw}{#2}{#1}% }% @@ -4011,6 +4352,8 @@ } % Simply divides #1 by log(10). +% ATTENTION: in order to implement per-axis log basis, this will be +% OVERWRITTEN in pgfplotsticks.code.tex ! \def\pgfmathlogtologten@#1{% \pgfmathmultiply@{#1}\reciproclogten% }% @@ -4073,7 +4416,7 @@ \pgfkeysdef{/pgfplots/@enlargelimits/rel}{\pgfkeysalso{true,value={#1}}}% \pgfkeysdef{/pgfplots/@enlargelimits/abs value}{% \begingroup - \pgfutil@namelet{pgfplots@datascaletrafo@\pgfplots@enlargelimits@curaxis}{pgfplots@datascaletrafo@\pgfplots@enlargelimits@curaxis @noshift}% + \pgfplotscoordmath{\pgfplots@enlargelimits@curaxis}{datascaletrafo set shift}{0}% \expandafter\csname pgfplotstransformcoordinate\pgfplots@enlargelimits@curaxis\endcsname{#1}% \pgfmath@smuggleone\pgfmathresult \endgroup @@ -4163,7 +4506,8 @@ % helper for \pgfplots@check@and@apply@datatrafo@for. % \def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{% - \expandafter\pgfmathfloat@decompose@E#1\relax#2\relax + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2\relax \advance#2 by1\relax } @@ -4187,167 +4531,177 @@ % initialise data scale transformation % T(x) = 10^{q-m} * x % - \begingroup - \let\data@max@order=\c@pgf@counta - \let\data@cur@order=\c@pgf@countb - \let\data@dimen=\pgf@xa - \let\data@tmp=\pgf@xb - \let\data@dimen@order=\c@pgf@countc - \let\data@EXPONENT=\c@pgf@countd - \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname - \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname - \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname - \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname - \ifpgfplots@autocompute@all@limits - \else - \pgfplotsmathfloatmax{\pgfplots@display@max@float}{\pgfplots@data@max@float}% - \let\pgfplots@data@max@float=\pgfmathresult - \pgfplotsmathfloatmin{\pgfplots@display@min@float}{\pgfplots@data@min@float}% - \let\pgfplots@data@min@float=\pgfmathresult - \fi - % - % Step 1: compute 'm', the data order - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@min@float - \tocount\data@cur@order - % - \data@max@order=\data@cur@order - % - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@max@float - \tocount\data@cur@order - % - \ifnum\data@cur@order>\data@max@order + \ifpgfplots@disabledatascaling + % this here is a waste of time, I know it. One could really + % safe a lot of CPU time when disabledatascaling is enabled... + % but it requires so much extra cases; I really don't want + % that! + \gdef\pgfplots@glob@TMPa{0}% + \gdef\pgfplots@glob@TMPb{0}% + \else + \begingroup + \let\data@max@order=\c@pgf@counta + \let\data@cur@order=\c@pgf@countb + \let\data@dimen=\pgf@xa + \let\data@tmp=\pgf@xb + \let\data@dimen@order=\c@pgf@countc + \let\data@EXPONENT=\c@pgf@countd + \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname + \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname + \ifpgfplots@autocompute@all@limits + \else + \pgfplotscoordmath{#1}{max}{\pgfplots@display@max@float}{\pgfplots@data@max@float}% + \let\pgfplots@data@max@float=\pgfmathresult + \pgfplotscoordmath{#1}{min}{\pgfplots@display@min@float}{\pgfplots@data@min@float}% + \let\pgfplots@data@min@float=\pgfmathresult + \fi + % +%\message{minmax = [\pgfplots@data@min@float,\pgfplots@data@max@float]}% + % Step 1: compute 'm', the data order + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@data@min@float + \tocount\data@cur@order + % \data@max@order=\data@cur@order - \fi - % - % Step 2: compute 'q', the #1-size of the axis. - \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty - % We have 'width' or 'height'. % - % Use the order of these parameters. - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@width\relax - \else - \def\pgfplots@loc@TMPb{y}% + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@data@max@float + \tocount\data@cur@order + % + \ifnum\data@cur@order>\data@max@order + \data@max@order=\data@cur@order + \fi + % + % Step 2: compute 'q', the #1-size of the axis. + %\expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + % We have 'width' or 'height' (I always have them). + % + % Use the order of these parameters. + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{x}% \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@height\relax + \data@dimen=\pgfplots@width\relax + \else + \if1\pgfplots@compat@scaling@zunitfix@enable + \data@dimen=\pgfplots@height\relax + \else + % this code here belongs to versions up to + % 1.3.1. + % It is now deprecated and produces small + % pixel differences. + \def\pgfplots@loc@TMPb{y}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \data@dimen=\pgfplots@height\relax + \else + \data@dimen=42pt % this is actually different from 1.3.1: there, it was UNDEFINED. + \fi + \fi \fi - \fi - \pgfplots@compute@number@order@for@trafo@isdimen - \data@dimen - \tocount\data@dimen@order - % This here is to avoid inaccuracies in the final - % axis rectangle size, see \pgfplots@initsizes: - %\advance\data@dimen@order by-1 - \else - % FIXME: - % we have either the 'x=1cm' or 'y=1cm' option! - % How should I initialise the trafo!? - \data@dimen@order=3 - \fi - % + \pgfplots@compute@number@order@for@trafo@isdimen + \data@dimen + \tocount\data@dimen@order + % This here is to avoid inaccuracies in the final + % axis rectangle size, see \pgfplots@initsizes: + %\advance\data@dimen@order by-1 + %\else + % FIXME: + % we have either the 'x=1cm' or 'y=1cm' option! + % How should I initialise the trafo!? + % \data@dimen@order=3 + %\fi + % %\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% - \data@EXPONENT=\data@dimen@order - \advance\data@EXPONENT by-\data@max@order - % Now, I introduce a loop which shall avoid cancellation of - % significant digits. - % - % Harmless Example: - % if we have data shift = -3 and - % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. - % In this case, the loop won't change anything. - % - % Critical Example: - % if we have data shift = -3 and - % max = 1980, min = 1930 then - % T(max) = 1.98 and T(min) = 1.93 - % and thus T(max)-T(min) = 0.05 . - % Considering that this is the axis range - % in which tick labels and plot points need to be computed, we - % only have two or three digits left! That happens because the - % prefix '19' is common and is cancelled in the subtraction. - % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 - % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). - % - \pgfplots@loop@CONTINUEtrue - \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% - \pgfutil@loop - \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% - \pgfplots@actual@trafo{\pgfplots@data@min@float}% - \let\pgfplots@min@fixed=\pgfmathresult - \ifpgfplots@loop@CONTINUE - \pgfplots@actual@trafo{\pgfplots@data@max@float}% - \let\pgfplots@max@fixed=\pgfmathresult - \expandafter\data@tmp\pgfplots@max@fixed pt + \data@EXPONENT=\data@dimen@order + \advance\data@EXPONENT by-\data@max@order + % Now, I introduce a loop which shall avoid cancellation of + % significant digits. + % + % Harmless Example: + % if we have data shift = -3 and + % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. + % In this case, the loop won't change anything. + % + % Critical Example: + % if we have data shift = -3 and + % max = 1980, min = 1930 then + % T(max) = 1.98 and T(min) = 1.93 + % and thus T(max)-T(min) = 0.05 . + % Considering that this is the axis range + % in which tick labels and plot points need to be computed, we + % only have two or three digits left! That happens because the + % prefix '19' is common and is cancelled in the subtraction. + % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 + % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). + % + \def\pgfplotscoordmathnotifydatascalesetfor##1{}% disable temporarily. We are just testing it. + \pgfplots@loop@CONTINUEtrue + \pgfutil@loop + \pgfplotscoordmath{#1}{datascaletrafo set params}{\the\data@EXPONENT}{0}% + \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@min@float}% + \let\pgfplots@min@fixed=\pgfmathresult + \ifpgfplots@loop@CONTINUE + \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@max@float}% + \let\pgfplots@max@fixed=\pgfmathresult + \data@tmp=\pgfplots@max@fixed pt %\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% - \ifdim\data@tmp<0pt - % I need absolute values here: - \multiply\data@tmp by-1\relax - \fi - \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% - \expandafter\data@dimen\pgfmathresult pt - \pgfplots@loop@CONTINUEfalse - \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit. - \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy - \ifdim\data@dimen<0.0001pt - \else - \advance\data@EXPONENT by1 - \pgfplots@loop@CONTINUEtrue + \ifdim\data@tmp<0pt + % I need absolute values here: + \multiply\data@tmp by-1\relax + \fi + \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% + \data@dimen=\pgfmathresult pt + \pgfplots@loop@CONTINUEfalse + \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit. + \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy + \ifdim\data@dimen<0.0001pt + \else + \advance\data@EXPONENT by1 + \pgfplots@loop@CONTINUEtrue + \fi \fi \fi - \fi - %-------------------------------------------------- - % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! - % \ifdim\data@dimen>7999pt - % \advance\data@EXPONENT by-2 - % \else - % \advance\data@EXPONENT by-1 - % \fi - % \pgfplots@loop@CONTINUEfalse - % \fi - %-------------------------------------------------- - \pgfutil@repeat - \xdef\pgfplots@glob@TMPa{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% - \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% - \endgroup -%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% - % COMPLETE INITIALISATION: - \ifpgfplots@disabledatascaling - % this here is a waste of time, I know it. One could really - % safe a lot of CPU time when disabledatascaling is enabled... - % but it requires so much extra cases; I really don't want - % that! - \gdef\pgfplots@glob@TMPa{0}% - \gdef\pgfplots@glob@TMPb{0}% + %-------------------------------------------------- + % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! + % \ifdim\data@dimen>7999pt + % \advance\data@EXPONENT by-2 + % \else + % \advance\data@EXPONENT by-1 + % \fi + % \pgfplots@loop@CONTINUEfalse + % \fi + %-------------------------------------------------- + \pgfutil@repeat + \xdef\pgfplots@glob@TMPa{\the\data@EXPONENT}% + \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% + \endgroup \fi - \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@glob@TMPb% + % COMPLETE INITIALISATION: +%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% + \pgfplotscoordmath{#1}{datascaletrafo set params}{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% % % ... and apply transformation to any user input % % Transform axis limits: %\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1min\endcsname}% + \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1min\endcsname}% \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult % - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1max\endcsname}% + \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1max\endcsname}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult %\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% % Transform tick limits (if they are set): %\message{#1- display tick limits BEFORE data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% \expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty \else - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmin\endcsname}% + \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1tickmin\endcsname}% \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult \fi % \expandafter\ifx\csname pgfplots@#1tickmax\endcsname\pgfutil@empty \else - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmax\endcsname}% + \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1tickmax\endcsname}% \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult \fi %\message{#1- display tick limits after data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% @@ -4357,7 +4711,6 @@ % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% \def\pgfplots@loc@TMPb{data}% \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb % we have #1tick = data @@ -4367,15 +4720,19 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname \expandafter\pgfplotsutil@unify@short@csv@list\expandafter{\pgfplots@loc@TMPa}% \t@pgfplots@toka=\expandafter{\pgfplotsretval}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa + {\pgfplotscoordmath{#1}{datascaletrafo}}% + \to\pgfplots@loc@TMPc % clear structure: \expandafter\global\expandafter\let\csname pgfplots@firstplot@coords@#1\endcsname=\pgfutil@empty \else \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% %\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa + {\pgfplotscoordmath{#1}{datascaletrafo}}% + \to\pgfplots@loc@TMPc \fi \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc \fi @@ -4384,17 +4741,29 @@ \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa + {\pgfplotscoordmath{#1}{datascaletrafo}}% + \to\pgfplots@loc@TMPc \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc \fi % + % Convert any minor tick lists in the same way. + \pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \edef\pgfplots@loc@TMPa{{\pgfplots@loc@TMPa}}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa + {\pgfplotscoordmath{#1}{datascaletrafo}}% + \to\pgfplots@loc@TMPc + \pgfkeyslet{/pgfplots/minor #1tick}\pgfplots@loc@TMPc + \fi + % % Transform any explicit axis unit scalings: % WILL BE DONE LATER! }{% % case apply trafo == false: - \expandafter\def\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \pgfplotscoordmath{#1}{datascaletrafo set params}{0}{0}% \def\pgfplots@loc@TMPb{data}% \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfplots@loc@TMPb \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname @@ -4412,31 +4781,26 @@ \newif\ifpgfplots@determinedefaultvalues@needs@check@uniformtick \newif\ifpgfplots@limits@are@computed +\def\pgfplots@handle@invalid@range@defaultlimits{% + \pgfplotscoordmath{x}{parsenumber}{0}% + \global\let\pgfplots@xmin=\pgfmathresult + \pgfplotscoordmath{x}{parsenumber}{1}% + \global\let\pgfplots@xmax=\pgfmathresult + \global\let\pgfplots@data@xmin=\pgfplots@xmin + \global\let\pgfplots@data@xmax=\pgfplots@xmax + % + \pgfplotscoordmath{y}{parsenumber}{0}% + \global\let\pgfplots@ymin=\pgfmathresult + \pgfplotscoordmath{y}{parsenumber}{1}% + \global\let\pgfplots@ymax=\pgfmathresult + \global\let\pgfplots@data@ymin=\pgfplots@ymin + \global\let\pgfplots@data@ymax=\pgfplots@ymax +} \def\pgfplots@handle@invalid@range{% % COMPLETELY EMPTY AXIS: \pgfplots@warning{You have an axis with empty range. Replacing it with a default range and clearing all plots.}% - \ifpgfplots@xislinear - \pgfmathfloatcreate{0}{0.0}{0}% - \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathfloatcreate{1}{1.0}{0}% - \global\let\pgfplots@xmax=\pgfmathresult - \global\let\pgfplots@data@xmin=\pgfplots@xmin - \global\let\pgfplots@data@xmax=\pgfplots@xmax - \else - \gdef\pgfplots@xmin{0}% - \gdef\pgfplots@xmax{1}% - \fi - \ifpgfplots@yislinear - \pgfmathfloatcreate{0}{0.0}{0}% - \global\let\pgfplots@ymin=\pgfmathresult - \pgfmathfloatcreate{1}{1.0}{0}% - \global\let\pgfplots@ymax=\pgfmathresult - \global\let\pgfplots@data@ymin=\pgfplots@ymin - \global\let\pgfplots@data@ymax=\pgfplots@ymax - \else - \gdef\pgfplots@ymin{0}% - \gdef\pgfplots@ymax{1}% - \fi + \pgfplots@handle@invalid@range@defaultlimits + % \pgfplots@threedimfalse \def\pgfplots@xtick{}% \def\pgfplots@ytick{}% @@ -4492,20 +4856,20 @@ \else % there is a rare change that min > max. % Handle that ... - \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotscoordmath{x}{min}{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmin=\pgfmathresult - \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotscoordmath{x}{max}{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmax=\pgfmathresult % - \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotscoordmath{y}{min}{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymin=\pgfmathresult - \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotscoordmath{y}{max}{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymax=\pgfmathresult % \ifpgfplots@threedim - \pgfplotsmathfloatmin{\pgfplots@zmin}{\pgfplots@zmax}% + \pgfplotscoordmath{z}{min}{\pgfplots@zmin}{\pgfplots@zmax}% \global\let\pgfplots@zmin=\pgfmathresult - \pgfplotsmathfloatmax{\pgfplots@zmin}{\pgfplots@zmax}% + \pgfplotscoordmath{z}{max}{\pgfplots@zmin}{\pgfplots@zmax}% \global\let\pgfplots@zmax=\pgfmathresult \fi \fi @@ -4532,31 +4896,6 @@ \def\pgfplots@determinedefaultvalues{% \pgfplots@check@invalid@range % - %-------------------------------------------------- - %FIXME - % \ifpgfplots@float@numerics@mode@x - % \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% - % \let\pgfplots@xmin=\pgfmathresult - % \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% - % \let\pgfplots@xmax=\pgfmathresult - % \else - % \pgfplotsmathmin{\pgfplots@xmin}{\pgfplots@xmax}% - % \let\pgfplots@xmin=\pgfmathresult - % \pgfplotsmathmax{\pgfplots@xmin}{\pgfplots@xmax}% - % \let\pgfplots@xmax=\pgfmathresult - % \fi - % \ifpgfplots@float@numerics@mode@y - % \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% - % \let\pgfplots@ymin=\pgfmathresult - % \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% - % \let\pgfplots@ymax=\pgfmathresult - % \else - % \pgfplotsmathmin{\pgfplots@ymin}{\pgfplots@ymax}% - % \let\pgfplots@ymin=\pgfmathresult - % \pgfplotsmathmax{\pgfplots@ymin}{\pgfplots@ymax}% - % \let\pgfplots@ymax=\pgfmathresult - % \fi - %-------------------------------------------------- %\message{untransformed: x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax]. }% % % @@ -4578,200 +4917,146 @@ % % From now on, we can always work with pgfmath. % We simply need to apply the data scaling trafo before doing so. - \pgfkeysgetvalue{/pgfplots/minor x tick num}\pgfplots@minor@xtick@num - \ifpgfplots@xislinear - \ifnum\pgfplots@minor@xtick@num=0\relax - \pgfplots@xminorticksfalse - \pgfplots@xminorgridsfalse - \else - \pgfplots@xminortickstrue - \fi - \fi - % \pgfplots@enlarge@limit@ifconfigured x \pgfplots@avoid@empty@axis@range@for x% % - \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num - \ifpgfplots@yislinear - \ifnum\pgfplots@minor@ytick@num=0\relax - \pgfplots@yminorticksfalse - \pgfplots@yminorgridsfalse - \else - \pgfplots@yminortickstrue - \fi - \fi \pgfplots@enlarge@limit@ifconfigured y \pgfplots@avoid@empty@axis@range@for y% \ifpgfplots@threedim - \pgfkeysgetvalue{/pgfplots/minor z tick num}\pgfplots@minor@ztick@num - \ifpgfplots@zislinear - \ifnum\pgfplots@minor@ztick@num=0\relax - \pgfplots@zminorticksfalse - \pgfplots@zminorgridsfalse - \else - \pgfplots@zminortickstrue - \fi - \fi \pgfplots@enlarge@limit@ifconfigured z \pgfplots@avoid@empty@axis@range@for z% \fi % - % \pgfplots@initsizes % + \pgfplots@limits@ready + \pgfplotspoint@initialisation + % % \pgfplots@BEGIN@prepare@description@styles % % + \pgfplots@init@ticks@for x% + \pgfplots@init@ticks@for y% + \ifpgfplots@threedim + \pgfplots@init@ticks@for z% + \fi + \pgfplots@init@ticks@ready + % + % + \pgfplots@prepare@ZERO@coordinates % + \pgfplots@decide@which@figure@surfaces@are@drawn + \pgfplots@init@ticklabelaxisspec + % + \pgfplots@define@threedim@marks + % + \pgfplots@clippath@prepare + % + \pgfplots@ticklabel@maxtickdimen@reset x% + \pgfplots@ticklabel@maxtickdimen@reset y% + \pgfplots@ticklabel@maxtickdimen@reset z% +} +\def\pgfplots@init@ticks@ready{}% +\def\pgfplots@init@ticks@for#1{% \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue - \ifx\pgfplots@xtick\pgfutil@empty - \pgfplots@assign@default@tick@foraxis{x}% + \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty + \pgfplots@assign@default@tick@foraxis{#1}% \fi \ifpgfplots@determinedefaultvalues@needs@check@uniformtick - \ifpgfplots@xislinear - \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@xtick}{\pgfplots@tick@distance@x}% - \else - \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@xtick}% - \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname + \pgfplots@if{pgfplots@#1islinear}{% + \def\pgfplots@loc@TMPb{\expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@loc@TMPa}}% + \expandafter\pgfplots@loc@TMPb\csname pgfplots@tick@distance@#1\endcsname% + }{% + \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@loc@TMPa}% + }% \fi + \pgfplots@check@for@minor@ticks{#1}% \ifpgfplots@isuniformtick \else - \pgfplots@xminorticksfalse - \pgfplots@xminorgridsfalse + \pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPb + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \csname pgfplots@#1minorticksfalse\endcsname + \csname pgfplots@#1minorgridsfalse\endcsname + \fi \fi % - \if0\pgfplots@xaxislinesnum\else - % axis x line* != box - \let\pgfplots@xticklabel@pos=\pgfutil@empty - \fi - \if0\pgfplots@yaxislinesnum\else - % axis y line* != box - \let\pgfplots@yticklabel@pos=\pgfutil@empty + \expandafter\ifx\csname pgfplots@#1ticklabel\endcsname\pgfutil@empty + \pgfplots@if{pgfplots@#1islinear}{% + \expandafter\def\csname pgfplots@#1ticklabel\endcsname{\axisdefaultticklabel}% + }{% + \expandafter\def\csname pgfplots@#1ticklabel\endcsname{\axisdefaultticklabellog}% + }% \fi - \if0\pgfplots@zaxislinesnum\else - % axis y line* != box - \let\pgfplots@zticklabel@pos=\pgfutil@empty + \expandafter\ifx\csname pgfplots@extra@#1ticklabel\endcsname\pgfutil@empty + \pgfutil@namelet{pgfplots@extra@#1ticklabel}{pgfplots@#1ticklabel}% \fi % - \ifx\pgfplots@xticklabel@pos\pgfutil@empty - \def\pgfplots@xticklabel@pos{% - \if3\pgfplots@xtickposnum% right - u% - \else - l% - \fi - }% + \if0\csname pgfplots@#1axislinesnum\endcsname\else + % axis x line* != box + \expandafter\let\csname pgfplots@#1ticklabel@pos\endcsname=\pgfutil@empty \fi - \ifx\pgfplots@yticklabel@pos\pgfutil@empty - \def\pgfplots@yticklabel@pos{% - \if3\pgfplots@ytickposnum% right + \expandafter\ifx\csname pgfplots@#1ticklabel@pos\endcsname\pgfutil@empty + \expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{% + \if3\csname pgfplots@#1tickposnum\endcsname% right u% \else l% \fi }% \fi - \ifx\pgfplots@zticklabel@pos\pgfutil@empty - \def\pgfplots@zticklabel@pos{% - \if3\pgfplots@ztickposnum% right - u% - \else - l% +}% + +\def\pgfplots@check@for@minor@ticks#1{% + \pgfkeysgetvalue{/pgfplots/minor #1 tick num}\pgfplots@loc@TMPa + \pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPb + \pgfplots@if{pgfplots@#1islinear}{% + \ifnum\pgfplots@loc@TMPa=0\relax + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \csname pgfplots@#1minorticksfalse\endcsname + \csname pgfplots@#1minorgridsfalse\endcsname \fi - }% - \fi - % - \ifx\pgfplots@xticklabel\pgfutil@empty - \ifpgfplots@xislinear - \def\pgfplots@xticklabel{\axisdefaultticklabel}% \else - \def\pgfplots@xticklabel{\axisdefaultticklabellog}% + \csname pgfplots@#1minortickstrue\endcsname \fi - \fi - \ifx\pgfplots@extra@xticklabel\pgfutil@empty - \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel - \fi - % - % - % - \pgfplots@isuniformticktrue - \pgfplots@determinedefaultvalues@needs@check@uniformticktrue - \ifx\pgfplots@ytick\pgfutil@empty - \pgfplots@assign@default@tick@foraxis{y}% - \fi - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick - \ifpgfplots@yislinear - \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ytick}{\pgfplots@tick@distance@y}% - \else - \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ytick}% - \fi - \fi - \ifpgfplots@isuniformtick + }{% + }% + \ifx\pgfplots@loc@TMPb\pgfutil@empty \else - \pgfplots@yminorticksfalse - \pgfplots@yminorgridsfalse - \fi - % - \ifx\pgfplots@yticklabel\pgfutil@empty - \ifpgfplots@yislinear - \def\pgfplots@yticklabel{\axisdefaultticklabel}% - \else - \def\pgfplots@yticklabel{\axisdefaultticklabellog}% - \fi - \fi - \ifx\pgfplots@extra@yticklabel\pgfutil@empty - \let\pgfplots@extra@yticklabel=\pgfplots@yticklabel + \csname pgfplots@#1minortickstrue\endcsname \fi - % +} + +% Invoked as soon as all axis limits are ready and final (in TeX +% number range, all data scaling is applied at this point). +\def\pgfplots@limits@ready{% + \pgfplots@limits@ready@tostring{x}{min}% + \pgfplots@limits@ready@tostring{x}{max}% + \pgfplots@limits@ready@tostring{y}{min}% + \pgfplots@limits@ready@tostring{y}{max}% \ifpgfplots@threedim - \pgfplots@isuniformticktrue - \pgfplots@determinedefaultvalues@needs@check@uniformticktrue - \ifx\pgfplots@ztick\pgfutil@empty - \pgfplots@assign@default@tick@foraxis{z}% - \fi - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick - \ifpgfplots@zislinear - \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ztick}{\pgfplots@tick@distance@z}% - \else - \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ztick}% - \fi - \fi - \ifpgfplots@isuniformtick - \else - \pgfplots@zminorticksfalse - \pgfplots@zminorgridsfalse - \fi - % - \ifx\pgfplots@zticklabel\pgfutil@empty - \ifpgfplots@zislinear - \def\pgfplots@zticklabel{\axisdefaultticklabel}% - \else - \def\pgfplots@zticklabel{\axisdefaultticklabellog}% - \fi - \fi - \ifx\pgfplots@extra@zticklabel\pgfutil@empty - \let\pgfplots@extra@zticklabel=\pgfplots@zticklabel - \fi + \pgfplots@limits@ready@tostring{z}{min}% + \pgfplots@limits@ready@tostring{z}{max}% \fi - % - % - \pgfplots@prepare@ZERO@coordinates - % - \pgfplotspoint@initialisation - % - \pgfplots@decide@which@figure@surfaces@are@drawn - % - \pgfplots@define@threedim@marks - % - \pgfplots@clippath@prepare - % - \pgfplots@ticklabel@maxtickdimen@reset x% - \pgfplots@ticklabel@maxtickdimen@reset y% - \pgfplots@ticklabel@maxtickdimen@reset z% -} +}% + +% write a limit into /pgfplots/#1#2 +% #1: either x,y or z +% #2: either 'min' or 'max' +% +% \pgfplots@limits@ready@tostring{x}{min} +\def\pgfplots@limits@ready@tostring#1#2{% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1#2\endcsname}% + }{% + \edef\pgfmathresult{\csname pgfplots@#1#2\endcsname}% + }% + \pgfplotscoordmath{#1}{tostring}{\pgfmathresult}% + \pgfkeyslet{/pgfplots/#1#2}\pgfmathresult +}% % Defines \pgfmathresult to be the desired width without axis labels. % @@ -4833,11 +5118,13 @@ {\pgf@sys@tonumber\pgf@xa}% {\pgf@sys@tonumber\pgf@xb}% }% -%\pgfplots@message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)'; -% c=estimated, -% width-c =\the\pgf@xa, -% x*(xmax[=\the\pgfplots@xcoordmaxTEX] - xmin[=\the\pgfplots@xcoordminTEX)]) = \the\pgf@xb -% -> x-scale =#2 }% +%-------------------------------------------------- +% \message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)'; +% c=estimated, +% width-c =\the\pgf@xa, +% x*(xmax - xmin)]) = \the\pgf@xb +% -> x-scale =\pgfmathresult }% +%-------------------------------------------------- \pgfmath@smuggleone\pgfmathresult \endgroup \let#2=\pgfmathresult @@ -4900,7 +5187,7 @@ \fi \fi \ifpgfplots@avoid@emptyrange@@range@is@approx@equal - \pgfplots@warning{Axis range for axis #1 is approximately empty; enlargeing it.}% + \pgfplots@warning{Axis range for axis #1 is approximately empty; enlarging it.}% % the case \pgfplots@@min ~= \pgfplots@@max % % enlarge \pgfplots@@max and shrink \min: @@ -4930,39 +5217,45 @@ % -> we need to enlarge limits in floating % point arithmetics. % - \pgfmathfloatcreate{0}{0.0}{0}% + \pgfplotscoordmath{#1}{parsenumber}{0}% \let\pgfplotsmath@zero=\pgfmathresult % \ifx\max@unscaled\pgfplotsmath@zero % max == 0 - \pgfmathfloatcreate{1}{1.0}{0}% + \pgfplotscoordmath{#1}{parsenumber}{1}% \let\max@unscaled=\pgfmathresult - \pgfmathfloatcreate{2}{1.0}{0}% + \pgfplotscoordmath{#1}{parsenumber}{-1}% \let\min@unscaled=\pgfmathresult \else % - \pgfmathfloatcreate{1}{1.2}{0}% + \pgfplotscoordmath{#1}{parsenumber}{1.2}% \let\pgfplotsmath@scalea=\pgfmathresult - \pgfmathfloatcreate{1}{8.0}{-1}% + \pgfplotscoordmath{#1}{parsenumber}{8e-1}% \let\pgfplotsmath@scaleb=\pgfmathresult % - \pgfmathfloatlessthan@{\pgfplotsmath@zero}{\max@unscaled}% - \ifpgfmathfloatcomparison - % 0 < max - \pgfmathfloatmultiply@{\max@unscaled}{\pgfplotsmath@scalea}% - \let\max@unscaled=\pgfmathresult - \pgfmathfloatmultiply@{\min@unscaled}{\pgfplotsmath@scaleb}% - \let\min@unscaled=\pgfmathresult - \else - \pgfmathfloatmultiply@{\max@unscaled}{\pgfplotsmath@scaleb}% - \let\max@unscaled=\pgfmathresult - \pgfmathfloatmultiply@{\min@unscaled}{\pgfplotsmath@scalea}% - \let\min@unscaled=\pgfmathresult - \fi + \pgfplotscoordmath{#1}{if less than} + {\pgfplotsmath@zero}{\max@unscaled}% + {% + % 0 < max + \pgfplotscoordmath{#1}{op}{multiply} + {{\max@unscaled}{\pgfplotsmath@scalea}}% + \let\max@unscaled=\pgfmathresult + \pgfplotscoordmath{#1}{op}{multiply} + {{\min@unscaled}{\pgfplotsmath@scaleb}}% + \let\min@unscaled=\pgfmathresult + }% + {% + \pgfplotscoordmath{#1}{op}{multiply} + {{\max@unscaled}{\pgfplotsmath@scaleb}}% + \let\max@unscaled=\pgfmathresult + \pgfplotscoordmath{#1}{op}{multiply} + {{\min@unscaled}{\pgfplotsmath@scalea}}% + \let\min@unscaled=\pgfmathresult + }% \fi - \csname pgfplots@datascaletrafo@#1\endcsname{\min@unscaled}% + \pgfplotscoordmath{#1}{datascaletrafo}{\min@unscaled}% \let\pgfplots@@min=\pgfmathresult - \csname pgfplots@datascaletrafo@#1\endcsname{\max@unscaled}% + \pgfplotscoordmath{#1}{datascaletrafo}{\max@unscaled}% \let\pgfplots@@max=\pgfmathresult \min@d=\pgfplots@@min pt \max@d=\pgfplots@@max pt @@ -5013,89 +5306,102 @@ \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}% \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}% \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}% + %\pgfkeysgetvalue{/pgfplots/viewdir}{\pgfplots@viewdir}% \pgfkeysgetvalue{/pgfplots/width}{\pgfplots@width}% \pgfkeysgetvalue{/pgfplots/height}{\pgfplots@height}% \ifx\pgfplots@width\pgfutil@empty + \def\pgfplots@user@provided@width{0}% \else + \def\pgfplots@user@provided@width{1}% \pgfmathparse{\pgfplots@width}% \edef\pgfplots@width{\pgfmathresult pt}% \fi \ifx\pgfplots@height\pgfutil@empty + \def\pgfplots@user@provided@height{0}% \else + \def\pgfplots@user@provided@height{1}% \pgfmathparse{\pgfplots@height}% \edef\pgfplots@height{\pgfmathresult pt}% \fi % % CASES: - % hasx := 'x' option non-empty - % hasy := 'y' option non-empty % W := 'width' option non-empty % H := 'height' option non-empty % - % hasx = 1 -> width is not interesting; we use 'x' option. - % hasx = 0 -> determine final width: % W H % 0 0 -> \axisdefaultwidth % 0 1 -> determine width out of H and the default aspect ratio % 1 X -> ok, use the user parameter. - % - % hasy = 1 -> height is not interesting, we use 'y' option. - % hasy = 0 -> determine final height: - % W H - % 0 0 -> \axisdefaultheight - % X 1 -> ok, use the user parameter - % 1 0 -> determine height out of W and the default aspect ratio - % - \ifx\pgfplots@x\pgfutil@empty - \ifx\pgfplots@y\pgfutil@empty - % hasx=0, hasy=0 - % - % -> KEEP ASPECT RATIO if just one W, or H is given! - \ifx\pgfplots@width\pgfutil@empty - \ifx\pgfplots@height\pgfutil@empty - % The case hasx=0, hasy=0, W=0 H=0: - \let\pgfplots@width=\axisdefaultwidth - \let\pgfplots@height=\axisdefaultheight - \else - % The case hasx=0, hasy=0, W=0 H=1: - \pgfplots@compute@default@aspect@ratio - \expandafter\pgfmath@y\pgfplots@height - \pgfmathlog@invoke@expanded\pgfmathmultiply@{% - {\pgf@sys@tonumber{\pgfmath@y}}% - {\pgfplots@default@aspect@ratio}% - }% - \edef\pgfplots@width{\pgfmathresult pt}% - \fi - \else - \ifx\pgfplots@height\pgfutil@empty - % The case hasx=0, hasy=0, W=1 H=0: - \pgfplots@compute@default@aspect@ratio - \expandafter\pgfmath@x\pgfplots@width - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber{\pgfmath@x}}% - {\pgfplots@default@aspect@ratio}% - }% - \edef\pgfplots@height{\pgfmathresult pt}% - \else - % The case hasx=0, hasy=0, W=1 H=1: - \fi - \fi + % -> KEEP ASPECT RATIO if just one W, or H is given! + \ifx\pgfplots@width\pgfutil@empty + \ifx\pgfplots@height\pgfutil@empty + % The case W=0 H=0: + \let\pgfplots@width=\axisdefaultwidth + \let\pgfplots@height=\axisdefaultheight \else - % hasx=0, hasy=1, W=0: - \ifx\pgfplots@width\pgfutil@empty - \let\pgfplots@width=\axisdefaultwidth - \fi + % The case W=0 H=1: + \pgfplots@compute@default@aspect@ratio + \expandafter\pgfmath@y\pgfplots@height + \pgfmathlog@invoke@expanded\pgfmathmultiply@{% + {\pgf@sys@tonumber{\pgfmath@y}}% + {\pgfplots@default@aspect@ratio}% + }% + \edef\pgfplots@width{\pgfmathresult pt}% \fi \else - \ifx\pgfplots@y\pgfutil@empty - % hasx=1, hasy=0, H=0 - \ifx\pgfplots@height\pgfutil@empty - \let\pgfplots@height=\axisdefaultheight - \fi + \ifx\pgfplots@height\pgfutil@empty + % The case W=1 H=0: + \pgfplots@compute@default@aspect@ratio + \expandafter\pgfmath@x\pgfplots@width + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber{\pgfmath@x}}% + {\pgfplots@default@aspect@ratio}% + }% + \edef\pgfplots@height{\pgfmathresult pt}% + \else + % The case W=1 H=1: \fi \fi \pgfkeyslet{/pgfplots/width}{\pgfplots@width}% \pgfkeyslet{/pgfplots/height}{\pgfplots@height}% + % + \ifpgfplots@threedim + \pgfplots@set@default@size@options@threedim + \fi +} +\def\pgfplots@set@default@size@options@threedim{% + \pgfplots@loc@tmpfalse + \ifx\pgfplots@x\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + \ifx\pgfplots@y\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + \ifx\pgfplots@z\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + \ifpgfplots@loc@tmp + % oh - we have at least one of the [xyz] unit vectors! + % make sure all of them are there + \ifx\pgfplots@x\pgfutil@empty + \pgfplots@set@default@size@options@threedim@{x}{(1pt,0pt)}% + \fi + \ifx\pgfplots@y\pgfutil@empty + \pgfplots@set@default@size@options@threedim@{y}{(0pt,1pt)}% + \fi + \ifx\pgfplots@z\pgfutil@empty + \pgfplots@set@default@size@options@threedim@{z}{(0pt,1pt)}% + \fi + \pgfkeyslet{/pgfplots/view/az}\pgfutil@empty + \pgfkeyslet{/pgfplots/view/el}\pgfutil@empty + \fi +} +\def\pgfplots@set@default@size@options@threedim@#1#2{% + \pgfplots@error{Sorry, a 3D axis needs either NONE or ALL of "x,y,z". I found partial information, but (at least) '#1' is lacking... please add '#1'}% + \expandafter\def\csname pgfplots@#1\endcsname{#2}% } % A helper method for \pgfplots@initsizes which @@ -5138,7 +5444,11 @@ \ifdim\pgfplots@loc@TMPa=0pt \def\pgfmathresult{0}% \else - \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \edef\pgf@marshal{% + {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}% + {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}% + }% + \expandafter\pgfmathveclen\pgf@marshal \fi \fi % The numbers 1/||e_x|| and 1/||e_y|| are used by the tick @@ -5170,17 +5480,18 @@ \def#4{0}% we DON'T have (#1,0) or (0,#1). At least I think so. % %\message{Setting unitvector(#1) to non-standard \csname pgfplots@#1\endcsname ...}% - % FIXME : that's wrong for 3D axes! \def\pgfplots@loc@TMPa(##1,##2){% - \pgfmathparse{##1}% + \pgfplotscoordmath{default}{parse}{##1}% + \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}% \let\pgfplots@loc@TMPb=\pgfmathresult - \pgfmathparse{##2}% + \pgfplotscoordmath{default}{parse}{##2}% + \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}% \let\pgfplots@loc@TMPc=\pgfmathresult % \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname{\pgfplots@loc@TMPb}% + \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPb}% \let\pgfplots@loc@TMPb=\pgfmathresult - \csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname{\pgfplots@loc@TMPc}% + \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPc}% \let\pgfplots@loc@TMPc=\pgfmathresult }{}% \csname pgfset#1vec\endcsname{% @@ -5190,12 +5501,17 @@ }% \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb% % - \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \edef\pgf@marshal{% + {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}% + {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}% + }% + \expandafter\pgfmath@basic@veclen@\pgf@marshal + % \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult \pgfplotsmath@ifzero{\pgfmathresult}{% \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% }{% - \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult }% \else @@ -5203,8 +5519,9 @@ \def#4{1}% we have (#1,0) or (0,#1) %\message{Setting unitvector(#1) to \csname pgfplots@#1\endcsname * e_{#2}...}% \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \pgfmathparse{\csname pgfplots@#1\endcsname}% - \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% + \pgfplotscoordmath{default}{parse}{\csname pgfplots@#1\endcsname}% + \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}% + \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfmathresult}% \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% }{\relax}% \begingroup @@ -5216,28 +5533,32 @@ \endgroup \ifcase#2\relax \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}% - \pgfmathabs@{\pgfplots@glob@TMPb}% + \pgfmath@basic@abs@{\pgfplots@glob@TMPb}% \or \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPb}}% - \pgfmathabs@{\pgfplots@glob@TMPb}% + \pgfmath@basic@abs@{\pgfplots@glob@TMPb}% \or \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}% \ifdim\pgfplots@loc@TMPb=0pt \def\pgfmathresult{0}% \else - \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \edef\pgf@marshal{% + {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}% + {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}% + }% + \expandafter\pgfmath@basic@veclen@\pgf@marshal \fi \fi \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult \pgfplotsmath@ifzero{\pgfmathresult}{% \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% }{% - \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult }% \fi \fi -%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).}% +%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).^^J}% }% % Applies the 'axis equal' feature. @@ -5256,142 +5577,337 @@ % transformation. All unit vector length above are only meaningful in % the UNTRANSFORMED range, so we have to mingle with the scaling % transformation. -\def\pgfplots@axis@equal@apply{% - % Step 1: compute the unit vector which STAYS CONSTANT. - % - % All other ones will be scaled to fit its length. - \ifpgfplots@threedim - \def\pgfplots@axis@equal@apply@reference{x}% - \pgfplots@if@unitveclenlessthan@untransformed xy{% - \pgfplots@if@unitveclenlessthan@untransformed xz{% - \def\pgfplots@axis@equal@apply@reference{x}% - }{}% - }{}% - \pgfplots@if@unitveclenlessthan@untransformed yx{% - \pgfplots@if@unitveclenlessthan@untransformed yz{% - \def\pgfplots@axis@equal@apply@reference{y}% - }{}% - }{}% - \pgfplots@if@unitveclenlessthan@untransformed zx{% - \pgfplots@if@unitveclenlessthan@untransformed zy{% - \def\pgfplots@axis@equal@apply@reference{z}% - }{}% - }{}% +\def\pgfplots@apply@unit@ratio{% + \pgfkeysgetvalue{/pgfplots/unit vector ratio}\pgfplots@unit@vector@ratio + \ifx\pgfplots@unit@vector@ratio\pgfutil@empty \else - \pgfplots@if@unitveclenlessthan@untransformed xy{% - \def\pgfplots@axis@equal@apply@reference{x}% - }{% - \def\pgfplots@axis@equal@apply@reference{y}% - }% - \fi -%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@axis@equal@apply@reference.}% - \if x\pgfplots@axis@equal@apply@reference - \else - \pgfplots@axis@equal@apply@for x - \fi - \if y\pgfplots@axis@equal@apply@reference - \else - \pgfplots@axis@equal@apply@for y - \fi - \ifpgfplots@threedim - \if z\pgfplots@axis@equal@apply@reference - \else - \pgfplots@axis@equal@apply@for z + \edef\pgfplots@unit@vector@ratio{\pgfplots@unit@vector@ratio\space1 1 }% + % + % Step 1: compute the unit vector which STAYS CONSTANT. + % + \pgfkeysgetvalue{/pgfplots/unit vector ratio axis}\pgfplots@apply@unit@ratio@reference + \ifx\pgfplots@apply@unit@ratio@reference\pgfutil@empty + \pgfplots@apply@unit@ratio@find@reference% + \fi + % + % FIXME : I could spent some attention here to save work: + % both, unit ratios and the resulting scales are computed at + % least twice (once in \pgfplots@apply@unit@ratio@find@reference and once in the + % following). + \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI + % +%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@apply@unit@ratio@reference; ratio \pgfplots@unit@ratio@x\space \pgfplots@unit@ratio@y\space \pgfplots@unit@ratio@z.^^J}% + % + % Step 2: apply the scaling: + \pgfplots@rescale@unit@vector@reltoreference{x}{\pgfplots@unit@ratio@x}% + \pgfplots@rescale@unit@vector@reltoreference{y}{\pgfplots@unit@ratio@y}% + \ifpgfplots@threedim + \pgfplots@rescale@unit@vector@reltoreference{z}{\pgfplots@unit@ratio@z}% \fi \fi }% -% Scales unit vector '#1' such that it has the same length as the unit -% vector in direction \pgfplots@axis@equal@apply@reference. +% This macro determines the reference axis for unit vector rescaling. +% The reference axis remains unscaled (it gets scaling factor 1 if you +% want it this way). +% +% The other axes are scaled such that the desired unit vector ratios +% are fulfilled. % -% The data limits for '#1' will be enlarged as well (for 'axis -% equal'). -\def\pgfplots@axis@equal@apply@for#1{% - \pgfmathmultiply@ - {\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname} - {\csname pgfplots@#1@inverseveclength\endcsname}% - \global\let\pgfplots@glob@TMPa=\pgfmathresult - \pgfmathmultiply@ - {\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname} - {\csname pgfplots@#1@veclength\endcsname}% - \global\let\pgfplots@glob@TMPb=\pgfmathresult - % - % If the datascaling transformation is active (which is almost - % everytime the case here), we need to respect it here. +% The idea to select a reference axis is as follows: +% 1. Every unit vector scaling factor s should fulfill s <= 1. +% 2. Choose the reference axis such that the minimal amount of scaling +% is performed. +% +% The motivation for (1) is: if all involved scaling factors are at +% most 1, the resulting picture will only become *smaller*. +% Consequently, we can simply enlarge axis limits to restore the +% original width/height! +% +% The motivation for (2) is: a huge amount of scaling might reduce the +% size of the image too much. Of course, the figure will be enlarged +% to fit the original width/height, but most of it will be empty. So, +% use the smallest scaling. +% +% @POSTCONDITION The reference axis is stored in +% \pgfplots@apply@unit@ratio@reference . +% +% @see the key 'unit vector ratio axis=y' which allows to manually +% select the reference axis. This will illustrate what happens here. +\def\pgfplots@apply@unit@ratio@find@reference{% % - % We only need to respect the SCALING, translations (shifts) are - % not interesting. + \begingroup + \let\pgfplots@ONE=\pgf@x + \global\pgfplots@ONE=1.002pt % - % We want that || T^{-1} e_ref || = || T^{-1} E_#1 ||. + \def\pgfplots@optimum@sofar@axis{}% + \let\pgfplots@optimum@sofar@value=\pgf@y + \global\pgfplots@optimum@sofar@value=16000pt % - % So: T^{-1} E_#1 := s* T^{-1} e_#1 where - % s = ||T^{-1} e_ref|| / || T^{-1} e_#1 || - % = |10^{scale_ref}| / |10^{scale_#1}| * || e_ref|| / ||e_#1||. - % - % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1. + %\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits % - % -> compute 's'! We already have the quotient of unit vectors. - % Now, acquire the scale quotients. + \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty + \ifpgfplots@threedim + % 3D is more complicated than 2D: + % for every fixed reference axis, we have to check *two* + % scaling factors. + % + % Furthermore, the optimality condition (2) needs to be + % performed on the maximum max{1-s_a, 1-s_b} provided both of + % these numbers are positive. + % + \def\pgfplots@check@##1##2{% + % PRECONDITION: \pgfplots@apply@unit@ratio@reference is defined. + % + % renormalize \pgfplots@unit@[xyz] : + \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI + % + % compute s_a : + \pgfplots@getscale@unit@vector@reltoreference ##1{\csname pgfplots@unit@ratio@##1\endcsname}% + \let\pgfplots@scale@a=\pgfmathresult + % + % compute s_b : + \pgfplots@getscale@unit@vector@reltoreference ##2{\csname pgfplots@unit@ratio@##2\endcsname}% + \let\pgfplots@scale@b=\pgfmathresult + % + % check if the actual choice of + % \pgfplots@apply@unit@ratio@reference is FEASIBLE. + % That is the case if s_a <= 1 && s_b <= 1. + % We check + % (1 - s_a >= 0 ) && ( 1 - s_b >= 0 ) + % instead, since I need the value + % max( 1-s_a, 1-s_b ) + % anyway. + \def\pgfplots@ref@is@feasible{1}% + \pgf@xa=\pgfplots@ONE \advance\pgf@xa by-\pgfplots@scale@a pt + \ifdim\pgf@xa<0sp + \def\pgfplots@ref@is@feasible{0}% + \else + \pgf@xb=\pgfplots@ONE \advance\pgf@xb by-\pgfplots@scale@b pt + \ifdim\pgf@xb<0sp + \def\pgfplots@ref@is@feasible{0}% + \fi + \fi + % compute max(1-s_a,1-s_b) into \pgf@xa: + % pgf@xa= max(pgf@xa,pgf@xb): + \ifdim\pgf@xb>\pgf@xa \pgf@xa=\pgf@xb \fi + \if1\pgfplots@ref@is@feasible + \ifdim\pgf@xa<\pgfplots@optimum@sofar@value + % Ah, ok. The actual choice is BETTER as it + % involves less scaling. + % + % Remember it! + \let\pgfplots@optimum@sofar@axis=\pgfplots@apply@unit@ratio@reference + \global\pgfplots@optimum@sofar@value=\pgf@xa + \fi + \fi +%\message{^^Junit vector ratio 3D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfplots@ref@is@feasible. \if1\pgfplots@ref@is@feasible max=\the\pgf@xa. \fi Optimum so far: value =\the\pgfplots@optimum@sofar@value\space for axis \pgfplots@optimum@sofar@axis.^^J}% + }% + % + % Check 'x' as reference : + \def\pgfplots@apply@unit@ratio@reference{x}% + \pgfplots@check@ yz% + % + % Check 'y' as reference : + \def\pgfplots@apply@unit@ratio@reference{y}% + \pgfplots@check@ xz% + % + % Check 'z' as reference : + \def\pgfplots@apply@unit@ratio@reference{z}% + \pgfplots@check@ xy% + % + \else + % 2D is much simpler: find the scale s which fulfills s <= 1. + % One of them MUST fulfill it. + % + % try 'x' axis as reference: + \def\pgfplots@apply@unit@ratio@reference{x}% + % + % renormalize: + \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI + % + % compute scaling factor: + \pgfplots@getscale@unit@vector@reltoreference y\pgfplots@unit@ratio@y% + % +%\message{^^Junit vector ratio 2D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfmathresult < 1: \ifdim\pgfmathresult pt <\pgfplots@ONE YES-> use x\else NO->use y\fi^^J}% + % and check (1). The condition (2) is irrelevant; it is met + % anyway. + \ifdim\pgfmathresult pt<\pgfplots@ONE + \def\pgfplots@optimum@sofar@axis{x}% + \else + \def\pgfplots@optimum@sofar@axis{y}% + \fi + \fi + \else +%\message{^^Junit vector ratio chose \pgfplots@optimum@sofar@axis\space to fulfill explicitly provided limits (at least partially).^^J}% + \fi % - \begingroup - \def\pgfplots@tmp@exponentref{0}% - \def\pgfplots@tmp@exponentK{0}% - \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@axis@equal@apply@reference}{% - \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@axis@equal@apply@reference}% - }{}% - \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}% - }{}% - \c@pgf@counta=\pgfplots@tmp@exponentref - \advance\c@pgf@counta by-\pgfplots@tmp@exponentK - \ifnum\c@pgf@counta=0 + \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty + \ifpgfplots@threedim + \def\pgfplots@optimum@sofar@axis{z}% \else - \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}% - \global\let\pgfplots@glob@TMPa=\pgfmathresult - \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}% - \global\let\pgfplots@glob@TMPb=\pgfmathresult + \def\pgfplots@optimum@sofar@axis{y}% \fi - \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}% + \pgfplots@warning{The algorithm to realize 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=\pgfplots@optimum@sofar@axis'.}% + \fi + \let\pgfplots@apply@unit@ratio@reference=\pgfplots@optimum@sofar@axis + \pgfmath@smuggleone\pgfplots@apply@unit@ratio@reference \endgroup +}% +\def\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits{% + \ifpgfplots@autocompute@ymax \else \def\pgfplots@optimum@sofar@axis{y}\fi + \ifpgfplots@autocompute@ymin \else \def\pgfplots@optimum@sofar@axis{y}\fi + \ifpgfplots@autocompute@xmax \else \def\pgfplots@optimum@sofar@axis{x}\fi + \ifpgfplots@autocompute@xmin \else \def\pgfplots@optimum@sofar@axis{x}\fi + \ifpgfplots@threedim + \ifpgfplots@autocompute@zmax \else \def\pgfplots@optimum@sofar@axis{z}\fi + \ifpgfplots@autocompute@zmin \else \def\pgfplots@optimum@sofar@axis{z}\fi + \fi +}% + +\def\pgfplots@apply@unit@ratio@prepareratios#1 #2 #3 #4\pgfplots@EOI{% + \def\pgfplots@unit@ratio@x{#1}% + \def\pgfplots@unit@ratio@y{#2}% + \def\pgfplots@unit@ratio@z{#3}% % - \if x#1 - \pgfsetxvec{\pgfplotsqpointxy{\pgfplots@glob@TMPa}{0}}% + % 'unit vector ratio' is measured relative to the y axis for 2d + % and relative to the z axis for 3d plots. + % renormalize such that it is relative to + % \pgfplots@apply@unit@ratio@reference. + % + % Furthermore, renormalize such that + % unit@ratio@\pgfplots@apply@unit@ratio@reference is 1. + \pgfmathreciprocal@{\csname pgfplots@unit@ratio@\pgfplots@apply@unit@ratio@reference\endcsname}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \ifpgfplots@threedim + \if z\pgfplots@apply@unit@ratio@reference + \else + \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \fi + % + \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}% + \let\pgfplots@unit@ratio@x=\pgfmathresult + % + \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}% + \let\pgfplots@unit@ratio@y=\pgfmathresult + % + \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}% + \let\pgfplots@unit@ratio@z=\pgfmathresult \else - \if y#1 - \pgfsetyvec{\pgfplotsqpointxy{0}{\pgfplots@glob@TMPa}}% + \if y\pgfplots@apply@unit@ratio@reference \else - \if z#1 - \pgfsetzvec{\pgfplotsqpointxyz{0}{0}{\pgfplots@glob@TMPa}}% - \fi + \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}% + \let\pgfplots@loc@TMPa=\pgfmathresult \fi + % + \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}% + \let\pgfplots@unit@ratio@x=\pgfmathresult + % + \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}% + \let\pgfplots@unit@ratio@y=\pgfmathresult + % + \def\pgfplots@unit@ratio@z{<unused>}% \fi % - % - % Update auxiliary data members: - % This is only complicated due to the scaling transformation. If we would not have the scaling trafo, the following - % code would simply copy the vector length and inverse vectors length from the reference axis. - \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname}{\pgfplots@glob@TMPc}% - \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname}{-\pgfplots@glob@TMPc}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult - % - % - \ifpgfplots@axis@equal@image +}% + + +% Computes a new unit vector E_#1 for direction #1 such that +% ||E_#1|| = #2 * ||e_reference||. +% Here, #2 is a scaling factor and e_reference is a reference axis. +% The reference axis is stored in +% \pgfplots@apply@unit@ratio@reference, the macro contains one of +% {x,y,z}. +% +% The data limits for '#1' will be enlarged as well (for 'unit rescale +% keep size'). +% +% #1 is the axis which should be scaled (i.e. #1 in {x,y,z}). +% It is allowed if #1 = \pgfplots@apply@unit@ratio@reference. In this +% case, you can provide a scale '#2' to rescale the axis. +% +% #2 is a desired scale, relative to +% \pgfplots@apply@unit@ratio@reference. #2 should be a number without +% unit. +% +% The parameter \pgfplots@apply@unit@ratio@reference is also one of +% {x,y,z}. +% +\def\pgfplots@rescale@unit@vector@reltoreference#1#2{% + \def\pgfplots@loc@TMPa{0}% + \if#1\pgfplots@apply@unit@ratio@reference + \pgfplotsmath@ifapproxequal@dim{#2pt}{1pt}{0.0002pt}{% + }{% + \def\pgfplots@loc@TMPa{1}% + }% \else + \def\pgfplots@loc@TMPa{1}% + \fi + \if1\pgfplots@loc@TMPa % - % Ok, now update the axis limits such that the axis' dimensions - % stay the same. + \pgfplots@getscale@unit@vector@reltoreference{#1}{#2}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult % - % My idea is to add half of the new range to 'max' and - % subtract the other half from 'min': - % 1/s( xmax - xmin) = (xmax+0.5d) - (xmin-0.5d) = xmax - xmin +d - % with d = 1/s (xmax-xmin) - (xmax-xmin) = (1/s - 1) (xmax-xmin) +%\message{Rescaling '#1' by \pgfplots@glob@TMPa.^^J}% + \if x#1 + \pgfsetxvec{\pgfplotsqpointxy{\pgfplots@glob@TMPa}{0}}% + \else + \if y#1 + \pgfsetyvec{\pgfplotsqpointxy{0}{\pgfplots@glob@TMPa}}% + \else + \if z#1 + \pgfsetzvec{\pgfplotsqpointxyz{0}{0}{\pgfplots@glob@TMPa}}% + \fi + \fi + \fi + % + \pgfmathmultiply@{\csname pgfplots@#1@veclength\endcsname}{\pgfplots@glob@TMPa}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + % + \pgfmathreciprocal@\pgfplots@glob@TMPa + \global\let\pgfplots@glob@TMPb=\pgfmathresult + % + \pgfmathmultiply@{\csname pgfplots@#1@inverseveclength\endcsname}{\pgfplots@glob@TMPb}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult % -%\message{'axis equal': Resizing data range for #1: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}% + % + \pgfplots@apply@unit@vector@rescale@keep@size{#1}{\pgfplots@glob@TMPb}% + % + \fi +} + +% Updates the #1 axis limits such that the axis' dimensions +% stay the same after scaling the #1 unit vector by a scale 's'. +% +% PRECONDITION: +% - the #1 unit vector has been rescaled by a factor s. +% For example, e_xnew := e_x * 0.5 . +% +% POSTCONDITION: +% - the axis limits are enlarged by a factor 1/s such that +% 1/s (#1max - #1min) * e_xnew = (#1max- #1min) * e_x. +% +% In other words, the unit vector rescale is componensated by +% modifying the axis limits. +% +% My idea is to add half of the new range to 'max' and +% subtract the other half from 'min': +% 1/s( xmax - xmin) = (xmax+0.5d) - (xmin-0.5d) = xmax - xmin +d +% with d = 1/s (xmax-xmin) - (xmax-xmin) = (1/s - 1) (xmax-xmin) +% +% #1: either x, y or z. It denotes the direction which has been +% modified. +% #2: the INVERSE of the scaling factor, #2 = 1/s . +% +\def\pgfplots@apply@unit@vector@rescale@keep@size#1#2{% + \ifpgfplots@unit@vector@rescale@keep@size + % +%\message{'unit rescale keep size': Resizing data range for #1: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}% \pgfmathsubtract@{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#1min\endcsname}% \begingroup \pgf@xa=\pgfmathresult pt - \pgfmathsubtract@{\pgfplots@glob@TMPb}{1.0}% + \pgfmathsubtract@{#2}{1.0}% \pgf@xa=\pgfmathresult \pgf@xa \divide\pgf@xa by2 \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% @@ -5405,6 +5921,85 @@ % Update auxiliary data members: \pgfplots@visphase@notify@changeofcanvaslimits{#1}% \fi +}% + +% #1: an axis which should be scaled +% #2: the desired final ratio ||e_#1||/||e_ref|| +\def\pgfplots@getscale@unit@vector@reltoreference#1#2{% + % + % If the datascaling transformation is active (which is almost + % everytime the case here), we have a transformation + % T^{-1}(x)= 10^scale * x + % with different scales for every axis. + % + % If the datascaling transformation is NOT active, scale is 0 + % and T^{-1} = Identity. + % + % Note that the datascaling transformation also has + % translations (shifts). These are not important here. + % + % Goal: + % compute E_#1 such that + % #2* || T^{-1} e_ref || = || T^{-1} E_#1 || + % where T^{-1} is the data scaling transformation and e_ref the + % reference unit vector. Keep in mind that there are + % *different* data scaling transformations for each axis. + % + % We are given e_ref and e_#1 and the desired aspect ratio + % between e_ref and E_#1, which is available as #2. + % + % So: T^{-1} E_#1 := s* T^{-1} e_#1 where + % s = #2 * ||T^{-1} e_ref|| / || T^{-1} e_#1 || + % = |10^{scale_ref}| / |10^{scale_#1}| * #2 * || e_ref|| / ||e_#1||. + % + % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1. + % + % -> compute 's'! + % + % Part 1: compute + % #2 * ||e_ref|| / ||e_#1||. + % + \pgfmathmultiply@ + {\csname pgfplots@\pgfplots@apply@unit@ratio@reference @veclength\endcsname} + {\csname pgfplots@#1@inverseveclength\endcsname}% + \pgfmathmultiply@ + {\pgfmathresult}% + {#2}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + % + % also compute 1/s, required as temporary value: + %\pgfmathmultiply@ + % {\csname pgfplots@\pgfplots@apply@unit@ratio@reference @inverseveclength\endcsname} + % {\csname pgfplots@#1@veclength\endcsname}% + %\ifdim#2pt=1pt + %\else + % \pgfmathdivide@{\pgfmathresult}{#2}% + %\fi + %\global\let\pgfplots@glob@TMPb=\pgfmathresult + % + % Part 2: handle data scaling trafo scales: + \begingroup + \def\pgfplots@tmp@exponentref{0}% + \def\pgfplots@tmp@exponentK{0}% + \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@apply@unit@ratio@reference }{% + \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@apply@unit@ratio@reference }% + }{}% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}% + }{}% + \c@pgf@counta=\pgfplots@tmp@exponentref\relax + \advance\c@pgf@counta by-\pgfplots@tmp@exponentK\relax + \ifnum\c@pgf@counta=0 + \else + \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + % \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}% + % \global\let\pgfplots@glob@TMPb=\pgfmathresult + \fi + \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}% + \endgroup + \let\pgfmathresult=\pgfplots@glob@TMPa +%\message{\string\pgfplots@getscale@unit@vector@reltoreference{#1}{#2} (reference \pgfplots@apply@unit@ratio@reference) = \pgfmathresult.^^J}% } % should be invoked whenever \pgfplots@#1min or \pgfplots@#1max have @@ -5414,18 +6009,32 @@ \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% + \pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1min\endcsname}% \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% + \pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1max\endcsname}% \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult }{}% }% -% Invokes #3 if +% Invokes #3 if ||D_#1||_CANVAS < ||D_#2||_CANVAS and #4 if that is not the case. +% Here D_x = (1,0,0) , D_y = (0,1,0) and D_z=(0,0,1). +% +% Due to the data scaling transformation, +% ||D_a|| = || T(1) * e_a|| +% where e_x, e_y, e_z are the lowlevel, transformed unit vectors. +% We have +% ||D_a|| = T(1) * veclen_a. +% Note that the shift in T is not of interest, we only deal with +% T_a(x) = 10^{s_a} x. +% +% Thus, this routine invokes #3 if % ( 10^{s1} * veclen1 < 10^{s2} * veclen2 ) % <=> % ( 10^{s1-s2} * veclen1 < veclen2 ). % +% Here s1/s2 are the respective scales of the data scaling +% transformation. +% % If the condition is false, '#4' is invoked. \def\pgfplots@if@unitveclenlessthan@untransformed#1#2#3#4{% \def\pgfplots@loc@TMPa{0}% @@ -5437,15 +6046,19 @@ \pgfplots@letcsname{pgfplots@loc@TMPb}={pgfplots@data@scale@trafo@EXPONENT@#2}% }{}% \begingroup +%\message{[comparison: [#1] < [#2]: 10^\pgfplots@loc@TMPa\space * \csname pgfplots@#1@veclength\endcsname < 10^\pgfplots@loc@TMPb\space * \csname pgfplots@#2@veclength\endcsname]^^J}% \pgf@xb=\csname pgfplots@#2@veclength\endcsname pt + % \c@pgf@counta=\pgfplots@loc@TMPa \advance\c@pgf@counta by-\pgfplots@loc@TMPb + % \ifnum\c@pgf@counta=0 \pgf@xa=\csname pgfplots@#1@veclength\endcsname pt \else \pgfplotsmathmultiplypowten@{\csname pgfplots@#1@veclength\endcsname}{\c@pgf@counta}% \pgf@xa=\pgfmathresult pt \fi + % \ifdim\pgf@xa<\pgf@xb \gdef\pgfplots@glob@TMPc{1}% \else @@ -5483,14 +6096,6 @@ \pgfplots@zmax@reg=\pgfplots@zmax pt % \fi % - \pgfpointdiff - {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}} - {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}% - % only used temporarily in this macro to compute the correct - % length for unit vectors: - \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}% - \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}% - % % %----------------------------------------- % PROCESS THE 'width' and 'height' options @@ -5506,13 +6111,24 @@ % FIXME \let\pgfplots@view@el=\pgfutil@empty \let\pgfplots@view@az=\pgfutil@empty - \def\pgfplots@view@dir@threedim@x{0}% - \def\pgfplots@view@dir@threedim@y{0}% - \def\pgfplots@view@dir@threedim@z{1}% \fi \ifx\pgfplots@view@az\pgfutil@empty + % Note that in presence of "x,y,z" options, the + % \pgfplots@set@default@size@options RESETS /pgfplots/view/az. + % %\let\pgfplots@rectangle@width=\pgfutil@empty %\let\pgfplots@rectangle@height=\pgfutil@empty + \def\pgfplots@view@dir@threedim@x{0}% + \def\pgfplots@view@dir@threedim@y{0}% + \def\pgfplots@view@dir@threedim@z{1}% + % + \pgfpointdiff + {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}} + {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}% + % only used temporarily in this macro to compute the correct + % length for unit vectors: + \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}% + \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}% % \ifx\pgfplots@x\pgfutil@empty \ifx\pgfplots@width\pgfutil@empty @@ -5545,17 +6161,26 @@ \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}% \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}% \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}% + \ifcase\pgfplots@scale@mode@choice\relax + % scale mode=auto : do nothing in this context. + \else + \pgfplots@scale@axisbox@to@widthheight + \fi + \ifpgfplots@threedim + \pgfplotsgetnormalforcurrentview + \fi \else - % 3D case is currently always initialised by `view': + % 3D case by `view': \let\pgfplots@x=\pgfutil@empty \let\pgfplots@y=\pgfutil@empty \let\pgfplots@z=\pgfutil@empty + % this invokes \pgfplots@scale@plotbox@to@widthheight automatically. \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}% \if1\pgfplots@tmp@xisaxisparallel% \def\pgfplots@tmp@yisaxisparallel{1}% \fi \fi -%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy). }% +%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy), n = (\pgfplots@view@dir@threedim@x,\pgfplots@view@dir@threedim@y,\pgfplots@view@dir@threedim@z).^^J }% % \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure @@ -5573,124 +6198,33 @@ \fi \fi \fi - \ifpgfplots@axis@equal@image - \pgfplots@axis@equaltrue - \fi - \ifpgfplots@axis@equal - \pgfplots@axis@equal@apply - \fi - % - % Determine final rectangle dimensions. - % There are the following cases: - % 1. the user really wants a fixed dimension, - % i.e. he used 'scale only axis'. - % Then, we have to work to get the correct dimension! - % - % Up to now, the scaling mechanism looses to many significant - % digits such that the final width/height differs by 1-2 pt. - % - % If I am not mistaken, this does ONLY affect the final size, - % not the relative plot precision. - % - % FIXME : really compute the plot precision! - % - % 2. The use specified width and/or height, but not 'scale only - % axis'. Accept inaccurate final widths/heights (see above). - % - % 3. The user supplied 'x' and or 'y'. Simply use them, its - % accurate. + \pgfplots@apply@unit@ratio % - \begingroup + \pgfplots@axis@apply@post@scale x + \pgfplots@axis@apply@post@scale y \ifpgfplots@threedim - \def\pgfplotspointmaxminmin{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}% - \def\pgfplotspointminmaxmin{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}% - \pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}% - \else - \def\pgfplotspointmaxminmin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}% - \def\pgfplotspointminmaxmin{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% - \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \pgfplots@axis@apply@post@scale z \fi - \xdef\pgfplotspointminminmin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% - % ATTENTION: I re-use registers here! Make sure they won't be - % overwritten! \pgfpointdiff and \pgfplotsqpointxy are ok in this respect. - \let\pgfplots@xcoordminTEX=\pgf@xb - \let\pgfplots@ycoordminTEX=\pgf@yb - \pgfplots@xcoordminTEX=\pgf@x - \pgfplots@ycoordminTEX=\pgf@y - % - %-------------------------------------------------- - % FIXME : WHAT IS THIS HERE FOR? - % \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% - % \ifx\pgfplots@rectangle@width\pgfutil@empty - % \def\pgfplots@tmp@xmax@ymin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}% - % \else - % % this 'if' here should only make a difference of about - % % 1-2pt, not more. - % % - % % and I am quite sure that this inaccuracy (and this - % % work-around) only affects the - % % final size, not the relative plot accuracy. - % \pgf@x=\pgfplots@xcoordminTEX - % \advance\pgf@x by\pgfplots@width - % \edef\pgfplots@tmp@xmax@ymin{\noexpand\pgfqpoint{\the\pgf@x}{\noexpand\pgfplots@ycoordminTEX}}% - % \fi - % \ifx\pgfplots@rectangle@height\pgfutil@empty - % \def\pgfplots@tmp@xmin@ymax{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% - % \else - % \pgf@x=\pgfplots@ycoordminTEX - % \advance\pgf@x\pgfplots@height - % \edef\pgfplots@tmp@xmin@ymax{\noexpand\pgfqpoint{\noexpand\pgfplots@xcoordminTEX}{\the\pgf@x}}% - % \fi - %-------------------------------------------------- - \pgfpointdiff - {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} - {\pgfplotspointmaxminmin}% - \xdef\pgfplotspointxaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% - \pgfmathveclen{\pgf@x}{\pgf@y}% - \xdef\pgfplotspointxaxislength{\pgfmathresult pt}% - % - \pgfpointdiff - {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} - {\pgfplotspointminmaxmin}% - \xdef\pgfplotspointyaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% - \pgfmathveclen{\pgf@x}{\pgf@y}% - \xdef\pgfplotspointyaxislength{\pgfmathresult pt}% +} +\def\pgfplots@axis@apply@post@scale#1{% % - \ifpgfplots@threedim - \pgfpointdiff - {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} - {\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% - \xdef\pgfplotspointzaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% - \pgfmathveclen{\pgf@x}{\pgf@y}% - \xdef\pgfplotspointzaxislength{\pgfmathresult pt}% - % - \pgfpointscale - {0.5}% - {\pgfplotspointxaxis - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \pgfplotspointyaxis% - \advance\pgf@xa by\pgf@x - \advance\pgf@xb by\pgf@y - \pgfplotspointzaxis% - \advance\pgf@xa by\pgf@x - \advance\pgf@xb by\pgf@y - \global\pgf@x=\pgf@xa - \global\pgf@y=\pgf@xb - }% - \xdef\pgfplotspointcenter{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% + \pgfkeysgetvalue{/pgfplots/#1 post scale}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty \else - \global\let\pgfplotspointzaxis=\pgfpointorigin - \gdef\pgfplotspointzaxislength{0pt}% - \pgfpointscale - {0.5}% - {\pgfpointadd - \pgfplotspointxaxis% - \pgfplotspointyaxis% - }% - \xdef\pgfplotspointcenter{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% + \pgfmathparse{\pgfmathresult}% + \ifdim\pgfmathresult pt=1pt + \else + \let\pgfplots@loc@TMPa=\pgfmathresult + \csname pgf@#1x\endcsname=\pgfmathresult\csname pgf@#1x\endcsname + \csname pgf@#1y\endcsname=\pgfmathresult\csname pgf@#1y\endcsname + % + \pgfmathmultiply@{\csname pgfplots@#1@veclength\endcsname}{\pgfplots@loc@TMPa}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + % + \pgfmathdivide@{\csname pgfplots@#1@inverseveclength\endcsname}{\pgfplots@loc@TMPa}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \fi \fi - \endgroup } % This here is a low-weight node. It can ONLY be used during axis @@ -5980,14 +6514,28 @@ %% %% \anchorborder{% - % Call a function that computes a border point. Since this - % function will modify dimensions like \pgf@x, we must move them to - % other dimensions. - \pgfutil@tempdima=\pgf@x - \pgfutil@tempdimb=\pgf@y - \pgfpointborderrectangle% - {\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}% - {\upperrightcorner}% + % remember the input coords: + \edef\pgfplots@loc@TMPa{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + % + % I want to use \pgfpointborderrectangle which expects that + % (0,0) is the CENTER. + % Ok, then: shift it: + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale + {0.5} + {\innerdiagonal}}% + \edef\pgfplots@loc@center{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + \pgfpointadd{% + \pgfpointborderrectangle% + {\pgfplots@loc@TMPa}% + {\pgfpointscale + {0.5} + {\innerdiagonal}}% + }{% + % and add the center to undo the local shift: + \pgfplots@loc@center + }% }% \backgroundpath{% \pgfkeysvalueof{/pgfplots/@backgroundpath@hook/.@cmd}\pgfeov @@ -6249,6 +6797,65 @@ }{}% }% + +% Defines a new axis type `#1' with initialization code `#2'. +% +% The name #1 will be available as value for 'axis type=#1' and +% furthermore, an environment '\begin{#1axis}' will be available. +% +% For ConTeXt, the \start#1axis and \stop#1axis commands will be +% available. +% +% #1: the axis type name +% #2: initialization TeX code. +% +% OPTIONAL: you can provide the expected axis coordinate system in +% square brackets. +% +% \pgfplotsdefineaxistype{rectangle}{...} +% \pgfplotsdefineaxistype[polar]{polar}{...} +\def\pgfplotsdefineaxistype{\pgfutil@ifnextchar[{\pgfplotsdefineaxistype@}{\pgfplotsdefineaxistype@[cart]}}% +\def\pgfplotsdefineaxistype@[#1]#2#3{% + \expandafter\def\csname pgfplots@axistype@#2\endcsname{% + \pgfkeyssetvalue{/pgfplots/@expected axis cs}{#1}% + #3% + }% + \expandafter\def\csname pgfplots@environment@#2axis\endcsname{% + \pgfutil@ifnextchar[% + {\csname pgfplots@environment@#2axis@\endcsname}% + {\csname pgfplots@environment@#2axis@\endcsname[]}% + }% + \expandafter\long\expandafter\def\csname pgfplots@environment@#2axis@\endcsname[##1]{% + \begin{axis}[% + ##1,% + data cs=#1,% assume that coordinates provided by \addplot are in the correct coordsystem + axis type=#2% active the correct axis type + ]% + }% + \expandafter\def\csname endpgfplots@environment@#2axis\endcsname{\end{axis}}% + \edef\pgfplots@glob@TMPc{\expandafter\noexpand\csname #2axis\endcsname\expandafter\noexpand\csname pgfplots@environment@#2axis\endcsname}% + \expandafter + \tikzaddtikzonlycommandshortcutlet\pgfplots@glob@TMPc + % + \edef\pgfplots@glob@TMPc{\expandafter\noexpand\csname end#2axis\endcsname\expandafter\noexpand\csname endpgfplots@environment@#2axis\endcsname}% + \expandafter + \tikzaddtikzonlycommandshortcutlet\pgfplots@glob@TMPc + % + % ConTeXt compatibility: + \t@pgfplots@toka=\expandafter{\csname #2axis\endcsname}% + \t@pgfplots@tokb=\expandafter{\csname end#2axis\endcsname}% + \expandafter\edef\csname start#2axis\endcsname{\the\t@pgfplots@toka}% + \expandafter\edef\csname stop#2axis\endcsname{\the\t@pgfplots@tokb}% +}% + +\def\pgfplotssetaxistype#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 + }% +}% + % A command which has to be invoked BEFORE \pgfplots@draw@axis to % prepare everything. \def\pgfplots@draw@axis@pre{% @@ -6285,6 +6892,8 @@ \fi } +\def\pgfplots@draw@axis@is@prepared{}% + % PRECONDITION: % \pgfplots@draw@axis@pre has been called. \def\pgfplots@draw@axis{% @@ -6341,8 +6950,8 @@ %\fi \else % Just use the 2d-point commands (assuming Z=0) - \let\pgfplotspointonorientedsurfaceabsetupforxyz=\pgfplotspointonorientedsurfaceabsetupforxy - \let\pgfplotspointonorientedsurfaceabsetupforyxz=\pgfplotspointonorientedsurfaceabsetupforyx + \let\pgfplotspointonorientedsurfaceabsetupfor@@xyz=\pgfplotspointonorientedsurfaceabsetupfor@@xy + \let\pgfplotspointonorientedsurfaceabsetupfor@@yxz=\pgfplotspointonorientedsurfaceabsetupfor@@yx \pgfplots@draw@axis@insurface@symmetric xyz \fi }% @@ -6614,10 +7223,33 @@ \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}% \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}% \fi + \else + % FIXME : it might be better to implement that stuff here + % implicilty using the 3D algorithms. + % + % this here is the only important one: + \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}% + % + \expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}% + \expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}% + \expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}% + \expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}% + \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}% + \def\pgfplotsifaxislineisonconvexhull##1##2##3{##2}% ALWAYS TRUE + \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@##1##2##3{##2}% ALWAYS TRUE + % + \fi +} + +% Initialises the 'pgfplots@[xyz]ticklabelaxisspecs' macro according to +% the foreground/background situation of the axis and the '[xyz]ticklabel pos' +% keys. +\def\pgfplots@init@ticklabelaxisspec{% + \ifpgfplots@threedim % % % Now, determine which axis line shall get tick labels. - % The strategie is as follows: + % The strategy is as follows: % - only lines on the convex hull of the 2D projected axis % rectangle can get tick labels, % - for each axis, there are two such choices in the general @@ -6635,20 +7267,6 @@ % \pgfplots@init@ticklabelaxisspecfor zx% \else - % FIXME : it might be better to implement that stuff here - % implicilty using the 3D algorithms. - % - % this here is the only important one: - \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}% - % - \expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}% - \expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}% - \expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}% - \expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}% - \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}% - \def\pgfplotsifaxislineisonconvexhull##1##2##3{##2}% ALWAYS TRUE - \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@##1##2##3{##2}% ALWAYS TRUE - % \pgfplotspointcenter \edef\pgfplots@tmp@centerx{\the\pgf@x}% \edef\pgfplots@tmp@centery{\the\pgf@y}% @@ -6657,10 +7275,10 @@ % \pgfplots@init@ticklabelaxisspec@twodim@for yx% \fi -} +}% % A helper method which is to be invoked ONLY inside of -% \pgfplots@decide@which@figure@surfaces@are@drawn. +% \pgfplots@init@ticklabelaxisspec. % It does NOT work outside of it. % % It initialises the 'pgfplots@#1ticklabelaxisspec' macro according to @@ -6677,7 +7295,6 @@ % % POSTCONDITION: % - pgfplots@#1ticklabelaxisspec is set, -% - pgfplots@#1ticklabel@suggested@anchor is set % % @see also \pgfplots@init@ticklabelaxisspec@twodim@for \def\pgfplots@init@ticklabelaxisspecfor#1#2{% @@ -6783,7 +7400,7 @@ % #3 : the direction which is currently fixed. \def\pgfplots@draw@axis@insurface#1#2#3{% \pgfplots@if{pgfplots@hide@#1}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \pgfplots@drawgridlines@onorientedsurf % \pgfplots@drawticklines@onorientedsurf @@ -6796,7 +7413,7 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% \fi }% @@ -6808,32 +7425,32 @@ % with slightly optimized execution sequence. \def\pgfplots@draw@axis@insurface@symmetric#1#2#3{% \pgfplots@if{pgfplots@hide@#1}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \pgfplots@drawgridlines@onorientedsurf }% \pgfplots@if{pgfplots@hide@#2}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #2#1#3% \pgfplots@drawgridlines@onorientedsurf }% % \pgfplots@if{pgfplots@hide@#1}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \pgfplots@drawticklines@onorientedsurf }% \pgfplots@if{pgfplots@hide@#2}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #2#1#3% \pgfplots@drawticklines@onorientedsurf }% % \ifpgfplots@separate@axis@lines \pgfplots@if{pgfplots@hide@#1}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2% \pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3% }% % \pgfplots@if{pgfplots@hide@#2}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #2#1#3% \pgfplots@drawaxis@outerlines@separate@onorientedsurf#2#1% \pgfplots@drawaxis@innerlines@onorientedsurf#2#1#3% }% @@ -6844,11 +7461,11 @@ \fi % \pgfplots@if{pgfplots@hide@#1}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \pgfplots@drawticklabels@onorientedsurf }% \pgfplots@if{pgfplots@hide@#2}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #2#1#3% \pgfplots@drawticklabels@onorientedsurf }% % @@ -6856,7 +7473,7 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% \fi }% @@ -6864,7 +7481,7 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#2tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #2#1#3% \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% \fi }% @@ -6872,7 +7489,7 @@ \def\pgfplots@draw@axis@insurface@onlyticksandgrid#1#2#3{% \pgfplots@if{pgfplots@hide@#1}{\relax}{% - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \pgfplots@drawgridlines@onorientedsurf \pgfplots@drawticklines@onorientedsurf % @@ -6881,7 +7498,7 @@ \else \begingroup \let\pgfplots@drawticklabels@onorientedsurf=\relax - \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplotspointonorientedsurfaceabsetupfor #1#2#3% \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}% \endgroup \fi @@ -6944,7 +7561,9 @@ \endgroup \expandafter\pgfsettransformentries\pgfplots@glob@TMPa{0pt}{0pt}% % + % \pgfplots@draw@axis@pre + \pgfplots@draw@axis@is@prepared \scope % \pgfkeysifdefined{/pgfplots/axis background/.@cmd}{% @@ -6962,26 +7581,26 @@ \pgfplotspointbb@assertvaluesexist% } -% Defines \pgfplots@clippath@install. -% @PRECONDITION the axis limits must be ready. -\def\pgfplots@clippath@prepare{% - \def\pgfplots@clippath@use@##1{% - \ifx\pgfplotspoint@bb@@@\relax - % remember the axis dimensions as well: - \ifdim\pgf@pathmaxx=-16000pt - \else - \begingroup - \pgf@xa=\pgf@pathmaxx - \advance\pgf@xa by-\pgf@pathminx - \pgf@ya=\pgf@pathmaxy - \advance\pgf@ya by-\pgf@pathminy - \xdef\pgfplots@glob@TMPa{{\the\pgf@pathminx}{\the\pgf@pathminy}{\the\pgf@xa}{\the\pgf@ya}}% - \endgroup - \global\let\pgfplotspoint@bb@@@=\pgfplots@glob@TMPa - \fi +% something which is invoked after a clippath segment is complete. +% #1 should be something like \pgfusepath{clip} +\def\pgfplots@clippath@use@#1{% + \ifx\pgfplotspoint@bb@@@\relax + % remember the axis dimensions: + \ifdim\pgf@pathmaxx=-16000pt + \else + \begingroup + \pgf@xa=\pgf@pathmaxx + \advance\pgf@xa by-\pgf@pathminx + \pgf@ya=\pgf@pathmaxy + \advance\pgf@ya by-\pgf@pathminy + \xdef\pgfplots@glob@TMPa{{\the\pgf@pathminx}{\the\pgf@pathminy}{\the\pgf@xa}{\the\pgf@ya}}% + \endgroup + \global\let\pgfplotspoint@bb@@@=\pgfplots@glob@TMPa \fi - ##1% - }% + \fi + #1% +}% +\def\pgfplots@clippath@prepare@for@axistype{% \ifpgfplots@threedim % FIXME : this can't be done in three dimensions. :-( % -> for 3d, I need to clip at least the 2d projection. @@ -7212,18 +7831,60 @@ \endgroup \let\pgfplots@clippath@install=\pgfplots@glob@TMPa \fi - % FIXME : workaround clear path sizes at beginning! This shouldn't - % be necessary! - \expandafter\def - \expandafter\pgfplots@clippath@install - \expandafter##% - \expandafter1% - \expandafter{% - \expandafter\pgf@resetpathsizes - \pgfplots@clippath@install{##1}% - }% +}% +% Defines \pgfplots@clippath@install. +% @PRECONDITION the axis limits must be ready. +\def\pgfplots@clippath@prepare{% + \pgfplots@clippath@prepare@for@axistype + % now, the \pgfplots@clippath@install routine should be ready. + % + % it is used to compute the bounding box. prepare that: \global\let\pgfplotspoint@bb@@@=\relax + % + % Now, I SET the clip path temporarily and record the low level + % protocol. + % This low level protocol is used to create a highly optimized + % clip path routine; it will be used quite often. + % + \let\pgfplots@clippath@install@pathcmd=\pgfplots@clippath@install + \pgf@resetpathsizes% FIXME: this here should not be necessary! + \pgfsysprotocol@getcurrentprotocol\pgfplots@loc@TMPa% + \begingroup + % when I do this work, I can as well compute the bounding + % box (done in \pgfplots@clippath@use@) + \pgfinterruptboundingbox + \pgf@relevantforpicturesizetrue + % + \pgfsysprotocol@bufferedtrue% + \pgfsysprotocol@setcurrentprotocol\pgfutil@empty% + % \pgfplots@clippath@install@pathcmd{\pgfusepath{clip}}% + \pgfsysprotocol@getcurrentprotocol\pgfplots@loc@TMPa% + \global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa + \endpgfinterruptboundingbox + \endgroup + \let\pgfplots@clippath@install@clip@protocolled=\pgfplots@glob@TMPa + \pgfsysprotocol@setcurrentprotocol\pgfplots@loc@TMPa% + % + % Replace \pgfplots@clippath@install by one which makes use of the + % optimized version (if ##1=\pgfusepath{clip}) + \def\pgfplots@clippath@install##1{% + \def\pgfplots@loc@TMPa{##1}% + \ifx\pgfplots@loc@TMPa\pgfplots@clippath@install@test + % the 'clip' path has been precomputed because it is often + % used: + \expandafter\pgfsys@invoke\expandafter{\pgfplots@clippath@install@clip@protocolled}% + % as far as I can see, this here is the only command which + % can't be protocolled: + \pgf@relevantforpicturesizefalse + \else + \pgf@resetpathsizes% FIXME: this here should not be necessary! + \pgfplots@clippath@install@pathcmd{##1}% + \fi + }% + % }% +\def\pgfplots@clippath@install@test{\pgfusepath{clip}X}% + \def\pgfplotspointbb@assertvaluesexist{% \ifx\pgfplotspoint@bb@@@\relax % (RE)COMPUTE: @@ -7295,7 +7956,7 @@ \def\pgfplots@filter@input@ticks@with@log#1#2{% \let\pgfplots@glob@TMPa=\pgfutil@empty \foreach \pgfplots@loc@TMPb in {#1} {% - \csname pgfplotsmathlog@#2@\endcsname{\pgfplots@loc@TMPb}% + \pgfplotscoordmath{#2}{log}{\pgfplots@loc@TMPb}% \ifx\pgfplots@glob@TMPa\pgfutil@empty \xdef\pgfplots@glob@TMPa{\pgfmathresult}% \else @@ -7321,14 +7982,17 @@ \let\pgfmathresult=\pgfplots@glob@TMPa } +% definition of 'axis cs': \tikzdeclarecoordinatesystem{axis}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface\pgfplots@loc@TMPa\pgfplots@coord@end} \def\pgfplotspointaxisxy#1#2{\pgfplots@evalute@tikz@coord@system@interface#1,#2\pgfplots@coord@end}% \def\pgfplotspointaxisxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface#1,#2,#3\pgfplots@coord@end}% +% rel axis cs: \tikzdeclarecoordinatesystem{rel axis}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface@rel\pgfplots@loc@TMPa\pgfplots@coord@end} \def\pgfplotspointrelaxisxy#1#2{\pgfplots@evalute@tikz@coord@system@interface@rel#1,#2\pgfplots@coord@end}% \def\pgfplotspointrelaxisxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface@rel#1,#2,#3\pgfplots@coord@end}% +% axis description cs: \tikzdeclarecoordinatesystem{axis description}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface@axis@description\pgfplots@loc@TMPa\pgfplots@coord@end} \def\pgfplots@evalute@tikz@coord@system@interface@axis@description#1,#2\pgfplots@coord@end{\pgfplotspointdescriptionxy{#1}{#2}} @@ -7347,10 +8011,11 @@ \let\pgfplots@loc@TMPc=\pgfmathresult% FIXME: is that necessary? I doubt it... but just to make sure... \csname ifpgfplots@#1islinear\endcsname \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \csname pgfplots@datascaletrafo@fromfixed@#1\endcsname{\pgfplots@loc@TMPc}% + \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@loc@TMPc}% + \pgfplotscoordmath{#1}{datascaletrafo}{\pgfmathresult}% }{}% \else - \pgfmathlog@{\pgfplots@loc@TMPc}% + \pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPc}% \fi } @@ -7469,7 +8134,6 @@ % See also: % \pgfplots@check@and@apply@datatrafo@for \def\pgfplots@prepare@coord@filtering@for#1{% - \expandafter\let\csname pgfplotsmathlogtologten@#1@\endcsname=\pgfmathlogtologten@ \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \expandafter\let\csname pgfplots@highlevel@trafo@#1\endcsname=\pgfplots@loc@TMPc \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key @@ -7527,6 +8191,7 @@ \expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfmathresult}% \fi \fi + % \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else @@ -7534,6 +8199,12 @@ \expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfmathresult}% \fi % + \pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@filter@input@ticks@with@highleveltrafo\expandafter{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}% + \pgfkeyslet{/pgfplots/minor #1tick}\pgfmathresult + \fi \fi % \pgfkeysgetvalue{/pgfplots/#1filter}\pgfplots@loc@TMPa @@ -7545,6 +8216,7 @@ \pgfkeys{/pgfplots/#1 filter/.code={\csname pgfplots@#1filter@backwcompat\endcsname{##1}\to\pgfmathresult}}% \fi \csname ifpgfplots@#1islinear\endcsname + \pgfplotssetcoordmathfor{#1}{float}% \csname pgfplots@apply@datatrafo@#1true\endcsname \pgfplots@apply@datatrafotrue \ifpgfplots@apply@datatrafo @@ -7552,37 +8224,31 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult \fi \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % Check for any existing tick limits: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult \fi \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{parsenumber}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult \fi \fi \else - \expandafter\let\csname pgfplotsmathlog@#1@\endcsname=\pgfmathlog@ - \expandafter\let\csname pgfplotsmathlogi@#1\endcsname=\logi - \expandafter\let\csname pgfplotsmathlog@#1@float\endcsname=\pgfmathlog@float - \expandafter\let\csname pgfplots@log@scale@todisplaylog@#1\endcsname=\logten - \expandafter\let\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname=\reciproclogten - \expandafter\def\csname pgfplotsmathlogscale@#1\endcsname{1}% - \expandafter\def\csname pgfplotsmathlogscale@#1@inv\endcsname{1}% + \pgfplotssetcoordmathfor{#1}{pgfbasic}% % % This here could be done using a high level coord trafo as % well! However, I don't want to risk accidentally overwritten @@ -7596,38 +8262,10 @@ % log basis x={} (initial setting:) \else % use a different basis. - % - % - \pgfmathlog@{\pgfplots@loc@TMPa}% - \let\pgfplots@loc@TMPa=\pgfmathresult - \pgfmathparse{1/\pgfplots@loc@TMPa}% - \expandafter\let\csname pgfplotsmathlogscale@#1\endcsname=\pgfplots@loc@TMPa - \expandafter\let\csname pgfplotsmathlogscale@#1@inv\endcsname=\pgfmathresult - % - \expandafter\edef\csname pgfplotsmathlog@#1@\endcsname##1{% - \noexpand\pgfmathlog@{##1}% - \noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty - \noexpand\else - \noexpand\expandafter\noexpand\pgfmath@basic@multiply@\noexpand\expandafter - {\noexpand\pgfmathresult}% - {\pgfmathresult}% - \noexpand\fi - }% - \expandafter\edef\csname pgfplotsmathlog@#1@float\endcsname##1{% - \noexpand\pgfmathlog@float{##1}% - \noexpand\ifx\noexpand\pgfmathresult\noexpand\pgfutil@empty - \noexpand\else - \noexpand\expandafter\noexpand\pgfmath@basic@multiply@\noexpand\expandafter - {\noexpand\pgfmathresult}% - {\pgfmathresult}% - \noexpand\fi - }% + \pgfplotscoordmath{#1}{set log basis}{\pgfplots@loc@TMPa}% % % generate default ticks in the 'log basis', not base 10: - \expandafter\def\csname pgfplots@log@scale@todisplaylog@#1\endcsname{1}% - \expandafter\def\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname{1}% \pgfplotsset{/pgfplots/log basis ticks=#1}% - % % \ifdim\pgfkeysvalueof{/pgfplots/log basis #1}pt=10pt \else @@ -7638,39 +8276,6 @@ \expandafter\def\csname pgfplots@#1minorgridstrue\endcsname{\pgfplots@error{Sorry, minor grid lines are not supported for this log basis.}}% \fi \pgfkeyslet{/pgfplots/log basis #1/.@cmd}\pgfplots@cant@set@in@this@context - % - % recompute logtologten for this axis: - \pgfmath@basic@multiply@{\reciproclogten}{\pgfplots@loc@TMPa}% - \expandafter\edef\csname pgfplotsmathlogtologten@#1@\endcsname##1{% - \noexpand\pgfmath@basic@multiply@{##1}{\pgfmathresult}% - }% - \begingroup - % recompute \logi for the new basis. - \dimen1=\logi1pt \dimen1=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen1 - \dimen2=\logi2pt \dimen2=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen2 - \dimen3=\logi3pt \dimen3=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen3 - \dimen4=\logi4pt \dimen4=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen4 - \dimen5=\logi5pt \dimen5=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen5 - \dimen6=\logi6pt \dimen6=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen6 - \dimen7=\logi7pt \dimen7=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen7 - \dimen8=\logi8pt \dimen8=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen8 - \dimen9=\logi9pt \dimen9=\csname pgfplotsmathlogscale@#1@inv\endcsname\dimen9 - \xdef\pgfplots@glob@TMPa##1{% - \noexpand\ifcase##1 - \noexpand\or0 - \noexpand\or\pgf@sys@tonumber{\dimen1 }% - \noexpand\or\pgf@sys@tonumber{\dimen2 }% - \noexpand\or\pgf@sys@tonumber{\dimen3 }% - \noexpand\or\pgf@sys@tonumber{\dimen4 }% - \noexpand\or\pgf@sys@tonumber{\dimen5 }% - \noexpand\or\pgf@sys@tonumber{\dimen6 }% - \noexpand\or\pgf@sys@tonumber{\dimen7 }% - \noexpand\or\pgf@sys@tonumber{\dimen8 }% - \noexpand\or\pgf@sys@tonumber{\dimen9 }% - \noexpand\fi - }% - \endgroup - \expandafter\let\csname pgfplotsmathlogi@#1\endcsname=\pgfplots@glob@TMPa %%% % Ok, now, I have prepared everything for the new % log basis! @@ -7680,13 +8285,13 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \csname pgfplotsmathlog@#1@\endcsname{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult \fi \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \csname pgfplotsmathlog@#1@\endcsname{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % @@ -7694,13 +8299,13 @@ \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \csname pgfplotsmathlog@#1@\endcsname{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult \fi \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \csname pgfplotsmathlog@#1@\endcsname{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult \fi % @@ -7723,26 +8328,26 @@ \expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfmathresult}% \fi % + \pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}{#1}% + \pgfkeyslet{/pgfplots/minor #1tick}\pgfmathresult + \fi + % % append logarithm to prepare coord. % \t@pgfplots@toka={% \ifx\pgfmathresult\pgfutil@empty \else \pgfplots@if{pgfplots@disablelogfilter@#1}{% - \pgfmathfloatparsenumber{\pgfmathresult}% - \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta - \ifnum\c@pgf@counta>2 % this clears nan, inf and -inf points. - \let\pgfmathresult=\pgfutil@empty - \def\pgfplots@unbounded@dir{#1}% - \else - \pgfmathfloattofixed{\pgfmathresult}% - \fi + \pgfplotscoordmath{#1}{parsenumber}{\pgfmathresult}% + % FIXME : check for unbounded arguments! }{% - \csname pgfplotsmathlog@#1@\endcsname{\pgfmathresult}% - \ifx\pgfmathresult\pgfutil@empty - % detect unbounded coords: + \pgfplotscoordmath{#1}{log}{\pgfmathresult}% + \pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{}{% \def\pgfplots@unbounded@dir{#1}% - \fi + }% }% \fi }% @@ -7777,6 +8382,7 @@ } \def\pgfplots@create@axis@descriptions@{% + \begingroup \ifpgfplots@hide@x \else \ifpgfplots@units@use% @@ -7815,6 +8421,7 @@ \fi \fi \fi + \endgroup % \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -7827,215 +8434,6 @@ % } -\def\pgfplots@datascaletrafo@undoshift@x#1{% - \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@x}% -}% -\def\pgfplots@datascaletrafo@redoshift@x#1{% - \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@x}% -}% -\def\pgfplots@datascaletrafo@undoshift@y#1{% - \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% -}% -\def\pgfplots@datascaletrafo@redoshift@y#1{% - \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% -}% -\def\pgfplots@datascaletrafo@undoshift@z#1{% - \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% -}% -\def\pgfplots@datascaletrafo@redoshift@z#1{% - \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% -}% - -% DATA TRANSFORMATION T(x) = X - xmin -% -% Input: -% a number in the original data range, given in **floating** point representation -% Output: -% a fixed point number in transformed range -% stored in \pgfmathresult -% @see -% \pgfplots@datascaletrafo@fromfixed@x -\def\pgfplots@datascaletrafo@x#1{% - \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% - \pgfmathfloattofixed{\pgfmathresult}% - \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@x}% -} -\def\pgfplots@datascaletrafo@x@noshift#1{% - \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% - \pgfmathfloattofixed{\pgfmathresult}% -} - -% Overloaded function. -% Input: -% a FIXED point number instead of a floating point one. -% @see \pgfplots@datascaletrafo@x -\def\pgfplots@datascaletrafo@fromfixed@x#1{% - \pgfmathfloatparsenumber{#1}% - \pgfplots@datascaletrafo@x{\pgfmathresult}% -} - -\def\pgfplots@datascaletrafo@y#1{% - \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% - \pgfmathfloattofixed{\pgfmathresult}% - \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@y}% -} -\def\pgfplots@datascaletrafo@fromfixed@y#1{% - \pgfmathfloatparsenumber{#1}% - \pgfplots@datascaletrafo@y{\pgfmathresult}% -} -\def\pgfplots@datascaletrafo@y@noshift#1{% - \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% - \pgfmathfloattofixed{\pgfmathresult}% -} -\def\pgfplots@datascaletrafo@z#1{% - \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% - \pgfmathfloattofixed{\pgfmathresult}% - \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@z}% -} -\def\pgfplots@datascaletrafo@fromfixed@z#1{% - \pgfmathfloatparsenumber{#1}% - \pgfplots@datascaletrafo@z{\pgfmathresult}% -} -\def\pgfplots@datascaletrafo@z@noshift#1{% - \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% - \pgfmathfloattofixed{\pgfmathresult}% -} - -% INVERSE transformation x = T^{-1}( X ) -% Input: -% a fixed point number in transformed domain -% Output: -% a number in the data domain, given in floating point -% representation -% -% If the input number is approximately X=0, we will return x=0 as -% well. -% -% This allows to handle rounding inaccuracies and should not pose any -% problems. -\def\pgfplots@inverse@datascaletrafo@x#1{% - \begingroup - \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@x}% - \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult - \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% - \ifpgfmathcomparison - \pgfmathfloatcreate{0}{0.0}{0}% - \else - \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% - \edef\pgfplots@data@scale@trafo@EXPONENT@x{-\pgfplots@data@scale@trafo@EXPONENT@x}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@x}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -\def\pgfplots@inverse@datascaletrafo@x@noshift#1{% - \begingroup - \pgfmathapproxequalto@{#1}{0.0}% - \ifpgfmathcomparison - \pgfmathfloatcreate{0}{0.0}{0}% - \else - \pgfmathfloatparsenumber{#1}% - \edef\pgfplots@data@scale@trafo@EXPONENT@x{-\pgfplots@data@scale@trafo@EXPONENT@x}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@x}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -} - -\def\pgfplots@inverse@datascaletrafo@y#1{% - \begingroup - \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% - \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult - \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% - \ifpgfmathcomparison - \pgfmathfloatcreate{0}{0.0}{0}% - \else - \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% - \edef\pgfplots@data@scale@trafo@EXPONENT@y{-\pgfplots@data@scale@trafo@EXPONENT@y}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@y}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -% Overloaded function. This one does only apply the scaling, no shift. -\def\pgfplots@inverse@datascaletrafo@y@noshift#1{% - \begingroup - \pgfmathapproxequalto@{#1}{0.0}% - \ifpgfmathcomparison - \pgfmathfloatcreate{0}{0.0}{0}% - \else - \pgfmathfloatparsenumber{#1}% - \edef\pgfplots@data@scale@trafo@EXPONENT@y{-\pgfplots@data@scale@trafo@EXPONENT@y}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@y}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -} - -\def\pgfplots@inverse@datascaletrafo@z#1{% - \begingroup - \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% - \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult - \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% - \ifpgfmathcomparison - \pgfmathfloatcreate{0}{0.0}{0}% - \else - \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% - \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -% Overloaded function. This one does only apply the scaling, no shift. -\def\pgfplots@inverse@datascaletrafo@z@noshift#1{% - \begingroup - \pgfmathapproxequalto@{#1}{0.0}% - \ifpgfmathcomparison - \pgfmathfloatcreate{0}{0.0}{0}% - \else - \pgfmathfloatparsenumber{#1}% - \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -} - -% Overloaded function. -% -% In contrast to \pgfplots@inverse@datascaletrafo@x, this method -% returns a number in FIXED point representation. -% @see \pgfplots@inverse@datascaletrafo@x -\def\pgfplots@inverse@datascaletrafo@tofixed@x#1{% - \pgfplots@inverse@datascaletrafo@x{#1}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% -} -\def\pgfplots@inverse@datascaletrafo@tofixed@y#1{% - \pgfplots@inverse@datascaletrafo@y{#1}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% -} -\def\pgfplots@inverse@datascaletrafo@tofixed@z#1{% - \pgfplots@inverse@datascaletrafo@z{#1}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% -} - -% Overloaded function. -% -% This one does only apply the scale, no shift. -\def\pgfplots@inverse@datascaletrafo@tofixed@x@noshift#1{% - \pgfplots@inverse@datascaletrafo@x@noshift{#1}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% -} -\def\pgfplots@inverse@datascaletrafo@tofixed@y@noshift#1{% - \pgfplots@inverse@datascaletrafo@y@noshift{#1}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% -} -\def\pgfplots@inverse@datascaletrafo@tofixed@z@noshift#1{% - \pgfplots@inverse@datascaletrafo@z@noshift{#1}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% -} - % Invokes '#1' foreach key which should be saved by a color bar. % % The current key name is available as '##1', the macro under which @@ -8150,9 +8548,9 @@ \fi % % normalize format: - \pgfmathfloattosci\pgfplots@colorbar@src@metamin + \pgfplotscoordmath{meta}{tostring}{\pgfplots@colorbar@src@metamin}% \global\let\pgfplots@colorbar@src@metamin=\pgfmathresult - \pgfmathfloattosci\pgfplots@colorbar@src@metamax + \pgfplotscoordmath{meta}{tostring}{\pgfplots@colorbar@src@metamax}% \global\let\pgfplots@colorbar@src@metamax=\pgfmathresult % \pgfplots@assemble@ref@picture @@ -8176,9 +8574,12 @@ \noexpand\pgfkeyssetvalue{/pgfplots/parent axis height}{\pgfkeysvalueof{/pgfplots/parent axis height}}% \noexpand\pgfkeyssetvalue{/pgfplots/colorbar/width}{\pgfkeysvalueof{/pgfplots/colorbar/width}}% \noexpand\pgfkeyssetvalue{/pgfplots/colorbar addplot}{\the\toks2 }% + \noexpand\def\noexpand\pgfplots@colormap@access{\pgfplots@colormap@access}% \noexpand\pgfkeyssetvalue{/pgfplots/colorbar pos*}{\pgfkeysvalueof{/pgfplots/colorbar pos*}}% + % just to make sure that colorbar sampled respects it: + \noexpand\pgfkeyssetvalue{/pgfplots/mark list fill}{\pgfkeysvalueof{/pgfplots/mark list fill}}% \noexpand\pgfplots@colorbar@define@hook% - \noexpand\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\noexpand\pgfeov + \noexpand\pgfplots@colorbar@draw@ \ifx\pgfplots@colorbar@toname\pgfutil@empty \noexpand\pgfnodealias{current colorbar axis}{current axis}% \noexpand\pgfnodealias{current axis}{parent axis}% @@ -8200,6 +8601,44 @@ \pgfplots@label{\pgfplots@colorbar@toname}{pgfplots@colorbar@to@name@}% \fi }% + +\newif\ifpgfplotscolorbarCMYKworkaround +\pgfplotscolorbarCMYKworkaroundtrue + +\def\pgfplots@colorbar@draw@{% + \ifpgfplotscolorbarCMYKworkaround + % the default implementation for colorbars is based on + % \pgfplotscolormaptoshadingspec. + % This, in turn, does NOT work for CMYK. + % + % This here detects that case and switches to the (visually) + % equivalent 'colorbar sampled={surf,shader=interp}' style. + \if1\pgfplotscolormaptoshadingspectorgb + \pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfplots@colorbar@draw@defaultimpl + \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPb + \pgfplotscolormapgetcolorspace{\pgfplots@loc@TMPb}% + \def\pgfplots@loc@TMPa{cmyk}% + \ifx\pgfplots@loc@TMPa\pgfplotsretval + \pgfutil@ifundefined{pgfplots@colorbar@CMYK@\pgfplots@loc@TMPb}{% + \pgfplots@warning{colorbar: The colormap '\pgfplots@loc@TMPb' has a CMYK colorspace which is not (yet) supported by PGF. I switched colorbar styles automatically to 'colorbar sampled={surf,shader=interp}' to generate a proper CMYK colorbar. Use \string\pgfplotscolorbarCMYKworkaroundfalse\space to disable this improvement. [This message won't be replicated for '\pgfplots@loc@TMPb']}% + \expandafter\gdef\csname pgfplots@colorbar@CMYK@\pgfplots@loc@TMPb\endcsname{1}% + }{}% + \pgfplotsset{colorbar sampled={surf,shader=interp}}% + \fi + \fi + \fi + \fi + % + % FIXME : the semicolon after ';' has a fixed catcode, namely + % the one assigned while pgfplots.code.tex has been read. + % + % The \pgfplots@checkandpreparefor@active@semicolon gets + % confused if the catcodes change... this here is a + % work-around for babel support. + \let\pgfplots@checkandpreparefor@active@semicolon\relax + \pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\pgfeov +} \pgfkeysdef{/pgfplots/colorbar to name/at}{% % automatically search-and-replace 'parent axis' which % is not defined for a detached colorbar: @@ -8444,6 +8883,8 @@ {#1}% \let\pgfplots@remaining@input=\pgfplots@rmopts % + \pgfplotssetaxistype{\pgfkeysvalueof{/pgfplots/axis type}}% + % % Step 2: parse any pgfplots options out of styles. \pgfkeysactivatefamily{/pgfplots/style commands}% %\pgfkeysinstallkeyfilter{/pgf/key filters/active families or descendants of}{/pgfplots} @@ -8455,6 +8896,8 @@ \pgfplots@set@keys@from@tikz@style{every axis}% \pgfkeysdeactivatefamily{/pgfplots/scale}% % + \pgfplots@set@keys@from@tikz@style@append@to{every \pgfkeysvalueof{/pgfplots/axis type} axis}{every axis}% + % \ifpgfplots@xislinear \ifpgfplots@yislinear \pgfplots@set@keys@from@tikz@style@append@to{every linear axis}{every axis}% @@ -8609,8 +9052,11 @@ \pgfkeysalso{/pgfplots/.search also=/tikz}% % \pgfplots@set@options@sanitize + \pgfplots@notify@options@are@set } +\def\pgfplots@notify@options@are@set{}% + \def\pgfplots@install@abbrev@commands{ \let\pgfplots@orig@path=\path \let\pgfplots@orig@plot=\plot @@ -8639,7 +9085,7 @@ \or2.197224 \fi }% - \def\axisdefaultticklabel{$\pgfmathprintnumber{\tick}$}% + \def\axisdefaultticklabel{\pgfmathprintnumber{\tick}}% \def\axisdefaultticklabellog{% \pgfkeysgetvalue{/pgfplots/log number format code/.@cmd}\pgfplots@log@label@style \expandafter\pgfplots@log@label@style\tick\pgfeov @@ -8651,6 +9097,13 @@ \let\addlegendentryexpanded=\pgfplots@addlegendentryexpanded } +\let\pgfplots@late@options=\pgfutil@empty +\def\pgfplotssetlateoptions#1{% + \t@pgfplots@toka=\expandafter{\pgfplots@late@options}% + \t@pgfplots@tokb={#1}% + \xdef\pgfplots@late@options{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}% +}% + \def\pgfplots@environment{% \pgfutil@ifnextchar[{% \pgfplots@environment@opt @@ -8681,11 +9134,19 @@ % \pgfplots@stored@current@cmd % \pgfplots@stored@current@data % \pgfplots@stored@current@postcmd -\def\pgfplots@stored@plotlist@EXTRACTENTRY#1#2#3#4{% - \def\pgfplots@stored@current@precmd{#1}% - \def\pgfplots@stored@current@cmd{#2}% +\long\def\pgfplots@stored@plotlist@EXTRACTENTRY#1#2#3#4{% + % the token register stuff allows '#' inside of arguments. + \t@pgfplots@tokc={#1}% + \edef\pgfplots@stored@current@precmd{\the\t@pgfplots@tokc}% + % + \t@pgfplots@tokc={#2}% + \edef\pgfplots@stored@current@cmd{\the\t@pgfplots@tokc}% + % \def\pgfplots@stored@current@data{#3}% - \def\pgfplots@stored@current@postcmd{#4}% + % + \t@pgfplots@tokc={#4}% + \edef\pgfplots@stored@current@postcmd{\the\t@pgfplots@tokc}% + % } \def\pgfplots@init@cleared@structures{% @@ -8776,6 +9237,7 @@ \noexpand\def\noexpand\pgfplots@draw@image{% \noexpand\def\noexpand\tikz@plot@handler{\the\toks3}% \noexpand\pgfkeysdef{/pgfplots/legend image code}{\the\toks0}% + \noexpand\pgfkeyssetvalue{/pgfplots/mark list fill}{\pgfkeysvalueof{/pgfplots/mark list fill}}% \ifx\pgfplots@stylekey\pgfutil@empty \else \noexpand\pgfkeysdef{#2}{\the\toks4}% @@ -8803,21 +9265,32 @@ % % THIS IS INCOMPATIBLE WITH plain TeX and ConTeXt! Don't use it, it % doesn't hurt. -\def\pgfplots@plot@label{\pgfutil@ifnextchar[{\pgfplots@plot@label@}{\pgfplots@plot@label@[]}}% -\def\pgfplots@plot@label@[#1]#2{% +\def\pgfplots@plot@label{% + \pgfutil@ifnextchar<{% + \pgfplots@plot@label@beamer@mode + }{% + \pgfutil@ifnextchar[{\pgfplots@plot@label@{}}{\pgfplots@plot@label@{}[]}% + }% +}% +\def\pgfplots@plot@label@beamer@mode<#1>{ + \pgfutil@ifnextchar[{\pgfplots@plot@label@{<#1>}}{\pgfplots@plot@label@{<#1>}[]}% +} +% #1: optional prefix options, used to support +% \label<...>{<name>} of beamer package +\def\pgfplots@plot@label@#1[#2]#3{% \ifpgfplots@has@label@information \begingroup - \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@last@plot@style@#1\endcsname + \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@last@plot@style@#2\endcsname \expandafter\pgfplots@export@legend@image@to@macro\expandafter{\pgfplots@loc@TMPb}{/pgfplots/every crossref picture}% % \t@pgfplots@toka=\expandafter{\pgfplotsretval}% \t@pgfplots@tokb=\expandafter{\pgfplotsretvalb}% - % 1. prepare /pgfplots/refstyle={#2}: + % 1. prepare /pgfplots/refstyle={#3}: \pgfplots@auxwrite{% \noexpand\expandafter\noexpand\gdef - \noexpand\csname pgfplots@labelstyle@#2\noexpand\endcsname{\the\t@pgfplots@tokb}% + \noexpand\csname pgfplots@labelstyle@#3\noexpand\endcsname{\the\t@pgfplots@tokb}% }% - % 2. prepare \ref{#2} and \pageref{#2}: + % 2. prepare \ref{#3} and \pageref{#3}: % % There are several nasty things to consider: % a) macro expansion. Use \string to allow a safe \write @@ -8827,20 +9300,20 @@ % a "moving argument" like \caption or so, we need to use % proper '\protect'ion. % - % this here is the low-level implementation of \ref{#2}. Write it into + % this here is the low-level implementation of \ref{#3}. Write it into % the .aux file: \pgfplots@auxwrite{% \noexpand\expandafter\noexpand\gdef - \noexpand\csname pgfplots@show@ref@#2\noexpand\endcsname{% + \noexpand\csname pgfplots@show@ref@#3\noexpand\endcsname{% \the\t@pgfplots@toka }% }% % create the \label command: \let\label=\pgfplots@original@LaTeX@label - \pgfplots@label{#2}{pgfplots@show@ref@}% + \pgfplots@label[#1]{#3}{pgfplots@show@ref@}% \endgroup \else - \pgfplots@error{Can't create \string\label{#2}: it needs to be called after \string\addplot.}% + \pgfplots@error{Can't create \string\label{#3}: it needs to be called after \string\addplot.}% \fi }% @@ -8869,6 +9342,8 @@ % \pgfkeysdef{/pgfplots/colorbar source}{}% make it NO-OP here. It has already been processed. % + \pgfplots@install@local@bar@handlers% see its docs. + % % set both, pgfplots and tikz keys: % the draw is important since \addplot visualizes its stuff % with \path coordinates ... @@ -8886,6 +9361,8 @@ \let\pgfplots@drawoptions=\tikz@options \let\pgfplots@drawmodes=\tikz@mode % + \pgfplots@check@for@default@plot@mark% + % % As of February 22, the final plot processing uses % foreach stored \addplot command : % \scope[current plot style] @@ -8901,26 +9378,45 @@ % inside of this scope, so we can check for that particular % case: \pgfkeys{/tikz/every path/.append code={% - \pgfutil@ifundefined{pgfplots@drawmodes}% - {\relax}% - {% - \let\tikz@mode=\pgfplots@drawmodes -% \let\tikz@options=\pgfplots@drawoptions - }% + \pgfplots@restore@drawmodes }% }% }% }% +\newif\ifpgfplots@drawmodes@append + +\def\pgfplots@restore@drawmodes{% + \pgfutil@ifundefined{pgfplots@drawmodes}% + {\relax}% + {% + \ifpgfplots@drawmodes@append + \t@pgfplots@toka=\expandafter{\tikz@mode}% + \t@pgfplots@tokb=\expandafter{\pgfplots@drawmodes}% + \edef\tikz@mode{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \else + \let\tikz@mode=\pgfplots@drawmodes + \fi +% \let\tikz@options=\pgfplots@drawoptions + }% +}% + +\long\def\pgfplotsifissurveyphase#1#2{% + \if\pgfplots@phase@name s% + #1\relax + \else + #2\relax + \fi +}% +\long\def\pgfplotsifisvisualizationphase#1#2{\pgfplotsifissurveyphase{#2}{#1}} +\def\pgfplots@phase@name{X} + % Invokes #1 if the statement occurs within \begin{axis}...\end{axis} % and #2 if not. \long\def\pgfplotsifinaxis#1#2{% \pgfutil@ifundefined{pgfplots@is@in@axis}{#2}{#1}% }% -\pgfutil@ifundefined{label}{\relax}{% -}% - % % \begin{axis}[#1] : % @@ -9046,15 +9542,21 @@ % \def\pgfplots@environment@opt[#1]{% \begingroup - \pgfutil@ifundefined{pgfplots@is@in@axis}{}{% + \pgfplotsifinaxis{% \pgfplots@error{% Sorry, nested axis environments are not supported. Please move the inner axis environment below \string\end{axis} and use alignment options (for example named nodes, see manual) to place it at the desired position}% - }% + }{}% \def\pgfplots@is@in@axis{1}% + \let\pgfpointxy@orig=\pgfpointxy + \let\pgfqpointxy@orig=\pgfqpointxy + \let\pgfpointxyz@orig=\pgfpointxyz + \let\pgfqpointxyz@orig=\pgfqpointxyz + \global\let\pgfplots@late@options=\pgfutil@empty \pgfplots@checkandpreparefor@active@semicolon + % \pgfplots@install@abbrev@commands \pgfplots@stacked@initialise % @@ -9072,6 +9574,8 @@ % \pgfplots@set@options{#1}% % + % + % % -------------------- % Allocations: % -------------------- @@ -9089,36 +9593,16 @@ \pgfplots@datascaletrafo@initialisedtrue% there is no trafo. \fi % - \ifpgfplots@xislinear - \pgfmathfloatcreate{1}{1.0}{2147483645}% - \let\pgfplots@invalidrange@xmin=\pgfmathresult - \pgfmathfloatcreate{2}{1.0}{2147483645}% - \let\pgfplots@invalidrange@xmax=\pgfmathresult - \else - \def\pgfplots@invalidrange@xmin{16300}% - \def\pgfplots@invalidrange@xmax{-16300}% - \fi - \ifpgfplots@yislinear - \pgfmathfloatcreate{1}{1.0}{2147483645}% - \let\pgfplots@invalidrange@ymin=\pgfmathresult - \pgfmathfloatcreate{2}{1.0}{2147483645}% - \let\pgfplots@invalidrange@ymax=\pgfmathresult - \else - \def\pgfplots@invalidrange@ymin{16300}% - \def\pgfplots@invalidrange@ymax{-16300}% - \fi - \ifpgfplots@zislinear - \pgfmathfloatcreate{1}{1.0}{2147483645}% - \let\pgfplots@invalidrange@zmin=\pgfmathresult - \pgfmathfloatcreate{2}{1.0}{2147483645}% - \let\pgfplots@invalidrange@zmax=\pgfmathresult - \else - \def\pgfplots@invalidrange@zmin{16300}% - \def\pgfplots@invalidrange@zmax{-16300}% - \fi - \pgfmathfloatcreate{1}{1.0}{2147483645}% + \pgfplotsutilforeachcommasep{x,y,z}\as\pgfplots@loc@TMPa{% + \pgfplotscoordmath \pgfplots@loc@TMPa{min limit}% + \expandafter\let\csname pgfplots@invalidrange@\pgfplots@loc@TMPa max\endcsname=\pgfmathresult + \pgfplotscoordmath \pgfplots@loc@TMPa{max limit}% + \expandafter\let\csname pgfplots@invalidrange@\pgfplots@loc@TMPa min\endcsname=\pgfmathresult + }% + % + \pgfplotscoordmath{meta}{max limit}% \let\pgfplots@invalidrange@metamin=\pgfmathresult - \pgfmathfloatcreate{2}{1.0}{2147483645}% + \pgfplotscoordmath{meta}{min limit}% \let\pgfplots@invalidrange@metamax=\pgfmathresult % % These numbers will ONLY be filled for linear axis! @@ -9179,7 +9663,7 @@ \def\pgfplots@axiswide@metamin@autocompute{1}% \else \def\pgfplots@axiswide@metamin@autocompute{0}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@loc@TMPa}% \global\let\pgfplots@axiswide@metamin=\pgfmathresult \fi \pgfkeysgetvalue{/pgfplots/point meta max}\pgfplots@loc@TMPa @@ -9187,7 +9671,7 @@ \def\pgfplots@axiswide@metamax@autocompute{1}% \else \def\pgfplots@axiswide@metamax@autocompute{0}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \pgfplotscoordmath{meta}{parsenumber}{\pgfplots@loc@TMPa}% \global\let\pgfplots@axiswide@metamax=\pgfmathresult \fi % @@ -9217,6 +9701,12 @@ % Use \axispath instead: \let\path=\pgfplots@replacement@for@tikz@path \let\closedcycle=\pgfplots@path@closed@cycle + % + % defines \pgfplotsaxisupdatelimitsforcoordinate etc. + \pgfplots@prepare@axis@API + \pgfkeysvalueof{/pgfplots/execute at begin axis}% + \def\pgfplots@phase@name{s}% + % \let\pgfplots@orig@scope=\scope \let\pgfplots@orig@endscope=\endscope \let\scope=\pgfplots@replacement@for@scope @@ -9229,12 +9719,14 @@ % This command actually takes all collected (global) variables, % creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% + \def\pgfplots@phase@name{v}% \pgfutil@ifundefined{label}{\relax}{% % restore. \let\label=\pgfplots@original@LaTeX@label }% \xdef\numplots{\the\pgfplots@numplots}% \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% + \pgfkeysvalueof{/pgfplots/execute at end axis}% % % restore old \path command: \let\path=\pgfplots@orig@path @@ -9244,12 +9736,17 @@ % \pgfplotssurveyphase@setactiveplothandlers % + \expandafter\pgfplotsset\expandafter{\pgfplots@late@options}% + % %\end{axis}: % + \begingroup + \pgfplots@sys@beforenode % create a leight-weight 'current axis' node for anchor references % (which may happen during both, the axis descriptions or any % path/plot commands). \pgfmultipartnode{pgfplots@low@level@shape@INNER}{image}{current axis}{\pgfusepath{discard}}% + \endgroup % % -------------------- % All plotting commands have been read. @@ -9257,23 +9754,30 @@ % -------------------- \pgfplots@BEGIN@init@and@draw@axis \pgfplots@stacked@initialise - \pgfplots@install@local@bar@handlers \global\pgfplotslistnewempty\pgfplots@stored@markerlist \ifpgfplots@stacked@reverse % This here applies any scaling trafos and assembles a % NEW \pgfplots@stored@plotlist! \pgfplots@stacked@finalize@stored@plots \fi - \pgfplotslistforeach\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% + \pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa -%\message{Processing stored plot with precommand '\meaning\pgfplots@stored@current@precmd'; pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd' postcommand '\meaning\pgfplots@stored@current@postcmd'}% +%\message{^^JProcessing stored plot with precommand '\meaning\pgfplots@stored@current@precmd';^^J pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd'^^J postcommand '\meaning\pgfplots@stored@current@postcmd'^^J}% +%\message{DATA: '\meaning\pgfplots@stored@current@data';^^J}% % The precmd sets all required variables needed to % finalize a plot. - % @see the stream preparation routines. - \pgfplots@stored@current@precmd \ifx\pgfplots@stored@current@cmd\pgfutil@empty \pgfplots@stored@current@data% \else + \begingroup + % @see the stream preparation routines. + \pgfplots@stored@current@precmd + \pgfkeysvalueof{/pgfplots/execute at begin plot visualization}% + \ifpgfplots@threedim + \else + % axis = 2d and plot=3d is forbidden here. + \pgfplots@curplot@threedimfalse + \fi % % this code here means we REALLY have a plotting % command! @@ -9292,8 +9796,10 @@ \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI \fi \endscope + \pgfkeysvalueof{/pgfplots/execute at end plot visualization}% + \pgfplots@stored@current@postcmd + \endgroup \fi - \pgfplots@stored@current@postcmd }% \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents. % @@ -9371,12 +9877,16 @@ \def\pgfplots@anchorname{image}% that means: no shift! }{}% % + \begingroup + \pgfplots@sys@beforenode + % \ifpgfplots@deprecated@anchors \pgfplots@restore@deprecated@lowlevel@shape \pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% \else \pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% \fi + \endgroup \pgfplots@fig@alias \pgfnodealias{current axis}{\tikz@fig@name}% % @@ -9504,5 +10014,8 @@ \tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis \tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis +\pgfplotsdefineaxistype{rectangle}{% + % do nothing, this is the default anyway. +}% \catcode`\;=\pgfplots@oldcatcodesemicolon |