diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex | 2555 |
1 files changed, 1106 insertions, 1449 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 7e2316ee45a..7bf4e86b27a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -34,6 +34,7 @@ \input pgfplotscolormap.code.tex \input pgfplotsstackedplots.code.tex \input pgfplotsplothandlers.code.tex +\input pgfplots.scaling.code.tex \input pgfplotscoordprocessing.code.tex \input pgfplotsticks.code.tex \input pgfplots.paths.code.tex @@ -49,12 +50,12 @@ \newif\ifpgfplots@has@label@information \newif\ifpgfplots@yislinear \newif\ifpgfplots@zislinear -\newif\ifpgfplots@unit@vector@rescale@keep@size \newif\ifpgfplots@reverse@legend \newif\ifpgfplots@transpose@legend \newif\ifpgfplots@allow@reversal@of@rel@axis@cs \newif\ifpgfplots@scanline@verbose \newif\ifpgfplots@plot@graphics@autoadjustaxis +\newif\ifpgfplots@scaleuniformly@warning \newcount\pgfplots@numplots \newdimen\pgfplots@xmin@reg \newdimen\pgfplots@xmax@reg @@ -68,7 +69,6 @@ \newif\ifpgfplots@clip \newif\ifpgfplots@plot@coords@mathparser \pgfplots@plot@coords@mathparsertrue -\pgfplots@cliptrue \newif\ifpgfplots@enlargelimits \newif\ifpgfplots@enlargelimits@rel@thresh \newif\ifpgfplots@enlargelimits@auto @@ -121,6 +121,7 @@ \let\pgfnodepartimagebox=\pgfnodeparttextbox \newif\ifpgfplotsplothandlermesh@internaldepth \newif\ifpgfplotsplothandlermesh@hide@refined@edges +\newif\ifpgfplots@has@cell@picture \newif\ifpgfplots@collect@firstplot@astick \newif\ifpgfplots@units@use @@ -485,6 +486,16 @@ % }% +\newif\ifpgfplotsplothandlermesh@shownormals + +\pgfkeys{% + % <key name>/.define layer set={<layer list>}{<style definition>} + /handlers/.define layer set/.code 2 args={% + \pgfkeyssetvalue{\pgfkeyscurrentpath/list}{#1}% + \pgfkeysdef{\pgfkeyscurrentpath}{\pgfkeysalso{#2}}% + }% +} + \pgfkeys{% /pgfplots/search path for tikz/.search also={/tikz,/pgfplots}, /pgfplots/.is family, @@ -497,6 +508,73 @@ /pgfplots/naming commands/.is family, /pgfplots/shared with tikz/.is family, /pgfplots/error bars/.is family, + % + % pgfplots uses the following (implicit) layers: + % context: & associated layer name: \\ + % background path & axis background \\ + % grid lines & axis grid \\ + % tick lines & axis ticks \\ + % axis lines & axis lines \\ + % tick labels & axis tick labels \\ + % plots & main \\ + % axis descriptions & axis descriptions \\ + % plot marks & (see 'mark layer')\\ + % the 'axis on top' key will change that order by moving all plot- and mark-related paths upwards (they are drawn earlier). + % None of these layers is mandatory; each can be omitted. + % The magic layer name 'discard' can be used as /dev/null layer. + % + % the <layer set name> must be defined + % set layers={<layer set name>} + /pgfplots/set layers/.code={% + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{none}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfkeysalso{% + /pgfplots/activate layers=false, + /pgfplots/set layers*={}, + }% + \else + \pgfkeysalso{% + /pgfplots/activate layers=true, + /pgfplots/set layers*={#1}, + }% + \pgfplotsifinaxis{% + \pgfkeysalso{/pgfplots/cell picture=if necessary}% + }{% + % we wrote it outside of an axis. In this case, we can + % assume that it prepares multiple axis - which + % REQUIRES to disable cell pictures. + \pgfkeysalso{/pgfplots/cell picture=false}% + }% + \fi + }, + % 'activate layers=false' is the same as 'set layers=none'. + % However, 'activate layers=true' does not work unless a 'set layers' + % has been installed as well. + /pgfplots/activate layers/.is if=pgfplots@layered@graphics, + /pgfplots/activate layers/.default=true, + /pgfplots/set layers*/.code=\pgfplots@key@set@layers{#1}, + /pgfplots/set layers*/.default={/pgfplots/layers/standard}, + /pgfplots/@set layers arg/.initial=, + /pgfplots/layers/.search also=/pgfplots, + /pgfplots/layers/standard/.define layer set={axis background,axis grid,axis ticks,axis lines,axis tick labels,main,axis descriptions,axis foreground}{ + grid style= {/pgfplots/on layer=axis grid}, + tick style= {/pgfplots/on layer=axis ticks}, + axis line style= {/pgfplots/on layer=axis lines}, + label style= {/pgfplots/on layer=axis descriptions}, + legend style= {/pgfplots/on layer=axis descriptions}, + title style= {/pgfplots/on layer=axis descriptions}, + colorbar style= {/pgfplots/on layer=axis descriptions}, + ticklabel style= {/pgfplots/on layer=axis tick labels}, + axis background@ style={/pgfplots/on layer=axis background}, + 3d box foreground style={/pgfplots/on layer=axis foreground}, + }, + /pgfplots/layers/axis on top/.define layer set={axis background,main,axis grid,axis ticks,axis lines,axis tick labels,axis descriptions,axis foreground}{ + /pgfplots/layers/standard + }, + /pgfplots/on layer/.initial=, + % mark layer can be 'auto', 'like plot', or a layer name. + /pgfplots/mark layer/.initial=, /pgfplots/every axis/.style={}, /pgfplots/every axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis}}, /pgfplots/every axis/.belongs to family=/pgfplots/style commands, @@ -1349,6 +1427,11 @@ /pgfplots/anchor/.belongs to family=/pgfplots, /pgfplots/anchor/.store in= \pgfplots@anchorname, /pgfplots/anchor=south west, + /pgfplots/cell picture/.is choice, + /pgfplots/cell picture/false/.code=\def\pgfplots@cell@picture@mode{0}, + /pgfplots/cell picture/true/.code=\def\pgfplots@cell@picture@mode{1}, + /pgfplots/cell picture/if necessary/.code=\def\pgfplots@cell@picture@mode{2}, + /pgfplots/cell picture/true, % backwards compatibility /pgfplots/log origin x/.is choice, /pgfplots/log origin x/infty/.code={\def\pgfplots@log@origin@choice@x{0}}, /pgfplots/log origin x/0/.code={\def\pgfplots@log@origin@choice@x{1}}, @@ -1570,8 +1653,25 @@ /pgfplots/clip limits=true, /pgfplots/clip limits/.belongs to family=/pgfplots, /pgfplots/clip/.is if=pgfplots@clip, + /pgfplots/clip/.default=true, + /pgfplots/clip=true, + /pgfplots/clip mode/.is choice, + /pgfplots/clip mode/global/.code= \def\pgfplots@clipmode{1}, + % this choice is implemented partially only (only for plots, not for + % graphical elements): + /pgfplots/clip mode/individual/.code= \def\pgfplots@clipmode{2}, + /pgfplots/clip mode=global, % will be used if it exists: - %/pgfplots/axis background/.style={}, + /pgfplots/axis background/.style={}, + /pgfplots/axis background style/.style={/pgfplots/axis background/.append style={#1}}, + % + % the 'axis background@' style is an optimization: it will only be + % used if 'axis background' is non-empty. + % The motivation is that once 'axis background' is non-empty, a + % background path will be generated whereas the 'axis background@' + % style can be changed at will. + /pgfplots/axis background@/.style={}, + /pgfplots/axis background@ style/.style={/pgfplots/axis background@/.append style={#1}}, % % 2d: 'unit vector ratio=2 1 is relative to y axis (x is twice as large as y) % 3d: 'unit vector ratio=2 2 1 is relative to z axis (x and y are both twice as large as z) @@ -1582,9 +1682,12 @@ /pgfplots/unit vector ratio={#1}, /pgfplots/unit rescale keep size=false, }, - /pgfplots/unit rescale keep size/.is if=pgfplots@unit@vector@rescale@keep@size, + /pgfplots/unit rescale keep size/.is choice, + /pgfplots/unit rescale keep size/true/.code={\def\pgfplots@unit@vector@rescale@keep@size{1}}, + /pgfplots/unit rescale keep size/false/.code={\def\pgfplots@unit@vector@rescale@keep@size{0}}, + /pgfplots/unit rescale keep size/unless limits declared/.code={\def\pgfplots@unit@vector@rescale@keep@size{2}}, /pgfplots/unit rescale keep size/.default=true, - /pgfplots/unit rescale keep size=true, + /pgfplots/unit rescale keep size=unless limits declared, /pgfplots/axis equal/.is choice, /pgfplots/axis equal/true/.style={ /pgfplots/unit vector ratio=1 1 1, @@ -1672,27 +1775,32 @@ \def\pgfplots@loc@TMPb##1:##2\relax{% \pgfkeysalso{% /pgfplots/#1 filter/.append code={% + \pgfplots@warn@if@log@basis@unset{#1}{domain restriction}% \let\pgfplots@restrict@to@domain@orig=\pgfmathresult - \def\pgfplots@restrict@to@domain@tmp{#2}% - \ifx\pgfplots@restrict@to@domain@tmp\pgfutil@empty - % we don't have an expression. + \ifx\pgfmathresult\pgfutil@empty + % the input value is empty... skip it! \else - % evaluate the expression! - \pgfmathparse{#2}% + \def\pgfplots@restrict@to@domain@tmp{#2}% + \ifx\pgfplots@restrict@to@domain@tmp\pgfutil@empty + % we don't have an expression. + \else + % evaluate the expression! + \pgfmathparse{#2}% + \fi + \pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}% + \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult + % + \pgfplotscoordmath{default}{if less than} + {\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument + {% + \edef\pgfmathresult{\if0#4inf\else ##1\fi}% + }{% + \pgfplotscoordmath{default}{if less than} + {##2}{\pgfplots@restrict@to@domain@tmp} + {\edef\pgfmathresult{\if0#4-inf\else ##2\fi}} + {\let\pgfmathresult=\pgfplots@restrict@to@domain@orig}% + }% \fi - \pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}% - \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult - % - \pgfplotscoordmath{default}{if less than} - {\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument - {% - \edef\pgfmathresult{\if0#4inf\else ##1\fi}% - }{% - \pgfplotscoordmath{default}{if less than} - {##2}{\pgfplots@restrict@to@domain@tmp} - {\edef\pgfmathresult{\if0#4-inf\else ##2\fi}} - {\let\pgfmathresult=\pgfplots@restrict@to@domain@orig}% - }% }% }% }% @@ -1829,6 +1937,21 @@ /pgfplots/scale mode/stretch to fill/.code={\def\pgfplots@scale@mode@choice{2}}, /pgfplots/scale mode/scale uniformly/.code={\def\pgfplots@scale@mode@choice{3}}, /pgfplots/scale mode/auto, + /pgfplots/scale uniformly strategy/.is choice, + % chooses one of the other choices depending on the target + % width/height: + /pgfplots/scale uniformly strategy/auto/.code= {\def\pgfplots@scaleuniformly@choice{0}}, + % scales units only, but does not compensate limits: + /pgfplots/scale uniformly strategy/units only/.code= {\def\pgfplots@scaleuniformly@choice{1}}, + % changes only vertical limits, no horizontal limits: + /pgfplots/scale uniformly strategy/change vertical limits/.code= {\def\pgfplots@scaleuniformly@choice{2}}, + % changes X and Y limits, but not Z limits - adjusts scale accordingly: + /pgfplots/scale uniformly strategy/change horizontal limits/.code= {\def\pgfplots@scaleuniformly@choice{3}}, + /pgfplots/scale uniformly strategy/auto, + /pgfplots/scale uniformly warning/.is if=pgfplots@scaleuniformly@warning, + /pgfplots/scale uniformly warning=false, + % number of iterations for the nonlinear method involved + /pgfplots/scale uniformly strategy iter/.initial=9, /pgfplots/allow reversal of rel axis cs/.is if=pgfplots@allow@reversal@of@rel@axis@cs,% /pgfplots/allow reversal of rel axis cs/.default=true,% /pgfplots/allow reversal of rel axis cs=true,% @@ -2789,6 +2912,21 @@ /pgfplots/mesh/cols/.initial=, /pgfplots/mesh/scanline verbose/.is if=pgfplots@scanline@verbose,% /pgfplots/mesh/scanline verbose/.default=true, + % + % this is currently only a debug feature. Perhaps it will never + % reach production state because of the lacking z buffering for + % this technique. + /pgfplots/mesh/show normals/.is if=pgfplotsplothandlermesh@shownormals, + /pgfplots/mesh/show normals/.default=true, + /pgfplots/mesh/show normals length factor/.initial=50, + /pgfplots/every patch normal/.style={-stealth,red}, + % + /pgfplots/mesh/interior colormap/.code 2 args={% + \pgfplotscreatecolormap{#1}{#2}% + \pgfkeysalso{/pgfplots/mesh/interior colormap name=#1}% + }, + /pgfplots/mesh/interior colormap name/.initial=, + /pgfplots/mesh/interior colormap thresh/.initial=0, /pgfplots/mesh/check/.code={% \pgfplotsutilifstringequal{#1}{false}{% \def\pgfplots@mesh@checkmode{0}% @@ -2849,6 +2987,7 @@ /pgfplots/shader/faceted interp/.code={\def\pgfplotsplothandlermesh@shader{3}}, /pgfplots/shader/faceted, /pgfplots/faceted color/.initial=mapped color!80!black, + /pgfplots/marker layer/.initial=auto, /pgfplots/clip marker paths/.is if=pgfplots@clip@marker@paths, /pgfplots/clip marker paths/.default=true, /pgfplots/axis on top/.is if=pgfplots@axis@on@top, @@ -3195,6 +3334,7 @@ /pgfplots/compat/anchors/1.4/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/1.5/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/1.5.1/.style= {/pgfplots/compat/anchors/1.3},% + /pgfplots/compat/anchors/1.6/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/newest/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},% % @@ -3202,10 +3342,11 @@ /pgfplots/compat/empty line/pre 1.3/.code={\pgfplots@emptyline@compattrue},% FIXME: WAS \global /pgfplots/compat/empty line/1.3/.style= {/pgfplots/compat/empty line/pre 1.3},% /pgfplots/compat/empty line/1.4/.code= {\pgfplots@emptyline@compatfalse},% - /pgfplots/compat/empty line/1.5/.style= {/pgfplots/compat/empty line/1.4},% - /pgfplots/compat/empty line/1.5.1/.style= {/pgfplots/compat/empty line/1.4},% - /pgfplots/compat/empty line/newest/.style= {/pgfplots/compat/empty line/1.4},% - /pgfplots/compat/empty line/default/.style={/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/1.5/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/1.5.1/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/1.6/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/newest/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/default/.style= {/pgfplots/compat/empty line/1.4},% % /pgfplots/compat/path replacement/.is choice, /pgfplots/compat/path replacement/pre 1.3/.code= {\pgfplots@path@replace@ellipsefalse}, @@ -3213,8 +3354,9 @@ /pgfplots/compat/path replacement/1.4/.style= {/pgfplots/compat/path replacement/pre 1.3}, /pgfplots/compat/path replacement/1.5/.style= {/pgfplots/compat/path replacement/pre 1.3},% /pgfplots/compat/path replacement/1.5.1/.code= {\pgfplots@path@replace@ellipsetrue},% - /pgfplots/compat/path replacement/newest/.style= {/pgfplots/compat/path replacement/1.5.1},% - /pgfplots/compat/path replacement/default/.style={/pgfplots/compat/path replacement/pre 1.3},% + /pgfplots/compat/path replacement/1.6/.style= {/pgfplots/compat/path replacement/1.5.1}, + /pgfplots/compat/path replacement/newest/.style= {/pgfplots/compat/path replacement/1.5.1},% + /pgfplots/compat/path replacement/default/.style= {/pgfplots/compat/path replacement/pre 1.3},% %ellipse/.is if=pgfplots@path@replace@ellipse, % /pgfplots/compat/labels/.is choice, @@ -3227,6 +3369,7 @@ /pgfplots/compat/labels/1.4/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/1.5/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/1.5.1/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/1.6/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( % @@ -3235,33 +3378,100 @@ /pgfplots/compat/scaling/.is choice, /pgfplots/compat/scaling/pre 1.3/.code={% \def\pgfplots@compat@scaling@zunitfix@enable{0}% - \def\pgfplots@compat@scaling@coordmath{pgfbasic}}, + \def\pgfplots@compat@scaling@coordmath{pgfbasic}% + \def\pgfplots@compat@scaling@coordmath@final{pgfbasic}% + }, /pgfplots/compat/scaling/1.3/.style={/pgfplots/compat/scaling/pre 1.3}, /pgfplots/compat/scaling/1.4/.code={% \def\pgfplots@compat@scaling@zunitfix@enable{1}% - \def\pgfplots@compat@scaling@coordmath{float}}, + \def\pgfplots@compat@scaling@coordmath{float}% + \def\pgfplots@compat@scaling@coordmath@final{pgfbasic}% + }, /pgfplots/compat/scaling/1.5/.style={/pgfplots/compat/scaling/1.4}, /pgfplots/compat/scaling/1.5.1/.style={/pgfplots/compat/scaling/1.4}, - /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.4}, + /pgfplots/compat/scaling/1.6/.code={% + \def\pgfplots@compat@scaling@zunitfix@enable{1}% + \def\pgfplots@compat@scaling@coordmath{float}% + \def\pgfplots@compat@scaling@coordmath@final{float}% + }, + /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4}, % + /pgfplots/compat/scale mode/.is choice, + /pgfplots/compat/scale mode/pre 1.3/.code=\def\pgfplots@compat@scale@mode@compatible@mode{1},% + /pgfplots/compat/scale mode/1.3/.style= {/pgfplots/compat/scale mode/pre 1.3}, + /pgfplots/compat/scale mode/1.4/.style= {/pgfplots/compat/scale mode/pre 1.3}, + /pgfplots/compat/scale mode/1.5/.style= {/pgfplots/compat/scale mode/pre 1.3}, + /pgfplots/compat/scale mode/1.5.1/.style= {/pgfplots/compat/scale mode/pre 1.3}, + /pgfplots/compat/scale mode/1.6/.code=\def\pgfplots@compat@scale@mode@compatible@mode{0}, + /pgfplots/compat/scale mode/newest/.style={/pgfplots/compat/scale mode/1.6}, + /pgfplots/compat/scale mode/default/.style={/pgfplots/compat/scale mode/1.5}, + % + % + /pgfplots/compat/plot3graphics/.is choice, + /pgfplots/compat/plot3graphics/pre 1.3/.style= {/pgfplots/compat/plot3graphics/1.5}, + /pgfplots/compat/plot3graphics/1.3/.style= {/pgfplots/compat/plot3graphics/1.5}, + /pgfplots/compat/plot3graphics/1.4/.style= {/pgfplots/compat/plot3graphics/1.5},% + /pgfplots/compat/plot3graphics/1.5/.code= {\def\b@pgfplots@compat@plot@graphics@threedim{1}},% + /pgfplots/compat/plot3graphics/1.5.1/.style= {/pgfplots/compat/plot3graphics/1.5},% + /pgfplots/compat/plot3graphics/1.6/.code= {\def\b@pgfplots@compat@plot@graphics@threedim{2}},% + /pgfplots/compat/plot3graphics/newest/.style= {/pgfplots/compat/plot3graphics/1.6},% + /pgfplots/compat/plot3graphics/default/.style= {/pgfplots/compat/plot3graphics/1.5},% + % + % ATTENTION: there is a compatibility issue which slipped through + % the quality assurance: if tick labels where generated in scientific notation + % (NOT log tick labels; these are special), and the numbers were + % negative, the spacing changed as follows: + % pre 1.3: - 1*10^5 (binary minus sign) + % 1.3: - 1*10^5 (binary minus sign) + % 1.4: - 1*10^5 (binary minus sign) + % 1.5: -1*10^5 (unary minus sign - correct!) + % 1.6: -1*10^5 (unary minus sign - correct!) + % This is (was) a bug in the PGF number printer which has been + % fixed in the meantime; it occurred only if + % $\pgfmathprintnumber{-1e5}$ was used (i.e. with the '$' signs). + % Unfortunately, version 1.5 has been released without realizing + % the changes; I detected them right before the release of 1.6. + % Consequently, I cannot introduce compatibity switches without + % loosing compatibility. + % + % I chose to keep the correct unary minus sign. If you ever want + % to revert to the old version in order to keep spacing intact, use + % + % \pgfkeys{/pgf/compat/number printer=2.10} + % + % Risk: the size of such tick labels changed and the + % figure has been moved somewhat. + % + % Sorry. + % + % /pgfplots/compat/general/.is choice, /pgfplots/compat/general/pre 1.3/.style={/pgfplots/log origin=infty},% - /pgfplots/compat/general/1.3/.style={/pgfplots/compat/general/pre 1.3}, - /pgfplots/compat/general/1.4/.style={/pgfplots/compat/general/pre 1.3},% - /pgfplots/compat/general/1.5/.style={/pgfplots/compat/general/newest},% - /pgfplots/compat/general/1.5.1/.style={/pgfplots/compat/general/newest},% - /pgfplots/compat/general/newest/.style={/pgfplots/log origin=0}, + /pgfplots/compat/general/1.3/.style= {/pgfplots/compat/general/pre 1.3}, + /pgfplots/compat/general/1.4/.style= {/pgfplots/compat/general/pre 1.3},% + /pgfplots/compat/general/1.5/.style= {/pgfplots/compat/general/newest},% + /pgfplots/compat/general/1.5.1/.style= {/pgfplots/compat/general/newest},% + /pgfplots/compat/general/1.6/.style= {/pgfplots/compat/general/newest},% + /pgfplots/compat/general/newest/.style= {/pgfplots/log origin=0}, /pgfplots/compat/general/default/.style={/pgfplots/compat/general/newest}, + % + /pgfplots/compat/show suggested version/.is if=pgfplots@show@suggested@version, + /pgfplots/compat/show suggested version=true, + /pgfplots/compat/current/.initial=, + /pgfplots/compat/mostrecent/.initial=1.6, /pgfplots/compat/.style={% % ATTENTION: *every* /pgfplots/compat/ setting needs to accept % the same choices due to this construction: + /pgfplots/compat/current=#1,% remember the value /pgfplots/compat/anchors=#1,% /pgfplots/compat/labels=#1,% /pgfplots/compat/empty line=#1,% /pgfplots/compat/scaling=#1,% + /pgfplots/compat/scale mode=#1,% /pgfplots/compat/general=#1,% /pgfplots/compat/path replacement=#1,% + /pgfplots/compat/plot3graphics=#1,% },% /pgfplots/compat/.default=pre 1.3,% this is used if you type '\pgfplotsset{compat}' without value /pgfplots/compat=default,% this is the initial config. @@ -3454,6 +3664,22 @@ \pgfplots@error{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% } +% #1: axis (x, y, or z) +% #2: display name of context information +\def\pgfplots@warn@if@log@basis@unset#1#2{% + \pgfplots@if{pgfplots@#1islinear}{% + }{% + \pgfplots@warn@if@log@basis@unset@{#1}{#2}% + }% +}% +\def\pgfplots@warn@if@log@basis@unset@#1#2{% + \pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfplots@warning{Some input argument (#2) explicitly relies on the log basis of #1 (which is e). Please verify that this is intended and set 'log basis #1=10' otherwise. This warning will be shown only once per document.}% + \fi + \gdef\pgfplots@warn@if@log@basis@unset##1##2{}% +}% + % #1 axis (x or y) % #2 the label @@ -3751,19 +3977,37 @@ \axispath\path#1;% } \def\pgfplots@replacement@for@scope{\pgfutil@ifnextchar[{\pgfplots@replacement@for@scope@}{\pgfplots@replacement@for@scope@[]}}% -\def\pgfplots@replacement@for@scope@[#1]{% +\long\def\pgfplots@replacement@for@scope@[#1]{% \pgfplotsextra{\scope[#1]}% \begingroup % I need to apply anything which might be relevant for \addplot % here. % But I do NOT want \scope since this might already affect the low - % level output. Try this: + % level output. + % + % This here works: + % 1. set them to activate plot handlers and parameters like + % samples and domain: \tikzset{#1}% + % + % 2. we need to remember all these options inside of + % 'current plot style' -- otherwise, they would not appear + % inside of legend images and markers. + \pgfplotsplothandlersurveyaddoptions{#1}% }% \def\pgfplots@replacement@for@endscope{% \endgroup - \pgfplotsextra\endscope% + \pgfplotsextra{\endscope}% +}% + +\def\pgfplots@replacement@for@onlayer#1{% + \edef\pgfplots@loc@TMPa{#1}% + \expandafter\pgfplots@replacement@for@onlayer@{#1}% +} +\def\pgfplots@replacement@for@onlayer@#1{% + \pgfplotsextra{\pgfonlayer{#1}}% }% +\def\pgfplots@replacement@for@endonlayer{\pgfplotsextra{\endpgfonlayer}}% { % A block which handles active semicolons. @@ -3885,7 +4129,15 @@ % before. % % In contrast to \path, \pgfplotsextra can contain any command(s). -\let\pgfplotsextra=\pgfplots@path@enqueue +% +% Syntax: either +% \pgfplotsextra{<argument>} +% or +% \pgfplotsextra <argument> \endpgfplotsextra +\def\pgfplotsextra{% + \pgfutil@ifnextchar\bgroup{\pgfplots@path@enqueue}{\pgfplotsextra@}% +}% +\long\def\pgfplotsextra@#1\endpgfplotsextra{\pgfplots@path@enqueue{#1}}% % Assigns a legend. @@ -4099,6 +4351,10 @@ % settings like stroke colors or the-like. \def\pgfplots@restore@state@before@legend@style{% \pgfsetfillcolor{black}% + % disable the transformations of pgfplots. This is only used by + % pgfplots-specific plot handlers which work only if used inside + % of an axis... disable it. + \def\pgfplotsaxisvisphasetransformcoordinate##1##2##3{}% }% \def\pgfplots@split@opts{% @@ -4284,10 +4540,12 @@ \let\pgfplots@already@computed@legend@node=\pgfplots@glob@TMPa \fi \fi -%\message{Vor legende: \meaning\pgfplots@already@computed@legend@node^^J}% \ifx\pgfplots@createlegend@toname\pgfutil@empty % DRAW: + \pgfplotsgetlayerforstyle{every axis legend}% + \pgfplotsonlayer\pgfplotsretval{legend style}% \pgfplots@already@computed@legend@node + \endpgfplotsonlayer \else % apply the 'legend to name' feature: % @@ -4590,202 +4848,24 @@ } -% helper for \pgfplots@check@and@apply@datatrafo@for. -\def\pgfplots@compute@number@order@for@trafo@isdimen#1\tocount#2{% - \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{#1}}% - \pgfmathfloatparsenumber{\pgfplots@loc@TMPa}% - \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2 - \advance#2 by1\relax -} - -% helper for \pgfplots@check@and@apply@datatrafo@for. -% -\def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{% - \pgfmathfloatparsenumber{#1}% - \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2\relax - \advance#2 by1\relax -} - % Initialises the data scale transformation and applies it to any % user specified options. % % PRECONDITION: -% - all axis limits are available in float representation +% - all axis limits are already transformed % - \pgfplots@set@default@size@options has been called before +% - the scaling transformation for direction x is set up +% (\pgfplots@set@optimal@datatrafo@for@), % POSTCONDITION: -% - the scaling transformation is set up, -% - all axis limits are transformed, % - any user input (like ticks and tick labels) % EXCEPT unit vectors will reflect the changes. % % Unit vectors will be scaled later. +% @see \pgfplots@apply@datatrafo@to@axis@limits \def\pgfplots@check@and@apply@datatrafo@for#1{% \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \pgfplots@letcsname pgfplots@#1min@unscaled@as@float={pgfplots@#1min}% - \pgfplots@letcsname pgfplots@#1max@unscaled@as@float={pgfplots@#1max}% - % initialise data scale transformation - % T(x) = 10^{q-m} * x - % - \ifpgfplots@disabledatascaling - % this here is a waste of time, I know it. One could really - % safe a lot of CPU time when disabledatascaling is enabled... - % but it requires so much extra cases; I really don't want - % that! - \gdef\pgfplots@glob@TMPa{0}% - \gdef\pgfplots@glob@TMPb{0}% - \else - \begingroup - \let\data@max@order=\c@pgf@counta - \let\data@cur@order=\c@pgf@countb - \let\data@dimen=\pgf@xa - \let\data@tmp=\pgf@xb - \let\data@dimen@order=\c@pgf@countc - \let\data@EXPONENT=\c@pgf@countd - \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname - \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname - \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname - \ifpgfplots@autocompute@all@limits - \else - \pgfplotscoordmath{#1}{max}{\pgfplots@display@max@float}{\pgfplots@data@max@float}% - \let\pgfplots@data@max@float=\pgfmathresult - \pgfplotscoordmath{#1}{min}{\pgfplots@display@min@float}{\pgfplots@data@min@float}% - \let\pgfplots@data@min@float=\pgfmathresult - \fi - % -%\message{minmax = [\pgfplots@data@min@float,\pgfplots@data@max@float]}% - % Step 1: compute 'm', the data order - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@min@float - \tocount\data@cur@order - % - \data@max@order=\data@cur@order - % - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@max@float - \tocount\data@cur@order - % - \ifnum\data@cur@order>\data@max@order - \data@max@order=\data@cur@order - \fi - % - % Step 2: compute 'q', the #1-size of the axis. - %\expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty - % We have 'width' or 'height' (I always have them). - % - % Use the order of these parameters. - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@width\relax - \else - \if1\pgfplots@compat@scaling@zunitfix@enable - \data@dimen=\pgfplots@height\relax - \else - % this code here belongs to versions up to - % 1.3.1. - % It is now deprecated and produces small - % pixel differences. - \def\pgfplots@loc@TMPb{y}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@height\relax - \else - \data@dimen=42pt % this is actually different from 1.3.1: there, it was UNDEFINED. - \fi - \fi - \fi - \pgfplots@compute@number@order@for@trafo@isdimen - \data@dimen - \tocount\data@dimen@order - % This here is to avoid inaccuracies in the final - % axis rectangle size, see \pgfplots@initsizes: - %\advance\data@dimen@order by-1 - %\else - % FIXME: - % we have either the 'x=1cm' or 'y=1cm' option! - % How should I initialise the trafo!? - % \data@dimen@order=3 - %\fi - % -%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% - \data@EXPONENT=\data@dimen@order - \advance\data@EXPONENT by-\data@max@order - % Now, I introduce a loop which shall avoid cancellation of - % significant digits. - % - % Harmless Example: - % if we have data shift = -3 and - % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. - % In this case, the loop won't change anything. - % - % Critical Example: - % if we have data shift = -3 and - % max = 1980, min = 1930 then - % T(max) = 1.98 and T(min) = 1.93 - % and thus T(max)-T(min) = 0.05 . - % Considering that this is the axis range - % in which tick labels and plot points need to be computed, we - % only have two or three digits left! That happens because the - % prefix '19' is common and is cancelled in the subtraction. - % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 - % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). - % - \def\pgfplotscoordmathnotifydatascalesetfor##1{}% disable temporarily. We are just testing it. - \pgfplots@loop@CONTINUEtrue - \pgfutil@loop - \pgfplotscoordmath{#1}{datascaletrafo set params}{\the\data@EXPONENT}{0}% - \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@min@float}% - \let\pgfplots@min@fixed=\pgfmathresult - \ifpgfplots@loop@CONTINUE - \pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@max@float}% - \let\pgfplots@max@fixed=\pgfmathresult - \data@tmp=\pgfplots@max@fixed pt -%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% - \ifdim\data@tmp<0pt - % I need absolute values here: - \multiply\data@tmp by-1\relax - \fi - \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% - \data@dimen=\pgfmathresult pt - \pgfplots@loop@CONTINUEfalse - \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit. - \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy - \ifdim\data@dimen<0.0001pt - \else - \advance\data@EXPONENT by1 - \pgfplots@loop@CONTINUEtrue - \fi - \fi - \fi - %-------------------------------------------------- - % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! - % \ifdim\data@dimen>7999pt - % \advance\data@EXPONENT by-2 - % \else - % \advance\data@EXPONENT by-1 - % \fi - % \pgfplots@loop@CONTINUEfalse - % \fi - %-------------------------------------------------- - \pgfutil@repeat - \xdef\pgfplots@glob@TMPa{\the\data@EXPONENT}% - \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% - \endgroup - \fi - % COMPLETE INITIALISATION: -%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% - \pgfplotscoordmath{#1}{datascaletrafo set params}{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% + % Transform axis limits: ALREADY DONE. % - % ... and apply transformation to any user input - % - % Transform axis limits: -%\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1min\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult - % - \pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1max\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult -%\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% % Transform tick limits (if they are set): %\message{#1- display tick limits BEFORE data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% \expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty @@ -4849,11 +4929,9 @@ \pgfkeyslet{/pgfplots/minor #1tick}\pgfplots@loc@TMPc \fi % - % Transform any explicit axis unit scalings: - % WILL BE DONE LATER! + % Transform any explicit axis unit scalings: ALREADY DONE }{% % case apply trafo == false: - \pgfplotscoordmath{#1}{datascaletrafo set params}{0}{0}% \def\pgfplots@loc@TMPb{data}% \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfplots@loc@TMPb \edef\pgfplots@loc@TMPa{\csname pgfplots@firstplot@coords@#1\endcsname}% @@ -4870,8 +4948,6 @@ \pgfkeyslet{/pgfplots/minor #1tick}\pgfplotsretval \fi \fi - \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfutil@empty - \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfutil@empty }% } @@ -5005,15 +5081,18 @@ \pgfplotsthreedimfalse \fi % - \pgfplots@check@and@apply@datatrafo@for x% - \pgfplots@check@and@apply@datatrafo@for y% + \pgfplots@set@optimal@datatrafos@allaxes + % + % Now, the data scaling has been set up. + % However, it may need to be changed if axis equal and/or unit + % vector ratio changes the axis limits considerably. If so, it + % will be done in \pgfplots@initsizes + \pgfplots@apply@datatrafo@to@axis@limits x% + \pgfplots@apply@datatrafo@to@axis@limits y% \ifpgfplots@threedim - \pgfplots@check@and@apply@datatrafo@for z% + \pgfplots@apply@datatrafo@to@axis@limits z% \fi - % clear structure: - \global\let\pgfplots@firstplot@coords@x=\pgfutil@empty - \global\let\pgfplots@firstplot@coords@y=\pgfutil@empty - \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty + % \pgfplots@datascaletrafo@initialisedtrue %\message{transformed: x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax].}% % @@ -5032,6 +5111,16 @@ % \pgfplots@initsizes % + \pgfplots@check@and@apply@datatrafo@for x% + \pgfplots@check@and@apply@datatrafo@for y% + \ifpgfplots@threedim + \pgfplots@check@and@apply@datatrafo@for z% + \fi + % clear structure: + \global\let\pgfplots@firstplot@coords@x=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@y=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty + % \pgfplots@limits@ready \pgfplotspoint@initialisation % @@ -5166,100 +5255,6 @@ \pgfkeyslet{/pgfplots/#1#2}\pgfmathresult }% -% Defines \pgfmathresult to be the desired width without axis labels. -% -\def\pgfplots@initsizes@get@width@withoutlabels{% - \pgfplots@initsizes@handle@label@const{\pgfplots@width}{45pt}{width}% -} - -% Defines \pgfmathresult to be the desired height without axis labels. -\def\pgfplots@initsizes@get@height@withoutlabels{% - \pgfplots@initsizes@handle@label@const{\pgfplots@height}{45pt}{height}% -} -\def\pgfplots@initsizes@handle@label@const#1#2#3{% - \begingroup - \pgf@xa=#1\relax - % EXPECTED WIDTH = X = \pgfplots@width - % ACTUAL WIDTH = c + x * (xmax-xmin) - % where c is a CONSTANT (for the axis labels/tick labels). - % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin)) - % - % \pgf@xa := X-c: - \ifpgfplots@scale@only@axis - \else - \advance\pgf@xa by-#2 % FIXME determine 'c' correctly! - \fi - \ifdim\pgf@xa<0pt - \pgfplots@error{Error: Plot #3 `#1' is too small. This can't be realised while maintaining constant size for labels. Sorry, label sizes are only approximate. You will need to adjust your #3.}% - \pgf@xa=0pt - \fi - \edef\pgfmathresult{\the\pgf@xa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - -% Helper method for initsizes. -% -% It computes a scaling such that \pgfplots@width = SCALE * ACTUAL WIDTH. -% -% The actual width is -% c + x*(xmax-xmin) -% based on -% - c = estimated, a constant for the axis label/tick labels -% -% Arguments: -% #1: is expected to be x*(xmax-xmin) measured in pt. -% #2: the output argument for the SCALE. -\def\pgfplots@initsizes@getXscale#1\into#2{% - \begingroup - \pgfplots@initsizes@get@width@withoutlabels - % EXPECTED WIDTH = X = \pgfplots@width - % ACTUAL WIDTH = c + x * (xmax-xmin) - % where c is a CONSTANT (for the axis labels/tick labels). - % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin)) - % - % \pgf@xa := X-c: - % \pgf@xb := x*(xmax-xmin): - \pgf@xa=\pgfmathresult\relax - \pgf@xb=#1\relax - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\pgf@xa}% - {\pgf@sys@tonumber\pgf@xb}% - }% -%-------------------------------------------------- -% \message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)'; -% c=estimated, -% width-c =\the\pgf@xa, -% x*(xmax - xmin)]) = \the\pgf@xb -% -> x-scale =\pgfmathresult }% -%-------------------------------------------------- - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let#2=\pgfmathresult -} - -% The same as \pgfplots@initsizes@getXscale, just for the height. -\def\pgfplots@initsizes@getYscale#1\into#2{% - \begingroup - \pgfplots@initsizes@get@height@withoutlabels - % \pgf@xb := y*(ymax-ymin): - \pgf@xa=\pgfmathresult\relax - \pgf@xb=#1% - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\pgf@xa}% - {\pgf@sys@tonumber\pgf@xb}% - }% -%\pgfplots@message{pgfplots.sty: Computing 'y' such that 'height = c + y*(ymax-ymin)'; -% height=\pgfplots@height, -% c=estimated, -% height-c =\the\pgf@xa, -% y*(ymax[=\the\pgfplots@ycoordmaxTEX] - ymin[=\the\pgfplots@ycoordminTEX)]) = \the\pgf@xb -% -> y-scale =#2 }% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let#2=\pgfmathresult -} - \newif\ifpgfplots@avoid@emptyrange@@range@is@approx@equal % Checks whether axis limits in coordinate #1 are approximately equal. @@ -5295,7 +5290,13 @@ \fi \fi \ifpgfplots@avoid@emptyrange@@range@is@approx@equal - \pgfplots@warning{Axis range for axis #1 is approximately empty; enlarging it.}% + \begingroup + \pgfplotscoordmath{#1}{datascaletrafo inverse to fixed}{\csname pgfplots@#1min\endcsname}% + \let\pgfplots@min=\pgfmathresult + \pgfplotscoordmath{#1}{datascaletrafo inverse to fixed}{\csname pgfplots@#1max\endcsname}% + \let\pgfplots@max=\pgfmathresult + \pgfplots@warning{Axis range for axis #1 is approximately empty; enlarging it (it is [\pgfplots@min:\pgfplots@max])}% + \endgroup % the case \pgfplots@@min ~= \pgfplots@@max % % enlarge \pgfplots@@max and shrink \min: @@ -5389,756 +5390,6 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb } -% PRECONDITION: -% none -% POSTCONDITION: -% \pgfplots@default@aspect@ratio is set. -\def\pgfplots@compute@default@aspect@ratio{% - \expandafter\pgfmath@x\axisdefaultwidth - \expandafter\pgfmath@y\axisdefaultheight - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber{\pgfmath@x}}% - {\pgf@sys@tonumber{\pgfmath@y}}% - }% - \let\pgfplots@default@aspect@ratio=\pgfmathresult -} - -\def\pgfplots@set@default@size@options{% - % The axes 'x' and 'y' vectors will be scaled such that the total - % size is (\axisdefaultwidth, \axisdefaultheight). - % - % If the user specifies ONE of width OR height, - % the plot will be resized; keeping the aspect ratio. - % - \let\pgfplots@default@aspect@ratio=\pgfutil@empty - \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}% - \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}% - \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}% - %\pgfkeysgetvalue{/pgfplots/viewdir}{\pgfplots@viewdir}% - \pgfkeysgetvalue{/pgfplots/width}{\pgfplots@width}% - \pgfkeysgetvalue{/pgfplots/height}{\pgfplots@height}% - \ifx\pgfplots@width\pgfutil@empty - \def\pgfplots@user@provided@width{0}% - \else - \def\pgfplots@user@provided@width{1}% - \pgfmathparse{\pgfplots@width}% - \edef\pgfplots@width{\pgfmathresult pt}% - \fi - \ifx\pgfplots@height\pgfutil@empty - \def\pgfplots@user@provided@height{0}% - \else - \def\pgfplots@user@provided@height{1}% - \pgfmathparse{\pgfplots@height}% - \edef\pgfplots@height{\pgfmathresult pt}% - \fi - % - % CASES: - % W := 'width' option non-empty - % H := 'height' option non-empty - % - % W H - % 0 0 -> \axisdefaultwidth - % 0 1 -> determine width out of H and the default aspect ratio - % 1 X -> ok, use the user parameter. - % -> KEEP ASPECT RATIO if just one W, or H is given! - \ifx\pgfplots@width\pgfutil@empty - \ifx\pgfplots@height\pgfutil@empty - % The case W=0 H=0: - \let\pgfplots@width=\axisdefaultwidth - \let\pgfplots@height=\axisdefaultheight - \else - % The case W=0 H=1: - \pgfplots@compute@default@aspect@ratio - \expandafter\pgfmath@y\pgfplots@height - \pgfmathlog@invoke@expanded\pgfmathmultiply@{% - {\pgf@sys@tonumber{\pgfmath@y}}% - {\pgfplots@default@aspect@ratio}% - }% - \edef\pgfplots@width{\pgfmathresult pt}% - \fi - \else - \ifx\pgfplots@height\pgfutil@empty - % The case W=1 H=0: - \pgfplots@compute@default@aspect@ratio - \expandafter\pgfmath@x\pgfplots@width - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber{\pgfmath@x}}% - {\pgfplots@default@aspect@ratio}% - }% - \edef\pgfplots@height{\pgfmathresult pt}% - \else - % The case W=1 H=1: - \fi - \fi - \pgfkeyslet{/pgfplots/width}{\pgfplots@width}% - \pgfkeyslet{/pgfplots/height}{\pgfplots@height}% - % - \ifpgfplots@threedim - \pgfplots@set@default@size@options@threedim - \fi -} -\def\pgfplots@set@default@size@options@threedim{% - \pgfplots@loc@tmpfalse - \ifx\pgfplots@x\pgfutil@empty - \else - \pgfplots@loc@tmptrue - \fi - \ifx\pgfplots@y\pgfutil@empty - \else - \pgfplots@loc@tmptrue - \fi - \ifx\pgfplots@z\pgfutil@empty - \else - \pgfplots@loc@tmptrue - \fi - \ifpgfplots@loc@tmp - % oh - we have at least one of the [xyz] unit vectors! - % make sure all of them are there - \ifx\pgfplots@x\pgfutil@empty - \pgfplots@set@default@size@options@threedim@{x}{(1pt,0pt)}% - \fi - \ifx\pgfplots@y\pgfutil@empty - \pgfplots@set@default@size@options@threedim@{y}{(0pt,1pt)}% - \fi - \ifx\pgfplots@z\pgfutil@empty - \pgfplots@set@default@size@options@threedim@{z}{(0pt,1pt)}% - \fi - \pgfkeyslet{/pgfplots/view/az}\pgfutil@empty - \pgfkeyslet{/pgfplots/view/el}\pgfutil@empty - \fi -} -\def\pgfplots@set@default@size@options@threedim@#1#2{% - \pgfplots@error{Sorry, a 3D axis needs either NONE or ALL of "x,y,z". I found partial information, but (at least) '#1' is lacking... please add '#1'}% - \expandafter\def\csname pgfplots@#1\endcsname{#2}% -} - -% A helper method for \pgfplots@initsizes which -% - applies the data scaling trafo to user arguments -% - sets calls pgfset#1vec -% - computes \pgfplots@#1@veclength -% - computes \pgfplots@#1@inverseveclength -% -% #1: the vector to set (either 'x' or 'y') -% #2: the index of the vector to set (either 0 or 1) -% #3: the already precomputed temporary scale (see pgfplots@initsizes) -% #4: an output argument. It is a macro name which will be defined to -% '1' if and only if the finally set vector is parallel to the #1 axis -% of PGF, that means (x,0) for #1=x and (0,y) for #2=y. -\def\pgfplots@initsizes@setunitvector#1#2#3#4{% - \pgfkeysgetvalue{/pgfplots/#1 dir/value}\pgfplots@loc@dirvalue - \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@#1\endcsname - \ifx\pgfplots@loc@TMPb\pgfutil@empty - \def#4{1}% we have (#1,0) or (0,#1) - % -%\message{Setting unitvector(#1) to auto-computed multiple of e_#2 ...}% - \edef\pgfplots@loc@TMPa{#3}% - \if r\pgfplots@loc@dirvalue - \edef\pgfplots@loc@TMPa{-#3}% - \fi - \begingroup - \pgf@xa=#3\relax - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% - \endgroup -% FIXME : '\pgfplots@loc@TMPa' contains 'pt' leading to missing -% character warning! - \ifcase#2\relax - \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPa}{0pt}}% - \pgfmathabs@{\pgfplots@glob@TMPb}% - \or - \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPa}}% - \pgfmathabs@{\pgfplots@glob@TMPb}% - \or - \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}}% - \ifdim\pgfplots@loc@TMPa=0pt - \def\pgfmathresult{0}% - \else - \edef\pgf@marshal{% - {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}% - {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}% - }% - \expandafter\pgfmathveclen\pgf@marshal - \fi - \fi - % The numbers 1/||e_x|| and 1/||e_y|| are used by the tick - % placement code to convert between logical and physical - % coordinates. - \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - \pgfplotsmath@ifzero{\pgfmathresult}{% - \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% - }{% - \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult - }% - \else - % Ok, we have a user-defined unit vector. - % - % That means we also need to apply the scaling trafo! - % - \if r\pgfplots@loc@dirvalue - \def\pgfplots@loc@dirvalue{-}% - \else - \def\pgfplots@loc@dirvalue{}% - \fi - % - % 1. Check whether we have a complete vector of type (x,y): - \expandafter\pgfutil@in@\expandafter(\expandafter{\pgfplots@loc@TMPb}% - \ifpgfutil@in@ - % YES: we have (x,y): - % - \def#4{0}% we DON'T have (#1,0) or (0,#1). At least I think so. - % -%\message{Setting unitvector(#1) to non-standard \csname pgfplots@#1\endcsname ...}% - \def\pgfplots@loc@TMPa(##1,##2){% - \pgfplotscoordmath{default}{parse}{##1}% - \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}% - \let\pgfplots@loc@TMPb=\pgfmathresult - \pgfplotscoordmath{default}{parse}{##2}% - \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}% - \let\pgfplots@loc@TMPc=\pgfmathresult - % - \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPb}% - \let\pgfplots@loc@TMPb=\pgfmathresult - \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfplots@loc@TMPc}% - \let\pgfplots@loc@TMPc=\pgfmathresult - }{}% - \csname pgfset#1vec\endcsname{% - \pgfqpoint - {\pgfplots@loc@dirvalue\pgfplots@loc@TMPb pt} - {\pgfplots@loc@dirvalue\pgfplots@loc@TMPc pt}}% - }% - \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb% - % - \edef\pgf@marshal{% - {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}% - {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}% - }% - \expandafter\pgfmath@basic@veclen@\pgf@marshal - % - \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - \pgfplotsmath@ifzero{\pgfmathresult}{% - \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% - }{% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult - }% - \else - % NO we simply have a scalar value. - \def#4{1}% we have (#1,0) or (0,#1) -%\message{Setting unitvector(#1) to \csname pgfplots@#1\endcsname * e_{#2}...}% - \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \pgfplotscoordmath{default}{parse}{\csname pgfplots@#1\endcsname}% - \pgfplotscoordmath{default}{tofixed}{\pgfmathresult}% - \pgfplotscoordmath{#1}{datascaletrafo noshift inverse to fixed}{\pgfmathresult}% - \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% - }{\relax}% - \begingroup - \pgf@xa=\pgfplots@loc@TMPb\relax - \if r\pgfplots@loc@dirvalue - \multiply\pgf@xa by-1 - \fi - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% - \endgroup - \ifcase#2\relax - \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}% - \pgfmath@basic@abs@{\pgfplots@glob@TMPb}% - \or - \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPb}}% - \pgfmath@basic@abs@{\pgfplots@glob@TMPb}% - \or - \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}% - \ifdim\pgfplots@loc@TMPb=0pt - \def\pgfmathresult{0}% - \else - \edef\pgf@marshal{% - {\expandafter\pgf@sys@tonumber\csname pgf@#1x\endcsname}% - {\expandafter\pgf@sys@tonumber\csname pgf@#1y\endcsname}% - }% - \expandafter\pgfmath@basic@veclen@\pgf@marshal - \fi - \fi - \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - \pgfplotsmath@ifzero{\pgfmathresult}{% - \expandafter\def\csname pgfplots@#1@inverseveclength\endcsname{infty}% - }{% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult - }% - \fi - \fi -%\message{-> got unitvector(#1) = (\the\csname pgf@#1x\endcsname, \the\csname pgf@#1y\endcsname).^^J}% -}% - -% Applies the 'axis equal' feature. -% -% PRECONDITION: -% - final unit vectors have been set -% - final axis limits are given in transformed range -% - \pgfplots@set@default@size@options has been invoked before -% -% POSTCONDITION: -% - unit vectors have been set to equal length, -% - axis limits have been rescaled such that the axis dimensions -% remain fixed -% -% There is just one algorithmic difficulty: the data scaling -% transformation. All unit vector length above are only meaningful in -% the UNTRANSFORMED range, so we have to mingle with the scaling -% transformation. -\def\pgfplots@apply@unit@ratio{% - \pgfkeysgetvalue{/pgfplots/unit vector ratio}\pgfplots@unit@vector@ratio - \ifx\pgfplots@unit@vector@ratio\pgfutil@empty - \else - \edef\pgfplots@unit@vector@ratio{\pgfplots@unit@vector@ratio\space1 1 }% - % - % Step 1: compute the unit vector which STAYS CONSTANT. - % - \pgfkeysgetvalue{/pgfplots/unit vector ratio axis}\pgfplots@apply@unit@ratio@reference - \ifx\pgfplots@apply@unit@ratio@reference\pgfutil@empty - \pgfplots@apply@unit@ratio@find@reference% - \fi - % - % FIXME : I could spent some attention here to save work: - % both, unit ratios and the resulting scales are computed at - % least twice (once in \pgfplots@apply@unit@ratio@find@reference and once in the - % following). - \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI - % -%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@apply@unit@ratio@reference; ratio \pgfplots@unit@ratio@x\space \pgfplots@unit@ratio@y\space \pgfplots@unit@ratio@z.^^J}% - % - % Step 2: apply the scaling: - \pgfplots@rescale@unit@vector@reltoreference{x}{\pgfplots@unit@ratio@x}% - \pgfplots@rescale@unit@vector@reltoreference{y}{\pgfplots@unit@ratio@y}% - \ifpgfplots@threedim - \pgfplots@rescale@unit@vector@reltoreference{z}{\pgfplots@unit@ratio@z}% - \fi - \fi -}% - -% This macro determines the reference axis for unit vector rescaling. -% The reference axis remains unscaled (it gets scaling factor 1 if you -% want it this way). -% -% The other axes are scaled such that the desired unit vector ratios -% are fulfilled. -% -% The idea to select a reference axis is as follows: -% 1. Every unit vector scaling factor s should fulfill s <= 1. -% 2. Choose the reference axis such that the minimal amount of scaling -% is performed. -% -% The motivation for (1) is: if all involved scaling factors are at -% most 1, the resulting picture will only become *smaller*. -% Consequently, we can simply enlarge axis limits to restore the -% original width/height! -% -% The motivation for (2) is: a huge amount of scaling might reduce the -% size of the image too much. Of course, the figure will be enlarged -% to fit the original width/height, but most of it will be empty. So, -% use the smallest scaling. -% -% @POSTCONDITION The reference axis is stored in -% \pgfplots@apply@unit@ratio@reference . -% -% @see the key 'unit vector ratio axis=y' which allows to manually -% select the reference axis. This will illustrate what happens here. -\def\pgfplots@apply@unit@ratio@find@reference{% - % - \begingroup - \let\pgfplots@ONE=\pgf@x - \global\pgfplots@ONE=1.002pt - % - \def\pgfplots@optimum@sofar@axis{}% - \let\pgfplots@optimum@sofar@value=\pgf@y - \global\pgfplots@optimum@sofar@value=16000pt - % - %\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits - % - \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty - % set \pgfplots@loc@TMPa := 1 if and only if the axis is 3d - \def\pgfplots@loc@TMPa{0}% - \ifpgfplots@threedim - % ah, it IS 3d! - \ifdim\pgfplots@z@veclength pt=0pt - % hm. It has view = {0}{90} (i.e. it is 2d) - \def\pgfplots@loc@TMPa{0}% - \else - \def\pgfplots@loc@TMPa{1}% - \fi - \fi - \if1\pgfplots@loc@TMPa - % 3D is more complicated than 2D: - % for every fixed reference axis, we have to check *two* - % scaling factors. - % - % Furthermore, the optimality condition (2) needs to be - % performed on the maximum max{1-s_a, 1-s_b} provided both of - % these numbers are positive. - % - \def\pgfplots@check@##1##2{% - % PRECONDITION: \pgfplots@apply@unit@ratio@reference is defined. - % - % renormalize \pgfplots@unit@[xyz] : - \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI - % - % compute s_a : - \pgfplots@getscale@unit@vector@reltoreference ##1{\csname pgfplots@unit@ratio@##1\endcsname}% - \let\pgfplots@scale@a=\pgfmathresult - % - % compute s_b : - \pgfplots@getscale@unit@vector@reltoreference ##2{\csname pgfplots@unit@ratio@##2\endcsname}% - \let\pgfplots@scale@b=\pgfmathresult - % - % check if the actual choice of - % \pgfplots@apply@unit@ratio@reference is FEASIBLE. - % That is the case if s_a <= 1 && s_b <= 1. - % We check - % (1 - s_a >= 0 ) && ( 1 - s_b >= 0 ) - % instead, since I need the value - % max( 1-s_a, 1-s_b ) - % anyway. - \def\pgfplots@ref@is@feasible{1}% - \pgf@xa=\pgfplots@ONE \advance\pgf@xa by-\pgfplots@scale@a pt - \ifdim\pgf@xa<0sp - \def\pgfplots@ref@is@feasible{0}% - \else - \pgf@xb=\pgfplots@ONE \advance\pgf@xb by-\pgfplots@scale@b pt - \ifdim\pgf@xb<0sp - \def\pgfplots@ref@is@feasible{0}% - \fi - \fi - % compute max(1-s_a,1-s_b) into \pgf@xa: - % pgf@xa= max(pgf@xa,pgf@xb): - \ifdim\pgf@xb>\pgf@xa \pgf@xa=\pgf@xb \fi - \if1\pgfplots@ref@is@feasible - \ifdim\pgf@xa<\pgfplots@optimum@sofar@value - % Ah, ok. The actual choice is BETTER as it - % involves less scaling. - % - % Remember it! - \let\pgfplots@optimum@sofar@axis=\pgfplots@apply@unit@ratio@reference - \global\pgfplots@optimum@sofar@value=\pgf@xa - \fi - \fi -%\message{^^Junit vector ratio 3D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfplots@ref@is@feasible. \if1\pgfplots@ref@is@feasible max=\the\pgf@xa. \fi Optimum so far: value =\the\pgfplots@optimum@sofar@value\space for axis \pgfplots@optimum@sofar@axis.^^J}% - }% - % - % Check 'x' as reference : - \def\pgfplots@apply@unit@ratio@reference{x}% - \pgfplots@check@ yz% - % - % Check 'y' as reference : - \def\pgfplots@apply@unit@ratio@reference{y}% - \pgfplots@check@ xz% - % - % Check 'z' as reference : - \def\pgfplots@apply@unit@ratio@reference{z}% - \pgfplots@check@ xy% - % - \else - % 2D is much simpler: find the scale s which fulfills s <= 1. - % One of them MUST fulfill it. - % - % try 'x' axis as reference: - \def\pgfplots@apply@unit@ratio@reference{x}% - % - % renormalize: - \expandafter\pgfplots@apply@unit@ratio@prepareratios\pgfplots@unit@vector@ratio\pgfplots@EOI - % - % compute scaling factor: - \pgfplots@getscale@unit@vector@reltoreference y\pgfplots@unit@ratio@y% - % -%\message{^^Junit vector ratio 2D searching reference: checking \pgfplots@apply@unit@ratio@reference. feasable=\pgfmathresult < 1: \ifdim\pgfmathresult pt <\pgfplots@ONE YES-> use x\else NO->use y\fi^^J}% - % and check (1). The condition (2) is irrelevant; it is met - % anyway. - \ifdim\pgfmathresult pt<\pgfplots@ONE - \def\pgfplots@optimum@sofar@axis{x}% - \else - \def\pgfplots@optimum@sofar@axis{y}% - \fi - \fi - \else -%\message{^^Junit vector ratio chose \pgfplots@optimum@sofar@axis\space to fulfill explicitly provided limits (at least partially).^^J}% - \fi - % - \ifx\pgfplots@optimum@sofar@axis\pgfutil@empty - \ifpgfplots@threedim - \ifdim\pgfplots@z@veclength pt=0pt - \def\pgfplots@optimum@sofar@axis{y}% - \else - \def\pgfplots@optimum@sofar@axis{z}% - \fi - \else - \def\pgfplots@optimum@sofar@axis{y}% - \fi - \pgfplots@warning{The algorithm to implement 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=\pgfplots@optimum@sofar@axis'.}% - \fi - \let\pgfplots@apply@unit@ratio@reference=\pgfplots@optimum@sofar@axis - \pgfmath@smuggleone\pgfplots@apply@unit@ratio@reference - \endgroup -}% -\def\pgfplots@apply@unit@ratio@find@reference@checkexplicitlimits{% - \ifpgfplots@autocompute@ymax \else \def\pgfplots@optimum@sofar@axis{y}\fi - \ifpgfplots@autocompute@ymin \else \def\pgfplots@optimum@sofar@axis{y}\fi - \ifpgfplots@autocompute@xmax \else \def\pgfplots@optimum@sofar@axis{x}\fi - \ifpgfplots@autocompute@xmin \else \def\pgfplots@optimum@sofar@axis{x}\fi - \ifpgfplots@threedim - \ifpgfplots@autocompute@zmax \else \def\pgfplots@optimum@sofar@axis{z}\fi - \ifpgfplots@autocompute@zmin \else \def\pgfplots@optimum@sofar@axis{z}\fi - \fi -}% - -\def\pgfplots@apply@unit@ratio@prepareratios#1 #2 #3 #4\pgfplots@EOI{% - \def\pgfplots@unit@ratio@x{#1}% - \def\pgfplots@unit@ratio@y{#2}% - \def\pgfplots@unit@ratio@z{#3}% - % - % 'unit vector ratio' is measured relative to the y axis for 2d - % and relative to the z axis for 3d plots. - % renormalize such that it is relative to - % \pgfplots@apply@unit@ratio@reference. - % - % Furthermore, renormalize such that - % unit@ratio@\pgfplots@apply@unit@ratio@reference is 1. - \pgfmathreciprocal@{\csname pgfplots@unit@ratio@\pgfplots@apply@unit@ratio@reference\endcsname}% - \let\pgfplots@loc@TMPa=\pgfmathresult - \ifpgfplots@threedim - \if z\pgfplots@apply@unit@ratio@reference - \else - \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}% - \let\pgfplots@loc@TMPa=\pgfmathresult - \fi - % - \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}% - \let\pgfplots@unit@ratio@x=\pgfmathresult - % - \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}% - \let\pgfplots@unit@ratio@y=\pgfmathresult - % - \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@z}% - \let\pgfplots@unit@ratio@z=\pgfmathresult - \else - \if y\pgfplots@apply@unit@ratio@reference - \else - \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}% - \let\pgfplots@loc@TMPa=\pgfmathresult - \fi - % - \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@x}% - \let\pgfplots@unit@ratio@x=\pgfmathresult - % - \pgfmathmultiply@{\pgfplots@loc@TMPa}{\pgfplots@unit@ratio@y}% - \let\pgfplots@unit@ratio@y=\pgfmathresult - % - \def\pgfplots@unit@ratio@z{<unused>}% - \fi - % -}% - - -% Computes a new unit vector E_#1 for direction #1 such that -% ||E_#1|| = #2 * ||e_reference||. -% Here, #2 is a scaling factor and e_reference is a reference axis. -% The reference axis is stored in -% \pgfplots@apply@unit@ratio@reference, the macro contains one of -% {x,y,z}. -% -% The data limits for '#1' will be enlarged as well (for 'unit rescale -% keep size'). -% -% #1 is the axis which should be scaled (i.e. #1 in {x,y,z}). -% It is allowed if #1 = \pgfplots@apply@unit@ratio@reference. In this -% case, you can provide a scale '#2' to rescale the axis. -% -% #2 is a desired scale, relative to -% \pgfplots@apply@unit@ratio@reference. #2 should be a number without -% unit. -% -% The parameter \pgfplots@apply@unit@ratio@reference is also one of -% {x,y,z}. -% -\def\pgfplots@rescale@unit@vector@reltoreference#1#2{% - \def\pgfplots@loc@TMPa{0}% - \if#1\pgfplots@apply@unit@ratio@reference - \pgfplotsmath@ifapproxequal@dim{#2pt}{1pt}{0.0002pt}{% - }{% - \def\pgfplots@loc@TMPa{1}% - }% - \else - \def\pgfplots@loc@TMPa{1}% - \fi - \ifdim\csname pgfplots@#1@veclength\endcsname pt=0pt - \def\pgfplots@loc@TMPa{0}% - \fi - \if1\pgfplots@loc@TMPa - % - \pgfplots@getscale@unit@vector@reltoreference{#1}{#2}% - \global\let\pgfplots@glob@TMPa=\pgfmathresult - % -%\message{Rescaling '#1' by \pgfplots@glob@TMPa.^^J}% - \if x#1 - \pgfsetxvec{\pgfplotsqpointxy{\pgfplots@glob@TMPa}{0}}% - \else - \if y#1 - \pgfsetyvec{\pgfplotsqpointxy{0}{\pgfplots@glob@TMPa}}% - \else - \if z#1 - \pgfsetzvec{\pgfplotsqpointxyz{0}{0}{\pgfplots@glob@TMPa}}% - \fi - \fi - \fi - % - \pgfmathmultiply@{\csname pgfplots@#1@veclength\endcsname}{\pgfplots@glob@TMPa}% - \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - % - \pgfmathreciprocal@\pgfplots@glob@TMPa - \global\let\pgfplots@glob@TMPb=\pgfmathresult - % - \pgfmathmultiply@{\csname pgfplots@#1@inverseveclength\endcsname}{\pgfplots@glob@TMPb}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult - % - % - \pgfplots@apply@unit@vector@rescale@keep@size{#1}{\pgfplots@glob@TMPb}% - % - \fi -} - -% Updates the #1 axis limits such that the axis' dimensions -% stay the same after scaling the #1 unit vector by a scale 's'. -% -% PRECONDITION: -% - the #1 unit vector has been rescaled by a factor s. -% For example, e_xnew := e_x * 0.5 . -% -% POSTCONDITION: -% - the axis limits are enlarged by a factor 1/s such that -% 1/s (#1max - #1min) * e_xnew = (#1max- #1min) * e_x. -% -% In other words, the unit vector rescale is componensated by -% modifying the axis limits. -% -% My idea is to add half of the new range to 'max' and -% subtract the other half from 'min': -% 1/s( xmax - xmin) = (xmax+0.5d) - (xmin-0.5d) = xmax - xmin +d -% with d = 1/s (xmax-xmin) - (xmax-xmin) = (1/s - 1) (xmax-xmin) -% -% #1: either x, y or z. It denotes the direction which has been -% modified. -% #2: the INVERSE of the scaling factor, #2 = 1/s . -% -\def\pgfplots@apply@unit@vector@rescale@keep@size#1#2{% - \ifpgfplots@unit@vector@rescale@keep@size - % -%\message{'unit rescale keep size': Resizing data range for #1: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}% - \pgfmathsubtract@{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#1min\endcsname}% - \begingroup - \pgf@xa=\pgfmathresult pt - \pgfmathsubtract@{#2}{1.0}% - \pgf@xa=\pgfmathresult \pgf@xa - \divide\pgf@xa by2 - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% - \endgroup - \pgfmathsubtract@{\csname pgfplots@#1min\endcsname}{\pgfplots@glob@TMPb}% - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult - \pgfmathadd@{\csname pgfplots@#1max\endcsname}{\pgfplots@glob@TMPb}% - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult -%\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [+- \pgfplots@glob@TMPb]}% - % - % Update auxiliary data members: - \pgfplots@visphase@notify@changeofcanvaslimits{#1}% - \fi -}% - -% #1: an axis which should be scaled -% #2: the desired final ratio ||e_#1||/||e_ref|| -\def\pgfplots@getscale@unit@vector@reltoreference#1#2{% - % - % If the datascaling transformation is active (which is almost - % everytime the case here), we have a transformation - % T^{-1}(x)= 10^scale * x - % with different scales for every axis. - % - % If the datascaling transformation is NOT active, scale is 0 - % and T^{-1} = Identity. - % - % Note that the datascaling transformation also has - % translations (shifts). These are not important here. - % - % Goal: - % compute E_#1 such that - % #2* || T^{-1} e_ref || = || T^{-1} E_#1 || - % where T^{-1} is the data scaling transformation and e_ref the - % reference unit vector. Keep in mind that there are - % *different* data scaling transformations for each axis. - % - % We are given e_ref and e_#1 and the desired aspect ratio - % between e_ref and E_#1, which is available as #2. - % - % So: T^{-1} E_#1 := s* T^{-1} e_#1 where - % s = #2 * ||T^{-1} e_ref|| / || T^{-1} e_#1 || - % = |10^{scale_ref}| / |10^{scale_#1}| * #2 * || e_ref|| / ||e_#1||. - % - % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1. - % - % -> compute 's'! - % - % Part 1: compute - % #2 * ||e_ref|| / ||e_#1||. - % - \def\pgfplots@loc@TMPa{1}% - \ifdim\csname pgfplots@#1@veclength\endcsname pt=0pt - \def\pgfplots@loc@TMPa{0}% - \else - \ifdim\csname pgfplots@\pgfplots@apply@unit@ratio@reference @veclength\endcsname pt=0pt - \def\pgfplots@loc@TMPa{0}% - \fi - \fi - \if0\pgfplots@loc@TMPa - \def\pgfmathresult{16001}% - \else - \pgfmathmultiply@ - {\csname pgfplots@\pgfplots@apply@unit@ratio@reference @veclength\endcsname} - {\csname pgfplots@#1@inverseveclength\endcsname}% - \pgfmathmultiply@ - {\pgfmathresult}% - {#2}% - \global\let\pgfplots@glob@TMPa=\pgfmathresult - % - % also compute 1/s, required as temporary value: - %\pgfmathmultiply@ - % {\csname pgfplots@\pgfplots@apply@unit@ratio@reference @inverseveclength\endcsname} - % {\csname pgfplots@#1@veclength\endcsname}% - %\ifdim#2pt=1pt - %\else - % \pgfmathdivide@{\pgfmathresult}{#2}% - %\fi - %\global\let\pgfplots@glob@TMPb=\pgfmathresult - % - % Part 2: handle data scaling trafo scales: - \begingroup - \def\pgfplots@tmp@exponentref{0}% - \def\pgfplots@tmp@exponentK{0}% - \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@apply@unit@ratio@reference }{% - \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@apply@unit@ratio@reference }% - }{}% - \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}% - }{}% - \c@pgf@counta=\pgfplots@tmp@exponentref\relax - \advance\c@pgf@counta by-\pgfplots@tmp@exponentK\relax - \ifnum\c@pgf@counta=0 - \else - \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}% - \global\let\pgfplots@glob@TMPa=\pgfmathresult - % \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}% - % \global\let\pgfplots@glob@TMPb=\pgfmathresult - \fi - \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}% - \endgroup - \let\pgfmathresult=\pgfplots@glob@TMPa - \fi -%\message{\string\pgfplots@getscale@unit@vector@reltoreference{#1}{#2} (reference \pgfplots@apply@unit@ratio@reference) = \pgfmathresult.^^J}% -} % should be invoked whenever \pgfplots@#1min or \pgfplots@#1max have % been changed during the visualization phase (for example, axis equal @@ -6206,171 +5457,8 @@ \if1\pgfplots@glob@TMPc #3\else #4\fi }% -% PRECONDITION: -% - final axis limits are given in transformed range -% - \pgfplots@set@default@size@options has been invoked before -% POSTCONDITION: -% - the current x,y and z unit vectors are defined properly; -% - the fast-access registers are initialised for the axis limits, -% - the following macros are assigned: -% \pgfplots@[xyz]@veclength -% \pgfplots@[xyz]@inverseveclength -% \pgfplotspointxaxis -% \pgfplotspointyaxis -% \pgfplotspointzaxis -% \pgfplotspointcenter -% \pgfplotspointminminmin -% -\def\pgfplots@initsizes{% - % INIT. - % - % - \pgfplots@xmin@reg=\pgfplots@xmin pt % - \pgfplots@xmax@reg=\pgfplots@xmax pt % - \pgfplots@ymin@reg=\pgfplots@ymin pt % - \pgfplots@ymax@reg=\pgfplots@ymax pt % - \ifpgfplots@threedim - \pgfplots@zmin@reg=\pgfplots@zmin pt % - \pgfplots@zmax@reg=\pgfplots@zmax pt % - \fi - % - % - %----------------------------------------- - % PROCESS THE 'width' and 'height' options - %----------------------------------------- - % - % - \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}% - \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}% - \ifpgfplots@threedim - \def\pgfplots@tmpZscale{1pt}% - \else - \def\pgfplots@tmpZscale{0pt}% - % FIXME - \let\pgfplots@view@el=\pgfutil@empty - \let\pgfplots@view@az=\pgfutil@empty - \fi - \ifx\pgfplots@view@az\pgfutil@empty - % Note that in presence of "x,y,z" options, the - % \pgfplots@set@default@size@options RESETS /pgfplots/view/az. - % - %\let\pgfplots@rectangle@width=\pgfutil@empty - %\let\pgfplots@rectangle@height=\pgfutil@empty - \def\pgfplots@view@dir@threedim@x{0}% - \def\pgfplots@view@dir@threedim@y{0}% - \def\pgfplots@view@dir@threedim@z{1}% - % - \pgfpointdiff - {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}} - {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}% - % only used temporarily in this macro to compute the correct - % length for unit vectors: - \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}% - \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}% - % - \ifx\pgfplots@x\pgfutil@empty - \ifx\pgfplots@width\pgfutil@empty - \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}% - \fi - \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale - %\ifpgfplots@scale@only@axis - % \let\pgfplots@rectangle@width=\pgfplots@width - %\fi - \else - \def\pgfplots@tmpXscale{1}% - \fi - % - \ifx\pgfplots@y\pgfutil@empty - \ifx\pgfplots@height\pgfutil@empty - \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% - \fi - \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale - %\ifpgfplots@scale@only@axis - % \let\pgfplots@rectangle@height=\pgfplots@height - %\fi - \else - \def\pgfplots@tmpYscale{1}% - \fi - % - \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% - \edef\pgfplots@tmpXscale{\the\pgf@x}% - \edef\pgfplots@tmpYscale{\the\pgf@y}% - % - \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}% - \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}% - \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}% - \ifcase\pgfplots@scale@mode@choice\relax - % scale mode=auto : do nothing in this context. - \else - \pgfplots@scale@axisbox@to@widthheight - \fi - \ifpgfplots@threedim - \pgfplotsgetnormalforcurrentview - \fi - \else - % 3D case by `view': - \let\pgfplots@x=\pgfutil@empty - \let\pgfplots@y=\pgfutil@empty - \let\pgfplots@z=\pgfutil@empty - % this invokes \pgfplots@scale@plotbox@to@widthheight automatically. - \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}% - \if1\pgfplots@tmp@xisaxisparallel% - \def\pgfplots@tmp@yisaxisparallel{1}% - \fi - \fi -%\message{Pgfplots debug: initialised unit vectors to x=(\the\pgf@xx,\the\pgf@xy), y=(\the\pgf@yx,\the\pgf@yy), z=(\the\pgf@zx,\the\pgf@zy), n = (\pgfplots@view@dir@threedim@x,\pgfplots@view@dir@threedim@y,\pgfplots@view@dir@threedim@z).^^J }% - % - \let\pgfplotsmathfloatviewdepthxyz@=\pgfplotsmathfloatviewdepthxyz@infigure - \let\pgfplotsmathviewdepthxyz@=\pgfplotsmathviewdepthxyz@infigure - % - \pgfplotsmath@ifzero{\pgfplots@x@veclength}{\pgfplots@hide@xtrue\pgfplots@shownothingof@xtrue}{}% - \pgfplotsmath@ifzero{\pgfplots@y@veclength}{\pgfplots@hide@ytrue\pgfplots@shownothingof@ytrue}{}% - \ifpgfplots@threedim - \pgfplotsmath@ifzero{\pgfplots@z@veclength}{\pgfplots@hide@ztrue\pgfplots@shownothingof@ztrue}{}% - \else - \if1\pgfplots@tmp@xisaxisparallel% - \if1\pgfplots@tmp@yisaxisparallel% - % Optimize for axis-parallel case! - % puh. Did not make any measureable difference!? Ok... - \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal - \fi - \fi - \fi - \pgfplots@apply@unit@ratio - % - \pgfplots@axis@apply@post@scale x - \pgfplots@axis@apply@post@scale y - \ifpgfplots@threedim - \pgfplots@axis@apply@post@scale z - \fi -} -\def\pgfplots@axis@apply@post@scale#1{% - % - \pgfkeysgetvalue{/pgfplots/#1 post scale}\pgfmathresult - \ifx\pgfmathresult\pgfutil@empty - \else - \pgfmathparse{\pgfmathresult}% - \ifdim\pgfmathresult pt=1pt - \else - \let\pgfplots@loc@TMPa=\pgfmathresult - \csname pgf@#1x\endcsname=\pgfmathresult\csname pgf@#1x\endcsname - \csname pgf@#1y\endcsname=\pgfmathresult\csname pgf@#1y\endcsname - % - \pgfmathmultiply@{\csname pgfplots@#1@veclength\endcsname}{\pgfplots@loc@TMPa}% - \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult - % - \pgfmathdivide@{\csname pgfplots@#1@inverseveclength\endcsname}{\pgfplots@loc@TMPa}% - \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult - \fi - \fi -} -% This here is a low-weight node. It can ONLY be used during axis -% descriptions and is completely useless otherwise. -% -% See pgfplots@low@level@shape below. -\pgfdeclareshape{pgfplots@low@level@shape@INNER}{% - \nodeparts{image}% +\def\pgfplots@low@level@shape@INNER@define{% \anchor{image}{\pgfpointorigin}% % % @@ -6413,8 +5501,17 @@ {\pgfplotsqpointdescriptionxy{0}{0}} {\pgfplotsqpointdescriptionxy{1}{0}}% }% +} + +% This here is a low-weight node. It can ONLY be used during axis +% descriptions and is completely useless otherwise. +% +% See pgfplots@low@level@shape below. +\pgfdeclareshape{pgfplots@low@level@shape@INNER}{% + \nodeparts{image}% %% %% + \pgfplots@low@level@shape@INNER@define %% %% \anchorborder{}% @@ -6432,12 +5529,14 @@ % of anchors. \pgfdeclareshape{pgfplots@low@level@shape}{% % The '(0,0)' point is the LOWER LEFT OUTER CORNER. - \savedanchor\upperrightcorner{ - \global\pgf@x=\wd\pgfnodepartimagebox - \global\pgf@y=\ht\pgfnodepartimagebox + \savedanchor\upperrightcorner{% + % FIXME : is this correct? + \pgfplotspointupperrightcorner + %\global\pgf@x=\wd\pgfnodepartimagebox + %\global\pgf@y=\ht\pgfnodepartimagebox }% \savedanchor\lowerleftinnercorner{% - \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% + \pgfplotspointlowerleftinnercorner% }% \savedanchor\innerdiagonal{\pgfplotspointbbdiagonal}% \savedanchor\origin{% @@ -6450,7 +5549,6 @@ \global\pgf@y=0pt % }% % - % \anchor{center}{% \pgfpointadd {\lowerleftinnercorner}% @@ -6695,11 +5793,13 @@ \pgfdeclareshape{pgfplots@low@level@shape@deprecated}{% % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ - \global\pgf@x=\wd\pgfnodepartimagebox - \global\pgf@y=\ht\pgfnodepartimagebox + % FIXME : is this correct? + \pgfplotspointupperrightcorner + %\global\pgf@x=\wd\pgfnodepartimagebox + %\global\pgf@y=\ht\pgfnodepartimagebox }% \savedanchor\lowerleftinnercorner{% - \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% + \pgfplotspointlowerleftinnercorner% }% \savedanchor\xaxisvec{\pgfplotspointxaxis}% \savedanchor\yaxisvec{\pgfplotspointyaxis}% @@ -7122,7 +6222,10 @@ \pgfplots@error{Sorry, your choice for '3d box' and 'axis x line' is incompatible.}% \else % 3d box=complete or complete* + \pgfplotsgetlayerforstyle{every 3d box foreground}% + \pgfplotsonlayer{\pgfplotsretval}{every 3d box foreground}% \begingroup + \pgfplots@layered@graphicsfalse% no distinction of layers here. \pgfplotsset{every 3d box foreground}% \let\pgfplots@drawticklabels@onorientedsurf=\relax \if2\pgfplots@threedimbox@choice @@ -7189,6 +6292,7 @@ }{}% %\fi \endgroup + \endpgfplotsonlayer % end of 3d box=complete \fi \fi @@ -7319,7 +6423,7 @@ % will be initialised. % % ABOUT THE ALGORITHM: -% Given \pgfplots@view@dir@threedim@[xyz], we know the view direction (in 3D!). +% Given \pgfplots@view@dir@threedim, we know the view direction (in 3D!). % Now, we compute the scalar products <n,(1,0,0)'> <n,(0,1,0)'> and % <n,(0,0,1)'> between the view direction n and the unit vectors in 3D % space. Of course, these scalar products are just specific components @@ -7338,29 +6442,30 @@ \expandafter\def\csname pgfplots@surfviewdepth@v2v\endcsname{f}% \expandafter\def\csname pgfplots@surfviewdepth@vv2\endcsname{f}% \ifpgfplots@threedim + \pgfplotsmathvectortocomponents\pgfplots@view@dir@threedim{pgfplots@loc@}{default}% % respect reversed axes here. If I am not mistaken, it should % be completely sufficient to flip signs here: - \ifdim\pgfplots@view@dir@threedim@x pt\if\pgfkeysvalueof{/pgfplots/x dir/value}n>\else<\fi0pt + \pgfplotscoordmath{default}{if is}{\pgfplots@loc@x}{\if\pgfkeysvalueof{/pgfplots/x dir/value}n+\else-\fi}{% \expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{f}% foreground \expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{b}% background - \else + }{% \expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}% \expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}% - \fi - \ifdim\pgfplots@view@dir@threedim@y pt\if\pgfkeysvalueof{/pgfplots/y dir/value}n>\else<\fi0pt + }% + \pgfplotscoordmath{default}{if is}{\pgfplots@loc@y}{\if\pgfkeysvalueof{/pgfplots/y dir/value}n+\else-\fi}{% \expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{f}% foreground \expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{b}% background - \else + }{% \expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}% \expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}% - \fi - \ifdim\pgfplots@view@dir@threedim@z pt\if\pgfkeysvalueof{/pgfplots/z dir/value}n>\else<\fi0pt + }% + \pgfplotscoordmath{default}{if is}{\pgfplots@loc@z}{\if\pgfkeysvalueof{/pgfplots/z dir/value}n+\else-\fi}{% \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{f}% foreground \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{b}% background - \else + }{% \expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}% \expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}% - \fi + }% \else % FIXME : it might be better to implement that stuff here % implicilty using the 3D algorithms. @@ -7448,51 +6553,64 @@ \def\pgfplots@loc@axischar@for@first{x}% \fi \fi - \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 00}{% - % -> both, v00 or v11 are on CH. - % - % Decide whether the '{0.5}{0}{0}' point is above or below - % the {0.5}{0.5}{0.5} - % point. This '<' operation is based on the '#1ticklabel pos' - % key, the 2D projection of the axis and the argument '#2'. - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 00}% - \pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}% - \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax - \if u\csname pgfplots@#1ticklabel@pos\endcsname - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% - \fi - \else - \if l\csname pgfplots@#1ticklabel@pos\endcsname - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% - \fi - \fi - }{% - % -> both, v01 or v10 are on CH - %-------------------------------------------------- - % \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 01}{% FIXME : eliminate sanity assertion if possible - % }{% - % \pgfplots@error{INTERNAL ERROR}% - % }% - %-------------------------------------------------- - % Decide whether the '{0.5}{1}{0}' point is above or below - % the {0.5}{0.5}{0.5} point. Again, the '<' operation is based - % on the '#1ticklabel pos' key, the projection and #2. - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 10}% - % compute the middle point on \pgfplots@loc@to@threedim 10 - \pgfpointadd - {\csname pgfplotspoint\pgfplots@loc@axischar@for@first axis\endcsname} - {\pgfpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}}% + %\if2\csname pgfplots@#1axislinesnum\endcsname + % axis #1 lines=center . + \iffalse + % FIXME : while this here seems reasonable, it is not fully + % implemented. The "outer normal" is missing and one other + % component produces a NYI-warning % - \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax - \if u\csname pgfplots@#1ticklabel@pos\endcsname - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% + % well, for 3d, this implies that all others also have + % "center". And since "0" == lower, "1" == upper", "2" == + % center, we have to use center: + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 22}% + \else + \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 00}{% + % -> both, v00 or v11 are on CH. + % + % Decide whether the '{0.5}{0}{0}' point is above or below + % the {0.5}{0.5}{0.5} + % point. This '<' operation is based on the '#1ticklabel pos' + % key, the 2D projection of the axis and the argument '#2'. + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 00}% + \pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}% + \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax + \if u\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% + \fi + \else + \if l\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}% + \fi \fi - \else - \if l\csname pgfplots@#1ticklabel@pos\endcsname - \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% + }{% + % -> both, v01 or v10 are on CH + %-------------------------------------------------- + % \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 01}{% FIXME : eliminate sanity assertion if possible + % }{% + % \pgfplots@error{INTERNAL ERROR}% + % }% + %-------------------------------------------------- + % Decide whether the '{0.5}{1}{0}' point is above or below + % the {0.5}{0.5}{0.5} point. Again, the '<' operation is based + % on the '#1ticklabel pos' key, the projection and #2. + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 10}% + % compute the middle point on \pgfplots@loc@to@threedim 10 + \pgfpointadd + {\csname pgfplotspoint\pgfplots@loc@axischar@for@first axis\endcsname} + {\pgfpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}}% + % + \ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax + \if u\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% + \fi + \else + \if l\csname pgfplots@#1ticklabel@pos\endcsname + \expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}% + \fi \fi - \fi - }% + }% + \fi }% \def\pgfplots@init@ticklabelaxisspec@twodim@for#1#2{% \if#1x% @@ -7677,11 +6795,321 @@ \pgfkeyslet{/pgfplots/.unknown/.@cmd}\pgfplots@BEGIN@prepare@description@styles@oldhandler }% -\def\pgfplots@BEGIN@init@and@draw@axis{% - \pgfplots@determinedefaultvalues +\newif\ifpgfplots@layered@graphics + + +% Shortcut for '\pgfplotsset{set layers={#1}}'. +% +% USAGE: +% 1. \pgfplotssetlayers{<layer config name>} (one declared with /.define layer set) +% 2. \pgfplotssetlayers (no braces) +% 3. \pgfplotssetlayers{<comma-separated-list-of-layers>} +% +% This command immediately installs a \pgfsetlayers command. It also prepares following axes. +% ATTENTION: this might affect tikzpictures as well. +% +\def\pgfplotssetlayers{% + \pgfutil@ifnextchar\bgroup{\pgfplotssetlayers@}{\pgfplotsset{set layers}}% +}% +\def\pgfplotssetlayers@#1{% + \pgfplotsset{set layers={#1}}% +}% + +% This method checks if '#1' is a well-known layer set. If that is the case, the layer set is initialized. +% If there is no such layer set, #1 is assumed to be a comma-separated-list of layer names. +% These layers are defined if they do not exist already. +% +% POSTCONDITION: +% - a \pgfsetlayers{<list>} is issued (immediately) +% - '/pgfplots/@set layers arg' is defined such that any following axes can initialized their layers. +\def\pgfplots@key@set@layers#1{% + % + % auto detect if '#1' is a defined layer set: + \pgfkeysifdefined{#1/list}{% + \def\pgfkeyscurrentname{#1}% + }{% + \pgfkeysifdefined{/pgfplots/layers/#1/list}{% + \edef\pgfkeyscurrentname{/pgfplots/layers/#1}% + }{% + \let\pgfkeyscurrentname\pgfutil@empty + }% + }% + \ifx\pgfkeyscurrentname\pgfutil@empty + % OK. The argument is NO layer set configuration. + \pgfplots@key@set@layers@{#1}% + \pgfkeyslet{/pgfplots/@set layers arg}\pgfutil@empty% + \else + % OK, The argument is the key name of some '/.define layer set' key. + % Remember it for later and initialize the layers: + \pgfkeyslet{/pgfplots/@set layers arg}\pgfkeyscurrentname% + \pgfkeysgetvalue{\pgfkeyscurrentname/list}\pgfplots@loc@TMPa + \expandafter\pgfplots@key@set@layers@\expandafter{\pgfplots@loc@TMPa}% + \fi +} +% a simple method which (immediately) invokes \pgfsetlayers{#1}. +% +% The only difference is that it creates missing layers on-the-fly. +\def\pgfplots@key@set@layers@#1{% + \edef\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + % DEFAULT. + \pgfsetlayers{main}% + \else + \def\pgfplots@loc@TMPb{false}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % "use layers=false" + \pgfsetlayers{main}% + \else + \def\pgfplots@loc@TMPb{main}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % "use layers=main" + \pgfsetlayers{main}% + \else + % declare all layers, and collect the normalised list + % into \pgfplots@loc@TMPd + \def\pgfplots@loc@TMPd{}% + \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplots@loc@TMPa}\as\pgfplots@loc@TMPa{% + % normalize argument: + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \expandafter\pgfplotsutil@trim\expandafter{\pgfplots@loc@TMPa}% + \let\pgfplots@loc@TMPa=\pgfplotsretval + % + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \def\pgfplots@loc@TMPb{main}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \else + \expandafter\pgfdeclarelayer\expandafter{\pgfplots@loc@TMPa}% + \fi + \edef\pgfplots@loc@TMPd{\ifx\pgfplots@loc@TMPd\pgfutil@empty\else\pgfplots@loc@TMPd,\fi\pgfplots@loc@TMPa}% + \fi + }% + % activate layers: + \pgfplots@log3{Setting layers '\pgfplots@loc@TMPd'...}% + \expandafter\pgfsetlayers\expandafter{\pgfplots@loc@TMPd}% + \fi + \fi + \fi +}% + +\def\pgfplots@prepare@layered@graphics{% + % check if there are no layers at all. + \ifpgfplots@layered@graphics + \pgfutil@ifundefined{pgf@layerlist}{% + }{% + \ifx\pgf@layerlist\pgfutil@empty + \pgfplots@layered@graphicsfalse + \else + \def\pgfplots@loc@TMPa{main}% + \ifx\pgf@layerlist\pgfplots@loc@TMPa + \pgfplots@layered@graphicsfalse + \fi + \fi + }% + \fi +}% + +% validates 'mark layer' such that it can be queried afterwards. +\def\pgfplots@prepare@layered@graphics@marks{% + \ifpgfplots@layered@graphics + \pgfkeysgetvalue{/pgfplots/mark layer}\pgfplots@loc@TMPa + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@loc@TMPa{auto}% + \fi + \def\pgfplots@loc@TMPb{auto}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % COMBINATION: 'activate layers,mark layer=auto' --> keep + % backwards compatibility with 'clip marker paths' + % -> nothing to do. + \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty% + \else + % mark layer=like plot + \def\pgfplots@loc@TMPb{like plot}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % draw markers together with their plot (no matter + % on which layer): + \pgfplots@clip@marker@pathstrue + \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty% + \else + \edef\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/on layer}}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % nothing to do; they are on the same layer + % anyway: (this is the same as 'like plot' + \pgfplots@clip@marker@pathstrue + \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty% + \else + % OK, marks will be plotted on their own layer. + \fi + \fi + \fi + \else + % reset its value: + \pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty% + \fi +}% + +% #2: context information (for improved error recovery), optional +\def\pgfplotsonlayer#1{% + \pgfutil@ifnextchar\bgroup{\pgfplotsonlayer@{#1}}{\pgfplotsonlayer@{#1}{}}% +} +\def\pgfplotsonlayer@#1#2{% + \begingroup + \def\b@pgfplotsonlayer@started{0}% + \ifpgfplots@layered@graphics + \edef\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \def\b@pgfplotsonlayer@started{1}% + \pgfonlayer{#1}% + \fi + \fi +}% +\def\endpgfplotsonlayer{% + \ifpgfplots@layered@graphics + \if1\b@pgfplotsonlayer@started + \endpgfonlayer + \fi + \fi + \endgroup +}% + + +% Searches for the layers of a (set of) style name(s). +% +% #1 is a style name like 'every major grid'. It can also be a list of +% style names. +% +% The last "on layer" key found in these styles will be used here. +% +% Note that the "on layer" keys have already been extracted in during +% the key filtering procedure. +\def\pgfplotsgetlayerforstyle#1{% + \let\pgfplotsretval=\pgfutil@empty + \ifpgfplots@layered@graphics + % this here is the return value: + \let\pgfplots@loc@TMPc=\pgfutil@empty + % + % search list: + \pgfplotsutilforeachcommasep{#1}\as\pgfplots@loc@TMPa{% + \pgfkeysifdefined{/pgfplots/layers for styles/\pgfplots@loc@TMPa}{% + % oh, good: I have already processed the requested + % style, and I already know if it has a particular + % layer. + \pgfkeysgetvalue{/pgfplots/layers for styles/\pgfplots@loc@TMPa}\pgfplots@loc@TMPb + }{% + % hm. Ok, then process the style. Throw everything + % away, keep only the layer. + \begingroup + \pgfkeyslet{/pgfplots/on layer}\pgfutil@empty + \pgfkeysdef{/handlers/.unknown}{}% do nothing + \pgfkeysdef{/tikz/.unknown}{}% also, do nothing. + \pgfplotsset{#1}% let's hope this works with unknown keys... + \pgfkeysgetvalue{/pgfplots/on layer}\pgfplots@loc@TMPb + \pgfmath@smuggleone\pgfplots@loc@TMPb + \endgroup + }% + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \else + % update return value: + \let\pgfplots@loc@TMPc=\pgfplots@loc@TMPb + \fi + }% + \let\pgfplotsretval=\pgfplots@loc@TMPc +%\message{\string\pgfplotsgetlayerforstyle{#1} = '\pgfplotsretval'^^J}% + \fi +}% + +% The purpose of this method is to check for the cases where no cell picture is necessary. +% The idea behind this anchor is to insert the axis DIRECTLY into the embedding tikzpicture, without +% a posteriori shifting. +% +% A posteriori shifting == anchors whose dimensions are not fixed +% until the complete axis has been "typeset". +% +% Disabling the cell picture will still prepare ALL anchors correctly, +% but it disables many of the anchor choices when it comes to the +% alignment of the current axis (in other words: other node can align +% using the anchors of this axis, but this axis cannot be aligned based on its anchors). +% +% The motivation for this feature is to implement multi-axis support together with layered graphics. +% +% The 'cell picture=false' feature may be interesting for SVG export as +% well. +\def\pgfplots@prepare@cell@picture{% + \pgfplots@ifcellpicture@required{% + \pgfplots@has@cell@picturetrue + }{% + % cell picture=false or cell picture=if necessary + % + % anchor processing is special in this case! The standard + % anchor processing uses a posteriori shifts. This feature + % here REQUIRES a priori shifts. + % Prepare special handling for these shifts: + \pgfplots@has@cell@picturefalse + \edef\pgfplots@anchorname@internal{\pgfplots@anchorname}% + %\def\pgfplots@anchorname{image}% + % + \let\pgfplots@BEGIN@cell@picture=\pgfplots@BEGIN@cell@picture@DISABLED + \let\pgfplots@END@cell@picture=\pgfplots@END@cell@picture@DISABLED + \def\pgfplots@add@named@child@node##1{}% do nothing here + \let\pgfplots@finally@correct@child@node@positions=\relax + % + % translate the coordinate system before the 'current axis' + % node is generated. + \expandafter\def\expandafter\pgfplots@beforenode\expandafter{\pgfplots@beforenode + \setbox\pgfnodepartimagebox=\hbox{}% + }% + }% +} + +\long\def\pgfplots@ifcellpicture@required#1#2{% + \if1\pgfplots@cell@picture@mode + % cell picture=true + #1\relax + \else + % cell picture=false | cell picture=if necessary + \edef\pgfplots@shapename{pgfplots@low@level@shape@INNER}% + \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% + % we need to compute the anchor a posteriorily. + \if0\pgfplots@cell@picture@mode + % cell picture=false is forbidden here... + \pgfplots@error{Sorry, 'cell picture=false' is UNSUPPORTED for 'anchor=\pgfplots@anchorname'.}% + \fi + \if2\pgfplots@cell@picture@mode + \pgfplots@log3{'cell picture=if necessary' resulted in 'cell picture=true'}% + \fi + #1\relax + }{% + \pgfplots@log3{'cell picture=if necessary' resulted in 'cell picture=false'}% + % OK, an a priori anchor is available - we do not really need + % a cell picture and this is compatible with the input + % options: + #2\relax + }% + \fi +}% + +\def\pgfplots@define@preliminary@current@axis@node{% + \begingroup + \pgfplots@sys@beforenode + % create a leight-weight 'current axis' node for anchor references + % (which may happen during both, the axis descriptions or any + % path/plot commands). + \pgfmultipartnode{pgfplots@low@level@shape@INNER}{image}{current axis}{\pgfusepath{discard}}% + \endgroup +}% + +\def\pgfplots@BEGIN@cell@picture[#1]{% + % + \pgfplots@define@preliminary@current@axis@node + % + \pgfplotsutil@BEGIN@cell@picture[#1]% +}% +\def\pgfplotsutil@BEGIN@cell@picture[#1]{% \setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup \pgfinterruptpicture - \tikzpicture[/pgfplots/every axis]% + \tikzpicture[#1]% % set baseline for sub-picture to default value. % the baseline option will be applied to the OUTER picture. \pgfsetbaseline{\pgf@picminy}% @@ -7698,15 +7126,142 @@ \xdef\pgfplots@glob@TMPa{{\aa}{\ab}{\ba}{\bb}}% \endgroup \expandafter\pgfsettransformentries\pgfplots@glob@TMPa{0pt}{0pt}% +} + +\def\pgfplotsutil@END@cell@picture#1{% + \endtikzpicture% + \begingroup + \ifdim\pgf@picmaxx=-16000pt\relax% + \pgf@picmaxx=0pt\relax% + \pgf@picminx=0pt\relax% + \pgf@picmaxy=0pt\relax% + \pgf@picminy=0pt\relax% + \fi% + #1 + \endgroup + \endpgfinterruptpicture + \egroup\egroup% end of pgfnodepartimagebox + % + % restore any shift transformations provided to an axis. + % These would be lost otherwise. + \pgftransformshift{\pgfplots@savedtransformshift}% + % + % allow positioning of colorbars with this hook. + % It is \relax unless this here is a color bar axis. + % Its intention is to re-define `\pgfplots@at': + \pgfplots@colorbar@position@hook% + % + \pgftransformshift{\pgfplots@at}% + % +}% +\def\pgfplots@END@cell@picture{% + \pgfplotsutil@END@cell@picture{\pgfplots@END@cell@picture@preparepoints}% +}% + +\def\pgfplots@END@cell@picture@preparepoints{% + % Protocol sizes for the axis-shape. + % That needs to be done globally, do avoid all those + % \endgroup's in and after \endpgfinterruptpicture ... + % + \xdef\pgfplotspointorigininternal{\global\pgf@x=\the\pgf@picminx\space\global\pgf@y=\the\pgf@picminy\space}% + % + \ifpgfplots@deprecated@anchors + \pgfplotspointminminmin + \else + \pgfplotspointbblowerleft + \fi + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgf@pos@transform\pgf@xa\pgf@ya + \advance\pgf@xa by-\pgf@picminx + \advance\pgf@ya by-\pgf@picminy + \xdef\pgfplotspointlowerleftinnercorner{% + \global\pgf@x=\the\pgf@xa\space + \global\pgf@y=\the\pgf@ya\space + }% + % + \global\pgf@x=\pgf@picmaxx + \global\pgf@y=\pgf@picmaxy + \global\advance\pgf@x by-\pgf@picminx + \global\advance\pgf@y by-\pgf@picminy + \xdef\pgfplotspointupperrightcorner{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% + % + \pgfplotspointaxisorigin + \pgf@pos@transform\pgf@x\pgf@y + \global\advance\pgf@x by-\pgf@picminx + \global\advance\pgf@y by-\pgf@picminy + \xdef\pgfplotspointaxisorigin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% +} + +% this here is essentially the same as +% \pgfpointanchor{current axis}{#1} +% but it does not need a node. +\def\pgfplotspointdescriptionbyanchor#1{% + \begingroup + \edef\pgfplotspointdescriptionbyanchor@{#1}% + \gdef\pgfplots@glob@TMPa{0}% + % do a linear search through all anchors of + % shape pgfplots@low@level@shape@INNER : + \def\anchor##1##2{% + \def\pgfplots@loc@TMPa{##1}% + \ifx\pgfplots@loc@TMPa\pgfplotspointdescriptionbyanchor@ + \pgf@process{##2}% + \gdef\pgfplots@glob@TMPa{1}% + \fi + }% + \pgfplots@low@level@shape@INNER@define + \if0\pgfplots@glob@TMPa + \pgfplots@error{The anchor '#1' is unsupported in this context.}% + \fi + \endgroup +}% + +\def\pgfplots@BEGIN@cell@picture@DISABLED[#1]{% + \begingroup + \pgfinterruptboundingbox + % + % + % allow positioning of colorbars with this hook. + % It is \relax unless this here is a color bar axis. + % Its intention is to re-define `\pgfplots@at': + \pgfplots@colorbar@position@hook% + % + \pgftransformshift{\pgfplots@at}% + % + % prepare a priori anchor transformation (see + % \pgfplots@prepare@cell@picture for details): + \pgftransformshift{% + \pgfqpointscale{-1}{\pgfplotspointdescriptionbyanchor{\pgfplots@anchorname@internal}}% + }% + % + \pgfplots@define@preliminary@current@axis@node + % + \scope[#1]% +}% +\def\pgfplots@END@cell@picture@DISABLED{% + \endscope% + \begingroup + \pgfplots@END@cell@picture@preparepoints% + \endgroup + \endpgfinterruptboundingbox + \endgroup +}% + +\def\pgfplots@BEGIN@init@and@draw@axis{% % % \pgfplots@draw@axis@pre \pgfplots@draw@axis@is@prepared \scope % - \pgfkeysifdefined{/pgfplots/axis background/.@cmd}{% - \path[/pgfplots/axis background] \pgfextra{\pgfplots@clippath@install{}};% - }{}% + \pgfkeysgetvalue{/pgfplots/axis background/.@cmd}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfplots@empty@style@key + \else + \pgfplotsgetlayerforstyle{/pgfplots/axis background,/pgfplots/axis background@}% + \pgfplotsonlayer{\pgfplotsretval}{axis background}% + \path[/pgfplots/axis background,/pgfplots/axis background@] \pgfextra{\pgfplots@clippath@install{}};% + \endpgfplotsonlayer + \fi % \ifpgfplots@axis@on@top \else @@ -7714,7 +7269,10 @@ \fi % CLIPPING: \ifpgfplots@clip - \pgfplots@clippath@install{\pgfusepath{clip}}% + \if1\pgfplots@clipmode + % 'clip=true' and 'clip/mode=global': + \pgfplots@clippath@install{\pgfusepath{clip}}% + \fi \fi \pgfplotspointbb@assertvaluesexist% } @@ -7986,7 +7544,7 @@ % clip path routine; it will be used quite often. % \let\pgfplots@clippath@install@pathcmd=\pgfplots@clippath@install - \iffalse% FIXME : this needs to be fixed + \iffalse \pgf@resetpathsizes% FIXME: this here should not be necessary! \pgfsysprotocol@getcurrentprotocol\pgfplots@loc@TMPa% \begingroup @@ -8004,7 +7562,7 @@ \endgroup \let\pgfplots@clippath@install@clip@protocolled=\pgfplots@glob@TMPa \pgfsysprotocol@setcurrentprotocol\pgfplots@loc@TMPa% - \fi + \fi % % Replace \pgfplots@clippath@install by one which makes use of the % optimized version (if ##1=\pgfusepath{clip}) @@ -8062,6 +7620,16 @@ \pgfplots@error{Can't install a clippath here - the command has not yet been prepared.}% }% + +% Generates a path representing the outline of the axis. +% Example: +% +% \pgfplotspathaxisoutline +% \pgfusepath{clip} +\def\pgfplotspathaxisoutline{% + \pgfplots@clippath@install{}% +}% + % This is the counterpart for \pgfplots@BEGIN@init@and@draw@axis \def\pgfplots@END@init@and@draw@axis{% \endscope% @@ -8071,19 +7639,25 @@ \fi \pgfplots@draw@axis@post % + % Draw any markers for which drawing has been postponed. + % + % The motivation here is that markers should be drawn on top of + % their plots, and AFTER the clip path. + % + % If the plotting logic added serialized marker streams to + % \pgfplots@stored@markerlist, these markers will be plotted here. + % + % Note that this list will be EMPTY if + % \ifpgfplots@clip@marker@paths is true. + % % whats the better sequence for \ifpgfplots@axis@on@top and \ifpgfplots@clip@marker@paths !? % This here looks better, I think... markers should not be obscured by descriptions. - \ifpgfplots@clip@marker@paths - \else - \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{% - \scope% make sure that 'fill opacity' and 'dotted' styles remain local! + \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{% %\message{Executing marker stuff: \meaning\pgfplots@loc@TMPa]]]]]}% %\tracingmacros=2\tracingcommands=2 - \pgfplots@loc@TMPa - \endscope - }% - \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear. - \fi + \pgfplots@loc@TMPa + }% + \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear. % \begingroup \pgfkeysvalueof{/pgfplots/after end axis/.@cmd}\pgfeov% @@ -8436,6 +8010,11 @@ % \pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa% \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \def\pgfplots@loc@TMPb{e}% + \ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa + % log basis x=e : same as empty value. + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi \ifx\pgfplots@loc@TMPa\pgfutil@empty % log basis x={} (initial setting:) \else @@ -8816,6 +8395,13 @@ % confused if the catcodes change... this here is a % work-around for babel support. \let\pgfplots@checkandpreparefor@active@semicolon\relax + % + % make sure that 'every colorbar' is checked by the key-filtering + % stuff: we want to find 'ymode=log' inside of it. + % Note that we have to change it here because only the colorbar + % should expand 'every colorbar' that early in the processing: + \pgfkeys{/pgfplots/every colorbar/.belongs to family=/pgfplots/scale}% + % \pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\pgfeov } \pgfkeysdef{/pgfplots/colorbar to name/at}{% @@ -8896,6 +8482,22 @@ \pgfplots@set@keymacro@to@style\pgfplots@rmopts{#1}% } +% Invokes \pgfplots@set@keys@from@tikz@style and handles the "on +% layer" key. +% +% More precisely, it stores any "on layer" value found in style "#1" +% in +% /pgfplots/layers for styles/#1. +% +% If there is no such value, it will store the empty string (main +% layer) +\def\pgfplots@set@keys@from@tikz@style@and@handle@layer#1{% + \pgfkeyslet{/pgfplots/on layer}\pgfutil@empty + \pgfplots@set@keys@from@tikz@style{#1}% + \pgfkeysgetvalue{/pgfplots/on layer}\pgfplots@loc@TMPa + \pgfkeyslet{/pgfplots/layers for styles/#1}\pgfplots@loc@TMPa +}% + % The same as \pgfplots@set@keys@from@tikz@style but this one appends % unmatched options to style #2. % @@ -9102,6 +8704,20 @@ \pgfkeysdeactivatefamily{/pgfplots/naming commands}% \pgfkeysdeactivatefamily{/pgfplots/shared with tikz}% % + \ifpgfplots@axis@on@top + \ifpgfplots@layered@graphics + \pgfplots@log3{the combination of 'axis on top' and 'activate layers' implies 'set layers=axis on top'. Deactivate 'axis on top' if you want other layers.}% + \pgfplotsset{set layers=axis on top}% + \fi + \fi + % retrieve layer configurations (the one set with 'set layers*'). + \pgfkeysgetvalue{/pgfplots/@set layers arg}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + % ah, yes: then set its style: + \pgfqkeys{/pgfplots/layers}{\pgfplots@loc@TMPa}% note that this here should not need key filtering; it adjusts only styles (hopefully ;) ) + \fi + % % Now, any 'name' and 'alias' options have been processed. % % Remember their current meaning and reset the tikz options! @@ -9118,16 +8734,16 @@ \pgfkeysgetvalue{/tikz/alias/.@cmd}\pgfplots@old@alias@impl }{}% \pgfkeysdef{/tikz/name}{% - \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{##1}}% + \pgfplots@add@named@child@node{##1}% \pgfplots@old@name@impl##1\pgfeov }% \pgfkeysdef{/tikz/alias}{% - \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{##1}}% + \pgfplots@add@named@child@node{##1}% \pgfplots@old@alias@impl##1\pgfeov }% % % Now, continue to process the 'every' styles. Please note that - % the 'legend style={}' like options have already been processed; + % options like 'legend style={}' have already been processed; % their values are already inside of the associated 'every' % styles. % @@ -9140,7 +8756,7 @@ % 'legend style={legend pos=outer north east}': \pgfkeysdef{/pgfplots/every axis legend/.append style}{\pgfkeysalso{##1}}% % - \pgfplots@set@keys@from@tikz@style{every axis legend}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every axis legend}% % % restore: \pgfkeysdef{/pgfplots/every axis legend/.append style}{% @@ -9159,12 +8775,12 @@ %\pgfkeysdeactivatefamily{/pgfplots/descriptions}% % \pgfkeysactivatefamily{/pgfplots/tick}% - \pgfplots@set@keys@from@tikz@style{every tick}% - \pgfplots@set@keys@from@tikz@style{every minor tick}% - \pgfplots@set@keys@from@tikz@style{every major tick}% - \pgfplots@set@keys@from@tikz@style{every axis grid}% - \pgfplots@set@keys@from@tikz@style{every minor grid}% - \pgfplots@set@keys@from@tikz@style{every major grid}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every tick}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every minor tick}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every major tick}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every axis grid}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every minor grid}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every major grid}% \pgfkeysdeactivatefamily{/pgfplots/tick}% % %-------------------------------------------------- @@ -9178,9 +8794,9 @@ % ensure that \axis[<options>] take higher precedence). %\pgfkeysactivatefamily{/pgfplots/descriptions}% \pgfkeysactivatefamily{/pgfplots/tick}% - \pgfplots@set@keys@from@tikz@style{every x tick label}% - \pgfplots@set@keys@from@tikz@style{every y tick label}% - \pgfplots@set@keys@from@tikz@style{every tick label}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every x tick label}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every y tick label}% + \pgfplots@set@keys@from@tikz@style@and@handle@layer{every tick label}% \pgfkeysdeactivatefamily{/pgfplots/tick}% %\pgfkeysdeactivatefamily{/pgfplots/descriptions}% % @@ -9240,10 +8856,24 @@ \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty \pgfkeysalso{/pgfplots/.search also=/tikz}% % + \pgfkeysifdefined{/tikz/on layer}{}{% + % make sure assignments 'on layer' in the /tikz/ prefix + % doesn't hurt. + % this may happen, for example with + % 'x grid style={on layer=...}' + % because 'x grid style' is not processed by the key filtering + % above (it is extracted later). + \pgfkeyslet{/tikz/on layer}\pgfutil@empty% + }% + % \pgfplots@set@options@sanitize \pgfplots@notify@options@are@set } +\def\pgfplots@add@named@child@node#1{% + \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{#1}}% +}% + \def\pgfplots@notify@options@are@set{}% \def\pgfplots@install@abbrev@commands{ @@ -9386,6 +9016,9 @@ {/pgf/key filters/defined}}% \def\pgfplots@label@tikzopts{}% \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}% + % FIXME : this fails if 'error bars/.cd,/pgfplots/.cd' is used inside of #1 -- + % the second /pgfplots/.cd will be applied, but the error bars + % command not \pgfqkeysfiltered{/tikz}{#1}% % \pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}% @@ -9797,6 +9430,9 @@ % \pgfplots@set@options{#1}% % + \pgfplots@prepare@layered@graphics + % + \pgfplots@prepare@cell@picture % % % @@ -9881,7 +9517,12 @@ \pgfplots@autocompute@all@limitsfalse \fi % - \pgfplots@declare@mathfunctions + \pgfutil@ifundefined{pgfmathdeclarefunction}{% + % SKIP: \pgfmathdeclarefunction is unavailable in pgf 2.00 . + % UPGRADE TO PGF 2.10 to use these math functions. + }{% + \pgfplots@declare@mathfunctions + }% % % check for axis-wide 'point meta min' : \pgfkeysgetvalue{/pgfplots/point meta min}\pgfplots@loc@TMPa @@ -9938,6 +9579,18 @@ \let\scope=\pgfplots@replacement@for@scope \let\endscope=\pgfplots@replacement@for@endscope % + \let\pgfplots@orig@pgfonlayer=\pgfonlayer + \let\pgfplots@orig@endpgfonlayer=\endpgfonlayer + \let\pgfonlayer=\pgfplots@replacement@for@onlayer + \let\endpgfonlayer=\pgfplots@replacement@for@endonlayer + % + \let\pgfplots@orig@pgfplotsonlayer=\pgfplotsonlayer + \let\pgfplots@orig@endpgfplotsonlayer=\endpgfplotsonlayer + \let\pgfplotsonlayer=\pgfplots@replacement@for@onlayer + \let\endpgfplotsonlayer=\pgfplots@replacement@for@endonlayer + % + % allow layer changes within the environment; reset: + \pgfkeyslet{/pgfplots/on layer}\pgfutil@empty } % \end{axis} : @@ -9959,6 +9612,10 @@ \let\plot=\pgfplots@orig@plot \let\scope=\pgfplots@orig@scope \let\endscope=\pgfplots@orig@endscope + \let\pgfonlayer=\pgfplots@orig@pgfonlayer + \let\endpgfonlayer=\pgfplots@orig@endpgfonlayer + \let\pgfplotsonlayer=\pgfplots@orig@pgfplotsonlayer + \let\endpgfplotsonlayer=\pgfplots@orig@endpgfplotsonlayer % \pgfplotssurveyphase@setactiveplothandlers % @@ -9966,131 +9623,99 @@ % %\end{axis}: % - \begingroup - \pgfplots@sys@beforenode - % create a leight-weight 'current axis' node for anchor references - % (which may happen during both, the axis descriptions or any - % path/plot commands). - \pgfmultipartnode{pgfplots@low@level@shape@INNER}{image}{current axis}{\pgfusepath{discard}}% - \endgroup - % % -------------------- % All plotting commands have been read. % -> apply postponed drawing commands! % -------------------- - \pgfplots@BEGIN@init@and@draw@axis - % - % replace some of tikz's paths (like ellipse and path): make them - % aware of any transformations: - \pgfplots@install@path@replacements - % - \pgfplots@stacked@initialise - \global\pgfplotslistnewempty\pgfplots@stored@markerlist - \ifpgfplots@stacked@reverse - % This here applies any scaling trafos and assembles a - % NEW \pgfplots@stored@plotlist! - \pgfplots@stacked@finalize@stored@plots - \fi - \pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% - \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa + \pgfplots@determinedefaultvalues + \pgfplots@BEGIN@cell@picture[/pgfplots/every axis]% + \pgfplots@BEGIN@init@and@draw@axis + % + % replace some of tikz's paths (like ellipse and path): make them + % aware of any transformations: + \pgfplots@install@path@replacements + % + \pgfplots@stacked@initialise + \global\pgfplotslistnewempty\pgfplots@stored@markerlist + \ifpgfplots@stacked@reverse + % This here applies any scaling trafos and assembles a + % NEW \pgfplots@stored@plotlist! + \pgfplots@stacked@finalize@stored@plots + \fi + \pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% + \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa %\message{^^JProcessing stored plot with precommand '\meaning\pgfplots@stored@current@precmd';^^J pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd'^^J postcommand '\meaning\pgfplots@stored@current@postcmd'^^J}% %\message{DATA: '\meaning\pgfplots@stored@current@data';^^J}% - % The precmd sets all required variables needed to - % finalize a plot. - \ifx\pgfplots@stored@current@cmd\pgfutil@empty - \pgfplots@stored@current@data% - \else - \begingroup + % The precmd sets all required variables needed to + % finalize a plot. % @see the stream preparation routines. \pgfplots@stored@current@precmd - \pgfkeysvalueof{/pgfplots/execute at begin plot visualization}% - \ifpgfplots@threedim - \else - % axis = 2d and plot=3d is forbidden here. - \pgfplots@curplot@threedimfalse - \fi - % - % this code here means we REALLY have a plotting - % command! - \scope[current plot style] % this sets BOTH pgfplots and tikz options. - % FIXME : what, precisely, was the motivation to use a - % scope here? It causes a lot of problems and - % work-arounds. Is it worth the effort!? - % - % de-activate the FPU here! I fear its number - % format may cause errors when used in low-level - % routines. - \pgfkeys{/pgf/fpu=false}% - % - \ifpgfplots@stacked@reverse - % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. - \pgfplots@stacked@draw@reversed@plot + \ifx\pgfplots@stored@current@cmd\pgfutil@empty + % Ah: some \pgfplotsextra command like \draw,\path, + % \node or even \scope or \endscope. + % + % do NOT call \pgfplotsonlayer here! We MUST NOT + % destroy grouping levels here. + \pgfplots@stored@current@data% \else - % modifies \pgfplots@stored@markerlist if necessary. - \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI + % + % this code here means we REALLY have a plotting + % command! + \begingroup + \pgfplotsonlayer{\pgfkeysvalueof{/pgfplots/on layer}}{a plot or graphical element (or inherited from the axis)}% + \pgfkeysvalueof{/pgfplots/execute at begin plot visualization}% + \ifpgfplots@threedim + \else + % axis = 2d and plot=3d is forbidden here. + \pgfplots@curplot@threedimfalse + \fi + \pgfplots@execute@at@begin@plot@visualization@internal + \scope[current plot style] % this does set BOTH pgfplots and tikz options. + % FIXME : what, precisely, was the motivation to use a + % scope here? It causes a lot of problems and + % work-arounds. Is it worth the effort!? + \ifpgfplots@clip + \if2\pgfplots@clipmode + % clip=true and 'clip mode=individual' + \pgfplots@clippath@install{\pgfusepath{clip}}% + \fi + \fi + % + \pgfplots@prepare@layered@graphics@marks + % + % de-activate the FPU here! I fear its number + % format may cause errors when used in low-level + % routines. + \pgfkeys{/pgf/fpu=false}% + % + \ifpgfplots@stacked@reverse + % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. + \pgfplots@stacked@draw@reversed@plot + \else + % modifies \pgfplots@stored@markerlist if necessary. + \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI + \fi + \endscope + \pgfplots@execute@at@end@plot@visualization@internal + \pgfkeysvalueof{/pgfplots/execute at end plot visualization}% + \endpgfplotsonlayer + \endgroup \fi - \endscope - \pgfkeysvalueof{/pgfplots/execute at end plot visualization}% \pgfplots@stored@current@postcmd - \endgroup - \fi - }% - \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents. - % - \pgfplots@END@init@and@draw@axis - % - \pgfplots@create@axis@descriptions - % - \endtikzpicture% - \begingroup - % Protocol sizes for the axis-shape. - % That needs to be done globally, do avoid all those - % \endgroup's in and after \endpgfinterruptpicture ... - \ifdim\pgf@picmaxx=-16000pt\relax% - \pgf@picmaxx=0pt\relax% - \pgf@picminx=0pt\relax% - \pgf@picmaxy=0pt\relax% - \pgf@picminy=0pt\relax% - \fi% - % - \xdef\pgfplots@saveddimen@picminx{\the\pgf@picminx}% - \xdef\pgfplots@saveddimen@picminy{\the\pgf@picminy}% - % - \ifpgfplots@deprecated@anchors - \pgfplotspointminminmin - \else - \pgfplotspointbblowerleft - \fi - \pgf@xa=\pgf@x - \advance\pgf@xa by-\pgf@picminx - \xdef\pgfplots@savedanchor@inner@lowerleft@x{\the\pgf@xa}% + }% + \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents. % - \pgf@xa=\pgf@y - \advance\pgf@xa by-\pgf@picminy - \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% + \pgfplots@END@init@and@draw@axis % - \pgfplotspointaxisorigin - \global\advance\pgf@x by-\pgf@picminx - \global\advance\pgf@y by-\pgf@picminy - \xdef\pgfplotspointaxisorigin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% - \endgroup - \endpgfinterruptpicture - \egroup\egroup% end of pgfnodepartimagebox + \pgfplots@create@axis@descriptions + % + % this here does \endtikzpicture\endpgfinterruptpicture + % (and stores sizes): + \pgfplots@END@cell@picture % \let\tikz@fig@name=\pgfplots@fig@name \tikz@fig@mustbenamed % - % restore any shift transformations provided to an axis. - % These would be lost otherwise. - \pgftransformshift{\pgfplots@savedtransformshift}% - % - % allow positioning of colorbars with this hook. - % It is \relax unless this here is a color bar axis. - % Its intention is to re-define `\pgfplots@at': - \pgfplots@colorbar@position@hook% - % - \pgftransformshift{\pgfplots@at}% - % \edef\pgfplots@shapename{pgfplots@low@level@shape\ifpgfplots@deprecated@anchors @deprecated\fi}% \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% % Oh. Well, suppose \pgfplots@anchorname is associated to an @@ -10102,7 +9727,7 @@ % \pgfplots@finally@correct@child@node@positions). % Do that here with \pgfplots@saveddimen@picminx: \pgfpointdiff - {\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}} + {\pgfplotspointorigininternal} {##1}% \global\pgf@x=-\pgf@x \global\pgf@y=-\pgf@y }% @@ -10112,7 +9737,7 @@ }{}% % \begingroup - \pgfplots@sys@beforenode + \pgfplots@beforenode % \ifpgfplots@deprecated@anchors \pgfplots@restore@deprecated@lowlevel@shape @@ -10132,10 +9757,40 @@ \else \global\let\pgfplots@glob@TMPa=\relax \fi + % + % transport the current layer config - but only if nessary! + \def\pgfplots@loc@TMPa{0}% + \ifpgfplots@has@cell@picture + % layers are used for the cell picture only- no need to + % communicate them. + \else + \ifpgfplots@layered@graphics + \def\pgfplots@loc@TMPa{1}% + \else + % there are no layers. + \fi + \fi + \if1\pgfplots@loc@TMPa + % Ah - we need to transport the current layer config! + \pgf@remember@layerlist@globally + \aftergroup\pgf@restore@layerlist@from@global + \else + % Hm. No layers to transport. Make sure that the second + % \aftergroup does not hurt: + \aftergroup\pgf@remember@layerlist@globally + \fi \endgroup \pgfplots@glob@TMPa + % + % once more again - just to be sure that it works with LaTeX which + % introduces a further grouping level: + \aftergroup\pgf@restore@layerlist@from@global } +\def\pgfplots@beforenode{% + \pgfplots@sys@beforenode +}% + % Now, we need to process all named nodes inside of our % axis-image. % @@ -10170,7 +9825,7 @@ \pgfpointanchor{\tikz@fig@name}{image}% \pgf@xa=\pgf@x \pgf@xb=\pgf@y - \pgf@process{\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}}% + \pgf@process{\pgfplotspointorigininternal}% \advance\pgf@xa by-\pgf@x \advance\pgf@xb by-\pgf@y \global\pgf@x=\pgf@xa @@ -10248,6 +9903,8 @@ \tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis \tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis +%\input pgfplots.multiaxis.code.tex + \pgfplotsdefineaxistype{rectangle}{% % do nothing, this is the default anyway. }% |