summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex63
1 files changed, 48 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex
index 32c2cdacd0c..478c3fe2bef 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.scaling.code.tex
@@ -3004,7 +3004,18 @@
\def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{%
\pgfmathfloatparsenumber{#1}%
\expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2\relax
- \advance#2 by1\relax
+ \advance#2 by1
+}
+
+\def\pgfplots@if@is@float@zero#1#2#3{%
+ \pgfmathfloatparsenumber{#1}%
+ \pgfmathfloatgetflags{\pgfmathresult}{\c@pgf@countd}%
+ \ifnum\c@pgf@countd=0 %
+ % ah - it *is* 0.0:
+ #2%
+ \else
+ #3%
+ \fi
}
% Initialises the data scale transformation such that it is optimal
@@ -3051,21 +3062,43 @@
\let\pgfplots@data@min@float=\pgfmathresult
\fi
%
-%\message{minmax = [\pgfplots@data@min@float,\pgfplots@data@max@float]}%
+%\message{minmax = [\pgfplots@data@min@float,\pgfplots@data@max@float]^^J}%
% Step 1: compute 'm', the data order
- \pgfplots@compute@number@order@for@trafo@isfloat
- \pgfplots@data@min@float
- \tocount\data@cur@order
- %
- \data@max@order=\data@cur@order
+ \pgfplots@if@is@float@zero{\pgfplots@data@min@float}{%
+ \pgfplots@if@is@float@zero{\pgfplots@data@max@float}{%
+ \data@max@order=1 % both are zero. ok.
+ % Note that this is '1' due to backwards
+ % compatibility.
+ }{%
+ % one of them is zero. Take the other one!
+ \pgfplots@compute@number@order@for@trafo@isfloat
+ \pgfplots@data@max@float
+ \tocount\data@cur@order
+ \data@max@order=\data@cur@order
+ }%
+ }{%
+ \pgfplots@if@is@float@zero{\pgfplots@data@max@float}{%
+ % one of them is zero. Take the other one!
+ \pgfplots@compute@number@order@for@trafo@isfloat
+ \pgfplots@data@min@float
+ \tocount\data@cur@order
+ \data@max@order=\data@cur@order
+ }{%
+ % none of them is zero. Compute MAX:
+ \pgfplots@compute@number@order@for@trafo@isfloat
+ \pgfplots@data@min@float
+ \tocount\data@cur@order
+ \data@max@order=\data@cur@order
+ \pgfplots@compute@number@order@for@trafo@isfloat
+ \pgfplots@data@max@float
+ \tocount\data@cur@order
+ \ifnum\data@cur@order>\data@max@order
+ \data@max@order=\data@cur@order
+ \fi
+ }%
+ }%
%
- \pgfplots@compute@number@order@for@trafo@isfloat
- \pgfplots@data@max@float
- \tocount\data@cur@order
%
- \ifnum\data@cur@order>\data@max@order
- \data@max@order=\data@cur@order
- \fi
%
% Step 2: compute 'q', the #1-size of the axis.
%\expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty
@@ -3105,7 +3138,7 @@
% \data@dimen@order=3
%\fi
%
-%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }%
+%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. ^^J}%
\data@EXPONENT=\data@dimen@order
\advance\data@EXPONENT by-\data@max@order
% Now, I introduce a loop which shall avoid cancellation of
@@ -3138,7 +3171,7 @@
\pgfplotscoordmath{#1}{datascaletrafo}{\pgfplots@data@max@float}%
\let\pgfplots@max@fixed=\pgfmathresult
\data@tmp=\pgfplots@max@fixed pt
-%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}%
+%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...^^J}%
\ifdim\data@tmp<0pt
% I need absolute values here:
\multiply\data@tmp by-1\relax