diff options
author | Karl Berry <karl@freefriends.org> | 2008-08-09 23:39:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-08-09 23:39:38 +0000 |
commit | f41811b55dfce3a5f59b953b68457b0aa5491baf (patch) | |
tree | c0346bf5128a5e21c5909eb116121b28de0fd24b /Master/texmf-dist/tex | |
parent | 607cf34a8ca9e08fbb89b52ee710467a72b5b99f (diff) |
pgfplots update (10aug08)
git-svn-id: svn://tug.org/texlive/trunk@10222 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
18 files changed, 5293 insertions, 1742 deletions
diff --git a/Master/texmf-dist/tex/context/pgfplots/t-pgfplots.tex b/Master/texmf-dist/tex/context/third/pgfplots/t-pgfplots.tex index 93324e1e5b0..1dbd5495cab 100644 --- a/Master/texmf-dist/tex/context/pgfplots/t-pgfplots.tex +++ b/Master/texmf-dist/tex/context/third/pgfplots/t-pgfplots.tex @@ -52,6 +52,9 @@ % \let\startloglogaxis=\pgfplots@environment@loglogaxis \let\stoploglogaxis=\endpgfplots@environment@loglogaxis + % + \def\startpgfplotsinterruptdatabb{\pgfplotsinterruptdatabb}% + \def\stoppgfplotsinterruptdatabb{\endpgfplotsinterruptdatabb}% }% \catcode`\@=\tikzatcode diff --git a/Master/texmf-dist/tex/context/third/pgfplots/t-pgfplotstable.tex b/Master/texmf-dist/tex/context/third/pgfplots/t-pgfplotstable.tex new file mode 100644 index 00000000000..0732df60c10 --- /dev/null +++ b/Master/texmf-dist/tex/context/third/pgfplots/t-pgfplotstable.tex @@ -0,0 +1,26 @@ +%-------------------------------------------- +% +% Package pgfplotstable +% +% 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/>. +% +%-------------------------------------------- + +\usemodule[pgfplots] + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarydateplot.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarydateplot.code.tex new file mode 100644 index 00000000000..161943d6c28 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarydateplot.code.tex @@ -0,0 +1,75 @@ +%-------------------------------------------- +% +% Package pgfplots, library for high-level coordinates. +% +% 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/>. +% +%-------------------------------------------- + +\pgfutil@usemodule{pgfcalendar} + +% Idea: allow +%-------------------------------------------------- +% \begin{tikzpicture} +% \begin{axis}[ +% date coordinates in=x, +% xticklabel={\day.\month.}, +% ] +% \addplot coordinates { +% (2008-01-5, 5) +% (2008-01-12, 10) +% (2008-01-16, 20) +% }; +% \end{axis} +% \end{tikzpicture} +%-------------------------------------------------- + +\def\pgfplots@truncate@to@julian#1.#2\pgfplots@EOI#3{#3=#1\relax}% + +\pgfplotsset{ + /pgfplots/date ZERO/.code={% + \begingroup + \pgfcalendardatetojulian{#1}\c@pgf@counta + \edef\pgfmathresult{\the\c@pgf@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplots@calender@ZEROSHIFT=\pgfmathresult + }, + date ZERO=2006-01-01, + /pgfplots/date coordinates in/.style={ + /pgfplots/#1 coord trafo/.code={% + \begingroup + \pgfcalendardatetojulian{##1}\c@pgf@counta + \advance\c@pgf@counta by-\pgfplots@calender@ZEROSHIFT\relax + \edef\pgfmathresult{\the\c@pgf@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }, + /pgfplots/#1 coord inv trafo/.code={% + \begingroup + \pgfplots@truncate@to@julian##1\pgfplots@EOI{\c@pgf@counta}% + \advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax + \expandafter + \endgroup + \expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day + \edef\pgfmathresult{\year-\month-\day}% + }, + /pgfplots/#1ticklabel={\tick},% + /pgfplots/scaled #1 ticks=false, + }, + /pgfplots/date coordinates in/.value required, +} + 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 16e4b539c02..77fc52b1115 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex @@ -56,7 +56,7 @@ \long\def\pgfplotsarraynew#1#2{% \pgfplotsarraynewempty{#1}% \long\def\pgfplotsarraynew@impl@rest{#2}% - \loop + \pgfutil@loop \ifx\pgfplotsarraynew@impl@rest\pgfutil@empty \pgfplots@loop@CONTINUEfalse \else @@ -64,7 +64,7 @@ \fi \ifpgfplots@loop@CONTINUE \expandafter\pgfplotsarraynew@impl\pgfplotsarraynew@impl@rest\toarray#1\relax - \repeat + \pgfutil@repeat } % helper macro for \pgfplotsarraynew @@ -96,11 +96,11 @@ \pgfplotsarray@@let{#2@size}={#1@size}% \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% \c@pgfplotsarray@tmp=0 - \loop + \pgfutil@loop \ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP \pgfplotsarray@@let{#2@\the\c@pgfplotsarray@tmp}={#1@\the\c@pgfplotsarray@tmp}% \advance\c@pgfplotsarray@tmp by1 - \repeat + \pgfutil@repeat } @@ -179,24 +179,24 @@ \long\def\pgfplotsarrayforeach#1\as#2#3{% \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% \c@pgfplotsarray@tmp=0\relax - \loop + \pgfutil@loop \ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP\relax \begingroup \expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname% #3% \endgroup \advance\c@pgfplotsarray@tmp by1 - \repeat + \pgfutil@repeat } % The same but without groups around #3. \long\def\pgfplotsarrayforeachungrouped#1\as#2#3{% \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% \c@pgfplotsarray@tmp=0\relax - \loop + \pgfutil@loop \ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP\relax \expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname% #3% \advance\c@pgfplotsarray@tmp by1 - \repeat + \pgfutil@repeat } 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 48fd19a890c..d7bd7dc73ed 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex @@ -4,12 +4,17 @@ % % Its implementation is based on Knuth's list macros in "The TeXbook". % +% It features a convenient set of list macros, but it is not fast. +% In fact, every elementary operation requires time O(N), so working +% with this list easily leads to O(N^2) runtime. +% % The following macros are supplied: % % \pgfplotslistnewempty % \pgfplotslistnew % \pgfplotslistcopy % \pgfplotslistpopfront +% \pgfplotslistfront % \pgfplotslistpushback % \pgfplotslistpushfront % \pgfplotslistsize @@ -17,6 +22,10 @@ % \pgfplotslistcheckempty % \pgfplotslistforeach % +% @see \pgfplotsapplist a "real" list with O(1) pushback, but limited application. +% @see \pgfplotsapplistX a preasymptotical fast list to accumulate elements. +% @see \pgfplotsapplistXX an optimized version of \pgfplotsapplistX. +% % Copyright 2007/2008 by Christian Feuersänger. % % This program is free software: you can redistribute it and/or modify @@ -36,8 +45,6 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newtoks\pgfplotslist@TOK@a -\newtoks\pgfplotslist@TOK@b \newif\ifpgfplotslistempty @@ -74,7 +81,7 @@ \else \expandafter\def\expandafter\pgfplotslistnew@impl@rest\expandafter{\pgfplotslistnew@impl@rest,}% \fi - \loop + \pgfutil@loop \ifx\pgfplotslistnew@impl@rest\pgfutil@empty \pgfplots@loop@CONTINUEfalse \else @@ -86,13 +93,13 @@ \else \expandafter\pgfplotslistnew@impl@comma\pgfplotslistnew@impl@rest\tolist#1\relax \fi - \repeat + \pgfutil@repeat } \def\pgfplotslist@EOI{\pgfplotslist@EOI} \def\pgfplotslist@check@backslash@list#1\\#2\pgfplotslist@EOI{% - \def\pgfplotslist@TMPB{#2}% - \ifx\pgfplotslist@TMPB\pgfutil@empty + \def\pgfplotslist@loc@TMPa{#2}% + \ifx\pgfplotslist@loc@TMPa\pgfutil@empty \pgfplotslist@is@backslash@terminatedfalse \else \pgfplotslist@is@backslash@terminatedtrue @@ -119,9 +126,15 @@ % Example: % \pgfplotslistpushfront Next first Element\to\foolist \long\def\pgfplotslistpushfront#1\to#2{% - \pgfplotslist@TOK@a={\pgfplotslist@sep{#1}}% - \pgfplotslist@TOK@b=\expandafter{#2}% - \edef#2{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka={\pgfpl@@{#1}}% + \t@pgfplots@tokb=\expandafter{#2}% + \edef#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% +} + +% Assembles a low-level list item representation into the token +% register #2. +\def\pgfplotslist@assembleentry#1\into#2{% + #2={\pgfpl@@{#1}}% } % #1: the item to append @@ -129,22 +142,32 @@ % Example: % \pgfplotslistpushback Next last element\to\foolist \long\def\pgfplotslistpushback#1\to#2{% - \pgfplotslist@TOK@a={\pgfplotslist@sep{#1}}% + \t@pgfplots@toka={\pgfpl@@{#1}}% \ifx#2\pgfutil@empty - \pgfplotslist@TOK@b={}% + \t@pgfplots@tokb={}% \else - \pgfplotslist@TOK@b=\expandafter{#2}% + \t@pgfplots@tokb=\expandafter{#2}% \fi - \edef#2{\the\pgfplotslist@TOK@b\the\pgfplotslist@TOK@a}% + \edef#2{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% +} +% Adds '#1' to the GLOBAL list '#2'. +\long\def\pgfplotslistpushbackglobal#1\to#2{% + \t@pgfplots@toka={\pgfpl@@{#1}}% + \ifx#2\pgfutil@empty + \t@pgfplots@tokb={}% + \else + \t@pgfplots@tokb=\expandafter{#2}% + \fi + \xdef#2{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% } % Concatenates two lists #2 and #3 into #1 % Example: % \pgfplotslistconcat\result=\foolist&\bar \long\def\pgfplotslistconcat#1=#2{% - \pgfplotslist@TOK@a=\expandafter{#2}% - \pgfplotslist@TOK@b=\expandafter{#3}% - \edef#1{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka=\expandafter{#2}% + \t@pgfplots@tokb=\expandafter{#3}% + \edef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% } % implements #2 := pop_front(#1) @@ -154,16 +177,29 @@ \pgfplotslistcheckempty#1\relax \ifpgfplotslistempty \pgfplots@error{ERROR: \string\pgfplotslistpopfront\ from \string#1\ although list is EMPTY}% + \let#2=\pgfutil@empty \else \expandafter\pgfplotslistpopfront@impl#1\pgfplotslistpopfront@macronames#1#2% \fi } +\long\def\pgfplotslistfront#1\to#2{% + \pgfplotslistcheckempty#1\relax + \ifpgfplotslistempty + \pgfplots@error{ERROR: \string\pgfplotslistfront\ from \string#1\ although list is EMPTY}% + \let#2=\pgfutil@empty + \else + \expandafter\pgfplotslistfront@impl#1\pgfplotslistpopfront@macronames#2% + \fi +} % implementation helper for listpopfront -\long\def\pgfplotslistpopfront@impl\pgfplotslist@sep#1#2\pgfplotslistpopfront@macronames#3#4{% +\long\def\pgfplotslistpopfront@impl\pgfpl@@#1#2\pgfplotslistpopfront@macronames#3#4{% \def#4{#1}% \def#3{#2}% } +\long\def\pgfplotslistfront@impl\pgfpl@@#1#2\pgfplotslistpopfront@macronames#3{% + \def#3{#1}% +} % Counts the number of elements in list #1, storing it into the count % register #2. @@ -172,7 +208,7 @@ % \the\count0 \long\def\pgfplotslistsize#1\to#2{% #2=0% - \long\def\pgfplotslist@sep##1{\advance#2 by 1 }% + \long\def\pgfpl@@##1{\advance#2 by 1 }% #1% } @@ -188,12 +224,15 @@ % \elem % Element \count1: % \pgfplotslistselect\count1\of\foo\to\elem -\long\def\pgfplotslistselect#1\of#2\to#3{% - \global\def\pgfplotslistselect@tmp{\def#3{\pgfplots@error{The requested item #1 of \string#2 is OUT OF RANGE.}}}% +\def\pgfplotslistselect#1\of#2\to#3{% + \global\def\pgfplotslistselect@tmp{\def#3{}\pgfplots@error{The requested list entry with index #1 of \string#2 is too large; this list has not enough elements.}}% + \pgfplotslistselect@{#1}\of{#2}\to{#3}% +} +\def\pgfplotslistselect@#1\of#2\to#3{% \begingroup \count0=#1\relax - \long\def\pgfplotslist@sep##1{% - \advance\count0-1\relax + \long\def\pgfpl@@##1{% + \advance\count0 by-1\relax \ifnum\count0=-1\relax \global\def\pgfplotslistselect@tmp{\def#3{##1}}% \fi% @@ -202,6 +241,10 @@ \endgroup \pgfplotslistselect@tmp } +\def\pgfplotslistselectorempty#1\of#2\to#3{% + \global\def\pgfplotslistselect@tmp{\def#3{}}% + \pgfplotslistselect@{#1}\of{#2}\to{#3}% +} % Sets the boolean \ifpgfplotslistempty depending on whether list #1 is empty % or not. @@ -217,7 +260,12 @@ \ifx#1\pgfutil@empty \pgfplotslistemptytrue \else - \pgfplotslistemptyfalse + \ifx#1\relax + \pgfplots@warning{WARNING: possible logic error in script code: the command \string\pgfplotslistcheckempty{\string#1} encountered an undefined argument.}% + \pgfplotslistemptytrue + \else + \pgfplotslistemptyfalse + \fi \fi } @@ -233,7 +281,7 @@ % Each single element will be grouped with TeX groups. \long\def\pgfplotslistforeach#1\as#2#3{% \begingroup - \long\def\pgfplotslist@sep##1{\def#2{##1}% + \long\def\pgfpl@@##1{\def#2{##1}% \begingroup #3 \endgroup}% @@ -249,7 +297,7 @@ \pgfplots@error{Sorry, you can't nest pgfplotslistforeachungrouped.}% \else \pgfplotslistforeachungroupedrunningtrue - \long\def\pgfplotslist@sep##1{\def#2{##1}#3}% + \long\def\pgfpl@@##1{\def#2{##1}#3}% #1\relax \pgfplotslistforeachungroupedrunningfalse \fi diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructureext.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructureext.code.tex new file mode 100644 index 00000000000..a10e67c82f3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructureext.code.tex @@ -0,0 +1,459 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This is a helper package with an elementary list datastructure. +% In contrast to \pgfplotslist, this one features fast append and fast +% copy-to-macro. +% +% The 'pgfplotsapplist' is a list which has ONLY the features +% +% \pgfplotsapplistnewempty +% \pgfplotsapplistpushback O(1) +% \pgfplotsapplistedefcontenttomacro (N) +% \pgfplotsapplistxdefcontenttomacro (N) +% +% It has been designed to accumulate macro content in O(N) (in +% contrast to TeX's macro append routines which lead to O(N^2) +% runtime). +% +% Furthermore, there is the +% +% \pgfplotsapplistXnewempty +% \pgfplotsapplistXpushback +% \pgfplotsapplistXedefcontenttomacro (N) +% \pgfplotsapplistXxdefcontenttomacro (N) +% \pgfplotsapplistXlet (N) +% +% structure which features **preasymptotical** constant runtime for +% pushback. That means, as long as N < 80000, the runtime is linear. +% It is only slightly slower than \pgfplotsapplist, and that only due +% to its generality. It could easily be adopted to be FASTER than +% \pgfplotsapplist. +% +% Credits for \pgfplotsapplist go to Till Tantau: he developped it for +% the PGF kernel. +% +% +% 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/>. +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% the applist defines one macro for each element, like +% +% \def\element<i>{<content>\element<i+1>} +% \def\element<i+1>{<content>\element<i+2>} +% \def\element<i+2>{} +% +% The '<i>' value belongs to the private interface and is part of the +% macro name. +% +% It features: +% - real O(1) pushback +% - O(N) edef to macro +% - O(N) execute +% - it requires O(N) different macros. +% - it ***can't*** be copied outside of the current TeX group! +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% Time: O(1), number of macros: 3 +\def\pgfplotsapplistnewempty#1{% + \expandafter\def\csname\string#1@endno\endcsname{0}% + \edef#1{\expandafter\noexpand\csname\string#1@0\endcsname}% + \expandafter\def\csname\string#1@0\endcsname{}% +}% + +% Time: O(1), number of macros per list: about N +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistpushback#1\to#2{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname\string#2@endno\endcsname + \begingroup + \c@pgf@counta=\pgfplots@loc@TMPa\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname\string#2@endno\endcsname=\pgfplots@glob@TMPa% + \t@pgfplots@toka={#1}% + \t@pgfplots@tokb=\expandafter{\csname\string#2@\pgfplots@glob@TMPa\endcsname}% + \expandafter\edef\csname\string#2@\pgfplots@loc@TMPa\endcsname{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \expandafter\let\the\t@pgfplots@tokb=\pgfutil@empty +}% + +% time O(N) +% Expands the complete content of list #1 as-is into the macro #2. +\def\pgfplotsapplistedefcontenttomacro#1\to#2{\edef#2{#1}} +\def\pgfplotsapplistxdefcontenttomacro#1\to#2{\xdef#2{#1}} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +% time O(N) +\def\pgfplotsapplistexecute#1{#1}% + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% This list here is a general re-implementation of the list used in +% the PGF system layer. +% It employs two collect-buffers to reduce the runtime. +% +% - It has preasymptotical runtime O(N), but is O(N^2) asymptotically. +% - It requires only 5 macros per list. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Usage: +% \pgfplotsapplistXnewempty\macro +% \pgfplotsapplistXnewempty[to global]\macro +% +% The 'to global' flag will configure the list such that all +% assignments to \macro are global. The list accumulation is +% LOCAL, however: 'to global' is to be used inside of a local +% group such that the final result, when all buffers are flushed, +% is assigned globally. +\def\pgfplotsapplistXnewempty{% + \pgfutil@ifnextchar[{% + \pgfplotsapplistXnewempty@opt + }{% + \pgfplotsapplistXnewempty@opt[]% + }% +} + +\def\pgfplotsapplistXnewempty@opt@TOGLOBAL{to global} + +\def\pgfplotsapplistXnewempty@opt[#1]#2{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \expandafter\let\csname\string#2@let\endcsname=\let% + \expandafter\let\csname\string#2@edef\endcsname=\edef + \else + \ifx\pgfplots@loc@TMPa\pgfplotsapplistXnewempty@opt@TOGLOBAL + \expandafter\def\csname\string#2@let\endcsname{\global\let}% + \expandafter\let\csname\string#2@edef\endcsname=\xdef + \else + \pgfplots@error{Sorry, the argument '#1' to \string\pgfplotsapplistXnewempty\ is unknown. Accepted is 'to global' or empty.}% + \fi + \fi + \pgfplotsapplistXnewempty@{#2}% +}% + +\def\pgfplotsapplistXnewempty@#1{% + \csname\string#1@let\endcsname#1=\pgfutil@empty + \expandafter\let\csname\string#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\let\csname\string#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#1@smallbuf@c\endcsname{0}% + \expandafter\def\csname\string#1@bigbuf@c\endcsname{0}% +}% + +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistXpushback#1\to#2{% + \begingroup + \c@pgf@counta=\csname\string#2@smallbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname\string#2@smallbuf@c\endcsname=\pgfplots@glob@TMPa + \ifnum\csname\string#2@smallbuf@c\endcsname<40 + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}% + \expandafter\edef\csname\string#2@smallbuf\endcsname{\the\t@pgfplots@toka}% + \else + \pgfplotsapplistXpushback@smallbufoverfl{#1}{#2}% + \fi +}% +\def\pgfplotsapplistXpushback@smallbufoverfl#1#2{% + \begingroup + \c@pgf@counta=\csname\string#2@bigbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname\string#2@bigbuf@c\endcsname=\pgfplots@glob@TMPa + % + \ifnum\csname\string#2@bigbuf@c\endcsname<30 + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}% + \expandafter\edef\csname\string#2@bigbuf\endcsname{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \expandafter\let\csname\string#2@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#2@smallbuf@c\endcsname{0}% + \else% + \t@pgfplots@toka=\expandafter{#2}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}% + \t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}% + \csname\string#2@edef\endcsname#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \expandafter\let\csname\string#2@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#2@smallbuf@c\endcsname{0}% + \expandafter\let\csname\string#2@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#2@bigbuf@c\endcsname{0}% + \fi% +}% +\def\pgfplotsapplistXflushbuffers#1{% + \t@pgfplots@toka=\expandafter{#1}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#1@bigbuf\endcsname}% + \t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#1@smallbuf\endcsname}% + \csname\string#1@edef\endcsname#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \expandafter\let\csname\string#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#1@smallbuf@c\endcsname{0}% + \expandafter\let\csname\string#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname\string#1@bigbuf@c\endcsname{0}% +}% + + +% Expands the complete content of list #1 as-is into the macro #2. +\def\pgfplotsapplistXedefcontenttomacro#1\to#2{% + \pgfplotsapplistXflushbuffers#1% + \edef#2{#1}} +\def\pgfplotsapplistXxdefcontenttomacro#1\to#2{% + \pgfplotsapplistXflushbuffers#1% + \xdef#2{#1}} +\def\pgfplotsapplistXlet#1=#2{% + \pgfplotsapplistXflushbuffers#2% + \let#1=#2} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +\def\pgfplotsapplistXexecute#1{% + \pgfplotsapplistXflushbuffers#1% + #1}% + + + + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% This list \pgfplotsapplistXX here is essentially the SAME as \pgfplotslistX. +% +% But there can only be one such list at a time, so it is faster than +% \pgfplotslistX. +% +% This here is probably the fastest list. +% +% It is nothing else but a copy of Till Tantau's pgf kernel list. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 + + + +% WARNING: call \pgfplotsapplistclear if there is another list active. +\def\pgfplotsapplistXXnewempty{% + \pgfutil@ifundefined{pgfplotsapplistXX}{}{% + \ifx\pgfplotsapplistXX\pgfutil@empty + \else + \pgfplots@error{\string\pgfplotsapplistXXnewempty: there is already another list which is *not* empty. It currently contains '\meaning\pgfplotsapplistXX'. Please call '\string\pgfplotsapplistXXclear' before using a new list to ensure clean separations.}% + \fi + }% + \let\pgfplotsapplistXX=\pgfutil@empty + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \def\pgfplotsapplistXX@bigbuf@c{0}% +}% + + +\def\pgfplotsapplistXXclear{% + \pgfutil@ifundefined{pgfplotsapplistXX}{}{% + \let\pgfplotsapplistXX=\pgfutil@empty + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \def\pgfplotsapplistXX@bigbuf@c{0}% + }% +}% + +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistXXpushback#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXX@smallbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \let\pgfplotsapplistXX@smallbuf@c=\pgfplots@glob@TMPa + \ifnum\pgfplotsapplistXX@smallbuf@c<40 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX@smallbuf#1}% + \edef\pgfplotsapplistXX@smallbuf{\the\t@pgfplots@toka}% + \else + \pgfplotsapplistXXpushback@smallbufoverfl{#1}% + \fi +}% +\def\pgfplotsapplistXXpushback@smallbufoverfl#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXX@bigbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \let\pgfplotsapplistXX@bigbuf@c=\pgfplots@glob@TMPa + % + \ifnum\pgfplotsapplistXX@bigbuf@c<30 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX@bigbuf}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@smallbuf#1}% + \edef\pgfplotsapplistXX@bigbuf{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \else% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXX@smallbuf#1}% + \edef\pgfplotsapplistXX{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@bigbuf@c{0}% + \fi% +}% +\def\pgfplotsapplistXXflushbuffers{% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXX}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXX@smallbuf}% + \edef\pgfplotsapplistXX{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \let\pgfplotsapplistXX@smallbuf=\pgfutil@empty + \def\pgfplotsapplistXX@smallbuf@c{0}% + \let\pgfplotsapplistXX@bigbuf=\pgfutil@empty + \def\pgfplotsapplistXX@bigbuf@c{0}% +}% + + +% Expands the complete content of list #1 as-is into the macro #2. +\def\pgfplotsapplistXXedefcontenttomacro#1{% + \pgfplotsapplistXXflushbuffers + \edef#1{\pgfplotsapplistXX}} +\def\pgfplotsapplistXXxdefcontenttomacro#1{% + \pgfplotsapplistXXflushbuffers% + \xdef#1{\pgfplotsapplistXX}} +\def\pgfplotsapplistXXlet#1{% + \pgfplotsapplistXXflushbuffers% + \let#1=\pgfplotsapplistXX} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +\def\pgfplotsapplistXXexecute#1{% + \pgfplotsapplistXXflushbuffers + #1}% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% \pgfplotslistXXglobal assigns to a global list. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +\def\pgfplotsapplistXXglobalnewempty{% + \pgfutil@ifundefined{pgfplotsapplistXXglobal}{}{% + \ifx\pgfplotsapplistXXglobal\pgfutil@empty + \else + \pgfplots@error{\string\pgfplotsapplistXXglobalnewempty: there is already another list which is *not* empty. It currently contains '\meaning\pgfplotsapplistXXglobal'. Please call '\string\pgfplotsapplistXXglobalclear' before using a new list to ensure clean separations.}% + \fi + }% + \global\let\pgfplotsapplistXXglobal=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% +}% + + +\def\pgfplotsapplistXXglobalclear{% + \pgfutil@ifundefined{pgfplotsapplistXXglobal}{}{% + \global\let\pgfplotsapplistXXglobal=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% + }% +}% + +% #1: the item to append +% #2: the list as macro name +\def\pgfplotsapplistXXglobalpushback#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXXglobal@smallbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \global\let\pgfplotsapplistXXglobal@smallbuf@c=\pgfplots@glob@TMPa + \ifnum\pgfplotsapplistXXglobal@smallbuf@c<40 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}% + \xdef\pgfplotsapplistXXglobal@smallbuf{\the\t@pgfplots@toka}% + \else + \pgfplotsapplistXXglobalpushback@smallbufoverfl{#1}% + \fi +}% +\def\pgfplotsapplistXXglobalpushback@smallbufoverfl#1{% + \begingroup + \c@pgf@counta=\pgfplotsapplistXXglobal@bigbuf@c\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \global\let\pgfplotsapplistXXglobal@bigbuf@c=\pgfplots@glob@TMPa + % + \ifnum\pgfplotsapplistXXglobal@bigbuf@c<30 + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal@bigbuf}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}% + \xdef\pgfplotsapplistXXglobal@bigbuf{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \else% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}% + \xdef\pgfplotsapplistXXglobal{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% + \fi% +}% +\def\pgfplotsapplistXXglobalflushbuffers{% + \t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal}% + \t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@bigbuf}% + \t@pgfplots@tokc=\expandafter{\pgfplotsapplistXXglobal@smallbuf}% + \xdef\pgfplotsapplistXXglobal{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}% + \global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@smallbuf@c{0}% + \global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty + \gdef\pgfplotsapplistXXglobal@bigbuf@c{0}% +}% + + +% Expands the complete content of list #1 as-is into the macro #2. +% +% this assigns locally into #1. +\def\pgfplotsapplistXXglobaledefcontenttomacro#1{% + \pgfplotsapplistXXglobalflushbuffers + \edef#1{\pgfplotsapplistXXglobal}} +% this assigns locally into #1. +\def\pgfplotsapplistXXglobalxdefcontenttomacro#1{% + \pgfplotsapplistXXglobalflushbuffers% + \xdef#1{\pgfplotsapplistXXglobal}} +% this assigns locally into #1. +\def\pgfplotsapplistXXgloballet#1{% + \pgfplotsapplistXXglobalflushbuffers% + \let#1=\pgfplotsapplistXXglobal} + +% Foreach list element, the stored value will simply be processed by +% TeX. Characters will be printed and commands will be executed. +% this assigns locally into #1. +\def\pgfplotsapplistXXglobalexecute#1{% + \pgfplotsapplistXXglobalflushbuffers + #1}% 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 82e27215bf4..77a40d51ed5 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -28,13 +28,6 @@ % %-------------------------------------------- -% This file relies on -% - pgfplotsliststructure.code.tex -% - pgfplotsarraystructure.code.tex -% - a (quite!) recent PGF. -% -% and needs some token registers. It does not use more of pgfplots. -% \newif\ifpgfplotstable@search@header \newcount\c@pgfplotstable@counta \newwrite\pgfplotstable@outfile @@ -43,9 +36,15 @@ % should always be false; use only in grouped internal macros \newif\ifpgfplots@table@options@areset +\newif\ifpgfplots@tableread@to@listener \input pgfplotstable.coltype.code.tex +% keys which are NOT predefined: +% /pgfplots/table/alias/<col alias>/.initial={<real col>} +% /pgfplots/table/columns/<col name>/.style={} +% /pgfplots/table/display columns/<col index>/.style={} +% /pgfplots/table/create on use/<col name>/.style={create options} \pgfkeys{% /pgfplots/table/header/.is if=pgfplotstable@search@header, /pgfplots/table/header=true, @@ -71,6 +70,38 @@ \fi \fi} }, + /pgfplots/table/select equal part entry of/.style 2 args={% + /pgfplots/table/row predicate/.code={% + \pgfplotstableuserowtrue + \begingroup + % this group re-uses counters as temporary variables. + \c@pgfplotstable@colindex=\pgfplotstablerows\relax + \divide\c@pgfplotstable@colindex by#2\relax + \edef\pgfplotstablepartsize{\the\c@pgfplotstable@colindex}% + % This here should create empty cells such that + % remaining entries are distributed equally: + \c@pgfplotstable@rowindex=\c@pgfplotstable@colindex + \multiply\c@pgfplotstable@rowindex by#2\relax + \ifnum\c@pgfplotstable@rowindex<\pgfplotstablerows\relax + \c@pgfplotstable@colindex=\pgfplotstablerows\relax + \advance\c@pgfplotstable@colindex by-\c@pgfplotstable@rowindex + \advance\c@pgfplotstable@colindex by\pgfplotstablepartsize + \edef\pgfplotstablepartsize{\the\c@pgfplotstable@colindex}% + \fi + % + \multiply\c@pgfplotstable@colindex by#1\relax + \ifnum##1<\c@pgfplotstable@colindex\relax + \aftergroup\pgfplotstableuserowfalse + \else + \advance\c@pgfplotstable@colindex by\pgfplotstablepartsize\relax + \ifnum##1<\c@pgfplotstable@colindex\relax + \else + \aftergroup\pgfplotstableuserowfalse + \fi + \fi + \endgroup + }% + }, /pgfplots/table/col sep/.is choice, /pgfplots/table/col sep/space/.code = {\def\pgfplotstableread@COLSEP@CASE{0}}, /pgfplots/table/col sep/comma/.code = {\def\pgfplotstableread@COLSEP@CASE{1}}, @@ -111,14 +142,44 @@ /pgfplots/table/multicolumn names/.default=c, /pgfplots/table/dec sep align/.style={% /pgf/number format/assume math mode, - /pgf/number format/set decimal separator/.add={&}{}, + /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/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}% + \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={% + /pgf/number format/assume math mode, + /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/assign cell content/.code={% - \pgfmathprintnumberto{##1}\pgfmathresult% - \expandafter\pgfutil@in@\expandafter&\expandafter{\pgfmathresult}% + \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&}% @@ -126,7 +187,7 @@ \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, }, - /pgfplots/table/dec sep align/.default=c, + /pgfplots/table/sci sep align/.default=c, % % A style which can be used together with the 'dcolumn' package by % David Carlisle. @@ -162,14 +223,22 @@ % #1: the cells content as it has been found in the input table % this command key should somehow fill |cell content|. /pgfplots/table/assign cell content/.code={% - \pgfmathprintnumberto{#1}\pgfmathresult% + \def\pgfmathresult{#1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathprintnumberto{#1}\pgfmathresult% + \fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, % % this here is the default formatting. It uses % \pgfmathprintnumber. /pgfplots/table/assign cell content as number/.code={% - \pgfmathprintnumberto{#1}\pgfmathresult% + \def\pgfmathresult{#1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathprintnumberto{#1}\pgfmathresult% + \fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, /pgfplots/table/string type/.style={% @@ -177,11 +246,284 @@ /pgfplots/table/@cell content={##1}% }% },% + /pgfplots/table/set content/.style={% + /pgfplots/table/postproc cell content/.style={% + /pgfplots/table/@cell content={#1}% + }% + },% + % + /pgfplots/table/postproc cell content/.code={}, + /pgfplots/table/preproc cell content/.code={}, + % + /pgfplots/table/multiply -1/.style={% + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\empty + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\pgfmatharga=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{0}% + \let\pgfmathargb=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmatharga}{\pgfmathargb}% + \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 + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1}% + \fi + \fi + }% + }, + % /pgfplots/table/font/.initial=, /pgfplots/table/.unknown/.code={% \pgfqkeys{/pgf/number format}{\pgfkeyscurrentname=#1}% - }% + },% + /pgfplots/table/create col/assign first/.style={ + /pgfplots/table/create col/assign% + }, + /pgfplots/table/create col/assign last/.style={ + /pgfplots/table/create col/assign% + }, + /pgfplots/table/create col/assign/.style={ + /pgfplots/table/create col/next content={}% + }, + /pgfplots/table/create col/next content/.initial={}, + /pgfplots/table/create col/expr/.style={% + /pgfplots/table/create col/assign/.code={% + \pgfmathparse{#1}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% + },% + /pgfplots/table/create col/quotient/.style={% + /pgfplots/table/columns={#1}, + /pgfplots/table/create col/assign first/.style={% + /pgfplots/table/create col/next content= + },% + /pgfplots/table/create col/assign/.code={% + \pgfmathfloatparsenumber{\prevrow{#1}}% + \let\pgfmatharga=\pgfmathresult + \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/table/create col/iquotient/.style={% + /pgfplots/table/columns={#1}, + /pgfplots/table/create col/assign first/.style={% + /pgfplots/table/create col/next content= + },% + /pgfplots/table/create col/assign/.code={% + \pgfmathfloatparsenumber{\prevrow{#1}}% + \let\pgfmathargb=\pgfmathresult + \pgfmathfloatparsenumber{\thisrow{#1}}% + \let\pgfmatharga=\pgfmathresult + \let\pgfmathaccuma=\pgfmathargb + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% + },% + % + % Produces 'log2( \prevrow{#1}/\thisrow{#1} ) + % + % Assumeing that every row contains error(h) = O(h^alpha) + % and h_this = h_prev/2, this result in 'alpha', the convergence + % rate. + /pgfplots/table/create col/dyadic refinement rate/.style={% + /pgfplots/table/columns={#1}, + /pgfplots/table/create col/assign first/.style={% + /pgfplots/table/create col/next content= + },% + /pgfplots/table/create col/assign/.code={% + \pgfmathfloatparsenumber{\prevrow{#1}}% + \let\pgfmatharga=\pgfmathresult + \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/table/create col/idyadic refinement rate/.style={% + /pgfplots/table/columns={#1}, + /pgfplots/table/create col/assign first/.style={% + /pgfplots/table/create col/next content= + },% + /pgfplots/table/create col/assign/.code={% + \pgfmathfloatparsenumber{\prevrow{#1}}% + \let\pgfmathargb=\pgfmathresult + \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/table/create col/gradient/.style 2 args={% + /pgfplots/table/columns={#1,#2}, + /pgfplots/table/create col/assign first/.code={% + \pgfmathfloatparsenumber{\thisrow{#1}}% + \let\pgfmathaccuma=\pgfmathresult + \pgfmathfloatparsenumber{\thisrow{#2}}% + \let\pgfmathaccumb=\pgfmathresult + \def\pgfmathresult{}% leave first empty. + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + },% + /pgfplots/table/create col/assign/.code={% + \let\pgfmathcur@x=\pgfmathaccuma + \let\pgfmathcur@y=\pgfmathaccumb + \pgfmathfloatparsenumber{\thisrow{#1}}% + \let\pgfmathnext@x=\pgfmathresult + \let\pgfmathaccuma=\pgfmathnext@x + \pgfmathfloatparsenumber{\thisrow{#2}}% + \let\pgfmathnext@y=\pgfmathresult + \let\pgfmathaccumb=\pgfmathnext@y + \pgfmathfloatsubtract@{\pgfmathnext@x}{\pgfmathcur@x}% + \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/table/create col/gradient loglog/.style 2 args={% + /pgfplots/table/columns={#1,#2}, + /pgfplots/table/create col/assign first/.code={% + \pgfmathlog{\thisrow{#1}}% + \let\pgfmathaccuma=\pgfmathresult + \pgfmathlog{\thisrow{#2}}% + \let\pgfmathaccumb=\pgfmathresult + \def\pgfmathresult{}% leave first empty. + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + },% + /pgfplots/table/create col/assign/.code={% + \let\pgfmathcur@x=\pgfmathaccuma + \let\pgfmathcur@y=\pgfmathaccumb + \pgfmathlog{\thisrow{#1}}% + \let\pgfmathnext@x=\pgfmathresult + \let\pgfmathaccuma=\pgfmathresult + \pgfmathlog{\thisrow{#2}}% + \let\pgfmathnext@y=\pgfmathresult + \let\pgfmathaccumb=\pgfmathresult + \pgfplots@loop@CONTINUEtrue + \ifx\pgfmathcur@x\pgfutil@empty \pgfplots@loop@CONTINUEfalse\fi + \ifx\pgfmathcur@y\pgfutil@empty \pgfplots@loop@CONTINUEfalse\fi + \ifx\pgfmathnext@x\pgfutil@empty \pgfplots@loop@CONTINUEfalse\fi + \ifx\pgfmathnext@y\pgfutil@empty \pgfplots@loop@CONTINUEfalse\fi + \ifpgfplots@loop@CONTINUE + \pgfmathsubtract@{\pgfmathnext@x}{\pgfmathcur@x}% + \let\pgfmathdiff@x=\pgfmathresult + \pgfmathsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% + \let\pgfmathdiff@y=\pgfmathresult + \pgfmathdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \else + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloattosci@\pgfmathresult + \fi + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + },% + },% + /pgfplots/table/create col/gradient semilogx/.style 2 args={% + /pgfplots/table/columns={#1,#2}, + /pgfplots/table/create col/assign first/.code={% + \pgfmathlog{\thisrow{#1}}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \let\pgfmathaccuma=\pgfmathresult + \pgfmathfloatparsenumber{\thisrow{#2}}% + \let\pgfmathaccumb=\pgfmathresult + \def\pgfmathresult{}% leave first empty. + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + },% + /pgfplots/table/create col/assign/.code={% + \let\pgfmathcur@x=\pgfmathaccuma + \let\pgfmathcur@y=\pgfmathaccumb + \pgfmathlog{\thisrow{#1}}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \let\pgfmathnext@x=\pgfmathresult + \let\pgfmathaccuma=\pgfmathresult + % + \pgfmathfloatparsenumber{\thisrow{#2}}% + \let\pgfmathnext@y=\pgfmathresult + \let\pgfmathaccumb=\pgfmathresult + \pgfmathfloatsubtract@{\pgfmathnext@x}{\pgfmathcur@x}% + \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/table/create col/gradient semilogy/.style 2 args={% + /pgfplots/table/columns={#1,#2}, + /pgfplots/table/create col/assign first/.code={% + \pgfmathfloatparsenumber{\thisrow{#1}}% + \let\pgfmathaccuma=\pgfmathresult + \pgfmathlog{\thisrow{#2}}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \let\pgfmathaccumb=\pgfmathresult + \def\pgfmathresult{}% leave first empty. + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + },% + /pgfplots/table/create col/assign/.code={% + \let\pgfmathcur@x=\pgfmathaccuma + \let\pgfmathcur@y=\pgfmathaccumb + \pgfmathlog{\thisrow{#2}}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfmathresult}% + \fi + \let\pgfmathnext@y=\pgfmathresult + \let\pgfmathaccumb=\pgfmathresult + % + \pgfmathfloatparsenumber{\thisrow{#1}}% + \let\pgfmathnext@x=\pgfmathresult + \let\pgfmathaccuma=\pgfmathresult + \pgfmathfloatsubtract@{\pgfmathnext@x}{\pgfmathcur@x}% + \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% + },% + },% } +\pgfkeysgetvalue{/pgfplots/table/postproc cell content/.@cmd}\pgfplotstable@postproccellcontent@EMPTY % \pgfplotstableread[OPTIONS] {FILE} to \name % @@ -206,6 +548,18 @@ % % The table data is stored columnwise in lists and can be accessed % with the other methods of this package. +% +% \pgfplotstableread[<options>]{<file>}{<\macro>} +% \pgfplotstableread[<options>]{<file>} to listener{<\macro>} +% +% The 'to listener' variant does NOT assemble a table data structure. +% Instead, it processes the input table row-wise and invokes <\macro> +% after each complete row. During the evaluation of <\macro>, the +% following methods can be used to query values: +% \pgfplotstablereadgetcolindex{<index>}{<\macro>} +% \pgfplotstablereadgetcolname{<name>}{<\macro>} +% Attention: 'to listener' is scoped by TeX groups, so any assignments +% need to be done globally (or with aftergroup magic). \def\pgfplotstableread{% \pgfutil@ifnextchar[{% \pgfplotstableread@impl @@ -221,14 +575,111 @@ \let#2=#1 } +% Returns a column vector in form of \pgfplotslist +% into #3. +% +% #1: the column name (not a macro) +% #2: the table structure +% #3: the output macro name. \def\pgfplotstablegetcolumnbyname#1\of#2\to#3{% \pgfutil@ifundefined{\string#2@#1}{% - \pgfplots@error{Sorry, could not retrieve column '#1' from table...}% + % Oh, there is no column '#1' in table '#2'! + % + % Ok, then check for the 'create on use' and the 'alias' + % features... + % 1. create on use: + % + % WARNING : this code has been REPLICATED in + % *** \pgfplotstablereadgetptrtocolname *** + % *** \pgfplotstablegetcolumnbyname *** + % *** \pgfplotstableresolvecolname *** + \def\pgfplotstable@loc@TMPa{/pgfplots/table/create on use/#1}% + \pgfkeysifdefined{\pgfplotstable@loc@TMPa/.@cmd}{% + % aah - a 'create on use' style exists. Apply it! + \expandafter\pgfplotstablecreatecol\expandafter[\pgfplotstable@loc@TMPa]{#1}{#2}% + % and return the newly generated col: + \expandafter\let\expandafter#3\csname\string#2@#1\endcsname + }{% + % ok, then it is either an alias or it is simply not + % existant. + \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% + \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% + \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% + \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb + \pgfutil@ifundefined{\string#2@\pgfplotstable@loc@TMPa}{% + \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.}% + \pgfplotslistnewempty#3 + }{% + \expandafter\let\expandafter#3\csname\string#2@\pgfplotstable@loc@TMPa\endcsname + }% + }{% + \pgfplots@error{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).}% + \pgfplotslistnewempty#3 + }% + }% }{% \expandafter\let\expandafter#3\csname\string#2@#1\endcsname }% } +% Retrieves the column *NAME* '#1' of table #2 and writes it into +% '#3'. +% +% If there is no such column, column aliases will be checked. Finally +% if there are no aliases, the command fails with an error. +% +% The 'create on use' statements can't be used in this context. +% @see \pgfplotstablegetcolumnbyname +% +% #1: a column name (not a macro) +% #2: the table structure +% #3: a macro name which will be filled with the (probably modified) +% column name into #2. +\def\pgfplotstableresolvecolname#1\of#2\to#3{% + \pgfutil@ifundefined{\string#2@#1}{% + % Oh, there is no column '#1' in table '#2'! + % + % Ok, then check for the 'alias' feature ... + % + % WARNING : this code has been REPLICATED in + % *** \pgfplotstablereadgetptrtocolname *** + % *** \pgfplotstablegetcolumnbyname *** + % *** \pgfplotstableresolvecolname *** + \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% + \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% + \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% + \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb + \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, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.}% + }% + \let#3=\pgfutil@empty + }{% + \let#3=\pgfplotstable@loc@TMPa + }% + }{% + \pgfplots@error{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).}% + \let#3=\pgfutil@empty + }% + }{% + \def#3{#1}% + }% +} + +% Invokes either \pgfplotstablegetcolumnbyindex or +% \pgfplotstablegetcolumnbyname. +\def\pgfplotstablegetcolumn#1\of#2\to#3{% + \pgfplotstable@is@colname{#1}% + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstablegetcolumnnamebyindex{#1}\of{#2}\to{#3} + \fi + \pgfplotstablegetcolumnbyname{#1}\of#2\to{#3}% +}% + \def\pgfplotstablegetcolumnnamebyindex#1\of#2\to#3{% \pgfplotslistselect#1\of#2\to#3\relax }% @@ -239,13 +690,56 @@ \def\pgfplotstablecopy#1\to#2{% \let#2=#1% - \pgfplotslistforeachungrouped#1\as\pgfplotstable@TMP{% - \def\pgfplotstable@TMPB{% - \expandafter\let\csname\string#2@\pgfplotstable@TMP\endcsname}% - \expandafter\pgfplotstable@TMPB\csname\string#1@\pgfplotstable@TMP\endcsname + \pgfplotstablegetname#2\pgfplotstable@loc@TMPa + \expandafter\let\csname\string#1@@table@name\endcsname=\pgfplotstable@loc@TMPa + \pgfplotslistforeachungrouped#1\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\let\csname\string#2@\pgfplotstable@loc@TMPa\endcsname}% + \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname }% } +% Returns the file name of table '#1' into macro #2. +\def\pgfplotstablegetname#1#2{% + \expandafter\let\expandafter#2\csname\string#1@@table@name\endcsname +} + +% expands to the table file name of table '#1' +\def\pgfplotstablenameof#1{% + \csname\string#1@@table@name\endcsname +} + +% Creates a new column named #1 and appends it to table #2. +% +% The column entries will be created using the command keys +% 'create col/assign' +% 'create col/assign last' +% +% The key 'create col/assign' will be invoked for every row of table #2. +% It is supposed to assign the key 'create col/next content'. +% During evaluation of 'create col/assign', the macro '\thisrow{<col name>}' +% expands to the current row's value of the column named by <col name>. +% Furthermore, '\nextrow{<col name>}' expands to the \emph{next} row's +% value of the designated column. +% +% Since the "next row" is not available if we are currently processing +% the last row, 'create col/assign last' is used in for the last row's +% value. +% +% You can use +% - \thisrow{<col name>}, +% - \getthisrow{<col name>}{\macro} +% - \nextrow{<col name>}, +% - \getnextrow{<col name>}{\macro} +\def\pgfplotstablecreatecol{% + \pgfutil@ifnextchar[{% + \pgfplotstablecreatecol@opt + }{% + \pgfplotstablecreatecol@opt[]% + }% +}% + + % Typesets a table. % % \pgfplotstabletypeset[<options>]<\tablestructure> @@ -285,7 +779,7 @@ \ifpgfplots@table@options@areset \else \pgfplots@table@options@aresettrue - \pgfplotstableset{/pgfplots/table/every table,#1}% + \pgfplotstableset{/pgfplots/table/every table={#2},#1}% \fi \pgfplotstableread{#2}\pgfplotstabletypesetfile@opt@@ \pgfplotstabletypeset\pgfplotstabletypesetfile@opt@@ @@ -300,6 +794,12 @@ \newif\ifpgfplotstableread@curline@contains@colnames \newif\ifpgfplotstableread@foundcolnames \newif\ifpgfplotstableread@skipline + +% Accept one of +% \pgfplotstableread[#1]{<file>}{<\macro>} +% \pgfplotstableread[#1]{<file>} to listener{<\macro>} +% or +% \pgfplotstableread[#1]{<file>} to {<\macro>} (DEPRECATED) \def\pgfplotstableread@impl[#1]#2{% \pgfutil@ifnextchar t{% \pgfplotstableread@impl@@{#1}{#2}% @@ -312,18 +812,37 @@ % >> \pgfplotstableread[]{file} to \macro % That ' to ' is really ugly. This here is for backwards % compatibility: -\def\pgfplotstableread@impl@@#1#2to #3{% +\def\pgfplotstableread@impl@@#1#2to {% + \pgfutil@ifnextchar l{% + \pgfplotstableread@impl@@listener{#1}{#2}% + }{% + \pgfplotstableread@impl@{#1}{#2}% + }% +}% +\def\pgfplotstableread@impl@@listener#1#2listener#3{% + \pgfplots@tableread@to@listenertrue \pgfplotstableread@impl@{#1}{#2}{#3}% + \pgfplots@tableread@to@listenerfalse }% \def\pgfplotstableread@impl@#1#2#3{% \begingroup \ifpgfplots@table@options@areset \else - \pgfplotstableset{/pgfplots/table/every table,#1}% + \pgfplotstableset{/pgfplots/table/every table={#2},#1}% \fi %\pgfplots@message{ATTEMPTING TO READ #2}% - \openin1=#2\relax + \openin1=#2.tex + \ifeof1 + \openin1=#2\relax + \else + \pgfplots@warning{% + You requested to open table '#2', but there is also a '#2.tex'. + TeX will automatically append the suffix '.tex', so I will now open '#2.tex'. + Please make sure you don't accidentally load TeX files - this may produce unrecoverable errors.}% + \closein1 + \openin1=#2\relax + \fi \def\pgfplotstableread@filename{#2}% \let\pgfplotstableread@lineno=\c@pgf@counta \let\pgfplotstableread@numcols=\c@pgf@countb @@ -332,48 +851,63 @@ \pgfplotstableread@lineno=0 \pgfplotstableread@usablelineno=0 \pgfplotstableread@numcols=0 - \pgfplotslistnewempty\pgfplotstable@colnames + \global\pgfplotslistnewempty\pgfplotstable@colnames \ifeof1 \pgfplotstable@error{Could not read table file '#2'.}% - \fi - % - \pgfplotstableread@loop@over@lines - % - \ifpgfplotstableread@foundcolnames + \global\pgfplotslistnewempty\pgfplotstable@colnames \else - \pgfplotstableread@create@column@names@with@numbers + \ifpgfplots@tableread@to@listener + \let\pgfplotstable@listener=#3% + \let\pgfplotstableread@impl@nextrow@NEXT=\pgfplotstableread@impl@nextrow@NEXT@listener + \let\pgfplotstablereadgetcolindex=\pgfplotstablereadgetcolindex@ + \let\pgfplotstablereadgetcolname=\pgfplotstablereadgetcolname@ + \let\pgfplotstablereadgetptrtocolname=\pgfplotstablereadgetptrtocolname@ + \let\pgfplotstablereadgetptrtocolindex=\pgfplotstablereadgetptrtocolindex@ + \let\pgfplotstablereadevalptr=\pgfplotstablereadevalptr@ + \fi + % + \pgfplotstableread@loop@over@lines + \closein1 + % + \pgfplotstableread@finish \fi - % Well, now write the identified data to #3: - % - % make all temporaries global: - \global\let\pgfplotstable@colnames=\pgfplotstable@colnames - \pgfplotstableread@curcol=0\relax - \loop - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols -%\pgfplots@message{ASSIGNING COLUMN NO \the\pgfplotstableread@curcol / \the\pgfplotstableread@numcols}% - % numtable@TMP := column list content - \expandafter\global\expandafter\let\expandafter\pgfplotstable@TMP\csname numtable@col@\the\pgfplotstableread@curcol\endcsname - % global := numtable@TMP - \expandafter\global\expandafter\let\csname numtable@col@\the\pgfplotstableread@curcol\endcsname=\pgfplotstable@TMP - \advance\pgfplotstableread@curcol by1\relax - \repeat - \closein1 \endgroup - % Now, we can access the global variables! - % copy them to #3. - \let#3=\pgfplotstable@colnames - \c@pgfplotstable@counta=0\relax% - \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@TMP{% - \def\pgfplotstable@TMPB{% - \expandafter\let\csname\string#3@\pgfplotstable@TMP\endcsname}% - \expandafter\pgfplotstable@TMPB\csname numtable@col@\the\c@pgfplotstable@counta\endcsname -%\message{Column '\pgfplotstable@TMP' has entries: \expandafter\meaning\csname numtable@col@\the\c@pgfplotstable@counta\endcsname}% - \expandafter\global\expandafter\let\csname numtable@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty - \advance\c@pgfplotstable@counta by1\relax - }% + \ifpgfplots@tableread@to@listener + % there are no data structures in this case. + \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 + }% + \fi \global\let\pgfplotstable@colnames=\pgfutil@empty } +\def\pgfplotstableread@finish{% + \ifpgfplots@tableread@to@listener + \else + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstableread@create@column@names@with@numbers + \fi + \pgfplotstableread@curcol=0\relax% + \pgfutil@loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols + \expandafter\pgfplotsapplistXflushbuffers\csname pgfp@numtable@glob@col@\the\pgfplotstableread@curcol\endcsname + \advance\pgfplotstableread@curcol by1 + \pgfutil@repeat + \fi +} + \def\pgfplotstableread@loop@over@lines{% \ifeof1 %\pgfplots@message{EOF}% @@ -390,9 +924,9 @@ % \fi %-------------------------------------------------- %\pgfplots@message{READING LINE \the\pgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% + \pgfplotstableread@curline@contains@colnamesfalse \ifnum\pgfplotstableread@numcols=0\relax \pgfplotstableread@curcol=0\relax - \pgfplotstableread@curline@contains@colnamesfalse \pgfplotstableread@impl@DO\pgfplotstableread@impl@countcols@and@identifynames@NEXT\pgfplotstable@LINE %\expandafter\pgfplotstableread@impl@countcols@and@identifynames@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI \pgfplotstableread@numcols=\pgfplotstableread@curcol @@ -439,14 +973,22 @@ \else \pgfplotstable@error{ERROR: the input table has an unexpected number of columns in row '\the\pgfplotstableread@lineno'. Expected: '\the\pgfplotstableread@numcols'; got '\the\pgfplotstableread@curcol. Maybe the input table is corrupted?}% \fi + \ifpgfplots@tableread@to@listener + \ifpgfplotstableread@curline@contains@colnames + \else + % report row! + \pgfplotstable@listener + \fi + \fi \advance\pgfplotstableread@usablelineno by1\relax \fi \fi \advance\pgfplotstableread@lineno by1\relax - \pgfplotstableread@loop@over@lines + \expandafter\pgfplotstableread@loop@over@lines \fi } +% WARNING: this routine is also use in pgfplots.code.tex ... \def\pgfplotstableread@checkspecial@line{% \pgfutil@ifnextchar##{% \pgfplotstableread@skiplinetrue @@ -478,20 +1020,21 @@ } \def\pgfplotstableread@create@column@lists{% - \loop + \pgfutil@loop \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols - \expandafter\pgfplotslistnewempty\csname numtable@col@\the\pgfplotstableread@curcol\endcsname + \def\pgfplots@loc@TMPa{\pgfplotsapplistXnewempty[to global]}% + \expandafter\pgfplots@loc@TMPa\csname pgfp@numtable@glob@col@\the\pgfplotstableread@curcol\endcsname \advance\pgfplotstableread@curcol by1\relax - \repeat + \pgfutil@repeat } \def\pgfplotstableread@create@column@names@with@numbers{% \pgfplotstableread@curcol=0\relax - \loop + \pgfutil@loop \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols - \expandafter\pgfplotslistpushback\the\pgfplotstableread@curcol\to\pgfplotstable@colnames + \expandafter\pgfplotslistpushbackglobal\the\pgfplotstableread@curcol\to\pgfplotstable@colnames \advance\pgfplotstableread@curcol by1\relax - \repeat + \pgfutil@repeat } \long\def\pgfplotstableread@impl@gobble#1\pgfplotstable@EOI{}% @@ -560,13 +1103,107 @@ \pgfplotstableread@impl@ITERATE@NEXT@{#1}% \pgfplotstableread@impl@ITERATE }% -%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% these values are only usable for a read-listener, that means: +% when using +% +% \pgfplotstableread{<file>} to listener<\macro> +% +% -> <\macro> can than use the methods +% +% \pgfplotstablereadgetcolindex{<index>}{<\content>} +% performs \let\content=<content of column no <index> > +\def\pgfplotstablereadgetcolindex@#1#2{% + \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% + \pgfplots@error{Sorry, the requested column number '#1' in table '\pgfplotstableread@filename' does not exist!? Please verify you used the correct index 0 <= i < N.}% + \let#2=\pgfutil@empty + }{% + \expandafter\let\expandafter#2\csname pgfplotstblread@colcontent@no#1\endcsname + }% +}% + +% \pgfplotstablereadgetcolname{<index>}{<name>} +% performs \let\content=<content of column named <name> > +\def\pgfplotstablereadgetcolname@#1#2{% + \pgfplotstablereadgetptrtocolname{#1}{\pgfplots@loc@TMPa}% + \pgfplotstablereadevalptr\pgfplots@loc@TMPa{#2}% +}% + +% \pgfplotstablereadgetptrtocolname{<name>}{\ptr} +% Creates some sort of "pointer" to the column named <name>. This +% pointer can than be used every time a new line has been reported to +% the listener. IT works like this: +% +% \let\ptr=\pgfutil@empty +% \def\macro{% +% \ifx\ptr\empty +% \pgfplotstablereadgetptrtocolname{<my col>}{\ptr}% +% \fi +% \pgfplotstablereadevalptr{\ptr}{\content}% +% -> do something with \content! +% } +% +% \pgfplotstableread{<file>} to listener<\macro> +% +% -> will evaluate \macro foreach row. +\def\pgfplotstablereadgetptrtocolname@#1#2{% + % Implementation note: it is necessary to replicate code becuase + % in this context, the table structure is NOT available. + \pgfutil@ifundefined{pgfplotstblread@colindex@for@name#1}{% + % Oh, there is no column '#1'! + % + % Check for the 'alias' feature! + % + % WARNING : this code has been REPLICATED in + % *** \pgfplotstablereadgetptrtocolname *** + % *** \pgfplotstablegetcolumnbyname *** + % *** \pgfplotstableresolvecolname *** + % + \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% + \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% + \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% + \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb + \pgfutil@ifundefined{pgfplotstblread@colindex@for@name\pgfplotstable@loc@TMPa}{% + \pgfplots@error{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename'. The original request was for '#1', which does not exist either.}% + \def#2{0}% + }{% + \edef#2{\csname pgfplotstblread@colindex@for@name\pgfplotstable@loc@TMPa\endcsname}% + }% + }{% + \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, could not retrieve column '#1' from table '\pgfplotstableread@filename'. Please check spelling (or introduce name aliases).}% + }% + \def#2{0}% + }% + }{% + \edef#2{\csname pgfplotstblread@colindex@for@name#1\endcsname}% + }% +}% + +% As \pgfplotstablereadgetptrtocolname, but this here access columns +% by index. +\def\pgfplotstablereadgetptrtocolindex@#1#2{\def#2{#1}}% +% \pgfplotstablereadevalptr{<\ptr>}{<\content} +% writes the current value of <\ptr> to <\content>. The pointer <\ptr> +% must be initialised with \pgfplotstablereadgetptrtocolname +\let\pgfplotstablereadevalptr@=\pgfplotstablereadgetcolindex@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\long\def\pgfplotstableread@impl@nextrow@NEXT@listener#1{% + \expandafter\def\csname pgfplotstblread@colcontent@no\the\pgfplotstableread@curcol\endcsname{#1}% + \advance\pgfplotstableread@curcol by1\relax +} \long\def\pgfplotstableread@impl@nextrow@NEXT#1{% %\pgfplots@message{Inserting '#1' at (\the\pgfplotstableread@lineno, \the\pgfplotstableread@curcol).}% - \def\pgfplotstableread@TMP{\pgfplotslistpushback#1\to}% - \expandafter\pgfplotstableread@TMP\csname numtable@col@\the\pgfplotstableread@curcol\endcsname + \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 } @@ -575,13 +1212,20 @@ \long\def\pgfplotstableread@impl@collectcolnames@NEXT#1{% %\pgfplots@message{Got column name no \the\pgfplotstableread@curcol\ as '#1'}% \pgfutil@ifundefined{pgfplotstableread@impl@COLNAME@#1}{% - \def\pgfplotstable@TMP{#1}% + \def\pgfplotstable@loc@TMPa{#1}% }{% generate unique column names - \pgfplots@warning{Warning: table '\pgfplotstableread@filename' has non-unique column name '#1'. Only the first occurence can be accessed via column names.}% - \edef\pgfplotstable@TMP{#1--index\the\pgfplotstableread@curcol}% + \pgfplots@warning{Table '\pgfplotstableread@filename' has non-unique column name '#1'. Only the first occurence can be accessed via column names.}% + \edef\pgfplotstable@loc@TMPa{#1--index\the\pgfplotstableread@curcol}% }% \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. - \expandafter\pgfplotslistpushback\expandafter{\pgfplotstable@TMP}\to\pgfplotstable@colnames + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames + \ifpgfplots@tableread@to@listener + % create an associative container colindex -> colname + % for use in a listener. + \def\pgfplots@loc@TMPb{% + \expandafter\def\csname pgfplotstblread@colindex@for@name#1\endcsname}% + \expandafter\pgfplots@loc@TMPb\expandafter{\the\pgfplotstableread@curcol}% + \fi \advance\pgfplotstableread@curcol by1\relax } @@ -659,7 +1303,7 @@ \pgfplotstableread@NEXT } -\def\pgfplotstable@error#1{\PackageError{numtable}{#1}{Please refer to the manual for further information.}}% +\def\pgfplotstable@error#1{\pgfplots@error{#1}}% \def\pgfplotstableset{% @@ -675,11 +1319,11 @@ % returned into #1. % % Otherwise, \ifpgfplotstableread@foundcolnames is set to true. -\def\pgfplotstabletypeset@is@colname#1{% +\def\pgfplotstable@is@colname#1{% \expandafter\pgfplotstabletypeset@is@colname@#1\pgfplotstable@EOI \ifpgfplotstableread@foundcolnames \else - \let#1=\pgfplotstable@TMP + \let#1=\pgfplotstable@loc@TMPa \fi }% \def\pgfplotstabletypeset@is@colname@{% @@ -692,20 +1336,71 @@ } \def\pgfplotstabletypeset@is@colname@index@@{index}% \def\pgfplotstabletypeset@is@colname@index[#1]#2\pgfplotstable@EOI{% - \def\pgfplotstable@TMP{#1}% - \ifx\pgfplotstable@TMP\pgfplotstabletypeset@is@colname@index@@ + \def\pgfplotstable@loc@TMPa{#1}% + \ifx\pgfplotstable@loc@TMPa\pgfplotstabletypeset@is@colname@index@@ \pgfplotstableread@foundcolnamesfalse - \def\pgfplotstable@TMP{#2}% + \def\pgfplotstable@loc@TMPa{#2}% \else \pgfplotstableread@foundcolnamestrue \fi }% \def\pgfplotstabletypeset@is@colname@name#1\pgfplotstable@EOI{}% + \def\pgfplotstabletypeset@getfinalentry#1#2{% - \pgfkeysvalueof{/pgfplots/table/assign cell content/.@cmd}#1\pgfeov - \pgfkeysgetvalue{/pgfplots/table/@cell content}{#2}% + \begingroup + \def\pgfplotstablepartno{0}% + \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1}% + \pgfkeysvalueof{/pgfplots/table/preproc cell content/.@cmd}#1\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + % + \pgfkeysgetvalue{/pgfplots/table/assign cell content/.@cmd}\pgfplotstable@assigncell + \expandafter\pgfplotstable@assigncell\pgfmathresult\pgfeov + % + \pgfkeysgetvalue{/pgfplots/table/postproc cell content/.@cmd}\pgfplotstable@postproccellcontent + \ifx\pgfplotstable@postproccellcontent\pgfplotstable@postproccellcontent@EMPTY + \else + % apply postprocessing to final cell content. + % This is complicated if there is an '&' in '@cell content', + % so handle that specially! + % + % FIXME also support more than one '&' ? + \def\pgfplotstabletypeset@rawinput{#1}% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \expandafter\pgfutil@in@\expandafter&\expandafter{\pgfmathresult}% + \ifpgfutil@in@ + \expandafter\pgfplotstabletypeset@postproc@separately\pgfmathresult\pgfplotstable@EOI + \else + \pgfplotstable@postproccellcontent#1\pgfeov + \fi + \fi + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let#2=\pgfmathresult }% +% This routine invokes 'postproc cell content' for columns which +% contain the column separate '&'. +% +% #1 is the formatted number, the result of 'dec sep align +% #3 is the (unformatted) input number. +\def\pgfplotstabletypeset@postproc@separately#1\pgfplotstable@EOI{% + \def\pgfmathresult{#1}% + \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult + \expandafter\pgfplotstable@postproccellcontent\pgfplotstabletypeset@rawinput\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfplotstable@entry@a + % + \def\pgfplotstablepartno{1}% + \def\pgfmathresult{#2}% + \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult + \expandafter\pgfplotstable@postproccellcontent\pgfplotstabletypeset@rawinput\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry@a}% + \t@pgfplots@tokb=\expandafter{\pgfmathresult}% + \edef\pgfmathresult{\the\t@pgfplots@toka&\the\t@pgfplots@tokb}% + \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult +} + % processes the option 'assign column name' \def\pgfplotstabletypeset@assign@final@colname#1#2{% \pgfkeysifdefined{/pgfplots/table/assign column name/.@cmd}{% @@ -730,18 +1425,38 @@ }% +\def\pgfplotstable@insertemptycells@forbalance{% + \pgfutil@loop + \ifnum\c@pgfplotstable@counta<\pgfplotstable@firstnumrows\relax + % let's hope @getfinalentry handles empty strings! + \pgfplotstabletypeset@getfinalentry{}{\pgfplotstable@entry}% + \expandafter\pgfplotslistpushback\pgfplotstable@entry\to\pgfplotstable@col@processed + \pgfplotslistpushback\to\pgfplotstable@col@processed + \advance\c@pgfplotstable@counta by1\relax + \pgfutil@repeat +} + % TODO % - replace grouped list foreach by popfront-loop and use arrays % directly -> group only the pgfkeys eval \def\pgfplotstabletypeset@opt[#1]#2{% \begingroup + %-------------------------------------------------- + % \pgfutil@ifundefined{#2}{% + % \pgfplots@error{There is no such table '\string#2' loaded into memory. Maybe you meant to use '\string\pgfplotstabletypesetfile{\string#2}' instead of '\string\pgfplotstabletypeset{\string#2}'?}% + % \pgfplotslistnewempty#2 + % }{}% + %-------------------------------------------------- \def\pgfplotstablecol{\the\c@pgfplotstable@colindex}% \def\pgfplotstablerow{\the\c@pgfplotstable@rowindex}% -% \def\pgfplotstablecols{\the\c@pgfplotstable@numcols}% -% \def\pgfplotstablerows{\the\c@pgfplotstable@numrows}% + \def\pgfplotstablecols{\the\c@pgfplotstable@numcols}% + \def\pgfplotstablerows{\the\c@pgfplotstable@numrows}% \ifpgfplots@table@options@areset \else - \pgfplotstableset{/pgfplots/table/every table,#1}% + \pgfplotstablegetname{#2}\pgfplotstable@loc@TMPa + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \edef\pgfplotstable@loc@TMPa{/pgfplots/table/every table={\the\t@pgfplots@toka}}% + \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa,#1}% \fi \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% \ifx\pgfplotstable@colnames\pgfutil@empty @@ -757,37 +1472,55 @@ \let\c@pgfplotstable@rowindex=\c@pgf@countc \let\c@pgfplotstable@colindex=\c@pgf@countb \pgfplotslistsize\pgfplotstable@colnames\to\c@pgfplotstable@numcols + \def\pgfplotstable@firstnumrows{-1}% + \c@pgfplotstable@numrows=-1\relax \c@pgfplotstable@colindex=0\relax \pgfplotslistforeach\pgfplotstable@colnames\as\pgfplotstable@colname{% \c@pgfplotstable@rowindex=0\relax - \pgfplotstabletypeset@is@colname\pgfplotstable@colname + \pgfplotstable@is@colname\pgfplotstable@colname \ifpgfplotstableread@foundcolnames \else \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#2\to\pgfplotstable@colname \fi \pgfplotstablegetcolumnbyname\pgfplotstable@colname\of#2\to\pgfplotstable@col % + % Init number of *input* rows here. This may not be the same + % as the number of *output* rows (see the row predicate + % below). + % + % Accessable with \pgfplotstablerows in style keys. + \ifnum\c@pgfplotstable@numrows=-1\relax + \pgfplotslistsize\pgfplotstable@col\to\c@pgfplotstable@numrows + \global\c@pgfplotstable@numrows=\c@pgfplotstable@numrows + \fi + % % Set keys for columns! \ifodd\c@pgfplotstable@colindex - \pgfplotslist@TOK@a={every odd column}% + \t@pgfplots@toka={every odd column}% \else - \pgfplotslist@TOK@a={every even column}% + \t@pgfplots@toka={every even column}% \fi \ifnum\c@pgfplotstable@colindex=0\relax - \pgfplotslist@TOK@a=\expandafter{\the\pgfplotslist@TOK@a,every first column}% + \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}% + % \global\advance\c@pgfplotstable@colindex by1\relax \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols - \pgfplotslist@TOK@a=\expandafter{\the\pgfplotslist@TOK@a,every last column}% + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last column}% \fi - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@colname}% - \expandafter\pgfplotstable@checkspecialchars@pgfkeys\the\pgfplotslist@TOK@b\pgfplotstable@EOI + \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname}% + \expandafter\pgfplotstable@checkspecialchars@pgfkeys\the\t@pgfplots@tokb\pgfplotstable@EOI \ifpgfutil@in@ - \edef\pgfplotstable@TMP{\the\pgfplotslist@TOK@a,columns/{\the\pgfplotslist@TOK@b}/.try}% + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/{\the\t@pgfplots@tokb}/.try}% \else - \edef\pgfplotstable@TMP{\the\pgfplotslist@TOK@a,columns/\the\pgfplotslist@TOK@b/.try}% + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/\the\t@pgfplots@tokb/.try}% \fi - \expandafter\pgfplotstableset\expandafter{\pgfplotstable@TMP}% + \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 @@ -803,16 +1536,35 @@ }% % \pgfplotslistnewempty\pgfplotstable@col@processed + \c@pgfplotstable@counta=0 \pgfplotslistforeachungrouped\pgfplotstable@col\as\pgfplotstable@entry{% \pgfplotstableuserowtrue - \edef\pgfplotstable@TMP{\noexpand\pgfkeysvalueof{/pgfplots/table/row predicate/.@cmd}\the\c@pgfplotstable@rowindex}% - \pgfplotstable@TMP\pgfeov + \edef\pgfplotstable@loc@TMPa{\noexpand\pgfkeysvalueof{/pgfplots/table/row predicate/.@cmd}\the\c@pgfplotstable@rowindex}% + \pgfplotstable@loc@TMPa\pgfeov \ifpgfplotstableuserow - \expandafter\pgfplotstabletypeset@getfinalentry\expandafter{\pgfplotstable@entry}{\pgfplotstable@entry}% - \expandafter\pgfplotslistpushback\pgfplotstable@entry\to\pgfplotstable@col@processed + \ifnum\pgfplotstable@firstnumrows=-1\relax + \else + \ifnum\c@pgfplotstable@counta=\pgfplotstable@firstnumrows + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname@out}% + \pgfplots@warning{Unbalanced cell with content '\the\t@pgfplots@toka' of column '\the\t@pgfplots@tokb' has been skipped: row count \the\c@pgfplotstable@counta+1 > \pgfplotstable@firstnumrows (which is the number of rows in the first column)}% + \pgfplotstableuserowfalse + \fi + \fi + \ifpgfplotstableuserow + \expandafter\pgfplotstabletypeset@getfinalentry\expandafter{\pgfplotstable@entry}{\pgfplotstable@entry}% + \expandafter\pgfplotslistpushback\pgfplotstable@entry\to\pgfplotstable@col@processed + \advance\c@pgfplotstable@counta by1\relax + \fi \fi \advance\c@pgfplotstable@rowindex by1\relax }% + \ifnum\pgfplotstable@firstnumrows=-1\relax + \xdef\pgfplotstable@firstnumrows{\the\c@pgfplotstable@counta}% + \else + % balance columns: + \pgfplotstable@insertemptycells@forbalance + \fi {\globaldefs=1 \expandafter\pgfplotslistpushback\expandafter{\pgfplotstable@col@processed}\to\pgfplotstabletypeset@final@cols }% @@ -834,25 +1586,25 @@ % STEP 1.1: collect column types: \def\pgfplotstable@resulttypes{}% \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@resulttypes}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@coltype}% - \edef\pgfplotstable@resulttypes{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \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}% - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@entry}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% \ifx\pgfplotstable@resulttypes\pgfutil@empty - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka}% \else - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@resulttypes}% - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a{\the\pgfplotslist@TOK@b}}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% \fi % \pgfkeysgetvalue{/pgfplots/table/font}{\pgfplotstable@font}% \ifx\pgfplotstable@font\pgfutil@empty \else - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@font}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\noexpand\begingroup\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \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}% \fi % @@ -861,33 +1613,33 @@ \pgfplotstableset{every head row}% \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@before}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@after}% - \xdef\pgfplotstable@TMP{% - \noexpand\def\noexpand\pgfplotstable@before{\the\pgfplotslist@TOK@a}% - \noexpand\def\noexpand\pgfplotstable@after{\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \xdef\pgfplots@glob@TMPc{% + \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% + \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% }% \endgroup - \pgfplotstable@TMP + \pgfplots@glob@TMPc % insert 'before row' here: - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@before}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@b\the\pgfplotslist@TOK@a}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% + \edef\pgfplotstable@result{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% % \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% \advance\c@pgfplotstable@colindex by1\relax - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@colname@out \\}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname@out \\}% \else - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@colname@out &}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname@out &}% \fi - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% }% % insert 'after row' here: - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% % %\message{I have now \meaning\pgfplotstable@result.}% % Step 2: column contents. @@ -910,92 +1662,94 @@ \else \pgfplots@loop@CONTINUEfalse \fi - \loop + \pgfutil@loop \ifpgfplots@loop@CONTINUE \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed \pgfplotslistcheckempty\pgfplotstable@col@processed \ifpgfplotslistempty + % assume that each column has the same number of entries + % (normalised tables): \pgfplots@loop@CONTINUEfalse \else \ifnum\c@pgfplotstable@colindex=0\relax % Install styles for the next row. \begingroup \ifodd\c@pgfplotstable@rowindex - \pgfplotslist@TOK@a={every odd row}% + \t@pgfplots@toka={every odd row}% \else - \pgfplotslist@TOK@a={every even row}% + \t@pgfplots@toka={every even row}% \fi \ifnum\c@pgfplotstable@rowindex=0\relax - \pgfplotslist@TOK@a=\expandafter{\the\pgfplotslist@TOK@a,every first row}% + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first row}% \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@TMP{\the\pgfplotslist@TOK@a,every row no \the\c@pgfplotstable@rowindex/.try,every last row}% + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try,every last row}% \else - \edef\pgfplotstable@TMP{\the\pgfplotslist@TOK@a,every row no \the\c@pgfplotstable@rowindex/.try}% + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% \fi - \expandafter\pgfplotstableset\expandafter{\pgfplotstable@TMP}% + \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa}% \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@before}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@after}% - \xdef\pgfplotstable@TMP{% - \noexpand\def\noexpand\pgfplotstable@before{\the\pgfplotslist@TOK@a}% - \noexpand\def\noexpand\pgfplotstable@after{\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \xdef\pgfplots@glob@TMPc{% + \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% + \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% }% \endgroup - \pgfplotstable@TMP + \pgfplots@glob@TMPc % insert 'before row' here: - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@before}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@b\the\pgfplotslist@TOK@a}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% + \edef\pgfplotstable@result{\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 - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@entry \\}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry \\}% \else - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@entry &}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry &}% \fi - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \edef\pgfplotstable@result{\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: - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% \advance\c@pgfplotstable@rowindex by1\relax \fi %\message{I have now \meaning\pgfplotstable@result.}% \fi - \repeat - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% + \pgfutil@repeat + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% \pgfkeysgetvalue{/pgfplots/table/end table}{\pgfplotstable@entry}% - \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@entry}% - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% \ifx\pgfplotstable@font\pgfutil@empty \else - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result\endgroup}% - \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@result\endgroup}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka}% \fi \ifpgfplotstabletypesetdebug - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% \immediate\write16{------- PGFPLOTSTABLE DEBUG MODE: --------}% - \immediate\write16{{\the\pgfplotslist@TOK@a}}% + \immediate\write16{{\the\t@pgfplots@toka}}% \fi \pgfkeysgetvalue{/pgfplots/table/outfile}{\pgfplotstable@entry}% \ifx\pgfplotstable@entry\pgfutil@empty \else \begingroup \immediate\openout\pgfplotstable@outfile=\pgfplotstable@entry\relax - \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% - \immediate\write\pgfplotstable@outfile{\the\pgfplotslist@TOK@a}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \immediate\write\pgfplotstable@outfile{\the\t@pgfplots@toka}% \immediate\closeout\pgfplotstable@outfile \endgroup \fi @@ -1003,5 +1757,130 @@ \endgroup }% +\newif\ifpgfplotstable@isfirstrow +\newif\ifpgfplotstable@islastrow +\newif\ifpgfplotstablecreatecol@isreallynew + +\def\pgfplotstablecreatecol@opt[#1]#2#3{% + \begingroup + \pgfplotstableset{columns=,#1}% + \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% + \ifx\pgfplotstable@colnames\pgfutil@empty + \pgfplotstablegetcolumnlist#3\to\pgfplotstable@colnames + \else + \expandafter\pgfplotslistnew\expandafter\pgfplotstable@colnames\expandafter{\pgfplotstable@colnames}% + \fi + \pgfplotslistnewempty\pgfplotstable@colnames@real + \t@pgfplots@toka=\expandafter{#2}% this should handle macro names in '#2'. + \edef\pgfplotstable@newcolname{\the\t@pgfplots@toka}% + \global\pgfplotstablecreatecol@isreallynewtrue + \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@colname{% + \pgfplotstable@is@colname\pgfplotstable@colname + \ifpgfplotstableread@foundcolnames + \expandafter\pgfplotslistpushback\expandafter{\pgfplotstable@colname}\to\pgfplotstable@colnames@real + \else + \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#2\to\pgfplotstable@colname + \expandafter\pgfplotslistpushback\expandafter{\pgfplotstable@colname}\to\pgfplotstable@colnames@real + \fi + \ifx\pgfplotstable@colname\pgfplotstable@newcolname + \global\pgfplotstablecreatecol@isreallynewfalse + \fi + }% + \pgfplotstable@isfirstrowtrue + \pgfplotstable@islastrowfalse + \pgfplotslistnewempty\pgfplotstable@newcol + % + \let\c@pgfplotstable@numrows=\c@pgf@countd + \let\c@pgfplotstable@rowindex=\c@pgf@countc + \c@pgfplotstable@numrows=-1\relax + \c@pgfplotstable@rowindex=0\relax + \def\pgfplotstablerow{\the\c@pgfplotstable@rowindex}% + \def\pgfplotstablerows{\the\c@pgfplotstable@numrows}% + % + \def\prevrow##1{\csname pgfplotstablecreate@prev@##1\endcsname}% + \def\thisrow##1{\csname pgfplotstablecreate@cur@##1\endcsname}% + \def\nextrow##1{\csname pgfplotstablecreate@next@##1\endcsname}% + \def\getprevrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@prev@##1\endcsname}% + \def\getthisrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@cur@##1\endcsname}% + \def\getnextrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@next@##1\endcsname}% + % + \pgfplots@loop@CONTINUEtrue + % allow this here to accumulate something. + \let\pgfmathaccuma=\pgfutil@empty + \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 + \pgfplotslistfront\pgfplotstable@colnames\to\pgfplotstable@colname + \expandafter\pgfplotslistsize\csname\string#3@\pgfplotstable@colname\endcsname\to\c@pgfplotstable@numrows + \fi + \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@colname{% + \expandafter\pgfplotstableresolvecolname\expandafter{\pgfplotstable@colname}\of#3\to\pgfplotstable@real@colname + \ifpgfplotstable@isfirstrow + \expandafter\pgfplotslistcheckempty\csname\string#3@\pgfplotstable@real@colname\endcsname + \ifpgfplotslistempty + % the table is completely empty. break. + \pgfplots@loop@CONTINUEfalse + \else + \expandafter\let\csname pgfplotstablecreate@prev@\pgfplotstable@colname\endcsname=\pgfutil@empty + \expandafter\pgfplotslistpopfront\csname\string#3@\pgfplotstable@real@colname\endcsname\to\pgfplotstable@entry + \expandafter\let\csname pgfplotstablecreate@cur@\pgfplotstable@colname\endcsname=\pgfplotstable@entry + \fi + \else + \expandafter\let\expandafter\pgfplotstable@prev\csname pgfplotstablecreate@cur@\pgfplotstable@colname\endcsname + \expandafter\let\csname pgfplotstablecreate@prev@\pgfplotstable@colname\endcsname=\pgfplotstable@prev + % + \expandafter\let\expandafter\pgfplotstable@next\csname pgfplotstablecreate@next@\pgfplotstable@colname\endcsname + \expandafter\let\csname pgfplotstablecreate@cur@\pgfplotstable@colname\endcsname=\pgfplotstable@next + \fi + \expandafter\pgfplotslistcheckempty\csname\string#3@\pgfplotstable@real@colname\endcsname + \ifpgfplotslistempty + \expandafter\let\csname pgfplotstablecreate@next@\pgfplotstable@colname\endcsname=\pgfutil@empty + \pgfplotstable@islastrowtrue + \else + \expandafter\pgfplotslistpopfront\csname\string#3@\pgfplotstable@real@colname\endcsname\to\pgfplotstable@entry + \expandafter\let\csname pgfplotstablecreate@next@\pgfplotstable@colname\endcsname=\pgfplotstable@entry + \fi + }% + \ifpgfplots@loop@CONTINUE + % Compute content: + % + \begingroup + \ifpgfplotstable@isfirstrow + \pgfkeysvalueof{/pgfplots/table/create col/assign first/.@cmd}\pgfeov + \else + \ifpgfplotstable@islastrow + \pgfkeysvalueof{/pgfplots/table/create col/assign last/.@cmd}\pgfeov + \else + \pgfkeysvalueof{/pgfplots/table/create col/assign/.@cmd}\pgfeov + \fi + \fi + \pgfkeysgetvalue{/pgfplots/table/create col/next content}{\pgfplotstable@entry}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% + \t@pgfplots@tokb=\expandafter{\pgfmathaccuma}% + \xdef\pgfplots@glob@TMPc{% + \noexpand\def\noexpand\pgfplotstable@entry{\the\t@pgfplots@toka}% + \noexpand\def\noexpand\pgfmathaccuma{\the\t@pgfplots@tokb}% + }% + \pgfmath@smuggleone\pgfmathaccumb + \endgroup + \pgfplots@glob@TMPc + \expandafter\pgfplotslistpushback\expandafter{\pgfplotstable@entry}\to\pgfplotstable@newcol + % + \ifpgfplotstable@islastrow + \pgfplots@loop@CONTINUEfalse + \fi + \fi + \pgfplotstable@isfirstrowfalse + \advance\c@pgfplotstable@rowindex by1\relax + \pgfutil@repeat + \global\let\pgfplots@glob@TMPc=\pgfplotstable@newcol + \global\let\pgfplots@glob@TMPb=\pgfplotstable@newcolname + \endgroup + \ifpgfplotstablecreatecol@isreallynew + \expandafter\pgfplotslistpushback\expandafter{\pgfplots@glob@TMPb}\to#3 + \fi + \expandafter\let\csname\string#3@\pgfplots@glob@TMPb\endcsname=\pgfplots@glob@TMPc +}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex index 628fc7f374e..ce780e866b2 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -1,11 +1,11 @@ -\pgfkeysifdefined{/pgf/number format/1000 sep/.@cmd}{\endinput}{} %-------------------------------------------------- -% \pgfutil@ifundefined{pgfplothandlerybarinterval} +% \pgfutil@ifundefined{pgfmathfloattosci} % {}% % {\endinput}% %-------------------------------------------------- +\pgfkeysifdefined{/pgf/number format/@dec sep mark}{\endinput}{} -\immediate\write16{Package pgfplots: loading support code for older PGF versions...} +\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 diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex index 9e037470f6e..def32476da4 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex @@ -42,6 +42,41 @@ } % ====================================================== + +% pgfutil@loop (from plain.tex) + +\def\pgfutil@loop#1\pgfutil@repeat{\def\pgfutil@body{#1}\pgfutil@iterate} +\def\pgfutil@iterate{\pgfutil@body \let\pgfutil@next\pgfutil@iterate \else\let\pgfutil@next\relax\fi \pgfutil@next} +\let\pgfutil@repeat=\fi % this makes \loop...\if...\repeat skippable + +\def\pgfqpointxy#1#2{% + \pgf@x=#1\pgf@xx% + \advance\pgf@x by #2\pgf@yx% + \pgf@y=#1\pgf@xy% + \advance\pgf@y by #2\pgf@yy} +\def\pgfqpointxyz#1#2#3{% + \pgf@x=#1\pgf@xx% + \advance\pgf@x by #2\pgf@yx% + \advance\pgf@x by #3\pgf@zx% + \pgf@y=#1\pgf@xy% + \advance\pgf@y by #2\pgf@yy% + \advance\pgf@y by #3\pgf@zy} +\def\pgfcoordinate#1#2{% + \edef\pgf@temp{#1}% + \ifx\pgf@temp\pgfutil@empty% do nothing + \else% + \pgf@process{\pgfpointtransformed{#2}}% + \expandafter\gdef\csname pgf@sh@ns@#1\endcsname{coordinate}% + \expandafter\xdef\csname pgf@sh@np@#1\endcsname{% + \noexpand\def\noexpand\centerpoint{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + } + \expandafter\gdef\csname pgf@sh@nt@#1\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% + \expandafter\global\expandafter\let\csname pgf@sh@ma@#1\endcsname\pgfutil@empty% + \expandafter\gdef\csname pgf@sh@pi@#1\endcsname{\pgfpictureid}% + \fi% +} +% ====================================================== + \def\pgfutilensuremath#1{% \ifmmode#1\else$#1$\fi } @@ -56,6 +91,49 @@ \tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright} \tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft} +% the 'every mark' style is new: +\tikzset{ + every mark/.style={}, + mark options/.style={% + every mark/.style={#1}% + }} +\def\tikz@@@plot{% + \def\pgfplotlastpoint{\pgfpointorigin}% + \tikz@plot@handler% + \tikz@plot@data% + \global\let\tikz@@@temp=\pgfplotlastpoint% + \ifx\tikz@plot@mark\pgfutil@empty% + \else% + % Marks are drawn after the path. + \setbox\tikz@figbox=\hbox{% + \unhbox\tikz@figbox% + \hbox{{% + \pgfinterruptpath% + \pgfscope% + \let\tikz@options=\pgfutil@empty% + \let\tikz@transform=\pgfutil@empty% + \tikzset{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 + \tikz@plot@data% + \endpgfscope + \endpgfinterruptpath% + }}% + }% + \fi% + \global\setbox\tikz@tempbox=\copy\tikz@figbox% + %\global\let\tikz@after@path@smuggle=\tikz@after@path + \endgroup% + \setbox\tikz@figbox=\box\tikz@tempbox% + \tikz@make@last@position{\tikz@@@temp}% + %\expandafter\tikz@scan@next@command\tikz@after@path@smuggle% + \tikz@scan@next@command% +} + diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex index cd5c328c700..ed490784564 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex @@ -627,6 +627,7 @@ % /bar/foo/... /pgf/key filters/is descendant of/.code={% \ifnum\pgfkeyscasenumber=0 +%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is UNKNOWN. Calling unknown handler.}% % unknown options shall be processed with the % unknown-handlers. \pgfkeysfiltercontinuetrue diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex index 0d120a8b722..0d120a8b722 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex index cb479f8dc73..e199d44f811 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -34,6 +34,8 @@ % can be changed with options. \def\pgfmathfloat@round@precision{2} +\gdef\pgfmathfloat@glob@TMP{} + % Computes a normalised floating point representation for #1 of the % form @@ -87,7 +89,8 @@ % -> \pgfmathresult = 11.41212e2 \def\pgfmathfloatparsenumber#1{% \begingroup - \expandafter\pgfmathfloatparsenumber@impl#1\pgfmathfloat@EOI + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% \fi @@ -101,7 +104,8 @@ \def\pgfmathfloatqparsenumber#1{% \begingroup \let\pgfmathfloatparsenumber@sanitize@digit=\relax - \expandafter\pgfmathfloatparsenumber@impl#1\pgfmathfloat@EOI + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% \fi @@ -140,13 +144,13 @@ \def\pgfmathfloattomacro#1#2#3#4{% \begingroup \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \xdef\pgfmathfloat@TMPB{% + \xdef\pgfmathfloat@glob@TMP{% \noexpand\def\noexpand#2{\the\pgfmathfloat@a@S}% \noexpand\def\noexpand#3{\the\pgfmathfloat@a@Mtok}% \noexpand\def\noexpand#4{\the\pgfmathfloat@a@E}% }% \endgroup - \pgfmathfloat@TMPB + \pgfmathfloat@glob@TMP } % Takes a floating point number #1 as input and writes flags to count @@ -174,7 +178,7 @@ \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}% } % Extracts the exponent of #1 into the count register #2. -\def\pgfmathfloatgetmantisse#1#2{% +\def\pgfmathfloatgetexponent#1#2{% \expandafter\pgfmathfloat@decompose@E#1\relax{#2}% } @@ -291,28 +295,60 @@ \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 +}% +\pgfmathfloatsetextprecision{2}% + % 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-2\relax% compensate for shift above + \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 }% -\def\pgfmathfloattoextentedprecision@@#1.#2#3#4\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2#3.#4}% -}% % 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-2\relax + \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI \else \edef\pgfmathresult{#1}% @@ -375,9 +411,9 @@ % % ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S. \def\pgfmathfloatadd@shift#1#2#3{% - \pgf@xa=#1 pt - \pgfmathfloat@a@S=#3 - \advance\pgfmathfloat@a@S by-#2 + \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 @@ -400,9 +436,9 @@ \divide\pgf@xa by10000\relax \divide\pgf@xa by10000\relax \else - \pgf@xa=0pt + \pgf@xa=0pt% \fi - #2=#3 + #2=#3\relax \edef#1{\pgf@sys@tonumber\pgf@xa}% } @@ -465,6 +501,211 @@ \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: @@ -489,6 +730,27 @@ } \let\pgfmathfloattofixed=\pgfmathfloattofixed@ +% Converts a floating point number to scientific format 1.234e5. +% +% This operation is very fast. +\def\pgfmathfloattosci@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + \def\pgfmathresult{0.0e0}% + \or + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \or + \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \or\def\pgfmathresult{nan}% + \or\def\pgfmathresult{inf}% + \or\def\pgfmathresult{-inf}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloattosci=\pgfmathfloattosci@ + % Divides or multiplies the input number by 10^#4 using an arithmetic % left/right shift. % @@ -567,7 +829,7 @@ % 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 - \loop + \pgfutil@loop \ifnum\pgfmathlog@loopcount<3 \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmathfloat@b@M}}}% \let\pgfmathlog@tmp=\pgfmathresult @@ -576,7 +838,7 @@ \advance\pgfmathfloat@b@M by\pgfmath@ya \advance\pgfmathfloat@b@M by-1pt \advance\pgfmathlog@loopcount by1 - \repeat + \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 @@ -663,9 +925,11 @@ \endgroup } +% see \pgfmathprintnumber@fixed@style for docs \def\pgfmathprintnumber@fixed@styleDEFAULT#1#2#3e#4\relax{% \begingroup \pgfkeysgetvalue{/pgf/number format/set decimal separator}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP + \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP \c@pgf@counta=#4\relax \def\pgfmathresult{}% @@ -673,21 +937,27 @@ \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI \else \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI% + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + \endgroup + \let\pgfmathresult=\pgfmathfloat@glob@TMP \fi \pgfmath@smuggleone\pgfmathresult \endgroup } \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1.#2\pgfmathfloat@EOI{% \ifpgfmathprintnumberskipzeroperiod - \def\pgfmathfloat@TMPB{#1}% - \ifx\pgfmathfloatparsenumber@tok@ZERO\pgfmathfloat@TMPB + \def\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloatparsenumber@tok@ZERO\pgfmathfloat@loc@TMPb \else - \def\pgfmathfloat@TMPC{-0}% - \ifx\pgfmathfloat@TMPC\pgfmathfloat@TMPB + \def\pgfmathfloat@loc@TMPc{-0}% + \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb \def\pgfmathresult{-}% \else - \def\pgfmathfloat@TMPC{+0}% - \ifx\pgfmathfloat@TMPC\pgfmathfloat@TMPB + \def\pgfmathfloat@loc@TMPc{+0}% + \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb \def\pgfmathresult{+}% \else \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI @@ -699,10 +969,11 @@ \fi \begingroup \toks0=\expandafter{\pgfmathresult}% - \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP #2}% - \xdef\pgfmathfloat@TMPB{\the\toks0\the\toks1}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% + \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP #2}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }% \endgroup - \let\pgfmathresult=\pgfmathfloat@TMPB + \let\pgfmathresult=\pgfmathfloat@glob@TMP }% \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod{% \ifx\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP\pgfutil@empty @@ -727,22 +998,27 @@ \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT } \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign#1{% - \def\pgfmathfloat@TMPB{#1}% - \ifx\pgfmathfloat@TMPB\pgfmathfloatparsenumber@tok@MINUS - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% FIXME: '-' is enough!? - \let\pgfmathfloat@TMPB=\pgfutil@empty + \def\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% + \let\pgfmathfloat@loc@TMPb=\pgfutil@empty \else - \ifx\pgfmathfloat@TMPB\pgfmathfloatparsenumber@tok@PLUS - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% FIXME: '+' is enough? - \let\pgfmathfloat@TMPB=\pgfutil@empty - \fi\fi + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% + \let\pgfmathfloat@loc@TMPb=\pgfutil@empty + \else + \ifpgfmathprintnumber@showpositive + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult +}% + \fi + \fi + \fi \ifnum\c@pgf@counta>0 \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@TMPB + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@loc@TMPb }% \else \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@TMPB + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@loc@TMPb }% \fi \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT @@ -764,9 +1040,9 @@ \begingroup \toks0=\expandafter{\pgfmathresult}% \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% - \xdef\pgfmathfloat@TMPB{\the\toks0\the\toks1}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% \endgroup - \let\pgfmathresult=\pgfmathfloat@TMPB + \let\pgfmathresult=\pgfmathfloat@glob@TMP \fi \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT } @@ -778,9 +1054,9 @@ \begingroup \toks0=\expandafter{\pgfmathresult}% \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% - \xdef\pgfmathfloat@TMPB{\the\toks0\the\toks1}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% \endgroup - \let\pgfmathresult=\pgfmathfloat@TMPB + \let\pgfmathresult=\pgfmathfloat@glob@TMP \fi \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird% @@ -788,17 +1064,33 @@ \else % in thise case, #1#2#3 are expected to be % \pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI - \def\pgfmathfloat@TMPB{\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI}% - \def\pgfmathfloat@TMPC{#1#2#3}% - \ifx\pgfmathfloat@TMPC\pgfmathfloat@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}% - \fi + %-------------------------------------------------- + % \def\pgfmathfloat@loc@TMPb{\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI}% + % \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}% + % \fi + %-------------------------------------------------- \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax \fi \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT } -\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI{% +\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall#1{% + \def\pgfmathfloat@loc@TMPb{#1}% + \let\pgfmathfloat@loc@TMPc=\pgfutil@empty + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS + \else + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS + \else + \ifpgfmathprintnumber@showpositive + \def\pgfmathfloat@loc@TMPc{+}% + \fi + \fi + \fi + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@\pgfmathfloat@loc@TMPc#1% +} +\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI{% \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% }% @@ -878,22 +1170,40 @@ % #2: mantisse % #3: exponent % #4: CODE to display if the mantisse is drawn. -% #5: CODE to display if the mantisse is NOT draw. +% #5: CODE to display if the mantisse is NOT draw. (unused) % #6: CODE to display the exponent. \def\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax#4#5#6{% - \expandafter\ifcase#1\relax + \pgfkeysgetvalue{/pgf/number format/@sci exponent mark}\pgfmathfloatrounddisplaystyle@e@mark + \ifcase#1\relax \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax% - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #4#6}% + \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% \or\pgfmathprintnumber@fixed@style{#2}#1#2e0\relax% - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #4#6}% - \or\pgfmathprintnumber@fixed@style{#2}#1#2e0\relax% - \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter-\pgfmathresult #4#6}% - \or\def\pgfmathresult{NaN}% - \or\def\pgfmathresult{\infty}% - \or\def\pgfmathresult{-\infty}% + \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% + \or\pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax% + \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% + \or + \pgfmathfloatrounddisplaystyle@shared@impl@{NaN}{}% + \or + \ifpgfmathprintnumber@showpositive + \pgfmathfloatrounddisplaystyle@shared@impl@{+\infty}{}% + \else + \pgfmathfloatrounddisplaystyle@shared@impl@{\infty}{}% + \fi + \or + \pgfmathfloatrounddisplaystyle@shared@impl@{-\infty}{}% \fi } +% #1: the part before the exponent code +% #2: the part for the exponent code. +\def\pgfmathfloatrounddisplaystyle@shared@impl@#1#2{% + {\toks0={#1}% + \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + }% + \let\pgfmathresult=\pgfmathfloat@glob@TMP +}% + \def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{% \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}% } @@ -904,27 +1214,27 @@ \ifnum#3<0\relax {\count0=#3\relax \multiply\count0 by-1 - \xdef\pgfmathfloat@TMPB{e{-}\the\count0}% + \xdef\pgfmathfloat@glob@TMP{e{-}\the\count0}% }% - \let\pgfmathresult=\pgfmathfloat@TMPB + \let\pgfmathresult=\pgfmathfloat@glob@TMP \else \def\pgfmathresult{e{+}#3}% \fi - \def\pgfmathfloat@TMPB{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% - \expandafter\pgfmathfloat@TMPB\expandafter{\pgfmathresult}% + \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% + \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% } \def\pgfmathfloatrounddisplaystyle@E#1#2e#3\relax{% \ifnum#3<0\relax {\count0=#3\relax \multiply\count0 by-1 - \xdef\pgfmathfloat@TMPB{E{-}\the\count0}% + \xdef\pgfmathfloat@glob@TMP{E{-}\the\count0}% }% - \let\pgfmathresult=\pgfmathfloat@TMPB + \let\pgfmathresult=\pgfmathfloat@glob@TMP \else \def\pgfmathresult{E{+}#3}% \fi - \def\pgfmathfloat@TMPB{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% - \expandafter\pgfmathfloat@TMPB\expandafter{\pgfmathresult}% + \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% + \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% } % A macro which takes three arguments, sign, mantisse and exponent and @@ -942,13 +1252,12 @@ \newif\ifpgfmathfloat@usezerofill@sci \newif\ifpgfmathfloat@usezerofill@fixed \newif\ifpgfmathprintnumber@assumemathmode +\newif\ifpgfmathprintnumber@showpositive \pgfkeys{% /pgf/number format/.is family, /pgf/number format, fixed/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED}, - %fixed zerofill/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED@ZEROFILL}, - %sci zerofill/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI@ZEROFILL}, sci/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI}, std/.code= \pgfmath@set@number@printer{pgfmathprintnumber@STD}, int detect/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@DETECT}, @@ -965,10 +1274,16 @@ fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT}, set decimal separator/.initial=, dec sep/.style={/pgf/number format/set decimal separator=#1}, + @dec sep mark/.initial=, + @sci exponent mark/.initial=, set thousands separator/.initial=, 1000 sep/.style={/pgf/number format/set thousands separator=#1}, 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, + showpos/.default=true, + print sign/.is if=pgfmathprintnumber@showpositive, + print sign/.default=true, skip 0./.is if=pgfmathprintnumberskipzeroperiod, skip 0./.default=true, skip 0.= false, @@ -1071,8 +1386,8 @@ \ifpgfmathfloatroundmayneedrenormalize \pgfmathfloat@a@E=#3\relax \advance\pgfmathfloat@a@E by1 - \edef\pgfmathfloat@TMPB{\noexpand\pgfmathprintnumber@fixed@style{\pgfmathresult}#1#2e\the\pgfmathfloat@a@E}% - \pgfmathfloat@TMPB\relax% + \edef\pgfmathfloat@loc@TMPb{\noexpand\pgfmathprintnumber@fixed@style{\pgfmathresult}#1#2e\the\pgfmathfloat@a@E}% + \pgfmathfloat@loc@TMPb\relax% \else \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax% \fi @@ -1138,26 +1453,26 @@ \begingroup \pgfmathprintnumber@{#1}% \ifpgfmathprintnumber@assumemathmode - \global\let\pgfmathfloat@TMPB=\pgfmathresult + \global\let\pgfmathfloat@glob@TMP=\pgfmathresult \else \toks0=\expandafter{\pgfmathresult}% - \xdef\pgfmathfloat@TMPB{\noexpand\pgfutilensuremath{\the\toks0}}% + \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}% \fi \endgroup - \let#2=\pgfmathfloat@TMPB + \let#2=\pgfmathfloat@glob@TMP }% \def\pgfmathprintnumberto@OPT[#1]#2#3{% \begingroup \pgfqkeys{/pgf/number format}{#1}% \pgfmathprintnumber@{#2}% \ifpgfmathprintnumber@assumemathmode - \global\let\pgfmathfloat@TMPB=\pgfmathresult + \global\let\pgfmathfloat@glob@TMP=\pgfmathresult \else \toks0=\expandafter{\pgfmathresult}% - \xdef\pgfmathfloat@TMPB{\noexpand\pgfutilensuremath{\the\toks0}}% + \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}% \fi \endgroup - \let#3=\pgfmathfloat@TMPB + \let#3=\pgfmathfloat@glob@TMP }% @@ -1610,14 +1925,14 @@ \def\pgfmathfloattofixed@impl#1.#2\relax{% \ifnum\pgfmathfloat@a@E<0 \pgfmathfloat@a@Mtok={0.}% - \loop + \pgfutil@loop \ifnum\pgfmathfloat@a@E<-1 \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% \advance\pgfmathfloat@a@E by1 - \repeat - \def\pgfmathfloat@TMPB{#2}% - \def\pgfmathfloat@TMPC{0}% - \ifx\pgfmathfloat@TMPB\pgfmathfloat@TMPC + \pgfutil@repeat + \def\pgfmathfloat@loc@TMPb{#2}% + \def\pgfmathfloat@loc@TMPc{0}% + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPc \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1}% \else \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}% @@ -1636,13 +1951,13 @@ \def\pgfmathfloattofixed@impl@collectmantisse#1#2\count#3{% \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}% \advance\pgfmathfloat@a@E by-1% - \def\pgfmathfloat@TMPB{#2}% - \ifx\pgfmathfloat@TMPB\pgfutil@empty - \loop + \def\pgfmathfloat@loc@TMPb{#2}% + \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty + \pgfutil@loop \ifnum\pgfmathfloat@a@E>0% \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% \advance\pgfmathfloat@a@E by-1% - \repeat + \pgfutil@repeat \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .0}% \else \ifnum\pgfmathfloat@a@E=0 @@ -1768,17 +2083,17 @@ \def\pgfmathfloatparsenumber@impl@readnan an{% \pgfmathfloat@a@S=3\relax% - \pgfmathfloat@a@Mtok={nan}% + \pgfmathfloat@a@Mtok={0.0}% \pgfmathfloat@a@E=0% \pgfmathfloatparsenumber@impl@finish } \def\pgfmathfloatparsenumber@impl@readinf nf{% \ifnum\pgfmathfloat@a@S=1 \pgfmathfloat@a@S=4\relax% - \pgfmathfloat@a@Mtok={inf}% + \pgfmathfloat@a@Mtok={0.0}% \else \pgfmathfloat@a@S=5\relax% - \pgfmathfloat@a@Mtok={-inf}% + \pgfmathfloat@a@Mtok={0.0}% \fi \pgfmathfloat@a@E=0% \pgfmathfloatparsenumber@impl@finish diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index ed8e8e611ec..53b602b0d9a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -24,18 +24,14 @@ % %-------------------------------------------- -\input pgfplotsliststructure.code.tex -\input pgfplotsarray.code.tex -\input pgfplotstable.code.tex +\input pgfplotsutil.code.tex \input pgfplotsoldpgfsupp_loader.code.tex \input pgfplots.stackedplots.code.tex \usetikzlibrary{decorations,decorations.pathmorphing,decorations.pathreplacing} % FIXME: reduce number of variables! -\newtoks\pgfplots@toka -\newcount\pgfplots@ticknum \newif\ifpgfplots@xislinear \newif\ifpgfplots@yislinear \newcount\pgfplots@numplots @@ -43,11 +39,8 @@ \newdimen\pgfplots@xcoordmaxTEX \newdimen\pgfplots@ycoordminTEX \newdimen\pgfplots@ycoordmaxTEX -\newdimen\pgfplots@tmpa -\newdimen\pgfplots@tmpb \newif\ifpgfplots@warn@for@filter@discards \newif\ifpgfplots@isuniformtick -\newif\ifpgfplots@addplot@table@from@macro \newif\ifpgfplots@clip@limits \newif\ifpgfplots@enlargelimits \newif\ifpgfplots@enlargelimits@rel@thresh @@ -61,11 +54,16 @@ \newif\ifpgfplots@xmajorgrids \newif\ifpgfplots@yminorgrids \newif\ifpgfplots@ymajorgrids -\newif\ifpgfplots@scaled@ticks +\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@disabledatascaling -\newif\ifpgfplots@hide +\newif\ifpgfplots@hide@x +\newif\ifpgfplots@hide@y \newif\ifpgfplots@is@old@list@format \newif\ifpgfplots@errorbars@enabled \newif\ifpgfplots@scale@only@axis @@ -75,9 +73,7 @@ \newif\ifpgfplots@stackedmode \newif\ifpgfplots@stacked@reverse \newif\ifpgfplots@stacked@plus -\let\pgfplots@TMP=\pgfutil@empty -\let\pgfplots@TMPB=\pgfutil@empty -\let\pgfplots@TMPC=\pgfutil@empty +\newif\ifpgfplots@plot@file@skipfirst \let\pgfnodepartimagebox=\pgfnodeparttextbox \newif\ifpgfplots@collect@firstplot@astick @@ -85,58 +81,10 @@ \def\pgfplots@errorbars@xdirection{0}% pre-init, see below \def\pgfplots@errorbars@ydirection{0}% -\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% -\def\pgfplots@warning#1{\pgfplots@message{#1}}% -\def\pgfplots@message#1{% - \immediate\write16{#1}% -}% - -\def\pgfplots@leftover{} -\def\pgfplots@rightover{} \def\axisdefaultwidth{240pt} \def\axisdefaultheight{207pt} -% Assigns list contents #2 to a list macro #1. -% -% The list contents may be provided in one of two formats: -% a) in the (deprecated) list format 'first\\second\\thirst\\' -% or -% b) in the PGF foreach list format 'first,second,third'. -\def\pgfplots@assign@list#1#2{% - \def\pgfplots@TMP{#2}% - \ifx\pgfplots@TMP\pgfutil@empty - \pgfplotslistnewempty#1% - \else - \pgfplots@check@backwards@compatible@list@format #2\\\pgfplots@EOI - \ifpgfplots@is@old@list@format - \pgfplotslistnew#1{#2}% - \else - \pgfplots@foreach@to@list{#2}\to#1 - \fi - \fi -}% - -\def\pgfplots@EOI{\pgfplots@EOI}% - -% Sets the boolean \ifpgfplots@is@old@list@format to true if and only -% if the input is a list in the format '{first\\second\\}'. -% -% This format is deprecated, but is still provided for backwards -% compatibility. -% -% Usage: -% \pgfplots@check@backwards@compatible@list@format <argument>'\\'\pgfplots@EOI -% you NEED to append '\\\pgfplots@EOI' at the end. -\def\pgfplots@check@backwards@compatible@list@format#1\\#2\pgfplots@EOI{% - \def\pgfplots@TMP{#2}% - \ifx\pgfplots@TMP\pgfutil@empty - \pgfplots@is@old@list@formatfalse - \else - \pgfplots@is@old@list@formattrue - \fi -}% - % Creates a named plot cycle list. @@ -148,38 +96,38 @@ \def\pgfcreateplotcyclelist#1#2{\pgfplots@assign@list#1{#2}} \pgfcreateplotcyclelist{\blackwhiteplotspeclist}{% - mark options={fill=gray},mark=*\\% - mark options={fill=gray},mark=square*\\% - mark options={fill=gray},mark=otimes*\\% + every mark/.append style={fill=gray},mark=*\\% + every mark/.append style={fill=gray},mark=square*\\% + every mark/.append style={fill=gray},mark=otimes*\\% mark=star\\% - mark options={fill=gray},mark=diamond*\\% - densely dashed,mark options={solid,fill=gray},mark=*\\% - densely dashed,mark options={solid,fill=gray},mark=square*\\% - densely dashed,mark options={solid,fill=gray},mark=otimes*\\% - densely dashed,mark options={solid},mark=star\\% - densely dashed,mark options={solid,fill=gray},mark=diamond*\\% + every mark/.append style={fill=gray},mark=diamond*\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=*\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=square*\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=otimes*\\% + densely dashed,every mark/.append style={solid},mark=star\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=diamond*\\% } \pgfcreateplotcyclelist{\coloredplotspeclist}{% - blue,mark options={fill=blue!80!black},mark=*\\% - red,mark options={fill=red!80!black},mark=square*\\% - brown!60!black,mark options={fill=brown!80!black},mark=otimes*\\% + 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*\\% black,mark=star\\% - blue,mark options={fill=blue!80!black},mark=diamond*\\% - red,densely dashed,mark options={solid,fill=red!80!black},mark=*\\% - brown!60!black,densely dashed,mark options={solid,fill=brown!80!black},mark=square*\\% - black,densely dashed,mark options={solid,fill=gray},mark=otimes*\\% - blue,densely dashed,mark=star,mark options=solid\\% - red,densely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\% + blue,every mark/.append style={fill=blue!80!black},mark=diamond*\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\% + brown!60!black,densely dashed,every mark/.append style={solid,fill=brown!80!black},mark=square*\\% + black,densely dashed,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*\\% } -\def\pgfplotsset{\pgfqkeys{/pgfplots}} +\def\pgfplotsset#{\pgfqkeys{/pgfplots}} \def\pgfplotsdeprecatedstylecheck#1{% \pgfkeysifdefined{#1/.@cmd}{% \begingroup \edef\pgfkeyscurrentkey{#1}% \pgfkeyssplitpath - \pgfplots@warning{Warning: Loading deprecated style option + \pgfplots@warning{Loading deprecated style option \pgfkeyscurrentpath/\pgfkeyscurrentname. Please replace '\string\tikzstyle{\pgfkeyscurrentname}' with '\string\pgfplotsset{\pgfkeyscurrentname/.style={}}' @@ -241,6 +189,32 @@ /pgfplots/every tick/.style={very thin,gray}, /pgfplots/every tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every tick}}, /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 outer x axis line/.style={}, + /pgfplots/every outer y 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}, + }, + /pgfplots/y axis line style/.style={ + /pgfplots/every outer y axis line/.append style={#1}, + /pgfplots/every inner y 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/inner axis line style/.style={ + /pgfplots/every inner x axis line/.append style={#1}, + /pgfplots/every inner y axis line/.append style={#1}% + }, + /pgfplots/axis line style/.style={ + /pgfplots/inner axis line style={#1}, + /pgfplots/outer axis line style={#1}% + }, + /pgfplots/separate axis lines/.is if=pgfplots@separate@axis@lines, + /pgfplots/separate axis lines/.default=true, /pgfplots/every minor tick/.style={}, /pgfplots/every minor tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor tick}}, /pgfplots/every minor tick/.belongs to family=/pgfplots/style commands, @@ -265,7 +239,8 @@ /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 axis grid/.style={help lines}, + %/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}}, /pgfplots/every axis grid/.belongs to family=/pgfplots/style commands, /pgfplots/every minor grid/.style={}, @@ -298,7 +273,9 @@ /pgfplots/every x tick label/.style={}, /pgfplots/every x tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every x tick label}}, /pgfplots/every x tick label/.belongs to family=/pgfplots/style commands, - /pgfplots/every extra x tick/.style={}, + /pgfplots/every extra x tick/.style={ + /pgfplots/log identify minor tick positions=true, + }, /pgfplots/every extra x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every extra x tick}}, /pgfplots/every extra x tick/.belongs to family=/pgfplots/style commands, /pgfplots/extra x tick style/.belongs to family=/pgfplots/style commands, @@ -311,7 +288,9 @@ /pgfplots/every y tick label/.style={}, /pgfplots/every y tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick label}}, /pgfplots/every y tick label/.belongs to family=/pgfplots/style commands, - /pgfplots/every extra y tick/.style={}, + /pgfplots/every extra y tick/.style={ + /pgfplots/log identify minor tick positions=true, + }, /pgfplots/every extra y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every extra y tick}}, /pgfplots/every extra y tick/.belongs to family=/pgfplots/style commands, /pgfplots/extra y tick style/.belongs to family=/pgfplots/style commands, @@ -390,10 +369,15 @@ /pgfplots/ytickten=, /pgfplots/tick scale label code/.code={$\cdot 10^{#1}$}, /pgfplots/tick scale label code/.belongs to family=/pgfplots/tick, - /pgfplots/scaled ticks/.is if=pgfplots@scaled@ticks, - /pgfplots/scaled ticks/.default=false, - /pgfplots/scaled ticks/.belongs to family=/pgfplots/tick, - /pgfplots/scaled ticks=true, + /pgfplots/scaled x ticks/.is if=pgfplots@scaled@ticks@x, + /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/.belongs to family=/pgfplots/tick, + /pgfplots/scaled y ticks=true, + /pgfplots/scaled ticks/.style={% + /pgfplots/scaled x ticks=#1, + /pgfplots/scaled y 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, @@ -429,7 +413,7 @@ /pgfplots/log plot exponent style/.belongs to family=/pgfplots/tick, /pgfplots/log identify minor tick positions/.is if=pgfplots@identify@log@minor@tick@pos, /pgfplots/log identify minor tick positions/.belongs to family=/pgfplots/tick, - /pgfplots/log identify minor tick positions=true, + /pgfplots/log identify minor tick positions=false, /pgfplots/log number format code/.code={{% \pgfmathlogtologten@{#1}% \ifpgfplots@identify@log@minor@tick@pos @@ -446,32 +430,78 @@ /pgfplots/log number format code/.belongs to family=/pgfplots/tick, /pgfplots/log base 10 number format code/.code={$10^{\pgfmathprintnumber{#1}}$}, /pgfplots/log base 10 number format code/.belongs to family=/pgfplots/tick, -% sets \pgfplots@tickposnum to -% left=0 -% right=1 -% both=2 - /pgfplots/tickpos/.is choice, +% sets \pgfplots@[xy]tickposnum to + /pgfplots/xtick pos/.is choice, + /pgfplots/xtick pos/.belongs to family=/pgfplots/tick, + /pgfplots/xtick pos/left/.code ={\def\pgfplots@xtickposnum{1}}, + /pgfplots/xtick pos/left/.belongs to family=/pgfplots/tick, + /pgfplots/xtick pos/right/.code ={\def\pgfplots@xtickposnum{3}}, + /pgfplots/xtick pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/xtick pos/both/.code ={\def\pgfplots@xtickposnum{0}}, + /pgfplots/xtick pos/both/.belongs to family=/pgfplots/tick, + /pgfplots/xtick pos=both, + /pgfplots/ytick pos/.is choice, + /pgfplots/ytick pos/.belongs to family=/pgfplots/tick, + /pgfplots/ytick pos/left/.code ={\def\pgfplots@ytickposnum{1}}, + /pgfplots/ytick pos/left/.belongs to family=/pgfplots/tick, + /pgfplots/ytick pos/right/.code ={\def\pgfplots@ytickposnum{3}}, + /pgfplots/ytick pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/ytick pos/both/.code ={\def\pgfplots@ytickposnum{0}}, + /pgfplots/ytick pos/both/.belongs to family=/pgfplots/tick, + /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/tickpos/.belongs to family=/pgfplots/tick, - /pgfplots/tickpos/left/.code ={\def\pgfplots@xtickposnum{1}\def\pgfplots@ytickposnum{1}}, - /pgfplots/tickpos/left/.belongs to family=/pgfplots/tick, - /pgfplots/tickpos/right/.code ={\def\pgfplots@xtickposnum{3}\def\pgfplots@ytickposnum{3}}, - /pgfplots/tickpos/right/.belongs to family=/pgfplots/tick, - /pgfplots/tickpos/both/.code ={\def\pgfplots@xtickposnum{0}\def\pgfplots@ytickposnum{0}}, - /pgfplots/tickpos/both/.belongs to family=/pgfplots/tick, - /pgfplots/tickpos=both, +% sets the tick LABEL position, \pgfplots@[xy]ticklabelposnum + /pgfplots/xticklabel pos/.is choice, + /pgfplots/xticklabel pos/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelposnum{0}}, + /pgfplots/xticklabel pos/default/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel pos/left/.code ={\def\pgfplots@xticklabelposnum{1}}, + /pgfplots/xticklabel pos/left/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel pos/right/.code ={\def\pgfplots@xticklabelposnum{3}}, + /pgfplots/xticklabel pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel pos=default, + /pgfplots/yticklabel pos/.is choice, + /pgfplots/yticklabel pos/.belongs to family=/pgfplots/tick, + /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelposnum{0}}, + /pgfplots/yticklabel pos/default/.belongs to family=/pgfplots/tick, + /pgfplots/yticklabel pos/left/.code ={\def\pgfplots@yticklabelposnum{1}}, + /pgfplots/yticklabel pos/left/.belongs to family=/pgfplots/tick, + /pgfplots/yticklabel pos/right/.code ={\def\pgfplots@yticklabelposnum{3}}, + /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}}, % sets \pgfplots@{x,y}tickalignnum to % inside=0 % outside=1 % center=2 - /pgfplots/tick align/.is choice, + /pgfplots/xtick align/.is choice, + /pgfplots/xtick align/.belongs to family=/pgfplots/tick, + /pgfplots/xtick align/inside/.code ={\def\pgfplots@xtickalignnum{0}}, + /pgfplots/xtick align/inside/.belongs to family=/pgfplots/tick, + /pgfplots/xtick align/outside/.code ={\def\pgfplots@xtickalignnum{1}}, + /pgfplots/xtick align/outside/.belongs to family=/pgfplots/tick, + /pgfplots/xtick align/center/.code ={\def\pgfplots@xtickalignnum{2}}, + /pgfplots/xtick align/center/.belongs to family=/pgfplots/tick, + /pgfplots/xtick align=inside, + /pgfplots/ytick align/.is choice, + /pgfplots/ytick align/.belongs to family=/pgfplots/tick, + /pgfplots/ytick align/inside/.code ={\def\pgfplots@ytickalignnum{0}}, + /pgfplots/ytick align/inside/.belongs to family=/pgfplots/tick, + /pgfplots/ytick align/outside/.code ={\def\pgfplots@ytickalignnum{1}}, + /pgfplots/ytick align/outside/.belongs to family=/pgfplots/tick, + /pgfplots/ytick align/center/.code ={\def\pgfplots@ytickalignnum{2}}, + /pgfplots/ytick align/center/.belongs to family=/pgfplots/tick, + /pgfplots/ytick align=inside, /pgfplots/tick align/.belongs to family=/pgfplots/tick, - /pgfplots/tick align/inside/.code ={\def\pgfplots@xtickalignnum{0}\def\pgfplots@ytickalignnum{0}}, - /pgfplots/tick align/inside/.belongs to family=/pgfplots/tick, - /pgfplots/tick align/outside/.code ={\def\pgfplots@xtickalignnum{1}\def\pgfplots@ytickalignnum{1}}, - /pgfplots/tick align/outside/.belongs to family=/pgfplots/tick, - /pgfplots/tick align/center/.code ={\def\pgfplots@xtickalignnum{2}\def\pgfplots@ytickalignnum{2}}, - /pgfplots/tick align/center/.belongs to family=/pgfplots/tick, - /pgfplots/tick align=inside, + /pgfplots/tick align/.style={% + /pgfplots/xtick align=#1, + /pgfplots/ytick align=#1, + },% % 'axis' options: /pgfplots/anchor/.belongs to family=/pgfplots, /pgfplots/anchor/.store in= \pgfplots@anchorname, @@ -565,6 +595,8 @@ /pgfplots/ymajorgrids/.default=true, /pgfplots/ymajorgrids/.belongs to family=/pgfplots/tick, % legend options: + /pgfplots/legend entries/.initial={}, + /pgfplots/legend entries/.belongs to family=/pgfplots/legend, /pgfplots/legend columns/.store in=\pgfplots@legend@columns, /pgfplots/legend columns/.belongs to family=/pgfplots/legend, /pgfplots/legend columns=1, @@ -587,21 +619,20 @@ }, /pgfplots/legend image code/.belongs to family=/pgfplots/legend, % axis description options: - /pgfplots/title/.store in= \pgfplots@title, + /pgfplots/title/.initial=, /pgfplots/title/.belongs to family=/pgfplots/descriptions, - /pgfplots/title=, - /pgfplots/xlabel/.store in= \pgfplots@xlabel, + /pgfplots/xlabel/.initial=, /pgfplots/xlabel/.belongs to family=/pgfplots/descriptions, - /pgfplots/xlabel=, - /pgfplots/ylabel/.store in= \pgfplots@ylabel, + /pgfplots/ylabel/.initial=, /pgfplots/ylabel/.belongs to family=/pgfplots/descriptions, - /pgfplots/ylabel=, /pgfplots/before end axis/.code=, /pgfplots/after end axis/.code=, /pgfplots/extra description/.code=, /pgfplots/extra description/.belongs to family=/pgfplots/descriptions, % axis options: - /pgfplots/at/.code={\tikz@scan@one@point\pgfplots@set@at#1}, + /pgfplots/at/.code={% + \pgfplots@assert@tikzinternal@exists{tikz@scan@one@point}% + \tikz@scan@one@point\pgfplots@set@at#1}, /pgfplots/at/.belongs to family=/pgfplots, /pgfplots/clip limits/.is if=pgfplots@clip@limits, /pgfplots/clip limits/.default=true, @@ -666,9 +697,14 @@ /pgfplots/execute at end plot/.store in= \pgfplots@execute@at@end@plot, /pgfplots/execute at end plot/.belongs to family=/pgfplots, /pgfplots/execute at end plot=, - /pgfplots/enlargelimits/.store in= \pgfplots@enlargelimits, - /pgfplots/enlargelimits/.belongs to family=/pgfplots, - /pgfplots/enlargelimits=auto, + /pgfplots/enlarge x limits/.initial=auto, + /pgfplots/enlarge x limits/.default=true, + /pgfplots/enlarge y limits/.initial=auto, + /pgfplots/enlarge y limits/.default=true, + /pgfplots/enlargelimits/.style={% + /pgfplots/enlarge x limits=#1,% + /pgfplots/enlarge y limits=#1,% + },% /pgfplots/enlargelimits/.default=true, /pgfplots/x/.store in= \pgfplots@x, /pgfplots/x/.belongs to family=/pgfplots, @@ -801,46 +837,122 @@ /pgfplots/disabledatascaling/.default=true, /pgfplots/disabledatascaling/.belongs to family=/pgfplots, /pgfplots/disabledatascaling=false, - /pgfplots/hide axis/.is if=pgfplots@hide, + /pgfplots/hide x axis/.is if=pgfplots@hide@x, + /pgfplots/hide x axis/.default=true, + /pgfplots/hide x axis=false, + /pgfplots/hide y axis/.is if=pgfplots@hide@y, + /pgfplots/hide y axis/.default=true, + /pgfplots/hide y axis=false, + /pgfplots/hide axis/.style={% + /pgfplots/hide x axis=#1, + /pgfplots/hide y axis=#1, + }, /pgfplots/hide axis/.default=true, - /pgfplots/hide axis/.belongs to family=/pgfplots, - /pgfplots/hide axis=false, + /pgfplots/every non boxed x axis/.style={% + xtick align=center, + enlarge x limits=false, + x axis line style={-stealth} + }, + /pgfplots/every non boxed y axis/.style={% + ytick align=center, + enlarge y limits=false, + y axis line style={-stealth} + }, + /pgfplots/every boxed x axis/.style={}, + /pgfplots/every boxed y axis/.style={}, +% /pgfplots/hide axis/.belongs to family=/pgfplots, % sets \pgfplots@xaxislinesnum to % box=0 % bottom=1 -% middle=2 +% middle=2 ( aliased with center ) % top=3 + /pgfplots/axis x line*/.is choice, + /pgfplots/axis x line*/box/.code ={\def\pgfplots@xaxislinesnum{0}\def\pgfplots@xtickposnum{0}}, + /pgfplots/axis x line*/bottom/.code ={\def\pgfplots@xaxislinesnum{1}\def\pgfplots@xtickposnum{1}}, + /pgfplots/axis x line*/middle/.code ={\def\pgfplots@xaxislinesnum{2}\def\pgfplots@xtickposnum{2}}, + /pgfplots/axis x line*/center/.style ={/pgfplots/axis x line*/middle}, + /pgfplots/axis x line*/top/.code ={\def\pgfplots@xaxislinesnum{3}\def\pgfplots@xtickposnum{3}}, + /pgfplots/axis x line*/none/.code ={\def\pgfplots@xaxislinesnum{4}\def\pgfplots@xtickposnum{4}}, + /pgfplots/axis x line*=box, + % /pgfplots/axis x line/.is choice, - /pgfplots/axis x line/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis x line/box/.code ={\def\pgfplots@xaxislinesnum{0}\def\pgfplots@xtickposnum{0}}, - /pgfplots/axis x line/box/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis x line/bottom/.code ={\def\pgfplots@xaxislinesnum{1}\def\pgfplots@xtickposnum{1}}, - /pgfplots/axis x line/bottom/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis x line/middle/.code ={\def\pgfplots@xaxislinesnum{2}\def\pgfplots@xtickposnum{2}}, - /pgfplots/axis x line/middle/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis x line/top/.code ={\def\pgfplots@xaxislinesnum{3}\def\pgfplots@xtickposnum{3}}, - /pgfplots/axis x line/top/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis x line/none/.code ={\def\pgfplots@xaxislinesnum{4}\def\pgfplots@xtickposnum{4}}, - /pgfplots/axis x line/none/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis x line=box, + /pgfplots/axis x line/box/.style ={ + /pgfplots/axis x line*/box, + /pgfplots/every boxed x axis + }, + /pgfplots/axis x line/bottom/.style ={ + /pgfplots/axis x line*/bottom, + /pgfplots/every non boxed x axis + }, + /pgfplots/axis x line/middle/.code ={% + \ifnum\pgfplots@yaxislinesnum=3 % if 'axis y line==right' then + \pgfkeysalso{/pgfplots/every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% + \else + \pgfkeysalso{/pgfplots/every axis x label/.style={at={(current axis.right of origin)},anchor=south east}}% + \fi + \pgfkeysalso{/pgfplots/axis x line*/middle, + /pgfplots/every non boxed x axis}% + }, + /pgfplots/axis x line/center/.style ={/pgfplots/axis x line/middle}, + /pgfplots/axis x line/top/.code ={ + \ifnum\pgfplots@yaxislinesnum=2 % if 'axis y line==center' then + \pgfkeysalso{ + /pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}% + \fi + \pgfkeysalso{% + /pgfplots/axis x line*/top, + /pgfplots/every axis x label/.style={at={(0.5,1)},anchor=south,yshift=15pt}, + /pgfplots/every non boxed x axis}% + }, + /pgfplots/axis x line/none/.style ={axis x line*/none,hide x axis}, % sets \pgfplots@yaxislinesnum to % box=0 % left=1 -% center=2 +% center=2 ( aliased with middle ) % right=3 + /pgfplots/axis y line*/.is choice, + /pgfplots/axis y line*/box/.code ={\def\pgfplots@yaxislinesnum{0}\def\pgfplots@ytickposnum{0}}, + /pgfplots/axis y line*/left/.code ={\def\pgfplots@yaxislinesnum{1}\def\pgfplots@ytickposnum{1}}, + /pgfplots/axis y line*/center/.code ={\def\pgfplots@yaxislinesnum{2}\def\pgfplots@ytickposnum{2}}, + /pgfplots/axis y line*/middle/.style ={/pgfplots/axis y line*/center}, + /pgfplots/axis y line*/right/.code ={\def\pgfplots@yaxislinesnum{3}\def\pgfplots@ytickposnum{3}}, + /pgfplots/axis y line*/none/.code ={\def\pgfplots@yaxislinesnum{4}\def\pgfplots@ytickposnum{4}}, + /pgfplots/axis y line*=box, + % /pgfplots/axis y line/.is choice, - /pgfplots/axis y line/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis y line/box/.code ={\def\pgfplots@yaxislinesnum{0}\def\pgfplots@ytickposnum{0}}, - /pgfplots/axis y line/box/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis y line/left/.code ={\def\pgfplots@yaxislinesnum{1}\def\pgfplots@ytickposnum{1}}, - /pgfplots/axis y line/left/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis y line/center/.code ={\def\pgfplots@yaxislinesnum{2}\def\pgfplots@ytickposnum{2}}, - /pgfplots/axis y line/center/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis y line/right/.code ={\def\pgfplots@yaxislinesnum{3}\def\pgfplots@ytickposnum{3}}, - /pgfplots/axis y line/right/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis y line/none/.code ={\def\pgfplots@yaxislinesnum{4}\def\pgfplots@ytickposnum{4}}, - /pgfplots/axis y line/none/.belongs to family=/pgfplots, %/axis, - /pgfplots/axis y line=box, + /pgfplots/axis y line/box/.style ={ + /pgfplots/axis y line*/box, + /pgfplots/every boxed y axis + }, + /pgfplots/axis y line/left/.style ={ + /pgfplots/axis y line*/left, + /pgfplots/every non boxed y axis + }, + /pgfplots/axis y line/center/.code ={ + \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then + \pgfkeysalso{% + /pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}% + \else + \pgfkeysalso{% + /pgfplots/every axis y label/.style={at={(current axis.above origin)},anchor=north west}}% + \fi + \pgfkeysalso{% + /pgfplots/axis y line*/center, + /pgfplots/every non boxed y axis}% + }, + /pgfplots/axis y line/middle/.style ={/pgfplots/axis y line/center}, + /pgfplots/axis y 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 y line*/right, + %every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt}, + every axis y label/.style={at={(1,0.5)},xshift=33pt,rotate=90}, + /pgfplots/every non boxed y axis + }% + },% + /pgfplots/axis y line/none/.style ={axis y line*/none,hide y axis}, % set \pgfplots@xaxisdiscontnum % none = 0 % crunch = 1 @@ -951,9 +1063,19 @@ } }, /pgfplots/area cycle list/.style={bar cycle list}, + /pgfplots/area legend/.style={% + /pgfplots/legend image code/.code={% + \draw[##1] (0cm,-0.1cm) rectangle (0.6cm,0.1cm); + }% + }, + /pgfplots/area style/.style={% + area cycle list, + area legend, + axis on top, + }, /pgfplots/ybar/.style={ bar cycle list, - tick align=outside, + xtick align=outside, /pgfplots/legend image code/.code={\draw[##1,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, /pgf/bar shift={% % total width = n*w + (n-1)*skip @@ -967,7 +1089,7 @@ /pgfplots/ybar/.belongs to family=/pgfplots, /pgfplots/xbar/.style={ bar cycle list, - tick align=outside, + ytick align=outside, /pgfplots/legend image code/.code={\draw[##1,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, /pgf/bar shift={% % total width = n*w + (n-1)*skip @@ -983,6 +1105,7 @@ bar cycle list, x tick label as interval, xmajorgrids, + xtick align=outside, % xtick=data, /pgfplots/legend image code/.code={\draw[##1,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, bar interval width={#1/\numplots}, @@ -996,6 +1119,7 @@ y tick label as interval, % ytick=data, ymajorgrids, + ytick align=outside, /pgfplots/legend image code/.code={\draw[##1,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, bar interval width={#1/\numplots}, bar interval shift={(\plotnum+0.5)/\numplots}, @@ -1043,8 +1167,40 @@ x tick label as interval, xticklabel={$\pgfmathprintnumber{\tick}$ -- $\pgfmathprintnumber{\nexttick}$} }, + /pgfplots/plot file/skip first/.is if=pgfplots@plot@file@skipfirst, + /pgfplots/plot file/skip first/.default=true, + /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, + /pgfplots/axis on top/.default=true, + /pgfplots/every crossref picture/.style={% + baseline,yshift=0.3em + }, + /pgfplots/x coord trafo/.code={}, + /pgfplots/x coord inv trafo/.code={}, + /pgfplots/y coord trafo/.code={}, + /pgfplots/y coord inv trafo/.code={}, +} + +{ +\pgfkeysdef{/pgfplots/empty command key}{}% +\pgfkeysgetvalue{/pgfplots/empty command key/.@cmd}\pgfplots@loc@TMPa +\global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa } +\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 xticklabel style=x tick label style; +\pgfplots@cmdkey@alias yticklabel style=y 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; + \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. @@ -1161,15 +1317,13 @@ % converts a comma-separated list (PGF foreach) to my internal list % structure. \long\def\pgfplots@foreach@to@list#1\to#2{% - \pgfplotslistnewempty\pgfplots@TMP + \global\pgfplotslistnewempty\pgfplots@glob@TMPa \begingroup - \foreach \i in {#1} {% - \globaldefs=1 - \expandafter\pgfplotslistpushback\i\to\pgfplots@TMP - \globaldefs=0 + \foreach \pgfplots@i in {#1} {% + \expandafter\pgfplotslistpushbackglobal\pgfplots@i\to\pgfplots@glob@TMPa }% \endgroup - \pgfplotslistcopy\pgfplots@TMP\to#2\relax + \pgfplotslistcopy\pgfplots@glob@TMPa\to#2\relax } % Several tick options: @@ -1204,11 +1358,11 @@ \expandafter\let\expandafter\pgfplots@cur@max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname % \ifx\pgfplots@cur@min@unscaled\pgfutil@empty - \xdef\pgfplots@TMP{\csname pgfplots@#1min\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1min\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% \let\pgfplots@cur@min@unscaled=\pgfmathresult - \xdef\pgfplots@TMP{\csname pgfplots@#1max\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1max\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% \let\pgfplots@cur@max@unscaled=\pgfmathresult \fi % @@ -1217,40 +1371,39 @@ \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E \pgfmathfloat@b@E=\pgfmathfloat@a@E \fi - \xdef\pgfplots@TMP{\pgfplots@scale@ticks@above@exponent}% - \expandafter\ifnum\pgfplots@TMP<\pgfmathfloat@b@E + \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@TMP{\the\pgfmathfloat@b@E}% + \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% \else - \xdef\pgfplots@TMP{\pgfplots@scale@ticks@below@exponent}% - \expandafter\ifnum\pgfplots@TMP>\pgfmathfloat@b@E + \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@TMP{\the\pgfmathfloat@b@E}% + \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% \else % no scaling necessary: - \xdef\pgfplots@TMP{0}% + \xdef\pgfplots@glob@TMPa{0}% \fi \fi \endgroup - \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@TMP% + \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% } % x-axis tick labels for #1th tick -% #1: options -% #2: the axis (x or y) -% #3: the value -% #4,#5: coordinates for tikz -% #6: ticknumber -\def\pgfplots@show@ticklabel[#1]#2#3(#4,#5)#6{{% - \csname ifpgfplots@#2ticklabel@interval\endcsname - \pgfmathparse{#4}% +% #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{#5}% + \pgfmathparse{#4}% \edef\pgfplots@show@ticklabel@coord@y@new{\pgfmathresult pt}% % - \pgfplots@show@ticklabel@{#2}{#3}% + \pgfplots@show@ticklabel@{#1}{#2}% \let\nexttick=\tick \ifx\pgfplots@show@ticklabel@LASTTICK\pgfutil@empty % its the first call. Simply remember arguments and wait @@ -1259,26 +1412,24 @@ % acquire options of first interval boundary: \pgfplots@show@ticklabel@LASTTICK % compute new node position: - \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#2\endcsname + \csname pgfplots@show@ticklabel@coord@#2@new\endcsname)}% - \expandafter\edef\csname pgfplots@show@ticklabel@coord@#2\endcsname{\pgfmathresult pt}% + \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% - \pgfplots@toka=\expandafter{\pgfplots@show@ticklabel@opts}% - \xdef\pgfplots@TMP{at (\pgfplots@show@ticklabel@coord@x,\pgfplots@show@ticklabel@coord@y) [\the\pgfplots@toka]}% - \expandafter\node\pgfplots@TMP - {\csname pgfplots@#2ticklabel\endcsname};% + \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@opts{#1}% \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\def\noexpand\pgfplots@show@ticklabel@num{\the#6}% + \noexpand\edef\noexpand\pgfplots@show@ticklabel@num{#5}% }% \else - \let\ticknum=#6\relax% - \pgfplots@show@ticklabel@{#2}{#3}% - \node at (#4,#5) [#1] {\csname pgfplots@#2ticklabel\endcsname};% + \let\ticknum=#5\relax% + \pgfplots@show@ticklabel@{#1}{#2}% + \node at (#3,#4) {\csname pgfplots@#1ticklabel\endcsname};% \fi }} @@ -1290,57 +1441,63 @@ \def\pgfplots@show@ticklabel@#1#2{% \csname ifpgfplots@apply@datatrafo@#1\endcsname \csname pgfplots@inverse@datascaletrafo@#1\endcsname{#2}% - % FIXME: do that for any linear axis, also if no datascale is - % applied! - \ifpgfplots@scaled@ticks + \pgfplots@if{pgfplots@scaled@ticks@#1}{% \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% - \fi + }\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{% - \pgfplotslistselect\ticknum\of\pgfplots@xticklabels\to\tick + \pgfplotslistselectorempty\ticknum\of\pgfplots@xticklabels\to\tick \tick } \def\pgfplots@user@ticklabel@list@y{% - \pgfplotslistselect\ticknum\of\pgfplots@yticklabels\to\tick + \pgfplotslistselectorempty\ticknum\of\pgfplots@yticklabels\to\tick \tick } \def\pgfplots@user@extra@ticklabel@list@x{% - \pgfplotslistselect\ticknum\of\pgfplots@extra@xticklabels\to\tick + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@xticklabels\to\tick \tick } \def\pgfplots@user@extra@ticklabel@list@y{% - \pgfplotslistselect\ticknum\of\pgfplots@extra@yticklabels\to\tick + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@yticklabels\to\tick \tick } -\def\axisdefaultticklabel{% - $\pgfmathprintnumber{\tick}$% -} - -\def\axisdefaultticklabellog{% - \pgfkeysgetvalue{/pgfplots/log number format code/.@cmd}\pgfplots@log@label@style - \expandafter\pgfplots@log@label@style\tick\pgfeov -} - -\def\pgfplots@show@label#1{% +% #1 axis (x or y) +% #2 the label +\def\pgfplots@show@label#1#2{% \node [/pgfplots/every axis label,% /pgfplots/every axis #1 label] - {\csname pgfplots@#1label\endcsname}; + {#2}; } -\def\pgfplots@show@title{% +\def\pgfplots@show@title#1{% \node% [/pgfplots/every axis title] - {\pgfplots@title}; + {#1}; } % Check if a label does not cross the x-axis @@ -1370,187 +1527,95 @@ \fi } -\def\pgfplots@drawyaxis@placecomputedtick#1[#2]{% - \ifcase\pgfplots@ytickalignnum\relax - \def\pgfplots@ytick@offset{0pt} +% 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 - \def\pgfplots@ytick@offset{#1} + % (\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 - \def\pgfplots@ytick@offset{.5*#1} + % (\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 - %\pgfplots@ytick@check@tickshow - %\ifpgfplots@tickshow - \draw[#2] - \ifcase\pgfplots@ytickposnum - (\pgfplots@xcoordminTEX-\pgfplots@ytick@offset, \pgfplots@tmpa) -- ++( #1, 0pt) +}% - (\pgfplots@xcoordmaxTEX+\pgfplots@ytick@offset, \pgfplots@tmpa) -- ++(-#1, 0pt) - \or - (\pgfplots@xcoordminTEX-\pgfplots@ytick@offset, \pgfplots@tmpa) -- ++( #1, 0pt) - \or - (\pgfplots@ZERO@x -\pgfplots@ytick@offset, \pgfplots@tmpa) -- ++( #1, 0pt) - \or - (\pgfplots@xcoordmaxTEX+\pgfplots@ytick@offset, \pgfplots@tmpa) -- ++(-#1, 0pt) - \fi - ; - %\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[#1]{% - \draw[#1] - (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@tmpa) - -- (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@tmpa) - ; +\def\pgfplots@drawyaxis@placecomputedgridline{% + \pgfpathmoveto{\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@tmpa}}% + \pgfpathlineto{\pgfqpoint{\pgfplots@xcoordmaxTEX}{\pgfplots@tmpa}}% }% -% Y-Achsen und Achsenbeschriftung LOG: -% 1: Ticks \newif\ifpgfplots@needsminorloop -\def\pgfplots@drawyaxis#1{% - \ifpgfplots@yislinear - \ifpgfplots@scaled@ticks - \pgfplots@init@scaled@tick@for y% - \fi - \fi - \begingroup - \global\pgfplots@ticknum=0 - \edef\pgfplots@TMP{#1}% - \ifx\pgfplots@TMP\pgfutil@empty - \else - \ifpgfplots@yminorticks - \pgfplots@needsminorlooptrue - \fi - \ifpgfplots@yminorgrids - \pgfplots@needsminorlooptrue - \fi - \ifpgfplots@needsminorloop - \ifpgfplots@yislinear - \begingroup - \c@pgf@counta=\pgfplots@minor@ytick@num\relax - \advance\c@pgf@counta by1\relax - \pgfplots@tmpb=\pgfplots@tick@distance@y pt - \divide\pgfplots@tmpb by\c@pgf@counta - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpb}}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgfplots@minor@tick@dist=\pgfmathresult - \else - \def\pgfplots@minor@ytick@num{9}% - \fi - \fi - \xdef\pgfplots@show@ticklabel@LASTTICK{}% - \foreach \y in {#1} { - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\y}}% - \pgfplots@ytick@check@tickshow - % - \ifpgfplots@tickshow - \ifdim\pgfplots@tmpa<\pgfplots@ycoordminTEX - \else - \ifdim\pgfplots@tmpa>\pgfplots@ycoordmaxTEX - \else - \ifcase\pgfplots@ytickalignnum\relax - \def\pgfplots@ytick@offset{0pt}% - \or - \def\pgfplots@ytick@offset{\pgfplots@tickwidth}% - \or - \def\pgfplots@ytick@offset{.5*\pgfplots@tickwidth}% - \fi - \ifcase\pgfplots@ytickposnum - \def\pgfplots@ytick@origin{\pgfplots@xcoordminTEX}% - \or - \def\pgfplots@ytick@origin{\pgfplots@xcoordminTEX}% - \or - \def\pgfplots@ytick@origin{\pgfplots@ZERO@x}% - \or - \def\pgfplots@ytick@origin{\pgfplots@xcoordmaxTEX}% - \fi - % Axis tick labels:` - \ifnum\pgfplots@ytickposnum=3\relax - \pgfplots@show@ticklabel - [right,/pgfplots/every tick label,/pgfplots/every y tick label]% - {y}{\y}% - (\pgfplots@ytick@origin+\pgfplots@ytick@offset,\pgfplots@tmpa)% - {\pgfplots@ticknum}% - \else - \pgfplots@show@ticklabel - [left,/pgfplots/every tick label,/pgfplots/every y tick label]% - {y}{\y}% - (\pgfplots@ytick@origin-\pgfplots@ytick@offset,\pgfplots@tmpa)% - {\pgfplots@ticknum}% - \fi - \fi - \fi - \fi - \global\advance\pgfplots@ticknum by1 - \scope - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \clip (\pgfplots@xcoordminTEX-5cm, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX+5cm, \pgfplots@ycoordmaxTEX); - \endpgfinterruptboundingbox% - % Y-ticks left and/or right - % in log: - % log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9 - \ifpgfplots@needsminorloop - \foreach \i in {1,...,\pgfplots@minor@ytick@num} { - % this code here is scoped inside of \foreach. - \ifpgfplots@yislinear - \pgfextracty{\pgfplots@tmpb}{\pgfpointxy{0}{\i*\pgfplots@minor@tick@dist}}% - \else - \pgfextracty{\pgfplots@tmpb}{\pgfpointxy{0}{\logi\i}}% - \fi - \advance\pgfplots@tmpa by\pgfplots@tmpb - \ifdim\pgfplots@tmpa<\pgfplots@ycoordminTEX - \else - \ifdim\pgfplots@tmpa>\pgfplots@ycoordmaxTEX - \else - \ifpgfplots@yminorgrids - \pgfplots@drawyaxis@placecomputedgridline[/pgfplots/every axis grid,/pgfplots/every minor grid,/pgfplots/every axis y grid,/pgfplots/every minor y grid]% - \fi - \ifpgfplots@yminorticks - \pgfplots@drawyaxis@placecomputedtick\pgfplots@subtickwidth[/pgfplots/every tick,/pgfplots/every minor tick,/pgfplots/every tick,/pgfplots/every minor y tick]% - \fi - \fi - \fi - }% - \fi - \ifdim\pgfplots@tmpa<\pgfplots@ycoordminTEX - \else - \ifdim\pgfplots@tmpa>\pgfplots@ycoordmaxTEX - \else - \ifpgfplots@ymajorgrids - \pgfplots@drawyaxis@placecomputedgridline[/pgfplots/every axis grid,/pgfplots/every major grid, /pgfplots/every axis y grid,/pgfplots/every major y grid]% - \fi - \ifpgfplots@tickshow - \ifpgfplots@ymajorticks - \pgfplots@drawyaxis@placecomputedtick\pgfplots@tickwidth[/pgfplots/every tick,/pgfplots/every major tick,/pgfplots/every y tick,/pgfplots/every major y tick]% - \fi - \fi - \fi - \fi - \endscope - }% - \fi - \pgfplots@draw@tick@scale@label@for y% - \endgroup -} \def\pgfplots@draw@tick@scale@label@for#1{% \csname ifpgfplots@#1islinear\endcsname - \ifpgfplots@scaled@ticks + \pgfplots@if{pgfplots@scaled@ticks@#1}{% \begingroup - \xdef\pgfplots@TMP{\csname pgfplots@tick@scale@#1\endcsname}% - \expandafter\c@pgf@counta\pgfplots@TMP\relax + \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@TMP=\pgfutil@empty + \global\let\pgfplots@glob@TMPa=\pgfutil@empty \else - \xdef\pgfplots@TMP{\the\c@pgf@counta}% + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% \fi \endgroup - \ifx\pgfplots@TMP\pgfutil@empty + \ifx\pgfplots@glob@TMPa\pgfutil@empty \else - \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/tick scale label code/.@cmd}{\pgfplots@TMP}}% + \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/tick scale label code/.@cmd}{\pgfplots@glob@TMPa}}% \node [% xshift=\pgfplots@xcoordminTEX,% @@ -1562,7 +1627,7 @@ /pgfplots/every #1 tick scale label] {\pgfplots@tick@scale@labels}; \fi - \fi + }{\relax}% \fi } @@ -1573,7 +1638,10 @@ \pgfplots@invoke@pgfkeyscode@CODE#2\pgfeov } -% Check if it does not cross the y-axis +% 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 @@ -1600,100 +1668,183 @@ \fi } -\def\pgfplots@drawxaxis@placecomputedtick#1[#2]{% - \ifcase\pgfplots@xtickalignnum\relax - \def\pgfplots@xtick@offset{0pt} - \or - \def\pgfplots@xtick@offset{#1} - \or - \def\pgfplots@xtick@offset{.5*#1} - \fi - %\pgfplots@xtick@check@tickshow - %\ifpgfplots@tickshow - \draw[#2] - \ifcase\pgfplots@xtickposnum - (\pgfplots@tmpa, \pgfplots@ycoordminTEX-\pgfplots@xtick@offset) -- ++(0pt, #1) - - (\pgfplots@tmpa, \pgfplots@ycoordmaxTEX+\pgfplots@xtick@offset) -- ++(0pt,-#1) - \or - (\pgfplots@tmpa, \pgfplots@ycoordminTEX-\pgfplots@xtick@offset) -- ++(0pt, #1) - \or - (\pgfplots@tmpa, \pgfplots@ZERO@y -\pgfplots@xtick@offset) -- ++(0pt, #1) - \or - (\pgfplots@tmpa, \pgfplots@ycoordmaxTEX+\pgfplots@xtick@offset) -- ++(0pt,-#1) - \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[#1]{% - \draw[#1] - (\pgfplots@tmpa, \pgfplots@ycoordminTEX\pgfplots@leftover) - -- (\pgfplots@tmpa, \pgfplots@ycoordmaxTEX\pgfplots@rightover) - ; +\def\pgfplots@drawxaxis@placecomputedgridline{% + \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordminTEX}}% + \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordmaxTEX}}% }% % #1: axis (x or y) -% #2: tick position list -\def\pgfplots@draw@extra@ticks@for#1#2{% +% #2: axis index (0 or 1) +% #3: tick position list +\def\pgfplots@draw@extra@ticks@for#1#2#3{% \begingroup - \edef\pgfplots@TMP{#2}% - \ifx\pgfplots@TMP\pgfutil@empty - \else - \pgfplots@scaled@ticksfalse - \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 - % FIXME: that search path - thing is far from perfect. - % In fact, it doesn't even work for choice keys... with - % unexpected results. - % I have fixed that in PGF CVS - but PGF 2.0 does not yet work - % here! - \pgfqkeys{/pgfplots/search path for tikz}{/pgfplots/every extra #1 tick}% - \csname pgfplots@draw#1axis\endcsname{#2}% - \fi + \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{% - \ifnum\pgfplots@yaxislinesnum=2 - \draw[decorate,ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] (\pgfplots@ZERO@x, \pgfplots@ycoordminTEX) -- (\pgfplots@ZERO@x, \pgfplots@ycoordmaxTEX); + \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 - \ifnum\pgfplots@xaxislinesnum=2 - \draw[decorate,xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] (\pgfplots@xcoordminTEX, \pgfplots@ZERO@y) -- (\pgfplots@xcoordmaxTEX, \pgfplots@ZERO@y); + \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 \fi }% -\def\pgfplots@drawaxis@outerlines{% - \draw +% 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 + \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) }; + \draw decorate { + (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) + -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; + + \or + \draw decorate { + (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) + -- (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) }; + \or + \or + \draw decorate { + (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) + -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; + + \fi + \endscope + \fi +}% + +% This here is complicated: we try to create good edges and draw a +% SINGLE path for the partial or complete rectangle +% +% ----- +% | | +% | | +% ----- +\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) +\ifpgfplots@hide@y + { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } +\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) } \fi +\fi +\ifpgfplots@hide@x + { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } +\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) } \fi +\fi +\ifpgfplots@hide@y + { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } +\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) } \fi +\fi +\ifpgfplots@hide@x + { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } +\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) } - \fi + \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 @@ -1750,7 +1901,7 @@ \advance \pgfplots@xcoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@x pt \fi % carry local computations outside of group: - \xdef\pgfplots@TMP{% + \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\xdisstart{\the\xdisstart}% \noexpand\def\noexpand\xdisend{\the\xdisend}% \noexpand\def\noexpand\ydisstart{\the\ydisstart}% @@ -1760,150 +1911,371 @@ /tikz/ydiscont/.style={\ydiscontstyle}}% }% \endgroup - \pgfplots@TMP + \pgfplots@glob@TMPa \pgfplots@drawaxis@outerlines% \pgfplots@drawaxis@innerlines% \endgroup }% -% X-Achsen und Achsenbeschriftung -% 1: Ticks -\def\pgfplots@drawxaxis#1{% - \ifpgfplots@xislinear - \ifpgfplots@scaled@ticks - \pgfplots@init@scaled@tick@for{x}% - \fi - \fi +% 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 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 - \global\pgfplots@ticknum=0 - \edef\pgfplots@TMP{#1}% - \ifx\pgfplots@TMP\pgfutil@empty + \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@xminorticks - \pgfplots@needsminorlooptrue - \fi - \ifpgfplots@xminorgrids + \ifpgfplots@minorticks \pgfplots@needsminorlooptrue + \else + \ifpgfplots@minorgrids + \pgfplots@needsminorlooptrue + \else + \pgfplots@needsminorloopfalse + \fi \fi \ifpgfplots@needsminorloop - \ifpgfplots@xislinear + \ifpgfplots@islinear + \expandafter\let\expandafter\pgfplots@minor@tick@num\csname pgfplots@minor@#2tick@num\endcsname \begingroup - \c@pgf@counta=\pgfplots@minor@xtick@num\relax + \c@pgf@counta=\pgfplots@minor@tick@num\relax \advance\c@pgf@counta by1\relax - \pgfplots@tmpb=\pgfplots@tick@distance@x pt - \divide\pgfplots@tmpb by\c@pgf@counta - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpb}}% + \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@xtick@num{9}% + \def\pgfplots@minor@tick@num{9}% \fi \fi - \xdef\pgfplots@show@ticklabel@LASTTICK{}% - \foreach \x in {#1} { - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\x}{0}}% - \pgfplots@xtick@check@tickshow + \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<\pgfplots@xcoordminTEX + \ifdim\pgfplots@tmpa<\csname pgfplots@#2coordminTEX\endcsname \else - \ifdim\pgfplots@tmpa>\pgfplots@xcoordmaxTEX + \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname \else - \ifcase\pgfplots@xtickalignnum\relax - \def\pgfplots@xtick@offset{0pt} - \or - \def\pgfplots@xtick@offset{\pgfplots@tickwidth} - \or - \def\pgfplots@xtick@offset{.5*\pgfplots@tickwidth} - \fi - \ifcase\pgfplots@xtickposnum - \def\pgfplots@xtick@origin{\pgfplots@ycoordminTEX} - \or - \def\pgfplots@xtick@origin{\pgfplots@ycoordminTEX} - \or - \def\pgfplots@xtick@origin{\pgfplots@ZERO@y} - \or - \def\pgfplots@xtick@origin{\pgfplots@ycoordmaxTEX} - \fi - % Axis tick labels: - \ifnum\pgfplots@xtickposnum=3 - \pgfplots@show@ticklabel - [above,/pgfplots/every tick label,/pgfplots/every x tick label]% - {x}{\x}(\pgfplots@tmpa,\pgfplots@xtick@origin+\pgfplots@xtick@offset)% - {\pgfplots@ticknum}% - \else - \pgfplots@show@ticklabel - [below,/pgfplots/every tick label,/pgfplots/every x tick label]% - {x}{\x}(\pgfplots@tmpa,\pgfplots@xtick@origin-\pgfplots@xtick@offset)% - {\pgfplots@ticknum}% - \fi + \edef\pgfplots@loc@TMPa{{\the\pgfplots@tmpa}{\x}}% + \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@prepared@tick@positions@major \fi \fi \fi - \global\advance\pgfplots@ticknum by1 - % - \scope - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX-5cm) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX+5cm); - \endpgfinterruptboundingbox% % X-Axis ticks bottom and top % in log: - % log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9 + % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9 \ifpgfplots@needsminorloop - \foreach \i in {1,...,\pgfplots@minor@xtick@num} { - % \pgfextractx{\pgfplots@tmpb}{\pgfpointxy{\logi\i}{0}}% - \ifpgfplots@xislinear - \pgfextractx{\pgfplots@tmpb}{\pgfpointxy{\i*\pgfplots@minor@tick@dist}{0}}% - \else - \pgfextractx{\pgfplots@tmpb}{\pgfpointxy{\logi\i}{0}}% + \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 - \advance\pgfplots@tmpa by\pgfplots@tmpb - \ifdim\pgfplots@tmpa<\pgfplots@xcoordminTEX + \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>\pgfplots@xcoordmaxTEX + \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname \else - \ifpgfplots@xminorgrids - \pgfplots@drawxaxis@placecomputedgridline[/pgfplots/every axis grid,/pgfplots/every minor grid]% - \fi - \ifpgfplots@xminorticks - \pgfplots@drawxaxis@placecomputedtick\pgfplots@subtickwidth[/pgfplots/every tick,/pgfplots/every minor tick,/pgfplots/every x tick,/pgfplots/every minor x tick]% - \fi + \expandafter\pgfplotslistpushbackglobal\the\pgfplots@tmpa\to\pgfplots@prepared@tick@positions@minor \fi \fi }% \fi - \ifdim\pgfplots@tmpa<\pgfplots@xcoordminTEX - \else - \ifdim\pgfplots@tmpa>\pgfplots@xcoordmaxTEX - \else - \ifpgfplots@xmajorgrids - \pgfplots@drawxaxis@placecomputedgridline[/pgfplots/every axis grid,/pgfplots/every major grid,/pgfplots/every axis x grid,/pgfplots/every major x grid]% - \fi - \ifpgfplots@tickshow - \ifpgfplots@xmajorticks - \pgfplots@drawxaxis@placecomputedtick\pgfplots@tickwidth[/pgfplots/every tick,/pgfplots/every major tick, /pgfplots/every x tick,/pgfplots/every major x tick]% - \fi - \fi - \fi - \fi - \endscope }% \fi - \pgfplots@draw@tick@scale@label@for x% + \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 } -\def\pgfplots@rememberplotspec#1{% +% #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 - \globaldefs=1 - \pgfplotslistpushback#1\to\pgfplots@plotspeclist + \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 + \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}% + \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}}% + \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}% + \else + \pgfplots@tickposchoiceb + \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \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 + }% + \endgroup + \pgfplots@draw@tick@scale@label@for #1% + \fi \endgroup } +\def\pgfplots@rememberplotspec#1{% + \pgfplotslistpushbackglobal{#1}\to\pgfplots@plotspeclist +} + \def\pgfplots@getautoplotspec into#1{% \pgfplotslistsize\autoplotspeclist\to\c@pgf@counta \ifnum\c@pgf@counta=0 @@ -1946,13 +2318,16 @@ % \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@options <--- \begingroup +% \pgfplots@start@plot@with@behavioroptions <--- \begingroup % ... % ... remember options GLOBALLY % ... update limits GLOBALLY @@ -1971,7 +2346,7 @@ % the space after ']' is required here: % FIXME: % - \addplot[]plot coordinates is NOT allowed!? - \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec] + \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec]% }% }% } @@ -1997,7 +2372,7 @@ } \def\pgfplots@addplotimpl@plot@withoptions#1[#2]{ - \pgfplots@start@plot@with@options{#1}{#2}% + \pgfplots@start@plot@with@behavioroptions{#2}% \pgfutil@ifnextchar c{% \pgfplots@addplotimpl@coordinates{#1}plot }{% @@ -2010,13 +2385,16 @@ \pgfutil@ifnextchar ({% \pgfplots@addplotimpl@expression{#1}% }{% - \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots!}% + \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots! Ignoring it.}% + \pgfplots@gobble@until@semicolon }% }% }% }% } +\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 @@ -2030,93 +2408,76 @@ % parser routines - it does NOT know that any numbers are already in % TeX-precision! % -% FIXME : configure pgfplots to finish the data scaling trafo! It's -% perfectly ok if it is simply the identity! \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}}% - \global\let\pgfplots@TMP=\pgfutil@empty + \pgfplotsapplistXXglobalnewempty \pgfplots@plot@data{% \pgfmathparse{#2}% \let\pgfplots@current@point@x=\pgfmathresult \pgfmathparse{#3}% \let\pgfplots@current@point@y=\pgfmathresult - \pgfplots@toka=\expandafter{\pgfplots@TMP}% - \xdef\pgfplots@TMP{\the\pgfplots@toka(\pgfplots@current@point@x,\pgfplots@current@point@y)}% + \edef\pgfplots@loc@TMPa{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% + \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@loc@TMPa}% }% - \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@TMP}% + \pgfplotsapplistXXgloballet\pgfplots@loc@TMPa + \pgfplotsapplistXXglobalclear + \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@loc@TMPa}% }% -\def\pgfplots@addplotimpl@expression@limits#1{% - %-------------------------------------------------- - %FIXME - % \pgfkeysinstallkeyfilter{/pgf/key filters/equals}{/tikz/domain}% - % \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/ignore}% - % \pgfqkeysfiltered - % {/tikz}% - % {#1}% - %-------------------------------------------------- - \expandafter\pgfplots@addplotimpl@expression@limits@domain\tikz@plot@domain\relax -}% - -\def\pgfplots@addplotimpl@expression@limits@domain#1:#2\relax{% - \ifpgfplots@autocompute@xlim - \ifpgfplots@float@numerics@mode@x - \pgfmathfloatparsenumber{#1}% - \let\pgfplots@current@point@x=\pgfmathresult - \pgfmathfloatmin{\pgfplots@xmin}{\pgfplots@current@point@x}% - \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathfloatmax{\pgfplots@xmax}{\pgfplots@current@point@x}% - \global\let\pgfplots@xmax=\pgfmathresult - % - \pgfmathfloatparsenumber{#2}% - \let\pgfplots@current@point@x=\pgfmathresult - \pgfmathfloatmin{\pgfplots@xmin}{\pgfplots@current@point@x}% - \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathfloatmax{\pgfplots@xmax}{\pgfplots@current@point@x}% - \global\let\pgfplots@xmax=\pgfmathresult - \else - \pgfmathmin{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathmax{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \pgfmathmin{\pgfplots@xmin}{#2}% - \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathmax{\pgfplots@xmax}{#2}% - \global\let\pgfplots@xmax=\pgfmathresult - \fi - \fi -} - \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;{% - \def\tikz@plot@filename{\tikz@plot@prefix\tikz@plot@id}% + \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\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{#2}}% + \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{#2}}% \else% \iftikz@plot@parametric% - \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{% - set format "\%.7e"; + \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\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{% - set format "\%.7e"; + \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}}% - \tikz@plot@data + \pgfplots@plot@data \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile }% @@ -2136,8 +2497,57 @@ \fi } +% #1: arguments to \addplot[...] +% #2: the file name +% #3: any additional path arguments \def\pgfplots@addplotimpl@file#1ile{% - \pgfplots@addplotimpl@table{#1}table[x index=0,y index=1,header=false]% + \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{% @@ -2148,17 +2558,11 @@ }% }% -\def\pgfplots@addplotimpl@table@f#1#2from{% - \pgfplots@addplot@table@from@macrotrue - \pgfplots@addplotimpl@table@START{#1}{#2}% -} - \def\pgfplots@addplotimpl@table@getopts#1[#2]{% \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@table@f{#1}{#2}% + \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% }{% - \pgfplots@addplot@table@from@macrofalse - \pgfplots@addplotimpl@table@START{#1}{#2}% + \pgfplots@addplotimpl@table@fromfile{#1}{#2}% }% } @@ -2166,14 +2570,15 @@ % #2: arguments to table[...] % #3: the argument of plot table{...} % #4: trailing path arguments after plot table{...}#4; -\long\def\pgfplots@addplotimpl@table@START#1#2#3#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}% - \ifpgfplots@addplot@table@from@macro - \pgfplotstablecopy#3\to\pgfplots@table - \else - \pgfplotstableread{#3} to \pgfplots@table - \fi + \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 @@ -2217,7 +2622,15 @@ \ifpgfplotslistempty \pgfplots@loop@CONTINUEfalse \else - \pgfplots@loop@CONTINUEtrue + % 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 @@ -2233,20 +2646,117 @@ \else \pgfplotslistpopfront\addplot@tbl@error@y\to\addplot@tbl@error@cur@y \fi - \edef\pgfplots@TMP{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{\addplot@tbl@error@cur@x}{\addplot@tbl@error@cur@y}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@TMP + \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@TMP{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{}{}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@TMP + \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[] (these are used for legend images as well) -% #2: arguments to \addplot plot[] (these are set directly in \addplot) -\def\pgfplots@start@plot@with@options#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@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 @@ -2254,15 +2764,14 @@ \else \pgfplots@execute@at@begin@plot \fi - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - \pgfplots@rememberplotspec{#1}% - \def\pgfplots@addplot@nonlegend@options{#2}% + \def\pgfplots@addplot@nonlegend@options{#1}% \ifx\pgfplots@addplot@nonlegend@options\pgfutil@empty \else - \pgfqkeys{/tikz}{#2}% + \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 @@ -2279,92 +2788,117 @@ % would yield #2 =' -- (0,0)' % \long\def\pgfplots@PREPARE@COORD@STREAM#1#2{% - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbar@recordto{\pgfplots@recordederrorbar}% - \pgfplots@streamerrorbarstart - \else - \let\pgfplots@recordederrorbar=\pgfutil@empty - \fi - \pgfplots@coord@stream@INIT\pgfplots@coord@stream@recorded - % - % make sure that \pgfplots@coord@stream@end@@ is called at the end - % of the lately prepare end-stream method. - \expandafter\def\expandafter\pgfplots@coord@stream@end@\expandafter{% - \pgfplots@coord@stream@end@ - \pgfplots@coord@stream@end@@ - \pgfplots@end@plot + \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 + % }% - \def\pgfplots@coord@stream@end@@{% + \let\pgfplots@coord@stream@coord@=\pgfplots@process@one@point + \def\pgfplots@coord@stream@end@{% \ifpgfplots@errorbars@enabled \pgfplots@streamerrorbarend \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@TMP{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% - \pgfplotslist@TOK@a=\expandafter{\pgfplots@TMP,#1,/pgfplots/every axis plot post}% - % Assemble a - % \pgfplots@addplot@enqueue@coords{}{}...{} - % statement with correct arguments: - \ifx\pgfplots@recordederrorbar\pgfutil@empty - \let\pgfplots@TMPB=\pgfutil@empty% + \ifpgfplots@coord@stream@isfirst + \pgfplots@warning{Empty plot silently dropped.}% \else - \pgfplotslist@TOK@b=\expandafter{\pgfplots@recordederrorbar}% - \def\pgfplots@TMPB{% - \noexpand\pgfplots@errorbars@finishwithstyleoptions[\the\pgfplotslist@TOK@a]{\the\pgfplotslist@TOK@b}% - }% - \fi - \ifpgfplots@datascaletrafo@initialised - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@TMP - \pgfplots@toka=\expandafter{\pgfplots@TMP}% - \else - \pgfplots@toka={}% - \fi - \edef\pgfplots@TMP{% - \noexpand\pgfplots@addplot@enqueue@coords - { - \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% - \noexpand\pgfplots@initzerolevelhandler - \the\pgfplots@toka% named start/end points - \noexpand\tikzstyle{current plot style}=[\the\pgfplotslist@TOK@a]% - \pgfplots@TMPB% error bar commands + \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% + }% }% - {% - \noexpand\draw[current plot style]% + \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 + }% }% - }% - \expandafter\pgfplots@TMP\expandafter{\pgfplots@coord@stream@recorded #2;}% - {}% + \pgfplots@glob@TMPa + %^^^^^^^^^^^^ ... END of \pgfplots@addplot@enqueue@coords HERE + \pgfplots@end@plot + \fi }% }% \def\pgfplots@end@plot{% \global\advance\pgfplots@numplots by1\relax% - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi \ifx\pgfplots@execute@at@end@plot\pgfutil@empty \else \pgfplots@execute@at@end@plot \fi - \global\let\pgfplots@TMP=\relax + \global\let\pgfplots@glob@TMPa=\relax \ifpgfplots@collect@firstplot@astick \ifnum\pgfplots@numplots=1\relax - \pgfplotslist@TOK@a=\expandafter{\pgfplots@firstplot@coords@x}% - \pgfplotslist@TOK@b=\expandafter{\pgfplots@firstplot@coords@y}% - \xdef\pgfplots@TMP{% - \noexpand\def\noexpand\pgfplots@firstplot@coords@x{\the\pgfplotslist@TOK@a}% - \noexpand\def\noexpand\pgfplots@firstplot@coords@y{\the\pgfplotslist@TOK@b}% + \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@TMP% see above + \pgfplots@glob@TMPa% see above } % #1: arguments to \addplot[...] @@ -2388,12 +2922,15 @@ }% \def\pgfplots@streamerrorbar@recordto#1{% - \def\pgfplots@streamerrorbarstart{\let#1=\pgfutil@empty}% - \def\pgfplots@streamerrorbarend{}% + \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{% - \expandafter\def\expandafter#1\expandafter{#1% - \pgfplots@errorbar@draw{##1}{##2}% - }% + \pgfplotsapplistXpushback{\pgfplots@errorbar@draw{##1}{##2}}\to\pgfplots@streamerrorbar@recordto@@ }% } \def\pgfplots@streamerrorbar@directdraw{% @@ -2416,97 +2953,148 @@ % clipping region. % % PRECONDITIONS: -% - 'floating point numerics active' -% => coordinate filtering is active -% => #1 and/or #2 are in floating point format -% - no coordinate filters active -% => #1 and #2 MAY be macros, but they must be valid TeX -% length (without unit). +% - 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) ...}% - \pgfplots@update@limits@for@one@point@ISCLIPPEDfalse - \ifpgfplots@clip@limits - \ifpgfplots@autocompute@xlim + \ifpgfplots@autocomputeanylimits + \pgfplots@update@limits@for@one@point@ISCLIPPEDfalse + \ifpgfplots@autocompute@all@limits \else - \ifpgfplots@float@numerics@mode@x - \pgfmathfloatlessthan@{#1}{\pgfplots@xmin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + % 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 - \pgfmathfloatlessthan@{\pgfplots@xmax}{#1}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \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 - \else - \pgfmathlessthan@{#1}{\pgfplots@xmin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \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 - \pgfmathlessthan@{\pgfplots@xmax}{#1}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \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 - \ifpgfplots@autocompute@ylim + % + % + % + % Update limits: + \ifpgfplots@update@limits@for@one@point@ISCLIPPED \else - \ifpgfplots@float@numerics@mode@y - \pgfmathfloatlessthan@{#2}{\pgfplots@ymin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \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 - \pgfmathfloatlessthan@{\pgfplots@ymax}{#2}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \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 - \else - \pgfmathlessthan@{#2}{\pgfplots@ymin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \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 - \pgfmathlessthan@{\pgfplots@ymax}{#2}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \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 - \ifpgfplots@update@limits@for@one@point@ISCLIPPED + % + % 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 - \ifpgfplots@autocompute@xlim - \ifpgfplots@float@numerics@mode@x - \pgfmathfloatmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \fi + % 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@autocompute@ylim - \ifpgfplots@float@numerics@mode@y - \pgfmathfloatmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \pgfmathmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\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 - \global\pgfplots@limits@are@computedtrue \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% @@ -2523,6 +3111,32 @@ \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.}% @@ -2533,15 +3147,8 @@ \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}% \fi \else + % \ifpgfplots@apply@datatrafo - \ifpgfplots@apply@datatrafo@x - \pgfmathfloatparsenumber{\pgfplots@current@point@x}% - \let\pgfplots@current@point@x=\pgfmathresult - \fi - \ifpgfplots@apply@datatrafo@y - \pgfmathfloatparsenumber{\pgfplots@current@point@y}% - \let\pgfplots@current@point@y=\pgfmathresult - \fi \ifpgfplots@datascaletrafo@initialised % apply data transformation directly. \ifpgfplots@apply@datatrafo@x @@ -2561,34 +3168,38 @@ \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 - \ifpgfplots@autocomputelimits - % update also axis limits: - \pgfplots@update@limits@for@one@point{\pgfplots@current@point@x}{\pgfplots@current@point@y}{}{}% - \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 - \pgfplots@toka=\expandafter{\pgfplots@coord@stream@recorded}% - \edef\pgfplots@coord@stream@recorded{\the\pgfplots@toka (\pgfplots@current@point@x,\pgfplots@current@point@y)}% + % + \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 - \pgfplots@toka=\expandafter{}% + \t@pgfplots@tokc=\expandafter{}% \else - \pgfplots@toka=\expandafter{\pgfplots@firstplot@coords@x,}% + \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@x,}% \fi - \edef\pgfplots@firstplot@coords@x{\the\pgfplots@toka\pgfplots@current@point@x}% + \edef\pgfplots@firstplot@coords@x{\the\t@pgfplots@tokc\pgfplots@current@point@x}% \ifx\pgfplots@firstplot@coords@y\pgfutil@empty - \pgfplots@toka=\expandafter{}% + \t@pgfplots@tokc=\expandafter{}% \else - \pgfplots@toka=\expandafter{\pgfplots@firstplot@coords@y,}% + \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@y,}% \fi - \edef\pgfplots@firstplot@coords@y{\the\pgfplots@toka\pgfplots@current@point@y}% + \edef\pgfplots@firstplot@coords@y{\the\t@pgfplots@tokc\pgfplots@current@point@y}% \fi \fi -%\pgfplots@message{FILTERING: appended \pgfplots@current@point@x,\pgfplots@current@point@y}% -> results in \pgfplots@coord@stream@recorded}% \fi \fi % @@ -2610,9 +3221,9 @@ % % FIXME: REPLACE THIS HERE WITH METHODS OF THE VISUALIZATION FRAMEWORK \newif\ifpgfplots@coord@stream@isfirst -\def\pgfplots@coord@stream@start{ +\def\pgfplots@coord@stream@start{% \pgfplots@coord@stream@isfirsttrue - \pgfplots@coord@stream@start@} + \pgfplots@coord@stream@start@}% \def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@} % Will be invoked for every point coordinate. @@ -2627,12 +3238,24 @@ \def\pgfplots@coord@stream@coord#1#2#3#4{% \pgfplots@coord@stream@coord@{#1}{#2}{#3}{#4}% \ifpgfplots@coord@stream@isfirst - \let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y - \pgfplots@coord@stream@isfirstfalse + \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 - \let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y }% % A looping method which applies @@ -2656,114 +3279,202 @@ \pgfplots@coord@stream@end }% -% Processes coordinates and writes a new, modified 'plot coordinates' -% command to macro #1. -% #1: macro name for processed coordinates. -% -% Please note that it may be necessary to process the same coordinates -% once more at the end of an axis - see -% pgfplots@coord@stream@finalize@storedcoords@START -\def\pgfplots@coord@stream@INIT#1{% - \def\pgfplots@coord@stream@start@{% - \let\pgfplots@coord@stream@recorded=\pgfutil@empty - }% - \def\pgfplots@coord@stream@end@{% - \pgfplots@toka=\expandafter{\pgfplots@coord@stream@recorded}% - \edef#1{plot coordinates {\the\pgfplots@toka}}% - }% - \let\pgfplots@coord@stream@coord@=\pgfplots@process@one@point -} +% 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. +% 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@{% - \let#1=\pgfplots@data@scaletrafo@result + \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! }% - \let\pgfplots@coord@stream@coord@=\pgfplots@apply@data@scaletrafo@to@one@point } - \def\pgfplots@addplot@get@named@startendpoints@command#1{% \edef#1{% - \noexpand\path - (\pgfplots@currentplot@firstcoord@x,\pgfplots@currentplot@firstcoord@y) coordinate (current plot begin) - (\pgfplots@currentplot@lastcoord@x,\pgfplots@currentplot@lastcoord@y) coordinate (current plot end) - ; + \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: -% a sequence of points (SMeE,SMeE) (terminated with ';') -% where S=sign, M=mantisse, E = exponent. -% Such input is generated in the case pgfplots@apply@datatrafotrue -% by the coordinate filters. -% OUTPUT: -% proper sequence of fixed point coordinates which are the result of the -% data scaling transformation (\pgfplots@datascaletrafo@x). +% either floating point or fixed point coordinates (depending on the +% state of the \ifpgfplots@apply@datatrafo boolean) % -% The output will be written into the macro #3 -\long\def\pgfplots@coord@stream@finalize@storedcoords@START plot coordinates #1#2;\to#3{% - \pgfplots@coord@stream@finalize@storedcoords@START@ plot coordinates {#1}#2;\to#3 - \ifpgfplots@errorbars@enabled - \pgfplots@errorbars@finishwithstyleoptions[current plot style]{\pgfplots@recordederrorbar}% - \fi - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@TMP - \pgfplots@TMP -}% -\long\def\pgfplots@coord@stream@finalize@storedcoords@START@ plot coordinates #1#2;\to#3{% - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - \pgfplots@coord@stream@INIT@finalize@storedcoords#3 - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbar@recordto{\pgfplots@recordederrorbar}% - \pgfplots@streamerrorbarstart - \fi +\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}% - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi - \pgfplots@toka=\expandafter{#3}% - \pgfplotslist@TOK@a={#2}% - \edef#3{plot coordinates {\the\pgfplots@toka}\the\pgfplotslist@TOK@a;}% - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbarend + \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 }% -% does the same job, but it does not execute any drawing commands. -% -% Instead, it generates a macro #4 which - if used as "precommand" -% befor a draw operation - restores all required options and performs -% pre-drawing. -\long\def\pgfplots@coord@stream@finalize@storedcoords@START@dryrun plot coordinates #1#2;\to#3#4{% - \pgfplots@coord@stream@finalize@storedcoords@START@ plot coordinates {#1}#2;\to#3 - \ifpgfplots@stackedmode - \pgfplots@stacked@savestateto\pgfplots@TMP - \pgfplotslist@TOK@a=\expandafter{\pgfplots@TMP}% - \else - \pgfplotslist@TOK@a={}% - \fi - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@TMP - \pgfplots@toka=\expandafter{\pgfplots@TMP}% - \ifpgfplots@errorbars@enabled - \pgfplotslist@TOK@b=\expandafter{\pgfplots@recordederrorbar}% - \edef#4{% - \the\pgfplots@toka - \the\pgfplotslist@TOK@a - \noexpand\pgfplots@errorbars@finishwithstyleoptions[current plot style]{\the\pgfplotslist@TOK@b}% - }% +% 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 - \edef#4{% - \the\pgfplots@toka - \the\pgfplotslist@TOK@a - }% + \pgfplothandlermarklisted{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}{\tikz@mark@list}% \fi }% @@ -2805,9 +3516,6 @@ \def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{} - -% for use in \ifx: -\def\pgfplots@EOI{\pgfplots@EOI}% % #1= x coord % #2= y coord @@ -2833,8 +3541,8 @@ \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 - \pgfplots@toka=\expandafter{\pgfplots@data@scaletrafo@result}% - \edef\pgfplots@data@scaletrafo@result{\the\pgfplots@toka(\pgfplots@current@point@x,\pgfplots@current@point@y)}% +% \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'. @@ -2843,8 +3551,7 @@ % means all limits are computed; the axis has been drawn, % transformations are set up...) \def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{% - \scope[%/pgfplots/search path for tikz/.cd, - #1,/pgfplots/every error bar]% + \scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it used the /pgfplots/.unknown #2% \endscope } @@ -2868,9 +3575,9 @@ \def\pgfplots@yarg{#2}% \def\pgfplots@error@yarg{#4}% \fi - \edef\pgfplots@TMP{{(\pgfplots@xarg,\pgfplots@yarg)}{(\pgfplots@error@xarg,\pgfplots@error@yarg)}}% - \def\pgfplots@TMPB{\pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}}% - \expandafter\pgfplots@TMPB\pgfplots@TMP\pgfeov + \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{% @@ -2894,11 +3601,11 @@ \def\pgfplots@yarg@unfiltered{#6}% \edef\pgfplots@error@xarg{#3}% \edef\pgfplots@error@yarg{#4}% - \def\pgfplots@TMP{0}% - \ifx\pgfplots@TMP\pgfplots@error@xarg + \def\pgfplots@loc@TMPa{0}% + \ifx\pgfplots@loc@TMPa\pgfplots@error@xarg \let\pgfplots@error@xarg=\pgfutil@empty \fi - \ifx\pgfplots@TMP\pgfplots@error@yarg + \ifx\pgfplots@loc@TMPa\pgfplots@error@yarg \let\pgfplots@error@yarg=\pgfutil@empty \fi % FIXME : INEFFICIENT! This code here does every computation @@ -2929,48 +3636,34 @@ % #3: an integer representing the argument #2. It is '1' if #2='+' % and '2' is #2 = '-'. \def\pgfplots@process@errorbar@@for#1#2#3{% - \expandafter\let\expandafter\ifpgfplots@is@datascaled\csname ifpgfplots@float@numerics@mode@#1\endcsname \csname ifpgfplots@#1islinear\endcsname \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% \ifcase\csname pgfplots@errorbars@#1mode\endcsname % fixed absolute error. - \ifpgfplots@is@datascaled - \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 + \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 - \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% - \pgfmathparse{\pgfplots@error@src#2 \pgfplots@error@coord}% + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% \fi \let\pgfplots@error@coord=\pgfmathresult \or% fixed relative error: - \ifpgfplots@is@datascaled - \pgfmathparse{(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathparse{\pgfplots@error@src*(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \fi + \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 - \ifpgfplots@is@datascaled - \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 + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% \else - \pgfmathparse{\pgfplots@error@src#2 \pgfplots@error@coord}% + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% \fi \let\pgfplots@error@coord=\pgfmathresult \fi @@ -2978,13 +3671,9 @@ \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% \ifx\pgfplots@error@coord\pgfutil@empty \else - \ifpgfplots@is@datascaled - \pgfmathparse{(1#2\pgfplots@error@coord)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathparse{\pgfplots@error@src*(1#2\pgfplots@error@coord)}% - \fi + \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 @@ -3041,26 +3730,22 @@ \fi \ifx\pgfplots@error@coord\pgfutil@empty \else - \def\pgfplots@TMP{#1}% - \def\pgfplots@TMPB{x}% - \ifx\pgfplots@TMP\pgfplots@TMPB - \ifpgfplots@autocomputelimits - \pgfplots@update@limits@for@one@point{\pgfplots@error@coord}{\pgfplots@yarg}{}{}% - \fi - \edef\pgfplots@TMP{% + \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 - \ifpgfplots@autocomputelimits - \pgfplots@update@limits@for@one@point{\pgfplots@xarg}{\pgfplots@error@coord}{}{}% - \fi - \edef\pgfplots@TMP{% + \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@TMP + \expandafter\pgfplots@streamerrorbarcoords\pgfplots@loc@TMPa \fi } @@ -3121,10 +3806,7 @@ % \long\def\pgfplots@path@enqueue@coords#1#2#3#4{% \ifpgfplots@draw@at@end - \begingroup - \globaldefs=1 - \pgfplotslistpushback{#1}{#2}{#3}{#4}\to\pgfplots@stored@plotlist - \endgroup + \pgfplotslistpushbackglobal{#1}{#2}{#3}{#4}\to\pgfplots@stored@plotlist \else \begingroup #1#2#3#4% @@ -3142,7 +3824,7 @@ \expandafter \pgfplots@path@enqueue@coords \expandafter{% - \expandafter\tikzset\expandafter{\pgfplots@addplot@nonlegend@options}% + \expandafter\pgfplotsset\expandafter{\pgfplots@addplot@nonlegend@options}% #1}{#2}{#3}{#4}% \fi \else @@ -3163,14 +3845,15 @@ \def\pgfplots@command@legend{ \pgfutil@ifnextchar[{% \pgfplots@error{Sorry, legend options are now deprecated. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% + \pgfplots@command@legend@impl }{% \pgfplots@command@legend@impl }% } \def\pgfplots@command@legend@impl#1{% - \pgfplots@assign@list\pgfplots@TMPC{#1}% - \global\let\pgfplots@legend=\pgfplots@TMPC + \pgfplots@assign@list\pgfplots@loc@TMPc{#1}% + \global\let\pgfplots@legend=\pgfplots@loc@TMPc } @@ -3182,10 +3865,7 @@ }% } \def\pgfplots@addlegendentry@opts[#1]#2{% - {% - \globaldefs=1% this will ONLY store the options and the legend into global variables - \pgfplotslistpushback[#1]#2\to\pgfplots@legend - }% + \pgfplotslistpushbackglobal[#1]#2\to\pgfplots@legend } \def\pgfplots@pop@next@legend{{% @@ -3231,21 +3911,22 @@ } \def\pgfplots@try@mirror@plot@handler{% - \pgfutil@ifundefined{tikz@plot@handler}{}{% - \ifx\tikz@plot@handler\pgfplothandlerconstantlineto - \let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkright - \else - \ifx\tikz@plot@handler\pgfplothandlerconstantlinetomarkright - \let\tikz@plot@handler=\pgfplothandlerconstantlineto - \fi + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + % this method assigns '\tikz@plot@handler'. + % That's ok and does not introduce incompatibilities. + \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerconstantlineto + \let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkright + \else + \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerconstantlinetomarkright + \let\tikz@plot@handler=\pgfplothandlerconstantlineto \fi - }% + \fi } \long\def\pgfplots@show@small@legendplots#1#2{ \begingroup - \def\pgfplots@TMPB{#1}% - \ifx\pgfplots@TMPB\pgfutil@empty + \def\pgfplots@loc@TMPb{#1}% + \ifx\pgfplots@loc@TMPb\pgfutil@empty \else \pgfqkeys{/pgfplots/search path for tikz}{#1}% \fi @@ -3276,6 +3957,13 @@ \ifx\pgfplots@already@computed@legend@node\pgfutil@empty \pgfplotslistcheckempty\pgfplots@legend \ifpgfplotslistempty + % No legend commands appeared in the document. So, + % consider the key: + \pgfkeysgetvalue{/pgfplots/legend entries}\pgfplots@legend + \expandafter\pgfplots@assign@list\expandafter\pgfplots@legend\expandafter{\pgfplots@legend}% + \pgfplotslistcheckempty\pgfplots@legend + \fi + \ifpgfplotslistempty \else % % @@ -3288,7 +3976,7 @@ % }; % command [and using the 'legend columns' option] % - % \pgfplotslist@TOK@a={ + % \t@pgfplots@toka={ % small plot & legend1\\ % small plot & legend2\\ % ... @@ -3296,13 +3984,13 @@ % ( I have allocated the token registers in my % liststructure.sty) % - % \global\def\pgfplots@TMP{ + % \global\def\pgfplots@glob@TMPa{ % \matrix { % \TOKL@TA % }; % } - % -> finally, \pgfplots@TMP will contain the complete command. - \pgfplotslist@TOK@a={}% + % -> finally, \pgfplots@glob@TMPa will contain the complete command. + \t@pgfplots@toka={}% \let\curcolumnNum=\c@pgf@counta \let\maxcolumnCount=\c@pgf@countb \let\legendplotpos=\c@pgf@countc @@ -3320,56 +4008,56 @@ \expandafter\pgfplots@split@opts\pgfplots@curlegend\pgfplots@result@to{\pgfplots@curlegend}{\pgfplots@curlegend@opts}% \ifcase\legendplotpos % legend plot pos=left - \pgfplotslist@TOK@b=\expandafter{% + \t@pgfplots@tokb=\expandafter{% \expandafter\pgfplots@show@small@legendplots \expandafter{\pgfplots@curlegend@opts}}% - \pgfplotslist@TOK@b=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfplotslist@TOK@b\expandafter{\pgfplots@curplotlist}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curplotlist}% \pgfmatrixnextcell\node}% - \pgfplotslist@TOK@b=\expandafter\expandafter\expandafter{% - \expandafter\the\expandafter\pgfplotslist@TOK@b + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\t@pgfplots@tokb \expandafter{\pgfplots@curlegend};}% \or % legend plot pos=right - \pgfplotslist@TOK@b=\expandafter{% + \t@pgfplots@tokb=\expandafter{% \expandafter\node \expandafter{\pgfplots@curlegend};% \pgfmatrixnextcell \pgfplots@show@small@legendplots}% - \pgfplotslist@TOK@b=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfplotslist@TOK@b\expandafter{\pgfplots@curlegend@opts}}% - \pgfplotslist@TOK@b=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfplotslist@TOK@b\expandafter{\pgfplots@curplotlist}}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curlegend@opts}}% + \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curplotlist}}% \or % legend plot pos=none - \pgfplotslist@TOK@b=\expandafter{\expandafter\node\expandafter{\pgfplots@curlegend};}% + \t@pgfplots@tokb=\expandafter{\expandafter\node\expandafter{\pgfplots@curlegend};}% \fi \ifnum\curcolumnNum=\maxcolumnCount - \pgfplotslist@TOK@b=\expandafter{\the\pgfplotslist@TOK@b\\}% + \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else \ifnum\pgfplots@numplots=0 - \pgfplotslist@TOK@b=\expandafter{\the\pgfplotslist@TOK@b\\}% + \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else - \pgfplotslist@TOK@b=\expandafter{\the\pgfplotslist@TOK@b\pgfmatrixnextcell}% + \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\pgfmatrixnextcell}% \fi \fi - \xdef\pgfplots@TMP{% - \the\pgfplotslist@TOK@a - \the\pgfplotslist@TOK@b + \xdef\pgfplots@glob@TMPa{% + \the\t@pgfplots@toka + \the\t@pgfplots@tokb }% \endgroup \ifnum\curcolumnNum=\maxcolumnCount \curcolumnNum=0 \fi - \expandafter\pgfplotslist@TOK@a\expandafter{\pgfplots@TMP}% + \expandafter\t@pgfplots@toka\expandafter{\pgfplots@glob@TMPa}% \fi \repeat - \pgfplotslist@TOK@b={\matrix[/pgfplots/every axis legend]}% - \xdef\pgfplots@TMP{% + \t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}% + \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\plotnum{0}% - \the\pgfplotslist@TOK@b {% - \the\pgfplotslist@TOK@a + \the\t@pgfplots@tokb {% + \the\t@pgfplots@toka };% }% \endgroup - \let\pgfplots@already@computed@legend@node=\pgfplots@TMP + \let\pgfplots@already@computed@legend@node=\pgfplots@glob@TMPa \fi \fi %\pgfplots@message{Vor legende: \meaning\pgfplots@already@computed@legend@node}% @@ -3404,11 +4092,11 @@ \pgfmathmultiply@\x\reciproclogten \let\cur=\pgfmathresult % check whether - % \cur - last == 1 (last = \pgfplots@TMPB) + % \cur - last == 1 (last = \pgfplots@glob@TMPb) \ifpgfplots@checkuniform@isfirst \global\pgfplots@checkuniform@isfirstfalse \else - \pgfmathsubtract@\cur\pgfplots@TMPB% + \pgfmathsubtract@\cur\pgfplots@glob@TMPb% \pgfmathapproxequalto@\pgfmathresult{1.0}% \ifpgfmathcomparison \else @@ -3416,7 +4104,7 @@ \breakforeach \fi \fi - \global\let\pgfplots@TMPB=\cur + \global\let\pgfplots@glob@TMPb=\cur }% \endgroup } @@ -3426,23 +4114,27 @@ % It also assigns pgfplots@tick@distance@#1 as the distance. % % see \pgfplots@checkisuniformLOGtick for details. -\def\pgfplots@checkisuniformLINEARtick#1{% +% +% #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@TMPB=\pgfutil@empty - \global\let\pgfplots@TMP=\relax + \global\let\pgfplots@glob@TMPb=\pgfutil@empty + \global\def\pgfplots@glob@TMPa{1}% \foreach \x in {#1}{% - \ifx\pgfplots@TMPB\pgfutil@empty + \ifx\pgfplots@glob@TMPb\pgfutil@empty \else - \pgfmathsubtract@\x\pgfplots@TMPB + \pgfmathsubtract@\x\pgfplots@glob@TMPb \ifpgfplots@checkuniform@isfirst % remember first distance h = x_1 - x_0 - \global\let\pgfplots@TMP=\pgfmathresult + \global\let\pgfplots@glob@TMPa=\pgfmathresult \global\pgfplots@checkuniform@isfirstfalse \else % check whether x_i - x_{i-1} = h - \pgfmathapproxequalto@\pgfmathresult\pgfplots@TMP% + \pgfmathapproxequalto@\pgfmathresult\pgfplots@glob@TMPa% \ifpgfmathcomparison \else \global\pgfplots@isuniformtickfalse @@ -3450,17 +4142,17 @@ \fi \fi \fi - \global\let\pgfplots@TMPB=\x% + \global\let\pgfplots@glob@TMPb=\x% }% \endgroup - \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@TMP + \let#2=\pgfplots@glob@TMPa } \def\skipsuffixzero#1.#2|{ {% - \def\pgfplots@TMP{#2}% - \def\pgfplots@TMPB{0}% - \ifx\pgfplots@TMP\pgfplots@TMPB + \def\pgfplots@loc@TMPa{#2}% + \def\pgfplots@loc@TMPb{0}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb \global\def\pgfmathresult{#1}% \else \global\def\pgfmathresult{#1.#2}% @@ -3496,8 +4188,8 @@ % The result will be \xdef'ed into #2. \def\pgfplots@compute@tick@times@logten#1\to#2{% \global\let#2=\pgfutil@empty - \foreach \pgfplots@TMPB in {#1} {% - \pgfmathmultiply@\pgfplots@TMPB\logten% + \foreach \pgfplots@loc@TMPb in {#1} {% + \pgfmathmultiply@\pgfplots@loc@TMPb\logten% \ifx#2\pgfutil@empty \xdef#2{\pgfmathresult}% \else @@ -3506,64 +4198,103 @@ }% } -\def\pgfplots@init@enlarge@limit@booleans{% +\def\pgfplots@enlarge@limit@ifconfigured#1{% \pgfplots@enlargelimits@autofalse \pgfplots@enlargelimitsfalse \pgfplots@enlargelimits@rel@threshfalse - \edef\pgfplots@TMP{\pgfplots@enlargelimits}% + \pgfkeysgetvalue{/pgfplots/enlarge #1 limits}{\pgfplots@loc@TMPa}% % - \def\pgfplots@TMPB{true}% - \ifx\pgfplots@TMP\pgfplots@TMPB + \def\pgfplots@loc@TMPb{true}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb \pgfplots@enlargelimitstrue \else - \def\pgfplots@TMPB{false}% - \ifx\pgfplots@TMP\pgfplots@TMPB + \def\pgfplots@loc@TMPb{false}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb \else - \def\pgfplots@TMPB{auto}% - \ifx\pgfplots@TMP\pgfplots@TMPB + \def\pgfplots@loc@TMPb{auto}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb \pgfplots@enlargelimits@autotrue \else \begingroup % try to read it as number: - \expandafter\pgf@xa\pgfplots@enlargelimits pt\relax + \pgf@xa\pgfplots@loc@TMPa pt\relax \endgroup \pgfplots@enlargelimitstrue \pgfplots@enlargelimits@rel@threshtrue \fi \fi \fi + \expandafter\let\expandafter\ifpgfplots@autocompute@@@min\csname ifpgfplots@autocompute@#1min\endcsname + \expandafter\let\expandafter\ifpgfplots@autocompute@@@max\csname ifpgfplots@autocompute@#1max\endcsname + \ifpgfplots@enlargelimits + % relax the sizes. + % + % Idea: if the user chose his xmin,xmax tight to his data, + % this here will look better. + \pgfplots@enlarge@limit@for{#1}% + \else + \ifpgfplots@enlargelimits@auto + %\ifpgfplots@hide@x + % there is no axis, so skip this enlargement (unless + % the user explizitly requests it) + % WHY!? + %\else + % FIXME : this here should be user-configurable! + \ifpgfplots@autocompute@@@min + \pgfplots@enlarge@limit@for{#1}% + \else + \ifpgfplots@autocompute@@@max + \pgfplots@enlarge@limit@for{#1}% + \fi + \fi + %\fi + \fi + \fi } \def\pgfplots@enlarge@limit@for#1{% \begingroup - \expandafter\let\expandafter\min\expandafter=\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\max\expandafter=\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\pgfplots@@min\expandafter=\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@@max\expandafter=\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\ifpgfplots@autocompute@@@min\csname ifpgfplots@autocompute@#1min\endcsname + \expandafter\let\expandafter\ifpgfplots@autocompute@@@max\csname ifpgfplots@autocompute@#1max\endcsname \ifpgfplots@enlargelimits@rel@thresh - \edef\enlargepercent{\pgfplots@enlargelimits}% + \pgfkeysgetvalue{/pgfplots/enlarge #1 limits}{\enlargepercent}% \else \def\enlargepercent{0.1}% FIXME : pack 10% as default into option 'enlargelimits' or so \fi - \pgfmathsubtract@\max\min% + \pgfmathsubtract@\pgfplots@@max\pgfplots@@min% \pgf@xa\pgfmathresult pt \pgf@xb\enlargepercent\pgf@xa \ifdim\pgf@xb>0.001pt % the case with % enlargeabsolute ~= 0 - % means that \min ~= \max. + % means that \pgfplots@@min ~= \pgfplots@@max. % It is handled in another method. \edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}% % - % compute xmin := xmin - enlargeabsolute - \pgfmathsubtract@\min\enlargeabsolute% - \let\min=\pgfmathresult - \pgfmathadd@\max\enlargeabsolute% - \let\max=\pgfmathresult - \fi - \xdef\pgfplots@TMP{\min}% - \xdef\pgfplots@TMPB{\max}% + \ifpgfplots@enlargelimits@auto + \ifpgfplots@autocompute@@@min + \pgfmathsubtract@\pgfplots@@min\enlargeabsolute% + \let\pgfplots@@min=\pgfmathresult + \fi + \ifpgfplots@autocompute@@@max + \pgfmathadd@\pgfplots@@max\enlargeabsolute% + \let\pgfplots@@max=\pgfmathresult + \fi + \else + % compute xmin := xmin - enlargeabsolute + \pgfmathsubtract@\pgfplots@@min\enlargeabsolute% + \let\pgfplots@@min=\pgfmathresult + \pgfmathadd@\pgfplots@@max\enlargeabsolute% + \let\pgfplots@@max=\pgfmathresult + \fi + \fi + \xdef\pgfplots@glob@TMPa{\pgfplots@@min}% + \xdef\pgfplots@glob@TMPb{\pgfplots@@max}% \endgroup - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@TMP - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@TMPB + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@glob@TMPa + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb } % Computes tick positions using the current axis limits. @@ -3642,19 +4373,18 @@ \advance\desirednumticks by1 \csname ifpgfplots@#1islinear\endcsname \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks - \expandafter\desirednumticks\axisdefaulttryminticks + \desirednumticks=\axisdefaulttryminticks \fi \else \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks - \expandafter\desirednumticks\pgfplots@default@try@minticks@log\relax + \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@TMP{\csname pgfplots@#1tickten\endcsname}% - \expandafter\pgfplots@compute@tick@times@logten\pgfplots@TMP\to\pgfplots@TMP - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@TMP - \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \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 % @@ -3663,8 +4393,8 @@ % ticks MIN,MIN+H,...,MAX. \let\MINH=\pgf@xa \let\H=\pgf@xb - \let\MAX=\pgfplots@tmpa - \let\MIN=\pgfplots@tmpb + \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 @@ -3672,6 +4402,7 @@ \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 @@ -3759,8 +4490,9 @@ % 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}% +%\message{ [ H / log(10) = \pgfmathresult ]}% \ifdim\H<2pt \H=1pt \else @@ -3835,15 +4567,113 @@ \fi \MINH=\MIN \advance\MINH by\H -%\pgfplots@message{final H=\the\H}% - \xdef\pgfplots@TMP{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% - \xdef\pgfplots@TMPB{\pgf@sys@tonumber{\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@TMP - \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@TMPB -%\pgfplots@message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1mode=\the\csname pgfplots@#1mode\endcsname, #1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% + \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 @@ -3853,8 +4683,8 @@ % #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@TMPB in {#1} {% - \pgfmathfloatparsenumber{\pgfplots@TMPB}% + \foreach \pgfplots@loc@TMPb in {#1} {% + \pgfmathfloatparsenumber{\pgfplots@loc@TMPb}% \expandafter#2\expandafter{\pgfmathresult}% \ifx#3\pgfutil@empty \xdef#3{\pgfmathresult}% @@ -3872,8 +4702,8 @@ % #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@TMPB in {#1} {% - #2{\pgfplots@TMPB}% + \foreach \pgfplots@loc@TMPb in {#1} {% + #2{\pgfplots@loc@TMPb}% \ifx#3\pgfutil@empty \xdef#3{\pgfmathresult}% \else @@ -3885,17 +4715,17 @@ % helper for \pgfplots@apply@data@scale@trafo@to@options@for. \def\pgfplots@compute@number@order@for@trafo@isdimen#1\tocount#2{% - \edef\pgfplots@TMP{\pgf@sys@tonumber{#1}}% - \pgfmathfloatparsenumber{\pgfplots@TMP}% + \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{#1}}% + \pgfmathfloatparsenumber{\pgfplots@loc@TMPa}% \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2 - \advance#2 by1 + \advance#2 by1\relax } % helper for \pgfplots@apply@data@scale@trafo@to@options@for. % \def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{% - \expandafter\pgfmathfloat@decompose@E#1\relax#2 - \advance#2 by1 + \expandafter\pgfmathfloat@decompose@E#1\relax#2\relax + \advance#2 by1\relax } % Initialises the data scale transformation and applies it to any @@ -3920,19 +4750,28 @@ \let\data@tmp=\pgf@xb \let\data@dimen@order=\c@pgf@countc \let\data@EXPONENT=\c@pgf@countd - \expandafter\let\expandafter\pgfplots@min@float\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\pgfplots@max@float\csname pgfplots@#1max\endcsname + \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@min@float + \pgfplots@data@min@float \tocount\data@cur@order % \data@max@order=\data@cur@order % \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@max@float + \pgfplots@data@max@float \tocount\data@cur@order % \ifnum\data@cur@order>\data@max@order @@ -3944,14 +4783,14 @@ % We have 'width' or 'height'. % % Use the order of these parameters. - \def\pgfplots@TMP{#1}% - \def\pgfplots@TMPB{x}% - \ifx\pgfplots@TMP\pgfplots@TMPB - \expandafter\data@dimen\pgfplots@width\relax + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{x}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \data@dimen=\pgfplots@width\relax \else - \def\pgfplots@TMPB{y}% - \ifx\pgfplots@TMP\pgfplots@TMPB - \expandafter\data@dimen\pgfplots@height\relax + \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 @@ -3994,21 +4833,21 @@ \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@min@float}% + \pgfplots@actual@trafo{\pgfplots@data@min@float}% \let\pgfplots@min@fixed=\pgfmathresult \ifpgfplots@loop@CONTINUE - \pgfplots@actual@trafo{\pgfplots@max@float}% + \pgfplots@actual@trafo{\pgfplots@data@max@float}% \let\pgfplots@max@fixed=\pgfmathresult \expandafter\data@tmp\pgfplots@max@fixed pt -%\message{Current trafo SHIFT for #1 direction: \the\data@EXPONENT; original #1 limits: [\pgfplots@min@float:\pgfplots@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% +%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% \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. - \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% - \expandafter\data@dimen\pgfmathresult pt \ifdim\data@dimen<100pt% I guess if max-min = O(100), we have quite good accuracy \ifdim\data@dimen<0.0001pt \else @@ -4017,64 +4856,77 @@ \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 + %-------------------------------------------------- \repeat - \xdef\pgfplots@TMP{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% - \xdef\pgfplots@TMPB{\pgfplots@min@fixed}% + \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@TMP*#1 - \pgfplots@TMPB...}% +%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% % COMPLETE INITIALISATION: - \ifpgfplots@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY - \pgfplots@warning{WARNING: the automatic scaling of input data has been DISABLED to allow unscalable commands. DISABLING THE DATA SCALING LIMITS THE DATA RANGE! I hope I can fix this issue as soon as possible. Please take a look at the manual for more information. If you get 'OVERFLOW' or 'UNDERFLOW' errors, you may need to disable the axispath.}% - \def\pgfplots@TMP{0}% - \def\pgfplots@TMPB{0}% - \fi - \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@TMP - \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@TMPB% + \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-limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% +%\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-limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% +%\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% % % Convert any user-specified ticks: - \edef\pgfplots@TMP{\csname pgfplots@#1tick\endcsname}% + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}% % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. - \ifx\pgfplots@TMP\pgfutil@empty + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \pgfplots@toka=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \def\pgfplots@TMPB{data}% - \ifx\pgfplots@TMP\pgfplots@TMPB + \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@TMP\csname pgfplots@firstplot@coords@#1\endcsname - \pgfplotslist@TOK@a=\expandafter{\pgfplots@TMP}% - \edef\pgfplots@TMP{{\the\pgfplotslist@TOK@a}\the\pgfplots@toka}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@TMP\to\pgfplots@TMPC + \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 \else - \pgfplotslist@TOK@a=\expandafter{\pgfplots@TMP}% + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% %\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% - \edef\pgfplots@TMP{{\the\pgfplotslist@TOK@a}\the\pgfplots@toka}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@TMP\to\pgfplots@TMPC + \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@TMPC + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc \fi % % Convert any extra-ticks, see above. - \edef\pgfplots@TMP{\csname pgfplots@extra@#1tick\endcsname}% - \ifx\pgfplots@TMP\pgfutil@empty + \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \pgfplots@toka=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \edef\pgfplots@TMP{{\csname pgfplots@extra@#1tick\endcsname}\the\pgfplots@toka}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@TMP\to\pgfplots@TMPC - \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@TMPC + \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: @@ -4091,23 +4943,130 @@ \newif\ifpgfplots@determinedefaultvalues@xisuniform \newif\ifpgfplots@determinedefaultvalues@yisuniform \newif\ifpgfplots@determinedefaultvalues@needs@check@uniformtick +\newif\ifpgfplots@limits@are@computed -\def\pgfplots@determinedefaultvalues{% +\def\pgfplots@handle@invalid@range{% + % COMPLETELY EMPTY AXIS: + \pgfplots@warning{You have a plot with empty range. Replacing it with default and clearing plots.}% + \ifpgfplots@xislinear + \pgfmathfloatcreate{0}{0.0}{0}% + \global\let\pgfplots@xmin=\pgfmathresult + \pgfmathfloatcreate{1}{1.0}{0}% + \global\let\pgfplots@xmax=\pgfmathresult + \global\let\pgfplots@data@xmin=\pgfplots@xmin + \global\let\pgfplots@data@xmax=\pgfplots@xmax + \else + \gdef\pgfplots@xmin{0}% + \gdef\pgfplots@xmax{1}% + \fi + \ifpgfplots@yislinear + \pgfmathfloatcreate{0}{0.0}{0}% + \global\let\pgfplots@ymin=\pgfmathresult + \pgfmathfloatcreate{1}{1.0}{0}% + \global\let\pgfplots@ymax=\pgfmathresult + \global\let\pgfplots@data@ymin=\pgfplots@ymin + \global\let\pgfplots@data@ymax=\pgfplots@ymax + \else + \gdef\pgfplots@ymin{0}% + \gdef\pgfplots@ymax{1}% + \fi + \def\pgfplots@xtick{}% + \def\pgfplots@ytick{}% + \def\pgfplots@extra@xtick{}% + \def\pgfplots@extra@ytick{}% + \def\pgfplots@xtickten{}% + \def\pgfplots@ytickten{}% + % clear all plots! + \pgfplots@init@cleared@structures +} +\def\pgfplots@check@invalid@range{% + \pgfplots@limits@are@computedtrue + \ifx\pgfplots@xmin\pgfplots@invalidrange@xmin + \pgfplots@limits@are@computedfalse + \fi + \ifx\pgfplots@xmin\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 + \pgfplots@limits@are@computedfalse + \fi \ifpgfplots@limits@are@computed + \ifx\pgfplots@data@xmin\pgfplots@invalidrange@xmin + \global\let\pgfplots@data@xmin=\pgfplots@xmin + \fi + \ifx\pgfplots@data@xmin\pgfplots@invalidrange@xmax + \global\let\pgfplots@data@xmax=\pgfplots@xmax + \fi + \ifx\pgfplots@data@ymin\pgfplots@invalidrange@ymin + \global\let\pgfplots@data@ymin=\pgfplots@ymin + \fi + \ifx\pgfplots@data@ymin\pgfplots@invalidrange@ymax + \global\let\pgfplots@data@ymax=\pgfplots@ymax + \fi + \ifpgfplots@clip@limits + \else + % there is a rare change that min > max. + % Handle that ... + \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + \global\let\pgfplots@xmin=\pgfmathresult + \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + \global\let\pgfplots@xmax=\pgfmathresult + % + \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + \global\let\pgfplots@ymin=\pgfmathresult + \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + \global\let\pgfplots@ymax=\pgfmathresult + \fi \else - % EMPTY AXIS: - \pgfplots@warning{WARNING: You have a plot with empty range. This may produce errors!}% + \pgfplots@handle@invalid@range \fi +}% + + +\def\pgfplots@determinedefaultvalues{% + \pgfplots@check@invalid@range + % + %-------------------------------------------------- + %FIXME + % \ifpgfplots@float@numerics@mode@x + % \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \let\pgfplots@xmin=\pgfmathresult + % \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \let\pgfplots@xmax=\pgfmathresult + % \else + % \pgfmathmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \let\pgfplots@xmin=\pgfmathresult + % \pgfmathmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \let\pgfplots@xmax=\pgfmathresult + % \fi + % \ifpgfplots@float@numerics@mode@y + % \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \let\pgfplots@ymin=\pgfmathresult + % \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \let\pgfplots@ymax=\pgfmathresult + % \else + % \pgfmathmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \let\pgfplots@ymin=\pgfmathresult + % \pgfmathmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \let\pgfplots@ymax=\pgfmathresult + % \fi + %-------------------------------------------------- +%\message{x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax]}% + % % \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@TMPB{data}% - \ifx\pgfplots@xtick\pgfplots@TMPB + \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 @@ -4118,8 +5077,8 @@ \let\pgfplots@ymax@unscaled@as@float=\pgfplots@ymax \pgfplots@apply@data@scale@trafo@to@options@for y% \else - \def\pgfplots@TMPB{data}% - \ifx\pgfplots@ytick\pgfplots@TMPB + \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 @@ -4129,9 +5088,6 @@ % % From now on, we can always work with pgfmath. % We simply need to apply the data scaling trafo before doing so. - \pgfplots@float@numerics@mode@xfalse - \pgfplots@float@numerics@mode@yfalse - % \pgfkeysgetvalue{/pgfplots/minor x tick num}\pgfplots@minor@xtick@num \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num \ifpgfplots@xislinear @@ -4151,30 +5107,8 @@ \fi \fi % - \pgfplots@init@enlarge@limit@booleans - \ifpgfplots@enlargelimits - % relax the sizes. - % - % Idea: if the user chose his xmin,xmax tight to his data, - % this here will look better. - \pgfplots@enlarge@limit@for x - \pgfplots@enlarge@limit@for y - \else - \ifpgfplots@enlargelimits@auto - \ifpgfplots@hide - % there is no axis, so skip this enlargement (unless - % the user explizitly requests it) - \else - % FIXME : this here should be user-configurable! - \ifpgfplots@autocompute@xlim - \pgfplots@enlarge@limit@for x - \fi - \ifpgfplots@autocompute@ylim - \pgfplots@enlarge@limit@for y - \fi - \fi - \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% @@ -4189,7 +5123,7 @@ \fi \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@xislinear - \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@xtick}% + \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@xtick}{\pgfplots@tick@distance@x}% \ifpgfplots@isuniformtick \pgfplots@determinedefaultvalues@xisuniformtrue \else @@ -4217,7 +5151,7 @@ \fi \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@yislinear - \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ytick}% + \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ytick}{\pgfplots@tick@distance@y}% \ifpgfplots@isuniformtick \pgfplots@determinedefaultvalues@yisuniformtrue \else @@ -4269,23 +5203,32 @@ % coordinate clipping to the resulting values and multiplies them % with x- and y scale vectors. \def\pgfplots@prepare@ZERO@coordinates{% - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@fromfixed@x{0}% + \ifpgfplots@xislinear + \ifpgfplots@apply@datatrafo@x + \pgfplots@datascaletrafo@fromfixed@x{0}% + \global\let\pgfplots@ZERO@x=\pgfmathresult + \else + \gdef\pgfplots@ZERO@x{0}% + \fi + \pgfmathmax@{\pgfplots@ZERO@x}{\pgfplots@xmin}% \global\let\pgfplots@ZERO@x=\pgfmathresult \else - \gdef\pgfplots@ZERO@x{0}% + \global\let\pgfplots@ZERO@x=\pgfplots@xmin% \fi - \pgfmathmax@{\pgfplots@ZERO@x}{\pgfplots@xmin}% - \global\let\pgfplots@ZERO@x=\pgfmathresult % - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@fromfixed@y{0}% + \ifpgfplots@yislinear + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@fromfixed@y{0}% + \global\let\pgfplots@ZERO@y=\pgfmathresult + \else + \gdef\pgfplots@ZERO@y{0}% + \fi + \pgfmathmax@{\pgfplots@ZERO@y}{\pgfplots@ymin}% \global\let\pgfplots@ZERO@y=\pgfmathresult \else - \gdef\pgfplots@ZERO@y{0}% + \global\let\pgfplots@ZERO@y=\pgfplots@ymin% \fi - \pgfmathmax@{\pgfplots@ZERO@y}{\pgfplots@ymin}% - \global\let\pgfplots@ZERO@y=\pgfmathresult + % \pgfinterruptboundingbox% \pgfpointxy{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}% \xdef\pgfplots@ZERO@x{\the\pgf@x}% @@ -4308,67 +5251,73 @@ % Arguments: % #1: the output argument for the SCALE. \def\pgfplots@initsizes@getXscale\into#1{% - \expandafter\pgfplots@tmpa\pgfplots@width\relax + \begingroup + \pgf@xa=\pgfplots@width\relax % EXPECTED WIDTH = X = \pgfplots@width % ACTUAL WIDTH = c + x * (xmax-xmin) % where c is a CONSTANT (for the axis labels/tick labels). % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin)) % - % \pgfplots@tmpa := X-c: + % \pgf@xa := X-c: \ifpgfplots@scale@only@axis \else - \advance\pgfplots@tmpa by-45pt% FIXME determine 'c' correctly! + \advance\pgf@xa by-45pt% FIXME determine 'c' correctly! \fi - \ifdim\pgfplots@tmpa<0pt + \ifdim\pgf@xa<0pt \pgfplots@error{Error: Plot width `\pgfplots@width' is too small. This can't be realised while maintaining constant width for y-labels. Sorry, label width are only approximate. You will need to adjust your width.}% - \pgfplots@tmpa=0pt + \pgf@xa=0pt \fi - % \pgfplots@tmpb := x*(xmax-xmin): - \pgfplots@tmpb=\pgfplots@xcoordmaxTEX - \advance\pgfplots@tmpb by-\pgfplots@xcoordminTEX + % \pgf@xb := x*(xmax-xmin): + \pgf@xb=\pgfplots@xcoordmaxTEX + \advance\pgf@xb by-\pgfplots@xcoordminTEX \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\pgfplots@tmpa}% - {\pgf@sys@tonumber\pgfplots@tmpb}% + {\pgf@sys@tonumber\pgf@xa}% + {\pgf@sys@tonumber\pgf@xb}% }% - \let#1=\pgfmathresult %\pgfplots@message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)'; % c=estimated, -% width-c =\the\pgfplots@tmpa, -% x*(xmax[=\the\pgfplots@xcoordmaxTEX] - xmin[=\the\pgfplots@xcoordminTEX)]) = \the\pgfplots@tmpb +% width-c =\the\pgf@xa, +% x*(xmax[=\the\pgfplots@xcoordmaxTEX] - xmin[=\the\pgfplots@xcoordminTEX)]) = \the\pgf@xb % -> x-scale =#1 }% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let#1=\pgfmathresult } % The same as \pgfplots@initsizes@getXscale, just for the height. \def\pgfplots@initsizes@getYscale\into#1{% - \expandafter\pgfplots@tmpa\pgfplots@height\relax + \begingroup + \expandafter\pgf@xa\pgfplots@height\relax % EXPECTED WIDTH = X = \pgfplots@width % ACTUAL WIDTH = c + x * (xmax-xmin) % where c is a CONSTANT (for the axis labels/tick labels). % -> \pgfplots@tmpXscale = (X - c) / (x *(xmax-xmin)) % - % \pgfplots@tmpa := X-c: + % \pgf@xa := X-c: \ifpgfplots@scale@only@axis \else - \advance\pgfplots@tmpa by-45pt\relax% FIXME determine 'c' correctly! + \advance\pgf@xa by-45pt\relax% FIXME determine 'c' correctly! \fi - \ifdim\pgfplots@tmpa<0pt + \ifdim\pgf@xa<0pt \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.}% - \pgfplots@tmpa=0pt + \pgf@xa=0pt \fi - % \pgfplots@tmpb := x*(xmax-xmin): - \pgfplots@tmpb=\pgfplots@ycoordmaxTEX - \advance\pgfplots@tmpb by-\pgfplots@ycoordminTEX + % \pgf@xb := x*(xmax-xmin): + \pgf@xb=\pgfplots@ycoordmaxTEX + \advance\pgf@xb by-\pgfplots@ycoordminTEX \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\pgfplots@tmpa}% - {\pgf@sys@tonumber\pgfplots@tmpb}% + {\pgf@sys@tonumber\pgf@xa}% + {\pgf@sys@tonumber\pgf@xb}% }% - \let#1=\pgfmathresult %\pgfplots@message{pgfplots.sty: Computing 'y' such that 'height = c + y*(ymax-ymin)'; % height=\pgfplots@height, % c=estimated, -% height-c =\the\pgfplots@tmpa, -% y*(ymax[=\the\pgfplots@ycoordmaxTEX] - ymin[=\the\pgfplots@ycoordminTEX)]) = \the\pgfplots@tmpb +% height-c =\the\pgf@xa, +% y*(ymax[=\the\pgfplots@ycoordmaxTEX] - ymin[=\the\pgfplots@ycoordminTEX)]) = \the\pgf@xb % -> y-scale =#1 }% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let#1=\pgfmathresult } @@ -4381,13 +5330,13 @@ % Check if axis limits are empty: \begingroup \expandafter\let\expandafter\if@cur@is@scaled\csname ifpgfplots@apply@datatrafo@#1\endcsname - \expandafter\let\expandafter\min\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\max\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\pgfplots@@min\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@@max\csname pgfplots@#1max\endcsname \let\min@d=\pgf@xa \let\max@d=\pgf@xb \let\diff=\pgf@xc - \expandafter\min@d\min pt - \expandafter\max@d\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! @@ -4395,21 +5344,21 @@ \if@cur@is@scaled % this here should be sufficient because the axis % has absolute values of order O( 10^3 ) or so. - \ifdim\diff<0.01pt + \ifdim\diff<0.0001pt \pgfplots@avoid@emptyrange@@range@is@approx@equaltrue \fi \else % there is no data scaling, so I should be much more defensive % with absolute thresholds... - \ifdim\diff<0.01pt + \ifdim\diff<0.0001pt \pgfplots@avoid@emptyrange@@range@is@approx@equaltrue \fi \fi \ifpgfplots@avoid@emptyrange@@range@is@approx@equal - \pgfplots@warning{WARNING: Axis range for axis #1 (transformed: [\min:\max]) is approximately equal; enlargeing it.}% - % the case \min ~= \max + \pgfplots@warning{Axis range for axis #1 is approximately equal; enlargeing it.}% + % the case \pgfplots@@min ~= \pgfplots@@max % - % enlarge \max and shrink \min: + % enlarge \pgfplots@@max and shrink \min: \ifdim\max@d<0pt \ifdim\max@d<-1pt \max@d=0.8\max@d @@ -4425,19 +5374,53 @@ \else \ifdim\max@d=0pt \if@cur@is@scaled - % we can't simply add a constant in the - % transformed range. + \expandafter\let\expandafter\min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname + \expandafter\let\expandafter\max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname + % **sigh**. That's really work. % - % So: set limits to [-1,1] = [-1.0e0,+1.0e0] - \pgfmathfloatcreate{2}{1.0}{0}% - \csname pgfplots@datascaletrafo@#1\endcsname{\pgfmathresult}% - \let\min=\pgfmathresult - \pgfmathfloatcreate{1}{1.0}{0}% - \csname pgfplots@datascaletrafo@#1\endcsname{\pgfmathresult}% - \let\max=\pgfmathresult -%\pgfplots@message{[trafo shift = \csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname; setting limits -1:1]}% - \expandafter\min@d\min pt - \expandafter\max@d\max pt + % This here happens ALWAYS if min == max for + % linear axis because the scaling + % transformation will result in T(min) = T(max) = 0 + % + % -> we need to enlarge limits in floating + % point arithmetics. + % + \pgfmathfloatcreate{0}{0.0}{0}% + \let\pgfplotsmath@zero=\pgfmathresult + % + \ifx\max@unscaled\pgfplotsmath@zero + % max == 0 + \pgfmathfloatcreate{1}{1.0}{0}% + \let\max@unscaled=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{0}% + \let\min@unscaled=\pgfmathresult + \else + % + \pgfmathfloatcreate{1}{1.2}{0}% + \let\pgfplotsmath@scalea=\pgfmathresult + \pgfmathfloatcreate{1}{8.0}{-1}% + \let\pgfplotsmath@scaleb=\pgfmathresult + % + \pgfmathfloatlessthan@{\pgfplotsmath@zero}{\max@unscaled}% + \ifpgfmathfloatcomparison + % 0 < max + \pgfmathfloatmultiply@{\max@unscaled}{\pgfplotsmath@scalea}% + \let\max@unscaled=\pgfmathresult + \pgfmathfloatmultiply@{\min@unscaled}{\pgfplotsmath@scaleb}% + \let\min@unscaled=\pgfmathresult + \else + \pgfmathfloatmultiply@{\max@unscaled}{\pgfplotsmath@scaleb}% + \let\max@unscaled=\pgfmathresult + \pgfmathfloatmultiply@{\min@unscaled}{\pgfplotsmath@scalea}% + \let\min@unscaled=\pgfmathresult + \fi + \fi + \csname pgfplots@datascaletrafo@#1\endcsname{\min@unscaled}% + \let\pgfplots@@min=\pgfmathresult + \csname pgfplots@datascaletrafo@#1\endcsname{\max@unscaled}% + \let\pgfplots@@max=\pgfmathresult + \min@d=\pgfplots@@min pt + \max@d=\pgfplots@@max pt \else \advance\max@d by1pt \advance\min@d by-1pt @@ -4448,16 +5431,16 @@ \fi \fi \fi - \xdef\pgfplots@TMP{\pgf@sys@tonumber{\min@d}}% - \xdef\pgfplots@TMPB{\pgf@sys@tonumber{\max@d}}% -%\pgfplots@message{ -> #1 = \pgfplots@TMP : \pgfplots@TMPB;}% + \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\min@d}}% + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\max@d}}% +%\pgfplots@message{ -> #1 = \pgfplots@glob@TMPa : \pgfplots@glob@TMPb;}% \else - \global\let\pgfplots@TMP=\min% - \global\let\pgfplots@TMPB=\max% + \global\let\pgfplots@glob@TMPa=\pgfplots@@min% + \global\let\pgfplots@glob@TMPb=\pgfplots@@max% \fi \endgroup - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@TMP - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@TMPB + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@glob@TMPa + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb } % PRECONDITION: @@ -4563,10 +5546,10 @@ % INIT. % % - \pgfpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% \pgfplots@xcoordminTEX=\pgf@x \pgfplots@ycoordminTEX=\pgf@y - \pgfpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% \pgfplots@xcoordmaxTEX=\pgf@x \pgfplots@ycoordmaxTEX=\pgf@y % @@ -4609,16 +5592,15 @@ % % Apply scaling: \pgfpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% - \pgfplots@tmpa=\pgf@x - \pgfplots@tmpb=\pgf@y -%\message{initscaling: got x-scaling \the\pgfplots@tmpa, and y-scaling \the\pgfplots@tmpb}% + \edef\pgfplots@tmpscale@x{\the\pgf@x}% + \edef\pgfplots@tmpscale@y{\the\pgf@y}% \ifx\pgfplots@x\pgfutil@empty - \pgfsetxvec{\pgfqpoint{\pgfplots@tmpa}{0pt}}% + \pgfsetxvec{\pgfqpoint{\pgfplots@tmpscale@x}{0pt}}% \else \pgfsetxvec{\pgfpoint{\pgfplots@x}{0pt}}% \fi \ifx\pgfplots@y\pgfutil@empty - \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@tmpb}}% + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@tmpscale@y}}% \else \pgfsetyvec{\pgfpoint{0pt}{\pgfplots@y}}% \fi @@ -4643,10 +5625,10 @@ % 3. The user supplied 'x' and or 'y'. Simply use them, its % accurate. % - \pgfpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% \pgfplots@xcoordminTEX=\pgf@x \pgfplots@ycoordminTEX=\pgf@y - \pgfpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% \ifx\pgfplots@rectangle@width\pgfutil@empty \pgfplots@xcoordmaxTEX=\pgf@x \else @@ -4674,6 +5656,45 @@ %-------------------------------------------------- } +% This here is a low-weight node. It can ONLY be used during axis +% descriptions and is completely useless otherwise. +% +% See pgfplots@low@level@shape below. +\pgfdeclareshape{pgfplots@low@level@shape@INNER}{% + \nodeparts{image}% + \anchor{image}{% + \pgf@x=0pt + \pgf@y=0pt + }% + % + % + \anchor{center}{\pgfqpointxy{0.5}{0.5}}% + \anchor{north}{\pgfqpointxy{0.5}{1}}% + \anchor{north east}{\pgfqpointxy{1}{1}}% + \anchor{east}{\pgfqpointxy{1}{0.5}} + \anchor{south east}{\pgfqpointxy{1}{0}}% + \anchor{south}{\pgfqpointxy{0.5}{0}}% + \anchor{south west}{\pgfqpointxy{0}{0}}% + \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}}% + %% + %% + %% + %% + \anchorborder{}% + \backgroundpath{}%\pgfpathrectangle{\pgfpointorigin}{\upperrightinnercorner}}% + \foregroundpath{}% + \behindbackgroundpath{}% + \beforebackgroundpath{}% + \behindforegroundpath{}% + \beforeforegroundpath{}% +} % This is the main axis shape. % @@ -4685,10 +5706,13 @@ \pgf@y=\ht\pgfnodepartimagebox }% \savedanchor\lowerleftinnercorner{% - \pgfpoint{\pgfplots@savedanchor@inner@lowerleft@x}{\pgfplots@savedanchor@inner@lowerleft@y}% + \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% }% \savedanchor\upperrightinnercorner{% - \pgfpoint{\pgfplots@savedanchor@inner@upperright@x}{\pgfplots@savedanchor@inner@upperright@y}% + \pgfqpoint{\pgfplots@savedanchor@inner@upperright@x\relax}{\pgfplots@savedanchor@inner@upperright@y\relax}% + }% + \savedanchor\origin{% + \pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}% }% % \nodeparts{image}% @@ -4697,43 +5721,6 @@ \pgf@y=0pt }% % - \anchor{outer north}{% - \upperrightcorner - \pgf@x=.5\pgf@x - }% - \anchor{outer north east}{\upperrightcorner}% - \anchor{outer east}{% - \upperrightcorner - \pgf@y=.5\pgf@y - }% - \anchor{outer south east}{% - \upperrightcorner - \pgf@y=0pt - }% - \anchor{outer south}{% - \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=0pt - }% - \anchor{outer south west}{% - \pgf@x=0pt - \pgf@y=0pt - }% - \anchor{outer west}{% - \upperrightcorner - \pgf@x=0pt - \pgf@y=.5\pgf@y - }% - \anchor{outer north west}{% - \upperrightcorner - \pgf@x=0pt - }% - \anchor{outer center}{% - \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=.5\pgf@y - }% - % % \anchor{center}{% \lowerleftinnercorner @@ -4796,6 +5783,75 @@ \pgf@x=\pgf@xa }% %% + \anchor{origin}{% + \origin + }% + \anchor{above origin}{% + \origin + \pgf@xa=\pgf@x + \upperrightinnercorner + \pgf@x=\pgf@xa + }% + \anchor{left of origin}{% + \origin + \pgf@xa=\pgf@y + \lowerleftinnercorner + \pgf@y=\pgf@xa + }% + \anchor{right of origin}{% + \origin + \pgf@xa=\pgf@y + \upperrightinnercorner + \pgf@y=\pgf@xa + }% + \anchor{below origin}{% + \origin + \pgf@xa=\pgf@x + \lowerleftinnercorner + \pgf@x=\pgf@xa + }% + % + %% + % + \anchor{outer north}{% + \upperrightcorner + \pgf@x=.5\pgf@x + }% + \anchor{outer north east}{\upperrightcorner}% + \anchor{outer east}{% + \upperrightcorner + \pgf@y=.5\pgf@y + }% + \anchor{outer south east}{% + \upperrightcorner + \pgf@y=0pt + }% + \anchor{outer south}{% + \upperrightcorner + \pgf@x=.5\pgf@x + \pgf@y=0pt + }% + \anchor{outer south west}{% + \pgf@x=0pt + \pgf@y=0pt + }% + \anchor{outer west}{% + \upperrightcorner + \pgf@x=0pt + \pgf@y=.5\pgf@y + }% + \anchor{outer north west}{% + \upperrightcorner + \pgf@x=0pt + }% + \anchor{outer center}{% + \upperrightcorner + \pgf@x=.5\pgf@x + \pgf@y=.5\pgf@y + }% + % + % + %% %% \anchor{above north}{% \upperrightcorner @@ -4875,7 +5931,6 @@ }% %% %% - %% \anchorborder{% % Call a function that computes a border point. Since this % function will modify dimensions like \pgf@x, we must move them to @@ -4894,6 +5949,50 @@ \beforeforegroundpath{}% } +\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}% + \fi + \ifpgfplots@hide@y\else + \pgfplots@drawticklines@for{y}{1}% + \fi + % + \pgfplots@drawaxis@lines + % + \ifpgfplots@hide@x\else + \pgfplots@drawticklabels@for{x}{0}% + \fi + \ifpgfplots@hide@y\else + \pgfplots@drawticklabels@for{y}{1}% + \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}% + \fi + \fi + \ifpgfplots@hide@y\else + \ifx\pgfplots@extra@ytick\pgfutil@empty + \else + \expandafter\pgfplots@draw@extra@ticks@for\expandafter y\expandafter1\expandafter{\pgfplots@extra@ytick}% + \fi + \fi +}% + \def\pgfplots@BEGIN@init@and@draw@axis{% \pgfplots@determinedefaultvalues \setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup @@ -4905,13 +6004,9 @@ \pgfsetbaseline{\pgf@picminy}% % \scope - \ifpgfplots@hide + \ifpgfplots@axis@on@top \else - \pgfplots@drawaxis@lines - \expandafter\pgfplots@drawxaxis\expandafter{\pgfplots@xtick}% - \expandafter\pgfplots@draw@extra@ticks@for\expandafter x\expandafter{\pgfplots@extra@xtick}% - \expandafter\pgfplots@drawyaxis\expandafter{\pgfplots@ytick}% - \expandafter\pgfplots@draw@extra@ticks@for\expandafter y\expandafter{\pgfplots@extra@ytick}% + \pgfplots@draw@axis \fi \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) @@ -4921,19 +6016,56 @@ \def\pgfplots@END@init@and@draw@axis{% \endscope% + % + \ifpgfplots@axis@on@top + \pgfplots@draw@axis + \else + \fi + % + % whats the better sequence for \ifpgfplots@axis@on@top and \ifpgfplots@clip@marker@paths !? + % This here looks better, I think... markers should not be obscured by descriptions. + \ifpgfplots@clip@marker@paths + \else + \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{% + \pgfplots@loc@TMPa + }% + \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear. + \fi + % + \begingroup + \pgfkeysvalueof{/pgfplots/after end axis/.@cmd}\pgfeov% + \endgroup + % } -% Writes output to \pgfplots@TMP +% Writes output to \pgfmathresult \def\pgfplots@filter@input@ticks@with@log#1{% - \let\pgfplots@TMP=\pgfutil@empty - \foreach \pgfplots@TMPB in {#1} {% - \expandafter\pgfmathlog@\expandafter{\pgfplots@TMPB}% - \ifx\pgfplots@TMP\pgfutil@empty - \xdef\pgfplots@TMP{\pgfmathresult}% + \let\pgfplots@glob@TMPa=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPb}% + \ifx\pgfplots@glob@TMPa\pgfutil@empty + \xdef\pgfplots@glob@TMPa{\pgfmathresult}% \else - \xdef\pgfplots@TMP{\pgfplots@TMP,\pgfmathresult}% + \xdef\pgfplots@glob@TMPa{\pgfplots@glob@TMPa,\pgfmathresult}% \fi }% + \let\pgfmathresult=\pgfplots@glob@TMPa +} + +% Writes output to \pgfmathresult +% #1: the input ticks +% #2: the transformation command key as macro +\def\pgfplots@filter@input@ticks@with@highleveltrafo#1#2{% + \let\pgfplots@glob@TMPa=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + \expandafter#2\expandafter{\pgfplots@loc@TMPb}\pgfeov% + \ifx\pgfplots@glob@TMPa\pgfutil@empty + \xdef\pgfplots@glob@TMPa{\pgfmathresult}% + \else + \xdef\pgfplots@glob@TMPa{\pgfplots@glob@TMPa,\pgfmathresult}% + \fi + }% + \let\pgfmathresult=\pgfplots@glob@TMPa } \tikzdeclarecoordinatesystem{axis}{\pgfplots@evalute@tikz@coord@system@interface#1\pgfplots@coord@end} @@ -4941,15 +6073,20 @@ % Assigns \pgfmathresult := canvas coordinate (#2) for axis #1. \long\def\pgfplots@evalute@tikz@coord@system@interface@for#1#2{% + \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc + \def\pgfmathresult{#2}% + \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key + \else + \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 - \csname pgfplots@datascaletrafo@fromfixed@#1\endcsname{#2}% - \else - \def\pgfmathresult{#2}% + \csname pgfplots@datascaletrafo@fromfixed@#1\endcsname{\pgfplots@loc@TMPc}% \fi \else - \pgfmathlog@{#2}% + \pgfmathlog@{\pgfplots@loc@TMPc}% \fi } @@ -4958,10 +6095,10 @@ \pgfplots@evalute@tikz@coord@system@interface@for{x}{#1}% \let\pgfplots@evaluate@tikz@coord@x=\pgfmathresult \pgfplots@evalute@tikz@coord@system@interface@for{y}{#2}% - \xdef\pgfplots@TMP{\pgfplots@evaluate@tikz@coord@x pt}% - \xdef\pgfplots@TMPB{\pgfmathresult pt}% + \xdef\pgfplots@glob@TMPa{\pgfplots@evaluate@tikz@coord@x}% + \xdef\pgfplots@glob@TMPb{\pgfmathresult}% \endgroup - \pgfpointxy{\pgfplots@TMP}{\pgfplots@TMPB}% + \pgfqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% } % In case of (semi-) logplots, this command will @@ -4970,11 +6107,9 @@ % % All subsequent commands will then work with logarithmic coordinates. % -% @see pgfmathlog.sty for details about the implementation of log(). -% % PRECONDITION: % - The user input options have been set correctly, -% - the option processing has not yet begun +% - the options have been set, but are not applied % % POSTCONDITION: % - any user input for log-axis has been replaced by its log @@ -4983,120 +6118,161 @@ % See also: % \pgfplots@apply@data@scale@trafo@to@options@for \def\pgfplots@prepare@coord@filtering@for#1{% - \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \def\pgfmathresult{##1}% - }% - \pgfkeysgetvalue{/pgfplots/#1filter}\pgfplots@TMP - \ifx\pgfplots@TMP\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc + \expandafter\let\csname pgfplots@highlevel@trafo@#1\endcsname=\pgfplots@loc@TMPc + \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key + % no high-level external coord trafos. + % Simply use identity: + \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% + \def\pgfmathresult{##1}% + }% \else - \expandafter\let\csname pgfplots@#1filter@backwcompat\endcsname=\pgfplots@TMP - \pgfplots@toka={WARNING: /pgfplots/#1filter is deprecated. Please use /pgfplots/#1 filter/.code={\def\pgfmathresult{\#1}}}% - \pgfplots@warning{\the\pgfplots@toka}% + % Apply external coordinate trafo to all input values: + \expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{% + \noexpand\def\noexpand\pgfmathresult{##1}% + \expandafter\noexpand\csname pgfplots@highlevel@trafo@#1\endcsname{##1}\noexpand\pgfeov + }% + % + % The transformation is now \pgfplots@loc@TMPc + % + % any user-specified axis limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult + \fi + % + % any user specified axis ticks: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \def\pgfplots@loc@TMPb{data}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \else + \expandafter\pgfplots@filter@input@ticks@with@highleveltrafo\expandafter{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}% + \expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfmathresult}% + \fi + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@filter@input@ticks@with@highleveltrafo\expandafter{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}% + \expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfmathresult}% + \fi + % + \fi + % + \pgfkeysgetvalue{/pgfplots/#1filter}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\let\csname pgfplots@#1filter@backwcompat\endcsname=\pgfplots@loc@TMPa + \t@pgfplots@tokc={/pgfplots/#1filter is deprecated. Please use /pgfplots/#1 filter/.code={\def\pgfmathresult{\#1}}}% + \pgfplots@warning{\the\t@pgfplots@tokc}% \pgfkeys{/pgfplots/#1 filter/.code={\csname pgfplots@#1filter@backwcompat\endcsname{##1}\to\pgfmathresult}}% \fi - \csname pgfplots@float@numerics@mode@#1false\endcsname \csname ifpgfplots@#1islinear\endcsname - \ifpgfplots@disabledatascaling - \csname pgfplots@apply@datatrafo@#1false\endcsname - \pgfplots@apply@datatrafofalse - \else - \csname pgfplots@apply@datatrafo@#1true\endcsname - \csname pgfplots@float@numerics@mode@#1true\endcsname - \pgfplots@apply@datatrafotrue - \fi + \csname pgfplots@apply@datatrafo@#1true\endcsname + \pgfplots@apply@datatrafotrue \ifpgfplots@apply@datatrafo % Check for any existing axis limits: - \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1min\endcsname - \ifx\pgfplots@TMP\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult \fi - \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1max\endcsname - \ifx\pgfplots@TMP\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\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 % any user-specified axis limits: - \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1min\endcsname - \ifx\pgfplots@TMP\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathlog@\expandafter{\pgfplots@TMP}% + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult \fi - \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1max\endcsname - \ifx\pgfplots@TMP\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfmathlog@\expandafter{\pgfplots@TMP}% + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % % any user specified axis ticks: - \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1tick\endcsname - \ifx\pgfplots@TMP\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \def\pgfplots@TMPB{data}% - \ifx\pgfplots@TMP\pgfplots@TMPB + \def\pgfplots@loc@TMPb{data}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb \else - \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@TMP}% - \expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfplots@TMP}% + \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}% + \expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfmathresult}% \fi \fi - \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@extra@#1tick\endcsname - \ifx\pgfplots@TMP\pgfutil@empty + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@TMP}% - \expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfplots@TMP}% + \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}% + \expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfmathresult}% \fi % - \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \pgfmathlog@{##1}% - }% - %-------------------------------------------------- - % \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1filter\endcsname - % \ifx\pgfplots@TMP\pgfutil@empty - % \expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{% - % \pgfmathlog@{##1}% - % \let##2=\pgfmathresult - % }% - % \else - % \expandafter\let\csname pgfplots@#1filter@orig\endcsname=\pgfplots@TMP - % \expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{% - % \pgfmathlog@{##1}% - % \ifx\pgfmathresult\pgfutil@empty - % \let##2=\pgfutil@empty - % \else - % \expandafter\expandafter\csname pgfplots@#1filter@orig\endcsname\pgfmathresult\to##2\relax - % \fi - % }% - % \fi - % \expandafter\let\expandafter\pgfplots@TMP\csname addplot@log@compute@#1filter\endcsname - % \expandafter\let\csname pgfplots@#1filter\endcsname\pgfplots@TMP - %-------------------------------------------------- + % append logarithm to prepare coord. + % + \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}% + }% + \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}}% + \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 } \def\pgfplots@create@axis@descriptions{% - \ifpgfplots@hide + \ifpgfplots@hide@x \else - \ifx\pgfplots@xlabel\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty \else - \pgfplots@show@label{x}% + \pgfplots@show@label{x}{\pgfplots@label@}% \fi - \ifx\pgfplots@ylabel\pgfutil@empty + \fi + \ifpgfplots@hide@y + \else + \pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty \else - \pgfplots@show@label{y}% + \pgfplots@show@label{y}{\pgfplots@label@}% \fi \fi - \ifx\pgfplots@title\pgfutil@empty + % + \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \pgfplots@show@title + \expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}% \fi \pgfplots@createlegend } @@ -5124,12 +6300,12 @@ % @see % \pgfplots@datascaletrafo@fromfixed@x \def\pgfplots@datascaletrafo@x#1{% - \pgfmathfloatshift{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@x}% } \def\pgfplots@datascaletrafo@x@noshift#1{% - \pgfmathfloatshift{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@x}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } @@ -5143,7 +6319,7 @@ } \def\pgfplots@datascaletrafo@y#1{% - \pgfmathfloatshift{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@y}% } @@ -5152,7 +6328,7 @@ \expandafter\pgfplots@datascaletrafo@y\expandafter{\pgfmathresult}% } \def\pgfplots@datascaletrafo@y@noshift#1{% - \pgfmathfloatshift{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } @@ -5178,7 +6354,7 @@ \else \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% \edef\pgfplots@data@scale@trafo@EXPONENT@x{-\pgfplots@data@scale@trafo@EXPONENT@x}% - \expandafter\pgfmathfloatshift\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@x}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@x}% \fi \pgfmath@smuggleone\pgfmathresult \endgroup @@ -5191,7 +6367,7 @@ \else \pgfmathfloatparsenumber{#1}% \edef\pgfplots@data@scale@trafo@EXPONENT@x{-\pgfplots@data@scale@trafo@EXPONENT@x}% - \expandafter\pgfmathfloatshift\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@x}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@x}% \fi \pgfmath@smuggleone\pgfmathresult \endgroup @@ -5207,7 +6383,7 @@ \else \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% \edef\pgfplots@data@scale@trafo@EXPONENT@y{-\pgfplots@data@scale@trafo@EXPONENT@y}% - \expandafter\pgfmathfloatshift\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@y}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@y}% \fi \pgfmath@smuggleone\pgfmathresult \endgroup @@ -5221,7 +6397,7 @@ \else \pgfmathfloatparsenumber{#1}% \edef\pgfplots@data@scale@trafo@EXPONENT@y{-\pgfplots@data@scale@trafo@EXPONENT@y}% - \expandafter\pgfmathfloatshift\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@y}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@y}% \fi \pgfmath@smuggleone\pgfmathresult \endgroup @@ -5297,16 +6473,16 @@ % #1: input macro \def\pgfplots@setkeys@from@macro#1{% \let\pgfplots@rmopts=\pgfutil@empty - \def\pgfplots@TMP{\pgfqkeysfiltered{/pgfplots}}% - \expandafter\pgfplots@TMP\expandafter{#1}% + \def\pgfplots@loc@TMPa{\pgfqkeysfiltered{/pgfplots}}% + \expandafter\pgfplots@loc@TMPa\expandafter{#1}% } % #1: macro % #2: style name \long\def\pgfplots@append@keymacro@to@style#1#2{% - \pgfplotslist@TOK@a={#2/.append style=}% - \pgfplotslist@TOK@b=\expandafter{#1}% - \edef\pgfplots@setkeys@TMP{\the\pgfplotslist@TOK@a{\the\pgfplotslist@TOK@b}}% + \t@pgfplots@toka={#2/.append style=}% + \t@pgfplots@tokb=\expandafter{#1}% + \edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% \expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}% %\pgfplots@message{tikzstyle{#2}+=[#1]}% } @@ -5314,22 +6490,23 @@ % #1: macro % #2: style name \long\def\pgfplots@set@keymacro@to@style#1#2{% - \pgfplotslist@TOK@a={#2/.style=}% - \pgfplotslist@TOK@b=\expandafter{#1}% - \edef\pgfplots@setkeys@TMP{\the\pgfplotslist@TOK@a{\the\pgfplotslist@TOK@b}}% + \t@pgfplots@toka={#2/.style=}% + \t@pgfplots@tokb=\expandafter{#1}% + \edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% \expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}% %\pgfplots@message{tikzstyle{#2}=[#1]}% } -\def\pgfplots@preset@keys{% - \def\pgfplots@at{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% -} - % backwards compatibility: \let\prettyprintnumber=\pgfmathprintnumber% \def\pgfplots@set@options#1{% - \pgfplots@preset@keys + \pgfutil@ifundefined{tikz@lastx}{% + % no warning. Its not that important anyway, I think. + \def\pgfplots@at{\pgfpointorigin}% + }{% + \def\pgfplots@at{\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}% + }% % % Temporarily assign families to 'name' and 'alias' options. % This allows to get the names - they should not be appended to @@ -5452,9 +6629,11 @@ \pgfplots@set@keys@from@tikz@style{every major grid}% \pgfkeysdeactivatefamily{/pgfplots/tick}% % - \pgfkeysactivatefamily{/pgfplots}% - \pgfplots@set@keys@from@tikz@style{every axis plot}% - \pgfkeysdeactivatefamily{/pgfplots}% + %-------------------------------------------------- + % \pgfkeysactivatefamily{/pgfplots}% + % \pgfplots@set@keys@from@tikz@style{every axis plot}% + % \pgfkeysdeactivatefamily{/pgfplots}% + %-------------------------------------------------- % \pgfkeysactivatefamily{/pgfplots/descriptions}% \pgfkeysactivatefamily{/pgfplots/tick}% @@ -5475,8 +6654,8 @@ {\pgfplots@remaining@input}% {every axis}% \pgfplots@deactivefamiliescmd -%\pgfkeysgetvalue{/tikz/every axis/.@cmd}\pgfplots@TMP -%\message{every axis is now '\meaning\pgfplots@TMP'}% +%\pgfkeysgetvalue{/tikz/every axis/.@cmd}\pgfplots@loc@TMPa +%\message{every axis is now '\meaning\pgfplots@loc@TMPa'}% % \pgfkeysdeactivatefamily{/pgfplots/style commands}% \global\pgfkeysgetvalue{/pgfplots/xmin}{\pgfplots@xmin}% @@ -5484,18 +6663,22 @@ \global\pgfkeysgetvalue{/pgfplots/ymin}{\pgfplots@ymin}% \global\pgfkeysgetvalue{/pgfplots/ymax}{\pgfplots@ymax}% % - \def\pgfplots@TMP{data}% + \def\pgfplots@loc@TMPa{data}% \pgfplots@collect@firstplot@astickfalse - \ifx\pgfplots@xtick\pgfplots@TMP + \ifx\pgfplots@xtick\pgfplots@loc@TMPa \pgfplots@collect@firstplot@asticktrue \fi - \ifx\pgfplots@ytick\pgfplots@TMP + \ifx\pgfplots@ytick\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 \fi + \pgfkeysdef{/pgfplots/.unknown}{% + \let\pgfplots@searchname=\pgfkeyscurrentname + \pgfkeysalso{/tikz/\pgfplots@searchname=##1}% + }% } \def\pgfplots@install@abbrev@commands{ @@ -5503,6 +6686,8 @@ \let\pgfplots@orig@plot=\plot % \let\axispath=\pgfplots@path + \let\pgfplotsinterruptdatabb=\pgfplots@interruptdatabb + \let\endpgfplotsinterruptdatabb=\endpgfplots@interruptdatabb % \let\addplot=\pgfplots@addplot \let\plot=\addplot @@ -5523,6 +6708,11 @@ \or2.197224 \fi }% + \def\axisdefaultticklabel{$\pgfmathprintnumber{\tick}$}% + \def\axisdefaultticklabellog{% + \pgfkeysgetvalue{/pgfplots/log number format code/.@cmd}\pgfplots@log@label@style + \expandafter\pgfplots@log@label@style\tick\pgfeov + }% % \let\legend=\pgfplots@command@legend \let\addlegendentry=\pgfplots@addlegendentry @@ -5537,18 +6727,17 @@ }% % temporary (local) variables inside of axis -\newif\ifpgfplots@autocomputelimits -\newif\ifpgfplots@autocompute@xlim -\newif\ifpgfplots@autocompute@ylim +\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@apply@datatrafo@x \newif\ifpgfplots@apply@datatrafo@y \newif\ifpgfplots@apply@datatrafo -\newif\ifpgfplots@float@numerics@mode@x -\newif\ifpgfplots@float@numerics@mode@y \newif\ifpgfplots@datascaletrafo@initialised \newif\ifpgfplots@draw@at@end -\newif\ifpgfplots@limits@are@computed -\newif\ifpgfplots@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY % Extracts single components of an entry of % \pgfplots@stored@plotlist @@ -5565,6 +6754,67 @@ \def\pgfplots@stored@current@postcmd{#4}% } +\def\pgfplots@init@cleared@structures{% + \global\pgfplotslistnewempty\pgfplots@plotspeclist + \global\pgfplotslistnewempty\pgfplots@legend + \global\pgfplotslistnewempty\pgfplots@stored@plotlist + \global\pgfplots@numplots=0 + \let\pgfplots@already@computed@legend@node=\pgfutil@empty +} + +% The implementation for \label{foo} after \addplot. It allows to +% \ref{foo} (it inserts the 'legend image code'). +% +% I only need to overwrite '\label'; the rest is done by LaTeX. +% +% THIS IS INCOMPATIBLE WITH plain TeX and ConTeXt! Don't use it, it +% doesn't hurt. +\def\pgfplots@plot@label#1{% + \ifx\pgfplots@last@plot@style\pgfutil@empty + \pgfplots@error{Can't create \string\label{#1}: it needs to be called after \string\addplot.}% + \else + \begingroup + % I'd like to get all options which are INDEPENDENT of + % pgfplots. Idea: expand all /pgfplots-keys and collect + % everything which belongs NOT to /pgfplots. This is the + % completely expanded rest. At least, I hope so and it appears + % to work. + \pgfkeysinstallkeyfilter + {/pgf/key filters/and} + {{/pgf/key filters/is descendant of=/pgfplots}% + {/pgf/key filters/defined}}% + \def\pgfplots@label@tikzopts{}% + \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}% + \def\pgfplots@loc@TMPa{\pgfqkeysfiltered{/tikz}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@last@plot@style}% + % + \pgfkeysgetvalue{/pgfplots/every crossref picture/.@cmd}{\pgfplots@crossref@pic}% + \pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}% + \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}% + \edef\pgfplots@loc@TMPa{% + \noexpand\begingroup + \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@tokb}}% + \noexpand\pgfkeysdef{/pgfplots/every crossref picture}{\the\t@pgfplots@tokc}% + \noexpand\tikz[/pgfplots/every crossref picture]{\the\t@pgfplots@toka}% + \noexpand\endgroup% + }% + \pgfplots@command@to@string{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}% + \global\let\pgfplots@glob@TMPb=\pgfplots@loc@TMPa + \endgroup + \let\@currentlabel=\pgfplots@glob@TMPb + \pgfplots@original@LaTeX@label{#1}% + \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@environment@opt[#1]{% \begingroup \pgfplots@install@abbrev@commands @@ -5586,12 +6836,7 @@ % -------------------- % Allocations: % -------------------- - \global\pgfplots@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITYfalse - \global\pgfplotslistnewempty\pgfplots@plotspeclist - \global\pgfplotslistnewempty\pgfplots@legend - \global\pgfplotslistnewempty\pgfplots@stored@plotlist - \global\pgfplots@numplots=0 - \let\pgfplots@already@computed@legend@node=\pgfutil@empty + \pgfplots@init@cleared@structures % % -------------------- % Option preprocessing @@ -5604,49 +6849,64 @@ \pgfplots@datascaletrafo@initialisedtrue% there is no trafo. \fi % + \ifpgfplots@xislinear + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@xmin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@xmax=\pgfmathresult + \else + \def\pgfplots@invalidrange@xmin{16300}% + \def\pgfplots@invalidrange@xmax{-16300}% + \fi + \ifpgfplots@yislinear + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@ymin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@ymax=\pgfmathresult + \else + \def\pgfplots@invalidrange@ymin{16300}% + \def\pgfplots@invalidrange@ymax{-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 + % + \pgfplots@autocompute@all@limitstrue \ifx\pgfplots@xmin\pgfutil@empty - \pgfplots@autocompute@xlimtrue - \gdef\pgfplots@xmin{16300}% - \ifpgfplots@float@numerics@mode@x - \pgfmathfloatcreate{1}{1.0}{324}% - \global\let\pgfplots@xmin=\pgfmathresult - \fi + \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@xlimtrue - \gdef\pgfplots@xmax{-16300}% - \ifpgfplots@float@numerics@mode@x - \pgfmathfloatcreate{2}{1.0}{324}% - \global\let\pgfplots@xmax=\pgfmathresult - \fi + \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@ylimtrue - \gdef\pgfplots@ymin{16300}% - \ifpgfplots@float@numerics@mode@y - \pgfmathfloatcreate{1}{1.0}{324}% - \global\let\pgfplots@ymin=\pgfmathresult - \fi + \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@ylimtrue - \gdef\pgfplots@ymax{-16300}% - \ifpgfplots@float@numerics@mode@y - \pgfmathfloatcreate{2}{1.0}{324}% - \global\let\pgfplots@ymax=\pgfmathresult - \fi + \pgfplots@autocompute@ymaxtrue + \global\let\pgfplots@ymax=\pgfplots@invalidrange@ymax + \pgfplots@autocomputeanylimitstrue + \else + \pgfplots@autocompute@all@limitsfalse \fi % - \global\pgfplots@limits@are@computedtrue - \ifpgfplots@autocompute@xlim + % autocomputelimits := at least one limit needs to be updated. + \ifpgfplots@autocomputeanylimits \pgfplots@draw@at@endtrue - \pgfplots@autocomputelimitstrue - \global\pgfplots@limits@are@computedfalse - \fi - \ifpgfplots@autocompute@ylim - \pgfplots@draw@at@endtrue - \pgfplots@autocomputelimitstrue - \global\pgfplots@limits@are@computedfalse \fi % % @@ -5677,6 +6937,12 @@ \pgfplots@stacked@reversefalse \fi % + \pgfutil@ifundefined{label}{\relax}{% + \let\pgfplots@original@LaTeX@label=\label + \let\label=\pgfplots@plot@label + }% + \global\let\pgfplots@last@plot@style=\pgfutil@empty + % % any \path command is invalid inside of an axis. % Use \axispath instead: \def\numplots{\the\pgfplots@numplots}% @@ -5690,8 +6956,8 @@ \pgfplots@nextcommand } \def\endpgfplots@environment@opt{% - \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% \xdef\numplots{\the\pgfplots@numplots}% + \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% % % restore old \path command: \let\path=\pgfplots@orig@path @@ -5702,18 +6968,20 @@ % All plotting commands have been read. % -> apply postponed drawing commands! % -------------------- - \ifpgfplots@draw@at@end + \ifpgfplots@draw@at@end% ALWAYS TRUE - this is obsolete \def\pgfplots@nextcommand{% \pgfplots@BEGIN@init@and@draw@axis \pgfplots@stacked@initialise + \global\pgfplotslistnewempty\pgfplots@stored@markerlist \ifpgfplots@stacked@reverse % This here applies any scaling trafos and assembles a % NEW \pgfplots@stored@plotlist! \pgfplots@stacked@finalize@stored@plots \fi - \pgfplotslistforeach\pgfplots@stored@plotlist\as\pgfplots@TMP{% - \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@TMP + \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 \ifx\pgfplots@stored@current@cmd\pgfutil@empty \pgfplots@stored@current@data% @@ -5722,14 +6990,11 @@ % command! \ifpgfplots@stacked@reverse % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. + \pgfplots@stacked@draw@reversed@plot \else - \ifpgfplots@apply@datatrafo - % Apply the data scaling transformation - \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\to\pgfplots@stored@current@data% - \fi + % modifies \pgfplots@stored@markerlist if necessary. + \expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI \fi -%\message{calling plotcmd and plotdata: pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd' data '\meaning\pgfplots@stored@current@data'}% - \expandafter\pgfplots@stored@current@cmd\pgfplots@stored@current@data \fi \pgfplots@stored@current@postcmd }% @@ -5741,15 +7006,15 @@ \pgfplots@nextcommand \pgfplots@END@init@and@draw@axis % - \begingroup - \pgfkeysvalueof{/pgfplots/after end axis/.@cmd}\pgfeov% - \endgroup % \begingroup % set coordinate system to (0,0) rectangle (1,1) for descriptions: \pgftransformxshift{\pgfplots@xcoordminTEX}% \pgftransformyshift{\pgfplots@ycoordminTEX}% % + % create a '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}}% @@ -5791,6 +7056,14 @@ \pgf@xa=\pgfplots@ycoordminTEX \advance\pgf@xa by-\pgf@picminy \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% + % + \pgf@xa=\pgfplots@ZERO@x + \advance\pgf@xa by-\pgf@picminx + \xdef\pgfplots@ZERO@x{\the\pgf@xa}% + % + \pgf@xa=\pgfplots@ZERO@y + \advance\pgf@xa by-\pgf@picminy + \xdef\pgfplots@ZERO@y{\the\pgf@xa}% \endgroup \endpgfinterruptpicture \egroup\egroup% end of pgfnodepartimagebox @@ -5800,6 +7073,7 @@ \pgftransformshift{\pgfplots@at}% \pgfmultipartnode{pgfplots@low@level@shape}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% \pgfplots@fig@alias + \pgfnodealias{current axis}{\tikz@fig@name}% % \pgfplots@finally@correct@child@node@positions \pgfplots@stacked@finalize @@ -5852,7 +7126,7 @@ \else \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% - \pgfplots@warning{Package 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.}% + \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.}% }{% \pgf@shift@node{\pgfplots@child@node@name}{\pgfplots@offset}% \expandafter\let\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname=\pgfutil@empty% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.stackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex index 1612ca8c7f5..90ca205c835 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.stackedplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex @@ -115,17 +115,16 @@ \global\pgfplotslistnewempty\pgfplots@stacked@zerolevellist \def\pgfplots@stacked@zerolevelpoint@x{0}% \def\pgfplots@stacked@zerolevelpoint@y{0}% + % only work with float if its really necessary - for + % example if the scaling trafo which maps to pgfmath is + % not yet initialised. \ifpgfplots@datascaletrafo@initialised - % work with pgfmath if possible - its faster. \else - % only work with float if its really necessary - for - % example if the scaling trafo which maps to pgfmath is - % not yet initialised. - \ifpgfplots@float@numerics@mode@x + \ifpgfplots@xislinear \pgfmathfloatcreate{0}{0.0}{0}% \let\pgfplots@stacked@zerolevelpoint@x=\pgfmathresult \fi - \ifpgfplots@float@numerics@mode@y + \ifpgfplots@yislinear \pgfmathfloatcreate{0}{0.0}{0}% \let\pgfplots@stacked@zerolevelpoint@y=\pgfmathresult \fi @@ -154,10 +153,10 @@ \ifpgfplots@stacked@isfirstplot \let\pgfplots@stacked@closedcycle@impl=\pgfplots@path@closed@cycle@std \else - \pgfplots@toka=\expandafter{\pgfplots@stacked@closedcycle@impl}% + \t@pgfplots@tokc=\expandafter{\pgfplots@stacked@closedcycle@impl}% \edef\pgfplots@stacked@closedcycle@impl{% [mark=none,/utils/exec=\noexpand\pgfplots@try@mirror@plot@handler] - --plot coordinates{\the\pgfplots@toka} + --plot coordinates{\the\t@pgfplots@tokc} --cycle }% \fi @@ -179,10 +178,8 @@ }% \def\pgfplots@stacked@rememberzerolevelpoint@for@next@plot#1{% - \edef\pgfplots@TMP{#1}% - {\globaldefs=1 - \expandafter\pgfplotslistpushback\pgfplots@TMP\to\pgfplots@stacked@nextzerolevellist - }% + \edef\pgfplots@loc@TMPa{#1}% + \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@stacked@nextzerolevellist } \def\pgfplots@stacked@finishpoint#1#2{% @@ -190,17 +187,15 @@ \else \pgfpointxy{\pgfplots@stacked@zerolevelpoint@x}{\pgfplots@stacked@zerolevelpoint@y}% \ifpgfplots@stacked@x - \edef\pgfplots@TMP{\the\pgf@x}% + \edef\pgfplots@loc@TMPa{\the\pgf@x}% \else - \edef\pgfplots@TMP{\the\pgf@y}% + \edef\pgfplots@loc@TMPa{\the\pgf@y}% \fi - {\globaldefs=1 - \expandafter\pgfplotslistpushback\pgfplots@TMP\to\pgfplots@stacked@PGFzerolevels - }% - \pgfplotslist@TOK@a=\expandafter{\pgfplots@stacked@closedcycle@impl}% + \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@stacked@PGFzerolevels + \t@pgfplots@toka=\expandafter{\pgfplots@stacked@closedcycle@impl}% \edef\pgfplots@stacked@closedcycle@impl{% (\pgfplots@stacked@zerolevelpoint@x,\pgfplots@stacked@zerolevelpoint@y)% - \the\pgfplotslist@TOK@a}% + \the\t@pgfplots@toka}% \fi }% @@ -212,7 +207,7 @@ \else \let\pgfplots@stacked@op=\pgfmathsubtract@ \fi - \ifpgfplots@float@numerics@mode@x + \ifpgfplots@xislinear \ifpgfplots@datascaletrafo@initialised \else \ifpgfplots@stacked@plus @@ -230,7 +225,7 @@ \else \let\pgfplots@stacked@op=\pgfmathsubtract@ \fi - \ifpgfplots@float@numerics@mode@y + \ifpgfplots@yislinear \ifpgfplots@datascaletrafo@initialised \else \ifpgfplots@stacked@plus @@ -248,7 +243,7 @@ % This here is a re-implementation of the stored plot processing. % -% The idea is simply, although it requires quite some work: +% The idea is simple, although it requires quite some work: % % If we stack plots on top of each other, early drawing commands % (early plots) will be OVERDRAWN by later drawing commands (later @@ -264,41 +259,168 @@ \def\pgfplots@stacked@finalize@stored@plots{% \pgfplotslistnewempty\pgfplots@stored@plotlist@reversed \begingroup - \pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@TMP{% - \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@TMP + \pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% + \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa \ifx\pgfplots@stored@current@cmd\pgfutil@empty \else - \ifpgfplots@apply@datatrafo - % Apply the data scaling transformation, but do NOT - % issue any drawing commands (-> use the ...@dryrun - % version) - \expandafter\pgfplots@coord@stream@finalize@storedcoords@START@dryrun\pgfplots@stored@current@data\to\pgfplots@stored@current@data\pgfplots@stored@current@precmdapp% - % save any intermediate results as "precmd": - \pgfplotslist@TOK@b=\expandafter{\pgfplots@stored@current@precmd}% - \pgfplotslist@TOK@a=\expandafter{\pgfplots@stored@current@precmdapp}% - \edef\pgfplots@stored@current@precmd{\the\pgfplotslist@TOK@b\the\pgfplotslist@TOK@a}% - \fi + % Apply the data scaling transformation and compute + % stacked coordinates, but do NOT + % issue any drawing commands: + \expandafter\pgfplots@stacked@finalize@stored@coords@START\pgfplots@stored@current@data + \to + {\pgfplots@stored@current@data}% + {\pgfplots@stored@current@precmdappend}% + % store preparation commands into "precmd": + \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@precmd}% + \t@pgfplots@toka=\expandafter{\pgfplots@stored@current@precmdappend}% + \edef\pgfplots@stored@current@precmd{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% \fi % Now, we need to insert all stored entities into the new, % reversed list. We only expand them ONCE. - \pgfplotslist@TOK@a=\expandafter{\pgfplots@stored@current@precmd}% - \pgfplotslist@TOK@b=\expandafter{\pgfplots@stored@current@cmd}% - \edef\pgfplots@TMP{% - {\the\pgfplotslist@TOK@a}{\the\pgfplotslist@TOK@b}}% - \pgfplots@toka=\expandafter{\pgfplots@TMP}% - \pgfplotslist@TOK@a=\expandafter{\pgfplots@stored@current@data}% - \pgfplotslist@TOK@b=\expandafter{\pgfplots@stored@current@postcmd}% - \edef\pgfplots@TMP{% - \the\pgfplots@toka - {\the\pgfplotslist@TOK@a}{\the\pgfplotslist@TOK@b}}% + \t@pgfplots@toka=\expandafter{\pgfplots@stored@current@precmd}% + \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@cmd}% + \edef\pgfplots@loc@TMPa{% + {\the\t@pgfplots@toka}{\the\t@pgfplots@tokb}}% + \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% + \t@pgfplots@toka=\expandafter{\pgfplots@stored@current@data}% + \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@postcmd}% + \edef\pgfplots@loc@TMPa{% + \the\t@pgfplots@tokc + {\the\t@pgfplots@toka}{\the\t@pgfplots@tokb}}% % Reverse sequence: - \expandafter\pgfplotslistpushfront\pgfplots@TMP\to\pgfplots@stored@plotlist@reversed + \expandafter\pgfplotslistpushfront\pgfplots@loc@TMPa\to\pgfplots@stored@plotlist@reversed }% % Now, overwrite the original list: \global\let\pgfplots@stored@plotlist=\pgfplots@stored@plotlist@reversed + \global\let\pgfplots@stored@plotlist@reversed=\relax \endgroup }% +% This command finalizes the stored plot data. It records a coordinate +% stream into '#3' and assembles a macro '#4' which contains all +% 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 +% pre-drawing. +\long\def\pgfplots@stacked@finalize@stored@coords@START plot 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@stacked@endplot + \pgfplots@stacked@savestateto\pgfplots@loc@TMPa + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\def\pgfplots@stacked@stored@postpath{#2}}% + \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa + \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% + \ifpgfplots@record@marker@stream + \t@pgfplots@tokb=\expandafter{\pgfplots@recorded@marker@stream}% + \else + \t@pgfplots@tokb={}% + \fi + \edef#4{% + \the\t@pgfplots@tokc + \noexpand\gdef\noexpand\pgfplots@recorded@marker@stream{\the\t@pgfplots@tokb}% + \the\t@pgfplots@toka + }% +}% + +% #1: for coordinates +% #2: for markers +\def\pgfplots@coord@stream@INIT@finalize@stackedcoords@recordto#1#2{% + \pgfplots@record@marker@streamtrue + % + \def\pgfplots@coord@stream@start@{% + \gdef#1{\pgfplotstreamstart}% + \ifpgfplots@record@marker@stream + \pgfplotsapplistXnewempty\pgfplots@stacked@record@mark@cmds + \pgfplotsapplistXpushback\pgfplotstreamstart\to\pgfplots@stacked@record@mark@cmds + \fi + }% + \def\pgfplots@coord@stream@end@{% + \expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}% + \ifpgfplots@record@marker@stream + \pgfplotsapplistXpushback\pgfplotstreamend\to\pgfplots@stacked@record@mark@cmds + \pgfplotsapplistXlet\pgfplots@loc@TMPa=\pgfplots@stacked@record@mark@cmds + \global\let#2=\pgfplots@loc@TMPa + \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}% + \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. +% It unpacks everything prepared by +% \pgfplots@stacked@finalize@stored@coords@START +% and draws the plot (and markers). +\def\pgfplots@stacked@draw@reversed@plot{% + \pgfplots@stored@current@cmd[current plot style] + \pgfextra + \tikzset{every plot/.try}% + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + \pgfplots@basiclevel@plothandler + % this here contains a recorded plot stream, see above. + \pgfplots@stored@current@data + % + \pgfplots@assert@tikzinternal@exists{tikz@make@last@position}% + \tikz@make@last@position{\pgfplotlastpoint}% + \expandafter + \endpgfextra + \pgfplots@stacked@stored@postpath + ; + % this here has been assigned by the precommand as well. + \ifx\pgfplots@recorded@marker@stream\pgfutil@empty + \else + \ifpgfplots@clip@marker@paths + \pgfplots@stored@current@cmd[current plot style] + \pgfextra + \pgfplots@install@plotmark@handler + \pgfplots@recorded@marker@stream + \endpgfextra + ; + \else + \pgfplots@stored@REMEMBER@MARK@COMMAND + \fi + \fi + \gdef\pgfplots@recorded@marker@stream{}% clear +}% + + \def\pgfplots@stacked@path@closed@cycle{% \pgfplots@stacked@closedcycle@impl } @@ -309,17 +431,17 @@ % This affects pgf zero level handlers and whether this here is the % first plot or not.. \def\pgfplots@stacked@savestateto#1{% - \pgfplotslist@TOK@a=\expandafter{\pgfplots@stacked@PGFzerolevels}% + \t@pgfplots@toka=\expandafter{\pgfplots@stacked@PGFzerolevels}% \ifpgfplots@stacked@isfirstplot - \pgfplotslist@TOK@b={\pgfplots@stacked@isfirstplottrue}% + \t@pgfplots@tokb={\pgfplots@stacked@isfirstplottrue}% \else - \pgfplotslist@TOK@b={\pgfplots@stacked@isfirstplotfalse}% + \t@pgfplots@tokb={\pgfplots@stacked@isfirstplotfalse}% \fi - \pgfplots@toka=\expandafter{\pgfplots@stacked@closedcycle@impl}% + \t@pgfplots@tokc=\expandafter{\pgfplots@stacked@closedcycle@impl}% \edef#1{% - \noexpand\gdef\noexpand\pgfplots@stacked@PGFzerolevels{\the\pgfplotslist@TOK@a}% - \the\pgfplotslist@TOK@b - \noexpand\def\noexpand\pgfplots@stacked@closedcycle@impl{\the\pgfplots@toka}% + \noexpand\gdef\noexpand\pgfplots@stacked@PGFzerolevels{\the\t@pgfplots@toka}% + \the\t@pgfplots@tokb + \noexpand\def\noexpand\pgfplots@stacked@closedcycle@impl{\the\t@pgfplots@tokc}% }% } diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex new file mode 100644 index 00000000000..e3094554af6 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex @@ -0,0 +1,206 @@ +%-------------------------------------------- +% +% 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@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 + +% Produces an \aftergroup statement for each single token in #1. +% +% ATTENTION: you *can't* use braces inside of '#1'! +\def\pgfplotsqaftergroupeach#1{% + \pgfplotsqaftergroupeach@#1\pgfplots@EOI +} +\def\pgfplotsqaftergroupeach@#1{% + \gdef\pgfplots@TMP{#1}% + \ifx\pgfplots@TMP\pgfplots@EOI + \else + \aftergroup#1% + \expandafter\pgfplotsqaftergroupeach@ + \fi +} + +\def\pgfplotsaftergroupcollectinto#1#2\pgfplots@EOI{% + \def#1{#2}% +}% + +% Assigns list contents #2 to a list macro #1. +% +% The list contents may be provided in one of two formats: +% a) in the (deprecated) list format 'first\\second\\thirst\\' +% or +% b) in the PGF foreach list format 'first,second,third'. +\def\pgfplots@assign@list#1#2{% + \def\pgfplots@TMP{#2}% + \ifx\pgfplots@TMP\pgfutil@empty + \pgfplotslistnewempty#1% + \else + \pgfplots@check@backwards@compatible@list@format #2\\\pgfplots@EOI + \ifpgfplots@is@old@list@format + \pgfplotslistnew#1{#2}% + \else + \pgfplots@foreach@to@list{#2}\to#1 + \fi + \fi +}% + +% Sets the boolean \ifpgfplots@is@old@list@format to true if and only +% if the input is a list in the format '{first\\second\\}'. +% +% This format is deprecated, but is still provided for backwards +% compatibility. +% +% Usage: +% \pgfplots@check@backwards@compatible@list@format <argument>'\\'\pgfplots@EOI +% you NEED to append '\\\pgfplots@EOI' at the end. +\def\pgfplots@check@backwards@compatible@list@format#1\\#2\pgfplots@EOI{% + \def\pgfplots@TMP{#2}% + \ifx\pgfplots@TMP\pgfutil@empty + \pgfplots@is@old@list@formatfalse + \else + \pgfplots@is@old@list@formattrue + \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}% +}% +\def\pgfplots@assert@tikzinternal@exists#1{% + \pgfutil@ifundefined{#1}{% + \pgfplots@error{Sorry, pgfplots relies on the existance of the tikz internal macro '#1'. + Unfortunately, this does no longer exist ... you will need to get an updated version of pgfplots to fix this problem.}% + \expandafter\let\csname #1\endcsname=\pgfutil@empty + }{}% +}% + + +% A future-version compatibility method which checks whether the +% macro '#2' exists. +% +% We assume that '#2' usually contains the value of the tikz key '#1'. +% Example: +% /tikz/variable is usually stored into '\tikz@plot@var'. +% +% However, this may change in future versions. +% +% So, we do the following: +% 1. check whether '#2' exists, if yet: ok. +% 2. if not, check whether the value is stored directly into '/tikz/#1'. +% 3. if not, check whether the value is stored directly into '/pgf/#1'. +% 4. If everything fails, provide an error message. +% +% #1: a tikz key without key prefix (/tikz/ and /pgf/ will be prepended). +% #2: a macro name WITHOUT backslash. +% #3: the default value if everything fails. +\def\pgfplots@gettikzinternal@keyval#1#2#3{% + \pgfutil@ifundefined{#2}{% + \pgfkeysifdefined{/tikz/#1}{% + \pgfkeysgetvalue{/tikz/#1}\pgfplots@TMP + \expandafter\let\csname #1\endcsname=\pgfplots@TMP + }{% + \pgfkeysifdefined{/pgf/#1}{% + \pgfkeysgetvalue{/pgf/#1}\pgfplots@TMP + \expandafter\let\csname #1\endcsname=\pgfplots@TMP + }{% + \expandafter\def\csname #1\endcsname{#3}% + {\t@pgfplots@tokc={#3}% + \pgfplots@warning{Sorry, could not find value of '/tikz/#1'. Assuming '\the\t@pgfplots@tokc'.}% + }% + }% + }% + }{}% +}% + +\def\pgfplots@getcurrent@plothandler#1{% + \pgfutil@ifundefined{tikz@plot@handler}{% + \pgfplots@error{Sorry, can't get the current plot handler. It appears that tikz and pgfplots is no longer compatible!? You will need to get a newer version of pgfplots.}% + \let#1=\pgfplothandlerlineto + }{% + \let#1=\tikz@plot@handler + }% +}% + + +% Converts an arbitrary command to a string in which all characters +% have category 12. +% +% #1: a macro name (which takes no arguments) +% #2: a macro name which will be assigned to '#1' converted to string. +% +% This uses '\meaning#1' hackery. +\def\pgfplots@command@to@string#1#2{% + \expandafter\pgfplots@command@to@string@@\meaning#1\pgfplots@EOI{#2}% +}% +{ +\let\CATCODE=\catcode +\CATCODE`\:=12 +\CATCODE`\-=12 +\CATCODE`\>=12 +\CATCODE`\m=12 +\CATCODE`\a=12 +\CATCODE`\c=12 +\CATCODE`\r=12 +\CATCODE`\o=12 +\xdef\pgfplts@glb@TMP{macro:->}% +} +\expandafter\def\expandafter\pgfplots@command@to@string@@\pgfplts@glb@TMP#1\pgfplots@EOI#2{% + \def#2{#1}% +}% + +% Usage: +% \pgfplots@if{pgfplots@scaled@ticks}{true-code}{false-code} +% +% it is to be used if the tex boolean is only known as string, not as +% macro. +\def\pgfplots@if#1#2#3{% + \csname if#1\endcsname + #2% + \else + #3% + \fi +}% diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty index 3e63fdfa8b7..8f0f7deace3 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty @@ -23,8 +23,8 @@ % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- -\def\pgfplotsversion{1.0} -\ProvidesPackage{pgfplots}[2008/06/07 Version \pgfplotsversion] +\def\pgfplotsversion{1.1} +\ProvidesPackage{pgfplots}[2008/08/02 Version \pgfplotsversion] % ATTENTION: % you MAY need one of diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty new file mode 100644 index 00000000000..218ad786962 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty @@ -0,0 +1,27 @@ +%-------------------------------------------- +% +% Package pgfplotstable.sty +% +% 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/>. +% +%-------------------------------------------- +\ProvidesPackage{pgfplotstable}[2008/08/02] + +% everything is loaded by pgfplots. +\RequirePackage{pgfplots} +\RequirePackage{array} % for |dec sep align| + +\endinput diff --git a/Master/texmf-dist/tex/plain/pgfplots/pgfplotstable.tex b/Master/texmf-dist/tex/plain/pgfplots/pgfplotstable.tex new file mode 100644 index 00000000000..c445da336bc --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgfplots/pgfplotstable.tex @@ -0,0 +1,38 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% 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/>. +% +%-------------------------------------------- +% ATTENTION: +% you MAY need one of +% \def\pgfsysdriver{pgfsys-dvipdfm.def} +% \def\pgfsysdriver{pgfsys-pdftex.def} +% \def\pgfsysdriver{pgfsys-dvips.def} +% +% BEFORE the first \input pgf.tex, \input tikz.tex or +% \input pgfplots.tex +% Default is +% 'dvips' for 'tex' +% 'pdftex' for 'pdftex' +% -> dvipdfm needs special attention. +% +\input pgfplots.tex% +% +\endinput |