diff options
author | Karl Berry <karl@freefriends.org> | 2008-06-15 17:56:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-06-15 17:56:37 +0000 |
commit | 3f126e90ac9efa15e72c8b415a2f25d3b19c509a (patch) | |
tree | 3fb6f3eebbf51978c31e8d6ff1180432e50b9935 /Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty | |
parent | 9667a29e9fef0ef89c9d7bd311e2d2a6aaccf50c (diff) |
painful pgfplots update (14jun08)
git-svn-id: svn://tug.org/texlive/trunk@8751 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty | 2559 |
1 files changed, 6 insertions, 2553 deletions
diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty index 114db197b55..3e63fdfa8b7 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty @@ -23,8 +23,8 @@ % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- -\def\pgfplotsversion{0.92.4} -\ProvidesPackage{pgfplots}[2008/02/17 Version \pgfplotsversion] +\def\pgfplotsversion{1.0} +\ProvidesPackage{pgfplots}[2008/06/07 Version \pgfplotsversion] % ATTENTION: % you MAY need one of @@ -39,2559 +39,12 @@ % 'pdftex' for 'pdflatex' % -> dvipdfm needs special attention. -\RequirePackage{xkeyval}[2006/11/18] -\RequirePackage{ifthen} -\RequirePackage{liststructure} -\RequirePackage{tikz}[2007/06/07] -\RequirePackage{sciformat} -\RequirePackage{pgfmathlog} -\usetikzlibrary{plotmarks} - -\def\prefix{pgfplots} - -% FIXME: reduce number of variables! -\newcount\axisticknum -\newcount\axis@tickposnum -\newcount\axis@xmode -\newcount\axis@ymode -\newcount\axis@numplots -\newdimen\axis@xcoordminTEX -\newdimen\axis@xcoordmaxTEX -\newdimen\axis@ycoordminTEX -\newdimen\axis@ycoordmaxTEX -\newdimen\axis@tmpa -\newdimen\axis@tmpb -\newif\ifaxis@isuniformtick -\newif\ifaxis@enlargelimits -\newif\ifaxis@enlargelimits@rel@thresh -\newif\ifaxis@enlargelimits@auto -\let\axis@TMP=\empty -\let\axis@TMPB=\empty -\let\axis@TMPC=\empty - -\def\axis@leftover{} -\def\axis@rightover{} -\def\axisdefaultwidth{240pt} -\def\axisdefaultheight{207pt} -\def\axisdefaulttickwidth{35}% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt') -\def\axisdefaulttryminticks{4} - -\listnew{\blackwhiteplotspeclist}{% - mark options={fill=gray},mark=*\\% - mark options={fill=gray},mark=square*\\% - mark options={fill=gray},mark=otimes*\\% - mark=star\\% - mark options={fill=gray},mark=diamond*\\% - densely dashed,mark options={solid,fill=gray},mark=*\\% - densely dashed,mark options={solid,fill=gray},mark=square*\\% - densely dashed,mark options={solid,fill=gray},mark=otimes*\\% - densely dashed,mark options={solid},mark=star\\% - densely dashed,mark options={solid,fill=gray},mark=diamond*\\% -} -\listnew{\coloredplotspeclist}{% - blue,mark options={fill=blue!80!black},mark=*\\% - red,mark options={fill=red!80!black},mark=square*\\% - brown!60!black,mark options={fill=brown!80!black},mark=otimes*\\% - black,mark=star\\% - blue,mark options={fill=blue!80!black},mark=diamond*\\% - red,densely dashed,mark options={solid,fill=red!80!black},mark=*\\% - brown!60!black,densely dashed,mark options={solid,fill=brown!80!black},mark=square*\\% - black,densely dashed,mark options={solid,fill=gray},mark=otimes*\\% - blue,densely dashed,mark=star,mark options=solid\\% - red,densely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\% -} - - -\listcopy\coloredplotspeclist\to\autoplotspeclist% -%\listcopy\blackwhiteplotspeclist\to\autoplotspeclist% - -\tikzstyle{every axis}=[] -\tikzstyle{every axis plot}=[] -\tikzstyle{every axis label}=[] -\tikzstyle{every axis x label}=[at={(0.5,0)},below,yshift=-15pt] -\tikzstyle{every axis y label}=[at={(0,0.5)},xshift=-35pt,rotate=90] -\tikzstyle{every axis title}=[at={(0.5,1)},above,yshift=6pt] -\tikzstyle{every tick}=[very thin,gray] -\tikzstyle{every minor tick}=[] -\tikzstyle{every major tick}=[] -\tikzstyle{every axis grid}=[style=help lines] -\tikzstyle{every minor grid}=[] -\tikzstyle{every major grid}=[] -\tikzstyle{every tick label}=[] -\tikzstyle{every x tick label}=[] -\tikzstyle{every y tick label}=[] - -% specifies how and where to draw the axis. -% \tikzstyle{every axis legend}+=[at={(0,0)}] -% will draw it at the lower left corner of the axis while -% \tikzstyle{every axis legend}+=[at={(1,1)}] -% means the upper right corner. -% -% The legend is a 'node' so you can use any tikz option which affects -% nodes. The option 'text width' is set automatically, depending on -% the \legend[textwidth=...] option. -% -% Examples: -% - \tikzstyle{every axis legend}+=[at={(1.02,1)},anchor=north west] -% draws the legend OUTSIDE TOP RIGHT. -% -% - \tikzstyle{every axis legend}+=[at={(1,0.5)},anchor=east,outer sep=0.5cm] -% draws the legend INSIDE MIDDLE RIGHT, separated by 0.5cm from the axis. -\tikzstyle{every axis legend}=[% - cells={anchor=center}, - inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em}, - anchor=north east,% - shape=rectangle,% - fill=white,% - draw=black, - at={(0.98,0.98)} - ] -% at={(1,1)}, -% outer sep=0.1cm] - - -\define@cmdkeys[\prefix]{axis}[axis@]{% - xmin,xmax,xticklabel,xtick,xtickten,xlabel,% - ymin,ymax,yticklabel,ytick,ytickten,ylabel,% - subtickwidth,tickwidth,% - xfilter,yfilter,% - width,height,% - title,% - execute at begin plot,% - execute at end plot,% - enlargelimits,% - legend columns,% - x,y}% - -\long\def\axis@foreach@to@list#1\to#2{% - \listnewempty\axis@TMP - \begingroup - \foreach \i in {#1} {% - \globaldefs=1 - \expandafter\listpushback\i\to\axis@TMP - \globaldefs=0 - }% - \endgroup - \listcopy\axis@TMP\to#2\relax -} - -\define@cmdkey[\prefix]{axis}[axis@]{xticklabels}{% - \expandafter\axis@foreach@to@list\axis@xticklabels\to\axis@xticklabels - %\expandafter\listnew\expandafter\axis@xticklabels\expandafter{\axis@xticklabels}% - \let\axis@xticklabel=\axis@user@ticklabel@list@x -} -\define@cmdkey[\prefix]{axis}[axis@]{yticklabels}{% - \expandafter\axis@foreach@to@list\axis@yticklabels\to\axis@yticklabels - %\expandafter\listnew\expandafter\axis@yticklabels\expandafter{\axis@yticklabels}% - \let\axis@yticklabel=\axis@user@ticklabel@list@y -} - -\define@cmdkey[\prefix]{axis}[axis@]{minor tick length}{% - \expandafter\let\expandafter\axis@subtickwidth\csname axis@minor tick length\endcsname -} -\define@cmdkey[\prefix]{axis}[axis@]{major tick length}{% - \expandafter\let\expandafter\axis@tickwidth\csname axis@major tick length\endcsname -} - -% sets \axis@tickposnum to -% left=0 -% right=1 -% both=2 -\define@choicekey[\prefix]{axis}{tickpos}[\val\nr]{left,right,both}{% - \axis@tickposnum=\nr\relax -} -\define@choicekey[\prefix]{axis}{legend plot pos}[\val\nr]{left,right,none}{% - \edef\axis@legend@plot@pos{\nr}% -} - -\define@choicekey[\prefix]{axis}{anchor}[\val\nr]{north,north west,west,south west,south,south east,east,north east,center}{% - \edef\axis@anchorchoicenum{\nr}% -} - -\define@choicekey[\prefix]{axis}{ticks}[\val\nr]{none,major,minor,both}{% - \expandafter\ifcase\nr\relax - \axis@xminorticksfalse - \axis@yminorticksfalse - \axis@xmajorticksfalse - \axis@ymajorticksfalse - \or - \axis@xminorticksfalse - \axis@yminorticksfalse - \axis@xmajortickstrue - \axis@ymajortickstrue - \or - \axis@xminortickstrue - \axis@yminortickstrue - \axis@xmajorticksfalse - \axis@ymajorticksfalse - \or - \axis@xminortickstrue - \axis@yminortickstrue - \axis@xmajortickstrue - \axis@ymajortickstrue - \fi -} -\define@choicekey[\prefix]{axis}{grid}[\val\nr]{none,major,minor,both}{% - \expandafter\ifcase\nr\relax - \axis@xminorgridsfalse - \axis@yminorgridsfalse - \axis@xmajorgridsfalse - \axis@ymajorgridsfalse - \or - \axis@xminorgridsfalse - \axis@yminorgridsfalse - \axis@xmajorgridstrue - \axis@ymajorgridstrue - \or - \axis@xminorgridstrue - \axis@yminorgridstrue - \axis@xmajorgridsfalse - \axis@ymajorgridsfalse - \or - \axis@xminorgridstrue - \axis@yminorgridstrue - \axis@xmajorgridstrue - \axis@ymajorgridstrue - \fi -} - - -\define@boolkeys[\prefix]{axis}[axis@]{% - xminorticks,% - xmajorticks,% - yminorticks,% - ymajorticks,% - xminorgrids,% - xmajorgrids,% - yminorgrids,% - ymajorgrids,% - disablelogfilter,% - disabledatascaling,% - hide axis,% - scale only axis}[true] - -% sets \axis@xmode to -% normal=0 -% log=1 -\define@choicekey[\prefix]{axis}{xmode}[\val\nr]{normal,log}{% - \axis@xmode=\nr\relax -} - -% sets \axis@ymode to -% normal=0 -% log=1 -\define@choicekey[\prefix]{axis}{ymode}[\val\nr]{normal,log}{% - \axis@ymode=\nr\relax -} - -\long\def\axispreset#1{% - \presetkeys[\prefix]{axis}{#1}{}% -} -\long\def\legendpreset#1{% - \errmessage{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% -} - -\presetkeys[\prefix]{axis}{% - xmode=normal, - xmin=, - xmax=, - xlabel=, - xtick=, - xtickten=, - xticklabel=, - xminorticks=true, - xmajorticks=true, - xminorgrids=false, - xmajorgrids=false, - ymode=normal, - ymin=, - ymax=, - ylabel=, - ytick=, - ytickten=, - yticklabel=, - yminorticks=true, - ymajorticks=true, - yminorgrids=false, - ymajorgrids=false, - grid=none,% - tickpos=both, - xfilter=, - yfilter=, - title=, - width=, - height=, - anchor=south west, - subtickwidth=0.1cm, - tickwidth=0.15cm, - scale only axis=false, - hide axis=false, - legend columns=1, - legend plot pos=left, - x=,% is implicitly set by 'width' and/or '\axisdefaultwidth' - y=,% is implicitly set by 'height' and/or '\axisdefaultheight' - execute at begin plot=,% - execute at end plot=,% - enlargelimits=auto, - disablelogfilter=false}{} - -\def\logten{2.3025851} -\def\reciproc@logten{0.434294481903252} - -\newcommand{\logi}[1]{% - \ifcase#1 - \or0 - \or0.693147 - \or1.098612 - \or1.386294 - \or1.60943791 - \or1.7917594 - \or1.94591014 - \or2.07944154 - \or2.197224 - \fi -} - -\newcommand{\show@yticklabel}[2]{{% - \let\ticknum=#1% - \ifaxis@float@numerics@mode@y - % this here stores \\tick@S, \\tick@M, \\tick@E - \axis@inverse@datascaletrafo@y{#2}\to\tick - % .. and this here provides \tick as fixed point repr: - \scitofixedsingle\tick\tick - \else - \def\tick{#2}% - \fi - \axis@yticklabel -}} - -% x-Achsenbeschriftung zum #1.ten Tick: -% #1: die ticknum -% #2: der x wert dafuer -\newcommand{\show@xticklabel}[2]{{% - \let\ticknum=#1% - \ifaxis@float@numerics@mode@x - % this here stores \\tick@S, \\tick@M, \\tick@E - \axis@inverse@datascaletrafo@x{#2}\to\tick - % .. and this here provides \tick as fixed point repr: - \scitofixedsingle\tick\tick - \else - \def\tick{#2}% - \fi - \axis@xticklabel -}} - -\def\axis@user@ticklabel@list@x{% - \listselect\ticknum\of\axis@xticklabels\to\tick - \tick -} -\def\axis@user@ticklabel@list@y{% - \listselect\ticknum\of\axis@yticklabels\to\tick - \tick -} - -\newcommand{\axisdefaultticklabel}[0]{% - $\prettyprintnumber{\tick}$% -} - -\newcommand{\axisdefaultticklabellog}[0]{% - \logtologtentomacro{\tick}{\roundedtick}% - $10^{\prettyprintnumber{\roundedtick}}$% -} - - -\newcommand{\axisshowxlabel}{% - \node - [style=every axis label,% - style=every axis x label] - {\axis@xlabel}; - -} -\newcommand{\axisshowylabel}{% - \node - [style=every axis label, - style=every axis y label] - {\axis@ylabel}; -} -\newcommand{\axisshowtitle}{% - \node% - [style=every axis title] - {\axis@title}; -} - -% Y-Achsen und Achsenbeschriftung LOG: -% 1: Ticks -\newcommand{\axis@drawyaxis}[1]{% - \begingroup - \newif\ifneedsminorloop - \axisticknum=0 - \edef\axis@TMP{#1}% - \ifx\axis@TMP\empty - \else - \ifaxis@yminorticks - \needsminorlooptrue - \fi - \ifaxis@yminorgrids - \needsminorlooptrue - \fi - \def\axis@placecomputedtick##1[##2]{% - \draw[##2] - \ifcase\axis@tickposnum - (\axis@xcoordminTEX\axis@leftover, \axis@tmpa) - -- (\axis@xcoordminTEX+##1, \axis@tmpa) - \or - (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa) - -- (\axis@xcoordmaxTEX-##1, \axis@tmpa) - \or - (\axis@xcoordminTEX\axis@leftover, \axis@tmpa) - -- (\axis@xcoordminTEX+##1, \axis@tmpa) - - (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa) - -- (\axis@xcoordmaxTEX-##1, \axis@tmpa) - \fi - ; - }% - \def\placecomputedgridline[##1]{% - \draw[##1] - (\axis@xcoordminTEX\axis@leftover, \axis@tmpa) - -- (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa) - ; - }% - \foreach \y in {#1} { - \pgfextracty{\axis@tmpa}{\pgfpointxy{0}{\y}}% - % - \ifdim\axis@tmpa<\axis@ycoordminTEX - \else - \ifdim\axis@tmpa>\axis@ycoordmaxTEX - \else - % Achsenbeschriftung: - \ifnum\axis@tickposnum=1 - \node at - (\axis@xcoordmaxTEX\axis@leftover,\axis@tmpa) - [right,style=every tick label,style=every y tick label] - {\show@yticklabel\axisticknum\y}; - \else - \node at - (\axis@xcoordminTEX\axis@leftover,\axis@tmpa) - [left,style=every tick label,style=every y tick label] - {\show@yticklabel\axisticknum\y}; - \fi - \fi - \fi - \global\advance\axisticknum by1 - \begin{scope} - \clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover) - rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover); - % Y-ticks left and/or right - % in log: - % log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9 - \ifneedsminorloop - \foreach \i in {1,...,9} { - % this code here is scoped inside of \foreach. - \pgfextracty{\axis@tmpb}{\pgfpointxy{0}{\logi\i}}% - \advance\axis@tmpa by\axis@tmpb - \ifaxis@yminorgrids - \placecomputedgridline[style=every axis grid,style=every minor grid]% - \fi - \ifaxis@yminorticks - \axis@placecomputedtick\axis@subtickwidth[style=every tick,style=every minor tick]% - \fi - }% - \fi - \ifaxis@ymajorgrids - \placecomputedgridline[style=every axis grid,style=every major grid]% - \fi - \ifaxis@ymajorticks - \axis@placecomputedtick\axis@tickwidth[style=every tick,style=every major tick]% - \fi - \end{scope} - }% - \fi - \endgroup -} - -% X-Achsen und Achsenbeschriftung -% 1: Ticks -\newcommand{\axis@drawxaxis}[1]{% - \begingroup - \axisticknum=0 - \newif\ifneedsminorloop - \edef\axis@TMP{#1}% - \ifx\axis@TMP\empty - \else - \ifaxis@xminorticks - \needsminorlooptrue - \fi - \ifaxis@xminorgrids - \needsminorlooptrue - \fi - \def\axis@placecomputedtick##1[##2]{% - \draw[##2] - \ifcase\axis@tickposnum - (\axis@tmpa, \axis@ycoordminTEX\axis@leftover) - -- (\axis@tmpa, \axis@ycoordminTEX+##1) - \or - (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover) - -- (\axis@tmpa, \axis@ycoordmaxTEX-##1) - \or - (\axis@tmpa, \axis@ycoordminTEX\axis@leftover) - -- (\axis@tmpa, \axis@ycoordminTEX+##1) - - (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover) - -- (\axis@tmpa, \axis@ycoordmaxTEX-##1) - \fi - ; - }% - \def\placecomputedgridline[##1]{% - \draw[##1] - (\axis@tmpa, \axis@ycoordminTEX\axis@leftover) - -- (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover) - ; - }% - \foreach \x in {#1} { - \pgfextractx{\axis@tmpa}{\pgfpointxy{\x}{0}}% - % - \ifdim\axis@tmpa<\axis@xcoordminTEX - \else - \ifdim\axis@tmpa>\axis@xcoordmaxTEX - \else - % Achsenbeschriftung: - \ifnum\axis@tickposnum=1 - \node at - (\axis@tmpa,\axis@ycoordmaxTEX\axis@leftover) - [above,style=every tick label,style=every x tick label] - {\show@xticklabel\axisticknum\x}; - \else - \node at - (\axis@tmpa,\axis@ycoordminTEX\axis@leftover) - [below,style=every tick label,style=every x tick label] - {\show@xticklabel\axisticknum\x}; - \fi - \fi - \fi - \global\advance\axisticknum by1 - % - \begin{scope} - \clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover) - rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover); - % X-Axis ticks bottom and top - % in log: - % log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9 - \ifneedsminorloop - \foreach \i in {1,...,9} { - \pgfextractx{\axis@tmpb}{\pgfpointxy{\logi\i}{0}}% - \advance\axis@tmpa by\axis@tmpb - \ifaxis@xminorgrids - \placecomputedgridline[style=every axis grid,style=every minor grid]% - \fi - \ifaxis@xminorticks - \axis@placecomputedtick\axis@subtickwidth[style=every tick,style=every minor tick]% - \fi - }% - \fi - \ifaxis@xmajorgrids - \placecomputedgridline[style=every axis grid,style=every major grid]% - \fi - \ifaxis@xmajorticks - \axis@placecomputedtick\axis@tickwidth[style=every tick,style=every major tick]% - \fi - \end{scope} - }% - \fi - \endgroup -} - -\def\axis@rememberplotspec#1{{% - \globaldefs=1 - \listpushback#1\to\axis@plotspeclist - \advance\axis@numplots by1% -}} - -\def\axis@getautoplotspec into#1{% - \listsize\autoplotspeclist\to\c@pgf@counta - \ifnum\c@pgf@counta=0 - \let#1=\empty - \else - \c@pgf@countb=\axis@numplots - \loop - \ifnum\c@pgf@countb<\c@pgf@counta - \else - \advance\c@pgf@countb by-\c@pgf@counta - \repeat - \listselect\c@pgf@countb\of\autoplotspeclist\to#1 -%\message{pgfplots.sty: using \string\autoplotspeclist\ specification no\#\the\c@pgf@countb (of \the\c@pgf@counta): #1}% - \fi -} - -% The main interface to draw a plot into an axis. -% -% Usage: -% \addplot -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% or -% -% \addplot[color=blue,mark=*] -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% The first syntax will use the next plot specification in the list -% \autoplotspeclist -% and the first will use blue color and * markers. -% -% The linespec. will be used in the legend. -\long\def\addplot{% - \@ifnextchar+{% - \axis@getautoplotspec into\nextplotspec - \axis@addplotimplAPPEND - }{% - \@ifnextchar[{% - \axis@addplotimpl% - }{% - \axis@getautoplotspec into\nextplotspec - % the space after ']' is required here: - % FIXME: - % - \addplot[]plot coordinates is NOT allowed!? - \expandafter\axis@addplotimpl\expandafter[\nextplotspec] - }% - }% -} - -\long\def\axis@addplotimplAPPEND+[{% - \expandafter\axis@addplotimpl\expandafter[\nextplotspec, -} - -\long\def\axis@addplotimpl[#1] #2;{% -%\tracingmacros=2\tracingcommands=2 - % #2 = plot coordinates {...} - \ifx\csname axis@execute at begin plot\endcsname\empty - \else - \csname axis@execute at begin plot\endcsname - \fi - \axis@rememberplotspec{[#1]}% - \ifaxis@filtercoords - % FIXME : FREE THIS VARIABLE: - \axis@filtercoords@and@up@limits#2;\newplotcmdto\axis@filteredcoordinateplotcmd - \def\axis@TMP{\axispath@impl{\draw[style=every axis plot,#1]}}% - \expandafter\axis@TMP\axis@filteredcoordinateplotcmd% - \else - \ifaxis@draw@at@end - \axis@update@limits{#2;}% - \fi - \axispath@impl{\draw[style=every axis plot,#1]}#2;% - \fi - \ifx\csname axis@execute at end plot\endcsname\empty - \else - \csname axis@execute at end plot\endcsname - \fi -%\tracingmacros=0\tracingcommands=0 -}% - -\long\def\axis@update@limits#1{% - \axis@foreach@plot@coord@do% - \axis@update@limits@for@one@point - \for - #1% - \EOI -} - -% PRECONDITIONS: -% - 'floating point numerics active' -% => coordinate filtering is active -% => #1 and #2 are MACRO names -% => these macros are encoded with \scisetcomponents -% - no coordinate filters active -% => #1 and #2 MAY be macros, but they must be valid TeX -% length (without unit). -\long\def\axis@update@limits@for@one@point#1#2{% -%\tracingmacros=2\tracingcommands=2 -%\message{Updating limits for (#1,#2) ...}% - \ifaxis@autocompute@xlim - \ifaxis@float@numerics@mode@x -%\scitofixedsingle\axis@xmin\axis@TMP -%\scitofixedsingle\axis@xmax\axis@TMPB -%\message{current limits: xmin=\axis@TMP, xmax=\axis@TMPB}% - \scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scigetcomponents\axis@xmin\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmin% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@xmin\axis@lim@S\axis@lim@M\axis@lim@E - % - \scigetcomponents\axis@xmax\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmax% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@xmax\axis@lim@S\axis@lim@M\axis@lim@E -%\scitofixedsingle\axis@xmin\axis@TMP -%\scitofixedsingle\axis@xmax\axis@TMPB -%\message{updated limits: xmin=\axis@TMP, xmax=\axis@TMPB}% - \else - \pgfmathmin{\axis@xmin}{#1}% - \let\axis@xmin=\pgfmathresult - \pgfmathmax{\axis@xmax}{#1}% - \let\axis@xmax=\pgfmathresult - \fi - \fi - \ifaxis@autocompute@ylim - \ifaxis@float@numerics@mode@y -%\scitofixedsingle\axis@ymin\axis@TMP -%\scitofixedsingle\axis@ymax\axis@TMPB -%\message{current limits: ymin=\axis@TMP, ymax=\axis@TMPB}% - \scigetcomponents#2\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scigetcomponents\axis@ymin\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmin% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@ymin\axis@lim@S\axis@lim@M\axis@lim@E - % - \scigetcomponents\axis@ymax\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmax% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@ymax\axis@lim@S\axis@lim@M\axis@lim@E -%\scitofixedsingle\axis@ymin\axis@TMP -%\scitofixedsingle\axis@ymax\axis@TMPB -%\message{updated limits: ymin=\axis@TMP, ymax=\axis@TMPB}% - \else - \pgfmathmin{\axis@ymin}{#2}% - \let\axis@ymin=\pgfmathresult - \pgfmathmax{\axis@ymax}{#2}% - \let\axis@ymax=\pgfmathresult - \fi - \fi - \axis@limits@are@computedtrue -%\tracingmacros=0\tracingcommands=0 -} - -% Filters coordinates and writes a new, modified 'plot coordinates' -% command to macro #2. -\long\def\axis@filtercoords@and@up@limits#1\newplotcmdto#2{% - \let#2=\empty - \let\axis@filter@output=#2 - \axis@foreach@plot@coord@do% - \axis@filter@one@coord@pair - \for - #1% - \EOI - \edef#2{plot coordinates {\axis@filter@output};}% -}% - -\def\axis@filter@one@coord@pair#1#2{% - \ifx\axis@xfilter\empty - \def\axis@filter@tmp@x{#1}% - \else - \let\axis@filter@tmp@x=\empty - \axis@xfilter#1\to\axis@filter@tmp@x - \fi - \ifx\axis@yfilter\empty - \def\axis@filter@tmp@y{#2}% - \else - \let\axis@filter@tmp@y=\empty - \axis@yfilter#2\to\axis@filter@tmp@y - \fi - \ifx\axis@filter@tmp@x\empty - \message{NOTE: coordinate (#1,#2) has been dropped because of the x-coordinate filter.}% - \else - \ifx\axis@filter@tmp@y\empty - \message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}% - \else - \ifaxis@draw@at@end - % update also axis limits: - \axis@update@limits@for@one@point{\axis@filter@tmp@x}{\axis@filter@tmp@y}% - \else - % apply data transformation directly. - \ifaxis@float@numerics@mode@x - \axis@datascaletrafo@x\axis@filter@tmp@x\to\axis@filter@tmp@x - \fi - \ifaxis@float@numerics@mode@y - \axis@datascaletrafo@y\axis@filter@tmp@y\to\axis@filter@tmp@y - \fi - \fi - % remind: - % \the\tokenregister - % will yield the contents of the token register, it will - % NOT expand recursively (like \expandafter)! - % - % Employ that here to maintain macros inside of - % \axis@filter@tmp[xy] - % (macros inside of those things are used by the floating - % point numerics to scale input data to TeX-lengths) - \pgfplots@toka=\expandafter{\axis@filter@output}% - \TOKL@ta=\expandafter{\axis@filter@tmp@x}% - \TOKL@tb=\expandafter{\axis@filter@tmp@y}% - \edef\axis@filter@output{\the\pgfplots@toka (\the\TOKL@ta,\the\TOKL@tb)}% -%\message{FILTERING: appended \axis@filter@tmp@x,\axis@filter@tmp@y}% -> results in \axis@filter@output}% - \fi - \fi -} - - -% A looping command to loop through plot coordinates. -% For every point, #3{X}{Y} will be invoked. -% -% No scoping is used during this operation, so you can access outer -% variables. -\long\def\axis@foreach@plot@coord@do#1\for plot coordinates #2;\EOI{% - \axis@foreach@plot@coord@ITERATE#1\n#2\EOI% -} - -\def\axis@foreach@plot@coord@ITERATE#1\n{% - \@ifnextchar;{% - \axis@foreach@plot@coord@FINISH@SEMICOLON% - }{% - \@ifnextchar\EOI{% - \axis@foreach@plot@coord@FINISH% - }{% - \axis@foreach@plot@coord@NEXT#1\n% - }% - }% -} - -\def\axis@foreach@plot@coord@NEXT#1\n(#2,#3){% - #1{#2}{#3}% - \axis@foreach@plot@coord@ITERATE#1\n -} - -\def\axis@foreach@plot@coord@FINISH\EOI{} -\def\axis@foreach@plot@coord@FINISH@SEMICOLON;\EOI{} - -% INPUT: -% a sequence of points (SMeE,SMeE) (terminated with ';') -% where S=sign, M=mantisse, E = exponent. -% Such input is generated in the case axis@float@numerics@modetrue -% by the coordinate filters. -% OUTPUT: -% proper sequence of fixed point coordinates which are the result of the -% data scaling transformation (\axis@datascaletrafo@x). -% -% The output will be written into the macro #1. -\long\def\axis@apply@data@scaletrafo@to@plot@data#1\to#2{% - \let#2=\empty - \let\axis@data@scaletrafo@result=\empty - \axis@foreach@plot@coord@do - \axis@apply@data@scaletrafo@to@one@point - \for - #1% - \EOI - \edef#2{plot coordinates {\axis@data@scaletrafo@result};}% - %\axis@apply@data@scaletrafo@to@plot@data@ITERATE\to#2 #1;% -} - -\def\axis@apply@data@scaletrafo@to@one@point#1#2{% - \ifaxis@float@numerics@mode@x - \axis@decode@filtered@float@numerics#1\to\axis@filter@tmp@x - \axis@datascaletrafo@x\axis@filter@tmp@x\to\axis@filter@tmp@x - \else - \def\axis@filter@tmp@x{#1}% - \fi - \ifaxis@float@numerics@mode@y - \axis@decode@filtered@float@numerics#2\to\axis@filter@tmp@y - \axis@datascaletrafo@y\axis@filter@tmp@y\to\axis@filter@tmp@y - \else - \def\axis@filter@tmp@y{#2}% - \fi - \edef\axis@data@scaletrafo@result{\axis@data@scaletrafo@result (\axis@filter@tmp@x,\axis@filter@tmp@y)}% -} - - -\def\axis@decode@filtered@float@numerics#1#2e#3\to#4{% - \scisetcomponents#4{#1}{#2}{#3}% -} - - -\long\def\axispath#1;{% - \axispath@impl{}#1; -} - -% low-level \axispath implementation. -% #1: -% the command which is responsable for drawing. -% - If #1 is NOT '\empty', we expect #2 to contain only -% EXPANDABLE DATA. -% That's important for postponed floating point arithmetics in #2. -% - If #1='\empty', we don't make any assumption about #2 -% and process it as-is. -% -% #2: see above. -\long\def\axispath@impl#1#2;{% - \ifaxis@draw@at@end - \listpushback{#1}\to\axis@stored@plot@cmds - \listpushback{#2;}\to\axis@stored@plot@data - \else - #1#2;% - \fi -} - - -% Assigns a legend. -% Syntax: -% \legend{entry 1\\entry2\\entry3} -\newcommand{\legend}[2][]{ - {% - \globaldefs=1% this will ONLY store the options and the legend into global variables - \def\axis@TMP{#1}% - \ifx\axis@TMP\empty - \else - \errmessage{Sorry, legend are now deprecated. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% - \fi - \def\axis@TMP{#2}% - \ifx\axis@TMP\empty - \else - \listnew\axis@legend{#2}% - \fi - } -} - -\newcommand{\addlegendentry}[1]{% - {% - \globaldefs=1% this will ONLY store the options and the legend into global variables - \listpushback#1\to\axis@legend - }% -} - -\def\axis@pop@next@legend{{% - \globaldefs=1 - \listcheckempty\axis@plotspeclist - \iflistempty - \let\axis@curplotlist=\empty - \else - \listpopfront\axis@plotspeclist\to\axis@curplotlist - \fi - % - \listcheckempty\axis@legend - \iflistempty - \let\axis@curlegend=\empty - \else - \listpopfront\axis@legend\to\axis@curlegend - \fi - \advance\axis@numplots by-1 -}} +\RequirePackage{tikz} -\long\def\axis@show@small@legendplots#1{ - \draw#1 - [mark repeat=2,mark phase=2] - plot coordinates { - (0cm,0cm) - (0.3cm,0cm) - (0.6cm,0cm)% - };% -} -% Typesets a legend node. -% -% It will either typeset a previously computed legend (which needs to be -% stored in the macro \axis@already@computed@legend@node) -% -% or it creates a legend, stores the commands into the macro named -% above and typesets it. -\newcommand\axis@createlegend{% - \ifx\axis@already@computed@legend@node\empty - \listcheckempty\axis@legend - \iflistempty - \else - % - % - \begingroup - % assemble a - % \matrix { - % small plot & legend1\\ - % small plot & legend2\\ - % ... - % }; - % command [and using the 'legend columns' option] - % - % \TOKL@ta={ - % small plot & legend1\\ - % small plot & legend2\\ - % ... - % } - % ( I have allocated the token register in my simplelist.sty) - % - % \global\def\axis@TMP{ - % \matrix { - % \TOKL@TA - % }; - % } - % -> finally, \axis@TMP will contain the complete command. - \TOKL@ta={}% - \let\curcolumnNum=\c@pgf@counta - \let\maxcolumnCount=\c@pgf@countb - \let\legendplotpos=\c@pgf@countc - \legendplotpos\expandafter=\axis@legend@plot@pos - \curcolumnNum=0 - \maxcolumnCount\expandafter=\csname axis@legend columns\endcsname\relax - % - \loop - \ifnum0<\axis@numplots\relax - \axis@pop@next@legend - \ifx\axis@curlegend\empty - \else - \advance\curcolumnNum by1 - \edef\axis@TMP{% - \the\TOKL@ta - \ifcase\legendplotpos - % legend plot pos=left - \noexpand\axis@show@small@legendplots{\axis@curplotlist}% - \noexpand\pgfmatrixnextcell - \noexpand\node {\axis@curlegend}; - \or - % legend plot pos=right - \noexpand\node {\axis@curlegend}; - \noexpand\pgfmatrixnextcell - \noexpand\axis@show@small@legendplots{\axis@curplotlist}% - \or - % legend plot pos=none - \noexpand\node {\axis@curlegend}; - \fi - \ifnum\curcolumnNum=\maxcolumnCount - \noexpand\\ - \else - \ifnum\axis@numplots=0 - \noexpand\\ - \else - \noexpand\pgfmatrixnextcell - \fi - \fi - }% - \ifnum\curcolumnNum=\maxcolumnCount - \curcolumnNum=0 - \fi - \expandafter\TOKL@ta\expandafter{\axis@TMP}% - \fi - \repeat - \TOKL@tb={\matrix[style=every axis legend]}% - \xdef\axis@TMP{% - \the\TOKL@tb {% - \the\TOKL@ta - };% - }% - \endgroup - \let\axis@already@computed@legend@node=\axis@TMP - \fi - \fi - \axis@already@computed@legend@node -} - -% 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 -% 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 -% \foreach \x in {#1}) -% -% OUTPUT: -% \axis@isuniformticktrue -% or -% \axis@isuniformtickfalse -% depending on the check. -% This variable will be set globally. -\def\axis@checkisuniformLOGtick#1{% - \begingroup - \global\axis@isuniformticktrue - \newif\ifisfirst - \newif\iftwo@are@equal - \isfirsttrue - \foreach \x in {#1}{% - \pgfmathmultiply@\x\reciproc@logten - \let\cur=\pgfmathresult - % check whether - % \cur - last == 1 (last = \axis@TMPB) - \ifisfirst - \global\isfirstfalse - \else - \pgfmathsubtract@\cur\axis@TMPB% - \pgfmathlog@approxequalto@macro\pgfmathresult{1.0}{two@are@equal}% - \iftwo@are@equal - \else - \global\axis@isuniformtickfalse - \breakforeach - \fi - \fi - \global\let\axis@TMPB=\cur - }% - \endgroup -} - -\def\skipsuffixzero#1.#2|{ - {% - \def\axis@TMP{#2}% - \def\axis@TMPB{0}% - \ifx\axis@TMP\axis@TMPB - \global\def\pgfmathresult{#1}% - \else - \global\def\pgfmathresult{#1.#2}% - \fi - }% -} - -\def\logtologtentomacro#1#2{% - \pgfmathmultiply@{#1}\reciproc@logten% - \expandafter\skipsuffixzero\pgfmathresult|% - \let#2=\pgfmathresult -} - -% Expands to #1/log(10). It will also skip a suffix '.0' -\def\logtologten#1{% - \pgfmathmultiply@{#1}\reciproc@logten% - \expandafter\skipsuffixzero\pgfmathresult|% - \pgfmathresult -} - -% helper method which computes log10*\x foreach \x in {#1}. -% The result will be \xdef'ed into #2. -\def\axis@compute@tick@times@logten#1\to#2{% - \global\let#2=\empty - \foreach \axis@TMPB in {#1} {% - \pgfmathmultiply@\axis@TMPB\logten% - \ifx#2\empty - \xdef#2{\pgfmathresult}% - \else - \xdef#2{#2,\pgfmathresult}% - \fi - }% -} - -\def\axis@init@enlarge@limit@booleans{% - \axis@enlargelimits@autofalse - \axis@enlargelimitsfalse - \axis@enlargelimits@rel@threshfalse - \edef\axis@TMP{\axis@enlargelimits}% - % - \def\axis@TMPB{true}% - \ifx\axis@TMP\axis@TMPB - \axis@enlargelimitstrue - \else - \def\axis@TMPB{false}% - \ifx\axis@TMP\axis@TMPB - \else - \def\axis@TMPB{auto}% - \ifx\axis@TMP\axis@TMPB - \axis@enlargelimits@autotrue - \else - \begingroup - % try to read it as number: - \expandafter\pgf@xa\axis@enlargelimits pt\relax - \endgroup - \axis@enlargelimitstrue - \axis@enlargelimits@rel@threshtrue - \fi - \fi - \fi -} - -\def\axis@enlarge@limit@for#1{% - \begingroup - \expandafter\let\expandafter\min\expandafter=\csname axis@#1min\endcsname - \expandafter\let\expandafter\max\expandafter=\csname axis@#1max\endcsname - \ifcase\csname axis@#1mode\endcsname - \ifaxis@enlargelimits@rel@thresh - \edef\enlargepercent{\axis@enlargelimits}% - \else - \def\enlargepercent{0.1}% FIXME : pack 10% as default into option 'enlargelimits' or so - \fi - \pgfmathsubtract@\max\min% - \expandafter\pgf@xa\pgfmathresult pt - \expandafter\pgf@xb\enlargepercent\pgf@xa - \ifdim\pgf@xb>0.001pt - % the case with - % enlargeabsolute ~= 0 - % means that \min ~= \max. - % It is handled in another method. - \edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}% - % - % compute xmin := xmin - enlargeabsolute - \pgfmathsubtract@\min\enlargeabsolute% - \let\min=\pgfmathresult - \pgfmathadd@\max\enlargeabsolute% - \let\max=\pgfmathresult - \fi - \or - % compute - % \pgfmathsetmacro{\min}{\min - 0.5*\logten}% - % \pgfmathsetmacro{\max}{\max + 0.5*\logten}% - % just a more efficiently (I hope so): - \expandafter\pgfmath@x\logten pt - \divide\pgfmath@x by2 - \pgfmathlog@invoke@expanded\pgfmathsubtract@{{\min}{\pgf@sys@tonumber{\pgfmath@x}}}% - \let\min=\pgfmathresult - \pgfmathlog@invoke@expanded\pgfmathadd@{{\max}{\pgf@sys@tonumber{\pgfmath@x}}}% - \let\max=\pgfmathresult - \fi - \xdef\axis@TMP{\min}% - \xdef\axis@TMPB{\max}% - \endgroup - \expandafter\let\csname axis@#1min\endcsname=\axis@TMP - \expandafter\let\csname axis@#1max\endcsname=\axis@TMPB -} - -% Computes tick positions using the current axis limits. -% -% Parameters: -% \axisdefaulttickwidth -% Determines the maximum space which is not filled by at least one -% tick label (approximate, there is some rounding internally) -% \axisdefaulttryminticks -% see manual -% -% Idea: -% We want ticks at each -% { i*H, i in \Z }. -% Of course, there shouldn't be TOO MUCH ticks. -% -% Our heuristics is to set -% desirednumticks = round(ACTUAL WIDTH / axisdefaulttickwidth) -% 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 -% { 1, 1/2, 1/5, 1/10 }, -% or, to be more precise: -% { 1*10^e, 2*10^e, 5*10^e } -% -> round to the nearest matching number! -% -% Then, the resulting tick is -% TICK={MIN,MIN+H,...,MAX} -% where -% MIN = I*H -% is chosen such that -% axis minimum limit = I*H + rest; |rest| < H. -% -% -% PRECONDITION: -% - limits are correct -% - axis width/height is set correctly -% -% POSTCONDITION: -% - Tick for axis #1 is assigned -% - \ifaxis@needs@check@uniformtick is set -\def\axis@assign@default@tick@foraxis#1{% - \begingroup - % Shortcut-names: - \expandafter\let\expandafter\ifaxis@is@datascaled\csname ifaxis@float@numerics@mode@#1\endcsname - \expandafter\let\expandafter\axis@data@scale@trafo\csname axis@datascaletrafo@#1\endcsname - \expandafter\let\expandafter\axis@data@scale@inverse@trafo\csname axis@inverse@datascaletrafo@#1\endcsname - % - \let\desirednumticks=\c@pgf@countd - \let\Wr=\pgf@xc - \Wr=\csname axis@#1coordmaxTEX\endcsname - \advance\Wr by-\csname axis@#1coordminTEX\endcsname - % r = max place without ticks in pt -> choose desirednumticks >= W/r - \expandafter\expandafter\divide\Wr\axisdefaulttickwidth - \pgfmathsetcount{\desirednumticks}{\Wr}% - \advance\desirednumticks by1 - \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks - \expandafter\desirednumticks\axisdefaulttryminticks - \fi - \ifcase\csname axis@#1mode\endcsname - % compute tick := MIN,MIN+H,....,MAX - \let\MINH=\pgf@xa - \let\H=\pgf@xb - \let\MAX=\axis@tmpa - \let\MIN=\axis@tmpb - % compute step size 'H': - \expandafter\MAX\csname axis@#1max\endcsname pt - \advance\MAX by0.001pt% avoid round errors - %\expandafter\MIN\the\c@pgf@counta pt - \expandafter\MIN\csname axis@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN - \c@pgf@counta=\desirednumticks - \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=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - % - \edef\Hmacro{\pgf@sys@tonumber\H}% - \ifaxis@is@datascaled - \expandafter\axis@data@scale@inverse@trafo\Hmacro\to\Hmacro - \else - \expandafter\sciparsesignsingle\expandafter{\Hmacro}\Hmacro - \fi - \scigetcomponents\Hmacro\H@S\H@M\H@E -%\message{Got T^{-1}(H) = [\H@S] \H@M * 10^\H@E}% - % modify the mantisse: - \expandafter\H\H@M pt - \ifdim\H<2pt - \ifdim\H<1.5pt - \def\H@M{1.0}% - \else - \def\H@M{2.0}% - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \def\H@M{2.0}% - \else - \def\H@M{5.0}% - \fi - \else - \ifdim\H<7.5pt - \def\H@M{5.0}% - \else - \def\H@M{1.0}% - \expandafter\c@pgf@counta\H@E - \advance\c@pgf@counta by1 - \edef\H@E{\the\c@pgf@counta}% - \fi - \fi - \fi - \scisetcomponents\Hmacro\H@S\H@M\H@E - \ifaxis@is@datascaled - \axis@data@scale@trafo\Hmacro\to\Hmacro - \else - \scitofixedsingle\Hmacro\Hmacro - \fi -%\message{I have computed H=\Hmacro}% - \expandafter\H\Hmacro pt -%\message{final H=\the\H}% - % - % Now, we want to activate the Tick set {i*H, i in \Z} - % compute I such that - % xmin = I * H + rest; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\pgf@sys@tonumber\H}% - }% - \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 - \multiply\MIN by\c@pgf@counta - \MINH=\MIN - \advance\MINH by\H - \xdef\axis@TMP{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% - \aftergroup\axis@needs@check@uniformtickfalse - \or - \expandafter\ifx\csname axis@#1tickten\endcsname\empty - % I want ticks at 10^k. So determine k_min and k_max. - % - % FIXME: optimize! - \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1min\endcsname*\reciproc@logten-1}% - \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}% - \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1max\endcsname*\reciproc@logten}% - \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}% - \pgfmathadd\tmp@min\logten% - \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}% - \aftergroup\axis@needs@check@uniformtickfalse - \else - \edef\axis@TMP{\csname axis@#1tickten\endcsname}% - \expandafter\axis@compute@tick@times@logten\axis@TMP\to\axis@TMP - \aftergroup\axis@needs@check@uniformticktrue - \fi - \fi - \endgroup - \expandafter\let\csname axis@#1tick\endcsname=\axis@TMP -%\message{pgfplots.sty: #1tick set to \csname axis@#1tick\endcsname [#1mode=\the\csname axis@#1mode\endcsname, #1min=\csname axis@#1min\endcsname, #1max=\csname axis@#1max\endcsname].}% -} - -% Helper method for -% \axis@apply@data@scale@trafo@to@options@for -% #1: the ticks -% #2: the trafo macro name (the form taking three args) -% #3: the output macro name -\long\def\axis@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% - \let#3=\empty - \foreach \axis@TMPB in {#1} {% - \expandafter\sciparsesign\expandafter{\axis@TMPB}\sci@S\sci@M\sci@E - #2\sci@S\sci@M\sci@E\to\axis@TMPB - \ifx#3\empty - \xdef#3{\axis@TMPB}% - \else - \xdef#3{#3,\axis@TMPB}% - \fi - }% - % -}% - -% helper for \axis@apply@data@scale@trafo@to@options@for. -\def\axis@compute@number@order@for@trafo@isdimen#1\tocount#2{% - \edef\axis@TMP{\pgf@sys@tonumber{#1}}% - \expandafter\sciparsesign\expandafter{\axis@TMP}\S\M\E - \expandafter#2\E\relax - \advance#2 by1 -} - -% helper for \axis@apply@data@scale@trafo@to@options@for. -% -\def\axis@compute@number@order@for@trafo@isfloat#1\tocount#2{% - \scigetcomponents#1\S\M\E - \expandafter#2\E\relax - \advance#2 by1 -} - -% Initialises the data scale transformation and applies it to any -% user specified options. -% -% PRECONDITION: -% - all axis limits are available in float representation -% (i.e. with \scisetcomponents) -% - \axis@set@default@size@options has been called before -% POSTCONDITION: -% - the scaling transformation is set up, -% - all axis limits are transformed, -% - any user input (like ticks and tick labels) -% will reflect the changes. -\def\axis@apply@data@scale@trafo@to@options@for#1{% - % initialise data scale transformation - % T(x) = 10^{q-m} * x - % - \begingroup - \let\data@max@order=\c@pgf@counta - \let\data@cur@order=\c@pgf@countb - \let\data@dimen=\pgf@xa - \let\data@dimen@order=\c@pgf@countc - % - % Step 1: compute 'm', the data order - \expandafter\axis@compute@number@order@for@trafo@isfloat - \csname axis@#1min\endcsname - \tocount\data@cur@order - % - \data@max@order=\data@cur@order - % - \expandafter\axis@compute@number@order@for@trafo@isfloat - \csname axis@#1max\endcsname - \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 axis@#1\endcsname\empty - % We have 'width' or 'height'. - % - % Use the order of these parameters. - \def\axis@TMP{#1}% - \def\axis@TMPB{x}% - \ifx\axis@TMP\axis@TMPB - \expandafter\data@dimen\axis@width\relax - \else - \def\axis@TMPB{y}% - \ifx\axis@TMP\axis@TMPB - \expandafter\data@dimen\axis@height\relax - \fi - \fi - \axis@compute@number@order@for@trafo@isdimen - \data@dimen - \tocount\data@dimen@order - % This here is to avoid inaccuracies in the final - % axis rectangle size, see \axis@initsizes: - \advance\data@dimen@order by-1 - \else - % FIXME: - % we have either the 'x=1cm' or 'y=1cm' option! - % How should I initialise the trafo!? - \data@dimen@order=3 - \fi - % -%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% - \advance\data@dimen@order by-\data@max@order - \xdef\axis@TMP{\the\data@dimen@order}% - \endgroup -%\message{Initialising the data scale transformation in direction #1 to \axis@TMP...}% - % COMPLETE INITIALISATION: - \ifaxis@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY - \message{WARNING: the automatic scaling of input data has been DISABLED to allow axispath commands [otherwise, axispath commands would not know of the pgfplots scalings - leading to wrong images). DISABLING THE DATA SCALING LIMITS THE DATA RANGE! I hope I can fix this issue as soon as possible. Please take a look at the manual for more information. If you get 'OVERFLOW' or 'UNDERFLOW' errors, you may need to disable the axispath.}% - \def\axis@TMP{0}% - \expandafter\let\csname axis@data@scale@trafo@SHIFT@#1\endcsname\axis@TMP - \else - \expandafter\let\csname axis@data@scale@trafo@SHIFT@#1\endcsname\axis@TMP - \fi - % - % ... and apply transformation to any user input - % - % Transform axis limits: - \expandafter\expandafter\csname axis@datascaletrafo@#1\endcsname\csname axis@#1min\endcsname\to\axis@TMP - \expandafter\let\csname axis@#1min\endcsname=\axis@TMP - % - \expandafter\expandafter\csname axis@datascaletrafo@#1\endcsname\csname axis@#1max\endcsname\to\axis@TMP - \expandafter\let\csname axis@#1max\endcsname=\axis@TMP - % - % Convert any user-specified ticks: - \edef\axis@TMP{\csname axis@#1tick\endcsname}% - % this here should also work with 'xtick=\empty', the "No tick" command. - \ifx\axis@TMP\empty - \else -%\message{Converting #1tick='\csname axis@#1tick\endcsname'}% - \pgfplots@toka=\expandafter{\csname axis@datascaletrafo@#1@three\endcsname}% - \edef\axis@TMP{{\csname axis@#1tick\endcsname}\the\pgfplots@toka}% - \expandafter\axis@apply@data@scale@trafo@to@user@ticks\axis@TMP\to\axis@TMPC - \expandafter\let\csname axis@#1tick\endcsname=\axis@TMPC - \fi - % - % Transform any explicit axis unit scalings: - \expandafter\ifx\csname axis@#1\endcsname\empty - \else -%\message{Converting #1 unit scale='\csname axis@#1\endcsname' ... }% - \expandafter\pgfmathparse\expandafter{\csname axis@#1\endcsname}% - \expandafter\expandafter\csname axis@inverse@datascaletrafo@tofixed@#1\endcsname\pgfmathresult\to\axis@TMP - \edef\axis@TMP{\axis@TMP pt}% - \expandafter\edef\csname axis@#1\endcsname{\axis@TMP}% -%\message{to #1='\csname axis@#1\endcsname'.}% - \fi -} - -\def\axis@determinedefaultvalues{% - \ifx\axis@xmin\empty - \errmessage{Sorry, the argument 'xmin=NUM' is mandatory to draw axes }% - \def\axis@xmin{0}% - \fi - \ifx\axis@xmax\empty - \errmessage{Sorry, the argument 'xmax=NUM' is mandatory to draw axes }% - \def\axis@xmax{1}% - \fi - \ifx\axis@ymin\empty - \errmessage{Sorry, the argument 'ymin=NUM' is mandatory to draw axes }% - \def\axis@ymin{0}% - \fi - \ifx\axis@ymax\empty - \errmessage{Sorry, the argument 'ymax=NUM' is mandatory to draw axes }% - \def\axis@ymax{1}% - \fi - % - \axis@set@default@size@options - % - \ifaxis@float@numerics@mode@x - \axis@apply@data@scale@trafo@to@options@for x% - \fi - \ifaxis@float@numerics@mode@y - \axis@apply@data@scale@trafo@to@options@for y% - \fi - % - \ifnum\axis@xmode=0 - \axis@xminorticksfalse - \fi - \ifnum\axis@ymode=0 - \axis@yminorticksfalse - \fi - % - \axis@init@enlarge@limit@booleans - \ifaxis@enlargelimits - % relax the sizes. - % - % Idea: if the user chose his xmin,xmax tight to his data, - % this here will look better. - \axis@enlarge@limit@for x - \axis@enlarge@limit@for y - \else - \ifaxis@enlargelimits@auto - \ifaxis@hide - % there is no axis, so skip this enlargement (unless - % the user explizitly requests it) - \else - % FIXME : this here should be user-configurable! - \ifaxis@autocompute@xlim - \axis@enlarge@limit@for x - \fi - \ifaxis@autocompute@ylim - \axis@enlarge@limit@for y - \fi - \fi - \fi - \fi - % - \axis@avoid@empty@axis@range@for x% - \axis@avoid@empty@axis@range@for y% - % - \axis@initsizes - % - \newif\ifaxis@xisuniform - \newif\ifaxis@yisuniform - \axis@xisuniformtrue - \axis@yisuniformtrue - \newif\ifaxis@needs@check@uniformtick - \axis@needs@check@uniformticktrue - \ifx\axis@xtick\empty - \axis@assign@default@tick@foraxis{x}% - \fi - \ifaxis@needs@check@uniformtick - \ifnum\axis@xmode=1 - \expandafter\axis@checkisuniformLOGtick\expandafter{\axis@xtick}% - \fi - \ifaxis@isuniformtick - \axis@xisuniformtrue - \else - \axis@xminorticksfalse - \axis@xisuniformfalse - \fi - \fi - % - % - % - \axis@needs@check@uniformticktrue - \ifx\axis@ytick\empty - \axis@assign@default@tick@foraxis{y}% - \fi - \ifaxis@needs@check@uniformtick - \ifnum\axis@ymode=1 - \expandafter\axis@checkisuniformLOGtick\expandafter{\axis@ytick}% - \fi - \ifaxis@isuniformtick - \axis@yisuniformtrue - \else - \axis@yminorticksfalse - \axis@yisuniformfalse - \fi - \fi - \ifx\axis@xticklabel\empty - \ifcase\axis@xmode - \def\axis@xticklabel{\axisdefaultticklabel}% - \or - \def\axis@xticklabel{\axisdefaultticklabellog}% - \fi - \fi - \ifx\axis@yticklabel\empty - \ifcase\axis@ymode - \def\axis@yticklabel{\axisdefaultticklabel}% - \or - \def\axis@yticklabel{\axisdefaultticklabellog}% - %-------------------------------------------------- - % \def\axis@yticklabel{% - % \pgfmathexp\tick - % \expandafter\skipsuffixzero\pgfmathresult|% - % $\pgfmathresult$}% - %-------------------------------------------------- - \fi - \fi -} - - -% Helper method for initsizes. -% -% It computes a scaling such that \axis@width = SCALE * ACTUAL WIDTH. -% -% The actual width is -% c + x*(xmax-xmin) -% based on -% - x*xmax = \axis@xcoordmaxTEX -% - x*xmin = \axis@xcoordminTEX -% - c = estimated, a constant for the axis label/tick labels -% -% Arguments: -% #1: the output argument for the SCALE. -\def\axis@initsizes@getXscale\into#1{% - \expandafter\axis@tmpa\axis@width\relax - % EXPECTED WIDTH = X = \axis@width - % ACTUAL WIDTH = c + x * (xmax-xmin) - % where c is a CONSTANT (for the axis labels/tick labels). - % -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin)) - % - % \axis@tmpa := X-c: - \ifaxis@scale@only@axis - \else - \advance\axis@tmpa by-45pt% FIXME determine 'c' correctly! - \fi - \ifdim\axis@tmpa<0pt - \errmessage{Error: Plot width `\axis@width' is too small. This can't be realised while maintaining constant width for y-labels. Sorry, label width are only approximate. You will need to adjust your width.}% - \axis@tmpa=0pt - \fi - % \axis@tmpb := x*(xmax-xmin): - \axis@tmpb=\axis@xcoordmaxTEX - \advance\axis@tmpb by-\axis@xcoordminTEX - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\axis@tmpa}% - {\pgf@sys@tonumber\axis@tmpb}% - }% - \let#1=\pgfmathresult -%\message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)'; -% c=estimated, -% width-c =\the\axis@tmpa, -% x*(xmax[=\the\axis@xcoordmaxTEX] - xmin[=\the\axis@xcoordminTEX)]) = \the\axis@tmpb -% -> x-scale =#1 }% -} - -% The same as \axis@initsizes@getXscale, just for the height. -\def\axis@initsizes@getYscale\into#1{% - \expandafter\axis@tmpa\axis@height\relax - % EXPECTED WIDTH = X = \axis@width - % ACTUAL WIDTH = c + x * (xmax-xmin) - % where c is a CONSTANT (for the axis labels/tick labels). - % -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin)) - % - % \axis@tmpa := X-c: - \ifaxis@scale@only@axis - \else - \advance\axis@tmpa by-45pt\relax% FIXME determine 'c' correctly! - \fi - \ifdim\axis@tmpa<0pt - \errmessage{Error: Plot height `\axis@height' is too small. This can't be realised while maintaining constant height for x-labels. Sorry, label heights are only approximate. You will need to adjust your height.}% - \axis@tmpa=0pt - \fi - % \axis@tmpb := x*(xmax-xmin): - \axis@tmpb=\axis@ycoordmaxTEX - \advance\axis@tmpb by-\axis@ycoordminTEX - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\axis@tmpa}% - {\pgf@sys@tonumber\axis@tmpb}% - }% - \let#1=\pgfmathresult -%\message{pgfplots.sty: Computing 'y' such that 'height = c + y*(ymax-ymin)'; -% height=\axis@height, -% c=estimated, -% height-c =\the\axis@tmpa, -% y*(ymax[=\the\axis@ycoordmaxTEX] - ymin[=\the\axis@ycoordminTEX)]) = \the\axis@tmpb -% -> y-scale =#1 }% -} - - -% Checks whether axis limits in coordinate #1 are approximately equal. -% -% If that is the case, force a non-zero width of the range. -% -\def\axis@avoid@empty@axis@range@for#1{% - % Check if axis limits are empty: - \begingroup - \expandafter\let\expandafter\if@cur@is@scaled\csname ifaxis@float@numerics@mode@#1\endcsname - \expandafter\let\expandafter\min\csname axis@#1min\endcsname - \expandafter\let\expandafter\max\csname axis@#1max\endcsname - \let\min@d=\pgf@xa - \let\max@d=\pgf@xb - \let\diff=\pgf@xc - \newif\ifrange@is@approx@equal - \expandafter\min@d\min pt - \expandafter\max@d\max pt - \diff=\max@d - \advance\diff by-\min@d - % FIXME : I need a RELATIVE check here! - % but: real number point division is expensive - \if@cur@is@scaled - % this here should be sufficient because the axis - % has absolute values of order O( 10^3 ) or so. - \ifdim\diff<1pt - \range@is@approx@equaltrue - \fi - \else - % there is no data scaling, so I should be much more defensive - % with absolute thresholds... - \ifdim\diff<0.05pt - \range@is@approx@equaltrue - \fi - \fi - \ifrange@is@approx@equal -%\message{avoid range is approx equal for coord #1: MODIFYING (\min,\max)...}% - % the case \min ~= \max - % - % enlarge \max and shrink \min: - \ifdim\max@d<0pt - \ifdim\max@d<-1pt - \max@d=0.8\max@d - \min@d=1.2\min@d - \else - \advance\max@d by-1pt - \advance\min@d by1pt - \fi - \else - \ifdim\max@d>1pt - \max@d=1.2\max@d - \min@d=0.8\min@d - \else - \ifdim\max@d=0pt - \if@cur@is@scaled - % we can't simply add a constant in the - % transformed range. - % - % So: set limits to [-1,1] = [-1.0e0,+1.0e0] - \def\sci@S{2}% - \def\sci@M{1.0}% - \def\sci@E{0}% - \csname axis@datascaletrafo@#1@three\endcsname\sci@S\sci@M\sci@E\to\min - \def\sci@S{1}% - \def\sci@M{1.0}% - \def\sci@E{0}% - \csname axis@datascaletrafo@#1@three\endcsname\sci@S\sci@M\sci@E\to\max -%\message{[trafo shift = \csname axis@data@scale@trafo@SHIFT@#1\endcsname; setting limits -1:1]}% - \expandafter\min@d\min pt - \expandafter\max@d\max pt - \else - \advance\max@d by1pt - \advance\min@d by-1pt - \fi - \else - \advance\max@d by1pt - \advance\min@d by-1pt - \fi - \fi - \fi - \xdef\axis@TMP{\pgf@sys@tonumber{\min@d}}% - \xdef\axis@TMPB{\pgf@sys@tonumber{\max@d}}% -%\message{ -> #1 = \axis@TMP : \axis@TMPB;}% - \else - \global\let\axis@TMP=\min% - \global\let\axis@TMPB=\max% - \fi - \endgroup - \expandafter\let\csname axis@#1min\endcsname=\axis@TMP - \expandafter\let\csname axis@#1max\endcsname=\axis@TMPB -} - -% PRECONDITION: -% none -% POSTCONDITION: -% \axis@default@aspect@ratio is set. -\def\axis@compute@default@aspect@ratio{% - \expandafter\pgfmath@x\axisdefaultwidth - \expandafter\pgfmath@y\axisdefaultheight - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber{\pgfmath@x}}% - {\pgf@sys@tonumber{\pgfmath@y}}% - }% - \let\axis@default@aspect@ratio=\pgfmathresult -} - -\def\axis@set@default@size@options{% - % The axes 'x' and 'y' vectors will be scaled such that the total - % size is (\axisdefaultwidth, \axisdefaultheight). - % - % If the user specifies ONE of width OR height, - % the plot will be resized; keeping the aspect ratio. - % - \let\axis@default@aspect@ratio=\empty - % CASES: - % hasx := 'x' option non-empty - % hasy := 'y' option non-empty - % W := 'width' option non-empty - % H := 'height' option non-empty - % - % hasx = 1 -> width is not interesting; we use 'x' option. - % hasx = 0 -> determine final width: - % W H - % 0 0 -> \axisdefaultwidth - % 0 1 -> determine width out of H and the default aspect ratio - % 1 X -> ok, use the user parameter. - % - % hasy = 1 -> height is not interesting, we use 'y' option. - % hasy = 0 -> determine final height: - % W H - % 0 0 -> \axisdefaultheight - % X 1 -> ok, use the user parameter - % 1 0 -> determine height out of W and the default aspect ratio - % - \ifx\axis@x\empty - \ifx\axis@y\empty - % hasx=0, hasy=0 - % - % -> KEEP ASPECT RATIO if just one W, or H is given! - \ifx\axis@width\empty - \ifx\axis@height\empty - % The case hasx=0, hasy=0, W=0 H=0: - \let\axis@width=\axisdefaultwidth - \let\axis@height=\axisdefaultheight - \else - % The case hasx=0, hasy=0, W=0 H=1: - \axis@compute@default@aspect@ratio - \expandafter\pgfmath@y\axis@height - \pgfmathlog@invoke@expanded\pgfmathmultiply@{% - {\pgf@sys@tonumber{\pgfmath@y}}% - {\axis@default@aspect@ratio}% - }% - \edef\axis@width{\pgfmathresult pt}% - \fi - \else - \ifx\axis@height\empty - % The case hasx=0, hasy=0, W=1 H=0: - \axis@compute@default@aspect@ratio - \expandafter\pgfmath@x\axis@width - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber{\pgfmath@x}}% - {\axis@default@aspect@ratio}% - }% - \edef\axis@height{\pgfmathresult pt}% - \else - % The case hasx=0, hasy=0, W=1 H=1: - \fi - \fi - \else - % hasx=0, hasy=1, W=0: - \ifx\axis@width\empty - \let\axis@width=\axisdefaultwidth - \fi - \fi - \else - \ifx\axis@y\empty - % hasx=1, hasy=0, H=0 - \ifx\axis@height\empty - \let\axis@height=\axisdefaultheight - \fi - \fi - \fi -} - -% PRECONDITION: -% - final axis limits are given in transformed range -% - \axis@set@default@size@options has been invoked before -% POSTCONDITION: -% - the current x- and y unit vectors are changed; -% - \axis@[xy]coord{min,max}TEX are set -% -\def\axis@initsizes{% - % INIT. - % - % - \pgfpointxy{\axis@xmin}{\axis@ymin}% - \axis@xcoordminTEX=\pgf@x - \axis@ycoordminTEX=\pgf@y - \pgfpointxy{\axis@xmax}{\axis@ymax}% - \axis@xcoordmaxTEX=\pgf@x - \axis@ycoordmaxTEX=\pgf@y - % - % - %----------------------------------------- - % PROCESS THE 'width' and 'height' options - %----------------------------------------- - % - % FIXME: make these variables LOCAL: - % - \let\axis@rectangle@width=\empty - \let\axis@rectangle@height=\empty - % - \ifx\axis@x\empty - \ifx\axis@width\empty - \errmessage{INTERNAL LOGIC ERROR! WIDTH NOT SET}% - \fi - \axis@initsizes@getXscale\into\axis@tmpXscale - \ifaxis@scale@only@axis - \let\axis@rectangle@width=\axis@width - \fi - \else - \def\axis@tmpXscale{1}% - \fi - % - \ifx\axis@y\empty - \ifx\axis@height\empty - \errmessage{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% - \fi - \axis@initsizes@getYscale\into\axis@tmpYscale - \ifaxis@scale@only@axis - \let\axis@rectangle@height=\axis@height - \fi - \else - \def\axis@tmpYscale{1}% - \fi - % - % - % assert( \axis@tmpXscale != \empty && \axis@tmpYscale != \empty ) - % - % Apply scaling: - \pgfpointxy{\axis@tmpXscale}{\axis@tmpYscale}% - \axis@tmpa=\pgf@x - \axis@tmpb=\pgf@y - \ifx\axis@x\empty - \pgfsetxvec{\pgfpoint{\axis@tmpa}{0pt}}% - \else - \pgfsetxvec{\pgfpoint{\axis@x}{0pt}}% - \fi - \ifx\axis@y\empty - \pgfsetyvec{\pgfpoint{0pt}{\axis@tmpb}}% - \else - \pgfsetyvec{\pgfpoint{0pt}{\axis@y}}% - \fi - % - % Determine final rectangle dimensions. - % There are the following cases: - % 1. the user really wants a fixed dimension, - % i.e. he used 'scale only axis'. - % Then, we have to work to get the correct dimension! - % - % Up to now, the scaling mechanism looses to many significant - % digits such that the final width/height differs by 1-2 pt. - % - % If I am not mistaken, this does ONLY affect the final size, - % not the relative plot precision. - % - % FIXME : really compute the plot precision! - % - % 2. The use specified width and/or height, but not 'scale only - % axis'. Accept inaccurate final widths/heights (see above). - % - % 3. The user supplied 'x' and or 'y'. Simply use them, its - % accurate. - % - \pgfpointxy{\axis@xmin}{\axis@ymin}% - \axis@xcoordminTEX=\pgf@x - \axis@ycoordminTEX=\pgf@y - \pgfpointxy{\axis@xmax}{\axis@ymax}% - \ifx\axis@rectangle@width\empty - \axis@xcoordmaxTEX=\pgf@x - \else - % this 'if' here should only make a difference of about - % 1-2pt, not more. - % - % and I am quite sure that this inaccuracy (and this - % work-around) only affects the - % final size, not the relative plot accuracy. - \axis@xcoordmaxTEX=\axis@xcoordminTEX - \expandafter\advance\expandafter\axis@xcoordmaxTEX\axis@width - \fi - \ifx\axis@rectangle@height\empty - \axis@ycoordmaxTEX=\pgf@y - \else - \axis@ycoordmaxTEX=\axis@ycoordminTEX - \expandafter\advance\expandafter\axis@ycoordmaxTEX\axis@height - \fi -%-------------------------------------------------- -% \begingroup -% \pgf@x=\axis@xcoordmaxTEX\advance\pgf@x by-\axis@xcoordminTEX -% \pgf@y=\axis@ycoordmaxTEX\advance\pgf@y by-\axis@ycoordminTEX -% \message{Axis scaling x=\axis@tmpXscale, y=\axis@tmpYscale\ yields lower-left-corner (\axis@xmin,\axis@ymin) = (\the\axis@xcoordminTEX,\the\axis@ycoordminTEX) and upper right (\axis@xmax,\axis@ymax) = (\the\axis@xcoordmaxTEX,\the\axis@ycoordmaxTEX). Axis dimensions are width=\the\pgf@x, height=\the\pgf@y.}% -% \endgroup -%-------------------------------------------------- -} - -\def\axis@BEGIN@init@and@draw@axis{% - \axis@determinedefaultvalues - - % move the anchor to (0,0): - \expandafter\ifcase\axis@anchorchoicenum - % north: - \begin{scope}[ - yshift=-\axis@ycoordmaxTEX, - xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX - ] - \or% north west: - \begin{scope}[ - yshift=-\axis@ycoordmaxTEX, - xshift=-\axis@xcoordminTEX - ] - \or% west: - \begin{scope}[ - yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX, - xshift=-\axis@xcoordminTEX - ] - \or% south west: - \begin{scope}[ - yshift=-\axis@ycoordminTEX, - xshift=-\axis@xcoordminTEX - ] - \or% south: - \begin{scope}[ - yshift=-\axis@ycoordminTEX, - xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX - ] - \or% south east: - \begin{scope}[ - yshift=-\axis@ycoordminTEX, - xshift=-\axis@xcoordmaxTEX - ] - \or% east: - \begin{scope}[ - yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX, - xshift=-\axis@xcoordmaxTEX - ] - \or% north east: - \begin{scope}[ - yshift=-\axis@ycoordmaxTEX, - xshift=-\axis@xcoordmaxTEX - ] - \or% center - \begin{scope}[ - yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX, - xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX - ] - \fi - - \begin{scope} - \ifaxis@hide - \clip - (\axis@xcoordminTEX, \axis@ycoordminTEX) - rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX); - \else - - % X-Achsenbeschriftung: - % LADE DIE \axis@xtick -variable REIN - \expandafter\axis@drawxaxis\expandafter{\axis@xtick} - % - % Y-Achsen und Achsenbeschriftung: - \expandafter\axis@drawyaxis\expandafter{\axis@ytick}% - \draw[clip] - (\axis@xcoordminTEX, \axis@ycoordminTEX) - rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX); - - \fi -} - -\def\axis@END@init@and@draw@axis{% - \end{scope}% -} - -% Writes output to \axis@TMP -\def\axis@filter@input@ticks@with@log#1{% - \let\axis@TMP=\empty - \foreach \axis@TMPB in {#1} {% - \expandafter\pgfmathlog@\expandafter{\axis@TMPB}% - \ifx\axis@TMP\empty - \xdef\axis@TMP{\pgfmathresult}% - \else - \xdef\axis@TMP{\axis@TMP,\pgfmathresult}% - \fi - }% -} - -\tikzdeclarecoordinatesystem{axis}{\axis@evalute@tikz@coord@system@interface#1\axis@coord@end} - - -% Assigns \pgfmathresult := canvas coordinate (#2) for axis #1. -\long\def\axis@evalute@tikz@coord@system@interface@for#1#2{% - \expandafter\let\expandafter\if@datascaled@cur\csname ifaxis@float@numerics@mode@#1\endcsname - \expandafter\ifcase\csname axis@#1mode\endcsname - \if@datascaled@cur - \csname axis@datascaletrafo@fromfixed@#1\endcsname#2\to\pgfmathresult - \else - \def\pgfmathresult{#2}% - \fi - \or - \pgfmathlog@{#2}% - \fi -} - -\long\def\axis@evalute@tikz@coord@system@interface#1,#2\axis@coord@end{% - \begingroup - \axis@evalute@tikz@coord@system@interface@for{x}{#1}% - \let\axis@evaluate@tikz@coord@x=\pgfmathresult - \axis@evalute@tikz@coord@system@interface@for{y}{#2}% - \xdef\axis@TMP{\axis@evaluate@tikz@coord@x pt}% - \xdef\axis@TMPB{\pgfmathresult pt}% - \endgroup - \pgfpointxy{\axis@TMP}{\axis@TMPB}% -} - -% In case of (semi-) logplots, this command will -% - assign a filter which invokes \pgfmathlog@{} for each coordinate -% - replace any user-specified coordinate by its log. -% -% All subsequent commands will then work with logarithmic coordinates. -% -% @see pgfmathlog.sty for details about the implementation of log(). -% -% PRECONDITION: -% - The user input options have been set correctly, -% - the option processing has not yet begun -% -% POSTCONDITION: -% - any user input for log-axis has been replaced by its log -% - coordinate filters to compute logs are installed -% -% See also: -% \axis@apply@data@scale@trafo@to@options@for -\def\axis@prepare@coord@filtering@for#1{% - \expandafter\ifcase\csname axis@#1mode\endcsname - \ifaxis@disabledatascaling - \csname axis@float@numerics@mode@#1false\endcsname - \axis@float@numerics@modefalse - \else - \csname axis@float@numerics@mode@#1true\endcsname - \axis@float@numerics@modetrue - \fi - \ifaxis@float@numerics@mode - % Install coordinate filters that - % - read input as normalised floating point numbers, - % - return [SIGN][MANTISSE]eEXPONENT - % Motivation: - % 1. we can compute axis limits using such data - % 2. we can remember the floating point representation for - % the data scaling transformation. - % ATTENTION: - % this here is a preprocessing step! You will need to - % apply the data scaling later! - % see - % \axis@apply@data@scaletrafo@to@plot@data - \expandafter\let\expandafter\axis@TMP\csname axis@#1filter\endcsname - \ifx\axis@TMP\empty - \expandafter\def\csname addplot@float@numerics@#1filter\endcsname##1\to##2{% - \sciparsesign{##1}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scisetcomponents{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \edef##2{\axis@tmp@S\axis@tmp@M e\axis@tmp@E}% - }% - \else - \expandafter\let\csname axis@#1filter@orig\endcsname=\axis@TMP - \expandafter\def\csname addplot@float@numerics@#1filter\endcsname##1\to##2{% - \csname axis@#1filter@orig\endcsname##1\to##2\relax - \ifx##2\empty - \else - \expandafter\sciparsesign\expandafter{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scisetcomponents{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \edef##2{\axis@tmp@S\axis@tmp@M e\axis@tmp@E}% - \fi - }% - \fi - \expandafter\let\expandafter\axis@TMP\csname addplot@float@numerics@#1filter\endcsname - \expandafter\let\csname axis@#1filter\endcsname\axis@TMP - % - % Check for any existing axis limits: - \expandafter\let\expandafter\axis@TMP\csname axis@#1min\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\sciparsesign\expandafter{\axis@TMP}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \expandafter\scisetcomponents\csname axis@#1min\endcsname\axis@tmp@S\axis@tmp@M\axis@tmp@E - \fi - \expandafter\let\expandafter\axis@TMP\csname axis@#1max\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\sciparsesign\expandafter{\axis@TMP}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \expandafter\scisetcomponents\csname axis@#1max\endcsname\axis@tmp@S\axis@tmp@M\axis@tmp@E - \fi - \fi - \or - \ifaxis@disablelogfilter - \else - % any user-specified axis limits: - \expandafter\let\expandafter\axis@TMP\csname axis@#1min\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\pgfmathlog@\expandafter{\axis@TMP}% - \expandafter\let\csname axis@#1min\endcsname=\pgfmathresult - \fi - \expandafter\let\expandafter\axis@TMP\csname axis@#1max\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\pgfmathlog@\expandafter{\axis@TMP}% - \expandafter\let\csname axis@#1max\endcsname=\pgfmathresult - \fi - % - % any user specified axis ticks: - \expandafter\let\expandafter\axis@TMP\csname axis@#1tick\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\axis@filter@input@ticks@with@log\expandafter{\axis@TMP}% - \expandafter\edef\csname axis@#1tick\endcsname{\axis@TMP}% - \fi - % - \expandafter\let\expandafter\axis@TMP\csname axis@#1filter\endcsname - \ifx\axis@TMP\empty - \expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{% - \pgfmathlog@{##1}% - \let##2=\pgfmathresult - }% - \else - \expandafter\let\csname axis@#1filter@orig\endcsname=\axis@TMP - \expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{% - \pgfmathlog@{##1}% - \ifx\pgfmathresult\empty - \let##2=\empty - \else - \expandafter\expandafter\csname axis@#1filter@orig\endcsname\pgfmathresult\to##2\relax - \fi - }% - \fi - \expandafter\let\expandafter\axis@TMP\csname addplot@log@compute@#1filter\endcsname - \expandafter\let\csname axis@#1filter\endcsname\axis@TMP - \fi - \fi -} - -\def\axis@create@axis@descriptions{% - \ifaxis@hide - \else - \ifx\axis@xlabel\empty - \else - \axisshowxlabel - \fi - \ifx\axis@ylabel\empty - \else - \axisshowylabel - \fi - \fi - \ifx\axis@title\empty - \else - \axisshowtitle - \fi - \axis@createlegend -} - -% DATA TRANSFORMATION T(x) = X -% -% Input: -% a number in the original data range, given in **floating** point representation -% Output: -% a fixed point number in transformed range -% @see -% \axis@datascaletrafo@x@three -% \axis@datascaletrafo@fromfixed@x -\def\axis@datascaletrafo@x#1\to#2{% - \scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E - \axis@datascaletrafo@x@three\axis@tmp@S\axis@tmp@M\axis@tmp@E\to#2 -} - -% Overloaded function. -% Input: -% The same as above, but with Sign, Mantisse, Exponent. -% #1,#2 and #3 are expected to be MACRO NAMES. -\def\axis@datascaletrafo@x@three#1#2#3\to#4{% - \def\axis@TMP{\scimathshift{#1}{#2}{#3}}% - \expandafter\axis@TMP\expandafter{\axis@data@scale@trafo@SHIFT@x}% - \scitofixed{#1}{#2}{#3}{#4}% -} - -% Overloaded function. -% Input: -% a FIXED point number instead of a floating point one. -% @see \axis@datascaletrafo@x -\def\axis@datascaletrafo@fromfixed@x#1\to#2{% - \begingroup - \sciparsesign{#1}\axis@S\axis@M\axis@E - \axis@datascaletrafo@x@three\axis@S\axis@M\axis@E\to{#2}% - \global\let\axis@TMP=#2\relax - \endgroup - \let#2=\axis@TMP -} - -\def\axis@datascaletrafo@y#1\to#2{% - \scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E - \axis@datascaletrafo@y@three\axis@tmp@S\axis@tmp@M\axis@tmp@E\to#2 -} -\def\axis@datascaletrafo@y@three#1#2#3\to#4{% - \def\axis@TMP{\scimathshift{#1}{#2}{#3}}% - \expandafter\axis@TMP\expandafter{\axis@data@scale@trafo@SHIFT@y}% - \scitofixed{#1}{#2}{#3}{#4}% -} -\def\axis@datascaletrafo@fromfixed@y#1\to#2{% - \begingroup - \sciparsesign{#1}\axis@S\axis@M\axis@E - \axis@datascaletrafo@y@three\axis@S\axis@M\axis@E\to{#2}% - \global\let\axis@TMP=#2\relax - \endgroup - \let#2=\axis@TMP -} - -% INVERSE transformation x = T^{-1}( X ) -% Input: -% a fixed point number in transformed domain -% Output: -% a number in the data domain, given in floating point -% representation -\def\axis@inverse@datascaletrafo@x#1\to#2{% - \expandafter\sciparsesignsingle\expandafter{#1}#2 - \edef\axis@TMP{\noexpand#2{-\axis@data@scale@trafo@SHIFT@x}}% - \expandafter\scimathshiftsingle\axis@TMP -} - -\def\axis@inverse@datascaletrafo@y#1\to#2{% - \expandafter\sciparsesignsingle\expandafter{#1}#2 - \edef\axis@TMP{\noexpand#2{-\axis@data@scale@trafo@SHIFT@y}}% - \expandafter\scimathshiftsingle\axis@TMP -} - -% Overloaded function. -% -% In contrast to \axis@inverse@datascaletrafo@x, this method -% returns a number in FIXED point representation. -% @see \axis@inverse@datascaletrafo@x -\def\axis@inverse@datascaletrafo@tofixed@x#1\to#2{% - \axis@inverse@datascaletrafo@x#1\to{#2}% - \scitofixedsingle{#2}{#2}% -} -\def\axis@inverse@datascaletrafo@tofixed@y#1\to#2{% - \axis@inverse@datascaletrafo@y#1\to{#2}% - \scitofixedsingle{#2}{#2}% -} - -\newenvironment{axis}[1][]{% - \begingroup -% \def\axis@setkeys{\setkeys*[\prefix]{axis}}% -%\tracingmacros=2\tracingcommands=2 -% \message{Der every-axis-style ist gerade \csname tikz@st@every axis\endcsname}% -%\tracingmacros=0\tracingcommands=0 -% \expandafter\expandafter\expandafter\axis@setkeys - % \expandafter\expandafter\expandafter{\csname tikz@st@every axis\endcsname}% - \begin{scope}[style=every axis,% - x=1pt,y=1pt% see below - ] - % The explicit specification of 'x' and 'y' as 1pt is to avoid - % numeric overflow/underflow during scale computations: - % - % The scaling (i.e. proper values for 'x' and 'y') will be - % determined later-on, dependend on the axis limits. Since axis - % limits are implicitly in units of 1pt, it is reasonable to use - % '1pt' here as well. - % - % -%-------------------------------------------------- -% \draw[very thin,color=gray,xstep=1,ystep=\logten] -% (\xcoordmin\axis@leftover,\ycoordmin) -% grid (\xcoordmax\axis@rightover,\ycoordmax); -%-------------------------------------------------- - \setkeys[\prefix]{axis}{#1}% - % - % -------------------- - % Allocations: - % -------------------- - \listnewempty\axis@plotspeclist - \listnewempty\axis@legend - \listnewempty\axis@stored@plot@cmds - \listnewempty\axis@stored@plot@data - \newif\ifaxis@autocompute@xlim - \newif\ifaxis@autocompute@ylim - \newif\ifaxis@filtercoords - \newif\ifaxis@float@numerics@mode@x - \newif\ifaxis@float@numerics@mode@y - \newif\ifaxis@float@numerics@mode - % rename '\ifaxis@hide axis' to mask the white space: - \expandafter\let\expandafter\ifaxis@hide\csname ifaxis@hide axis\endcsname - % the same for other options with white spaces: - \expandafter\let\expandafter\ifaxis@scale@only@axis\csname ifaxis@scale only axis\endcsname - \newif\ifaxis@draw@at@end - \newif\ifaxis@limits@are@computed - \newif\ifaxis@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY - \axis@numplots=0 - \let\axis@already@computed@legend@node=\empty - % - % -------------------- - % Option preprocessing - % -------------------- - \axis@prepare@coord@filtering@for x - \axis@prepare@coord@filtering@for y - % - \ifx\axis@xfilter\empty - \else - \axis@filtercoordstrue - \fi - \ifx\axis@yfilter\empty - \else - \axis@filtercoordstrue - \fi - % - \ifx\axis@xmin\empty - \axis@autocompute@xlimtrue - \def\axis@xmin{16300}% - \ifaxis@float@numerics@mode@x - \scisetcomponents\axis@xmin{1}{1.0}{324}% - \fi - \fi - \ifx\axis@xmax\empty - \axis@autocompute@xlimtrue - \def\axis@xmax{-16300}% - \ifaxis@float@numerics@mode@x - \scisetcomponents\axis@xmax{2}{1.0}{324}% - \fi - \fi - \ifx\axis@ymin\empty - \axis@autocompute@ylimtrue - \def\axis@ymin{16300}% - \ifaxis@float@numerics@mode@y - \scisetcomponents\axis@ymin{1}{1.0}{324}% - \fi - \fi - \ifx\axis@ymax\empty - \axis@autocompute@ylimtrue - \def\axis@ymax{-16300}% - \ifaxis@float@numerics@mode@y - \scisetcomponents\axis@ymax{2}{1.0}{324}% - \fi - \fi - % - \ifaxis@autocompute@xlim - \axis@draw@at@endtrue - \axis@limits@are@computedfalse - \else - \axis@limits@are@computedtrue - \fi - \ifaxis@autocompute@ylim - \axis@draw@at@endtrue - \axis@limits@are@computedfalse - \else - \axis@limits@are@computedtrue - \fi - % - % - % -------------------- - % Start axis: - % either postponed to \end or directly. - % -------------------- - % - \ifaxis@draw@at@end - \else - \axis@BEGIN@init@and@draw@axis - \fi -}{% - %\end{axis}: - % -------------------- - % All plotting commands - % have been done. - % -> apply postponed drawing commands! - % -------------------- - \ifaxis@draw@at@end - \ifaxis@limits@are@computed - \else - % EMPTY AXIS: - \def\axis@xmin{0}% - \def\axis@xmax{1}% - \def\axis@ymin{0}% - \def\axis@ymax{1}% - \fi - \axis@BEGIN@init@and@draw@axis - \listforeach\axis@stored@plot@cmds\as\plotcmd{% - \listpopfront\axis@stored@plot@data\to\plotdata - \ifaxis@float@numerics@mode - \ifx\plotcmd\empty - \plotdata - \else - % Apply the data scaling transformation - \expandafter\axis@apply@data@scaletrafo@to@plot@data\plotdata\to\plotdata - \expandafter\plotcmd\plotdata - \fi - \else - \expandafter\plotcmd\plotdata - \fi - }% - \fi - \axis@END@init@and@draw@axis - % - \begin{scope}[% - xshift=+\axis@xcoordminTEX, - yshift=\axis@ycoordminTEX, - x={\axis@xcoordmaxTEX-\axis@xcoordminTEX}, - y={\axis@ycoordmaxTEX-\axis@ycoordminTEX} - ]% - \axis@create@axis@descriptions - \end{scope}% - \end{scope}% this scope starts inside of \axis@BEGIN@init@and@draw@axis - % - \end{scope}% - \endgroup -} +\input pgfplots.code.tex +\usetikzlibrary{plotmarks} -\newenvironment{semilogxaxis}[1][]{% - \begin{axis}[xmode=log,ymode=normal,#1] -}{% - \end{axis}% -} -\newenvironment{semilogyaxis}[1][]{% - \begin{axis}[xmode=normal,ymode=log,#1] -}{% - \end{axis}% -} -\newenvironment{loglogaxis}[1][]{% - \begin{axis}[xmode=log,ymode=log,#1] -}{% - \end{axis}% -} +\endinput |