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 | 389 |
1 files changed, 347 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 7bf4e86b27a..7edbb15a4c3 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -65,11 +65,14 @@ \newdimen\pgfplots@zmax@reg \newif\ifpgfplots@warn@for@filter@discards \newif\ifpgfplots@isuniformtick +\newif\ifpgfplotsplothandlermesh@patch@type@sampling \newif\ifpgfplots@clip@limits \newif\ifpgfplots@clip \newif\ifpgfplots@plot@coords@mathparser \pgfplots@plot@coords@mathparsertrue \newif\ifpgfplots@enlargelimits +\newif\ifpgfplots@enlargelimits@respect@figure@size +\pgfplots@enlargelimits@respect@figure@sizetrue \newif\ifpgfplots@enlargelimits@rel@thresh \newif\ifpgfplots@enlargelimits@auto \newif\ifpgfplots@tickshow @@ -138,7 +141,7 @@ % Invokes '#2' if a cycle list named '#1' exists and '#3' if not. \long\def\pgfplotsifcyclelistexists#1#2#3{% - \pgfutil@ifundefined{pgfp@cyclist@\string#1@}{#3}{#2}% + \pgfutil@IfUndefined{pgfp@cyclist@\string#1@}{#3}{#2}% }% % Creates a named plot cycle list. @@ -1183,12 +1186,6 @@ /pgfplots/scale ticks below exponent/.store in= \pgfplots@scale@ticks@below@exponent, /pgfplots/scale ticks below exponent/.belongs to family=/pgfplots/tick, /pgfplots/scale ticks below exponent=-1, - /pgfplots/subtickwidth/.store in= \pgfplots@subtickwidth, - /pgfplots/subtickwidth/.belongs to family=/pgfplots/tick, - /pgfplots/subtickwidth=0.1cm, - /pgfplots/tickwidth/.store in= \pgfplots@tickwidth, - /pgfplots/tickwidth/.belongs to family=/pgfplots/tick, - /pgfplots/tickwidth=0.15cm, /pgfplots/minor x tick num/.initial=0, /pgfplots/minor x tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor y tick num/.initial=0, @@ -1213,10 +1210,14 @@ /pgfplots/minor ztick={#1}, }, /pgfplots/minor tick/.belongs to family=/pgfplots/tick, - /pgfplots/minor tick length/.estore in=\pgfplots@subtickwidth, + % + /pgfplots/subtickwidth/.style= {/pgfplots/minor tick length={#1}}, + /pgfplots/tickwidth/.style= {/pgfplots/major tick length={#1}}, /pgfplots/minor tick length/.belongs to family=/pgfplots/tick, - /pgfplots/major tick length/.estore in=\pgfplots@tickwidth, + /pgfplots/minor tick length/.initial=0.1cm, /pgfplots/major tick length/.belongs to family=/pgfplots/tick, + /pgfplots/major tick length/.initial=0.15cm, + % /pgfplots/max space between ticks/.estore in=\axisdefaulttickwidth, /pgfplots/max space between ticks/.belongs to family=/pgfplots/tick, /pgfplots/max space between ticks=35,% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt') @@ -1880,7 +1881,7 @@ /pgfplots/prefix/.code={\pgfkeysalso{/tikz/prefix={#1}}}, /pgfplots/raw gnuplot/.code={\pgfkeysalso{/tikz/raw gnuplot={#1}}}, /pgfplots/parametric/.code={\pgfkeysalso{/tikz/parametric={#1}}},% - % + % /pgfplots/width/.initial=,% /pgfplots/width/.belongs to family=/pgfplots, /pgfplots/height/.initial=,% @@ -1909,6 +1910,7 @@ /pgfplots/enlarge z limits=#1,% },% /pgfplots/enlargelimits/.default=true, + /pgfplots/enlargelimits respects figure size/.is if=pgfplots@enlargelimits@respect@figure@size, /pgfplots/update limits/.is if=pgfplots@bb@isactive, /pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/x/.belongs to family=/pgfplots, @@ -2674,14 +2676,14 @@ % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% - \draw[xshift={\pgfkeysvalueof{/pgf/bar shift}}] + \draw[xshift={\pgfplotbarshift}] ##1 -- ##2 node[pos=1,sloped,allow upside down] {% \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% \pgfusepath{stroke}}% }; },% - /pgfplots/every node near coord/.append style={xshift={\pgfkeysvalueof{/pgf/bar shift}}},% + /pgfplots/every node near coord/.append style={xshift={\pgfplotbarshift}},% /tikz/ybar, }, /pgfplots/ybar/.default=2pt, @@ -2706,14 +2708,14 @@ % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% - \draw[yshift={\pgfkeysvalueof{/pgf/bar shift}}] + \draw[yshift={\pgfplotbarshift}] ##1 -- ##2 node[pos=1,sloped,allow upside down] {% \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% \pgfusepath{stroke}}% }; },% - /pgfplots/every node near coord/.append style={yshift={\pgfkeysvalueof{/pgf/bar shift}}},% + /pgfplots/every node near coord/.append style={yshift={\pgfplotbarshift}},% /tikz/xbar, }, /pgfplots/xbar/.default=2pt, @@ -2817,6 +2819,7 @@ /pgfplots/plot graphics/auto adjust axis/.is if=pgfplots@plot@graphics@autoadjustaxis, /pgfplots/plot graphics/auto adjust axis=true, /pgfplots/plot graphics/snap z/.initial=0.02, + % possible values: debug=<empty>|false|true|visual /pgfplots/plot graphics/debug/.initial=, /pgfplots/plot graphics/debug/.default=true, /pgfplots/plot graphics/squeeze tol/.initial=2pt, @@ -2892,6 +2895,7 @@ \pgfkeysalso{/pgfplots/point meta/explicit}% }, /pgfplots/patch type/.initial=, + /pgfplots/patch type sampling/.is if=pgfplotsplothandlermesh@patch@type@sampling, /pgfplots/patch internal depth/.is if=pgfplotsplothandlermesh@internaldepth, /pgfplots/patch internal depth=true, /pgfplots/patch to triangles/.is choice, @@ -3335,6 +3339,7 @@ /pgfplots/compat/anchors/1.5/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/1.5.1/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/1.6/.style= {/pgfplots/compat/anchors/1.3},% + /pgfplots/compat/anchors/1.7/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/newest/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},% % @@ -3345,6 +3350,7 @@ /pgfplots/compat/empty line/1.5/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/1.5.1/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/1.6/.style= {/pgfplots/compat/empty line/1.4},% + /pgfplots/compat/empty line/1.7/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/newest/.style= {/pgfplots/compat/empty line/1.4},% /pgfplots/compat/empty line/default/.style= {/pgfplots/compat/empty line/1.4},% % @@ -3355,6 +3361,7 @@ /pgfplots/compat/path replacement/1.5/.style= {/pgfplots/compat/path replacement/pre 1.3},% /pgfplots/compat/path replacement/1.5.1/.code= {\pgfplots@path@replace@ellipsetrue},% /pgfplots/compat/path replacement/1.6/.style= {/pgfplots/compat/path replacement/1.5.1}, + /pgfplots/compat/path replacement/1.7/.style= {/pgfplots/compat/path replacement/1.5.1}, /pgfplots/compat/path replacement/newest/.style= {/pgfplots/compat/path replacement/1.5.1},% /pgfplots/compat/path replacement/default/.style= {/pgfplots/compat/path replacement/pre 1.3},% %ellipse/.is if=pgfplots@path@replace@ellipse, @@ -3370,6 +3377,7 @@ /pgfplots/compat/labels/1.5/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/1.5.1/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/1.6/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/1.7/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.3},% /pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( % @@ -3394,6 +3402,7 @@ \def\pgfplots@compat@scaling@coordmath{float}% \def\pgfplots@compat@scaling@coordmath@final{float}% }, + /pgfplots/compat/scaling/1.7/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/newest/.style={/pgfplots/compat/scaling/1.6}, /pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4}, % @@ -3404,6 +3413,7 @@ /pgfplots/compat/scale mode/1.5/.style= {/pgfplots/compat/scale mode/pre 1.3}, /pgfplots/compat/scale mode/1.5.1/.style= {/pgfplots/compat/scale mode/pre 1.3}, /pgfplots/compat/scale mode/1.6/.code=\def\pgfplots@compat@scale@mode@compatible@mode{0}, + /pgfplots/compat/scale mode/1.7/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/newest/.style={/pgfplots/compat/scale mode/1.6}, /pgfplots/compat/scale mode/default/.style={/pgfplots/compat/scale mode/1.5}, % @@ -3415,6 +3425,7 @@ /pgfplots/compat/plot3graphics/1.5/.code= {\def\b@pgfplots@compat@plot@graphics@threedim{1}},% /pgfplots/compat/plot3graphics/1.5.1/.style= {/pgfplots/compat/plot3graphics/1.5},% /pgfplots/compat/plot3graphics/1.6/.code= {\def\b@pgfplots@compat@plot@graphics@threedim{2}},% + /pgfplots/compat/plot3graphics/1.7/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/newest/.style= {/pgfplots/compat/plot3graphics/1.6},% /pgfplots/compat/plot3graphics/default/.style= {/pgfplots/compat/plot3graphics/1.5},% % @@ -3445,6 +3456,16 @@ % % Sorry. % + /pgfplots/compat/bar width by units/.is choice, + /pgfplots/compat/bar width by units/pre 1.3/.code= {\def\b@pgfplots@compat@bar@width@units{1}},% + /pgfplots/compat/bar width by units/1.3/.style= {/pgfplots/compat/bar width by units/pre 1.3}, + /pgfplots/compat/bar width by units/1.4/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.5/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.5.1/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.6/.style= {/pgfplots/compat/bar width by units/pre 1.3},% + /pgfplots/compat/bar width by units/1.7/.code= {\def\b@pgfplots@compat@bar@width@units{0}},% + /pgfplots/compat/bar width by units/newest/.style= {/pgfplots/compat/bar width by units/1.7}, + /pgfplots/compat/bar width by units/default/.style={/pgfplots/compat/bar width by units/pre 1.3}, % /pgfplots/compat/general/.is choice, /pgfplots/compat/general/pre 1.3/.style={/pgfplots/log origin=infty},% @@ -3453,13 +3474,14 @@ /pgfplots/compat/general/1.5/.style= {/pgfplots/compat/general/newest},% /pgfplots/compat/general/1.5.1/.style= {/pgfplots/compat/general/newest},% /pgfplots/compat/general/1.6/.style= {/pgfplots/compat/general/newest},% + /pgfplots/compat/general/1.7/.style= {/pgfplots/compat/general/newest},% /pgfplots/compat/general/newest/.style= {/pgfplots/log origin=0}, /pgfplots/compat/general/default/.style={/pgfplots/compat/general/newest}, % /pgfplots/compat/show suggested version/.is if=pgfplots@show@suggested@version, /pgfplots/compat/show suggested version=true, /pgfplots/compat/current/.initial=, - /pgfplots/compat/mostrecent/.initial=1.6, + /pgfplots/compat/mostrecent/.initial=1.7, /pgfplots/compat/.style={% % ATTENTION: *every* /pgfplots/compat/ setting needs to accept % the same choices due to this construction: @@ -3472,6 +3494,7 @@ /pgfplots/compat/general=#1,% /pgfplots/compat/path replacement=#1,% /pgfplots/compat/plot3graphics=#1,% + /pgfplots/compat/bar width by units=#1,% },% /pgfplots/compat/.default=pre 1.3,% this is used if you type '\pgfplotsset{compat}' without value /pgfplots/compat=default,% this is the initial config. @@ -3552,6 +3575,10 @@ },% } +% backwards compatibility: +\def\pgfplots@tickwidth{\pgfkeysvalueof{/pgfplots/major tick length}}% +\def\pgfplots@subtickwidth{\pgfkeysvalueof{/pgfplots/minor tick length}}% + \pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@colorbar@draw@defaultimpl % call @@ -4593,7 +4620,7 @@ \fi } -\pgfutil@ifundefined{AtBeginDocument}{}{% +\pgfutil@IfUndefined{AtBeginDocument}{}{% \AtBeginDocument{% \let\pgfplots@original@LaTeX@label@loadtime=\label }% @@ -4613,7 +4640,7 @@ \string\protect \string\csname\space #3#2\string\endcsname }% - \pgfutil@ifundefined{hyper@makecurrent}{}{% + \pgfutil@IfUndefined{hyper@makecurrent}{}{% \hyper@makecurrent{pgfplotslink}% \hyper@anchorstart{\@currentHref}{}\hyper@anchorend \pgfplotsutil@advancestringcounter@global\c@pgfplots@label @@ -4623,7 +4650,7 @@ % \label in sub \let\sf@@memsub@label=\pgfplots@original@LaTeX@label@loadtime % - \pgfutil@ifundefined{label}{% + \pgfutil@IfUndefined{label}{% }{% \def\pgfplots@loc@TMPa{\label #1}% \expandafter\pgfplots@loc@TMPa\expandafter{#2}% the \expandafter is a convenience method; the name should be expandable anyway @@ -4638,8 +4665,8 @@ \pgfplots@texdist@protect\pgfplotslegendfromname@{#1}% }% \def\pgfplotslegendfromname@#1{% - \pgfutil@ifundefined{pgfplots@legend@to@name@#1}{% - \pgfutil@ifundefined{ref}{% + \pgfutil@IfUndefined{pgfplots@legend@to@name@#1}{% + \pgfutil@IfUndefined{ref}{% \pgfplots@warning{There is no `legend to name=#1', sorry. I am skipping it}% \string\pgfplotslegendfromname{#1}: ??% }{% @@ -4654,8 +4681,8 @@ \pgfplots@texdist@protect\pgfplotscolorbarfromname@{#1}% }% \def\pgfplotscolorbarfromname@#1{% - \pgfutil@ifundefined{pgfplots@colorbar@to@name@#1}{% - \pgfutil@ifundefined{ref}{% + \pgfutil@IfUndefined{pgfplots@colorbar@to@name@#1}{% + \pgfutil@IfUndefined{ref}{% \pgfplots@warning{There is no `colorbar to name=#1', sorry. I am skipping it}% \string\pgfplotscolorbarfromname{#1}: ??% }{% @@ -4670,8 +4697,8 @@ \pgfplots@texdist@protect\pgfplotsplotfromname@{#1}% }% \def\pgfplotsplotfromname@#1{% - \pgfutil@ifundefined{pgfplots@show@ref@#1}{% - \pgfutil@ifundefined{ref}{% + \pgfutil@IfUndefined{pgfplots@show@ref@#1}{% + \pgfutil@IfUndefined{ref}{% \pgfplots@warning{There is no \string\addplot\space label `#1', sorry. I am skipping it}% \string\pgfplotsplotfromname{#1}: ??% }{% @@ -4683,7 +4710,7 @@ }% \def\pgfplots@ifintikzpicture#1#2{% - \pgfutil@ifundefined{filldraw}{#2}{#1}% + \ifpgfpicture #1\else #2\fi }% % DEPRECATED. @@ -4761,19 +4788,43 @@ }{}% \fi }% + +\def\pgfplots@enlargelimits@rel@unitserror#1{% + \pgfplots@error{enlarge limits only supports values with units for 'abs=#1' and/or 'abs value=#1'. Ignoring unit}% +}% \pgfkeysdef{/pgfplots/@enlargelimits/value}{% \pgfmathparse{#1}% + \ifpgfmathunitsdeclared + \pgfplots@enlargelimits@rel@unitserror{#1}% + \fi \let\pgfplots@enlargelimits@relthresh=\pgfmathresult \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty }% \pgfkeysdef{/pgfplots/@enlargelimits/rel}{\pgfkeysalso{true,value={#1}}}% \pgfkeysdef{/pgfplots/@enlargelimits/abs value}{% \begingroup - \pgfplotscoordmath{\pgfplots@enlargelimits@curaxis}{datascaletrafo set shift}{0}% - \expandafter\csname pgfplotstransformcoordinate\pgfplots@enlargelimits@curaxis\endcsname{#1}% - \pgfmath@smuggleone\pgfmathresult + \ifpgfplots@usefpu + \pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}% + \fi + \pgfmathparse{#1}% + \xdef\pgfplots@glob@TMPa{% + \ifpgfmathunitsdeclared + \noexpand\pgfmathunitsdeclaredtrue + \else + \noexpand\pgfmathunitsdeclaredfalse + \fi + \noexpand\def\noexpand\pgfmathresult{\pgfmathresult}% + }% \endgroup - \let\pgfplots@enlargelimits@absthresh=\pgfmathresult + \pgfplots@glob@TMPa + \ifpgfmathunitsdeclared + \edef\pgfplots@enlargelimits@absdimension{\pgfmathresult pt}% + \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty + \else + \let\pgfplots@enlargelimits@absdimension=\pgfutil@empty + \csname pgfplotstransformdirection\pgfplots@enlargelimits@curaxis\endcsname{\pgfmathresult}% + \let\pgfplots@enlargelimits@absthresh=\pgfmathresult + \fi \let\pgfplots@enlargelimits@relthresh=\pgfutil@empty }% \pgfkeysdef{/pgfplots/@enlargelimits/abs}{\pgfkeysalso{true,abs value={#1}}}% @@ -4781,10 +4832,31 @@ \def\pgfplots@enlarge@limit@ifconfigured#1{% \begingroup + % ATTENTION: this uses similar access patterns as + % \pgfplots@enlarge@limit@by@dimension \def\bool@pgfplots@loc@enlargelimits@min{0}% \def\bool@pgfplots@loc@enlargelimits@max{0}% + % + % we can either enlarge + % ... using a relative limit (like 0.1 -> 10%) \def\pgfplots@enlargelimits@relthresh{0.1}% the default + % ...or an absolute limit ( like 4 units) \let\pgfplots@enlargelimits@absthresh=\pgfutil@empty + % or an absolute dimension (like 1cm). + % + % Relative and absolute values are relatively simple: we only need to compute and + % add the changes to the already existing limits. The value with + % an absolute dimension is surprisingly complicated. + % + % The problem is: enlargelimits has to be computed before the + % image has been scaled into its final size. This is not merely a + % technical problem; this is how one wants it to be! + % + % The solution taken here is to communicate such an absolute + % dimension to the scaling routines. The scaling routines will + % handle the case; we don't change limits here. + % + \let\pgfplots@enlargelimits@absdimension=\pgfutil@empty \def\pgfplots@enlargelimits@curaxis{#1}% % \pgfkeysgetvalue{/pgfplots/enlarge #1 limits}{\pgfplots@loc@TMPa}% @@ -4803,13 +4875,230 @@ \pgfplots@enlarge@limit@for{#1}% \fi \global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany - % assignments are made globally. + % limits assignments are made globally. + \xdef\pgfplots@glob@TMPb{% + \noexpand\pgfplots@enlargelimits@remember@abs@dimension{#1}% + {\bool@pgfplots@loc@enlargelimits@min}% + {\bool@pgfplots@loc@enlargelimits@max}% + {\pgfplots@enlargelimits@absdimension}% + }% \endgroup + \pgfplots@glob@TMPb \if1\pgfplots@glob@TMPa \pgfplots@visphase@notify@changeofcanvaslimits{#1}% \fi } +% Reconfigures the scaling routines such that following calls to +% \pgfplots@scaleaxes@to@BB@ will enlarge the limit for a specific +% axis by an absolute dimension. +% +% This enlargement is different from standard limit enlargement: +% Standart limit enlargement is typically applied (and finished) long +% before the scaling routines start. In fact, the result of +% enlargelimits is typically the input argument for the scaling +% (compare the pgfplots manual (pdf)). +% +% This here needs a different treatment because "enlarge x limits={abs=1cm}" +% has to be applied AFTER the scaling is complete. To this end, it is +% applied as the very last scaling step. It is applied after any post +% scales, and it only modifies axis limits. +% +% #1: x,y, or z +% #2: 1 if the lower limit shall be enlarged, 0 if not +% #3: 1 if the upper limit shall be enlarged, 0 if not +% #4: some absolute dimension (like 1cm) by which we want to enlarge +% axis limits. +\def\pgfplots@enlargelimits@remember@abs@dimension#1#2#3#4{% + \expandafter\edef\csname pgfplots@enlargelimits@absdimension@#1\endcsname{#4}% + \expandafter\edef\csname pgfplots@enlargelimits@absdimension@#1@minmax\endcsname{{#2}{#3}}% +}% +\let\pgfplots@enlargelimits@absdimension@x=\pgfutil@empty +\let\pgfplots@enlargelimits@absdimension@y=\pgfutil@empty +\let\pgfplots@enlargelimits@absdimension@z=\pgfutil@empty + +% Called as soon as the scaling is completely set up and any +% "enlarge #1 limits={abs=1cm}" +% enlargements shall be done, i.e. enlargement by unit. +% +% #1: x,y, or z +\def\pgfplots@scaling@apply@enlargelimits@by@dimension#1{% + \expandafter\ifx\csname pgfplots@enlargelimits@absdimension@#1\endcsname\pgfutil@empty + \else + \pgfplotsconvertunittocoordinate{#1}{\csname pgfplots@enlargelimits@absdimension@#1\endcsname}% + \edef\pgfplots@loc@TMPa{% + \noexpand\pgfplots@enlarge@limit@by@dimension{#1} + \csname pgfplots@enlargelimits@absdimension@#1@minmax\endcsname + {\pgfmathresult}% + }% + \pgfplots@loc@TMPa + \fi +}% + + +% PRECONDITION: +% 1. width/height are set +% 2. the unit vectors point indicate whether the axis is a standard +% box or some skewed plot (their precise direction and magnitude is +% irrelevant) +% 3. the enlargelimits code has already evaluated the case +% "enlargelimits={abs=1cm}" +% +% POSTCONDITION: +% width and/or height might be modified +\def\pgfplots@scaling@changewidthheight@for@enlargelimits@by@dimension{% + \ifpgfplots@enlargelimits@respect@figure@size + % + % decide if we need to do anything at all, i.e. if there IS + % some option 'enlarge * limits={abs=1cm}' : + \pgfplots@loc@tmpfalse + \ifx\pgfplots@enlargelimits@absdimension@x\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + \ifx\pgfplots@enlargelimits@absdimension@y\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + \ifx\pgfplots@enlargelimits@absdimension@z\pgfutil@empty + \else + \pgfplots@loc@tmptrue + \fi + % + \ifpgfplots@loc@tmp + \def\pgfplotsretval{}% + % ok. We encountered an option 'enlarge * limits={abs=1cm}' for at least one axis. + % and we WANT to keep 'width', 'height'. + % + % This is not quite trivial because in order to compute + % enlarge-by-dimension, we NEED the unit vectors. But the + % unit vectors need the limits - a nonlinear problem. + % + % Since this here is not really a common use-case, I + % decided to implement a heuristics which works in most + % common cases: for standard 2d axes. It might fail for + % skewed axes and it will probably fail for 3d axes. + % + % My idea is to change width and/or height BEFORE the unit + % vectors have been computed. + % + % First: check if we HAVE a standard 2d axis. + \pgfplots@loc@tmpfalse + \ifpgfplots@threedim + \else + \ifdim\pgf@xx=0sp % + \else + \ifdim\pgf@xy=0sp % + \ifdim\pgf@yx=0sp % + \ifdim\pgf@yy=0sp % + \else + \pgfplots@loc@tmptrue + \fi + \fi + \fi + \fi + \fi + % + \ifpgfplots@loc@tmp + \def\pgfplots@loc@TMPc{{1}{1}}% + % + % ah - we really *have* a standard boxed axis. + % Compute + % newwidth = width - enlargevalue + % newheight = height - enlargevalue + % + % newwidth will be stored in \pgfplots@loc@TMPa + % and newheight in \pgfplots@loc@TMPb + \ifx\pgfplots@enlargelimits@absdimension@x\pgfutil@empty + \let\pgfplots@loc@TMPa=\pgfplots@width + \else + \ifx\pgfplots@enlargelimits@absdimension@x@minmax\pgfplots@loc@TMPc + \def\pgfmathresult{2}% + \else + \def\pgfmathresult{1}% + \fi + \pgfmathparse{\pgfplots@width - \pgfmathresult * \pgfplots@enlargelimits@absdimension@x}% + \edef\pgfplots@loc@TMPa{\pgfmathresult pt}% + \fi + % + \ifx\pgfplots@enlargelimits@absdimension@y\pgfutil@empty + \let\pgfplots@loc@TMPb=\pgfplots@height + \else + \ifx\pgfplots@enlargelimits@absdimension@y@minmax\pgfplots@loc@TMPc + \def\pgfmathresult{2}% + \else + \def\pgfmathresult{1}% + \fi + \pgfmathparse{\pgfplots@height - \pgfmathresult * \pgfplots@enlargelimits@absdimension@y}% + \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% + \fi + % + % OK. if( newwidth>0 && newheight>0 ), we can proceed. + \pgfplots@loc@tmpfalse + \ifdim\pgfplots@loc@TMPa>10pt % + \ifdim\pgfplots@loc@TMPb>10pt % + \pgfplots@loc@tmptrue + \fi + \fi + \ifpgfplots@loc@tmp + % Ah: newheight>0 && newheight>0 . Good. + \let\pgfplots@width=\pgfplots@loc@TMPa + \let\pgfplots@height=\pgfplots@loc@TMPb + \else + \def\pgfplotsretval{enlarge value are bigger than old picture size}% + \fi + \else + \def\pgfplotsretval{size adjust is unavailable for non-standard axes}% + \fi + \ifx\pgfplotsretval\pgfutil@empty + \else + \pgfplots@warning{enlargelimits respects figure size=true: could not respect the prescribed width/height (\pgfplotsretval). The size and/or aspect ratio of your image will be different than expected. You can try to modify BOTH width and height.}% + \fi + \fi + \fi +} + +% this here applies changes required for 'enlarge #1 limits={abs=1cm}', i.e. +% for the case of numbers with units. +% +% The main difference is that it is applied AFTER the scaling of the +% axis is complete. +% +% #1: x,y,or z +% #2: 1 if lower limit shall be changed +% #3: 1 if upper limit shall be changed +% #4: the absolute value +\def\pgfplots@enlarge@limit@by@dimension#1#2#3#4{% + \begingroup + % ATTENTION: this uses similar access patterns as + % \pgfplots@enlarge@limit@ifconfigured + \def\bool@pgfplots@loc@enlargelimits@min{#2}% + \def\bool@pgfplots@loc@enlargelimits@max{#3}% + % + \let\pgfplots@enlargelimits@relthresh=\pgfutil@empty + \def\pgfplots@enlargelimits@absthresh{#4} + \def\pgfplots@enlargelimits@curaxis{#1}% + % + \def\bool@pgfplots@loc@enlargeany{0}% + \if1\bool@pgfplots@loc@enlargelimits@min + \def\bool@pgfplots@loc@enlargeany{1}% + \else + \if1\bool@pgfplots@loc@enlargelimits@max + \def\bool@pgfplots@loc@enlargeany{1}% + \fi + \fi + \if1\bool@pgfplots@loc@enlargeany + \pgfplots@enlarge@limit@for{#1}% + \fi + \global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany + % limits assignments are made globally. + \endgroup + \if1\pgfplots@glob@TMPa + \pgfplots@visphase@notify@changeofcanvaslimits{#1}% + \fi +} + + % Helper method inside of \pgfplots@enlarge@limit@ifconfigured. % % It modifies '#1min' and '#1max' (globally!) according to the already prepared @@ -4819,9 +5108,16 @@ \expandafter\let\expandafter\pgfplots@@min\csname pgfplots@#1min\endcsname \expandafter\let\expandafter\pgfplots@@max\csname pgfplots@#1max\endcsname \ifx\pgfplots@enlargelimits@relthresh\pgfutil@empty - % we have an absolute enlarge value: - \let\enlargeabsolute=\pgfplots@enlargelimits@absthresh - \pgf@xb=\pgfplots@enlargelimits@absthresh pt + \ifx\pgfplots@enlargelimits@absthresh\pgfutil@empty + % ups. No enlargement!? OK, can happen for 'abs=1cm' ... + % numbers with unit are processed later (after the scaling + % is set up) + \pgf@xb=0pt % + \else + % we have an absolute enlarge value: + \let\enlargeabsolute=\pgfplots@enlargelimits@absthresh + \pgf@xb=\pgfplots@enlargelimits@absthresh pt + \fi \else % we have a relative enlarge value: \pgfmathsubtract@\pgfplots@@max\pgfplots@@min% @@ -6087,7 +6383,7 @@ }% \def\pgfplotssetaxistype#1{% - \pgfutil@ifundefined{pgfplots@axistype@#1}{% + \pgfutil@IfUndefined{pgfplots@axistype@#1}{% \pgfplots@error{Sorry, 'axis type=#1' is unknown. Maybe you need to load a proper library first or you misspelled the name? Ignoring it}% }{% \csname pgfplots@axistype@#1\endcsname @@ -6895,7 +7191,7 @@ \def\pgfplots@prepare@layered@graphics{% % check if there are no layers at all. \ifpgfplots@layered@graphics - \pgfutil@ifundefined{pgf@layerlist}{% + \pgfutil@IfUndefined{pgf@layerlist}{% }{% \ifx\pgf@layerlist\pgfutil@empty \pgfplots@layered@graphicsfalse @@ -7070,7 +7366,7 @@ \else % cell picture=false | cell picture=if necessary \edef\pgfplots@shapename{pgfplots@low@level@shape@INNER}% - \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% + \pgfutil@IfUndefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% % we need to compute the anchor a posteriorily. \if0\pgfplots@cell@picture@mode % cell picture=false is forbidden here... @@ -8649,6 +8945,15 @@ \pgfkeyssetfamily{/tikz/alias}{/pgfplots/naming commands}% \pgfkeyssetfamily{/tikz/overlay}{/pgfplots/shared with tikz}% \pgfkeyssetfamily{/tikz/variable}{/pgfplots}% + % + % ... we need to set these options during the survey phase + % (because it might be interesting for enlarge limits to depend + % upon their value): + \pgfkeysdef{/pgfplots/bar width}{\pgfkeysalso{/pgf/bar width={##1}}}% + \pgfkeysdef{/pgfplots/bar shift}{\pgfkeysalso{/pgf/bar shift={##1}}}% + \pgfkeyssetfamily{/pgf/bar width}{/pgfplots}% + \pgfkeyssetfamily{/pgf/bar shift}{/pgfplots}% + % \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@rmopts}% % \let\tikz@alias=\pgfutil@empty @@ -9517,7 +9822,7 @@ \pgfplots@autocompute@all@limitsfalse \fi % - \pgfutil@ifundefined{pgfmathdeclarefunction}{% + \pgfutil@IfUndefined{pgfmathdeclarefunction}{% % SKIP: \pgfmathdeclarefunction is unavailable in pgf 2.00 . % UPGRADE TO PGF 2.10 to use these math functions. }{% @@ -9553,7 +9858,7 @@ \pgfplots@stacked@reversefalse \fi % - \pgfutil@ifundefined{label}{\relax}{% + \pgfutil@IfUndefined{label}{\relax}{% \let\pgfplots@original@LaTeX@label=\label \let\label=\pgfplots@plot@label }% @@ -9599,7 +9904,7 @@ % creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% \def\pgfplots@phase@name{v}% - \pgfutil@ifundefined{label}{\relax}{% + \pgfutil@IfUndefined{label}{\relax}{% % restore. \let\label=\pgfplots@original@LaTeX@label }% @@ -9717,7 +10022,7 @@ \tikz@fig@mustbenamed % \edef\pgfplots@shapename{pgfplots@low@level@shape\ifpgfplots@deprecated@anchors @deprecated\fi}% - \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% + \pgfutil@IfUndefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% % Oh. Well, suppose \pgfplots@anchorname is associated to an % INNER node. \def\pgfplots@loc@TMPa##1{% @@ -9837,7 +10142,7 @@ \else %\message{Attempting to correct '\pgfplots@child@node@name' position by \meaning\pgfplots@offset\space (the node is inside of an axis).}% \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% - \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% + \pgfutil@IfUndefined{pgf@sh@nt@\pgfplots@child@node@name}{% \pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}% }{% \pgf@shift@node{\pgfplots@child@node@name}{\pgfplots@offset}% @@ -9883,7 +10188,7 @@ } -\pgfutil@ifundefined{tikzaddtikzonlycommandshortcutlet}{% +\pgfutil@IfUndefined{tikzaddtikzonlycommandshortcutlet}{% \def\tikzaddtikzonlycommandshortcutlet#1#2{% \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands \let#1=#2 |