summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex170
1 files changed, 90 insertions, 80 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex
index 6b8c58a9e30..926476e73b5 100644
--- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex
+++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex
@@ -4,7 +4,7 @@
%
% Provides a user-friendly interface to create function plots (normal
% plots, semi-logplots and double-logplots).
-%
+%
% It is based on Till Tantau's PGF package.
%
% Copyright 2007/2008 by Christian Feuersänger.
@@ -13,12 +13,12 @@
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
-%
+%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
-%
+%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
%
@@ -37,15 +37,15 @@
% Arguments:
% #1.#2 the value log10(T)
%
-% Implementation:
+% Implementation:
% if T = i*10^j, log10(T) = log10(i) + j.
% That means if log10(T) in \Z, we have T = 10^j. If not, we need to
% check wether i is an integer. Please note that log10(i) < 1.
%
% Further note: log(T) < 0 <=> j<0.
-% In case j<0, we have
-% #1.#2 = j + log(i)
-% = - ( -j - log(i) )
+% In case j<0, we have
+% #1.#2 = j + log(i)
+% = - ( -j - log(i) )
% = - ( -j - 1 + (1-log(i)) )
% = #1 '.' #2 [ up to the '0.'
% that means #1 = j-1 and #2 = 1-log(i).
@@ -138,10 +138,10 @@
% PRECONDITION:
% Axis limits for #1 are given. I need their values before any data
% scale transformation has been applied.
-% If
-% \pgfplots@#1min@unscaled@as@float
+% If
+% \pgfplots@#1min@unscaled@as@float
% and
-% \pgfplots@#1max@unscaled@as@float
+% \pgfplots@#1max@unscaled@as@float
% exist; I will use these macros.
% Otherwise, I will use \pgfplots@#1min and \pgfplots@#1max;
% assuming that no data scale transformation is active.
@@ -223,7 +223,7 @@
% and we want to use B's exponent (only) for the decision here.
%
% INPUT:
-% - \pgfplots@cur@min@unscaled,
+% - \pgfplots@cur@min@unscaled,
% - \pgfplots@cur@max@unscaled,
% - \pgfmathfloat@a@E
% - \pgfmathfloat@b@E
@@ -234,7 +234,7 @@
\pgfmathfloatgetflags\pgfplots@cur@min@unscaled\pgfmathfloat@a@S
\pgfmathfloatgetflags\pgfplots@cur@max@unscaled\pgfmathfloat@b@S
\ifcase\pgfmathfloat@a@S%
- % min = 0.
+ % min = 0.
\ifcase\pgfmathfloat@b@S
% max =0
% normalize to 0 * 10^0 !
@@ -455,14 +455,14 @@
\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:
+ % shall be used:
\ifdim\pgf@x>0sp
\ifdim\pgf@y>0sp
% NORTH EAST
@@ -711,9 +711,9 @@
% Fills the macros
% \pgfplots@tick@LOWER@b \pgfplots@tick@end@a
% \pgfplots@tick@UPPER@b \pgfplots@tick@end@b
-% with coordinates such that
+% with coordinates such that
% (\pgfplots@tick@LOWER@b,\pgfplots@tmpa) -- (\pgfplots@tick@end@a,\pgfplots@tmpa)
-% produces a correct tick line.
+% produces a correct tick line.
%
% The '@b' variant is only used in case of \pgfplots@ytickposnum = 0
%
@@ -833,7 +833,7 @@
\fi
}
-% Check if the current tick position, stored in \pgfplots@tmpa,
+% Check if the current tick position, stored in \pgfplots@tmpa,
% does not cross the y-axis.
%
% This is just a special case for centered axis lines.
@@ -934,7 +934,7 @@
% #1: the axis
% #2: the tick list.
%
-% PRECONDITION:
+% PRECONDITION:
% - \pgfplots@determinedefaultvalues has been executed.
% That means particularly that \pgfplots@[xy][min,max] are available in TeX point
% range (after datascaling and logs).
@@ -1010,6 +1010,12 @@
}%
\fi
%
+ % compute the last index because it won't receive minor ticks:
+ \gdef\pgfplots@glob@TMPd{-1}%
+ \foreach \x in {#2} {%
+ \pgfplotsutil@advancestringcounter@global\pgfplots@glob@TMPd
+ }%
+ \let\c@pgfplots@ticknum@last=\pgfplots@glob@TMPd
%
\gdef\pgfplots@glob@TMPa{0}%
\foreach \x in {#2} {%
@@ -1027,29 +1033,34 @@
\fi
% X-Axis ticks bottom and top
\ifpgfplots@needsminorloop
- % SEE BELOW for the 'minor #1tick' feature -- it has a
- % separate loop.
- \foreach \pgfplots@i in {1,...,\pgfplots@minor@tick@num} {%
- \ifpgfplots@islinear
- \pgfmathmultiply@{\pgfplots@i}{\pgfplots@minor@tick@dist}%
- \else
- % in log:
- % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9
- \pgfplotscoordmath{#1}{log unsigned int}{\pgfplots@i}%
- \pgfplotscoordmath{#1}{tofixed}{\pgfmathresult}%
- \fi
- \pgfplots@prepare@tick@coordlists@for@advance\pgfplots@tmpa by\pgfmathresult
- \pgfplots@tickshowtrue
- \pgfplots@prepare@tick@coordlists@for@checkdatalimits#1%
- \pgfplots@checktickminmax
- \ifpgfplots@tickshow
- \pgfplots@prepare@tick@coordlists@for@tofixed\pgfplots@tmpa
- \c@pgf@counta=\pgfplots@ticknum\relax
- \advance\c@pgf@counta by\pgfplots@i\relax
- \edef\x{{\the\c@pgf@counta}{\pgfmathresult}}%
- \expandafter\pgfplotslistpushbackglobal\x\to\pgfplots@prepared@tick@positions@minor
- \fi
- }%
+ \ifnum\pgfplots@ticknum=\c@pgfplots@ticknum@last\relax
+ \else
+ % SEE BELOW for the 'minor #1tick' feature -- it has a
+ % separate loop.
+ \foreach \pgfplots@i in {1,...,\pgfplots@minor@tick@num} {%
+ % XXX : bug 165 [minor ticks] minor tick drawn after the last xtick
+ % seems to be here. Does that harm?
+ \ifpgfplots@islinear
+ \pgfmathmultiply@{\pgfplots@i}{\pgfplots@minor@tick@dist}%
+ \else
+ % in log:
+ % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9
+ \pgfplotscoordmath{#1}{log unsigned int}{\pgfplots@i}%
+ \pgfplotscoordmath{#1}{tofixed}{\pgfmathresult}%
+ \fi
+ \pgfplots@prepare@tick@coordlists@for@advance\pgfplots@tmpa by\pgfmathresult
+ \pgfplots@tickshowtrue
+ \pgfplots@prepare@tick@coordlists@for@checkdatalimits#1%
+ \pgfplots@checktickminmax
+ \ifpgfplots@tickshow
+ \pgfplots@prepare@tick@coordlists@for@tofixed\pgfplots@tmpa
+ \c@pgf@counta=\pgfplots@ticknum\relax
+ \advance\c@pgf@counta by\pgfplots@i\relax
+ \edef\x{{\the\c@pgf@counta}{\pgfmathresult}}%
+ \expandafter\pgfplotslistpushbackglobal\x\to\pgfplots@prepared@tick@positions@minor
+ \fi
+ }%
+ \fi
\fi
\pgfplotsutil@advancestringcounter\pgfplots@ticknum
% carry \ticknum outside of this scope:
@@ -1269,8 +1280,8 @@
\pgfkeysgetvalue{/pgfplots/axis \pgfplots@loc@TMPa\space line shift}\pgfplots@loc@TMPb
\ifx\pgfplots@loc@TMPb\pgfutil@empty
\else
- % in this case, we KNOW that is is
- % (a) parsed and
+ % in this case, we KNOW that is is
+ % (a) parsed and
% (b) nonzero and
% (c) a dimension WITHOUT unit
% See \pgfplots@init@axis@shift
@@ -1297,7 +1308,7 @@
% The oriented surface is two dimensional and has been initialised
% with \pgfplotspointonorientedsurfaceabsetupfor*** somehow.
%
-% The idea is now the following:
+% The idea is now the following:
% - the tick positions change along the FIRST coordinate of this
% surface:
%
@@ -1310,7 +1321,7 @@
% | ---- | ---- | ---- | | SECOND
% | | | | v
%
-% for example,
+% for example,
% \pgfplotspointonorientedsurfaceab@setupfor@xyZ{1}
% \pgfplots@drawticklines@onorientedsurf
% will draw ticks at x-positions designated by \pgfplots@xtick. The
@@ -1323,7 +1334,7 @@
% will draw ticks at y-positions designated by \pgfplots@ytick. The
% small tick lines will be drawn along the x axis. For each processed
% point, the z coordinate will be fixed to '-1'.
-%
+%
% Tick positions are taken out of the already precomputed list
% \pgfplots@prepared@tick@positions@major@...
\def\pgfplots@drawticklines@onorientedsurf{%
@@ -1559,12 +1570,12 @@
%
% That's all, basically.
%
-% For 3D axes, all these points are basically ... the same!
+% 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.
@@ -1608,7 +1619,7 @@
%\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
@@ -1646,7 +1657,7 @@
\if2\pgfplots@ticklabelside
\else
% Should never happen.
- \pgfplots@error{Internal logic error during tick label placement (got placement character '\pgfplots@ticklabelside').
+ \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.}%
\fi
\fi
@@ -1699,7 +1710,7 @@
% '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
+% 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.
@@ -1717,7 +1728,7 @@
% PRECONDITION:
% - called inside of \pgfplots@drawticklabels@onorientedsurf@
% POSTCONDITION:
-% - defines
+% - defines
% - \pgfplots@tickposchoicea
% if called, sets keys such that tick labels are RIGHT (TOP) of
% the axis,
@@ -1735,7 +1746,7 @@
\or
% 1: near ticklabel.
% The following code contains automatically
- % aligned tick labels (especially for 3D axes).
+ % aligned tick labels (especially for 3D axes).
% see the manual for the |near ticklabel| anchors.
\pgfkeys{/tikz/anchor=near #1ticklabel}%
%
@@ -1812,14 +1823,14 @@
% Checks whether the argument to xtick or ytick is a UNIFORM tick
% sequence.
%
-% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but
+% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but
% NOT 0,2,4 or 4,10.
%
% Furthermore, any NON-integer tick arguments are also assumed to be
% NOT uniform.
%
% INPUT:
-% #1: a tick argument (i.e. something which can be put to
+% #1: a tick argument (i.e. something which can be put to
% \foreach \x in {#1})
%
% OUTPUT:
@@ -1914,7 +1925,7 @@
% This is part of \pgfplots@assign@default@tick@foraxis and relies on
% its temporary variables.
%
-% INPUT:
+% INPUT:
% \MIN : the lower axis limit of #1 (a TeX register, in transformed range)
% \MAX : same with upper axis limit of #1
% \desirednumticks: the number of ticks to use
@@ -2208,10 +2219,10 @@
% it won't be printed).
\advance\MIN by-\H\relax
\else
- % Now, we want to activate the Tick set
+ % Now, we want to activate the Tick set
% {lowest, lowest+H, ..., highest}
%
- % Where
+ % Where
% lowest = I * log(10) + rest, |rest| < log(10).
% this is conceptionally different from the approach for
% linear axes, because H = j*log(10).
@@ -2235,7 +2246,7 @@
% near the lower axis limit.
%
% "Near" means either directly above or directly below ymin.
- %
+ %
% My application example is as follows:
% Let H = 2*log(10).
% Furthermore, ymin = 3e-6, ymax= 8e-2. That means we can choose either
@@ -2250,12 +2261,12 @@
% shift the current tick by log(10):
% if( ymin - I * log(10) < 0.5*H -> use I+1, that means add log(10).
%
- % that's equivalent to
+ % that's equivalent to
% 2*(ymin - I * log(10)) - H < 0.
\advance\MINH by-\MIN
\multiply\MINH by2
\advance\MINH by-\H
- %
+ %
\ifdim\MINH<0pt
\advance\MIN \pgfplots@loc@log@to@display@log@scale pt
\fi
@@ -2268,9 +2279,9 @@
% That's useless, so check for it.
%
% That's the case if
- % MIN < ORIGMIN && MAX < MIN+2 H
+ % MIN < ORIGMIN && MAX < MIN+2 H
% MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by
- % construction, but I don't care about this case).
+ % construction, but I don't care about this case).
% So: check only the second condition.
%\message{Got MIN=\pgf@sys@tonumber\MIN; H=\pgf@sys@tonumber\H; MAX=\pgf@sys@tonumber\MAX.^^J}%
\def\pgfplots@tick@returnval@ready{0}%
@@ -2280,7 +2291,7 @@
\ifdim\MAX<\pgfplots@tmpa
\if1\b@pgfplots@ticks@computed@tick@distance@is@final
% OK, we cannot auto adjust tick labels -- if if there are
- % too few of them.
+ % too few of them.
\else
\pgfplots@assign@default@tick@foraxis@autoadjust@result#1%
\fi
@@ -2290,7 +2301,7 @@
% FIXME :this minimum might actually be too small...
\ifdim\MINH=\MIN
\pgfplotsthrow{dimension too small in ticks}{#1}\pgfeov%
- %
+ %
% make sure that the compilation succeeds:
\H=1pt %
\advance\MINH by\H
@@ -2316,16 +2327,16 @@
% see manual
%
% Idea:
-% We want ticks at each
+% We want ticks at each
% { i*H, i in \Z }.
-% Of course, there shouldn't be TOO MUCH ticks.
+% Of course, there shouldn't be TOO MUCH ticks.
%
% Our heuristics is to set
% desirednumticks = round(ACTUAL WIDTH / (max space between ticks) )
% and generate H = (axis range) / (desirednumticks).
%
-% Since not all step sizes H look well, restrict H to a set of allowed
-% step sizes such as
+% Since not all step sizes H look well, restrict H to a set of allowed
+% step sizes such as
% { 1, 1/2, 1/5, 1/10 },
% or, to be more precise:
% { 1*10^e, 2*10^e, 5*10^e }
@@ -2346,12 +2357,12 @@
% -> for the data scaling case, I will use floating point
% arithmetics to compute that last step.
% I will acquire \pgfplots@[xy]min@unscaled@as@float here.
-%
%
%
%
%
-% For log-plots,
+%
+% For log-plots,
% H in { j*log(10), j=1,2,3,... }
% where the usual case should be j = 1.
%
@@ -2359,7 +2370,7 @@
% TICK={MIN,MIN+H,...,MAX}
% where
% MIN = I*H
-% is chosen such that
+% is chosen such that
% axis minimum limit = I*H + rest; |rest| < H.
%
% Again, log plots follow a slightly different approach: here,
@@ -2453,13 +2464,13 @@
% Takes the distance between adjacent ticks as floating point number
% and returns a normalized tick distance.
-%
+%
%
% The idea is to get "nice" (human readable) distances instead of
% strange fractions or real numbers.
%
% The result will be assigned to \pgfmathresult (in float).
-%
+%
% #1 the axis (x or y or z)
% #2 the unnormalized tick distance computed so far
%
@@ -2470,7 +2481,7 @@
% -->
%
% \pgfmathresult={1200}
-% or something like that.
+% or something like that.
\def\pgfplots@assign@default@tick@foraxis@normalizetickdist#1#2{%
\begingroup
\let\H=\pgf@xb
@@ -2503,11 +2514,11 @@
\endgroup
}%
-% Helper method for
+% Helper method for
% \pgfplots@apply@data@scale@trafo@to@options@for
% #1: the ticks
% #2: the trafo routine (not necessarily a single macro, but should
-% take one arg)
+% take one arg)
% #3: the output macro name
\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{%
\let#3=\pgfutil@empty
@@ -2523,10 +2534,10 @@
%
}%
-% Helper method for
+% Helper method for
% \pgfplots@apply@data@scale@trafo@to@options@for
% #1: the ticks ALREADY IN FLOAT FORMAT
-% #2: the trafo macro name
+% #2: the trafo macro name
% #3: the output macro name
\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat#1#2\to#3{%
\let#3=\pgfutil@empty
@@ -2562,4 +2573,3 @@
\def\pgfplotsdeclareborderanchorforticklabelaxis#1#2{%
\pgfplotsdeclareborderanchorforaxis{#1}{\pgfplotsticklabelaxisspec{#1}}{#2}%
}
-