diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex | 1219 |
1 files changed, 811 insertions, 408 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex index d953f779f01..416d888a511 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -211,12 +211,15 @@ } % x-axis tick labels for #1th tick -% #1: the axis (x or y) +% #1: the axis (x,y or z) % #2: the value % #3,#4: coordinates for \pgfplotspointonorientedsurfaceab % #5: ticknumber -\def\pgfplots@show@ticklabel#1#2(#3,#4)#5{{% +\def\pgfplots@show@ticklabel#1#2(#3,#4)#5{% + \begingroup% \csname ifpgfplots@#1ticklabel@interval\endcsname + % Special case for the INTERVAL feature: + % we have to do additional work here. \pgfmathparse{#3}% \edef\pgfplots@show@ticklabel@coord@x@new{\pgfmathresult}% \pgfmathparse{#4}% @@ -231,15 +234,13 @@ % acquire options of first interval boundary: \pgfplots@show@ticklabel@LASTTICK % compute new node position: - \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#1\endcsname + \csname pgfplots@show@ticklabel@coord@#1@new\endcsname)}% - \expandafter\edef\csname pgfplots@show@ticklabel@coord@#1\endcsname{\pgfmathresult}% + \pgfmathparse{0.5*(\pgfplots@show@ticklabel@coord@x + \pgfplots@show@ticklabel@coord@x@new)}% + \let\pgfplots@show@ticklabel@coord@x=\pgfmathresult% + \pgfmathparse{0.5*(\pgfplots@show@ticklabel@coord@y + \pgfplots@show@ticklabel@coord@y@new)}% + \let\pgfplots@show@ticklabel@coord@y=\pgfmathresult% \let\ticknum=\pgfplots@show@ticklabel@num\relax% \let\tick=\pgfplots@show@ticklabel@tick% - \edef\pgfplots@loc@TMPa{at (\pgfplots@show@ticklabel@coord@x,\pgfplots@show@ticklabel@coord@y)}% - \begingroup - \pgftransformshift{\pgfplotspointonorientedsurfaceab{\pgfplots@show@ticklabel@coord@x}{\pgfplots@show@ticklabel@coord@y}}% - \node at (0pt,0pt) {\csname pgfplots@#1ticklabel\endcsname};% - \endgroup + \pgfplots@show@ticklabel@@{#1}{\pgfplotspointonorientedsurfaceab{\pgfplots@show@ticklabel@coord@x}{\pgfplots@show@ticklabel@coord@y}}% \fi \xdef\pgfplots@show@ticklabel@LASTTICK{% \noexpand\def\noexpand\pgfplots@show@ticklabel@tick{\nexttick}% @@ -250,76 +251,216 @@ \else \let\ticknum=#5\relax% \pgfplots@show@ticklabel@{#1}{#2}% + \pgfplots@show@ticklabel@@{#1}{\pgfplotspointonorientedsurfaceab{#3}{#4}}% + \fi + \endgroup +} + +% #1: the axis (x,y or z) +% #2: the location where to place it. +\def\pgfplots@show@ticklabel@@#1#2{% + % Typeset the label! + \pgfinterruptboundingbox + % What makes this complicated is the 'ticklabel cs' feature. + % What we need is to compute the MAXIMUM LENGTH over each tick + % label IN DIRECTION OF THE OUTER NORMAL. + % + % This needs to + % 1. enable bounding box computation even in case of + % 'overlay', + % 2. projection of the bounding box in direction of the outer + % normal, + % 3. update of the bounding box if 'overlay' is not active. \begingroup - \pgftransformshift{\pgfplotspointonorientedsurfaceab{#3}{#4}}% -% -%-------------------------------------------------- -% \iffalse -% %\iftrue -% % The following code is experimental and contains automatically -% % aligned tick labels (especially for 3D axes). It's not quite -% % finished. -% % -% %\tracingmacros=2\tracingcommands=2 -% \message{HIER}% -% \if x\pgfplotspointonorientedsurfaceB -% \if y\pgfplotspointonorientedsurfaceN -% \def\pgfplotspointonorientedsurfbN##1##2{\pgfplotsqpointxyz{##1}{##2}{0}}% -% \else% N == z: -% \def\pgfplotspointonorientedsurfbN##1##2{\pgfplotsqpointxyz{##1}{0}{##2}}% -% \fi -% \else -% \if y\pgfplotspointonorientedsurfaceB -% \if x\pgfplotspointonorientedsurfaceN -% \def\pgfplotspointonorientedsurfbN##1##2{\pgfplotsqpointxyz{##2}{##1}{0}}% -% \else% N == z: -% \def\pgfplotspointonorientedsurfbN##1##2{\pgfplotsqpointxyz{0}{##1}{##2}}% -% \fi -% \else -% % B == z -% \if y\pgfplotspointonorientedsurfaceN -% \def\pgfplotspointonorientedsurfbN##1##2{\pgfplotsqpointxyz{0}{##2}{##1}}% -% \else% N == x: -% \def\pgfplotspointonorientedsurfbN##1##2{\pgfplotsqpointxyz{##2}{0}{##1}}% -% \fi -% \fi -% \fi -% %\message{a == \pgfplotspointonorientedsurfaceA, b == \pgfplotspointonorientedsurfaceB, N == \pgfplotspointonorientedsurfaceN. zeug=\meaning\pgfplotspointonorientedsurfbN.}% -% \if0\pgfplots@ticklabelside -% % this means : the 'b' axis of the surface is on the lower axis -% % limit. Since we want tick labels OUTSIDE of the axis, we need -% % sign = -1. -% \def\pgfplots@loc@TMPa{-}% -% \else -% % in this case, we the OUTSIDE area requires a plus sign - the b -% % axis already points to the outside. -% \def\pgfplots@loc@TMPa{}% -% \fi -% \if0\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol -% % same as before: the N axis is on the lower axis limit. -% % So: sign -1 -% \def\pgfplots@loc@TMPb{-}% -% \else -% \def\pgfplots@loc@TMPb{}% -% \fi -% \pgfmathparse{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname * \pgfplots@loc@TMPa 0.2cm}% -% \let\pgfplots@loc@TMPa=\pgfmathresult -% \pgfmathparse{\csname pgfplots@\pgfplotspointonorientedsurfaceN @inverseveclength\endcsname * \pgfplots@loc@TMPb 0.2cm}% -% \let\pgfplots@loc@TMPb=\pgfmathresult -% %-------------------------------------------------- -% % \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}% -% % \pgfpathlineto{\pgfplotspointonorientedsurfbN{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}}% -% % \pgfusepath{stroke} -% %-------------------------------------------------- -% \pgftransformshift{\pgfplotspointonorientedsurfbN{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}}% -% \tikzset{every node/.append style={anchor=center}}% -% \fi -%-------------------------------------------------- -% - \node at (0pt,0pt) {\csname pgfplots@#1ticklabel\endcsname};% + % + % prepare step (1.): + \pgfkeysalso{% + /tikz/every node/.append code={% + \ifpgf@relevantforpicturesize + \gdef\pgfplots@show@ticklabel@@update@BB{1}% + \else + \gdef\pgfplots@show@ticklabel@@update@BB{0}% + \fi + \pgf@relevantforpicturesizetrue + }% + }% + % + % Compute and remember the position '#2': + \pgf@process{#2}% + \edef\pgfplots@ticklabel@at@x{\the\pgf@x}% + \edef\pgfplots@ticklabel@at@y{\the\pgf@y}% + % + % ok, generate the label! + \node at (\pgfplots@ticklabel@at@x,\pgfplots@ticklabel@at@y) {\csname pgfplots@#1ticklabel\endcsname};% + % + % compute the label's dimensions, step (2.): + \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath + {#1} + {\pgf@x=\pgfplots@ticklabel@at@x\space\pgf@y=\pgfplots@ticklabel@at@y\space}%% + % + % prepare step (3.): update of bounding box: + \if\pgfplots@show@ticklabel@@update@BB1% + \xdef\pgfplots@glob@TMPa{% + \pgf@xa=\the\pgf@picminx\space + \pgf@xb=\the\pgf@picminy\space + \pgf@ya=\the\pgf@picmaxx\space + \pgf@yb=\the\pgf@picmaxy\space + \noexpand\pgf@protocolsizes{\pgf@xa}{\pgf@xb}% + \noexpand\pgf@protocolsizes{\pgf@ya}{\pgf@yb}% + \noexpand\pgf@resetpathsizes + }% + \else + \global\let\pgfplots@glob@TMPa=\relax + \fi \endgroup + \endpgfinterruptboundingbox + \begingroup + \pgfplots@glob@TMPa + \endgroup +}% + +% TICK LABEL DIMENSION CONTROL +% +% The following framework is supposed to accumulate the value for +% \pgfplotsvalueoflargesttickdimen. +% +% It works like this: +% +% \pgfplots@ticklabel@maxtickdimen@reset{#1} +% \pgfplots@ticklabel@maxtickdimen@prepare@for@normalvec{#1}{<normal vector>} +% ... +% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath{#1} +% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath{#1} +% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath{#1} +% ... +% \pgfplots@ticklabel@maxtickdimen@finish{#1} +% +% -> then, \pgfplotsvalueoflargesttickdimen expands to the largest +% distance from a tick's coordinate to its tick label bounding box in +% direction of the outer normal vector. +\def\pgfplots@ticklabel@maxtickdimen@reset#1{% + \expandafter\gdef\csname pgfplots@maxtickdimen@#1\endcsname{0pt}% + \expandafter\gdef\csname pgfplots@maxtickdimen@extrashift@#1\endcsname{0pt}% +}% + +% Adds the extra shift '#2' along the normal vector for axis '#1'. +\def\pgfplots@ticklabel@maxtickdimen@extrashift#1#2{% + \begingroup + \afterassignment\pgfplots@gobble@until@relax + \pgf@xa=#2pt\relax + \advance\pgf@xa by\csname pgfplots@maxtickdimen@extrashift@#1\endcsname\relax + \expandafter\xdef\csname pgfplots@maxtickdimen@extrashift@#1\endcsname{\the\pgf@xa}% + \endgroup +} + +% Finalizes the maxtickdimen computation. +% +% This applies any extra shifts (including '#1ticklabel shift'). +\def\pgfplots@ticklabel@maxtickdimen@finish#1{% + \pgfkeysgetvalue{/pgfplots/#1ticklabel shift}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@ticklabel@maxtickdimen@extrashift{#1}{\pgfkeysvalueof{/pgfplots/#1ticklabel shift}}% \fi -}} + \begingroup + \pgf@xa=\csname pgfplots@maxtickdimen@extrashift@#1\endcsname\relax + \advance\pgf@xa by \csname pgfplots@maxtickdimen@#1\endcsname\relax + \expandafter\xdef\csname pgfplots@maxtickdimen@#1\endcsname{\the\pgf@xa}% + \endgroup +}% +% +% #1: the axis (x,y or z) +% #2: the normal vector +\def\pgfplots@ticklabel@maxtickdimen@prepare@for@normalvec#1#2{% + \pgf@process{#2}% + \edef\pgfplots@loc@vector@to@outside{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + % Identify the corner point of the ticklabel bounding box which + % shall be used: + \ifdim\pgf@x>0sp + \ifdim\pgf@y>0sp + % NORTH EAST + \def\pgfplots@loc@ticklabel@bb@corner{\pgf@x=\pgf@picmaxx\pgf@y=\pgf@picmaxy}% + \else + % SOUTH EAST + \def\pgfplots@loc@ticklabel@bb@corner{\pgf@x=\pgf@picmaxx\pgf@y=\pgf@picminy}% + \fi + \else + \ifdim\pgf@y>0sp + % NORTH WEST + \def\pgfplots@loc@ticklabel@bb@corner{\pgf@x=\pgf@picminx\pgf@y=\pgf@picmaxy}% + \else + % SOUTH WEST + \def\pgfplots@loc@ticklabel@bb@corner{\pgf@x=\pgf@picminx\pgf@y=\pgf@picminy}% + \fi + \fi +}% + +% #1: the axis (x,y or z) +% #2: the point from where dimension shall be computed (the 'at' +% argument of the tick label) +\def\pgfplots@ticklabel@maxtickdimen@updateforcurrentpath#1#2{% + \pgfplotsscalarproductofvectors + {\pgfplots@loc@vector@to@outside}% + {\pgfpointdiff + {#2}% + {\pgfplots@loc@ticklabel@bb@corner}}% + \ifdim\pgf@x>\csname pgfplots@maxtickdimen@#1\endcsname\relax + \expandafter\xdef\csname pgfplots@maxtickdimen@#1\endcsname{\the\pgf@x}% + \fi +}% + +% Expands to the largest distance of a tick position to its tick label +% bounding box in direction of the outer unit normal vector. +% +% It does also include the value of the 'ticklabel shift' key. +% +% This function assumes that +% \pgfplots@ticklabel@maxtickdimen@reset{#1} +% \pgfplots@ticklabel@maxtickdimen@prepare@for@normalvec{#1}{<normal vector>} +% ... +% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath{#1} +% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath{#1} +% \pgfplots@ticklabel@maxtickdimen@updateforcurrentpath{#1} +% ... +% \pgfplots@ticklabel@maxtickdimen@finish{#1} +% has been invoked completely. +% +% #1: either x,y or z. It denotes the axis for which the ticks are +% requested. +\def\pgfplotsvalueoflargesttickdimen#1{% + \csname pgfplots@maxtickdimen@#1\endcsname +}% + +% Just like \pgfplotsqpointoutsideofaxis, but this one here uses the +% axis on which tick labels will be drawn. +% +% #1: one of x, y or z. +% #2: the coordinate on the tick axis designated by '#1'. +% #3: a scale (a dimen) in which the point is moved in direction of +% the outward normal vector of the axis. +% +% @see \pgfplotsqpointoutsideofaxis +\def\pgfplotsqpointoutsideofticklabelaxis#1#2#3{% + \pgfplotsqpointoutsideofaxis{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}% +}% +\def\pgfplotsqpointoutsideofticklabelaxisrel#1#2#3{% + \pgfplotsqpointoutsideofaxisrel{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}% +}% +\def\pgfplotsqpointoutsideofticklabelaxistransformed#1#2#3{% + \pgfplotsqpointoutsideofaxistransformed{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}% +}% + +% Expands to the three-character-identification for the axis +% containing tick labels for axis #1. +% +% #1: either x, y or z. +\def\pgfplotsticklabelaxisspec#1{\csname pgfplots@#1ticklabelaxisspec\endcsname}% + +% The unit outer normal vector for axis #1. +% #1: one of x, y or z. +\def\pgfplotspointouternormalvectorofticklabelaxis#1{% + \pgfplotspointouternormalvectorofaxis{\csname pgfplots@#1ticklabelaxisspec\endcsname}% +} % Defines \tick by applying any necessary math to the (possibly % transformed) tick value #2. @@ -397,32 +538,55 @@ % Check if a label does not cross the x-axis \def\pgfplots@ytick@check@tickshow{% \pgfplots@tickshowtrue - \ifnum\pgfplots@yaxislinesnum=2 % + \if\pgfplots@yaxislinesnum2% center \ifcase\pgfplots@xaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@ymin@reg\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@ymax@reg\relax - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@ymin@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@ymax@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% \or - \ifdim\pgfplots@tmpa=\pgfplots@ymin@reg\relax - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@ymin@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{% + }% \or - \ifdim\pgfplots@tmpa=\pgfplots@logical@ZERO@y pt - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@logical@ZERO@y pt} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% \or - \ifdim\pgfplots@tmpa=\pgfplots@ymax@reg\relax - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@ymax@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% \fi \fi } \def\pgfplots@ztick@check@tickshow{% \pgfplots@tickshowtrue - % FIXME + \if\pgfplots@zaxislinesnum2% center + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@logical@ZERO@z pt} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% + \fi }% % Fills the macros @@ -438,7 +602,11 @@ % #2 : the current tick width % \def\pgfplots@prepare@tick@offsets@for@#1#2{% + % FIXME : this stuff was ok for 2D. + % For 3D, it works only for the cases of boxed axes or centered + % axis lines. \ifcase\csname pgfplots@#1tickposnum\endcsname\relax + % both %(\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt) \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}% \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% @@ -453,6 +621,7 @@ \pgfmathsubtract@{\pgfplots@tick@beg@b}{#2}% \let\pgfplots@tick@end@b=\pgfmathresult% \or + % left % (\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt); \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}% \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% @@ -460,20 +629,22 @@ \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% \let\pgfplots@tick@end@a=\pgfmathresult \or + % center % (\pgfplots@ZERO@x -\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt); \pgfmathsubtract@{\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB \endcsname}{\pgfplots@tick@offset}% \let\pgfplots@tick@beg@a=\pgfmathresult \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% \let\pgfplots@tick@end@a=\pgfmathresult% \or + % right % (\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#2, 0pt); - \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}% - \pgfmathadd@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathsubtract@{\pgfplots@tick@beg@a}{#2}% - \let\pgfplots@tick@end@a=\pgfmathresult% + \edef\pgfplots@tick@beg@b{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}% + \pgfmathadd@{\pgfplots@tick@beg@b}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@b=\pgfmathresult + \pgfmathsubtract@{\pgfplots@tick@beg@b}{#2}% + \let\pgfplots@tick@end@b=\pgfmathresult% \else - % FALL BACK + % FALL BACK. never used, I guess? % (\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt); \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}% \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% @@ -522,11 +693,9 @@ \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key \else \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/#1tick scale label code/.@cmd}{\pgfplots@glob@TMPa}}% - \pgftransformshift{\pgfplotspointsouthwest}% - \pgfsetxvec{\pgfplotspointxaxis}% - \pgfsetyvec{\pgfplotspointyaxis}% - % FIXME : do I need the fix for 'current axis.origin' - % here!? + % + \pgfplots@change@pgfpoints@to@descriptioncs + % \node[% /pgfplots/every tick label,% /pgfplots/every #1 tick label,% @@ -544,26 +713,41 @@ % This is just a special case for centered axis lines. \def\pgfplots@xtick@check@tickshow{% \pgfplots@tickshowtrue - \ifnum\pgfplots@xaxislinesnum=2 % + \if\pgfplots@xaxislinesnum2% center \ifcase\pgfplots@yaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@xmin@reg\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@xmax@reg\relax - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@xmin@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@xmax@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% \or - \ifdim\pgfplots@tmpa=\pgfplots@xmin@reg\relax - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@xmin@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% \or - \ifdim\pgfplots@tmpa=\pgfplots@logical@ZERO@x pt % - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@logical@ZERO@x pt} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% \or - \ifdim\pgfplots@tmpa=\pgfplots@xmax@reg\relax - \pgfplots@tickshowfalse - \fi + \pgfplotsmath@ifapproxequal@dim + {\pgfplots@tmpa}{\pgfplots@xmax@reg} + {\pgfplots@loc@tick@placement@tolerance} + {% + \pgfplots@tickshowfalse + }{}% \fi \fi } @@ -584,12 +768,13 @@ \begingroup \def\pgfplots@scaled@ticks@x@choice{0}% \def\pgfplots@scaled@ticks@y@choice{0}% + \def\pgfplots@scaled@ticks@z@choice{0}% \csname pgfplots@#1minorticksfalse\endcsname \csname pgfplots@#1minorgridsfalse\endcsname \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP \pgfplotsset{/pgfplots/every extra #1 tick}% - \expandafter\pgfplots@prepare@tick@coordlists@for\pgfplotspointonorientedsurfaceA{#2}% + \pgfplots@prepare@tick@coordlists@for{#1}{#2}% \pgfplots@drawgridlines@onorientedsurf% \pgfplots@drawticklines@onorientedsurf% \pgfplots@drawticklabels@onorientedsurf% @@ -611,6 +796,12 @@ % - \pgfplots@determinedefaultvalues has been executed. % That means particularly that \pgfplots@[xy][min,max] are available in TeX point % range (after datascaling and logs). +% POSTCONDITION: +% - the lists +% \pgfplots@prepared@tick@positions@major@x +% \pgfplots@prepared@tick@positions@major@tickindices@x +% \pgfplots@prepared@tick@positions@minor@x +% are ready. \def\pgfplots@prepare@tick@coordlists@for#1#2{% \begingroup \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname @@ -620,7 +811,17 @@ % of \foreach statements. And, yes: I have also added a TeX group % on my own (but that's not the problem). \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@major + \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@major@tickindices \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@minor + % + \afterassignment\pgfplots@gobble@until@relax + \pgfplots@tmpa=\pgfkeysvalueof{/pgfplots/#1tick placement tolerance}pt\relax + \pgfplots@tmpa=\csname pgfplots@#1@inverseveclength\endcsname\pgfplots@tmpa + \edef\pgfplots@loc@tick@placement@tolerance{\the\pgfplots@tmpa}% + % + \advance\csname pgfplots@#1min@reg\endcsname by-\pgfplots@tmpa + \advance\csname pgfplots@#1max@reg\endcsname by\pgfplots@tmpa + % \edef\pgfplots@loc@TMPa{#2}% \ifx\pgfplots@loc@TMPa\pgfutil@empty \else @@ -672,7 +873,10 @@ \fi % % + \gdef\pgfplots@glob@TMPa{0}% \foreach \x in {#2} {% + \let\pgfplots@ticknum=\pgfplots@glob@TMPa + % \pgfplots@tmpa=\x pt % \csname pgfplots@#1tick@check@tickshow\endcsname \pgfplots@checktickminmax @@ -683,6 +887,7 @@ \ifdim\pgfplots@tmpa>\csname pgfplots@#1max@reg\endcsname \else \expandafter\pgfplotslistpushbackglobal\x\to\pgfplots@prepared@tick@positions@major + \expandafter\pgfplotslistpushbackglobal\pgfplots@ticknum\to\pgfplots@prepared@tick@positions@major@tickindices \fi \fi \fi @@ -696,7 +901,7 @@ \pgfplots@tmpa=\pgfplots@minor@tick@dist pt % \pgfplots@tmpa=\pgfplots@i\pgfplots@tmpa \else - \pgfplots@tmpa=\logi\pgfplots@i pt % + \pgfplots@tmpa=\csname pgfplotsmathlogi@#1\endcsname\pgfplots@i pt % \fi \edef\pgfmathresult{\the\pgfplots@tmpa}% \pgfmath@smuggleone\pgfmathresult @@ -716,12 +921,17 @@ \fi }% \fi + \pgfplotsutil@advancestringcounter\pgfplots@ticknum + % carry \ticknum outside of this scope: + \global\let\pgfplots@glob@TMPa=\pgfplots@ticknum }% \fi \endgroup \expandafter\let\csname pgfplots@prepared@tick@positions@minor@#1\endcsname=\pgfplots@prepared@tick@positions@minor \expandafter\let\csname pgfplots@prepared@tick@positions@major@#1\endcsname=\pgfplots@prepared@tick@positions@major + \expandafter\let\csname pgfplots@prepared@tick@positions@major@tickindices@#1\endcsname=\pgfplots@prepared@tick@positions@major@tickindices \global\let\pgfplots@prepared@tick@positions@major=\relax + \global\let\pgfplots@prepared@tick@positions@major@tickindices=\relax \global\let\pgfplots@prepared@tick@positions@minor=\relax }% @@ -740,65 +950,53 @@ \expandafter\pgfplots@drawgridlines@onorientedsurf@\pgfplotspointonorientedsurfaceA }% \def\pgfplots@drawgridlines@onorientedsurf@#1{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorgrids\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorgrids\endcsname - % grid lines shall be drawn - % if and only if BOTH adjacent axis lines shall be drawn: - \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% - % remark: this is ALWAYS true for 2D plots. - \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% - \def\pgfplots@drawgridlines@onorientedsurf@OK{1}% - }{% - \def\pgfplots@drawgridlines@onorientedsurf@OK{0}% - }% + \pgfplots@if{pgfplots@shownothingof@\pgfplotspointonorientedsurfaceB}{% + \relax }{% - \def\pgfplots@drawgridlines@onorientedsurf@OK{0}% - }% - \if1\pgfplots@drawgridlines@onorientedsurf@OK - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - \pgfplots@loop@CONTINUEfalse - \ifpgfplots@major - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@minor - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@loop@CONTINUE - \scope - \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 - \ifpgfplots@major - \draw[% - /pgfplots/every axis grid, - /pgfplots/every major grid, - /pgfplots/every axis #1 grid, - /pgfplots/every major #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curgridpos{% - \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% - \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every axis grid, - /pgfplots/every minor grid, - /pgfplots/every axis #1 grid, - /pgfplots/every minor #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curgridpos{% - \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% - \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% - }% - \endpgfextra; + \begingroup + \pgfplots@ifgridlines@onorientedsurf@should@be@drawn{% + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname + \pgfplots@loop@CONTINUEfalse + \pgfplots@if{pgfplots@#1majorgrids}{\pgfplots@loop@CONTINUEtrue}{}% + \pgfplots@if{pgfplots@#1minorgrids}{\pgfplots@loop@CONTINUEtrue}{}% + \ifpgfplots@loop@CONTINUE + \scope + \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 + % + \pgfplots@if{pgfplots@#1minorgrids}{% + \draw[% + /pgfplots/every axis grid, + /pgfplots/every minor grid, + /pgfplots/every axis #1 grid, + /pgfplots/every minor #1 grid]% + \pgfextra + \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curgridpos{% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% + }% + \endpgfextra; + }{}% + % + \pgfplots@if{pgfplots@#1majorgrids}{% + \draw[% + /pgfplots/every axis grid, + /pgfplots/every major grid, + /pgfplots/every axis #1 grid, + /pgfplots/every major #1 grid]% + \pgfextra + \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curgridpos{% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% + }% + \endpgfextra; + }{}% + % + \endscope \fi - \endscope - \fi - \fi - \endgroup + }{}% + \endgroup + }% } % Draws ticks on the currently active "oriented surface". @@ -847,6 +1045,8 @@ \begingroup \pgf@xa=5cm \edef\pgfplots@loc@TMPc{\pgf@sys@tonumber{\pgf@xa}}% + % the case ||e_b|| == 0 should never happen here! Should be + % caught before entering this routine. \pgfmathmultiply@{\pgfplots@loc@TMPc}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% \let\pgfplots@loc@LENGTH=\pgfmathresult \pgfmathsubtract@{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}{\pgfplots@loc@LENGTH}% @@ -863,168 +1063,217 @@ }% \def\pgfplots@drawticklines@onorientedsurf@#1{% - \scope - \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% - \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{1}% - }{% - \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{0}% - }% - \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% - \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{1}% + \pgfplots@if{pgfplots@shownothingof@\pgfplotspointonorientedsurfaceB}{% + \relax }{% - \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{0}% - }% - \begingroup - % Assemble the \pgfplots@drawticklines@for@placecomputedtick - % command. - \let\E=\noexpand - \xdef\pgfplots@drawticklines@for@placecomputedtick{% - \if\pgfplots@drawticklines@for@placecomputedtick@LOWEROK1% - \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@a}}% - \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@a}}% - \fi - \if\pgfplots@drawticklines@for@placecomputedtick@UPPEROK1% - \ifnum\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname=0\relax - \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@b}}% - \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@b}}% + \scope + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% + \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{1}% + }{% + \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{0}% + }% + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{1}% + }{% + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{0}% + }% + \if\pgfkeysvalueof{/pgfplots/\pgfplotspointonorientedsurfaceB\space dir/value}r% + % local special handling for reversed axes: exchange + % meaning of 'left' and 'right' here. + % + % the rest of the pgfplots code does that automatically because + % there, tickposnum is relevant to determine the axes + % which contains tick labels. And this algorithm checks + % for reversed axes implicitly. + % + \if1\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname + \expandafter\def\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname{3}% + \else + \if3\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname + \expandafter\def\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname{1}% \fi \fi - }% - \endgroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorticks\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 - \ifpgfplots@major - \draw[% - /pgfplots/every tick, - /pgfplots/every major tick, - /pgfplots/every #1 tick, - /pgfplots/every major #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@tickwidth}% - \let\pgfplots@tickwidth@=\pgfmathresult - \pgfmathmultiply@{\pgfplots@tickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% - \let\pgfplots@tickwidth@=\pgfmathresult - \let\pgfplots@tickwidth=\pgfmathresult - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0}% - \or - \let\pgfplots@tick@offset=\pgfplots@tickwidth@% - \or - \pgfmathmultiply@{0.5}{\pgfplots@tickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% \fi - \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@tickwidth@}% - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% - \pgfplots@drawticklines@for@placecomputedtick - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every tick, - /pgfplots/every minor tick, - /pgfplots/every #1 tick, - /pgfplots/every minor #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@subtickwidth}% - \let\pgfplots@subtickwidth@=\pgfmathresult - \pgfmathmultiply@{\pgfplots@subtickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% - \let\pgfplots@subtickwidth@=\pgfmathresult - \let\pgfplots@subtickwidth=\pgfmathresult - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0}% + \ifcase\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname\relax + % both \or - \let\pgfplots@tick@offset=\pgfplots@subtickwidth@% + % lower + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{0}% \or - \pgfmathmultiply@{0.5}{\pgfplots@subtickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% + % center + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{0}% + \or + % upper + \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{0}% + \else + % never used? + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{0}% \fi - \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@subtickwidth@}% - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curtickpos{% - \pgfplots@drawticklines@for@placecomputedtick - }% - \endpgfextra; - \fi - \endscope + \begingroup + % Assemble the \pgfplots@drawticklines@for@placecomputedtick + % command. + \let\E=\noexpand + \xdef\pgfplots@drawticklines@for@placecomputedtick{% + \if\pgfplots@drawticklines@for@placecomputedtick@LOWEROK1% + \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@a}}% + \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@a}}% + \fi + \if\pgfplots@drawticklines@for@placecomputedtick@UPPEROK1% + \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@b}}% + \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@b}}% + \fi + }% + \endgroup + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname + \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 + % + \pgfplots@if{pgfplots@#1minorticks}{% + \draw[% + /pgfplots/every tick, + /pgfplots/every minor tick, + /pgfplots/every #1 tick, + /pgfplots/every minor #1 tick]% + \pgfextra + \pgfmathparse{\pgfplots@subtickwidth}% + \let\pgfplots@subtickwidth@=\pgfmathresult + \pgfmathmultiply@{\pgfplots@subtickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@subtickwidth@=\pgfmathresult + \let\pgfplots@subtickwidth=\pgfmathresult + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfplots@tick@offset{0}% + \or + \let\pgfplots@tick@offset=\pgfplots@subtickwidth@% + \or + \pgfmathmultiply@{0.5}{\pgfplots@subtickwidth@}% + \let\pgfplots@tick@offset=\pgfmathresult% + \fi + \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@subtickwidth@}% + \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curtickpos{% + \pgfplots@drawticklines@for@placecomputedtick + }% + \endpgfextra; + }{}% + % + \pgfplots@if{pgfplots@#1majorticks}{% + \draw[% + /pgfplots/every tick, + /pgfplots/every major tick, + /pgfplots/every #1 tick, + /pgfplots/every major #1 tick]% + \pgfextra + \pgfmathparse{\pgfplots@tickwidth}% + \let\pgfplots@tickwidth@=\pgfmathresult + \pgfmathmultiply@{\pgfplots@tickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@tickwidth@=\pgfmathresult + \let\pgfplots@tickwidth=\pgfmathresult + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfplots@tick@offset{0}% + \or + \let\pgfplots@tick@offset=\pgfplots@tickwidth@% + \or + \pgfmathmultiply@{0.5}{\pgfplots@tickwidth@}% + \let\pgfplots@tick@offset=\pgfmathresult% + \fi + \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@tickwidth@}% + \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% + \pgfplots@drawticklines@for@placecomputedtick + }% + \endpgfextra; + }{}% + % + \endscope + }% } -% Draws tick labels at the A positions of the currently set oriented +% Draws tick labels at the positions of the currently set oriented % surface. % % Tick positions are taken out of the already precomputed list % \pgfplots@prepared@tick@positions@major@... % +% For 2D axes, this task is relatively simple: +% we iterate through every prepared major tick position and place a +% tick label. Open points, however, are the question whether to use +% the RIGHT or the LEFT axis line on the current oriented surface: +% +% direction 'b' (second oriented) +% |-------------------------| +% | | +% | | +% | |direction 'a' (first oriented) +% | | +% | | +% | | +% |-------------------------| +% Left Right +% +% Given the axis line which shall contain the labels, we have to +% decide how to align the tick label nodes: on the left or on the +% right? Of course, we want to align them such that they are "outside" +% of the figure! That's simple as well: "Left axis line => outside +% means left", "Right axis line => outside means right". +% +% That's all, basically. +% +% For 3D axes, all these points are basically ... the same! +% Now it can happen that the current oriented surface shall +% not contain ANY tick label. In that case, we do nothing. +% Furthermore, the "outside" direction (i.e. the anchoring of the +% label nodes) is a little bit more difficult. +% +% % See \pgfplots@drawticklines@onorientedsurf@ for a description of the % oriented surface. -% -% #1 : the verbatim axis name (either 'x' or 'y') \def\pgfplots@drawticklabels@onorientedsurf{% \expandafter\pgfplots@drawticklabels@onorientedsurf@\pgfplotspointonorientedsurfaceA } \def\pgfplots@drawticklabels@onorientedsurf@#1{% \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + % check whether + % - we need to place tick labels on the LEFT side, + % - we need to place tick labels on the RIGHT side, + % - we don't need tick labels for the current surface at all: \pgfplotspointonorientedsurfaceabmatchaxisline{\csname pgfplots@#1ticklabelaxisspec\endcsname}{\pgfplots@ticklabelside}% \ifx\pgfplots@ticklabelside\pgfutil@empty % SKIP. The current oriented surface shall not get tick labels % for #1. \else - \ifpgfplots@major - \ifpgfplots@islinear + \pgfplots@if{pgfplots@#1majorticks}{% + \pgfplots@if{pgfplots@#1islinear}{% \pgfplots@init@scaled@tick@for{#1}% - \fi + }{\relax}% \begingroup - \if\pgfplotspointonorientedsurfaceB x - \def\pgfplots@tickposchoicea{\tikzset{right}}% - \def\pgfplots@tickposchoiceb{\tikzset{left}}% - \else - \if\pgfplotspointonorientedsurfaceB y - \def\pgfplots@tickposchoicea{\tikzset{above}}% - \def\pgfplots@tickposchoiceb{\tikzset{below}}% - \else - \def\pgfplots@tickposchoicea{\tikzset{anchor=north east}}% - \def\pgfplots@tickposchoiceb{\tikzset{anchor=south east}}% - \fi - \fi + \pgfkeysalso{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}% + \pgfplots@drawticklabels@onorientedsurf@prepareanchor#1% % - \pgfkeys{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfmathresult{0}% - \or - \pgfmathparse{\pgfplots@tickwidth}% - \or - \pgfmathmultiply{0.5}{\pgfplots@tickwidth}% - \fi - \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% - \let\pgfplots@tick@offset=\pgfmathresult - %-------------------------------------------------- - % \ifnum\csname pgfplots@#1ticklabelaxisspec\endcsname=0 - % % the choice '[xy]ticklabel pos=default': - % \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1tickposnum\endcsname - % \else - % \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1ticklabelaxisspec\endcsname - % \fi - % \ifcase\pgfplots@tmpposnum\relax - % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% - % \or - % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% - % \or - % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname% - % \or - % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname% - % \fi - %-------------------------------------------------- - \ifnum\csname pgfplots@#1axislinesnum\endcsname=2 % Centered axis lines? + \pgfplotsmath@ifzero{\csname pgfplots@\pgfplotspointonorientedsurfaceB @veclength\endcsname}{% + \def\pgfplots@tick@offset{0}% + }{% + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfmathresult{0}% + \or + \pgfmathparse{\pgfplots@tickwidth}% + \or + \pgfmathmultiply{0.5}{\pgfplots@tickwidth}% + \fi + \let\pgfplots@tick@offset=\pgfmathresult + \pgfplots@ticklabel@maxtickdimen@extrashift{#1}{\pgfplots@tick@offset}% + \pgfmathmultiply@{\pgfplots@tick@offset}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@tick@offset=\pgfmathresult + }% + % + \if2\csname pgfplots@#1axislinesnum\endcsname % Centered axis lines? \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname% % FIXME : that stuff here does not respect % '[xyz]tickpos num' keys! \pgfplots@tickposchoiceb + \if r\pgfkeysvalueof{/pgfplots/\pgfplotspointonorientedsurfaceB\space dir/value}% + % special handling for reversed axes. + \pgfmathmultiply{-1}{\pgfplots@tick@offset}% + \let\pgfplots@tick@offset=\pgfmathresult + \fi \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% \else \if0\pgfplots@ticklabelside @@ -1037,6 +1286,7 @@ \pgfplots@tickposchoicea \pgfmathadd@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% \else + % Should never happen. \pgfplots@error{Internal logic error during tick label placement (got placement character '\pgfplots@ticklabelside'). Please report this as a bug or verify your input arguments to #1ticklabel pos.}% \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% @@ -1046,27 +1296,134 @@ \fi \fi % + % make sure the \pgfmathlogtologten method works even for + % non-standard 'log basis #1': + \expandafter\let\expandafter\pgfmathlogtologten@\csname pgfplotsmathlogtologten@#1@\endcsname + % \let\pgfplots@tick@origin=\pgfmathresult% - \def\pgfplots@ticknum{0}% \xdef\pgfplots@show@ticklabel@LASTTICK{}% \pgfplotslistforeachungrouped\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% + \expandafter\pgfplotslistpopfront\csname pgfplots@prepared@tick@positions@major@tickindices@#1\endcsname\to\pgfplots@ticknum \pgfplots@show@ticklabel {#1}{\pgfplots@curtickpos}(\pgfplots@curtickpos,\pgfplots@tick@origin)% {\pgfplots@ticknum}% - \begingroup - \c@pgf@counta=\pgfplots@ticknum\relax - \advance\c@pgf@counta by1 - \edef\pgfplots@ticknum{\the\c@pgf@counta}% - \pgfmath@smuggleone\pgfplots@ticknum - \endgroup }% + \pgfplots@ticklabel@maxtickdimen@finish{#1}% \endgroup \pgfplots@draw@tick@scale@label@for #1% - \fi + }% + {\relax}% if...@major==false \fi \endgroup } +% This here does the main work for any tick label ANCHORING. +% +% FIXME : the new 'near ticklabel' anchors are now the default method +% to place tick labels. +% +% This feature here can be used to disable this anchoring, i.e. set +% 'ticklabel anchor=tikz' to use a stupid heuristics. +% +% There are actually two choices: +% Choice 1: near ticklabel +% This choice places tick labels fully automatic outside of the +% figure, all on a line which is parallel to the axis which +% contains the corresponding tick labels. +% +% Since we are currently working on a restricted surface, we have +% three direction related to that surface: +% 'a': this is the direction in which tick positions are known. +% 'b': the 'orthogonal' axis to 'a' which is also in the surface. +% 'n': the surface normal. +% Now, the idea for tick labels is to place them at +% SCALE_b * b + SCALE_n * n, +% where the SCALE_[bn] numbers are choosen such that the label is +% outside of the axis. +% +% The offset is simply added to the transformation matrix (as a +% shift). +% +% Choice 2: tikz. +% This is more or less a backwards compatibility feature. It does +% not change the transformation matrix. It simply sets the 'at' key +% of each node to the tick position and prepares the correct anchors +% for the TikZ '\node' commands. +% That's all here. +% +% PRECONDITION: +% - called inside of \pgfplots@drawticklabels@onorientedsurf@ +% POSTCONDITION: +% - defines +% - \pgfplots@tickposchoicea +% if called, sets keys such that tick labels are RIGHT (TOP) of +% the axis, +% +% - \pgfplots@tickposchoiceb +% if called, sets keys such that tick labels are LEFT +% (BOTTOM) of the axis, +\def\pgfplots@drawticklabels@onorientedsurf@prepareanchor#1{% + \if\csname pgfplots@ticklabel@anchor@#1\endcsname0% + % auto is the same as 'near ticklabel': + \expandafter\def\csname pgfplots@ticklabel@anchor@#1\endcsname{1}% + \fi + \ifcase\csname pgfplots@ticklabel@anchor@#1\endcsname% + % 0: doesn't happen, see above. + \or + % 1: near ticklabel. + % The following code contains automatically + % aligned tick labels (especially for 3D axes). + % see the manual for the |near ticklabel| anchors. + \pgfkeys{/tikz/anchor=near #1ticklabel}% + % + % process the (optional) ticklabel distance: + \begingroup + \pgfkeysgetvalue{/pgfplots/#1ticklabel shift}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \afterassignment\pgfplots@gobble@until@relax + \pgf@xa=\pgfkeysvalueof{/pgfplots/#1ticklabel shift}pt\relax + \multiply\pgf@xa by-1 % the direction vector points to the INSIDE. the shift should have opposite sign. + \edef\pgfmathresult{\pgf@sys@tonumber\pgf@xa}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplots@loc@TMPc=\pgfmathresult + \ifx\pgfplots@loc@TMPc\pgfutil@empty + \else + \pgftransformshift{% + \pgfplotspointouternormalvectorofticklabelaxis{#1}% + \pgfqpointscale{-\pgfplots@loc@TMPc}{}% + }% + \fi + % + % these things are irrelevant here: + \let\pgfplots@tickposchoicea=\pgfutil@empty + \let\pgfplots@tickposchoiceb=\pgfutil@empty + \or + % 2: tikz. + % We simply prepare the default anchor. + % Actually, this code is just for backwards compatibility - + % there may be people who prefer to set anchors. The + % 'near ticklabel' implementation is much more general, however. + \if\pgfplotspointonorientedsurfaceB x + \def\pgfplots@tickposchoicea{\tikzset{right}}% + \def\pgfplots@tickposchoiceb{\tikzset{left}}% + \else + \if\pgfplotspointonorientedsurfaceB y + \def\pgfplots@tickposchoicea{\tikzset{above}}% + \def\pgfplots@tickposchoiceb{\tikzset{below}}% + \else + \def\pgfplots@tickposchoicea{\tikzset{anchor=north east}}% + \def\pgfplots@tickposchoiceb{\tikzset{anchor=south east}}% + \fi + \fi + \fi + \pgfplots@ticklabel@maxtickdimen@prepare@for@normalvec + {#1}% + {\pgfplotspointouternormalvectorofticklabelaxis{#1}}% +}% + \newif\ifpgfplots@checkuniform@isfirst % Checks whether the argument to xtick or ytick is a UNIFORM tick % sequence. @@ -1153,10 +1510,14 @@ % helper method which computes log10*\x foreach \x in {#1}. % The result will be \xdef'ed into #2. -\def\pgfplots@compute@tick@times@logten#1\to#2{% +% +% #1: the ticks +% #2: the output macro +% #3: the axis +\def\pgfplots@compute@tick@times@logten#1\to#2#3{% \global\let#2=\pgfutil@empty \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathmultiply@\pgfplots@loc@TMPb\logten% + \pgfmathmultiply@{\pgfplots@loc@TMPb}{\csname pgfplots@log@scale@todisplaylog@#3\endcsname}% \ifx#2\pgfutil@empty \xdef#2{\pgfmathresult}% \else @@ -1253,24 +1614,25 @@ % \let\desirednumticks=\c@pgf@countd \let\Wr=\pgf@xc - \Wr=\csname pgfplotspoint#1axislength\endcsname + \Wr=\csname pgfplotspoint#1axislength\endcsname\relax % r = max place without ticks in pt -> choose desirednumticks >= W/r - \expandafter\expandafter\divide\Wr\axisdefaulttickwidth - \pgfmathsetcount{\desirednumticks}{\Wr}% + \divide\Wr by\axisdefaulttickwidth\relax + \afterassignment\pgfplots@gobble@until@relax + \desirednumticks=\the\Wr\relax \advance\desirednumticks by1 \csname ifpgfplots@#1islinear\endcsname - \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks - \desirednumticks=\axisdefaulttryminticks + \ifnum\axisdefaulttryminticks>\desirednumticks\relax + \desirednumticks=\axisdefaulttryminticks\relax \fi \else - \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks + \ifnum\pgfplots@default@try@minticks@log>\desirednumticks\relax \desirednumticks=\pgfplots@default@try@minticks@log\relax \fi \expandafter\ifx\csname pgfplots@#1tickten\endcsname\pgfutil@empty \else % log plot and tickten-option: provide special processing. \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tickten\endcsname}% - \expandafter\pgfplots@compute@tick@times@logten\pgfplots@loc@TMPa\to\pgfplots@glob@TMPa + \expandafter\pgfplots@compute@tick@times@logten\pgfplots@loc@TMPa\to\pgfplots@glob@TMPa{#1}% \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa \fi \fi @@ -1283,15 +1645,15 @@ \let\MAX=\pgf@ya \let\MIN=\pgf@yb % compute step size 'H': - \expandafter\MAX\csname pgfplots@#1max\endcsname pt + \expandafter\MAX\csname pgfplots@#1max\endcsname pt % \advance\MAX by0.001pt % avoid round errors %\expandafter\MIN\the\c@pgf@counta pt - \expandafter\MIN\csname pgfplots@#1min\endcsname pt + \expandafter\MIN\csname pgfplots@#1min\endcsname pt % \H=\MAX \advance\H by-\MIN %\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.}% \c@pgf@counta=\desirednumticks - \advance\c@pgf@counta by-1 + \advance\c@pgf@counta by-1 % \divide\H by\c@pgf@counta %\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% % @@ -1366,10 +1728,10 @@ \fi % % And, since we have used finite precision, I is most - % likely to large. So: subtract one H. In the worst + % likely to be large. So: subtract one H. In the worst % case, this produces one tick position too much (but % it won't be printed). - \advance\MIN by-\H + \advance\MIN by-\H\relax \else % CASE LOG AXIS % @@ -1377,7 +1739,7 @@ % % And prefer j=1 if that is possible (otherwise minor % ticks are not useful). - \pgfmathmultiply@{\Hmacro}{\reciproclogten}% + \pgfmathmultiply@{\Hmacro}{\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname}% \let\Hmacrobaseten=\pgfmathresult \expandafter\H\pgfmathresult pt %\message{ [ H / log(10) = \pgfmathresult ]}% @@ -1399,7 +1761,7 @@ \pgfplots@isuniformtickfalse \fi %\message{final H=\pgf@sys@tonumber{\H} * log(10)}% - \H=\logten\H\relax + \H=\csname pgfplots@log@scale@todisplaylog@#1\endcsname\H\relax % Now, we want to activate the Tick set % {lowest, lowest+H, ..., highest} % @@ -1412,14 +1774,14 @@ \MINH=\MIN % % and compute I and I*log(10) here: - \expandafter\MIN\reciproclogten\MIN\relax + \MIN=\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname\MIN\relax \edef\pgfmathresult{\pgf@sys@tonumber{\MIN}}% \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% \ifdim\MIN<0pt % the truncation rounds TOWARDS 0 which is not what I want. \advance\c@pgf@counta by-1 \fi - \expandafter\MIN\logten pt + \MIN=\csname pgfplots@log@scale@todisplaylog@#1\endcsname pt \multiply\MIN by\c@pgf@counta \ifpgfplots@isuniformtick \else @@ -1449,7 +1811,7 @@ \advance\MINH by-\H % \ifdim\MINH<0pt - \expandafter\advance\expandafter\MIN\logten pt + \advance\MIN \csname pgfplots@log@scale@todisplaylog@#1\endcsname pt \fi \fi \fi @@ -1464,94 +1826,112 @@ % MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by % construction, but I don't care about this case). % So: check only the second condition. + \def\pgfplots@tick@returnval@ready{0}% \pgfplots@tmpa=\MINH \advance\pgfplots@tmpa by\H \ifdim\MAX<\pgfplots@tmpa - \aftergroup\pgfplots@isuniformtickfalse - % ok, do something special. - % - % The idea is now to place ticks at - % 10^{i*h} with properly choosen 'h'. - % - % So: apply basically the SAME code as above for linear - % axis, just everything log 10! And keep in mind that all - % coordinates are actually given as natural logarithms. - \expandafter\MIN\csname pgfplots@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN - \H=\reciproclogten\H + \pgfplots@if{pgfplots@#1islinear}{% + \def\pgfplots@tick@returnval@ready{1}% + \begingroup + \c@pgf@counta=\axisdefaulttryminticks\relax + \advance\c@pgf@counta by1 + \edef\axisdefaulttryminticks{\the\c@pgf@counta}% +%\message{**TOO FEW TICK LABELS. RECURSION with try min ticks=\axisdefaulttryminticks.**}% + % recurse. + \pgfplots@assign@default@tick@foraxis{#1}% + \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname + \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPb\csname pgfplots@tick@distance@#1\endcsname + \endgroup + }{% + \aftergroup\pgfplots@isuniformtickfalse + % ok, do something special. + % + % The idea is now to place ticks at + % 10^{i*h} with properly choosen 'h'. + % + % So: apply basically the SAME code as above for linear + % axis, just everything log 10! And keep in mind that all + % coordinates are actually given as natural logarithms. + \expandafter\MIN\csname pgfplots@#1min\endcsname pt + \H=\MAX + \advance\H by-\MIN + \H=\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname\H %\message{Axis limit #1: [\the\MIN:\the\MAX], diff/log(10) = \the\H.}% - \c@pgf@counta=\desirednumticks\relax - \advance\c@pgf@counta by-1 - \ifnum\c@pgf@counta>2 - % subtract one more. This algorithm here produces more - % ticks than the normal one which is designed for 10^i + \c@pgf@counta=\desirednumticks\relax \advance\c@pgf@counta by-1 - \fi - \divide\H by\c@pgf@counta\relax -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - \edef\Hmacro{\pgf@sys@tonumber\H}% - \pgfmathfloatparsenumber{\Hmacro}% - \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E - % Determine properly snapped mantisse... - \ifdim\H<2pt - \ifdim\H<1.5pt - \H=1.0pt - \else - \H=2.0pt + \ifnum\c@pgf@counta>2 + % subtract one more. This algorithm here produces more + % ticks than the normal one which is designed for 10^i + \advance\c@pgf@counta by-1 \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \H=2.0pt\relax + \divide\H by\c@pgf@counta\relax +%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% + % + % SEARCH for the NEXT FEASABLE H. + \edef\Hmacro{\pgf@sys@tonumber\H}% + \pgfmathfloatparsenumber{\Hmacro}% + \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E + % Determine properly snapped mantisse... + \ifdim\H<2pt + \ifdim\H<1.5pt + \H=1.0pt \else - \H=5.0pt\relax + \H=2.0pt \fi \else - \ifdim\H<7.5pt - \H=5.0pt\relax + \ifdim\H<4.9999pt + \ifdim\H<3.5pt + \H=2.0pt\relax + \else + \H=5.0pt\relax + \fi \else - \H=1.0pt\relax - \advance\pgfmathfloat@a@E by1 + \ifdim\H<7.5pt + \H=5.0pt\relax + \else + \H=1.0pt\relax + \advance\pgfmathfloat@a@E by1 + \fi \fi \fi - \fi - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\Hmacro=\pgfmathresult - \H=\Hmacro pt % - % Ok, our step size h for 10^{i*h} is ready! + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\Hmacro=\pgfmathresult + \H=\Hmacro pt % + % Ok, our step size h for 10^{i*h} is ready! %\message{determined step size 10^{\Hmacro}}% - % Now, we want to activate the Tick set {10^{i*H}, i in \Z} - % compute I such that - % 10^{min} = 10^{I * H + rest}; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - % BUT EVERYTHING to log(10) basis! - \MIN=\reciproclogten\MIN\relax - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\Hmacro}% + % Now, we want to activate the Tick set {10^{i*H}, i in \Z} + % compute I such that + % 10^{min} = 10^{I * H + rest}; |rest| < H + % -> I = round(xmin/H) + % -> MIN = I * H + % BUT EVERYTHING to log(10) basis! + \MIN=\csname pgfplots@log@scale@todisplaylog@#1@inv\endcsname \MIN\relax + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber\MIN}% + {\Hmacro}% + }% + \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% + \ifdim\MIN<0pt + % the truncation rounds TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \MIN=\H\relax + \multiply\MIN by\c@pgf@counta\relax + % + % convert back to basis 'e': + \MIN=\csname pgfplots@log@scale@todisplaylog@#1\endcsname\MIN\relax + \H=\csname pgfplots@log@scale@todisplaylog@#1\endcsname\H\relax + \MINH=\MIN\relax + \advance\MINH by\H\relax }% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \MIN=\H\relax - \multiply\MIN by\c@pgf@counta\relax - % - % convert back to basis 'e': - \MIN=\logten\MIN\relax - \H=\logten\H\relax - \MINH=\MIN\relax - \advance\MINH by\H\relax \fi -%\pgfplots@message{final H=\the\H.}% - \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\H}}% +%\message{final H=\the\H.}% + \if0\pgfplots@tick@returnval@ready + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\H}}% + \advance\MAX by0.5\H % avoid rounding inaccuracies: + \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% + \fi \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformtickfalse \else \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname @@ -1561,7 +1941,7 @@ \endgroup \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@glob@TMPb -%\pgfplots@message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% +%\message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% } % Helper method for @@ -1600,3 +1980,26 @@ }% % }% + +% Adds a further, temporary anchor to every node which will be +% processed. The anchor will be named '#2'. It is placed such that +% 1. the node's center is on a line in direction of the inwards normal +% vector of the #1 ticklabel axis and the 'at' position of the node, +% 2. the node does not intrude the axis. +% +% In effect, one of the node's standard anchors (north, east, ... ) +% will be placed on the line +% \draw[blue,thick,->] (xticklabel cs:0,0) -- (xticklabel cs:1,0); +% +% This command is identical to calling +% \pgfplotsdeclareborderanchorforaxis{#1}{<three-char-string-of-#1-ticklabel-axis>}{#2} +% +% @REMARKS: +% - it is -by no means- necessary that any ticks or tick labels are +% drawn or defined for this method. +% - in fact, tick labels use such an anchor (the 'near #1ticklabel' +% anchor is defined in this way) +\def\pgfplotsdeclareborderanchorforticklabelaxis#1#2{% + \pgfplotsdeclareborderanchorforaxis{#1}{\pgfplotsticklabelaxisspec{#1}}{#2}% +} + |