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 | 122 |
1 files changed, 111 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex index 98cb20753e4..66e9cd8693f 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -148,6 +148,10 @@ % FIXME : does that need further attention? \def\pgfplots@init@scaled@tick@for#1{% \global\def\pgfplots@glob@TMPa{0}% + \expandafter\pgfplotslistcheckempty\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \ifpgfplotslistempty + % we have no tick labels. Omit the tick scale label as well! + \else \begingroup \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname\relax % CASE 0 : scaled #1 ticks=false: do nothing here. @@ -172,17 +176,18 @@ % \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E + \pgfplots@init@scaled@tick@normalize@exponents \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E \pgfmathfloat@b@E=\pgfmathfloat@a@E \fi \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@above@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E + \ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E % ok, scale it: \multiply\pgfmathfloat@b@E by-1 \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% \else \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@below@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E + \ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E % ok, scale it: \multiply\pgfmathfloat@b@E by-1 \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% @@ -207,9 +212,88 @@ \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@scaled@ticks@#1@arg\endcsname \fi \endgroup + \fi \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% } +% Handles the case that one of the limits is 0 (or unbounded, although +% that might not be a use-case at all). +% +% Note that 0 = 0*10^A (naturally). In this case, A can be undefined, +% and we want to use B's exponent (only) for the decision here. +% +% INPUT: +% - \pgfplots@cur@min@unscaled, +% - \pgfplots@cur@max@unscaled, +% - \pgfmathfloat@a@E +% - \pgfmathfloat@b@E +% +% Output: +% normalized values of \pgfmathfloat@a@E and \pgfmathfloat@b@E +\def\pgfplots@init@scaled@tick@normalize@exponents{% + \pgfmathfloatgetflags\pgfplots@cur@min@unscaled\pgfmathfloat@a@S + \pgfmathfloatgetflags\pgfplots@cur@max@unscaled\pgfmathfloat@b@S + \ifcase\pgfmathfloat@a@S% + % min = 0. + \ifcase\pgfmathfloat@b@S + % max =0 + % normalize to 0 * 10^0 ! + \pgfmathfloat@a@E=0 % + \pgfmathfloat@b@E=0 % + \or + % max > 0 + % since 0 = 0 * 10^A for any A, tick scaling is based on + % B only. + \pgfmathfloat@a@E=\pgfmathfloat@b@E + \or + % max < 0 + \pgfmathfloat@a@E=\pgfmathfloat@b@E + \else + % max is unbounded. normalize exponent to something + % useful: + \pgfmathfloat@a@E=0 % + \pgfmathfloat@b@E=0 % + \fi + \or + % min>0 + \ifcase\pgfmathfloat@b@S + % max =0 + % since 0 = 0 * 10^B for any B, tick scaling is based on + % A only. + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \or + % max > 0 + \or + % max < 0 + \else + % max is unbounded. normalize exponent to something + % useful: + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \fi + \or + % min<0 + \ifcase\pgfmathfloat@b@S + % max =0 + % since 0 = 0 * 10^B for any B, tick scaling is based on + % A only. + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \or + % max > 0 + \or + % max < 0 + \else + % max is unbounded. normalize exponent to something + % useful: + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \fi + \else + % min is unbounded: + % normalize somehow. + \pgfmathfloat@a@E=0 % + \pgfmathfloat@b@E=0 % + \fi +} + % x-axis tick labels for #1th tick % #1: the axis (x,y or z) % #2: the value @@ -445,6 +529,7 @@ \pgfplotsqpointoutsideofaxis{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}% }% \def\pgfplotsqpointoutsideofticklabelaxisrel#1#2#3{% +%\message{using \string\pgfplotsqpointoutsideofaxisrel{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}^^J}% \pgfplotsqpointoutsideofaxisrel{\csname pgfplots@#1ticklabelaxisspec\endcsname}{#2}{#3}% }% \def\pgfplotsqpointoutsideofticklabelaxistransformed#1#2#3{% @@ -536,26 +621,41 @@ \tick } +\def\pgfplots@limit@max@reg#1{% + \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n% + \csname pgfplots@#1max@reg\endcsname + \else + \csname pgfplots@#1min@reg\endcsname + \fi +}% +\def\pgfplots@limit@min@reg#1{% + \if\pgfkeysvalueof{/pgfplots/#1 dir/value}n% + \csname pgfplots@#1min@reg\endcsname + \else + \csname pgfplots@#1max@reg\endcsname + \fi +}% + % Check if a label does not cross the x-axis \def\pgfplots@ytick@check@tickshow{% \pgfplots@tickshowtrue \if\pgfplots@yaxislinesnum2% center \ifcase\pgfplots@xaxislinesnum\relax \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -570,7 +670,7 @@ }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@ymax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{y}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -726,20 +826,20 @@ \if\pgfplots@xaxislinesnum2% center \ifcase\pgfplots@yaxislinesnum\relax \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmin@reg} + {\pgfplots@tmpa}{\pgfplots@limit@min@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -753,7 +853,7 @@ }{}% \or \pgfplotsmath@ifapproxequal@dim - {\pgfplots@tmpa}{\pgfplots@xmax@reg} + {\pgfplots@tmpa}{\pgfplots@limit@max@reg{x}} {\pgfplots@loc@tick@placement@tolerance} {% \pgfplots@tickshowfalse @@ -1972,7 +2072,7 @@ \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 \else - \pgfplots@warning{Tick computation for direction #1 failed; there are always too few tick labels (try min ticks has already been advanced to \axisdefaulttryminticks)}% + \pgfplotswarning{tick computation failed}{#1}{\axisdefaulttryminticks}\pgfeov% \def\pgfplots@tick@returnval@ready{0}% \fi \pgfmath@smuggleone\pgfplots@tick@returnval@ready |