diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic')
15 files changed, 11602 insertions, 4851 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex index 77fc52b1115..6f0d12ee115 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex @@ -125,6 +125,10 @@ \long\def\pgfplotsarraysize#1\to#2{% #2=\csname\string#1@size\endcsname\relax } +\long\def\pgfplotsarraysizetomacro#1\to#2{% + \expandafter\let\expandafter#2\csname\string#1@size\endcsname +} + % Returns the #1th element of array #2 into macro #3 % Arguments: @@ -158,8 +162,7 @@ % List is not empty. % \fi \def\pgfplotsarraycheckempty#1{% - \pgfplotsarraysize{#1}\to\c@pgfplotsarray@tmp - \ifnum\c@pgfplotsarray@tmp=0\relax + \ifnum\csname\string#1@size\endcsname=0 \pgfplotsarrayemptytrue \else \pgfplotsarrayemptyfalse diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex index d7bd7dc73ed..91caf2a033f 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex @@ -282,9 +282,7 @@ \long\def\pgfplotslistforeach#1\as#2#3{% \begingroup \long\def\pgfpl@@##1{\def#2{##1}% - \begingroup - #3 - \endgroup}% + \begingroup #3\endgroup}% #1\relax \endgroup } diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex index 77a40d51ed5..2d0ec9c1911 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -28,11 +28,39 @@ % %-------------------------------------------- + +% This file provides a high-level table manipulation and typesetting +% package. +% +% +% --------------------------------------------- +% Implementation notes for programmers: +% --------------------------------------------- +% +% The table data structure consists of +% 1. A name which must be a valid TeX macro like '\table' +% 2. A column list in the \pgfplotslist format. +% In fact, the column list is stored in the table's name: +% \pgfplotslistnewempty\table +% 3. A "file name" stored in +% \csname\string<\namemacro>@@table@name\endcsname +% 4. foreach column, there is a list of row-values (a row-vector) in +% the \pgfplotslist format named +% \csname\string<\namemacro>@<column name>\endcsname +% + + \newif\ifpgfplotstable@search@header \newcount\c@pgfplotstable@counta \newwrite\pgfplotstable@outfile \newif\ifpgfplotstabletypesetdebug +\newif\ifpgfplotstabletypesetskipcoltypes +\newif\ifpgfplotstabletypesetresult \newif\ifpgfplotstableuserow +\newif\ifpgfplotstabletypeset@includeoutfiles +\newif\ifpgfplotstabletypeset@force@remake +\newif\ifpgfplots@addplotimpl@readcompletely +\newif\ifpgfplotstable@disable@rowcolstyles % should always be false; use only in grouped internal macros \newif\ifpgfplots@table@options@areset @@ -40,6 +68,22 @@ \input pgfplotstable.coltype.code.tex +% #1= floating point number +% #2= TeX code to execute if #1 == 0 +% #3= TeX code to execute if #1 != 0 +\def\pgfplots@ifzero#1#2#3{% + \expandafter\pgfmathfloat@decompose@F#1\relax\pgfmathfloat@a@S + \ifnum\pgfmathfloat@a@S=0 #2\else#3\fi +}% + +% just make sure no-one complaints if manual example are used without +% booktabs loaded: +\pgfutil@ifundefined{toprule}{% + \def\toprule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\toprule}}% + \def\midrule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\midrule}}% + \def\bottomrule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\bottomrule}}% +}{\relax}% + % keys which are NOT predefined: % /pgfplots/table/alias/<col alias>/.initial={<real col>} % /pgfplots/table/columns/<col name>/.style={} @@ -48,18 +92,24 @@ \pgfkeys{% /pgfplots/table/header/.is if=pgfplotstable@search@header, /pgfplots/table/header=true, - /pgfplots/table/x index/.store in=\pgfplots@plot@tbl@xindex, - /pgfplots/table/x index=0, - /pgfplots/table/x/.store in=\pgfplots@plot@tbl@x, - /pgfplots/table/x=, - /pgfplots/table/y index/.store in=\pgfplots@plot@tbl@yindex, - /pgfplots/table/y index=1, - /pgfplots/table/y/.store in=\pgfplots@plot@tbl@y, - /pgfplots/table/y=, + /pgfplots/table/x index/.initial=0, + /pgfplots/table/x/.initial=, + /pgfplots/table/y index/.initial=1, + /pgfplots/table/y/.initial=, + /pgfplots/table/z index/.initial=2, + /pgfplots/table/z/.initial=, + /pgfplots/table/meta index/.initial=, + /pgfplots/table/meta/.initial=, /pgfplots/table/x error index/.initial=, /pgfplots/table/y error index/.initial=, + /pgfplots/table/z error index/.initial=, /pgfplots/table/x error/.initial=, /pgfplots/table/y error/.initial=, + /pgfplots/table/z error/.initial=, + /pgfplots/table/read completely/.is if=pgfplots@addplotimpl@readcompletely, + /pgfplots/table/read completely/.default=true, + /pgfplots/table/disable rowcol styles/.is if=pgfplotstable@disable@rowcolstyles, + /pgfplots/table/disable rowcol styles/.default=true, /pgfplots/table/row predicate/.code={}, /pgfplots/table/skip rows between index/.style 2 args={% /pgfplots/table/row predicate/.append code={% @@ -140,52 +190,65 @@ }% }, /pgfplots/table/multicolumn names/.default=c, - /pgfplots/table/dec sep align/.style={% + /pgfplots/table/dec sep align/.code={% + \pgfplots@assert@LaTeX@package@loaded{array}{dec sep align}% + \pgfkeysalso{% /pgf/number format/assume math mode, - /pgf/number format/@dec sep mark={&}, + /pgf/number format/@dec sep mark={$&$}, /pgfplots/table/assign column name/.code={% \pgfkeyssetvalue{/pgfplots/table/column name}{\multicolumn{2}{#1}{##1}}% },% - /pgfplots/table/column type={>{$}r<{$}@{}>{$}l<{$}}, + /pgfplots/table/column type={% + r<{\pgfplotstableresetcolortbloverhangright}% + @{}% + l<{\pgfplotstableresetcolortbloverhangleft}% + }, /pgfplots/table/assign cell content/.code={% \def\pgfmathresult{##1}% \ifx\pgfmathresult\pgfutil@empty \def\pgfmathresult{&}% - % \pgfutil@in@false \else \pgfmathprintnumberto{##1}\pgfmathresult% - % \expandafter\pgfutil@in@\expandafter&\expandafter{\pgfmathresult}% + % now make sure we have math mode for the single + % columns: + \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter$\pgfmathresult$}% \fi - %\ifpgfutil@in@ - %\else - % \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult&}% - %\fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, + }% }, /pgfplots/table/dec sep align/.default=c, - /pgfplots/table/sci sep align/.style={% + /pgfplots/table/sci sep align/.code={% + \pgfplots@assert@LaTeX@package@loaded{array}{sci sep align}% + \pgfkeysalso{% /pgf/number format/assume math mode, - /pgf/number format/@sci exponent mark={&}, + /pgf/number format/@sci exponent mark={$&$}, /pgfplots/table/assign column name/.code={% \pgfkeyssetvalue{/pgfplots/table/column name}{\multicolumn{2}{#1}{##1}}% },% - /pgfplots/table/column type={>{$}r<{$}@{}>{$}l<{$}}, + /pgfplots/table/column type={% + r<{\pgfplotstableresetcolortbloverhangright}% + @{}% + l<{\pgfplotstableresetcolortbloverhangleft}% + }, /pgfplots/table/assign cell content/.code={% \def\pgfmathresult{##1}% \ifx\pgfmathresult\pgfutil@empty \def\pgfmathresult{&}% - \pgfutil@in@true \else \pgfmathprintnumberto{##1}\pgfmathresult% \expandafter\pgfutil@in@\expandafter&\expandafter{\pgfmathresult}% - \fi - \ifpgfutil@in@ - \else - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult&}% + % now make sure we have math mode for the single + % columns: + \ifpgfutil@in@ + \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter$\pgfmathresult$}% + \else + \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter\pgfutilensuremath\expandafter{\pgfmathresult}&}% + \fi \fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, + }% }, /pgfplots/table/sci sep align/.default=c, % @@ -215,6 +278,15 @@ /pgfplots/table/begin table/.initial={\begin{tabular}}, /pgfplots/table/end table/.initial={\end{tabular}}, /pgfplots/table/outfile/.initial=, + /pgfplots/table/include outfiles/.is if=pgfplotstabletypeset@includeoutfiles, + /pgfplots/table/include outfiles/.default=true, + /pgfplots/table/force remake/.is if=pgfplotstabletypeset@force@remake, + /pgfplots/table/force remake/.default=true, + /pgfplots/table/write to macro/.initial=, + /pgfplots/table/typeset/.is if=pgfplotstabletypesetresult, + /pgfplots/table/typeset=true, + /pgfplots/table/skip coltypes/.is if=pgfplotstabletypesetskipcoltypes, + /pgfplots/table/skip coltypes/.default=true, /pgfplots/table/debug/.is if=pgfplotstabletypesetdebug, % % will be redefined by |assign cell content| for every cell: @@ -246,6 +318,23 @@ /pgfplots/table/@cell content={##1}% }% },% + /pgfplots/table/date type/.style={% + /pgfplots/table/assign cell content/.code={% + \begingroup + \pgfcalendardatetojulian{##1}\c@pgfplotstable@counta + \pgfcalendarjuliantodate{\c@pgfplotstable@counta}\year\month\day + \pgfcalendarjuliantoweekday\c@pgfplotstable@counta\c@pgf@countc + \edef\weekday{\the\c@pgf@countc }% + \edef\weekdayname{\pgfcalendarweekdayname\c@pgf@countc}% + \edef\weekdayshortname{\pgfcalendarweekdayshortname\c@pgf@countc}% + \edef\monthname{\pgfcalendarmonthname\month}% + \edef\monthshortname{\pgfcalendarmonthshortname\month}% + \xdef\pgfplots@glob@TMPa{#1}% + \endgroup + \pgfkeyslet{/pgfplots/table/@cell content}\pgfplots@glob@TMPa% + }% + },% + /pgfplots/table/date type/.default={\year/\month/\day}% /pgfplots/table/set content/.style={% /pgfplots/table/postproc cell content/.style={% /pgfplots/table/@cell content={#1}% @@ -255,10 +344,40 @@ /pgfplots/table/postproc cell content/.code={}, /pgfplots/table/preproc cell content/.code={}, % + /pgfplots/table/clear infinite/.style={% + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\pgfmatharga=\pgfmathresult + {% + \pgfmathfloatgetflags\pgfmatharga\c@pgfplotstable@counta + \xdef\pgfplots@glob@TMPc{\the\c@pgfplotstable@counta}% + }% + \ifnum\pgfplots@glob@TMPc<3 + \pgfmathfloattosci@\pgfmathresult + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfmathresult}% + \else + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfutil@empty}% + \fi + \fi + } + }, + /pgfplots/table/string replace/.style 2 args={% + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfmathresult\pgfplots@loc@TMPa + \def\pgfplots@loc@TMPb{#2}% + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfplots@loc@TMPb}% + \fi + } + }, /pgfplots/table/multiply -1/.style={% /pgfplots/table/preproc cell content/.append code={% \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult - \ifx\pgfmathresult\empty + \ifx\pgfmathresult\pgfutil@empty \else \pgfmathfloatparsenumber{\pgfmathresult}% \let\pgfmatharga=\pgfmathresult @@ -270,6 +389,44 @@ \fi } }, + /pgfplots/table/multiply with/.code={% + \pgfmathfloatparsenumber{#1}% + \let\pgfplotstable@scale=\pgfmathresult + \pgfkeysalso{ + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\pgfmatharga=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmatharga}{\pgfplotstable@scale}% + \pgfmathfloattosci@\pgfmathresult + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfmathresult}% + \fi + }% + }% + }, + /pgfplots/table/divide by/.code={% + \pgfkeysalso{/pgfplots/table/multiply with=#1}% + \let\pgfplotstable@divisor=\pgfplotstable@scale + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfplotstable@ONE=\pgfmathresult + \pgfmathfloatdivide@{\pgfplotstable@ONE}{\pgfplotstable@divisor}% + \let\pgfplotstable@scale=\pgfmathresult + }, + /pgfplots/table/sqrt/.style={% + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\pgfmatharga=\pgfmathresult + \pgfmathfloatsqrt@{\pgfmatharga}% + \pgfmathfloattosci@\pgfmathresult + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfmathresult}% + \fi + }% + }, /pgfplots/table/empty cells with/.style={% /pgfplots/table/postproc cell content/.append code={% \ifnum\pgfplotstablepartno=0 @@ -283,7 +440,8 @@ % /pgfplots/table/font/.initial=, /pgfplots/table/.unknown/.code={% - \pgfqkeys{/pgf/number format}{\pgfkeyscurrentname=#1}% + \let\pgfplots@table@curkeyname=\pgfkeyscurrentname + \pgfqkeys{/pgf/number format}{\pgfplots@table@curkeyname=#1}% },% /pgfplots/table/create col/assign first/.style={ /pgfplots/table/create col/assign% @@ -295,12 +453,63 @@ /pgfplots/table/create col/next content={}% }, /pgfplots/table/create col/next content/.initial={}, - /pgfplots/table/create col/expr/.style={% + /pgfplots/table/create col/copy/.style={% /pgfplots/table/create col/assign/.code={% + \getthisrow{#1}\pgfmathresult + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% + }, + /pgfplots/table/create col/set/.style={% + /pgfplots/table/create col/assign/.code={% + \def\pgfmathresult{#1}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% + },% + /pgfplots/table/create col/set list/.code={% + \pgfplots@assign@list\pgfmathaccumb{#1}% + \pgfkeysalso{/pgfplots/table/create col/@from list struct=\pgfmathaccumb}% + },% + /pgfplots/table/create col/expr accum/.code 2 args={% + \ifpgfplots@usefpu + \pgfkeysalso{/pgf/fpu=true,/pgf/fpu/output format=sci}% + \fi + \pgfkeysdef{/pgfplots/table/create col/assign}{% + \ifx\pgfmathaccuma\pgfutil@empty + \pgfmathparse{#2}% + \let\pgfmathaccuma=\pgfmathresult + \fi \pgfmathparse{#1}% \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \let\pgfmathaccuma=\pgfmathresult }% + }, + /pgfplots/table/create col/expr/.style={% + /pgfplots/table/create col/expr accum={#1}{0}% },% + /pgfplots/table/create col/copy column from table/.code 2 args={% + \pgfplotstable@isloadedtable{#1}{% + \pgfplotstablegetcolumnbyname{#2}\of#1\to\pgfmathaccumb + }{% + \begingroup + \pgfplotstableread{#1}\pgfplotstable@tmptbl + \pgfplotstablegetcolumnbyname{#2}\of\pgfplotstable@tmptbl\to\pgfmathaccumb + \pgfmath@smuggleone\pgfmathaccumb + \endgroup + }% + \pgfkeysalso{/pgfplots/table/create col/@from list struct=\pgfmathaccumb}% + }, + /pgfplots/table/create col/@from list struct/.code={% + \pgfplotslistcopy#1\to\pgfmathaccumb + \pgfkeysdef{/pgfplots/table/create col/assign}{% + \pgfplotslistcheckempty\pgfmathaccumb + \ifpgfplotslistempty + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + \else + \pgfplotslistpopfront\pgfmathaccumb\to\pgfmathresult + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \fi + }% + }, /pgfplots/table/create col/quotient/.style={% /pgfplots/table/columns={#1}, /pgfplots/table/create col/assign first/.style={% @@ -312,9 +521,13 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmathargb=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% /pgfplots/table/create col/iquotient/.style={% @@ -328,9 +541,13 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmatharga=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% % @@ -350,13 +567,17 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmathargb=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \pgfmathlog@float{\pgfmathresult}% - \ifx\pgfmathresult\pgfutil@empty - \else - \pgfmathmultiply@{1.442695}{\pgfmathresult}% - \fi - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \pgfmathlog@float{\pgfmathresult}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathmultiply@{1.442695}{\pgfmathresult}% + \fi + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% /pgfplots/table/create col/idyadic refinement rate/.style={% @@ -370,13 +591,17 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmatharga=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \pgfmathlog@float{\pgfmathresult}% - \ifx\pgfmathresult\pgfutil@empty - \else - \pgfmathmultiply@{1.442695}{\pgfmathresult}% - \fi - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \pgfmathlog@float{\pgfmathresult}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathmultiply@{1.442695}{\pgfmathresult}% + \fi + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% /pgfplots/table/create col/gradient/.style 2 args={% @@ -402,9 +627,13 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathfloatsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathdiff@x{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% },% },% /pgfplots/table/create col/gradient loglog/.style 2 args={% @@ -436,12 +665,18 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \ifdim\pgfmathdiff@x pt=0.0pt + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + \else + \pgfmathdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \fi \else - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloattosci@\pgfmathresult + % \pgfmathfloatcreate{3}{0.0}{0}% + % \pgfmathfloattosci@\pgfmathresult + % \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% \fi - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% },% },% /pgfplots/table/create col/gradient semilogx/.style 2 args={% @@ -478,9 +713,13 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathfloatsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathdiff@x{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% },% },% /pgfplots/table/create col/gradient semilogy/.style 2 args={% @@ -517,14 +756,95 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathfloatsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathdiff@x{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% },% },% + /pgfplots/table/typeset cell/.code={% + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax + \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\\}% + \else + \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1&}% + \fi + }, + /pgfplots/table/reset styles/.style={ + /pgfplots/table/every table/.code=, + /pgfplots/table/every odd column/.code=, + /pgfplots/table/every even column/.code=, + /pgfplots/table/every first column/.code=, + /pgfplots/table/every last column/.code=, + /pgfplots/table/every head row/.code=, + /pgfplots/table/every odd row/.code=, + /pgfplots/table/every even row/.code=, + /pgfplots/table/every first row/.code=, + /pgfplots/table/every last row/.code=, + }, } + +% 'function graph cut y'={<epsilon>}{<options>}{comma-separated-list of specs where to get yi} +% +% fills the column with x1,...,xN such that yi(xi) == epsilon where +% +% In other words, it computes cuts points between the line +% y == epsilon and one or more other plots yi(x) and returns the 'x' +% values of the cuts. +% +% Example: +% \pgfplotstableset{ +% create on use/cut/.style={create col/function graph cut y={7e-4}{x=Basis,ymode=log,xmode=log}{{table=regtable,y=special-L2}}}, +%} +\pgfkeysdefargs{/pgfplots/table/create col/function graph cut y}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{y}{x}} +\pgfkeysdefargs{/pgfplots/table/create col/function graph cut x}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{x}{y}} +\pgfkeys{% + /pgfplots/table/create col/function graph cut/xmode/.is choice, + /pgfplots/table/create col/function graph cut/xmode/linear/.code={\def\pgfplotstable@fgc@xmode{0}},% + /pgfplots/table/create col/function graph cut/xmode/log/.code={\def\pgfplotstable@fgc@xmode{1}},% + /pgfplots/table/create col/function graph cut/ymode/.is choice, + /pgfplots/table/create col/function graph cut/ymode/linear/.code={\def\pgfplotstable@fgc@ymode{0}},% + /pgfplots/table/create col/function graph cut/ymode/log/.code={\def\pgfplotstable@fgc@ymode{1}},% + /pgfplots/table/create col/function graph cut/x/.initial=, + /pgfplots/table/create col/function graph cut/y/.initial=, + /pgfplots/table/create col/function graph cut/table/.initial=, +} + + +\pgfkeyslet{/pgfplots/table/TeX comment}\pgfplots@PERCENT@TEXT \pgfkeysgetvalue{/pgfplots/table/postproc cell content/.@cmd}\pgfplotstable@postproccellcontent@EMPTY + +% A helper macro to automatically remove the "hangover" created by +% 'colortbl'. +% This allows compatibility between my 'sci sep align' and 'dec sep align' +% implementations and \rowcolor. Otherwise, the hangover +% would overwrite digits near the separator. +% +% @remark This does also work if colortbl is not loaded. +\def\pgfplotstableresetcolortbloverhangright{% + \pgfutil@ifundefined{CT@row@color}{\relax}{% + \global\let\pgfplots@origrowcolorcmd=\CT@row@color + \gdef\CT@row@color{% + \pgfplots@origrowcolorcmd + \@tempdimc=0pt + \global\let\CT@row@color=\pgfplots@origrowcolorcmd + }% + }% +}% +\def\pgfplotstableresetcolortbloverhangleft{% + \pgfutil@ifundefined{CT@row@color}{\relax}{% + \global\let\pgfplots@origrowcolorcmd=\CT@row@color + \gdef\CT@row@color{% + \pgfplots@origrowcolorcmd + \@tempdimb=0pt + \global\let\CT@row@color=\pgfplots@origrowcolorcmd + }% + }% +}% + % \pgfplotstableread[OPTIONS] {FILE} to \name % % This method reads a table from FILE to macro \name. @@ -571,10 +891,172 @@ % BACKWARDS COMPATIBILITY \let\pgfnumtableread=\pgfplotstableread -\def\pgfplotstablegetcolumnlist#1\to#2{% - \let#2=#1 +% Invokes #2 if '#1' is an already loaded table and #3 if not. +\long\def\pgfplotstable@isloadedtable#1#2#3{% + \pgfutil@ifundefined{\string#1@@table@name}{#3}{#2}% +}% + +% Defines \pgfmathresult to be the number of rows in table #1. +% +% #1 may be either a loaded table structure (a macro name) or a table +% file name. In the latter case, the file will be loaded temporarily. +\def\pgfplotstablegetrowsof#1{% + \pgfplotstable@isloadedtable{#1}{% + % ah - it is an already loaded table! + \begingroup + \pgfplotslistfront#1\to\pgfplotstablegetrows@@ + \expandafter\pgfplotslistsize\csname\string#1@\pgfplotstablegetrows@@\endcsname\to\c@pgfplotstable@counta + \edef\pgfmathresult{\the\c@pgfplotstable@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }{% + % ah - it is a file name. + \begingroup + \pgfplotstableread{#1}\pgfplotstablegetrows@ + \pgfplotstablegetrowsof{\pgfplotstablegetrows@}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }% +}% + +% \pgfplotstablesave[<options>]{<\tablename>}{file name} +\def\pgfplotstablesave{% + \pgfutil@ifnextchar[{% + \pgfplotstablesave@impl + }{% + \pgfplotstablesave@impl[]% + }% +} + +{ +\catcode`\^^I=12 +\gdef\pgfplotstablesave@impl@TAB{^^I} } +\def\pgfplotstablesave@impl[#1]#2#3{% + \pgfplotstabletypeset[% + reset styles,% + disable rowcol styles,% + begin table={}, end table={},% + typeset cell/.code={% + \begingroup + \t@pgfplots@toka={##1}% + \ifcase\pgfplotstableread@OUTCOLSEP@CASE\relax + % SPACE: + \t@pgfplots@tokb=\expandafter{\pgfplotstablesave@impl@TAB}% + \pgfplots@ifempty{##1}{% + \t@pgfplots@toka={{}}% + }{}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % comma: + \t@pgfplots@tokb={,}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % semicolon: + \t@pgfplots@tokb={;}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % colon: + \t@pgfplots@tokb={:}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % braces: + \xdef\pgfplots@glob@TMPc{{\the\t@pgfplots@toka}}% + \fi + \endgroup + \pgfkeyslet{/pgfplots/table/@cell content}\pgfplots@glob@TMPc% + },% + before row=,after row=,% + skip coltypes, typeset=false, string type,% + TeX comment=,% + columns=,% + font=,% + /pgfplots/table/col sep/.is choice,% + /pgfplots/table/col sep/space/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{0}},% + /pgfplots/table/col sep/comma/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{1}},% + /pgfplots/table/col sep/semicolon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{2}},% + /pgfplots/table/col sep/colon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{3}},% + /pgfplots/table/col sep/braces/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{4}},% + /pgfplots/table/col sep=space,% + /pgfplots/table/in col sep/.is choice,% + /pgfplots/table/in col sep/space/.code = {\def\pgfplotstableread@COLSEP@CASE{0}},% + /pgfplots/table/in col sep/comma/.code = {\def\pgfplotstableread@COLSEP@CASE{1}},% + /pgfplots/table/in col sep/semicolon/.code = {\def\pgfplotstableread@COLSEP@CASE{2}},% + /pgfplots/table/in col sep/colon/.code = {\def\pgfplotstableread@COLSEP@CASE{3}},% + /pgfplots/table/in col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}},% + /pgfplots/table/in col sep=space,% + % WARNING: you NEED a '%' before '#1': + #1,% + outfile={#3}% + ]{#2}% +}% + +% \pgfplotstablenew[<options>]{<numrows>}{<\name>} +% +% Creates a new table from scratch. +% +% The new table will contain all columns listed in the 'columns' key +% which must be present in <options>. +% +% Furthermore, there must be 'create on use' statements for every +% column which shall be generated. Columns are generated +% independently, in the order of appearance in 'columns'. +% The table will contain exactly <numrows> rows. +\def\pgfplotstablenew{% + \pgfutil@ifnextchar[{% + \pgfplotstablenew@impl + }{% + \pgfplotstablenew@impl[]% + }% +}% +\def\pgfplotstablenew@impl[#1]#2#3{% + \pgfutil@namedef{\string#3@@table@name}{newlycreatedtable}% + \begingroup + % create a temporary column with the desired number of rows: + \pgfutil@in@\pgfplotstablegetrowsof{#2}% + \ifpgfutil@in@ + #2% + \let\pgfplotstable@loc@TMPa=\pgfmathresult + \else + \def\pgfplotstable@loc@TMPa{#2}% + \fi + \pgfplotslistnew#3{@@@@@temporary@column@\\}% + \expandafter\pgfplots@assign@list\csname\string#3@@@@@@temporary@column@\endcsname{1,2,...,\pgfplotstable@loc@TMPa}% + % + % now, create all real columns: + \pgfkeyslet{/pgfplots/table/columns}{\pgfutil@empty}% + \pgfplotstableset{#1}% + \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% + \ifx\pgfplotstable@colnames\pgfutil@empty + \pgfplots@warning{\string\pgfplotstablenew[columns={},...]{#2}{\string#3} has been invoked - but empty tables are currently not really supported, sorry. You will have to live with an artifical column which contains temporary values.}% + \else + \expandafter\pgfplots@assign@list\expandafter\pgfplotstablenew@cols\expandafter{\pgfplotstable@colnames}% + % make sure every requested column exists: + \pgfutil@loop + \pgfplotslistcheckempty\pgfplotstablenew@cols + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \pgfplotslistpopfront\pgfplotstablenew@cols\to\pgfplotstablenew@col + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstablenew@col}\of#3\to\pgfplotstable@loc@TMPa + \pgfutil@repeat + % remove the temporary column: + % FIXME this should be done after the '\fi'. But that will + % lead to an error because empty tables are currently + % unsupported! + \pgfplotslistpopfront#3\to\pgfplotstable@loc@TMPa + \fi + \pgfplotstable@copy@to@globalbuffers#3 + \endgroup + \pgfplotstable@copy@globalbuffers@to#3 +}% + +\def\pgfplotstablegetcolumnlist#1\to#2{\let#2=#1} + % Returns a column vector in form of \pgfplotslist % into #3. % @@ -652,7 +1134,7 @@ \pgfutil@ifundefined{\string#2@\pgfplotstable@loc@TMPa}{% \def\pgfplotstable@loc@TMPb{/pgfplots/table/create on use/#1}% \pgfkeysifdefined{\pgfplotstable@loc@TMPb/.@cmd}{% - \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPb' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here.}% + \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPb' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% }{% \pgfplots@error{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.}% }% @@ -731,6 +1213,8 @@ % - \getthisrow{<col name>}{\macro} % - \nextrow{<col name>}, % - \getnextrow{<col name>}{\macro} +% +% FIXME this documentation is incomplete. Please refer to pgfplotstable.pdf . \def\pgfplotstablecreatecol{% \pgfutil@ifnextchar[{% \pgfplotstablecreatecol@opt @@ -743,6 +1227,8 @@ % Typesets a table. % % \pgfplotstabletypeset[<options>]<\tablestructure> +% or +% \pgfplotstabletypeset[<options>]{<file name>} % % If you do not select any columns, the complete table is drawn. % @@ -765,24 +1251,55 @@ \pgfplotstabletypeset@opt[]% }% } +\def\pgfplotstabletypeset@opt[#1]#2{% + \pgfplotstable@isloadedtable{#2}% + {\pgfplotstabletypeset@opt@[#1]{#2}}% + {\pgfplotstabletypesetfile@opt@[#1]{#2}}% +} % Like \pgfplotstabletypeset, but the first argument is a file name. -\def\pgfplotstabletypesetfile{% - \pgfutil@ifnextchar[{% - \pgfplotstabletypesetfile@opt - }{% - \pgfplotstabletypesetfile@opt[]% - }% -} -\def\pgfplotstabletypesetfile@opt[#1]#2{% +% This is the same now; it will be recognised automatically. +\let\pgfplotstabletypesetfile=\pgfplotstabletypeset +\def\pgfplotstabletypesetfile@opt@[#1]#2{% \begingroup \ifpgfplots@table@options@areset \else \pgfplots@table@options@aresettrue \pgfplotstableset{/pgfplots/table/every table={#2},#1}% \fi - \pgfplotstableread{#2}\pgfplotstabletypesetfile@opt@@ - \pgfplotstabletypeset\pgfplotstabletypesetfile@opt@@ + \ifpgfplotstabletypeset@force@remake + \pgfplotstabletypeset@includeoutfilesfalse + \else + \ifpgfplotstabletypeset@includeoutfiles + \pgfplotstabletypeset@includeoutfilesfalse + \pgfkeysgetvalue{/pgfplots/table/outfile}\pgfplotstable@outfilename + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \openin1=\pgfplotstable@outfilename\relax + \ifeof1 + \else + \pgfplotstabletypeset@includeoutfilestrue + \fi + \closein1 + \fi + \fi + \fi + \ifpgfplotstabletypeset@includeoutfiles + \input \pgfplotstable@outfilename\relax + \else + \pgfplotstableread{#2}\pgfplotstabletypesetfile@opt@@ + \pgfplotstabletypeset\pgfplotstabletypesetfile@opt@@ + \fi + \pgfkeysgetvalue{/pgfplots/table/write to macro}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@loc@TMPa{\pgfutil@empty}% + \else + \expandafter\ifx\pgfplots@loc@TMPa\relax + % is it really defined? NO! Sanity checking here: + \def\pgfplots@loc@TMPa{\pgfutil@empty}% + \fi + \fi + \expandafter\pgfmath@smuggleone\pgfplots@loc@TMPa \endgroup }% @@ -843,6 +1360,7 @@ \closein1 \openin1=#2\relax \fi + \pgfplots@logfileopen{#2}% \def\pgfplotstableread@filename{#2}% \let\pgfplotstableread@lineno=\c@pgf@counta \let\pgfplotstableread@numcols=\c@pgf@countb @@ -851,10 +1369,10 @@ \pgfplotstableread@lineno=0 \pgfplotstableread@usablelineno=0 \pgfplotstableread@numcols=0 - \global\pgfplotslistnewempty\pgfplotstable@colnames + \global\pgfplotslistnewempty\pgfplotstable@colnames@glob \ifeof1 \pgfplotstable@error{Could not read table file '#2'.}% - \global\pgfplotslistnewempty\pgfplotstable@colnames + \global\pgfplotslistnewempty\pgfplotstable@colnames@glob \else \ifpgfplots@tableread@to@listener \let\pgfplotstable@listener=#3% @@ -877,21 +1395,44 @@ \else % Now, we can access the global variables! % copy them to #3. - \let#3=\pgfplotstable@colnames \expandafter\def\csname\string#3@@table@name\endcsname{#2}% - \c@pgfplotstable@counta=0\relax% - \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\let\csname\string#3@\pgfplotstable@loc@TMPa\endcsname}% - \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname - %\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% - \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty - \advance\c@pgfplotstable@counta by1\relax - }% + \pgfplotstable@copy@globalbuffers@to#3 \fi - \global\let\pgfplotstable@colnames=\pgfutil@empty } +% Copies the table column list and the column vectors of #1 to global buffers. +% @see \pgfplotstable@copy@globalbuffers@to +% +% Use these two methods to avoid scoping problems. +\def\pgfplotstable@copy@to@globalbuffers#1{% + \global\let\pgfplotstable@colnames@glob=#1 + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname% + }% + \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname + \advance\c@pgfplotstable@counta by1\relax + }% +}% + +% copies the global column list and the global column vectors to #1 +% (NOT the table file name). +% @see \pgfplotstable@copy@to@globalbuffers +\def\pgfplotstable@copy@globalbuffers@to#1{% + \let#1=\pgfplotstable@colnames@glob + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\let\csname\string#1@\pgfplotstable@loc@TMPa\endcsname}% + \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname +%\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty + \advance\c@pgfplotstable@counta by1\relax + }% + \global\let\pgfplotstable@colnames@glob=\pgfutil@empty +}% + \def\pgfplotstableread@finish{% \ifpgfplots@tableread@to@listener \else @@ -926,6 +1467,9 @@ %\pgfplots@message{READING LINE \the\pgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% \pgfplotstableread@curline@contains@colnamesfalse \ifnum\pgfplotstableread@numcols=0\relax + % STEP 0: initialise + % - count columns + % - find header data \pgfplotstableread@curcol=0\relax \pgfplotstableread@impl@DO\pgfplotstableread@impl@countcols@and@identifynames@NEXT\pgfplotstable@LINE %\expandafter\pgfplotstableread@impl@countcols@and@identifynames@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI @@ -963,7 +1507,7 @@ \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE %\expandafter\pgfplotstableread@impl@nextrow@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI \fi -%\pgfplots@message{After reading first row: found '\the\pgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames'}% +%\pgfplots@message{After reading first row: found '\the\pgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames@glob'}% \else \pgfplotstableread@curcol=0\relax \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE @@ -1032,7 +1576,7 @@ \pgfplotstableread@curcol=0\relax \pgfutil@loop \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols - \expandafter\pgfplotslistpushbackglobal\the\pgfplotstableread@curcol\to\pgfplotstable@colnames + \expandafter\pgfplotslistpushbackglobal\the\pgfplotstableread@curcol\to\pgfplotstable@colnames@glob \advance\pgfplotstableread@curcol by1\relax \pgfutil@repeat } @@ -1173,7 +1717,7 @@ }{% \def\pgfplotstable@loc@TMPa{/pgfplots/table/create on use/#1}% \pgfkeysifdefined{\pgfplotstable@loc@TMPa/.@cmd}{% - \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here.}% + \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% }{% \pgfplots@error{Sorry, could not retrieve column '#1' from table '\pgfplotstableread@filename'. Please check spelling (or introduce name aliases).}% }% @@ -1201,10 +1745,17 @@ \long\def\pgfplotstableread@impl@nextrow@NEXT#1{% %\pgfplots@message{Inserting '#1' at (\the\pgfplotstableread@lineno, \the\pgfplotstableread@curcol).}% - \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc - \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% - \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\the\pgfplotstableread@curcol\endcsname - \advance\pgfplotstableread@curcol by1\relax + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols + \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc + \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% + \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\the\pgfplotstableread@curcol\endcsname + \advance\pgfplotstableread@curcol by1\relax + \else + \begingroup + \t@pgfplots@tokc={#1}% + \pgfplots@error{Table '\pgfplotstableread@filename' has too much columns in line \the\pgfplotstableread@lineno: Ignoring '\the\t@pgfplots@tokc'. Please verify that every cell entry is separated correctly (use braces {<cell entry>} if necessary). This error is not critical}% + \endgroup + \fi } @@ -1218,7 +1769,7 @@ \edef\pgfplotstable@loc@TMPa{#1--index\the\pgfplotstableread@curcol}% }% \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. - \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames@glob \ifpgfplots@tableread@to@listener % create an associative container colindex -> colname % for use in a listener. @@ -1404,6 +1955,7 @@ % processes the option 'assign column name' \def\pgfplotstabletypeset@assign@final@colname#1#2{% \pgfkeysifdefined{/pgfplots/table/assign column name/.@cmd}{% + \pgfkeysdef{/pgfplots/table/column name}{#1}% \pgfkeysvalueof{/pgfplots/table/assign column name/.@cmd}#1\pgfeov \pgfkeysgetvalue{/pgfplots/table/column name}{#2}% }{}% @@ -1439,7 +1991,7 @@ % TODO % - replace grouped list foreach by popfront-loop and use arrays % directly -> group only the pgfkeys eval -\def\pgfplotstabletypeset@opt[#1]#2{% +\def\pgfplotstabletypeset@opt@[#1]#2{% \begingroup %-------------------------------------------------- % \pgfutil@ifundefined{#2}{% @@ -1458,6 +2010,61 @@ \edef\pgfplotstable@loc@TMPa{/pgfplots/table/every table={\the\t@pgfplots@toka}}% \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa,#1}% \fi + \pgfkeysgetvalue{/pgfplots/table/outfile}\pgfplotstable@outfilename + \pgfkeysgetvalue{/pgfplots/table/TeX comment}\pgfplots@TeX@comment + \ifpgfplotstabletypeset@force@remake + \pgfplotstabletypeset@includeoutfilesfalse + \else + \ifpgfplotstabletypeset@includeoutfiles + \pgfplotstabletypeset@includeoutfilesfalse + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \pgfplots@logfileopen{\pgfplotstable@outfilename}% + \openin1=\pgfplotstable@outfilename\relax + \ifeof1 \else\pgfplotstabletypeset@includeoutfilestrue \fi + \closein1 + \fi + \fi + \fi + \ifpgfplotstabletypeset@includeoutfiles + \input \pgfplotstable@outfilename\relax + \else + % + % Prepare outfile and debug options: + \let\pgfplotstable@notify@finished@line=\pgfutil@empty + % + % FLUSH assumes that \pgfplotstable@curline is finished. It + % appends all its contents as-is to \pgfplotstable@result. + % + % Furthermore, it calls \pgfplotstable@notify@finished@line which + % in turn may invoke additional output routines for the debug and + % outfile options. + % + % Finally, it resets \pgfplotstable@curline. + \def\pgfplotstable@curline@FLUSH{% + \pgfplotstable@notify@finished@line + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \let\pgfplotstable@curline=\pgfutil@empty + }% + \ifpgfplotstabletypesetdebug + \immediate\write16{------- PGFPLOTSTABLE DEBUG MODE: --------}% + \expandafter\def\expandafter\pgfplotstable@notify@finished@line\expandafter{\pgfplotstable@notify@finished@line + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \immediate\write16{\the\t@pgfplots@toka\pgfplots@TeX@comment}% + }% + \fi + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \immediate\openout\pgfplotstable@outfile=\pgfplotstable@outfilename\relax + \expandafter\def\expandafter\pgfplotstable@notify@finished@line\expandafter{\pgfplotstable@notify@finished@line + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \immediate\write\pgfplotstable@outfile{\the\t@pgfplots@toka\pgfplots@TeX@comment}% + }% + \fi + % + % Start operation: \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% \ifx\pgfplotstable@colnames\pgfutil@empty \pgfplotstablegetcolumnlist#2\to\pgfplotstable@colnames @@ -1494,6 +2101,8 @@ \global\c@pgfplotstable@numrows=\c@pgfplotstable@numrows \fi % + % + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Set keys for columns! \ifodd\c@pgfplotstable@colindex \t@pgfplots@toka={every odd column}% @@ -1504,23 +2113,30 @@ \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first column}% \fi % save this now before we increment '\c@pgfplotstable@colindex': - \edef\pgfplotstable@displaycolkey{display columns/\the\c@pgfplotstable@colindex/.try}% + \edef\pgfplotstable@displaycolkey{display columns/\the\c@pgfplotstable@colindex/.try,every col no \the\c@pgfplotstable@colindex/.try}% % \global\advance\c@pgfplotstable@colindex by1\relax \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last column}% \fi - \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname}% - \expandafter\pgfplotstable@checkspecialchars@pgfkeys\the\t@pgfplots@tokb\pgfplotstable@EOI - \ifpgfutil@in@ - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/{\the\t@pgfplots@tokb}/.try}% + \ifpgfplotstable@disable@rowcolstyles + % ok, then don't check for 'columns/<name>' and + % 'display columns/<index>': + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka}% \else - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/\the\t@pgfplots@tokb/.try}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname}% + \expandafter\pgfplotstable@checkspecialchars@pgfkeys\the\t@pgfplots@tokb\pgfplotstable@EOI + \ifpgfutil@in@ + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/{\the\t@pgfplots@tokb}/.try}% + \else + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/\the\t@pgfplots@tokb/.try}% + \fi + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@displaycolkey}% + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}% \fi - \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@displaycolkey}% - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}% \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa}% + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \pgfkeysgetvalue{/pgfplots/table/column name}{\pgfplotstable@colname@out}% \ifx\pgfplotstable@colname@out\pgfplotstabletypeset@nocolname @@ -1583,31 +2199,42 @@ %\message{I have now \meaning\pgfplotstabletypeset@final@colnames, and \meaning\pgfplotstabletypeset@final@cols.}% % Step 1: column names. \c@pgfplotstable@colindex=0\relax - % STEP 1.1: collect column types: - \def\pgfplotstable@resulttypes{}% - \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% - \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% - \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - }% - \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% - \ifx\pgfplotstable@resulttypes\pgfutil@empty - \edef\pgfplotstable@result{\the\t@pgfplots@toka}% - \else - \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% - \fi + \c@pgfplotstable@rowindex=-1\relax + \let\pgfplotstable@result=\pgfutil@empty % \pgfkeysgetvalue{/pgfplots/table/font}{\pgfplotstable@font}% \ifx\pgfplotstable@font\pgfutil@empty \else \t@pgfplots@toka=\expandafter{\pgfplotstable@font}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\noexpand\begingroup\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\noexpand\begingroup\the\t@pgfplots@toka}% + \pgfplotstable@curline@FLUSH + \fi + % + \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka}% + % + \ifpgfplotstabletypesetskipcoltypes + \else + % STEP 1.1: collect column types: + \def\pgfplotstable@resulttypes{}% + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% + \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% + \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + }% + \ifx\pgfplotstable@resulttypes\pgfutil@empty + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% + \fi + \fi + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH \fi % - % Step 1.2: Collect FIRST ROW (column names) \begingroup \pgfplotstableset{every head row}% @@ -1623,23 +2250,28 @@ \pgfplots@glob@TMPc % insert 'before row' here: \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% % \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% + % \advance\c@pgfplotstable@colindex by1\relax - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname@out \\}% - \else - \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname@out &}% - \fi - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % typeset the cell: + \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa + \expandafter\pgfplots@loc@TMPa\pgfplotstable@colname@out\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + % + % append this cell: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfmathresult}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% }% % insert 'after row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % + \pgfplotstable@curline@FLUSH % %\message{I have now \meaning\pgfplotstable@result.}% % Step 2: column contents. @@ -1682,15 +2314,18 @@ \ifnum\c@pgfplotstable@rowindex=0\relax \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first row}% \fi + \ifpgfplotstable@disable@rowcolstyles + \else + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \fi % misuse as temporary variable: \c@pgfplotstable@colindex=\c@pgfplotstable@rowindex \advance\c@pgfplotstable@colindex by1\relax \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numrows - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try,every last row}% - \else - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last row}% \fi - \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa}% + \expandafter\pgfplotstableset\expandafter{\the\t@pgfplots@toka}% \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% @@ -1703,58 +2338,70 @@ \pgfplots@glob@TMPc % insert 'before row' here: \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% \fi % % \pgfplotslistpopfront\pgfplotstable@col@processed\to\pgfplotstable@entry \pgfplotsarrayletentry\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array=\pgfplotstable@col@processed \advance\c@pgfplotstable@colindex by1\relax - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry \\}% - \else - \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry &}% - \fi - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % typeset the cell: + \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa + \expandafter\pgfplots@loc@TMPa\pgfplotstable@entry\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + % + % append this cell: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfmathresult}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax \c@pgfplotstable@colindex=0\relax % insert 'after row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% \advance\c@pgfplotstable@rowindex by1\relax + \pgfplotstable@curline@FLUSH \fi %\message{I have now \meaning\pgfplotstable@result.}% \fi \pgfutil@repeat - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \pgfkeysgetvalue{/pgfplots/table/end table}{\pgfplotstable@entry}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH + \fi + % \ifx\pgfplotstable@font\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplotstable@result\endgroup}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka}% + \edef\pgfplotstable@curline{\noexpand\endgroup}% + \pgfplotstable@curline@FLUSH \fi - \ifpgfplotstabletypesetdebug - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \immediate\write16{------- PGFPLOTSTABLE DEBUG MODE: --------}% - \immediate\write16{{\the\t@pgfplots@toka}}% + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \immediate\closeout\pgfplotstable@outfile \fi - \pgfkeysgetvalue{/pgfplots/table/outfile}{\pgfplotstable@entry}% - \ifx\pgfplotstable@entry\pgfutil@empty +%\message{I have now \meaning\pgfplotstable@result.}% + \def\pgfplotstablecol{\pgfplots@error{Sorry, you can't access the \string\pgfplotstablecol\ in this context. It is ONLY valid during the preparation routines (please check the 'display columns/<index>' style in the manual).}}% + \def\pgfplotstablerow{\pgfplots@error{Sorry, you can't access the \string\pgfplotstablerow\ in this context. It is ONLY valid during the preparation routines (please check the 'every row no <index>' style).}}% + \ifpgfplotstabletypesetresult + \pgfplotstable@result + \fi + \pgfkeysgetvalue{/pgfplots/table/write to macro}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \global\let\pgfplots@glob@TMPa=\relax \else - \begingroup - \immediate\openout\pgfplotstable@outfile=\pgfplotstable@entry\relax \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \immediate\write\pgfplotstable@outfile{\the\t@pgfplots@toka}% - \immediate\closeout\pgfplotstable@outfile - \endgroup + \xdef\pgfplots@glob@TMPa{\noexpand\def\expandafter\noexpand\pgfplots@loc@TMPa{\the\t@pgfplots@toka}}% + \fi \fi - \pgfplotstable@result \endgroup + \pgfplots@glob@TMPa% execute 'write to macro' if set. }% \newif\ifpgfplotstable@isfirstrow @@ -1806,8 +2453,12 @@ % \pgfplots@loop@CONTINUEtrue % allow this here to accumulate something. - \let\pgfmathaccuma=\pgfutil@empty - \let\pgfmathaccumb=\pgfutil@empty + \pgfutil@ifundefined{pgfmathaccuma}{% + \let\pgfmathaccuma=\pgfutil@empty + }{}% + \pgfutil@ifundefined{pgfmathaccumb}{% + \let\pgfmathaccumb=\pgfutil@empty + }{}% \pgfutil@loop% loop over each row until there are no more rows. \ifpgfplots@loop@CONTINUE \ifnum\c@pgfplotstable@numrows=-1\relax @@ -1883,4 +2534,181 @@ \expandafter\let\csname\string#3@\pgfplots@glob@TMPb\endcsname=\pgfplots@glob@TMPc }% + +%----------------------------------------------------------- +% +% Implementation of '/pgfplots/table/create col/function graph cut y': +% +%----------------------------------------------------------- + +% create on use/cut/.style={create col/function graph cut y={7e-4}{x=Basis,ymode=log,xmode=log}{{table=regtable,y=special-L2}}}, +% #1 = value of fixed line (I call it epsilon) +% #2 = options +% #3 = specification where to get the y from. It is a comma separated +% list of key-value sets, on set for every y(x) graph which shall be +% used. +% #4 = the direction in which the line does NOT vary (either 'x' or 'y') +% #5 = the direction in which the line DOES vary (either 'x' or 'y') +\def\pgfplotstable@fgc@init#1#2#3#4#5{% + \def\pgfplotstable@fgc@xmode{0}% + \def\pgfplotstable@fgc@ymode{0}% + % + \pgfkeysalso{/pgf/fpu=true}% + % + \pgfqkeys{/pgfplots/table/create col/function graph cut}{#2}% + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/table}\pgfplotstable@fgc@table + \ifx\pgfplotstable@fgc@table\pgfutil@empty + \else + % ok, we need to query (or load) a table! + \pgfplotstable@isloadedtable{\pgfplotstable@fgc@table}{% + }{% + \expandafter\pgfplotstableread\expandafter{\pgfplotstable@fgc@table}{\pgfplotstable@fgc@table}% + }% + \fi + % + \ifnum\csname pgfplotstable@fgc@#4mode\endcsname=1 + \pgfmathparse{ln(#1)}% + \else + \pgfmathparse{#1}% + \fi + \let\pgfplotstable@fgc@eps=\pgfmathresult + \pgfplots@assign@list\pgfmathaccumb{#3}% + % + \pgfkeysdef{/pgfplots/table/create col/assign}{% +%\message{working on next cell ...}% + \pgfplotslistcheckempty\pgfmathaccumb + \ifpgfplotslistempty + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + \else + \pgfplotslistpopfront\pgfmathaccumb\to\pgfmathresult + \begingroup + % set local keys: + \def\pgfplots@loc@TMPa{\pgfqkeys{/pgfplots/table/create col/function graph cut}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}% + % acquire any sources: + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/table}\pgfplotstable@fgc@table + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/x}\pgfplotstable@fgc@x + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/y}\pgfplotstable@fgc@y + \ifx\pgfplotstable@fgc@table\pgfutil@empty + \else + % ok, we need to query (or load) a table! + \pgfplotstable@isloadedtable{\pgfplotstable@fgc@table}{% + }{% + \expandafter\pgfplotstableread\expandafter{\pgfplotstable@fgc@table}{\pgfplotstable@fgc@table}% + }% + \fi + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@fgc@x}\of\pgfplotstable@fgc@table\to\pgfplotstable@fgc@x@col + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@fgc@y}\of\pgfplotstable@fgc@table\to\pgfplotstable@fgc@y@col + % + % search for epsilon in the y values: + \expandafter\pgfplotstable@fgc@findintervalwitheps\expandafter{\csname pgfplotstable@fgc@#4@col\endcsname}{\csname pgfplotstable@fgc@#4mode\endcsname}% + \ifx\pgfplotstable@fgc@second\pgfutil@empty + \let\pgfmathresult=\pgfutil@empty + \else + % + % acquire the associated x values: + \expandafter\pgfplotstable@fgc@getassociated\expandafter{\csname pgfplotstable@fgc@#5@col\endcsname}{\csname pgfplotstable@fgc@#5mode\endcsname}% + % + % Interpolate: + \pgfmathparse{ + \pgfplotstable@fgc@abscissafirst + + (\pgfplotstable@fgc@eps - \pgfplotstable@fgc@first) / (\pgfplotstable@fgc@second-\pgfplotstable@fgc@first) + * (\pgfplotstable@fgc@abscissasecond - \pgfplotstable@fgc@abscissafirst) }% + \if\pgfplotstable@fgc@xmode1 + \pgfmathfloatexp@{\pgfmathresult}% + \fi + \pgflibraryfpuifactive{\pgfmathfloattosci{\pgfmathresult}}{}% +%\message{FGC: found \pgfplotstable@fgc@eps\space in no \pgfplotstable@fgc@index; \pgfplotstable@fgc@first:\pgfplotstable@fgc@second; lastwasless=\pgfplotstable@fgc@lastwasless; abscissa interval = \pgfplotstable@fgc@abscissafirst:\pgfplotstable@fgc@abscissasecond; result = \pgfmathresult}% + \fi + % + \pgfmath@smuggleone\pgfmathresult + \endgroup + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \fi + }% +}% + +% #1 : the coordinate list to query +% #2 : the mode +% +% POSTCONDITION: +% - \pgfplotstable@fgc@abscissafirst and \pgfplotstable@fgc@abscissasecond +% contain the abscissa values +% +\def\pgfplotstable@fgc@getassociated#1#2{% + \c@pgfplotstable@counta=\pgfplotstable@fgc@index + \pgfplotslistselect\c@pgfplotstable@counta\of#1\to\pgfplotstable@fgc@abscissasecond + \advance\c@pgfplotstable@counta by-1 + \pgfplotslistselect\c@pgfplotstable@counta\of#1\to\pgfplotstable@fgc@abscissafirst + \pgfmathfloatparsenumber{\pgfplotstable@fgc@abscissafirst}% + \let\pgfplotstable@fgc@abscissafirst=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplotstable@fgc@abscissasecond}% + \let\pgfplotstable@fgc@abscissasecond=\pgfmathresult + \if1#2 + \pgfmathln@{\pgfplotstable@fgc@abscissafirst}% + \let\pgfplotstable@fgc@abscissafirst=\pgfmathresult + \pgfmathln@{\pgfplotstable@fgc@abscissasecond}% + \let\pgfplotstable@fgc@abscissasecond=\pgfmathresult + \fi +}% + +% Search for the (first) interval in #1 containing epsilon and return +% \pgfplotstable@fgc@first and \pgfplotstable@fgc@second. +% +% #1 : the list of values. +% #2 : the mode (0 = linear, 1 = log) +% +% PRECONDITION: +% - \pgfplotstable@fgc@eps contains the value to search for +% +% POSTCONDITION +% On success, +% - \pgfplotstable@fgc@first and \pgfplotstable@fgc@second contain the interval. +% - \pgfplotstable@fgc@index contains the index of the @second coordinate. +% - \pgfplotstable@fgc@lastwasless is +% 1 if \pgfplotstable@fgc@second < eps +% 0 if \pgfplotstable@fgc@second >= eps +% If there was no such interval, +% \pgfplotstable@fgc@second will be empty. +\def\pgfplotstable@fgc@findintervalwitheps#1#2{% + \global\let\pgfplotstable@fgc@first=\pgfutil@empty + \global\let\pgfplotstable@fgc@second=\pgfutil@empty + \global\def\pgfplotstable@fgc@lastwasless{2}% + \global\def\pgfplotstable@fgc@break{0}% + \global\def\pgfplotstable@fgc@index{0}% + \pgfplotslistforeach#1\as\pgfplotstable@fgc@val{% + \if\pgfplotstable@fgc@break0 + \pgfmathfloatparsenumber{\pgfplotstable@fgc@val}% + \let\pgfplotstable@fgc@val=\pgfmathresult + \ifnum#2=1 + \pgfmathln@{\pgfplotstable@fgc@val}% + \let\pgfplotstable@fgc@val=\pgfmathresult + \fi + \pgfmathfloatlessthan@{\pgfplotstable@fgc@val}{\pgfplotstable@fgc@eps}% + \ifpgfmathfloatcomparison + \pgfplotstable@fgc@findintervalwitheps@updateresult 01 + \else + \pgfplotstable@fgc@findintervalwitheps@updateresult 10 + \fi + \fi + }% +} + +% #1 : the value of \pgfplotstable@fgc@lastwasless for which the loop +% shall break. +% #2 : the next value for \pgfplotstable@fgc@lastwasless +\def\pgfplotstable@fgc@findintervalwitheps@updateresult#1#2{% + \if\pgfplotstable@fgc@lastwasless#1 + % found it ! + \global\let\pgfplotstable@fgc@second=\pgfplotstable@fgc@val + \global\def\pgfplotstable@fgc@break{1}% + \else + \global\let\pgfplotstable@fgc@first=\pgfplotstable@fgc@val + \c@pgfplotstable@counta=\pgfplotstable@fgc@index + \advance\c@pgfplotstable@counta by1 + \xdef\pgfplotstable@fgc@index{\the\c@pgfplotstable@counta}% + \fi + \global\def\pgfplotstable@fgc@lastwasless{#2}% +}% + \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex index ce780e866b2..6d89fd79532 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -1,12 +1,29 @@ -%-------------------------------------------------- -% \pgfutil@ifundefined{pgfmathfloattosci} -% {}% -% {\endinput}% -%-------------------------------------------------- -\pgfkeysifdefined{/pgf/number format/@dec sep mark}{\endinput}{} - -\immediate\write16{Package pgfplots: loading complementary code for your PGF version...} -\input pgfplotsoldpgfsupp_misc.code.tex -\input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex -\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex -\input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex + +\pgfutil@ifundefined{pgfmathlessthan@}{% + \let\pgfmathlessthan@=\pgfmathless@ + \let\pgfmathgreaterthan@=\pgfmathgreater@ +}{}% + + +% check whether we need to load supplementary code. +% The development of pgfplots and pgf is intermingled, so pgfplots +% always uses up-to-date pgf CVS versions - the relevant complements between +% PGF 2.00 and PGF CVS are loaded here: +\pgfutil@ifundefined{pgfmathfloatparsenumber@handleerror}{% + %\pgfkeysifdefined{/pgf/number format/min exponent for 1000 sep}{\endinput}{} + \immediate\write16{Package pgfplots: loading complementary code for your PGF version...} + \input pgfplotsoldpgfsupp_misc.code.tex + \input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex + \input pgfplotsoldpgfsupp_pgfmathfloat.code.tex + \input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +} + {\relax} + +\pgfplots@iffileexists{pgflibraryfpu.code.tex}{% + \usepgflibrary{fpu}% +}{% + \immediate\write16{Package pgfplots: loading FPU library which doesn't appear to exist in your PGF version...} + \input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex +}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex index def32476da4..8911ac2f14b 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex @@ -91,6 +91,13 @@ \tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright} \tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft} +\tikzoption{mark}{ + \def\tikz@plot@mark{#1}% + \def\tikz@temp{none}% this check is relatively new + \ifx\tikz@temp\tikz@plot@mark + \let\tikz@plot@mark=\pgfutil@empty + \fi +} % the 'every mark' style is new: \tikzset{ every mark/.style={}, diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex new file mode 100644 index 00000000000..1c985f27d47 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex @@ -0,0 +1,1767 @@ +% Copyright 2008/2009 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU General Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\newif\ifpgfmathfloatparseactive +\newif\ifpgfmathfloat@scaleactive + +% public macro which invokes '#1' if the fpu is installed and ready and '#2' +% otherwise. +\def\pgflibraryfpuifactive#1#2{% + \ifpgfmathfloatparseactive + #1% + \else + #2% + \fi +}% + +\pgfqkeys{/pgf}{ + % enable the FPU parser if it is not yet active + % + % It will be deactivated after the current TeX group + fpu/.is choice, + fpu/true/.code={% + \ifpgfmathfloatparseactive + \else + \pgfutil@ifundefined{pgfmathdeclarefunction}{% + % Ohoh - we are running on a TeX distribution with + % PGF 2.00 which doesn't have the new math engine. + % I can provide special treatment here, provided that + % all float commands are still able to run (that means + % more information needs to be copied from the pgf cvs + % to pgf 2.00 - for example pgfmathfloat.code.tex). + % + % I employ this to work with pgfplots and pgf 2.00 + % using all new features. + \pgfmathfloat@parser@install@pgf@two@null@null% + }{% + \pgfmathfloat@parser@install% + }% + \pgfmathfloatparseactivetrue + % improve compatibility with Marks FP library: + \pgfkeysalso{/pgf/fixed point arithmetic/.prefix style={/pgf/fpu=false}}% + \fi + },% + fpu/false/.code={% + \ifpgfmathfloatparseactive + \pgfmathfloat@uninstall% + \pgfmathfloatparseactivefalse + \fi + },% + fpu/.default=true, + % Use this to introduce a result scaling. + % Every expression in which the prefix '*' occurs + % will be multiplied with the result and converted to fixed point + % representation. + fpu/scale results/.code={% + \ifpgfmathfloatparseactive + \pgfmathparse{#1}% + \else + \pgfmathfloatparsenumber{#1}% + \fi + \let\pgfmathfloatscale=\pgfmathresult% + },% + % determines the output format of each complete expression parsing + % process. If 'scale results' is active, 'fixed' is assumed + % automatically. + fpu/output format/.is choice, + fpu/output format/float/.code= {\let\pgfmathfloatparse@output=\relax}, + fpu/output format/sci/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattosci@{\pgfmathresult}}}, + fpu/output format/fixed/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattofixed@{\pgfmathresult}}}, + fpu/output format/float, +} + +\pgfmathfloatcreate{1}{1.0}{0}\let\pgfmathfloatscale=\pgfmathresult + +% This is the replacement parser invocation. +% It does two things which are different to \pgfmathparse: +% 1. it disables any dimension dependand scalings, +% 2. it implements the 'scale results' feature. +\def\pgfmathfloatparse{% + \begingroup% + % disable any dimension-dependant scalings: + \let\pgfmathpostparse=\relax% + \pgfmath@catcodes% + \pgfmath@quickparsefalse% + \pgfmathfloatparse@} + +% for pgf 2.00 : +\def\pgfmathfloatparse@pgf@two@null@null{% + \pgfmath@quickparsefalse% + \pgfmathfloatparse@} + +\def\pgfmathfloatparse@#1{% + \edef\pgfmathfloat@expression{#1}% + \expandafter\pgfmathfloatparse@@\pgfmathfloat@expression\pgfmathfloat@ + \ifpgfmathfloat@scaleactive + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloatscale} + \pgfmathfloattofixed{\pgfmathresult}% + \else + \pgfmathfloatparse@output + \fi +} + +\def\pgfmathfloat@char@asterisk{*} +\def\pgfmathfloatparse@@#1#2\pgfmathfloat@{% + \def\pgfmathfloat@test{#1}% + \ifx\pgfmathfloat@test\pgfmathfloat@char@asterisk% + \def\pgfmathfloat@expression{#2}% + \pgfmathfloat@scaleactivetrue + \fi% + \expandafter\pgfmathparse@\expandafter{\pgfmathfloat@expression}% + % \endgroup provided by \pgfpathmarse@end +} + +% Crude handling of file plots +% +\pgfkeys{/pgf/fpu/.cd, + scale file plot x/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalex{\pgfmathresult*}, + scale file plot y/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscaley{\pgfmathresult*}, + scale file plot z/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalez{\pgfmathresult*} +} + +\def\pgfmathfloat@uninstall@appendcmd#1{% + \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall #1}% +}% + +% If the uninstall command is already assembled, it will skip the +% uninstall assemblation. +\def\pgfmathfloat@plots@checkuninstallcmd{% + \pgfutil@ifundefined{pgfmathfloat@uninstall}{% + \global\let\pgfmathfloat@uninstall=\pgfutil@empty + }{% + % We already HAVE an uninstall command (prepared globally). + % So: don't waste time assembling one! + \def\pgfmathfloat@uninstall@appendcmd##1{}% + \def\pgfmathfloat@prepareuninstallcmd##1{}% + }% +}% + +% This assembles an uninstall command globally ON FIRST USAGE. +% See \pgfmathfloat@plots@checkuninstallcmd +\def\pgfmathfloat@prepareuninstallcmd#1{% + % and store backup information (globally - I don't want to do that + % all the time when the FPU is used!): + \expandafter\global\expandafter\let\csname pgfmathfloat@backup@\string#1\endcsname=#1% + \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall + \expandafter\let\expandafter#1\csname pgfmathfloat@backup@\string#1\endcsname% + }% +} + +\def\pgfmathfloat@install#1=#2{% + \pgfmathfloat@prepareuninstallcmd{#1}% + \let#1=#2% +} +\def\pgfmathfloat@install@unimplemented#1{% + \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname% + \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}% +} +\def\pgfmathfloat@plots@install{% + \let\pgfmathfloatplotscalex=\pgfutil@empty + \let\pgfmathfloatplotscaley=\pgfutil@empty + \let\pgfmathfloatplotscalez=\pgfutil@empty + \pgfmathfloat@install\pgf@parsexyline=\pgfmathfloat@parsexyline% + \pgfmathfloat@install\pgf@parsexyzline=\pgfmathfloat@parsexyzline% +} +\def\pgfmathfloat@parsexyline#1 #2 #3\pgf@stop{% + \edef\pgfmathfloat@marshal{% + \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}}% + }% + \pgfmathfloat@marshal% +} +\def\pgfmathfloat@parsexyzline#1 #2 #3 #4\pgf@stop{% + \edef\pgfmathfloat@marshal{% + \noexpand\pgfplotstreampoint{% + \noexpand\pgfpointxyz{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}{\pgfmathfloatplotscalez#3}% + }% + }% + \pgfmathfloat@marshal% +} + +% +\def\pgfmathfloat@parser@install@functions{% + % Install float commands... + % + \pgfmathfloat@install\pgfmathadd@=\pgfmathfloatadd@% + \pgfmathfloat@install\pgfmathsubtract@=\pgfmathfloatsubtract@% + \pgfmathfloat@install\pgfmathneg@=\pgfmathfloatneg@% + \pgfmathfloat@install\pgfmathmultiply@=\pgfmathfloatmultiply@% + \pgfmathfloat@install\pgfmathdivide@=\pgfmathfloatdivide@% + \pgfmathfloat@install\pgfmathabs@=\pgfmathfloatabs@% + \pgfmathfloat@install\pgfmathround@=\pgfmathfloatround@% + \pgfmathfloat@install\pgfmathfloor@=\pgfmathfloatfloor@% + \pgfmathfloat@install\pgfmathmod@=\pgfmathfloatmod@% + \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmax@% + \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmin@% + \pgfmathfloat@install\pgfmathsin@=\pgfmathfloatsin@% + \pgfmathfloat@install\pgfmathcos@=\pgfmathfloatcos@% + \pgfmathfloat@install\pgfmathtan@=\pgfmathfloattan@% + \pgfmathfloat@install\pgfmathdeg@=\pgfmathfloatdeg@% + \pgfmathfloat@install\pgfmathrad@=\pgfmathfloatrad@% + \pgfmathfloat@install\pgfmathatan@=\pgfmathfloatatan@% + \pgfmathfloat@install\pgfmathasin@=\pgfmathfloatasin@% + \pgfmathfloat@install\pgfmathacos@=\pgfmathfloatacos@% + \pgfmathfloat@install\pgfmathcot@=\pgfmathfloatcot@% + \pgfmathfloat@install\pgfmathsec@=\pgfmathfloatsec@% + \pgfmathfloat@install\pgfmathcosec@=\pgfmathfloatcosec@% + \pgfmathfloat@install\pgfmathexp@=\pgfmathfloatexp@% + \pgfmathfloat@install\pgfmathln@=\pgfmathfloatln@% + \pgfmathfloat@install\pgfmathsqrt@=\pgfmathfloatsqrt@% + \pgfmathfloat@install\pgfmath@pi=\pgfmathfloatpi@% + \pgfmathfloat@install\pgfmathpi=\pgfmathfloatpi@% + \pgfmathfloat@install\pgfmathe@=\pgfmathfloate@% + \pgfmathfloat@install\pgfmathe=\pgfmathfloate@% + \pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@% + \pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@% + \pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@ + \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@ + \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@ + \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@ + \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd + \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@ + \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@ + \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@ + \pgfmathfloat@install\pgfmathhex@=\pgfmathfloathex@ + \pgfmathfloat@install\pgfmathHex@=\pgfmathfloatHex@ + \pgfmathfloat@install\pgfmathoct@=\pgfmathfloatoct@ + \pgfmathfloat@install\pgfmathbin@=\pgfmathfloatbin@ + \pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@ + \pgfmathfloat@install\pgfmathor@=\pgfmathfloator@ + \pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@ + \pgfmathfloat@install@unimplemented{ceil}% + \pgfmathfloat@install@unimplemented{frac}% + \pgfmathfloat@install@unimplemented{log2}% + \pgfmathfloat@install@unimplemented{log10}% + \pgfmathfloat@install@unimplemented{veclen}% + \pgfmathfloat@install@unimplemented{equalto}% + \pgfmathfloat@install@unimplemented{random}% + \pgfmathfloat@install@unimplemented{setseed}% + \pgfmathfloat@install@unimplemented{Mod}% + \pgfmathfloat@install@unimplemented{real}% + \pgfmathfloat@install@unimplemented{notequal}% + \pgfmathfloat@install@unimplemented{sinh}% + \pgfmathfloat@install@unimplemented{cosh}% + \pgfmathfloat@install@unimplemented{tanh}% +% \pgfmathfloat@install@unimplemented{atan2}% +% \pgfmathfloat@install@unimplemented{height}% + % + % + \pgfmathfloat@install\pgfmathscientific=\pgfmathfloatscientific% +} + +\def\pgfmathfloat@parser@install{% + \pgfmathfloat@plots@checkuninstallcmd + \pgfmathfloat@plots@install% + \pgfmathfloat@parser@install@functions + % + % + % + % The following methods actually enable the parser to work with + % the internal floating point number representation. + % + % The idea is as follows: + % 1. Every operand must be given in internal float representation. + % 2. The internal float repr can be distinguished by a normal + % number. This is accomplished by introducing a new "exponent" + % token. + % 3. The stack-push-operation checks whether the argument is a + % float. If not, it is parsed properly before pushing it. + \pgfmath@tokens@make{exponent}{\pgfmathfloat@POSTFLAGSCHAR}% + \pgfmathfloat@uninstall@appendcmd{% + \expandafter\let\csname pgfmath@token@exponent@\pgfmathfloat@POSTFLAGSCHAR\endcsname=\relax + }% + \let\pgfmath@basic@parse@exponent=\pgfmath@parse@exponent% + \let\pgfmath@basic@stack@push@operand=\pgfmath@stack@push@operand + \pgfmathfloat@install\pgfmath@stack@push@operand=\pgfmathfloat@stack@push@operand + \pgfmathfloat@install\pgfmath@parse@exponent=\pgfmathfloat@parse@float@or@exponent + % + \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse% +}% + +\def\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG#1{% + \edef\pgfmathfloat@loc@TMPa{% + \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1\endcsname{% + \noexpand\let\noexpand\pgfmath@parsepostgroup\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname% + \noexpand\expandafter\noexpand\pgfmath@parse@}% + \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{% + \noexpand\expandafter\expandafter\noexpand\csname pgfmath#1@\endcsname\noexpand\expandafter{\noexpand\pgfmathresult}% + \noexpand\pgfmath@postfunction% + }% + }% + \pgfmathfloat@loc@TMPa +}% +\def\pgfmathfloat@parser@install@pgf@two@null@null{% + \pgfmathfloat@plots@checkuninstallcmd + \pgfmathfloat@plots@install% + \pgfmathfloat@parser@install@functions + \let\pgfmathrand@=\pgfmath@basic@rand@ + \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo% + \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{hex}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{bin}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{oct}% + % + % The following methods actually enable the parser to work with + % the internal floating point number representation. + % + % The idea is as follows: + % 1. Every operand must be given in internal float representation. + % 2. The internal float repr can be distinguished by a normal + % number. This is accomplished by introducing a new "exponent" + % token. + % 3. The stack-push-operation checks whether the argument is a + % float. If not, it is parsed properly before pushing it. + \let\pgfmath@basic@parsedecimalpoint=\pgfmath@parsedecimalpoint% + \let\pgfmath@basic@stack@push@operand=\pgfmath@stackpushoperand + \pgfmathfloat@install\pgfmath@stackpushoperand=\pgfmathfloat@stack@push@operand + \pgfmathfloat@install\pgfmath@parsedecimalpoint=\pgfmathfloat@parsedecimalpoint@pgf@two@null@null + \pgfmathfloat@install\pgfmath@endparse=\pgfmathfloat@endparse@pgf@two@null@null + \pgfmathfloat@install\pgfmath@endparsegroup=\pgfmathfloat@endparsegroup@pgf@two@null@null + \pgfmathfloat@install\pgfmath@postfunction=\pgfmathfloat@postfunction@pgf@two@null@null + \pgfmathfloat@install\pgfmath@@parseoperandgroup=\pgfmathfloat@@parseoperandgroup + % + \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null% +}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Hacks to the basic level pgf math engine: +% +% WARNING: These methods rely heavily on the internal float representation! +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% for pgf2.00 : +\def\pgfmathfloat@parsedecimalpoint@pgf@two@null@null#1{% + \expandafter\ifx\pgfmathfloat@POSTFLAGSCHAR#1% check whether it is a float + \let\pgfmath@next=\pgfmathfloat@return@float@pgf@two@null@null% + \else + \def\pgfmath@next{\pgfmath@basic@parsedecimalpoint#1}% + \fi + \pgfmath@next +} +% for pgf2.00: +\def\pgfmathfloat@return@float@pgf@two@null@null#1]{% + \edef\pgfmathresult{\the\c@pgfmath@parsecounta\pgfmathfloat@POSTFLAGSCHAR#1]}% + \let\pgfmath@resulttemp=\pgfmathresult + \pgfmath@parseoperator% +}% +% for pgf2.00: +\def\pgfmathfloat@endparse@pgf@two@null@null#1\pgfmath@empty{% + \pgfmath@processalloperations% + \pgfmath@stackpop{\pgfmathresult}% + % delete the final unit scalings + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \ignorespaces% +} +% for pgf2.00: +\def\pgfmathfloat@endparsegroup@pgf@two@null@null{% + \pgfmath@processalloperations% + \pgfmath@stackpop{\pgfmathresult}% + % eliminated register usage here... + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \pgfmath@parsepostgroup% +} +% for pgf2.00: +\def\pgfmathfloat@postfunction@pgf@two@null@null{% + \let\pgfmath@parsepostgroup\pgfmath@parseoperator% + \ifnum\pgfmath@sign1<0 + \pgfmathfloatneg@{\pgfmathresult}% + \let\pgfmath@sign\pgfutil@empty + \fi + \pgfmath@parseoperator} +% for pgf2.00: +\def\pgfmathfloat@@parseoperandgroup{% + \let\pgfmath@postparsegroup\pgfmath@parseoperator% + \ifnum\pgfmath@sign1<0 + \pgfmathfloatneg@{\pgfmathresult}% + \let\pgfmath@sign\pgfutil@empty + \fi + \pgfmath@parseoperator% +} + + + + + + +% PRECONDITION: +% either +% <number>e +% ^ +% -> read the exponent. +% or +% <sign>\pgfmathfloat@POSTFLAGSCHAR +% ^ +% -> we have a parsed floating point number -> read it. +\def\pgfmathfloat@parse@float@or@exponent{% + \if\pgfmath@token \pgfmathfloat@POSTFLAGSCHAR% + % Ok, we actually HAVE a pre-parsed floating point number! + % Return it. + \expandafter\pgfmathfloat@return@float\expandafter\pgfmath@token@next + \else + % We have a standard number in scientific format. Parse it. + \expandafter\pgfmath@basic@parse@exponent + \fi +}% +\def\pgfmathfloat@return@float#1]{% + \edef\pgfmathresult{\pgfmath@number \pgfmathfloat@POSTFLAGSCHAR#1]}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \pgfmath@parse@@operator% +}% + +% This extends the functionality of the basic level operand stack: it +% assures every element on the stack is a float. +\def\pgfmathfloat@stack@push@operand#1{% + \pgfutil@ifnextchar\bgroup{% + \let\pgfmathfloat@stack@push@operand@list@=\pgfutil@empty + \pgfmathfloat@stack@push@operand@list + }{% + \pgfmathfloat@stack@push@operand@single + }% + #1\relax +}% +\def\pgfmathfloat@stack@push@operand@single#1\relax{% + \expandafter\pgfutil@in@\pgfmathfloat@POSTFLAGSCHAR{#1}% + \ifpgfutil@in@ + \pgfmath@basic@stack@push@operand{#1}% + \else + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \fi +}% +\def\pgfmathfloat@stack@push@operand@GOBBLE#1\relax{}% +\def\pgfmathfloat@stack@push@operand@list#1{% + \expandafter\pgfutil@in@ \pgfmathfloat@POSTFLAGSCHAR{#1}% + \ifpgfutil@in@ + \expandafter\def\expandafter\pgfmathfloat@stack@push@operand@list@\expandafter{% + \pgfmathfloat@stack@push@operand@list@{#1}% + }% + \else + \pgfmathfloatparsenumber{#1}% + \begingroup + \toks0=\expandafter{\pgfmathfloat@stack@push@operand@list@}% + \toks1=\expandafter{\pgfmathresult}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 {\the\toks1}}% + \endgroup + \let\pgfmathfloat@stack@push@operand@list@=\pgfmathfloat@glob@TMP + \fi + \pgfutil@ifnextchar\relax{% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathfloat@stack@push@operand@list@}% + \pgfmathfloat@stack@push@operand@GOBBLE + }{% + \pgfmathfloat@stack@push@operand@list + }% +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% --- END --- Hacks to the basic level pgf math engine +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Here starts the implementation of the floating point +% routines. +% +% They can be used even if the FPU parser is not active. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Remember the basic math commands. They will be invoked as subroutines in floating point routines. +\let\pgfmath@basic@add@=\pgfmathadd@ +\let\pgfmath@basic@subtract@=\pgfmathsubtract@ +\let\pgfmath@basic@multiply@=\pgfmathmultiply@ +\let\pgfmath@basic@divide@=\pgfmathdivide@ +\let\pgfmath@basic@abs@=\pgfmathabs@ +\let\pgfmath@basic@round@=\pgfmathround@ +\let\pgfmath@basic@rand@=\pgfmathrand@ +\let\pgfmath@basic@rnd@=\pgfmathrnd@ +\let\pgfmath@basic@setseed@=\pgfmathsetseed@ +\let\pgfmath@basic@random@=\pgfmathrandom@ +\let\pgfmath@basic@floor@=\pgfmathfloor@ +\let\pgfmath@basic@ceil@=\pgfmathceil@ +\let\pgfmath@basic@mod@=\pgfmathmod@ +\let\pgfmath@basic@max@=\pgfmathmax@ +\let\pgfmath@basic@min@=\pgfmathmin@ +\let\pgfmath@basic@sin@=\pgfmathsin@ +\let\pgfmath@basic@cos@=\pgfmathcos@ +\let\pgfmath@basic@tan@=\pgfmathtan@ +\let\pgfmath@basic@deg@=\pgfmathdeg@ +\let\pgfmath@basic@rad@=\pgfmathrad@ +\let\pgfmath@basic@atan@=\pgfmathatan@ +\let\pgfmath@basic@asin@=\pgfmathasin@ +\let\pgfmath@basic@acos@=\pgfmathacos@ +\let\pgfmath@basic@cot@=\pgfmathcot@ +\let\pgfmath@basic@sec@=\pgfmathsec@ +\let\pgfmath@basic@cosec@=\pgfmathcosec@ +\let\pgfmath@basic@pow@=\pgfmathpow@ +\let\pgfmath@basic@exp@=\pgfmathexp@ +\let\pgfmath@basic@ln@=\pgfmathln@ +\let\pgfmath@basic@sqrt@=\pgfmathsqrt@ +\let\pgfmath@basic@@pi=\pgfmath@pi +\let\pgfmath@basic@veclen@=\pgfmathveclen@ +\let\pgfmath@basic@e@=\pgfmathe@ +\let\pgfmath@basic@lessthan@=\pgfmathlessthan@ +\let\pgfmath@basic@greaterthan@=\pgfmathgreaterthan@ +\let\pgfmath@basic@equalto@=\pgfmathequalto@ +\let\pgfmath@basic@true@=\pgfmathtrue@ +\let\pgfmath@basic@false@=\pgfmathfalse@ + +\def\pgfmathfloatscientific#1#2{% + \edef\pgfmathresult{#1e#2}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfmathresult}% +} +% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0. +% +% It also sets the boolean \ifpgfmathfloatcomparison (globally. +\def\pgfmathfloatlessthan@#1#2{% +%\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{% + \global\pgfmathfloatcomparisonfalse + \begingroup + \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E + \ifcase\pgfmathfloat@a@S + % x = 0 -> (x<y <=> y >0) + \ifnum1=\pgfmathfloat@b@S + \global\pgfmathfloatcomparisontrue + \fi + \or + % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) + \ifnum1=\pgfmathfloat@b@S + % y>0: + \pgfmathfloatlessthan@positive + \fi + \or + % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) + \ifnum2=\pgfmathfloat@b@S + % 'y<0': + \pgfmathfloatgreaterthan@positive + \else + \global\pgfmathfloatcomparisontrue + \fi + \else + \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}{}% + \fi + \endgroup + \ifpgfmathfloatcomparison + \def\pgfmathresult{1.0}% + \else + \def\pgfmathresult{0.0}% + \fi +} +\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ + +% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] +\def\pgfmathfloatlessthan@positive{% + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +} + +% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME] +\def\pgfmathfloatgreaterthan@positive{% + \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +} + + +\def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}} +\let\pgfmathfloatgreaterthan=\pgfmathfloatgreaterthan@ + +\def\pgfmathfloatmax@#1{% + \begingroup + \pgfmathfloatcreate{2}{1.0}{2147483644}% + \let\pgfmathmaxsofar=\pgfmathresult + \pgfmathfloatmax@@#1{}% +}% +\def\pgfmathfloatmax@@#1{% + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \expandafter\pgfmathfloatmax@@@% + \else% + \pgfmathfloatlessthan{\pgfmathmaxsofar}{#1}% + \ifpgfmathfloatcomparison + \edef\pgfmathmaxsofar{#1}% + \fi + \expandafter\pgfmathfloatmax@@% + \fi% +}% +\def\pgfmathfloatmax@@@{% + \let\pgfmathresult=\pgfmathmaxsofar + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup +}% +\def\pgfmathfloatmin@#1{% + \begingroup + \pgfmathfloatcreate{1}{1.0}{2147483644}% + \let\pgfmathminsofar=\pgfmathresult + \pgfmathfloatmin@@#1{}% +}% +\def\pgfmathfloatmin@@#1{% + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \expandafter\pgfmathfloatmin@@@% + \else% + \pgfmathfloatlessthan{#1}{\pgfmathminsofar}% + \ifpgfmathfloatcomparison + \edef\pgfmathminsofar{#1}% + \fi + \expandafter\pgfmathfloatmin@@% + \fi% +}% +\def\pgfmathfloatmin@@@{% + \let\pgfmathresult=\pgfmathminsofar + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup +}% + +\def\pgfmathfloatmaxtwo#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#2}% + \else + \edef\pgfmathresult{#1}% + \fi +} +\let\pgfmathfloatmax=\pgfmathfloatmaxtwo + +\def\pgfmathfloatmintwo#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +} +\let\pgfmathfloatmin=\pgfmathfloatmintwo + +% Renormalizes #1 to extended precision mantisse, meaning +% 100 <= m < 1000 +% instead of 1 <= m < 10. +% +% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses. +% +% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision). +% +% The operation is supposed to be very fast. +% +% @see \pgfmathfloatsetextprecision +% +% There is a routine for internal usage, +% \pgfmathfloattoextentedprecision@a. It also provides exponent and +% sign of #1 in output arguments and may be used to increase speed. +\def\pgfmathfloattoextentedprecision#1{% + \begingroup + \pgfmathfloattoextentedprecision@a{#1}% + \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1}% +}% +\def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1#2.#3}% +}% +\def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1#2#3.#4}% +}% +\def\pgfmathfloattoextentedprecision@@three#1.#2#3#4#5\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1#2#3#4.#5}% +}% + +% Sets extended precision to 10^#1. +% +% The different choices are +% +% - 0: normalization 0 <= m < 1 (disable extended precision) +% - 1: normalization 10 <= m < 100 +% - 2: normalization 100 <= m < 1000 (default) +% - 3: normalization 1000 <= m < 10000 +% +% #1 is the exponent, #1 = 0,1,2 or 3. +% +% This setting applies to \pgfmathfloattoextentedprecision and friends. +\def\pgfmathfloatsetextprecision#1{% + \ifcase#1\relax + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero + \def\pgfmathfloatextprec@shift{0}% + \or + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one + \def\pgfmathfloatextprec@shift{1}% + \or + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two + \def\pgfmathfloatextprec@shift{2}% + \else + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@three + \def\pgfmathfloatextprec@shift{3}% + \fi +}% +\pgfmathfloatsetextprecision{2}% + +% Does the "hard" work for \pgfmathfloattoextentedprecision. It +% provides additional outputs. +% +% INPUT: +% #1 normalized floating point number. Maybe a macro (it will be expanded ONCE) +% +% OUTPUT: +% - \pgfmathresult : the mantisse in extended precision +% - \pgfmathfloat@a@S : the sign of #1 +% - \pgfmathfloat@a@E : the exponent of #1, adjusted for extended precision +% - \pgfmathfloat@a@Mtok : undefined (its contents will be destroyed. +% +\def\pgfmathfloattoextentedprecision@a#1{% + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S<3 + \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift + \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 000\pgfmathfloat@EOI + \else + \edef\pgfmathresult{#1}% + \fi +}% + + +% Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers. +\def\pgfmathfloattoextentedprecision@b#1{% + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \ifnum\pgfmathfloat@b@S<3 + \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax + \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI + \else + \edef\pgfmathresult{#1}% + \fi +}% + +% Addition of two floating point numbers using 8 significant digits. +\def\pgfmathfloatadd@#1#2{% + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloattoextentedprecision@b{#2}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#2}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + % Shift lesser mantisse to fit the larger one: + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}% + \else + \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}% + \fi + % add them! + \pgfmath@basic@add@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +% #1= floating point number +% #2= TeX code to execute if #1 == 0 +% #3= TeX code to execute if #1 != 0 +\def\pgfmathfloatifzero#1#2#3{% + \expandafter\pgfmathfloat@decompose@F#1\relax\pgfmathfloat@a@S + \ifnum\pgfmathfloat@a@S=0 #2\else#3\fi +}% + +% #1=mantisse which needs to be shifted (with smaller exponent) +% #2=smaller exponent +% #3=larger exponent +% +% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S. +\def\pgfmathfloatadd@shift#1#2#3{% + \pgf@xa=#1 pt% + \pgfmathfloat@a@S=#3\relax + \advance\pgfmathfloat@a@S by-#2\relax + \ifcase\pgfmathfloat@a@S + \or + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10000\relax + \else + \pgf@xa=0pt% + \fi + #2=#3\relax + \edef#1{\pgf@sys@tonumber\pgf@xa}% +} + +\let\pgfmathfloatadd=\pgfmathfloatadd@ + + +% Subtracts two floating point numbers. +\def\pgfmathfloatsubtract@#1#2{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \or + \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \or + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \else + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@ + +% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply. +% +% Use this method if #2 is small number. +\def\pgfmathfloatmultiplyfixed@#1#2{% + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@multiply@{\pgfmathfloat@arga}{#2}% + % renormalize product. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@ + + +\def\pgfmathfloatmultiply@#1#2{% + \begingroup + \pgfmathfloatsetextprecision{1}% + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \edef\pgfmathfloat@argb{#2}% + \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% + + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{1}% + \or + \def\pgfmathresult@S{2}% + \else + \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% - + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{2}% + \or + \def\pgfmathresult@S{1}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% +infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% -infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@multiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatmultiply=\pgfmathfloatmultiply@ + +% Defines \pgfmathresult to be #1 / #2 for two floating point numbers. +% +% It employs the basic math engine internally to divide mantissas. +\def\pgfmathfloatdivide@#1#2{% + \begingroup + \pgfmathfloatsetextprecision{1}% is not too important, I think. After all, 0.1 <= #1/#2 < 10 or so due to normalization (no matter, which) + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \edef\pgfmathfloat@argb{#2}% + \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% + + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{1}% + \or + \def\pgfmathresult@S{2}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \else + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% - + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{2}% + \or + \def\pgfmathresult@S{1}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \else + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% +infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ? + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ? + \pgfmathfloatcomparisonfalse + \fi + \or% -infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@divide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E + % renormalize. This is the only part were an expensive float routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + % And re-insert the proper sign: + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatdivide=\pgfmathfloatdivide@ + +\def\pgfmathfloatreciprocal@#1{% + \begingroup + % FIXME optimize + \edef\pgfmathfloat@loc@TMPa{#1}% + \pgfmathfloatcreate{1}{1.0}{0}% + \pgfmathfloatdivide@{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +% Computes sqrt(#1) in floating point arithmetics. +% +% It employs sqrt( m * 10^e ) = sqrt(m) * sqrt(10^e). +\def\pgfmathfloatsqrt@#1{% + \begingroup + \pgfmathfloatsetextprecision{3}% + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \or% + + \pgfmath@basic@sqrt@{\pgfmathfloat@arga}% + \ifodd\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@E>0 + \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{3.16227766}% * sqrt(10) + \else + \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{0.316227766}% * sqrt(0.1) + \fi + \fi + \divide\pgfmathfloat@a@E by2 % sqrt(10^e) = 10^{e/2} (see above for odd e) + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathfloat@arga{\pgfmathresult e\the\pgfmathfloat@a@E}% + \pgfmathfloatqparsenumber{\pgfmathfloat@arga}% + \or% - + \pgfmathfloatcreate{3}{0.0}{0}% + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \or% +infty + \pgfmathfloatcreate{4}{0.0}{0}% + \or% -infty + \pgfmathfloatcreate{3}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatsqrt=\pgfmathfloatsqrt@ + +% Returns the integer part of the floating point number #1. +% +% The result is returned as floating point as well. +% +% This operation is not limited to TeX's range of count registers (it +% works symbolly) +\def\pgfmathfloatint@#1{% + \begingroup + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % 0: nothing to do. + \or% + + \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or% - + \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \else + % nothing to do + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\def\pgfmathfloatint@@#1.{% + \ifnum\pgfmathfloat@a@E<0 + \pgfmathfloat@a@S=0 + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0 + \expandafter\pgfmathfloatint@@loop@gobble + \else + \pgfmathfloat@a@Mtok={#1.}% + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \expandafter\pgfmathfloatint@@loop + \fi +}% +\def\pgfmathfloatint@@loop#1{% + \def\pgfmathfloatint@@loop@{#1}% + \ifx\pgfmathfloatint@@loop@\pgfmathfloat@EOI + \let\pgfmathfloatint@@loop@next=\relax + \else + \ifnum\pgfmathfloat@b@E=0 + \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop@gobble + \else + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \advance\pgfmathfloat@b@E by-1 + \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop + \fi + \fi + \pgfmathfloatint@@loop@next +}% +\def\pgfmathfloatint@@loop@gobble#1\pgfmathfloat@EOI{}% +\let\pgfmathfloatint=\pgfmathfloatint@ +\let\pgfmathfloatfloor=\pgfmathfloatint +\let\pgfmathfloatfloor@=\pgfmathfloatint@ + +\def\pgfmathfloat@notimplemented#1{% + \pgfmath@error{Sorry, the operation '#1' has not yet been implemented in the floating point unit :-(}{}% + \pgfmathfloatcreate{0}{0.0}{0}% +}% + +% Divides or multiplies the input number by 10^#4 using an arithmetic +% left/right shift. +% +% Input: +% #1 a normalised floating point number. +% #2 a positive or negative integer number denoting the shift. +% +% Example: +% \pgfmathfloatshift{11e3}{4}% +% -> pgfmathresult = 11e7 +\def\pgfmathfloatshift@#1#2{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \advance\pgfmathfloat@a@E by#2\relax + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloatshift=\pgfmathfloatshift@ + +% Defines \pgfmathresult to be |#1|, the absolute value of the +% normalized floating point number #1. +\def\pgfmathfloatabs@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % 0: do nothing. + \or + % +: ok, is positive. + \or + % -: multiply with -1: + \pgfmathfloat@a@S=1 + \or + % nan: do nothing. + \or + % +infty: ok. + \or + % -infty: multiply with -1: + \pgfmathfloat@a@S=4 + \fi + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatabs=\pgfmathfloatabs@ + +% Computes the absolute error |#1 - #2| into \pgfmathresult. +\def\pgfmathfloatabserror@#1#2{% + \pgfmathfloatsubtract@{#1}{#2}% + \pgfmathfloatabs@{\pgfmathresult}% +}% +\let\pgfmathfloatabserror=\pgfmathfloatabserror@ + +% Computes the relative error |#1 - #2|/|#2| into \pgfmathresult, +% assuming #2 != 0. +\def\pgfmathfloatrelerror@#1#2{% + \pgfmathfloatsubtract@{#1}{#2}% + \pgfmathfloatdivide@{\pgfmathresult}{#2}% + \pgfmathfloatabs@{\pgfmathresult}% +}% +\let\pgfmathfloatrelerror=\pgfmathfloatrelerror@ + +% Computes \pgfmathresult = #1 mod #2 using truncated division. +% +\def\pgfmathfloatmod@#1#2{% + \begingroup + \pgfmathfloatdivide@{#1}{#2}% + \pgfmathfloatint@{\pgfmathresult}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloatmod=\pgfmathfloatmod@ + +% A modification of \pgfmathfloatmod@ where #3 = 1/#2 is already +% known. This may be faster. +\def\pgfmathfloatmodknowsinverse@#1#2#3{% + \begingroup + \pgfmathfloatmultiply@{#1}{#3}% + \pgfmathfloatint@{\pgfmathresult}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloatmodknowsinverse=\pgfmathfloatmodknowsinverse@ + +\def\pgfmathfloatpi@{% + \pgfmathfloatcreate{1}{3.14159265358979}{0}% +}% +\let\pgfmathfloatpi=\pgfmathfloatpi@ + +\def\pgfmathfloate@{% + \pgfmathfloatcreate{1}{2.71828182845905}{0}% +} +\let\pgfmathfloate=\pgfmathfloate@ + +% Converts #1 from radians to degrees. +\def\pgfmathfloatdeg@#1{% + \expandafter\ifx\csname pgfmfltdeg@factor\endcsname\relax + % Lazy evaluation: + \pgfmathfloatcreate{1}{5.72957795130823}{1}% + \global\let\pgfmfltdeg@factor=\pgfmathresult + \fi + \pgfmathfloatmultiply@{#1}\pgfmfltdeg@factor% +} +\let\pgfmathfloatdeg=\pgfmathfloatdeg@ + +% Converts #1 from degree to radians. +\def\pgfmathfloatrad@#1{% + \expandafter\ifx\csname pgfmfltrad@factor\endcsname\relax + % Lazy evaluation: + \pgfmathfloatcreate{1}{1.74532925199433}{-2}% + \global\let\pgfmfltrad@factor=\pgfmathresult + \fi + \pgfmathfloatmultiply@{#1}\pgfmfltrad@factor% +} +\let\pgfmathfloatrad=\pgfmathfloatrad@ + +% Computes #1(#2) where #1 is a trigonometric function, i.e. +% #1(#2) = #1( #2 + r*360 ) +% +% #1 is a one-argument macro which assigns \pgfmathresult. +\def\pgfmathfloatTRIG@#1#2{% + \expandafter\ifx\csname pgfmathfloatTRIG@NUM\endcsname\relax% why not directly!??? Did not work!?? + % Lazy evaluation: + \pgfmathfloatcreate{1}{3.6}{2}% + \global\let\pgfmathfloatTRIG@NUM=\pgfmathresult + \pgfmathfloatcreate{1}{2.77777777777778}{-3}% + \global\let\pgfmathfloatTRIG@NUM@INV=\pgfmathresult + \fi + \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@NUM}{\pgfmathfloatTRIG@NUM@INV}% + \pgfmathfloattofixed@{\pgfmathresult}% + \expandafter#1\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% +}% + +\def\pgfmathfloatsin@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}} +\let\pgfmathfloatsin=\pgfmathfloatsin@ +\def\pgfmathfloatcos@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}} +\let\pgfmathfloatcos=\pgfmathfloatcos@ +\def\pgfmathfloattan@#1{% + % compute sin(#1) / cos(#1) + \begingroup + \pgfmathfloatcos@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatsin@{#1}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloattan=\pgfmathfloattan@ + +\def\pgfmathfloatcot@#1{% + % compute cos(#1) / sin(#1) + \begingroup + \pgfmathfloatsin@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatcos@{#1}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatcot=\pgfmathfloatcot@ + +\def\pgfmathfloatatan@#1{% + \begingroup + \expandafter\ifx\csname pgfmathfloatatan@TMP\endcsname\relax% why not directly!??? Did not work!?? + \pgfmathfloatcreate{1}{1.6}{4}% + \global\let\pgfmathfloatatan@TMP=\pgfmathresult + \pgfmathfloatcreate{2}{1.6}{4}% + \global\let\pgfmathfloatatan@TMPB=\pgfmathresult + \fi + \pgfmathfloatgreaterthan@{#1}{\pgfmathfloatatan@TMP}% + \ifpgfmathfloatcomparison + \pgfmathfloatcreate{1}{9.0}{1}% + \else + \pgfmathfloatlessthan{#1}{\pgfmathfloatatan@TMPB}% + \ifpgfmathfloatcomparison + \pgfmathfloatcreate{2}{9.0}{1}% + \else + \pgfmathfloattofixed@{#1}% + \expandafter\pgfmath@basic@atan@\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatatan=\pgfmathfloatatan@ + +\def\pgfmathfloatsec@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}} +\let\pgfmathfloatsec=\pgfmathfloatsec@ +\def\pgfmathfloatcosec@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}} +\let\pgfmathfloatcosec=\pgfmathfloatcosec@ + +% Expands #2 using \edef and invokes #1 with the resulting string. +% +% DEPRECATED +% Example: +% \pgfmath@y=7.9pt +% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% +% will invoke +% \pgfmathexp@{7.9} +\def\pgfmathlog@invoke@expanded#1#2{% + \edef\pgfmath@resulttemp{#2}% + \expandafter#1\pgfmath@resulttemp +} + +\def\pgfmathfloatln@#1{% + \pgfmathlog@float{#1}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi +} +\let\pgfmathfloatln=\pgfmathfloatln@ + +% Computes log(x) into \pgfmathresult. +% +% This allows numbers such at 10000000 or 5.23e-10 to be represented +% properly, although TeX-registers would produce overflow/underflow +% errors in these cases. +% +% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y +% +% FIXME This routine is only kept for backwards compatibility! +% It does not work as expected because +% 1. it calls \pgfmathfloatparsenumber +% 2. it returns the result as fixed point number +% Use \pgfmathln@ instead! +\def\pgfmathlog@#1{% + \pgfmathfloatparsenumber{#1}% + \pgfmathlog@float{\pgfmathresult}% +} +\let\pgfmathlog=\pgfmathlog@ +\def\pgfmathlog@float#1{% + \begingroup% + % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S=1 + % Now, compute log(#1) = log(M) + E*log(10) + \expandafter\pgfmath@basic@ln@\expandafter{\the\pgfmathfloat@a@Mtok}% + \pgfmathfloat@b@M=\pgfmathresult pt% + \pgfmathfloat@a@M=2.302585pt% = log(10) + \multiply\pgfmathfloat@a@M by\pgfmathfloat@a@E\relax + \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}% + \else + \let\pgfmathresult=\pgfutil@empty% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup% +} + + +% Computes exp(#1) in floating point. +% +% The algorithm employs the identity +% exp(x) = exp(x - log(10^k) + log(10^k) +% = 10^k exp( x - k*log 10 ) +% with k choosen such that exp( x - k*log10) can be computed with the +% basic level math engine. +% +% The precision (relative error) is between 10^{-4} and 10^{-6}. For +% #1 = 700, it is even 10^{-3}. I will need to improve that someday. +\def\pgfmathfloatexp@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % #1 = 0: + \pgfmathfloatcreate{1}{1.0}{0}% + \or% #1 > 0 + \pgfmathfloatexp@@{#1}% + \or% #1 < 0 + \pgfmathfloatexp@@{#1}% + \else + \edef\pgfmathresult{#1}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\def\pgfmathfloatexp@@#1{% + % Employ the identity + % exp(x) = exp(x - log(10^k) + log(10^k)) = 10^k exp( x - k *log(10)) + % + % I'd like to have x - k*log(10) <= 1 + % => compute k := int( (x - 1) * 1/log(10) ) + % that should suffice since \pgfmathexp@ should be + % accurate enough for those numbers. + % + % please note that we can do all this in TeX registers. + % exp(700) is almost the maximum of double precision + % anyway, and exp(16000) is certainly the largest we will + % ever need. + \pgfmathfloattofixed@{#1}% + \pgf@xa=\pgfmathresult pt + \pgf@xa=0.434294481\pgf@xa\relax + \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% + \expandafter\pgfmathfloatexp@@toint\pgfmathfloat@loc@TMPa\relax + \pgf@xa=2.302585092pt + \multiply\pgf@xa by-\pgfmathfloat@k\relax + \advance\pgf@xa by\pgfmathresult pt + \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% +%\message{computing exp(\pgfmathresult) = 10^\pgfmathfloat@k * exp(\pgfmathfloat@loc@TMPa)...}% + \pgfmath@basic@exp@{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatparsenumber{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatshift@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@k}% +} +% determine 'k'. This is a heuristics. The exponential series +% converges best for |x| <= 1. However, the fixed point arithmetics +% for tex results in best results for large |x|. Well, I'll need to +% tune this here. +\def\pgfmathfloatexp@@toint#1.#2\relax{% + \c@pgf@counta=#1\relax + \ifnum\c@pgf@counta<0 +\advance\c@pgf@counta by-1 % FIXME . this is a test for optimizations. + \c@pgf@countb=#2\relax + \ifnum\c@pgf@countb>0 + \advance\c@pgf@counta by-1 + \fi + \fi + \edef\pgfmathfloat@k{\the\c@pgf@counta}% +}% +\let\pgfmathfloatexp=\pgfmathfloatexp@ + +\def\pgfmathfloatround@#1{% + \begingroup + \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov + \pgfmathfloattofixed{#1}% + \pgfmathroundto{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +\def\pgfmathfloatneg@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S\relax + % 0: + \edef\pgfmathresult{#1}% + \or + % +: + \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % -: + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % nan: + \edef\pgfmathresult{#1}% + \or + % +infty: + \pgfmathfloatcreate{5}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % -infty: + \pgfmathfloatcreate{4}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +\def\pgfmathfloatpow@#1#2{% + \begingroup% + \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S\relax + % #1 ^ 0 = 1 + \pgfmathfloatcreate{1}{1.0}{0}% + \or + % #2 > 0 + \pgfmathfloatpow@@{#1}{#2}% + \or + % #2 < 0 + \pgfmathfloatpow@@{#1}{#2}% + \or + % #2 = nan + \edef\pgfmathresult{#2}% + \or + % #2 = inf + \edef\pgfmathresult{#2}% + \or + % #2 = -inf + \pgfmathfloatcreate{0}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +% computes #1^#2 +% PRECONDITIONS +% - #2 is positive. +\def\pgfmathfloatpow@@#1#2{% + \pgfmathfloattofixed@{#2}% + \afterassignment\pgfmath@x% + \expandafter\c@pgfmath@counta\pgfmathresult pt\relax% + \ifdim\pgfmath@x=0pt % + % loop "manually"; we have an integer exponent! + \ifnum\c@pgfmath@counta<0 + \pgfmathfloatreciprocal@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \c@pgfmath@counta=-\c@pgfmath@counta + \else + \edef\pgfmathfloat@loc@TMPa{#1}% + \fi + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathloop + \ifnum\c@pgfmath@counta>0\relax% + \ifodd\c@pgfmath@counta% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPb}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \fi + \ifnum\c@pgfmath@counta>1\relax% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \fi% + \divide\c@pgfmath@counta by2\relax% + \repeatpgfmathloop% + \else + % employ #1^#2 = exp( #2 * ln(#1) ) + \pgfmathfloatln@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \edef\pgfmathfloat@loc@TMPb{#2}% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}% + \pgfmathfloatexp@{\pgfmathresult}% + \fi +} + +\def\pgfmathfloat@definemethodfrombasic@NOARG#1{% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP{% + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% +}% +\def\pgfmathfloat@definemethodfrombasic@ONEARG#1{% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP##1{% + \noexpand\pgfmathfloattofixed{##1}% + \noexpand\expandafter + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% + {\noexpand\pgfmathresult}% + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% +}% +\def\pgfmathfloat@definemethodfrombasic@TWOARGS#1{% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP##1##2{% + \noexpand\pgfmathfloattofixed{##2}% + \noexpand\let\noexpand\pgfmathfloat@loc@TMPa=\noexpand\pgfmathresult + \noexpand\pgfmathfloattofixed{##1}% + \noexpand\expandafter + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% + {\noexpand\pgfmathresult}{\noexpand\pgfmathfloat@loc@TMPa}% + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% +}% +\pgfmathfloat@definemethodfrombasic@NOARG{rand} +\pgfmathfloat@definemethodfrombasic@NOARG{rnd} +\pgfmathfloat@definemethodfrombasic@NOARG{false} +\pgfmathfloat@definemethodfrombasic@NOARG{true} +% arcsin, arccos +\pgfmathfloat@definemethodfrombasic@ONEARG{asin} +\pgfmathfloat@definemethodfrombasic@ONEARG{acos} +\pgfmathfloat@definemethodfrombasic@ONEARG{not} +\pgfmathfloat@definemethodfrombasic@ONEARG{hex} +\pgfmathfloat@definemethodfrombasic@ONEARG{Hex} +\pgfmathfloat@definemethodfrombasic@ONEARG{oct} +\pgfmathfloat@definemethodfrombasic@ONEARG{bin} +\pgfmathfloat@definemethodfrombasic@TWOARGS{and} +\pgfmathfloat@definemethodfrombasic@TWOARGS{or} + +\pgfutil@ifundefined{pgfmathdeclarefunction}{% + % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00: + \let\pgfmath@basic@rand=\pgfmathrand + \def\pgfmathfloatrand@{% + \pgfmath@basic@rand + \pgfmathfloatparsenumber{\pgfmathresult}% + }% + % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00: + \let\pgfmath@basic@rnd=\pgfmathrnd + \def\pgfmathfloatrnd@{% + \pgfmath@basic@rnd + \pgfmathfloatparsenumber{\pgfmathresult}% + }% +}{} + +% Implements the factorial of '#1'. +% This does only work if '#1 < 2^32'. +\def\pgfmathfloatfactorial@#1{% + \begingroup + \pgfmathfloattofixed{#1}% + % collect integer part into a 32 bit register: + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\pgfmathresult\relax\pgfmath@% + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathloop + \ifnum\c@pgfmath@counta<2 % + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \advance\c@pgfmath@counta by-1\relax% + \repeatpgfmathloop + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex index 0d120a8b722..871bb8b03b0 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex,v 1.3 2008/06/07 17:08:33 ludewich Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.13 2008/05/22 14:32:36 ludewich Exp $ \newif\ifpgf@plot@started diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex index e199d44f811..3d0cad1b196 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -10,7 +10,7 @@ % This file contains methods for basic floating point arithmetics, rounding % to arbitrary precision and number pretty printing. % -% Version 0.9.4 2008/03/18 +% Version 1.0 2008/09/17 \global\newif\ifpgfmathfloatcomparison \newif\ifpgfmathfloatroundhasperiod @@ -90,12 +90,11 @@ \def\pgfmathfloatparsenumber#1{% \begingroup \edef\pgfmathresult{#1}% - \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI + \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% \fi - \edef\pgfmathresult{% - \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% \pgfmath@smuggleone\pgfmathresult \endgroup } @@ -103,18 +102,27 @@ % The same as \pgfmathfloatparsenumber, but does not perform sanity checking. \def\pgfmathfloatqparsenumber#1{% \begingroup - \let\pgfmathfloatparsenumber@sanitize@digit=\relax \edef\pgfmathresult{#1}% - \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI + \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% \fi - \edef\pgfmathresult{% - \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% \pgfmath@smuggleone\pgfmathresult \endgroup } +% Assigns \pgfmathresult to be a float encoded as +% <FLAGS><MANTISSE>e<EXPONENT> +% +% example: +% \pgfmathfloatcreate{1}{2.0}{10} +% \pgfmathfloat@to@FMeE@style\pgfmathresult +% -> +% \pgfmathresult is now '12.0e10' regardless of the internal float +% format. +\def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax}% +\def\pgfmathfloat@to@FMeE@style@#1Y#2e#3]\relax{\def\pgfmathresult{#1#2e#3}}% % decomposes a lowlevel floating point representation into flags, % mantisse and exponent. @@ -122,22 +130,22 @@ % #4: integer register for the flags. % #5: dimen registers for the mantisse. % #6: integer register for the exponent. -\def\pgfmathfloat@decompose#1#2e#3\relax#4#5#6{% +\def\pgfmathfloat@decompose#1Y#2e#3]\relax#4#5#6{% #4=#1\relax #5=#2pt% #6=#3\relax% } % overloaded, #5 needs to be a token register for the mantisse. -\def\pgfmathfloat@decompose@tok#1#2e#3\relax#4#5#6{% +\def\pgfmathfloat@decompose@tok#1Y#2e#3]\relax#4#5#6{% #4=#1\relax #5={#2}% #6=#3\relax% } % overloaded, returns only ONE of the three components into #4: -\def\pgfmathfloat@decompose@F#1#2e#3\relax#4{#4=#1\relax}% -\def\pgfmathfloat@decompose@M#1#2e#3\relax#4{#4=#2pt}% -\def\pgfmathfloat@decompose@Mtok#1#2e#3\relax#4{#4={#2}}% -\def\pgfmathfloat@decompose@E#1#2e#3\relax#4{#4=#3\relax}% +\def\pgfmathfloat@decompose@F#1Y#2e#3]\relax#4{#4=#1\relax}% +\def\pgfmathfloat@decompose@M#1Y#2e#3]\relax#4{#4=#2pt}% +\def\pgfmathfloat@decompose@Mtok#1Y#2e#3]\relax#4{#4={#2}}% +\def\pgfmathfloat@decompose@E#1Y#2e#3]\relax#4{#4=#3\relax}% % Takes a floating point number #1 as input and writes flags to macro % #2, mantisse to macro #3 and exponent to macro #4. @@ -187,525 +195,15 @@ % % All arguments are characters and will be expanded using '\edef'. \def\pgfmathfloatcreate#1#2#3{% - \edef\pgfmathresult{#1#2e#3}% -}% - - -% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0. -% -% It also sets the boolean \ifpgfmathfloatcomparison (globally. -\def\pgfmathfloatlessthan@#1#2{% -%\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{% - \global\pgfmathfloatcomparisonfalse - \begingroup - \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E - \ifcase\pgfmathfloat@a@S - % x = 0 -> (x<y <=> y >0) - \ifnum1=\pgfmathfloat@b@S - \global\pgfmathfloatcomparisontrue - \fi - \or - % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) - \ifnum1=\pgfmathfloat@b@S - % y>0: - \pgfmathfloatlessthan@positive - \fi - \or - % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) - \ifnum2=\pgfmathfloat@b@S - % 'y<0': - \pgfmathfloatgreaterthan@positive - \else - \global\pgfmathfloatcomparisontrue - \fi - \else - \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}% - \fi - \endgroup - \ifpgfmathfloatcomparison - \def\pgfmathresult{1.0}% - \else - \def\pgfmathresult{0.0}% - \fi -} -\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ - -% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] -\def\pgfmathfloatlessthan@positive{% - \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E - \global\pgfmathfloatcomparisontrue - \else - \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E - \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M - \global\pgfmathfloatcomparisontrue - \fi - \fi - \fi -} - -% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME] -\def\pgfmathfloatgreaterthan@positive{% - \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E - \global\pgfmathfloatcomparisontrue - \else - \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E - \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M - \global\pgfmathfloatcomparisontrue - \fi - \fi - \fi -} - - -\def\pgfmathfloatmax@#1#2{% - \pgfmathfloatlessthan{#1}{#2}% - \ifpgfmathfloatcomparison - \edef\pgfmathresult{#2}% - \else - \edef\pgfmathresult{#1}% - \fi -} -\let\pgfmathfloatmax=\pgfmathfloatmax@ - -\def\pgfmathfloatmin@#1#2{% - \pgfmathfloatlessthan{#1}{#2}% - \ifpgfmathfloatcomparison - \edef\pgfmathresult{#1}% - \else - \edef\pgfmathresult{#2}% - \fi -} -\let\pgfmathfloatmin=\pgfmathfloatmin@ - -% Renormalizes #1 to extended precision mantisse, meaning -% 100 <= m < 1000 -% instead of 1 <= m < 10. -% -% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses. -% -% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision). -% -% The operation is supposed to be very fast. -\def\pgfmathfloattoextentedprecision#1{% - \begingroup - \pgfmathfloattoextentedprecision@a{#1}% - \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - -\def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1}% -}% -\def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2.#3}% -}% -\def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2#3.#4}% -}% - -% Sets extended precision to 10^#1. -% -% The default is 10^2, which means mantissas in extended precision are -% normalised to 100 <= m < 1000. -% -% The case 10^1 means they are normalised to 10 <= m < 100 and 10^0 -% deactivates extended precision. -% -% #1 is the exponent, #1 = 0,1 or 2. -% -% This setting applies to \pgfmathfloattoextentedprecision. -\def\pgfmathfloatsetextprecision#1{% - \ifcase#1\relax - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero - \def\pgfmathfloatextprec@shift{0}% - \or - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one - \def\pgfmathfloatextprec@shift{1}% - \else - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two - \def\pgfmathfloatextprec@shift{2}% - \fi + \edef\pgfmathresult{#1Y#2e#3]}% }% -\pgfmathfloatsetextprecision{2}% +% This is the character present in any low-level floating point +% number. It is assumed to be the SECOND character of a float (after +% the flags integer). +\def\pgfmathfloat@POSTFLAGSCHAR{Y} -% Does the same work as \pgfmathfloattoextentedprecision, but this one here fills the -% registers \pgfmathfloat@a@S and \pgfmathfloat@a@E with the flags and (renormalized) exponent. -% It destroys the content of \pgfmathfloat@a@Mtok. -\def\pgfmathfloattoextentedprecision@a#1{% - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifnum\pgfmathfloat@a@S<3 - \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift - \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI - \else - \edef\pgfmathresult{#1}% - \fi -}% -% Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers. -\def\pgfmathfloattoextentedprecision@b#1{% - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E - \ifnum\pgfmathfloat@b@S<3 - \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax - \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI - \else - \edef\pgfmathresult{#1}% - \fi -}% - -% Addition of two floating point numbers using 8 significant digits. -\def\pgfmathfloatadd@#1#2{% - \begingroup - % - % renormalize argument to 100 <= m < 1000 for extended accuracy: - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - \edef\pgfmathresult{#2}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% - \fi - \ifcase\pgfmathfloat@b@S - \edef\pgfmathresult{#1}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% - \fi - \ifpgfmathfloatcomparison - % Shift lesser mantisse to fit the larger one: - \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E - \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}% - \else - \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}% - \fi - % add them! - \pgfmathadd@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - - -% #1=mantisse which needs to be shifted (with smaller exponent) -% #2=smaller exponent -% #3=larger exponent -% -% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S. -\def\pgfmathfloatadd@shift#1#2#3{% - \pgf@xa=#1 pt% - \pgfmathfloat@a@S=#3\relax - \advance\pgfmathfloat@a@S by-#2\relax - \ifcase\pgfmathfloat@a@S - \or - \divide\pgf@xa by10\relax - \or - \divide\pgf@xa by100\relax - \or - \divide\pgf@xa by1000\relax - \or - \divide\pgf@xa by10000\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by10\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by100\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by1000\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by10000\relax - \else - \pgf@xa=0pt% - \fi - #2=#3\relax - \edef#1{\pgf@sys@tonumber\pgf@xa}% -} - -\let\pgfmathfloatadd=\pgfmathfloatadd@ - - -% Subtracts two floating point numbers. -\def\pgfmathfloatsubtract@#1#2{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E - \ifcase\pgfmathfloat@b@S - \edef\pgfmathresult{#1}% - \or - \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% - \let\pgfmathfloatsub@arg=\pgfmathresult - \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% - \or - \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% - \let\pgfmathfloatsub@arg=\pgfmathresult - \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% - \else - \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - -\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@ - -% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply. -% -% Use this method if #2 is small number. -\def\pgfmathfloatmultiplyfixed@#1#2{% - \begingroup - % - % renormalize argument to 100 <= m < 1000 for extended accuracy: - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - \edef\pgfmathresult{#1}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% - \fi - \ifpgfmathfloatcomparison - \pgfmathmultiply@{\pgfmathfloat@arga}{#2}% - % renormalize product. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - -\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@ - - -\def\pgfmathfloatmultiply@#1#2{% - \begingroup - \pgfmathfloatsetextprecision{1}% - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - % 0 - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% + - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{1}% - \or - \def\pgfmathresult@S{2}% - \else - \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% - - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{2}% - \or - \def\pgfmathresult@S{1}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% nan - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% +infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% -infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \fi - \ifpgfmathfloatcomparison - \pgfmathmultiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% -\let\pgfmathfloatmultiply=\pgfmathfloatmultiply@ - -\def\pgfmathfloatdivide@#1#2{% - \begingroup - \pgfmathfloatsetextprecision{1}% - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - % 0 - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% + - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{1}% - \or - \def\pgfmathresult@S{2}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \else - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% - - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{2}% - \or - \def\pgfmathresult@S{1}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \else - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% nan - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% +infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ? - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ? - \pgfmathfloatcomparisonfalse - \fi - \or% -infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \fi - \ifpgfmathfloatcomparison - \pgfmathdivide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% -\let\pgfmathfloatdivide=\pgfmathfloatdivide@ - % Converts a composed floating point representation to fixed point. % % Example: @@ -720,7 +218,8 @@ \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax \or \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax - \edef\pgfmathresult{-\pgfmathresult}% + \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}% + \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}% \or\def\pgfmathresult{nan}% \or\def\pgfmathresult{inf}% \or\def\pgfmathresult{-inf}% @@ -751,127 +250,6 @@ }% \let\pgfmathfloattosci=\pgfmathfloattosci@ -% Divides or multiplies the input number by 10^#4 using an arithmetic -% left/right shift. -% -% Input: -% #1 a normalised floating point number. -% #2 a positive or negative integer number denoting the shift. -% -% Example: -% \pgfmathfloatshift{11e3}{4}% -% -> pgfmathresult = 11e7 -\def\pgfmathfloatshift@#1#2{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \expandafter\advance\expandafter\pgfmathfloat@a@E#2\relax - \edef\pgfmathresult{\the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -\let\pgfmathfloatshift=\pgfmathfloatshift@ - -% Computes a good guess for log(X.XXXX) where the input number should -% be between 0 < x < 10. -% -% If it is not in this range, the returned value will be bad. -% -% For use in the newton implementation of log(x). Please note that we -% first compute a normalized floating point representation of x, and -% the mantisse is always between 0 and 10. -\def\pgfmathlog@smaller@ten@newton@startval#1.#2\to#3{% - \ifcase#1 - \pgfmath@error{pgfmathlog@newton: INTERNAL ERROR: should not happen! - [\#1=0 should have been caught before!]}% - \or#3=0.530628pt - \or#3=0.993pt - \or#3=1.308pt - \or#3=1.5pt - \or#3=1.71pt - \or#3=1.872pt - \or#3=2.01pt - \or#3=2.145pt - \or#3=2.24pt - \fi -} - -% FIXME : eliminate \pgfmathlog@invoke@expanded ? - -% Expands #2 using \edef and invokes #1 with the resulting string. -% -% Example: -% \pgfmath@y=7.9pt -% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% -% will invoke -% \pgfmathexp@{7.9} -\def\pgfmathlog@invoke@expanded#1#2{% - \edef\pgfmath@resulttemp{#2}% - \expandafter#1\pgfmath@resulttemp -} - -% This implementation of log(X) is done with a newton method applied to x-exp(y) = 0. -% The implementation \pgfmathexp is used for exp(y). -% -% see \pgfmathlog@ -\def\pgfmathlog@newton#1{% - \pgfmathfloatparsenumber{#1}% - \pgfmathlog@newton@float{\pgfmathresult}% -} - -% the same as \pgfmathlog@newton, but this one takes a floating point number as input. -\def\pgfmathlog@newton@float#1{% - \begingroup% - % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX - \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E - \let\pgfmathlog@loopcount=\pgfmathfloat@b@S% this counter is not used here... use it as loop counter. - % - \ifnum\pgfmathfloat@a@S=1 - % Now, compute log(#1) = log(M) + E*log(10) - \expandafter\pgfmathlog@smaller@ten@newton@startval\the\pgfmathfloat@a@M.\to\pgfmathfloat@b@M - \pgfmathlog@loopcount=0 - \pgfutil@loop - \ifnum\pgfmathlog@loopcount<3 - \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmathfloat@b@M}}}% - \let\pgfmathlog@tmp=\pgfmathresult - \pgfmathlog@invoke@expanded\pgfmathdivide@{{\pgf@sys@tonumber{\pgfmathfloat@a@M}}{\pgfmathlog@tmp}}% - \expandafter\pgfmath@ya\pgfmathresult pt - \advance\pgfmathfloat@b@M by\pgfmath@ya - \advance\pgfmathfloat@b@M by-1pt - \advance\pgfmathlog@loopcount by1 - \pgfutil@repeat - \pgfmathfloat@a@M=2.302585pt% = log(10) - \multiply\expandafter\pgfmathfloat@a@M\pgfmathfloat@a@E - \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}% - \else - \let\pgfmathresult=\pgfutil@empty% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup% -} - -% Computes log(x) into \pgfmathresult. -% -% REMARK -% This method does NOT use TeX Registers to represent the numbers! The -% computation is COMPLETELY STRING BASED. -% This allows numbers such at 10000000 or 5.23e-10 to be represented -% properly, although TeX-registers would produce overflow/underflow -% errors in these cases. -% -% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y -\let\pgfmathlog@=\pgfmathlog@newton - -\let\pgfmathlog@float=\pgfmathlog@newton@float - -% Public interface method. This is expected to use \pgfmathparse but -% it DOESN'T do that. \pgfmathparse naturally can't handle numbers -% which exceed TeX's numerical capabilities. However, exponentials are -% typically either too large or too small for TeX. -% -% @see \pgfmathnormalisedfloatingpoint for how we parse arguments. -% @see \pgfmathlog@ -\let\pgfmathlog=\pgfmathlog@newton % Rounds a fixed point number #1 to \pgfmathfloat@round@precision digits precision and returns % the result into \pgfmathresult. @@ -891,7 +269,7 @@ % -> \pgfmathresult = '20000' % % Arguments: -% #1 may be either a number or a macro expanding to a number. +% #1 may be either a number or a macro (\pgfmathresult is allowed) expanding to a number. % % SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set. \def\pgfmathroundto#1{% @@ -984,15 +362,20 @@ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% \else - \advance\c@pgf@counta by1% counta:= total number of digits, N. - \c@pgf@countb=\c@pgf@counta - \divide\c@pgf@countb by3% countb := N DIV 3 - \c@pgf@countc=\c@pgf@countb - \multiply\c@pgf@countc by3 - \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3 - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign - }% + \ifnum\c@pgf@counta<\pgfkeysvalueof{/pgf/number format/min exponent for 1000 sep}\relax + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% + \else + \advance\c@pgf@counta by1 % counta:= total number of digits, N. + \c@pgf@countb=\c@pgf@counta + \divide\c@pgf@countb by3 % countb := N DIV 3 + \c@pgf@countc=\c@pgf@countb + \multiply\c@pgf@countc by3 + \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3 + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign + }% + \fi \fi \fi \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT @@ -1069,7 +452,7 @@ % \def\pgfmathfloat@loc@TMPc{#1#2#3}% % \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb % \else - % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}% + % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}{}% % \fi %-------------------------------------------------- \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax @@ -1120,7 +503,9 @@ % Input: % #1 the fixed point number to be displayed (maybe a macro). -% #2#3e#4: the (possibly unformatted) floating point representation which belongs to #1. +% #2#3e#4: the (possibly unformatted) floating point representation +% which belongs to #1. This format is returned (only!) by +% \pgfmathfloat@to@FMeE@style. % It is used to determine sign and exponent. \let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT @@ -1182,15 +567,15 @@ \or\pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax% \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% \or - \pgfmathfloatrounddisplaystyle@shared@impl@{NaN}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{NaN}{}% \or \ifpgfmathprintnumber@showpositive - \pgfmathfloatrounddisplaystyle@shared@impl@{+\infty}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}% \else - \pgfmathfloatrounddisplaystyle@shared@impl@{\infty}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}% \fi \or - \pgfmathfloatrounddisplaystyle@shared@impl@{-\infty}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}% \fi } @@ -1203,6 +588,17 @@ }% \let\pgfmathresult=\pgfmathfloat@glob@TMP }% +% Same as \pgfmathfloatrounddisplaystyle@shared@impl@, but it also +% inserts the '@dec sep mark' at the end. +\def\pgfmathfloatrounddisplaystyle@shared@impl@@#1#2{% + {\toks0={#1}% + \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% + \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK + \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }% + }% + \let\pgfmathresult=\pgfmathfloat@glob@TMP +} \def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{% \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}% @@ -1210,6 +606,9 @@ \def\pgfmathfloatrounddisplaystyle@subscript#1#2e#3\relax{% \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}% } +\def\pgfmathfloatrounddisplaystyle@superscript#1#2e#3\relax{% + \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{^{#3}}% +} \def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{% \ifnum#3<0\relax {\count0=#3\relax @@ -1237,7 +636,7 @@ \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% } -% A macro which takes three arguments, sign, mantisse and exponent and +% A macro which takes the argument '<SIGN><MANTISSE>e<EXPONENT>' and % expands to the final TeX-representation for that floating point % number. % @@ -1245,9 +644,8 @@ % the floating point number has already been rounded properly and % the mantisse has been rounded correcty. % -% #1: SIGN -% #2: MANTISSE -% #3: EXPONENT +% The argument needs to be in the format returned by +% \pgfmathfloat@to@FMeE@style and terminated by '\relax'. \let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std \newif\ifpgfmathfloat@usezerofill@sci \newif\ifpgfmathfloat@usezerofill@fixed @@ -1278,6 +676,7 @@ @sci exponent mark/.initial=, set thousands separator/.initial=, 1000 sep/.style={/pgf/number format/set thousands separator=#1}, + min exponent for 1000 sep/.initial=0, use period/.style= {/pgf/number format/set decimal separator={.},/pgf/number format/set thousands separator={{{,}}}}, use comma/.style= {/pgf/number format/set decimal separator={{{,}}},/pgf/number format/set thousands separator={.}}, showpos/.is if=pgfmathprintnumber@showpositive, @@ -1293,6 +692,7 @@ sci e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@e}, sci E/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@E}, sci subscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@subscript}, + sci superscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@superscript}, % sci may skip mantisse/.is if=pgfmathfloatround@allow@empty@mantisse, % sci may skip mantisse/.default=true, } @@ -1302,6 +702,7 @@ \def\pgfmathprintnumber@STD#1{% % parse the input: \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax } @@ -1329,6 +730,7 @@ \def\pgfmathprintnumber@INT@TRUNC#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax } @@ -1338,7 +740,8 @@ } \def\pgfmathprintnumber@INT@TRUNC@issci#1#2e#3\relax{% \ifnum#1<3\relax - \pgfmathfloattofixed{#1#2e#3}% + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax \else \pgfmathfloatrounddisplaystyle#1#2e#3\relax% @@ -1348,13 +751,15 @@ \def\pgfmathprintnumber@INT@DETECT#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax } \def\pgfmathprintnumber@INT@DETECT@issci#1#2e#3\relax{% \begingroup \ifnum#1<3\relax - \pgfmathfloattofixed{#1#2e#3}% + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% \def\pgfmathfloat@round@precision{6}% \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% \ifpgfmathfloatroundhasperiod @@ -1371,13 +776,15 @@ \def\pgfmathprintnumber@FIXED#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax } \def\pgfmathprintnumber@FIXED@issci#1#2e#3\relax{% \begingroup \ifnum#1<3 - \pgfmathfloattofixed{#1#2e#3}% + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% \ifpgfmathfloat@usezerofill@fixed \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}% \else @@ -1401,15 +808,18 @@ \def\pgfmathprintnumber@SCI#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax } \def\pgfmathprintnumber@SCI@issci#1#2e#3\relax{% + \pgfmathfloatcreate{#1}{#2}{#3}% \ifpgfmathfloat@usezerofill@sci - \pgfmathfloatroundzerofill{#1#2e#3}% + \pgfmathfloatroundzerofill{\pgfmathresult}% \else - \pgfmathfloatround{#1#2e#3}% + \pgfmathfloatround{\pgfmathresult}% \fi + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax } @@ -1426,6 +836,7 @@ \def\pgfmathprintnumber@noopt#1{% \pgfmathprintnumber@{#1}% \ifpgfmathprintnumber@assumemathmode + \pgfmathresult \else \pgfutilensuremath{\pgfmathresult}% \fi @@ -1435,6 +846,7 @@ \pgfqkeys{/pgf/number format}{#1}% \pgfmathprintnumber@{#2}% \ifpgfmathprintnumber@assumemathmode + \pgfmathresult \else \pgfutilensuremath{\pgfmathresult}% \fi @@ -1519,12 +931,12 @@ % current TeX group. % \ifpgfmathfloatroundmayneedrenormalize will be set globally \def\pgfmathroundto@impl#1{% + \edef\pgfmathround@input{#1}% \global\pgfmathfloatroundmayneedrenormalizefalse \pgfmathfloat@tmptoks={}% \let\pgfmathround@next=\pgfutil@empty \let\pgfmathround@cur=\pgfutil@empty \let\pgfmathresult=\pgfutil@empty - \edef\pgfmathround@input{#1}% \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax \c@pgfmathroundto@lastzeros=0 \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far @@ -1628,14 +1040,14 @@ \fi \else %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec - % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}% + % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}{}% %\fi \pgfmathroundto@impl@finish@with@truncation \fi \else %\ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec %\else - % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}% + % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}{}% %\fi \expandafter\ifnum\pgfmathround@next<5\relax \pgfmathroundto@impl@finish@with@truncation @@ -1909,7 +1321,7 @@ \fi \advance\pgfmathfloat@a@E by1 \fi - \edef\pgfmathresult{\the\pgfmathfloat@a@S\pgfmathresult e\the\pgfmathfloat@a@E}% + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}% } \def\pgfmathfloatround@impl@renormalize#1#2.#3\pgfmathfloat@EOI{% @@ -1924,12 +1336,36 @@ % collects everything into \pgfmathresult \def\pgfmathfloattofixed@impl#1.#2\relax{% \ifnum\pgfmathfloat@a@E<0 - \pgfmathfloat@a@Mtok={0.}% - \pgfutil@loop - \ifnum\pgfmathfloat@a@E<-1 - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% - \advance\pgfmathfloat@a@E by1 - \pgfutil@repeat + \ifcase-\pgfmathfloat@a@E + \or%e-1 + \pgfmathfloat@a@Mtok={0.}% + \or%e-2 + \pgfmathfloat@a@Mtok={0.0}% + \or%e-3 + \pgfmathfloat@a@Mtok={0.00}% + \or%e-4 + \pgfmathfloat@a@Mtok={0.000}% + \or%e-5 + \pgfmathfloat@a@Mtok={0.0000}% + \or%e-6 + \pgfmathfloat@a@Mtok={0.00000}% + \or%e-7 + \pgfmathfloat@a@Mtok={0.000000}% + \or%e-8 + \pgfmathfloat@a@Mtok={0.0000000}% + \or%e-9 + \pgfmathfloat@a@Mtok={0.00000000}% + \or%e-10 + \pgfmathfloat@a@Mtok={0.000000000}% + \else%<= -11 + \pgfmathfloat@a@Mtok={0.0000000000}% + \advance\pgfmathfloat@a@E by10 + \pgfutil@loop + \ifnum\pgfmathfloat@a@E<-1 + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% + \advance\pgfmathfloat@a@E by1 + \pgfutil@repeat + \fi \def\pgfmathfloat@loc@TMPb{#2}% \def\pgfmathfloat@loc@TMPc{0}% \ifx\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPc @@ -1938,15 +1374,48 @@ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}% \fi \else - \ifnum\pgfmathfloat@a@E=0% - \edef\pgfmathresult{#1.#2}% - \else - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloattofixed@impl@collectmantisse#2\count\pgfmathfloat@a@E - \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% - \fi + %-------------------------------------------------- + % \ifnum\pgfmathfloat@a@E=0% + % \edef\pgfmathresult{#1.#2}% + % \else + % \pgfmathfloat@a@Mtok={#1}% + % \pgfmathfloattofixed@impl@collectmantisse#2\count\pgfmathfloat@a@E + % \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% + % \fi + %-------------------------------------------------- + \pgfmathfloat@a@Mtok{#1}% + \pgfmathfloattofixed@impl@pos#2000000000\pgfmathfloat@EOI + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% + \fi +} + +% FIXME: this implementation here is very fast, but it introduces trailing zeros. Is that acceptable? +\def\pgfmathfloattofixed@impl@pos#1#2#3#4#5#6#7#8#9\pgfmathfloat@EOI{% + \ifcase\pgfmathfloat@a@E + % e+0 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok .#1#2#3#4#5#6#7#8#9}% + \or%e+1 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1.#2#3#4#5#6#7#8#9}% + \or%e+2 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2.#3#4#5#6#7#8#9}% + \or%e+3 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3.#4#5#6#7#8#9}% + \or%e+4 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4.#5#6#7#8#9}% + \or%e+5 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5.#6#7#8#9}% + \or%e+6 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6.#7#8#9}% + \or%e+7 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7.#8#9}% + \or%e+8 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8.#9}% + \else%>=9 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8}% + \advance\pgfmathfloat@a@E by-8 + \pgfmathfloattofixed@impl@collectmantisse#9\count\pgfmathfloat@a@E \fi -} +}% \def\pgfmathfloattofixed@impl@collectmantisse#1#2\count#3{% \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}% @@ -1977,117 +1446,124 @@ % % ============================================ - % accepted parser tokens: -\def\pgfmathfloatparsenumber@tok@ONE{1} -\def\pgfmathfloatparsenumber@tok@TWO{2} -\def\pgfmathfloatparsenumber@tok@THREE{3} -\def\pgfmathfloatparsenumber@tok@FOUR{4} -\def\pgfmathfloatparsenumber@tok@FIVE{5} -\def\pgfmathfloatparsenumber@tok@SIX{6} -\def\pgfmathfloatparsenumber@tok@SEVEN{7} -\def\pgfmathfloatparsenumber@tok@EIGHT{8} -\def\pgfmathfloatparsenumber@tok@NINE{9} \def\pgfmathfloatparsenumber@tok@ZERO{0} -\def\pgfmathfloatparsenumber@tok@e{e} -\def\pgfmathfloatparsenumber@tok@E{E} \def\pgfmathfloatparsenumber@tok@PLUS{+} \def\pgfmathfloatparsenumber@tok@MINUS{-} -\def\pgfmathfloatparsenumber@tok@n{n} -\def\pgfmathfloatparsenumber@tok@N{N} -\def\pgfmathfloatparsenumber@tok@i{i} -\def\pgfmathfloatparsenumber@tok@I{I} \def\pgfmathfloatparsenumber@tok@PERIOD{.} \newif\ifpgfmathfloatparsenumberpendingperiod +\def\pgfflt@EOI{p@EOI}% + % Starts a finite-start-machine parser to read a number. % +% The machine's state is represented by the macro which is currently +% processed; state transitions are realised using \csname...#1\endcsname +% constructions. +% % It assigns \pgfmathfloat@a@S, \pgfmathfloat@a@Mtok, \pgfmathfloat@a@E. -\def\pgfmathfloatparsenumber@impl#1{% +\def\pgfflt@impl#1{% \pgfmathfloatparsenumberpendingperiodfalse \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS \pgfmathfloat@a@E=0 % start parsing: check for sign: - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PLUS - \pgfmathfloat@a@S=1\relax% - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}% + \expandafter\ifx\csname pgfflt@#1\endcsname\relax + \pgfmathfloat@a@S=1 + \expandafter\pgfflt@init\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@MINUS - \pgfmathfloat@a@S=2\relax% - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}% - \else - \pgfmathfloat@a@S=1\relax% - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init#1}% - \fi + \expandafter\expandafter\csname pgfflt@#1\endcsname + \fi +} +% State transitions: +\expandafter\def\csname pgfflt@+\endcsname{% + \pgfmathfloat@a@S=1 % + \pgfflt@init}% +\expandafter\def\csname pgfflt@-\endcsname{% + \pgfmathfloat@a@S=2 % + \pgfflt@init}% +\expandafter\def\csname pgfflt@\pgfflt@EOI\endcsname{% + \pgfmathfloatparsenumber@handleerror{empty number}{}{}}% + +\pgfkeys{ + /pgf/fpu/handlers/empty number/.style 2 args={% + /pgf/fpu/handlers/invalid number={#1}{#2}% + }, + /pgf/fpu/handlers/invalid number/.code 2 args={% + \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near '#2'.}{}% + }, +} + +% #1 the error handler +% #2 the number which was invalid. +% #3 the part which produced the error +\def\pgfmathfloatparsenumber@handleerror#1#2#3{% + \let\pgfmathresult=\pgfutil@empty + \pgfmathfloatparsenumberpendingperiodfalse + \pgfkeys{/pgf/fpu/handlers/#1={#2}{#3}}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloat@a@S=3 + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0 + \else + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E \fi - \pgfmathfloatparsenumber@NEXT } +\def\pgfflt@error#1\pgfflt@EOI{% + \begingroup + \pgfmathfloat@a@Mtok={#1}% + \xdef\pgfmathfloat@glob@TMP{% + \noexpand\pgfmathfloatparsenumber@handleerror + {invalid number}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}% + \endgroup + \pgfmathfloat@glob@TMP +}% + -\def\pgfmathfloatparsenumber@sanitize@digit{% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ONE - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@TWO - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@THREE - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FOUR - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FIVE - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SIX - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SEVEN - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@EIGHT - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@NINE - \else - \def\pgfmathfloatparsenumber@NEXT{\expandafter\pgfmathfloatparsenumber@impl@error\pgfmathfloatparsenumber@curtok}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi -} % FROM: checksign. % -\def\pgfmathfloatparsenumber@impl@init#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@n - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readnan}% +\def\pgfflt@init#1{% + \expandafter\ifx\csname pgffltA@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@i - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readinf}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@leadingzero}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloatparsenumberpendingperiodtrue - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi - \fi - \fi - \pgfmathfloatparsenumber@NEXT -} - -\def\pgfmathfloatparsenumber@impl@error#1\pgfmathfloat@EOI{% - \begingroup + \expandafter\expandafter\csname pgffltA@#1\endcsname + \fi} +% state transitions: +\expandafter\def\csname pgffltA@0\endcsname{\pgfflt@leadingzero}% FIXME: inline optimization! +\expandafter\def\csname pgffltA@1\endcsname{\pgfflt@nonzerodigit1}% +\expandafter\def\csname pgffltA@2\endcsname{\pgfflt@nonzerodigit2}% +\expandafter\def\csname pgffltA@3\endcsname{\pgfflt@nonzerodigit3}% +\expandafter\def\csname pgffltA@4\endcsname{\pgfflt@nonzerodigit4}% +\expandafter\def\csname pgffltA@5\endcsname{\pgfflt@nonzerodigit5}% +\expandafter\def\csname pgffltA@6\endcsname{\pgfflt@nonzerodigit6}% +\expandafter\def\csname pgffltA@7\endcsname{\pgfflt@nonzerodigit7}% +\expandafter\def\csname pgffltA@8\endcsname{\pgfflt@nonzerodigit8}% +\expandafter\def\csname pgffltA@9\endcsname{\pgfflt@nonzerodigit9}% +\def\pgfflt@nonzerodigit#1{% \pgfmathfloat@a@Mtok={#1}% - \pgfmath@error{Could not read input number, sorry. The unreadable part was near '\the\pgfmathfloat@a@Mtok'.}% - \endgroup -}% + \pgfmathfloatparsenumberpendingperiodtrue + \pgfflt@positiveexp}% +\expandafter\def\csname pgffltA@n\endcsname{\pgfflt@readnan}% FIXME: inlining? +\expandafter\def\csname pgffltA@N\endcsname{\pgfflt@readNaN}% FIXME: inlining? +\expandafter\def\csname pgffltA@i\endcsname{\pgfflt@readinf}% FIXME: inlining? +\expandafter\def\csname pgffltA@I\endcsname{\pgfflt@readINF}% FIXME: inlining? -\def\pgfmathfloatparsenumber@impl@finish#1\pgfmathfloat@EOI{} +\def\pgfflt@finish#1\pgfflt@EOI{} -\def\pgfmathfloatparsenumber@impl@readnan an{% +\def\pgfflt@readnan an{% + \pgfmathfloat@a@S=3\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@finish +} +\def\pgfflt@readNaN aN{% \pgfmathfloat@a@S=3\relax% \pgfmathfloat@a@Mtok={0.0}% \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@finish + \pgfflt@finish } -\def\pgfmathfloatparsenumber@impl@readinf nf{% +\def\pgfflt@readinf nf{% \ifnum\pgfmathfloat@a@S=1 \pgfmathfloat@a@S=4\relax% \pgfmathfloat@a@Mtok={0.0}% @@ -2096,227 +1572,228 @@ \pgfmathfloat@a@Mtok={0.0}% \fi \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@finish + \pgfflt@finish } -\def\pgfmathfloatparsenumber@impl@leadingzero#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloatparsenumber@impl@leadingzero}% +\def\pgfflt@readINF NF{% + \ifnum\pgfmathfloat@a@S=1 + \pgfmathfloat@a@S=4\relax% + \pgfmathfloat@a@Mtok={0.0}% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@E=-1 - \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - }% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloatparsenumberpendingperiodtrue - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi + \pgfmathfloat@a@S=5\relax% + \pgfmathfloat@a@Mtok={0.0}% \fi - \pgfmathfloatparsenumber@NEXT + \pgfmathfloat@a@E=0% + \pgfflt@finish } +\def\pgfflt@leadingzero#1{% + \expandafter\ifx\csname pgffltB@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltB@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltB@0\endcsname{\pgfflt@leadingzero}% +\expandafter\def\csname pgffltB@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfmathfloat@a@Mtok={0}\pgfflt@readlowlevelfloat}% +\expandafter\def\csname pgffltB@.\endcsname{% + \pgfmathfloat@a@E=-1 + \pgfflt@leadingzero@foundperiod}% +\expandafter\def\csname pgffltB@e\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@readexponent}% +\let\pgffltB@E=\pgffltB@e +\expandafter\def\csname pgffltB@\pgfflt@EOI\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0}% -\def\pgfmathfloatparsenumber@impl@leadingzero@foundperiod#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by-1 - \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}% +\def\pgfflt@leadingzero@foundperiod#1{% + \expandafter\ifx\csname pgffltC@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - }% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloatparsenumberpendingperiodtrue - \pgfmathfloatparsenumber@impl@finish@number@after@period}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi - \pgfmathfloatparsenumber@NEXT -} + \expandafter\expandafter\csname pgffltC@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltC@0\endcsname{% + \advance\pgfmathfloat@a@E by-1 + \pgfflt@leadingzero@foundperiod}% +\expandafter\def\csname pgffltC@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@e\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@readexponent}% +\let\pgffltC@E=\pgffltC@e +\expandafter\def\csname pgffltC@\pgfflt@EOI\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0}% -\def\pgfmathfloatparsenumber@impl@positiveexp#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by1 - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}% +\def\pgfflt@positiveexp#1{% + \expandafter\ifx\csname pgffltD@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by1 - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi + \expandafter\expandafter\csname pgffltD@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltD@0\endcsname{% + \advance\pgfmathfloat@a@E by1 + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros@positiveexp}% +\expandafter\def\csname pgffltD@1\endcsname{\pgffltD@nonzerodigit1}% +\expandafter\def\csname pgffltD@2\endcsname{\pgffltD@nonzerodigit2}% +\expandafter\def\csname pgffltD@3\endcsname{\pgffltD@nonzerodigit3}% +\expandafter\def\csname pgffltD@4\endcsname{\pgffltD@nonzerodigit4}% +\expandafter\def\csname pgffltD@5\endcsname{\pgffltD@nonzerodigit5}% +\expandafter\def\csname pgffltD@6\endcsname{\pgffltD@nonzerodigit6}% +\expandafter\def\csname pgffltD@7\endcsname{\pgffltD@nonzerodigit7}% +\expandafter\def\csname pgffltD@8\endcsname{\pgffltD@nonzerodigit8}% +\expandafter\def\csname pgffltD@9\endcsname{\pgffltD@nonzerodigit9}% +\expandafter\def\csname pgffltD@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfflt@readlowlevelfloat}% +\expandafter\def\csname pgffltD@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining? +\expandafter\def\csname pgffltD@e\endcsname{\pgfflt@readexponent}% FIXME : inlining? +\let\pgffltD@E=\pgffltD@e +\expandafter\def\csname pgffltD@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltD@nonzerodigit#1{% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@positiveexp}% -\def\pgfmathfloatparsenumber@impl@readexponent#1\pgfmathfloat@EOI{% +% Read a low-level floating point. +% Since we are in the second state, \pgfmathfloat@a@Mtok contains the +% FLAGS. The post-flags-char has also been read. +\def\pgfflt@readlowlevelfloat#1e#2]\pgfflt@EOI{% + \pgfmathfloatparsenumberpendingperiodfalse + \pgfmathfloat@a@S=\the\pgfmathfloat@a@Mtok\relax + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloat@a@E=#2 +}% + +\def\pgfflt@readexponent#1\pgfflt@EOI{% \advance\pgfmathfloat@a@E by#1\relax } -\def\pgfmathfloatparsenumber@impl@pendingzeros@positiveexp#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \advance\pgfmathfloat@a@E by1 - \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}% +\def\pgfflt@pendingzeros@positiveexp#1{% + \expandafter\ifx\csname pgffltE@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by1 - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi + \expandafter\expandafter\csname pgffltE@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltE@0\endcsname{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \advance\pgfmathfloat@a@E by1 + \pgfflt@pendingzeros@positiveexp}% +\expandafter\def\csname pgffltE@1\endcsname{\pgffltE@nonzerodigit1}% +\expandafter\def\csname pgffltE@2\endcsname{\pgffltE@nonzerodigit2}% +\expandafter\def\csname pgffltE@3\endcsname{\pgffltE@nonzerodigit3}% +\expandafter\def\csname pgffltE@4\endcsname{\pgffltE@nonzerodigit4}% +\expandafter\def\csname pgffltE@5\endcsname{\pgffltE@nonzerodigit5}% +\expandafter\def\csname pgffltE@6\endcsname{\pgffltE@nonzerodigit6}% +\expandafter\def\csname pgffltE@7\endcsname{\pgffltE@nonzerodigit7}% +\expandafter\def\csname pgffltE@8\endcsname{\pgffltE@nonzerodigit8}% +\expandafter\def\csname pgffltE@9\endcsname{\pgffltE@nonzerodigit9}% +\expandafter\def\csname pgffltE@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining? +\def\pgffltE@e{\pgfflt@readexponent}% FIXME : inlining? +\let\pgffltE@E=\pgffltE@e +\expandafter\def\csname pgffltE@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltE@nonzerodigit#1{% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@positiveexp}% -\def\pgfmathfloatparsenumber@impl@finish@number@after@period#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfmathfloatparsenumber@impl@pendingzeros}% +\def\pgfflt@finish@number@after@period#1{% + \expandafter\ifx\csname pgffltF@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@finish@number@after@period}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi + \expandafter\expandafter\csname pgffltF@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltF@0\endcsname{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros}% +\expandafter\def\csname pgffltF@1\endcsname{\pgffltF@nonzerodigit1}% +\expandafter\def\csname pgffltF@2\endcsname{\pgffltF@nonzerodigit2}% +\expandafter\def\csname pgffltF@3\endcsname{\pgffltF@nonzerodigit3}% +\expandafter\def\csname pgffltF@4\endcsname{\pgffltF@nonzerodigit4}% +\expandafter\def\csname pgffltF@5\endcsname{\pgffltF@nonzerodigit5}% +\expandafter\def\csname pgffltF@6\endcsname{\pgffltF@nonzerodigit6}% +\expandafter\def\csname pgffltF@7\endcsname{\pgffltF@nonzerodigit7}% +\expandafter\def\csname pgffltF@8\endcsname{\pgffltF@nonzerodigit8}% +\expandafter\def\csname pgffltF@9\endcsname{\pgffltF@nonzerodigit9}% +\def\pgffltF@e{\pgfflt@readexponent}% +\let\pgffltF@E=\pgffltF@e +\expandafter\def\csname pgffltF@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltF@nonzerodigit#1{% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@finish@number@after@period}% -\def\pgfmathfloatparsenumber@impl@pendingzeros#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfmathfloatparsenumber@impl@pendingzeros}% + +\def\pgfflt@pendingzeros#1{% + \expandafter\ifx\csname pgffltG@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@finish@number@after@period}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi + \expandafter\expandafter\csname pgffltG@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltG@0\endcsname{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros}% +\expandafter\def\csname pgffltG@1\endcsname{\pgffltG@nonzerodigit1}% +\expandafter\def\csname pgffltG@2\endcsname{\pgffltG@nonzerodigit2}% +\expandafter\def\csname pgffltG@3\endcsname{\pgffltG@nonzerodigit3}% +\expandafter\def\csname pgffltG@4\endcsname{\pgffltG@nonzerodigit4}% +\expandafter\def\csname pgffltG@5\endcsname{\pgffltG@nonzerodigit5}% +\expandafter\def\csname pgffltG@6\endcsname{\pgffltG@nonzerodigit6}% +\expandafter\def\csname pgffltG@7\endcsname{\pgffltG@nonzerodigit7}% +\expandafter\def\csname pgffltG@8\endcsname{\pgffltG@nonzerodigit8}% +\expandafter\def\csname pgffltG@9\endcsname{\pgffltG@nonzerodigit9}% +\def\pgffltG@e{\pgfflt@readexponent}% FIXME: inlining? +\let\pgffltG@E=\pgffltG@e +\expandafter\def\csname pgffltG@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltG@nonzerodigit#1{% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} - - + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@finish@number@after@period}% +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 53b602b0d9a..03b56e28bdc 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -24,21 +24,35 @@ % %-------------------------------------------- -\input pgfplotsutil.code.tex +\edef\pgfplots@oldcatcodesemicolon{\the\catcode`\;}% +\catcode`\;=12 + +\input pgfplotscore.code.tex \input pgfplotsoldpgfsupp_loader.code.tex +\input pgfplotsutil.code.tex +\input pgfplotscolormap.code.tex \input pgfplots.stackedplots.code.tex +\input pgfplotscoordprocessing.code.tex +\input pgfplotsticks.code.tex + \usetikzlibrary{decorations,decorations.pathmorphing,decorations.pathreplacing} % FIXME: reduce number of variables! +\newif\ifpgfplots@bb@isactive \newif\ifpgfplots@xislinear \newif\ifpgfplots@yislinear +\newif\ifpgfplots@zislinear +\newif\ifpgfplots@axis@equal +\newif\ifpgfplots@axis@equal@image \newcount\pgfplots@numplots -\newdimen\pgfplots@xcoordminTEX -\newdimen\pgfplots@xcoordmaxTEX -\newdimen\pgfplots@ycoordminTEX -\newdimen\pgfplots@ycoordmaxTEX +\newdimen\pgfplots@xmin@reg +\newdimen\pgfplots@xmax@reg +\newdimen\pgfplots@ymin@reg +\newdimen\pgfplots@ymax@reg +\newdimen\pgfplots@zmin@reg +\newdimen\pgfplots@zmax@reg \newif\ifpgfplots@warn@for@filter@discards \newif\ifpgfplots@isuniformtick \newif\ifpgfplots@clip@limits @@ -46,40 +60,50 @@ \newif\ifpgfplots@enlargelimits@rel@thresh \newif\ifpgfplots@enlargelimits@auto \newif\ifpgfplots@tickshow +\newif\ifpgfplots@scatterplotenabled \newif\ifpgfplots@xminorticks \newif\ifpgfplots@xmajorticks \newif\ifpgfplots@yminorticks \newif\ifpgfplots@ymajorticks +\newif\ifpgfplots@zminorticks +\newif\ifpgfplots@zmajorticks \newif\ifpgfplots@xminorgrids \newif\ifpgfplots@xmajorgrids \newif\ifpgfplots@yminorgrids \newif\ifpgfplots@ymajorgrids +\newif\ifpgfplots@zminorgrids +\newif\ifpgfplots@zmajorgrids \newif\ifpgfplots@clip@marker@paths \newif\ifpgfplots@axis@on@top \newif\ifpgfplots@separate@axis@lines -\newif\ifpgfplots@scaled@ticks@x -\newif\ifpgfplots@scaled@ticks@y \newif\ifpgfplots@identify@log@minor@tick@pos -\newif\ifpgfplots@disablelogfilter +\newif\ifpgfplots@disablelogfilter@x +\newif\ifpgfplots@disablelogfilter@y +\newif\ifpgfplots@disablelogfilter@z \newif\ifpgfplots@disabledatascaling \newif\ifpgfplots@hide@x \newif\ifpgfplots@hide@y +\newif\ifpgfplots@hide@z \newif\ifpgfplots@is@old@list@format \newif\ifpgfplots@errorbars@enabled \newif\ifpgfplots@scale@only@axis \newif\ifpgfplots@xticklabel@interval \newif\ifpgfplots@yticklabel@interval -\newif\ifpgfplots@stacked@x +\newif\ifpgfplots@zticklabel@interval \newif\ifpgfplots@stackedmode \newif\ifpgfplots@stacked@reverse \newif\ifpgfplots@stacked@plus \newif\ifpgfplots@plot@file@skipfirst +\newif\ifpgfplots@threedim +\newif\ifpgfplots@curplot@isirrelevant +\newif\ifpgfplots@perpointmeta@usesfloat \let\pgfnodepartimagebox=\pgfnodeparttextbox \newif\ifpgfplots@collect@firstplot@astick \def\pgfplots@errorbars@xdirection{0}% pre-init, see below \def\pgfplots@errorbars@ydirection{0}% +\def\pgfplots@errorbars@zdirection{0}% \def\axisdefaultwidth{240pt} \def\axisdefaultheight{207pt} @@ -93,9 +117,9 @@ % #2: the list entries. You can use either a comma-separated list or % a '\\'-terminated list. The latter case also requires '\\' % AFTER the last entry. -\def\pgfcreateplotcyclelist#1#2{\pgfplots@assign@list#1{#2}} +\def\pgfplotscreateplotcyclelist#1#2{\expandafter\pgfplots@assign@list\csname pgfp@cyclist@\string#1@\endcsname{#2}} -\pgfcreateplotcyclelist{\blackwhiteplotspeclist}{% +\pgfplotscreateplotcyclelist{black white}{% every mark/.append style={fill=gray},mark=*\\% every mark/.append style={fill=gray},mark=square*\\% every mark/.append style={fill=gray},mark=otimes*\\% @@ -107,7 +131,8 @@ densely dashed,every mark/.append style={solid},mark=star\\% densely dashed,every mark/.append style={solid,fill=gray},mark=diamond*\\% } -\pgfcreateplotcyclelist{\coloredplotspeclist}{% + +\pgfplotscreateplotcyclelist{color}{% blue,every mark/.append style={fill=blue!80!black},mark=*\\% red,every mark/.append style={fill=red!80!black},mark=square*\\% brown!60!black,every mark/.append style={fill=brown!80!black},mark=otimes*\\% @@ -119,6 +144,25 @@ blue,densely dashed,mark=star,every mark/.append style=solid\\% red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% } +\pgfplotscreateplotcyclelist{exotic}{% + teal,every mark/.append style={fill=teal!80!black},mark=*\\% + orange,every mark/.append style={fill=orange!80!black},mark=square*\\% + cyan!60!black,every mark/.append style={fill=cyan!80!black},mark=otimes*\\% + red!70!white,mark=star\\% + lime!80!black,every mark/.append style={fill=lime},mark=diamond*\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\% + yellow!60!black,densely dashed,every mark/.append style={solid,fill=yellow!80!black},mark=square*\\% + black,every mark/.append style={solid,fill=gray},mark=otimes*\\% + blue,densely dashed,mark=star,every mark/.append style=solid\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% +} + + +% backwards compatibility: +\let\pgfcreateplotcyclelist=\pgfplotscreateplotcyclelist +\pgfplots@letcsname{pgfp@cyclist@\string\blackwhiteplotspeclist @}={pgfp@cyclist@black white@}% +\pgfplots@letcsname{pgfp@cyclist@\string\coloredplotspeclist @}={pgfp@cyclist@color@}% +%%%% \def\pgfplotsset#{\pgfqkeys{/pgfplots}} @@ -137,6 +181,43 @@ }{}% }% +\def\pgfplots@scaled@ticks@setargs#1#2{% + \pgfutil@in@{:}{#2}% + \ifpgfutil@in@ + \pgfplots@scaled@ticks@setargs@{#1}#2\pgfplots@EOI + \else + \expandafter\pgfutil@in@\expandafter{\pgfplots@activecolon}{#2}% + \ifpgfutil@in@ + \pgfplots@scaled@ticks@setargs@active{#1}#2\pgfplots@EOI + \else + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2}% + \fi + \fi +}% +\def\pgfplots@scaled@ticks@setargs@#1#2:#3\pgfplots@EOI{% + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2=#3}% +} + +{ + \catcode`\:=\active + \gdef\pgfplots@scaled@ticks@setargs@active#1#2:#3\pgfplots@EOI{% + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2=#3}% + } +} + +% does the work for '[xyz]ticklabel pos'. +% #1 : one of [xyz] +% #2 : an axis line spec. +\def\pgfplots@setticklabelpos@for#1#2{% + \pgfkeysifdefined{/pgfplots/#1ticklabel pos/#2/.@cmd}{% + \pgfkeysvalueof{/pgfplots/#1ticklabel pos/#2/.@cmd}\pgfeov + }{% + \expandafter\def\csname pgfplots@#1ticklabelaxisspec\endcsname{#2}% + }% +}% + + + \pgfkeys{% /pgfplots/search path for tikz/.unknown/.code={% \let\searchname=\pgfkeyscurrentname% @@ -174,6 +255,7 @@ /pgfplots/every axis plot/.belongs to family=/pgfplots/style commands, /pgfplots/every axis plot post/.style={}, /pgfplots/every axis plot post/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis plot}}, + /pgfplots/no markers/.style={/pgfplots/every axis plot post/.append style={mark=none}}, /pgfplots/every axis label/.style={}, /pgfplots/every axis label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis label}}, /pgfplots/every axis label/.belongs to family=/pgfplots/style commands, @@ -183,6 +265,9 @@ /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, /pgfplots/every axis y label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis y label}}, /pgfplots/every axis y label/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis z label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, + /pgfplots/every axis z label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis z label}}, + /pgfplots/every axis z label/.belongs to family=/pgfplots/style commands, /pgfplots/every axis title/.style={at={(0.5,1)},above,yshift=6pt}, /pgfplots/every axis title/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis title}}, /pgfplots/every axis title/.belongs to family=/pgfplots/style commands, @@ -191,8 +276,10 @@ /pgfplots/every tick/.belongs to family=/pgfplots/style commands, /pgfplots/every inner x axis line/.style={}, /pgfplots/every inner y axis line/.style={}, + /pgfplots/every inner z axis line/.style={}, /pgfplots/every outer x axis line/.style={}, /pgfplots/every outer y axis line/.style={}, + /pgfplots/every outer z axis line/.style={}, /pgfplots/x axis line style/.style={ /pgfplots/every outer x axis line/.append style={#1}, /pgfplots/every inner x axis line/.append style={#1}, @@ -201,13 +288,19 @@ /pgfplots/every outer y axis line/.append style={#1}, /pgfplots/every inner y axis line/.append style={#1}, }, + /pgfplots/z axis line style/.style={ + /pgfplots/every outer z axis line/.append style={#1}, + /pgfplots/every inner z axis line/.append style={#1}, + }, /pgfplots/outer axis line style/.style={ /pgfplots/every outer x axis line/.append style={#1}, /pgfplots/every outer y axis line/.append style={#1}% + /pgfplots/every outer z axis line/.append style={#1}% }, /pgfplots/inner axis line style/.style={ /pgfplots/every inner x axis line/.append style={#1}, /pgfplots/every inner y axis line/.append style={#1}% + /pgfplots/every inner z axis line/.append style={#1}% }, /pgfplots/axis line style/.style={ /pgfplots/inner axis line style={#1}, @@ -239,6 +332,15 @@ /pgfplots/every major y tick/.style={}, /pgfplots/every major y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y tick}}, /pgfplots/every major y tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every z tick/.style={}, + /pgfplots/every z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick}}, + /pgfplots/every z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor z tick/.style={}, + /pgfplots/every minor z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor z tick}}, + /pgfplots/every minor z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every major z tick/.style={}, + /pgfplots/every major z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major z tick}}, + /pgfplots/every major z tick/.belongs to family=/pgfplots/style commands, %/pgfplots/every axis grid/.style={help lines}, /pgfplots/every axis grid/.style={thin,black!25}, /pgfplots/every axis grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis grid}}, @@ -267,6 +369,15 @@ /pgfplots/every major y grid/.style={}, /pgfplots/every major y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y grid}}, /pgfplots/every major y grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis z grid/.style={}, + /pgfplots/every axis z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis z grid}}, + /pgfplots/every axis z grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor z grid/.style={}, + /pgfplots/every minor z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor z grid}}, + /pgfplots/every minor z grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every major z grid/.style={}, + /pgfplots/every major z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major z grid}}, + /pgfplots/every major z grid/.belongs to family=/pgfplots/style commands, /pgfplots/every tick label/.style={}, /pgfplots/every tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every tick label}}, /pgfplots/every tick label/.belongs to family=/pgfplots/style commands, @@ -300,6 +411,21 @@ /pgfplots/every y tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, /pgfplots/every y tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick scale label}}, /pgfplots/every y tick scale label/.belongs to family=/pgfplots/style commands, + /pgfplots/every z tick label/.style={}, + /pgfplots/every z tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick label}}, + /pgfplots/every z tick label/.belongs to family=/pgfplots/style commands, + /pgfplots/every extra z tick/.style={ + /pgfplots/log identify minor tick positions=true, + }, + /pgfplots/every extra z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every extra z tick}}, + /pgfplots/every extra z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/extra z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/extra z tick style/.code={% + \pgfkeysalso{/pgfplots/every extra z tick/.append style={#1}}% + }, + /pgfplots/every z tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, + /pgfplots/every z tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick scale label}}, + /pgfplots/every z tick scale label/.belongs to family=/pgfplots/style commands, /pgfplots/every axis legend/.style={% cells={anchor=center}, inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em}, @@ -328,12 +454,23 @@ /pgfplots/yticklabel/.store in= \pgfplots@yticklabel, /pgfplots/yticklabel/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel=, + /pgfplots/zticklabels/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@zticklabels + \let\pgfplots@zticklabel=\pgfplots@user@ticklabel@list@z + }, + /pgfplots/zticklabel/.store in= \pgfplots@zticklabel, + /pgfplots/zticklabel/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel=, /pgfplots/x tick label as interval/.is if=pgfplots@xticklabel@interval, /pgfplots/x tick label as interval/.default=true, /pgfplots/x tick label as interval/.belongs to family=/pgfplots/tick, /pgfplots/y tick label as interval/.is if=pgfplots@yticklabel@interval, /pgfplots/y tick label as interval/.default=true, /pgfplots/y tick label as interval/.belongs to family=/pgfplots/tick, + /pgfplots/z tick label as interval/.is if=pgfplots@zticklabel@interval, + /pgfplots/z tick label as interval/.default=true, + /pgfplots/z tick label as interval/.belongs to family=/pgfplots/tick, /pgfplots/extra x tick label/.store in= \pgfplots@extra@xticklabel, /pgfplots/extra x tick label/.belongs to family=/pgfplots/tick, /pgfplots/extra x tick label=, @@ -346,6 +483,10 @@ \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@yticklabels \let\pgfplots@extra@yticklabel=\pgfplots@user@extra@ticklabel@list@y }, + /pgfplots/extra z tick labels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@zticklabels + \let\pgfplots@extra@zticklabel=\pgfplots@user@extra@ticklabel@list@z + }, /pgfplots/xtick/.store in= \pgfplots@xtick, /pgfplots/xtick/.belongs to family=/pgfplots/tick, /pgfplots/xtick=, @@ -367,17 +508,70 @@ /pgfplots/ytickten/.store in= \pgfplots@ytickten, /pgfplots/ytickten/.belongs to family=/pgfplots/tick, /pgfplots/ytickten=, - /pgfplots/tick scale label code/.code={$\cdot 10^{#1}$}, - /pgfplots/tick scale label code/.belongs to family=/pgfplots/tick, - /pgfplots/scaled x ticks/.is if=pgfplots@scaled@ticks@x, + /pgfplots/extra z tick label/.store in= \pgfplots@extra@zticklabel, + /pgfplots/extra z tick label/.belongs to family=/pgfplots/tick, + /pgfplots/extra z tick label=, + /pgfplots/ztick/.store in= \pgfplots@ztick, + /pgfplots/ztick/.belongs to family=/pgfplots/tick, + /pgfplots/ztick=, + /pgfplots/extra z ticks/.store in=\pgfplots@extra@ztick, + /pgfplots/extra z ticks/.belongs to family=/pgfplots/tick, + /pgfplots/extra z ticks=, + /pgfplots/ztickten/.store in= \pgfplots@ztickten, + /pgfplots/ztickten/.belongs to family=/pgfplots/tick, + /pgfplots/ztickten=, + /pgfplots/xtick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/xtick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/ytick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/ytick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/ztick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/ztick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/tick scale label code/.style={% + /pgfplots/xtick scale label code={#1}, + /pgfplots/ytick scale label code={#1}% + /pgfplots/ztick scale label code={#1}% + },% + /pgfplots/scaled x ticks/.code={\pgfplots@scaled@ticks@setargs{x}{#1}}, + /pgfplots/scaled x ticks/false/.code= {\def\pgfplots@scaled@ticks@x@choice{0}}, + /pgfplots/scaled x ticks/true/.code= {\def\pgfplots@scaled@ticks@x@choice{1}}, + /pgfplots/scaled x ticks/base 10/.code= {\def\pgfplots@scaled@ticks@x@choice{2}\def\pgfplots@scaled@ticks@x@arg{#1}}, + /pgfplots/scaled x ticks/real/.code= {% + \def\pgfplots@scaled@ticks@x@choice{3}\def\pgfplots@scaled@ticks@x@arg{#1}% + \pgfkeys{/pgfplots/xtick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled x ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@x@choice{4}\def\pgfplots@scaled@ticks@x@arg##1{#2}% + \pgfkeys{/pgfplots/xtick scale label code/.code={#1}}}, /pgfplots/scaled x ticks/.belongs to family=/pgfplots/tick, /pgfplots/scaled x ticks=true, - /pgfplots/scaled y ticks/.is if=pgfplots@scaled@ticks@y, + /pgfplots/scaled y ticks/.code={\pgfplots@scaled@ticks@setargs{y}{#1}}, + /pgfplots/scaled y ticks/false/.code= {\def\pgfplots@scaled@ticks@y@choice{0}}, + /pgfplots/scaled y ticks/true/.code= {\def\pgfplots@scaled@ticks@y@choice{1}}, + /pgfplots/scaled y ticks/base 10/.code= {\def\pgfplots@scaled@ticks@y@choice{2}\def\pgfplots@scaled@ticks@y@arg{#1}}, + /pgfplots/scaled y ticks/real/.code= {% + \def\pgfplots@scaled@ticks@y@choice{3}\def\pgfplots@scaled@ticks@y@arg{#1}% + \pgfkeys{/pgfplots/ytick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled y ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@y@choice{4}\def\pgfplots@scaled@ticks@y@arg##1{#2}% + \pgfkeys{/pgfplots/ytick scale label code/.code={#1}}}, /pgfplots/scaled y ticks/.belongs to family=/pgfplots/tick, /pgfplots/scaled y ticks=true, + /pgfplots/scaled z ticks/.code={\pgfplots@scaled@ticks@setargs{z}{#1}}, + /pgfplots/scaled z ticks/false/.code= {\def\pgfplots@scaled@ticks@z@choice{0}}, + /pgfplots/scaled z ticks/true/.code= {\def\pgfplots@scaled@ticks@z@choice{1}}, + /pgfplots/scaled z ticks/base 10/.code= {\def\pgfplots@scaled@ticks@z@choice{2}\def\pgfplots@scaled@ticks@z@arg{#1}}, + /pgfplots/scaled z ticks/real/.code= {% + \def\pgfplots@scaled@ticks@z@choice{3}\def\pgfplots@scaled@ticks@z@arg{#1}% + \pgfkeys{/pgfplots/ztick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled z ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@z@choice{4}\def\pgfplots@scaled@ticks@z@arg##1{#2}% + \pgfkeys{/pgfplots/ztick scale label code/.code={#1}}}, + /pgfplots/scaled z ticks/.belongs to family=/pgfplots/tick, + /pgfplots/scaled z ticks=true, /pgfplots/scaled ticks/.style={% /pgfplots/scaled x ticks=#1, - /pgfplots/scaled y ticks=#1}, + /pgfplots/scaled y ticks=#1, + /pgfplots/scaled z ticks=#1 + }, /pgfplots/scale ticks above exponent/.store in= \pgfplots@scale@ticks@above@exponent, /pgfplots/scale ticks above exponent/.belongs to family=/pgfplots/tick, /pgfplots/scale ticks above exponent=3, @@ -394,7 +588,13 @@ /pgfplots/minor x tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor y tick num/.initial=0, /pgfplots/minor y tick num/.belongs to family=/pgfplots/tick, - /pgfplots/minor tick num/.style={/pgfplots/minor x tick num=#1,/pgfplots/minor y tick num=#1}, + /pgfplots/minor z tick num/.initial=0, + /pgfplots/minor z tick num/.belongs to family=/pgfplots/tick, + /pgfplots/minor tick num/.style={ + /pgfplots/minor x tick num=#1, + /pgfplots/minor y tick num=#1, + /pgfplots/minor z tick num=#1, + }, /pgfplots/minor tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor tick length/.estore in=\pgfplots@subtickwidth, /pgfplots/minor tick length/.belongs to family=/pgfplots/tick, @@ -451,30 +651,60 @@ /pgfplots/ytick pos/top/.style={/pgfplots/ytick pos/right}, /pgfplots/ytick pos/bottom/.style={/pgfplots/ytick pos/left}, /pgfplots/ytick pos=both, - /pgfplots/tickpos/.style={/pgfplots/xtick pos={#1},/pgfplots/ytick pos={#1}}, + /pgfplots/ztick pos/.is choice, + /pgfplots/ztick pos/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/left/.code ={\def\pgfplots@ztickposnum{1}}, + /pgfplots/ztick pos/left/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/right/.code ={\def\pgfplots@ztickposnum{3}}, + /pgfplots/ztick pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/both/.code ={\def\pgfplots@ztickposnum{0}}, + /pgfplots/ztick pos/both/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/top/.style={/pgfplots/ztick pos/right}, + /pgfplots/ztick pos/bottom/.style={/pgfplots/ztick pos/left}, + /pgfplots/ztick pos=both, + /pgfplots/tickpos/.style={ + /pgfplots/xtick pos={#1}, + /pgfplots/ytick pos={#1}, + /pgfplots/ztick pos={#1} + }, /pgfplots/tickpos/.belongs to family=/pgfplots/tick, -% sets the tick LABEL position, \pgfplots@[xy]ticklabelposnum - /pgfplots/xticklabel pos/.is choice, +% sets the tick LABEL position, \pgfplots@[xy]ticklabelaxisspec +% to one of +% default : 0 +% left : 1 +% right : 3 + /pgfplots/xticklabel pos/.code={\pgfplots@setticklabelpos@for x{#1}}, /pgfplots/xticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelposnum{0}}, + /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelaxisspec{}}, /pgfplots/xticklabel pos/default/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/left/.code ={\def\pgfplots@xticklabelposnum{1}}, + /pgfplots/xticklabel pos/left/.code ={\def\pgfplots@xticklabelaxisspec{v00}}, /pgfplots/xticklabel pos/left/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/right/.code ={\def\pgfplots@xticklabelposnum{3}}, + /pgfplots/xticklabel pos/right/.code ={\def\pgfplots@xticklabelaxisspec{v10}}, /pgfplots/xticklabel pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel pos/top/.style={/pgfplots/xticklabel pos/right}, + /pgfplots/xticklabel pos/bottom/.style={/pgfplots/xticklabel pos/left}, /pgfplots/xticklabel pos=default, - /pgfplots/yticklabel pos/.is choice, + /pgfplots/yticklabel pos/.code={\pgfplots@setticklabelpos@for y{#1}}, /pgfplots/yticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelposnum{0}}, + /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelaxisspec{}}, /pgfplots/yticklabel pos/default/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/left/.code ={\def\pgfplots@yticklabelposnum{1}}, + /pgfplots/yticklabel pos/left/.code ={\def\pgfplots@yticklabelaxisspec{0v0}}, /pgfplots/yticklabel pos/left/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/right/.code ={\def\pgfplots@yticklabelposnum{3}}, + /pgfplots/yticklabel pos/right/.code ={\def\pgfplots@yticklabelaxisspec{1v0}}, /pgfplots/yticklabel pos/right/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel pos/top/.style={/pgfplots/yticklabel pos/right}, /pgfplots/yticklabel pos/bottom/.style={/pgfplots/yticklabel pos/left}, /pgfplots/yticklabel pos=default, - /pgfplots/ticklabelpos/.style={/pgfplots/xticklabel pos={#1},/pgfplots/yticklabel pos={#1}}, + /pgfplots/zticklabel pos/.code={\pgfplots@setticklabelpos@for z{#1}}, + /pgfplots/zticklabel pos/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel pos/default/.code ={\def\pgfplots@zticklabelaxisspec{}}, + /pgfplots/zticklabel pos/default/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel pos=default, + /pgfplots/ticklabelpos/.style={ + /pgfplots/xticklabel pos={#1}, + /pgfplots/yticklabel pos={#1}, + % /pgfplots/zticklabel pos={#1}, + }, % sets \pgfplots@{x,y}tickalignnum to % inside=0 % outside=1 @@ -497,10 +727,20 @@ /pgfplots/ytick align/center/.code ={\def\pgfplots@ytickalignnum{2}}, /pgfplots/ytick align/center/.belongs to family=/pgfplots/tick, /pgfplots/ytick align=inside, + /pgfplots/ztick align/.is choice, + /pgfplots/ztick align/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/inside/.code ={\def\pgfplots@ztickalignnum{0}}, + /pgfplots/ztick align/inside/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/outside/.code ={\def\pgfplots@ztickalignnum{1}}, + /pgfplots/ztick align/outside/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/center/.code ={\def\pgfplots@ztickalignnum{2}}, + /pgfplots/ztick align/center/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align=inside, /pgfplots/tick align/.belongs to family=/pgfplots/tick, /pgfplots/tick align/.style={% /pgfplots/xtick align=#1, /pgfplots/ytick align=#1, + /pgfplots/ztick align=#1, },% % 'axis' options: /pgfplots/anchor/.belongs to family=/pgfplots, @@ -513,29 +753,37 @@ /pgfplots/ticks/none/.code={% \pgfplots@xminorticksfalse \pgfplots@yminorticksfalse + \pgfplots@zminorticksfalse \pgfplots@xmajorticksfalse \pgfplots@ymajorticksfalse + \pgfplots@zmajorticksfalse }, /pgfplots/ticks/major/.belongs to family=/pgfplots/tick, /pgfplots/ticks/major/.code={% \pgfplots@xminorticksfalse \pgfplots@yminorticksfalse + \pgfplots@zminorticksfalse \pgfplots@xmajortickstrue \pgfplots@ymajortickstrue + \pgfplots@zmajortickstrue }, /pgfplots/ticks/minor/.belongs to family=/pgfplots/tick, /pgfplots/ticks/minor/.code={% \pgfplots@xminortickstrue \pgfplots@yminortickstrue + \pgfplots@zminortickstrue \pgfplots@xmajorticksfalse \pgfplots@ymajorticksfalse + \pgfplots@zmajorticksfalse }, /pgfplots/ticks/both/.belongs to family=/pgfplots/tick, /pgfplots/ticks/both/.code={% \pgfplots@xminortickstrue \pgfplots@yminortickstrue + \pgfplots@zminortickstrue \pgfplots@xmajortickstrue \pgfplots@ymajortickstrue + \pgfplots@zmajortickstrue }, /pgfplots/ticks=both, /pgfplots/grid/.is choice, @@ -544,29 +792,37 @@ /pgfplots/grid/none/.code={% \pgfplots@xminorgridsfalse \pgfplots@yminorgridsfalse + \pgfplots@zminorgridsfalse \pgfplots@xmajorgridsfalse \pgfplots@ymajorgridsfalse + \pgfplots@zmajorgridsfalse }, /pgfplots/grid/major/.belongs to family=/pgfplots/tick, /pgfplots/grid/major/.code={% \pgfplots@xminorgridsfalse \pgfplots@yminorgridsfalse + \pgfplots@zminorgridsfalse \pgfplots@xmajorgridstrue \pgfplots@ymajorgridstrue + \pgfplots@zmajorgridstrue }, /pgfplots/grid/minor/.belongs to family=/pgfplots/tick, /pgfplots/grid/minor/.code={% \pgfplots@xminorgridstrue \pgfplots@yminorgridstrue + \pgfplots@zminorgridstrue \pgfplots@xmajorgridsfalse \pgfplots@ymajorgridsfalse + \pgfplots@zmajorgridsfalse }, /pgfplots/grid/both/.belongs to family=/pgfplots/tick, /pgfplots/grid/both/.code={% \pgfplots@xminorgridstrue \pgfplots@yminorgridstrue + \pgfplots@zminorgridstrue \pgfplots@xmajorgridstrue \pgfplots@ymajorgridstrue + \pgfplots@zmajorgridstrue }, /pgfplots/grid=none, /pgfplots/grid/.default=major, @@ -582,6 +838,12 @@ /pgfplots/ymajorticks/.is if=pgfplots@ymajorticks, /pgfplots/ymajorticks/.default=true, /pgfplots/ymajorticks/.belongs to family=/pgfplots/tick, + /pgfplots/zminorticks/.is if=pgfplots@zminorticks, + /pgfplots/zminorticks/.default=true, + /pgfplots/zminorticks/.belongs to family=/pgfplots/tick, + /pgfplots/zmajorticks/.is if=pgfplots@zmajorticks, + /pgfplots/zmajorticks/.default=true, + /pgfplots/zmajorticks/.belongs to family=/pgfplots/tick, /pgfplots/xminorgrids/.is if=pgfplots@xminorgrids, /pgfplots/xminorgrids/.default=true, /pgfplots/xminorgrids/.belongs to family=/pgfplots/tick, @@ -594,6 +856,12 @@ /pgfplots/ymajorgrids/.is if=pgfplots@ymajorgrids, /pgfplots/ymajorgrids/.default=true, /pgfplots/ymajorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/zminorgrids/.is if=pgfplots@zminorgrids, + /pgfplots/zminorgrids/.default=true, + /pgfplots/zminorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/zmajorgrids/.is if=pgfplots@zmajorgrids, + /pgfplots/zmajorgrids/.default=true, + /pgfplots/zmajorgrids/.belongs to family=/pgfplots/tick, % legend options: /pgfplots/legend entries/.initial={}, /pgfplots/legend entries/.belongs to family=/pgfplots/legend, @@ -625,6 +893,8 @@ /pgfplots/xlabel/.belongs to family=/pgfplots/descriptions, /pgfplots/ylabel/.initial=, /pgfplots/ylabel/.belongs to family=/pgfplots/descriptions, + /pgfplots/zlabel/.initial=, + /pgfplots/zlabel/.belongs to family=/pgfplots/descriptions, /pgfplots/before end axis/.code=, /pgfplots/after end axis/.code=, /pgfplots/extra description/.code=, @@ -638,6 +908,10 @@ /pgfplots/clip limits/.default=true, /pgfplots/clip limits=true, /pgfplots/clip limits/.belongs to family=/pgfplots, + /pgfplots/axis equal/.is if=pgfplots@axis@equal, + /pgfplots/axis equal/.default=true, + /pgfplots/axis equal image/.is if=pgfplots@axis@equal@image, + /pgfplots/axis equal image/.default=true, /pgfplots/xmin/.belongs to family=/pgfplots, /pgfplots/xmin/.initial=, /pgfplots/xmax/.belongs to family=/pgfplots, @@ -646,12 +920,30 @@ /pgfplots/ymin/.initial=, /pgfplots/ymax/.belongs to family=/pgfplots, /pgfplots/ymax/.initial=, + /pgfplots/zmin/.belongs to family=/pgfplots, + /pgfplots/zmin/.initial=, + /pgfplots/zmax/.belongs to family=/pgfplots, + /pgfplots/zmax/.initial=, + /pgfplots/xtickmin/.belongs to family=/pgfplots, + /pgfplots/xtickmin/.initial=, + /pgfplots/xtickmax/.belongs to family=/pgfplots, + /pgfplots/xtickmax/.initial=, + /pgfplots/ytickmin/.belongs to family=/pgfplots, + /pgfplots/ytickmin/.initial=, + /pgfplots/ytickmax/.belongs to family=/pgfplots, + /pgfplots/ytickmax/.initial=, + /pgfplots/ztickmin/.belongs to family=/pgfplots, + /pgfplots/ztickmin/.initial=, + /pgfplots/ztickmax/.belongs to family=/pgfplots, + /pgfplots/ztickmax/.initial=, /pgfplots/stack plots/.is choice, /pgfplots/stack plots/.belongs to family=/pgfplots, - /pgfplots/stack plots/x/.code={\pgfplots@stacked@xtrue\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/x/.code={\def\pgfplots@stacked@dir{x}\pgfplots@stackedmodetrue}, /pgfplots/stack plots/x/.belongs to family=/pgfplots, - /pgfplots/stack plots/y/.code={\pgfplots@stacked@xfalse\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/y/.code={\def\pgfplots@stacked@dir{y}\pgfplots@stackedmodetrue}, /pgfplots/stack plots/y/.belongs to family=/pgfplots, + /pgfplots/stack plots/z/.code={\def\pgfplots@stacked@dir{z}\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/z/.belongs to family=/pgfplots, /pgfplots/stack plots/false/.code={\pgfplots@stackedmodefalse}, /pgfplots/stack plots/false/.belongs to family=/pgfplots, /pgfplots/stack plots=false, @@ -672,6 +964,8 @@ /pgfplots/x filter/.belongs to family=/pgfplots, /pgfplots/y filter/.code={}, /pgfplots/y filter/.belongs to family=/pgfplots, + /pgfplots/z filter/.code={}, + /pgfplots/z filter/.belongs to family=/pgfplots, /pgfplots/skip coords between index/.style 2 args={% /pgfplots/x filter/.append code={% \ifnum\coordindex<#1\relax @@ -682,9 +976,25 @@ \fi} }, /pgfplots/xfilter/.initial=,% DEPRECATED - /pgfplots/xfilter/.belongs to family=/pgfplots, /pgfplots/yfilter/.initial=,% DEPRECATED - /pgfplots/yfilter/.belongs to family=/pgfplots, + /pgfplots/zfilter/.initial=,% DEPRECATED + % interpretation: + % if 'samples at'==empty && 'domain' == empty + % use tikz option processing! + % else if 'samples at' == empty + % use 'domain' + % else + % use 'samples at' + /pgfplots/domain/.initial=,% empty -> use value of /tikz/domain! see \pgfplots@validate@plot@domain@arguments + /pgfplots/samples at/.initial=,% empty -> use value of /tikz/samples at! + /pgfplots/samples/.initial=,% empty -> use /tikz/samples! + % and provide aliases in the '/pgfplots/' tree to avoid + % search path problems just for these two options: + /pgfplots/name/.belongs to family=/pgfplots/naming commands, + /pgfplots/name/.code={\pgfkeysalso{/tikz/name={#1}}}, + /pgfplots/alias/.belongs to family=/pgfplots/naming commands, + /pgfplots/alias/.code={\pgfkeysalso{/tikz/alias={#1}}}, + /pgfplots/y domain/.initial=-5:5, /pgfplots/width/.store in= \pgfplots@width, /pgfplots/width/.belongs to family=/pgfplots, /pgfplots/width=, @@ -701,22 +1011,42 @@ /pgfplots/enlarge x limits/.default=true, /pgfplots/enlarge y limits/.initial=auto, /pgfplots/enlarge y limits/.default=true, + /pgfplots/enlarge z limits/.initial=auto, + /pgfplots/enlarge z limits/.default=true, /pgfplots/enlargelimits/.style={% /pgfplots/enlarge x limits=#1,% /pgfplots/enlarge y limits=#1,% + /pgfplots/enlarge z limits=#1,% },% /pgfplots/enlargelimits/.default=true, - /pgfplots/x/.store in= \pgfplots@x, + /pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/x/.belongs to family=/pgfplots, - /pgfplots/x=,% is implicitly set by 'width' and/or '\axisdefaultwidth' - /pgfplots/y/.store in= \pgfplots@y, + /pgfplots/y/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/y/.belongs to family=/pgfplots, - /pgfplots/y=,% is implicitly set by 'width' and/or '\axisdefaultwidth' + /pgfplots/z/.initial=, + /pgfplots/z/.belongs to family=/pgfplots, + /pgfplots/view/.code 2 args={% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \let\pgfplots@view@pitch=\pgfutil@empty + \let\pgfplots@view@yaw=\pgfutil@empty + \else + \pgfmathparse{#1}\let\pgfplots@view@pitch=\pgfmathresult + \pgfmathparse{#2}\let\pgfplots@view@yaw=\pgfmathresult + \fi + }, + /pgfplots/view={}{}, /pgfplots/cycle list/.code={\pgfplots@assign@list\autoplotspeclist{#1}}, /pgfplots/cycle list/.belongs to family=/pgfplots, - /pgfplots/cycle list name/.code={\let\autoplotspeclist=#1\relax}, + /pgfplots/cycle list name/.code={% + \pgfutil@ifundefined{pgfp@cyclist@\string#1@}{% + \pgfplots@error{Sorry, there is no such cycle list named \string#1. Maybe you misspelled it?}% + }{% + \expandafter\let\expandafter\autoplotspeclist\csname pgfp@cyclist@\string#1@\endcsname + }% + }, /pgfplots/cycle list name/.belongs to family=/pgfplots, - /pgfplots/cycle list name=\coloredplotspeclist, + /pgfplots/cycle list name=color, /pgfplots/legend style/.belongs to family=/pgfplots/style commands, /pgfplots/legend style/.code={% \pgfkeysalso{/pgfplots/every axis legend/.append style={#1}}% @@ -733,6 +1063,10 @@ /pgfplots/y label style/.code={% \pgfkeysalso{/pgfplots/every axis y label/.append style={#1}}% }, + /pgfplots/z label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z label style/.code={% + \pgfkeysalso{/pgfplots/every axis z label/.append style={#1}}% + }, /pgfplots/title style/.belongs to family=/pgfplots/style commands, /pgfplots/title style/.code={% \pgfkeysalso{/pgfplots/every axis title/.append style={#1}}% @@ -749,6 +1083,10 @@ /pgfplots/y tick label style/.code={% \pgfkeysalso{/pgfplots/every y tick label/.append style={#1}}% }, + /pgfplots/z tick label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick label style/.code={% + \pgfkeysalso{/pgfplots/every z tick label/.append style={#1}}% + }, /pgfplots/x tick scale label style/.belongs to family=/pgfplots/style commands, /pgfplots/x tick scale label style/.code={% \pgfkeysalso{/pgfplots/every x scale tick label/.append style={#1}}% @@ -757,6 +1095,10 @@ /pgfplots/y tick scale label style/.code={% \pgfkeysalso{/pgfplots/every y scale tick label/.append style={#1}}% }, + /pgfplots/z tick scale label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick scale label style/.code={% + \pgfkeysalso{/pgfplots/every z scale tick label/.append style={#1}}% + }, /pgfplots/tick style/.belongs to family=/pgfplots/style commands, /pgfplots/tick style/.code={% \pgfkeysalso{/pgfplots/every tick/.append style={#1}}% @@ -793,6 +1135,18 @@ /pgfplots/major y tick style/.code={% \pgfkeysalso{/pgfplots/every major y tick/.append style={#1}}% }, + /pgfplots/z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick style/.code={% + \pgfkeysalso{/pgfplots/every z tick/.append style={#1}}% + }, + /pgfplots/minor z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor z tick style/.code={% + \pgfkeysalso{/pgfplots/every minor z tick/.append style={#1}}% + }, + /pgfplots/major z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/major z tick style/.code={% + \pgfkeysalso{/pgfplots/every major z tick/.append style={#1}}% + }, /pgfplots/grid style/.belongs to family=/pgfplots/style commands, /pgfplots/grid style/.code={% \pgfkeysalso{/pgfplots/every axis grid/.append style={#1}}% @@ -829,10 +1183,29 @@ /pgfplots/major y grid style/.code={% \pgfkeysalso{/pgfplots/every major y grid/.append style={#1}}% }, - /pgfplots/disablelogfilter/.is if=pgfplots@disablelogfilter, - /pgfplots/disablelogfilter/.default=true, - /pgfplots/disablelogfilter/.belongs to family=/pgfplots, - /pgfplots/disablelogfilter=false, + /pgfplots/y grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/y grid style/.code={% + \pgfkeysalso{/pgfplots/every axis z grid/.append style={#1}}% + }, + /pgfplots/minor z grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor z grid style/.code={% + \pgfkeysalso{/pgfplots/every minor z grid/.append style={#1}}% + }, + /pgfplots/major z grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/major z grid style/.code={% + \pgfkeysalso{/pgfplots/every major z grid/.append style={#1}}% + }, + /pgfplots/disablelogfilter x/.is if=pgfplots@disablelogfilter@x, + /pgfplots/disablelogfilter x/.default=true, + /pgfplots/disablelogfilter y/.is if=pgfplots@disablelogfilter@y, + /pgfplots/disablelogfilter y/.default=true, + /pgfplots/disablelogfilter z/.is if=pgfplots@disablelogfilter@z, + /pgfplots/disablelogfilter z/.default=true, + /pgfplots/disablelogfilter/.style={ + /pgfplots/disablelogfilter x=#1, + /pgfplots/disablelogfilter y=#1, + /pgfplots/disablelogfilter z=#1, + }, /pgfplots/disabledatascaling/.is if=pgfplots@disabledatascaling, /pgfplots/disabledatascaling/.default=true, /pgfplots/disabledatascaling/.belongs to family=/pgfplots, @@ -843,9 +1216,13 @@ /pgfplots/hide y axis/.is if=pgfplots@hide@y, /pgfplots/hide y axis/.default=true, /pgfplots/hide y axis=false, + /pgfplots/hide z axis/.is if=pgfplots@hide@y, + /pgfplots/hide z axis/.default=true, + /pgfplots/hide z axis=false, /pgfplots/hide axis/.style={% /pgfplots/hide x axis=#1, /pgfplots/hide y axis=#1, + /pgfplots/hide z axis=#1, }, /pgfplots/hide axis/.default=true, /pgfplots/every non boxed x axis/.style={% @@ -858,8 +1235,14 @@ enlarge y limits=false, y axis line style={-stealth} }, + /pgfplots/every non boxed z axis/.style={% + ytick align=center, + enlarge z limits=false, + y axis line style={-stealth} + }, /pgfplots/every boxed x axis/.style={}, /pgfplots/every boxed y axis/.style={}, + /pgfplots/every boxed z axis/.style={}, % /pgfplots/hide axis/.belongs to family=/pgfplots, % sets \pgfplots@xaxislinesnum to % box=0 @@ -953,6 +1336,55 @@ }% },% /pgfplots/axis y line/none/.style ={axis y line*/none,hide y axis}, +% +% sets \pgfplots@zaxislinesnum to +% box=0 +% left=1 +% center=2 ( aliased with middle ) +% right=3 + /pgfplots/axis z line*/.is choice, + /pgfplots/axis z line*/box/.code ={\def\pgfplots@zaxislinesnum{0}\def\pgfplots@ztickposnum{0}}, + /pgfplots/axis z line*/left/.code ={\def\pgfplots@zaxislinesnum{1}\def\pgfplots@ztickposnum{1}}, + /pgfplots/axis z line*/center/.code ={\def\pgfplots@zaxislinesnum{2}\def\pgfplots@ztickposnum{2}}, + /pgfplots/axis z line*/middle/.style ={/pgfplots/axis z line*/center}, + /pgfplots/axis z line*/right/.code ={\def\pgfplots@zaxislinesnum{3}\def\pgfplots@ztickposnum{3}}, + /pgfplots/axis z line*/none/.code ={\def\pgfplots@zaxislinesnum{4}\def\pgfplots@ztickposnum{4}}, + /pgfplots/axis z line*=box, + % + /pgfplots/axis z line/.is choice, + /pgfplots/axis z line/box/.style ={ + /pgfplots/axis z line*/box, + /pgfplots/every boxed z axis + }, + /pgfplots/axis z line/left/.style ={ + /pgfplots/axis z line*/left, + /pgfplots/every non boxed z axis + }, + /pgfplots/axis z line/center/.code ={ + \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then + \pgfkeysalso{% + /pgfplots/every axis z label/.style={at={(current axis.below origin)},anchor=south west}}% + \else + \pgfkeysalso{% + /pgfplots/every axis z label/.style={at={(current axis.above origin)},anchor=north west}}% + \fi + \pgfkeysalso{% + /pgfplots/axis z line*/center, + /pgfplots/every non boxed z axis}% + }, + /pgfplots/axis z line/middle/.style ={/pgfplots/axis z line/center}, + /pgfplots/axis z line/right/.code ={% + \ifnum\pgfplots@xaxislinesnum=2 + \pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% + \fi + \pgfkeysalso{ + axis z line*/right, + %every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt}, + every axis z label/.style={at={(1,0.5)},xshift=33pt,rotate=90}, + /pgfplots/every non boxed z axis + }% + },% + /pgfplots/axis z line/none/.style ={axis z line*/none,hide z axis}, % set \pgfplots@xaxisdiscontnum % none = 0 % crunch = 1 @@ -979,6 +1411,19 @@ /pgfplots/axis y discontinuity/parallel/.code ={\def\pgfplots@yaxisdiscontnum{2}}, /pgfplots/axis y discontinuity/parallel/.belongs to family=/pgfplots, %/axis, /pgfplots/axis y discontinuity=none, +% set \pgfplots@yaxisdiscontnum +% none = 0 +% crunch = 1 +% open = 2 + /pgfplots/axis z discontinuity/.is choice, + /pgfplots/axis z discontinuity/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/none/.code ={\def\pgfplots@zaxisdiscontnum{0}}, + /pgfplots/axis z discontinuity/none/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/crunch/.code ={\def\pgfplots@zaxisdiscontnum{1}}, + /pgfplots/axis z discontinuity/crunch/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/parallel/.code ={\def\pgfplots@zaxisdiscontnum{2}}, + /pgfplots/axis z discontinuity/parallel/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity=none, /pgfplots/scale only axis/.is if=pgfplots@scale@only@axis, /pgfplots/scale only axis/.default=true, /pgfplots/scale only axis/.belongs to family=/pgfplots, @@ -1004,6 +1449,15 @@ /pgfplots/ymode/log/.code={\pgfplots@yislinearfalse}, /pgfplots/ymode/log/.belongs to family=/pgfplots/scale, /pgfplots/ymode=linear, + /pgfplots/zmode/.is choice, + /pgfplots/zmode/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/normal/.code={\pgfplots@zislineartrue}, + /pgfplots/zmode/normal/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/linear/.code={\pgfplots@zislineartrue}, + /pgfplots/zmode/linear/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/log/.code={\pgfplots@zislinearfalse}, + /pgfplots/zmode/log/.belongs to family=/pgfplots/scale, + /pgfplots/zmode=linear, /pgfplots/error bars/x fixed/.code= \def\pgfplots@errorbars@xfixed{#1}\def\pgfplots@errorbars@xmode{0}, /pgfplots/error bars/x fixed relative/.code= \def\pgfplots@errorbars@xrel{#1}\def\pgfplots@errorbars@xmode{1}, /pgfplots/error bars/x explicit/.code= \def\pgfplots@errorbars@xmode{2}, @@ -1016,11 +1470,19 @@ /pgfplots/error bars/y explicit relative/.code= \def\pgfplots@errorbars@ymode{3}, /pgfplots/error bars/y fixed relative=0, /pgfplots/error bars/y fixed=0, + /pgfplots/error bars/z fixed/.code= \def\pgfplots@errorbars@zfixed{#1}\def\pgfplots@errorbars@zmode{0}, + /pgfplots/error bars/z fixed relative/.code= \def\pgfplots@errorbars@zrel{#1}\def\pgfplots@errorbars@zmode{1}, + /pgfplots/error bars/z explicit/.code= \def\pgfplots@errorbars@zmode{2}, + /pgfplots/error bars/z explicit relative/.code= \def\pgfplots@errorbars@zmode{3}, + /pgfplots/error bars/z fixed relative=0, + /pgfplots/error bars/z fixed=0, /pgfplots/error bars/x dir/.is choice, /pgfplots/error bars/x dir/none/.code={% \def\pgfplots@errorbars@xdirection{0}% \ifnum\pgfplots@errorbars@ydirection=0 - \pgfplots@errorbars@enabledfalse + \ifnum\pgfplots@errorbars@zdirection=0 + \pgfplots@errorbars@enabledfalse + \fi \fi }, /pgfplots/error bars/x dir/plus/.code= \def\pgfplots@errorbars@xdirection{1}\pgfplots@errorbars@enabledtrue, @@ -1031,13 +1493,28 @@ /pgfplots/error bars/y dir/none/.code={% \def\pgfplots@errorbars@ydirection{0}% \ifnum\pgfplots@errorbars@xdirection=0 - \pgfplots@errorbars@enabledfalse + \ifnum\pgfplots@errorbars@zdirection=0 + \pgfplots@errorbars@enabledfalse + \fi \fi }, /pgfplots/error bars/y dir/plus/.code= \def\pgfplots@errorbars@ydirection{1}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir/minus/.code= \def\pgfplots@errorbars@ydirection{2}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir/both/.code= \def\pgfplots@errorbars@ydirection{3}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir=none, + /pgfplots/error bars/z dir/.is choice, + /pgfplots/error bars/z dir/none/.code={% + \def\pgfplots@errorbars@zdirection{0}% + \ifnum\pgfplots@errorbars@xdirection=0 + \ifnum\pgfplots@errorbars@ydirection=0 + \pgfplots@errorbars@enabledfalse + \fi + \fi + }, + /pgfplots/error bars/z dir/plus/.code= \def\pgfplots@errorbars@zdirection{1}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir/minus/.code= \def\pgfplots@errorbars@zdirection{2}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir/both/.code= \def\pgfplots@errorbars@zdirection{3}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir=none, /pgfplots/error bars/error mark/.initial={-}, /pgfplots/error bars/error mark options/.initial={rotate=90}, /pgfplots/error bars/error bar style/.code={% @@ -1083,6 +1560,17 @@ -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + % the '0.5*w' is for centering (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /pgfplots/error bars/draw error bar/.code 2 args={% +% FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% + \draw[xshift={\pgfkeysvalueof{/pgf/bar shift}}] + ##1 -- ##2 node[pos=1,sloped,allow upside down] {% + \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% + \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% + \pgfusepath{stroke}}% + }; + },% /tikz/ybar, }, /pgfplots/ybar/.default=2pt, @@ -1097,6 +1585,17 @@ -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + % the '0.5*w' is for centering (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /pgfplots/error bars/draw error bar/.code 2 args={% +% FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% + \draw[yshift={\pgfkeysvalueof{/pgf/bar shift}}] + ##1 -- ##2 node[pos=1,sloped,allow upside down] {% + \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% + \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% + \pgfusepath{stroke}}% + }; + },% /tikz/xbar, }, /pgfplots/xbar/.default=2pt, @@ -1169,6 +1668,10 @@ }, /pgfplots/plot file/skip first/.is if=pgfplots@plot@file@skipfirst, /pgfplots/plot file/skip first/.default=true, + /pgfplots/plot file/.unknown/.code={% + \let\pgfplots@table@curkeyname=\pgfkeyscurrentname + \pgfqkeys{/pgfplots}{\pgfplots@table@curkeyname=##1}% + }, /pgfplots/clip marker paths/.is if=pgfplots@clip@marker@paths, /pgfplots/clip marker paths/.default=true, /pgfplots/axis on top/.is if=pgfplots@axis@on@top, @@ -1180,6 +1683,171 @@ /pgfplots/x coord inv trafo/.code={}, /pgfplots/y coord trafo/.code={}, /pgfplots/y coord inv trafo/.code={}, + /pgfplots/z coord trafo/.code={}, + /pgfplots/z coord inv trafo/.code={}, +% Set \pgfplots@perpointmeta@choice to +% 0: mi is not available/not used. +% 1: mi = xi +% 2: mi = yi +% 3: mi = zi +% 4: mi = given explicitly somehow +% 5: mi = given explicitly somehow AS SYMBOLIC CONSTANTS. + /pgfplots/point meta/.is choice, + /pgfplots/point meta/none/.code={ + \def\pgfplots@perpointmeta@choice{0}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/x/.code={ + \def\pgfplots@perpointmeta@choice{1}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/y/.code={ + \def\pgfplots@perpointmeta@choice{2}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/z/.code={ + \def\pgfplots@perpointmeta@choice{3}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/explicit/.code={ + \def\pgfplots@perpointmeta@choice{4}% + \def\pgfplots@perpointmeta@arg{#1}% + }, + /pgfplots/point meta/explicit symbolic/.code={ + \def\pgfplots@perpointmeta@choice{5}% + \def\pgfplots@perpointmeta@arg{#1}% + }, + /pgfplots/point meta/none, + /pgfplots/colormap name/.initial=hot, + /pgfplots/colormap/.code 2 args={ + \pgfplotscreatecolormap{#1}{#2}% + \pgfkeysdef{/pgfplots/colormap name}{#1}% + }, + /pgfplots/scatter/.is choice, + /pgfplots/scatter/false/.code={% + \pgfplots@scatterplotenabledfalse + }, + /pgfplots/scatter/true/.code={% + \pgfplots@scatterplotenabledtrue + % make sure there is a mark set! + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + \def\pgfplots@loc@TMPa{none}% + \ifx\tikz@plot@mark\pgfplots@loc@TMPa + % this here happens only in older versions of pgf. + \pgfqkeys{/tikz}{mark=*}% + \else + \ifx\tikz@plot@mark\pgfutil@empty + \pgfqkeys{/tikz}{mark=*}% + \fi + \fi + }, + /pgfplots/scatter/.default=true, + /pgfplots/scatter src/.style={/pgfplots/point meta=#1}, + /tikz/scatter/.style={/pgfplots/scatter=#1}, + % + % ARGUMENTS: the macros + % - \pgfplotspointmeta + % - \pgfplotspointmetarange + % - \pgfplotspointmetatransformed + % - \pgfplotspointmetatransformedrange + % are set during @pre marker code and @post marker code. + % '#1' is empty. + /pgfplots/scatter/@pre marker code/.code={}, + /pgfplots/scatter/@post marker code/.code={}, + /pgfplots/scatter/use mapped color/.style={ + /pgfplots/scatter/@pre marker code/.code={ + \expandafter\pgfplotscolormapfind\expandafter[\pgfplotspointmetatransformedrange] + [1.0] + {\pgfplotspointmetatransformed} + {\pgfkeysvalueof{/pgfplots/colormap name}} +%\message{Color for current point is RGB '\pgfmathresult' (determined using meta 'phi(\pgfplotspointmeta) = \pgfplotspointmetatransformed')}% + \def\pgfplots@loc@TMPb{\definecolor{mapped color}{rgb}} + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfmathresult} + \scope[#1] + }, + /pgfplots/scatter/@post marker code/.code={\endscope} + }, + /pgfplots/scatter/use mapped color/.default={draw=mapped color!80!black,fill=mapped color}, + /pgfplots/scatter/use mapped color, + % expect '#1 = {<class>=<style>,<class>=<style>,...} where <class> + % is expected as SYMBOL, not as number. See 'point meta/explicit symbolic' + /pgfplots/scatter/classes/.code={% + % Step 1: remember the per class-styles as + % \csname pgfp@scatter@class@<class name>\endcsname + % -> this is done locally! + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \def\pgfplots@loc@TMPa##1=##2\relax{% + \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% + \t@pgfplots@tokb={\expandafter\def\csname pgfp@scatter@class@##1\endcsname{##2}}% + \xdef\pgfplots@glob@TMPa{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + }% + % accumulate the \def-macros in a global macro because + % \foreach is scoped: + \foreach \entry in {#1} {% + \edef\eentry{\entry}% + \expandafter\pgfplots@loc@TMPa\eentry\relax + }% + % do the assignments: + \pgfplots@glob@TMPa + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \pgfkeysdef{/pgfplots/scatter/@pre marker code}{% + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + \let\pgfplots@loc@TMPa=\pgfplotspointmeta + % + % ups - no styles available? Maybe something went + % wrong with the 'scatter src' key. Check whether it + % was accidentally a numerical style: + \ifnum\pgfplots@perpointmeta@choice=5 + \else + % ok, be fault tolerant and round to an integer: + \pgfmathfloattofixed{\pgfplotspointmeta}% + \begingroup + \pgfkeys{/pgf/number format/precision=0}% + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplotspointmeta=\pgfmathresult + \fi + % now, check again: + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + % still not possible? Then, try truncating the + % number to an integer. + \expandafter\pgfutil@in@\expandafter.\expandafter{\pgfplotspointmeta}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPb####1.####2\relax{\def\pgfplotspointmeta{####1}}% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax + \fi + % now, check again: + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + \pgfutil@ifundefined{pgfp@scatter@WARNING@\pgfplotspointmeta}{% + \pgfplots@warning{scatter/classes: can't find class for '\pgfplotspointmeta'!? Please make sure you have specified 'scatter src=explicit symbolic'. Ignoring class '\pgfplotspointmeta' (this message will not come again).}% + \expandafter\gdef\csname pgfp@scatter@WARNING@\pgfplotspointmeta\endcsname{ALREADY CHECKED}% + }{}% + \def\pgfplots@loc@TMPa{}% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + \expandafter\scope\expandafter[\pgfplots@loc@TMPa]% + }% + \pgfkeysdef{/pgfplots/scatter/@post marker code}{\endscope}% + }, + /pgfplots/refstyle/.code={% + \pgfutil@ifundefined{pgfplots@labelstyle@#1}{% + \G@refundefinedtrue + \@latex@warning{Reference `#1' on page \thepage \space undefined}% + }{% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@labelstyle@#1\endcsname}% + \expandafter\pgfkeysalso\expandafter{\the\t@pgfplots@toka}% + }% + },% + /pgfplots/forget plot/.is if=pgfplots@curplot@isirrelevant, + /pgfplots/forget plot/.default=true, } { @@ -1188,302 +1856,80 @@ \global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa } +% Only define if it is undefined. It may be possible that related libraries +% habe been loaded before pgfplots. +\pgfkeysifdefined{/pgfplots/@backgroundpath@hook}{\relax}{% + \pgfkeysdef{/pgfplots/@backgroundpath@hook}{}% +} + \def\pgfplots@cmdkey@alias#1=#2;{% \pgfkeysgetvalue{/pgfplots/#2/.@cmd}\pgfplots@glob@TMPa \pgfkeyslet{/pgfplots/#1/.@cmd}\pgfplots@glob@TMPa }% \pgfplots@cmdkey@alias xlabel style=x label style; \pgfplots@cmdkey@alias ylabel style=y label style; +\pgfplots@cmdkey@alias zlabel style=z label style; \pgfplots@cmdkey@alias xticklabel style=x tick label style; \pgfplots@cmdkey@alias yticklabel style=y tick label style; +\pgfplots@cmdkey@alias zticklabel style=z tick label style; %\pgfplots@cmdkey@alias xtick scale label style=x tick scale label style; %\pgfplots@cmdkey@alias ytick scale label style=y tick scale label style; \pgfplots@cmdkey@alias xtick style=x tick style; \pgfplots@cmdkey@alias ytick style=y tick style; +\pgfplots@cmdkey@alias ztick style=z tick style; -\newif\ifpgfplots@log@tick@isminor@tick@pos -% Checks whether the tick position given as #1.#2=log10(T) belongs to -% T=i*10^j with an integer i>1. -% -% If T=i*10^j, \ifpgfplots@log@tick@isminor@tick@pos will be set to true and -% \pgfmathresult will contain T. -% -% Otherwise, \ifpgfplots@log@tick@isminor@tick@pos will be set to false and -% pgfmathresult to #1.#2 + +% A backwards compatibility method which works as follows: +% if any user specified arguments exist for the 'domain' or 'samples +% at' or 'samples' keys, nothing is done. % -% Arguments: -% #1.#2 the value log10(T) +% It these keys are empty, we switch to backwards compatibility mode +% and acquire the key settings from tikz. % -% 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. +% This allows something like +% \begin{tikzpicture}[samples=70,domain=1:5] +% \begin{axis} +% \addplot {x^2}; +% \end{axis} +% \end{tikzpicture} % -% Further note: log(T) < 0 <=> j<0. -% 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). -\def\pgfplots@is@log@tick@a@minor@tick@pos#1.#2\relax{% - \pgfmathapproxequalto@{#1.#2}{#1.0}% - \ifpgfmathcomparison - % in MOST cases, this here will be true: - \pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \else - % I guess this won't happen too often. In fact, it's a very - % special case. - \begingroup - \c@pgf@counta=#1\relax - \ifnum\c@pgf@counta<0 - \advance\c@pgf@counta by-1 - \pgfmathsubtract@{1}{0.#2}% - \expandafter\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi\pgfmathresult\relax - \ifpgfplots@log@tick@isminor@tick@pos - \aftergroup\pgfplots@log@tick@isminor@tick@postrue - \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% - \else - \aftergroup\pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \fi +% POSTCONDITION: +% - \pgfplots@plot@domain = value of '/pgfplots/domain', +% - \pgfplots@plot@samples@at = the value of '/pgfplots/samples at', +% - \pgfplots@plot@samples = value of '/pgfplots/samples', +% the values after any backwards compatibility issues will be used. +\def\pgfplots@validate@plot@domain@arguments{% + \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain + \pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at + \ifx\pgfplots@plot@domain\pgfutil@empty + \ifx\pgfplots@plot@samples@at\pgfutil@empty + \pgfplots@gettikzinternal@keyval{samples at}{tikz@plot@samplesat}{-5,-4.6,...,5}% + \pgfkeyslet{/pgfplots/samples at}{\tikz@plot@samplesat}% + \let\pgfplots@plot@samples@at=\tikz@plot@samplesat \else - \pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#2\relax - \ifpgfplots@log@tick@isminor@tick@pos - \aftergroup\pgfplots@log@tick@isminor@tick@postrue - \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% - \else - \aftergroup\pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \fi + % routines should use \pgfplots@plot@samples@at. \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup \fi -} - -% expects a positive number. -\def\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#1\relax{% - \pgfplots@log@tick@isminor@tick@postrue - \pgfmathapproxequalto@{0.#1}{0.3010299956639}% - \ifpgfmathcomparison - \def\pgfmathresult{2}% - \else - \pgfmathapproxequalto@{0.#1}{0.4771212547196}% - \ifpgfmathcomparison - \def\pgfmathresult{3}% - \else - \pgfmathapproxequalto@{0.#1}{0.6020599913279}% - \ifpgfmathcomparison - \def\pgfmathresult{4}% - \else - \pgfmathapproxequalto@{0.#1}{0.698970004}% - \ifpgfmathcomparison - \def\pgfmathresult{5}% - \else - \pgfmathapproxequalto@{0.#1}{0.7781512503}% - \ifpgfmathcomparison - \def\pgfmathresult{6}% - \else - \pgfmathapproxequalto@{0.#1}{0.8450980400}% - \ifpgfmathcomparison - \def\pgfmathresult{7}% - \else - \pgfmathapproxequalto@{0.#1}{0.9030899869}% - \ifpgfmathcomparison - \def\pgfmathresult{8}% - \else - \pgfmathapproxequalto@{0.#1}{0.954242509439}% - \ifpgfmathcomparison - \def\pgfmathresult{9}% - \else - \pgfplots@log@tick@isminor@tick@posfalse - \fi - \fi - \fi - \fi - \fi - \fi - \fi + \pgfkeysgetvalue{/pgfplots/samples}\pgfplots@plot@samples + \ifx\pgfplots@plot@samples\pgfutil@empty + \pgfplots@gettikzinternal@keyval{samples}{tikz@plot@samples}{25}% + \pgfkeyslet{/pgfplots/samples}{\tikz@plot@samples}% + \let\pgfplots@plot@samples=\tikz@plot@samples \fi -} - +}% \def\pgfplots@set@at#1{\def\pgfplots@at{#1}}% - -% converts a comma-separated list (PGF foreach) to my internal list -% structure. -\long\def\pgfplots@foreach@to@list#1\to#2{% - \global\pgfplotslistnewempty\pgfplots@glob@TMPa - \begingroup - \foreach \pgfplots@i in {#1} {% - \expandafter\pgfplotslistpushbackglobal\pgfplots@i\to\pgfplots@glob@TMPa - }% - \endgroup - \pgfplotslistcopy\pgfplots@glob@TMPa\to#2\relax -} - -% Several tick options: +% DEPRECATED \long\def\axispreset#1{% \pgfplotsset{every axis/.append style={#1}}% } +% DEPRECATED \long\def\legendpreset#1{% \pgfplots@error{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.}% } -% Checks whether we need to create a separate 'tick scale label', -% a node with ' * 10^3' on the side of the axis: -% -% 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 -% and -% \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. -% FIXME : does that need further attention? -\def\pgfplots@init@scaled@tick@for#1{% - \begingroup - % the \pgfplots@xmin@unscaled@as@float is set just before the data - % scale transformation is initialised. - % - % The variables are empty if there is no datascale transformation. - \expandafter\let\expandafter\pgfplots@cur@min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname - \expandafter\let\expandafter\pgfplots@cur@max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname - % - \ifx\pgfplots@cur@min@unscaled\pgfutil@empty - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1min\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% - \let\pgfplots@cur@min@unscaled=\pgfmathresult - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1max\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% - \let\pgfplots@cur@max@unscaled=\pgfmathresult - \fi - % - \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E - \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E - \pgfmathfloat@b@E=\pgfmathfloat@a@E - \fi - \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@above@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E - % ok, scale it: - \multiply\pgfmathfloat@b@E by-1 - \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% - \else - \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@below@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E - % ok, scale it: - \multiply\pgfmathfloat@b@E by-1 - \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% - \else - % no scaling necessary: - \xdef\pgfplots@glob@TMPa{0}% - \fi - \fi - \endgroup - \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% -} - -% x-axis tick labels for #1th tick -% #1: the axis (x or y) -% #2: the value -% #3,#4: coordinates for tikz -% #5: ticknumber -\def\pgfplots@show@ticklabel#1#2(#3,#4)#5{{% - \csname ifpgfplots@#1ticklabel@interval\endcsname - \pgfmathparse{#3}% - \edef\pgfplots@show@ticklabel@coord@x@new{\pgfmathresult pt}% - \pgfmathparse{#4}% - \edef\pgfplots@show@ticklabel@coord@y@new{\pgfmathresult pt}% - % - \pgfplots@show@ticklabel@{#1}{#2}% - \let\nexttick=\tick - \ifx\pgfplots@show@ticklabel@LASTTICK\pgfutil@empty - % its the first call. Simply remember arguments and wait - % for interval boundary before proceeding. - \else - % acquire options of first interval boundary: - \pgfplots@show@ticklabel@LASTTICK - % compute new node position: - \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#1\endcsname + \csname pgfplots@show@ticklabel@coord@#1@new\endcsname)}% - \expandafter\edef\csname pgfplots@show@ticklabel@coord@#1\endcsname{\pgfmathresult pt}% - \let\ticknum=\pgfplots@show@ticklabel@num\relax% - \let\tick=\pgfplots@show@ticklabel@tick% - \edef\pgfplots@loc@TMPa{at (\pgfplots@show@ticklabel@coord@x,\pgfplots@show@ticklabel@coord@y)}% - \expandafter\node\pgfplots@loc@TMPa - {\csname pgfplots@#1ticklabel\endcsname};% - \fi - \xdef\pgfplots@show@ticklabel@LASTTICK{% - \noexpand\def\noexpand\pgfplots@show@ticklabel@tick{\nexttick}% - \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@x{\pgfplots@show@ticklabel@coord@x@new}% - \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@y{\pgfplots@show@ticklabel@coord@y@new}% - \noexpand\edef\noexpand\pgfplots@show@ticklabel@num{#5}% - }% - \else - \let\ticknum=#5\relax% - \pgfplots@show@ticklabel@{#1}{#2}% - \node at (#3,#4) {\csname pgfplots@#1ticklabel\endcsname};% - \fi -}} - -% Defines \tick by applying any necessary math to the (possibly -% transformed) tick value #2. -% -% #1: axis (x or y) -% #2: tick value. -\def\pgfplots@show@ticklabel@#1#2{% - \csname ifpgfplots@apply@datatrafo@#1\endcsname - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{#2}% - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% - }\relax - % .. and this here provides \tick as fixed point repr: - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\tick=\pgfmathresult - \else - \edef\tick{#2}% - \pgfplots@if{pgfplots@#1islinear}{% - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \pgfmathfloatparsenumber{#2}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\tick=\pgfmathresult - }{}% - }{}% - \fi - \pgfkeysgetvalue{/pgfplots/#1 coord inv trafo/.@cmd}\pgfplots@loc@TMPa - \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key - \else - \let\pgfmathresult=\tick% - \expandafter\pgfplots@loc@TMPa\expandafter{\tick}\pgfeov - \let\tick=\pgfmathresult - \fi -}% - -\def\pgfplots@user@ticklabel@list@x{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@xticklabels\to\tick - \tick -} -\def\pgfplots@user@ticklabel@list@y{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@yticklabels\to\tick - \tick -} -\def\pgfplots@user@extra@ticklabel@list@x{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@xticklabels\to\tick - \tick -} -\def\pgfplots@user@extra@ticklabel@list@y{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@yticklabels\to\tick - \tick -} - % #1 axis (x or y) % #2 the label @@ -1500,280 +1946,70 @@ {#1}; } -% Check if a label does not cross the x-axis -\def\pgfplots@ytick@check@tickshow{% - \pgfplots@tickshowtrue - \ifnum\pgfplots@yaxislinesnum=2\relax - \ifcase\pgfplots@xaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ZERO@y\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \fi - \fi -} -% Fills the macros -% \pgfplots@tick@beg@a \pgfplots@tick@end@a -% \pgfplots@tick@beg@b \pgfplots@tick@end@b -% with coordinates such that -% (\pgfplots@tick@beg@a,\pgfplots@tmpa) -- (\pgfplots@tick@end@a,\pgfplots@tmpa) -% produces a correct tick line. -% -% The '@b' variant is only used in case of \pgfplots@ytickposnum = 0 -% -% #1 : the current axis (x or y). -% #2 : the axis which is NOT fixed. For x tick lines, this is the y -% axis and for y tick lines, this is the x axis (#1 = x or y) -% #3 : the current tick width -\def\pgfplots@prepare@tick@offsets@for@#1#2#3{% - \ifcase\csname pgfplots@#1tickposnum\endcsname\relax - %(\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt) - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordminTEX\endcsname}}% - \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - % - %(\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#3, 0pt) - \edef\pgfplots@tick@beg@b{\pgf@sys@tonumber{\csname pgfplots@#2coordmaxTEX\endcsname}}% - \pgfmathadd@{\pgfplots@tick@beg@b}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@b=\pgfmathresult - \pgfmathsubtract@{\pgfplots@tick@beg@b}{#3}% - \edef\pgfplots@tick@beg@b{\pgfplots@tick@beg@b pt}% - \edef\pgfplots@tick@end@b{\pgfmathresult pt}% - \or - % (\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt); - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordminTEX\endcsname}}% - \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \or - % (\pgfplots@ZERO@x -\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt); - \pgf@xa=\csname pgfplots@ZERO@#2\endcsname - \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% - \pgfmathsubtract@{\pgfplots@loc@TMPa}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \or - % (\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#3, 0pt); - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordmaxTEX\endcsname}}% - \pgfmathadd@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathsubtract@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \fi -}% - -\def\pgfplots@drawyaxis@placecomputedtick{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tick@beg@a}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tick@end@a}{\pgfplots@tmpa}}% - \ifnum\pgfplots@ytickposnum=0\relax - \pgfpathmoveto{\pgfqpoint{\pgfplots@tick@beg@b}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tick@end@b}{\pgfplots@tmpa}}% - \fi -}% -\def\pgfplots@drawyaxis@placecomputedgridline{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@xcoordmaxTEX}{\pgfplots@tmpa}}% -}% - -\newif\ifpgfplots@needsminorloop - -\def\pgfplots@draw@tick@scale@label@for#1{% - \csname ifpgfplots@#1islinear\endcsname - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \begingroup - \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% - \expandafter\c@pgf@counta\pgfplots@glob@TMPa\relax - \multiply\c@pgf@counta by-1 - \ifnum\c@pgf@counta=0\relax - \global\let\pgfplots@glob@TMPa=\pgfutil@empty - \else - \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% - \fi - \endgroup - \ifx\pgfplots@glob@TMPa\pgfutil@empty - \else - \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/tick scale label code/.@cmd}{\pgfplots@glob@TMPa}}% - \node - [% - xshift=\pgfplots@xcoordminTEX,% - yshift=\pgfplots@ycoordminTEX,% - x=\pgfplots@xcoordmaxTEX-\pgfplots@xcoordminTEX,% - y=\pgfplots@ycoordmaxTEX-\pgfplots@ycoordminTEX,% - /pgfplots/every tick label,% - /pgfplots/every #1 tick label,% - /pgfplots/every #1 tick scale label] - {\pgfplots@tick@scale@labels}; - \fi - }{\relax}% - \fi -} - -% Simply invokes the code of PGF key #1 with value #2, that means -% #1#2\pgfeov -\def\pgfplots@invoke@pgfkeyscode#1#2{% - \pgfkeysgetvalue{#1}\pgfplots@invoke@pgfkeyscode@CODE - \pgfplots@invoke@pgfkeyscode@CODE#2\pgfeov -} - -% 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. -\def\pgfplots@xtick@check@tickshow{% - \pgfplots@tickshowtrue - \ifnum\pgfplots@xaxislinesnum=2\relax - \ifcase\pgfplots@yaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ZERO@x\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \fi - \fi -} - -\def\pgfplots@drawxaxis@placecomputedtick{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@beg@a}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@end@a}}% - \ifnum\pgfplots@xtickposnum=0\relax - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@beg@b}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@end@b}}% - \fi -}% -\def\pgfplots@drawxaxis@placecomputedgridline{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordminTEX}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordmaxTEX}}% -}% - -% #1: axis (x or y) -% #2: axis index (0 or 1) -% #3: tick position list -\def\pgfplots@draw@extra@ticks@for#1#2#3{% - \begingroup - \pgfplots@scaled@ticks@xfalse - \pgfplots@scaled@ticks@yfalse - \csname pgfplots@#1minorticksfalse\endcsname - \csname pgfplots@#1minorgridsfalse\endcsname - \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname - \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP - \pgfplotsset{/pgfplots/every extra #1 tick}% FIXME : used 'search path for tikz' before... - \pgfplots@prepare@ticks@for{#3}{#1}{#2}% - \pgfplots@drawgridlines@for{#1}{#2}% - \pgfplots@drawticklines@for{#1}{#2}% - \pgfplots@drawticklabels@for{#1}{#2}% - \endgroup -} - -\def\pgfplots@drawaxis@innerlines{% - \ifpgfplots@hide@y\else - \ifnum\pgfplots@yaxislinesnum=2 - \draw[/pgfplots/every inner y axis line,% - decorate,% - ydiscont,% - decoration={pre length=\ydisstart, post length=\ydisend}] - (\pgfplots@ZERO@x, \pgfplots@ycoordminTEX) -- (\pgfplots@ZERO@x, \pgfplots@ycoordmaxTEX); - \fi - \fi - \ifpgfplots@hide@x\else - \ifnum\pgfplots@xaxislinesnum=2 - \draw[/pgfplots/every inner x axis line,% - decorate,% - xdiscont,% - decoration={pre length=\xdisstart, post length=\xdisend}] - (\pgfplots@xcoordminTEX, \pgfplots@ZERO@y) -- (\pgfplots@xcoordmaxTEX, \pgfplots@ZERO@y); - \fi +% #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA) +% #2: the 'b' axis on the orentied surface (the same as \pgfplotspointonorientedsurfaceB) +\def\pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3{% + \ifnum\csname pgfplots@#1axislinesnum\endcsname=2 + \draw[/pgfplots/every inner #1 axis line,% + decorate,% + #1discont,% + decoration={pre length=\csname #1disstart\endcsname, post length=\csname #1disend\endcsname}] + \pgfextra + \csname pgfplotspointonorientedsurfaceabsetupforset#3\endcsname{\csname pgfplots@logical@ZERO@#3\endcsname}{2}% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@logical@ZERO@#2\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@logical@ZERO@#2\endcsname}}% + \endpgfextra + ; \fi }% % Ok, we don't mind whether edges with thick lines look ugly. We just % draw separate lines. This here is necessary if we want arrow heads. -\def\pgfplots@drawaxis@outerlines@separate{% - \ifpgfplots@hide@x - \else - \scope[/pgfplots/every outer x axis line, - xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] - \ifcase\pgfplots@xaxislinesnum - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) }; - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \or - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) }; - \or - \or +% +% #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA) +% #2: the 'b' axis on the orentied surface (the same as \pgfplotspointonorientedsurfaceB) +\def\pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2{% + \scope[/pgfplots/every outer #1 axis line, + #1discont,decoration={pre length=\csname #1disstart\endcsname, post length=\csname #1disend\endcsname}] + \ifcase\csname pgfplots@#1axislinesnum\endcsname\relax + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \fi - \endscope - \fi - \ifpgfplots@hide@y - \else - \scope[/pgfplots/every outer y axis line, - ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] - \ifcase\pgfplots@yaxislinesnum - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) }; + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% + \endpgfextra + }; + }{\relax}% + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% \draw decorate { - (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \or + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2max\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% + \endpgfextra + }; + }{\relax}% + \or + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) }; - \or - \or + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% + \endpgfextra + }; + }{\relax}% + \or + \or + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% \draw decorate { - (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \fi - \endscope + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2max\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% + \endpgfextra + }; + }{\relax}% \fi + \endscope }% % This here is complicated: we try to create good edges and draw a @@ -1783,494 +2019,104 @@ % | | % | | % ----- +% +% ATTENTION: this thing is used IF AND ONLY IF d=2 and the axis is +% drawn as box. \def\pgfplots@drawaxis@outerlines@cycledpath{% \draw[ /pgfplots/every outer x axis line, % FIXME! these outer styles need much more attention :-( /pgfplots/every outer y axis line] - (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) + (\pgfplots@xmin, \pgfplots@ymin) \ifpgfplots@hide@y - { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } + { (\pgfplots@xmin, \pgfplots@ymax) } \else \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } + decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } + \or decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } + \or { (\pgfplots@xmin, \pgfplots@ymax) } + \or { (\pgfplots@xmin, \pgfplots@ymax) } \fi \fi \ifpgfplots@hide@x - { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } + { (\pgfplots@xmax, \pgfplots@ymax) } \else \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } + decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } + \or { (\pgfplots@xmax, \pgfplots@ymax) } + \or { (\pgfplots@xmax, \pgfplots@ymax) } + \or decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } \fi \fi \ifpgfplots@hide@y - { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } + { (\pgfplots@xmax, \pgfplots@ymin) } \else \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } + decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } + \or { (\pgfplots@xmax, \pgfplots@ymin) } + \or { (\pgfplots@xmax, \pgfplots@ymin) } + \or decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } \fi \fi \ifpgfplots@hide@x - { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } + { (\pgfplots@xmin, \pgfplots@ymin) } \else \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } + decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } + \or decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } + \or { (\pgfplots@xmin, \pgfplots@ymin) } + \or { (\pgfplots@xmin, \pgfplots@ymin) } \fi% can't use cycle here! \fi ; % -- cycle; }% -\def\pgfplots@drawaxis@outerlines{% - \ifnum\pgfplots@xaxislinesnum>0 - \pgfplots@separate@axis@linestrue - \fi - \ifnum\pgfplots@yaxislinesnum>0 - \pgfplots@separate@axis@linestrue - \fi - \ifpgfplots@separate@axis@lines - \pgfplots@drawaxis@outerlines@separate - \else - \pgfplots@drawaxis@outerlines@cycledpath - \fi -}% - -\def\pgfplots@drawaxis@lines{% - \begingroup - \begingroup - % this group employs several temporary dimension registers - % and is therefor scoped: - \let\ydisstart=\pgf@xa - \let\ydisend=\pgf@xb - \let\xdisstart=\pgf@ya - \let\xdisend=\pgf@yb - \ydisend=\pgfplots@ycoordmaxTEX - \advance \ydisend by -\pgfplots@ycoordminTEX - \ifcase\pgfplots@yaxisdiscontnum\relax - \let\ydiscontstyle=\pgfutil@empty - \or - \def\ydiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% - \advance \ydisend by -16pt - \or - \def\ydiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% - \advance \ydisend by -8pt - \fi - \ifpgfplots@apply@datatrafo@y - \advance \pgfplots@ycoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@y pt - \fi - \ifdim\pgfplots@ycoordmaxTEX<0pt - \ydisstart=\ydisend - \ydisend=4pt - \else - \ydisstart=4pt - \fi - \ifpgfplots@apply@datatrafo@y - \advance \pgfplots@ycoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@y pt - \fi - \xdisend=\pgfplots@xcoordmaxTEX - \advance \xdisend by -\pgfplots@xcoordminTEX - \ifcase\pgfplots@xaxisdiscontnum\relax - \let\xdiscontstyle=\pgfutil@empty - \or - \def\xdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% - \advance \xdisend by -16pt - \or - \def\xdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% - \advance \xdisend by -8pt - \fi - \ifpgfplots@apply@datatrafo@x - \advance \pgfplots@xcoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@x pt - \fi - \ifdim\pgfplots@xcoordmaxTEX<0pt - \xdisstart=\xdisend - \xdisend=4pt - \else - \xdisstart=4pt - \fi - \ifpgfplots@apply@datatrafo@x - \advance \pgfplots@xcoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@x pt - \fi - % carry local computations outside of group: - \xdef\pgfplots@glob@TMPa{% - \noexpand\def\noexpand\xdisstart{\the\xdisstart}% - \noexpand\def\noexpand\xdisend{\the\xdisend}% - \noexpand\def\noexpand\ydisstart{\the\ydisstart}% - \noexpand\def\noexpand\ydisend{\the\ydisend}% - \noexpand\pgfkeys{% - /tikz/xdiscont/.style={\xdiscontstyle},% - /tikz/ydiscont/.style={\ydiscontstyle}}% - }% - \endgroup - \pgfplots@glob@TMPa - \pgfplots@drawaxis@outerlines% - \pgfplots@drawaxis@innerlines% - \endgroup -}% - -% Computes final major and minor tick positions into global lists -% \pgfplots@prepared@tick@positions@major@x -% and -% \pgfplots@prepared@tick@positions@minor@x. -% -% The major tick list contains tuples (canvas position,logical position) -% while the minor tick list contains just the canvas position. +% Assigns the macros +% #1disstart +% #1disend +% and the key /tikz/#1discont for use in the axis line routines. % -% #1: the tick list. -% #2: the axis name as character, i.e. 'x' or 'y' -% #3: the axis name as integer, i.e. 0 or 1 -\def\pgfplots@prepare@ticks@for#1#2#3{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#2islinear\endcsname - \expandafter\let\expandafter\ifpgfplots@minorticks\csname ifpgfplots@#2minorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@minorgrids\csname ifpgfplots@#2minorgrids\endcsname - % these lists need to be global such that I can fill them inside - % of \foreach statements. And, yes: I have also added a TeX group - % on my own (but that's not the problem). - \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@major - \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@minor - \edef\pgfplots@loc@TMPa{#1}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \ifpgfplots@minorticks - \pgfplots@needsminorlooptrue - \else - \ifpgfplots@minorgrids - \pgfplots@needsminorlooptrue - \else - \pgfplots@needsminorloopfalse - \fi - \fi - \ifpgfplots@needsminorloop - \ifpgfplots@islinear - \expandafter\let\expandafter\pgfplots@minor@tick@num\csname pgfplots@minor@#2tick@num\endcsname - \begingroup - \c@pgf@counta=\pgfplots@minor@tick@num\relax - \advance\c@pgf@counta by1\relax - \pgfplots@tmpa=\csname pgfplots@tick@distance@#2\endcsname pt - \divide\pgfplots@tmpa by\c@pgf@counta - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpa}}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgfplots@minor@tick@dist=\pgfmathresult - \else - \def\pgfplots@minor@tick@num{9}% - \fi - \fi - \foreach \x in {#1} {% - \ifcase#3\relax - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\x}{0}}% - \or - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\x}}% - \fi - \csname pgfplots@#2tick@check@tickshow\endcsname - % - \ifpgfplots@tickshow - \ifdim\pgfplots@tmpa<\csname pgfplots@#2coordminTEX\endcsname - \else - \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname - \else - \edef\pgfplots@loc@TMPa{{\the\pgfplots@tmpa}{\x}}% - \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@prepared@tick@positions@major - \fi - \fi - \fi - % X-Axis ticks bottom and top - % in log: - % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9 - \ifpgfplots@needsminorloop - \foreach \pgfplots@i in {1,...,\pgfplots@minor@tick@num} {% - \begingroup - \ifcase#3\relax - \ifpgfplots@islinear - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\pgfplots@i*\pgfplots@minor@tick@dist}{0}}% - \else - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\logi\pgfplots@i}{0}}% - \fi - \or - \ifpgfplots@islinear - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\pgfplots@i*\pgfplots@minor@tick@dist}}% - \else - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\logi\pgfplots@i}}% - \fi - \fi - \edef\pgfmathresult{\the\pgfplots@tmpa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \advance\pgfplots@tmpa by\pgfmathresult\relax - \ifdim\pgfplots@tmpa<\csname pgfplots@#2coordminTEX\endcsname - \else - \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname - \else - \expandafter\pgfplotslistpushbackglobal\the\pgfplots@tmpa\to\pgfplots@prepared@tick@positions@minor - \fi - \fi - }% - \fi - }% - \fi - \endgroup - \expandafter\let\csname pgfplots@prepared@tick@positions@minor@#2\endcsname=\pgfplots@prepared@tick@positions@minor - \expandafter\let\csname pgfplots@prepared@tick@positions@major@#2\endcsname=\pgfplots@prepared@tick@positions@major - \global\let\pgfplots@prepared@tick@positions@major=\relax - \global\let\pgfplots@prepared@tick@positions@minor=\relax -}% - -% Converts the tuples in major tick lists into two separate variables. -% -% Usage: -% \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@x\as\curelement{% -% \expandafter\pgfplots@parse@prepared@major@tickpos\curelement\canvas\logical -% } -% -% #1#2 : the tuples as they are found in the prepared major tick list, -% #3 : a dimen register which will be filled with #1 -% #4 : a macro which will be assigned with #2 -\def\pgfplots@parse@prepared@major@tickpos#1#2#3#4{% - #3=#1\relax% - \def#4{#2}% -}% - - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawgridlines@for#1#2{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorgrids\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorgrids\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - \pgfplots@loop@CONTINUEfalse - \ifpgfplots@major - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@minor - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@loop@CONTINUE - \scope - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \ifcase#2\relax - \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX-5cm) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX+5cm); - \or - \clip (\pgfplots@xcoordminTEX-5cm, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX+5cm, \pgfplots@ycoordmaxTEX); - \fi - \endpgfinterruptboundingbox% - \ifpgfplots@major - \draw[% - /pgfplots/every axis grid, - /pgfplots/every major grid, - /pgfplots/every axis #1 grid, - /pgfplots/every major #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curgridpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curgridpos\pgfplots@tmpa\pgfplots@curgridpos - \csname pgfplots@draw#1axis@placecomputedgridline\endcsname - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every axis grid, - /pgfplots/every minor grid, - /pgfplots/every axis #1 grid, - /pgfplots/every minor #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curgridpos{% - \pgfplots@tmpa=\pgfplots@curgridpos - \csname pgfplots@draw#1axis@placecomputedgridline\endcsname - }% - \endpgfextra; - \fi - \endscope - \fi - \endgroup -} - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawticklines@for#1#2{% - \scope - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorticks\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \ifcase#2\relax - \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX-5cm) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX+5cm); - \or - \clip (\pgfplots@xcoordminTEX-5cm, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX+5cm, \pgfplots@ycoordmaxTEX); - \fi - \endpgfinterruptboundingbox% - \ifpgfplots@major - \draw[% - /pgfplots/every tick, - /pgfplots/every major tick, - /pgfplots/every #1 tick, - /pgfplots/every major #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@tickwidth}% - \let\pgfplots@tickwidth@=\pgfmathresult - \edef\pgfplots@tickwidth{\pgfplots@tickwidth@ pt}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0} - \or - \let\pgfplots@tick@offset=\pgfplots@tickwidth@% - \or - \pgfmathmultiply@{0.5}{\pgfplots@tickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% - \fi - \ifcase#2\relax - \pgfplots@prepare@tick@offsets@for@{#1}{y}{\pgfplots@tickwidth@}% - \else - \pgfplots@prepare@tick@offsets@for@{#1}{x}{\pgfplots@tickwidth@}% - \fi - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curtickpos\pgfplots@tmpa\pgfplots@curtickpos - \csname pgfplots@draw#1axis@placecomputedtick\endcsname - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every tick, - /pgfplots/every minor tick, - /pgfplots/every #1 tick, - /pgfplots/every minor #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@subtickwidth}% - \let\pgfplots@subtickwidth@=\pgfmathresult - \edef\pgfplots@subtickwidth{\pgfplots@subtickwidth@ pt}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0}% - \or - \let\pgfplots@tick@offset=\pgfplots@subtickwidth@% - \or - \pgfmathmultiply@{0.5}{\pgfplots@subtickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% - \fi - \ifcase#2\relax - \pgfplots@prepare@tick@offsets@for@{#1}{y}{\pgfplots@subtickwidth@}% - \else - \pgfplots@prepare@tick@offsets@for@{#1}{x}{\pgfplots@subtickwidth@}% - \fi - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curtickpos{% - \pgfplots@tmpa=\pgfplots@curtickpos - \csname pgfplots@draw#1axis@placecomputedtick\endcsname - }% - \endpgfextra; - \fi - \endscope -} - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawticklabels@for#1#2{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \ifpgfplots@major - \ifpgfplots@islinear - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \pgfplots@init@scaled@tick@for{#1}% - }\relax% - \fi +% #1 : either x or y. +\def\pgfplots@drawaxis@lines@preparediscont@for#1{% + \ifnum\csname pgfplots@#1axisdiscontnum\endcsname>0 \begingroup - \pgfkeys{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfmathresult{0}% - \or - \pgfmathparse{\pgfplots@tickwidth}% + % this group employs several temporary dimension registers + % and is therefor scoped: + \let\disstart=\pgf@ya + \let\disend=\pgf@yb + \disend=\csname pgfplots@#1max@reg\endcsname + \advance\disend by -\csname pgfplots@#1min@reg\endcsname + \disend=\csname pgfplots@#1@veclength\endcsname\disend + \ifcase\csname pgfplots@#1axisdiscontnum\endcsname\relax + % has already been checked above. \or - \pgfmathmultiply{0.5}{\pgfplots@tickwidth}% - \fi - \let\pgfplots@tick@offset=\pgfmathresult - \ifnum\csname pgfplots@#1ticklabelposnum\endcsname=0 - % the choice '[xy]ticklabel pos=default': - \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1tickposnum\endcsname - \else - \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1ticklabelposnum\endcsname - \fi - \ifcase#2\relax - \ifcase\pgfplots@tmpposnum\relax - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordminTEX}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordminTEX}}% - \or - \pgf@xa=\pgfplots@ZERO@y - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgf@xa}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordmaxTEX}}% - \fi - \def\pgfplots@tickposchoicea{\tikzset{above}}% - \def\pgfplots@tickposchoiceb{\tikzset{below}}% + \def\discontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% + \advance \disend by -16pt \or - \ifcase\pgfplots@tmpposnum\relax - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordminTEX}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordminTEX}}% - \or - \pgf@xa=\pgfplots@ZERO@x - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgf@xa}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordmaxTEX}}% - \fi - \def\pgfplots@tickposchoicea{\tikzset{right}}% - \def\pgfplots@tickposchoiceb{\tikzset{left}}% - \fi - \ifnum\pgfplots@tmpposnum=3 - \pgfplots@tickposchoicea - \pgfmathadd@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \def\discontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% + \advance \disend by -8pt + \fi + % if #1max + shift < 0pt (shift is 0 without the scaling trafo) + \ifdim\csname pgfplots@#1max@reg\endcsname<-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt + % swap start and end + \disstart=\disend + \disend=4pt \else - \pgfplots@tickposchoiceb - \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \disstart=4pt \fi - \edef\pgfplots@tick@origin{\pgfmathresult pt}% - \def\pgfplots@ticknum{0}% - \xdef\pgfplots@show@ticklabel@LASTTICK{}% - \pgfplotslistforeachungrouped\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curtickpos\pgfplots@tmpa\pgfplots@curtickpos - \ifcase#2\relax - \pgfplots@show@ticklabel - {#1}{\pgfplots@curtickpos}(\pgfplots@tmpa,\pgfplots@tick@origin)% - {\pgfplots@ticknum}% - \or - \pgfplots@show@ticklabel - {#1}{\pgfplots@curtickpos}(\pgfplots@tick@origin,\pgfplots@tmpa)% - {\pgfplots@ticknum}% - \fi - \begingroup - \c@pgf@counta=\pgfplots@ticknum\relax - \advance\c@pgf@counta by1 - \edef\pgfplots@ticknum{\the\c@pgf@counta}% - \pgfmath@smuggleone\pgfplots@ticknum - \endgroup + % carry local computations outside of group: + \xdef\pgfplots@glob@TMPa{% + \noexpand\def\expandafter\noexpand\csname #1disstart\endcsname{\the\disstart}% + \noexpand\def\expandafter\noexpand\csname #1disend\endcsname{\the\disend}% + \noexpand\pgfkeysdef{/tikz/#1discont}{\noexpand\pgfkeysalso{\discontstyle}}% }% \endgroup - \pgfplots@draw@tick@scale@label@for #1% + \pgfplots@glob@TMPa + \else + \expandafter\def\csname #1disstart\endcsname{0pt}% + \expandafter\def\csname #1disend\endcsname{0pt}% + \pgfkeyslet{/tikz/#1discont}=\pgfutil@empty \fi - \endgroup -} +}% \def\pgfplots@rememberplotspec#1{% \pgfplotslistpushbackglobal{#1}\to\pgfplots@plotspeclist @@ -2283,7 +2129,7 @@ \else \c@pgf@countb=\pgfplots@numplots % offset modulo size: - \loop + \pgfutil@loop \ifnum\c@pgf@countb<\c@pgf@counta \pgfplots@loop@CONTINUEfalse \else @@ -2291,1474 +2137,42 @@ \fi \ifpgfplots@loop@CONTINUE \advance\c@pgf@countb by-\c@pgf@counta - \repeat + \pgfutil@repeat \pgfplotslistselect\c@pgf@countb\of\autoplotspeclist\to#1 %\pgfplots@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. -% -% \addplot[<style options>] plot[<behavior options>] <input type and args> <post plot path> ; -% -% -% The linespec. will be used in the legend. -% -% Low-level implementation: -% -% \pgfplots@addplot -% \pgfplots@addplotimpl -% \pgfplots@start@plot@with@behavioroptions <--- \begingroup -% ... -% ... remember options GLOBALLY -% ... update limits GLOBALLY -% ... \pgfplots@addplot@enqueue@coords GLOBALLY -% ... -% \pgfplots@end@plot <--- \endgroup -\long\def\pgfplots@addplot{% - \pgfutil@ifnextchar+{% - \pgfplots@getautoplotspec into\nextplotspec - \pgfplots@addplotimplAPPEND - }{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl% - }{% - \pgfplots@getautoplotspec into\nextplotspec - % the space after ']' is required here: - % FIXME: - % - \addplot[]plot coordinates is NOT allowed!? - \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec]% - }% - }% -} - -\long\def\pgfplots@addplotimplAPPEND+[{% - \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec, -} - -\long\def\pgfplots@addplotimpl[#1]{% - \pgfutil@ifnextchar p{% - \pgfplots@addplotimpl@plot{#1}% - }{% - \pgfplots@addplotimpl@plot{#1}plot - }% -} -\def\pgfplots@addplotimpl@plot#1plot{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@plot@withoptions{#1}% - }{% - \pgfplots@addplotimpl@plot@withoptions{#1}[]% - }% +\long\def\pgfplots@path#1;{% + \pgfplots@path@enqueue{#1;}% } -\def\pgfplots@addplotimpl@plot@withoptions#1[#2]{ - \pgfplots@start@plot@with@behavioroptions{#2}% - \pgfutil@ifnextchar c{% - \pgfplots@addplotimpl@coordinates{#1}plot - }{% - \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@f{#1}% - }{% - \pgfutil@ifnextchar t{% - \pgfplots@addplotimpl@table{#1}% - }{% - \pgfutil@ifnextchar ({% - \pgfplots@addplotimpl@expression{#1}% - }{% - \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots! Ignoring it.}% - \pgfplots@gobble@until@semicolon - }% - }% - }% - }% +% This thing here shall be used to replace any '\path' where \axispath +% shall be used. +\long\def\pgfplots@replacement@for@tikz@path#1;{% + \axispath\path#1;% } -\def\pgfplots@gobble@until@semicolon#1;{} - -% Currently, plot expression is really inefficient: -% -% 1. it invokes the math parser to get all coordinates. Ok, that's -% what one expects. -% -% 2. It collects the result into one large list instead of calling -% pgfplots' stream methods. That's because \foreach encapsulates its -% code in at least one TeX-group. -% -% 3. It processes the collected list; applying any floating point -% parser routines - it does NOT know that any numbers are already in -% TeX-precision! -% -\long\def\pgfplots@addplotimpl@expression#1(#2,#3)#4;{% - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - % - \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}% - \pgfplots@gettikzinternal@keyval{samples at}{tikz@plot@samplesat}{-5,-4.6,...,5}% - % - \edef\pgfplots@plot@data{\noexpand\foreach\expandafter\noexpand\tikz@plot@var in {\tikz@plot@samplesat}}% - \pgfplotsapplistXXglobalnewempty - \pgfplots@plot@data{% - \pgfmathparse{#2}% - \let\pgfplots@current@point@x=\pgfmathresult - \pgfmathparse{#3}% - \let\pgfplots@current@point@y=\pgfmathresult - \edef\pgfplots@loc@TMPa{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@loc@TMPa}% - }% - \pgfplotsapplistXXgloballet\pgfplots@loc@TMPa - \pgfplotsapplistXXglobalclear - \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@loc@TMPa}% -}% - -\def\pgfplots@addplotimpl@f#1f{% - \pgfutil@ifnextchar i{\pgfplots@addplotimpl@file{#1}}{\pgfplots@addplotimpl@function{#1}}% -}% - -\let\pgfplots@backupof@pgfplotxyfile=\pgfplotxyfile - -% the following code -% results finally in -% -% set format "%.7e";; set samples <...>; plot ... -% -% The windows port of gnuplot doesn't run without the second semicolon -% - for whatever reason. { - \catcode`\%=12 - \catcode`\"=12 - \xdef\pgfplots@gnuplot@format{set format "%.7e";} -} - -% #1: args of \addplot[...] -% #2: file name -% #3: trailing path commands until ';' -\def\pgfplots@addplotimpl@function#1unction#2#3;{% - \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}% - \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-plot}% - \pgfplots@gettikzinternal@keyval{samples}{tikz@plot@samples}{25}% - \pgfplots@gettikzinternal@keyval{domain}{tikz@plot@domain}{-5:5}% - \pgfplots@gettikzinternal@keyval{raw gnuplot}{iftikz@plot@raw@gnuplot}{\iffalse}% - \pgfplots@gettikzinternal@keyval{parametric}{iftikz@plot@parametric}{\iffalse}% - % - \def\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}% - \iftikz@plot@raw@gnuplot% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{#2}}% - \else% - \iftikz@plot@parametric% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% - \pgfplots@gnuplot@format; - set samples \tikz@plot@samples; - set parametric; - plot [t=\tikz@plot@domain] #2}}% - \else% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% - \pgfplots@gnuplot@format; - set samples \tikz@plot@samples; - plot [x=\tikz@plot@domain] #2}}% - \fi% - \fi% - \def\pgfplotxyfile{\pgfplots@addplotimpl@gnuplotresult{#1}{#3}}% - \pgfplots@plot@data - \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile -}% - -\def\pgfplots@addplotimpl@gnuplotresult#1#2#3{% - \begingroup - \openin1=#3 - \ifeof1 - \pgfplots@error{Sorry, the gnuplot-result file '#3' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot #3' manually.}% - \aftergroup\pgfplots@loop@CONTINUEfalse - \else - \aftergroup\pgfplots@loop@CONTINUEtrue - \fi - \closein1 - \endgroup - \ifpgfplots@loop@CONTINUE - \pgfplots@addplotimpl@file{#1}ile{#3}#2;% - \fi -} - -% #1: arguments to \addplot[...] -% #2: the file name -% #3: any additional path arguments -\def\pgfplots@addplotimpl@file#1ile{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@file@opt{#1}% - }{% - \pgfplots@addplotimpl@file@opt{#1}[]% - }% -} - -% \addplot[#1] file[#2] {#3} #4; -\def\pgfplots@addplotimpl@file@opt#1[#2]#3#4;{% - \begingroup - \def\pgfplots@loc@TMPa{#2}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \pgfqkeys{/pgfplots/plot file}{#2}% - \fi - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplots@coord@stream@start - \openin1=#3 - \ifeof1 - \pgfplots@warning{sorry, plot file{#3} could not be opened!?}% - \else - \pgfplots@addplotimpl@file@readall - \fi - \pgfplots@coord@stream@end - \endgroup -}% -\def\pgfplots@addplotimpl@file@readall{% - \read1 to\pgfplots@file@LINE - \expandafter\pgfplotstableread@checkspecial@line\pgfplots@file@LINE\pgfplotstable@EOI - \ifpgfplotstableread@skipline - \else - \ifpgfplots@plot@file@skipfirst - % Silently skip first data row, assuming it is a header. - \pgfplots@plot@file@skipfirstfalse - \else - \expandafter\pgfplots@addplotimpl@file@parsesingle\pgfplots@file@LINE\pgfplots@EOI - \fi - \fi - \ifeof1 - \else - \expandafter - \pgfplots@addplotimpl@file@readall - \fi -}% - -\def\pgfplots@addplotimpl@file@parsesingle#1 #2 #3\pgfplots@EOI{% - \pgfplots@coord@stream@coord{#1}{#2}{}{}% -}% - -\def\pgfplots@addplotimpl@table#1table{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@table@getopts{#1}% - }{% - \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% - }% -}% - -\def\pgfplots@addplotimpl@table@getopts#1[#2]{% - \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% - }{% - \pgfplots@addplotimpl@table@fromfile{#1}{#2}% - }% -} - -% #1: arguments to \addplot[...] -% #2: arguments to table[...] -% #3: the argument of plot table{...} -% #4: trailing path arguments after plot table{...}#4; -\long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{% - \begingroup - % FIXME : this thing here has runtime O(N^2) ! - % I fear it is faster to simply reload the data .... !? - % - % well, for a lot of columns which are used in different contexts - % and few rows, this here IS more efficient. - \pgfplotstableset{#2}% - \pgfplotstablecopy#3\to\pgfplots@table - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\addplot@tbl@x - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\addplot@tbl@y - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y - \fi + % A block which handles active semicolons. % - \ifpgfplots@errorbars@enabled - \let\addplot@tbl@error@x=\pgfutil@empty - \let\addplot@tbl@error@y=\pgfutil@empty - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \else - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\addplot@tbl@error@x - \fi - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x - \fi - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \else - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\addplot@tbl@error@y - \fi - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y - \fi - \fi + % ATTENTION: this block does only work if + % \pgfplots@addplotimpl.... changes are reflected here! % - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplots@coord@stream@start - \loop - \pgfplotslistcheckempty\addplot@tbl@x - \ifpgfplotslistempty - \pgfplots@loop@CONTINUEfalse - \else - % This here is just for sanity checking: if the 'y' column is - % - for whatever reasons - invalid; provide good error - % recovery. - \pgfplotslistcheckempty\addplot@tbl@y - \ifpgfplotslistempty - \pgfplots@loop@CONTINUEfalse - \else - \pgfplots@loop@CONTINUEtrue - \fi - \fi - \ifpgfplots@loop@CONTINUE - \pgfplotslistpopfront\addplot@tbl@x\to\addplot@tbl@cur@x - \pgfplotslistpopfront\addplot@tbl@y\to\addplot@tbl@cur@y - \ifpgfplots@errorbars@enabled - \ifx\addplot@tbl@error@x\pgfutil@empty - \let\addplot@tbl@error@cur@x=\pgfutil@empty - \else - \pgfplotslistpopfront\addplot@tbl@error@x\to\addplot@tbl@error@cur@x - \fi - \ifx\addplot@tbl@error@y\pgfutil@empty - \let\addplot@tbl@error@cur@y=\pgfutil@empty - \else - \pgfplotslistpopfront\addplot@tbl@error@y\to\addplot@tbl@error@cur@y - \fi - \edef\pgfplots@loc@TMPa{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{\addplot@tbl@error@cur@x}{\addplot@tbl@error@cur@y}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@loc@TMPa - \else - \edef\pgfplots@loc@TMPa{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{}{}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@loc@TMPa - \fi - \repeat - \pgfplots@coord@stream@end - \endgroup -} - - -% #1: arguments to \addplot[...] -% #2: arguments to table[...] -% #3: the argument of plot table{...} -% #4: trailing path arguments after plot table{...}#4; -\long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{% - %-------------------------------------------------- - % \begingroup - % \pgfplotstableset{#2}% - % \pgfplotstableread{#3}\pgfplots@table - % \pgfplots@addplotimpl@table@fromstructure{#1}{}from{\pgfplots@table}{#4};% - % \endgroup - %-------------------------------------------------- - \pgfplotsapplistXXglobalnewempty - \begingroup - \pgfplotstableset{#2}% - \let\pgfplots@table@PTR@x=\pgfutil@empty - \let\pgfplots@table@PTR@y=\pgfutil@empty - \ifpgfplots@errorbars@enabled - \let\pgfplots@table@ERRPTR@x=\pgfutil@empty - \let\pgfplots@table@ERRPTR@y=\pgfutil@empty - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@witherrors - \else - \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener - \fi - \endgroup - % - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplotsapplistXXgloballet\pgfplots@coordlist - \pgfplotsapplistXXglobalclear - \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@coordlist}%% -} -\def\pgfplots@addplotimpl@table@fromfile@listener{% - \pgfplots@addplotimpl@table@fromfile@listener@ - \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% -} -\def\pgfplots@addplotimpl@table@fromfile@listener@{% - \ifx\pgfplots@table@PTR@x\pgfutil@empty - % this here is only evaluated ONCE. - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@xindex}{\pgfplots@table@PTR@x}% - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@x}{\pgfplots@table@PTR@x}% - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@yindex}{\pgfplots@table@PTR@y}% - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@y}{\pgfplots@table@PTR@y}% - \fi - \fi - \pgfplotstablereadevalptr\pgfplots@table@PTR@x\pgfplots@current@point@x - \pgfplotstablereadevalptr\pgfplots@table@PTR@y\pgfplots@current@point@y -}% -\def\pgfplots@addplotimpl@table@fromfile@listener@witherrors{% - \pgfplots@addplotimpl@table@fromfile@listener@ - % - \ifx\pgfplots@table@ERRPTR@x\pgfutil@empty - % this here is only evaluated ONCE. - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \let\pgfplots@table@ERRPTR@x=\relax% - \else - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@xindex}{\pgfplots@table@ERRPTR@x}% - \fi - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@x}{\pgfplots@table@ERRPTR@x}% - \fi - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \let\pgfplots@table@ERRPTR@y=\relax% - \else - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@yindex}{\pgfplots@table@ERRPTR@y}% - \fi - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@y}{\pgfplots@table@ERRPTR@y}% - \fi - \fi - \ifx\relax\pgfplots@table@ERRPTR@x - \let\addplot@tbl@error@cur@x=\pgfutil@empty - \else - \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@x\addplot@tbl@error@cur@x - \fi - \ifx\relax\pgfplots@table@ERRPTR@y - \let\addplot@tbl@error@cur@y=\pgfutil@empty - \else - \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@y\addplot@tbl@error@cur@y - \fi - \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)+-(\addplot@tbl@error@cur@x,\addplot@tbl@error@cur@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% -}% - -% #1: arguments to \addplot plot[#1] -% -> these are called 'behavior' options in the manual; they are set -% immediately. -\def\pgfplots@start@plot@with@behavioroptions#1{% - \begingroup - \def\pgfplots@current@point@coordindex{0}% can be used inside of coordinate filters. - \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot - \ifx\pgfplots@execute@at@begin@plot\pgfutil@empty - \else - \pgfplots@execute@at@begin@plot - \fi - \def\pgfplots@addplot@nonlegend@options{#1}% - \ifx\pgfplots@addplot@nonlegend@options\pgfutil@empty - \else - \pgfplotsset{#1}% - \fi - % these styles may contain behavior options (error bars, - % samples,... ) activate them! - \pgfplotsset{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% -} - -% Initialises -% \pgfplots@coord@stream@start -% \pgfplots@coord@stream@coord -% \pgfplots@coord@stream@end -% such that a following coordinate stream is processed properly. The -% following coordinate stream may come from different input methods. -% -% Arguments: -% #1: all options of \addplot[...] (the plot style) -% #2: any trailing path commands after the 'plot' command as such, -% for example \addplot plot coordinates {...} -- (0,0); -% would yield #2 =' -- (0,0)' -% -\long\def\pgfplots@PREPARE@COORD@STREAM#1#2{% - \def\pgfplots@coord@stream@start@{% - \pgfplotsapplistXXnewempty - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbar@recordto{\pgfplots@recordederrorbar}% - \pgfplots@streamerrorbarstart - \else - \let\pgfplots@recordederrorbar=\pgfutil@empty - \fi - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - % - %\let\pgfplots@coord@stream@recorded=\pgfutil@empty - % - }% - \let\pgfplots@coord@stream@coord@=\pgfplots@process@one@point - \def\pgfplots@coord@stream@end@{% - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbarend - \fi - \ifpgfplots@coord@stream@isfirst - \pgfplots@warning{Empty plot silently dropped.}% - \else - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi - % Idea: use - % \scope[plot specification] - % <any paths for error bars> - % \endscope - % \draw plot coordinates {...}; - % to share plot specifications between error bars and plot - % coordinates. Unfortunately, it is NOT sufficient to use - % \tikzset{#1} - \edef\pgfplots@addplot@preoptionsTMP{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% - \expandafter\pgfplots@rememberplotspec\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% - % warning: rememberplotspec calls list macros which - % overwrite \t@pgfplots@toka - \t@pgfplots@toka=\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% - \xdef\pgfplots@last@plot@style{\the\t@pgfplots@toka}% store it for \label commands. - % ATTENTION: do NOT call list macros from here on! - % - \ifpgfplots@datascaletrafo@initialised - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa - \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% - \else - \t@pgfplots@tokc={}% - \fi - \ifx\pgfplots@recordederrorbar\pgfutil@empty - \let\pgfplots@loc@TMPb=\pgfutil@empty% - \else - \t@pgfplots@tokb=\expandafter{\pgfplots@recordederrorbar}% - \def\pgfplots@loc@TMPb{% - \noexpand\pgfplots@errorbars@finishwithstyleoptions[current plot style]{\the\t@pgfplots@tokb}% - }% - \fi - % assembe a \pgfplots@addplot@enqueue@coords command ... - % BEGIN HERE ... - % vvvvvvvvvv - \xdef\pgfplots@glob@TMPa{% - \noexpand\pgfplots@addplot@enqueue@coords - {% precommand: - \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% - \noexpand\pgfplots@initzerolevelhandler - \the\t@pgfplots@tokc% named start/end points (if already available) - \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@toka}}% - \pgfplots@loc@TMPb% error bar commands - }% - {% draw command: - \noexpand\draw% - }% - }% - \pgfplotsapplistXXlet\pgfplots@coord@stream@recorded - \pgfplotsapplistXXclear - \t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% - \t@pgfplots@tokb={#2;}% - \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% - \xdef\pgfplots@glob@TMPa{% - \the\t@pgfplots@toka - {% coordinates which need to be processed in \endaxis: - plot coordinates {\the\t@pgfplots@tokc}\the\t@pgfplots@tokb - }% - {% postcommand - }% - }% - \pgfplots@glob@TMPa - %^^^^^^^^^^^^ ... END of \pgfplots@addplot@enqueue@coords HERE - \pgfplots@end@plot - \fi - }% -}% - -\def\pgfplots@end@plot{% - \global\advance\pgfplots@numplots by1\relax% - \ifx\pgfplots@execute@at@end@plot\pgfutil@empty - \else - \pgfplots@execute@at@end@plot - \fi - \global\let\pgfplots@glob@TMPa=\relax - \ifpgfplots@collect@firstplot@astick - \ifnum\pgfplots@numplots=1\relax - \t@pgfplots@toka=\expandafter{\pgfplots@firstplot@coords@x}% - \t@pgfplots@tokb=\expandafter{\pgfplots@firstplot@coords@y}% - \xdef\pgfplots@glob@TMPa{% - \noexpand\def\noexpand\pgfplots@firstplot@coords@x{\the\t@pgfplots@toka}% - \noexpand\def\noexpand\pgfplots@firstplot@coords@y{\the\t@pgfplots@tokb}% - }% - \fi - \fi - \endgroup - \pgfplots@glob@TMPa% see above -} - -% #1: arguments to \addplot[...] -% #2: the plot coordinates -% #3: any trailing path command before the final ';'. It will be used as-is. -\long\def\pgfplots@addplotimpl@coordinates#1plot coordinates#2#3;{% -%\tracingmacros=2\tracingcommands=2 -%\pgfplots@message{processing plots coords with trailing path '#3'}% - \pgfplots@PREPARE@COORD@STREAM{#1}{#3}% - \pgfplots@coord@stream@foreach{#2}% -}% - -\newif\ifpgfplots@update@limits@for@one@point@ISCLIPPED -\def\pgfplots@math@ONE{1.0}% - -\def\pgfplots@streamerrorbarstart{% -}% -\def\pgfplots@streamerrorbarend{% -}% -\def\pgfplots@streamerrorbarcoords#1#2{% -}% - -\def\pgfplots@streamerrorbar@recordto#1{% - \def\pgfplots@streamerrorbarstart{% - \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@ - }% - \def\pgfplots@streamerrorbarend{% - \pgfplotsapplistXlet#1=\pgfplots@streamerrorbar@recordto@@ - \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@% clear - }% - \def\pgfplots@streamerrorbarcoords##1##2{% - \pgfplotsapplistXpushback{\pgfplots@errorbar@draw{##1}{##2}}\to\pgfplots@streamerrorbar@recordto@@ - }% -} -\def\pgfplots@streamerrorbar@directdraw{% - \def\pgfplots@streamerrorbarstart{}% - \def\pgfplots@streamerrorbarend{}% - \def\pgfplots@streamerrorbarcoords##1##2{% - \pgfplots@errorbar@draw{##1}{##2}% - }% -} - - - -% Updates the current x and y limits for point (#1,#2). -% -% The point coordinates may be given in floating point format, see -% below. -% -% Please note that if user specified limits are given, automatic -% limits are only applied to points which fall into the user specified -% clipping region. -% -% PRECONDITIONS: -% - the input coordinates have been parsed correctly (floating point -% format for linear axis, log applied for logarithmic ones) -% -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\long\def\pgfplots@update@limits@for@one@point#1#2#3#4{% -%\tracingmacros=2\tracingcommands=2 -%\pgfplots@message{Updating limits for (#1,#2) ...}% - \ifpgfplots@autocomputeanylimits - \pgfplots@update@limits@for@one@point@ISCLIPPEDfalse - \ifpgfplots@autocompute@all@limits - \else - % check whether we need to clip limits: - \ifpgfplots@clip@limits - \ifpgfplots@autocompute@xmin - \else - \ifpgfplots@xislinear - \pgfmathfloatlessthan@{#1}{\pgfplots@xmin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{#1}{\pgfplots@xmin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@xmax - \else - \ifpgfplots@xislinear - \pgfmathfloatlessthan@{\pgfplots@xmax}{#1}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{\pgfplots@xmax}{#1}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@ymin - \else - \ifpgfplots@yislinear - \pgfmathfloatlessthan@{#2}{\pgfplots@ymin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{#2}{\pgfplots@ymin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@ymax - \else - \ifpgfplots@yislinear - \pgfmathfloatlessthan@{\pgfplots@ymax}{#2}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{\pgfplots@ymax}{#2}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \fi - \fi - % - % - % - % Update limits: - \ifpgfplots@update@limits@for@one@point@ISCLIPPED - \else - \ifpgfplots@autocompute@xmin - \ifpgfplots@xislinear - \pgfmathfloatmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@xmax - \ifpgfplots@xislinear - \pgfmathfloatmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \else - \pgfmathmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@ymin - \ifpgfplots@yislinear - \pgfmathfloatmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@ymax - \ifpgfplots@yislinear - \pgfmathfloatmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\pgfmathresult - \else - \pgfmathmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\pgfmathresult - \fi - \fi - \fi - \fi - % - % Compute data range: - \ifpgfplots@autocompute@all@limits - \global\let\pgfplots@data@xmin=\pgfplots@xmin - \global\let\pgfplots@data@xmax=\pgfplots@xmax - \global\let\pgfplots@data@ymin=\pgfplots@ymin - \global\let\pgfplots@data@ymax=\pgfplots@ymax - \else - % Attention: it is only done for linear axis! - \ifpgfplots@xislinear - \pgfmathfloatmin@{\pgfplots@data@xmin}{#1}% - \global\let\pgfplots@data@xmin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@data@xmax}{#1}% - \global\let\pgfplots@data@xmax=\pgfmathresult - \fi - \ifpgfplots@yislinear - \pgfmathfloatmin@{\pgfplots@data@ymin}{#2}% - \global\let\pgfplots@data@ymin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@data@ymax}{#2}% - \global\let\pgfplots@data@ymax=\pgfmathresult - \fi - \fi -%\pgfplots@message{Updated limits: (\pgfplots@xmin,\pgfplots@ymin) rectangle (\pgfplots@xmax,\pgfplots@ymax).}% -%\tracingmacros=0\tracingcommands=0 -} -\let\pgfplots@update@limits@for@one@point@orig=\pgfplots@update@limits@for@one@point - -\def\pgfplots@invoke@filter#1#2{% - \pgfkeysvalueof{/pgfplots/#2 filter/.@cmd}#1\pgfeov% -}% - -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\def\pgfplots@process@one@point#1#2#3#4{% - \pgfplots@prepare@xcoord{#1}% - \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{x}% - \let\pgfplots@current@point@x=\pgfmathresult - % - \pgfplots@prepare@ycoord{#2}% - \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{y}% - \let\pgfplots@current@point@y=\pgfmathresult - % - \ifpgfplots@xislinear - \ifx\pgfplots@current@point@x\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@current@point@x}% - \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta - \ifnum\c@pgf@counta>2 - \let\pgfplots@current@point@x=\pgfutil@empty - \else - \let\pgfplots@current@point@x=\pgfmathresult - \fi - \fi - \fi - % - \ifpgfplots@yislinear - \ifx\pgfplots@current@point@y\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@current@point@y}% - \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta - \ifnum\c@pgf@counta>2 - \let\pgfplots@current@point@y=\pgfutil@empty - \else - \let\pgfplots@current@point@y=\pgfmathresult - \fi - \fi - \fi - % - \ifx\pgfplots@current@point@x\pgfutil@empty - \ifpgfplots@warn@for@filter@discards - \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the x-coordinate filter.}% - \fi - \else - \ifx\pgfplots@current@point@y\pgfutil@empty - \ifpgfplots@warn@for@filter@discards - \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}% - \fi - \else - % - \ifpgfplots@apply@datatrafo - \ifpgfplots@datascaletrafo@initialised - % apply data transformation directly. - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x\pgfplots@current@point@x - \let\pgfplots@current@point@x=\pgfmathresult - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y\pgfplots@current@point@y - \let\pgfplots@current@point@y=\pgfmathresult - \fi - \fi - \fi - % All following routines (limit updating/stacking/error - % bars) will use float numerics if necessary (controlled - % by ifs). - \ifpgfplots@stackedmode - \pgfplots@stacked@preparepoint@inmacro{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \ifpgfplots@datascaletrafo@initialised% is also true if there is no scale trafo. - \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \else - % the finishpoint routine will be invoked at - % \endaxis. - \fi - \fi - % update also axis / data limits: - \pgfplots@update@limits@for@one@point{\pgfplots@current@point@x}{\pgfplots@current@point@y}{}{}% - \ifpgfplots@errorbars@enabled - \pgfplots@process@errorbar@for{\pgfplots@current@point@x}{\pgfplots@current@point@y}{#3}{#4}{#1}{#2}% - \fi - % - \edef\pgfplots@loc@TMPa{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXpushback\expandafter{\pgfplots@loc@TMPa}% - %\t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% - %\edef\pgfplots@coord@stream@recorded{\the\t@pgfplots@tokc (\pgfplots@current@point@x,\pgfplots@current@point@y)}% - % - \ifpgfplots@collect@firstplot@astick - \ifnum\pgfplots@numplots=0 - \ifx\pgfplots@firstplot@coords@x\pgfutil@empty - \t@pgfplots@tokc=\expandafter{}% - \else - \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@x,}% - \fi - \edef\pgfplots@firstplot@coords@x{\the\t@pgfplots@tokc\pgfplots@current@point@x}% - \ifx\pgfplots@firstplot@coords@y\pgfutil@empty - \t@pgfplots@tokc=\expandafter{}% - \else - \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@y,}% - \fi - \edef\pgfplots@firstplot@coords@y{\the\t@pgfplots@tokc\pgfplots@current@point@y}% - \fi - \fi - \fi - \fi - % - % increase \pgfplots@current@point@coordindex: - \begingroup - \c@pgf@counta=\pgfplots@current@point@coordindex - \advance\c@pgf@counta by1\relax - \edef\pgfmathresult{\the\c@pgf@counta}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgfplots@current@point@coordindex=\pgfmathresult -} - -% Internal stream methods. -% -% Please overwrite \pgfplots@coord@stream@start@, -% \pgfplots@coord@stream@end@ and \pgfplots@coord@stream@coord@ -% if you implement streams. -% -% FIXME: REPLACE THIS HERE WITH METHODS OF THE VISUALIZATION FRAMEWORK -\newif\ifpgfplots@coord@stream@isfirst -\def\pgfplots@coord@stream@start{% - \pgfplots@coord@stream@isfirsttrue - \pgfplots@coord@stream@start@}% -\def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@} - -% Will be invoked for every point coordinate. -% -% It invokes \pgfplots@coord@stream@coord@. -% It is expected to assign \pgfplots@current@point@x and -% \pgfplots@current@point@y -% -% It is expected to -% (#1,#2) : x, y coordinates -% (#3,#4) : any x, y errors (or empty) -\def\pgfplots@coord@stream@coord#1#2#3#4{% - \pgfplots@coord@stream@coord@{#1}{#2}{#3}{#4}% - \ifpgfplots@coord@stream@isfirst - \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty - \else - \ifx\pgfplots@currentplot@firstcoord@y\pgfutil@empty - \else - \let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y - \pgfplots@coord@stream@isfirstfalse - \fi - \fi - \fi - \ifx\pgfplots@current@point@x\pgfutil@empty - \else - \ifx\pgfplots@current@point@y\pgfutil@empty - \else - \let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y - \fi - \fi -}% - -% A looping method which applies -% \pgfplots@coord@stream@start -% for each coordinate '(x,y)' or '(x,y) +- (ex,ey)', call -% \pgfplots@coord@stream@coord{x}{y}{ex}{ey} -% \pgfplots@coord@stream@end -% -% #1 a sequence of coordinates of the form -% '(x,y)' -% or -% '(x,y) +- (ex,ey)' -% separated by white-space. -\long\def\pgfplots@coord@stream@foreach#1{% - \pgfplots@coord@stream@start - \pgfplots@foreach@plot@coord@do% - \pgfplots@coord@stream@coord - \for - plot coordinates {#1};% - \pgfplots@EOI - \pgfplots@coord@stream@end -}% - -% this is a convenience macro to save storage in the long coordinate -% lists. -\def\pgfplots@stream#1#2{\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} - -\newif\ifpgfplots@record@marker@stream -% Takes a sequence of PREPARED coordinates which are given in floating -% point representation and applies the data scaling trafo (if -% necessary). -% -% Any coordinate will be plotted with the selected PGF plot handler. -% -% This stream is designed to be done at the end of an axis. -% See \pgfplots@coord@stream@finalize@storedcoords@START -% -% #1 : a macro which will be filled with a pgf plot stream for the -% marker points. -\def\pgfplots@coord@stream@INIT@finalize@storedcoords#1{% - % - % Init the plot handlers: - \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler - \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% - % - \ifx\tikz@plot@mark\pgfutil@empty - % mark=none : no need to waste time collecting marker - % positions. - \pgfplots@record@marker@streamfalse - \else - \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard - \ifpgfplots@clip@marker@paths - % only marks: draw markers directly; no need for the - % two-pass-approach. - \let\pgfplots@basiclevel@plothandler=\relax - \pgfplots@install@plotmark@handler - \pgfplots@record@marker@streamfalse - \else - % collect mark positions... they will be drawn after - % the clipped axis range. Clipping will only be - % applied to their *positions*, not their paths. - \pgfplots@record@marker@streamtrue - \fi - \else - % ok, mark!=none and we also have a plot handler. - % So, collect mark positions! - \pgfplots@record@marker@streamtrue - \fi - \fi - \gdef#1{}% - % - % Now, set up coordinate streams. - \def\pgfplots@coord@stream@start@{% - \ifpgfplots@apply@datatrafo - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - \fi - \pgfplots@basiclevel@plothandler - \pgfplotstreamstart - \let\pgfplots@data@scaletrafo@result=\pgfutil@empty - \ifpgfplots@record@marker@stream - \pgfplotsapplistXXnewempty - \pgfplotsapplistXXpushback{\pgfplotstreamstart}% - %\gdef#1{\pgfplotstreamstart}% - \fi - }% - \def\pgfplots@coord@stream@end@{% - \ifpgfplots@apply@datatrafo - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa - \pgfplots@loc@TMPa - \fi - \pgfplotstreamend - \ifpgfplots@record@marker@stream - \pgfplotsapplistXXpushback{\pgfplotstreamend}% - \pgfplotsapplistXXflushbuffers% - \global\let#1=\pgfplotsapplistXX - \pgfplotsapplistXXclear - %\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}% - \fi - }% - \ifpgfplots@apply@datatrafo - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \pgfplots@apply@data@scaletrafo@to@one@point{##1}{##2}{##3}{##4}% - \pgfplots@coord@stream@finalize@currentpt - }% - \else - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \def\pgfplots@current@point@x{##1}% - \def\pgfplots@current@point@y{##2}% - \pgfplots@coord@stream@finalize@currentpt - }% - \fi - % - \def\pgfplots@coord@stream@finalize@currentpt{% - \pgfqpointxy{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \ifpgfplots@record@marker@stream - \ifdim\pgf@x<\pgfplots@xcoordminTEX - \else - \ifdim\pgf@x>\pgfplots@xcoordmaxTEX - \else - \ifdim\pgf@y<\pgfplots@ycoordminTEX - \else - \ifdim\pgf@y>\pgfplots@ycoordmaxTEX - \else - \edef\pgfmathresult{\noexpand\pgfplots@stream{\the\pgf@x}{\the\pgf@y}}% - \expandafter\pgfplotsapplistXXpushback\expandafter{\pgfmathresult}% - \fi - \fi - \fi - \fi - \fi - \pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y! - }% -} -\def\pgfplots@addplot@get@named@startendpoints@command#1{% - \edef#1{% - \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfqpointxy{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}}% - \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfqpointxy{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}}% - }% -}% - -% INPUT: -% either floating point or fixed point coordinates (depending on the -% state of the \ifpgfplots@apply@datatrafo boolean) -% -\long\def\pgfplots@coord@stream@finalize@storedcoords@START plot coordinates #1#2;\pgfplots@EOI{% - \pgfplots@assert@tikzinternal@exists{tikz@make@last@position}% - \pgfplots@stored@current@cmd[current plot style] - \pgfextra - \tikzset{every plot/.try}% - \pgfplots@coord@stream@INIT@finalize@storedcoords\pgfplots@recorded@marker@stream% - \pgfplots@coord@stream@foreach{#1}% - \tikz@make@last@position{\pgfplotlastpoint}% - \endpgfextra - #2; - \ifx\pgfplots@recorded@marker@stream\pgfutil@empty - \else - \ifpgfplots@clip@marker@paths - % Draw markers on top of the plot lines: - % - % FIXME: inefficient! Use \scope to set variables of 'current plot style' !? - \pgfplots@stored@current@cmd[current plot style] - \pgfextra - \pgfplots@install@plotmark@handler - \pgfplots@recorded@marker@stream - \endpgfextra - ; - \else - % sigh... ok, store the marker list (once more again). - % They need to be drawn after the clipped area. - \pgfplots@stored@REMEMBER@MARK@COMMAND - \fi - \fi - \gdef\pgfplots@recorded@marker@stream{}% clear -}% - -% This method MUST be called while \pgfplots@stored@plotlist is -% evaluated, that means -% - \pgfplots@stored@* commands need to be valid, -% - the precommand has already been invoked. -% - pgfplots@recorded@marker@stream exists -% - current plot style is valid -\def\pgfplots@stored@REMEMBER@MARK@COMMAND{% - \pgfkeysgetvalue{/tikz/current plot style/.@cmd}{\pgfplots@loc@TMPa}% - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\pgfeov}% - \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@cmd[current plot style]}% - \t@pgfplots@tokc=\expandafter{\pgfplots@recorded@marker@stream}% - \edef\pgfplots@loc@TMPa{% - \noexpand\pgfkeysdef{/tikz/current plot style}{\the\t@pgfplots@toka}% - \the\t@pgfplots@tokb - \noexpand\pgfextra - \noexpand\pgfplots@install@plotmark@handler - \the\t@pgfplots@tokc - \noexpand\endpgfextra - ;}% - \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}\to\pgfplots@stored@markerlist -}% - -\def\pgfplots@install@plotmark@handler{% - \pgfplots@assert@tikzinternal@exists{tikz@options}% - % note: I can't check on tikz@transform because it can be - % '\relax'. - \pgfplots@gettikzinternal@keyval{mark indices}{tikz@mark@list}{}% - \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% - % - % do not reset \tikz@options: draw color may be acquired - % from 'current plot style' - %\let\tikz@options=\pgfutil@empty% - \let\tikz@transform=\pgfutil@empty% - \tikzset{every plot/.try,every mark}% - \tikz@options - \ifx\tikz@mark@list\pgfutil@empty% - \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% - \else - \pgfplothandlermarklisted{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}{\tikz@mark@list}% - \fi -}% - -% A looping command to loop through plot coordinates. -% For every point, #1{X}{Y} will be invoked. -% -% No scoping is used during this operation, so you can access outer -% variables. -\long\def\pgfplots@foreach@plot@coord@do#1\for plot coordinates #2;\pgfplots@EOI{% - \def\pgfplots@foreach@plot@coord@do@CMD{#1}% - \pgfplots@foreach@plot@coord@ITERATE#2\pgfplots@EOI% -} - -\def\pgfplots@foreach@plot@coord@ITERATE{% - \pgfutil@ifnextchar\pgfplots@EOI{% - \pgfplots@foreach@plot@coord@FINISH% - }{% - \pgfplots@foreach@plot@coord@NEXT% + \catcode`\;=\active + \globaldefs=1 + % 'AS' == 'active semicolon' + \def\pgfplots@path@AS#1;{\pgfplots@path@enqueue{#1;}}% + \long\def\pgfplots@replacement@for@tikz@path@AS#1;{% + \axispath\path#1;% }% -} - -\def\pgfplots@foreach@plot@coord@NEXT(#1,#2){% - \pgfutil@ifnextchar+{% - \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE{#1}{#2}% - }{% - \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{}{}% - \pgfplots@foreach@plot@coord@ITERATE + \pgfplots@appendto@activesemicolon@switcher{% + \let\pgfplots@path=\pgfplots@path@AS + \let\pgfplots@replacement@for@tikz@path=\pgfplots@replacement@for@tikz@path@AS }% } -% processing something like '(x,y) +- (error_x,error_y)' -\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE#1#2+-#3({% - \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@{#1}{#2}% -} -\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@#1#2#3,#4){% - \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{#3}{#4}% - \pgfplots@foreach@plot@coord@ITERATE -} - -\def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{} - - -% #1= x coord -% #2= y coord -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\def\pgfplots@apply@data@scaletrafo@to@one@point#1#2#3#4{% - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x{#1}% - \let\pgfplots@current@point@x=\pgfmathresult - \else - \def\pgfplots@current@point@x{#1}% - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y{#2}% - \let\pgfplots@current@point@y=\pgfmathresult - \else - \def\pgfplots@current@point@y{#2}% - \fi - \ifpgfplots@stackedmode - % all these calls work with pgfmath; no more floating point - % arithmetics are applied. - \pgfplots@stacked@getnextzerolevelpoint - \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \fi -% \t@pgfplots@tokc=\expandafter{\pgfplots@data@scaletrafo@result}% -% \edef\pgfplots@data@scaletrafo@result{\the\t@pgfplots@tokc(\pgfplots@current@point@x,\pgfplots@current@point@y)}% -} - -% This thing here shall draw all error bar commands listed in '#2'. -% -% It will be invoked when any plotting commands take effect (that -% means all limits are computed; the axis has been drawn, -% transformations are set up...) -\def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{% - \scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it used the /pgfplots/.unknown - #2% - \endscope -} - -\def\pgfplots@errorbar@draw@float(#1,#2)(#3,#4){% - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x{#1}% - \let\pgfplots@xarg=\pgfmathresult% - \pgfplots@datascaletrafo@x{#3}% - \let\pgfplots@error@xarg=\pgfmathresult% - \else - \def\pgfplots@xarg{#1}% - \def\pgfplots@error@xarg{#3}% - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y{#2}% - \let\pgfplots@yarg=\pgfmathresult% - \pgfplots@datascaletrafo@y{#4}% - \let\pgfplots@error@yarg=\pgfmathresult% - \else - \def\pgfplots@yarg{#2}% - \def\pgfplots@error@yarg{#4}% - \fi - \edef\pgfplots@loc@TMPa{{(\pgfplots@xarg,\pgfplots@yarg)}{(\pgfplots@error@xarg,\pgfplots@error@yarg)}}% - \def\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}}% - \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfeov -} - -\def\pgfplots@errorbar@draw#1#2{% - \begingroup - \ifpgfplots@apply@datatrafo - \pgfplots@errorbar@draw@float#1#2 - \else - \pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov% - \fi - \endgroup -}% - -% Also provides UNFILTERED arguments x (#5) and y (#6). These are use -% in case of logplots, because we may need to compute log( x + e_x ) -% or log( y + e_y ). -\def\pgfplots@process@errorbar@for#1#2#3#4#5#6{% -% \begingroup - \edef\pgfplots@xarg{#1}% - \edef\pgfplots@yarg{#2}% - \def\pgfplots@xarg@unfiltered{#5}% - \def\pgfplots@yarg@unfiltered{#6}% - \edef\pgfplots@error@xarg{#3}% - \edef\pgfplots@error@yarg{#4}% - \def\pgfplots@loc@TMPa{0}% - \ifx\pgfplots@loc@TMPa\pgfplots@error@xarg - \let\pgfplots@error@xarg=\pgfutil@empty - \fi - \ifx\pgfplots@loc@TMPa\pgfplots@error@yarg - \let\pgfplots@error@yarg=\pgfutil@empty - \fi - % FIXME : INEFFICIENT! This code here does every computation - % multiple times! - \ifcase\pgfplots@errorbars@xdirection - \or - \pgfplots@process@errorbar@@for{x}{+}1% - \or - \pgfplots@process@errorbar@@for{x}{-}2% - \or - \pgfplots@process@errorbar@@for{x}{+}1% - \pgfplots@process@errorbar@@for{x}{-}2% - \fi - \ifcase\pgfplots@errorbars@ydirection - \or - \pgfplots@process@errorbar@@for{y}{+}1% - \or - \pgfplots@process@errorbar@@for{y}{-}2% - \or - \pgfplots@process@errorbar@@for{y}{+}1% - \pgfplots@process@errorbar@@for{y}{-}2% - \fi -% \endgroup -} - -% #1: either 'x' or 'y' -% #2: either '+' or '-' -% #3: an integer representing the argument #2. It is '1' if #2='+' -% and '2' is #2 = '-'. -\def\pgfplots@process@errorbar@@for#1#2#3{% - \csname ifpgfplots@#1islinear\endcsname - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \ifcase\csname pgfplots@errorbars@#1mode\endcsname - % fixed absolute error. - \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \let\pgfplots@error@coord=\pgfmathresult - \or% fixed relative error: - \pgfmathparse{(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \or% explicit absolute: - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \let\pgfplots@error@coord=\pgfmathresult - \fi - \or% explicit relative: - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathparse{(1#2\pgfplots@error@coord)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \fi - \fi - \else - % LOGARITHMIC scaling. All errors are interpreted as - % log(x +- e_x) - % or - % log( x*(1+-e_x) ) - \ifcase\csname pgfplots@errorbars@#1mode\endcsname - % fixed absolute, log( x +- e_x ) - \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatparsenumber{\pgfplots@error@src}% - \let\pgfplots@error@src=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \pgfmathlog@float{\pgfmathresult}% - \let\pgfplots@error@coord=\pgfmathresult - \or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x) - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \pgfmathparse{\pgfplots@error@src + ln(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \let\pgfplots@error@coord=\pgfmathresult% - \or% explicit absolute - \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatparsenumber{\pgfplots@error@src}% - \let\pgfplots@error@src=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \pgfmathlog@float{\pgfmathresult}% - \let\pgfplots@error@coord=\pgfmathresult - \fi - \or% explicit relative: - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathparse{\pgfplots@error@src + ln(1#2 \pgfplots@error@coord)}% - \let\pgfplots@error@coord=\pgfmathresult% - \fi - \fi - \fi - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \pgfplots@update@limits@for@one@point{\pgfplots@error@coord}{\pgfplots@yarg}{}{}% - \edef\pgfplots@loc@TMPa{% - {(\pgfplots@xarg,\pgfplots@yarg)}% - {(\pgfplots@error@coord,\pgfplots@yarg)}% - }% - \else - \pgfplots@update@limits@for@one@point{\pgfplots@xarg}{\pgfplots@error@coord}{}{}% - \edef\pgfplots@loc@TMPa{% - {(\pgfplots@xarg,\pgfplots@yarg)}% - {(\pgfplots@xarg,\pgfplots@error@coord)}% - }% - \fi - \expandafter\pgfplots@streamerrorbarcoords\pgfplots@loc@TMPa - \fi -} - -\long\def\pgfplots@path#1;{% - \pgfplots@path@enqueue{#1;}% -} - -% This thing here shall be used to replace any '\path' where \axispath -% shall be used. -\long\def\pgfplots@replacement@for@tikz@path#1;{% - \axispath\path#1;% -} - % Will be available as \closedcycle command inside of an axis. % @@ -3886,30 +2300,6 @@ \advance\pgfplots@numplots by-1 }} -% This routine is called at the begin of every plot. -% It initialised a zero level stream. -% -% The default is to use '0' as zero level streams. -% -% This method is called as "precommand"; before any Tikz drawing -% commands have been started. -\def\pgfplots@initzerolevelhandler{% - \ifpgfplots@stackedmode - % ATTENTION: this thing here says: - % "draw zero level coordinates from list XYZ." - % But at the time of this initialisation, the list will be EMPTY! - % - % It will be filled later. That's ok, because - % \pgfplots@initzerolevelhandler will be - % used as 'precommand', that means before Tikz sees any - % coordinates. - \pgfplots@stacked@initzerolevelhandler - \else - \pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}% - \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% - \fi -} - \def\pgfplots@try@mirror@plot@handler{% \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler % this method assigns '\tikz@plot@handler'. @@ -3998,7 +2388,7 @@ \curcolumnNum=0 \maxcolumnCount=\pgfplots@legend@columns\relax % - \loop + \pgfutil@loop \ifnum0<\pgfplots@numplots\relax \pgfplots@pop@next@legend \ifx\pgfplots@curlegend\pgfutil@empty @@ -4032,7 +2422,15 @@ \ifnum\curcolumnNum=\maxcolumnCount \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else + \pgfplotslistcheckempty\pgfplots@legend \ifnum\pgfplots@numplots=0 + \pgfplotslistemptytrue + \fi + \ifpgfplotslistempty + % Ok, either the legend list is empty or + % there are no more plots. + % + % Finalize matrix: \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\pgfmatrixnextcell}% @@ -4048,7 +2446,7 @@ \fi \expandafter\t@pgfplots@toka\expandafter{\pgfplots@glob@TMPa}% \fi - \repeat + \pgfutil@repeat \t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}% \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\plotnum{0}% @@ -4064,90 +2462,7 @@ \pgfplots@already@computed@legend@node } -\newif\ifpgfplots@checkuniform@isfirst -% 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: -% \pgfplots@isuniformticktrue -% or -% \pgfplots@isuniformtickfalse -% depending on the check. -% This variable will be set globally. -\def\pgfplots@checkisuniformLOGtick#1{% - \begingroup - \global\pgfplots@isuniformticktrue - \pgfplots@checkuniform@isfirsttrue - \foreach \x in {#1}{% - \pgfmathmultiply@\x\reciproclogten - \let\cur=\pgfmathresult - % check whether - % \cur - last == 1 (last = \pgfplots@glob@TMPb) - \ifpgfplots@checkuniform@isfirst - \global\pgfplots@checkuniform@isfirstfalse - \else - \pgfmathsubtract@\cur\pgfplots@glob@TMPb% - \pgfmathapproxequalto@\pgfmathresult{1.0}% - \ifpgfmathcomparison - \else - \global\pgfplots@isuniformtickfalse - \breakforeach - \fi - \fi - \global\let\pgfplots@glob@TMPb=\cur - }% - \endgroup -} - -% Checks whether the linear tick sequence #1 is a uniform tick. -% -% It also assigns pgfplots@tick@distance@#1 as the distance. -% -% see \pgfplots@checkisuniformLOGtick for details. -% -% #1: a tick sequence (expanded) -% #2: a macro which will be filled with the tick distance. This is -% only valid if \pgfplots@isuniformticktrue. -\def\pgfplots@checkisuniformLINEARtick#1#2{% - \begingroup - \global\pgfplots@isuniformticktrue - \pgfplots@checkuniform@isfirsttrue - \global\let\pgfplots@glob@TMPb=\pgfutil@empty - \global\def\pgfplots@glob@TMPa{1}% - \foreach \x in {#1}{% - \ifx\pgfplots@glob@TMPb\pgfutil@empty - \else - \pgfmathsubtract@\x\pgfplots@glob@TMPb - \ifpgfplots@checkuniform@isfirst - % remember first distance h = x_1 - x_0 - \global\let\pgfplots@glob@TMPa=\pgfmathresult - \global\pgfplots@checkuniform@isfirstfalse - \else - % check whether x_i - x_{i-1} = h - \pgfmathapproxequalto@\pgfmathresult\pgfplots@glob@TMPa% - \ifpgfmathcomparison - \else - \global\pgfplots@isuniformtickfalse - \breakforeach - \fi - \fi - \fi - \global\let\pgfplots@glob@TMPb=\x% - }% - \endgroup - \let#2=\pgfplots@glob@TMPa -} - +% DEPRECATED. \def\skipsuffixzero#1.#2|{ {% \def\pgfplots@loc@TMPa{#2}% @@ -4184,20 +2499,6 @@ \pgfmathresult } -% helper method which computes log10*\x foreach \x in {#1}. -% The result will be \xdef'ed into #2. -\def\pgfplots@compute@tick@times@logten#1\to#2{% - \global\let#2=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathmultiply@\pgfplots@loc@TMPb\logten% - \ifx#2\pgfutil@empty - \xdef#2{\pgfmathresult}% - \else - \xdef#2{#2,\pgfmathresult}% - \fi - }% -} - \def\pgfplots@enlarge@limit@ifconfigured#1{% \pgfplots@enlargelimits@autofalse \pgfplots@enlargelimitsfalse @@ -4297,423 +2598,8 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb } -% Computes tick positions using the current axis limits. -% -% Parameters: -% /pgfplots/max space between ticks -% Determines the maximum space which is not filled by at least one -% tick label (approximate, there is some rounding internally) -% /pgfplots/try min ticks -% 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 / (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 -% { 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! -% -% For log-plots, -% H in { j*log(10), j=1,2,3,... } -% where the usual case should be j = 1. -% -% 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. -% -% Again, log plots follow a slightly different approach: here, -% MIN = I * log(10) -% is chosen such that -% axis minimum limit = I*log(10) + rest; |rest| < log(10) -% while H = j*log(10), j>=1. -% -% -% PRECONDITION: -% - limits are correct -% - axis width/height is set correctly -% -% POSTCONDITION: -% - Tick for axis #1 is assigned -% - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick is set -% -% REMARKS: -% - this algorithms works also if the data range has been transformed -% with a LINEAR transformation. -% ATTENTION: as of 2008-05-15, the scaling trafo is AFFINE LINEAR. -% That means we have to eliminate the 'affine' shifting before the -% algorithms works correctly. -\def\pgfplots@assign@default@tick@foraxis#1{% - \begingroup - % Shortcut-names: - \expandafter\let\expandafter\ifpgfplots@is@datascaled\csname ifpgfplots@apply@datatrafo@#1\endcsname - % Attention here: use UNSHIFTET scalings, see remark above - \expandafter\let\expandafter\pgfplots@data@scale@trafo\csname pgfplots@datascaletrafo@#1@noshift\endcsname - \expandafter\let\expandafter\pgfplots@data@scale@inverse@trafo\csname pgfplots@inverse@datascaletrafo@#1@noshift\endcsname - \expandafter\let\expandafter\ifpgfplots@cur@is@linear\csname ifpgfplots@#1islinear\endcsname - % - \let\desirednumticks=\c@pgf@countd - \let\Wr=\pgf@xc - \Wr=\csname pgfplots@#1coordmaxTEX\endcsname - \advance\Wr by-\csname pgfplots@#1coordminTEX\endcsname - % r = max place without ticks in pt -> choose desirednumticks >= W/r - \expandafter\expandafter\divide\Wr\axisdefaulttickwidth - \pgfmathsetcount{\desirednumticks}{\Wr}% - \advance\desirednumticks by1 - \csname ifpgfplots@#1islinear\endcsname - \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks - \desirednumticks=\axisdefaulttryminticks - \fi - \else - \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks - \desirednumticks=\pgfplots@default@try@minticks@log\relax - \fi - \expandafter\ifx\csname pgfplots@#1tickten\endcsname\pgfutil@empty - \else - % log plot and tickten-option: provide special processing. - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tickten\endcsname}% - \expandafter\pgfplots@compute@tick@times@logten\pgfplots@loc@TMPa\to\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa - \fi - \fi - % - \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty - % Ok, we have either log or linear axis and need default - % ticks MIN,MIN+H,...,MAX. - \let\MINH=\pgf@xa - \let\H=\pgf@xb - \let\MAX=\pgf@ya - \let\MIN=\pgf@yb - % compute step size 'H': - \expandafter\MAX\csname pgfplots@#1max\endcsname pt - \advance\MAX by0.001pt% avoid round errors - %\expandafter\MIN\the\c@pgf@counta pt - \expandafter\MIN\csname pgfplots@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN -%\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.}% - \c@pgf@counta=\desirednumticks - \advance\c@pgf@counta by-1 - \divide\H by\c@pgf@counta -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - \edef\Hmacro{\pgf@sys@tonumber\H}% - \ifpgfplots@cur@is@linear - % CASE LINEAR AXIS - \ifpgfplots@is@datascaled - % This here works if the scaling trafo is linear. - \expandafter\pgfplots@data@scale@inverse@trafo\expandafter{\Hmacro}% - \let\Hmacro=\pgfmathresult - \else - \pgfmathfloatparsenumber{\Hmacro}% - \let\Hmacro=\pgfmathresult - \fi - \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E -%\message{Got T^{-1}(H#1) = \Hmacro}% - % modify the mantisse: - \ifdim\H<2pt - \ifdim\H<1.5pt - \H=1.0pt - \else - \H=2.0pt - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \H=2.0pt\relax - \else - \H=5.0pt\relax - \fi - \else - \ifdim\H<7.5pt - \H=5.0pt\relax - \else - \H=1.0pt\relax - \advance\pgfmathfloat@a@E by1 - \fi - \fi - \fi -%\message{Computed H#1=\the\H [unscaled]; transforming ... }% - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% - \let\Hmacro=\pgfmathresult - \ifpgfplots@is@datascaled - \pgfplots@data@scale@trafo\Hmacro - \else - \pgfmathfloattofixed\Hmacro - \fi - \let\Hmacro=\pgfmathresult -%\message{got H#1=\Hmacro\ [transformed]}% - \expandafter\H\Hmacro pt - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname - % - % 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 - % - % but first: eliminate any 'affine' data scaling! - \ifpgfplots@is@datascaled - \advance\MIN by\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt - \fi - \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 - \ifpgfplots@is@datascaled - \advance\MIN by-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt - \fi - \else - % CASE LOG AXIS - % - % search for the "best" H= j* log(10), j an integer. - % - % And prefer j=1 if that is possible (otherwise minor - % ticks are not useful). - \pgfmathmultiply@{\Hmacro}{\reciproclogten}% - \let\Hmacrobaseten=\pgfmathresult - \expandafter\H\pgfmathresult pt -%\message{ [ H / log(10) = \pgfmathresult ]}% - \ifdim\H<2pt - \H=1pt - \else - \ifnum\H<1pt - \H=1pt - \else - \expandafter\pgfmathfloor\expandafter{\pgfmathresult}% - \expandafter\H\pgfmathresult pt - \fi - \fi - \ifdim\H=1pt - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname - \pgfplots@isuniformticktrue - \else - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformfalse\endcsname - \pgfplots@isuniformtickfalse - \fi -%\message{final H=\pgf@sys@tonumber{\H} * log(10)}% - \H=\logten\H\relax - % Now, we want to activate the Tick set - % {lowest, lowest+H, ..., highest} - % - % Where - % lowest = I * log(10) + rest, |rest| < log(10). - % this is conceptionally different from the approach for - % linear axes, because H = j*log(10). - % - % remember the original xmin in MINH: - \MINH=\MIN - % - % and compute I and I*log(10) here: - \expandafter\MIN\reciproclogten\MIN\relax - \edef\pgfmathresult{\pgf@sys@tonumber{\MIN}}% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \expandafter\MIN\logten pt - \multiply\MIN by\c@pgf@counta - \ifpgfplots@isuniformtick - \else - % This here is a special case to move the first tick - % 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 - % 10^{-5}, 10^{-3}, 10^{-1} - % or - % 10^{-4}, 10^{-2} - % as ticks. Well, I prefer the first one. - % - % HEURISTICS: start as near to ymin as possible! - % - % We check here if we can come nearer to ymin if we - % 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 - % 2*(ymin - I * log(10)) - H < 0. - \advance\MINH by-\MIN - \multiply\MINH by2 - \advance\MINH by-\H - % - \ifdim\MINH<0pt - \expandafter\advance\expandafter\MIN\logten pt - \fi - \fi - \fi - \MINH=\MIN - \advance\MINH by\H - % Ok, now it can happen that only ONE tick label is placed in - % this range. - % That's useless, so check for it. - % - % That's the case if - % MIN < ORIGMIN && MAX < MIN+2 H - % MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by - % construction, but I don't care about this case). - % So: check only the second condition. - \pgfplots@tmpa=\MINH - \advance\pgfplots@tmpa by\H - \ifdim\MAX<\pgfplots@tmpa - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformfalse\endcsname - % ok, do something special. - % - % The idea is now to place ticks at - % 10^{i*h} with properly choosen 'h'. - % - % So: apply basically the SAME code as above for linear - % axis, just everything log 10! And keep in mind that all - % coordinates are actually given as natural logarithms. - \expandafter\MIN\csname pgfplots@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN - \H=\reciproclogten\H -%\message{Axis limit #1: [\the\MIN:\the\MAX], diff/log(10) = \the\H.}% - \c@pgf@counta=\desirednumticks\relax - \advance\c@pgf@counta by-1 - \ifnum\c@pgf@counta>2 - % subtract one more. This algorithm here produces more - % ticks than the normal one which is designed for 10^i - \advance\c@pgf@counta by-1 - \fi - \divide\H by\c@pgf@counta\relax -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - \edef\Hmacro{\pgf@sys@tonumber\H}% - \pgfmathfloatparsenumber{\Hmacro}% - \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E - % Determine properly snapped mantisse... - \ifdim\H<2pt - \ifdim\H<1.5pt - \H=1.0pt - \else - \H=2.0pt - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \H=2.0pt\relax - \else - \H=5.0pt\relax - \fi - \else - \ifdim\H<7.5pt - \H=5.0pt\relax - \else - \H=1.0pt\relax - \advance\pgfmathfloat@a@E by1 - \fi - \fi - \fi - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\Hmacro=\pgfmathresult - \H=\Hmacro pt% - % Ok, our step size h for 10^{i*h} is ready! -%\message{determined step size 10^{\Hmacro}}% - % Now, we want to activate the Tick set {10^{i*H}, i in \Z} - % compute I such that - % 10^{min} = 10^{I * H + rest}; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - % BUT EVERYTHING to log(10) basis! - \MIN=\reciproclogten\MIN\relax - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\Hmacro}% - }% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \MIN=\H\relax - \multiply\MIN by\c@pgf@counta\relax - % - % convert back to basis 'e': - \MIN=\logten\MIN\relax - \H=\logten\H\relax - \MINH=\MIN\relax - \advance\MINH by\H\relax - \fi -%\pgfplots@message{final H=\the\H.}% - \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\H}}% - \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformtickfalse - \else - \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname - \gdef\pgfplots@glob@TMPb{}% will be computed later, in 'check uniform tick' - \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformticktrue - \fi - \endgroup - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@glob@TMPb -%\pgfplots@message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% -} -% Helper method for -% \pgfplots@apply@data@scale@trafo@to@options@for -% #1: the ticks -% #2: the trafo macro name -% #3: the output macro name -\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% - \let#3=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathfloatparsenumber{\pgfplots@loc@TMPb}% - \expandafter#2\expandafter{\pgfmathresult}% - \ifx#3\pgfutil@empty - \xdef#3{\pgfmathresult}% - \else - \xdef#3{#3,\pgfmathresult}% - \fi - }% - % -}% - -% Helper method for -% \pgfplots@apply@data@scale@trafo@to@options@for -% #1: the ticks ALREADY IN FLOAT FORMAT -% #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 - \foreach \pgfplots@loc@TMPb in {#1} {% - #2{\pgfplots@loc@TMPb}% - \ifx#3\pgfutil@empty - \xdef#3{\pgfmathresult}% - \else - \xdef#3{#3,\pgfmathresult}% - \fi - }% - % -}% - -% helper for \pgfplots@apply@data@scale@trafo@to@options@for. +% helper for \pgfplots@check@and@apply@datatrafo@for. \def\pgfplots@compute@number@order@for@trafo@isdimen#1\tocount#2{% \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{#1}}% \pgfmathfloatparsenumber{\pgfplots@loc@TMPa}% @@ -4721,7 +2607,7 @@ \advance#2 by1\relax } -% helper for \pgfplots@apply@data@scale@trafo@to@options@for. +% helper for \pgfplots@check@and@apply@datatrafo@for. % \def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{% \expandafter\pgfmathfloat@decompose@E#1\relax#2\relax @@ -4738,210 +2624,235 @@ % - the scaling transformation is set up, % - all axis limits are transformed, % - any user input (like ticks and tick labels) -% will reflect the changes. -\def\pgfplots@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@tmp=\pgf@xb - \let\data@dimen@order=\c@pgf@countc - \let\data@EXPONENT=\c@pgf@countd - \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname - \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname - \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname - \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname - \ifpgfplots@autocompute@all@limits - \else - \pgfmathfloatmax@{\pgfplots@display@max@float}{\pgfplots@data@max@float}% - \let\pgfplots@data@max@float=\pgfmathresult - \pgfmathfloatmin@{\pgfplots@display@min@float}{\pgfplots@data@min@float}% - \let\pgfplots@data@min@float=\pgfmathresult - \fi - % - % 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@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 - % We have 'width' or 'height'. +% EXCEPT unit vectors will reflect the changes. +% +% Unit vectors will be scaled later. +\def\pgfplots@check@and@apply@datatrafo@for#1{% + \expandafter\let\expandafter\if@datascaled@cur\csname ifpgfplots@apply@datatrafo@#1\endcsname + \if@datascaled@cur + \pgfplots@letcsname pgfplots@#1min@unscaled@as@float={pgfplots@#1min}% + \pgfplots@letcsname pgfplots@#1max@unscaled@as@float={pgfplots@#1max}% + % initialise data scale transformation + % T(x) = 10^{q-m} * x % - % Use the order of these parameters. - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@width\relax + \begingroup + \let\data@max@order=\c@pgf@counta + \let\data@cur@order=\c@pgf@countb + \let\data@dimen=\pgf@xa + \let\data@tmp=\pgf@xb + \let\data@dimen@order=\c@pgf@countc + \let\data@EXPONENT=\c@pgf@countd + \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname + \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname + \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname + \ifpgfplots@autocompute@all@limits \else - \def\pgfplots@loc@TMPb{y}% + \pgfplotsmathfloatmax{\pgfplots@display@max@float}{\pgfplots@data@max@float}% + \let\pgfplots@data@max@float=\pgfmathresult + \pgfplotsmathfloatmin{\pgfplots@display@min@float}{\pgfplots@data@min@float}% + \let\pgfplots@data@min@float=\pgfmathresult + \fi + % + % 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@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 + % We have 'width' or 'height'. + % + % Use the order of these parameters. + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{x}% \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@height\relax + \data@dimen=\pgfplots@width\relax + \else + \def\pgfplots@loc@TMPb{y}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \data@dimen=\pgfplots@height\relax + \fi \fi + \pgfplots@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 \pgfplots@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 - \pgfplots@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 \pgfplots@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. }% - \data@EXPONENT=\data@dimen@order - \advance\data@EXPONENT by-\data@max@order - % Now, I introduce a loop which shall avoid cancellation of - % significant digits. - % - % Harmless Example: - % if we have data shift = -3 and - % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. - % In this case, the loop won't change anything. - % - % Critical Example: - % if we have data shift = -3 and - % max = 1980, min = 1930 then - % T(max) = 1.98 and T(min) = 1.93 - % and thus T(max)-T(min) = 0.05 . - % Considering that this is the axis range - % in which tick labels and plot points need to be computed, we - % only have two or three digits left! That happens because the - % prefix '19' is common and is cancelled in the subtraction. - % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 - % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). - % - \pgfplots@loop@CONTINUEtrue - \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% - \loop - \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% - \pgfplots@actual@trafo{\pgfplots@data@min@float}% - \let\pgfplots@min@fixed=\pgfmathresult - \ifpgfplots@loop@CONTINUE - \pgfplots@actual@trafo{\pgfplots@data@max@float}% - \let\pgfplots@max@fixed=\pgfmathresult - \expandafter\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...}% - \ifdim\data@tmp<0pt - % I need absolute values here: - \multiply\data@tmp by-1\relax - \fi - \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% - \expandafter\data@dimen\pgfmathresult pt - \pgfplots@loop@CONTINUEfalse - \ifdim\data@tmp<1500pt% a multiplication with '10' results in max = 15000 which is the upper limit. - \ifdim\data@dimen<100pt% I guess if max-min = O(100), we have quite good accuracy - \ifdim\data@dimen<0.0001pt - \else - \advance\data@EXPONENT by1 - \pgfplots@loop@CONTINUEtrue + % + %\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% + \data@EXPONENT=\data@dimen@order + \advance\data@EXPONENT by-\data@max@order + % Now, I introduce a loop which shall avoid cancellation of + % significant digits. + % + % Harmless Example: + % if we have data shift = -3 and + % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. + % In this case, the loop won't change anything. + % + % Critical Example: + % if we have data shift = -3 and + % max = 1980, min = 1930 then + % T(max) = 1.98 and T(min) = 1.93 + % and thus T(max)-T(min) = 0.05 . + % Considering that this is the axis range + % in which tick labels and plot points need to be computed, we + % only have two or three digits left! That happens because the + % prefix '19' is common and is cancelled in the subtraction. + % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 + % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). + % + \pgfplots@loop@CONTINUEtrue + \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \pgfutil@loop + \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% + \pgfplots@actual@trafo{\pgfplots@data@min@float}% + \let\pgfplots@min@fixed=\pgfmathresult + \ifpgfplots@loop@CONTINUE + \pgfplots@actual@trafo{\pgfplots@data@max@float}% + \let\pgfplots@max@fixed=\pgfmathresult + \expandafter\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...}% + \ifdim\data@tmp<0pt + % I need absolute values here: + \multiply\data@tmp by-1\relax + \fi + \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% + \expandafter\data@dimen\pgfmathresult pt + \pgfplots@loop@CONTINUEfalse + \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit. + \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy + \ifdim\data@dimen<0.0001pt + \else + \advance\data@EXPONENT by1 + \pgfplots@loop@CONTINUEtrue + \fi \fi \fi + %-------------------------------------------------- + % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! + % \ifdim\data@dimen>7999pt + % \advance\data@EXPONENT by-2 + % \else + % \advance\data@EXPONENT by-1 + % \fi + % \pgfplots@loop@CONTINUEfalse + % \fi + %-------------------------------------------------- + \pgfutil@repeat + \xdef\pgfplots@glob@TMPa{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% + \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% + \endgroup + %\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% + % COMPLETE INITIALISATION: + \ifpgfplots@disabledatascaling + % this here is a waste of time, I know it. One could really + % safe a lot of CPU time when disabledatascaling is enabled... + % but it requires so much extra cases; I really don't want + % that! + \gdef\pgfplots@glob@TMPa{0}% + \gdef\pgfplots@glob@TMPb{0}% + \fi + \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@glob@TMPa + \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@glob@TMPb% + % + % ... and apply transformation to any user input + % + % Transform axis limits: + %\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1min\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + % + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1max\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult + %\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% + % Transform tick limits (if they are set): + %\message{#1- display tick limits BEFORE data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% + \expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty + \else + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmin\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult \fi - %-------------------------------------------------- - % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! - % \ifdim\data@dimen>7999pt - % \advance\data@EXPONENT by-2 - % \else - % \advance\data@EXPONENT by-1 - % \fi - % \pgfplots@loop@CONTINUEfalse - % \fi - %-------------------------------------------------- - \repeat - \xdef\pgfplots@glob@TMPa{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% - \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% - \endgroup -%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% - % COMPLETE INITIALISATION: - \ifpgfplots@disabledatascaling - % this here is a waste of time, I know it. One could really - % safe a lot of CPU time when disabledatascaling is enabled... - % but it requires so much extra cases; I really don't want - % that! - \gdef\pgfplots@glob@TMPa{0}% - \gdef\pgfplots@glob@TMPb{0}% - \fi - \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@glob@TMPb% - % - % ... and apply transformation to any user input - % - % Transform axis limits: -%\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1min\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult - % - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1max\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult -%\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - % - % Convert any user-specified ticks: - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}% - % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - % we have #1tick = data - % - % Since we have entered this method, we know that these - % coordinate ARE ALREADY in floating point representation. - \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + % + \expandafter\ifx\csname pgfplots@#1tickmax\endcsname\pgfutil@empty + \else + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmax\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + %\message{#1- display tick limits after data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% + % + % Convert any user-specified ticks: + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}% + % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% + \def\pgfplots@loc@TMPb{data}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % we have #1tick = data + % + % Since we have entered this method, we know that these + % coordinate ARE ALREADY in floating point representation. + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + % clear structure: + \expandafter\global\expandafter\let\csname pgfplots@firstplot@coords@#1\endcsname=\pgfutil@empty + \else + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + %\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \fi + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc + \fi + % + % Convert any extra-ticks, see above. + \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% -%\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% + \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}\the\t@pgfplots@tokc}% \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc \fi - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc - \fi - % - % Convert any extra-ticks, see above. - \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc - \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc - \fi - % - % Transform any explicit axis unit scalings: - \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + % + % Transform any explicit axis unit scalings: + % WILL BE DONE LATER! \else -%\message{Converting #1 unit scale='\csname pgfplots@#1\endcsname' ... }% - \expandafter\pgfmathparse\expandafter{\csname pgfplots@#1\endcsname}% - \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% - \expandafter\edef\csname pgfplots@#1\endcsname{\pgfmathresult pt}% -%\message{to #1='\csname pgfplots@#1\endcsname'.}% + \expandafter\def\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \def\pgfplots@loc@TMPb{data}% + \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfplots@loc@TMPb + \pgfplots@letcsname pgfplots@#1tick={pgfplots@firstplot@coords@#1}% + % clear structure: + \expandafter\global\expandafter\let\csname pgfplots@firstplot@coords@#1\endcsname=\pgfutil@empty + \fi + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfutil@empty + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfutil@empty \fi } -\newif\ifpgfplots@determinedefaultvalues@xisuniform -\newif\ifpgfplots@determinedefaultvalues@yisuniform +\newif\ifpgfplots@determinedefaultvalues@isuniform \newif\ifpgfplots@determinedefaultvalues@needs@check@uniformtick \newif\ifpgfplots@limits@are@computed @@ -4959,6 +2870,8 @@ \gdef\pgfplots@xmin{0}% \gdef\pgfplots@xmax{1}% \fi + % unnecessary? they will be reset anyway because empty plots are + % recognised before any other axis limit routine \ifpgfplots@yislinear \pgfmathfloatcreate{0}{0.0}{0}% \global\let\pgfplots@ymin=\pgfmathresult @@ -4970,6 +2883,7 @@ \gdef\pgfplots@ymin{0}% \gdef\pgfplots@ymax{1}% \fi + \pgfplots@threedimfalse \def\pgfplots@xtick{}% \def\pgfplots@ytick{}% \def\pgfplots@extra@xtick{}% @@ -4984,15 +2898,23 @@ \ifx\pgfplots@xmin\pgfplots@invalidrange@xmin \pgfplots@limits@are@computedfalse \fi - \ifx\pgfplots@xmin\pgfplots@invalidrange@xmax + \ifx\pgfplots@xmax\pgfplots@invalidrange@xmax \pgfplots@limits@are@computedfalse \fi \ifx\pgfplots@ymin\pgfplots@invalidrange@ymin \pgfplots@limits@are@computedfalse \fi - \ifx\pgfplots@ymin\pgfplots@invalidrange@ymax + \ifx\pgfplots@ymax\pgfplots@invalidrange@ymax \pgfplots@limits@are@computedfalse \fi + \ifpgfplots@threedim + \ifx\pgfplots@zmin\pgfplots@invalidrange@zmin + \pgfplots@limits@are@computedfalse + \fi + \ifx\pgfplots@zmax\pgfplots@invalidrange@zmax + \pgfplots@limits@are@computedfalse + \fi + \fi \ifpgfplots@limits@are@computed \ifx\pgfplots@data@xmin\pgfplots@invalidrange@xmin \global\let\pgfplots@data@xmin=\pgfplots@xmin @@ -5006,19 +2928,32 @@ \ifx\pgfplots@data@ymin\pgfplots@invalidrange@ymax \global\let\pgfplots@data@ymax=\pgfplots@ymax \fi + \ifx\pgfplots@data@zmin\pgfplots@invalidrange@zmin + \global\let\pgfplots@data@zmin=\pgfplots@zmin + \fi + \ifx\pgfplots@data@zmin\pgfplots@invalidrange@zmax + \global\let\pgfplots@data@zmax=\pgfplots@zmax + \fi \ifpgfplots@clip@limits \else % there is a rare change that min > max. % Handle that ... - \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmax=\pgfmathresult % - \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymax=\pgfmathresult + % + \ifpgfplots@threedim + \pgfplotsmathfloatmin{\pgfplots@zmin}{\pgfplots@zmax}% + \global\let\pgfplots@zmin=\pgfmathresult + \pgfplotsmathfloatmax{\pgfplots@zmin}{\pgfplots@zmax}% + \global\let\pgfplots@zmax=\pgfmathresult + \fi \fi \else \pgfplots@handle@invalid@range @@ -5026,31 +2961,45 @@ }% +% This method finishes the accumulated information of axis limits and +% all internal flag fields. +% +% PRECONDITION: +% - all plots are finally finished; axis and data limits are known. +% +% POSTCONDITION: +% - the scaling transformation is set-up and applied to all user +% inputs and axis limits. +% - the \pgfplots@[xy][min,max] variables and associated TeX +% registers are set up and final. They should not be changed +% afterwards. +% - any tick lists etc. are final. +% \def\pgfplots@determinedefaultvalues{% \pgfplots@check@invalid@range % %-------------------------------------------------- %FIXME % \ifpgfplots@float@numerics@mode@x - % \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmin=\pgfmathresult - % \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmax=\pgfmathresult % \else - % \pgfmathmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathmin{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmin=\pgfmathresult - % \pgfmathmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathmax{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmax=\pgfmathresult % \fi % \ifpgfplots@float@numerics@mode@y - % \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymin=\pgfmathresult - % \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymax=\pgfmathresult % \else - % \pgfmathmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathmin{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymin=\pgfmathresult - % \pgfmathmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathmax{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymax=\pgfmathresult % \fi %-------------------------------------------------- @@ -5060,36 +3009,16 @@ \pgfplots@set@default@size@options % % - \ifpgfplots@apply@datatrafo@x - \let\pgfplots@xmin@unscaled@as@float=\pgfplots@xmin - \let\pgfplots@xmax@unscaled@as@float=\pgfplots@xmax - \pgfplots@apply@data@scale@trafo@to@options@for x% - \else - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@xtick\pgfplots@loc@TMPb - \let\pgfplots@xtick=\pgfplots@firstplot@coords@x - \fi - \let\pgfplots@xmin@unscaled@as@float=\pgfutil@empty - \let\pgfplots@xmax@unscaled@as@float=\pgfutil@empty - \fi - \ifpgfplots@apply@datatrafo@y - \let\pgfplots@ymin@unscaled@as@float=\pgfplots@ymin - \let\pgfplots@ymax@unscaled@as@float=\pgfplots@ymax - \pgfplots@apply@data@scale@trafo@to@options@for y% - \else - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@ytick\pgfplots@loc@TMPb - \let\pgfplots@ytick=\pgfplots@firstplot@coords@y - \fi - \let\pgfplots@ymin@unscaled@as@float=\pgfutil@empty - \let\pgfplots@ymax@unscaled@as@float=\pgfutil@empty + \pgfplots@check@and@apply@datatrafo@for x% + \pgfplots@check@and@apply@datatrafo@for y% + \ifpgfplots@threedim + \pgfplots@check@and@apply@datatrafo@for z% \fi \pgfplots@datascaletrafo@initialisedtrue % % From now on, we can always work with pgfmath. % We simply need to apply the data scaling trafo before doing so. \pgfkeysgetvalue{/pgfplots/minor x tick num}\pgfplots@minor@xtick@num - \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num \ifpgfplots@xislinear \ifnum\pgfplots@minor@xtick@num=0\relax \pgfplots@xminorticksfalse @@ -5098,6 +3027,11 @@ \pgfplots@xminortickstrue \fi \fi + % + \pgfplots@enlarge@limit@ifconfigured x + \pgfplots@avoid@empty@axis@range@for x% + % + \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num \ifpgfplots@yislinear \ifnum\pgfplots@minor@ytick@num=0\relax \pgfplots@yminorticksfalse @@ -5106,17 +3040,27 @@ \pgfplots@yminortickstrue \fi \fi - % - \pgfplots@enlarge@limit@ifconfigured x \pgfplots@enlarge@limit@ifconfigured y - % - \pgfplots@avoid@empty@axis@range@for x% \pgfplots@avoid@empty@axis@range@for y% + + \ifpgfplots@threedim + \pgfkeysgetvalue{/pgfplots/minor z tick num}\pgfplots@minor@ztick@num + \ifpgfplots@zislinear + \ifnum\pgfplots@minor@ztick@num=0\relax + \pgfplots@zminorticksfalse + \pgfplots@zminorgridsfalse + \else + \pgfplots@zminortickstrue + \fi + \fi + \pgfplots@enlarge@limit@ifconfigured y + \pgfplots@avoid@empty@axis@range@for y% + \fi + % % \pgfplots@initsizes % - \pgfplots@determinedefaultvalues@xisuniformtrue - \pgfplots@determinedefaultvalues@yisuniformtrue + \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue \ifx\pgfplots@xtick\pgfutil@empty \pgfplots@assign@default@tick@foraxis{x}% @@ -5124,27 +3068,52 @@ \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@xislinear \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@xtick}{\pgfplots@tick@distance@x}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@xisuniformtrue - \else - \pgfplots@determinedefaultvalues@xisuniformfalse - \fi \else \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@xtick}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@xisuniformtrue - \else - \pgfplots@determinedefaultvalues@xisuniformfalse - \fi \fi \fi - \ifpgfplots@determinedefaultvalues@xisuniform + \ifpgfplots@isuniformtick \else \pgfplots@xminorticksfalse + \pgfplots@xminorgridsfalse + \fi + % + \ifx\pgfplots@xticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@xtickposnum=3 % right + \def\pgfplots@xticklabelaxisspec{v10}% + \else + \def\pgfplots@xticklabelaxisspec{v00}% + \fi + \fi + \ifx\pgfplots@yticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@ytickposnum=3 % right + \def\pgfplots@yticklabelaxisspec{1v0}% + \else + \def\pgfplots@yticklabelaxisspec{0v0}% + \fi + \fi + \ifx\pgfplots@zticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@ztickposnum=3 % right + \def\pgfplots@zticklabelaxisspec{01v}% + \else + \def\pgfplots@zticklabelaxisspec{00v}% + \fi + \fi + % + \ifx\pgfplots@xticklabel\pgfutil@empty + \ifpgfplots@xislinear + \def\pgfplots@xticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@xticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@xticklabel\pgfutil@empty + \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel \fi % % % + \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue \ifx\pgfplots@ytick\pgfutil@empty \pgfplots@assign@default@tick@foraxis{y}% @@ -5152,35 +3121,16 @@ \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@yislinear \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ytick}{\pgfplots@tick@distance@y}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@yisuniformtrue - \else - \pgfplots@determinedefaultvalues@yisuniformfalse - \fi \else \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ytick}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@yisuniformtrue - \else - \pgfplots@determinedefaultvalues@yisuniformfalse - \fi \fi \fi - \ifpgfplots@determinedefaultvalues@yisuniform + \ifpgfplots@isuniformtick \else \pgfplots@yminorticksfalse + \pgfplots@yminorgridsfalse \fi % - \ifx\pgfplots@xticklabel\pgfutil@empty - \ifpgfplots@xislinear - \def\pgfplots@xticklabel{\axisdefaultticklabel}% - \else - \def\pgfplots@xticklabel{\axisdefaultticklabellog}% - \fi - \fi - \ifx\pgfplots@extra@xticklabel\pgfutil@empty - \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel - \fi \ifx\pgfplots@yticklabel\pgfutil@empty \ifpgfplots@yislinear \def\pgfplots@yticklabel{\axisdefaultticklabel}% @@ -5192,49 +3142,40 @@ \let\pgfplots@extra@yticklabel=\pgfplots@yticklabel \fi % - % - \pgfplots@prepare@ZERO@coordinates -} - -% This code is mainly interesting for bar plots. -% -% It precomputes x = 0 and y = 0 - which is not necessarily -% trivial in case of data scaling. Furthermore, it applies -% coordinate clipping to the resulting values and multiplies them -% with x- and y scale vectors. -\def\pgfplots@prepare@ZERO@coordinates{% - \ifpgfplots@xislinear - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@fromfixed@x{0}% - \global\let\pgfplots@ZERO@x=\pgfmathresult - \else - \gdef\pgfplots@ZERO@x{0}% + \ifpgfplots@threedim + \pgfplots@isuniformticktrue + \pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \ifx\pgfplots@ztick\pgfutil@empty + \pgfplots@assign@default@tick@foraxis{z}% \fi - \pgfmathmax@{\pgfplots@ZERO@x}{\pgfplots@xmin}% - \global\let\pgfplots@ZERO@x=\pgfmathresult - \else - \global\let\pgfplots@ZERO@x=\pgfplots@xmin% - \fi - % - \ifpgfplots@yislinear - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@fromfixed@y{0}% - \global\let\pgfplots@ZERO@y=\pgfmathresult + \ifpgfplots@determinedefaultvalues@needs@check@uniformtick + \ifpgfplots@zislinear + \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ztick}{\pgfplots@tick@distance@z}% + \else + \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ztick}% + \fi + \fi + \ifpgfplots@isuniformtick \else - \gdef\pgfplots@ZERO@y{0}% + \pgfplots@zminorticksfalse + \pgfplots@zminorgridsfalse + \fi + % + \ifx\pgfplots@zticklabel\pgfutil@empty + \ifpgfplots@zislinear + \def\pgfplots@zticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@zticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@zticklabel\pgfutil@empty + \let\pgfplots@extra@zticklabel=\pgfplots@zticklabel \fi - \pgfmathmax@{\pgfplots@ZERO@y}{\pgfplots@ymin}% - \global\let\pgfplots@ZERO@y=\pgfmathresult - \else - \global\let\pgfplots@ZERO@y=\pgfplots@ymin% \fi % - \pgfinterruptboundingbox% - \pgfpointxy{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}% - \xdef\pgfplots@ZERO@x{\the\pgf@x}% - \xdef\pgfplots@ZERO@y{\the\pgf@y}% - \endpgfinterruptboundingbox% -}% + % + \pgfplots@prepare@ZERO@coordinates +} % Helper method for initsizes. @@ -5244,13 +3185,12 @@ % The actual width is % c + x*(xmax-xmin) % based on -% - x*xmax = \pgfplots@xcoordmaxTEX -% - x*xmin = \pgfplots@xcoordminTEX % - c = estimated, a constant for the axis label/tick labels % % Arguments: -% #1: the output argument for the SCALE. -\def\pgfplots@initsizes@getXscale\into#1{% +% #1: is expected to be x*(xmax-xmin) measured in pt. +% #2: the output argument for the SCALE. +\def\pgfplots@initsizes@getXscale#1\into#2{% \begingroup \pgf@xa=\pgfplots@width\relax % EXPECTED WIDTH = X = \pgfplots@width @@ -5268,8 +3208,7 @@ \pgf@xa=0pt \fi % \pgf@xb := x*(xmax-xmin): - \pgf@xb=\pgfplots@xcoordmaxTEX - \advance\pgf@xb by-\pgfplots@xcoordminTEX + \pgf@xb=#1\relax \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% {\pgf@sys@tonumber\pgf@xb}% @@ -5278,14 +3217,14 @@ % c=estimated, % width-c =\the\pgf@xa, % x*(xmax[=\the\pgfplots@xcoordmaxTEX] - xmin[=\the\pgfplots@xcoordminTEX)]) = \the\pgf@xb -% -> x-scale =#1 }% +% -> x-scale =#2 }% \pgfmath@smuggleone\pgfmathresult \endgroup - \let#1=\pgfmathresult + \let#2=\pgfmathresult } % The same as \pgfplots@initsizes@getXscale, just for the height. -\def\pgfplots@initsizes@getYscale\into#1{% +\def\pgfplots@initsizes@getYscale#1\into#2{% \begingroup \expandafter\pgf@xa\pgfplots@height\relax % EXPECTED WIDTH = X = \pgfplots@width @@ -5302,9 +3241,8 @@ \pgfplots@error{Error: Plot height `\pgfplots@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.}% \pgf@xa=0pt \fi - % \pgf@xb := x*(xmax-xmin): - \pgf@xb=\pgfplots@ycoordmaxTEX - \advance\pgf@xb by-\pgfplots@ycoordminTEX + % \pgf@xb := y*(ymax-ymin): + \pgf@xb=#1% \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% {\pgf@sys@tonumber\pgf@xb}% @@ -5314,10 +3252,10 @@ % c=estimated, % height-c =\the\pgf@xa, % y*(ymax[=\the\pgfplots@ycoordmaxTEX] - ymin[=\the\pgfplots@ycoordminTEX)]) = \the\pgf@xb -% -> y-scale =#1 }% +% -> y-scale =#2 }% \pgfmath@smuggleone\pgfmathresult \endgroup - \let#1=\pgfmathresult + \let#2=\pgfmathresult } @@ -5335,8 +3273,8 @@ \let\min@d=\pgf@xa \let\max@d=\pgf@xb \let\diff=\pgf@xc - \expandafter\min@d\pgfplots@@min pt - \expandafter\max@d\pgfplots@@max pt + \expandafter\min@d\pgfplots@@min pt % + \expandafter\max@d\pgfplots@@max pt % \diff=\max@d \advance\diff by-\min@d % FIXME : I need a RELATIVE check here! @@ -5359,20 +3297,20 @@ % the case \pgfplots@@min ~= \pgfplots@@max % % enlarge \pgfplots@@max and shrink \min: - \ifdim\max@d<0pt - \ifdim\max@d<-1pt + \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 + \advance\max@d by-1pt% + \advance\min@d by1pt% \fi \else - \ifdim\max@d>1pt + \ifdim\max@d>1pt% \max@d=1.2\max@d \min@d=0.8\min@d \else - \ifdim\max@d=0pt + \ifdim\max@d=0pt% \if@cur@is@scaled \expandafter\let\expandafter\min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname \expandafter\let\expandafter\max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname @@ -5465,6 +3403,10 @@ % the plot will be resized; keeping the aspect ratio. % \let\pgfplots@default@aspect@ratio=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}% + \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}% + \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}% + % % CASES: % hasx := 'x' option non-empty % hasy := 'y' option non-empty @@ -5535,6 +3477,320 @@ \fi } +% A helper method for \pgfplots@initsizes which +% - applies the data scaling trafo to user arguments +% - sets calls pgfset#1vec +% - computes \pgfplots@#1@veclength +% - computes \pgfplots@#1@inverseveclength +% +% #1: the vector to set (either 'x' or 'y') +% #2: the index of the vector to set (either 0 or 1) +% #3: the already precomputed temporary scale (see pgfplots@initsizes) +% #4: an output argument. It is a macro name which will be defined to +% '1' if and only if the finally set vector is parallel to the #1 axis +% of PGF, that means (x,0) for #1=x and (0,y) for #2=y. +\def\pgfplots@initsizes@setunitvector#1#2#3#4{% + \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@#1\endcsname + \expandafter\let\expandafter\if@cur@is@scaled\csname ifpgfplots@apply@datatrafo@#1\endcsname + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \def#4{1}% we have (#1,0) or (0,#1) + % +%\message{Setting unitvector(#1) to auto-computed multiple of e_#2 ...}% + \edef\pgfplots@loc@TMPa{#3}% + \begingroup + \pgf@xa=#3\relax + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup +% FIXME : '\pgfplots@loc@TMPa' contains 'pt' leading to missing +% character warning! + \ifcase#2\relax + \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPa}{0pt}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPa}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}}% + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi + % The numbers 1/||e_x|| and 1/||e_y|| are used by the tick + % placement code to convert between logical and physical + % coordinates. FIXME is that accurate enough!? + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \else + % Ok, we have a user-defined unit vector. + % + % That means we also need to apply the scaling trafo! + % + % + % 1. Check whether we have a complete vector of type (x,y): + \expandafter\pgfutil@in@\expandafter(\expandafter{\pgfplots@loc@TMPb}% + \ifpgfutil@in@ + % YES: we have (x,y): + % + \def#4{0}% we DON'T have (#1,0) or (0,#1). At least I think so. + % +%\message{Setting unitvector(#1) to non-standard \csname pgfplots@#1\endcsname ...}% + \def\pgfplots@loc@TMPa(##1,##2){% + \pgfmathparse{##1}% + \ifpgfplots@apply@datatrafo@x + \expandafter\pgfplots@inverse@datascaletrafo@tofixed@x@noshift\expandafter{\pgfmathresult}% + \fi + \let\pgfplots@loc@TMPb=\pgfmathresult + % + \pgfmathparse{##2}% + \ifpgfplots@apply@datatrafo@y + \expandafter\pgfplots@inverse@datascaletrafo@tofixed@y@noshift\expandafter{\pgfmathresult}% + \fi + \let\pgfplots@loc@TMPc=\pgfmathresult + \csname pgfset#1vec\endcsname{\pgfqpoint{\pgfplots@loc@TMPb pt}{\pgfplots@loc@TMPc pt}}% + }% + \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb% + % + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \else + % NO we simply have a scalar value. + \def#4{1}% we have (#1,0) or (0,#1) +%\message{Setting unitvector(#1) to \csname pgfplots@#1\endcsname * e_{#2}...}% + \if@cur@is@scaled + \pgfmathparse{\csname pgfplots@#1\endcsname}% + \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% + \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% + \fi + \begingroup + \pgf@xa=\pgfplots@loc@TMPb\relax + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup + \ifcase#2\relax + \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPb}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}% + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \fi + \fi +}% + +% Applies the 'axis equal' feature. +% +% PRECONDITION: +% - final unit vectors have been set +% - final axis limits are given in transformed range +% - \pgfplots@set@default@size@options has been invoked before +% +% POSTCONDITION: +% - unit vectors have been set to equal length, +% - axis limits have been rescaled such that the axis dimensions +% remain fixed +% +% There is just one algorithmic difficulty: the data scaling +% transformation. All unit vector length above are only meaningful in +% the UNTRANSFORMED range, so we have to mingle with the scaling +% transformation. +\def\pgfplots@axis@equal@apply{% + % Step 1: compute the unit vector which STAYS CONSTANT. + % + % All other ones will be scaled to fit its length. + \ifpgfplots@threedim + \def\pgfplots@axis@equal@apply@reference{x}% + \pgfplots@if@unitveclenlessthan@untransformed xy{% + \pgfplots@if@unitveclenlessthan@untransformed xz{% + \def\pgfplots@axis@equal@apply@reference{x}% + }{}% + }{}% + \pgfplots@if@unitveclenlessthan@untransformed yx{% + \pgfplots@if@unitveclenlessthan@untransformed yz{% + \def\pgfplots@axis@equal@apply@reference{y}% + }{}% + }{}% + \pgfplots@if@unitveclenlessthan@untransformed zx{% + \pgfplots@if@unitveclenlessthan@untransformed zy{% + \def\pgfplots@axis@equal@apply@reference{z}% + }{}% + }{}% + \else + \pgfplots@if@unitveclenlessthan@untransformed xy{% + \def\pgfplots@axis@equal@apply@reference{x}% + }{% + \def\pgfplots@axis@equal@apply@reference{y}% + }% + \fi +%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@axis@equal@apply@reference.}% + \if x\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for x + \fi + \if y\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for y + \fi + \ifpgfplots@threedim + \if z\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for z + \fi + \fi +}% + +% Scales unit vector '#1' such that it has the same length as the unit +% vector in direction \pgfplots@axis@equal@apply@reference. +% +% The data limits for '#1' will be enlarged as well (for 'axis +% equal'). +\def\pgfplots@axis@equal@apply@for#1{% + \pgfmathmultiply@ + {\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname} + {\csname pgfplots@#1@inverseveclength\endcsname}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \pgfmathmultiply@ + {\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname} + {\csname pgfplots@#1@veclength\endcsname}% + \global\let\pgfplots@glob@TMPb=\pgfmathresult + % + % If the datascaling transformation is active (which is almost + % every the case here), we need to respect it here. + % + % We only need to respect the SCALING, translations (shifts) are + % not interesting. + % + % We want that || T^{-1} e_ref || = || T^{-1} E_#1 ||. + % + % So: T^{-1} E_#1 := s* T^{-1} e_#1 where + % s = ||T^{-1} e_ref|| / || T^{-1} e_#1 || + % = |10^{scale_ref}| / |10^{scale_#1}| * || e_ref|| / ||e_#1||. + % + % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1. + % + % -> compute 's'! We already have the quotient of unit vectors. + % Now, acquire the scale quotients. + % + \begingroup + \def\pgfplots@tmp@exponentref{0}% + \def\pgfplots@tmp@exponentK{0}% + \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@axis@equal@apply@reference}{% + \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@axis@equal@apply@reference}% + }{}% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}% + }{}% + \c@pgf@counta=\pgfplots@tmp@exponentref + \advance\c@pgf@counta by-\pgfplots@tmp@exponentK + \ifnum\c@pgf@counta=0 + \else + \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}% + \global\let\pgfplots@glob@TMPb=\pgfmathresult + \fi + \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}% + \endgroup + % + \if x#1 + \pgfsetxvec{\pgfplotsqpointxy{\pgfplots@glob@TMPa}{0}}% + \else + \if y#1 + \pgfsetyvec{\pgfplotsqpointxy{0}{\pgfplots@glob@TMPa}}% + \else + \if z#1 + \pgfsetzvec{\pgfplotsqpointxyz{0}{0}{\pgfplots@glob@TMPa}}% + \fi + \fi + \fi + % + % + % Update auxiliary data members: + % This is only complicated due to the scaling transformation. If we would not have the scaling trafo, the following + % code would simply copy the vector length and inverse vectors length from the reference axis. + \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname}{\pgfplots@glob@TMPc}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname}{-\pgfplots@glob@TMPc}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + % + % + \ifpgfplots@axis@equal@image + \else + % + % Ok, now update the axis limits such that the axis' dimensions + % stay the same. + % + % My idea is to add half of the new range to 'max' and + % subtract the other half from 'min': + % 1/s( xmax - xmin) = (xmax+0.5d) - (xmin-0.5d) = xmax - xmin +d + % with d = 1/s (xmax-xmin) - (xmax-xmin) = (1/s - 1) (xmax-xmin) + % +%\message{'axis equal': Resizing data range for #1: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}% + \pgfmathsubtract@{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#1min\endcsname}% + \begingroup + \pgf@xa=\pgfmathresult pt + \pgfmathsubtract@{\pgfplots@glob@TMPb}{1.0}% + \pgf@xa=\pgfmathresult \pgf@xa + \divide\pgf@xa by2 + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup + \pgfmathsubtract@{\csname pgfplots@#1min\endcsname}{\pgfplots@glob@TMPb}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + \pgfmathadd@{\csname pgfplots@#1max\endcsname}{\pgfplots@glob@TMPb}% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult +%\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [+- \pgfplots@glob@TMPb]}% + % + % Update auxiliary data members: + \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % + \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult + }{}% + \fi +} + +% Invokes #3 if +% ( 10^{s1} * veclen1 < 10^{s2} * veclen2 ) +% <=> +% ( 10^{s1-s2} * veclen1 < veclen2 ). +% +% If the condition is false, '#4' is invoked. +\def\pgfplots@if@unitveclenlessthan@untransformed#1#2#3#4{% + \def\pgfplots@loc@TMPa{0}% + \def\pgfplots@loc@TMPb{0}% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplots@letcsname{pgfplots@loc@TMPa}={pgfplots@data@scale@trafo@EXPONENT@#1}% + }{}% + \pgfplots@if{pgfplots@apply@datatrafo@#2}{% + \pgfplots@letcsname{pgfplots@loc@TMPb}={pgfplots@data@scale@trafo@EXPONENT@#2}% + }{}% + \begingroup + \pgf@xb=\csname pgfplots@#2@veclength\endcsname pt + \c@pgf@counta=\pgfplots@loc@TMPa + \advance\c@pgf@counta by-\pgfplots@loc@TMPb + \ifnum\c@pgf@counta=0 + \pgf@xa=\csname pgfplots@#1@veclength\endcsname pt + \else + \pgfplotsmathmultiplypowten@{\csname pgfplots@#1@veclength\endcsname}{\c@pgf@counta}% + \pgf@xa=\pgfmathresult pt + \fi + \ifdim\pgf@xa<\pgf@xb + \gdef\pgfplots@glob@TMPc{1}% + \else + \gdef\pgfplots@glob@TMPc{0}% + \fi + \endgroup + \if1\pgfplots@glob@TMPc #3\else #4\fi +}% + % PRECONDITION: % - final axis limits are given in transformed range % - \pgfplots@set@default@size@options has been invoked before @@ -5546,12 +3802,22 @@ % INIT. % % - \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% - \pgfplots@xcoordminTEX=\pgf@x - \pgfplots@ycoordminTEX=\pgf@y - \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% - \pgfplots@xcoordmaxTEX=\pgf@x - \pgfplots@ycoordmaxTEX=\pgf@y + \pgfplots@xmin@reg=\pgfplots@xmin pt % + \pgfplots@xmax@reg=\pgfplots@xmax pt % + \pgfplots@ymin@reg=\pgfplots@ymin pt % + \pgfplots@ymax@reg=\pgfplots@ymax pt % + \ifpgfplots@threedim + \pgfplots@zmin@reg=\pgfplots@zmin pt % + \pgfplots@zmax@reg=\pgfplots@zmax pt % + \fi + % + \pgfpointdiff + {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}} + {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}% + % only used temporarily in this macro to compute the correct + % length for unit vectors: + \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}% + \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}% % % %----------------------------------------- @@ -5567,7 +3833,7 @@ \ifx\pgfplots@width\pgfutil@empty \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}% \fi - \pgfplots@initsizes@getXscale\into\pgfplots@tmpXscale + \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale \ifpgfplots@scale@only@axis \let\pgfplots@rectangle@width=\pgfplots@width \fi @@ -5579,7 +3845,7 @@ \ifx\pgfplots@height\pgfutil@empty \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% \fi - \pgfplots@initsizes@getYscale\into\pgfplots@tmpYscale + \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale \ifpgfplots@scale@only@axis \let\pgfplots@rectangle@height=\pgfplots@height \fi @@ -5590,19 +3856,35 @@ % % assert( \pgfplots@tmpXscale != \pgfutil@empty && \pgfplots@tmpYscale != \pgfutil@empty ) % - % Apply scaling: - \pgfpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% - \edef\pgfplots@tmpscale@x{\the\pgf@x}% - \edef\pgfplots@tmpscale@y{\the\pgf@y}% - \ifx\pgfplots@x\pgfutil@empty - \pgfsetxvec{\pgfqpoint{\pgfplots@tmpscale@x}{0pt}}% + \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% + \edef\pgfplots@tmpXscale{\the\pgf@x}% + \edef\pgfplots@tmpYscale{\the\pgf@y}% + \def\pgfplots@tmpZscale{1pt}% + \ifx\pgfplots@view@pitch\pgfutil@empty + \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}% + \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}% + \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}% \else - \pgfsetxvec{\pgfpoint{\pgfplots@x}{0pt}}% + \pgfplotssetaxesfrompitchyaw{\pgfplots@view@pitch}{\pgfplots@view@yaw}{\pgfplots@tmp@xisaxisparallel}% + \if1\pgfplots@tmp@xisaxisparallel% + \def\pgfplots@tmp@yisaxisparallel{1}% + \fi \fi - \ifx\pgfplots@y\pgfutil@empty - \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@tmpscale@y}}% + \ifpgfplots@threedim \else - \pgfsetyvec{\pgfpoint{0pt}{\pgfplots@y}}% + \if1\pgfplots@tmp@xisaxisparallel% + \if1\pgfplots@tmp@yisaxisparallel% + % Optimize for axis-parallel case! + % puh. Did not make any measureable difference!? Ok... + \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal + \fi + \fi + \fi + \ifpgfplots@axis@equal@image + \pgfplots@axis@equaltrue + \fi + \ifpgfplots@axis@equal + \pgfplots@axis@equal@apply \fi % % Determine final rectangle dimensions. @@ -5625,12 +3907,19 @@ % 3. The user supplied 'x' and or 'y'. Simply use them, its % accurate. % - \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \begingroup + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \xdef\pgfplotspointsouthwest{\noexpand\pgf@x=\the\pgf@x\noexpand\relax\noexpand\pgf@y=\the\pgf@y}% + % ATTENTION: I re-use registers here! Make sure they won't be + % overwritten! \pgfpointdiff and \pgfplotsqpointxy are ok in this respect. + \let\pgfplots@xcoordminTEX=\pgf@xb + \let\pgfplots@ycoordminTEX=\pgf@yb \pgfplots@xcoordminTEX=\pgf@x \pgfplots@ycoordminTEX=\pgf@y - \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + % + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% \ifx\pgfplots@rectangle@width\pgfutil@empty - \pgfplots@xcoordmaxTEX=\pgf@x + \def\pgfplots@tmp@xmax@ymin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}% \else % this 'if' here should only make a difference of about % 1-2pt, not more. @@ -5638,22 +3927,40 @@ % and I am quite sure that this inaccuracy (and this % work-around) only affects the % final size, not the relative plot accuracy. - \pgfplots@xcoordmaxTEX=\pgfplots@xcoordminTEX - \expandafter\advance\expandafter\pgfplots@xcoordmaxTEX\pgfplots@width + \pgf@x=\pgfplots@xcoordminTEX + \advance\pgf@x by\pgfplots@width + \edef\pgfplots@tmp@xmax@ymin{\noexpand\pgfqpoint{\the\pgf@x}{\noexpand\pgfplots@ycoordminTEX}}% \fi \ifx\pgfplots@rectangle@height\pgfutil@empty - \pgfplots@ycoordmaxTEX=\pgf@y + \def\pgfplots@tmp@xmin@ymax{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% \else - \pgfplots@ycoordmaxTEX=\pgfplots@ycoordminTEX - \expandafter\advance\expandafter\pgfplots@ycoordmaxTEX\pgfplots@height + \pgf@x=\pgfplots@ycoordminTEX + \advance\pgf@x\pgfplots@height + \edef\pgfplots@tmp@xmin@ymax{\noexpand\pgfqpoint{\noexpand\pgfplots@xcoordminTEX}{\the\pgf@x}}% + \fi + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplots@tmp@xmax@ymin}% + \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointxaxislength{\pgfmathresult pt}% + % + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplots@tmp@xmin@ymax}% + \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointyaxislength{\pgfmathresult pt}% + % + \ifpgfplots@threedim + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplotsqpointxy{\pgfplots@zmin}{\pgfplots@zmax}}% + \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointzaxislength{\pgfmathresult pt}% \fi -%-------------------------------------------------- -% \begingroup -% \pgf@x=\pgfplots@xcoordmaxTEX\advance\pgf@x by-\pgfplots@xcoordminTEX -% \pgf@y=\pgfplots@ycoordmaxTEX\advance\pgf@y by-\pgfplots@ycoordminTEX -% \message{Axis scaling x=\pgfplots@tmpXscale, y=\pgfplots@tmpYscale\ yields lower-left-corner (\pgfplots@xmin,\pgfplots@ymin) = (\the\pgfplots@xcoordminTEX,\the\pgfplots@ycoordminTEX) and upper right (\pgfplots@xmax,\pgfplots@ymax) = (\the\pgfplots@xcoordmaxTEX,\the\pgfplots@ycoordmaxTEX). Axis dimensions are width=\the\pgf@x, height=\the\pgf@y.}% -% \endgroup -%-------------------------------------------------- + \endgroup } % This here is a low-weight node. It can ONLY be used during axis @@ -5678,17 +3985,41 @@ \anchor{west}{\pgfqpointxy{0}{0.5}}% \anchor{north west}{\pgfqpointxy{0}{1}}% %% - \anchor{origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}}% - \anchor{above origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ycoordmaxTEX}}% - \anchor{left of origin}{\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ZERO@y\relax}}% - \anchor{right of origin}{\pgfqpoint{\pgfplots@xcoordmaxTEX}{\pgfplots@ZERO@y\relax}}% - \anchor{below origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ycoordminTEX}}% + \anchor{origin}{\pgfplotspointORIGIN@tmp}% + \anchor{above origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointyaxis}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}} + {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}{\pgfplotspointxaxis}}% + }% + \anchor{left of origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointxaxis}}} + {\pgfqpointxy{0}{0}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}% + }% + \anchor{right of origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointxaxis}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}} + {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}{\pgfplotspointyaxis}}% + }% + \anchor{below origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointyaxis}}} + {\pgfqpointxy{0}{0}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}% + }% %% %% %% %% \anchorborder{}% - \backgroundpath{}%\pgfpathrectangle{\pgfpointorigin}{\upperrightinnercorner}}% + \backgroundpath{}% \foregroundpath{}% \behindbackgroundpath{}% \beforebackgroundpath{}% @@ -5701,6 +4032,7 @@ % It has one node part, which is the complete image. It provides a lot % of anchors. \pgfdeclareshape{pgfplots@low@level@shape}{% + % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ \pgf@x=\wd\pgfnodepartimagebox \pgf@y=\ht\pgfnodepartimagebox @@ -5708,107 +4040,91 @@ \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% }% - \savedanchor\upperrightinnercorner{% - \pgfqpoint{\pgfplots@savedanchor@inner@upperright@x\relax}{\pgfplots@savedanchor@inner@upperright@y\relax}% - }% + \savedanchor\xaxisvec{\pgfplotspointxaxis}% + \savedanchor\yaxisvec{\pgfplotspointyaxis}% \savedanchor\origin{% \pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}% }% % \nodeparts{image}% \anchor{image}{% - \pgf@x=0pt - \pgf@y=0pt + \pgf@x=0pt % + \pgf@y=0pt % }% % % \anchor{center}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\pgfpointadd{\xaxisvec}{\yaxisvec}}}% }% \anchor{north}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + }% + \anchor{north east}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% }% - \anchor{north east}{\upperrightinnercorner}% \anchor{east}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% }% \anchor{south east}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% }% \anchor{south}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa - \pgf@y=\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% }% \anchor{south west}{\lowerleftinnercorner}% \anchor{west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@x=\pgf@xa - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% }% \anchor{north west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% }% %% \anchor{origin}{% \origin }% \anchor{above origin}{% - \origin - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\yaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}{\xaxisvec}}% }% \anchor{left of origin}{% - \origin - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@y=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\xaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}% }% \anchor{right of origin}{% - \origin - \pgf@xa=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\xaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}{\yaxisvec}}% }% \anchor{below origin}{% - \origin - \pgf@xa=\pgf@x - \lowerleftinnercorner - \pgf@x=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\yaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}% }% % %% @@ -5855,53 +4171,55 @@ %% \anchor{above north}{% \upperrightcorner - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@xb=\pgf@x - \upperrightinnercorner - \advance\pgf@xb by\pgf@x - \pgf@x=.5\pgf@xb - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + \pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner - \pgf@xa=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@xb=\pgf@y - \lowerleftinnercorner - \advance\pgf@xb by\pgf@y - \pgf@x=\pgf@xa - \pgf@y=.5\pgf@xb + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% + \pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner - \pgf@xa=\pgf@x - \lowerleftinnercorner - \pgf@x=\pgf@xa + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% + \pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% \pgf@y=0pt }% \anchor{below south}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% \pgf@y=0pt - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa }% \anchor{below south west}{% \lowerleftinnercorner @@ -5912,22 +4230,24 @@ \pgf@x=0pt }% \anchor{left of west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@y - \pgf@y=.5\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% \pgf@x=0pt }% \anchor{left of north west}{% - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% \pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% + \pgf@y=\pgfutil@tempdima }% %% %% @@ -5935,13 +4255,16 @@ % Call a function that computes a border point. Since this % function will modify dimensions like \pgf@x, we must move them to % other dimensions. - \@tempdima=\pgf@x - \@tempdimb=\pgf@y + \pgfutil@tempdima=\pgf@x + \pgfutil@tempdimb=\pgf@y \pgfpointborderrectangle% - {\pgfpoint{\@tempdima}{\@tempdimb}}% - {\pgfpointadd{\upperrightcorner}{\pgfpoint{\width}{\height}}} + {\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}% + {\upperrightcorner}% + }% + \backgroundpath{% + \pgfkeysvalueof{/pgfplots/@backgroundpath@hook/.@cmd}\pgfeov + \pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}% }% - \backgroundpath{\pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}}% \foregroundpath{}% \behindbackgroundpath{}% \beforebackgroundpath{}% @@ -5950,47 +4273,359 @@ } \def\pgfplots@draw@axis{% - \ifpgfplots@hide@x\else - % compute tick position lists - % \pgfplots@prepared@tick@positions@minor@x - % and - % \pgfplots@prepared@tick@positions@major@x - \expandafter\pgfplots@prepare@ticks@for\expandafter{\pgfplots@xtick}{x}{0}% - \pgfplots@drawgridlines@for{x}{0}% - \fi - \ifpgfplots@hide@y\else - \expandafter\pgfplots@prepare@ticks@for\expandafter{\pgfplots@ytick}{y}{1}% - \pgfplots@drawgridlines@for{y}{1}% - \fi % - \ifpgfplots@hide@x\else - \pgfplots@drawticklines@for{x}{0}% + % Preparation for axis lines and discontinuities: + \pgfplots@drawaxis@lines@preparediscont@for{x}% + \pgfplots@drawaxis@lines@preparediscont@for{y}% + \ifpgfplots@threedim + \pgfplots@drawaxis@lines@preparediscont@for{z}% \fi - \ifpgfplots@hide@y\else - \pgfplots@drawticklines@for{y}{1}% + \ifpgfplots@threedim + \pgfplots@separate@axis@linestrue + \else + \ifnum\pgfplots@xaxislinesnum>0 + \pgfplots@separate@axis@linestrue + \fi + \ifnum\pgfplots@yaxislinesnum>0 + \pgfplots@separate@axis@linestrue + \fi \fi % - \pgfplots@drawaxis@lines + \pgfplots@decide@which@figure@surfaces@are@drawn % + % compute tick position lists + % \pgfplots@prepared@tick@positions@minor@x + % and + % \pgfplots@prepared@tick@positions@major@x \ifpgfplots@hide@x\else - \pgfplots@drawticklabels@for{x}{0}% + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter x\expandafter{\pgfplots@xtick}% \fi \ifpgfplots@hide@y\else - \pgfplots@drawticklabels@for{y}{1}% + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter y\expandafter{\pgfplots@ytick}% \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z\else + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter z\expandafter{\pgfplots@ztick}% + \fi + \ifcase\pgfplots@zaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% + \pgfplots@draw@axis@insurface@symmetric xyz0 + % + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}% + \pgfplots@draw@axis@insurface@symmetric xyz1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@logical@ZERO@z}{2}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \fi % - \ifpgfplots@hide@x\else - \ifx\pgfplots@extra@xtick\pgfutil@empty - \else - \expandafter\pgfplots@draw@extra@ticks@for\expandafter x\expandafter0\expandafter{\pgfplots@extra@xtick}% + \ifcase\pgfplots@xaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx0 + % + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx0 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@logical@ZERO@x}{2}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 \fi + % + \ifcase\pgfplots@yaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + % + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@logical@ZERO@y}{2}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \fi + \else + % Just use the 2d-point commands (assuming Z=0) + \let\pgfplotspointonorientedsurfaceabsetupforxyz=\pgfplotspointonorientedsurfaceabsetupforxy + \let\pgfplotspointonorientedsurfaceabsetupforyxz=\pgfplotspointonorientedsurfaceabsetupforyx + \pgfplots@draw@axis@insurface@symmetric xyz2 \fi - \ifpgfplots@hide@y\else - \ifx\pgfplots@extra@ytick\pgfutil@empty +}% + +% Defines booleans for every surface of the axis cube indicating +% whether they shall be drawn or not. +% +% For 2D, the only available surface is 'vv0' (x=variing; y=variing; z=zmin) +% For 3D, there are surfaces +% - 'vv0' 'vv1' +% - 'v0v' 'v1v' +% ' '0vv' '1vv' +% +% @see \pgfplotspointonorientedsurfaceabmatchaxisline for details +% about those three-character ids. +% +% @PRECONDITION +% +% @POSTCONDITION +% for every available surface, a macro '\pgfplots@surfenabled@CCC' +% is defined to be either '0' or '1'. +% Thus, we don't have real TeX booleans, "only" those one-character +% strings. +% +% ABOUT THE ALGORITHM: +% I find it really hard to decide exactly which surfaces shall be drawn. After +% all, PGF is 2D and notions like "above" are not possible. +% So, I resorted to an heuristic approach which will (hopefully) prove +% to be a good idea: +% +% ASSUMPTION: +% 1. We have a right-handed-coordinate system. The heuristics here +% WILL fail in every other case. +% 2. The z-axis points to the top of the paper. +% Again, the heuristics WILL fail if that is not the case. +% Both assumptions happen to be reasonable for most cases. +% I will have to think about those cases where they are not +% reasonable. +% +% Now, the heuristics ONLY CHECKS THE 'y' components of the the three +% basis vectors. Since per assumption (1.), z_y > 0, there remain only +% a handful of cases for x_y > 0, x_y <0, y_y > 0 and y_y <0. I have +% hard-coded good approaches for each of them below. +\def\pgfplots@decide@which@figure@surfaces@are@drawn{% + \ifpgfplots@threedim + \begingroup + \gdef\pgfplots@glob@TMPa{% + % This here is the "fall-back" solution: simple enable + % every axis. + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + }% + \let\xaxisy=\pgf@ya + \let\yaxisy=\pgf@yb + \let\zaxisy=\pgf@yc + \pgfplotspointxaxis + \xaxisy=\pgf@y + \pgfplotspointyaxis + \yaxisy=\pgf@y + \pgfplotspointzaxis + \zaxisy=\pgf@y + \ifdim\zaxisy>0pt + % CASE I : + \ifdim\xaxisy>0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{0}% + % + \def\pgfplots@xticklabelaxisspec{v00}% + \def\pgfplots@yticklabelaxisspec{1v0}% + \def\pgfplots@zticklabelaxisspec{00v}% + }% + \fi + \fi + % CASE II: + \ifdim\xaxisy<0pt + \else + \ifdim\yaxisy<0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + % + \def\pgfplots@xticklabelaxisspec{v00}% + \def\pgfplots@yticklabelaxisspec{0v0}% + \def\pgfplots@zticklabelaxisspec{01v}% + }% + \fi + \fi + % CASE III: + \ifdim\xaxisy<0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + % + \def\pgfplots@xticklabelaxisspec{v10}% + \def\pgfplots@yticklabelaxisspec{0v0}% + \def\pgfplots@zticklabelaxisspec{11v}% + }% + \fi + \fi + % CASE IV: + \ifdim\xaxisy>0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{0}% + % + \def\pgfplots@xticklabelaxisspec{v10}% + \def\pgfplots@yticklabelaxisspec{1v0}% + \def\pgfplots@zticklabelaxisspec{10v}% + }% + \fi + \fi + \fi + \endgroup + % and activate the macro: + \pgfplots@glob@TMPa + \else + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn##1##2##3{##2}% ALWAYS TRUE + \fi +} + +% Processes every tick mark in direction #1 and draws tick lines, tick +% labels, grid lines, axis lines and extra ticks. +% +% #1 : the direction into which tick positions are processed. +% #2 : the direction in which tick lines and grid lines shall be drawn. +% #3 : the direction which is currently fixed. +% #4 : an integer used to decide whether tick LABELS shall be drawn. +% The following values are accepted: +% 0 : we are on the "left". So, draw tick labels if '#3ticklabel pos==left' +% 1 : we are on the "right". So, draw tick labels if '#3ticklabel pos==right' +% 2 : draw tick labels anyway. +% +\def\pgfplots@draw@axis@insurface#1#2#3#4{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + % + \pgfplots@drawticklines@onorientedsurf + % + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2% + \pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3% + % + \pgfplots@drawticklabels@onorientedsurf + % + \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty \else - \expandafter\pgfplots@draw@extra@ticks@for\expandafter y\expandafter1\expandafter{\pgfplots@extra@ytick}% + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% \fi + }% +}% + +% A variant of \pgfplots@draw@axis@insurface which is equivalent to +% \pgfplots@draw@axis@insurface #1#2#3#4 +% \pgfplots@draw@axis@insurface #2#1#3#4 +% with slightly optimized execution sequence. +\def\pgfplots@draw@axis@insurface@symmetric#1#2#3#4{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + }% + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawticklines@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawticklines@onorientedsurf + }% + % + \ifpgfplots@separate@axis@lines + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2% + \pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3% + }% + % + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#2#1% + \pgfplots@drawaxis@innerlines@onorientedsurf#2#1#3% + }% + \else + % this happens if and only if d=2 and the axis lines are drawn + % as box. + \pgfplots@drawaxis@outerlines@cycledpath \fi + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawticklabels@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawticklabels@onorientedsurf + }% + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty + \else + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% + \fi + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \expandafter\ifx\csname pgfplots@extra@#2tick\endcsname\pgfutil@empty + \else + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@ytick}% + \fi + }% +}% + +\def\pgfplots@draw@axis@insurface@onlyticksandgrid#1#2#3{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + \pgfplots@drawticklines@onorientedsurf + }% }% \def\pgfplots@BEGIN@init@and@draw@axis{% @@ -5998,7 +4633,6 @@ \setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup \pgfinterruptpicture \tikzpicture[/pgfplots/every axis]% - %\pgfqkeys{/tikz}{every axis}% % set baseline for sub-picture to default value. % the baseline option will be applied to the OUTER picture. \pgfsetbaseline{\pgf@picminy}% @@ -6008,11 +4642,48 @@ \else \pgfplots@draw@axis \fi - \clip - (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX); + % CLIPPING: + \pgfplots@clippath@prepare + \pgfplots@clippath@install } +% Defines \pgfplots@clippath@install. +% @PRECONDITION the axis limits must be ready. +\def\pgfplots@clippath@prepare{% + \ifpgfplots@threedim + % FIXME : this can't be done in three dimensions. :-( + % -> for 3d, I need to clip at least the 2d projection. + % FIXME : which path(s) do I need for 3d? + \let\pgfplots@clippath@install=\pgfutil@empty + \else + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \edef\pgfplots@loc@TMPa{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}% + \edef\pgfplots@loc@TMPb{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + \edef\pgfplots@loc@TMPc{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}% + \edef\pgfplots@loc@TMPd{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \begingroup + \toks0=\expandafter{\pgfplots@loc@TMPa}% + \toks1=\expandafter{\pgfplots@loc@TMPb}% + \toks2=\expandafter{\pgfplots@loc@TMPc}% + \toks3=\expandafter{\pgfplots@loc@TMPd}% + \xdef\pgfplots@glob@TMPa{% + \noexpand\pgfpathmoveto{\the\toks0 }% + \noexpand\pgfpathlineto{\the\toks1 }% + \noexpand\pgfpathlineto{\the\toks2 }% + \noexpand\pgfpathlineto{\the\toks3 }% + \noexpand\pgfusepath{clip}% + }% + \endgroup + \let\pgfplots@clippath@install=\pgfplots@glob@TMPa + \fi +}% + +\def\pgfplots@clippath@install{% + \pgfplots@error{Can't install a clippath here - the command has not yet been prepared.}% +}% \def\pgfplots@END@init@and@draw@axis{% \endscope% @@ -6027,7 +4698,9 @@ \ifpgfplots@clip@marker@paths \else \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{% + \scope% make sure that 'fill opacity' and 'dotted' styles remain local! \pgfplots@loc@TMPa + \endscope }% \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear. \fi @@ -6080,17 +4753,17 @@ \expandafter\pgfplots@loc@TMPc\expandafter{\pgfmathresult}\pgfeov \fi \let\pgfplots@loc@TMPc=\pgfmathresult% FIXME: is that necessary? I doubt it... but just to make sure... - \expandafter\let\expandafter\if@datascaled@cur\csname ifpgfplots@apply@datatrafo@#1\endcsname \csname ifpgfplots@#1islinear\endcsname - \if@datascaled@cur + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% \csname pgfplots@datascaletrafo@fromfixed@#1\endcsname{\pgfplots@loc@TMPc}% - \fi + }{}% \else \pgfmathlog@{\pgfplots@loc@TMPc}% \fi } \long\def\pgfplots@evalute@tikz@coord@system@interface#1,#2\pgfplots@coord@end{% + \global\let\pgfplots@glob@TMPc=\pgfutil@empty \begingroup \pgfplots@evalute@tikz@coord@system@interface@for{x}{#1}% \let\pgfplots@evaluate@tikz@coord@x=\pgfmathresult @@ -6098,7 +4771,11 @@ \xdef\pgfplots@glob@TMPa{\pgfplots@evaluate@tikz@coord@x}% \xdef\pgfplots@glob@TMPb{\pgfmathresult}% \endgroup - \pgfqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% + \ifx\pgfplots@glob@TMPc\pgfutil@empty + \pgfplotsqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% + \else + \pgfplotsqpointxyz{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}{\pgfplots@glob@TMPc}% FIXME: read 3D! + \fi } % In case of (semi-) logplots, this command will @@ -6116,7 +4793,7 @@ % - coordinate filters to compute logs are installed % % See also: -% \pgfplots@apply@data@scale@trafo@to@options@for +% \pgfplots@check@and@apply@datatrafo@for \def\pgfplots@prepare@coord@filtering@for#1{% \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \expandafter\let\csname pgfplots@highlevel@trafo@#1\endcsname=\pgfplots@loc@TMPc @@ -6124,12 +4801,12 @@ % no high-level external coord trafos. % Simply use identity: \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \def\pgfmathresult{##1}% + \edef\pgfmathresult{##1}% }% \else % Apply external coordinate trafo to all input values: \expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{% - \noexpand\def\noexpand\pgfmathresult{##1}% + \noexpand\edef\noexpand\pgfmathresult{##1}% \expandafter\noexpand\csname pgfplots@highlevel@trafo@#1\endcsname{##1}\noexpand\pgfeov }% % @@ -6149,6 +4826,20 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % + % any user-specified tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + % % any user specified axis ticks: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6194,13 +4885,25 @@ \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi + % Check for any existing tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi \fi \else % This here could be done using a high level coord trafo as % well! However, I don't want to risk accidentally overwritten % keys, so I replicate it here. - \ifpgfplots@disablelogfilter - \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{\relax}{% % any user-specified axis limits: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6215,6 +4918,20 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % + % any user-specified tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + % % any user specified axis ticks: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6238,16 +4955,37 @@ \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \pgfmathlog@{##1}% + \edef\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{% + \pgfmathfloatparsenumber{##1}% + \pgfmathfloattofixed{\pgfmathresult}% + }{% + \pgfmathlog@{##1}% + }% + \fi }% \else % This is a bit complicated... but it works. - \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@prepare@#1coord\endcsname{##1}\expandafter\pgfmathlog@\expandafter{\pgfmathresult}}% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{% + \csname pgfplots@prepare@#1coord\endcsname{##1}% + \edef\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{% + \pgfmathfloatparsenumber{##1}% + \pgfmathfloattofixed{\pgfmathresult}% + }{% + \expandafter\pgfmathlog@\expandafter{\pgfmathresult}% + }% + \fi + }% \edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka}% \expandafter\def\expandafter\pgfplots@loc@TMPa\expandafter##\expandafter1\expandafter{\pgfplots@loc@TMPa}% \expandafter\let\csname pgfplots@prepare@#1coord\endcsname=\pgfplots@loc@TMPa \fi - \fi + }% \fi } @@ -6268,6 +5006,16 @@ \pgfplots@show@label{y}{\pgfplots@label@}% \fi \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z + \else + \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{z}{\pgfplots@label@}% + \fi + \fi + \fi % \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6289,6 +5037,12 @@ \def\pgfplots@datascaletrafo@redoshift@y#1{% \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% }% +\def\pgfplots@datascaletrafo@undoshift@z#1{% + \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% +}% +\def\pgfplots@datascaletrafo@redoshift@z#1{% + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% +}% % DATA TRANSFORMATION T(x) = X - xmin % @@ -6331,6 +5085,19 @@ \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@datascaletrafo@z#1{% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@z}% +} +\def\pgfplots@datascaletrafo@fromfixed@z#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfplots@datascaletrafo@z\expandafter{\pgfmathresult}% +} +\def\pgfplots@datascaletrafo@z@noshift#1{% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % INVERSE transformation x = T^{-1}( X ) % Input: @@ -6403,6 +5170,36 @@ \endgroup } +\def\pgfplots@inverse@datascaletrafo@z#1{% + \begingroup + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% + \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult + \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% + \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +% Overloaded function. This one does only apply the scaling, no shift. +\def\pgfplots@inverse@datascaletrafo@z@noshift#1{% + \begingroup + \pgfmathapproxequalto@{#1}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{#1}% + \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + % Overloaded function. % % In contrast to \pgfplots@inverse@datascaletrafo@x, this method @@ -6416,6 +5213,10 @@ \pgfplots@inverse@datascaletrafo@y{#1}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@inverse@datascaletrafo@tofixed@z#1{% + \pgfplots@inverse@datascaletrafo@z{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % Overloaded function. % @@ -6428,6 +5229,10 @@ \pgfplots@inverse@datascaletrafo@y@noshift{#1}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@inverse@datascaletrafo@tofixed@z@noshift#1{% + \pgfplots@inverse@datascaletrafo@z@noshift{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % Parses all options in #1 which are known in the currently active families. % @@ -6501,6 +5306,9 @@ \let\prettyprintnumber=\pgfmathprintnumber% \def\pgfplots@set@options#1{% + \pgfplots@bb@isactivetrue + \pgfplots@curplot@threedimfalse + \global\pgfplots@threedimfalse \pgfutil@ifundefined{tikz@lastx}{% % no warning. Its not that important anyway, I think. \def\pgfplots@at{\pgfpointorigin}% @@ -6512,16 +5320,8 @@ % This allows to get the names - they should not be appended to % 'every axis'! \pgfkeys{% - /tikz/domain/.belongs to family=/pgfplots, - /pgfplots/domain/.code={\pgfkeysalso{/tikz/domain=##1}}, /tikz/name/.belongs to family=/pgfplots/naming commands, /tikz/alias/.belongs to family=/pgfplots/naming commands, - % and provide aliases in the '/pgfplots/' tree to avoid - % search path problems just for these two options: - /pgfplots/name/.belongs to family=/pgfplots/naming commands, - /pgfplots/alias/.belongs to family=/pgfplots/naming commands, - /pgfplots/name/.code={\pgfkeysalso{/tikz/name=##1}}, - /pgfplots/alias/.code={\pgfkeysalso{/tikz/alias=##1}}, % % /pgf/key filter handlers/append filtered to/.install key filter handler=\pgfplots@rmopts, @@ -6569,6 +5369,9 @@ \fi \fi \pgfplots@deactivefamiliescmd + \pgfkeysdef{/pgfplots/xmode}{\pgfplots@error{You can't set 'xmode' in this context, sorry.}}% + \pgfkeysdef{/pgfplots/ymode}{\pgfplots@error{You can't set 'ymode' in this context, sorry.}}% + \pgfkeysdef{/pgfplots/zmode}{\pgfplots@error{You can't set 'zmode' in this context, sorry.}}% % % Acquire style commands and nameing commands from direct input % options '#1' BEFORE the 'every' styles are processed: @@ -6662,6 +5465,14 @@ \global\pgfkeysgetvalue{/pgfplots/xmax}{\pgfplots@xmax}% \global\pgfkeysgetvalue{/pgfplots/ymin}{\pgfplots@ymin}% \global\pgfkeysgetvalue{/pgfplots/ymax}{\pgfplots@ymax}% + \global\pgfkeysgetvalue{/pgfplots/zmin}{\pgfplots@zmin}% + \global\pgfkeysgetvalue{/pgfplots/zmax}{\pgfplots@zmax}% + \pgfkeysgetvalue{/pgfplots/xtickmin}{\pgfplots@xtickmin}% + \pgfkeysgetvalue{/pgfplots/xtickmax}{\pgfplots@xtickmax}% + \pgfkeysgetvalue{/pgfplots/ytickmin}{\pgfplots@ytickmin}% + \pgfkeysgetvalue{/pgfplots/ytickmax}{\pgfplots@ytickmax}% + \pgfkeysgetvalue{/pgfplots/ztickmin}{\pgfplots@ztickmin}% + \pgfkeysgetvalue{/pgfplots/ztickmax}{\pgfplots@ztickmax}% % \def\pgfplots@loc@TMPa{data}% \pgfplots@collect@firstplot@astickfalse @@ -6671,13 +5482,17 @@ \ifx\pgfplots@ytick\pgfplots@loc@TMPa \pgfplots@collect@firstplot@asticktrue \fi + \ifx\pgfplots@ztick\pgfplots@loc@TMPa + \pgfplots@collect@firstplot@asticktrue + \fi \ifpgfplots@collect@firstplot@astick - \let\pgfplots@firstplot@coords@x=\pgfutil@empty - \let\pgfplots@firstplot@coords@y=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@x=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@y=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty \fi \pgfkeysdef{/pgfplots/.unknown}{% \let\pgfplots@searchname=\pgfkeyscurrentname - \pgfkeysalso{/tikz/\pgfplots@searchname=##1}% + \pgfkeysalso{/tikz/\pgfplots@searchname={##1}}% }% } @@ -6727,14 +5542,16 @@ }% % temporary (local) variables inside of axis -\newif\ifpgfplots@autocomputeanylimits \newif\ifpgfplots@autocompute@all@limits \newif\ifpgfplots@autocompute@xmin \newif\ifpgfplots@autocompute@xmax \newif\ifpgfplots@autocompute@ymin \newif\ifpgfplots@autocompute@ymax +\newif\ifpgfplots@autocompute@zmin +\newif\ifpgfplots@autocompute@zmax \newif\ifpgfplots@apply@datatrafo@x \newif\ifpgfplots@apply@datatrafo@y +\newif\ifpgfplots@apply@datatrafo@z \newif\ifpgfplots@apply@datatrafo \newif\ifpgfplots@datascaletrafo@initialised \newif\ifpgfplots@draw@at@end @@ -6793,6 +5610,12 @@ \t@pgfplots@toka=\expandafter{\pgfplots@curlegendcode current plot style\pgfeov}% \t@pgfplots@tokb=\expandafter{\pgfplots@label@tikzopts}% \t@pgfplots@tokc=\expandafter{\pgfplots@crossref@pic\pgfeov}% + % 1. prepare /pgfplots/refstyle={#1}: + \immediate\write\@auxout{% + \noexpand\expandafter\noexpand\gdef + \noexpand\csname pgfplots@labelstyle@#1\noexpand\endcsname{\the\t@pgfplots@tokb}% + }% + % 2. prepare \ref{#1} and \pageref{#1}: \edef\pgfplots@loc@TMPa{% \noexpand\begingroup \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@tokb}}% @@ -6808,15 +5631,121 @@ \fi }% -\def\pgfplots@interruptdatabb{% - \def\pgfplots@update@limits@for@one@point##1##2##3##4{}% -}% -\def\endpgfplots@interruptdatabb{% - \let\pgfplots@update@limits@for@one@point=\pgfplots@update@limits@for@one@point@orig -}% +\def\pgfplots@interruptdatabb{\pgfplots@bb@isactivefalse} +\def\endpgfplots@interruptdatabb{\pgfplots@bb@isactivetrue} + +% +% \begin{axis}[#1] : +% +% This command prepares the axis for collection. NOTHING will be drawn +% until \end{axis}. During the collect phase, axis limits will be +% computed. +% +% The following variables are accummulated between +% \begin{axis} +% and +% \end{axis}: +% +% - \pgfplots@[xyz]min +% \pgfplots@[xyz]max +% - These denote the axis limits. +% - They are always assigned globally. +% - For linear axes, they will be computed in floating point. +% - For log axes, they will be computed using pgf math engine. +% - \pgfplots@[xyz]min@reg +% - A register containing the value of macro \pgfplots@[xyz]min +% in pt. It is only valid during \end{axis}. +% - \pgfplots@[xyz]max@reg +% - The same for 'max'. +% - \pgfplots@invalidrange@[xyz]min +% \pgfplots@invalidrange@[xyz]max +% A value which is used for the axis limits before the +% limit computation starts. +% - \pgfplots@data@[xyz]min +% \pgfplots@data@[xyz]max +% - DATA limits. These limits are not affected by limit +% restrictions +% - They are used to initialise the data scaling trafo. +% - They WON'T be assigned for log axes. +% - Assigned globally. +% - \pgfplots@[xyz]min@unscaled@as@float +% - Assigned during \end{axis} (local variables). +% - Contain the value of axis limits as floating point numbers +% in the original data range. +% - \pgfplots@metamin +% \pgfplots@metamax +% - if meta data is active, these macros will contain the upper +% and lower bound for meta data. +% - will be assigned globally. +% - \pgfplots@numplots +% - A count register indexing the current plot counter. Assigned +% globally. +% - \ifpgfplots@apply@datatrafo +% A boolean which indicates whether any scaling trafo is +% active. +% - \ifpgfplots@apply@datatrafo@[xyz] +% Booleans indicating whether for which axes the scaling trafo +% is active. +% - \pgfplots@stored@plotlist +% - An instance of pgfplotslist. +% - It is assigned globally. +% - Every \addplot or tikz path command is collected into this +% structure. +% - The element type is a compound object containing everything +% needed to process the plot during \end{axis}. +% - \pgfplots@plotspeclist +% - instance of pgfplotslist +% - collects every line specification for \addplot. +% - Used to assemble legends. +% - Assigned globally. +% - \pgfplots@legend +% - instance of pgfplotslist +% - collects every legend entry. +% - Used to assemble legends. +% - Assigned globally. +% - \pgfplots@data@scale@trafo@SHIFT@[xyz] +% \pgfplots@data@scale@trafo@EXPONENT@[xyz] +% - For any direction for which the scaling trafo is active, +% these macros contain the two parameters for the affine scaling +% trafo. +% - \pgfplots@firstplot@coords@[xyz] +% - A macro containing a comma separated list +% - It is collected if and only if [xyz]tick = 'data'. +% - Contains a list of coordinates in floating point +% representation if the axis is linear. +% - The coordinates are in pgf math notation for log axes. +% - Assigned globally. +% - \pgfplots@[xyz]@veclength +% - A macro containing the vector length of the [xyz] unit +% vector. +% - Assigned in \end{axis} +% - \pgfplots@[xyz]@inverseveclength +% - A macro containing the INVERSE vector length of the [xyz] +% unit vector. +% - Assigned in \end{axis} +% - \pgfplotspoint[xyz]axis +% - A macro which sets 'pgf@x' and 'pgf@y' to the [xyz] axis. +% - \pgfplotspoint[xyz]axislength +% - A macro containing the vector length of the [xyz] axis +% (including the 'pt' suffix). +% +% - \ifpgfplots@curplot@threedim +% - valid during an '\addplot' preparation step. +% - \ifpgfplots@threedim +% - whether the axis shall be threedimensional. +% +% - \pgfplots@currentplot@firstcoord@[xyz] +% - \pgfplots@currentplot@lastcoord@[xyz] +% - contains the first/last coordinate of the current plot. +% - assigned globally. +% - \ifpgfplots@coord@stream@isfirst +% - assigned globally during \addplot. +% +% \def\pgfplots@environment@opt[#1]{% \begingroup + \pgfplots@checkandpreparefor@active@semicolon \pgfplots@install@abbrev@commands \pgfplots@stacked@initialise % @@ -6830,6 +5759,7 @@ % '1pt' here as well. \pgfsetxvec{\pgfqpoint{1pt}{0pt}}% \pgfsetyvec{\pgfqpoint{0pt}{1pt}}% + \pgfsetzvec{\pgfqpoint{1.2pt}{1.2pt}}% % \pgfplots@set@options{#1}% % @@ -6843,6 +5773,7 @@ % -------------------- \pgfplots@prepare@coord@filtering@for x \pgfplots@prepare@coord@filtering@for y + \pgfplots@prepare@coord@filtering@for z \ifpgfplots@apply@datatrafo \pgfplots@datascaletrafo@initialisedfalse \else @@ -6867,48 +5798,63 @@ \def\pgfplots@invalidrange@ymin{16300}% \def\pgfplots@invalidrange@ymax{-16300}% \fi + \ifpgfplots@zislinear + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@zmin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@zmax=\pgfmathresult + \else + \def\pgfplots@invalidrange@zmin{16300}% + \def\pgfplots@invalidrange@zmax{-16300}% + \fi % % These numbers will ONLY be filled for linear axis! \global\let\pgfplots@data@xmin=\pgfplots@invalidrange@xmin \global\let\pgfplots@data@xmax=\pgfplots@invalidrange@xmax \global\let\pgfplots@data@ymin=\pgfplots@invalidrange@ymin \global\let\pgfplots@data@ymax=\pgfplots@invalidrange@ymax + \global\let\pgfplots@data@zmin=\pgfplots@invalidrange@zmin + \global\let\pgfplots@data@zmax=\pgfplots@invalidrange@zmax % \pgfplots@autocompute@all@limitstrue \ifx\pgfplots@xmin\pgfutil@empty \pgfplots@autocompute@xmintrue \global\let\pgfplots@xmin=\pgfplots@invalidrange@xmin - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@xmax\pgfutil@empty \pgfplots@autocompute@xmaxtrue \global\let\pgfplots@xmax=\pgfplots@invalidrange@xmax - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@ymin\pgfutil@empty \pgfplots@autocompute@ymintrue \global\let\pgfplots@ymin=\pgfplots@invalidrange@ymin - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@ymax\pgfutil@empty \pgfplots@autocompute@ymaxtrue \global\let\pgfplots@ymax=\pgfplots@invalidrange@ymax - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi - % - % autocomputelimits := at least one limit needs to be updated. - \ifpgfplots@autocomputeanylimits - \pgfplots@draw@at@endtrue + \ifx\pgfplots@zmin\pgfutil@empty + \pgfplots@autocompute@zmintrue + \global\let\pgfplots@zmin=\pgfplots@invalidrange@zmin + \else + \global\pgfplots@threedimtrue + \pgfplots@autocompute@all@limitsfalse + \fi + \ifx\pgfplots@zmax\pgfutil@empty + \pgfplots@autocompute@zmaxtrue + \global\let\pgfplots@zmax=\pgfplots@invalidrange@zmax + \else + \global\pgfplots@threedimtrue + \pgfplots@autocompute@all@limitsfalse \fi - % % % -------------------- % Start axis: @@ -6916,7 +5862,8 @@ % -------------------- % % Since I've introduced a public \numplots macro, I should - % make sure it's filled correctly: + % make sure it's filled correctly. + % All versions from now on will store plots until \end{axis}: \pgfplots@draw@at@endtrue % \ifpgfplots@collect@firstplot@astick @@ -6949,12 +5896,16 @@ \let\path=\pgfplots@replacement@for@tikz@path \let\closedcycle=\pgfplots@path@closed@cycle \ifpgfplots@draw@at@end - \let\pgfplots@nextcommand=\relax \else - \def\pgfplots@nextcommand{\pgfplots@BEGIN@init@and@draw@axis}% + \expandafter% remove the '\fi' + \pgfplots@BEGIN@init@and@draw@axis \fi - \pgfplots@nextcommand } + +% \end{axis} : +% +% This command actually takes all collected (global) variables, +% creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% \xdef\numplots{\the\pgfplots@numplots}% \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% @@ -6968,6 +5919,10 @@ % All plotting commands have been read. % -> apply postponed drawing commands! % -------------------- + + + + \ifpgfplots@draw@at@end% ALWAYS TRUE - this is obsolete \def\pgfplots@nextcommand{% \pgfplots@BEGIN@init@and@draw@axis @@ -6981,13 +5936,21 @@ \pgfplotslistforeach\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa %\message{Processing stored plot with precommand '\meaning\pgfplots@stored@current@precmd'; pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd' postcommand '\meaning\pgfplots@stored@current@postcmd'}% - % The precmd processed any error bars. - \pgfplots@stored@current@precmd + % The precmd sets all required variables needed to + % finalize a plot. + % @see the stream preparation routines. \ifx\pgfplots@stored@current@cmd\pgfutil@empty + \pgfplots@stored@current@precmd \pgfplots@stored@current@data% \else % this code here means we REALLY have a plotting % command! + \pgfplots@stored@current@precmd + % de-activate the FPU here! I fear its number + % format may cause errors when used in low-level + % routines. + \pgfkeys{/pgf/fpu=false}% + % \ifpgfplots@stacked@reverse % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. \pgfplots@stacked@draw@reversed@plot @@ -7009,20 +5972,22 @@ % \begingroup % set coordinate system to (0,0) rectangle (1,1) for descriptions: - \pgftransformxshift{\pgfplots@xcoordminTEX}% - \pgftransformyshift{\pgfplots@ycoordminTEX}% + \pgftransformshift{\pgfplotspointsouthwest}% + % This here is a preparation macro for \pgfplots@low@level@shape@INNER. + % It applies the shift to the ORIGIN as well. + % It will ONLY be expanded if someone uses origin-anchors + % inside of axis descriptions. + \def\pgfplotspointORIGIN@tmp{% + \pgfpointdiff + {\pgfplotspointsouthwest}% + {\pgfqpoint{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}}% + }% + \pgfsetxvec{\pgfplotspointxaxis}% + \pgfsetyvec{\pgfplotspointyaxis}% % - % create a 'current axis' node for anchor references. + % create a leight-weight 'current axis' node for anchor references. \pgfmultipartnode{pgfplots@low@level@shape@INNER}{south west}{current axis}{\pgfusepath{discard}}% % - \pgfplots@tmpa=\pgfplots@xcoordmaxTEX - \advance\pgfplots@tmpa by-\pgfplots@xcoordminTEX - \pgfsetxvec{\pgfqpoint{\pgfplots@tmpa}{0cm}}% - % - \pgfplots@tmpa=\pgfplots@ycoordmaxTEX - \advance\pgfplots@tmpa by-\pgfplots@ycoordminTEX - \pgfsetyvec{\pgfqpoint{0cm}{\pgfplots@tmpa}}% - % \pgfplots@create@axis@descriptions \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% \endgroup @@ -7041,19 +6006,12 @@ \xdef\pgfplots@saveddimen@picminx{\the\pgf@picminx}% \xdef\pgfplots@saveddimen@picminy{\the\pgf@picminy}% % - \pgf@xa=\pgfplots@xcoordmaxTEX - \advance\pgf@xa by-\pgf@picminx - \xdef\pgfplots@savedanchor@inner@upperright@x{\the\pgf@xa}% - % - \pgf@xa=\pgfplots@xcoordminTEX + \pgfplotspointsouthwest + \pgf@xa=\pgf@x \advance\pgf@xa by-\pgf@picminx \xdef\pgfplots@savedanchor@inner@lowerleft@x{\the\pgf@xa}% % - \pgf@xa=\pgfplots@ycoordmaxTEX - \advance\pgf@xa by-\pgf@picminy - \xdef\pgfplots@savedanchor@inner@upperright@y{\the\pgf@xa}% - % - \pgf@xa=\pgfplots@ycoordminTEX + \pgf@xa=\pgf@y \advance\pgf@xa by-\pgf@picminy \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% % @@ -7124,6 +6082,7 @@ \pgfutil@for\pgfplots@child@node@name:=\pgfplots@named@child@node@list\do{% \ifx\pgfplots@child@node@name\pgfutil@empty \else +%\message{Attempting to correct '\pgfplots@child@node@name' position (it is inside of an axis).}% \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% \pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}% @@ -7190,3 +6149,6 @@ \tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis \tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis + + +\catcode`\;=\pgfplots@oldcatcodesemicolon diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex index 90ca205c835..14b81c1a7c4 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex @@ -130,23 +130,47 @@ \fi \fi \def\pgfplots@stacked@getnextzerolevelpoint{}% will remain constant anyway. + \ifpgfplots@curplot@threedim + \def\pgfplots@stacked@zerolevelpoint@z{0}% + \ifpgfplots@datascaletrafo@initialised + \else + \ifpgfplots@zislinear + \pgfmathfloatcreate{0}{0.0}{0}% + \let\pgfplots@stacked@zerolevelpoint@z=\pgfmathresult + \fi + \fi + \fi \else {\globaldefs=1 \pgfplotslistcopy\pgfplots@stacked@nextzerolevellist\to\pgfplots@stacked@zerolevellist }% - \def\pgfplots@stacked@getnextzerolevelpoint{% - {\globaldefs=1 - \pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult + \ifpgfplots@curplot@threedim + \def\pgfplots@stacked@getnextzerolevelpoint{% + {\globaldefs=1 + \pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult + }% + \expandafter\pgfplots@stacked@parsezerolevelpoint@threedim\pgfmathresult\relax }% - \expandafter\pgfplots@stacked@parsezerolevelpoint\pgfmathresult - }% + \else + \def\pgfplots@stacked@getnextzerolevelpoint{% + {\globaldefs=1 + \pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult + }% + \expandafter\pgfplots@stacked@parsezerolevelpoint\pgfmathresult\relax + }% + \fi \fi \global\pgfplotslistnewempty\pgfplots@stacked@nextzerolevellist }% -\def\pgfplots@stacked@parsezerolevelpoint(#1,#2){% +\def\pgfplots@stacked@parsezerolevelpoint(#1,#2)\relax{% + \def\pgfplots@stacked@zerolevelpoint@x{#1}% + \def\pgfplots@stacked@zerolevelpoint@y{#2}% +} +\def\pgfplots@stacked@parsezerolevelpoint@threedim(#1,#2,#3)\relax{% \def\pgfplots@stacked@zerolevelpoint@x{#1}% \def\pgfplots@stacked@zerolevelpoint@y{#2}% + \def\pgfplots@stacked@zerolevelpoint@z{#3}% } \def\pgfplots@stacked@endplot{% @@ -168,7 +192,7 @@ % \ifpgfplots@stacked@isfirstplot NOR the zero level lists are % initialised! \def\pgfplots@stacked@initzerolevelhandler{% - \ifpgfplots@stacked@x + \if\pgfplots@stacked@dir x \pgfplotxzerolevelstream@@list \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% \else @@ -177,16 +201,25 @@ \fi }% +% #1: a point as (x,y) (or (x,y,z) ) \def\pgfplots@stacked@rememberzerolevelpoint@for@next@plot#1{% \edef\pgfplots@loc@TMPa{#1}% \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@stacked@nextzerolevellist } -\def\pgfplots@stacked@finishpoint#1#2{% +% PRECONDITION: +% Is in invoked inside of a coord preparation routine, that means +% - \pgfplots@current@point@[xyz] +% - \ifpgfplots@curplot@threedim +% are all set properly. +\def\pgfplots@stacked@finishpoint{% \ifpgfplots@stacked@isfirstplot \else + % FIXME : This needs to be converted to logical coords. + % + % FIXME : 3D is not supported by the low level plot interface (yet). \pgfpointxy{\pgfplots@stacked@zerolevelpoint@x}{\pgfplots@stacked@zerolevelpoint@y}% - \ifpgfplots@stacked@x + \if\pgfplots@stacked@dir x \edef\pgfplots@loc@TMPa{\the\pgf@x}% \else \edef\pgfplots@loc@TMPa{\the\pgf@y}% @@ -199,46 +232,42 @@ \fi }% -\def\pgfplots@stacked@preparepoint@inmacro#1#2{% +% PRECONDITION: +% Is in invoked inside of a coord preparation routine, that means +% - \pgfplots@current@point@[xyz] +% - \ifpgfplots@curplot@threedim +% are all set properly. +% +% POSTCONDITION: +% - \pgfplots@current@point@[xyz] are adjusted. +\def\pgfplots@stacked@preparepoint@inmacro{% \pgfplots@stacked@getnextzerolevelpoint - \ifpgfplots@stacked@x - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathadd@ - \else - \let\pgfplots@stacked@op=\pgfmathsubtract@ - \fi - \ifpgfplots@xislinear - \ifpgfplots@datascaletrafo@initialised - \else - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathfloatadd@ - \else - \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ - \fi - \fi - \fi - \pgfplots@stacked@op{\pgfplots@stacked@zerolevelpoint@x}{#1}% - \let#1=\pgfmathresult + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathadd@ \else - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathadd@ + \let\pgfplots@stacked@op=\pgfmathsubtract@ + \fi + \pgfplots@if{pgfplots@\pgfplots@stacked@dir islinear}{% + \ifpgfplots@datascaletrafo@initialised \else - \let\pgfplots@stacked@op=\pgfmathsubtract@ - \fi - \ifpgfplots@yislinear - \ifpgfplots@datascaletrafo@initialised + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathfloatadd@ \else - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathfloatadd@ - \else - \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ - \fi + \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ \fi \fi - \pgfplots@stacked@op{\pgfplots@stacked@zerolevelpoint@y}{#2}% - \let#2=\pgfmathresult + }{}% + \edef\pgfplots@loc@TMPa{ + \noexpand\pgfplots@stacked@op + {\csname pgfplots@stacked@zerolevelpoint@\pgfplots@stacked@dir\endcsname}% + {\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}}% + \pgfplots@loc@TMPa + \expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname=\pgfmathresult + \ifpgfplots@curplot@threedim + \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z)}% + \else + \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% \fi - \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(#1,#2)}% } % This here is a re-implementation of the stored plot processing. @@ -301,13 +330,13 @@ % preparation commands to ensure the functionality of % \pgfplots@stacked@finalize@stored@plots % -% Instead, it generates a macro #4 which - if used as "precommand" -% befor a draw operation - restores all required options and performs +% The macro #4 will - if used as "precommand" +% befor a draw operation - restore all required options and performs % pre-drawing. -\long\def\pgfplots@stacked@finalize@stored@coords@START plot coordinates #1#2;\to#3#4{% +\long\def\pgfplots@stacked@finalize@stored@coords@START normalized coordinates #1#2;\to#3#4{% \pgfplots@stacked@beginplot \pgfplots@coord@stream@INIT@finalize@stackedcoords@recordto{#3}{\pgfplots@recorded@marker@stream}% - \pgfplots@coord@stream@foreach{#1}% + \pgfplots@coord@stream@foreach@NORMALIZED{#1}% \pgfplots@stacked@endplot \pgfplots@stacked@savestateto\pgfplots@loc@TMPa \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\def\pgfplots@stacked@stored@postpath{#2}}% @@ -345,43 +374,82 @@ \global\let#2=\pgfplots@loc@TMPa \fi }% + % + \begingroup + \let\E=\noexpand + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro + % Will be inserted in one of two possible places below: + \def\pgfplots@loc@TMPa{% + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds%% + }% + % This finalize command maps the logical coordinate into PGF's + % point space. Furthermore, it collects marker coordinates + % (properly clipped by position) if markers are required (see + % above). + % + % It is prepared here to eliminate if's. + \xdef\pgfplots@coord@stream@finalize@currentpt{% + \ifpgfplots@curplot@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{\E\pgfplots@current@point@z}% + \else + \ifpgfplots@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{0.0}% + \else + \E\pgfplotsqpointxy{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}% + \fi + \fi + \E\edef\E\pgfmathresult{{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\t@pgfplots@toka=\E\expandafter{\E#1}% + \E\t@pgfplots@tokb=\E\expandafter{\E\pgfmathresult}% + \E\xdef\E#1{\E\the\E\t@pgfplots@toka + \E\noexpand\E\pgfplots@stream\E\the\E\t@pgfplots@tokb}% + % + \ifpgfplots@record@marker@stream + \E\pgf@xa=\E\pgfplots@current@point@x pt % FIXME : SCOPE REGISTERS!? + \E\pgf@ya=\E\pgfplots@current@point@y pt % + \ifpgfplots@curplot@threedim + \E\pgf@yb=\E\pgfplots@current@point@z pt % + \fi + \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg + \E\else + \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg + \E\else + \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg + \E\else + \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\else + \ifpgfplots@curplot@threedim + \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg + \E\else + \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\else + \pgfplots@loc@TMPa + \E\fi + \E\fi + \else + \pgfplots@loc@TMPa + \fi + \E\fi + \E\fi + \E\fi + \E\fi + \fi + }% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \endgroup + % \ifpgfplots@apply@datatrafo - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \pgfplots@apply@data@scaletrafo@to@one@point{##1}{##2}{##3}{##4}% + \def\pgfplots@coord@stream@coord@{% + \pgfplots@apply@data@scaletrafo@to@one@point% \pgfplots@coord@stream@finalize@currentpt }% \else - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \def\pgfplots@current@point@x{##1}% - \def\pgfplots@current@point@y{##2}% + \def\pgfplots@coord@stream@coord@{% \pgfplots@coord@stream@finalize@currentpt }% \fi - \def\pgfplots@coord@stream@finalize@currentpt{% - \pgfqpointxy{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \edef\pgfmathresult{{\the\pgf@x}{\the\pgf@y}}% - \t@pgfplots@toka=\expandafter{#1}% - \t@pgfplots@tokb=\expandafter{\pgfmathresult}% - \xdef#1{\the\t@pgfplots@toka - \noexpand\pgfplots@stream\the\t@pgfplots@tokb}% - % - \ifpgfplots@record@marker@stream - \ifdim\pgf@x<\pgfplots@xcoordminTEX - \else - \ifdim\pgf@x>\pgfplots@xcoordmaxTEX - \else - \ifdim\pgf@y<\pgfplots@ycoordminTEX - \else - \ifdim\pgf@y>\pgfplots@ycoordmaxTEX - \else - \edef\pgfmathresult{\noexpand\pgfplots@stream{\the\pgf@x}{\the\pgf@y}}% - \expandafter\pgfplotsapplistXpushback\expandafter{\pgfmathresult}\to\pgfplots@stacked@record@mark@cmds% - \fi - \fi - \fi - \fi - \fi - }% } % This command gets called after the sequence reversal has been done. @@ -407,12 +475,14 @@ \ifx\pgfplots@recorded@marker@stream\pgfutil@empty \else \ifpgfplots@clip@marker@paths + \scope% make sure that 'fill opacity' and 'dotted' styles remain local! \pgfplots@stored@current@cmd[current plot style] \pgfextra \pgfplots@install@plotmark@handler \pgfplots@recorded@marker@stream \endpgfextra ; + \endscope \else \pgfplots@stored@REMEMBER@MARK@COMMAND \fi diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex new file mode 100644 index 00000000000..4e00a678252 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex @@ -0,0 +1,3251 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% 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. +% +% This program is free software: you can redistribute it and/or modify +% 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/>. +% +%-------------------------------------------- + +% This file contains the code to process coordinates +% - coordinate input: \addplot and its variants, +% - coordinate loops, +% - single coordinate processing + + + +% Denotes a point in a twodimensional hyperplane. The hyperplane is +% one of the six planes of the threedimensional axis cube. +% +% The meaning of coordinates #1 and #2 will be redefined depending on +% which surface we are currently processing. You can get the axis +% names for '#1' (a) and '#2' (b) using the macros +% \pgfplotspointonorientedsurfaceA +% and +% \pgfplotspointonorientedsurfaceB. +% +% Example: +% \pgfplotspointonorientedsurfaceabsetupforxyz{0} +% -> +% \pgfplotspointonorientedsurfaceA = x +% \pgfplotspointonorientedsurfaceB = y +% \pgfplotspointonorientedsurfaceab{3}{4} = \pgfqpointxyz{3}{4}{0} +% +% \pgfplotspointonorientedsurfaceabsetupforyxz{0} +% -> +% \pgfplotspointonorientedsurfaceA = y +% \pgfplotspointonorientedsurfaceB = x +% \pgfplotspointonorientedsurfaceab{3}{4} = \pgfqpointxyz{4}{3}{0} +% +% @see \pgfplotspointonorientedsurfaceabsetupforxyz +\def\pgfplotspointonorientedsurfaceab#1#2{% + \pgfplots@error{Internal logic error: \string\pgfplotspointonorientedsurfaceab\ used although surface has not been declared! You need to call \string\pgfplotspointonorientedsurfaceabsetupforxyz\ or its friends to do so.}% +}% + +% This macro will be defined after +% \pgfplotspointonorientedsurfaceabsetupfor... +% routines. It expands to a three-character string +% where the first character contains information about the x axis, +% the second about the y axis and the third about the z axis. +% +% The single characters can be one of +% - 'a' - the corresponding axis is the PRIMARY direction of the +% oriented surface. +% - 'b' - the corresponding axis is the SECONDARY direction of the +% oriented surface. +% - anything else - the characters provides as second argument for +% \pgfplotspointonorientedsurfaceabsetupforsetz{}{}, for example. +% Common choices are '0' for lower limit, '1' for upper limit and +% '2' for other. +\def\pgfplotspointonorientedsurfacespec{}% + +% Similar to \pgfplotspointonorientedsurfacespec, this macro encodes +% the currently active oriented surface. +% However, it only contains the characters 'v', '0' and '1' and '2'. +% The distinction 'v in {a,b}' is eliminated. +\def\pgfplotspointonorientedsurfacespecunordered{}% + +% Initialises \pgfplotspointonorientedsurfaceab such that 'a' is the x +% axis and 'b' is the y axis and the z coordinate has been fixed with +% \pgfplotspointonorientedsurfaceabsetupforsetz{}. +% +% The Z value needs to be fixed with +% \pgfplotspointonorientedsurfaceabsetupforsetz . +% +\def\pgfplotspointonorientedsurfaceabsetupforxyz{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##1}{##2}{\pgfplotspointonorientedsurfaceabsetupfor@fixedZ}}% + \def\pgfplotspointonorientedsurfaceA{x}% + \def\pgfplotspointonorientedsurfaceB{y}% + \edef\pgfplotspointonorientedsurfacespec{ab\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforyxz{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##2}{##1}{\pgfplotspointonorientedsurfaceabsetupfor@fixedZ}}% + \def\pgfplotspointonorientedsurfaceA{y}% + \def\pgfplotspointonorientedsurfaceB{x}% + \edef\pgfplotspointonorientedsurfacespec{ba\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforxzy{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##1}{\pgfplotspointonorientedsurfaceabsetupfor@fixedY}{##2}}% + \def\pgfplotspointonorientedsurfaceA{x}% + \def\pgfplotspointonorientedsurfaceB{z}% + \edef\pgfplotspointonorientedsurfacespec{a\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol b}% + \edef\pgfplotspointonorientedsurfacespecunordered{v\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol v}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforzxy{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##2}{\pgfplotspointonorientedsurfaceabsetupfor@fixedY}{##1}}% + \def\pgfplotspointonorientedsurfaceA{z}% + \def\pgfplotspointonorientedsurfaceB{x}% + \edef\pgfplotspointonorientedsurfacespec{b\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol a}% + \edef\pgfplotspointonorientedsurfacespecunordered{v\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol v}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforyzx{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{\pgfplotspointonorientedsurfaceabsetupfor@fixedX}{##1}{##2}}% + \def\pgfplotspointonorientedsurfaceA{y}% + \def\pgfplotspointonorientedsurfaceB{z}% + \edef\pgfplotspointonorientedsurfacespec{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol ab}% + \edef\pgfplotspointonorientedsurfacespecunordered{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol vv}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforzyx{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{\pgfplotspointonorientedsurfaceabsetupfor@fixedX}{##2}{##1}}% + \def\pgfplotspointonorientedsurfaceA{z}% + \def\pgfplotspointonorientedsurfaceB{y}% + \edef\pgfplotspointonorientedsurfacespec{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol ba}% + \edef\pgfplotspointonorientedsurfacespecunordered{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol vv}% +}% + +% Fixes 'x' to #1 for use in +% \pgfplotspointonorientedsurfaceabsetupforzyx and +% \pgfplotspointonorientedsurfaceabsetupforyzx. +% +% #1: The fixed value for 'x'. +% #2: a one-character symbol describing 'x'. +% Command characters are +% - 0 : x is the lower x-axis range. +% - 1 : x is the upper x-axis range. +% - 2 : other. +\def\pgfplotspointonorientedsurfaceabsetupforsetx#1#2{% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedX{#1}% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforsety#1#2{% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedY{#1}% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforsetz#1#2{% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedZ{#1}% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}% +}% + +% Helper methods which should be used if no Z component exists (pure +% 2d plots). +\def\pgfplotspointonorientedsurfaceabsetupforxy{% + \def\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{0}% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxy{##1}{##2}}% + \def\pgfplotspointonorientedsurfaceA{x}% + \def\pgfplotspointonorientedsurfaceB{y}% + \edef\pgfplotspointonorientedsurfacespec{ab\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforyx{% + \def\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{0}% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxy{##2}{##1}}% + \def\pgfplotspointonorientedsurfaceA{y}% + \def\pgfplotspointonorientedsurfaceB{x}% + \edef\pgfplotspointonorientedsurfacespec{ba\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% + + +% Assuming that an oriented surface has been initialised, say 'a0b', +% we have the following possible axis lines which can be drawn: +% - b=0: 'v00' +% - b=1: 'v01' +% - b=2: 'v02' +% +% To check which of them should be drawn, this macro here convert 'a' +% to 'v' and 'b' to '#1'. +% +% The resulting three-character-string is written into '#2'. +\def\pgfplotspointonorientedsurfaceabgetcontainedaxisline#1#2{% + \expandafter\pgfplotspointonorientedsurfaceabgetcontainedaxisline@\pgfplotspointonorientedsurfacespec\relax{#1}% + \let#2=\pgfplots@loc@TMPa +}% +% writes into \pgfplots@loc@TMPa: +\def\pgfplotspointonorientedsurfaceabgetcontainedaxisline@#1#2#3\relax#4{% + \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#1}{#4}\to\pgfplots@loc@TMPa + \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#2}{#4}\to\pgfplots@loc@TMPb + \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#3}{#4}\to\pgfplots@loc@TMPc + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa\pgfplots@loc@TMPb\pgfplots@loc@TMPc}% +}% +\def\pgfplotspointonorientedsurfaceabgetcontainedaxisline@single#1#2\to#3{% + \if#1a% + \def#3{v}% + \else + \if#1b% + \def#3{#2}% + \else + \def#3{#1}% + \fi + \fi +}% + + +% Finds the two surfaces which are adjacent to an axis line encoded as +% three-character-string. +% +% There are the following possibilities: +% #1 = 'v**' where '*' is not 'v'. +% -> #2 = 'vv*' and #3 = 'v*v' +% +% #1 = '*v*' +% -> #2 = 'vv*' and #3 = '*vv' +% +% #1 = '**v' +% -> #2 = 'v*v' and #3 = '*vv' +\def\pgfplotsgetadjacentsurfsforaxisline#1\to#2#3{% + \edef\pgfplots@loc@TMPa{#1}% + \expandafter\pgfplotsgetadjacentsurfsforaxisline@\pgfplots@loc@TMPa\relax{#2}{#3}% +}% +\def\pgfplotsgetadjacentsurfsforaxisline@#1#2#3\relax#4#5{% + \if#1v% + \def#4{vv#3}% + \def#5{v#2v}% + \else + \if#2v% + \def#4{vv#3}% + \def#5{#1vv}% + \else + \def#4{v#2v}% + \def#5{#1vv}% + \fi + \fi +}% + +% Executes code '#2' if the axis line with 'b=#1' on the current +% oriented surface shall be drawn. +% If that is not the case, the code '#3' will be executed. +% +% Example: +% Let's assume the current oriented surface is 'b0a'. +% Then, +% \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{draw it!}{\relax} +% will check whether the line '00v' shall be drawn while +% \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{draw it!}{\relax} +% will check whether the line '10v' shall be drawn. +% +% @see \pgfplotspointonorientedsurfaceabgetcontainedaxisline +% +% @ATTENTION : this command will be always true for the 2D case. (it +% will be overwritten, see \pgfplots@decide@which@figure@surfaces@are@drawn) +\def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn#1#2#3{% + \pgfplotspointonorientedsurfaceabgetcontainedaxisline#1\pgfplots@loc@TMPc + \pgfplotsgetadjacentsurfsforaxisline\pgfplots@loc@TMPc\to\pgfplots@loc@TMPb\pgfplots@loc@TMPc + \if1\csname pgfplots@surfenabled@\pgfplots@loc@TMPb\endcsname + #2% + \else + \if1\csname pgfplots@surfenabled@\pgfplots@loc@TMPc\endcsname + #2% + \else + #3% + \fi + \fi +}% + + +% Checks whether the line specified by a three-character-string '#1' +% is inside of the currently set-up oriented surface. +% +% The return value is encoded as integer into the macro #2 as +% described below. +% +% #1 : a three-character string uniquely identifing an axis line. +% Each of the three characters can be 'v', '0' or '1'. +% The value '0' denotes the lower axis range while '1' denotes +% the upper axis range. The character 'v' stands for 'varying' +% and indicates the direction in which the line varies. The first +% character contains the values for the 'x' axis, the second +% character for the 'y' axis and the third character for the 'z' +% axis. +% Example: +% 'v01' is the axis line with 'y=lower y limit' and 'z=upper z limit' +% '10v' is the axis line with 'x=upper x limit' and 'y=lower y limit' +% The 'v' character indicates the varying component. There may be +% only one 'v'. +% #2 : a macro name. It will be empty if the line is NOT on the +% current surface. If will be non-empty if it IS on the current +% surface. +% To be more precise, If the line IS on the current surface, '#2' will be set to +% the character in '#1' which belongs to the second oriented +% surface axis (which is called the 'b' axis). +% Thus, the following values for '#2' can be expected: +% - '' (empty) if the line is not on the surface, +% - 'v' if the line IS on the surface, and '#1' contains a 'v' +% in direction of the surface's 'b' axis. +% - '0' if the line IS on the surface and '#1' contains a '0' in +% direction of the surface's 'b' axis, +% - '1' if the line IS on the surface and '#1' contains a '1' in +% direction of the surface's 'b' axis. +% No other values are possible. +% +% Example: +% \pgfplotspointonorientedsurfaceabsetupforsetz{\zmax}{1} +% \pgfplotspointonorientedsurfaceabsetupforyxz +% \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result} +% -> \result will be 'v' because 'x=v' in '{v01} +% +% \pgfplotspointonorientedsurfaceabsetupforsety{\ymin}{0} +% \pgfplotspointonorientedsurfaceabsetupforxzy +% \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result} +% -> \result will be '1' because 'z=1' in '{v01} +% +% \pgfplotspointonorientedsurfaceabsetupforsety{\ymax}{1} +% \pgfplotspointonorientedsurfaceabsetupforxzy +% \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result} +% -> \result will be empty because 'y=0' in '{v01} +% +% \pgfplotspointonorientedsurfaceabsetupforsetx{\xmax}{1} +% \pgfplotspointonorientedsurfaceabsetupforyzx +% \pgfplotspointonorientedsurfaceabmatchaxisline{10v}{\result} +% -> \result will be 'v' because 'z=v' in '{10v} +\def\pgfplotspointonorientedsurfaceabmatchaxisline#1#2{% + \pgfplotsmatchcubeparts{#1}{\pgfplotspointonorientedsurfacespec}{#2}% +}% + +% Checks whether the line or surface specified by a three-character-string '#1' +% is inside of the surface designated by the three-character-string '#2'. +% +% +% Arguments: +% #1 a cube-part (axis line or surface) encoded as three character +% string. Can be '0v1' or 'vv0' or so (see above). +% #2 a surface, also encoded as three character string. Maybe +% oriented. +% #3 The return value is encoded as integer into the macro #3 as +% described in \pgfplotspointonorientedsurfaceabmatchaxisline: +% '#3' will be EMPTY if '#1' NOT in '#2'. +% '#3' will be NON-EMPTY if '#1' IN '#2'. +\def\pgfplotsmatchcubeparts#1#2#3{% + \edef\pgfplots@loc@TMPa{#1:#2}% + \expandafter\pgfplotspointonorientedsurfaceabmatchaxisline@\pgfplots@loc@TMPa\pgfplots@EOI + \let#3=\pgfplots@loc@TMPa +}% + +% IMPLEMENTATION: +% The return value is 'yes, #1#2#3 is on the oriented surface #4#5#6' +% if and only if for all three character pairs, the following single +% relations hold. +% Input char oriented surface char +% 'v' : is either a or b or v +% '0' : is either 0, a, b, v or 2 (i.e. NOT 1) +% '1' : is either 1, a, b, v or 2 (i.e. NOT 0) +% That's all. +% +% If the 'oriented surface char' is 'v', then we actually don't have +% an oriented surface but just a surface. +% So, 'a0b' is the same surface as 'v0v', but the first choice has +% designated orientations. +% +% @POST \pgfplots@loc@TMPa contains the return value macro. +\def\pgfplotspointonorientedsurfaceabmatchaxisline@#1#2#3:#4#5#6\pgfplots@EOI{% + % Search for the 'b' character: + \if#4b% + \def\pgfplots@loc@TMPa{#1}% + \else + \if#5b% + \def\pgfplots@loc@TMPa{#2}% + \else + \if#6b% + \def\pgfplots@loc@TMPa{#3}% + \else + \def\pgfplots@loc@TMPa{v}% FALLBACK solution. + \fi + \fi + \fi + % Now, check whether we need to clear the return value (i.e. + % return false) + \pgfplotspointonorientedsurfaceabmatchaxisline@single{#1}{#4}% + \pgfplotspointonorientedsurfaceabmatchaxisline@single{#2}{#5}% + \pgfplotspointonorientedsurfaceabmatchaxisline@single{#3}{#6}% +} +\def\pgfplotspointonorientedsurfaceabmatchaxisline@single#1#2{% + \if#1v% + \if#2a% + \else + \if#2b% + \else + \if#2v% + \else + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \fi + \fi + \else + \if0#1% + \if1#2% + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \else + \if1#1% + \if0#2% + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \else + \pgfplots@error{The character '#1' is no valid element for a three-character axis line or surface description!}% + \fi + \fi + \fi +}% + +% Takes Pitch '#1' and Yaw '#2' (both in degrees) and computes +% x,y and z vectors which define the view in the direction +% defined by '#1' and '#2'. +% +% 'Pitch' means a rotation around the viewport's x axis. 'Yaw' means +% a rotation around the original coordinate system's z axis. +% +% The method works by computing +% Az = [ cos(yaw) -sin(yaw) 0; ... +% sin(yaw) cos(yaw) 0; ... +% 0 0 1 ]; +% Ax = [ 1 0 0; ... +% 0 cos(pitch) -sin(pitch) ;... +% 0 sin(pitch) cos(pitch) ]; +% v= Ax * Az; +% +% = [ ... +% cosy -siny cosp siny sinp; ... +% siny cosy cosp -sinp cosy; ... +% 0 sinp cosp ]; +% +% Then, we use the rotated XY plane as viewport, that means +% xvec = v * [1 0 0]' +% yvec = v * [0 1 0]' +% and we define the projection onto the twodimensional surface +% spanned by 'xvec' and 'yvec' as +% P( q ) = [ q^T xvec, q^T yvec ]' +% for q in R^3. +% As a consequence, we compute the three unit vectors as +% x = P( [1 0 0] ) +% y = P( [0 1 0] ) +% z = P( [0 0 1] ) +% and get thus in matlab notation: +% +% proj = 1:2; +% x = v(1,proj); +% y = v(2,proj); +% z = v(3,proj); +% +% INPUT: +% - #1 : pitch +% - #2 : yaw +% OUTPUT: +% - #3 : a macro which will be set to '1' if and only if +% the viewport is the standard XY axis (i.e. pitch=0,yaw=0). +% - \pgfplots@[xyz]@veclength +% \pgfplots@[xyz]@inverseveclength +% are set properly +\def\pgfplotssetaxesfrompitchyaw#1#2#3{% + \begingroup + \pgfmathsin@{#1}% + \let\sinp=\pgfmathresult + \pgfmathsin@{#2}% + \let\siny=\pgfmathresult + \pgfmathcos@{#1}% + \let\cosp=\pgfmathresult + \pgfmathcos@{#2}% + \let\cosy=\pgfmathresult + % x: + \pgfmathmultiply@{\siny}{-1}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\cosp}% + \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpoint{\cosy pt}{\pgfmathresult pt}}% + % y: + \pgfmathmultiply@{\cosy}{\cosp}% + \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpoint{\siny pt}{\pgfmathresult pt}}% + % z: + \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpoint{0pt}{\sinp pt}}% + \endgroup +\message{Setting x,y and z from {#1}{#2} to x = \meaning\pgfplots@glob@TMPa, y = \meaning\pgfplots@glob@TMPb, z = \meaning\pgfplots@glob@TMPc...}% + \pgfsetxvec{\pgfplots@glob@TMPa}% + \pgfsetyvec{\pgfplots@glob@TMPb}% + \pgfsetzvec{\pgfplots@glob@TMPc}% + \def#3{0}% + \def\pgfplots@x@veclength{1.0}% + \def\pgfplots@y@veclength{1.0}% + \def\pgfplots@z@veclength{1.0}% + \def\pgfplots@x@inverseveclength{1.0}% + \def\pgfplots@y@inverseveclength{1.0}% + \def\pgfplots@z@inverseveclength{1.0}% +% FIXME : +\def\scale{200}% +\pgfmathreciprocal@{\scale}% +\let\invscale=\pgfmathresult +\pgfsetxvec{\pgfpointscale{\scale}{\pgfplots@glob@TMPa}}% +\pgfsetyvec{\pgfpointscale{\scale}{\pgfplots@glob@TMPb}}% +\pgfsetzvec{\pgfpointscale{\scale}{\pgfplots@glob@TMPc}}% +\let\pgfplots@x@veclength=\scale% +\let\pgfplots@y@veclength=\scale% +\let\pgfplots@z@veclength=\scale% +\let\pgfplots@x@inverseveclength=\invscale% +\let\pgfplots@y@inverseveclength=\invscale% +\let\pgfplots@z@inverseveclength=\invscale% +}% + + + +% Internal stream methods. +% +% Please overwrite +% - \pgfplots@coord@stream@start@, +% - \pgfplots@coord@stream@end@ and +% - \pgfplots@coord@stream@coord@ +% if you implement streams. +% +% REMARK: +% - the stream methods automatically collect first and last +% coordinates. +% - I have experimented with global \addplot accumulation to reduce +% copy operations. That experiment was not successfull (it was not +% faster :-( ). However, the streaming methods still assign their +% things globally... +\newif\ifpgfplots@coord@stream@isfirst +\def\pgfplots@coord@stream@start{% + \global\pgfplots@coord@stream@isfirsttrue + \global\let\pgfplots@currentplot@firstcoord@x=\pgfutil@empty + \global\let\pgfplots@currentplot@firstcoord@y=\pgfutil@empty + \global\let\pgfplots@currentplot@firstcoord@z=\pgfutil@empty + \global\let\pgfplots@currentplot@lastcoord@x=\pgfutil@empty + \global\let\pgfplots@currentplot@lastcoord@y=\pgfutil@empty + \global\let\pgfplots@currentplot@lastcoord@z=\pgfutil@empty + \let\pgfplots@current@point@x=\pgfutil@empty + \let\pgfplots@current@point@y=\pgfutil@empty + \let\pgfplots@current@point@z=\pgfutil@empty + \let\pgfplots@current@point@meta=\pgfutil@empty + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \pgfplots@coord@stream@start@}% +\def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@} + +% Will be invoked for every point coordinate. +% +% It invokes \pgfplots@coord@stream@coord@. +% +% Arguments: +% \pgfplots@current@point@[xyz] +% \pgfplots@current@point@[xyz]@error (if in argument list) +% \pgfplots@current@point@meta +\def\pgfplots@coord@stream@coord{% + \pgfplots@coord@stream@coord@% + % FIXME : needs to be updated for 3D + % FIXME : reduce \if's + \ifx\pgfplots@current@point@x\pgfutil@empty + \else + \ifx\pgfplots@current@point@y\pgfutil@empty + \else + \ifpgfplots@coord@stream@isfirst + \global\let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x + \global\let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y + \global\pgfplots@coord@stream@isfirstfalse + \fi + \global\let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x + \global\let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y + \fi + \fi +}% + +% Initialises +% \pgfplots@coord@stream@start +% \pgfplots@coord@stream@coord +% \pgfplots@coord@stream@end +% such that a following coordinate stream is processed properly. The +% following coordinate stream may come from different input methods. +% +% Arguments: +% #1: all options of \addplot[...] (the plot style) +% #2: any trailing path commands after the 'plot' command as such, +% for example \addplot plot coordinates {...} -- (0,0); +% would yield #2 =' -- (0,0)' +% +% PRECONDITION: +% - needs to be called inside of \addplot. +% +% REMARK: +% The following code is permissable: +% \pgfplots@PREPARE@COORD@STREAM{..}{...} +% \pgfplots@coord@stream@start +% ... +% \pgfplots@coord@stream@coord +% .. +% \pgfplots@coord@stream@coord +% .. +% \pgfplots@coord@stream@end +% -> All need to be the SAME LEVEL OF SCOPING! The '@coord' commands +% may not be scoped deeper than 'begin' and 'end'! +% - I had a version which allowed that. it was actually slower! +% - For now, the following things are global / local: +% - point coordinate list: local +% - meta data limits: global, +% - recorded error bar commands: local, +% - what about stacked plot stuff: appears to be a combination +% of local/global. +% +\long\def\pgfplots@PREPARE@COORD@STREAM#1#2{% + \ifpgfplots@curplot@threedim + \global\pgfplots@threedimtrue + \fi + \def\pgfplots@coord@stream@start@{% + \pgfplotsapplistXXnewempty + \ifpgfplots@errorbars@enabled + \pgfplots@streamerrorbar@recordto{\pgfplots@recordederrorbar}% + \pgfplots@streamerrorbarstart + \else + \let\pgfplots@recordederrorbar=\pgfutil@empty + \fi + \ifpgfplots@stackedmode + \pgfplots@stacked@beginplot + \fi + % + %\let\pgfplots@coord@stream@recorded=\pgfutil@empty + % + \pgfplots@perpointmeta@usesfloattrue + % %%%%%%%%%%%%%% + % + % Define \pgfplots@set@perpointmeta properly: + \ifcase\pgfplots@perpointmeta@choice + % disabled. + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfutil@empty + }% + \or + % point meta/x + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfplots@current@point@x + }% + \ifpgfplots@xislinear + \else + \pgfplots@perpointmeta@usesfloatfalse + \fi + \or + % point meta/y + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfplots@current@point@y + }% + \ifpgfplots@yislinear + \else + \pgfplots@perpointmeta@usesfloatfalse + \fi + \or + % point meta/z + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfplots@current@point@z + }% + \ifpgfplots@zislinear + \else + \pgfplots@perpointmeta@usesfloatfalse + \fi + \or + % point meta/explicit : parse the information found + % somewhere: + \def\pgfplots@set@perpointmeta{% + \pgfmathfloatparsenumber{\pgfplots@current@point@meta}% + \let\pgfplots@current@point@meta=\pgfmathresult + }% + \or + % point meta/explicit symbolic : simply collect the + % information, no math. + \def\pgfplots@set@perpointmeta{}% + \fi + \ifnum\pgfplots@perpointmeta@choice=0 + \global\let\pgfplots@metamin=\pgfutil@empty + \global\let\pgfplots@metamax=\pgfutil@empty + \else + \ifnum\pgfplots@perpointmeta@choice=5 + \global\let\pgfplots@metamin=\pgfutil@empty + \global\let\pgfplots@metamax=\pgfutil@empty + \else + % We need to work with per point meta data. + % So, also compute the data range on a per-stream basis! + % These limits are important later. + \ifpgfplots@perpointmeta@usesfloat + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@metamin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@metamax=\pgfmathresult + \global\let\pgfplots@metamin=\pgfplots@invalidrange@metamin + \global\let\pgfplots@metamax=\pgfplots@invalidrange@metamax + \expandafter\def\expandafter\pgfplots@set@perpointmeta\expandafter{% + \pgfplots@set@perpointmeta + \pgfplotsmathfloatmin{\pgfplots@metamin}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamin=\pgfmathresult + \pgfplotsmathfloatmax{\pgfplots@metamax}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamax=\pgfmathresult + }% + \else + \def\pgfplots@invalidrange@metamin{16300}% + \def\pgfplots@invalidrange@metamax{-16300}% + \global\let\pgfplots@metamin=\pgfplots@invalidrange@metamin + \global\let\pgfplots@metamax=\pgfplots@invalidrange@metamax + \expandafter\def\expandafter\pgfplots@set@perpointmeta\expandafter{% + \pgfplots@set@perpointmeta + \pgfplotsmathmin{\pgfplots@metamin}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamin=\pgfmathresult + \pgfplotsmathmax{\pgfplots@metamax}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamax=\pgfmathresult + }% + \fi + \fi + \fi + }% + \begingroup + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \let\E=\noexpand + % + % Setup Just-In-Time-Macro Compilation: + % I compile a set of macros which is highly optimized for this + % particular plot. + % + % 1.\pgfplots@update@limits@for@one@point + % Updates the current x and y limits for point (#1,#2). + % + % To eliminate all those case distinctions, it is created with + % 'edef' and a lot of '\noexpand' calls here: + % + % + % The point coordinates may be given in floating point format, see + % below. + % + % Please note that if user specified limits are given, automatic + % limits are only applied to points which fall into the user specified + % clipping region. + % + % PRECONDITIONS: + % - the input coordinates have been parsed correctly (floating point + % format for linear axis, log applied for logarithmic ones) + % + % Arguments: + % \pgfplots@current@point@[xyz] + \xdef\pgfplots@update@limits@for@one@point{% +%\E\tracingmacros=2\E\tracingcommands=2 +%\E\pgfplots@message{Updating limits for (\E\pgfplots@current@point@x,\E\pgfplots@current@point@y) ...}% + % + % VIM SEARCH PATTERN: + % [^E]\zs\\\ze[^E] + % -> this finds '\' which is neither '\E' nor is it prefixed + % by 'E'. + % + % + % + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDfalse + % check whether we need to clip limits: + \ifpgfplots@clip@limits + \ifpgfplots@autocompute@xmin + \else + \ifpgfplots@xislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@current@point@x}{\E\pgfplots@xmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@current@point@x}{\E\pgfplots@xmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@xmax + \else + \ifpgfplots@xislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@ymin + \else + \ifpgfplots@yislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@current@point@y}{\E\pgfplots@ymin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@current@point@y}{\E\pgfplots@ymin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@ymax + \else + \ifpgfplots@yislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@curplot@threedim + \else + \ifpgfplots@autocompute@zmin + \else + \ifpgfplots@zislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@current@point@z}{\E\pgfplots@zmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@current@point@z}{\E\pgfplots@zmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@zmax + \else + \ifpgfplots@zislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \fi + \fi + % + % + % + % Update limits: + \E\ifpgfplots@update@limits@for@one@point@ISCLIPPED + \E\else + \ifpgfplots@autocompute@xmin + \ifpgfplots@xislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@xmin}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmin=\E\pgfmathresult + \else + \E\pgfplotsmathmin{\E\pgfplots@xmin}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmin=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@xmax + \ifpgfplots@xislinear + \E\pgfplotsmathfloatmax{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmax=\E\pgfmathresult + \else + \E\pgfplotsmathmax{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmax=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@ymin + \ifpgfplots@yislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@ymin}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymin=\E\pgfmathresult + \else + \E\pgfplotsmathmin{\E\pgfplots@ymin}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymin=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@ymax + \ifpgfplots@yislinear + \E\pgfplotsmathfloatmax{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymax=\E\pgfmathresult + \else + \E\pgfplotsmathmax{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymax=\E\pgfmathresult + \fi + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@autocompute@zmin + \ifpgfplots@zislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@zmin}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmin=\E\pgfmathresult + \else + \E\pgfplotsmathmin{\E\pgfplots@zmin}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmin=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@zmax + \ifpgfplots@zislinear + \E\pgfplotsmathfloatmax{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmax=\E\pgfmathresult + \else + \E\pgfplotsmathmax{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmax=\E\pgfmathresult + \fi + \fi + \fi + \E\fi + % + % Compute data range: + \ifpgfplots@autocompute@all@limits + % the data range will be acquired simply from the axis + % range, see below! + \else + % Attention: it is only done for linear axis! + \ifpgfplots@xislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@data@xmin}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@data@xmin=\E\pgfmathresult + \E\pgfplotsmathfloatmax{\E\pgfplots@data@xmax}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@data@xmax=\E\pgfmathresult + \fi + \ifpgfplots@yislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@data@ymin}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@data@ymin=\E\pgfmathresult + \E\pgfplotsmathfloatmax{\E\pgfplots@data@ymax}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@data@ymax=\E\pgfmathresult + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@zislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@data@zmin}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@data@zmin=\E\pgfmathresult + \E\pgfplotsmathfloatmax{\E\pgfplots@data@zmax}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@data@zmax=\E\pgfmathresult + \fi + \fi + \fi +%\E\pgfplots@message{Updated limits: (\E\pgfplots@xmin,\E\pgfplots@ymin) rectangle (\E\pgfplots@xmax,\E\pgfplots@ymax).}% +%\E\tracingmacros=0\E\tracingcommands=0 + }% +%\message{Assembled update-limits macro to {\meaning\pgfplots@update@limits@for@one@point}}% + \ifpgfplots@bb@isactive + \else + % we are inside of + % \pgfplotsinterruptdatabb + % .. + % \endpgfinterruptboundingbox + % -> don't change data limits! + \global\let\pgfplots@update@limits@for@one@point=\relax + \fi + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % This here is the MAIN code of \pgfplots@process@one@point . + % It is inserted below into the right, into one of two prepared + % places. + \def\pgfplots@loc@TMPa{% + \ifpgfplots@apply@datatrafo + \ifpgfplots@datascaletrafo@initialised + % apply data transformation directly. + \ifpgfplots@apply@datatrafo@x + \E\pgfplots@datascaletrafo@x\E\pgfplots@current@point@x + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + \fi + \ifpgfplots@apply@datatrafo@y + \E\pgfplots@datascaletrafo@y\E\pgfplots@current@point@y + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@apply@datatrafo@z + \E\pgfplots@datascaletrafo@z\E\pgfplots@current@point@z + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + \fi + \fi + \fi + \fi + % All following routines (limit updating/stacking/error + % bars) will use float numerics if necessary (controlled + % by ifs). + \ifpgfplots@stackedmode + \E\pgfplots@stacked@preparepoint@inmacro% + \ifpgfplots@datascaletrafo@initialised% is also true if there is no scale trafo. + \E\pgfplots@stacked@finishpoint + \else + % the finishpoint routine will be invoked at + % \endaxis. + \fi + \fi + % + % Prepare \pgfplots@current@point@meta (see the preparation + % routine above): + \E\pgfplots@set@perpointmeta + % + % update also axis / data limits: + % Arguments: \pgfplots@current@point@[xy] + \E\pgfplots@update@limits@for@one@point + \ifpgfplots@errorbars@enabled + % This thing gets the 'current@point@...' context, + % that means + % \pgfplots@current@point@[xy] + % \pgfplots@current@point@[xy]@error + % \pgfplots@current@point@[xy]@unfiltered + \E\pgfplots@process@errorbar@for% + \fi + % + % Store normalized point for list: + % We need + % xi,yi,zi,mi; + % where zi and mi may be empty. mi is the per-point meta + % information. It is used for per-coordinate marker + % modifications (like colormaps for scatter plots). + \E\edef\E\pgfplots@loc@TMPa{\E\pgfplots@current@point@x,\E\pgfplots@current@point@y,\E\pgfplots@current@point@z,\E\pgfplots@current@point@meta;}% + \E\expandafter\E\pgfplotsapplistXXpushback\E\expandafter{\E\pgfplots@loc@TMPa}% + % + \ifpgfplots@collect@firstplot@astick + \ifnum\pgfplots@numplots=0 + \E\ifx\E\pgfplots@firstplot@coords@x\E\pgfutil@empty + \E\t@pgfplots@tokc={}% + \E\else + \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@x,}% + \E\fi + \E\xdef\E\pgfplots@firstplot@coords@x{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@x}% + \E\ifx\E\pgfplots@firstplot@coords@y\E\pgfutil@empty + \E\t@pgfplots@tokc={}% + \E\else + \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@y,}% + \E\fi + \E\xdef\E\pgfplots@firstplot@coords@y{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@y}% + % + \ifpgfplots@curplot@threedim + \E\ifx\E\pgfplots@firstplot@coords@z\E\pgfutil@empty + \E\t@pgfplots@tokc={}% + \E\else + \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@z,}% + \E\fi + \E\xdef\E\pgfplots@firstplot@coords@z{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@z}% + \fi + \fi + \fi + }% + % The following code assembles the command which is executed for + % each coordinate. + % + % To eliminate all those case distinctions, it is created with + % 'edef' and a lot of '\noexpand' calls here: + % + % Arguments: + % \pgfplots@current@point@[xyz] + % \pgfplots@current@point@[xyz]@error (if in argument list) + \xdef\pgfplots@process@one@point{% + % These things are necessary for error bars: + \E\let\E\pgfplots@current@point@x@unfiltered=\E\pgfplots@current@point@x + \E\let\E\pgfplots@current@point@y@unfiltered=\E\pgfplots@current@point@y + \ifpgfplots@curplot@threedim + \E\let\E\pgfplots@current@point@z@unfiltered=\E\pgfplots@current@point@z + \fi + % + \E\pgfplots@prepare@xcoord{\E\pgfplots@current@point@x}% + \E\expandafter\E\pgfplots@invoke@filter\E\expandafter{\E\pgfmathresult}{x}% + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + % + \E\pgfplots@prepare@ycoord{\E\pgfplots@current@point@y}% + \E\expandafter\E\pgfplots@invoke@filter\E\expandafter{\E\pgfmathresult}{y}% + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + % + \ifpgfplots@xislinear + \E\ifx\E\pgfplots@current@point@x\E\pgfutil@empty + \E\else + \E\pgfmathfloatparsenumber{\E\pgfplots@current@point@x}% + \E\expandafter\E\pgfmathfloat@decompose@F\E\pgfmathresult\E\relax\E\c@pgf@counta + \E\ifnum\E\c@pgf@counta>2 + \E\let\E\pgfplots@current@point@x=\E\pgfutil@empty + \E\else + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + \E\fi + \E\fi + \fi + % + \ifpgfplots@yislinear + \E\ifx\E\pgfplots@current@point@y\E\pgfutil@empty + \E\else + \E\pgfmathfloatparsenumber{\E\pgfplots@current@point@y}% + \E\expandafter\E\pgfmathfloat@decompose@F\E\pgfmathresult\E\relax\E\c@pgf@counta + \E\ifnum\E\c@pgf@counta>2 + \E\let\E\pgfplots@current@point@y=\E\pgfutil@empty + \E\else + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + \E\fi + \E\fi + \fi + % + \ifpgfplots@curplot@threedim + \E\let\E\pgfplots@current@point@z@unfiltered=\E\pgfplots@current@point@z + \E\pgfplots@prepare@zcoord{\E\pgfplots@current@point@z}% + \E\expandafter\E\pgfplots@invoke@filter\E\expandafter{\E\pgfmathresult}{z}% + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + % + \ifpgfplots@zislinear + \E\ifx\E\pgfplots@current@point@z\E\pgfutil@empty + \E\else + \E\pgfmathfloatparsenumber{\E\pgfplots@current@point@z}% + \E\expandafter\E\pgfmathfloat@decompose@F\E\pgfmathresult\E\relax\E\c@pgf@counta + \E\ifnum\E\c@pgf@counta>2 + \E\let\E\pgfplots@current@point@z=\E\pgfutil@empty + \E\else + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + \E\fi + \E\fi + \fi + \fi + % + \E\ifx\E\pgfplots@current@point@x\E\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \E\pgfplots@message{NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered\ifpgfplots@curplot@threedim,\E\pgfplots@current@point@z@unfiltered\fi) has been dropped because of the x-coordinate filter.}% + \fi + \E\else + \E\ifx\E\pgfplots@current@point@y\E\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \E\pgfplots@message{NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered\ifpgfplots@curplot@threedim,\E\pgfplots@current@point@z@unfiltered\fi) has been dropped because of the y-coordinate filter.}% + \fi + \E\else + \ifpgfplots@curplot@threedim + \E\ifx\E\pgfplots@current@point@z\E\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \E\pgfplots@message{NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered,\E\pgfplots@current@point@z@unfiltered) has been dropped because of the z-coordinate filter.}% + \fi + \E\else + % insert the main 3d code here: + \pgfplots@loc@TMPa + \E\fi + \else + % insert the main 2d code here: + \pgfplots@loc@TMPa + \fi + \E\fi + \E\fi + % + % increase \pgfplots@current@point@coordindex: + \E\begingroup + \E\c@pgf@counta=\E\pgfplots@current@point@coordindex + \E\advance\E\c@pgf@counta by1\E\relax + \E\xdef\E\pgfplots@glob@TMPc{\E\the\E\c@pgf@counta}% + \E\endgroup + \E\let\E\pgfplots@current@point@coordindex=\E\pgfplots@glob@TMPc + }% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \endgroup +%\message{Prepared macro \string\pgfplots@update@limits@for@one@point: {\meaning\pgfplots@update@limits@for@one@point}}% +%\message{Prepared macro \string\pgfplots@process@one@point: {\meaning\pgfplots@process@one@point}}% + \let\pgfplots@coord@stream@coord@=\pgfplots@process@one@point + % + \def\pgfplots@coord@stream@end@{% + \ifpgfplots@autocompute@all@limits + \global\let\pgfplots@data@xmin=\pgfplots@xmin + \global\let\pgfplots@data@xmax=\pgfplots@xmax + \global\let\pgfplots@data@ymin=\pgfplots@ymin + \global\let\pgfplots@data@ymax=\pgfplots@ymax + \global\let\pgfplots@data@zmin=\pgfplots@zmin + \global\let\pgfplots@data@zmax=\pgfplots@zmax + \fi + \ifpgfplots@errorbars@enabled + \pgfplots@streamerrorbarend + \fi + \ifpgfplots@stackedmode + \pgfplots@stacked@endplot + \fi + \ifpgfplots@coord@stream@isfirst + \pgfplots@warning{the current plot has no coordinates (left?)}% + \fi +% \else + % Idea: use + % \scope[plot specification] + % <any paths for error bars> + % \endscope + % \draw plot coordinates {...}; + % to share plot specifications between error bars and plot + % coordinates. Unfortunately, it is NOT sufficient to use + % \tikzset{#1} + \ifpgfplots@curplot@isirrelevant + \edef\pgfplots@addplot@preoptionsTMP{/pgfplots/every axis plot,/pgfplots/every forget plot/.try}% + \else + \edef\pgfplots@addplot@preoptionsTMP{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% + \expandafter\pgfplots@rememberplotspec\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% + \fi + % warning: rememberplotspec calls list macros which + % overwrite \t@pgfplots@toka + \t@pgfplots@toka=\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% + \xdef\pgfplots@last@plot@style{\the\t@pgfplots@toka}% store it for \label commands. + % ATTENTION: do NOT call list macros from here on! + % + \ifpgfplots@datascaletrafo@initialised + \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa + \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% + \else + \t@pgfplots@tokc={}% + \fi + % assembe a \pgfplots@addplot@enqueue@coords command ... + % BEGIN HERE ... + % vvvvvvvvvv + \xdef\pgfplots@glob@TMPa{% + \noexpand\pgfplots@addplot@enqueue@coords + {% precommand(s): + \expandafter\noexpand\csname pgfplots@curplot@threedim\ifpgfplots@curplot@threedim true\else false\fi\endcsname + \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% + \noexpand\pgfplots@initzerolevelhandler + \the\t@pgfplots@tokc% named start/end points (if already available) + \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@toka}}% + % per-point meta data ranges: + \noexpand\xdef\noexpand\pgfplots@metamin{\pgfplots@metamin}% + \noexpand\xdef\noexpand\pgfplots@metamax{\pgfplots@metamax}% + \ifpgfplots@perpointmeta@usesfloat + \noexpand\pgfplots@perpointmeta@usesfloattrue + \else + \noexpand\pgfplots@perpointmeta@usesfloatfalse + \fi + \noexpand\def\noexpand\pgfplots@perpointmeta@choice{\pgfplots@perpointmeta@choice}% + }% + {% draw command: + \noexpand\draw% + }% + }% + \pgfplotsapplistXXlet\pgfplots@coord@stream@recorded + \pgfplotsapplistXXclear + \t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% + \t@pgfplots@tokb={#2;}% + \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% + \xdef\pgfplots@glob@TMPa{% + \the\t@pgfplots@toka + {% coordinates which need to be processed in \endaxis: + normalized coordinates {\the\t@pgfplots@tokc}\the\t@pgfplots@tokb + }% + }% + % + % Ok, now assemble the POST COMMANDS. Error bar + % commands will be append here (if any) + \ifx\pgfplots@recordederrorbar\pgfutil@empty + \pgfplots@glob@TMPa + {% + % Post commands are empty here. + }% + \else + \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% + \t@pgfplots@tokb=\expandafter{\pgfplots@recordederrorbar}% + \def\pgfplots@loc@TMPb{% + \noexpand\pgfplots@errorbars@finishwithstyleoptions[current plot style]{\the\t@pgfplots@tokb}% + }% + \xdef\pgfplots@glob@TMPa{ + \the\t@pgfplots@toka + { + % Post commands: append error bar commands. + \pgfplots@loc@TMPb + }% + }% + \pgfplots@glob@TMPa + \fi + %^^^^^^^^^^^^ ... END of \pgfplots@addplot@enqueue@coords HERE +% \fi + \pgfplots@end@plot + }% +}% + +% Defines the linear transformation macro \pgfplots@perpointmeta@trafo, +% +% phi : [meta_min,meta,max] -> [0,10^k] +% +% which operates on the per-point meta data (if any). +% The trafo will be skipped if there is no such data. +% +% The trafo is expected to prepare meta information before it is used +% as input to \pgfplotscolormapfind. Thus, the 10^k is chosen to be +% the same as \pgfplotscolormaprange (which is 1000 per default). +% +% If there is now data range (for example because meta information is +% not available or is not of numeric type), the trafo will simply +% copy the input argument symbolically. +\def\pgfplots@perpointmeta@preparetrafo{% + \ifx\pgfplots@metamax\pgfutil@empty + \def\pgfplots@perpointmeta@trafo##1{\def\pgfmathresult{##1}}% + \def\pgfplots@perpointmeta@traforange{0:0}% + \else + % The transformation is + % + % phi(m) = ( m- meta_min) * 1000/ (meta_max-meta_min). + % + % -> precompute the scaling factor! + \ifpgfplots@perpointmeta@usesfloat + \edef\pgfplots@loc@TMPa{\pgfplotscolormaprange}% + \ifnum\pgfplots@loc@TMPa=1000 + \else + \pgfplots@error{LOGIC ERROR: sorry, I have hard-coded the assumption \string\pgfplotscolormaprange = 1000, but now it is \pgfplots@loc@TMPa.}% + \fi + \pgfmathfloatsubtract@{\pgfplots@metamax}{\pgfplots@metamin}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfmathfloatcreate{1}{1.0}{3}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfplots@loc@TMPa}% + \let\pgfplots@perpointmeta@trafo@factor=\pgfmathresult + % + % Now, setup the trafo as such. + % It assigns \pgfmathresult (in fixed point). + \def\pgfplots@perpointmeta@trafo##1{% + \pgfmathfloatsubtract@{##1}{\pgfplots@metamin}% + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfplots@perpointmeta@trafo@factor}% + \expandafter\pgfmathfloattofixed@\expandafter{\pgfmathresult}% + }% + % Expands to the transformation range as 'a:b': + \def\pgfplots@perpointmeta@traforange{0:1000}% + \else + \edef\pgfplots@loc@TMPa{\pgfplotscolormaprange}% + \ifnum\pgfplots@loc@TMPa=1000 + \else + \pgfplots@error{LOGIC ERROR: sorry, I have hard-coded the assumption \string\pgfplotscolormaprange = 1000, but now it is \pgfplots@loc@TMPa.}% + \fi + \pgfmathsubtract@{\pgfplots@metamax}{\pgfplots@metamin}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \expandafter\pgfmathdivide@\expandafter{\pgfplotscolormaprange}{\pgfplots@loc@TMPa}% + \let\pgfplots@perpointmeta@trafo@factor=\pgfmathresult + % + % Now, setup the trafo as such. + % It assigns \pgfmathresult (in fixed point). + \def\pgfplots@perpointmeta@trafo##1{% + \pgfmathsubtract@{##1}{\pgfplots@metamin}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplots@perpointmeta@trafo@factor}% + }% + % Expands to the transformation range as 'a:b': + \def\pgfplots@perpointmeta@traforange{0:1000}% + \fi + \fi +}% + +% A looping method which applies +% \pgfplots@coord@stream@start +% for each coordinate '(x,y)' or '(x,y) +- (ex,ey)', +% assign \pgfplots@current@point@[xyz] +% assign \pgfplots@current@point@[xyz]@error (if in argument list) +% assign \pgfplots@current@point@meta +% call \pgfplots@coord@stream@coord +% \pgfplots@coord@stream@end +% +% #1 a sequence of coordinates of the form +% '(x,y)' or '(x,y,z)' +% or +% '(x,y[,z]) +- (ex,ey)' +% or +% '(x,y) [meta]' +% or +% '(x,y) +- (ex,ey) [meta]' +% separated by white-space. +% +% The per-point meta is not implemented yet. +\long\def\pgfplots@coord@stream@foreach#1{% + \pgfplots@coord@stream@start + \pgfplots@foreach@plot@coord@ITERATE#1\pgfplots@EOI% + \pgfplots@coord@stream@end +}% + +% A looping command to loop through plot coordinates. +% For every point, #1{X}{Y} will be invoked. +% +% No scoping is used during this operation, so you can access outer +% variables. +\def\pgfplots@foreach@plot@coord@ITERATE{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfplots@foreach@plot@coord@FINISH% + }{% + \pgfutil@ifnextchar\par{% + \pgfplots@foreach@plot@coord@ITERATE@gobbleone + }{% + \pgfutil@ifnextchar({% + \pgfplots@foreach@plot@coord@NEXT% + }{% + \pgfplots@foreach@plot@coord@error + }% + }% + }% +} +\long\def\pgfplots@foreach@plot@coord@error#1\pgfplots@EOI{% + \pgfplots@error{Sorry, I could not read the plot coordinates near '#1'. Please check for format mistakes.}% +}% +\long\def\pgfplots@foreach@plot@coord@ITERATE@gobbleone#1{\pgfplots@foreach@plot@coord@ITERATE}% +\def\pgfplots@foreach@plot@coord@NEXT(#1,#2){% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \pgfutil@ifnextchar+{% + \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE% + }{% + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@ITERATE + }% + }% +} +\def\pgfplots@foreach@plot@coord@NEXT@meta[#1]{% + \def\pgfplots@current@point@meta{#1}% + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@ITERATE +}% +% processing something like '(x,y) +- (error_x,error_y)' +\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE+-#1({% + \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@% +} +\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@#1,#2){% + \def\pgfplots@current@point@x@error{#1}% + \def\pgfplots@current@point@y@error{#2}% + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@ITERATE + }% +} +\def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% The same for three dim coords: +\long\def\pgfplots@coord@stream@foreach@threedim#1{% + \pgfplots@coord@stream@start + \pgfplots@foreach@plot@coord@threedim@ITERATE#1\pgfplots@EOI% + \pgfplots@coord@stream@end +}% +\def\pgfplots@foreach@plot@coord@threedim@ITERATE{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfplots@foreach@plot@coord@FINISH% + }{% + \pgfutil@ifnextchar\par{% + \pgfplots@foreach@plot@coord@threedim@ITERATE@gobbleone + }{% + \pgfutil@ifnextchar({% + \pgfplots@foreach@plot@coord@threedim@NEXT% + }{% + \pgfplots@foreach@plot@coord@error + }% + }% + }% +} +\long\def\pgfplots@foreach@plot@coord@threedim@ITERATE@gobbleone#1{\pgfplots@foreach@plot@coord@threedim@ITERATE}% +\def\pgfplots@foreach@plot@coord@threedim@NEXT(#1,#2,#3){% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \pgfutil@ifnextchar+{% + \pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE% + }{% + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@threedim@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@threedim@ITERATE + }% + }% +} +\def\pgfplots@foreach@plot@coord@threedim@NEXT@meta[#1]{% + \def\pgfplots@current@point@meta{#1}% + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@threedim@ITERATE +}% +% processing something like '(x,y) +- (error_x,error_y)' +\def\pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE+-#1({% + \pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@% +} +\def\pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@#1,#2,#3){% + \def\pgfplots@current@point@x@error{#1}% + \def\pgfplots@current@point@y@error{#2}% + \def\pgfplots@current@point@z@error{#3}% + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@threedim@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@threedim@ITERATE + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% The same in normalized coordinates of the form +% x1,y1,z1,m1;x2,y2,z2,m2;...;xN,yN,zN,mN; +% if the plot is not threedim, zi is empty. +% +% The mi are Meta Values associated to point coordinates. They are +% usually empty, but can be used to realize per-point marker +% modifications (scatter plots, especially for colormaps). +\long\def\pgfplots@coord@stream@foreach@NORMALIZED#1{% + \pgfplots@coord@stream@start + \pgfplots@foreach@plot@coord@NORMALIZED@ITERATE#1\pgfplots@EOI + \pgfplots@coord@stream@end +}% + +% A looping command to loop through plot coordinates. +% For every point, #1{X}{Y} will be invoked. +% +% No scoping is used during this operation, so you can access outer +% variables. +\def\pgfplots@foreach@plot@coord@NORMALIZED@ITERATE{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfplots@foreach@plot@coord@FINISH% + }{% + \pgfplots@foreach@plot@coord@NORMALIZED@NEXT% + }% +} +\def\pgfplots@foreach@plot@coord@NORMALIZED@NEXT#1,#2,#3,#4;{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \def\pgfplots@current@point@meta{#4}% + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@NORMALIZED@ITERATE +} + + +\newif\ifpgfplots@curplot@threedim + +% 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) +% }; +% +% or one of the other input types. +% +% The first syntax will use the next plot specification in the list +% \autoplotspeclist +% and the first will use blue color and * markers. +% +% \addplot [<style options>] plot[<behavior options>] <input type and args> <post plot path> ; +% \addplot3[<style options>] plot[<behavior options>] <input type and args> <post plot path> ; +% +% The complete accumulation is done GLOBALLY. It should be safe to put +% '\addplot' into local groups. +% +% +% The linespec. will be used in the legend. +% +% Low-level implementation: +% +% \pgfplots@addplot +% \pgfplots@addplotimpl +% \pgfplots@start@plot@with@behavioroptions <--- \begingroup +% ... +% ... remember options GLOBALLY +% ... update limits GLOBALLY +% ... \pgfplots@addplot@enqueue@coords GLOBALLY +% ... +% \pgfplots@end@plot <--- \endgroup +\def\pgfplots@addplot{% + \pgfutil@ifnextchar3{% + \pgfplots@curplot@threedimtrue + \pgfplots@addplot@three + }{% + \pgfplots@curplot@threedimfalse + \pgfplots@addplot@ + }% +} +\def\pgfplots@addplot@three3{\pgfplots@addplot@}% +\def\pgfplots@addplot@{% + \pgfutil@ifnextchar+{% + \pgfplots@getautoplotspec into\nextplotspec + \pgfplots@addplotimplAPPEND + }{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl% + }{% + \pgfplots@getautoplotspec into\nextplotspec + % the space after ']' is required here: + % FIXME: + % - \addplot[]plot coordinates is NOT allowed!? + \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec]% + }% + }% +} + +\long\def\pgfplots@addplotimplAPPEND+[{% + \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec, +} + +\long\def\pgfplots@addplotimpl[#1]{% + \pgfutil@ifnextchar p{% + \pgfplots@addplotimpl@plot{#1}% + }{% + \pgfplots@addplotimpl@plot{#1}plot + }% +} + +\def\pgfplots@addplotimpl@plot#1plot{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@plot@withoptions{#1}% + }{% + \pgfplots@addplotimpl@plot@withoptions{#1}[]% + }% +} + +\def\pgfplots@addplotimpl@plot@withoptions#1[#2]{ + \begingroup% <-- This groups ends in \pgfplots@end@plot + % + \pgfutil@ifnextchar c{% + \pgfplots@addplotimpl@coordinates{#1}{#2}plot + }{% + \pgfutil@ifnextchar f{% + \pgfplots@addplotimpl@f{#1}{#2}% + }{% + \pgfutil@ifnextchar t{% + \pgfplots@start@plot@with@behavioroptions{#2}% + \pgfplots@addplotimpl@table{#1}% + }{% + \pgfutil@ifnextchar ({% + \pgfplots@addplotimpl@expression{#1}{#2}% + }{% + \pgfutil@ifnextchar\bgroup{% + \pgfplots@addplotimpl@expression@curly{#1}{#2}% + }{% + \pgfutil@ifnextchar e{% + \pgfplots@addplotimpl@expression@e{#1}{#2}% + }{% + \pgfutil@ifnextchar g{% + \pgfplots@addplotimpl@gnuplot{#1}{#2}% + }{% + \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots! Ignoring it.}% + \pgfplots@gobble@until@semicolon + }% + }% + }% + }% + }% + }% + }% +} +\def\pgfplots@addplotimpl@f#1#2f{% + \pgfutil@ifnextchar i{% + \pgfplots@addplotimpl@file{#1}{#2}% + }{% + \pgfplots@addplotimpl@function{#1}{#2}% + }% +}% + +\def\pgfplots@gobble@until@semicolon#1;{} + +% Plot expression. It invokes the pgf math parser and a customized +% pgfplots point sampling routine. Combined with the 'fixed point +% library' of pgf, it results in highly accurate plots. +% +% +\long\def\pgfplots@addplotimpl@expression#1#2(#3,#4)#5;{\pgfplots@addplotimpl@expression@{#1}{#2}{#3}{#4}{#5}}% +% \addplot[#1] [#2] (#3,#4) #5; +\long\def\pgfplots@addplotimpl@expression@#1#2#3#4#5{% + \ifpgfplots@usefpu + \def\pgfplots@loc@TMPa{/pgf/fpu=true}% + \else + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \expandafter\pgfplots@start@plot@with@behavioroptions\expandafter{\pgfplots@loc@TMPa,#2}% + \pgfplots@PREPARE@COORD@STREAM{#1}{#5}% + % + \pgfplots@validate@plot@domain@arguments + \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain + \pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at + \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}% + % + % Determine whether the x range is parameterized or uniform and + % prepare a macro which assigns \pgfplots@current@point@x: + \def\pgfplots@addplotimpl@expression@prepare@x{% + \pgfmathparse{#3}% + \let\pgfplots@current@point@x=\pgfmathresult + }% + \def\pgfplots@addplotimpl@expression@hasuniform@x{0}% + \def\pgfplots@loc@TMPa{#3}% + % do we have '\x' as x coordinate? + \expandafter\def\expandafter\pgfplots@loc@TMPb\expandafter{\tikz@plot@var}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@addplotimpl@expression@hasuniform@x{1}% + \else + \def\pgfplots@loc@TMPb{x}% + % do we have 'x' as x coordinate? + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@addplotimpl@expression@hasuniform@x{1}% + \fi + \fi + \if\pgfplots@addplotimpl@expression@hasuniform@x1% + % if '#3' is '\x' or 'x', we don't need the math parser - + % we can simply take \tikz@plot@var. + \def\pgfplots@addplotimpl@expression@prepare@x{% + \edef\pgfplots@current@point@x{\tikz@plot@var}% + }% + \fi + % + % Define a "function" x which sets \pgfmathresult := \x : + \pgfutil@ifundefined{pgfmathdeclarefunction}{% + % We have PGF 2.00 : + \def\pgfmath@parsefunction@x{\edef\pgfmathresult{\tikz@plot@var}\pgfmath@postfunction}% + \def\pgfmath@parsefunction@y{\let\pgfmathresult=\y\pgfmath@postfunction}% + }{% + % We have PGF > 2.00 : + \pgfmathdeclarefunction{x}{0}{\edef\pgfmathresult{\tikz@plot@var}}% + \pgfmathdeclarefunction{y}{0}{\let\pgfmathresult=\y}% + }% + % + % Now, prepare the loops. + % + % I am using \pgfplotsforeachungrouped in favor of + % \foreach because \foreach does NOT allow extended + % precision. Besided, \pgfplotsforeachungrouped avoids + % scoping problems. + % + \ifpgfplots@curplot@threedim + \pgfkeysgetvalue{/pgfplots/y domain}{\pgfplots@plot@ydomain}% + \def\pgfplots@addplotimpl@expression@split@yz##1,##3\pgfplots@EOI{% + \def\pgfplots@addplotimpl@expression@yEXPR{##1}% + \def\pgfplots@addplotimpl@expression@zEXPR{##3}% + }% + \pgfplots@addplotimpl@expression@split@yz#4\pgfplots@EOI% + \ifx\pgfplots@plot@ydomain\pgfutil@empty + \def\pgfplots@plot@ydomain{0:0}% + \fi + \ifx\pgfplots@plot@samples@at\pgfutil@empty + % we don't have 'samples at' -> use domain! + \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@domain\relax + \let\pgfplots@loc@TMPa=\pgfplotslocretval + \else + % use 'samples at': + \let\pgfplots@loc@TMPa=\pgfplots@plot@samples@at + \fi + \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@ydomain\relax + \let\pgfplots@loc@TMPb=\pgfplotslocretval + % Assemble a + % \pgfplots@plot@data##1 -> + % \foreach \x in {-5,-4.6,...,5} + % \foreach \y in {-5,-4.6,...,5} {##1}; + % macro: + \edef\pgfplots@plot@data##1{% + \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@loc@TMPa} + {\noexpand\pgfplotsforeachungrouped\noexpand\y in {\pgfplots@loc@TMPb} {##1}}}% + \else + % Assemble a + % \pgfplots@plot@data##1 -> \foreach \x in {-5,-4.6,...,5} {##1} macro: + % + % + % if( + % x is logarithmic && + % #3 == '\x' && + % the 'samples at' key has not been used ) + % -> sample logarithmically! + \def\pgfplots@samples@logarithmically{0}% + \ifpgfplots@xislinear + \else + \if\pgfplots@addplotimpl@expression@hasuniform@x1% + \ifx\pgfplots@plot@samples@at\pgfutil@empty + % we don't have 'samples at' -> use domain! + \def\pgfplots@samples@logarithmically{1}% + \fi + \fi + \fi + \if\pgfplots@samples@logarithmically1% + % sample logarithmically: + \edef\pgfplots@plot@data##1{% + \noexpand\pgfplotsforeachlogarithmicungrouped + \expandafter\noexpand\tikz@plot@var/\noexpand\pgfplots@current@point@x@log + in {\pgfplots@plot@domain} {##1}}% + % we have a logarithmic sampling sequence, + % \pgfplots@current@point@x@log is already available + % logarithmic! We can safe time and accuracy for the x + % coordinate by using that one instead of computing + % log(exp(\x)) numerically: + \pgfplots@disablelogfilter@xtrue + \def\pgfplots@addplotimpl@expression@prepare@x{% + \let\pgfplots@current@point@x=\pgfplots@current@point@x@log + }% + \pgflibraryfpuifactive + {\relax} + {% + % ok, if the FPU is NOT active, we should return + % results as fixed points. + % We need to configure that for + % \pgfplotsforeachlogarithmicungrouped manually: + \pgfplotsforeachlogarithmicformatresultwith{% + \pgfmathfloattofixed{\pgfmathresult}% + }% + }% + \else + \ifx\pgfplots@plot@samples@at\pgfutil@empty + % we don't have 'samples at' -> use domain! + \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@domain\relax + \let\pgfplots@loc@TMPa=\pgfplotslocretval + \else + % use 'samples at': + \let\pgfplots@loc@TMPa=\pgfplots@plot@samples@at + \fi + \edef\pgfplots@plot@data##1{ + \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@loc@TMPa} {##1}}% + \fi + \def\y{0}% + \def\pgfplots@addplotimpl@expression@yEXPR{#4}% + \def\pgfplots@current@point@z{}% + \fi + \pgfplots@coord@stream@start + \pgfplots@plot@data{% + \pgfplots@addplotimpl@expression@prepare@x% + \pgfmathparse{\pgfplots@addplotimpl@expression@yEXPR}% + \let\pgfplots@current@point@y=\pgfmathresult + \ifpgfplots@curplot@threedim + \pgfmathparse{\pgfplots@addplotimpl@expression@zEXPR}% + \let\pgfplots@current@point@z=\pgfmathresult + \fi + \pgfplots@coord@stream@coord + }% + \pgfplots@coord@stream@end +}% +% \addplot[#1] [#2] {#3} #4; +\long\def\pgfplots@addplotimpl@expression@curly#1#2#3#4;{\pgfplots@addplotimpl@expression@curly@{#1}{#2}{#3}{#4}}% +\long\def\pgfplots@addplotimpl@expression@curly@#1#2#3#4{% + \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}% + \def\pgfplots@loc@TMPa{\pgfplots@addplotimpl@expression@{#1}{#2}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\tikz@plot@var}{#3}{#4}% +}% +% \addplot[#1] [#2] expression[#3] {#4} #5; +\def\pgfplots@addplotimpl@expression@e#1#2expression{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@expression@e@{#1}{#2}% + }{% + \pgfplots@addplotimpl@expression@e@{#1}{#2}[]% + }% +}% +\def\pgfplots@addplotimpl@expression@e@#1#2[#3]{% + \pgfplots@addplotimpl@expression@curly{#1}{#2,#3}% +}% + + +\let\pgfplots@backupof@pgfplotxyfile=\pgfplotxyfile + +% the following code +% results finally in +% +% set format "%.7e";; set samples <...>; plot ... +% +% The windows port of gnuplot doesn't run without the second semicolon +% - for whatever reason. +{ + \catcode`\%=12 + \catcode`\"=12 + \catcode`\;=12 + \xdef\pgfplots@gnuplot@format{set format "%.7e";} +} + +% |\addplot gnuplot| is an alias to |\addplot function| +\def\pgfplots@addplotimpl@gnuplot#1#2gnuplot{\pgfplots@addplotimpl@function{#1}{#2}unction}% + +% \addplot[<style options>] +% plot[<behavior opts>] +% function[<further behavior opts>] +% {gnuplot code} +% #3; +% #1: args of \addplot[...] +% #2: optional arguments after function[] +% #3: gnuplot code to generate coordinates +% #4: trailing path commands until ';' +\def\pgfplots@addplotimpl@function#1#2unction{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@function@opt{#1}{#2}% + }{% + \pgfplots@addplotimpl@function@opt{#1}{#2}[]% + }% +}% +\def\pgfplots@addplotimpl@function@opt#1#2[#3]#4#5;{\pgfplots@addplotimpl@function@opt@{#1}{#2}{#3}{#4}{#5}}% +% \addplot[#1] [#2] function[#3] {#4} #5; +\def\pgfplots@addplotimpl@function@opt@#1#2#3#4#5{% + \pgfplots@start@plot@with@behavioroptions{% + #2,#3}% + \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}% + \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-plot}% + \pgfplots@gettikzinternal@keyval{raw gnuplot}{iftikz@plot@raw@gnuplot}{\iffalse}% + \pgfplots@gettikzinternal@keyval{parametric}{iftikz@plot@parametric}{\iffalse}% + \pgfplots@validate@plot@domain@arguments + \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain + \pgfkeysgetvalue{/pgfplots/y domain}{\pgfplots@plot@ydomain}% + \ifx\pgfplots@plot@domain\pgfutil@empty + % this is a potential problem: 'plot gnuplot' doesn't support + % the 'samples at' framework which should be in effect now. + % -> acquire the /tikz/domain value! + \pgfplots@gettikzinternal@keyval{domain}{tikz@plot@domain}{-5:5}% + \let\pgfplots@plot@domain=\tikz@plot@domain + \fi + % + \def\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}% + \def\pgfplots@addplotimpl@gnuplotresult@isthreedim@withtwocoords{0}% + \iftikz@plot@raw@gnuplot% + \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{#4}}% + \else% + \def\pgfplots@gnuplot@logdirs{}% + \ifpgfplots@xislinear + \else + \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs x}% + \fi + \ifpgfplots@yislinear + \else + \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs y}% + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@zislinear + \else + \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs z}% + \fi + \pgfplots@disablelogfilter@ztrue + \fi + \pgfplots@disablelogfilter@xtrue + \pgfplots@disablelogfilter@ytrue + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@ydomain\pgfutil@empty + \pgfplots@error{Sorry, '\string\addplot3 plot function{}' can't be processed correctly because 'y domain' is empty.}% + \def\pgfplots@plot@ydomain{0:1}% + \fi + \fi + \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% + \pgfplots@gnuplot@format; + set samples \pgfkeysvalueof{/pgfplots/samples}; + \ifx\pgfplots@gnuplot@logdirs\pgfutil@empty + \else + set logscale \pgfplots@gnuplot@logdirs\space 2.71828182845905; + \fi + \iftikz@plot@parametric set parametric;\fi + \ifpgfplots@curplot@threedim + splot [x=\pgfplots@plot@domain] [y=\pgfplots@plot@ydomain] #4;% + \else + plot [x=\pgfplots@plot@domain] #4;% + \fi + }}% + \fi% + \def\pgfplotxyfile{\pgfplots@addplotimpl@gnuplotresult{#1}{#5}}% + \pgfplots@plot@data + \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile +}% + +\def\pgfplots@addplotimpl@gnuplotresult#1#2#3{% + \begingroup + \openin1=#3 + \ifeof1 + \pgfplots@error{Sorry, the gnuplot-result file '#3' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot <file>.gnuplot' manually on the respective gnuplot file.}% + \aftergroup\pgfplots@loop@CONTINUEfalse + \else + \aftergroup\pgfplots@loop@CONTINUEtrue + \fi + \closein1 + \endgroup + \ifpgfplots@loop@CONTINUE + % Now, invoke 'plot file'. + % + % I invoke the private '@opt@' method because the semicolon ';' + % character may cause problems due to catcode mismatches. + % *sigh*. + \pgfplots@addplotimpl@file@opt@@{#1}{}{#3}{#2}% + \else + \expandafter\pgfplots@end@plot + \fi +} + +% \addplot[#1] [#2] file{#3} #4; +\def\pgfplots@addplotimpl@file#1#2ile{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@file@opt{#1}{#2}% + }{% + \pgfplots@addplotimpl@file@opt{#1}{#2}[]% + }% +} + +% \addplot[#1] [#2] file[#3] {#4} #5; +\def\pgfplots@addplotimpl@file@opt#1#2[#3]#4#5;{\pgfplots@addplotimpl@file@opt@{#1}{#2}{#3}{#4}{#5}}% +\def\pgfplots@addplotimpl@file@opt@#1#2#3#4#5{% + \pgfplots@start@plot@with@behavioroptions{#2}% + \pgfplots@addplotimpl@file@opt@@{#1}{#3}{#4}{#5}% +} +\def\pgfplots@addplotimpl@file@opt@@#1#2#3#4{% + \begingroup + \def\pgfplots@loc@TMPa{#2}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfqkeys{/pgfplots/plot file}{#2}% + \fi + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \pgfplots@coord@stream@start + \pgfplots@logfileopen{#3}% + \openin1=#3 + \ifeof1 + \pgfplots@warning{sorry, plot file{#3} could not be opened!?}% + \else + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \ifpgfplots@curplot@threedim + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim + \ifnum\pgfplots@perpointmeta@choice=4 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta + \else + \ifnum\pgfplots@perpointmeta@choice=5 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta + \fi + \fi + \else + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim + \ifnum\pgfplots@perpointmeta@choice=4 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta + \else + \ifnum\pgfplots@perpointmeta@choice=5 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta + \fi + \fi + \fi + \pgfplots@addplotimpl@file@readall + \fi + \pgfplots@coord@stream@end + \endgroup +}% +\def\pgfplots@addplotimpl@file@readall{% + \read1 to\pgfplots@file@LINE + \expandafter\pgfplotstableread@checkspecial@line\pgfplots@file@LINE\pgfplotstable@EOI + \ifpgfplotstableread@skipline + \else + \ifpgfplots@plot@file@skipfirst + % Silently skip first data row, assuming it is a header. + \pgfplots@plot@file@skipfirstfalse + \else + \expandafter\pgfplots@addplotimpl@file@parsesingle\pgfplots@file@LINE\pgfplots@EOI + \fi + \fi + \ifeof1 + \else + \expandafter + \pgfplots@addplotimpl@file@readall + \fi +}% + +\def\pgfplots@addplotimpl@file@parsesingle@threedim#1 #2 #3 #4\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \pgfplots@coord@stream@coord% +}% +\def\pgfplots@addplotimpl@file@parsesingle@twodim#1 #2 #3\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \pgfplots@coord@stream@coord% +}% +\def\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta#1 #2 #3 #4 #5\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \def\pgfplots@current@point@meta{#4}% + \pgfplots@coord@stream@coord% +}% +\def\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta#1 #2 #3 #4\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@meta{#3}% + \pgfplots@coord@stream@coord% +}% + +\def\pgfplots@addplotimpl@table#1table{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@table@getopts{#1}% + }{% + \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% + }% +}% + +\def\pgfplots@addplotimpl@table@getopts#1[#2]{% + \pgfutil@ifnextchar f{% + \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% + }{% + \pgfplots@addplotimpl@table@fromfile{#1}{#2}% + }% +} + +% this macro simply invokes the "correct" table processing routine. +% The distinction between 'table from {<\macro>}' and 'table +% {<filename>}' is deprecated; it is done automatically now. +% +% \addplot[#1] table[#2] [from] {#3} #4; +\def\pgfplots@addplotimpl@table@startprocessing#1#2#3#4{% + \pgfplotstable@isloadedtable{#3}{% + \pgfplots@addplotimpl@table@fromstructure@{#1}{#2}{#3}{#4}% + }{% + \pgfplots@addplotimpl@table@fromfile@{#1}{#2}{#3}{#4}% + }% +}% + +% \addplot[#1] table[#2] from {#3} #4; +% +% #1: arguments to \addplot[...] +% #2: arguments to table[...] +% #3: the argument of plot table{...} +% #4: trailing path arguments after plot table{...}#4; +\long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% +% \addplot[#1] table[#2] from {#3} #4 ; +\long\def\pgfplots@addplotimpl@table@fromstructure@#1#2#3#4{% + % set options here. They may contain behavior options! + \pgfplots@addplotimpl@table@installkeypath + \pgfplotstableset{#2}% + \begingroup + % FIXME : this thing here has runtime O(N^2) ! + % I fear it is faster to simply reload the data .... !? + % + % well, for a lot of columns which are used in different contexts + % and few rows, this here IS more efficient. + \pgfplotstablecopy#3\to\pgfplots@table + \pgfkeysgetvalue{/pgfplots/table/x}{\pgfplots@plot@tbl@x}% + \pgfkeysgetvalue{/pgfplots/table/x index}{\pgfplots@plot@tbl@xindex}% + \pgfkeysgetvalue{/pgfplots/table/y}{\pgfplots@plot@tbl@y}% + \pgfkeysgetvalue{/pgfplots/table/y index}{\pgfplots@plot@tbl@yindex}% + \pgfkeysgetvalue{/pgfplots/table/z}{\pgfplots@plot@tbl@z}% + \pgfkeysgetvalue{/pgfplots/table/z index}{\pgfplots@plot@tbl@zindex}% + \pgfkeysgetvalue{/pgfplots/table/meta}{\pgfplots@plot@tbl@meta}% + \pgfkeysgetvalue{/pgfplots/table/meta index}{\pgfplots@plot@tbl@metaindex}% + \ifx\pgfplots@plot@tbl@x\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\addplot@tbl@x + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x + \fi + \ifx\pgfplots@plot@tbl@y\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\addplot@tbl@y + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@z\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@zindex\of\pgfplots@table\to\addplot@tbl@z + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@z\of\pgfplots@table\to\addplot@tbl@z + \fi + \fi + \let\addplot@tbl@meta=\pgfutil@empty + \ifx\pgfplots@plot@tbl@meta\pgfutil@empty + \ifx\pgfplots@plot@tbl@metaindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@metaindex\of\pgfplots@table\to\addplot@tbl@meta + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@meta\of\pgfplots@table\to\addplot@tbl@meta + \fi + % + \ifpgfplots@errorbars@enabled + \let\addplot@tbl@error@x=\pgfutil@empty + \let\addplot@tbl@error@z=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex + \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x + \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex + \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y + \pgfkeysgetvalue{/pgfplots/table/z error index}\pgfplots@plot@tbl@error@zindex + \pgfkeysgetvalue{/pgfplots/table/z error}\pgfplots@plot@tbl@error@z + \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\addplot@tbl@error@x + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x + \fi + \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\addplot@tbl@error@y + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@zindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@zindex\of\pgfplots@table\to\addplot@tbl@error@z + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@z\of\pgfplots@table\to\addplot@tbl@error@z + \fi + \fi + \fi + % + \ifpgfplots@errorbars@enabled + \else + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \fi + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \pgfplots@coord@stream@start + \pgfutil@loop + \pgfplotslistcheckempty\addplot@tbl@x + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + % This here is just for sanity checking: if the 'y' column is + % - for whatever reasons - invalid; provide good error + % recovery. + \pgfplotslistcheckempty\addplot@tbl@y + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \fi + \ifpgfplots@loop@CONTINUE + \pgfplotslistpopfront\addplot@tbl@x\to\pgfplots@current@point@x + \pgfplotslistpopfront\addplot@tbl@y\to\pgfplots@current@point@y + \ifpgfplots@curplot@threedim + \pgfplotslistpopfront\addplot@tbl@z\to\pgfplots@current@point@z + \fi + \ifx\addplot@tbl@meta\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@meta\to\pgfplots@current@point@meta + \fi + \ifpgfplots@errorbars@enabled + \ifx\addplot@tbl@error@x\pgfutil@empty + \let\pgfplots@current@point@x@error=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@x\to\pgfplots@current@point@x@error + \fi + \ifx\addplot@tbl@error@y\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@y\to\pgfplots@current@point@y@error + \fi + \ifpgfplots@errorbars@enabled + \ifx\addplot@tbl@error@z\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@z\to\pgfplots@current@point@z@error + \fi + \fi + \pgfplots@coord@stream@coord + \else + \pgfplots@coord@stream@coord + \fi + \pgfutil@repeat + \pgfplots@coord@stream@end + \endgroup +} + + +% \addplot[#1] table[#2] {#3} #4; +% +% This here is the (probably) faster input method from tables. +% +% It has linear complexity in the number of rows (as long as the +% number of rows is less than about 110000). +% +% #1: arguments to \addplot[...] +% #2: arguments to table[...] +% #3: the argument of plot table{...} +% #4: trailing path arguments after plot table{...}#4; +\long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% +% \addplot[#1] table[#2] {#3} {#4}; +\long\def\pgfplots@addplotimpl@table@fromfile@#1#2#3#4{% + % set options outside of the following group. + % They may contain behavior options. + \pgfplots@addplotimpl@table@installkeypath + \pgfplotstableset{#2}% + %-------------------------------------------------- + % \begingroup + % \pgfplotstableset{#2}% + % \pgfplotstableread{#3}\pgfplots@table + % \pgfplots@addplotimpl@table@fromstructure{#1}{}from{\pgfplots@table}{#4};% + % \endgroup + %-------------------------------------------------- + \begingroup + \ifpgfplots@addplotimpl@readcompletely + \pgfplotstableread{#3}\pgfplots@table + \pgfplots@addplotimpl@table@fromstructure@{#1}{}{\pgfplots@table}{#4}% + \endgroup + \else + \pgfplotsapplistXXglobalnewempty + \pgfkeysgetvalue{/pgfplots/table/x}{\pgfplots@plot@tbl@x}% + \pgfkeysgetvalue{/pgfplots/table/x index}{\pgfplots@plot@tbl@xindex}% + \pgfkeysgetvalue{/pgfplots/table/y}{\pgfplots@plot@tbl@y}% + \pgfkeysgetvalue{/pgfplots/table/y index}{\pgfplots@plot@tbl@yindex}% + \pgfkeysgetvalue{/pgfplots/table/z}{\pgfplots@plot@tbl@z}% + \pgfkeysgetvalue{/pgfplots/table/z index}{\pgfplots@plot@tbl@zindex}% + \pgfkeysgetvalue{/pgfplots/table/meta}{\pgfplots@plot@tbl@meta}% + \pgfkeysgetvalue{/pgfplots/table/meta index}{\pgfplots@plot@tbl@metaindex}% + \let\pgfplots@table@PTR@x=\pgfutil@empty + \let\pgfplots@table@PTR@y=\pgfutil@empty + \let\pgfplots@table@PTR@z=\pgfutil@empty + \let\pgfplots@table@PTR@meta=\pgfutil@empty + \let\pgfplots@current@point@meta=\pgfutil@empty + \let\pgfplots@current@point@z=\pgfutil@empty + \ifpgfplots@errorbars@enabled + \let\pgfplots@table@ERRPTR@x=\pgfutil@empty + \let\pgfplots@table@ERRPTR@y=\pgfutil@empty + \let\pgfplots@table@ERRPTR@z=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex + \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x + \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex + \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y + \pgfkeysgetvalue{/pgfplots/table/z error index}\pgfplots@plot@tbl@error@zindex + \pgfkeysgetvalue{/pgfplots/table/z error}\pgfplots@plot@tbl@error@z + \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL + \else + \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED + \fi + \endgroup + % + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \pgfplotsapplistXXgloballet\pgfplots@coordlist + \pgfplotsapplistXXglobalclear + \ifpgfplots@errorbars@enabled + \ifpgfplots@curplot@threedim + \expandafter\pgfplots@coord@stream@foreach@threedim\expandafter{\pgfplots@coordlist}%% + \else + \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@coordlist}%% + \fi + \else + % this here is the usual case; it is faster than the error bar + % stuff. + \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@coordlist}% + \fi + \fi +} +\def\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED{% + \pgfplots@addplotimpl@table@fromfile@listener@ + \edef\pgfplots@current@point{% + \pgfplots@current@point@x,% + \pgfplots@current@point@y,% + \pgfplots@current@point@z,% + \pgfplots@current@point@meta% + ;% + }% + \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% +} +\def\pgfplots@addplotimpl@table@fromfile@listener@{% + \ifx\pgfplots@table@PTR@x\pgfutil@empty + % this here is only evaluated ONCE. + \ifx\pgfplots@plot@tbl@x\pgfutil@empty + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@xindex}{\pgfplots@table@PTR@x}% + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@x}{\pgfplots@table@PTR@x}% + \fi + \ifx\pgfplots@plot@tbl@y\pgfutil@empty + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@yindex}{\pgfplots@table@PTR@y}% + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@y}{\pgfplots@table@PTR@y}% + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@z\pgfutil@empty + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@zindex}{\pgfplots@table@PTR@z}% + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@z}{\pgfplots@table@PTR@z}% + \fi + \fi + \ifx\pgfplots@plot@tbl@meta\pgfutil@empty + \ifx\pgfplots@plot@tbl@metaindex\pgfutil@empty + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@metaindex}{\pgfplots@table@PTR@meta}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@meta}{\pgfplots@table@PTR@meta}% + \fi + \fi + \pgfplotstablereadevalptr\pgfplots@table@PTR@x\pgfplots@current@point@x + \pgfplotstablereadevalptr\pgfplots@table@PTR@y\pgfplots@current@point@y + \ifpgfplots@curplot@threedim + \pgfplotstablereadevalptr\pgfplots@table@PTR@z\pgfplots@current@point@z + \fi + \ifx\pgfplots@table@PTR@meta\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@PTR@meta\pgfplots@current@point@meta + \fi +}% +\def\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL{% + \pgfplots@addplotimpl@table@fromfile@listener@ + % + \ifx\pgfplots@table@ERRPTR@x\pgfutil@empty + % this here is only evaluated ONCE. + \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty + \let\pgfplots@table@ERRPTR@x=\relax% + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@xindex}{\pgfplots@table@ERRPTR@x}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@x}{\pgfplots@table@ERRPTR@x}% + \fi + \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty + \let\pgfplots@table@ERRPTR@y=\relax% + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@yindex}{\pgfplots@table@ERRPTR@y}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@y}{\pgfplots@table@ERRPTR@y}% + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@zindex\pgfutil@empty + \let\pgfplots@table@ERRPTR@z=\relax% + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@zindex}{\pgfplots@table@ERRPTR@z}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@z}{\pgfplots@table@ERRPTR@z}% + \fi + \fi + \fi + \ifx\relax\pgfplots@table@ERRPTR@x + \let\pgfplots@current@point@x@error=\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@x\pgfplots@current@point@x@error + \fi + \ifx\relax\pgfplots@table@ERRPTR@y + \let\pgfplots@current@point@y@error=\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@y\pgfplots@current@point@y@error + \fi + \ifpgfplots@curplot@threedim + \ifx\relax\pgfplots@table@ERRPTR@z + \let\pgfplots@current@point@z@error=\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@z\pgfplots@current@point@z@error + \fi + \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z)+-(\pgfplots@current@point@x@error,\pgfplots@current@point@y@error,\pgfplots@current@point@z@error) [\pgfplots@current@point@meta]}% + \else + \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)+-(\pgfplots@current@point@x@error,\pgfplots@current@point@y@error) [\pgfplots@current@point@meta]}% + \fi + \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% +}% +\def\pgfplots@addplotimpl@table@installkeypath{% + \pgfkeysdef{/pgfplots/table/.unknown}{% + \let\pgfplots@table@curkeyname=\pgfkeyscurrentname + \pgfqkeys{/pgfplots}{\pgfplots@table@curkeyname=##1}% + }% +}% + +% #1: arguments to \addplot plot[#1] +% -> these are called 'behavior' options in the manual; they are set +% immediately. +\def\pgfplots@start@plot@with@behavioroptions#1{% + %\begingroup%<-- has been moved to \pgfplots@addplotimpl@plot@withoptions + \def\pgfplots@current@point@coordindex{0}% can be used inside of coordinate filters. + \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot + \ifx\pgfplots@execute@at@begin@plot\pgfutil@empty + \else + \pgfplots@execute@at@begin@plot + \fi + \let\pgfplots@addplot@nonlegend@options=\pgfutil@empty + \pgfplots@process@behavioroptions{#1}% + % these styles may contain behavior options (error bars, + % samples,... ) activate them! + \ifpgfplots@curplot@isirrelevant + \pgfplotsset{/pgfplots/every axis plot,/pgfplots/every forget plot/.try}% + \else + \pgfplotsset{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% + \fi +} +\def\pgfplots@process@behavioroptions#1{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplots@addplot@nonlegend@options\expandafter{% + \pgfplots@addplot@nonlegend@options,#1}% + \pgfplotsset{#1}% + \fi +}% + +\def\pgfplots@end@plot{% + \ifpgfplots@curplot@isirrelevant + \else + \global\advance\pgfplots@numplots by1\relax% + \fi + \pgfplots@execute@at@end@plot + \endgroup%<-- close the \begingroup of \pgfplots@addplotimpl@plot@withoptions +} + +% \addplot[#1] [#2] {#3} #4; +\long\def\pgfplots@addplotimpl@coordinates#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% +% \addplot[#1] [#2] coordinates {#3} #4; +\long\def\pgfplots@addplotimpl@coordinates@#1#2#3#4{% +%\tracingmacros=2\tracingcommands=2 +%\pgfplots@message{processing plots coords with trailing path '#4'}% + \pgfplots@start@plot@with@behavioroptions{#2}% + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \ifpgfplots@curplot@threedim + \pgfplots@coord@stream@foreach@threedim{#3}% + \else + \pgfplots@coord@stream@foreach{#3}% + \fi +}% + +{ + % A block which handles active semicolons. + % + % ATTENTION: this block does only work if + % \pgfplots@addplotimpl.... changes are reflected here! + % + \catcode`\;=\active + \globaldefs=1 + % 'AS' == 'active semicolon' + % 'IS' == 'inactive semicolon' + \let\pgfplots@gobble@until@semicolon@IS=\pgfplots@gobble@until@semicolon + \let\pgfplots@addplotimpl@expression@IS=\pgfplots@addplotimpl@expression + \let\pgfplots@addplotimpl@expression@curly@IS=\pgfplots@addplotimpl@expression@curly + \let\pgfplots@addplotimpl@function@opt@IS=\pgfplots@addplotimpl@function@opt + \let\pgfplots@addplotimpl@file@opt@IS=\pgfplots@addplotimpl@file@opt + \let\pgfplots@addplotimpl@table@fromstructure@IS=\pgfplots@addplotimpl@table@fromstructure + \let\pgfplots@addplotimpl@table@fromfile@IS=\pgfplots@addplotimpl@table@fromfile + \let\pgfplots@addplotimpl@coordinates@IS=\pgfplots@addplotimpl@coordinates + % + \def\pgfplots@gobble@until@semicolon@AS#1;{} + \long\def\pgfplots@addplotimpl@expression@AS#1#2(#3,#4)#5;{\pgfplots@addplotimpl@expression@{#1}{#2}{#3}{#4}{#5}}% + \long\def\pgfplots@addplotimpl@expression@curly@AS#1#2#3#4;{\pgfplots@addplotimpl@expression@curly@{#1}{#2}{#3}{#4}}% + \def\pgfplots@addplotimpl@function@opt@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@function@opt@{#1}{#2}{#3}{#4}{#5}}% + \def\pgfplots@addplotimpl@file@opt@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@file@opt@{#1}{#2}{#3}{#4}{#5}}% + \long\def\pgfplots@addplotimpl@table@fromstructure@AS#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% + \long\def\pgfplots@addplotimpl@table@fromfile@AS#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% + \long\def\pgfplots@addplotimpl@coordinates@AS#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% + % + % Checks whether ';' is an active character and, if that is the + % case, modifies all public macros for it. + \pgfplots@appendto@activesemicolon@switcher{% + \let\pgfplots@gobble@until@semicolon=\pgfplots@gobble@until@semicolon@AS + \let\pgfplots@addplotimpl@expression=\pgfplots@addplotimpl@expression@AS + \let\pgfplots@addplotimpl@expression@curly=\pgfplots@addplotimpl@expression@curly@AS + \let\pgfplots@addplotimpl@function@opt=\pgfplots@addplotimpl@function@opt@AS + \let\pgfplots@addplotimpl@file@opt=\pgfplots@addplotimpl@file@opt@AS + \let\pgfplots@addplotimpl@table@fromstructure=\pgfplots@addplotimpl@table@fromstructure@AS + \let\pgfplots@addplotimpl@table@fromfile=\pgfplots@addplotimpl@table@fromfile@AS + \let\pgfplots@addplotimpl@coordinates=\pgfplots@addplotimpl@coordinates@AS + }% +} + +\newif\ifpgfplots@update@limits@for@one@point@ISCLIPPED +\def\pgfplots@math@ONE{1.0}% + +\def\pgfplots@streamerrorbarstart{% +}% +\def\pgfplots@streamerrorbarend{% +}% +\def\pgfplots@streamerrorbarcoords#1#2{% +}% + +\def\pgfplots@streamerrorbar@recordto#1{% + \def\pgfplots@streamerrorbarstart{% + \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@ + }% + \def\pgfplots@streamerrorbarend{% + \pgfplotsapplistXlet#1=\pgfplots@streamerrorbar@recordto@@ + \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@% clear + }% + \def\pgfplots@streamerrorbarcoords##1##2{% + \pgfplotsapplistXpushback{\pgfplots@errorbar@draw{##1}{##2}}\to\pgfplots@streamerrorbar@recordto@@ + }% +} +\def\pgfplots@streamerrorbar@directdraw{% + \def\pgfplots@streamerrorbarstart{}% + \def\pgfplots@streamerrorbarend{}% + \def\pgfplots@streamerrorbarcoords##1##2{% + \pgfplots@errorbar@draw{##1}{##2}% + }% +} + +\def\pgfplots@invoke@filter#1#2{% + \pgfkeysvalueof{/pgfplots/#2 filter/.@cmd}#1\pgfeov% +}% + +% this is a convenience macro to save storage in the long coordinate +% lists. +\def\pgfplots@stream#1#2{\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} +\def\pgfplots@stream@withmeta#1#2#3{\def\pgfplots@current@point@meta{#3}\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} + +\newif\ifpgfplots@record@marker@stream +% Takes a sequence of PREPARED coordinates which are given in floating +% point representation and applies the data scaling trafo (if +% necessary). +% +% Any coordinate will be plotted with the selected PGF plot handler. +% +% This stream is designed to be done at the end of an axis. +% See \pgfplots@coord@stream@finalize@storedcoords@START +% +% #1 : a macro which will be filled with a pgf plot stream for the +% marker points. +\def\pgfplots@coord@stream@INIT@finalize@storedcoords#1{% + % + % Init the plot handlers: + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + \ifpgfplots@scatterplotenabled + \ifx\tikz@plot@mark\pgfutil@empty + \pgfplots@warning{I am confused: A scatter plot with 'mark=none'? This may need attention...?}% + \fi + \fi + % + \ifx\tikz@plot@mark\pgfutil@empty + % mark=none : no need to waste time collecting marker + % positions. + \pgfplots@record@marker@streamfalse + \else + \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard + \ifpgfplots@clip@marker@paths + % only marks: draw markers directly; no need for the + % two-pass-approach. + \let\pgfplots@basiclevel@plothandler=\relax + \pgfplots@install@plotmark@handler + \pgfplots@record@marker@streamfalse + \else + % collect mark positions... they will be drawn after + % the clipped axis range. Clipping will only be + % applied to their *positions*, not their paths. + \pgfplots@record@marker@streamtrue + \fi + \else + % ok, mark!=none and we also have a plot handler. + % So, collect mark positions! + \pgfplots@record@marker@streamtrue + \fi + \fi + \gdef#1{}% + % + % Now, set up coordinate streams. + \def\pgfplots@coord@stream@start@{% + \ifpgfplots@apply@datatrafo + \ifpgfplots@stackedmode + \pgfplots@stacked@beginplot + \fi + \fi + \pgfplots@basiclevel@plothandler + \pgfplotstreamstart + \let\pgfplots@data@scaletrafo@result=\pgfutil@empty + \ifpgfplots@record@marker@stream + \pgfplotsapplistXXnewempty + \pgfplotsapplistXXpushback{\pgfplotstreamstart}% + %\gdef#1{\pgfplotstreamstart}% + \fi + % Define \pgfplots@process@perpointmeta properly: + \ifnum\pgfplots@perpointmeta@choice=0 + % disabled. + \def\pgfplots@process@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfutil@empty + }% + \else + \fi + }% + \def\pgfplots@coord@stream@end@{% + \ifpgfplots@apply@datatrafo + \ifpgfplots@stackedmode + \pgfplots@stacked@endplot + \fi + \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa + \pgfplots@loc@TMPa + \fi + \pgfplotstreamend + \ifpgfplots@record@marker@stream + \pgfplotsapplistXXpushback{\pgfplotstreamend}% + \pgfplotsapplistXXflushbuffers% + \global\let#1=\pgfplotsapplistXX + \pgfplotsapplistXXclear + %\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}% + \fi + }% + \begingroup + \let\E=\noexpand + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro + % + % Will be inserted in one of two possible places below: + \def\pgfplots@loc@TMPa{% + \ifnum\pgfplots@perpointmeta@choice=0 + % we don't have per-point meta data. Nothing special to + % do: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\expandafter\E\pgfplotsapplistXXpushback\E\expandafter{\E\pgfmathresult}% + \else + % Ok, then we need to process the meta data as well: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream@withmeta{\E\the\E\pgf@x}{\E\the\E\pgf@y}{\E\pgfplots@current@point@meta}}% + \E\expandafter\E\pgfplotsapplistXXpushback\E\expandafter{\E\pgfmathresult}% + \fi + }% + % This finalize command maps the logical coordinate into PGF's + % point space. Furthermore, it collects marker coordinates + % (properly clipped by position) if markers are required (see + % above). + % + % It is prepared here to eliminate if's. + \xdef\pgfplots@coord@stream@finalize@currentpt{% + \ifpgfplots@curplot@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{\E\pgfplots@current@point@z}% + \else + \ifpgfplots@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{0.0}% + \else + \E\pgfplotsqpointxy{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}% + \fi + \fi + \ifpgfplots@record@marker@stream + \E\pgf@xa=\E\pgfplots@current@point@x pt % FIXME : SCOPE REGISTERS!? + \E\pgf@ya=\E\pgfplots@current@point@y pt % + \ifpgfplots@curplot@threedim + \E\pgf@yb=\E\pgfplots@current@point@z pt % + \fi + \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg + \E\else + \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg + \E\else + \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg + \E\else + \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\else + \ifpgfplots@curplot@threedim + \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg + \E\else + \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\else + \pgfplots@loc@TMPa + \E\fi + \E\fi + \else + \pgfplots@loc@TMPa + \fi + \E\fi + \E\fi + \E\fi + \E\fi + \fi + \E\pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y! + }% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \endgroup +% +%\message{Prepared macro \string \pgfplots@apply@data@scaletrafo@to@one@point {\meaning\pgfplots@apply@data@scaletrafo@to@one@point}}% +%\message{Prepared macro \string \pgfplots@coord@stream@finalize@currentpt {\meaning\pgfplots@coord@stream@finalize@currentpt}}% + \ifpgfplots@apply@datatrafo + \def\pgfplots@coord@stream@coord@{% + \pgfplots@apply@data@scaletrafo@to@one@point% + \pgfplots@coord@stream@finalize@currentpt + }% + \else + \def\pgfplots@coord@stream@coord@{% + \pgfplots@coord@stream@finalize@currentpt + }% + \fi + % +} + +% Defines an optimized and matching \pgfplots@apply@data@scaletrafo@to@one@point +% during the coordinate finalization step in \end{axis}. +\def\pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro{% + \begingroup + \let\E=\noexpand + % The command which is called for every non-yet-finished point. + % + % It is prepared here to eliminate if's. + % + % Arguments: + % \pgfplots@current@point@[xyz] + % \pgfplots@current@point@[xyz]@error (if in argument list) + \xdef\pgfplots@apply@data@scaletrafo@to@one@point{% + \ifpgfplots@apply@datatrafo@x + \E\pgfplots@datascaletrafo@x{\E\pgfplots@current@point@x}% + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + \fi + \ifpgfplots@apply@datatrafo@y + \E\pgfplots@datascaletrafo@y{\E\pgfplots@current@point@y}% + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@apply@datatrafo@z + \E\pgfplots@datascaletrafo@z{\E\pgfplots@current@point@z}% + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + \fi + \fi + \ifpgfplots@stackedmode + % all these calls work with pgfmath; no more floating point + % arithmetics are applied. + \E\pgfplots@stacked@getnextzerolevelpoint + \E\pgfplots@stacked@finishpoint% + \E\pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\E\pgfplots@current@point@x,\E\pgfplots@current@point@y)}% + \fi + % \t@pgfplots@tokc=\expandafter{\pgfplots@data@scaletrafo@result}% + % \edef\pgfplots@data@scaletrafo@result{\the\t@pgfplots@tokc(\pgfplots@current@point@x,\pgfplots@current@point@y)}% + }% + % + \endgroup +} + +\def\pgfplots@addplot@get@named@startendpoints@command#1{% + \ifpgfplots@coord@stream@isfirst + \edef#1{% + \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfqpoint{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}}% + \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfqpoint{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}}% + }% + \else + \edef#1{% + \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfplotsqpointxy{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}}% + \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfplotsqpointxy{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}}% + }% + \fi +}% + +% INPUT: +% either floating point or fixed point coordinates (depending on the +% state of the \ifpgfplots@apply@datatrafo boolean) +% +\long\def\pgfplots@coord@stream@finalize@storedcoords@START normalized coordinates #1#2;\pgfplots@EOI{% + \pgfplots@assert@tikzinternal@exists{tikz@make@last@position}% + \pgfplots@stored@current@cmd[current plot style] + \pgfextra + \tikzset{every plot/.try}% + \pgfplots@coord@stream@INIT@finalize@storedcoords\pgfplots@recorded@marker@stream% + \pgfplots@coord@stream@foreach@NORMALIZED{#1}% + \pgfutil@ifundefined{pgfplotlastpoint}{}{% + \tikz@make@last@position{\pgfplotlastpoint}% + }% + \endpgfextra + #2; + \ifx\pgfplots@recorded@marker@stream\pgfutil@empty + \else + \ifpgfplots@clip@marker@paths + % Draw markers on top of the plot lines: + % + % FIXME: inefficient! Use \scope to set variables of 'current plot style' !? + \pgfplots@stored@current@cmd[current plot style] + \pgfextra + \pgfplots@install@plotmark@handler + \pgfplots@recorded@marker@stream + \endpgfextra + ; + \else + % sigh... ok, store the marker list (once more again). + % They need to be drawn after the clipped area. + \pgfplots@stored@REMEMBER@MARK@COMMAND + \fi + \fi + \gdef\pgfplots@recorded@marker@stream{}% clear +}% + +% This method MUST be called while \pgfplots@stored@plotlist is +% evaluated, that means +% - \pgfplots@stored@* commands need to be valid, +% - the precommand has already been invoked. +% - pgfplots@recorded@marker@stream exists +% - current plot style is valid +\def\pgfplots@stored@REMEMBER@MARK@COMMAND{% + \pgfkeysgetvalue{/tikz/current plot style/.@cmd}{\pgfplots@loc@TMPa}% + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\pgfeov}% + \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@cmd[current plot style]}% + \t@pgfplots@tokc=\expandafter{\pgfplots@recorded@marker@stream}% + \edef\pgfplots@loc@TMPa{% + \noexpand\pgfkeysdef{/tikz/current plot style}{\the\t@pgfplots@toka}% + % de-activate the FPU here if it was active! I fear its number + % format may cause errors when used in low-level + % routines. + \noexpand\pgfkeys{/pgf/fpu=false}% + % + \noexpand\xdef\noexpand\pgfplots@metamin{\pgfplots@metamin}% + \noexpand\xdef\noexpand\pgfplots@metamax{\pgfplots@metamax}% + \ifpgfplots@perpointmeta@usesfloat + \noexpand\pgfplots@perpointmeta@usesfloattrue + \else + \noexpand\pgfplots@perpointmeta@usesfloatfalse + \fi + \noexpand\def\noexpand\pgfplots@perpointmeta@choice{\pgfplots@perpointmeta@choice}% + % + \the\t@pgfplots@tokb + \noexpand\pgfextra + \noexpand\pgfplots@install@plotmark@handler + \the\t@pgfplots@tokc + \noexpand\endpgfextra + ;}% + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@precmd}% + \edef\pgfplots@loc@TMPa{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}\to\pgfplots@stored@markerlist +}% + +\def\pgfplots@install@plotmark@handler{% + \pgfplots@assert@tikzinternal@exists{tikz@options}% + % note: I can't check on tikz@transform because it can be + % '\relax'. + \pgfplots@gettikzinternal@keyval{mark indices}{tikz@mark@list}{}% + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + % + % do not reset \tikz@options: draw color may be acquired + % from 'current plot style' + %\let\tikz@options=\pgfutil@empty% + \let\tikz@transform=\pgfutil@empty% + \tikzset{every plot/.try,every mark}% + \tikz@options + \pgfplots@perpointmeta@preparetrafo + % this here is the MAIN marker code. + % It may be modified if scatter plot is enabled, see below. + \def\pgfplots@loc@TMPa{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}} + \ifpgfplots@scatterplotenabled + % Scatter plots work like this: + % + % <compute per-point meta info> + % /pgfplots/scatter/@pre marker code + % <marker code, lowlevel> + % /pgfplots/scatter/@post marker code + % + % -> that's all. The Rest is configurable with style which + % (re)define '@pre marker code' and '@post marker code' (see + % the docs for details). + % + % Prepare arguments for '@pre/@post' macros: + \edef\pgfplotspointmetarange{\pgfplots@metamin:\pgfplots@metamax}% + \edef\pgfplotspointmetatransformedrange{\pgfplots@perpointmeta@traforange}% + \t@pgfplots@toka={% + \begingroup + \pgfutil@ifundefined{pgfplots@current@point@meta}{% + \pgfplots@error{'scatter' could not access its data source. Maybe you need to add '\string\addplot\space plot[scatter src=y]' or something like that?}% + \pgfmathfloatcreate{1}{1.0}{0}% + \def\pgfplotspointmetatransformed{1.0}% + }{% + % prepare arguments: + \let\pgfplotspointmeta=\pgfplots@current@point@meta + \pgfplots@perpointmeta@trafo{\pgfplotspointmeta}% + \let\pgfplotspointmetatransformed=\pgfmathresult + }% + \pgfkeysvalueof{/pgfplots/scatter/@pre marker code/.@cmd}\pgfeov + }% + \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}% + \t@pgfplots@tokc={% + \pgfkeysvalueof{/pgfplots/scatter/@post marker code/.@cmd}\pgfeov + \endgroup + }% + \edef\pgfplots@loc@TMPa{% + \the\t@pgfplots@toka + \the\t@pgfplots@tokb + \the\t@pgfplots@tokc + }% + \fi + \ifx\tikz@mark@list\pgfutil@empty% + \expandafter\pgfplothandlermark\expandafter{\pgfplots@loc@TMPa}% + \else + \expandafter\pgfplothandlermarklisted\expandafter{\pgfplots@loc@TMPa}{\tikz@mark@list}% + \fi +}% + + +% This thing here shall draw all error bar commands listed in '#2'. +% +% It will be invoked when any plotting commands take effect (that +% means all limits are computed; the axis has been drawn, +% transformations are set up...) +\def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{% + \scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it uses the /pgfplots/.unknown handler + #2% + \endscope +} + +\def\pgfplots@errorbar@draw@float(#1,#2)(#3,#4){% + \ifpgfplots@apply@datatrafo@x + \pgfplots@datascaletrafo@x{#1}% + \let\pgfplots@xarg=\pgfmathresult% + \pgfplots@datascaletrafo@x{#3}% + \let\pgfplots@error@xarg=\pgfmathresult% + \else + \def\pgfplots@xarg{#1}% + \def\pgfplots@error@xarg{#3}% + \fi + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@y{#2}% + \let\pgfplots@yarg=\pgfmathresult% + \pgfplots@datascaletrafo@y{#4}% + \let\pgfplots@error@yarg=\pgfmathresult% + \else + \def\pgfplots@yarg{#2}% + \def\pgfplots@error@yarg{#4}% + \fi + \edef\pgfplots@loc@TMPa{{(\pgfplots@xarg,\pgfplots@yarg)}{(\pgfplots@error@xarg,\pgfplots@error@yarg)}}% + \def\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}}% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfeov +} + +\def\pgfplots@errorbar@draw#1#2{% + \begingroup + \ifpgfplots@apply@datatrafo + \pgfplots@errorbar@draw@float#1#2 + \else + \pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov% + \fi + \endgroup +}% + +% Arguments: +% \pgfplots@current@point@[xyz] +% \pgfplots@current@point@[xyz]@unfiltered +% \pgfplots@current@point@[xyz]@error (if in argument list) +% Also provides UNFILTERED arguments x and y . These are use +% in case of logplots, because we may need to compute log( x + e_x ) +% or log( y + e_y ). +\def\pgfplots@process@errorbar@for{% +% \begingroup + \edef\pgfplots@xarg{\pgfplots@current@point@x}% + \edef\pgfplots@yarg{\pgfplots@current@point@y}% + \let\pgfplots@xarg@unfiltered\pgfplots@current@point@x@unfiltered% + \let\pgfplots@yarg@unfiltered\pgfplots@current@point@y@unfiltered% + \edef\pgfplots@error@xarg{\pgfplots@current@point@x@error}% + \edef\pgfplots@error@yarg{\pgfplots@current@point@y@error}% + \def\pgfplots@loc@TMPa{0}% + \ifx\pgfplots@loc@TMPa\pgfplots@error@xarg + \let\pgfplots@error@xarg=\pgfutil@empty + \fi + \ifx\pgfplots@loc@TMPa\pgfplots@error@yarg + \let\pgfplots@error@yarg=\pgfutil@empty + \fi + % FIXME : INEFFICIENT! This code here does every computation + % multiple times! + \ifcase\pgfplots@errorbars@xdirection + \or + \pgfplots@process@errorbar@@for{x}{+}1% + \or + \pgfplots@process@errorbar@@for{x}{-}2% + \or + \pgfplots@process@errorbar@@for{x}{+}1% + \pgfplots@process@errorbar@@for{x}{-}2% + \fi + \ifcase\pgfplots@errorbars@ydirection + \or + \pgfplots@process@errorbar@@for{y}{+}1% + \or + \pgfplots@process@errorbar@@for{y}{-}2% + \or + \pgfplots@process@errorbar@@for{y}{+}1% + \pgfplots@process@errorbar@@for{y}{-}2% + \fi + % Restore macros which may have been overwritten: + \let\pgfplots@current@point@x=\pgfplots@xarg + \let\pgfplots@current@point@y=\pgfplots@yarg +% \endgroup +} + +% #1: either 'x' or 'y' +% #2: either '+' or '-' +% #3: an integer representing the argument #2. It is '1' if #2='+' +% and '2' is #2 = '-'. +\def\pgfplots@process@errorbar@@for#1#2#3{% + \csname ifpgfplots@#1islinear\endcsname + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \ifcase\csname pgfplots@errorbars@#1mode\endcsname + % fixed absolute error. + \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \let\pgfplots@error@coord=\pgfmathresult + \or% fixed relative error: + \pgfmathparse{(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \or% explicit absolute: + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \let\pgfplots@error@coord=\pgfmathresult + \fi + \or% explicit relative: + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathparse{(1#2\pgfplots@error@coord)}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \fi + \fi + \else + % LOGARITHMIC scaling. All errors are interpreted as + % log(x +- e_x) + % or + % log( x*(1+-e_x) ) + \ifcase\csname pgfplots@errorbars@#1mode\endcsname + % fixed absolute, log( x +- e_x ) + \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@error@src}% + \let\pgfplots@error@src=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \pgfmathlog@float{\pgfmathresult}% + \let\pgfplots@error@coord=\pgfmathresult + \or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x) + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \pgfmathparse{\pgfplots@error@src + ln(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% + \let\pgfplots@error@coord=\pgfmathresult% + \or% explicit absolute + \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@error@src}% + \let\pgfplots@error@src=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \pgfmathlog@float{\pgfmathresult}% + \let\pgfplots@error@coord=\pgfmathresult + \fi + \or% explicit relative: + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathparse{\pgfplots@error@src + ln(1#2 \pgfplots@error@coord)}% + \let\pgfplots@error@coord=\pgfmathresult% + \fi + \fi + \fi + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{x}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \let\pgfplots@current@point@x=\pgfplots@error@coord + \let\pgfplots@current@point@y=\pgfplots@yarg + \pgfplots@update@limits@for@one@point + \edef\pgfplots@loc@TMPa{% + {(\pgfplots@xarg,\pgfplots@yarg)}% + {(\pgfplots@error@coord,\pgfplots@yarg)}% + }% + \else + \let\pgfplots@current@point@x=\pgfplots@xarg + \let\pgfplots@current@point@y=\pgfplots@error@coord + \pgfplots@update@limits@for@one@point + \edef\pgfplots@loc@TMPa{% + {(\pgfplots@xarg,\pgfplots@yarg)}% + {(\pgfplots@xarg,\pgfplots@error@coord)}% + }% + \fi + \expandafter\pgfplots@streamerrorbarcoords\pgfplots@loc@TMPa + \fi +} +% This routine is called at the begin of every plot. +% It initialises a zero level stream. +% +% The default is to use '0' as zero level streams. +% +% This method is called as "precommand"; before any Tikz drawing +% commands have been started. +\def\pgfplots@initzerolevelhandler{% + \ifpgfplots@stackedmode + % ATTENTION: this thing here says: + % "draw zero level coordinates from list XYZ." + % But at the time of this initialisation, the list will be EMPTY! + % + % It will be filled later. That's ok, because + % \pgfplots@initzerolevelhandler will be + % used as 'precommand', that means before Tikz sees any + % coordinates. + \pgfplots@stacked@initzerolevelhandler + \else + \pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}% + \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% + \fi +} + +% This code is mainly interesting for bar plots. +% +% It precomputes x = 0 and y = 0 - which is not necessarily +% trivial in case of data scaling. Furthermore, it applies +% coordinate clipping to the resulting values and multiplies them +% with x- and y scale vectors. +\def\pgfplots@prepare@ZERO@coordinates{% + \ifpgfplots@xislinear + \ifpgfplots@apply@datatrafo@x + \pgfplots@datascaletrafo@fromfixed@x{0}% + \global\let\pgfplots@logical@ZERO@x=\pgfmathresult + \else + \gdef\pgfplots@logical@ZERO@x{0}% + \fi + \pgfplotsmathmax{\pgfplots@logical@ZERO@x}{\pgfplots@xmin}% + \global\let\pgfplots@logical@ZERO@x=\pgfmathresult + \else + \global\let\pgfplots@logical@ZERO@x=\pgfplots@xmin% + \fi + % + \ifpgfplots@yislinear + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@fromfixed@y{0}% + \global\let\pgfplots@logical@ZERO@y=\pgfmathresult + \else + \gdef\pgfplots@logical@ZERO@y{0}% + \fi + \pgfplotsmathmax{\pgfplots@logical@ZERO@y}{\pgfplots@ymin}% + \global\let\pgfplots@logical@ZERO@y=\pgfmathresult + \else + \global\let\pgfplots@logical@ZERO@y=\pgfplots@ymin% + \fi + % + \ifpgfplots@threedim + \ifpgfplots@zislinear + \ifpgfplots@apply@datatrafo@z + \pgfplots@datascaletrafo@fromfixed@z{0}% + \global\let\pgfplots@logical@ZERO@z=\pgfmathresult + \else + \gdef\pgfplots@logical@ZERO@z{0}% + \fi + \pgfplotsmathmax{\pgfplots@logical@ZERO@z}{\pgfplots@zmin}% + \global\let\pgfplots@logical@ZERO@z=\pgfmathresult + \else + \global\let\pgfplots@logical@ZERO@z=\pgfplots@zmin% + \fi + \fi + % + % + \pgfinterruptboundingbox% + \ifpgfplots@threedim + \pgfplotsqpointxyz{\pgfplots@logical@ZERO@x}{\pgfplots@logical@ZERO@y}{\pgfplots@logical@ZERO@z}% + \else + \pgfplotsqpointxy{\pgfplots@logical@ZERO@x}{\pgfplots@logical@ZERO@y}% + \fi + \xdef\pgfplots@ZERO@x{\the\pgf@x}% + \xdef\pgfplots@ZERO@y{\the\pgf@y}% + \endpgfinterruptboundingbox% +}% + diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex new file mode 100644 index 00000000000..b5aaadc42dc --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex @@ -0,0 +1,77 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% 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. +% +% This program is free software: you can redistribute it and/or modify +% 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/>. +% +%-------------------------------------------- + + +\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% +\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}% +\def\pgfplots@message#1{% + \immediate\write16{#1}% +}% + + +\pgfutil@ifundefined{pgfkeys}{% + \pgfplots@error{It seems your version of PGF/Tikz is older than 2.00. Unfortunately, pgfplots requires at least version 2.00 ... you may need to update your TeX-Distribution or install PGF manually, sorry}% +}{\relax} + +\def\pgfplots@EOI{\pgfplots@EOI}% + +\newif\ifpgfplots@loc@tmp +\newtoks\t@pgfplots@toka +\newtoks\t@pgfplots@tokb +\newtoks\t@pgfplots@tokc +\newdimen\pgfplots@tmpa + +% use these macros for GLOBAL temporary assignments. +% you can NEVER rely on their values unless you know exactly what you are doing. +\gdef\pgfplots@glob@TMPa{}% +\gdef\pgfplots@glob@TMPb{}% +\gdef\pgfplots@glob@TMPc{}% + +% use these macros for LOCAL temporary assigments. +% you can NEVER rely on their values unless you know exactly what you are doing. +\def\pgfplots@loc@TMPa{}% +\def\pgfplots@loc@TMPb{}% +\def\pgfplots@loc@TMPc{}% + + +% Invokes code #2 if file '#1' exists and #3 if not. +\def\pgfplots@iffileexists#1#2#3{% + \begingroup + \openin1=#1 + \ifeof1 + \xdef\pgfplots@glob@TMPa{0}% + \else + \closein1 + \xdef\pgfplots@glob@TMPa{1}% + \fi + \endgroup + \if1\pgfplots@glob@TMPa + #2% + \else + #3% + \fi +} +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex new file mode 100644 index 00000000000..cd0cc44dff3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -0,0 +1,1530 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% 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. +% +% This program is free software: you can redistribute it and/or modify +% 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/>. +% +%-------------------------------------------- + +\newif\ifpgfplots@log@tick@isminor@tick@pos +% Checks whether the tick position given as #1.#2=log10(T) belongs to +% T=i*10^j with an integer i>1. +% +% If T=i*10^j, \ifpgfplots@log@tick@isminor@tick@pos will be set to true and +% \pgfmathresult will contain T. +% +% Otherwise, \ifpgfplots@log@tick@isminor@tick@pos will be set to false and +% pgfmathresult to #1.#2 +% +% Arguments: +% #1.#2 the value log10(T) +% +% 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) ) +% = - ( -j - 1 + (1-log(i)) ) +% = #1 '.' #2 [ up to the '0.' +% that means #1 = j-1 and #2 = 1-log(i). +\def\pgfplots@is@log@tick@a@minor@tick@pos#1.#2\relax{% + \pgfmathapproxequalto@{#1.#2}{#1.0}% + \ifpgfmathcomparison + % in MOST cases, this here will be true: + \pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \else + % I guess this won't happen too often. In fact, it's a very + % special case. + \begingroup + \c@pgf@counta=#1\relax + \ifnum\c@pgf@counta<0 + \advance\c@pgf@counta by-1 + \pgfmathsubtract@{1}{0.#2}% + \expandafter\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi\pgfmathresult\relax + \ifpgfplots@log@tick@isminor@tick@pos + \aftergroup\pgfplots@log@tick@isminor@tick@postrue + \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% + \else + \aftergroup\pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \fi + \else + \pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#2\relax + \ifpgfplots@log@tick@isminor@tick@pos + \aftergroup\pgfplots@log@tick@isminor@tick@postrue + \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% + \else + \aftergroup\pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup + \fi +} + +% expects a positive number. +\def\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#1\relax{% + \pgfplots@log@tick@isminor@tick@postrue + \pgfmathapproxequalto@{0.#1}{0.3010299956639}% + \ifpgfmathcomparison + \def\pgfmathresult{2}% + \else + \pgfmathapproxequalto@{0.#1}{0.4771212547196}% + \ifpgfmathcomparison + \def\pgfmathresult{3}% + \else + \pgfmathapproxequalto@{0.#1}{0.6020599913279}% + \ifpgfmathcomparison + \def\pgfmathresult{4}% + \else + \pgfmathapproxequalto@{0.#1}{0.698970004}% + \ifpgfmathcomparison + \def\pgfmathresult{5}% + \else + \pgfmathapproxequalto@{0.#1}{0.7781512503}% + \ifpgfmathcomparison + \def\pgfmathresult{6}% + \else + \pgfmathapproxequalto@{0.#1}{0.8450980400}% + \ifpgfmathcomparison + \def\pgfmathresult{7}% + \else + \pgfmathapproxequalto@{0.#1}{0.9030899869}% + \ifpgfmathcomparison + \def\pgfmathresult{8}% + \else + \pgfmathapproxequalto@{0.#1}{0.954242509439}% + \ifpgfmathcomparison + \def\pgfmathresult{9}% + \else + \pgfplots@log@tick@isminor@tick@posfalse + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +% Checks whether we need to create a separate 'tick scale label', +% a node with ' * 10^3' on the side of the axis: +% +% 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 +% and +% \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. +% FIXME : does that need further attention? +\def\pgfplots@init@scaled@tick@for#1{% + \global\def\pgfplots@glob@TMPa{0}% + \begingroup + \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname + % CASE 0 : scaled #1 ticks=false: do nothing here. + \or + % CASE 1 : scaled #1 ticks=true: + %-------------------------------- + % the \pgfplots@xmin@unscaled@as@float is set just before the data + % scale transformation is initialised. + % + % The variables are empty if there is no datascale transformation. + \expandafter\let\expandafter\pgfplots@cur@min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname + \expandafter\let\expandafter\pgfplots@cur@max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname + % + \ifx\pgfplots@cur@min@unscaled\pgfutil@empty + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1min\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \let\pgfplots@cur@min@unscaled=\pgfmathresult + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1max\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \let\pgfplots@cur@max@unscaled=\pgfmathresult + \fi + % + \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E + \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \fi + \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@above@exponent}% + \expandafter\ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E + % ok, scale it: + \multiply\pgfmathfloat@b@E by-1 + \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% + \else + \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@below@exponent}% + \expandafter\ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E + % ok, scale it: + \multiply\pgfmathfloat@b@E by-1 + \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% + \else + % no scaling necessary: + \xdef\pgfplots@glob@TMPa{0}% + \fi + \fi + \or + % CASE 2 : scaled #1 ticks=base 10: + %-------------------------------- + \c@pgf@counta=\csname pgfplots@scaled@ticks@#1@arg\endcsname\relax + %\multiply\c@pgf@counta by-1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \or + % CASE 3 : scaled #1 ticks=real: + %-------------------------------- + \pgfmathfloatparsenumber{\csname pgfplots@scaled@ticks@#1@arg\endcsname}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \or + % CASE 4 : scaled #1 ticks=manual: + \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@scaled@ticks@#1@arg\endcsname + \fi + \endgroup + \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% +} + +% x-axis tick labels for #1th tick +% #1: the axis (x or y) +% #2: the value +% #3,#4: coordinates for \pgfplotspointonorientedsurfaceab +% #5: ticknumber +\def\pgfplots@show@ticklabel#1#2(#3,#4)#5{{% + \csname ifpgfplots@#1ticklabel@interval\endcsname + \pgfmathparse{#3}% + \edef\pgfplots@show@ticklabel@coord@x@new{\pgfmathresult}% + \pgfmathparse{#4}% + \edef\pgfplots@show@ticklabel@coord@y@new{\pgfmathresult}% + % + \pgfplots@show@ticklabel@{#1}{#2}% + \let\nexttick=\tick + \ifx\pgfplots@show@ticklabel@LASTTICK\pgfutil@empty + % its the first call. Simply remember arguments and wait + % for interval boundary before proceeding. + \else + % acquire options of first interval boundary: + \pgfplots@show@ticklabel@LASTTICK + % compute new node position: + \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#1\endcsname + \csname pgfplots@show@ticklabel@coord@#1@new\endcsname)}% + \expandafter\edef\csname pgfplots@show@ticklabel@coord@#1\endcsname{\pgfmathresult}% + \let\ticknum=\pgfplots@show@ticklabel@num\relax% + \let\tick=\pgfplots@show@ticklabel@tick% + \edef\pgfplots@loc@TMPa{at (\pgfplots@show@ticklabel@coord@x,\pgfplots@show@ticklabel@coord@y)}% + \begingroup + \pgftransformshift{\pgfplotspointonorientedsurfaceab{\pgfplots@show@ticklabel@coord@x}{\pgfplots@show@ticklabel@coord@y}}% + \node at (0pt,0pt) {\csname pgfplots@#1ticklabel\endcsname};% + \endgroup + \fi + \xdef\pgfplots@show@ticklabel@LASTTICK{% + \noexpand\def\noexpand\pgfplots@show@ticklabel@tick{\nexttick}% + \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@x{\pgfplots@show@ticklabel@coord@x@new}% + \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@y{\pgfplots@show@ticklabel@coord@y@new}% + \noexpand\edef\noexpand\pgfplots@show@ticklabel@num{#5}% + }% + \else + \let\ticknum=#5\relax% + \pgfplots@show@ticklabel@{#1}{#2}% + \begingroup + \pgftransformshift{\pgfplotspointonorientedsurfaceab{#3}{#4}}% + \node at (0pt,0pt) {\csname pgfplots@#1ticklabel\endcsname};% + \endgroup + \fi +}} + +% Defines \tick by applying any necessary math to the (possibly +% transformed) tick value #2. +% +% #1: axis (x or y) +% #2: tick value. +\def\pgfplots@show@ticklabel@#1#2{% + \csname ifpgfplots@apply@datatrafo@#1\endcsname + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{#2}% + \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname + \or + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \or + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \or + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \or + % scaled #1 ticks=manual. Invoke manual tick scaling code: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@tick@scale@#1\endcsname + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}% + \fi + % .. and this here provides \tick as fixed point repr: + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\tick=\pgfmathresult + \else + \edef\tick{#2}% + \pgfplots@if{pgfplots@#1islinear}{% + \ifnum\csname pgfplots@scaled@ticks@#1@choice\endcsname=0 + \else + \pgfmathfloatparsenumber{#2}% + \ifnum\csname pgfplots@scaled@ticks@#1@choice\endcsname=3 + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \else + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \fi + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\tick=\pgfmathresult + \fi + }{}% + \fi + \pgfkeysgetvalue{/pgfplots/#1 coord inv trafo/.@cmd}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key + \else + \let\pgfmathresult=\tick% + \expandafter\pgfplots@loc@TMPa\expandafter{\tick}\pgfeov + \let\tick=\pgfmathresult + \fi +}% + +\def\pgfplots@user@ticklabel@list@x{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@xticklabels\to\tick + \tick +} +\def\pgfplots@user@ticklabel@list@y{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@yticklabels\to\tick + \tick +} +\def\pgfplots@user@ticklabel@list@z{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@zticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@x{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@xticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@y{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@yticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@z{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@zticklabels\to\tick + \tick +} + +% Check if a label does not cross the x-axis +\def\pgfplots@ytick@check@tickshow{% + \pgfplots@tickshowtrue + \ifnum\pgfplots@yaxislinesnum=2 % + \ifcase\pgfplots@xaxislinesnum\relax + \ifdim\pgfplots@tmpa=\pgfplots@ymin@reg\relax + \pgfplots@tickshowfalse + \fi + \ifdim\pgfplots@tmpa=\pgfplots@ymax@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ymin@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@logical@ZERO@y pt + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ymax@reg\relax + \pgfplots@tickshowfalse + \fi + \fi + \fi +} +\def\pgfplots@ztick@check@tickshow{% + \pgfplots@tickshowtrue + % FIXME +}% + +% Fills the macros +% \pgfplots@tick@beg@a \pgfplots@tick@end@a +% \pgfplots@tick@beg@b \pgfplots@tick@end@b +% with coordinates such that +% (\pgfplots@tick@beg@a,\pgfplots@tmpa) -- (\pgfplots@tick@end@a,\pgfplots@tmpa) +% produces a correct tick line. +% +% The '@b' variant is only used in case of \pgfplots@ytickposnum = 0 +% +% #1 : the current axis (x or y). +% #2 : the current tick width +% +\def\pgfplots@prepare@tick@offsets@for@#1#2{% + \ifcase\csname pgfplots@#1tickposnum\endcsname\relax + %(\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt) + \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}% + \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult + % + %(\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#2, 0pt) + \edef\pgfplots@tick@beg@b{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}% + \pgfmathadd@{\pgfplots@tick@beg@b}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@b=\pgfmathresult + \pgfmathsubtract@{\pgfplots@tick@beg@b}{#2}% + \let\pgfplots@tick@end@b=\pgfmathresult% + \or + % (\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt); + \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}% + \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult + \or + % (\pgfplots@ZERO@x -\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt); + \pgfmathsubtract@{\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB \endcsname}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult% + \or + % (\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#2, 0pt); + \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}% + \pgfmathadd@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathsubtract@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult% + \fi +}% + + +\newif\ifpgfplots@needsminorloop + +\def\pgfplots@draw@tick@scale@label@for#1{% + \csname ifpgfplots@#1islinear\endcsname + \begingroup + \def\pgfplots@temp@isbaseten{0}% + \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \or + \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% + \def\pgfplots@temp@isbaseten{1}% + \or + \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% + \def\pgfplots@temp@isbaseten{1}% + \or + \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% + % real: + \or + % manual: + \global\def\pgfplots@glob@TMPa{dummyargument}% + \fi + \if1\pgfplots@temp@isbaseten + \expandafter\c@pgf@counta\pgfplots@glob@TMPa\relax + \multiply\c@pgf@counta by-1 + \ifnum\c@pgf@counta=0\relax + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \else + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \fi + \fi + \endgroup + \ifx\pgfplots@glob@TMPa\pgfutil@empty + \else + \begingroup + \pgfkeysgetvalue{/pgfplots/#1tick scale label code/.@cmd}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key + \else + \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/#1tick scale label code/.@cmd}{\pgfplots@glob@TMPa}}% + \pgftransformshift{\pgfplotspointsouthwest}% + \pgfsetxvec{\pgfplotspointxaxis}% + \pgfsetyvec{\pgfplotspointyaxis}% + % FIXME : do I need the fix for 'current axis.origin' + % here!? + \node[% + /pgfplots/every tick label,% + /pgfplots/every #1 tick label,% + /pgfplots/every #1 tick scale label] + {\pgfplots@tick@scale@labels}; + \fi + \endgroup + \fi + \fi +} + +% 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. +\def\pgfplots@xtick@check@tickshow{% + \pgfplots@tickshowtrue + \ifnum\pgfplots@xaxislinesnum=2 % + \ifcase\pgfplots@yaxislinesnum\relax + \ifdim\pgfplots@tmpa=\pgfplots@xmin@reg\relax + \pgfplots@tickshowfalse + \fi + \ifdim\pgfplots@tmpa=\pgfplots@xmax@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@xmin@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@logical@ZERO@x pt % + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@xmax@reg\relax + \pgfplots@tickshowfalse + \fi + \fi + \fi +} + +% Draws extra ticks including grid lines, tick lines and tick labels +% along the current oriented surface. +% +% See \pgfplots@drawticklines@onorientedsurf@ for a description of the +% oriented surface. +% +% #1 : tick position list +\def\pgfplots@draw@extra@ticks@onorientedsurf{% + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf@\pgfplotspointonorientedsurfaceA +}% +% #1: axis (x or y) +% #2: tick position list +\def\pgfplots@draw@extra@ticks@onorientedsurf@#1#2{% + \begingroup + \def\pgfplots@scaled@ticks@x@choice{0}% + \def\pgfplots@scaled@ticks@y@choice{0}% + \csname pgfplots@#1minorticksfalse\endcsname + \csname pgfplots@#1minorgridsfalse\endcsname + \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname + \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP + \pgfplotsset{/pgfplots/every extra #1 tick}% + \expandafter\pgfplots@prepare@tick@coordlists@for\pgfplotspointonorientedsurfaceA{#2}% + \pgfplots@drawgridlines@onorientedsurf% + \pgfplots@drawticklines@onorientedsurf% + \pgfplots@drawticklabels@onorientedsurf% + \endgroup +} + +% Computes final major and minor tick positions into global lists +% \pgfplots@prepared@tick@positions@major@x +% and +% \pgfplots@prepared@tick@positions@minor@x. +% +% The major tick list contains tuples (canvas position,logical position) +% while the minor tick list contains just the canvas position. +% +% #1: the axis +% #2: the tick list. +% +% PRECONDITION: +% - \pgfplots@determinedefaultvalues has been executed. +% That means particularly that \pgfplots@[xy][min,max] are available in TeX point +% range (after datascaling and logs). +\def\pgfplots@prepare@tick@coordlists@for#1#2{% + \begingroup + \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname + \expandafter\let\expandafter\ifpgfplots@minorticks\csname ifpgfplots@#1minorticks\endcsname + \expandafter\let\expandafter\ifpgfplots@minorgrids\csname ifpgfplots@#1minorgrids\endcsname + % these lists need to be global such that I can fill them inside + % of \foreach statements. And, yes: I have also added a TeX group + % on my own (but that's not the problem). + \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@major + \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@minor + \edef\pgfplots@loc@TMPa{#2}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \ifpgfplots@minorticks + \pgfplots@needsminorlooptrue + \else + \ifpgfplots@minorgrids + \pgfplots@needsminorlooptrue + \else + \pgfplots@needsminorloopfalse + \fi + \fi + \ifpgfplots@needsminorloop + \ifpgfplots@islinear + \expandafter\let\expandafter\pgfplots@minor@tick@num\csname pgfplots@minor@#1tick@num\endcsname + \begingroup + \c@pgf@counta=\pgfplots@minor@tick@num\relax + \advance\c@pgf@counta by1\relax + \pgfplots@tmpa=\csname pgfplots@tick@distance@#1\endcsname pt % + \divide\pgfplots@tmpa by\c@pgf@counta + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpa}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplots@minor@tick@dist=\pgfmathresult + \else + \def\pgfplots@minor@tick@num{9}% + \fi + \fi + % + % Prepare the [xy]tick[min|max] key processing: + \let\pgfplots@checktickminmax=\pgfutil@empty + \expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplots@checktickminmax\expandafter{% + \pgfplots@checktickminmax + \ifdim\pgfplots@tmpa<\csname pgfplots@#1tickmin\endcsname pt + \pgfplots@tickshowfalse + \fi + }% + \fi + \expandafter\ifx\csname pgfplots@#1tickmax\endcsname\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplots@checktickminmax\expandafter{% + \pgfplots@checktickminmax + \ifdim\pgfplots@tmpa>\csname pgfplots@#1tickmax\endcsname pt + \pgfplots@tickshowfalse + \fi + }% + \fi + % + % + \foreach \x in {#2} {% + \pgfplots@tmpa=\x pt % + \csname pgfplots@#1tick@check@tickshow\endcsname + \pgfplots@checktickminmax + % + \ifpgfplots@tickshow + \ifdim\pgfplots@tmpa<\csname pgfplots@#1min@reg\endcsname + \else + \ifdim\pgfplots@tmpa>\csname pgfplots@#1max@reg\endcsname + \else + \expandafter\pgfplotslistpushbackglobal\x\to\pgfplots@prepared@tick@positions@major + \fi + \fi + \fi + % X-Axis ticks bottom and top + % in log: + % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9 + \ifpgfplots@needsminorloop + \foreach \pgfplots@i in {1,...,\pgfplots@minor@tick@num} {% + \begingroup + \ifpgfplots@islinear + \pgfplots@tmpa=\pgfplots@minor@tick@dist pt % + \pgfplots@tmpa=\pgfplots@i\pgfplots@tmpa + \else + \pgfplots@tmpa=\logi\pgfplots@i pt % + \fi + \edef\pgfmathresult{\the\pgfplots@tmpa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \advance\pgfplots@tmpa by\pgfmathresult\relax + \pgfplots@tickshowtrue + \pgfplots@checktickminmax + \ifpgfplots@tickshow + \ifdim\pgfplots@tmpa<\csname pgfplots@#1min@reg\endcsname + \else + \ifdim\pgfplots@tmpa>\csname pgfplots@#1max@reg\endcsname + \else + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpa}}% + \expandafter\pgfplotslistpushbackglobal\pgfmathresult\to\pgfplots@prepared@tick@positions@minor + \fi + \fi + \fi + }% + \fi + }% + \fi + \endgroup + \expandafter\let\csname pgfplots@prepared@tick@positions@minor@#1\endcsname=\pgfplots@prepared@tick@positions@minor + \expandafter\let\csname pgfplots@prepared@tick@positions@major@#1\endcsname=\pgfplots@prepared@tick@positions@major + \global\let\pgfplots@prepared@tick@positions@major=\relax + \global\let\pgfplots@prepared@tick@positions@minor=\relax +}% + +% Draws grid lines at the a-positions of the currently set oriented +% surface. +% +% Tick positions are taken out of the already precomputed list +% \pgfplots@prepared@tick@positions@major@... +% +% See \pgfplots@drawticklines@onorientedsurf@ for a description of the +% oriented surface. +% +% #1 : the verbatim axis name (either 'x' or 'y') +% #2 : the index of the axis (either 0 or 1) +\def\pgfplots@drawgridlines@onorientedsurf{% + \expandafter\pgfplots@drawgridlines@onorientedsurf@\pgfplotspointonorientedsurfaceA +}% +\def\pgfplots@drawgridlines@onorientedsurf@#1{% + \begingroup + \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorgrids\endcsname + \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorgrids\endcsname + % grid lines shall be drawn + % if and only if BOTH adjacent axis lines shall be drawn: + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% + % remark: this is ALWAYS true for 2D plots. + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% + \def\pgfplots@drawgridlines@onorientedsurf@OK{1}% + }{% + \def\pgfplots@drawgridlines@onorientedsurf@OK{0}% + }% + }{% + \def\pgfplots@drawgridlines@onorientedsurf@OK{0}% + }% + \if1\pgfplots@drawgridlines@onorientedsurf@OK + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname + \pgfplots@loop@CONTINUEfalse + \ifpgfplots@major + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@minor + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \scope + \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 + \ifpgfplots@major + \draw[% + /pgfplots/every axis grid, + /pgfplots/every major grid, + /pgfplots/every axis #1 grid, + /pgfplots/every major #1 grid]% + \pgfextra + \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curgridpos{% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% + }% + \endpgfextra; + \fi + % + \ifpgfplots@minor + \draw[% + /pgfplots/every axis grid, + /pgfplots/every minor grid, + /pgfplots/every axis #1 grid, + /pgfplots/every minor #1 grid]% + \pgfextra + \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curgridpos{% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% + }% + \endpgfextra; + \fi + \endscope + \fi + \fi + \endgroup +} + +% Draws ticks on the currently active "oriented surface". +% +% The oriented surface is two dimensional and has been initialised +% with \pgfplotspointonorientedsurfaceabsetupfor*** somehow. +% +% The idea is now the following: +% - the tick positions change along the FIRST coordinate of this +% surface: +% +% x ---- x ---- x ---- x +% --> FIRST --> +% +% - the tick lines are drawn along the SECOND coordinate of this +% surface: +% +% | ---- | ---- | ---- | | SECOND +% | | | | v +% +% for example, +% \pgfplotspointonorientedsurfaceab@setupfor@xyZ{1} +% \pgfplots@drawticklines@onorientedsurf +% will draw ticks at x-positions designated by \pgfplots@xtick. The +% small tick lines will be drawn along the y axis. For each processed +% point, the z coordinate will be fixed to '1'. +% +% Another example: +% \pgfplotspointonorientedsurfaceab@setupfor@yxZ{-1} +% \pgfplots@drawticklines@onorientedsurf +% 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{% + \expandafter\pgfplots@drawticklines@onorientedsurf@\pgfplotspointonorientedsurfaceA +}% + +% Avoids tick lines which are too thick by introducing a clipping +% region. Tick lines (and grid lines) won't extend to the left or +% right of axis #1. +\def\pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1{% + \pgfinterruptboundingbox% + \begingroup + \pgf@xa=5cm + \edef\pgfplots@loc@TMPc{\pgf@sys@tonumber{\pgf@xa}}% + \pgfmathmultiply@{\pgfplots@loc@TMPc}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@loc@LENGTH=\pgfmathresult + \pgfmathsubtract@{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}{\pgfplots@loc@LENGTH}% + \let\pgfplots@loc@MIN=\pgfmathresult + \pgfmathadd@{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}{\pgfplots@loc@LENGTH}% + \let\pgfplots@loc@MAX=\pgfmathresult + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\pgfplots@loc@MIN}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\pgfplots@loc@MIN}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\pgfplots@loc@MAX}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\pgfplots@loc@MAX}}% + \pgfusepath{clip}% + \endgroup + \endpgfinterruptboundingbox% +}% + +\def\pgfplots@drawticklines@onorientedsurf@#1{% + \scope + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% + \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{1}% + }{% + \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{0}% + }% + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{1}% + }{% + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{0}% + }% + \begingroup + % Assemble the \pgfplots@drawticklines@for@placecomputedtick + % command. + \let\E=\noexpand + \xdef\pgfplots@drawticklines@for@placecomputedtick{% + \if\pgfplots@drawticklines@for@placecomputedtick@LOWEROK1% + \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@a}}% + \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@a}}% + \fi + \if\pgfplots@drawticklines@for@placecomputedtick@UPPEROK1% + \ifnum\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname=0\relax + \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@b}}% + \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@b}}% + \fi + \fi + }% + \endgroup + \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname + \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorticks\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname + \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 + \ifpgfplots@major + \draw[% + /pgfplots/every tick, + /pgfplots/every major tick, + /pgfplots/every #1 tick, + /pgfplots/every major #1 tick]% + \pgfextra + \pgfmathparse{\pgfplots@tickwidth}% + \let\pgfplots@tickwidth@=\pgfmathresult + \pgfmathmultiply@{\pgfplots@tickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@tickwidth@=\pgfmathresult + \let\pgfplots@tickwidth=\pgfmathresult + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfplots@tick@offset{0}% + \or + \let\pgfplots@tick@offset=\pgfplots@tickwidth@% + \or + \pgfmathmultiply@{0.5}{\pgfplots@tickwidth@}% + \let\pgfplots@tick@offset=\pgfmathresult% + \fi + \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@tickwidth@}% + \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% + \pgfplots@drawticklines@for@placecomputedtick + }% + \endpgfextra; + \fi + % + \ifpgfplots@minor + \draw[% + /pgfplots/every tick, + /pgfplots/every minor tick, + /pgfplots/every #1 tick, + /pgfplots/every minor #1 tick]% + \pgfextra + \pgfmathparse{\pgfplots@subtickwidth}% + \let\pgfplots@subtickwidth@=\pgfmathresult + \pgfmathmultiply@{\pgfplots@subtickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@subtickwidth@=\pgfmathresult + \let\pgfplots@subtickwidth=\pgfmathresult + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfplots@tick@offset{0}% + \or + \let\pgfplots@tick@offset=\pgfplots@subtickwidth@% + \or + \pgfmathmultiply@{0.5}{\pgfplots@subtickwidth@}% + \let\pgfplots@tick@offset=\pgfmathresult% + \fi + \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@subtickwidth@}% + \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curtickpos{% + \pgfplots@drawticklines@for@placecomputedtick + }% + \endpgfextra; + \fi + \endscope +} + +% Draws tick labels at the A positions of the currently set oriented +% surface. +% +% Tick positions are taken out of the already precomputed list +% \pgfplots@prepared@tick@positions@major@... +% +% See \pgfplots@drawticklines@onorientedsurf@ for a description of the +% oriented surface. +% +% #1 : the verbatim axis name (either 'x' or 'y') +\def\pgfplots@drawticklabels@onorientedsurf{% + \expandafter\pgfplots@drawticklabels@onorientedsurf@\pgfplotspointonorientedsurfaceA +} +\def\pgfplots@drawticklabels@onorientedsurf@#1{% + \begingroup + \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname + \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \pgfplotspointonorientedsurfaceabmatchaxisline{\csname pgfplots@#1ticklabelaxisspec\endcsname}{\pgfplots@ticklabelside}% + \ifx\pgfplots@ticklabelside\pgfutil@empty + % SKIP. The current oriented surface shall not get tick labels + % for #1. + \else + \ifpgfplots@major + \ifpgfplots@islinear + \pgfplots@init@scaled@tick@for{#1}% + \fi + \begingroup + \if\pgfplotspointonorientedsurfaceB x + \def\pgfplots@tickposchoicea{\tikzset{right}}% + \def\pgfplots@tickposchoiceb{\tikzset{left}}% + \else + \if\pgfplotspointonorientedsurfaceB y + \def\pgfplots@tickposchoicea{\tikzset{above}}% + \def\pgfplots@tickposchoiceb{\tikzset{below}}% + \else + \def\pgfplots@tickposchoicea{\tikzset{anchor=north east}}% + \def\pgfplots@tickposchoiceb{\tikzset{anchor=south east}}% + \fi + \fi + % + \pgfkeys{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}% + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfmathresult{0}% + \or + \pgfmathparse{\pgfplots@tickwidth}% + \or + \pgfmathmultiply{0.5}{\pgfplots@tickwidth}% + \fi + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@tick@offset=\pgfmathresult + %-------------------------------------------------- + % \ifnum\csname pgfplots@#1ticklabelaxisspec\endcsname=0 + % % the choice '[xy]ticklabel pos=default': + % \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1tickposnum\endcsname + % \else + % \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1ticklabelaxisspec\endcsname + % \fi + % \ifcase\pgfplots@tmpposnum\relax + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + % \or + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + % \or + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname% + % \or + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname% + % \fi + %-------------------------------------------------- + \ifnum\csname pgfplots@#1axislinesnum\endcsname=2 % Centered axis lines? + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname% + % FIXME : that stuff here does not respect + % '[xyz]tickpos num' keys! + \pgfplots@tickposchoiceb + \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \else + \if0\pgfplots@ticklabelside + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + \pgfplots@tickposchoiceb + \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \else + \if1\pgfplots@ticklabelside + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname% + \pgfplots@tickposchoicea + \pgfmathadd@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \else + \pgfplots@error{Internal logic error during tick label placement (got placement character '\pgfplots@ticklabelside'). + Please report this as a bug or verify your input arguments to #1ticklabel pos.}% + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + \pgfplots@tickposchoiceb + \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \fi + \fi + \fi + % + \let\pgfplots@tick@origin=\pgfmathresult% + \def\pgfplots@ticknum{0}% + \xdef\pgfplots@show@ticklabel@LASTTICK{}% + \pgfplotslistforeachungrouped\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% + \pgfplots@show@ticklabel + {#1}{\pgfplots@curtickpos}(\pgfplots@curtickpos,\pgfplots@tick@origin)% + {\pgfplots@ticknum}% + \begingroup + \c@pgf@counta=\pgfplots@ticknum\relax + \advance\c@pgf@counta by1 + \edef\pgfplots@ticknum{\the\c@pgf@counta}% + \pgfmath@smuggleone\pgfplots@ticknum + \endgroup + }% + \endgroup + \pgfplots@draw@tick@scale@label@for #1% + \fi + \fi + \endgroup +} + +\newif\ifpgfplots@checkuniform@isfirst +% 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: +% \pgfplots@isuniformticktrue +% or +% \pgfplots@isuniformtickfalse +% depending on the check. +% This variable will be set globally. +\def\pgfplots@checkisuniformLOGtick#1{% + \begingroup + \global\pgfplots@isuniformticktrue + \pgfplots@checkuniform@isfirsttrue + \foreach \x in {#1}{% + \pgfmathmultiply@\x\reciproclogten + \let\cur=\pgfmathresult + % check whether + % \cur - last == 1 (last = \pgfplots@glob@TMPb) + \ifpgfplots@checkuniform@isfirst + \global\pgfplots@checkuniform@isfirstfalse + \else + \pgfmathsubtract@\cur\pgfplots@glob@TMPb% + \pgfmathapproxequalto@\pgfmathresult{1.0}% + \ifpgfmathcomparison + \else + \global\pgfplots@isuniformtickfalse + \breakforeach + \fi + \fi + \global\let\pgfplots@glob@TMPb=\cur + }% + \endgroup +} + +% Checks whether the linear tick sequence #1 is a uniform tick. +% +% It also assigns pgfplots@tick@distance@#1 as the distance. +% +% see \pgfplots@checkisuniformLOGtick for details. +% +% #1: a tick sequence (expanded) +% #2: a macro which will be filled with the tick distance. This is +% only valid if \pgfplots@isuniformticktrue. +\def\pgfplots@checkisuniformLINEARtick#1#2{% + \begingroup + \global\pgfplots@isuniformticktrue + \pgfplots@checkuniform@isfirsttrue + \global\let\pgfplots@glob@TMPb=\pgfutil@empty + \global\def\pgfplots@glob@TMPa{1}% + \foreach \x in {#1}{% + \ifx\pgfplots@glob@TMPb\pgfutil@empty + \else + \pgfmathsubtract@\x\pgfplots@glob@TMPb + \ifpgfplots@checkuniform@isfirst + % remember first distance h = x_1 - x_0 + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \global\pgfplots@checkuniform@isfirstfalse + \else + % check whether x_i - x_{i-1} = h + \pgfmathapproxequalto@\pgfmathresult\pgfplots@glob@TMPa% + \ifpgfmathcomparison + \else + \global\pgfplots@isuniformtickfalse + \breakforeach + \fi + \fi + \fi + \global\let\pgfplots@glob@TMPb=\x% + }% + \endgroup + \let#2=\pgfplots@glob@TMPa +} + +% helper method which computes log10*\x foreach \x in {#1}. +% The result will be \xdef'ed into #2. +\def\pgfplots@compute@tick@times@logten#1\to#2{% + \global\let#2=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + \pgfmathmultiply@\pgfplots@loc@TMPb\logten% + \ifx#2\pgfutil@empty + \xdef#2{\pgfmathresult}% + \else + \xdef#2{#2,\pgfmathresult}% + \fi + }% +} + +% Computes tick positions using the current axis limits. +% +% Parameters: +% /pgfplots/max space between ticks +% Determines the maximum space which is not filled by at least one +% tick label (approximate, there is some rounding internally) +% /pgfplots/try min ticks +% 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 / (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 +% { 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! +% This yields H (for example as 2*10^e). Then, compute i*H, i \in \Z +% +% The data scaling transformation T(x) makes things more complicated. +% Now, T(x) = q * x - p and we need to check for problems with large +% numbers: +% - q* H = ( T(Max) - T(Min) ) / desirednumticks = q * (Max - Min) / desirednumticks. +% - Using floating point arithmetics, (Max-Min)/desirednumticks (unscaled!) +% is analysed to restrict H to {1*10^e, 2*10^e, 5*10^e}. +% - So, we get q * H (we can't use the 'p' shift of the affine trafo here). +% - The next problem is to compute { I*H, I in \Z } because +% I = trunc( Min / H ) = trunc( ( T(Min) + p ) / (q*H) ). +% This can be seen by Min = I*H + rest and thus T(Min) = I*q*H + q*rest -p. +% The Problem: (T(min)+p ) / (q*H) can be TOO BIG for pgfmath. +% -> 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, +% H in { j*log(10), j=1,2,3,... } +% where the usual case should be j = 1. +% +% 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. +% +% Again, log plots follow a slightly different approach: here, +% MIN = I * log(10) +% is chosen such that +% axis minimum limit = I*log(10) + rest; |rest| < log(10) +% while H = j*log(10), j>=1. +% +% +% PRECONDITION: +% - limits are correct +% - axis width/height is set correctly +% +% POSTCONDITION: +% - Tick for axis #1 is assigned +% - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick is set +% +% REMARKS: +% - this algorithms works also if the data range has been transformed +% with a LINEAR transformation. +% ATTENTION: as of 2008-05-15, the scaling trafo is AFFINE LINEAR. +% That means we have to eliminate the 'affine' shifting before the +% algorithms works correctly. +\def\pgfplots@assign@default@tick@foraxis#1{% + \begingroup + % Shortcut-names: + \expandafter\let\expandafter\ifpgfplots@is@datascaled\csname ifpgfplots@apply@datatrafo@#1\endcsname + % Attention here: use UNSHIFTET scalings, see remark above + \expandafter\let\expandafter\pgfplots@data@scale@trafo\csname pgfplots@datascaletrafo@#1@noshift\endcsname + \expandafter\let\expandafter\pgfplots@data@scale@inverse@trafo\csname pgfplots@inverse@datascaletrafo@#1@noshift\endcsname + \expandafter\let\expandafter\ifpgfplots@cur@is@linear\csname ifpgfplots@#1islinear\endcsname + % + \let\desirednumticks=\c@pgf@countd + \let\Wr=\pgf@xc + \Wr=\csname pgfplotspoint#1axislength\endcsname + % r = max place without ticks in pt -> choose desirednumticks >= W/r + \expandafter\expandafter\divide\Wr\axisdefaulttickwidth + \pgfmathsetcount{\desirednumticks}{\Wr}% + \advance\desirednumticks by1 + \csname ifpgfplots@#1islinear\endcsname + \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks + \desirednumticks=\axisdefaulttryminticks + \fi + \else + \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks + \desirednumticks=\pgfplots@default@try@minticks@log\relax + \fi + \expandafter\ifx\csname pgfplots@#1tickten\endcsname\pgfutil@empty + \else + % log plot and tickten-option: provide special processing. + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tickten\endcsname}% + \expandafter\pgfplots@compute@tick@times@logten\pgfplots@loc@TMPa\to\pgfplots@glob@TMPa + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa + \fi + \fi + % + \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty + % Ok, we have either log or linear axis and need default + % ticks MIN,MIN+H,...,MAX. + \let\MINH=\pgf@xa + \let\H=\pgf@xb + \let\MAX=\pgf@ya + \let\MIN=\pgf@yb + % compute step size 'H': + \expandafter\MAX\csname pgfplots@#1max\endcsname pt + \advance\MAX by0.001pt % avoid round errors + %\expandafter\MIN\the\c@pgf@counta pt + \expandafter\MIN\csname pgfplots@#1min\endcsname pt + \H=\MAX + \advance\H by-\MIN +%\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.}% + \c@pgf@counta=\desirednumticks + \advance\c@pgf@counta by-1 + \divide\H by\c@pgf@counta +%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% + % + % SEARCH for the NEXT FEASABLE H. + \edef\Hmacro{\pgf@sys@tonumber\H}% + \ifpgfplots@cur@is@linear + % CASE LINEAR AXIS + \ifpgfplots@is@datascaled + % This here works if the scaling trafo is linear. + \expandafter\pgfplots@data@scale@inverse@trafo\expandafter{\Hmacro}% + \let\Hmacro=\pgfmathresult + \else + \pgfmathfloatparsenumber{\Hmacro}% + \let\Hmacro=\pgfmathresult + \fi + \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E +%\message{Got T^{-1}(H#1) = \Hmacro}% + % modify the mantisse: + \ifdim\H<2pt + \ifdim\H<1.5pt + \H=1.0pt + \else + \H=2.0pt + \fi + \else + \ifdim\H<4.9999pt + \ifdim\H<3.5pt + \H=2.0pt\relax + \else + \H=5.0pt\relax + \fi + \else + \ifdim\H<7.5pt + \H=5.0pt\relax + \else + \H=1.0pt\relax + \advance\pgfmathfloat@a@E by1 + \fi + \fi + \fi + \aftergroup\pgfplots@isuniformticktrue + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% + \let\Hmacro=\pgfmathresult + % The following code is carried out in floating point + % arithmetics because it requires large data ranges. + % + % I want to compute MIN@new := I*H where I is chosen + % such that MIN = I*H + rest with rest < H. + % The problem is the possibly large range of MIN. I + % can't work completely in the transformed datarange, + % so numbers get too large. + % + % So, compute I := int( MIN / H ) (integer truncation) + % in float arithmetics and then MIN@new := I*H + \pgfmathfloatdivide@{\csname pgfplots@#1min@unscaled@as@float\endcsname}{\Hmacro}% + \pgfmathfloatint@{\pgfmathresult}% + \pgfmathfloatmultiply@{\pgfmathresult}{\Hmacro}% + \let\MIN@new=\pgfmathresult + % Ok, we are ready. + % Now, convert everything into the fixed point data + % range: + \ifpgfplots@is@datascaled + \csname pgfplots@datascaletrafo@#1\endcsname{\MIN@new}% + \MIN=\pgfmathresult pt + \pgfplots@data@scale@trafo\Hmacro + \H=\pgfmathresult pt + \else + \pgfmathfloattofixed\MIN@new + \MIN=\pgfmathresult pt + \pgfmathfloattofixed\Hmacro + \H=\pgfmathresult pt + \fi + % + % And, since we have used finite precision, I is most + % likely to large. So: subtract one H. In the worst + % case, this produces one tick position too much (but + % it won't be printed). + \advance\MIN by-\H + \else + % CASE LOG AXIS + % + % search for the "best" H= j* log(10), j an integer. + % + % And prefer j=1 if that is possible (otherwise minor + % ticks are not useful). + \pgfmathmultiply@{\Hmacro}{\reciproclogten}% + \let\Hmacrobaseten=\pgfmathresult + \expandafter\H\pgfmathresult pt +%\message{ [ H / log(10) = \pgfmathresult ]}% + \ifdim\H<2pt + \H=1pt + \else + \ifnum\H<1pt + \H=1pt + \else + \expandafter\pgfmathfloor\expandafter{\pgfmathresult}% + \expandafter\H\pgfmathresult pt + \fi + \fi + \ifdim\H=1pt + \aftergroup\pgfplots@isuniformticktrue + \pgfplots@isuniformticktrue + \else + \aftergroup\pgfplots@isuniformtickfalse + \pgfplots@isuniformtickfalse + \fi +%\message{final H=\pgf@sys@tonumber{\H} * log(10)}% + \H=\logten\H\relax + % Now, we want to activate the Tick set + % {lowest, lowest+H, ..., highest} + % + % Where + % lowest = I * log(10) + rest, |rest| < log(10). + % this is conceptionally different from the approach for + % linear axes, because H = j*log(10). + % + % remember the original xmin in MINH: + \MINH=\MIN + % + % and compute I and I*log(10) here: + \expandafter\MIN\reciproclogten\MIN\relax + \edef\pgfmathresult{\pgf@sys@tonumber{\MIN}}% + \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% + \ifdim\MIN<0pt + % the truncation rounds TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \expandafter\MIN\logten pt + \multiply\MIN by\c@pgf@counta + \ifpgfplots@isuniformtick + \else + % This here is a special case to move the first tick + % 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 + % 10^{-5}, 10^{-3}, 10^{-1} + % or + % 10^{-4}, 10^{-2} + % as ticks. Well, I prefer the first one. + % + % HEURISTICS: start as near to ymin as possible! + % + % We check here if we can come nearer to ymin if we + % 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 + % 2*(ymin - I * log(10)) - H < 0. + \advance\MINH by-\MIN + \multiply\MINH by2 + \advance\MINH by-\H + % + \ifdim\MINH<0pt + \expandafter\advance\expandafter\MIN\logten pt + \fi + \fi + \fi + \MINH=\MIN + \advance\MINH by\H + % Ok, now it can happen that only ONE tick label is placed in + % this range. + % That's useless, so check for it. + % + % That's the case if + % MIN < ORIGMIN && MAX < MIN+2 H + % MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by + % construction, but I don't care about this case). + % So: check only the second condition. + \pgfplots@tmpa=\MINH + \advance\pgfplots@tmpa by\H + \ifdim\MAX<\pgfplots@tmpa + \aftergroup\pgfplots@isuniformtickfalse + % ok, do something special. + % + % The idea is now to place ticks at + % 10^{i*h} with properly choosen 'h'. + % + % So: apply basically the SAME code as above for linear + % axis, just everything log 10! And keep in mind that all + % coordinates are actually given as natural logarithms. + \expandafter\MIN\csname pgfplots@#1min\endcsname pt + \H=\MAX + \advance\H by-\MIN + \H=\reciproclogten\H +%\message{Axis limit #1: [\the\MIN:\the\MAX], diff/log(10) = \the\H.}% + \c@pgf@counta=\desirednumticks\relax + \advance\c@pgf@counta by-1 + \ifnum\c@pgf@counta>2 + % subtract one more. This algorithm here produces more + % ticks than the normal one which is designed for 10^i + \advance\c@pgf@counta by-1 + \fi + \divide\H by\c@pgf@counta\relax +%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% + % + % SEARCH for the NEXT FEASABLE H. + \edef\Hmacro{\pgf@sys@tonumber\H}% + \pgfmathfloatparsenumber{\Hmacro}% + \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E + % Determine properly snapped mantisse... + \ifdim\H<2pt + \ifdim\H<1.5pt + \H=1.0pt + \else + \H=2.0pt + \fi + \else + \ifdim\H<4.9999pt + \ifdim\H<3.5pt + \H=2.0pt\relax + \else + \H=5.0pt\relax + \fi + \else + \ifdim\H<7.5pt + \H=5.0pt\relax + \else + \H=1.0pt\relax + \advance\pgfmathfloat@a@E by1 + \fi + \fi + \fi + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\Hmacro=\pgfmathresult + \H=\Hmacro pt % + % Ok, our step size h for 10^{i*h} is ready! +%\message{determined step size 10^{\Hmacro}}% + % Now, we want to activate the Tick set {10^{i*H}, i in \Z} + % compute I such that + % 10^{min} = 10^{I * H + rest}; |rest| < H + % -> I = round(xmin/H) + % -> MIN = I * H + % BUT EVERYTHING to log(10) basis! + \MIN=\reciproclogten\MIN\relax + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber\MIN}% + {\Hmacro}% + }% + \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% + \ifdim\MIN<0pt + % the truncation rounds TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \MIN=\H\relax + \multiply\MIN by\c@pgf@counta\relax + % + % convert back to basis 'e': + \MIN=\logten\MIN\relax + \H=\logten\H\relax + \MINH=\MIN\relax + \advance\MINH by\H\relax + \fi +%\pgfplots@message{final H=\the\H.}% + \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\H}}% + \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformtickfalse + \else + \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname + \gdef\pgfplots@glob@TMPb{}% will be computed later, in 'check uniform tick' + \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \fi + \endgroup + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa + \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@glob@TMPb +%\pgfplots@message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% +} + +% Helper method for +% \pgfplots@apply@data@scale@trafo@to@options@for +% #1: the ticks +% #2: the trafo macro name +% #3: the output macro name +\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% + \let#3=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + \pgfmathfloatparsenumber{\pgfplots@loc@TMPb}% + \expandafter#2\expandafter{\pgfmathresult}% + \ifx#3\pgfutil@empty + \xdef#3{\pgfmathresult}% + \else + \xdef#3{#3,\pgfmathresult}% + \fi + }% + % +}% + +% Helper method for +% \pgfplots@apply@data@scale@trafo@to@options@for +% #1: the ticks ALREADY IN FLOAT FORMAT +% #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 + \foreach \pgfplots@loc@TMPb in {#1} {% + #2{\pgfplots@loc@TMPb}% + \ifx#3\pgfutil@empty + \xdef#3{\pgfmathresult}% + \else + \xdef#3{#3,\pgfmathresult}% + \fi + }% + % +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex new file mode 100644 index 00000000000..077ca23c946 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex @@ -0,0 +1,326 @@ +%-------------------------------------------- +% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/util/pgfplotscolormap.code.tex,v 1.8 2008/11/30 22:59:31 ludewich Exp $ +% +% Package pgfplots +% +% 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. +% +% This program is free software: you can redistribute it and/or modify +% 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/>. +% +%-------------------------------------------- + +% This package relies on pgfplots temporary registers and its array +% data structure. + + +% Creates a new colormap. +% +% #1 : the name of the color map as string (not as macro). +% #2 : a <color specification> as is expected for a colormap. +% +% Example: \pgfplots@createcolormap{my map}{rgb(0cm)=(1,0,0); rgb(1cm)=(0,1,0); rgb(2cm)=(0,0,1); gray(3cm)=(3); color(4cm)=(green); } +\def\pgfplotscreatecolormap#{% + \pgfplots@createcolormap +} +\def\pgfplots@createcolormap#1#2{% + \edef\pgfplots@createcolormap@name{pgfpl@cm@#1}% + \expandafter\pgfplotsarraynewempty\expandafter{\pgfplots@createcolormap@name}% + \def\pgfplots@createcolormap@MIN{0}% NORMALIZATION: assume that lower-end is 0pt. + \let\pgfplots@createcolormap@H=\pgfutil@empty + \def\pgfplots@createcolormap@MAX{0}% To be computed. + \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MIN + % PARSE IT: + \pgfplots@createcolormap@#2] + \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% + % sanity checking: + \expandafter\pgfplotsarraysizetomacro\expandafter{\pgfplots@createcolormap@name}\to\pgfplots@loc@TMPa + \ifcase\pgfplots@loc@TMPa\relax + \pgfplots@error{Sorry, you need to provide at least the two end points of a colormap.}% + \or + \pgfplots@error{Sorry, you need to provide at least the two end points of a colormap.}% + \fi + % Map the input range [0pt,MAX] linearly to [0,1000] + \pgfmathdivide@{\pgfplotscolormaprange}{\pgfplots@createcolormap@MAX}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfmathmultiply@{\pgfplots@loc@TMPb}{\pgfplots@createcolormap@H}% + \let\pgfplots@createcolormap@H=\pgfmathresult + \expandafter\let\csname\pgfplots@createcolormap@name @h\endcsname=\pgfplots@createcolormap@H + \pgfmathreciprocal@{\pgfplots@createcolormap@H}% + \expandafter\let\csname\pgfplots@createcolormap@name @invh\endcsname=\pgfmathresult +%\pgfplots@colormap@showdebuginfofor{#1}% +} +\def\pgfplots@createcolormap@{% + \pgfutil@ifnextchar]{\pgfutil@gobble}%done! + {% + \pgfutil@ifnextchar;{\pgfplots@createcolormap@grabsemicolon}% + {% + \pgfutil@ifnextchar r{\pgfplots@createcolormap@grabrgb}% + {% + \pgfutil@ifnextchar g{\pgfplots@createcolormap@grabgray}% + {% + \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabcolor}% + { + \expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}% + {\pgfplots@error{Illformed colormap specification}}% + }% + }% + }% + }% + }% +} +\def\pgfplots@createcolormap@grabsemicolon;{\pgfplots@createcolormap@}% + +{ + \catcode`\;=\active + \gdef\pgfplots@createcolormap@grabsemicolon@active;{\pgfplots@createcolormap@}% +} + +\def\pgfplots@createcolormap@grabrgb rgb(#1)=(#2,#3,#4){% + \pgfplots@createcolormap@nextRGB{#1}{#2}{#3}{#4}% + \pgfplots@createcolormap@} +\def\pgfplots@createcolormap@grabgray gray(#1)=(#2){% + \pgfplots@createcolormap@nextRGB{#1}{#2}{#2}{#2}% + \pgfplots@createcolormap@} +\def\pgfplots@createcolormap@grabcolor color(#1)=(#2){% + \pgfutil@colorlet{pgf@tempcol}{#2}% + \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% + \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \expandafter\pgfplots@createcolormap@grabcolor@\pgf@rgbcolor\relax{#1}}% +\def\pgfplots@createcolormap@grabcolor@#1,#2,#3\relax#4{% + \pgfplots@createcolormap@nextRGB{#4}{#1}{#2}{#3}% + \pgfplots@createcolormap@} +\def\pgfplots@createcolormap@rgbrangeexception#1#2#3{% + \pgfplots@error{Sorry, RGB[#1,#2,#3] is not supported. The allowed range is 0 <= r,g,b <= 1.}% +}% +% Ok, we parsed the next single spec. +% #1: the width +% #2,#3,#4 RGB values. +\def\pgfplots@createcolormap@nextRGB#1#2#3#4{% + \ifdim#2pt<0pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#3pt<0pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#4pt<0pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#2pt>1pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#3pt>1pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#4pt>1pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + % Process 'h': + \pgfmathparse{#1}% + \let\pgfplots@createcolormap@MAX=\pgfmathresult + \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@createcolormap@LAST}% + \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MAX + \let\pgfplots@createcolormap@H@cur=\pgfmathresult +%\message{found current diff = \pgfplots@createcolormap@H@cur\ ( from #1 - \pgfplots@createcolormap@LAST pt)}% + \ifx\pgfplots@createcolormap@H\pgfutil@empty + \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% + \ifpgfplotsarrayempty + \ifdim\pgfplots@createcolormap@MAX pt=0pt + \else + \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt.}% + \def\pgfplots@createcolormap@MAX{0}% + \fi + \else + \let\pgfplots@createcolormap@H=\pgfplots@createcolormap@H@cur +%\message{H := \pgfplots@createcolormap@H( from #1).}% + \fi + \else + \pgfmathapproxequalto@{\pgfplots@createcolormap@H}{\pgfplots@createcolormap@H@cur}% + \ifpgfmathcomparison + \else + \pgfplots@error{Sorry, non-uniform colormaps are not yet implemented. Please maintain a uniform distance before offset #1 (in this case, I expected h = \pgfplots@createcolormap@H pt).}% + \fi + \fi + % + % Append values: + \def\pgfplots@loc@TMPa{\pgfplotsarraypushback{#2,#3,#4}\to}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}% +}% + +% Shows debug info about colormap #1 into the console. +\def\pgfplots@colormap@showdebuginfofor#1{% + \message{Debug info for color map '#1':}% + \message{(Transformed) Range: [0:\pgfplotscolormaprange]; }% + \message{H: \csname pgfpl@cm@#1@h\endcsname; }% + \message{H:^{-1}: \csname pgfpl@cm@#1@invh\endcsname; }% + \pgfplotsarraysizetomacro{pgfpl@cm@#1}\to\pgfplots@loc@TMPa + \message{Size: \pgfplots@loc@TMPa; }% + \message{RGB Values: }% + \begingroup + \c@pgf@counta=0 + \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{% + \message{\#\the\c@pgf@counta: \elem; }% + \advance\c@pgf@counta by1 + }% + \endgroup +} + +% Convert a colormap into a PGF shading's color specification for use +% in \pgfdeclare*shading. +% +% #1: the colormap's name. +% #2: the PGF "size" of the shading. It is used to set the right end +% of the color specification. +% #3: a macro which will be filled with the result. +% +% Example: +% \pgfplotscolormaptoshadingspec{my colormap}{4cm}{\output} +% \def\tempb{\pgfdeclarehorizontalshading{myshadingA}{1cm}} +% \expandafter\tempb\expandafter{\temp} +% +% \pgfuseshading{myshadingA} +\def\pgfplotscolormaptoshadingspec#1#2#3{% + \begingroup + \pgfmathparse{#2}% + \expandafter\pgfmathdivide@\expandafter{\pgfmathresult}{\pgfplotscolormaprange}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfmathmultiply@{\csname pgfpl@cm@#1@h\endcsname}{\pgfplots@loc@TMPb}% + \pgf@ya=\pgfmathresult pt + \c@pgf@counta=0 + \let#3=\pgfutil@empty + \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\pgfplots@loc@TMPa{% + \ifnum\c@pgf@counta=0 + \edef\pgfplots@loc@TMPc{rgb(0pt)=(\pgfplots@loc@TMPa)}% + \else + \pgf@yb=\c@pgf@counta\pgf@ya + \edef\pgfplots@loc@TMPc{rgb(\the\pgf@yb)=(\pgfplots@loc@TMPa)}% + \fi + \ifx#3\pgfutil@empty + \t@pgfplots@toka={}% + \else + \t@pgfplots@toka=\expandafter{#3; }% + \fi + \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPc}% + \edef#3{\the\t@pgfplots@toka \the\t@pgfplots@tokb }% + \advance\c@pgf@counta by1 + }% + \pgfmath@smuggleone#3% + \endgroup +}% + + +% Expands to the transformed range's right end of every colormap. The left +% end is fixed to '0'. +\def\pgfplotscolormaprange{1000} + +% Linearly maps the number #4 into the colormap #5 and returns the interpolated RGB triple +% into \pgfmathresult. +% +% [#1:#2] the number range of the data source. This is required to +% map into the colormap. +% [#3] (optional) the quantity +% s := \pgfplotscolormaprange / (#2-#1). +% Precomputing this quantity may save a lot of time because +% divisions are expensive in TeX. You can omit [#3] or +% provide an empty string here. +% #4 the number to map. +% #5 the colormap's name. Must be defined with +% \pgfplotscreatecolormap before. +% +% Example: +% \pgfplotscolormapfind[-1:1]{0.2}{my colormap} +\def\pgfplotscolormapfind[#1:#2]{% + \pgfutil@ifnextchar[{% + \pgfplotscolormapfind@precomputed[#1:#2]% + }{% + \pgfplotscolormapfind@precomputed[#1:#2][]% + }% +}% +\def\pgfplotscolormapfind@precomputed[#1:#2][#3]#4#5{% + \begingroup + % Step 0: compute #3 if it is missing and write it into + % \pgfplots@loc@TMPa. + \def\pgfplots@loc@TMPa{#3}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfmathsubtract@{#2}{#1}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfmathdivide@{\pgfplotscolormaprange}{\pgfplots@loc@TMPb}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \fi +%\message{mapping '#4' into colormap '#5' ... }% + % Step 1: perform lookup. Map #4 into the colormap's range + % using the linear trafo + % phi(#4) = ( #4 - #1 ) / (#2-#1) * colormaprange(#5). + % This, determine the INTERVAL number into which #4 falls. + \pgfmathsubtract@{#4}{#1}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplots@loc@TMPa}% + \let\pgfplotscolormapfind@transformedx=\pgfmathresult + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\csname pgfpl@cm@#5@invh\endcsname}% + \let\pgfplotscolormapfind@transformedx@divh=\pgfmathresult + \expandafter\pgfmathfloor@\expandafter{\pgfmathresult}% + % assign \pgfplotscolormapfind@intervalno := \pgfmathresult + % without '.0' suffix: + \def\pgfplots@discardperiod##1.##2\relax{\def\pgfplotscolormapfind@intervalno{##1}}% + \expandafter\pgfplots@discardperiod\pgfmathresult\relax +%\message{mapping [#1,#2] -> [0,\pgfplotscolormaprange] yielded phi(#4) = \pgfplotscolormapfind@transformedx, situated in interval no \pgfplotscolormapfind@intervalno.}% + % Step 2: interpolate the desired RGB value using vector valued + % interpolation on the identified interval. + \c@pgf@counta=\pgfplotscolormapfind@intervalno\relax + \pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#5}\to\pgfplotscolormapfind@rgb@LEFT + \advance\c@pgf@counta by1 + \pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#5}\to\pgfplotscolormapfind@rgb@RIGHT +%\message{After lookup: the corresponding RGB interval boundaries are [\pgfplotscolormapfind@rgb@LEFT: \pgfplotscolormapfind@rgb@RIGHT].}% + \edef\pgfplots@loc@TMPa{\pgfplotscolormapfind@rgb@LEFT:\pgfplotscolormapfind@rgb@RIGHT}% + \expandafter\pgfplotscolormapfind@interpolate\pgfplots@loc@TMPa\relax + \pgfmath@smuggleone\pgfmathresult + \endgroup +%\message{-> got finally mapping(#4, #5) = RGB'\pgfmathresult'.}% +}% + +% internal helper method which computes +% +% color^m(x) = ( x/h - i ) * ( c_{i+1}^m - c_{i}^m ) + c_i^m +% for each m in {red,green,blue} and defines \pgfmathresult to be +% 'R,G,B' , the single results. +\def\pgfplotscolormapfind@interpolate#1,#2,#3:#4,#5,#6\relax{% + % R: + \pgfmathsubtract@{#4}{#1}% + \let\pgfplotscolormapfind@Cdiff=\pgfmathresult + \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}% + \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#1}% + \let\RED=\pgfmathresult + % G: + \pgfmathsubtract@{#5}{#2}% + \let\pgfplotscolormapfind@Cdiff=\pgfmathresult + \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}% + \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#2}% + \let\GREEN=\pgfmathresult + % B: + \pgfmathsubtract@{#6}{#3}% + \let\pgfplotscolormapfind@Cdiff=\pgfmathresult + \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}% + \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#3}% + \let\BLUE=\pgfmathresult + \edef\pgfmathresult{\RED,\GREEN,\BLUE}% +}% + + +\pgfplotscreatecolormap{hot}{color(0cm)=(blue); color(1cm)=(yellow); color(2cm)=(orange); color(3cm)=(red)} diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex index e3094554af6..781f5e4937d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex @@ -24,29 +24,11 @@ % %-------------------------------------------- -\def\pgfplots@EOI{\pgfplots@EOI}% - -\newtoks\t@pgfplots@toka -\newtoks\t@pgfplots@tokb -\newtoks\t@pgfplots@tokc -\newdimen\pgfplots@tmpa - -% use these macros for GLOBAL temporary assignments. -% you can NEVER rely on their values unless you know exactly what you are doing. -\gdef\pgfplots@glob@TMPa{}% -\gdef\pgfplots@glob@TMPb{}% -\gdef\pgfplots@glob@TMPc{}% - -% use these macros for LOCAL temporary assigments. -% you can NEVER rely on their values unless you know exactly what you are doing. -\def\pgfplots@loc@TMPa{}% -\def\pgfplots@loc@TMPb{}% -\def\pgfplots@loc@TMPc{}% - -\input pgfplotsliststructure.code.tex -\input pgfplotsliststructureext.code.tex -\input pgfplotsarray.code.tex -\input pgfplotstable.code.tex +\newif\ifpgfplots@usefpu +\pgfkeys{% + /pgfplots/use fpu/.is if=pgfplots@usefpu, + /pgfplots/use fpu=true, +} % Produces an \aftergroup statement for each single token in #1. % @@ -105,10 +87,18 @@ \fi }% -\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% -\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}% -\def\pgfplots@message#1{% - \immediate\write16{#1}% +% Issues an error message if the **LaTeX** package '#1' is not loaded +% (An error is also raised if the document is not a LaTeX document). +% #1: the required LaTeX package +% #2: the feature which requires this package +\def\pgfplots@assert@LaTeX@package@loaded#1#2{% + \pgfutil@ifundefined{@ifpackageloaded}{% + \pgfplots@error{Sorry, #2 only works with LaTeX (it relies on the LaTeX package #1)}% + }{% + \pgfutil@ifundefined{ver@#1.sty}% this here has been extracted from ltclass.dtx. \@ifpackageloaded is only usable in preamble. + {\pgfplots@error{Sorry, use need \string\usepackage{#1} in your preamble for '#2'}}% + {\relax}% + }% }% \def\pgfplots@assert@tikzinternal@exists#1{% \pgfutil@ifundefined{#1}{% @@ -192,6 +182,11 @@ \def#2{#1}% }% +{ +\catcode`\%=12 +\gdef\pgfplots@PERCENT@TEXT{%} +} + % Usage: % \pgfplots@if{pgfplots@scaled@ticks}{true-code}{false-code} % @@ -204,3 +199,446 @@ #3% \fi }% + +\def\pgfplotsmathmin#1#2{% + \ifdim#1 pt<#2 pt + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +}% +\def\pgfplotsmathmax#1#2{% + \ifdim#1 pt>#2 pt + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +}% +\def\pgfplotsmathlessthan#1#2{\ifdim#1 pt<#2 pt \pgfmathfloatcomparisontrue\else\pgfmathfloatcomparisonfalse\fi} + +% Re-define two-argument function for min and max. +% The pgfmath engine now uses a variable number of arguments. +\def\pgfplotsmathfloatmax#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#2}% + \else + \edef\pgfmathresult{#1}% + \fi +} +\def\pgfplotsmathfloatmin#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +} + +% Defines \pgfmathresult to be #1 * 10^{#2}. +% +% #1 a macro without unit suffix. +% #2 an integer number (may be a register) +\def\pgfplotsmathmultiplypowten@#1#2{% + \begingroup + \pgf@xa=#1pt + \ifnum#2<0 + \ifcase-#2 + \or\divide\pgf@xa by10 + \or\divide\pgf@xa by100 + \or\divide\pgf@xa by1000 + \or\divide\pgf@xa by10000 + \or\divide\pgf@xa by100000 + \fi + \else + \ifcase#2 + \or\multiply\pgf@xa by10 + \or\multiply\pgf@xa by100 + \or\multiply\pgf@xa by1000 + \or\multiply\pgf@xa by10000 + \or\multiply\pgf@xa by100000 + \fi + \fi + \edef\pgfmathresult{\pgf@sys@tonumber{\pgf@xa}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +% converts a comma-separated list (PGF foreach) to my internal list +% structure. +\long\def\pgfplots@foreach@to@list#1\to#2{% + \global\pgfplotslistnewempty\pgfplots@glob@TMPa + \begingroup + \foreach \pgfplots@i in {#1} {% + \expandafter\pgfplotslistpushbackglobal\pgfplots@i\to\pgfplots@glob@TMPa + }% + \endgroup + \pgfplotslistcopy\pgfplots@glob@TMPa\to#2\relax +} + +% Simply invokes the code of PGF key #1 with value #2, that means +% #1#2\pgfeov +\def\pgfplots@invoke@pgfkeyscode#1#2{% + \pgfkeysgetvalue{#1}\pgfplots@invoke@pgfkeyscode@CODE + \pgfplots@invoke@pgfkeyscode@CODE#2\pgfeov +} + + +% Usage: +% \pgfplots@letcsname pgfplots@xtick={pgfplots@kram@x} +% -> invokes \csname ... \endcsname for both args. +\def\pgfplots@letcsname#1=#2{% + \expandafter\let\expandafter\pgfplots@loc@TMPc\csname #2\endcsname + \expandafter\let\csname #1\endcsname=\pgfplots@loc@TMPc +}% + +% I have introduced this macro to allow optimizations of (x,y) +% coordinate processing. Use it for everything which is directly plot +% related. +% +% @see \pgfplotsqpointxy@orthogonal +\let\pgfplotsqpointxy=\pgfqpointxy +\let\pgfplotsqpointxyz=\pgfqpointxyz + +% A "quick" quick variant of \pgfqpointxy which assumes that +% the X unit vector is ( e_xx,0 )^T and the Y unit vector is ( 0, +% e_yy)^T. +% +% In words, the unit vectors are orthogonal. This is the usual case +% for two-dimensional plots and shall be optimized. +\def\pgfplotsqpointxy@orthogonal#1#2{% + \pgf@x=#1\pgf@xx% + \pgf@y=#2\pgf@yy} + + +% Takes a domain as input and generates a foreach argument which +% samples from the domain. +% Writes the result to \pgfplotslocretval +% INPUT: +% #1:#2 the domain +% /pgfplots/samples the number of samples +% OUTPUT: +% \pgfplotslocretval a foreach specification. +\def\pgfplots@domain@to@foreach#1:#2\relax{% + \pgfmathparse{#1}% + \let\pgfplots@loc@TMPa=\pgfmathresult% + \pgfmathparse{#2}% + \let\pgfplots@loc@TMPb=\pgfmathresult% + \pgfmathparse{\pgfplots@loc@TMPa+(\pgfplots@loc@TMPb-\pgfplots@loc@TMPa)/(\pgfkeysvalueof{/pgfplots/samples}-1)}% + \edef\pgfplotslocretval{\pgfplots@loc@TMPa,\pgfmathresult,...,\pgfplots@loc@TMPb}% +} + +{ + \catcode`\;=\active + \catcode`\:=\active + \gdef\pgfplots@activesemicolon{;}% + \gdef\pgfplots@activecolon{:}% +} + +% checks whether ';' is active and replaces a sequence of commands +% accordingly. +% +% @see \pgfplots@appendto@activesemicolon@switcher +\def\pgfplots@checkandpreparefor@active@semicolon{% + \ifnum\the\catcode`\;=\active\relax + \pgfplots@checkandpreparefor@active@semicolon@ + \fi +}% +\def\pgfplots@checkandpreparefor@active@semicolon@{}% + +% Adds all commands '#1' to the sequence of commands which will be +% issued in case ';' is active. +\def\pgfplots@appendto@activesemicolon@switcher#1{% + \expandafter\def\expandafter\pgfplots@checkandpreparefor@active@semicolon@\expandafter{% + \pgfplots@checkandpreparefor@active@semicolon@ + #1% + }% +}% + + +% Usage: +% \pgfplotsforeachentryinCSV{\value}{1,2,3,4.5,6.7,10}{The value is \value\par} +% +% The loop is ungrouped. +\long\def\pgfplotsforeachentryinCSV#1#2#3{% + \def\pgfplotsforeachentryinCSV@{#1}% + \long\def\pgfplotsforeachentryinCSV@@{#3}% + \pgfplotsforeachentryinCSV@loop#2,\pgfplots@EOI +}% +% A variant of \pgfplotsforeachentryinCSV where a trailing comma +% indicates the end of input. +% Example: +% +% \pgfplotsforeachentryinCSV{\value}{1,2,3,4.5,6.7,10,}{The value is \value\par} +% ^ +% +% It is permissable to provide an empty list (without trailing comma) +\long\def\pgfplotsforeachentryinCSVisterminated#1#2#3{% + \def\pgfplotsforeachentryinCSV@{#1}% + \long\def\pgfplotsforeachentryinCSV@@{#3}% + \pgfplotsforeachentryinCSV@loop#2\pgfplots@EOI +}% +\def\pgfplotsforeachentryinCSV@loop{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfutil@gobble + }{% + \pgfplotsforeachentryinCSV@next + }% +}% +\def\pgfplotsforeachentryinCSV@next#1,{% + \expandafter\def\pgfplotsforeachentryinCSV@{#1}% + \pgfplotsforeachentryinCSV@@ + \pgfplotsforeachentryinCSV@loop +}% + + +% A (simple) replacement for \foreach which +% 1. does NOT scope the argument +% 2. allows to use PGF Math routines for loops ( '...' notation) +% instead of TeX registers. +% +% Usage: +% \pgfplotsforeachungrouped \x in {1,2,3,4,5} {<code>} +% +% Some details: +% - If #2 is a UNIFORM SAMPLING RANGE, the algorithm is supposed to be +% most effective. +% - If \pgfmathadd@ is the standard PGF math version of \pgfmathadd@, +% we use fast TeX dimensions for any loops. Otherwise, \pgfmathadd@ +% is used (assuming it has been replaced and should be used. +% +\def\pgfplotsforeachungrouped#1{\pgfplotsforeachungrouped@{#1}}% +\long\def\pgfplotsforeachungrouped@#1in #2#3{% + \pgfplotsforeachungrouped@isuniform{#2}% + \ifpgfplots@loc@tmp + \pgfplotsforeachungroupeduniform@#1{#2}{#3}% + \else + \pgfplotsforeachungroupednonuniform@#1{#2}{#3}% + \fi +} +\let\pgfplots@original@pgfmathadd@=\pgfmathadd@ + +\long\def\pgfplotsforeachungroupeduniform@#1#2#3{% + \pgfplotsforeachungroupeduniform@@{#1}#2\relax{#3}% +} +\long\def\pgfplotsforeachungroupeduniform@@#1#2,#3,...,#4\relax#5{% + % Compute mesh width! + \pgfmathparse{#2}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfmathparse{#3}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult + \pgfmathsubtract@{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}% + \ifx\pgfmathadd@\pgfplots@original@pgfmathadd@ + % perform manual restoration of local variables: + \edef\pgfplots@foreach@loc@TMPd{% + \noexpand\pgf@xa=\the\pgf@xa\noexpand\relax + \noexpand\pgf@xb=\the\pgf@xb\noexpand\relax + \noexpand\pgf@ya=\the\pgf@ya\noexpand\relax + }% + % mesh width: + \pgf@ya=\pgfmathresult pt + % the loop will run while ( NOT <cur> \pgfplots@foreach@loc@cmp <last> ) + \ifdim\pgf@ya<0pt + \def\pgfplots@foreach@loc@cmp{<}% + \else + \def\pgfplots@foreach@loc@cmp{>}% + \fi + % + \pgfmathparse{#4}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult + \pgf@xa=\pgfplots@foreach@loc@TMPa pt + \pgf@xb=\pgfplots@foreach@loc@TMPb pt + \long\def\pgfplots@foreach@loc@TMPc{#5}% + % + \pgfutil@loop + \ifdim\pgf@xa \pgfplots@foreach@loc@cmp \pgf@xb\relax + \pgfplots@loc@tmpfalse + \else + \pgfplots@loc@tmptrue + \fi + \ifpgfplots@loc@tmp + \edef#1{\pgf@sys@tonumber{\pgf@xa}}% + \pgfplots@foreach@loc@TMPc\relax + \advance\pgf@xa by\pgf@ya\relax + \pgfutil@repeat + % ok, restore them: + \pgfplots@foreach@loc@TMPd + \else + % Use \pgfmath engine for the loop: + \edef\pgfplots@foreach@loc@TMPd{% + \noexpand\pgf@xa=\the\pgf@xa\noexpand\relax + }% + % mesh width: + \let\pgfplots@foreach@loc@meshwidth=\pgfmathresult + \pgfmathparse{0}% invoke the parser - in case the fpu is active. + \pgfmathlessthan@{\pgfplots@foreach@loc@meshwidth}{\pgfmathresult}% + \pgf@xa=\pgfmathresult pt + % the loop will run while ( NOT \pgfplots@foreach@loc@cmp{<cur>}{<last>} ) + \ifdim\pgf@xa=1pt + \let\pgfplots@foreach@loc@cmp=\pgfmathlessthan@ + \else + \let\pgfplots@foreach@loc@cmp=\pgfmathgreaterthan@ + \fi + % + \pgfmathparse{#4}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult + \long\def\pgfplots@foreach@loc@TMPc{#5}% + % + \pgfutil@loop + \pgfplots@foreach@loc@cmp{\pgfplots@foreach@loc@TMPa}{\pgfplots@foreach@loc@TMPb}% + \pgf@xa=\pgfmathresult pt + \ifdim\pgf@xa=0pt + \let#1=\pgfplots@foreach@loc@TMPa% + \pgfplots@foreach@loc@TMPc\relax + \pgfmathadd@{\pgfplots@foreach@loc@TMPa}{\pgfplots@foreach@loc@meshwidth}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfutil@repeat + % ok, restore them: + \pgfplots@foreach@loc@TMPd + \fi +}% +\long\def\pgfplotsforeachungroupednonuniform@#1#2#3{% + \pgfplotsapplistXXglobalnewempty + \foreach\pgfplots@foreach@loc@TMPa in {#2} {% + \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@foreach@loc@TMPa,}% + }% + \pgfplotsapplistXXgloballet\pgfplots@foreach@loc@TMPa + \pgfplotsapplistXXglobalclear + \expandafter\pgfplotsforeachentryinCSVisterminated\expandafter\pgfplots@foreach@loc@TMPa\expandafter{\pgfplots@foreach@loc@TMPa}{% + \let#1=\pgfplots@foreach@loc@TMPa + #3% + }% +} + +% Sets \ifpgfplots@loc@tmp to something true if and only if '#1' is of the form +% #1 = <number1>,<number2>,...,<number3>. +\def\pgfplotsforeachungrouped@isuniform#1{% + \edef\pgfplots@foreach@loc@TMPa{#1}% + \expandafter\pgfplotsforeachungrouped@isuniform@\pgfplots@foreach@loc@TMPa,,,,\relax +}% +\def\pgfplotsforeachungrouped@isuniform@#1,#2,#3,#4,#5\relax{% + \def\pgfplots@foreach@loc@TMPa{#5}% + \def\pgfplots@foreach@loc@TMPb{,,,}% + \pgfplots@loc@tmpfalse + \ifx\pgfplots@foreach@loc@TMPa\pgfplots@foreach@loc@TMPb + \def\pgfplots@foreach@loc@TMPa{#3}% + \def\pgfplots@foreach@loc@TMPb{...}% + \ifx\pgfplots@foreach@loc@TMPa\pgfplots@foreach@loc@TMPb + \pgfutil@in@,{#4}% + \ifpgfutil@in@ + \else + % ok, we REALLY have a uniform range! + \pgfplots@loc@tmptrue + \fi + \fi + \fi +}% + +% Allows to provide an output routine for +% \pgfplotsforeachlogarithmicungrouped which changes the number format +% of \pgfmathresult. +% +% Example: +% \pgfplotsforeachlogarithmicformatresultwith{\pgfmathfloattofixed{\pgfmathresult}} +% +% #1: is code which modifies \pgfmathresult. +\def\pgfplotsforeachlogarithmicformatresultwith#1{% + \def\pgfplotsforeachlogarithmicungrouped@finalizeresult{#1}% +} + +% \pgfplotsforeachlogarithmicungrouped \x/\logx in {a:b} {#3} +% +% samples \x between a and b using a logarithmic scale. +% +% During '#3', \x will contain the sample and \logx the logarithm of +% \x. +% +% Both, #1 and #2 will be provided as floating point numbers unless +% configured otherwise with \pgfplotsforeachlogarithmicsetoutput, +% see above. +% +\def\pgfplotsforeachlogarithmicungrouped#1/#2{\pgfplotsforeachlogarithmicungrouped@{#1}{#2}}% +\long\def\pgfplotsforeachlogarithmicungrouped@#1#2in #3#4{% + % define + % \pgfplots@foreach@loc@TMPd = N in fixed point + % \pgfplots@foreach@loc@TMPc = N-1 in float : + \pgfkeysgetvalue{/pgfplots/samples}{\pgfplots@plot@samples} + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@plot@samples}% + \expandafter\pgfmathfloatsubtract@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}% + \let\pgfplots@foreach@loc@TMPc=\pgfmathresult + % + \edef\pgfplots@loc@TMPb{#3}% + \expandafter\pgfplotsforeachlogarithmicungrouped@readdomain\pgfplots@loc@TMPb\relax + % compute mesh width into \pgfplots@foreach@loc@TMPc: + % \pgfplots@foreach@loc@TMPc := h := ( log(xmax) - log(xmin) ) / (N-1) + \pgfmathfloatsubtract@{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}% + \pgfmathfloatdivide@{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}% + \let\pgfplots@foreach@loc@TMPc=\pgfmathresult + % + % apply local scoping here: + \edef\pgfplots@foreach@loc@TMPd{% + \noexpand\c@pgf@counta=\the\c@pgf@counta\noexpand\relax + }% + \long\def\pgfplots@foreach@loc@TMPf{#4}% + \c@pgf@counta=0 + \pgfutil@loop + \ifnum\c@pgf@counta<\pgfplots@plot@samples + % compute exp(log(min) + i * h) + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgf@counta}% + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}% + \expandafter\pgfmathfloatadd@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfplotsforeachlogarithmicungrouped@finalizeresult% + \let#2=\pgfmathresult + \pgfmathfloatexp@{\pgfplots@loc@TMPa}% + \pgfplotsforeachlogarithmicungrouped@finalizeresult% + \let#1=\pgfmathresult + % + % ok, invoke it! + % -> store \c@pgf@counta before doing so. We need to scope + % manually here. + \edef\pgfplots@foreach@loc@TMPe{\the\c@pgf@counta}% + \pgfplots@foreach@loc@TMPf\relax + \c@pgf@counta=\pgfplots@foreach@loc@TMPe\relax + \advance\c@pgf@counta by 1 + \pgfutil@repeat + % restore scoped variables: + \pgfplots@foreach@loc@TMPd +} +% can be used to convert the number format from float to something +% else. +\def\pgfplotsforeachlogarithmicungrouped@finalizeresult{}% + + +% defines +% \pgfplots@foreach@loc@TMPa := log(firstintervalpt) +% and +% \pgfplots@foreach@loc@TMPb := log(secondintervalpt) +\def\pgfplotsforeachlogarithmicungrouped@readdomain#1:#2\relax{% + \pgfmathfloatparsenumber{#1}% + \pgfmathfloatln@{\pgfmathresult}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \pgfmathfloatln@{\pgfmathresult}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult +} + +% invokes '#2' if #1 expands (\edef) to the empty string or '#3' if not. +\def\pgfplots@ifempty#1#2#3{% + \edef\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty #2\else #3\fi +}% + +\def\pgfplots@logfileopen#1{% + \immediate\write-1{PGFPlots: reading {#1}}% +}% + +\input pgfplotsliststructure.code.tex +\input pgfplotsliststructureext.code.tex +\input pgfplotsarray.code.tex +\input pgfplotstable.code.tex + +\endinput |