diff options
author | Karl Berry <karl@freefriends.org> | 2008-06-15 17:56:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-06-15 17:56:37 +0000 |
commit | 3f126e90ac9efa15e72c8b415a2f25d3b19c509a (patch) | |
tree | 3fb6f3eebbf51978c31e8d6ff1180432e50b9935 /Master/texmf-dist/tex | |
parent | 9667a29e9fef0ef89c9d7bd311e2d2a6aaccf50c (diff) |
painful pgfplots update (14jun08)
git-svn-id: svn://tug.org/texlive/trunk@8751 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
18 files changed, 11913 insertions, 4033 deletions
diff --git a/Master/texmf-dist/tex/context/pgfplots/t-pgfplots.tex b/Master/texmf-dist/tex/context/pgfplots/t-pgfplots.tex new file mode 100644 index 00000000000..93324e1e5b0 --- /dev/null +++ b/Master/texmf-dist/tex/context/pgfplots/t-pgfplots.tex @@ -0,0 +1,61 @@ +%-------------------------------------------- +% +% 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/>. +% +%-------------------------------------------- + +\usemodule[tikz] +\usetikzlibrary[plotmarks] + +\edef\tikzatcode{\the\catcode`\@} +\edef\tikzbarcode{\the\catcode`\|} +\edef\tikzexclaimcode{\the\catcode`\!} +\catcode`\@=11 +\catcode`\|=12 +\catcode`\!=12 + +\input pgfplots.code.tex + +\let\pgfplots@ORIG@tikz@installcommands@before@context=\tikz@installcommands + +\def\tikz@installcommands{% + \pgfplots@ORIG@tikz@installcommands@before@context + % + \let\startaxis=\pgfplots@environment@axis + \let\stopaxis=\endpgfplots@environment@axis + % + \let\startsemilogxaxis=\pgfplots@environment@semilogxaxis + \let\stopsemilogxaxis=\endpgfplots@environment@semilogxaxis + % + \let\startsemilogyaxis=\pgfplots@environment@semilogyaxis + \let\stopsemilogyaxis=\endpgfplots@environment@semilogyaxis + % + \let\startloglogaxis=\pgfplots@environment@loglogaxis + \let\stoploglogaxis=\endpgfplots@environment@loglogaxis +}% + +\catcode`\@=\tikzatcode +\catcode`\|=\tikzbarcode +\catcode`\!=\tikzexclaimcode + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex new file mode 100644 index 00000000000..16e4b539c02 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex @@ -0,0 +1,202 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This is a helper package with an elementary array datastructure, +% featuring O(1) index access and O(N) creation, deletion, copy. +% +% The following macros are supplied: +% +% \pgfplotsarraynewempty +% \pgfplotsarraynew +% \pgfplotsarraycopy +% \pgfplotsarraypushback +% \pgfplotsarraysize +% \pgfplotsarrayselect +% \pgfplotsarrayletentry +% \pgfplotsarraycheckempty +% \pgfplotsarrayforeach +% +% 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/>. +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcount\c@pgfplotsarray@tmp +\newif\ifpgfplotsarrayempty + +% Creates a new, empty array. +\long\def\pgfplotsarraynewempty#1{% + \pgfplotsarray@@def{#1@size}{0}% +} + +% Creates a new array with an abirtrary number of elements. +% Arguments: +% #1: the array's name (a macro name) +% #2: the elements in the form +% first\\second\\third\\ ...\\ +% like in tabular with one column. +% +% Example: +% \pgfplotsarraynew\fooarray{First Element\\Second Element\\Third Element\\} +% +% WARNING: do NOT forget the final '\\'! +\long\def\pgfplotsarraynew#1#2{% + \pgfplotsarraynewempty{#1}% + \long\def\pgfplotsarraynew@impl@rest{#2}% + \loop + \ifx\pgfplotsarraynew@impl@rest\pgfutil@empty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \expandafter\pgfplotsarraynew@impl\pgfplotsarraynew@impl@rest\toarray#1\relax + \repeat +} + +% helper macro for \pgfplotsarraynew +\long\def\pgfplotsarraynew@impl#1\\#2\toarray#3{% + \pgfplotsarraypushback#1\to#3\relax% + \def\pgfplotsarraynew@impl@rest{#2}% +} + + +\def\pgfplotsarray@@let#1=#2{% + \def\pgfplotsarray@TMP@@{\expandafter\let\csname\string#1\endcsname}% + \expandafter\pgfplotsarray@TMP@@\expandafter=\csname\string#2\endcsname +}% + +\def\pgfplotsarray@@def#1{% + \expandafter\def\csname\string#1\endcsname +}% +\def\pgfplotsarray@@edef#1{% + \expandafter\edef\csname\string#1\endcsname +}% + +\def\pgfplotsarray@@getsizeto#1#2{% + \pgfplotsarraysize{#1}\to\c@pgfplotsarray@tmp + \edef#2{\the\c@pgfplotsarray@tmp}% +}% + +% Copies array #1 to array #2. +\def\pgfplotsarraycopy#1\to#2{% + \pgfplotsarray@@let{#2@size}={#1@size}% + \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% + \c@pgfplotsarray@tmp=0 + \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 +} + + + +% #1: the item to append +% #2: the array as macro name +% Example: +% \pgfplotsarraypushback Next last element\to\fooarray +\long\def\pgfplotsarraypushback#1\to#2{% + \pgfplotsarraysize{#2}\to\c@pgfplotsarray@tmp + \pgfplotsarray@@def{#2@\the\c@pgfplotsarray@tmp}{#1}% + \advance\c@pgfplotsarray@tmp by1 + \pgfplotsarray@@edef{#2@size}{\the\c@pgfplotsarray@tmp}% +} + + +% Counts the number of elements in array #1, storing it into the count +% register #2. +% Example: +% \pgfplotsarraysize\foo\to{\count0}% +% \the\count0 +\long\def\pgfplotsarraysize#1\to#2{% + #2=\csname\string#1@size\endcsname\relax +} + +% Returns the #1th element of array #2 into macro #3 +% Arguments: +% #1: a count 0,...,N-1 where N is the array size. +% You may specify a number of a count. +% #2: a array +% #3: a macro name +% Example: +% Element 0: +% \pgfplotsarrayselect0\of\foo\to\elem +% \elem +% Element \count1: +% \pgfplotsarrayselect\count1\of\foo\to\elem +\long\def\pgfplotsarrayselect#1\of#2\to#3{% + \c@pgfplotsarray@tmp=#1\relax + \expandafter\let\expandafter#3\expandafter=\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname% +} +\long\def\pgfplotsarrayletentry#1\of#2=#3{% + \c@pgfplotsarray@tmp=#1\relax + \expandafter\let\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname=#3\relax +} + +% Sets the boolean \ifpgfplotsarrayempty depending on whether array #1 is empty +% or not. +% Example: +% +% \pgfplotsarraycheckempty\fooarray +% \ifpgfplotsarrayempty +% List fooarray is empty! +% \else +% List is not empty. +% \fi +\def\pgfplotsarraycheckempty#1{% + \pgfplotsarraysize{#1}\to\c@pgfplotsarray@tmp + \ifnum\c@pgfplotsarray@tmp=0\relax + \pgfplotsarrayemptytrue + \else + \pgfplotsarrayemptyfalse + \fi +} + + +% Iterates through each array element, names it #2 and calls code #3. +% Example: +% \pgfplotsarraynew\fooarray{Eins\\Zwei\\Drei\\}% +% \pgfplotsarrayforeach\fooarray\as\foo{Element \foo\par}% +% results in +% Element Eins +% Element Zwei +% Element Drei +% Each single element will be grouped with TeX groups. +\long\def\pgfplotsarrayforeach#1\as#2#3{% + \pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}% + \c@pgfplotsarray@tmp=0\relax + \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 +} + +% 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 + \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 +} diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex new file mode 100644 index 00000000000..48fd19a890c --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex @@ -0,0 +1,256 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% This is a helper package with an elementary list datastructure. +% +% Its implementation is based on Knuth's list macros in "The TeXbook". +% +% The following macros are supplied: +% +% \pgfplotslistnewempty +% \pgfplotslistnew +% \pgfplotslistcopy +% \pgfplotslistpopfront +% \pgfplotslistpushback +% \pgfplotslistpushfront +% \pgfplotslistsize +% \pgfplotslistselect +% \pgfplotslistcheckempty +% \pgfplotslistforeach +% +% 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/>. +% +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newtoks\pgfplotslist@TOK@a +\newtoks\pgfplotslist@TOK@b +\newif\ifpgfplotslistempty + + +\newif\ifpgfplots@loop@CONTINUE +\newif\ifpgfplotslist@is@backslash@terminated + +% Creates a new, empty list. +\long\def\pgfplotslistnewempty#1{\let#1=\pgfutil@empty} + +% Creates a new list with an abirtrary number of elements. +% Arguments: +% #1: the list's name (a macro name) +% #2: the elements in the form +% first\\second\\third\\ ...\\ +% like in tabular with one column. +% You can also use comma-separated lists +% first,second,third +% +% Example: +% 1. +% \pgfplotslistnew\foolist{First Element\\Second Element\\Third Element\\} +% WARNING: do NOT forget the final '\\'! +% +% 2. +% \pgfplotslistnew\foolist{First Element,Second Element,Third Element} +% +% Use braces '{}' to use '\\' or ',' as arguments. +% +\long\def\pgfplotslistnew#1#2{% + \pgfplotslistnewempty{#1}% + \long\def\pgfplotslistnew@impl@rest{#2}% + \pgfplotslist@check@backslash@list #2\\\pgfplotslist@EOI + \ifpgfplotslist@is@backslash@terminated + \else + \expandafter\def\expandafter\pgfplotslistnew@impl@rest\expandafter{\pgfplotslistnew@impl@rest,}% + \fi + \loop + \ifx\pgfplotslistnew@impl@rest\pgfutil@empty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \ifpgfplotslist@is@backslash@terminated + \expandafter\pgfplotslistnew@impl\pgfplotslistnew@impl@rest\tolist#1\relax + \else + \expandafter\pgfplotslistnew@impl@comma\pgfplotslistnew@impl@rest\tolist#1\relax + \fi + \repeat +} +\def\pgfplotslist@EOI{\pgfplotslist@EOI} + +\def\pgfplotslist@check@backslash@list#1\\#2\pgfplotslist@EOI{% + \def\pgfplotslist@TMPB{#2}% + \ifx\pgfplotslist@TMPB\pgfutil@empty + \pgfplotslist@is@backslash@terminatedfalse + \else + \pgfplotslist@is@backslash@terminatedtrue + \fi +}% + +% Copies list #1 to list #2. +\def\pgfplotslistcopy#1\to#2{\let#2=#1} + + +% helper macro for \pgfplotslistnew +\long\def\pgfplotslistnew@impl#1\\#2\tolist#3{% + \pgfplotslistpushback#1\to#3\relax% + \def\pgfplotslistnew@impl@rest{#2}% +} +\long\def\pgfplotslistnew@impl@comma#1,#2\tolist#3{% + \pgfplotslistpushback#1\to#3\relax% + \def\pgfplotslistnew@impl@rest{#2}% +} + + +% #1: the item to prepend +% #2: the list as macro name +% 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}% +} + +% #1: the item to append +% #2: the list as macro name +% Example: +% \pgfplotslistpushback Next last element\to\foolist +\long\def\pgfplotslistpushback#1\to#2{% + \pgfplotslist@TOK@a={\pgfplotslist@sep{#1}}% + \ifx#2\pgfutil@empty + \pgfplotslist@TOK@b={}% + \else + \pgfplotslist@TOK@b=\expandafter{#2}% + \fi + \edef#2{\the\pgfplotslist@TOK@b\the\pgfplotslist@TOK@a}% +} + +% 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}% +} + +% implements #2 := pop_front(#1) +% Example: +% \pgfplotslistpopfront\foolist\to\poppedfirstelem +\long\def\pgfplotslistpopfront#1\to#2{% + \pgfplotslistcheckempty#1\relax + \ifpgfplotslistempty + \pgfplots@error{ERROR: \string\pgfplotslistpopfront\ from \string#1\ although list is EMPTY}% + \else + \expandafter\pgfplotslistpopfront@impl#1\pgfplotslistpopfront@macronames#1#2% + \fi +} + +% implementation helper for listpopfront +\long\def\pgfplotslistpopfront@impl\pgfplotslist@sep#1#2\pgfplotslistpopfront@macronames#3#4{% + \def#4{#1}% + \def#3{#2}% +} + +% Counts the number of elements in list #1, storing it into the count +% register #2. +% Example: +% \pgfplotslistsize\foo\to{\count0}% +% \the\count0 +\long\def\pgfplotslistsize#1\to#2{% + #2=0% + \long\def\pgfplotslist@sep##1{\advance#2 by 1 }% + #1% +} + +% Returns the #1th element of list #2 into macro #3 +% Arguments: +% #1: a count 0,...,N-1 where N is the list size. +% You may specify a number of a count. +% #2: a list +% #3: a macro name +% Example: +% Element 0: +% \pgfplotslistselect0\of\foo\to\elem +% \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.}}}% + \begingroup + \count0=#1\relax + \long\def\pgfplotslist@sep##1{% + \advance\count0-1\relax + \ifnum\count0=-1\relax + \global\def\pgfplotslistselect@tmp{\def#3{##1}}% + \fi% + }% + #2% + \endgroup + \pgfplotslistselect@tmp +} + +% Sets the boolean \ifpgfplotslistempty depending on whether list #1 is empty +% or not. +% Example: +% +% \pgfplotslistcheckempty\foolist +% \ifpgfplotslistempty +% List foolist is empty! +% \else +% List is not empty. +% \fi +\def\pgfplotslistcheckempty#1{% + \ifx#1\pgfutil@empty + \pgfplotslistemptytrue + \else + \pgfplotslistemptyfalse + \fi +} + + +% Iterates through each list element, names it #2 and calls code #3. +% Example: +% \pgfplotslistnew\foolist{Eins\\Zwei\\Drei\\}% +% \pgfplotslistforeach\foolist\as\foo{Element \foo\par}% +% results in +% Element Eins +% Element Zwei +% Element Drei +% 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}% + \begingroup + #3 + \endgroup}% + #1\relax + \endgroup +} + +\newif\ifpgfplotslistforeachungroupedrunning + +% The same but without groups around #3. +\long\def\pgfplotslistforeachungrouped#1\as#2#3{% + \ifpgfplotslistforeachungroupedrunning + \pgfplots@error{Sorry, you can't nest pgfplotslistforeachungrouped.}% + \else + \pgfplotslistforeachungroupedrunningtrue + \long\def\pgfplotslist@sep##1{\def#2{##1}#3}% + #1\relax + \pgfplotslistforeachungroupedrunningfalse + \fi +} diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex new file mode 100644 index 00000000000..82e27215bf4 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -0,0 +1,1007 @@ +%-------------------------------------------- +% +% Package numtable +% +% Provides support to read and work with abstact numeric tables of the +% form +% +% COLUMN1 COLUMN2 COLUMN3 +% 1 2 3 +% 4 4 552 +% 1e124 0.00001 1.2345e-12 +% ... +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +% This file 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 +\newif\ifpgfplotstabletypesetdebug +\newif\ifpgfplotstableuserow + +% should always be false; use only in grouped internal macros +\newif\ifpgfplots@table@options@areset + +\input pgfplotstable.coltype.code.tex + +\pgfkeys{% + /pgfplots/table/header/.is if=pgfplotstable@search@header, + /pgfplots/table/header=true, + /pgfplots/table/x index/.store in=\pgfplots@plot@tbl@xindex, + /pgfplots/table/x index=0, + /pgfplots/table/x/.store in=\pgfplots@plot@tbl@x, + /pgfplots/table/x=, + /pgfplots/table/y index/.store in=\pgfplots@plot@tbl@yindex, + /pgfplots/table/y index=1, + /pgfplots/table/y/.store in=\pgfplots@plot@tbl@y, + /pgfplots/table/y=, + /pgfplots/table/x error index/.initial=, + /pgfplots/table/y error index/.initial=, + /pgfplots/table/x error/.initial=, + /pgfplots/table/y error/.initial=, + /pgfplots/table/row predicate/.code={}, + /pgfplots/table/skip rows between index/.style 2 args={% + /pgfplots/table/row predicate/.append code={% + \ifnum##1<#1\relax + \else + \ifnum##1<#2\relax + \pgfplotstableuserowfalse + \fi + \fi} + }, + /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}}, + /pgfplots/table/col sep/semicolon/.code = {\def\pgfplotstableread@COLSEP@CASE{2}}, + /pgfplots/table/col sep/colon/.code = {\def\pgfplotstableread@COLSEP@CASE{3}}, + /pgfplots/table/col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}}, + /pgfplots/table/col sep=space, + % columns={name1,name2} + % or + % columns={[index]2,name2,name3,[index]5} + /pgfplots/table/columns/.initial=, + /pgfplots/table/column name/.initial=\pgfkeysnovalue, + % + % this thing here allows to MODIFY 'column name'. + % + % Argument #1 is the current column name, that means after + % evaluating 'column name'. If this key changes anything, it + % should write its result back into 'column name'. + % + % That means you can use 'column name' to assign the name as such + % and 'assign column name' to generate final TeX code (for example + % to insert \multicolumn{1}{c}{#1} or so). + % default is empty which means no change. + %/pgfplots/table/assign column name/.code={ + % \pgfkeyssetvalue{/pgfplots/table/column name}{#1}% + %}, + % + % + % + % A style which inserts \multicolumn{1}{#1}{<column name>} for + % each column name. + % The column name as such can be set with the 'column name' option. + /pgfplots/table/multicolumn names/.style={% + /pgfplots/table/assign column name/.code={% + \pgfkeyssetvalue{/pgfplots/table/column name}{\multicolumn{1}{#1}{##1}}% + }% + }, + /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={&}{}, + /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}% + \ifpgfutil@in@ + \else + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult&}% + \fi + \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult + }, + }, + /pgfplots/table/dec sep align/.default=c, + % + % A style which can be used together with the 'dcolumn' package by + % David Carlisle. + % #1: the dcolumn type, defaults to 'D{.}{.}{2}' + % #2: the column name type, defaults to 'c' + /pgfplots/table/dcolumn/.style 2 args={% + /pgf/number format/assume math mode, + column type={#1}, + multicolumn names=#2, + }, + /pgfplots/table/dcolumn/.default={D{.}{.}{2}}{c}, + /pgfplots/table/column type/.initial={c}, + /pgfplots/table/every table/.style={}, + /pgfplots/table/every even row/.style={}, + /pgfplots/table/every odd row/.style={}, + /pgfplots/table/every last row/.style={}, + /pgfplots/table/every first row/.style={}, + /pgfplots/table/every head row/.style={}, + /pgfplots/table/every first column/.style={}, + /pgfplots/table/every last column/.style={}, + /pgfplots/table/every even column/.style={}, + /pgfplots/table/every odd column/.style={}, + /pgfplots/table/before row/.initial=, + /pgfplots/table/after row/.initial=, + /pgfplots/table/begin table/.initial={\begin{tabular}}, + /pgfplots/table/end table/.initial={\end{tabular}}, + /pgfplots/table/outfile/.initial=, + /pgfplots/table/debug/.is if=pgfplotstabletypesetdebug, + % + % will be redefined by |assign cell content| for every cell: + /pgfplots/table/@cell content/.initial=, + % + % #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% + \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% + \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult + }, + /pgfplots/table/string type/.style={% + /pgfplots/table/assign cell content/.style={% + /pgfplots/table/@cell content={##1}% + }% + },% + /pgfplots/table/font/.initial=, + /pgfplots/table/.unknown/.code={% + \pgfqkeys{/pgf/number format}{\pgfkeyscurrentname=#1}% + }% +} + +% \pgfplotstableread[OPTIONS] {FILE} to \name +% +% This method reads a table from FILE to macro \name. +% +% FILE is something like +% G Basis dof L2 A Lmax cgiter maxlevel eps +% 5 5 5 8.31160034e-02 0.00000000e+00 1.80007647e-01 2 2 -1 +% 17 17 17 2.54685628e-02 0.00000000e+00 3.75580565e-02 5 3 -1 +% ... +% +% A number format line is also understood: +% G Basis dof L2 A Lmax cgiter maxlevel eps +% $flags int int int sci:8 sci:8 sci:8 int int std:8 +% 5 5 5 8.31160034e-02 0.00000000e+00 1.80007647e-01 2 2 -1 +% +% or a three-column-gnuplot file with 2 comment headers like +% #Curve 0, 20 points +% #x y type +% 0.00000 0.00000 i +% 0.52632 0.50235 i +% +% The table data is stored columnwise in lists and can be accessed +% with the other methods of this package. +\def\pgfplotstableread{% + \pgfutil@ifnextchar[{% + \pgfplotstableread@impl + }{% + \pgfplotstableread@impl[]% + }% +} + +% BACKWARDS COMPATIBILITY +\let\pgfnumtableread=\pgfplotstableread + +\def\pgfplotstablegetcolumnlist#1\to#2{% + \let#2=#1 +} + +\def\pgfplotstablegetcolumnbyname#1\of#2\to#3{% + \pgfutil@ifundefined{\string#2@#1}{% + \pgfplots@error{Sorry, could not retrieve column '#1' from table...}% + }{% + \expandafter\let\expandafter#3\csname\string#2@#1\endcsname + }% +} + +\def\pgfplotstablegetcolumnnamebyindex#1\of#2\to#3{% + \pgfplotslistselect#1\of#2\to#3\relax +}% +\def\pgfplotstablegetcolumnbyindex#1\of#2\to#3{% + \pgfplotslistselect#1\of#2\to#3\relax + \expandafter\pgfplotstablegetcolumnbyname#3\of#2\to{#3}% +} + +\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 + }% +} + +% Typesets a table. +% +% \pgfplotstabletypeset[<options>]<\tablestructure> +% +% If you do not select any columns, the complete table is drawn. +% +% There are several options and styles which are available in +% <options>, see the declaration above. +% +% ATTENTION: the default implementation employs +% \begin{tabular}...\end{tabular} and is therefor only usable with +% LaTeX! +% +% You will need to reconfigure the tables. +% +% Inside of \pgfplotstabletypeset, the macros \pgfplotstablecol and +% \pgfplotstablerow will expand to the current column index and row +% index. +\def\pgfplotstabletypeset{% + \pgfutil@ifnextchar[{% + \pgfplotstabletypeset@opt + }{% + \pgfplotstabletypeset@opt[]% + }% +} + +% Like \pgfplotstabletypeset, but the first argument is a file name. +\def\pgfplotstabletypesetfile{% + \pgfutil@ifnextchar[{% + \pgfplotstabletypesetfile@opt + }{% + \pgfplotstabletypesetfile@opt[]% + }% +} +\def\pgfplotstabletypesetfile@opt[#1]#2{% + \begingroup + \ifpgfplots@table@options@areset + \else + \pgfplots@table@options@aresettrue + \pgfplotstableset{/pgfplots/table/every table,#1}% + \fi + \pgfplotstableread{#2}\pgfplotstabletypesetfile@opt@@ + \pgfplotstabletypeset\pgfplotstabletypesetfile@opt@@ + \endgroup +}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% IMPLEMENTATION +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifpgfplotstableread@curline@contains@colnames +\newif\ifpgfplotstableread@foundcolnames +\newif\ifpgfplotstableread@skipline +\def\pgfplotstableread@impl[#1]#2{% + \pgfutil@ifnextchar t{% + \pgfplotstableread@impl@@{#1}{#2}% + }{% + \pgfplotstableread@impl@{#1}{#2}% + }% +}% + +% I don't know why; but I started with +% >> \pgfplotstableread[]{file} to \macro +% That ' to ' is really ugly. This here is for backwards +% compatibility: +\def\pgfplotstableread@impl@@#1#2to #3{% + \pgfplotstableread@impl@{#1}{#2}{#3}% +}% + +\def\pgfplotstableread@impl@#1#2#3{% + \begingroup + \ifpgfplots@table@options@areset + \else + \pgfplotstableset{/pgfplots/table/every table,#1}% + \fi +%\pgfplots@message{ATTEMPTING TO READ #2}% + \openin1=#2\relax + \def\pgfplotstableread@filename{#2}% + \let\pgfplotstableread@lineno=\c@pgf@counta + \let\pgfplotstableread@numcols=\c@pgf@countb + \let\pgfplotstableread@curcol=\c@pgf@countc + \let\pgfplotstableread@usablelineno=\c@pgf@countd + \pgfplotstableread@lineno=0 + \pgfplotstableread@usablelineno=0 + \pgfplotstableread@numcols=0 + \pgfplotslistnewempty\pgfplotstable@colnames + \ifeof1 + \pgfplotstable@error{Could not read table file '#2'.}% + \fi + % + \pgfplotstableread@loop@over@lines + % + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstableread@create@column@names@with@numbers + \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 + }% + \global\let\pgfplotstable@colnames=\pgfutil@empty +} + +\def\pgfplotstableread@loop@over@lines{% + \ifeof1 +%\pgfplots@message{EOF}% + \else + \read1 to\pgfplotstable@LINE + \ifeof1 + \else + \expandafter\pgfplotstableread@checkspecial@line\pgfplotstable@LINE\pgfplotstable@EOI + \ifpgfplotstableread@skipline + \else + %-------------------------------------------------- + % \ifnum\pgfplotstableread@lineno=0 + % \let\pgfplotstable@firstline=\pgfplotstable@LINE + % \fi + %-------------------------------------------------- +%\pgfplots@message{READING LINE \the\pgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% + \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 + \pgfplotstableread@curcol=0\relax + % Create empty column lists: + \pgfplotstableread@create@column@lists + % + \ifnum\pgfplotstableread@usablelineno=0\relax + \ifnum\pgfplotstableread@lineno=2\relax + \ifnum\pgfplotstableread@numcols=3\relax + % The file started with + % #... + % #... + % X Y i + % -> thats a gnuplot file! + \pgfplotstableread@curline@contains@colnamesfalse + \fi + \fi + \fi + % Now, read the first line. + % It contains either + % - column names, + % - numerical data, + % - nothing (comments). + \ifpgfplotstableread@curline@contains@colnames + \pgfplotstableread@foundcolnamestrue + \pgfplotstableread@curcol=0\relax + \pgfplotstableread@impl@DO\pgfplotstableread@impl@collectcolnames@NEXT\pgfplotstable@LINE + %\expandafter\pgfplotstableread@impl@collectcolnames@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI + \else + \pgfplotstableread@foundcolnamesfalse + \pgfplotstableread@curcol=0\relax + % Leave column name lists empty... + \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE + %\expandafter\pgfplotstableread@impl@nextrow@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI + \fi +%\pgfplots@message{After reading first row: found '\the\pgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames'}% + \else + \pgfplotstableread@curcol=0\relax + \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE + %\expandafter\pgfplotstableread@impl@nextrow@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI + \fi + \ifnum\pgfplotstableread@curcol=\pgfplotstableread@numcols + \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 + \advance\pgfplotstableread@usablelineno by1\relax + \fi + \fi + \advance\pgfplotstableread@lineno by1\relax + \pgfplotstableread@loop@over@lines + \fi +} + +\def\pgfplotstableread@checkspecial@line{% + \pgfutil@ifnextchar##{% + \pgfplotstableread@skiplinetrue + \pgfplotstableread@impl@gobble + }{% + \pgfutil@ifnextchar${% + \pgfplotstableread@process@flags@line + }{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfplotstableread@skiplinetrue + \pgfplotstableread@impl@gobble + }{% + \pgfutil@ifnextchar\par{% + \pgfplotstableread@skiplinetrue + \pgfplotstableread@impl@gobble + }{% + \pgfplotstableread@skiplinefalse + \pgfplotstableread@impl@gobble + }% + }% + }% + }% +} + +\long\def\pgfplotstableread@process@flags@line$flags {% +%\pgfplots@message{Ignoring flags line ...}% + \pgfplotstableread@skiplinetrue + \pgfplotstableread@impl@gobble +} + +\def\pgfplotstableread@create@column@lists{% + \loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols + \expandafter\pgfplotslistnewempty\csname numtable@col@\the\pgfplotstableread@curcol\endcsname + \advance\pgfplotstableread@curcol by1\relax + \repeat +} + +\def\pgfplotstableread@create@column@names@with@numbers{% + \pgfplotstableread@curcol=0\relax + \loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols + \expandafter\pgfplotslistpushback\the\pgfplotstableread@curcol\to\pgfplotstable@colnames + \advance\pgfplotstableread@curcol by1\relax + \repeat +} + +\long\def\pgfplotstableread@impl@gobble#1\pgfplotstable@EOI{}% + +\def\pgfplotstable@EOI{\pgfplotstable@EOI}% + +%%%%%%%%%%%%%%% + +% A loop command which processes every single entry in a raw data row #2 +% and invokes the macro #1{<arg>} for each found column entry. +% +% Columns are separated by the /pgfplots/table/col sep character. +% +% #1: a command which takes precisely one argument. It will be called +% for each found column entry +% +% #2: a macro containing a raw data line with <col sep> separated +% entries. +\def\pgfplotstableread@impl@DO#1#2{% + \let\pgfplotstableread@impl@ITERATE@NEXT@=#1\relax + \ifcase\pgfplotstableread@COLSEP@CASE\relax + % SPACE: + \expandafter\pgfplotstableread@impl@ITERATE#2\pgfplotstable@EOI + \or + % COMMA: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COMMA + \expandafter\pgfplotstableread@impl@ITERATE#2,\pgfplotstable@EOI + \or + % SEMICOLON: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON + \expandafter\pgfplotstableread@impl@ITERATE#2;\pgfplotstable@EOI + \or + % COLON: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COLON + \expandafter\pgfplotstableread@impl@ITERATE#2:\pgfplotstable@EOI + \or + % BRACE: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@BRACE + \expandafter\pgfplotstableread@impl@ITERATE#2\pgfplotstable@EOI + \fi +}% +\def\pgfplotstableread@impl@ITERATE{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfplotstableread@impl@gobble + }{% + \pgfplotstableread@impl@ITERATE@NEXT + }% +}% +\def\pgfplotstableread@impl@ITERATE@NEXT#1 {% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\def\pgfplotstableread@impl@ITERATE@NEXT@COMMA#1,{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\def\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON#1;{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\def\pgfplotstableread@impl@ITERATE@NEXT@COLON#1:{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\def\pgfplotstableread@impl@ITERATE@NEXT@BRACE#1{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +%%%%%%%%%%%% + + +\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 + \advance\pgfplotstableread@curcol by1\relax +} + + + +\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}% + }{% 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}% + }% + \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. + \expandafter\pgfplotslistpushback\expandafter{\pgfplotstable@TMP}\to\pgfplotstable@colnames + \advance\pgfplotstableread@curcol by1\relax +} + + + + +\long\def\pgfplotstableread@impl@countcols@and@identifynames@NEXT#1{% + \advance\pgfplotstableread@curcol by1\relax + \ifpgfplotstable@search@header + \ifpgfplotstableread@curline@contains@colnames + \else + \pgfplotstableread@isnumber@ITERATE#1\pgfplotstable@EOI +%\ifpgfplotstableread@curline@contains@colnames\pgfplots@message{'#1' is a column name!}\else\pgfplots@message{'#1' is NO column name!}\fi + \fi + \fi +} +\def\pgfplotstableread@isnumber@plus{+} +\def\pgfplotstableread@isnumber@minus{-} +\def\pgfplotstableread@isnumber@zero{0} +\def\pgfplotstableread@isnumber@one{1} +\def\pgfplotstableread@isnumber@two{2} +\def\pgfplotstableread@isnumber@three{3} +\def\pgfplotstableread@isnumber@four{4} +\def\pgfplotstableread@isnumber@five{5} +\def\pgfplotstableread@isnumber@six{6} +\def\pgfplotstableread@isnumber@seven{7} +\def\pgfplotstableread@isnumber@eight{8} +\def\pgfplotstableread@isnumber@nine{9} +\def\pgfplotstableread@isnumber@e{e} +\def\pgfplotstableread@isnumber@E{E} +\def\pgfplotstableread@isnumber@period{.} + +\def\pgfplotstableread@isnumber@ITERATE#1{% + \def\pgfplotstableread@CURTOK{#1}% + \ifx\pgfplotstableread@CURTOK\pgfplotstable@EOI + \def\pgfplotstableread@NEXT{}% + \else + \def\pgfplotstableread@NEXT{\pgfplotstableread@isnumber@ITERATE}% + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@plus + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@minus + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@zero + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@one + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@two + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@three + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@four + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@five + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@six + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@seven + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@eight + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@nine + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@e + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@E + \else + \ifx\pgfplotstableread@CURTOK\pgfplotstableread@isnumber@period + \else +%\message{NO ITS NOT! Token: '\meaning\pgfplotstableread@CURTOK'}% + % it's no number, so it is a column name. + \pgfplotstableread@curline@contains@colnamestrue + \def\pgfplotstableread@NEXT{\pgfplotstableread@impl@gobble}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi + \pgfplotstableread@NEXT +} + +\def\pgfplotstable@error#1{\PackageError{numtable}{#1}{Please refer to the manual for further information.}}% + + +\def\pgfplotstableset{% + \pgfqkeys{/pgfplots/table}% +}% + +% Accepts a macro #1 which contains an argument denoting a column +% name. +% +% It checks whether #1 starts with '#', indicating that it is actually +% a column INDEX. If that is the case, +% \ifpgfplotstableread@foundcolnames is set to false and the index is +% returned into #1. +% +% Otherwise, \ifpgfplotstableread@foundcolnames is set to true. +\def\pgfplotstabletypeset@is@colname#1{% + \expandafter\pgfplotstabletypeset@is@colname@#1\pgfplotstable@EOI + \ifpgfplotstableread@foundcolnames + \else + \let#1=\pgfplotstable@TMP + \fi +}% +\def\pgfplotstabletypeset@is@colname@{% + \pgfutil@ifnextchar[{% + \pgfplotstabletypeset@is@colname@index + }{% + \pgfplotstableread@foundcolnamestrue + \pgfplotstabletypeset@is@colname@name + }% +} +\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@@ + \pgfplotstableread@foundcolnamesfalse + \def\pgfplotstable@TMP{#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}% +}% + +% processes the option 'assign column name' +\def\pgfplotstabletypeset@assign@final@colname#1#2{% + \pgfkeysifdefined{/pgfplots/table/assign column name/.@cmd}{% + \pgfkeysvalueof{/pgfplots/table/assign column name/.@cmd}#1\pgfeov + \pgfkeysgetvalue{/pgfplots/table/column name}{#2}% + }{}% +} +\def\pgfplotstabletypeset@nocolname{\pgfkeysnovalue} + +% checks if #1 contains invalid chars for pgfkeys and sets +% \ifpgfutil@in@ to true if that is the case. +\def\pgfplotstable@checkspecialchars@pgfkeys#1\pgfplotstable@EOI{% + \pgfutil@in@/{#1}% + \ifpgfutil@in@ + \else + \pgfutil@in@={#1}% + \ifpgfutil@in@ + \else + \pgfutil@in@,{#1}% + \fi + \fi + +}% + +% TODO +% - replace grouped list foreach by popfront-loop and use arrays +% directly -> group only the pgfkeys eval +\def\pgfplotstabletypeset@opt[#1]#2{% + \begingroup + \def\pgfplotstablecol{\the\c@pgfplotstable@colindex}% + \def\pgfplotstablerow{\the\c@pgfplotstable@rowindex}% +% \def\pgfplotstablecols{\the\c@pgfplotstable@numcols}% +% \def\pgfplotstablerows{\the\c@pgfplotstable@numrows}% + \ifpgfplots@table@options@areset + \else + \pgfplotstableset{/pgfplots/table/every table,#1}% + \fi + \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% + \ifx\pgfplotstable@colnames\pgfutil@empty + \pgfplotstablegetcolumnlist#2\to\pgfplotstable@colnames + \else + \expandafter\pgfplotslistnew\expandafter\pgfplotstable@colnames\expandafter{\pgfplotstable@colnames}% + \fi + \global\pgfplotslistnewempty\pgfplotstabletypeset@final@colnames + \global\pgfplotslistnewempty\pgfplotstabletypeset@final@coltypes + \global\pgfplotslistnewempty\pgfplotstabletypeset@final@cols + \let\c@pgfplotstable@numcols=\c@pgf@counta + \let\c@pgfplotstable@numrows=\c@pgf@countd + \let\c@pgfplotstable@rowindex=\c@pgf@countc + \let\c@pgfplotstable@colindex=\c@pgf@countb + \pgfplotslistsize\pgfplotstable@colnames\to\c@pgfplotstable@numcols + \c@pgfplotstable@colindex=0\relax + \pgfplotslistforeach\pgfplotstable@colnames\as\pgfplotstable@colname{% + \c@pgfplotstable@rowindex=0\relax + \pgfplotstabletypeset@is@colname\pgfplotstable@colname + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#2\to\pgfplotstable@colname + \fi + \pgfplotstablegetcolumnbyname\pgfplotstable@colname\of#2\to\pgfplotstable@col + % + % Set keys for columns! + \ifodd\c@pgfplotstable@colindex + \pgfplotslist@TOK@a={every odd column}% + \else + \pgfplotslist@TOK@a={every even column}% + \fi + \ifnum\c@pgfplotstable@colindex=0\relax + \pgfplotslist@TOK@a=\expandafter{\the\pgfplotslist@TOK@a,every first column}% + \fi + \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}% + \fi + \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@colname}% + \expandafter\pgfplotstable@checkspecialchars@pgfkeys\the\pgfplotslist@TOK@b\pgfplotstable@EOI + \ifpgfutil@in@ + \edef\pgfplotstable@TMP{\the\pgfplotslist@TOK@a,columns/{\the\pgfplotslist@TOK@b}/.try}% + \else + \edef\pgfplotstable@TMP{\the\pgfplotslist@TOK@a,columns/\the\pgfplotslist@TOK@b/.try}% + \fi + \expandafter\pgfplotstableset\expandafter{\pgfplotstable@TMP}% + % + \pgfkeysgetvalue{/pgfplots/table/column name}{\pgfplotstable@colname@out}% + \ifx\pgfplotstable@colname@out\pgfplotstabletypeset@nocolname + \let\pgfplotstable@colname@out=\pgfplotstable@colname + \fi + \expandafter\pgfplotstabletypeset@assign@final@colname\expandafter{\pgfplotstable@colname@out}\pgfplotstable@colname@out + {\globaldefs=1 + \expandafter\pgfplotslistpushback\pgfplotstable@colname@out\to\pgfplotstabletypeset@final@colnames + }% + \pgfkeysgetvalue{/pgfplots/table/column type}{\pgfplotstable@coltype}% + {\globaldefs=1 + \expandafter\pgfplotslistpushback\pgfplotstable@coltype\to\pgfplotstabletypeset@final@coltypes + }% + % + \pgfplotslistnewempty\pgfplotstable@col@processed + \pgfplotslistforeachungrouped\pgfplotstable@col\as\pgfplotstable@entry{% + \pgfplotstableuserowtrue + \edef\pgfplotstable@TMP{\noexpand\pgfkeysvalueof{/pgfplots/table/row predicate/.@cmd}\the\c@pgfplotstable@rowindex}% + \pgfplotstable@TMP\pgfeov + \ifpgfplotstableuserow + \expandafter\pgfplotstabletypeset@getfinalentry\expandafter{\pgfplotstable@entry}{\pgfplotstable@entry}% + \expandafter\pgfplotslistpushback\pgfplotstable@entry\to\pgfplotstable@col@processed + \fi + \advance\c@pgfplotstable@rowindex by1\relax + }% + {\globaldefs=1 + \expandafter\pgfplotslistpushback\expandafter{\pgfplotstable@col@processed}\to\pgfplotstabletypeset@final@cols + }% + }% + % + % Ok, I have now everything which will come into the final table. + % + % But I have it column-oriented; I need to transpose the storage. + % + % The following code assembles a + % \begin{tabular}{} + % ... + % \end{tabular} + % statement piece after piece. + % +%\message{I have now \meaning\pgfplotstabletypeset@final@colnames, and \meaning\pgfplotstabletypeset@final@cols.}% + % Step 1: column names. + \c@pgfplotstable@colindex=0\relax + % STEP 1.1: collect column types: + \def\pgfplotstable@resulttypes{}% + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% + \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@resulttypes}% + \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@coltype}% + \edef\pgfplotstable@resulttypes{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + }% + \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% + \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@entry}% + \ifx\pgfplotstable@resulttypes\pgfutil@empty + \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a}% + \else + \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@resulttypes}% + \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a{\the\pgfplotslist@TOK@b}}% + \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}% + \fi + % + + % Step 1.2: Collect FIRST ROW (column names) + \begingroup + \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}% + }% + \endgroup + \pgfplotstable@TMP + % 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}% + % + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% + \advance\c@pgfplotstable@colindex by1\relax + \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax + \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@colname@out \\}% + \else + \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@colname@out &}% + \fi + \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + }% + % 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}% + % +%\message{I have now \meaning\pgfplotstable@result.}% + % Step 2: column contents. + % I will first convert \pgfplotstabletypeset@final@cols into an array. + \c@pgfplotstable@colindex=0\relax + \pgfplotsarraynewempty\pgfplotstabletypeset@final@cols@array + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@cols\as\pgfplotstable@col@processed{% + \expandafter\pgfplotsarraypushback\expandafter{\pgfplotstable@col@processed}\to\pgfplotstabletypeset@final@cols@array + }% + % init numrows: + \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed + \pgfplotslistsize\pgfplotstable@col@processed\to\c@pgfplotstable@numrows + % + % Now, we loop over every column as long as there are still rows + % left. We assemble rows while we go. + % + \c@pgfplotstable@rowindex=0\relax + \ifnum\c@pgfplotstable@colindex<\c@pgfplotstable@numcols + \pgfplots@loop@CONTINUEtrue + \else + \pgfplots@loop@CONTINUEfalse + \fi + \loop + \ifpgfplots@loop@CONTINUE + \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed + \pgfplotslistcheckempty\pgfplotstable@col@processed + \ifpgfplotslistempty + \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}% + \else + \pgfplotslist@TOK@a={every even row}% + \fi + \ifnum\c@pgfplotstable@rowindex=0\relax + \pgfplotslist@TOK@a=\expandafter{\the\pgfplotslist@TOK@a,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}% + \else + \edef\pgfplotstable@TMP{\the\pgfplotslist@TOK@a,every row no \the\c@pgfplotstable@rowindex/.try}% + \fi + \expandafter\pgfplotstableset\expandafter{\pgfplotstable@TMP}% + \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}% + }% + \endgroup + \pgfplotstable@TMP + % 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}% + \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}% + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax + \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@entry \\}% + \else + \pgfplotslist@TOK@b=\expandafter{\pgfplotstable@entry &}% + \fi + \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a\the\pgfplotslist@TOK@b}% + \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}% + \advance\c@pgfplotstable@rowindex by1\relax + \fi +%\message{I have now \meaning\pgfplotstable@result.}% + \fi + \repeat + \pgfplotslist@TOK@a=\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}% + \ifx\pgfplotstable@font\pgfutil@empty + \else + \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result\endgroup}% + \edef\pgfplotstable@result{\the\pgfplotslist@TOK@a}% + \fi + \ifpgfplotstabletypesetdebug + \pgfplotslist@TOK@a=\expandafter{\pgfplotstable@result}% + \immediate\write16{------- PGFPLOTSTABLE DEBUG MODE: --------}% + \immediate\write16{{\the\pgfplotslist@TOK@a}}% + \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}% + \immediate\closeout\pgfplotstable@outfile + \endgroup + \fi + \pgfplotstable@result + \endgroup +}% + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.coltype.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.coltype.code.tex new file mode 100644 index 00000000000..b56d65147fc --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.coltype.code.tex @@ -0,0 +1,85 @@ +%-------------------------------------------- +% +% Package numtable. +% +% This file provides support for column types in LaTeX tabular +% environments, i.e. +% +%\begin{tabular}{>{\pgfplotstablecoltype}c<{\endpgfplotstablecoltype}} +% 1 \\ +% 2 \\ +% 3 \\ +%\end{tabular} +% +% +% +% 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/>. +% +%-------------------------------------------- + + + +% If I did not get it wrong, the tabular package, initialised with a +% column type like +% >{\pgfplotstablecoltype}c<{\endpgfplotstablecoltype} +% yields +% +% \pgfplotstablecoltype \ignorespaces <content> \unskip \endpgfplotstablecoltype +% OR +% \pgfplotstablecoltype \ignorespaces <content> \\ \endpgfplotstablecoltype +% +% So, I define \pgfplotstablecoltype to skip \ignorespaces and \unskip and simply +% get <content>. +\def\pgfplotstablecoltype{% + \begingroup + \let\pgfplotstablecoltype@content=\empty + \pgfutil@ifnextchar[{% + \pgfplotstablecoltype@ + }{% + \pgfplotstablecoltype@until@end@start + }% +}% +\def\pgfplotstablecoltype@[#1]{% + \pgfqkeys{/pgf/number format}{#1}% + \pgfplotstablecoltype@until@end@start +}% + +\def\pgfplotstablecoltype@until@end@start\ignorespaces{% + \pgfplotstablecoltype@until@end +}% +\def\pgfplotstablecoltype@until@end{% + \pgfutil@ifnextchar\\{% + \pgfplotstablecoltype@finish% + }{% + \pgfutil@ifnextchar{\unskip}{% + \pgfplotstablecoltype@finish% + }{% + \pgfplotstablecoltype@next + }% + }% +} +\def\pgfplotstablecoltype@next#1{% + \expandafter\def\expandafter\pgfplotstablecoltype@content\expandafter{\pgfplotstablecoltype@content#1}% + \pgfplotstablecoltype@until@end +} +\def\pgfplotstablecoltype@finish{% +%\message{COLLECTED \meaning\pgfplotstablecoltype@content}% + \pgfmathprintnumber{\pgfplotstablecoltype@content}% + \endgroup +}% + +%\def\pgfplotstablecoltype{\message{COLLECT}}% +\def\endpgfplotstablecoltype{}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex new file mode 100644 index 00000000000..628fc7f374e --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -0,0 +1,12 @@ +\pgfkeysifdefined{/pgf/number format/1000 sep/.@cmd}{\endinput}{} +%-------------------------------------------------- +% \pgfutil@ifundefined{pgfplothandlerybarinterval} +% {}% +% {\endinput}% +%-------------------------------------------------- + +\immediate\write16{Package pgfplots: loading support code for older PGF versions...} +\input pgfplotsoldpgfsupp_misc.code.tex +\input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex +\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex +\input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex new file mode 100644 index 00000000000..9e037470f6e --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex @@ -0,0 +1,96 @@ + +% ====================================================== +% compatibility with PGF 2.0 +\def\pgfkeysaddvalue#1#2#3{% + {% + \toks0{#2}% + \pgfkeysifdefined{#1} + {\pgfkeys@temptoks\expandafter\expandafter\expandafter{\csname pgfk@#1\endcsname}}% + {\pgfkeys@temptoks{}}% + \toks1{#3}% + \xdef\pgfkeys@global@temp{\the\toks0 \the\pgfkeys@temptoks \the\toks1}% believe or don't: the spaces are important + }% + \pgfkeyslet{#1}\pgfkeys@global@temp% +} + +\def\pgfkeys@try{% + \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}% + {% + \pgfkeysgetvalue{\pgfkeyscurrentpath/.@cmd}{\pgfkeys@code}% + \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value + \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}% + {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}} + {}% no default, so leave it + \fi% + \let\pgfkeyscurrentkey=\pgfkeyscurrentpath% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice + % FIXME: maybe there are more things like that - also adjust currentname!? + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov% + \pgfkeyssuccesstrue% + }% + {% + \pgfkeysifdefined{\pgfkeyscurrentpath}% + {% + \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% + \pgfkeysvalueof{\pgfkeyscurrentpath}% + \else% + \pgfkeyslet{\pgfkeyscurrentpath}\pgfkeyscurrentvalue% + \fi% + \pgfkeyssuccesstrue% + }% + {\pgfkeyssuccessfalse}% + }% +} +% ====================================================== + +\def\pgfutilensuremath#1{% + \ifmmode#1\else$#1$\fi +} + +\tikzoption{ybar}[]{\let\tikz@plot@handler=\pgfplothandlerybar} +\tikzoption{xbar}[]{\let\tikz@plot@handler=\pgfplothandlerxbar} +\tikzoption{ybar interval}[]{\let\tikz@plot@handler=\pgfplothandlerybarinterval} +\tikzoption{xbar interval}[]{\let\tikz@plot@handler=\pgfplothandlerxbarinterval} +\tikzoption{const plot}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto} +\tikzoption{const plot mark left}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto} +\tikzoption{const plot mark right}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkright} +\tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright} +\tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft} + + + + +% ====================================================== + + +\newif\ifpgfmathcomparison + +% Assigns \pgfmathresult to 1.0 if #1 ~= #1. +% +% It will also set the boolean \ifpgfmathcomparison accordingly +% (globally). +\def\pgfmathapproxequalto#1#2{% + \edef\pgfmath@marshal{% + \noexpand\pgfmathparse{#2} + \noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult% + \noexpand\pgfmathparse{#1}% + }% + \pgfmath@marshal% + \pgfmathapproxequalto@{\pgfmathresult}{\pgfmath@arg}} +\def\pgfmathapproxequalto@#1#2{% + \begingroup% + \pgfmath@x#1pt% + \pgfmath@y#2pt% + \advance\pgfmath@x-\pgfmath@y% + \ifdim\pgfmath@x<0pt + \multiply\pgfmath@x by-1 + \fi + \ifdim\pgfmath@x<0.0001pt\relax% + \def\pgfmathresult{1.0}% + \global\pgfmathcomparisontrue + \else% + \def\pgfmathresult{0.0}% + \global\pgfmathcomparisonfalse + \fi% + \pgfmath@smuggleone\pgfmathresult + \endgroup% +} diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex new file mode 100644 index 00000000000..cd5c328c700 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex @@ -0,0 +1,927 @@ +% Copyright 2008 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% +% This file contains additions to pgfkeys.code.tex (loaded +% automatically at the end of pgfkeys.code.tex) +% +% Improvements: +% +% - option filtering +% you provide +% - a boolean predicate +% - a "filter handler" which will be invoked for non-matching options, +% - a key=value list as usual. +% The filter sets only matching options and invokes the handler for +% unmatching ones. +% +% - Fast family support as in xkeyval. +% - A key like /my tree/my option can be associated with /my family +% - You can efficiently set keys which belong to a set of "active" +% families. +% Remaining options can be collected into a macro. + +% WARNING: +% this file overwrites +% \pgfkeys@addpath +% \pgfkeys@nevermind +% +% all other features are 'additive' + + +% these implementations will be switched dynamically with their +% filtered versions (in \pgfkeys@install@filter@and@invoke) +\let\pgfkeys@orig@case@one=\pgfkeys@case@one +\let\pgfkeys@orig@@set=\pgfkeys@@set +\let\pgfkeys@orig@@qset=\pgfkeys@@qset +\let\pgfkeys@orig@try=\pgfkeys@try +\let\pgfkeys@orig@unknown=\pgfkeys@unknown + +\newif\ifpgfkeysfilteringisactive +\newif\ifpgfkeysfiltercontinue +\let\pgfkeys@key@predicate=\pgfkeys@empty +\let\pgfkeys@filtered@handler=\pgfkeys@empty +\newtoks\pgfkeys@tmptoks + +% Performs 'filtered' key settings. +% +% For every option for which the path prefixing has already been done, +% the current key filter predicate will be invoked. If the predicate +% returns true, pgfkeys will process this key in the normal manner. +% If not, a key filter handler will be invoked. +% +% The *predicate* and *handler* semantics are as follows: +% PRECONDITION: +% 1. The variables +% \pgfkeyscurrentkey (full path including name) +% \pgfkeyscurrentkeyRAW (the current key as it has been +% found in the key=value list +% without path modification) +% \pgfkeyscurrentvalue +% are all set. If the current key is a handler variable, +% \pgfkeyscurrentname +% and +% \pgfkeyscurrentpath +% are also set. +% 2. The type of option has already been checked, that means +% case (1) whether '.@cmd' exists +% case (2) whether the key as such has its value +% case (3) it is a handler like '.code', '.cd' or whatever. +% case (0) it is unknown. +% The actual case number (0-3) will be provided as contents +% of the macro +% \pgfkeyscasenumber. +% Please note that unknown options will be processed with +% the usual '.unknown' handlers unless the key filter takes +% control over unknown options as well. +% +% POSTCONDITION: +% the predicate sets +% \pgfkeysfiltercontinuetrue +% or +% \pgfkeysfiltercontinuefalse +% (the boolean \ifpgfkeysfiltercontinue). +% Depending on this 'if', option processing will be continued or +% skipped. +% +% The handler can do anything with the option, for example collect +% unmatched ones. +% +% ATTENTION: \pgfkeysfiltered can't be nested (yet). Use the +% \pgfkeyspredicateAND if you need multiple predicates at once. +% Nesting would produce unexpected results because the current filter +% state can't be stored/restored without TeX-groups, therefor it is +% disabled. +% +% ATTENTION: you can't filter error messages. +% +% REMARK: In case (3), the macros \pgfkeyscurrentpath and +% \pgfkeyscurrentname have already been computed, you do not need to +% invoke \pgfkeyssplitpath. In any other case, neither path nor name +% are required for the options processing - if you need them for +% predicates/handlers, you need to compute them by hand. +% +% +% Example: +% \def\unmatched{} +% \pgfkeys{/pgf/key filters/is descendant of/.install key filter=/my group} +% \pgfkeys{/pgf/key filter handlers/append filtered to/.install key filter handler=\unmatched} +% \pgfkeysfiltered% +% {/my group/option 1=value 1,/tikz/option 2=value 2} +% -> +% will set '/my group/option 1' as usual, but '/tikz/option 2' will not +% be set. Instead, it will be appended to '\unmatched' such that +% \unmatched = {/tikz/option 2=value2} +% after the operation. +% +% Arguments: +% #1: key-value list. +\def\pgfkeysfiltered{% + % produce + % '{<default path>}' + % each expanded exactly one time into the register: + \expandafter\pgfkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}% +} + +% #1: old value of default path. +% #2: key-value-list. +\def\pgfkeysfiltered@@install#1#2{% + \pgfkeys@install@filter@and@invoke{% + \let\pgfkeysdefaultpath\pgfkeys@root% + \pgfkeys@parse#2,\pgfkeys@mainstop% + \def\pgfkeysdefaultpath{#1}% + }% +} + +% Assuming that macro #1 contains a key=value list, this command +% performs an \pgfkeysalso command for the content of macro #1. +% +% It can be used in conjunction with +% - \pgfkeysfiltered and +% - \pgfkeysappendfilterednamestomacro: +% the first pass fill only process options matching the filter, then, +% a \pgfkeysalsofrom can be used at a later time to set the remaining +% options. +% +% Example: +% \pgfkeys{/my group/.cd,/utils/exec=\pgfkeysalsofrom\filtered} +\def\pgfkeysalsofrom#1{% + \expandafter\pgfkeysalso\expandafter{#1}% +} + +% The same as \pgfkeysalsofrom, but it invokes \pgfkeysalsofiltered. +\def\pgfkeysalsofilteredfrom#1{% + \expandafter\pgfkeysalsofiltered\expandafter{#1}% +} + +% #1 = options +\long\def\pgfkeysalsofiltered#1{% + \pgfkeys@install@filter@and@invoke{\pgfkeysalso{#1}}% +}% + +% The same like \pgfkeysfiltered, but with quick search path setting. +% +% #1: default path +% #2: key-value-pairs +\def\pgfqkeysfiltered#1{% + \expandafter\pgfqkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}{#1}% +} + +% #1: old value of default path. +% #2: default path +% #3: key-value-list. +\def\pgfqkeysfiltered@@install#1#2#3{% + \pgfkeys@install@filter@and@invoke{% + \def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}% + }% +} + +% Family management +% +% The family code provides the following features: +% 1. every key can be associated with 0 or 1 'family'. +% 2. Families are a loose association which are independend of the key +% hierarchy. +% For example, /my tree/key1 can belong to family /tikz. +% +% 3. It is possible to "activate" or "deactivate" single families. +% Furthermore, it is possible to set only keys which belong to +% active families (using \pgfkeysfiltered). +% 4. Runtime complexities: +% If you have N options and you only want to process K active +% families, the runtime is O( N + K ): +% - activate every family O(K) +% - use \pgfkeyshasactivefamily as filter predicate O(N) +% - deactivate every family O(K) + + +% Activates family #1. +% +% #1 maybe a macro. +\def\pgfkeysactivatefamily#1{% + \pgfkeysiffamilydefined + {#1}% + {\csname pgfk@#1/familyactivetrue\endcsname}% + {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}% +%\message{[ACTIVATING FAMILY #1]}% +} + +% Deactivates family #1. +% +% #1 maybe a macro. +\def\pgfkeysdeactivatefamily#1{ + \pgfkeysiffamilydefined + {#1}% + {\csname pgfk@#1/familyactivefalse\endcsname}% + {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}% +%\message{[DEACTIVATING FAMILY #1]}% +} + +% Activates all families in the comma separated list #1. +% +% It will also generate code for deactivation of all those families +% into the command #2. +% +% #1: a comma-separated list of fully qualified family names. +% #2: a command which will be filled with a deactivate-all command. +\def\pgfkeysactivatefamilies#1#2{% + \pgfkeyssavekeyfilterstateto\pgfkeys@cur@state + \expandafter\pgfkeysactivatefamilies@impl\expandafter{\pgfkeys@cur@state}{#1}{#2}% +} +% #1: commands needed to restore the old filtering state +% #2: family name list +% #3: macro name for de-activate command +\def\pgfkeysactivatefamilies@impl#1#2#3{% + \pgfkeysinstallkeyfilter{/pgf/key filters/false}{}% + \let#3=\pgfkeys@empty% + \def\pgfkeys@filtered@handler{\pgfkeys@family@activate@handler{#3}}% + \pgfkeysalsofiltered{#2}% + #1% +} + +\def\pgfkeys@family@activate@handler#1{% + \pgfkeysactivatefamily{\pgfkeyscurrentkey}% + % produce + % <old list> '\pgfkeysdeactivatefamily{' <current key> '}' + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter\pgfkeysdeactivatefamily\expandafter{\pgfkeyscurrentkey}}% + \edef#1{\the\pgfkeys@tmptoks}% +} + +% If for testing whether a family exists. +% +% #1 = fully qualified family name +% #2 = if-case +% #3 = else-case +% +% Description: +% +% If the family exists, #2 will be executed. Otherwise, #3 will be +% called. +\long\def\pgfkeysiffamilydefined#1#2#3{\pgfkeys@ifcsname ifpgfk@#1/familyactive\endcsname#2\else#3\fi} + +% Sets the TeX boolean +% \ifpgfkeysfiltercontinue := ( family #1 is active ) +% +% Argument: +% #1 the family name. Maybe a macro. +\def\pgfkeysisfamilyactive#1{% + \pgfkeysiffamilydefined{#1}{% + \expandafter\let\expandafter\ifpgfkeysfiltercontinue\csname ifpgfk@#1/familyactive\endcsname + }{% + \pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov% + \expandafter\expandafter\expandafter\let\csname ifpgfkeysfiltercontinue\endcsname\csname iffalse\endcsname + }% +}% + +% Retrieve the family of full key #1 into macro #2. +% +% Will set the TeX boolean \ifpgfkeyssuccess to whether the full key +% really has a family. +% +% The family for any key is stored in the sub-key #1/family. +% +% Parameters: +% #1: the full key name for which the family is requested. Maybe a +% macro. +% #2: a macro name which will be filled with the result. +\def\pgfkeysgetfamily#1#2{% + \pgfkeysifdefined{#1/family}{\pgfkeysgetvalue{#1/family}{#2}\pgfkeyssuccesstrue}{\pgfkeyssuccessfalse}% +} + + + +% Sets \ifpgfkeysfiltercontinue to true iff the current key belongs to +% the /errors tree. +\long\def\pgfkeys@cur@is@descendant@of@errors{% + \expandafter\pgfkeys@cur@is@descendant@of@errors@impl\pgfkeyscurrentkey/errors\pgf@@eov +}% +\long\def\pgfkeys@cur@is@descendant@of@errors@impl#1/errors#2\pgf@@eov{% + \def\pgfkeyspred@TMP{#1}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty +%\message{[SPECIAL CHECK] '\pgfkeyscurrentkey' is descendant of '/errors': TRUE.}% + \pgfkeysfiltercontinuetrue + \else +%\message{[SPECIAL CHECK] '\pgfkeyscurrentkey' is descendant of '/errors': FALSE.}% + \pgfkeysfiltercontinuefalse + \fi +}% + +% \pgfkeysinterruptkeyfilter +% ... +% \endpgfkeysinterruptkeyfilter +% temporarily interrupts key filtering and enables it in +% \endpgfkeysinterruptkeyfilter. +% +% If key filtering it not active, this has no effect at all. +% +% REMARK: +% \pgfkeysinterruptkeyfilter...\endpgfkeysinterruptkeyfilter does NOT +% introduce a \TeX-group. +\def\pgfkeysinterruptkeyfilter{% + \ifpgfkeysfilteringisactive + \let\pgfkeys@case@one=\pgfkeys@orig@case@one + \let\pgfkeys@try=\pgfkeys@orig@try + \let\pgfkeys@unknown=\pgfkeys@orig@unknown + \fi +} + +\def\endpgfkeysinterruptkeyfilter{% + \ifpgfkeysfilteringisactive + \let\pgfkeys@case@one=\pgfkeys@case@one@filtered + \let\pgfkeys@try=\pgfkeys@try@filtered + \let\pgfkeys@unknown=\pgfkeys@unknown@filtered + \fi +} + +% Activates families #1, calls \pgfkeysfiltered and deactivates the +% families afterwards. +% +% REMARK: you need to install a family-based key filter predicate +% manually to benefit from the activated families! +% +% #1: comma separated family list +% #2: key-value pairs +% +% @see \pgfkeysactivatefamiliesandfilteroptions +\def\pgfkeysactivatefamiliesandfilteroptions#1#2{% + \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}% + \pgfkeysfiltered{#2}% + \pgfkeys@family@deactivation +} + +% The "quick" variant of \pgfkeysactivatefamiliesandfilteroptions: it +% also assigns a default path. +% +% #1: comma separated family list +% #2: default path +% #3: key-value pairs +\def\pgfqkeysactivatefamiliesandfilteroptions#1#2#3{% + \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}% + \pgfqkeysfiltered{#2}{#3}% + \pgfkeys@family@deactivation +} + +% Public version of split path: +\def\pgfkeyssplitpath{\pgfkeys@split@path}% + + +% The same as \pgfkeysactivatefamiliesandfilteroptions but just for +% ONE family. +% +% #1: family (maybe a macro) +% #2: key-value pairs +\def\pgfkeysactivatesinglefamilyandfilteroptions#1#2{% + \pgfkeysactivatefamily{#1}% + \pgfkeysfiltered{#2}% + \pgfkeysdeactivatefamily{#1}% +} + +% The "quick" variant of \pgfkeysactivatesinglefamilyandfilteroptions +% +% #1: family (maybe a macro) +% #2: default path +% #3: key-value pairs +\def\pgfqkeysactivatesinglefamilyandfilteroptions#1#2#3{% + \pgfkeysactivatefamily{#1}% + \pgfqkeysfiltered{#2}{#3}% + \pgfkeysdeactivatefamily{#1}% +} + +% Installs the key filter '#1' with argument '#2'. +% This is equivalent to +% \pgfkeys{#1/.install key filter=#2} +% +% The current values of the key filter handler is stored into the public +% macros +% \pgfkeyscurrentkeyfilter +% and +% \pgfkeyscurrentkeyfilterargs +% +% #1: a full key name; may be a macro +% #2: optional arguments for the key. If the key expects more than one +% argument, supply '{{first}{second}}' +\def\pgfkeysinstallkeyfilter#1#2{% + \pgfkeysifdefined{#1/.@cmd}{% + \edef\pgfkeyscurrentkeyfilter{#1}% + \def\pgfkeyscurrentkeyfilterargs{#2}% + \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@key@predicate@}% + \def\pgfkeys@key@predicate{\pgfkeys@key@predicate@#2\pgfeov}% + }{% + \pgfkeysvalueof{/errors/no such key filter/.@cmd}{#1}{#2}\pgfeov% + }% +} + +% Installs the key filter handler '#1' with argument '#2'. +% This is equivalent to +% \pgfkeys{#1/.install key filter handler=#2} +% +% The current values of the key filter handler is stored into the public +% macros +% \pgfkeyscurrentkeyfilterhandler +% and +% \pgfkeyscurrentkeyfilterhandlerargs +% +% #1: a full key name; may be a macro +% #2: optional arguments for the handler. If the handler expects more than one +% argument, supply '{{first}{second}}' +\def\pgfkeysinstallkeyfilterhandler#1#2{% + \pgfkeysifdefined{#1/.@cmd}{% + \edef\pgfkeyscurrentkeyfilterhandler{#1}% + \def\pgfkeyscurrentkeyfilterhandlerargs{#2}% + \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@filtered@handler@}% + \def\pgfkeys@filtered@handler{\pgfkeys@filtered@handler@#2\pgfeov}% + }{% + \pgfkeysvalueof{/errors/no such key filter handler/.@cmd}{#1}{#2}\pgfeov% + }% +} + +% Creates a macro which contains commands to re-activate the current +% key filter and key filter handler. It can be used to temporarily +% switch the key filter. +\def\pgfkeyssavekeyfilterstateto#1{% + % produce the string + % \pgfkeysinstallkeyfilter{...}{...} + % \pgfkeysinstallkeyfilterhandler{...}{...} + % where each argument is expanded once + % FIXME: Do the same with less overhead! + \pgfkeys@tmptoks={\pgfkeysinstallkeyfilter}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilter}}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterargs}\pgfkeysinstallkeyfilterhandler}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandler}}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandlerargs}}% + \edef#1{% + \the\pgfkeys@tmptoks + }% +} + + +\pgfkeys{% + /errors/family unknown/.code=\pgfkeys@error{% + Sorry, I do not know family '#1' and can't work with any assoicated family handling. Perhaps you misspelled it?}, + /errors/no such key filter/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter '#1'.}, + /errors/no such key filter handler/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter handler '#1'.}, + % HANDLERS: + % + % .is family should + % 1. '.cd' into the families' path, + % 2. define booleans to activate/deactive the family + % (see \pgfkeysisfamilyactive) + % 3. make sure that \pgfkeyshasactivefamily returns true for + % the family itsself. + /handlers/.is family/.append code={% + %\newif is an \outer macro in plain tex, so this here is not portable: + %\expandafter\newif\csname if\pgfkeyscurrentpath/familyactive\endcsname + \edef\pgfkeyspred@TMP{pgfk@\pgfkeyscurrentpath/familyactive}% + \expandafter\pgfkeys@non@outer@newif\expandafter{\pgfkeyspred@TMP}% + \edef\pgfkeyspred@TMP{\pgfkeyscurrentpath/.belongs to family=\pgfkeyscurrentpath}% + \expandafter\pgfkeysalso\expandafter{\pgfkeyspred@TMP}% + },% + /handlers/.activate family/.code=\pgfkeysactivatefamily{\pgfkeyscurrentpath}, + /handlers/.deactivate family/.code=\pgfkeysdeactivatefamily{\pgfkeyscurrentpath}, + /handlers/.belongs to family/.code={% + \pgfkeysiffamilydefined{#1}{% + \pgfkeyssetvalue{\pgfkeyscurrentpath/family}{#1}% + }{% + \pgfkeysalso{/errors/family unknown=#1}% + }% + },% + % + % + % An addition to the '.try' and '.retry' handlers: + % + % It is the same as '.retry', but if the option is still unknown, the + % usual handlers for unknown keys will be invoked. + /handlers/.lastretry/.code={% + \ifpgfkeyssuccess\else + \pgfkeys@try + \ifpgfkeyssuccess\else + % discard the '.lastretry' suffix: + \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% + \pgfkeys@split@path% + \pgfkeys@unknown + \fi + \fi + }, + % + % + /handlers/.install key filter/.code={% + \pgfkeysinstallkeyfilter{\pgfkeyscurrentpath}{#1}% + },% + /handlers/.install key filter handler/.code={% + \pgfkeysinstallkeyfilterhandler{\pgfkeyscurrentpath}{#1}% + },% + % + % + % KEY FILTER HANDLERS: + % + /pgf/key filter handlers/append filtered to/.code={% + % Produce + % <orig key> '={' <value> '}' + % where both, the key and the value are expanded just ONCE: + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\pgfkeyscurrentkeyRAW\expandafter=\expandafter{\pgfkeyscurrentvalue}}% + \ifx#1\pgfkeys@empty + \else + % Produce <old list> ',' <orig key> '={' <value> '}' + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter,\the\pgfkeys@tmptoks}% + \fi + \edef#1{\the\pgfkeys@tmptoks}% + },% + /pgf/key filter handlers/ignore/.code={}, + /pgf/key filter handlers/ignore/.install key filter handler, + /pgf/key filter handlers/log/.code={% + \immediate\write16{LOG: the option '\pgfkeyscurrentkey' (was originally '\pgfkeyscurrentkeyRAW') (case \pgfkeyscasenumber) has not been processed due to pgfkeysfiltered.}% + }, + % + % + % KEY FILTER PREDICATES: + % + % Returns true iff the currently processed key belongs to an active family. + % A family is active if it has been activated before. + /pgf/key filters/active families/.code={% + \ifnum\pgfkeyscasenumber=0 + % unknown options shall be processed with the + % unknown-handlers. + \pgfkeysfiltercontinuetrue + \else + \ifnum\pgfkeyscasenumber=3 + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + \pgfkeysfiltercontinuefalse + \fi + \fi + },% + % + % + % + % This filter works as follows: + % 1. if the current key belongs to a family: + % return whether its family is active, + % 2. if the current key does NOT belong to a family: + % return the result of criterion '#1', + % 3. the current key is unknown: + % return the result of criterion '#2'. + % + % Arguments: + % #1: the predicate which will be invoked in case 2. + % It will be invoked with the current case number as argument. + % #2: the predicate which will be invoked in case 3 with + % the current case number as argument. + /pgf/key filters/active families or no family/.code 2 args={% + \ifnum\pgfkeyscasenumber=0 + \pgfkeysevalkeyfilterwith{#2}% + \else + \ifnum\pgfkeyscasenumber=3 + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + \pgfkeysevalkeyfilterwith{#1}% + \fi + \fi + }, + /pgf/key filters/active families or no family DEBUG/.code 2 args={% + \ifnum\pgfkeyscasenumber=0 + \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking unknown handler '#2']}% + \pgfkeysevalkeyfilterwith{#2}% + \else + \ifnum\pgfkeyscasenumber=3 + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \ifpgfkeysfiltercontinue + \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is ACTIVE]}% + \else + \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is NOT active.]}% + \fi + \else% Ok, it does not belong to any family. + \immediate\write16{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking has-no-family-handler '#1']}% + \pgfkeysevalkeyfilterwith{#1}% + \fi + \fi + }, + % + % Processes only options which are childs of #1. + % Example: + % is descendant of/.install key filter=/foo + % will be true for + % /foo/bar/x=y + % /foo/.cd + % /foo/bar/.style=... + % but not for + % /bar/foo/... + /pgf/key filters/is descendant of/.code={% + \ifnum\pgfkeyscasenumber=0 + % unknown options shall be processed with the + % unknown-handlers. + \pgfkeysfiltercontinuetrue + \else + % string prefix comparison: + \long\def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{% + \def\pgfkeyspred@TMP{##1}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty +%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is descendant of '#1': TRUE.}% + \pgfkeysfiltercontinuetrue + \else +%\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is descendant of '#1': FALSE.}% + \pgfkeysfiltercontinuefalse + \fi + }% + \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov + \fi + },% + % + % + % + % Returns true if the currently processed full key equals #2. + /pgf/key filters/equals/.code={% + \ifnum\pgfkeyscasenumber=0 + % Unknown option: + \pgfkeysfiltercontinuetrue + \else + \def\pgfkeyspred@TMP{#1}% + \ifx\pgfkeyscurrentkey\pgfkeyspred@TMP + \pgfkeysfiltercontinuetrue + \else + \pgfkeysfiltercontinuefalse + \fi + \fi + },% + % + % + % Argument #1 can be any other (evaluated) filter predicate, its logical return + % value will be inverted. + % Example: + % not/.install key filter={is descendend of=/tikz} + % will install a key filter which evaluates 'is descendant of' with argument '/tikz' and returns the logical negation of the result. + /pgf/key filters/not/.code={% + \pgfkeysevalkeyfilterwith{#1}% + \ifpgfkeysfiltercontinue + \pgfkeysfiltercontinuefalse + \else + \pgfkeysfiltercontinuetrue + \fi + },% + /pgf/key filters/and/.code 2 args={% + \pgfkeysevalkeyfilterwith{#1}% + \ifpgfkeysfiltercontinue + \pgfkeysevalkeyfilterwith{#2}% + \fi + },% + /pgf/key filters/or/.code 2 args={% + \pgfkeysevalkeyfilterwith{#1}% + \ifpgfkeysfiltercontinue + \else + \pgfkeysevalkeyfilterwith{#2}% + \fi + },% + /pgf/key filters/true/.code={\pgfkeysfiltercontinuetrue},% + /pgf/key filters/true/.install key filter, + /pgf/key filters/false/.code={\pgfkeysfiltercontinuefalse},% + % + % Returns false if the current key is unknown, which avoids calling + % the unknown handlers. + /pgf/key filters/defined/.code={% + \ifnum\pgfkeyscasenumber=0 + \pgfkeysfiltercontinuefalse + \else + \pgfkeysfiltercontinuetrue + \fi + }, +}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Private IMPLEMENTATION +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +% This command does THE SAME work as \pgfkeys@case@one, +% but it applies filtering whenever it identified the type of an +% option. +\def\pgfkeys@case@one@filtered{% + \pgfkeys@cur@is@descendant@of@errors + \ifpgfkeysfiltercontinue + \pgfkeys@orig@case@one + \else + \pgfkeysfiltercontinuetrue + \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{% + % CASE ONE: a command option + \def\pgfkeyscasenumber{1}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue +%\message{PROCESSING KEY \pgfkeyscurrentkey!}% + \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov + \else +%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}% + \pgfkeys@filtered@handler% + \fi + }{% + % CASE TWO: a normal value option + \pgfkeysifdefined{\pgfkeyscurrentkey}{% + \def\pgfkeyscasenumber{2}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue +%\message{PROCESSING KEY \pgfkeyscurrentkey!}% + \pgfkeys@case@two@extern + \else +%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}% + \pgfkeys@filtered@handler% + \fi + }{% + \pgfkeys@split@path + % CASE THREE: a handler + \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{% + \def\pgfkeyscasenumber{3}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue +%\message{PROCESSING KEY \pgfkeyscurrentkey!}% + \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov + \else +%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}% + \pgfkeys@filtered@handler% + \fi + }{% + \pgfkeys@unknown + }% + }% + }% + \fi +}% + +\def\pgfkeys@unknown@filtered{% + % CASE ZERO: an unknown option. + \def\pgfkeyscasenumber{0}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue +%\message{PROCESSING KEY \pgfkeyscurrentkey!}% + % start normal 'unknown' handlers: + \pgfkeys@orig@unknown + \else +%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}% + \pgfkeys@filtered@handler% + \fi +} + +% Does the same as \pgfkeys@try, but it also invokes the key filters. +\def\pgfkeys@try@filtered{% + \ifpgfkeysfiltercontinue + \pgfkeys@orig@try + \else + \pgfkeysfiltercontinuetrue + \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}% + {% + % CASE ONE: a command option + \def\pgfkeyscasenumber{1}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue + \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% + \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value + \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}% + {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}} + {}% no default, so leave it + \fi% + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov% + \else + \pgfkeys@filtered@handler% + \fi + \pgfkeyssuccesstrue% + }% + {% + \pgfkeysifdefined{\pgfkeyscurrentpath}% + {% CASE TWO: a normal value option + \def\pgfkeyscasenumber{2}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue + \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% + \pgfkeysvalueof{\pgfkeyscurrentpath}% + \else% + \pgfkeyslet{\pgfkeyscurrentpath}\pgfkeyscurrentvalue% + \fi% + \else + \pgfkeys@filtered@handler% + \fi + \pgfkeyssuccesstrue% + }% + {\pgfkeyssuccessfalse}% + }% + \fi +} + + +% #1 the code to invoke after init and before cleanup +\def\pgfkeys@install@filter@and@invoke#1{% + \ifpgfkeysfilteringisactive + \pgfkeys@error{Sorry, nested calls to key filtering routines are not allowed. (reason: It is not possible to properly restore the previous filtering state after returning from the nested call)}% + \fi + \pgfkeysfilteringisactivetrue + \let\pgfkeys@case@one=\pgfkeys@case@one@filtered + \let\pgfkeys@try=\pgfkeys@try@filtered + \let\pgfkeys@unknown=\pgfkeys@unknown@filtered + #1% + \let\pgfkeys@case@one=\pgfkeys@orig@case@one + \let\pgfkeys@try=\pgfkeys@orig@try + \let\pgfkeys@unknown=\pgfkeys@orig@unknown + \pgfkeysfilteringisactivefalse +} + + +%-------------------------------------------------- +% \def\pgfkeys@eval@key@filter@subroutine@case@one{% +% \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{% +% \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% +% \let\pgfkeyspred@TMP=\pgfkeyscurrentvalue +% \pgfkeys@eval@key@filter@subroutine@restorestate +% \expandafter\pgfkeys@code\pgfkeyspred@TMP\pgfeov +% }{% +% \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyscurrentkey\pgfkeyscurrentvalue\pgfeov% +% }% +% } +% % THIS VERSION IS TOO SLOW. See below. +% \def\pgfkeysevalkeyfilterwith#1{% +% \edef\pgfkeys@eval@key@filter@subroutine@restorestate{% +% \noexpand\def\noexpand\pgfkeyscurrentkey{\pgfkeyscurrentkey}% +% \noexpand\def\noexpand\pgfkeyscurrentkeyRAW{\pgfkeyscurrentkeyRAW}% +% \noexpand\def\noexpand\pgfkeyscurrentname{\pgfkeyscurrentname}% +% \noexpand\def\noexpand\pgfkeyscurrentvalue{\pgfkeyscurrentvalue}% +% \noexpand\pgfkeys@pathtoks={\pgfkeyscurrentpath}% +% }% +% \pgfkeysinterruptkeyfilter +% \let\pgfkeys@case@one=\pgfkeys@eval@key@filter@subroutine@case@one +% \pgfkeysalso{#1}% +% \endpgfkeysinterruptkeyfilter% this here also restored \pgfkeys@case@one. +% \pgfkeys@eval@key@filter@subroutine@restorestate +% }% +%-------------------------------------------------- + + +% Evaluates a key filter '#1'. Example: +% \pgfkeysevalkeyfilterwith{/pgf/key filters/equals=/tikz} +% +% \pgfkeysevalkeyfilterwith works only if key filtering is +% active. +% +% The argument '#1' MUST be a FULL KEY. +% +% The implementation employs a subset of the \pgfkeysalso code. +\def\pgfkeysevalkeyfilterwith#1{% + \pgfkeys@eval@key@filter@subroutine@unpack#1=\pgfkeysnovalue=\pgfkeys@stop +}% +\def\pgfkeys@eval@key@filter@subroutine@unpack#1=#2=#3\pgfkeys@stop{% + \pgfkeys@spdef\pgfkeyspred@TMP{#1}% + \edef\pgfkeyspred@TMP{\pgfkeyspred@TMP}% + \pgfkeys@spdef\pgfkeyspred@TMPB{#2}% TMPB=value + \ifx\pgfkeyspred@TMPB\pgfkeysnovalue@text% Hmm... no value + \pgfkeysifdefined{\pgfkeyspred@TMP/.@def}% + {\pgfkeysgetvalue{\pgfkeyspred@TMP/.@def}{\pgfkeyspred@TMPB}} + {}% no default, so leave it + \fi% + \ifx\pgfkeyspred@TMPB\pgfkeysvaluerequired% + \pgfkeysvalueof{/errors/value required/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov% + \else% + \pgfkeysifdefined{\pgfkeyspred@TMP/.@cmd}{% + \pgfkeysgetvalue{\pgfkeyspred@TMP/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyspred@TMPB\pgfeov + }{% + \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov% + }% + \fi% +} + + +\def\pgfkeys@nevermind#1\relax{\let\pgfkeyscurrentkeyRAW=\pgfkeyscurrentkey} +\def\pgfkeys@addpath#1\relax{\def\pgfkeyscurrentkeyRAW{#1}% old @addpath: + \edef\pgfkeyscurrentkey{\pgfkeysdefaultpath#1}% +} + +\def\pgfkeys@non@outer@newif@#1#2{% + \expandafter\edef\csname #2true\endcsname{\noexpand\let\noexpand#1=\noexpand\iftrue}% + \expandafter\edef\csname #2false\endcsname{\noexpand\let\noexpand#1=\noexpand\iffalse}% + \csname #2false\endcsname +}% + +% For latex and context, this here has the same effect as a \newif +% applied to 'if#1'. For plain tex, it has also the same effect, but +% it is not an \outer macro as the plain-tex \newif. +\def\pgfkeys@non@outer@newif#1{% + \expandafter\pgfkeys@non@outer@newif@\csname if#1\endcsname{#1}% +} +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex new file mode 100644 index 00000000000..0d120a8b722 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex @@ -0,0 +1,922 @@ +% Copyright 2006 by Till Tantau +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex,v 1.3 2008/06/07 17:08:33 ludewich Exp $ + +\newif\ifpgf@plot@started + + +% This handler converts each plot stream command into a curveto +% command, except for the first, which is converted to the previously +% specified action. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% \pgfsetlinetofirstplotpoint +% \pgfplothandlercurveto +% \pgfplotxyfile{mytable} + +\def\pgfplothandlercurveto{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@initial% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgf@plot@curveto@handler@finish% + \global\pgf@plot@startedfalse% + }% +} + +\def\pgf@plot@curveto@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@plot@first@action{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \xdef\pgf@plot@curveto@first{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plot@curveto@first@support=\pgf@plot@curveto@first% + \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@second% +} + +\def\pgf@plot@curveto@handler@second#1{% + \pgf@process{#1}% + \xdef\pgf@plot@curveto@second{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + \global\let\pgf@plotstreampoint=\pgf@plot@curveto@handler@third% + \global\pgf@plot@startedtrue% +} + +\def\pgf@plot@curveto@handler@third#1{% + \pgf@process{#1}% + \xdef\pgf@plot@curveto@current{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@curveto@first} + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@curveto@second}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@curveto@first@support}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@curveto@second}}% + {\pgf@marshal}% + % Prepare next: + \global\let\pgf@plot@curveto@first=\pgf@plot@curveto@second% + \global\let\pgf@plot@curveto@second=\pgf@plot@curveto@current% + \xdef\pgf@plot@curveto@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% +} + +\def\pgf@plot@curveto@handler@finish{% + \ifpgf@plot@started% + \pgfpathcurveto{\pgf@plot@curveto@first@support}{\pgf@plot@curveto@second}{\pgf@plot@curveto@second}% + \fi% +} + + +% This commands sets the tension for smoothing of plots. +% +% #1 = tension of curves. A value of 1 will yield a circle when the +% control points are at quarters of a circle. A smaller value +% will result in a tighter curve. Default is 0.5. +% +% Example: +% +% \pgfsetplottension{0.2} + +\def\pgfsetplottension#1{% + \pgf@x=#1pt\relax% + \pgf@x=0.2775\pgf@x\relax% + \edef\pgf@plottension{\pgf@sys@tonumber\pgf@x}} +\pgfsetplottension{0.5} + + +% This handler converts the plot stream command into a curveto +% command that is closed using a closepath. +% +% Example: +% +% \pgfpathmoveto{\pgfpointorigin} +% \pgfplothandlerclosedcurve +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerclosedcurve{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@initial% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgf@plot@closedcurve@handler@finish% + }% +} + +\def\pgf@plot@closedcurve@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@closedcurve@initial{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@second% + \global\pgf@plot@startedfalse% +} + +\def\pgf@plot@closedcurve@handler@second#1{% + \pgf@process{#1}% + \xdef\pgf@plot@closedcurve@after@initial{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + {\pgfpathmoveto{}}% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@third% +} + +\def\pgf@plot@closedcurve@handler@third#1{% + \global\pgf@plot@startedtrue% + \pgf@process{#1}% + \xdef\pgf@plot@closedcurve@current{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@initial} + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@after@initial}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \global\let\pgf@plot@closedcurve@first=\pgf@plot@closedcurve@after@initial% + \global\let\pgf@plot@closedcurve@second=\pgf@plot@closedcurve@current% + \xdef\pgf@plot@closedcurve@after@initial@presupport{\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}% + \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + \global\let\pgf@plotstreampoint=\pgf@plot@closedcurve@handler@fourth% +} + +\def\pgf@plot@closedcurve@handler@fourth#1{% + \pgf@process{#1}% + \xdef\pgf@plot@closedcurve@current{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@first} + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@second}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@second}}% + {\pgf@marshal}% + % Prepare next: + \global\let\pgf@plot@closedcurve@first=\pgf@plot@closedcurve@second% + \global\let\pgf@plot@closedcurve@second=\pgf@plot@closedcurve@current% + \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% +} + +\def\pgf@plot@closedcurve@handler@finish{% + \ifpgf@plot@started + % + % first, draw line from 2nd last to last: + % + \pgf@process{\pgf@plot@closedcurve@initial}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@first}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@second}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@second}}% + {\pgf@marshal}% + \xdef\pgf@plot@closedcurve@first@support{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + % + % second, draw line from last point to start: + % + \pgf@process{\pgf@plot@closedcurve@after@initial}% + % compute difference vector: + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgf@process{\pgf@plot@closedcurve@second}% + \advance\pgf@xa by-\pgf@x% + \advance\pgf@ya by-\pgf@y% + % compute support directions: + \pgf@xa=\pgf@plottension\pgf@xa% + \pgf@ya=\pgf@plottension\pgf@ya% + % first marshal: + \pgf@process{\pgf@plot@closedcurve@initial}% + \pgf@xb=\pgf@x% + \pgf@yb=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \advance\pgf@xb by-\pgf@xa% + \advance\pgf@yb by-\pgf@ya% + \advance\pgf@xc by\pgf@xa% + \advance\pgf@yc by\pgf@ya% + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgf@plot@closedcurve@first@support}% + {\noexpand\pgfqpoint{\the\pgf@xb}{\the\pgf@yb}}{\noexpand\pgf@plot@closedcurve@initial}}% + {\pgf@marshal}% + % + % third, draw line from first to second point: + % + \edef\pgf@marshal{\noexpand\pgfpathcurveto{\noexpand\pgfqpoint{\the\pgf@xc}{\the\pgf@yc}}% + {\noexpand\pgf@plot@closedcurve@after@initial@presupport}{\noexpand\pgf@plot@closedcurve@after@initial}}% + {\pgf@marshal}% + \pgfpathclose% + \fi% +} + + + + + +% This handler converts each point in a stream into a line from the +% $y$-axis to the given points coordinate, resulting in a +% ``comb.'' +% +% Example: +% +% \pgfplothandlerxcomb +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerxcomb{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@xcomb@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend% + \pgfplotxzerolevelstreamstart + }% +} + +\def\pgf@plot@xcomb@handler#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \begingroup + \pgfplotxzerolevelstreamnext + \endgroup + \pgf@yb=\pgf@x + \pgfpathmoveto{\pgfqpoint{\pgf@yb}{\pgf@ya}}% + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% +} + + +% This handler converts each point in a stream into a line from the +% $x$-axis straight up to the given points coordinate, resulting in a +% ``comb.'' +% +% Example: +% +% \pgfplothandlerycomb +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerycomb{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@ycomb@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend% + \pgfplotyzerolevelstreamstart + }% +} + +\def\pgf@plot@ycomb@handler#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \begingroup + \pgfplotyzerolevelstreamnext + \endgroup + \pgf@yb=\pgf@x + \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}% + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% +} + +% PGF Bar or comb plots usually draw something from zero to the current plot's coordinate. +% +% The 'zero' offset can be changed using an input stream. +% +% There are two such streams which can be configured independently. +% The first one returns "zeros" for coordinate x, the second one +% returns "zeros" for coordinate y. +% +% \pgfplotxzerolevelstreamstart +% \pgfplotxzerolevelstreamnext % assigns \pgf@x globally +% \pgfplotxzerolevelstreamnext +% \pgfplotxzerolevelstreamnext +% \pgfplotxzerolevelstreamend +% +% and +% \pgfplotyzerolevelstreamstart +% \pgfplotyzerolevelstreamnext % assigns \pgf@x globally +% \pgfplotyzerolevelstreamend +% +\def\pgfplotxzerolevelstreamstart{\pgf@plotxzerolevelstreamstart}% +\def\pgfplotxzerolevelstreamend{\pgf@plotxzerolevelstreamend}% +\def\pgfplotxzerolevelstreamnext{\pgf@plotxzerolevelstreamnext} +\def\pgfplotyzerolevelstreamstart{\pgf@plotyzerolevelstreamstart}% +\def\pgfplotyzerolevelstreamend{\pgf@plotyzerolevelstreamend}% +\def\pgfplotyzerolevelstreamnext{\pgf@plotyzerolevelstreamnext} + +% This zero level stream always returns '#1' (a dimension). +\def\pgfplotxzerolevelstreamconstant#1{% + \edef\pgfplotxzerolevelstreamconstant@val{#1}% + \def\pgf@plotxzerolevelstreamstart{% + \global\let\pgf@plotxzerolevelstreamend=\relax + \gdef\pgf@plotxzerolevelstreamnext{\global\pgf@x=\pgfplotxzerolevelstreamconstant@val\relax}% + }% +}% +\pgfplotxzerolevelstreamconstant{0pt}% + +% This zero level stream always returns '#1'. +\def\pgfplotyzerolevelstreamconstant#1{% + \edef\pgfplotyzerolevelstreamconstant@val{#1}% + \def\pgf@plotyzerolevelstreamstart{% + \global\let\pgf@plotyzerolevelstreamend=\relax + \gdef\pgf@plotyzerolevelstreamnext{\global\pgf@x=\pgfplotyzerolevelstreamconstant@val\relax}% + }% +}% +\pgfplotyzerolevelstreamconstant{0pt}% + +\def\pgfplotbarwidth{\pgfkeysvalueof{/pgf/bar width}} + +\pgfqkeys{/pgf}{% + bar width/.initial=10pt, + bar shift/.initial=0pt, + bar interval width/.initial=1, + bar interval shift/.initial=0.5, +} + +% This handler places a rectangle at each point in the plot stream, a +% rectangle which touches the x-axis at one end and the current point +% at the other end: +% --(X)-- +% | | +% | | +% | | +% --(0)-- +% Example: +% +% \pgfplothandlerybar +% \pgfplotxyfile{mytable} +\def\pgfplothandlerybar{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@ybar@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend% + \pgfmathparse{\pgfplotbarwidth}% + \xdef\pgfplotbarwidth@{\pgfmathresult pt}% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}% + \xdef\pgfplotbarshift@{\pgfmathresult pt}% + \pgfplotyzerolevelstreamstart + }% +} + +\def\pgf@plot@ybar@handler#1{% + \pgf@process{#1}% + \pgf@ya=\pgf@y + \expandafter\pgf@xb\pgfplotbarwidth@\relax + \pgf@xc=\pgf@x + \advance\pgf@xc by-.5\pgf@xb + \advance\pgf@xc by\pgfplotbarshift@\relax + \begingroup + \pgfplotyzerolevelstreamnext + \endgroup + \pgf@yb=\pgf@x + \advance\pgf@ya by-\pgf@yb + \pgfpathrectangle + {\pgfqpoint{\pgf@xc}{\pgf@yb}}% + {\pgfqpoint{\pgf@xb}{\pgf@ya}}% +} + +% This handler places a rectangle at each point in the plot stream, a +% rectangle which touches the y-axis at one end and the current point +% at the other end: +% --------- +% | | +% (0) (X) +% | | +% --------- +% Example: +% +% \pgfplothandlerxbar +% \pgfplotxyfile{mytable} +\def\pgfplothandlerxbar{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@xbar@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend% + \pgfmathparse{\pgfplotbarwidth}% + \xdef\pgfplotbarwidth@{\pgfmathresult pt}% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar shift}}% + \xdef\pgfplotbarshift@{\pgfmathresult pt}% + \pgfplotxzerolevelstreamstart + }% +} + +\def\pgf@plot@xbar@handler#1{% + \pgf@process{#1}% + \pgf@ya=\pgf@x + \expandafter\pgf@xb\pgfplotbarwidth@\relax + \pgf@xc=\pgf@y + \advance\pgf@xc by-.5\pgf@xb + \advance\pgf@xc by\pgfplotbarshift@\relax + \begingroup + \pgfplotxzerolevelstreamnext + \endgroup + \pgf@yb=\pgf@x + \advance\pgf@ya by-\pgf@yb + \pgfpathrectangle + {\pgfqpoint{\pgf@yb}{\pgf@xc}}% + {\pgfqpoint{\pgf@ya}{\pgf@xb}}% +} + +% This handler is a variant of \pgfplothandlerybar which works with +% intervals instead of points. +% +% Bars are drawn between successive input coordinates and the width is +% determined relatively to the interval length. +% +% It looks like this: +% +% |---| |-----| +% | | | | +% | | | | +% | | | | +% (X)------(X)-----------(X) +% +% where (X) denotes the x-axis offsets of input coordinates. +% +% In more detail, if (x_i,y_i) and (x_{i+1},y_{i+1}) denote successive +% input coordinates, the bar will be placed above the +% interval [x_i,x_{i+1}], centered at +% +% x_i + \pgfkeysvalueof{/pgf/bar interval shift} * (x_{i+1} - x_i) +% +% with width +% +% \pgfkeysvalueof{/pgf/bar interval width} * (x_{i+1} - x_i). +% +% If you have N+1 input points, you will get N bars (one for each +% interval). The y_i value of the last bar will be ignored. +% +% Example: +% +% \pgfplothandlerybarinterval +% \pgfplotxyfile{mytable} +\def\pgfplothandlerybarinterval{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler@first% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgfplotyzerolevelstreamend% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}% + \xdef\pgfplotbarintervalwidth@{\pgfmathresult}% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}% + \xdef\pgfplotbarintervalshift@{\pgfmathresult}% + \pgfplotyzerolevelstreamstart + }% +} + +\def\pgf@plot@ybarinterval@handler@first#1{% + \pgf@process{#1}% + \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@x}% + \xdef\pgf@plot@barinterval@bar{\the\pgf@y}% + \global\let\pgf@plotstreampoint=\pgf@plot@ybarinterval@handler% +} +\def\pgf@plot@ybarinterval@handler#1{% + \pgf@process{#1}% + \pgf@ya=\pgf@plot@barinterval@bar + \xdef\pgf@plot@barinterval@bar{\the\pgf@y}% + \pgf@xc=\pgf@plot@barinterval@intervalstart\relax + \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@x}% + \pgf@xb=\pgf@x + \advance\pgf@xb by-\pgf@xc + \advance\pgf@xc by\pgfplotbarintervalshift@\pgf@xb + \pgf@xb=\pgfplotbarintervalwidth@\pgf@xb + \advance\pgf@xc by-.5\pgf@xb% center + \begingroup + \pgfplotyzerolevelstreamnext + \endgroup + \pgf@yb=\pgf@x + \advance\pgf@ya by-\pgf@yb + \pgfpathrectangle + {\pgfqpoint{\pgf@xc}{\pgf@yb}}% + {\pgfqpoint{\pgf@xb}{\pgf@ya}}% +} + +% Like \pgfplothandlerybarinterval but for xbar. +\def\pgfplothandlerxbarinterval{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler@first% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgfplotxzerolevelstreamend% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval width}}% + \xdef\pgfplotbarintervalwidth@{\pgfmathresult}% + \pgfmathparse{\pgfkeysvalueof{/pgf/bar interval shift}}% + \xdef\pgfplotbarintervalshift@{\pgfmathresult}% + \pgfplotxzerolevelstreamstart + }% +} + +\def\pgf@plot@xbarinterval@handler@first#1{% + \pgf@process{#1}% + \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@y}% + \xdef\pgf@plot@barinterval@bar{\the\pgf@x}% + \global\let\pgf@plotstreampoint=\pgf@plot@xbarinterval@handler% +} +\def\pgf@plot@xbarinterval@handler#1{% + \pgf@process{#1}% + \pgf@ya=\pgf@plot@barinterval@bar + \xdef\pgf@plot@barinterval@bar{\the\pgf@x}% + \pgf@xc=\pgf@plot@barinterval@intervalstart\relax + \xdef\pgf@plot@barinterval@intervalstart{\the\pgf@y}% + \pgf@xb=\pgf@y + \advance\pgf@xb by-\pgf@xc + \advance\pgf@xc by\pgfplotbarintervalshift@\pgf@xb + \pgf@xb=\pgfplotbarintervalwidth@\pgf@xb + \advance\pgf@xc by-.5\pgf@xb% center + \begingroup + \pgfplotxzerolevelstreamnext + \endgroup + \pgf@yb=\pgf@x + \advance\pgf@ya by-\pgf@yb + \pgfpathrectangle + {\pgfqpoint{\pgf@yb}{\pgf@xc}}% + {\pgfqpoint{\pgf@ya}{\pgf@xb}}% +} + + +% This handler is very similar to \pgfplothandlerlineto, but it +% produces CONSTANT connected pieces of the form +% +% x +% | +% x--- | +% | x---- +% x-| +% +% Example: +% +% \pgfplothandlerconstantlineto +% \pgfplotxyfile{mytable} +\def\pgfplothandlerconstantlineto{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@const@line@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} +\def\pgf@plot@const@line@handler#1{% + \pgf@plot@first@action{#1}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@y}% + \global\let\pgf@plotstreampoint=\pgf@plot@const@line@handler@@% +} +\def\pgf@plot@const@line@handler@@#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \expandafter\pgf@yb\pgf@plot@const@line@handler@last + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}% + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}% +} + +% A variant of \pgfplothandlerconstantlineto which places its mark on +% the right line ends. +% +% |---x +% ---x | +% |--x +% x +% +% Example: +% +% \pgfplothandlerconstantlinetomarkright +% \pgfplotxyfile{mytable} +\def\pgfplothandlerconstantlinetomarkright{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@right@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} +\def\pgf@plot@const@line@mark@right@handler#1{% + \pgf@plot@first@action{#1}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@x}% + \global\let\pgf@plotstreampoint=\pgf@plot@const@line@mark@right@handler@@% +} +\def\pgf@plot@const@line@mark@right@handler@@#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \expandafter\pgf@yb\pgf@plot@const@line@handler@last + \pgfpathlineto{\pgfqpoint{\pgf@yb}{\pgf@ya}}% + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}% +} + +% This handler is in fact a variant of \pgfplothandlerconstantlineto, +% but it does not draw vertical lines. It produces a sequence of +% line-to and move-to operations such that plot marks are placed at +% each right end: +% +% ---x +% ---x +% ---x +% --x +% +% Example: +% +% \pgfplothandlerjumpmarkright +% \pgfplotxyfile{mytable} +\def\pgfplothandlerjumpmarkright{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkright@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} +\def\pgf@plot@jumpmarkright@handler#1{% + \pgf@plot@first@action{#1}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@x}% + \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkright@handler@@% +} +\def\pgf@plot@jumpmarkright@handler@@#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \expandafter\pgf@yb\pgf@plot@const@line@handler@last + \pgfpathmoveto{\pgfqpoint{\pgf@yb}{\pgf@ya}}% + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@xa}% +} + +% This handler is in fact a variant of \pgfplothandlerconstantlineto, +% but it does not draw vertical lines. It produces a sequence of +% line-to and move-to operations such that plot marks are placed at +% each left end: +% +% x--- +% x--- +% x--- +% x-- +% +% Example: +% +% \pgfplothandlerjumpmarkleft +% \pgfplotxyfile{mytable} +\def\pgfplothandlerjumpmarkleft{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkleft@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} +\def\pgf@plot@jumpmarkleft@handler#1{% + \pgf@plot@first@action{#1}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@y}% + \global\let\pgf@plotstreampoint=\pgf@plot@jumpmarkleft@handler@@% +} +\def\pgf@plot@jumpmarkleft@handler@@#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \expandafter\pgf@yb\pgf@plot@const@line@handler@last + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}% + \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% + \xdef\pgf@plot@const@line@handler@last{\the\pgf@ya}% +} + + + +% This handler converts each point in a stream into a line from the +% origin to the point's coordinate, resulting in a ``star''. +% +% Example: +% +% \pgfplothandlerpolarcomb +% \pgfplotxyfile{mytable} + +\def\pgfplothandlerpolarcomb{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@polarcomb@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@polarcomb@handler#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \pgfpathmoveto{\pgfpointorigin}% + \pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@ya}}% +} + + + + +% This handler draws a given mark at each point. +% +% #1 = some code to be executed at each point (with the coordinate +% system translated to that point). +% Typically, this code will be \pgfuseplotmark{whatever}. +% +% Example: +% +% \pgfplothandlermark{\pgfuseplotmark{*}} +% \pgfplotxyfile{mytable} + +\def\pgfplothandlermark#1{% + \pgf@plothandlermark{% + \ifnum\pgf@plot@mark@count<\pgf@plot@mark@repeat\relax% + \else% + \global\pgf@plot@mark@count=0\relax% + #1% + \fi% + }% +} + +\newcount\pgf@plot@mark@count +\def\pgf@plot@mark@phase{0} + +\def\pgf@plothandlermark#1{% + \def\pgf@plot@mark{#1}% + \def\pgf@plotstreamstart{% + \global\pgf@plot@mark@count=\pgf@plot@mark@repeat\relax% + \global\advance\pgf@plot@mark@count by-\pgf@plot@mark@phase\relax% + \global\let\pgf@plotstreampoint=\pgf@plot@mark@handler% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@mark@handler#1{% + \global\advance\pgf@plot@mark@count by1\relax% + {\pgftransformshift{#1}\pgf@plot@mark}% +} + + +% Set the repeat count for marks. For example, if 3 is given as a +% value, only every third point will get a mark. +% +% #1 = repeat count +% +% Example: +% +% \pgfsetplotmarkrepeat{2} + +\def\pgfsetplotmarkrepeat#1{\def\pgf@plot@mark@repeat{#1}} +\pgfsetplotmarkrepeat{1} + + +% Set the phase for marks. For example, if 3 is the repeat and 3 is +% the phase, already the first point will be marked. +% +% #1 = the index of the first point that should be marked. +% +% Example: +% +% \pgfsetplotmarkphase{3} + +\def\pgfsetplotmarkphase#1{\def\pgf@plot@mark@phase{#1}} +\pgfsetplotmarkphase{1} + + + +% This handler draws a given mark at those points whose number is +% given in the (pgffor-like) list. +% +% #1 = some code to be executed at each point (with the coordinate +% system translated to that point). +% Typically, this code will be \pgfuseplotmark{whatever}. +% #2 = list of positions like "1,2,4,...,9,10" +% +% Example: +% +% \pgfplothandlermarklisted{\pgfuseplotmark{*}}{1,2,4,...,9} +% \pgfplotxyfile{mytable} + +\def\pgfplothandlermarklisted#1#2{% + \let\pgf@plot@mark@list=\pgfutil@empty% + \edef\pgf@marshal{\noexpand\foreach\noexpand\pgf@temp in{#2}} + \pgf@marshal{\xdef\pgf@plot@mark@list{\pgf@plot@mark@list(\pgf@temp)}}% + \pgf@plothandlermark{% + \edef\pgf@marshal{\noexpand\pgfutil@in@{(\the\pgf@plot@mark@count)}{\pgf@plot@mark@list}}% + \pgf@marshal% + \ifpgfutil@in@#1\fi}% +} + + +% Define a new plot mark for use with \pgfplotmark. +% +% #1 = a plot mark mnemonic +% #2 = code for drawing the mark +% +% Example: +% +% \pgfdeclareplotmark{*}{\pgfpathcircle{\pgfpointorigin}{2pt}\pgfusepathqfill} + +\def\pgfdeclareplotmark#1#2{\expandafter\def\csname pgf@plot@mark@#1\endcsname{#2}} + + +% Set the size of plot marks. For circles, this will be the radius, +% for other shapes it should be about half the width/height. +% +% Example: +% +% \pgfsetplotmarksize{1pt} + +\def\pgfsetplotmarksize#1{\pgfmathsetlength\pgfplotmarksize{#1}} + +\newdimen\pgfplotmarksize +\pgfplotmarksize=2pt + + +% Insert a plot mark's code at the origin. +% +% #1 = plot mark mnemonic +% +% Example: +% +% \pgfuseplotmark{*} + +\def\pgfuseplotmark#1{\csname pgf@plot@mark@#1\endcsname} + + +% A stroke-filled circle mark + +\pgfdeclareplotmark{*} +{% + \pgfpathcircle{\pgfpointorigin}{\pgfplotmarksize} + \pgfusepathqfillstroke +} + + +% A plus-sign like mark + +\pgfdeclareplotmark{+} +{% + \pgfpathmoveto{\pgfqpoint{-\pgfplotmarksize}{0pt}} + \pgfpathlineto{\pgfqpoint{\pgfplotmarksize}{0pt}} + \pgfpathmoveto{\pgfqpoint{0pt}{\pgfplotmarksize}} + \pgfpathlineto{\pgfqpoint{0pt}{-\pgfplotmarksize}} + \pgfusepathqstroke +} + + +% An x-shaped mark + +\pgfdeclareplotmark{x} +{% + \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathmoveto{\pgfqpoint{-.70710678\pgfplotmarksize}{.70710678\pgfplotmarksize}} + \pgfpathlineto{\pgfqpoint{.70710678\pgfplotmarksize}{-.70710678\pgfplotmarksize}} + \pgfusepathqstroke +} + +% See pgflibraryplotmarks for more plot marks + + + + + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex new file mode 100644 index 00000000000..cb479f8dc73 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -0,0 +1,2007 @@ +% Copyright 2008 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. +% +% This file contains methods for basic floating point arithmetics, rounding +% to arbitrary precision and number pretty printing. +% +% Version 0.9.4 2008/03/18 + +\global\newif\ifpgfmathfloatcomparison +\newif\ifpgfmathfloatroundhasperiod +\newif\ifpgfmathprintnumberskipzeroperiod + + +% used internally in grouped macros: +\toksdef\pgfmathfloat@tmptoks=1 +\newif\ifpgfmathfloat@fixed@digits@after@period +\newif\ifpgfmathfloatroundmayneedrenormalize +\toksdef\pgfmathfloat@a@Mtok=0 + +%% WARNING: avoid conflicting register names! +\let\pgfmathfloat@a@S=\c@pgf@counta +\let\pgfmathfloat@a@M=\pgf@xa +\let\pgfmathfloat@a@E=\c@pgf@countb +\let\pgfmathfloat@b@S=\c@pgf@countc +\let\pgfmathfloat@b@M=\pgf@xb +\let\pgfmathfloat@b@E=\c@pgf@countd + +% can be changed with options. +\def\pgfmathfloat@round@precision{2} + + +% Computes a normalised floating point representation for #1 of the +% form +% [FLAGS] MANTISSE EXPONENT +% meaning +% [+-]X.XXXXXXX*10^C +% where +% X.XXXXXX is a mantisse with first number != 0, C is an integer and +% FLAGS contains the sign and some other special cases. +% +% This method does NOT use TeX Registers to represent the numbers! The +% computation is COMPLETELY STRING BASED. +% This allows numbers such at 10000000 or 5.23e-10 to be represented +% properly, although TeX-registers would produce overflow/underflow +% errors in these cases. +% +% It is to be used to compute logs, because log(X*10^Y) = log(X) + log(10)*Y +% +% Arguments: +% #1: an arbitrary number which shall be parsed. Maybe a macro. +% Examples: +% [+-]XXXXX.XXXXXX +% [+-]XXXXX.XXXXXXeXXXX +% [+-]0.0000XXXXXX +% [+-]0.0000XXXXXXeXXXX +% [+-]inf +% nan +% Maybe a macro containing such a number. +% +% Return value: +% \pgfmathresult will be \def'ed to +% FLAGS MANTISSE 'e' EXPONENT +% where +% FLAGS is a number in [0-5] where +% 0 == '0' (the number is +- 0.0), +% 1 == '+', +% 2 == '-', +% 3 == 'not a number' +% 4 == '+ infinity' +% 5 == '- infinity' +% +% MANTISSE is a normalised number 1 <= M < 10. It always contains a +% period and at least one digit after the period. +% +% EXPONENT is an integer value. +% +% Example: +% \pgfmathfloatparsenumber{1} +% -> \pgfmathresult = 11.0e0 +% \pgfmathfloatparsenumber{141.212} +% -> \pgfmathresult = 11.41212e2 +\def\pgfmathfloatparsenumber#1{% + \begingroup + \expandafter\pgfmathfloatparsenumber@impl#1\pgfmathfloat@EOI + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% + \fi + \edef\pgfmathresult{% + \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +% The same as \pgfmathfloatparsenumber, but does not perform sanity checking. +\def\pgfmathfloatqparsenumber#1{% + \begingroup + \let\pgfmathfloatparsenumber@sanitize@digit=\relax + \expandafter\pgfmathfloatparsenumber@impl#1\pgfmathfloat@EOI + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% + \fi + \edef\pgfmathresult{% + \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + + +% decomposes a lowlevel floating point representation into flags, +% mantisse and exponent. +% +% #4: integer register for the flags. +% #5: dimen registers for the mantisse. +% #6: integer register for the exponent. +\def\pgfmathfloat@decompose#1#2e#3\relax#4#5#6{% + #4=#1\relax + #5=#2pt% + #6=#3\relax% +} +% overloaded, #5 needs to be a token register for the mantisse. +\def\pgfmathfloat@decompose@tok#1#2e#3\relax#4#5#6{% + #4=#1\relax + #5={#2}% + #6=#3\relax% +} +% overloaded, returns only ONE of the three components into #4: +\def\pgfmathfloat@decompose@F#1#2e#3\relax#4{#4=#1\relax}% +\def\pgfmathfloat@decompose@M#1#2e#3\relax#4{#4=#2pt}% +\def\pgfmathfloat@decompose@Mtok#1#2e#3\relax#4{#4={#2}}% +\def\pgfmathfloat@decompose@E#1#2e#3\relax#4{#4=#3\relax}% + +% Takes a floating point number #1 as input and writes flags to macro +% #2, mantisse to macro #3 and exponent to macro #4. +\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{% + \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 +} + +% Takes a floating point number #1 as input and writes flags to count +% register #2, mantisse to dimen register #3 and exponent to count +% register #4. +\def\pgfmathfloattoregisters#1#2#3#4{% + \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}% +} + +% the same, but writes the mantisse into a token register. +\def\pgfmathfloattoregisterstok#1#2#3#4{% + \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}% +} + +% Extracts the flags of #1 into the count register #2. +\def\pgfmathfloatgetflags#1#2{% + \expandafter\pgfmathfloat@decompose@F#1\relax{#2}% +} +% Extracts the mantisse of #1 into the dimen register #2. +\def\pgfmathfloatgetmantisse#1#2{% + \expandafter\pgfmathfloat@decompose@M#1\relax{#2}% +} +% Extracts the mantisse of #1 into the token register #2. +\def\pgfmathfloatgetmantissetok#1#2{% + \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}% +} +% Extracts the exponent of #1 into the count register #2. +\def\pgfmathfloatgetmantisse#1#2{% + \expandafter\pgfmathfloat@decompose@E#1\relax{#2}% +} + +% Defines \pgfmathresult as the floating point number encoded by +% the flags #1, mantisse #2 and exponent #3. +% +% All arguments are characters and will be expanded using '\edef'. +\def\pgfmathfloatcreate#1#2#3{% + \edef\pgfmathresult{#1#2e#3}% +}% + + +% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0. +% +% It also sets the boolean \ifpgfmathfloatcomparison (globally. +\def\pgfmathfloatlessthan@#1#2{% +%\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{% + \global\pgfmathfloatcomparisonfalse + \begingroup + \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E + \ifcase\pgfmathfloat@a@S + % x = 0 -> (x<y <=> y >0) + \ifnum1=\pgfmathfloat@b@S + \global\pgfmathfloatcomparisontrue + \fi + \or + % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) + \ifnum1=\pgfmathfloat@b@S + % y>0: + \pgfmathfloatlessthan@positive + \fi + \or + % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) + \ifnum2=\pgfmathfloat@b@S + % 'y<0': + \pgfmathfloatgreaterthan@positive + \else + \global\pgfmathfloatcomparisontrue + \fi + \else + \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}% + \fi + \endgroup + \ifpgfmathfloatcomparison + \def\pgfmathresult{1.0}% + \else + \def\pgfmathresult{0.0}% + \fi +} +\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ + +% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] +\def\pgfmathfloatlessthan@positive{% + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +} + +% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME] +\def\pgfmathfloatgreaterthan@positive{% + \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +} + + +\def\pgfmathfloatmax@#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#2}% + \else + \edef\pgfmathresult{#1}% + \fi +} +\let\pgfmathfloatmax=\pgfmathfloatmax@ + +\def\pgfmathfloatmin@#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +} +\let\pgfmathfloatmin=\pgfmathfloatmin@ + +% Renormalizes #1 to extended precision mantisse, meaning +% 100 <= m < 1000 +% instead of 1 <= m < 10. +% +% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses. +% +% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision). +% +% The operation is supposed to be very fast. +\def\pgfmathfloattoextentedprecision#1{% + \begingroup + \pgfmathfloattoextentedprecision@a{#1}% + \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +% 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 + \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 + \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI + \else + \edef\pgfmathresult{#1}% + \fi +}% + +% Addition of two floating point numbers using 8 significant digits. +\def\pgfmathfloatadd@#1#2{% + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloattoextentedprecision@b{#2}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#2}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + % Shift lesser mantisse to fit the larger one: + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}% + \else + \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}% + \fi + % add them! + \pgfmathadd@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +% #1=mantisse which needs to be shifted (with smaller exponent) +% #2=smaller exponent +% #3=larger exponent +% +% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S. +\def\pgfmathfloatadd@shift#1#2#3{% + \pgf@xa=#1 pt + \pgfmathfloat@a@S=#3 + \advance\pgfmathfloat@a@S by-#2 + \ifcase\pgfmathfloat@a@S + \or + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10000\relax + \else + \pgf@xa=0pt + \fi + #2=#3 + \edef#1{\pgf@sys@tonumber\pgf@xa}% +} + +\let\pgfmathfloatadd=\pgfmathfloatadd@ + + +% Subtracts two floating point numbers. +\def\pgfmathfloatsubtract@#1#2{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \or + \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \or + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \else + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@ + +% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply. +% +% Use this method if #2 is small number. +\def\pgfmathfloatmultiplyfixed@#1#2{% + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + \pgfmathmultiply@{\pgfmathfloat@arga}{#2}% + % renormalize product. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@ + +% Converts a composed floating point representation to fixed point. +% +% Example: +% \pgfmathfloattofixed{142e1} +% -> \pgfmathresult = 42.0 +\def\pgfmathfloattofixed@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + \def\pgfmathresult{0.0}% + \or + \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax + \or + \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax + \edef\pgfmathresult{-\pgfmathresult}% + \or\def\pgfmathresult{nan}% + \or\def\pgfmathresult{inf}% + \or\def\pgfmathresult{-inf}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloattofixed=\pgfmathfloattofixed@ + +% Divides or multiplies the input number by 10^#4 using an arithmetic +% left/right shift. +% +% Input: +% #1 a normalised floating point number. +% #2 a positive or negative integer number denoting the shift. +% +% Example: +% \pgfmathfloatshift{11e3}{4}% +% -> pgfmathresult = 11e7 +\def\pgfmathfloatshift@#1#2{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \expandafter\advance\expandafter\pgfmathfloat@a@E#2\relax + \edef\pgfmathresult{\the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloatshift=\pgfmathfloatshift@ + +% Computes a good guess for log(X.XXXX) where the input number should +% be between 0 < x < 10. +% +% If it is not in this range, the returned value will be bad. +% +% For use in the newton implementation of log(x). Please note that we +% first compute a normalized floating point representation of x, and +% the mantisse is always between 0 and 10. +\def\pgfmathlog@smaller@ten@newton@startval#1.#2\to#3{% + \ifcase#1 + \pgfmath@error{pgfmathlog@newton: INTERNAL ERROR: should not happen! + [\#1=0 should have been caught before!]}% + \or#3=0.530628pt + \or#3=0.993pt + \or#3=1.308pt + \or#3=1.5pt + \or#3=1.71pt + \or#3=1.872pt + \or#3=2.01pt + \or#3=2.145pt + \or#3=2.24pt + \fi +} + +% FIXME : eliminate \pgfmathlog@invoke@expanded ? + +% Expands #2 using \edef and invokes #1 with the resulting string. +% +% Example: +% \pgfmath@y=7.9pt +% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% +% will invoke +% \pgfmathexp@{7.9} +\def\pgfmathlog@invoke@expanded#1#2{% + \edef\pgfmath@resulttemp{#2}% + \expandafter#1\pgfmath@resulttemp +} + +% This implementation of log(X) is done with a newton method applied to x-exp(y) = 0. +% The implementation \pgfmathexp is used for exp(y). +% +% see \pgfmathlog@ +\def\pgfmathlog@newton#1{% + \pgfmathfloatparsenumber{#1}% + \pgfmathlog@newton@float{\pgfmathresult}% +} + +% the same as \pgfmathlog@newton, but this one takes a floating point number as input. +\def\pgfmathlog@newton@float#1{% + \begingroup% + % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX + \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E + \let\pgfmathlog@loopcount=\pgfmathfloat@b@S% this counter is not used here... use it as loop counter. + % + \ifnum\pgfmathfloat@a@S=1 + % Now, compute log(#1) = log(M) + E*log(10) + \expandafter\pgfmathlog@smaller@ten@newton@startval\the\pgfmathfloat@a@M.\to\pgfmathfloat@b@M + \pgfmathlog@loopcount=0 + \loop + \ifnum\pgfmathlog@loopcount<3 + \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmathfloat@b@M}}}% + \let\pgfmathlog@tmp=\pgfmathresult + \pgfmathlog@invoke@expanded\pgfmathdivide@{{\pgf@sys@tonumber{\pgfmathfloat@a@M}}{\pgfmathlog@tmp}}% + \expandafter\pgfmath@ya\pgfmathresult pt + \advance\pgfmathfloat@b@M by\pgfmath@ya + \advance\pgfmathfloat@b@M by-1pt + \advance\pgfmathlog@loopcount by1 + \repeat + \pgfmathfloat@a@M=2.302585pt% = log(10) + \multiply\expandafter\pgfmathfloat@a@M\pgfmathfloat@a@E + \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}% + \else + \let\pgfmathresult=\pgfutil@empty% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup% +} + +% Computes log(x) into \pgfmathresult. +% +% REMARK +% This method does NOT use TeX Registers to represent the numbers! The +% computation is COMPLETELY STRING BASED. +% This allows numbers such at 10000000 or 5.23e-10 to be represented +% properly, although TeX-registers would produce overflow/underflow +% errors in these cases. +% +% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y +\let\pgfmathlog@=\pgfmathlog@newton + +\let\pgfmathlog@float=\pgfmathlog@newton@float + +% Public interface method. This is expected to use \pgfmathparse but +% it DOESN'T do that. \pgfmathparse naturally can't handle numbers +% which exceed TeX's numerical capabilities. However, exponentials are +% typically either too large or too small for TeX. +% +% @see \pgfmathnormalisedfloatingpoint for how we parse arguments. +% @see \pgfmathlog@ +\let\pgfmathlog=\pgfmathlog@newton + +% Rounds a fixed point number #1 to \pgfmathfloat@round@precision digits precision and returns +% the result into \pgfmathresult. +% +% Any trailing zeros after the period are discarded. +% See \pgfmathroundtozerofill if you want trailing zeros and fixed +% width. +% +% This method is PURELY text based and can work with arbirtrary +% precision (well, limited to TeX's stack size and integer size). +% +% Examples: +% \pgfmathroundto{1} +% -> \pgfmathresult = '1' +% +% \pgfmathroundto{19999.9996} +% -> \pgfmathresult = '20000' +% +% Arguments: +% #1 may be either a number or a macro expanding to a number. +% +% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set. +\def\pgfmathroundto#1{% + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodfalse + \pgfmathroundto@impl{#1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + + +% Overloaded method. +% +% This variant always uses a FIXED number behind the period and fills +% in zeros if necessary. +% Examples: +% \pgfmathroundtozerofill{1} +% -> \pgfmathresult = '1.00' +% +% \pgfmathroundtozerofill{19999.9996} +% -> \pgfmathresult = '20000.00' +% +% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set. +\def\pgfmathroundtozerofill#1{% + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodtrue + \pgfmathroundto@impl{#1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +\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/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP + \c@pgf@counta=#4\relax + \def\pgfmathresult{}% + \ifpgfmathfloatroundhasperiod + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI + \else + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI% + \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 + \else + \def\pgfmathfloat@TMPC{-0}% + \ifx\pgfmathfloat@TMPC\pgfmathfloat@TMPB + \def\pgfmathresult{-}% + \else + \def\pgfmathfloat@TMPC{+0}% + \ifx\pgfmathfloat@TMPC\pgfmathfloat@TMPB + \def\pgfmathresult{+}% + \else + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI + \fi + \fi + \fi + \else + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI + \fi + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP #2}% + \xdef\pgfmathfloat@TMPB{\the\toks0\the\toks1}% + \endgroup + \let\pgfmathresult=\pgfmathfloat@TMPB +}% +\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod{% + \ifx\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP\pgfutil@empty + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% + \else + \ifnum\c@pgf@counta<0\relax + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% + \else + \advance\c@pgf@counta by1% counta:= total number of digits, N. + \c@pgf@countb=\c@pgf@counta + \divide\c@pgf@countb by3% countb := N DIV 3 + \c@pgf@countc=\c@pgf@countb + \multiply\c@pgf@countc by3 + \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3 + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign + }% + \fi + \fi + \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 + \else + \ifx\pgfmathfloat@TMPB\pgfmathfloatparsenumber@tok@PLUS + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% FIXME: '+' is enough? + \let\pgfmathfloat@TMPB=\pgfutil@empty + \fi\fi + \ifnum\c@pgf@counta>0 + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@TMPB + }% + \else + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@TMPB + }% + \fi + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT +} +\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits#1#2{% + \ifcase\c@pgf@counta + \or + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#2% + }% + \or + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2}% + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird% + }% + \fi + \ifnum\c@pgf@countb>0\relax + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% + \xdef\pgfmathfloat@TMPB{\the\toks0\the\toks1}% + \endgroup + \let\pgfmathresult=\pgfmathfloat@TMPB + \fi + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT +} +\def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#1#2#3{% + \ifnum\c@pgf@countb>0\relax + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2#3}% + \advance\c@pgf@countb by-1 + \ifnum\c@pgf@countb>0\relax + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% + \xdef\pgfmathfloat@TMPB{\the\toks0\the\toks1}% + \endgroup + \let\pgfmathresult=\pgfmathfloat@TMPB + \fi + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird% + }% + \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 + \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{% + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% +}% + +% #1 maybe a macro +\def\pgfmathprintnumber@fixed@stylePERIOD#1#2#3e#4\relax{% + \def\pgfmathresult{#1}% +} + +% #1 maybe a macro +\def\pgfmathprintnumber@fixed@styleCOMMA#1#2#3e#4\relax{% + \ifpgfmathfloatroundhasperiod + \expandafter\pgfmathprintnumber@fixed@styleCOMMA@impl#1\pgfmathfloat@EOI + \else + \def\pgfmathresult{#1}% + \fi +} +\def\pgfmathprintnumber@fixed@styleCOMMA@impl#1.#2\pgfmathfloat@EOI{\def\pgfmathresult{#1{,}#2}} + +% The default style to display fixed point numbers. +% +% It does not apply numerics, but it is responsable to typeset the +% rounded number. +% It can access the \ifpgfmathfloatroundhasperiod boolean. +% +% Arguments: +% #1#2#3e#4\relax + +% Input: +% #1 the fixed point number to be displayed (maybe a macro). +% #2#3e#4: the (possibly unformatted) floating point representation which belongs to #1. +% It is used to determine sign and exponent. +\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT + + +% Rounds a normalized floating point number to \pgfmathfloat@round@precision +% digits precision and writes the result to \pgfmathresult. +% +% This method uses \pgfmathroundto for the mantisse. +% +% @see pgfmathfloatroundzerofill +% +% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to +% whether the final mantisse #5 has a period or not. +\def\pgfmathfloatround#1{% + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodfalse + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatround@impl + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +% Overload. +% +% This method uses a fixed width for the mantisse and fills in zeros +% if necessary. +% +% This method uses \pgfmathroundtozerofill for the mantisse. +% +% SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to +% whether the final mantisse #5 has a period or not. +\def\pgfmathfloatroundzerofill#1{% + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodtrue + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatround@impl + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +\newif\ifpgfmathfloatround@allow@empty@mantisse +\def\pgfmathfloatround@mantisse@ONE{1.0}% + +% #1: sign +% #2: mantisse +% #3: exponent +% #4: CODE to display if the mantisse is drawn. +% #5: CODE to display if the mantisse is NOT draw. +% #6: CODE to display the exponent. +\def\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax#4#5#6{% + \expandafter\ifcase#1\relax + \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{\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}% + \fi +} + +\def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{% + \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}% +} +\def\pgfmathfloatrounddisplaystyle@subscript#1#2e#3\relax{% + \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}% +} +\def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{% + \ifnum#3<0\relax + {\count0=#3\relax + \multiply\count0 by-1 + \xdef\pgfmathfloat@TMPB{e{-}\the\count0}% + }% + \let\pgfmathresult=\pgfmathfloat@TMPB + \else + \def\pgfmathresult{e{+}#3}% + \fi + \def\pgfmathfloat@TMPB{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% + \expandafter\pgfmathfloat@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}% + }% + \let\pgfmathresult=\pgfmathfloat@TMPB + \else + \def\pgfmathresult{E{+}#3}% + \fi + \def\pgfmathfloat@TMPB{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% + \expandafter\pgfmathfloat@TMPB\expandafter{\pgfmathresult}% +} + +% A macro which takes three arguments, sign, mantisse and exponent and +% expands to the final TeX-representation for that floating point +% number. +% +% PRECONDITION: +% the floating point number has already been rounded properly and +% the mantisse has been rounded correcty. +% +% #1: SIGN +% #2: MANTISSE +% #3: EXPONENT +\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std +\newif\ifpgfmathfloat@usezerofill@sci +\newif\ifpgfmathfloat@usezerofill@fixed +\newif\ifpgfmathprintnumber@assumemathmode + +\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}, + int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC}, + assume math mode/.is if=pgfmathprintnumber@assumemathmode, + assume math mode/.default=true, + fixed zerofill/.is if= pgfmathfloat@usezerofill@fixed, + fixed zerofill/.default=true, + sci zerofill/.is if= pgfmathfloat@usezerofill@sci, + sci zerofill/.default=true, + zerofill/.style= {/pgf/number format/fixed zerofill=#1,/pgf/number format/sci zerofill=#1}, + zerofill/.default= true, + precision/.store in= \pgfmathfloat@round@precision, + fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT}, + set decimal separator/.initial=, + dec sep/.style={/pgf/number format/set decimal separator=#1}, + 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={.}}, + skip 0./.is if=pgfmathprintnumberskipzeroperiod, + skip 0./.default=true, + skip 0.= false, + use period, + sci 10^e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std}, + sci 10e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std}, + sci e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@e}, + sci E/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@E}, + sci subscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@subscript}, +% sci may skip mantisse/.is if=pgfmathfloatround@allow@empty@mantisse, +% sci may skip mantisse/.default=true, +} + + + +\def\pgfmathprintnumber@STD#1{% + % parse the input: + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax +} + +\def\pgfmathprintnumber@STD@issci#1#2e#3\relax{% + \expandafter\ifnum#1<3 + \expandafter\ifnum#3>4 + \pgfmathprintnumber@SCI@issci#1#2e#3\relax% + \else + \begingroup + \c@pgf@counta=\pgfmathfloat@round@precision\relax + \divide\c@pgf@counta by-2\relax + \ifnum#3<\c@pgf@counta + \pgfmathprintnumber@SCI@issci#1#2e#3\relax% + \else + \pgfmathprintnumber@FIXED@issci#1#2e#3\relax% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup + \fi + \else% nan or inf: + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi +} + + +\def\pgfmathprintnumber@INT@TRUNC#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax +} + +\def\pgfmathprintnumber@INT@TRUNC@impl#1.#2\relax#3#4e#5\relax{% + \pgfmathfloatroundhasperiodfalse + \pgfmathprintnumber@fixed@style{#1}#3#4e#5\relax% +} +\def\pgfmathprintnumber@INT@TRUNC@issci#1#2e#3\relax{% + \ifnum#1<3\relax + \pgfmathfloattofixed{#1#2e#3}% + \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax + \else + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi +} + + +\def\pgfmathprintnumber@INT@DETECT#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax +} + +\def\pgfmathprintnumber@INT@DETECT@issci#1#2e#3\relax{% + \begingroup + \ifnum#1<3\relax + \pgfmathfloattofixed{#1#2e#3}% + \def\pgfmathfloat@round@precision{6}% + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \ifpgfmathfloatroundhasperiod + \pgfmathprintnumber@SCI@issci#1#2e#3\relax + \else + \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax + \fi + \else + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +\def\pgfmathprintnumber@FIXED#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax +} + +\def\pgfmathprintnumber@FIXED@issci#1#2e#3\relax{% + \begingroup + \ifnum#1<3 + \pgfmathfloattofixed{#1#2e#3}% + \ifpgfmathfloat@usezerofill@fixed + \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}% + \else + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \fi + \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% + \else + \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax% + \fi + \else% nan or inf: + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + + +\def\pgfmathprintnumber@SCI#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax +} + +\def\pgfmathprintnumber@SCI@issci#1#2e#3\relax{% + \ifpgfmathfloat@usezerofill@sci + \pgfmathfloatroundzerofill{#1#2e#3}% + \else + \pgfmathfloatround{#1#2e#3}% + \fi + \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax +} + +% Prints argument #1 using the current pretty printer environment (all +% variables in /pgf/number format). +% +% You may specify optional arguments with \pgfmathprintnumber[...]. +\def\pgfmathprintnumber{% + \pgfutil@ifnextchar[% + {\pgfmathprintnumber@OPT}% + {\pgfmathprintnumber@noopt}% +} + +\def\pgfmathprintnumber@noopt#1{% + \pgfmathprintnumber@{#1}% + \ifpgfmathprintnumber@assumemathmode + \else + \pgfutilensuremath{\pgfmathresult}% + \fi +}% +\def\pgfmathprintnumber@OPT[#1]#2{% + \begingroup + \pgfqkeys{/pgf/number format}{#1}% + \pgfmathprintnumber@{#2}% + \ifpgfmathprintnumber@assumemathmode + \else + \pgfutilensuremath{\pgfmathresult}% + \fi + \endgroup +}% + +% As \pgfmathprintnumber, but it produces its output into the second +% argument. +\def\pgfmathprintnumberto{% + \pgfutil@ifnextchar[% + {\pgfmathprintnumberto@OPT}% + {\pgfmathprintnumberto@noopt}% +} + +\def\pgfmathprintnumberto@noopt#1#2{% + \begingroup + \pgfmathprintnumber@{#1}% + \ifpgfmathprintnumber@assumemathmode + \global\let\pgfmathfloat@TMPB=\pgfmathresult + \else + \toks0=\expandafter{\pgfmathresult}% + \xdef\pgfmathfloat@TMPB{\noexpand\pgfutilensuremath{\the\toks0}}% + \fi + \endgroup + \let#2=\pgfmathfloat@TMPB +}% +\def\pgfmathprintnumberto@OPT[#1]#2#3{% + \begingroup + \pgfqkeys{/pgf/number format}{#1}% + \pgfmathprintnumber@{#2}% + \ifpgfmathprintnumber@assumemathmode + \global\let\pgfmathfloat@TMPB=\pgfmathresult + \else + \toks0=\expandafter{\pgfmathresult}% + \xdef\pgfmathfloat@TMPB{\noexpand\pgfutilensuremath{\the\toks0}}% + \fi + \endgroup + \let#3=\pgfmathfloat@TMPB +}% + + +% Changes the current number pretty printer to #1. +% +% #1 is the macro base name for the pretty print routine, without the +% leading '\'. +\def\pgfmath@set@number@printer#1{% + \expandafter\let\expandafter\pgfmathprintnumber@\csname #1\endcsname + \expandafter\let\expandafter\pgfmathprintnumber@issci\csname #1@issci\endcsname +} + +\pgfmath@set@number@printer{pgfmathprintnumber@STD} +%\pgfmath@set@number@printer{pgfmathprintnumber@FIXED} +%\pgfmath@set@number@printer{pgfmathprintnumber@FIXED@ZEROFILL} +%\pgfmath@set@number@printer{pgfmathprintnumber@SCI@ZEROFILL} +%\pgfmath@set@number@printer{pgfmathprintnumber@SCI} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% IMPL +% +%%%%%%%%%%%%%%%%%%%%%%%%%% + +% equals only itsself when compared with \ifx: +\def\pgfmathfloat@EOI{\pgfmathfloat@EOI}% + +% Re-use counters internally. +% +% They are always grouped and only used inside of the rounding +% routines. +\let\c@pgfmathroundto@prec=\pgfmathfloat@b@S% ATTENTION: DOUBLE-USED REGISTERS! +\let\c@pgfmathroundto@offsetbehindperiod=\pgfmathfloat@b@E +\newcount\c@pgfmathroundto@lastzeros + +\newif\ifpgfmathround@impl@PREPERIOD@is@negative@zero + +% PRECONDITION: +% \ifpgfmathfloatroundhasperiod=\iftrue holds outside of the +% current TeX group. +% +% POSTCONDITION: +% \ifpgfmathfloatroundhasperiod will be set correctly AFTER the +% current TeX group. +% \ifpgfmathfloatroundmayneedrenormalize will be set globally +\def\pgfmathroundto@impl#1{% + \global\pgfmathfloatroundmayneedrenormalizefalse + \pgfmathfloat@tmptoks={}% + \let\pgfmathround@next=\pgfutil@empty + \let\pgfmathround@cur=\pgfutil@empty + \let\pgfmathresult=\pgfutil@empty + \edef\pgfmathround@input{#1}% + \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax + \c@pgfmathroundto@lastzeros=0 + \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far + \pgfmathround@impl@PREPERIOD@is@negative@zerotrue + \expandafter\pgfmathroundto@impl@ITERATE@NODOT@firstcall\pgfmathround@input\pgfmathfloat@EOI +} + +% \pgfmathroundto implementation in WORDS: +% +% coarse idea: +% 1. collect all digits/sign BEFORE the first period in REVERSE order +% 2. then, collect UP TO \prec digits after the period in REVERSE order +% Steps 1. and 2. lead to the digit [sign] sequence +% "x_{-p} x_{-p+1} ... x_{-2} x_{-1} '.' x_0 ... x_r" +% where 'r' is the total number of digits. The integer 'p' denotes the +% ACTUALLY collected number of digits behind the period. +% +% Let 'k' be the desired precision. +% +% Please note that pgfmathroundto rounds the mantisse, that means |abs(x)|. +% +% There are exactly TWO cases: +% 1. The case with p<=k and x_{-p-1} = end of input. +% 2. The case with p=k and x_{-p-1} is a further, next character. +% +% Then, for case 1.): +% discard any unused zeros at the tail of our number (possibly +% including the period) +% +% and in case 2.) +% if NEXT DIGIT < 5: +% do exactly the same as in case 1.) above and discard any +% following digits. +% else +% let q := -p +% while(x_q = 9 and q<=r ) +% if q>=0 +% set x_q = '0' +% else +% discard digit x_q='9' +% fi +% ++q +% if q=0 +% discard the period +% fi +% end while +% if q = r+1 +% insert a '1' +% else +% set x_q = x_q + 1 +% fi +% fi +% +% All these loops have been implemented in spaghetti-code below. +% Sorry, I fear its hard to understand. In principle, everything is +% realised using more or less finite state machines (with some number +% counting logic). +% +% Some comments: +% - The token register \pgfmathfloat@tmptoks is used to accumulate the REVERSED input number. +% - \pgfmathfloat@EOI always denotes 'END OF INPUT'. +% - in the second stage, we need to reverse \pgfmathfloat@tmptoks. +% This is -again- done with \pgfmathfloat@tmptoks. + +\def\pgfmathroundto@impl@discard@period#1.#2\pgfmathfloat@EOI{% + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \def\pgfmathresult{#1}% +} + +\def\pgfmathroundto@impl@gobble@rest@and@start#1\pgfmathfloat@EOI{% + \pgfmathroundto@impl@start +} +\def\pgfmathroundto@impl@gobble@and@start\pgfmathfloat@EOI{% + \pgfmathroundto@impl@start +} +\def\pgfmathroundto@impl@gobble\pgfmathfloat@EOI{}% +\def\pgfmathroundto@impl@gobble@rest#1\pgfmathfloat@EOI{}% + +% This method will be invoked as soon as the first step, the reverse +% collection of up to PREC digits after the period, has finished. +\def\pgfmathroundto@impl@start{% + \ifx\pgfmathround@next\pgfutil@empty + \ifnum\c@pgfmathroundto@offsetbehindperiod<0 + % no period found. + \ifpgfmathfloat@fixed@digits@after@period + \ifnum\c@pgfmathroundto@prec=0\relax + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \edef\pgfmathresult{\pgfmathround@input}% + \else + \pgfmathfloat@tmptoks=\expandafter{\pgfmathround@input.}% + \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + \pgfmathroundto@impl@append@zeros + \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% + \fi + \else + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \edef\pgfmathresult{\pgfmathround@input}% + \fi + \else + %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec + % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}% + %\fi + \pgfmathroundto@impl@finish@with@truncation + \fi + \else + %\ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + %\else + % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}% + %\fi + \expandafter\ifnum\pgfmathround@next<5\relax + \pgfmathroundto@impl@finish@with@truncation + \else + \multiply\c@pgfmathroundto@offsetbehindperiod by-1 + \expandafter\pgfmathroundto@impl@ADD@ONE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \fi + \fi +} + +% takes the current input and decides whether trailing zeros shall be +% discarded or more zeros need to be filled in. +\def\pgfmathroundto@impl@finish@with@truncation{% + \ifpgfmathfloat@fixed@digits@after@period + \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod + \ifpgfmathround@impl@PREPERIOD@is@negative@zero + % write '0.0000' instead of '-0.0000': + \expandafter\pgfmathroundto@impl@discard@minus\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \fi + \fi + \ifnum\c@pgfmathroundto@prec=0\relax + \expandafter\pgfmathroundto@impl@discard@period\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \else + \advance\c@pgfmathroundto@prec by-\c@pgfmathroundto@offsetbehindperiod + \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + \pgfmathroundto@impl@append@zeros + \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% + \fi + \else + \pgfmathroundto@impl@discard@suffix@zeros + \fi +} + +\def\pgfmathroundto@impl@discard@minus-#1\pgfmathfloat@EOI{\pgfmathfloat@tmptoks={#1}}% + +% appends \c@pgfmathroundto@offsetbehindperiod zeros at the end of \pgfmathfloat@tmptoks. +\def\pgfmathroundto@impl@append@zeros{% + \ifnum\c@pgfmathroundto@offsetbehindperiod>0 + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \advance\c@pgfmathroundto@offsetbehindperiod by-1 + \pgfmathroundto@impl@append@zeros + \fi +} + +\def\pgfmathroundto@impl@ADD@ONE{% + \pgfmathfloat@tmptoks={}% no longer needed because its old value will be read from input + \pgfmathroundto@impl@ADD@ONE@ITERATE +} +\def\pgfmathroundto@impl@ADD@ONE@ITERATE{% + \pgfutil@ifnextchar\pgfmathfloat@EOI{% + \global\pgfmathfloatroundmayneedrenormalizetrue + \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble + }{% + \pgfutil@ifnextchar.{% + \ifnum\c@pgfmathroundto@prec=0 + % silently discard period in special case precision=0 + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}% + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT}% + \fi + \pgfmathround@nextcmd + }{% + \pgfutil@ifnextchar+{% + \global\pgfmathfloatroundmayneedrenormalizetrue + \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble@rest + }{% + \pgfutil@ifnextchar-{% + \global\pgfmathfloatroundmayneedrenormalizetrue + \edef\pgfmathresult{-1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble@rest + }{% + \pgfmathroundto@impl@ADD@ONE@NEXT + }% + }% + }% + }% +} + +\def\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot.{% + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \pgfmathroundto@impl@ADD@ONE@ITERATE +} + +\def\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT#1{% + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@ADD@ONE@ITERATE +} +\def\pgfmathroundto@impl@ADD@ONE@NEXT#1{% + \ifnum#1=9 + \ifnum\c@pgfmathroundto@offsetbehindperiod<0 + \ifpgfmathfloat@fixed@digits@after@period + \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}% + \else + % silently DROP digit + \fi + \else + \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}% + \fi + \advance\c@pgfmathroundto@offsetbehindperiod by1 + \ifnum\c@pgfmathroundto@offsetbehindperiod=0 + \ifpgfmathfloat@fixed@digits@after@period + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}% + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}% + \fi + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}% + \fi + \else + % re-use this counter: + \c@pgfmathroundto@lastzeros=#1 + \advance\c@pgfmathroundto@lastzeros by1 + \edef\pgfmathresult{\the\c@pgfmathroundto@lastzeros\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks=\expandafter{\pgfmathresult}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE@ITERATE}% + \fi + \pgfmathround@nextcmd +} + + +\def\pgfmathroundto@impl@discard@suffix@zeros{% + \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod + \ifpgfmathround@impl@PREPERIOD@is@negative@zero + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \def\pgfmathresult{0}% write '0' instead of '-0' + \else + \expandafter\pgfmathroundto@impl@discard@period\pgfmathround@input\pgfmathfloat@EOI + \fi + \else + \ifnum\c@pgfmathroundto@lastzeros=0 + \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \else + \expandafter\pgfmathroundto@impl@discard@suffix@zeros@ITERATE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \fi + \fi +} + +% PRECONDITION: +% \c@pgfmathroundto@lastzeros > 0 +\def\pgfmathroundto@impl@discard@suffix@zeros@ITERATE#1{% + \advance\c@pgfmathroundto@lastzeros by-1 + \ifnum\c@pgfmathroundto@lastzeros=0 + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE}% + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@discard@suffix@zeros@ITERATE}% + \fi + \pgfmathround@nextcmd +} + +% Usage: +% \pgfmathroundto@impl@REVERSE#1\pgfmathfloat@EOI +% -> writes #1 reversed into \pgfmathfloat@tmptoks +\def\pgfmathroundto@impl@REVERSE{% + \pgfmathfloat@tmptoks={}% + \pgfmathroundto@impl@REVERSE@ITERATE +} + +\def\pgfmathroundto@impl@REVERSE@ITERATE{% + \pgfutil@ifnextchar\pgfmathfloat@EOI{% + \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble + }{% + \pgfmathroundto@impl@REVERSE@NEXT + }% +} + +\def\pgfmathroundto@impl@REVERSE@NEXT#1{% + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@REVERSE@ITERATE +} + +\def\pgfmathroundto@impl@BEGIN@DOT.{% + \pgfmathfloat@tmptoks=\expandafter{\expandafter.\the\pgfmathfloat@tmptoks}% + \c@pgfmathroundto@offsetbehindperiod=0 + \pgfmathroundto@impl@ITERATE@DOT +} +\def\pgfmathroundto@impl@ITERATE@DOT{% + \pgfutil@ifnextchar\pgfmathfloat@EOI{% + % finished. + \pgfmathroundto@impl@gobble@and@start + }{% + \pgfmathroundto@impl@NEXT@DOT + }% +} +\def\pgfmathroundto@impl@NEXT@DOT#1{% + \ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + \def\pgfmathround@next{#1}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@gobble@rest@and@start}% + \else + \advance\c@pgfmathroundto@offsetbehindperiod by1 + \ifnum#1=0 + \advance\c@pgfmathroundto@lastzeros by1 + \else + \c@pgfmathroundto@lastzeros=0 + \fi + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@DOT}% + \fi + \pgfmathround@nextcmd +}% + +% in contrast to pgfmathroundto@impl@ITERATE@NODOT, this method here +% checks also for signs +\def\pgfmathroundto@impl@ITERATE@NODOT@firstcall#1{% + \def\pgfmathround@cur{#1}% + \ifx\pgfmathround@cur\pgfmathfloat@EOI + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@MINUS + \else + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \fi + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}% + \fi + \fi + \pgfmathround@nextcmd +} + +\def\pgfmathroundto@impl@ITERATE@NODOT#1{% + \def\pgfmathround@cur{#1}% + \ifx\pgfmathround@cur\pgfmathfloat@EOI + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@ZERO + \else + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \fi + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}% + \fi + \fi + \pgfmathround@nextcmd +} + +%-------------------------------------------- +% END of pgfmathroundto implementation. +%-------------------------------------------- + + +% flags, mantisse and exponent has already been stored into +% \pgfmathfloat@a@* [using ...@Mtok] +% +% PRECONDITION: +% \ifpgfmathfloatroundhasperiod = \iftrue outside of the current +% group +% +% POSTCONDITION: +% \ifpgfmathfloatroundhasperiod will be set after the current TeX +% group. +\def\pgfmathfloatround@impl{% + \expandafter\pgfmathroundto@impl\expandafter{\the\pgfmathfloat@a@Mtok}% + \ifpgfmathfloatroundmayneedrenormalize + \ifpgfmathfloatroundhasperiod + \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult\pgfmathfloat@EOI% + \else + \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult.\pgfmathfloat@EOI% + \fi + \advance\pgfmathfloat@a@E by1 + \fi + \edef\pgfmathresult{\the\pgfmathfloat@a@S\pgfmathresult e\the\pgfmathfloat@a@E}% +} + +\def\pgfmathfloatround@impl@renormalize#1#2.#3\pgfmathfloat@EOI{% + \pgfmathroundto@impl{#1.#2#3}% +} + + + + + +% ATTENTION: this thing REQUIRES a period in the mantisse! +% collects everything into \pgfmathresult +\def\pgfmathfloattofixed@impl#1.#2\relax{% + \ifnum\pgfmathfloat@a@E<0 + \pgfmathfloat@a@Mtok={0.}% + \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 + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1}% + \else + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}% + \fi + \else + \ifnum\pgfmathfloat@a@E=0% + \edef\pgfmathresult{#1.#2}% + \else + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloattofixed@impl@collectmantisse#2\count\pgfmathfloat@a@E + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% + \fi + \fi +} + +\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 + \ifnum\pgfmathfloat@a@E>0% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% + \advance\pgfmathfloat@a@E by-1% + \repeat + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .0}% + \else + \ifnum\pgfmathfloat@a@E=0 + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .#2}% + \else + \pgfmathfloattofixed@impl@collectmantisse#2\count#3% + \fi + \fi +} + + +% ============================================ +% +% +% \pgfmathfloatparsenumber implementation +% +% +% ============================================ + + +% accepted parser tokens: +\def\pgfmathfloatparsenumber@tok@ONE{1} +\def\pgfmathfloatparsenumber@tok@TWO{2} +\def\pgfmathfloatparsenumber@tok@THREE{3} +\def\pgfmathfloatparsenumber@tok@FOUR{4} +\def\pgfmathfloatparsenumber@tok@FIVE{5} +\def\pgfmathfloatparsenumber@tok@SIX{6} +\def\pgfmathfloatparsenumber@tok@SEVEN{7} +\def\pgfmathfloatparsenumber@tok@EIGHT{8} +\def\pgfmathfloatparsenumber@tok@NINE{9} +\def\pgfmathfloatparsenumber@tok@ZERO{0} +\def\pgfmathfloatparsenumber@tok@e{e} +\def\pgfmathfloatparsenumber@tok@E{E} +\def\pgfmathfloatparsenumber@tok@PLUS{+} +\def\pgfmathfloatparsenumber@tok@MINUS{-} +\def\pgfmathfloatparsenumber@tok@n{n} +\def\pgfmathfloatparsenumber@tok@N{N} +\def\pgfmathfloatparsenumber@tok@i{i} +\def\pgfmathfloatparsenumber@tok@I{I} +\def\pgfmathfloatparsenumber@tok@PERIOD{.} + +\newif\ifpgfmathfloatparsenumberpendingperiod + +% Starts a finite-start-machine parser to read a number. +% +% It assigns \pgfmathfloat@a@S, \pgfmathfloat@a@Mtok, \pgfmathfloat@a@E. +\def\pgfmathfloatparsenumber@impl#1{% + \pgfmathfloatparsenumberpendingperiodfalse + \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS + \pgfmathfloat@a@E=0 + % start parsing: check for sign: + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PLUS + \pgfmathfloat@a@S=1\relax% + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@MINUS + \pgfmathfloat@a@S=2\relax% + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}% + \else + \pgfmathfloat@a@S=1\relax% + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init#1}% + \fi + \fi + \pgfmathfloatparsenumber@NEXT +} + +\def\pgfmathfloatparsenumber@sanitize@digit{% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ONE + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@TWO + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@THREE + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FOUR + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FIVE + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SIX + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SEVEN + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@EIGHT + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@NINE + \else + \def\pgfmathfloatparsenumber@NEXT{\expandafter\pgfmathfloatparsenumber@impl@error\pgfmathfloatparsenumber@curtok}% + \fi\fi\fi\fi\fi\fi\fi\fi\fi +} + +% FROM: checksign. +% +\def\pgfmathfloatparsenumber@impl@init#1{% + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@n + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readnan}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@i + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readinf}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@leadingzero}% + \else + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloatparsenumberpendingperiodtrue + \pgfmathfloatparsenumber@impl@positiveexp}% + \pgfmathfloatparsenumber@sanitize@digit + \fi + \fi + \fi + \pgfmathfloatparsenumber@NEXT +} + +\def\pgfmathfloatparsenumber@impl@error#1\pgfmathfloat@EOI{% + \begingroup + \pgfmathfloat@a@Mtok={#1}% + \pgfmath@error{Could not read input number, sorry. The unreadable part was near '\the\pgfmathfloat@a@Mtok'.}% + \endgroup +}% + +\def\pgfmathfloatparsenumber@impl@finish#1\pgfmathfloat@EOI{} + +\def\pgfmathfloatparsenumber@impl@readnan an{% + \pgfmathfloat@a@S=3\relax% + \pgfmathfloat@a@Mtok={nan}% + \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}% + \else + \pgfmathfloat@a@S=5\relax% + \pgfmathfloat@a@Mtok={-inf}% + \fi + \pgfmathfloat@a@E=0% + \pgfmathfloatparsenumber@impl@finish +} +\def\pgfmathfloatparsenumber@impl@leadingzero#1{% + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloatparsenumber@impl@leadingzero}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@E=-1 + \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + }% + \else + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloatparsenumberpendingperiodtrue + \pgfmathfloatparsenumber@impl@positiveexp}% + \pgfmathfloatparsenumber@sanitize@digit + \fi\fi\fi + \fi + \fi + \pgfmathfloatparsenumber@NEXT +} + +\def\pgfmathfloatparsenumber@impl@leadingzero@foundperiod#1{% + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO + \def\pgfmathfloatparsenumber@NEXT{% + \advance\pgfmathfloat@a@E by-1 + \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + }% + \else + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloatparsenumberpendingperiodtrue + \pgfmathfloatparsenumber@impl@finish@number@after@period}% + \pgfmathfloatparsenumber@sanitize@digit + \fi\fi\fi + \fi + \pgfmathfloatparsenumber@NEXT +} + + +\def\pgfmathfloatparsenumber@impl@positiveexp#1{% + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO + \def\pgfmathfloatparsenumber@NEXT{% + \advance\pgfmathfloat@a@E by1 + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI + \def\pgfmathfloatparsenumber@NEXT{}% + \else + \def\pgfmathfloatparsenumber@NEXT{% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfmathfloatparsenumber@impl@positiveexp}% + \pgfmathfloatparsenumber@sanitize@digit + \fi\fi\fi + \fi + \fi + \pgfmathfloatparsenumber@NEXT +} + +\def\pgfmathfloatparsenumber@impl@readexponent#1\pgfmathfloat@EOI{% + \advance\pgfmathfloat@a@E by#1\relax +} + +\def\pgfmathfloatparsenumber@impl@pendingzeros@positiveexp#1{% + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \advance\pgfmathfloat@a@E by1 + \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI + \def\pgfmathfloatparsenumber@NEXT{}% + \else + \def\pgfmathfloatparsenumber@NEXT{% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfmathfloatparsenumber@impl@positiveexp}% + \pgfmathfloatparsenumber@sanitize@digit + \fi\fi\fi + \fi + \fi + \pgfmathfloatparsenumber@NEXT +} + +\def\pgfmathfloatparsenumber@impl@finish@number@after@period#1{% + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfmathfloatparsenumber@impl@pendingzeros}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI + \def\pgfmathfloatparsenumber@NEXT{}% + \else + \def\pgfmathfloatparsenumber@NEXT{% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfmathfloatparsenumber@impl@finish@number@after@period}% + \pgfmathfloatparsenumber@sanitize@digit + \fi\fi\fi + \fi + \pgfmathfloatparsenumber@NEXT +} + +\def\pgfmathfloatparsenumber@impl@pendingzeros#1{% + \def\pgfmathfloatparsenumber@curtok{#1}% + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO + \def\pgfmathfloatparsenumber@NEXT{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfmathfloatparsenumber@impl@pendingzeros}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E + \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% + \else + \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI + \def\pgfmathfloatparsenumber@NEXT{}% + \else + \def\pgfmathfloatparsenumber@NEXT{% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfmathfloatparsenumber@impl@finish@number@after@period}% + \pgfmathfloatparsenumber@sanitize@digit + \fi\fi\fi + \fi + \pgfmathfloatparsenumber@NEXT +} + + + diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.code.tex new file mode 100644 index 00000000000..ed8e8e611ec --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.code.tex @@ -0,0 +1,5918 @@ +%-------------------------------------------- +% +% 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/>. +% +%-------------------------------------------- + +\input pgfplotsliststructure.code.tex +\input pgfplotsarray.code.tex +\input pgfplotstable.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 +\newdimen\pgfplots@xcoordminTEX +\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 +\newif\ifpgfplots@enlargelimits@auto +\newif\ifpgfplots@tickshow +\newif\ifpgfplots@xminorticks +\newif\ifpgfplots@xmajorticks +\newif\ifpgfplots@yminorticks +\newif\ifpgfplots@ymajorticks +\newif\ifpgfplots@xminorgrids +\newif\ifpgfplots@xmajorgrids +\newif\ifpgfplots@yminorgrids +\newif\ifpgfplots@ymajorgrids +\newif\ifpgfplots@scaled@ticks +\newif\ifpgfplots@identify@log@minor@tick@pos +\newif\ifpgfplots@disablelogfilter +\newif\ifpgfplots@disabledatascaling +\newif\ifpgfplots@hide +\newif\ifpgfplots@is@old@list@format +\newif\ifpgfplots@errorbars@enabled +\newif\ifpgfplots@scale@only@axis +\newif\ifpgfplots@xticklabel@interval +\newif\ifpgfplots@yticklabel@interval +\newif\ifpgfplots@stacked@x +\newif\ifpgfplots@stackedmode +\newif\ifpgfplots@stacked@reverse +\newif\ifpgfplots@stacked@plus +\let\pgfplots@TMP=\pgfutil@empty +\let\pgfplots@TMPB=\pgfutil@empty +\let\pgfplots@TMPC=\pgfutil@empty +\let\pgfnodepartimagebox=\pgfnodeparttextbox + +\newif\ifpgfplots@collect@firstplot@astick + +\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. +% +% #1: the name of the final list. Can be used in 'cycle list name' +% #2: the list entries. You can use either a comma-separated list or +% a '\\'-terminated list. The latter case also requires '\\' +% AFTER the last entry. +\def\pgfcreateplotcyclelist#1#2{\pgfplots@assign@list#1{#2}} + +\pgfcreateplotcyclelist{\blackwhiteplotspeclist}{% + mark options={fill=gray},mark=*\\% + mark options={fill=gray},mark=square*\\% + mark options={fill=gray},mark=otimes*\\% + mark=star\\% + mark options={fill=gray},mark=diamond*\\% + densely dashed,mark options={solid,fill=gray},mark=*\\% + densely dashed,mark options={solid,fill=gray},mark=square*\\% + densely dashed,mark options={solid,fill=gray},mark=otimes*\\% + densely dashed,mark options={solid},mark=star\\% + densely dashed,mark options={solid,fill=gray},mark=diamond*\\% +} +\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*\\% + 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*\\% +} + +\def\pgfplotsset{\pgfqkeys{/pgfplots}} + +\def\pgfplotsdeprecatedstylecheck#1{% + \pgfkeysifdefined{#1/.@cmd}{% + \begingroup + \edef\pgfkeyscurrentkey{#1}% + \pgfkeyssplitpath + \pgfplots@warning{Warning: Loading deprecated style option + \pgfkeyscurrentpath/\pgfkeyscurrentname. + Please replace '\string\tikzstyle{\pgfkeyscurrentname}' + with '\string\pgfplotsset{\pgfkeyscurrentname/.style={}}' + (or '\string\pgfplotsset{\pgfkeyscurrentname/.append style={}}').}% + \endgroup + \pgfkeysvalueof{#1/.@cmd}\pgfeov + }{}% +}% + +\pgfkeys{% + /pgfplots/search path for tikz/.unknown/.code={% + \let\searchname=\pgfkeyscurrentname% + \pgfkeysalso{% + /tikz/\searchname/.try=#1, + /pgfplots/\searchname/.lastretry=#1 + }% + },% + /pgfplots/.is family, + /pgfplots/scale/.is family, + /pgfplots/legend/.is family, + /pgfplots/tick/.is family, + /pgfplots/axis/.is family, + /pgfplots/descriptions/.is family, + /pgfplots/style commands/.is family, + /pgfplots/naming commands/.is family, + /pgfplots/error bars/.is family, + /pgfplots/every axis/.style={}, + /pgfplots/every axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis}}, + /pgfplots/every axis/.belongs to family=/pgfplots/style commands, + /pgfplots/every semilogx axis/.style={}, + /pgfplots/every semilogx axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every semilogx axis}}, + /pgfplots/every semilogx axis/.belongs to family=/pgfplots/style commands, + /pgfplots/every semilogy axis/.style={}, + /pgfplots/every semilogy axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every semilogy axis}}, + /pgfplots/every semilogy axis/.belongs to family=/pgfplots/style commands, + /pgfplots/every loglog axis/.style={}, + /pgfplots/every loglog axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every loglog axis}}, + /pgfplots/every loglog axis/.belongs to family=/pgfplots/style commands, + /pgfplots/every linear axis/.style={}, + /pgfplots/every linear axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every linear axis}}, + /pgfplots/every linear axis/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis plot/.style={}, + /pgfplots/every axis plot/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis plot}}, + /pgfplots/every axis plot/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis plot post/.style={}, + /pgfplots/every axis plot post/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis plot}}, + /pgfplots/every axis label/.style={}, + /pgfplots/every axis label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis label}}, + /pgfplots/every axis label/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis x label/.style={at={(0.5,0)},below,yshift=-15pt}, + /pgfplots/every axis x label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis x label}}, + /pgfplots/every axis x label/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, + /pgfplots/every axis y label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis y label}}, + /pgfplots/every axis y label/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis title/.style={at={(0.5,1)},above,yshift=6pt}, + /pgfplots/every axis title/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis title}}, + /pgfplots/every axis title/.belongs to family=/pgfplots/style commands, + /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 minor tick/.style={}, + /pgfplots/every minor tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor tick}}, + /pgfplots/every minor tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every major tick/.style={}, + /pgfplots/every major tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major tick}}, + /pgfplots/every major tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every x tick/.style={}, + /pgfplots/every x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every x tick}}, + /pgfplots/every x tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor x tick/.style={}, + /pgfplots/every minor x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor x tick}}, + /pgfplots/every minor x tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every major x tick/.style={}, + /pgfplots/every major x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major x tick}}, + /pgfplots/every major x tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every y tick/.style={}, + /pgfplots/every y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick}}, + /pgfplots/every y tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor y tick/.style={}, + /pgfplots/every minor y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor y tick}}, + /pgfplots/every minor y tick/.belongs to family=/pgfplots/style commands, + /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/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis grid}}, + /pgfplots/every axis grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor grid/.style={}, + /pgfplots/every minor grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor grid}}, + /pgfplots/every minor grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every major grid/.style={}, + /pgfplots/every major grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major grid}}, + /pgfplots/every major grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis x grid/.style={}, + /pgfplots/every axis x grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis x grid}}, + /pgfplots/every axis x grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor x grid/.style={}, + /pgfplots/every minor x grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor x grid}}, + /pgfplots/every minor x grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every major x grid/.style={}, + /pgfplots/every major x grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major x grid}}, + /pgfplots/every major x grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis y grid/.style={}, + /pgfplots/every axis y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis y grid}}, + /pgfplots/every axis y grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor y grid/.style={}, + /pgfplots/every minor y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor y grid}}, + /pgfplots/every minor y grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every major y grid/.style={}, + /pgfplots/every major y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y grid}}, + /pgfplots/every major y grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every tick label/.style={}, + /pgfplots/every tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every tick label}}, + /pgfplots/every tick label/.belongs to family=/pgfplots/style commands, + /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/.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, + /pgfplots/extra x tick style/.code={% + \pgfkeysalso{/pgfplots/every extra x tick/.append style={#1}}% + }, + /pgfplots/every x tick scale label/.style={at={(1,0)},yshift=-2em,left,inner sep=0pt}, + /pgfplots/every x tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every x tick scale label}}, + /pgfplots/every x tick scale label/.belongs to family=/pgfplots/style commands, + /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/.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, + /pgfplots/extra y tick style/.code={% + \pgfkeysalso{/pgfplots/every extra y tick/.append style={#1}}% + }, + /pgfplots/every y tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, + /pgfplots/every y tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick scale label}}, + /pgfplots/every y tick scale label/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis legend/.style={% + cells={anchor=center}, + inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em}, + anchor=north east,% + shape=rectangle,% + fill=white,% + draw=black, + at={(0.98,0.98)}, + }, + /pgfplots/every axis legend/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis legend}}, + /pgfplots/every axis legend/.belongs to family=/pgfplots/style commands, +% tick options: + /pgfplots/xticklabel/.store in= \pgfplots@xticklabel, + /pgfplots/xticklabel/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel=, + /pgfplots/xticklabels/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@xticklabels + \let\pgfplots@xticklabel=\pgfplots@user@ticklabel@list@x + }, + /pgfplots/yticklabels/.belongs to family=/pgfplots/tick, + /pgfplots/yticklabels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@yticklabels + \let\pgfplots@yticklabel=\pgfplots@user@ticklabel@list@y + }, + /pgfplots/yticklabel/.store in= \pgfplots@yticklabel, + /pgfplots/yticklabel/.belongs to family=/pgfplots/tick, + /pgfplots/yticklabel=, + /pgfplots/x tick label as interval/.is if=pgfplots@xticklabel@interval, + /pgfplots/x tick label as interval/.default=true, + /pgfplots/x tick label as interval/.belongs to family=/pgfplots/tick, + /pgfplots/y tick label as interval/.is if=pgfplots@yticklabel@interval, + /pgfplots/y tick label as interval/.default=true, + /pgfplots/y tick label as interval/.belongs to family=/pgfplots/tick, + /pgfplots/extra x tick label/.store in= \pgfplots@extra@xticklabel, + /pgfplots/extra x tick label/.belongs to family=/pgfplots/tick, + /pgfplots/extra x tick label=, + /pgfplots/extra x tick labels/.belongs to family=/pgfplots/tick, + /pgfplots/extra x tick labels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@xticklabels + \let\pgfplots@extra@xticklabel=\pgfplots@user@extra@ticklabel@list@x + }, + /pgfplots/extra y tick labels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@yticklabels + \let\pgfplots@extra@yticklabel=\pgfplots@user@extra@ticklabel@list@y + }, + /pgfplots/xtick/.store in= \pgfplots@xtick, + /pgfplots/xtick/.belongs to family=/pgfplots/tick, + /pgfplots/xtick=, + /pgfplots/extra x ticks/.store in=\pgfplots@extra@xtick, + /pgfplots/extra x ticks/.belongs to family=/pgfplots/tick, + /pgfplots/extra x ticks=, + /pgfplots/xtickten/.store in= \pgfplots@xtickten, + /pgfplots/xtickten/.belongs to family=/pgfplots/tick, + /pgfplots/xtickten=, + /pgfplots/extra y tick label/.store in= \pgfplots@extra@yticklabel, + /pgfplots/extra y tick label/.belongs to family=/pgfplots/tick, + /pgfplots/extra y tick label=, + /pgfplots/ytick/.store in= \pgfplots@ytick, + /pgfplots/ytick/.belongs to family=/pgfplots/tick, + /pgfplots/ytick=, + /pgfplots/extra y ticks/.store in=\pgfplots@extra@ytick, + /pgfplots/extra y ticks/.belongs to family=/pgfplots/tick, + /pgfplots/extra y ticks=, + /pgfplots/ytickten/.store in= \pgfplots@ytickten, + /pgfplots/ytickten/.belongs to family=/pgfplots/tick, + /pgfplots/ytickten=, + /pgfplots/tick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/tick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/scaled ticks/.is if=pgfplots@scaled@ticks, + /pgfplots/scaled ticks/.default=false, + /pgfplots/scaled ticks/.belongs to family=/pgfplots/tick, + /pgfplots/scaled ticks=true, + /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, + /pgfplots/scale ticks below exponent/.store in= \pgfplots@scale@ticks@below@exponent, + /pgfplots/scale ticks below exponent/.belongs to family=/pgfplots/tick, + /pgfplots/scale ticks below exponent=-1, + /pgfplots/subtickwidth/.store in= \pgfplots@subtickwidth, + /pgfplots/subtickwidth/.belongs to family=/pgfplots/tick, + /pgfplots/subtickwidth=0.1cm, + /pgfplots/tickwidth/.store in= \pgfplots@tickwidth, + /pgfplots/tickwidth/.belongs to family=/pgfplots/tick, + /pgfplots/tickwidth=0.15cm, + /pgfplots/minor x tick num/.initial=0, + /pgfplots/minor x tick num/.belongs to family=/pgfplots/tick, + /pgfplots/minor y tick num/.initial=0, + /pgfplots/minor y tick num/.belongs to family=/pgfplots/tick, + /pgfplots/minor tick num/.style={/pgfplots/minor x tick num=#1,/pgfplots/minor y tick num=#1}, + /pgfplots/minor tick num/.belongs to family=/pgfplots/tick, + /pgfplots/minor tick length/.estore in=\pgfplots@subtickwidth, + /pgfplots/minor tick length/.belongs to family=/pgfplots/tick, + /pgfplots/major tick length/.estore in=\pgfplots@tickwidth, + /pgfplots/major tick length/.belongs to family=/pgfplots/tick, + /pgfplots/max space between ticks/.estore in=\axisdefaulttickwidth, + /pgfplots/max space between ticks/.belongs to family=/pgfplots/tick, + /pgfplots/max space between ticks=35,% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt') + /pgfplots/try min ticks/.estore in= \axisdefaulttryminticks, + /pgfplots/try min ticks/.belongs to family=/pgfplots/tick, + /pgfplots/try min ticks=4, + /pgfplots/try min ticks log/.estore in= \pgfplots@default@try@minticks@log, + /pgfplots/try min ticks log/.belongs to family=/pgfplots/tick, + /pgfplots/try min ticks log=3, + /pgfplots/log plot exponent style/.style={/pgf/number format/fixed,/pgf/number format/precision=2}, + /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 number format code/.code={{% + \pgfmathlogtologten@{#1}% + \ifpgfplots@identify@log@minor@tick@pos + \expandafter\pgfplots@is@log@tick@a@minor@tick@pos\pgfmathresult\relax% + \else + \pgfplots@log@tick@isminor@tick@posfalse + \fi + \ifpgfplots@log@tick@isminor@tick@pos + \pgfmathprintnumber[sci]{\pgfmathresult}% + \else + \pgfkeysalso{/pgfplots/log plot exponent style,/pgfplots/log base 10 number format code=\pgfmathresult}% + \fi + }}, + /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, + /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 \pgfplots@{x,y}tickalignnum to +% inside=0 +% outside=1 +% center=2 + /pgfplots/tick align/.is choice, + /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, +% 'axis' options: + /pgfplots/anchor/.belongs to family=/pgfplots, + /pgfplots/anchor/.store in= \pgfplots@anchorname, + /pgfplots/anchor=south west, +% tick options: + /pgfplots/ticks/.is choice, + /pgfplots/ticks/.belongs to family=/pgfplots/tick, + /pgfplots/ticks/none/.belongs to family=/pgfplots/tick, + /pgfplots/ticks/none/.code={% + \pgfplots@xminorticksfalse + \pgfplots@yminorticksfalse + \pgfplots@xmajorticksfalse + \pgfplots@ymajorticksfalse + }, + /pgfplots/ticks/major/.belongs to family=/pgfplots/tick, + /pgfplots/ticks/major/.code={% + \pgfplots@xminorticksfalse + \pgfplots@yminorticksfalse + \pgfplots@xmajortickstrue + \pgfplots@ymajortickstrue + }, + /pgfplots/ticks/minor/.belongs to family=/pgfplots/tick, + /pgfplots/ticks/minor/.code={% + \pgfplots@xminortickstrue + \pgfplots@yminortickstrue + \pgfplots@xmajorticksfalse + \pgfplots@ymajorticksfalse + }, + /pgfplots/ticks/both/.belongs to family=/pgfplots/tick, + /pgfplots/ticks/both/.code={% + \pgfplots@xminortickstrue + \pgfplots@yminortickstrue + \pgfplots@xmajortickstrue + \pgfplots@ymajortickstrue + }, + /pgfplots/ticks=both, + /pgfplots/grid/.is choice, + /pgfplots/grid/.belongs to family=/pgfplots/tick, + /pgfplots/grid/none/.belongs to family=/pgfplots/tick, + /pgfplots/grid/none/.code={% + \pgfplots@xminorgridsfalse + \pgfplots@yminorgridsfalse + \pgfplots@xmajorgridsfalse + \pgfplots@ymajorgridsfalse + }, + /pgfplots/grid/major/.belongs to family=/pgfplots/tick, + /pgfplots/grid/major/.code={% + \pgfplots@xminorgridsfalse + \pgfplots@yminorgridsfalse + \pgfplots@xmajorgridstrue + \pgfplots@ymajorgridstrue + }, + /pgfplots/grid/minor/.belongs to family=/pgfplots/tick, + /pgfplots/grid/minor/.code={% + \pgfplots@xminorgridstrue + \pgfplots@yminorgridstrue + \pgfplots@xmajorgridsfalse + \pgfplots@ymajorgridsfalse + }, + /pgfplots/grid/both/.belongs to family=/pgfplots/tick, + /pgfplots/grid/both/.code={% + \pgfplots@xminorgridstrue + \pgfplots@yminorgridstrue + \pgfplots@xmajorgridstrue + \pgfplots@ymajorgridstrue + }, + /pgfplots/grid=none, + /pgfplots/grid/.default=major, + /pgfplots/xminorticks/.is if=pgfplots@xminorticks, + /pgfplots/xminorticks/.default=true, + /pgfplots/xminorticks/.belongs to family=/pgfplots/tick, + /pgfplots/xmajorticks/.is if=pgfplots@xmajorticks, + /pgfplots/xmajorticks/.default=true, + /pgfplots/xmajorticks/.belongs to family=/pgfplots/tick, + /pgfplots/yminorticks/.is if=pgfplots@yminorticks, + /pgfplots/yminorticks/.default=true, + /pgfplots/yminorticks/.belongs to family=/pgfplots/tick, + /pgfplots/ymajorticks/.is if=pgfplots@ymajorticks, + /pgfplots/ymajorticks/.default=true, + /pgfplots/ymajorticks/.belongs to family=/pgfplots/tick, + /pgfplots/xminorgrids/.is if=pgfplots@xminorgrids, + /pgfplots/xminorgrids/.default=true, + /pgfplots/xminorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/xmajorgrids/.is if=pgfplots@xmajorgrids, + /pgfplots/xmajorgrids/.default=true, + /pgfplots/xmajorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/yminorgrids/.is if=pgfplots@yminorgrids, + /pgfplots/yminorgrids/.default=true, + /pgfplots/yminorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/ymajorgrids/.is if=pgfplots@ymajorgrids, + /pgfplots/ymajorgrids/.default=true, + /pgfplots/ymajorgrids/.belongs to family=/pgfplots/tick, +% legend options: + /pgfplots/legend columns/.store in=\pgfplots@legend@columns, + /pgfplots/legend columns/.belongs to family=/pgfplots/legend, + /pgfplots/legend columns=1, + /pgfplots/legend plot pos/.is choice, + /pgfplots/legend plot pos/.belongs to family=/pgfplots/legend, + /pgfplots/legend plot pos/left/.code= {\def\pgfplots@legend@plot@pos{0}}, + /pgfplots/legend plot pos/left/.belongs to family=/pgfplots/legend, + /pgfplots/legend plot pos/right/.code= {\def\pgfplots@legend@plot@pos{1}}, + /pgfplots/legend plot pos/right/.belongs to family=/pgfplots/legend, + /pgfplots/legend plot pos/none/.code= {\def\pgfplots@legend@plot@pos{2}}, + /pgfplots/legend plot pos/none/.belongs to family=/pgfplots/legend, + /pgfplots/legend plot pos=left, + /pgfplots/legend image code/.code={% + \draw[#1,mark repeat=2,mark phase=2] + plot coordinates { + (0cm,0cm) + (0.3cm,0cm) + (0.6cm,0cm)% + };% + }, + /pgfplots/legend image code/.belongs to family=/pgfplots/legend, +% axis description options: + /pgfplots/title/.store in= \pgfplots@title, + /pgfplots/title/.belongs to family=/pgfplots/descriptions, + /pgfplots/title=, + /pgfplots/xlabel/.store in= \pgfplots@xlabel, + /pgfplots/xlabel/.belongs to family=/pgfplots/descriptions, + /pgfplots/xlabel=, + /pgfplots/ylabel/.store in= \pgfplots@ylabel, + /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/.belongs to family=/pgfplots, + /pgfplots/clip limits/.is if=pgfplots@clip@limits, + /pgfplots/clip limits/.default=true, + /pgfplots/clip limits=true, + /pgfplots/clip limits/.belongs to family=/pgfplots, + /pgfplots/xmin/.belongs to family=/pgfplots, + /pgfplots/xmin/.initial=, + /pgfplots/xmax/.belongs to family=/pgfplots, + /pgfplots/xmax/.initial=, + /pgfplots/ymin/.belongs to family=/pgfplots, + /pgfplots/ymin/.initial=, + /pgfplots/ymax/.belongs to family=/pgfplots, + /pgfplots/ymax/.initial=, + /pgfplots/stack plots/.is choice, + /pgfplots/stack plots/.belongs to family=/pgfplots, + /pgfplots/stack plots/x/.code={\pgfplots@stacked@xtrue\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/x/.belongs to family=/pgfplots, + /pgfplots/stack plots/y/.code={\pgfplots@stacked@xfalse\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/y/.belongs to family=/pgfplots, + /pgfplots/stack plots/false/.code={\pgfplots@stackedmodefalse}, + /pgfplots/stack plots/false/.belongs to family=/pgfplots, + /pgfplots/stack plots=false, + /pgfplots/reverse stacked plots/.is if=pgfplots@stacked@reverse, + /pgfplots/reverse stacked plots/.belongs to family=/pgfplots, + /pgfplots/reverse stacked plots/.default=true, + /pgfplots/reverse stacked plots=true, + /pgfplots/stack dir/.is choice, + /pgfplots/stack dir/.belongs to family=/pgfplots, + /pgfplots/stack dir/plus/.code={\pgfplots@stacked@plustrue}, + /pgfplots/stack dir/plus/.belongs to family=/pgfplots, + /pgfplots/stack dir/minus/.code={\pgfplots@stacked@plusfalse}, + /pgfplots/stack dir/minus/.belongs to family=/pgfplots, + /pgfplots/stack dir=plus, + /pgfplots/filter discard warning/.is if=pgfplots@warn@for@filter@discards, + /pgfplots/filter discard warning=true, + /pgfplots/x filter/.code={}, + /pgfplots/x filter/.belongs to family=/pgfplots, + /pgfplots/y filter/.code={}, + /pgfplots/y filter/.belongs to family=/pgfplots, + /pgfplots/skip coords between index/.style 2 args={% + /pgfplots/x filter/.append code={% + \ifnum\coordindex<#1\relax + \else + \ifnum\coordindex<#2\relax + \let\pgfmathresult=\pgfutil@empty + \fi + \fi} + }, + /pgfplots/xfilter/.initial=,% DEPRECATED + /pgfplots/xfilter/.belongs to family=/pgfplots, + /pgfplots/yfilter/.initial=,% DEPRECATED + /pgfplots/yfilter/.belongs to family=/pgfplots, + /pgfplots/width/.store in= \pgfplots@width, + /pgfplots/width/.belongs to family=/pgfplots, + /pgfplots/width=, + /pgfplots/height/.store in= \pgfplots@height, + /pgfplots/height/.belongs to family=/pgfplots, + /pgfplots/height=, + /pgfplots/execute at begin plot/.store in=\pgfplots@execute@at@begin@plot, + /pgfplots/execute at begin plot/.belongs to family=/pgfplots, + /pgfplots/execute at begin plot=, + /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/enlargelimits/.default=true, + /pgfplots/x/.store in= \pgfplots@x, + /pgfplots/x/.belongs to family=/pgfplots, + /pgfplots/x=,% is implicitly set by 'width' and/or '\axisdefaultwidth' + /pgfplots/y/.store in= \pgfplots@y, + /pgfplots/y/.belongs to family=/pgfplots, + /pgfplots/y=,% is implicitly set by 'width' and/or '\axisdefaultwidth' + /pgfplots/cycle list/.code={\pgfplots@assign@list\autoplotspeclist{#1}}, + /pgfplots/cycle list/.belongs to family=/pgfplots, + /pgfplots/cycle list name/.code={\let\autoplotspeclist=#1\relax}, + /pgfplots/cycle list name/.belongs to family=/pgfplots, + /pgfplots/cycle list name=\coloredplotspeclist, + /pgfplots/legend style/.belongs to family=/pgfplots/style commands, + /pgfplots/legend style/.code={% + \pgfkeysalso{/pgfplots/every axis legend/.append style={#1}}% + }, + /pgfplots/label style/.belongs to family=/pgfplots/style commands, + /pgfplots/label style/.code={% + \pgfkeysalso{/pgfplots/every axis label/.append style={#1}}% + },% + /pgfplots/x label style/.belongs to family=/pgfplots/style commands, + /pgfplots/x label style/.code={% + \pgfkeysalso{/pgfplots/every axis x label/.append style={#1}}% + }, + /pgfplots/y label style/.belongs to family=/pgfplots/style commands, + /pgfplots/y label style/.code={% + \pgfkeysalso{/pgfplots/every axis y label/.append style={#1}}% + }, + /pgfplots/title style/.belongs to family=/pgfplots/style commands, + /pgfplots/title style/.code={% + \pgfkeysalso{/pgfplots/every axis title/.append style={#1}}% + }, + /pgfplots/tick label style/.belongs to family=/pgfplots/style commands, + /pgfplots/tick label style/.code={% + \pgfkeysalso{/pgfplots/every tick label/.append style={#1}}% + }, + /pgfplots/x tick label style/.belongs to family=/pgfplots/style commands, + /pgfplots/x tick label style/.code={% + \pgfkeysalso{/pgfplots/every x tick label/.append style={#1}}% + }, + /pgfplots/y tick label style/.belongs to family=/pgfplots/style commands, + /pgfplots/y tick label style/.code={% + \pgfkeysalso{/pgfplots/every y tick label/.append style={#1}}% + }, + /pgfplots/x tick scale label style/.belongs to family=/pgfplots/style commands, + /pgfplots/x tick scale label style/.code={% + \pgfkeysalso{/pgfplots/every x scale tick label/.append style={#1}}% + }, + /pgfplots/y tick scale label style/.belongs to family=/pgfplots/style commands, + /pgfplots/y tick scale label style/.code={% + \pgfkeysalso{/pgfplots/every y scale tick label/.append style={#1}}% + }, + /pgfplots/tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/tick style/.code={% + \pgfkeysalso{/pgfplots/every tick/.append style={#1}}% + }, + /pgfplots/minor tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor tick style/.code={% + \pgfkeysalso{/pgfplots/every minor tick/.append style={#1}}% + }, + /pgfplots/major tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/major tick style/.code={% + \pgfkeysalso{/pgfplots/every major tick/.append style={#1}}% + }, + /pgfplots/x tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/x tick style/.code={% + \pgfkeysalso{/pgfplots/every x tick/.append style={#1}}% + }, + /pgfplots/minor x tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor x tick style/.code={% + \pgfkeysalso{/pgfplots/every minor x tick/.append style={#1}}% + }, + /pgfplots/major x tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/major x tick style/.code={% + \pgfkeysalso{/pgfplots/every major x tick/.append style={#1}}% + }, + /pgfplots/y tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/y tick style/.code={% + \pgfkeysalso{/pgfplots/every y tick/.append style={#1}}% + }, + /pgfplots/minor y tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor y tick style/.code={% + \pgfkeysalso{/pgfplots/every minor y tick/.append style={#1}}% + }, + /pgfplots/major y tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/major y tick style/.code={% + \pgfkeysalso{/pgfplots/every major y tick/.append style={#1}}% + }, + /pgfplots/grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/grid style/.code={% + \pgfkeysalso{/pgfplots/every axis grid/.append style={#1}}% + }, + /pgfplots/minor grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor grid style/.code={% + \pgfkeysalso{/pgfplots/every minor grid/.append style={#1}}% + }, + /pgfplots/major grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/major grid style/.code={% + \pgfkeysalso{/pgfplots/every major grid/.append style={#1}}% + }, + /pgfplots/x grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/x grid style/.code={% + \pgfkeysalso{/pgfplots/every axis x grid/.append style={#1}}% + }, + /pgfplots/minor x grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor x grid style/.code={% + \pgfkeysalso{/pgfplots/every minor x grid/.append style={#1}}% + }, + /pgfplots/major x grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/major x grid style/.code={% + \pgfkeysalso{/pgfplots/every major x grid/.append style={#1}}% + }, + /pgfplots/y grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/y grid style/.code={% + \pgfkeysalso{/pgfplots/every axis y grid/.append style={#1}}% + }, + /pgfplots/minor y grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor y grid style/.code={% + \pgfkeysalso{/pgfplots/every minor y grid/.append style={#1}}% + }, + /pgfplots/major y grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/major y grid style/.code={% + \pgfkeysalso{/pgfplots/every major y grid/.append style={#1}}% + }, + /pgfplots/disablelogfilter/.is if=pgfplots@disablelogfilter, + /pgfplots/disablelogfilter/.default=true, + /pgfplots/disablelogfilter/.belongs to family=/pgfplots, + /pgfplots/disablelogfilter=false, + /pgfplots/disabledatascaling/.is if=pgfplots@disabledatascaling, + /pgfplots/disabledatascaling/.default=true, + /pgfplots/disabledatascaling/.belongs to family=/pgfplots, + /pgfplots/disabledatascaling=false, + /pgfplots/hide axis/.is if=pgfplots@hide, + /pgfplots/hide axis/.default=true, + /pgfplots/hide axis/.belongs to family=/pgfplots, + /pgfplots/hide axis=false, +% sets \pgfplots@xaxislinesnum to +% box=0 +% bottom=1 +% middle=2 +% top=3 + /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, +% sets \pgfplots@yaxislinesnum to +% box=0 +% left=1 +% center=2 +% right=3 + /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, +% set \pgfplots@xaxisdiscontnum +% none = 0 +% crunch = 1 +% open = 2 + /pgfplots/axis x discontinuity/.is choice, + /pgfplots/axis x discontinuity/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis x discontinuity/none/.code ={\def\pgfplots@xaxisdiscontnum{0}}, + /pgfplots/axis x discontinuity/none/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis x discontinuity/crunch/.code ={\def\pgfplots@xaxisdiscontnum{1}}, + /pgfplots/axis x discontinuity/crunch/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis x discontinuity/parallel/.code ={\def\pgfplots@xaxisdiscontnum{2}}, + /pgfplots/axis x discontinuity/parallel/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis x discontinuity=none, +% set \pgfplots@yaxisdiscontnum +% none = 0 +% crunch = 1 +% open = 2 + /pgfplots/axis y discontinuity/.is choice, + /pgfplots/axis y discontinuity/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis y discontinuity/none/.code ={\def\pgfplots@yaxisdiscontnum{0}}, + /pgfplots/axis y discontinuity/none/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis y discontinuity/crunch/.code ={\def\pgfplots@yaxisdiscontnum{1}}, + /pgfplots/axis y discontinuity/crunch/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis y discontinuity/parallel/.code ={\def\pgfplots@yaxisdiscontnum{2}}, + /pgfplots/axis y discontinuity/parallel/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis y discontinuity=none, + /pgfplots/scale only axis/.is if=pgfplots@scale@only@axis, + /pgfplots/scale only axis/.default=true, + /pgfplots/scale only axis/.belongs to family=/pgfplots, + /pgfplots/scale only axis=false, +% sets \pgfplots@xislinear to +% normal=true +% log=false + /pgfplots/xmode/.is choice, + /pgfplots/xmode/.belongs to family=/pgfplots/scale, + /pgfplots/xmode/normal/.code={\pgfplots@xislineartrue}, + /pgfplots/xmode/normal/.belongs to family=/pgfplots/scale, + /pgfplots/xmode/linear/.code={\pgfplots@xislineartrue}, + /pgfplots/xmode/linear/.belongs to family=/pgfplots/scale, + /pgfplots/xmode/log/.code={\pgfplots@xislinearfalse}, + /pgfplots/xmode/log/.belongs to family=/pgfplots/scale, + /pgfplots/xmode=linear, + /pgfplots/ymode/.is choice, + /pgfplots/ymode/.belongs to family=/pgfplots/scale, + /pgfplots/ymode/normal/.code={\pgfplots@yislineartrue}, + /pgfplots/ymode/normal/.belongs to family=/pgfplots/scale, + /pgfplots/ymode/linear/.code={\pgfplots@yislineartrue}, + /pgfplots/ymode/linear/.belongs to family=/pgfplots/scale, + /pgfplots/ymode/log/.code={\pgfplots@yislinearfalse}, + /pgfplots/ymode/log/.belongs to family=/pgfplots/scale, + /pgfplots/ymode=linear, + /pgfplots/error bars/x fixed/.code= \def\pgfplots@errorbars@xfixed{#1}\def\pgfplots@errorbars@xmode{0}, + /pgfplots/error bars/x fixed relative/.code= \def\pgfplots@errorbars@xrel{#1}\def\pgfplots@errorbars@xmode{1}, + /pgfplots/error bars/x explicit/.code= \def\pgfplots@errorbars@xmode{2}, + /pgfplots/error bars/x explicit relative/.code= \def\pgfplots@errorbars@xmode{3}, + /pgfplots/error bars/x fixed relative=0, + /pgfplots/error bars/x fixed=0, + /pgfplots/error bars/y fixed/.code= \def\pgfplots@errorbars@yfixed{#1}\def\pgfplots@errorbars@ymode{0}, + /pgfplots/error bars/y fixed relative/.code= \def\pgfplots@errorbars@yrel{#1}\def\pgfplots@errorbars@ymode{1}, + /pgfplots/error bars/y explicit/.code= \def\pgfplots@errorbars@ymode{2}, + /pgfplots/error bars/y explicit relative/.code= \def\pgfplots@errorbars@ymode{3}, + /pgfplots/error bars/y fixed relative=0, + /pgfplots/error bars/y fixed=0, + /pgfplots/error bars/x dir/.is choice, + /pgfplots/error bars/x dir/none/.code={% + \def\pgfplots@errorbars@xdirection{0}% + \ifnum\pgfplots@errorbars@ydirection=0 + \pgfplots@errorbars@enabledfalse + \fi + }, + /pgfplots/error bars/x dir/plus/.code= \def\pgfplots@errorbars@xdirection{1}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/x dir/minus/.code= \def\pgfplots@errorbars@xdirection{2}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/x dir/both/.code= \def\pgfplots@errorbars@xdirection{3}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/x dir=none, + /pgfplots/error bars/y dir/.is choice, + /pgfplots/error bars/y dir/none/.code={% + \def\pgfplots@errorbars@ydirection{0}% + \ifnum\pgfplots@errorbars@xdirection=0 + \pgfplots@errorbars@enabledfalse + \fi + }, + /pgfplots/error bars/y dir/plus/.code= \def\pgfplots@errorbars@ydirection{1}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/y dir/minus/.code= \def\pgfplots@errorbars@ydirection{2}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/y dir/both/.code= \def\pgfplots@errorbars@ydirection{3}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/y dir=none, + /pgfplots/error bars/error mark/.initial={-}, + /pgfplots/error bars/error mark options/.initial={rotate=90}, + /pgfplots/error bars/error bar style/.code={% + \pgfkeysalso{/pgfplots/every error bar/.append style={#1}}% + }, + /pgfplots/every error bar/.style={thin}, + /pgfplots/every error bar/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every error bar}}, + /pgfplots/error bars/draw error bar/.code 2 args={% +%\message{/pgfplots/error bars/draw error bar: working with '#1' -- '#2'.}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% + \draw #1 -- #2 node[pos=1,sloped,allow upside down] {% + \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% + \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% + \pgfusepath{stroke}}% + }; + }, + /pgfplots/bar cycle list/.style={/pgfplots/cycle list={% + {blue,fill=blue!30!white,mark=none},% + {red,fill=red!30!white,mark=none},% + {brown!60!black,fill=brown!30!white,mark=none},% + {black,fill=gray,mark=none},% + } + }, + /pgfplots/area cycle list/.style={bar cycle list}, + /pgfplots/ybar/.style={ + bar cycle list, + tick 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 + % -> subtract half for centering + -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + % the '0.5*w' is for centering + (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /tikz/ybar, + }, + /pgfplots/ybar/.default=2pt, + /pgfplots/ybar/.belongs to family=/pgfplots, + /pgfplots/xbar/.style={ + bar cycle list, + tick 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 + % -> subtract half for centering + -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + % the '0.5*w' is for centering + (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /tikz/xbar, + }, + /pgfplots/xbar/.default=2pt, + /pgfplots/xbar/.belongs to family=/pgfplots, + /pgfplots/ybar interval/.style={% + bar cycle list, + x tick label as interval, + xmajorgrids, + % 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}, + bar interval shift={(\plotnum+0.5)/\numplots}, + /tikz/ybar interval, + }, + /pgfplots/ybar interval/.default=1, + /pgfplots/ybar interval/.belongs to family=/pgfplots, + /pgfplots/xbar interval/.style={% + bar cycle list, + y tick label as interval, + % ytick=data, + ymajorgrids, + /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}, + /tikz/xbar interval, + }, + /pgfplots/xbar interval/.default=1, + /pgfplots/xbar interval/.belongs to family=/pgfplots, + /pgfplots/xbar stacked/.style={ + bar cycle list, + stack plots=x, + stack dir=#1, + /tikz/xbar, + }, + /pgfplots/xbar stacked/.default=plus, + /pgfplots/xbar stacked/.belongs to family=/pgfplots, + /pgfplots/ybar stacked/.style={ + bar cycle list, + stack plots=y, + stack dir=#1, + /tikz/ybar, + }, + /pgfplots/ybar stacked/.default=plus, + /pgfplots/ybar stacked/.belongs to family=/pgfplots, + /pgfplots/xbar interval stacked/.style={ + bar cycle list, + stack plots=x, + stack dir=#1, + /tikz/xbar interval, + }, + /pgfplots/xbar interval stacked/.default=plus, + /pgfplots/xbar interval stacked/.belongs to family=/pgfplots, + /pgfplots/ybar interval stacked/.style={ + bar cycle list, + stack plots=y, + stack dir=#1, + /tikz/ybar interval, + }, + /pgfplots/ybar interval stacked/.default=plus, + /pgfplots/ybar interval stacked/.belongs to family=/pgfplots, + /pgfplots/yticklabel interval boundaries/.style={% + y tick label as interval, + yticklabel={$\pgfmathprintnumber{\tick}$ -- $\pgfmathprintnumber{\nexttick}$} + }, + /pgfplots/xticklabel interval boundaries/.style={% + x tick label as interval, + xticklabel={$\pgfmathprintnumber{\tick}$ -- $\pgfmathprintnumber{\nexttick}$} + }, +} + +\newif\ifpgfplots@log@tick@isminor@tick@pos +% Checks whether the tick position given as #1.#2=log10(T) belongs to +% T=i*10^j with an integer i>1. +% +% If T=i*10^j, \ifpgfplots@log@tick@isminor@tick@pos will be set to true and +% \pgfmathresult will contain T. +% +% Otherwise, \ifpgfplots@log@tick@isminor@tick@pos will be set to false and +% pgfmathresult to #1.#2 +% +% Arguments: +% #1.#2 the value log10(T) +% +% Implementation: +% if T = i*10^j, log10(T) = log10(i) + j. +% That means if log10(T) in \Z, we have T = 10^j. If not, we need to +% check wether i is an integer. Please note that log10(i) < 1. +% +% Further note: log(T) < 0 <=> j<0. +% In case j<0, we have +% #1.#2 = j + log(i) +% = - ( -j - log(i) ) +% = - ( -j - 1 + (1-log(i)) ) +% = #1 '.' #2 [ up to the '0.' +% that means #1 = j-1 and #2 = 1-log(i). +\def\pgfplots@is@log@tick@a@minor@tick@pos#1.#2\relax{% + \pgfmathapproxequalto@{#1.#2}{#1.0}% + \ifpgfmathcomparison + % in MOST cases, this here will be true: + \pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \else + % I guess this won't happen too often. In fact, it's a very + % special case. + \begingroup + \c@pgf@counta=#1\relax + \ifnum\c@pgf@counta<0 + \advance\c@pgf@counta by-1 + \pgfmathsubtract@{1}{0.#2}% + \expandafter\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi\pgfmathresult\relax + \ifpgfplots@log@tick@isminor@tick@pos + \aftergroup\pgfplots@log@tick@isminor@tick@postrue + \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% + \else + \aftergroup\pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \fi + \else + \pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#2\relax + \ifpgfplots@log@tick@isminor@tick@pos + \aftergroup\pgfplots@log@tick@isminor@tick@postrue + \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% + \else + \aftergroup\pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup + \fi +} + +% expects a positive number. +\def\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#1\relax{% + \pgfplots@log@tick@isminor@tick@postrue + \pgfmathapproxequalto@{0.#1}{0.3010299956639}% + \ifpgfmathcomparison + \def\pgfmathresult{2}% + \else + \pgfmathapproxequalto@{0.#1}{0.4771212547196}% + \ifpgfmathcomparison + \def\pgfmathresult{3}% + \else + \pgfmathapproxequalto@{0.#1}{0.6020599913279}% + \ifpgfmathcomparison + \def\pgfmathresult{4}% + \else + \pgfmathapproxequalto@{0.#1}{0.698970004}% + \ifpgfmathcomparison + \def\pgfmathresult{5}% + \else + \pgfmathapproxequalto@{0.#1}{0.7781512503}% + \ifpgfmathcomparison + \def\pgfmathresult{6}% + \else + \pgfmathapproxequalto@{0.#1}{0.8450980400}% + \ifpgfmathcomparison + \def\pgfmathresult{7}% + \else + \pgfmathapproxequalto@{0.#1}{0.9030899869}% + \ifpgfmathcomparison + \def\pgfmathresult{8}% + \else + \pgfmathapproxequalto@{0.#1}{0.954242509439}% + \ifpgfmathcomparison + \def\pgfmathresult{9}% + \else + \pgfplots@log@tick@isminor@tick@posfalse + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + + +\def\pgfplots@set@at#1{\def\pgfplots@at{#1}}% + + + +% converts a comma-separated list (PGF foreach) to my internal list +% structure. +\long\def\pgfplots@foreach@to@list#1\to#2{% + \pgfplotslistnewempty\pgfplots@TMP + \begingroup + \foreach \i in {#1} {% + \globaldefs=1 + \expandafter\pgfplotslistpushback\i\to\pgfplots@TMP + \globaldefs=0 + }% + \endgroup + \pgfplotslistcopy\pgfplots@TMP\to#2\relax +} + +% Several tick options: +\long\def\axispreset#1{% + \pgfplotsset{every axis/.append style={#1}}% +} +\long\def\legendpreset#1{% + \pgfplots@error{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% +} + +% Checks whether we need to create a separate 'tick scale label', +% a node with ' * 10^3' on the side of the axis: +% +% PRECONDITION: +% Axis limits for #1 are given. I need their values before any data +% scale transformation has been applied. +% If +% \pgfplots@#1min@unscaled@as@float +% and +% \pgfplots@#1max@unscaled@as@float +% exist; I will use these macros. +% Otherwise, I will use \pgfplots@#1min and \pgfplots@#1max; +% assuming that no data scale transformation is active. +% FIXME : does that need further attention? +\def\pgfplots@init@scaled@tick@for#1{% + \begingroup + % the \pgfplots@xmin@unscaled@as@float is set just before the data + % scale transformation is initialised. + % + % The variables are empty if there is no datascale transformation. + \expandafter\let\expandafter\pgfplots@cur@min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname + \expandafter\let\expandafter\pgfplots@cur@max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname + % + \ifx\pgfplots@cur@min@unscaled\pgfutil@empty + \xdef\pgfplots@TMP{\csname pgfplots@#1min\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \let\pgfplots@cur@min@unscaled=\pgfmathresult + \xdef\pgfplots@TMP{\csname pgfplots@#1max\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \let\pgfplots@cur@max@unscaled=\pgfmathresult + \fi + % + \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E + \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \fi + \xdef\pgfplots@TMP{\pgfplots@scale@ticks@above@exponent}% + \expandafter\ifnum\pgfplots@TMP<\pgfmathfloat@b@E + % ok, scale it: + \multiply\pgfmathfloat@b@E by-1 + \xdef\pgfplots@TMP{\the\pgfmathfloat@b@E}% + \else + \xdef\pgfplots@TMP{\pgfplots@scale@ticks@below@exponent}% + \expandafter\ifnum\pgfplots@TMP>\pgfmathfloat@b@E + % ok, scale it: + \multiply\pgfmathfloat@b@E by-1 + \xdef\pgfplots@TMP{\the\pgfmathfloat@b@E}% + \else + % no scaling necessary: + \xdef\pgfplots@TMP{0}% + \fi + \fi + \endgroup + \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@TMP% +} + +% 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}% + \edef\pgfplots@show@ticklabel@coord@x@new{\pgfmathresult pt}% + \pgfmathparse{#5}% + \edef\pgfplots@show@ticklabel@coord@y@new{\pgfmathresult pt}% + % + \pgfplots@show@ticklabel@{#2}{#3}% + \let\nexttick=\tick + \ifx\pgfplots@show@ticklabel@LASTTICK\pgfutil@empty + % its the first call. Simply remember arguments and wait + % for interval boundary before proceeding. + \else + % acquire options of first interval boundary: + \pgfplots@show@ticklabel@LASTTICK + % compute new node position: + \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#2\endcsname + \csname pgfplots@show@ticklabel@coord@#2@new\endcsname)}% + \expandafter\edef\csname pgfplots@show@ticklabel@coord@#2\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};% + \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}% + }% + \else + \let\ticknum=#6\relax% + \pgfplots@show@ticklabel@{#2}{#3}% + \node at (#4,#5) [#1] {\csname pgfplots@#2ticklabel\endcsname};% + \fi +}} + +% Defines \tick by applying any necessary math to the (possibly +% transformed) tick value #2. +% +% #1: axis (x or y) +% #2: tick value. +\def\pgfplots@show@ticklabel@#1#2{% + \csname ifpgfplots@apply@datatrafo@#1\endcsname + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{#2}% + % FIXME: do that for any linear axis, also if no datascale is + % applied! + \ifpgfplots@scaled@ticks + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \fi + % .. and this here provides \tick as fixed point repr: + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\tick=\pgfmathresult + \else + \edef\tick{#2}% + \fi +}% + +\def\pgfplots@user@ticklabel@list@x{% + \pgfplotslistselect\ticknum\of\pgfplots@xticklabels\to\tick + \tick +} +\def\pgfplots@user@ticklabel@list@y{% + \pgfplotslistselect\ticknum\of\pgfplots@yticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@x{% + \pgfplotslistselect\ticknum\of\pgfplots@extra@xticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@y{% + \pgfplotslistselect\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{% + \node + [/pgfplots/every axis label,% + /pgfplots/every axis #1 label] + {\csname pgfplots@#1label\endcsname}; +} + +\def\pgfplots@show@title{% + \node% + [/pgfplots/every axis title] + {\pgfplots@title}; +} + +% Check if a label does not cross the x-axis +\def\pgfplots@ytick@check@tickshow{% + \pgfplots@tickshowtrue + \ifnum\pgfplots@yaxislinesnum=2\relax + \ifcase\pgfplots@xaxislinesnum\relax + \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax + \pgfplots@tickshowfalse + \fi + \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ZERO@y\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax + \pgfplots@tickshowfalse + \fi + \fi + \fi +} + +\def\pgfplots@drawyaxis@placecomputedtick#1[#2]{% + \ifcase\pgfplots@ytickalignnum\relax + \def\pgfplots@ytick@offset{0pt} + \or + \def\pgfplots@ytick@offset{#1} + \or + \def\pgfplots@ytick@offset{.5*#1} + \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@placecomputedgridline[#1]{% + \draw[#1] + (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@tmpa) + -- (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \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 + \begingroup + \xdef\pgfplots@TMP{\csname pgfplots@tick@scale@#1\endcsname}% + \expandafter\c@pgf@counta\pgfplots@TMP\relax + \multiply\c@pgf@counta by-1 + \ifnum\c@pgf@counta=0\relax + \global\let\pgfplots@TMP=\pgfutil@empty + \else + \xdef\pgfplots@TMP{\the\c@pgf@counta}% + \fi + \endgroup + \ifx\pgfplots@TMP\pgfutil@empty + \else + \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/tick scale label code/.@cmd}{\pgfplots@TMP}}% + \node + [% + xshift=\pgfplots@xcoordminTEX,% + yshift=\pgfplots@ycoordminTEX,% + x=\pgfplots@xcoordmaxTEX-\pgfplots@xcoordminTEX,% + y=\pgfplots@ycoordmaxTEX-\pgfplots@ycoordminTEX,% + /pgfplots/every tick label,% + /pgfplots/every #1 tick label,% + /pgfplots/every #1 tick scale label] + {\pgfplots@tick@scale@labels}; + \fi + \fi + \fi +} + +% Simply invokes the code of PGF key #1 with value #2, that means +% #1#2\pgfeov +\def\pgfplots@invoke@pgfkeyscode#1#2{% + \pgfkeysgetvalue{#1}\pgfplots@invoke@pgfkeyscode@CODE + \pgfplots@invoke@pgfkeyscode@CODE#2\pgfeov +} + +% Check if it does not cross the y-axis +\def\pgfplots@xtick@check@tickshow{% + \pgfplots@tickshowtrue + \ifnum\pgfplots@xaxislinesnum=2\relax + \ifcase\pgfplots@yaxislinesnum\relax + \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax + \pgfplots@tickshowfalse + \fi + \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ZERO@x\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax + \pgfplots@tickshowfalse + \fi + \fi + \fi +} + +\def\pgfplots@drawxaxis@placecomputedtick#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@placecomputedgridline[#1]{% + \draw[#1] + (\pgfplots@tmpa, \pgfplots@ycoordminTEX\pgfplots@leftover) + -- (\pgfplots@tmpa, \pgfplots@ycoordmaxTEX\pgfplots@rightover) + ; +}% + +% #1: axis (x or y) +% #2: tick position list +\def\pgfplots@draw@extra@ticks@for#1#2{% + \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 + \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); + \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); + \fi +}% + +\def\pgfplots@drawaxis@outerlines{% + \draw + (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) + \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 + \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 + \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 + \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 + ; % -- cycle; +}% + +\def\pgfplots@drawaxis@lines{% + \begingroup + \begingroup + % this group employs several temporary dimension registers + % and is therefor scoped: + \let\ydisstart=\pgf@xa + \let\ydisend=\pgf@xb + \let\xdisstart=\pgf@ya + \let\xdisend=\pgf@yb + \ydisend=\pgfplots@ycoordmaxTEX + \advance \ydisend by -\pgfplots@ycoordminTEX + \ifcase\pgfplots@yaxisdiscontnum\relax + \let\ydiscontstyle=\pgfutil@empty + \or + \def\ydiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% + \advance \ydisend by -16pt + \or + \def\ydiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% + \advance \ydisend by -8pt + \fi + \ifpgfplots@apply@datatrafo@y + \advance \pgfplots@ycoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@y pt + \fi + \ifdim\pgfplots@ycoordmaxTEX<0pt + \ydisstart=\ydisend + \ydisend=4pt + \else + \ydisstart=4pt + \fi + \ifpgfplots@apply@datatrafo@y + \advance \pgfplots@ycoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@y pt + \fi + \xdisend=\pgfplots@xcoordmaxTEX + \advance \xdisend by -\pgfplots@xcoordminTEX + \ifcase\pgfplots@xaxisdiscontnum\relax + \let\xdiscontstyle=\pgfutil@empty + \or + \def\xdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% + \advance \xdisend by -16pt + \or + \def\xdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% + \advance \xdisend by -8pt + \fi + \ifpgfplots@apply@datatrafo@x + \advance \pgfplots@xcoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@x pt + \fi + \ifdim\pgfplots@xcoordmaxTEX<0pt + \xdisstart=\xdisend + \xdisend=4pt + \else + \xdisstart=4pt + \fi + \ifpgfplots@apply@datatrafo@x + \advance \pgfplots@xcoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@x pt + \fi + % carry local computations outside of group: + \xdef\pgfplots@TMP{% + \noexpand\def\noexpand\xdisstart{\the\xdisstart}% + \noexpand\def\noexpand\xdisend{\the\xdisend}% + \noexpand\def\noexpand\ydisstart{\the\ydisstart}% + \noexpand\def\noexpand\ydisend{\the\ydisend}% + \noexpand\pgfkeys{% + /tikz/xdiscont/.style={\xdiscontstyle},% + /tikz/ydiscont/.style={\ydiscontstyle}}% + }% + \endgroup + \pgfplots@TMP + \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 + \begingroup + \global\pgfplots@ticknum=0 + \edef\pgfplots@TMP{#1}% + \ifx\pgfplots@TMP\pgfutil@empty + \else + \ifpgfplots@xminorticks + \pgfplots@needsminorlooptrue + \fi + \ifpgfplots@xminorgrids + \pgfplots@needsminorlooptrue + \fi + \ifpgfplots@needsminorloop + \ifpgfplots@xislinear + \begingroup + \c@pgf@counta=\pgfplots@minor@xtick@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}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplots@minor@tick@dist=\pgfmathresult + \else + \def\pgfplots@minor@xtick@num{9}% + \fi + \fi + \xdef\pgfplots@show@ticklabel@LASTTICK{}% + \foreach \x in {#1} { + \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\x}{0}}% + \pgfplots@xtick@check@tickshow + % + \ifpgfplots@tickshow + \ifdim\pgfplots@tmpa<\pgfplots@xcoordminTEX + \else + \ifdim\pgfplots@tmpa>\pgfplots@xcoordmaxTEX + \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 + \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 + \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}}% + \fi + \advance\pgfplots@tmpa by\pgfplots@tmpb + \ifdim\pgfplots@tmpa<\pgfplots@xcoordminTEX + \else + \ifdim\pgfplots@tmpa>\pgfplots@xcoordmaxTEX + \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 + \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 +} + +\def\pgfplots@rememberplotspec#1{% + \begingroup + \globaldefs=1 + \pgfplotslistpushback#1\to\pgfplots@plotspeclist + \endgroup +} + +\def\pgfplots@getautoplotspec into#1{% + \pgfplotslistsize\autoplotspeclist\to\c@pgf@counta + \ifnum\c@pgf@counta=0 + \let#1=\pgfutil@empty + \else + \c@pgf@countb=\pgfplots@numplots + % offset modulo size: + \loop + \ifnum\c@pgf@countb<\c@pgf@counta + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \advance\c@pgf@countb by-\c@pgf@counta + \repeat + \pgfplotslistselect\c@pgf@countb\of\autoplotspeclist\to#1 +%\pgfplots@message{pgfplots.sty: using \string\autoplotspeclist\ specification no\#\the\c@pgf@countb (of \the\c@pgf@counta): #1}% + \fi +} + +% The main interface to draw a plot into an axis. +% +% Usage: +% \addplot +% plot coordinates { +% (0,0) +% (1,1) +% }; +% +% or +% +% \addplot[color=blue,mark=*] +% plot coordinates { +% (0,0) +% (1,1) +% }; +% +% The first syntax will use the next plot specification in the list +% \autoplotspeclist +% and the first will use blue color and * markers. +% +% The linespec. will be used in the legend. +% +% Low-level implementation: +% +% \pgfplots@addplot +% \pgfplots@addplotimpl +% \pgfplots@start@plot@with@options <--- \begingroup +% ... +% ... remember options GLOBALLY +% ... update limits GLOBALLY +% ... \pgfplots@addplot@enqueue@coords GLOBALLY +% ... +% \pgfplots@end@plot <--- \endgroup +\long\def\pgfplots@addplot{% + \pgfutil@ifnextchar+{% + \pgfplots@getautoplotspec into\nextplotspec + \pgfplots@addplotimplAPPEND + }{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl% + }{% + \pgfplots@getautoplotspec into\nextplotspec + % the space after ']' is required here: + % FIXME: + % - \addplot[]plot coordinates is NOT allowed!? + \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec] + }% + }% +} + +\long\def\pgfplots@addplotimplAPPEND+[{% + \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec, +} + +\long\def\pgfplots@addplotimpl[#1]{% + \pgfutil@ifnextchar p{% + \pgfplots@addplotimpl@plot{#1}% + }{% + \pgfplots@addplotimpl@plot{#1}plot + }% +} + +\def\pgfplots@addplotimpl@plot#1plot{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@plot@withoptions{#1}% + }{% + \pgfplots@addplotimpl@plot@withoptions{#1}[]% + }% +} + +\def\pgfplots@addplotimpl@plot@withoptions#1[#2]{ + \pgfplots@start@plot@with@options{#1}{#2}% + \pgfutil@ifnextchar c{% + \pgfplots@addplotimpl@coordinates{#1}plot + }{% + \pgfutil@ifnextchar f{% + \pgfplots@addplotimpl@f{#1}% + }{% + \pgfutil@ifnextchar t{% + \pgfplots@addplotimpl@table{#1}% + }{% + \pgfutil@ifnextchar ({% + \pgfplots@addplotimpl@expression{#1}% + }{% + \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots!}% + }% + }% + }% + }% +} + +% Currently, plot expression is really inefficient: +% +% 1. it invokes the math parser to get all coordinates. Ok, that's +% what one expects. +% +% 2. It collects the result into one large list instead of calling +% pgfplots' stream methods. That's because \foreach encapsulates its +% code in at least one TeX-group. +% +% 3. It processes the collected list; applying any floating point +% parser routines - it does NOT know that any numbers are already in +% TeX-precision! +% +% 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}% + \edef\pgfplots@plot@data{\noexpand\foreach\expandafter\noexpand\tikz@plot@var in {\tikz@plot@samplesat}}% + \global\let\pgfplots@TMP=\pgfutil@empty + \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)}% + }% + \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@TMP}% +}% + +\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 + +% #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}% + \iftikz@plot@raw@gnuplot% + \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{#2}}% + \else% + \iftikz@plot@parametric% + \def\tikz@plot@data{\pgfplotgnuplot[\tikz@plot@filename]{% + set format "\%.7e"; + 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"; + set samples \tikz@plot@samples; + plot [x=\tikz@plot@domain] #2}}% + \fi% + \fi% + \def\pgfplotxyfile{\pgfplots@addplotimpl@gnuplotresult{#1}{#3}}% + \tikz@plot@data + \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile +}% + +\def\pgfplots@addplotimpl@gnuplotresult#1#2#3{% + \begingroup + \openin1=#3 + \ifeof1 + \pgfplots@error{Sorry, the gnuplot-result file '#3' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot #3' manually.}% + \aftergroup\pgfplots@loop@CONTINUEfalse + \else + \aftergroup\pgfplots@loop@CONTINUEtrue + \fi + \closein1 + \endgroup + \ifpgfplots@loop@CONTINUE + \pgfplots@addplotimpl@file{#1}ile{#3}#2;% + \fi +} + +\def\pgfplots@addplotimpl@file#1ile{% + \pgfplots@addplotimpl@table{#1}table[x index=0,y index=1,header=false]% +}% + +\def\pgfplots@addplotimpl@table#1table{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@table@getopts{#1}% + }{% + \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% + }% +}% + +\def\pgfplots@addplotimpl@table@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@addplot@table@from@macrofalse + \pgfplots@addplotimpl@table@START{#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@START#1#2#3#4;{% + \begingroup + \pgfplotstableset{#2}% + \ifpgfplots@addplot@table@from@macro + \pgfplotstablecopy#3\to\pgfplots@table + \else + \pgfplotstableread{#3} to \pgfplots@table + \fi + \ifx\pgfplots@plot@tbl@x\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\addplot@tbl@x + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x + \fi + \ifx\pgfplots@plot@tbl@y\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\addplot@tbl@y + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y + \fi + % + \ifpgfplots@errorbars@enabled + \let\addplot@tbl@error@x=\pgfutil@empty + \let\addplot@tbl@error@y=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex + \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x + \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex + \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y + \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\addplot@tbl@error@x + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x + \fi + \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\addplot@tbl@error@y + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y + \fi + \fi + % + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \pgfplots@coord@stream@start + \loop + \pgfplotslistcheckempty\addplot@tbl@x + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \pgfplotslistpopfront\addplot@tbl@x\to\addplot@tbl@cur@x + \pgfplotslistpopfront\addplot@tbl@y\to\addplot@tbl@cur@y + \ifpgfplots@errorbars@enabled + \ifx\addplot@tbl@error@x\pgfutil@empty + \let\addplot@tbl@error@cur@x=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@x\to\addplot@tbl@error@cur@x + \fi + \ifx\addplot@tbl@error@y\pgfutil@empty + \let\addplot@tbl@error@cur@y=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@y\to\addplot@tbl@error@cur@y + \fi + \edef\pgfplots@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 + \else + \edef\pgfplots@TMP{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{}{}}% + \expandafter\pgfplots@coord@stream@coord\pgfplots@TMP + \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{% + \begingroup + \def\pgfplots@current@point@coordindex{0}% can be used inside of coordinate filters. + \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot + \ifx\pgfplots@execute@at@begin@plot\pgfutil@empty + \else + \pgfplots@execute@at@begin@plot + \fi + \ifpgfplots@stackedmode + \pgfplots@stacked@beginplot + \fi + \pgfplots@rememberplotspec{#1}% + \def\pgfplots@addplot@nonlegend@options{#2}% + \ifx\pgfplots@addplot@nonlegend@options\pgfutil@empty + \else + \pgfqkeys{/tikz}{#2}% + \fi +} + +% Initialises +% \pgfplots@coord@stream@start +% \pgfplots@coord@stream@coord +% \pgfplots@coord@stream@end +% such that a following coordinate stream is processed properly. The +% following coordinate stream may come from different input methods. +% +% Arguments: +% #1: all options of \addplot[...] (the plot style) +% #2: any trailing path commands after the 'plot' command as such, +% for example \addplot plot coordinates {...} -- (0,0); +% would yield #2 =' -- (0,0)' +% +\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@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% + \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 + }% + {% + \noexpand\draw[current plot style]% + }% + }% + \expandafter\pgfplots@TMP\expandafter{\pgfplots@coord@stream@recorded #2;}% + {}% + }% +}% + +\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 + \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}% + }% + \fi + \fi + \endgroup + \pgfplots@TMP% see above +} + +% #1: arguments to \addplot[...] +% #2: the plot coordinates +% #3: any trailing path command before the final ';'. It will be used as-is. +\long\def\pgfplots@addplotimpl@coordinates#1plot coordinates#2#3;{% +%\tracingmacros=2\tracingcommands=2 +%\pgfplots@message{processing plots coords with trailing path '#3'}% + \pgfplots@PREPARE@COORD@STREAM{#1}{#3}% + \pgfplots@coord@stream@foreach{#2}% +}% + +\newif\ifpgfplots@update@limits@for@one@point@ISCLIPPED +\def\pgfplots@math@ONE{1.0}% + +\def\pgfplots@streamerrorbarstart{% +}% +\def\pgfplots@streamerrorbarend{% +}% +\def\pgfplots@streamerrorbarcoords#1#2{% +}% + +\def\pgfplots@streamerrorbar@recordto#1{% + \def\pgfplots@streamerrorbarstart{\let#1=\pgfutil@empty}% + \def\pgfplots@streamerrorbarend{}% + \def\pgfplots@streamerrorbarcoords##1##2{% + \expandafter\def\expandafter#1\expandafter{#1% + \pgfplots@errorbar@draw{##1}{##2}% + }% + }% +} +\def\pgfplots@streamerrorbar@directdraw{% + \def\pgfplots@streamerrorbarstart{}% + \def\pgfplots@streamerrorbarend{}% + \def\pgfplots@streamerrorbarcoords##1##2{% + \pgfplots@errorbar@draw{##1}{##2}% + }% +} + + + +% Updates the current x and y limits for point (#1,#2). +% +% The point coordinates may be given in floating point format, see +% below. +% +% Please note that if user specified limits are given, automatic +% limits are only applied to points which fall into the user specified +% clipping region. +% +% PRECONDITIONS: +% - '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). +% #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 + \else + \ifpgfplots@float@numerics@mode@x + \pgfmathfloatlessthan@{#1}{\pgfplots@xmin}% + \ifpgfmathfloatcomparison + \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \fi + \pgfmathfloatlessthan@{\pgfplots@xmax}{#1}% + \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 + \pgfmathlessthan@{\pgfplots@xmax}{#1}% + \ifx\pgfmathresult\pgfplots@math@ONE + \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \fi + \fi + \fi + \ifpgfplots@autocompute@ylim + \else + \ifpgfplots@float@numerics@mode@y + \pgfmathfloatlessthan@{#2}{\pgfplots@ymin}% + \ifpgfmathfloatcomparison + \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \fi + \pgfmathfloatlessthan@{\pgfplots@ymax}{#2}% + \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 + \pgfmathlessthan@{\pgfplots@ymax}{#2}% + \ifx\pgfmathresult\pgfplots@math@ONE + \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \fi + \fi + \fi + \fi + \ifpgfplots@update@limits@for@one@point@ISCLIPPED + \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 + \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 + \fi + \global\pgfplots@limits@are@computedtrue + \fi +%\pgfplots@message{Updated limits: (\pgfplots@xmin,\pgfplots@ymin) rectangle (\pgfplots@xmax,\pgfplots@ymax).}% +%\tracingmacros=0\tracingcommands=0 +} + +\def\pgfplots@invoke@filter#1#2{% + \pgfkeysvalueof{/pgfplots/#2 filter/.@cmd}#1\pgfeov% +}% + +% #3= error for x coord (or empty) +% #4= error for y coord (or empty) +\def\pgfplots@process@one@point#1#2#3#4{% + \pgfplots@prepare@xcoord{#1}% + \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{x}% + \let\pgfplots@current@point@x=\pgfmathresult + % + \pgfplots@prepare@ycoord{#2}% + \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{y}% + \let\pgfplots@current@point@y=\pgfmathresult + % + \ifx\pgfplots@current@point@x\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the x-coordinate filter.}% + \fi + \else + \ifx\pgfplots@current@point@y\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}% + \fi + \else + \ifpgfplots@apply@datatrafo + \ifpgfplots@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 + \pgfplots@datascaletrafo@x\pgfplots@current@point@x + \let\pgfplots@current@point@x=\pgfmathresult + \fi + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@y\pgfplots@current@point@y + \let\pgfplots@current@point@y=\pgfmathresult + \fi + \fi + \fi + % All following routines (limit updating/stacking/error + % bars) will use float numerics if necessary (controlled + % by ifs). + \ifpgfplots@stackedmode + \pgfplots@stacked@preparepoint@inmacro{\pgfplots@current@point@x}{\pgfplots@current@point@y}% + \ifpgfplots@datascaletrafo@initialised% is also true if there is no scale trafo. + \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% + \fi + \fi + \ifpgfplots@autocomputelimits + % update also axis limits: + \pgfplots@update@limits@for@one@point{\pgfplots@current@point@x}{\pgfplots@current@point@y}{}{}% + \fi + \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)}% + \ifpgfplots@collect@firstplot@astick + \ifnum\pgfplots@numplots=0 + \ifx\pgfplots@firstplot@coords@x\pgfutil@empty + \pgfplots@toka=\expandafter{}% + \else + \pgfplots@toka=\expandafter{\pgfplots@firstplot@coords@x,}% + \fi + \edef\pgfplots@firstplot@coords@x{\the\pgfplots@toka\pgfplots@current@point@x}% + \ifx\pgfplots@firstplot@coords@y\pgfutil@empty + \pgfplots@toka=\expandafter{}% + \else + \pgfplots@toka=\expandafter{\pgfplots@firstplot@coords@y,}% + \fi + \edef\pgfplots@firstplot@coords@y{\the\pgfplots@toka\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 + % + % increase \pgfplots@current@point@coordindex: + \begingroup + \c@pgf@counta=\pgfplots@current@point@coordindex + \advance\c@pgf@counta by1\relax + \edef\pgfmathresult{\the\c@pgf@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplots@current@point@coordindex=\pgfmathresult +} + +% Internal stream methods. +% +% Please overwrite \pgfplots@coord@stream@start@, +% \pgfplots@coord@stream@end@ and \pgfplots@coord@stream@coord@ +% if you implement streams. +% +% FIXME: REPLACE THIS HERE WITH METHODS OF THE VISUALIZATION FRAMEWORK +\newif\ifpgfplots@coord@stream@isfirst +\def\pgfplots@coord@stream@start{ + \pgfplots@coord@stream@isfirsttrue + \pgfplots@coord@stream@start@} +\def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@} + +% Will be invoked for every point coordinate. +% +% It invokes \pgfplots@coord@stream@coord@. +% It is expected to assign \pgfplots@current@point@x and +% \pgfplots@current@point@y +% +% It is expected to +% (#1,#2) : x, y coordinates +% (#3,#4) : any x, y errors (or empty) +\def\pgfplots@coord@stream@coord#1#2#3#4{% + \pgfplots@coord@stream@coord@{#1}{#2}{#3}{#4}% + \ifpgfplots@coord@stream@isfirst + \let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x + \let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y + \pgfplots@coord@stream@isfirstfalse + \fi + \let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x + \let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y +}% + +% A looping method which applies +% \pgfplots@coord@stream@start +% for each coordinate '(x,y)' or '(x,y) +- (ex,ey)', call +% \pgfplots@coord@stream@coord{x}{y}{ex}{ey} +% \pgfplots@coord@stream@end +% +% #1 a sequence of coordinates of the form +% '(x,y)' +% or +% '(x,y) +- (ex,ey)' +% separated by white-space. +\long\def\pgfplots@coord@stream@foreach#1{% + \pgfplots@coord@stream@start + \pgfplots@foreach@plot@coord@do% + \pgfplots@coord@stream@coord + \for + plot coordinates {#1};% + \pgfplots@EOI + \pgfplots@coord@stream@end +}% + +% 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 +} + +% Takes a sequence of PREPARED coordinates which are given in floating +% point representation and applies the data scaling trafo. +% +% This stream is designed to be done at the end of an axis. +% See \pgfplots@coord@stream@finalize@storedcoords@START +\def\pgfplots@coord@stream@INIT@finalize@storedcoords#1{% + \def\pgfplots@coord@stream@start@{% + \let\pgfplots@data@scaletrafo@result=\pgfutil@empty + }% + \def\pgfplots@coord@stream@end@{% + \let#1=\pgfplots@data@scaletrafo@result + }% + \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) + ; + }% +}% + +% 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). +% +% 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 + \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 + \fi +}% + +% 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}% + }% + \else + \edef#4{% + \the\pgfplots@toka + \the\pgfplotslist@TOK@a + }% + \fi +}% + +% A looping command to loop through plot coordinates. +% For every point, #1{X}{Y} will be invoked. +% +% No scoping is used during this operation, so you can access outer +% variables. +\long\def\pgfplots@foreach@plot@coord@do#1\for plot coordinates #2;\pgfplots@EOI{% + \def\pgfplots@foreach@plot@coord@do@CMD{#1}% + \pgfplots@foreach@plot@coord@ITERATE#2\pgfplots@EOI% +} + +\def\pgfplots@foreach@plot@coord@ITERATE{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfplots@foreach@plot@coord@FINISH% + }{% + \pgfplots@foreach@plot@coord@NEXT% + }% +} + +\def\pgfplots@foreach@plot@coord@NEXT(#1,#2){% + \pgfutil@ifnextchar+{% + \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE{#1}{#2}% + }{% + \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{}{}% + \pgfplots@foreach@plot@coord@ITERATE + }% +} + +% processing something like '(x,y) +- (error_x,error_y)' +\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE#1#2+-#3({% + \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@{#1}{#2}% +} +\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@#1#2#3,#4){% + \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{#3}{#4}% + \pgfplots@foreach@plot@coord@ITERATE +} + +\def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{} + + +% for use in \ifx: +\def\pgfplots@EOI{\pgfplots@EOI}% + +% #1= x coord +% #2= y coord +% #3= error for x coord (or empty) +% #4= error for y coord (or empty) +\def\pgfplots@apply@data@scaletrafo@to@one@point#1#2#3#4{% + \ifpgfplots@apply@datatrafo@x + \pgfplots@datascaletrafo@x{#1}% + \let\pgfplots@current@point@x=\pgfmathresult + \else + \def\pgfplots@current@point@x{#1}% + \fi + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@y{#2}% + \let\pgfplots@current@point@y=\pgfmathresult + \else + \def\pgfplots@current@point@y{#2}% + \fi + \ifpgfplots@stackedmode + % all these calls work with pgfmath; no more floating point + % arithmetics are applied. + \pgfplots@stacked@getnextzerolevelpoint + \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% + \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% + \fi + \pgfplots@toka=\expandafter{\pgfplots@data@scaletrafo@result}% + \edef\pgfplots@data@scaletrafo@result{\the\pgfplots@toka(\pgfplots@current@point@x,\pgfplots@current@point@y)}% +} + +% This thing here shall draw all error bar commands listed in '#2'. +% +% It will be invoked when any plotting commands take effect (that +% means all limits are computed; the axis has been drawn, +% transformations are set up...) +\def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{% + \scope[%/pgfplots/search path for tikz/.cd, + #1,/pgfplots/every error bar]% + #2% + \endscope +} + +\def\pgfplots@errorbar@draw@float(#1,#2)(#3,#4){% + \ifpgfplots@apply@datatrafo@x + \pgfplots@datascaletrafo@x{#1}% + \let\pgfplots@xarg=\pgfmathresult% + \pgfplots@datascaletrafo@x{#3}% + \let\pgfplots@error@xarg=\pgfmathresult% + \else + \def\pgfplots@xarg{#1}% + \def\pgfplots@error@xarg{#3}% + \fi + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@y{#2}% + \let\pgfplots@yarg=\pgfmathresult% + \pgfplots@datascaletrafo@y{#4}% + \let\pgfplots@error@yarg=\pgfmathresult% + \else + \def\pgfplots@yarg{#2}% + \def\pgfplots@error@yarg{#4}% + \fi + \edef\pgfplots@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 +} + +\def\pgfplots@errorbar@draw#1#2{% + \begingroup + \ifpgfplots@apply@datatrafo + \pgfplots@errorbar@draw@float#1#2 + \else + \pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov% + \fi + \endgroup +}% + +% Also provides UNFILTERED arguments x (#5) and y (#6). These are use +% in case of logplots, because we may need to compute log( x + e_x ) +% or log( y + e_y ). +\def\pgfplots@process@errorbar@for#1#2#3#4#5#6{% +% \begingroup + \edef\pgfplots@xarg{#1}% + \edef\pgfplots@yarg{#2}% + \def\pgfplots@xarg@unfiltered{#5}% + \def\pgfplots@yarg@unfiltered{#6}% + \edef\pgfplots@error@xarg{#3}% + \edef\pgfplots@error@yarg{#4}% + \def\pgfplots@TMP{0}% + \ifx\pgfplots@TMP\pgfplots@error@xarg + \let\pgfplots@error@xarg=\pgfutil@empty + \fi + \ifx\pgfplots@TMP\pgfplots@error@yarg + \let\pgfplots@error@yarg=\pgfutil@empty + \fi + % FIXME : INEFFICIENT! This code here does every computation + % multiple times! + \ifcase\pgfplots@errorbars@xdirection + \or + \pgfplots@process@errorbar@@for{x}{+}1% + \or + \pgfplots@process@errorbar@@for{x}{-}2% + \or + \pgfplots@process@errorbar@@for{x}{+}1% + \pgfplots@process@errorbar@@for{x}{-}2% + \fi + \ifcase\pgfplots@errorbars@ydirection + \or + \pgfplots@process@errorbar@@for{y}{+}1% + \or + \pgfplots@process@errorbar@@for{y}{-}2% + \or + \pgfplots@process@errorbar@@for{y}{+}1% + \pgfplots@process@errorbar@@for{y}{-}2% + \fi +% \endgroup +} + +% #1: either 'x' or 'y' +% #2: either '+' or '-' +% #3: an integer representing the argument #2. It is '1' if #2='+' +% and '2' is #2 = '-'. +\def\pgfplots@process@errorbar@@for#1#2#3{% + \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 + \else + \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% + \pgfmathparse{\pgfplots@error@src#2 \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 + \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 + \else + \pgfmathparse{\pgfplots@error@src#2 \pgfplots@error@coord}% + \fi + \let\pgfplots@error@coord=\pgfmathresult + \fi + \or% explicit relative: + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \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 + \let\pgfplots@error@coord=\pgfmathresult + \fi + \fi + \else + % LOGARITHMIC scaling. All errors are interpreted as + % log(x +- e_x) + % or + % log( x*(1+-e_x) ) + \ifcase\csname pgfplots@errorbars@#1mode\endcsname + % fixed absolute, log( x +- e_x ) + \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@error@src}% + \let\pgfplots@error@src=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \pgfmathlog@float{\pgfmathresult}% + \let\pgfplots@error@coord=\pgfmathresult + \or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x) + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \pgfmathparse{\pgfplots@error@src + ln(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% + \let\pgfplots@error@coord=\pgfmathresult% + \or% explicit absolute + \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@error@src}% + \let\pgfplots@error@src=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \pgfmathlog@float{\pgfmathresult}% + \let\pgfplots@error@coord=\pgfmathresult + \fi + \or% explicit relative: + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathparse{\pgfplots@error@src + ln(1#2 \pgfplots@error@coord)}% + \let\pgfplots@error@coord=\pgfmathresult% + \fi + \fi + \fi + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \def\pgfplots@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{% + {(\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@xarg,\pgfplots@yarg)}% + {(\pgfplots@xarg,\pgfplots@error@coord)}% + }% + \fi + \expandafter\pgfplots@streamerrorbarcoords\pgfplots@TMP + \fi +} + +\long\def\pgfplots@path#1;{% + \pgfplots@path@enqueue{#1;}% +} + +% This thing here shall be used to replace any '\path' where \axispath +% shall be used. +\long\def\pgfplots@replacement@for@tikz@path#1;{% + \axispath\path#1;% +} + + +% Will be available as \closedcycle command inside of an axis. +% +% It closes the current plot by drawing lines to the last "zero +% level". +% +% That means the current plot is connected orthogonally with the +% x-axis, allowing fill commands. +% +% For stacked plots, \closedcycle is special (it connects with the +% previous \addplot command). +% +% Example: +% \addplot coordinates {(3,0.5) (4,2) (5,1)} \closedcycle; +\def\pgfplots@path@closed@cycle{% + \ifpgfplots@stackedmode + \pgfplots@stacked@path@closed@cycle + \else + \pgfplots@path@closed@cycle@std + \fi +} +\def\pgfplots@path@closed@cycle@std{% + |- (perpendicular cs: + vertical line through={(current plot begin)}, + horizontal line through={(\pgfplots@ZERO@x,\pgfplots@ZERO@y)}) + -- cycle +}% + +% Remembers the plotting command #2 and '#3=plot coordinates {...} ...'; +% for later postprocessing of the coordinates. +% +% #1: commands which should be executed before issueing the plotting +% command #2 #3. +% #2: +% the command which is responsable for drawing. +% - If #2 is NOT '\pgfutil@empty', we expect #3 to contain only +% EXPANDABLE DATA. +% That's important for postponed floating point arithmetics in #3. +% - If #2='\pgfutil@empty', we don't make any assumption about #3 +% and process it as-is. +% +% #3: see above. +% +% #4: commands which should be executed after '#2 #3'. +% +\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 + \else + \begingroup + #1#2#3#4% + \endgroup + \fi +} + +% The same as \pgfplots@path@enqueue@coords, but this here also stores +% \pgfplots@addplot@nonlegend@options +\long\def\pgfplots@addplot@enqueue@coords#1#2#3#4{% + \ifpgfplots@draw@at@end + \ifx\pgfplots@addplot@nonlegend@options\pgfutil@empty + \pgfplots@path@enqueue@coords{#1}{#2}{#3}{#4}% + \else + \expandafter + \pgfplots@path@enqueue@coords + \expandafter{% + \expandafter\tikzset\expandafter{\pgfplots@addplot@nonlegend@options}% + #1}{#2}{#3}{#4}% + \fi + \else + \pgfplots@path@enqueue@coords{#1}{#2}{#3}{#4}% + \fi +} + + +% Remembers the plotting command #1. +\long\def\pgfplots@path@enqueue#1{% + \pgfplots@path@enqueue@coords{}{}{#1}{}% +} + + +% Assigns a legend. +% Syntax: +% \legend{entry 1\\entry2\\entry3} +\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 + }% +} + +\def\pgfplots@command@legend@impl#1{% + \pgfplots@assign@list\pgfplots@TMPC{#1}% + \global\let\pgfplots@legend=\pgfplots@TMPC +} + + +\def\pgfplots@addlegendentry{% + \pgfutil@ifnextchar[{% + \pgfplots@addlegendentry@opts + }{% + \pgfplots@addlegendentry@opts[]% + }% +} +\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 + }% +} + +\def\pgfplots@pop@next@legend{{% + \globaldefs=1 + \pgfplotslistcheckempty\pgfplots@plotspeclist + \ifpgfplotslistempty + \let\pgfplots@curplotlist=\pgfutil@empty + \else + \pgfplotslistpopfront\pgfplots@plotspeclist\to\pgfplots@curplotlist + \fi + % + \pgfplotslistcheckempty\pgfplots@legend + \ifpgfplotslistempty + \let\pgfplots@curlegend=\pgfutil@empty + \else + \pgfplotslistpopfront\pgfplots@legend\to\pgfplots@curlegend + \fi + \advance\pgfplots@numplots by-1 +}} + +% This routine is called at the begin of every plot. +% It initialised a zero level stream. +% +% The default is to use '0' as zero level streams. +% +% This method is called as "precommand"; before any Tikz drawing +% commands have been started. +\def\pgfplots@initzerolevelhandler{% + \ifpgfplots@stackedmode + % ATTENTION: this thing here says: + % "draw zero level coordinates from list XYZ." + % But at the time of this initialisation, the list will be EMPTY! + % + % It will be filled later. That's ok, because + % \pgfplots@initzerolevelhandler will be + % used as 'precommand', that means before Tikz sees any + % coordinates. + \pgfplots@stacked@initzerolevelhandler + \else + \pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}% + \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% + \fi +} + +\def\pgfplots@try@mirror@plot@handler{% + \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 + \fi + }% +} + +\long\def\pgfplots@show@small@legendplots#1#2{ + \begingroup + \def\pgfplots@TMPB{#1}% + \ifx\pgfplots@TMPB\pgfutil@empty + \else + \pgfqkeys{/pgfplots/search path for tikz}{#1}% + \fi + \pgfkeysvalueof{/pgfplots/legend image code/.@cmd}#2\pgfeov + \endgroup +} + +\def\pgfplots@split@opts{% + \pgfutil@ifnextchar[{% + \pgfplots@split@opts@opts + }{% + \pgfplots@split@opts@opts[]% + }% +} +\def\pgfplots@split@opts@opts[#1]#2\pgfplots@result@to#3#4{% + \def#3{#2}% + \def#4{#1}% +} + +% Typesets a legend node. +% +% It will either typeset a previously computed legend (which needs to be +% stored in the macro \pgfplots@already@computed@legend@node) +% +% or it creates a legend, stores the commands into the macro named +% above and typesets it. +\def\pgfplots@createlegend{% + \ifx\pgfplots@already@computed@legend@node\pgfutil@empty + \pgfplotslistcheckempty\pgfplots@legend + \ifpgfplotslistempty + \else + % + % + \begingroup + % assemble a + % \matrix { + % small plot & legend1\\ + % small plot & legend2\\ + % ... + % }; + % command [and using the 'legend columns' option] + % + % \pgfplotslist@TOK@a={ + % small plot & legend1\\ + % small plot & legend2\\ + % ... + % } + % ( I have allocated the token registers in my + % liststructure.sty) + % + % \global\def\pgfplots@TMP{ + % \matrix { + % \TOKL@TA + % }; + % } + % -> finally, \pgfplots@TMP will contain the complete command. + \pgfplotslist@TOK@a={}% + \let\curcolumnNum=\c@pgf@counta + \let\maxcolumnCount=\c@pgf@countb + \let\legendplotpos=\c@pgf@countc + \legendplotpos\expandafter=\pgfplots@legend@plot@pos + \curcolumnNum=0 + \maxcolumnCount=\pgfplots@legend@columns\relax + % + \loop + \ifnum0<\pgfplots@numplots\relax + \pgfplots@pop@next@legend + \ifx\pgfplots@curlegend\pgfutil@empty + \else + \advance\curcolumnNum by1 + \begingroup + \expandafter\pgfplots@split@opts\pgfplots@curlegend\pgfplots@result@to{\pgfplots@curlegend}{\pgfplots@curlegend@opts}% + \ifcase\legendplotpos + % legend plot pos=left + \pgfplotslist@TOK@b=\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}% + \pgfmatrixnextcell\node}% + \pgfplotslist@TOK@b=\expandafter\expandafter\expandafter{% + \expandafter\the\expandafter\pgfplotslist@TOK@b + \expandafter{\pgfplots@curlegend};}% + \or + % legend plot pos=right + \pgfplotslist@TOK@b=\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}}% + \or + % legend plot pos=none + \pgfplotslist@TOK@b=\expandafter{\expandafter\node\expandafter{\pgfplots@curlegend};}% + \fi + \ifnum\curcolumnNum=\maxcolumnCount + \pgfplotslist@TOK@b=\expandafter{\the\pgfplotslist@TOK@b\\}% + \else + \ifnum\pgfplots@numplots=0 + \pgfplotslist@TOK@b=\expandafter{\the\pgfplotslist@TOK@b\\}% + \else + \pgfplotslist@TOK@b=\expandafter{\the\pgfplotslist@TOK@b\pgfmatrixnextcell}% + \fi + \fi + \xdef\pgfplots@TMP{% + \the\pgfplotslist@TOK@a + \the\pgfplotslist@TOK@b + }% + \endgroup + \ifnum\curcolumnNum=\maxcolumnCount + \curcolumnNum=0 + \fi + \expandafter\pgfplotslist@TOK@a\expandafter{\pgfplots@TMP}% + \fi + \repeat + \pgfplotslist@TOK@b={\matrix[/pgfplots/every axis legend]}% + \xdef\pgfplots@TMP{% + \noexpand\def\noexpand\plotnum{0}% + \the\pgfplotslist@TOK@b {% + \the\pgfplotslist@TOK@a + };% + }% + \endgroup + \let\pgfplots@already@computed@legend@node=\pgfplots@TMP + \fi + \fi +%\pgfplots@message{Vor legende: \meaning\pgfplots@already@computed@legend@node}% + \pgfplots@already@computed@legend@node +} + +\newif\ifpgfplots@checkuniform@isfirst +% Checks whether the argument to xtick or ytick is a UNIFORM tick +% sequence. +% +% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but +% NOT 0,2,4 or 4,10. +% +% Furthermore, any NON-integer tick arguments are also assumed to be +% NOT uniform. +% +% INPUT: +% #1: a tick argument (i.e. something which can be put to +% \foreach \x in {#1}) +% +% OUTPUT: +% \pgfplots@isuniformticktrue +% or +% \pgfplots@isuniformtickfalse +% depending on the check. +% This variable will be set globally. +\def\pgfplots@checkisuniformLOGtick#1{% + \begingroup + \global\pgfplots@isuniformticktrue + \pgfplots@checkuniform@isfirsttrue + \foreach \x in {#1}{% + \pgfmathmultiply@\x\reciproclogten + \let\cur=\pgfmathresult + % check whether + % \cur - last == 1 (last = \pgfplots@TMPB) + \ifpgfplots@checkuniform@isfirst + \global\pgfplots@checkuniform@isfirstfalse + \else + \pgfmathsubtract@\cur\pgfplots@TMPB% + \pgfmathapproxequalto@\pgfmathresult{1.0}% + \ifpgfmathcomparison + \else + \global\pgfplots@isuniformtickfalse + \breakforeach + \fi + \fi + \global\let\pgfplots@TMPB=\cur + }% + \endgroup +} + +% Checks whether the linear tick sequence #1 is a uniform tick. +% +% It also assigns pgfplots@tick@distance@#1 as the distance. +% +% see \pgfplots@checkisuniformLOGtick for details. +\def\pgfplots@checkisuniformLINEARtick#1{% + \begingroup + \global\pgfplots@isuniformticktrue + \pgfplots@checkuniform@isfirsttrue + \global\let\pgfplots@TMPB=\pgfutil@empty + \global\let\pgfplots@TMP=\relax + \foreach \x in {#1}{% + \ifx\pgfplots@TMPB\pgfutil@empty + \else + \pgfmathsubtract@\x\pgfplots@TMPB + \ifpgfplots@checkuniform@isfirst + % remember first distance h = x_1 - x_0 + \global\let\pgfplots@TMP=\pgfmathresult + \global\pgfplots@checkuniform@isfirstfalse + \else + % check whether x_i - x_{i-1} = h + \pgfmathapproxequalto@\pgfmathresult\pgfplots@TMP% + \ifpgfmathcomparison + \else + \global\pgfplots@isuniformtickfalse + \breakforeach + \fi + \fi + \fi + \global\let\pgfplots@TMPB=\x% + }% + \endgroup + \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@TMP +} + +\def\skipsuffixzero#1.#2|{ + {% + \def\pgfplots@TMP{#2}% + \def\pgfplots@TMPB{0}% + \ifx\pgfplots@TMP\pgfplots@TMPB + \global\def\pgfmathresult{#1}% + \else + \global\def\pgfmathresult{#1.#2}% + \fi + }% +} + +\def\pgfmathlogtologten#1{% + \pgfmathparse{#1}% + \expandafter\pgfmathlogtologten@\expandafter{\pgfmathresult}% +} + +% Simply divides #1 by log(10). +\def\pgfmathlogtologten@#1{% + \pgfmathmultiply@{#1}\reciproclogten% +}% + +% DEPRECATED. +\def\logtologtentomacro#1#2{% + \pgfmathmultiply@{#1}\reciproclogten% + \expandafter\skipsuffixzero\pgfmathresult|% + \let#2=\pgfmathresult +} + +% DEPRECATED. +\def\logtologten#1{% + \pgfmathmultiply@{#1}\reciproclogten% + \expandafter\skipsuffixzero\pgfmathresult|% + \pgfmathresult +} + +% helper method which computes log10*\x foreach \x in {#1}. +% The result will be \xdef'ed into #2. +\def\pgfplots@compute@tick@times@logten#1\to#2{% + \global\let#2=\pgfutil@empty + \foreach \pgfplots@TMPB in {#1} {% + \pgfmathmultiply@\pgfplots@TMPB\logten% + \ifx#2\pgfutil@empty + \xdef#2{\pgfmathresult}% + \else + \xdef#2{#2,\pgfmathresult}% + \fi + }% +} + +\def\pgfplots@init@enlarge@limit@booleans{% + \pgfplots@enlargelimits@autofalse + \pgfplots@enlargelimitsfalse + \pgfplots@enlargelimits@rel@threshfalse + \edef\pgfplots@TMP{\pgfplots@enlargelimits}% + % + \def\pgfplots@TMPB{true}% + \ifx\pgfplots@TMP\pgfplots@TMPB + \pgfplots@enlargelimitstrue + \else + \def\pgfplots@TMPB{false}% + \ifx\pgfplots@TMP\pgfplots@TMPB + \else + \def\pgfplots@TMPB{auto}% + \ifx\pgfplots@TMP\pgfplots@TMPB + \pgfplots@enlargelimits@autotrue + \else + \begingroup + % try to read it as number: + \expandafter\pgf@xa\pgfplots@enlargelimits pt\relax + \endgroup + \pgfplots@enlargelimitstrue + \pgfplots@enlargelimits@rel@threshtrue + \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 + \ifpgfplots@enlargelimits@rel@thresh + \edef\enlargepercent{\pgfplots@enlargelimits}% + \else + \def\enlargepercent{0.1}% FIXME : pack 10% as default into option 'enlargelimits' or so + \fi + \pgfmathsubtract@\max\min% + \pgf@xa\pgfmathresult pt + \pgf@xb\enlargepercent\pgf@xa + \ifdim\pgf@xb>0.001pt + % the case with + % enlargeabsolute ~= 0 + % means that \min ~= \max. + % It is handled in another method. + \edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}% + % + % compute xmin := xmin - enlargeabsolute + \pgfmathsubtract@\min\enlargeabsolute% + \let\min=\pgfmathresult + \pgfmathadd@\max\enlargeabsolute% + \let\max=\pgfmathresult + \fi + \xdef\pgfplots@TMP{\min}% + \xdef\pgfplots@TMPB{\max}% + \endgroup + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@TMP + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@TMPB +} + +% Computes tick positions using the current axis limits. +% +% Parameters: +% /pgfplots/max space between ticks +% Determines the maximum space which is not filled by at least one +% tick label (approximate, there is some rounding internally) +% /pgfplots/try min ticks +% see manual +% +% Idea: +% We want ticks at each +% { i*H, i in \Z }. +% Of course, there shouldn't be TOO MUCH ticks. +% +% Our heuristics is to set +% desirednumticks = round(ACTUAL WIDTH / (max space between ticks) ) +% and generate H = (axis range) / (desirednumticks). +% +% Since not all step sizes H look well, restrict H to a set of allowed +% step sizes such as +% { 1, 1/2, 1/5, 1/10 }, +% or, to be more precise: +% { 1*10^e, 2*10^e, 5*10^e } +% -> round to the nearest matching number! +% +% For log-plots, +% H in { j*log(10), j=1,2,3,... } +% where the usual case should be j = 1. +% +% Then, the resulting tick is +% TICK={MIN,MIN+H,...,MAX} +% where +% MIN = I*H +% is chosen such that +% axis minimum limit = I*H + rest; |rest| < H. +% +% Again, log plots follow a slightly different approach: here, +% MIN = I * log(10) +% is chosen such that +% axis minimum limit = I*log(10) + rest; |rest| < log(10) +% while H = j*log(10), j>=1. +% +% +% PRECONDITION: +% - limits are correct +% - axis width/height is set correctly +% +% POSTCONDITION: +% - Tick for axis #1 is assigned +% - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick is set +% +% REMARKS: +% - this algorithms works also if the data range has been transformed +% with a LINEAR transformation. +% ATTENTION: as of 2008-05-15, the scaling trafo is AFFINE LINEAR. +% That means we have to eliminate the 'affine' shifting before the +% algorithms works correctly. +\def\pgfplots@assign@default@tick@foraxis#1{% + \begingroup + % Shortcut-names: + \expandafter\let\expandafter\ifpgfplots@is@datascaled\csname ifpgfplots@apply@datatrafo@#1\endcsname + % Attention here: use UNSHIFTET scalings, see remark above + \expandafter\let\expandafter\pgfplots@data@scale@trafo\csname pgfplots@datascaletrafo@#1@noshift\endcsname + \expandafter\let\expandafter\pgfplots@data@scale@inverse@trafo\csname pgfplots@inverse@datascaletrafo@#1@noshift\endcsname + \expandafter\let\expandafter\ifpgfplots@cur@is@linear\csname ifpgfplots@#1islinear\endcsname + % + \let\desirednumticks=\c@pgf@countd + \let\Wr=\pgf@xc + \Wr=\csname pgfplots@#1coordmaxTEX\endcsname + \advance\Wr by-\csname pgfplots@#1coordminTEX\endcsname + % r = max place without ticks in pt -> choose desirednumticks >= W/r + \expandafter\expandafter\divide\Wr\axisdefaulttickwidth + \pgfmathsetcount{\desirednumticks}{\Wr}% + \advance\desirednumticks by1 + \csname ifpgfplots@#1islinear\endcsname + \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks + \expandafter\desirednumticks\axisdefaulttryminticks + \fi + \else + \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks + \expandafter\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 + \fi + \fi + % + \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty + % Ok, we have either log or linear axis and need default + % ticks MIN,MIN+H,...,MAX. + \let\MINH=\pgf@xa + \let\H=\pgf@xb + \let\MAX=\pgfplots@tmpa + \let\MIN=\pgfplots@tmpb + % compute step size 'H': + \expandafter\MAX\csname pgfplots@#1max\endcsname pt + \advance\MAX by0.001pt% avoid round errors + %\expandafter\MIN\the\c@pgf@counta pt + \expandafter\MIN\csname pgfplots@#1min\endcsname pt + \H=\MAX + \advance\H by-\MIN + \c@pgf@counta=\desirednumticks + \advance\c@pgf@counta by-1 + \divide\H by\c@pgf@counta +%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% + % + % SEARCH for the NEXT FEASABLE H. + \edef\Hmacro{\pgf@sys@tonumber\H}% + \ifpgfplots@cur@is@linear + % CASE LINEAR AXIS + \ifpgfplots@is@datascaled + % This here works if the scaling trafo is linear. + \expandafter\pgfplots@data@scale@inverse@trafo\expandafter{\Hmacro}% + \let\Hmacro=\pgfmathresult + \else + \pgfmathfloatparsenumber{\Hmacro}% + \let\Hmacro=\pgfmathresult + \fi + \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E +%\message{Got T^{-1}(H#1) = \Hmacro}% + % modify the mantisse: + \ifdim\H<2pt + \ifdim\H<1.5pt + \H=1.0pt + \else + \H=2.0pt + \fi + \else + \ifdim\H<4.9999pt + \ifdim\H<3.5pt + \H=2.0pt\relax + \else + \H=5.0pt\relax + \fi + \else + \ifdim\H<7.5pt + \H=5.0pt\relax + \else + \H=1.0pt\relax + \advance\pgfmathfloat@a@E by1 + \fi + \fi + \fi +%\message{Computed H#1=\the\H [unscaled]; transforming ... }% + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% + \let\Hmacro=\pgfmathresult + \ifpgfplots@is@datascaled + \pgfplots@data@scale@trafo\Hmacro + \else + \pgfmathfloattofixed\Hmacro + \fi + \let\Hmacro=\pgfmathresult +%\message{got H#1=\Hmacro\ [transformed]}% + \expandafter\H\Hmacro pt + \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname + % + % Now, we want to activate the Tick set {i*H, i in \Z} + % compute I such that + % xmin = I * H + rest; |rest| < H + % -> I = round(xmin/H) + % -> MIN = I * H + % + % but first: eliminate any 'affine' data scaling! + \ifpgfplots@is@datascaled + \advance\MIN by\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt + \fi + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber\MIN}% + {\pgf@sys@tonumber\H}% + }% + \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% + \ifdim\MIN<0pt + % the truncation rounds TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \MIN=\H + \multiply\MIN by\c@pgf@counta + \ifpgfplots@is@datascaled + \advance\MIN by-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt + \fi + \else + % CASE LOG AXIS + % + % search for the "best" H= j* log(10), j an integer. + % + % And prefer j=1 if that is possible (otherwise minor + % ticks are not useful). + \pgfmathmultiply@{\Hmacro}{\reciproclogten}% + \expandafter\H\pgfmathresult pt +%\message{ [ H / log(10) = \pgfmathresult}% + \ifdim\H<2pt + \H=1pt + \else + \ifnum\H<1pt + \H=1pt + \else + \expandafter\pgfmathfloor\expandafter{\pgfmathresult}% + \expandafter\H\pgfmathresult pt + \fi + \fi + \ifdim\H=1pt + \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname + \pgfplots@isuniformticktrue + \else + \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformfalse\endcsname + \pgfplots@isuniformtickfalse + \fi +%\message{final H=\pgf@sys@tonumber{\H} * log(10)}% + \H=\logten\H\relax + % Now, we want to activate the Tick set + % {lowest, lowest+H, ..., highest} + % + % Where + % lowest = I * log(10) + rest, |rest| < log(10). + % this is conceptionally different from the approach for + % linear axes, because H = j*log(10). + % + % remember the original xmin in MINH: + \MINH=\MIN + % + % and compute I and I*log(10) here: + \expandafter\MIN\reciproclogten\MIN\relax + \edef\pgfmathresult{\pgf@sys@tonumber{\MIN}}% + \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% + \ifdim\MIN<0pt + % the truncation rounds TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \expandafter\MIN\logten pt + \multiply\MIN by\c@pgf@counta + \ifpgfplots@isuniformtick + \else + % This here is a special case to move the first tick + % near the lower axis limit. + % + % "Near" means either directly above or directly below ymin. + % + % My application example is as follows: + % Let H = 2*log(10). + % Furthermore, ymin = 3e-6, ymax= 8e-2. That means we can choose either + % 10^{-5}, 10^{-3}, 10^{-1} + % or + % 10^{-4}, 10^{-2} + % as ticks. Well, I prefer the first one. + % + % HEURISTICS: start as near to ymin as possible! + % + % We check here if we can come nearer to ymin if we + % shift the current tick by log(10): + % if( ymin - I * log(10) < 0.5*H -> use I+1, that means add log(10). + % + % that's equivalent to + % 2*(ymin - I * log(10)) - H < 0. + \advance\MINH by-\MIN + \multiply\MINH by2 + \advance\MINH by-\H + % + \ifdim\MINH<0pt + \expandafter\advance\expandafter\MIN\logten pt + \fi + \fi + \fi + \MINH=\MIN + \advance\MINH by\H +%\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}}% + \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformtickfalse + \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].}% +} + +% Helper method for +% \pgfplots@apply@data@scale@trafo@to@options@for +% #1: the ticks +% #2: the trafo macro name +% #3: the output macro name +\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% + \let#3=\pgfutil@empty + \foreach \pgfplots@TMPB in {#1} {% + \pgfmathfloatparsenumber{\pgfplots@TMPB}% + \expandafter#2\expandafter{\pgfmathresult}% + \ifx#3\pgfutil@empty + \xdef#3{\pgfmathresult}% + \else + \xdef#3{#3,\pgfmathresult}% + \fi + }% + % +}% + +% Helper method for +% \pgfplots@apply@data@scale@trafo@to@options@for +% #1: the ticks ALREADY IN FLOAT FORMAT +% #2: the trafo macro name +% #3: the output macro name +\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat#1#2\to#3{% + \let#3=\pgfutil@empty + \foreach \pgfplots@TMPB in {#1} {% + #2{\pgfplots@TMPB}% + \ifx#3\pgfutil@empty + \xdef#3{\pgfmathresult}% + \else + \xdef#3{#3,\pgfmathresult}% + \fi + }% + % +}% + +% 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}% + \expandafter\pgfmathfloat@decompose@E\pgfmathresult\relax#2 + \advance#2 by1 +} + +% 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 +} + +% Initialises the data scale transformation and applies it to any +% user specified options. +% +% PRECONDITION: +% - all axis limits are available in float representation +% - \pgfplots@set@default@size@options has been called before +% POSTCONDITION: +% - the scaling transformation is set up, +% - all axis limits are transformed, +% - any user input (like ticks and tick labels) +% will reflect the changes. +\def\pgfplots@apply@data@scale@trafo@to@options@for#1{% + % initialise data scale transformation + % T(x) = 10^{q-m} * x + % + \begingroup + \let\data@max@order=\c@pgf@counta + \let\data@cur@order=\c@pgf@countb + \let\data@dimen=\pgf@xa + \let\data@tmp=\pgf@xb + \let\data@dimen@order=\c@pgf@countc + \let\data@EXPONENT=\c@pgf@countd + \expandafter\let\expandafter\pgfplots@min@float\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@max@float\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname + % + % Step 1: compute 'm', the data order + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@min@float + \tocount\data@cur@order + % + \data@max@order=\data@cur@order + % + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@max@float + \tocount\data@cur@order + % + \ifnum\data@cur@order>\data@max@order + \data@max@order=\data@cur@order + \fi + % + % Step 2: compute 'q', the #1-size of the axis. + \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + % We have 'width' or 'height'. + % + % Use the order of these parameters. + \def\pgfplots@TMP{#1}% + \def\pgfplots@TMPB{x}% + \ifx\pgfplots@TMP\pgfplots@TMPB + \expandafter\data@dimen\pgfplots@width\relax + \else + \def\pgfplots@TMPB{y}% + \ifx\pgfplots@TMP\pgfplots@TMPB + \expandafter\data@dimen\pgfplots@height\relax + \fi + \fi + \pgfplots@compute@number@order@for@trafo@isdimen + \data@dimen + \tocount\data@dimen@order + % This here is to avoid inaccuracies in the final + % axis rectangle size, see \pgfplots@initsizes: + %\advance\data@dimen@order by-1 + \else + % FIXME: + % we have either the 'x=1cm' or 'y=1cm' option! + % How should I initialise the trafo!? + \data@dimen@order=3 + \fi + % +%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% + \data@EXPONENT=\data@dimen@order + \advance\data@EXPONENT by-\data@max@order + % Now, I introduce a loop which shall avoid cancellation of + % significant digits. + % + % Harmless Example: + % if we have data shift = -3 and + % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. + % In this case, the loop won't change anything. + % + % Critical Example: + % if we have data shift = -3 and + % max = 1980, min = 1930 then + % T(max) = 1.98 and T(min) = 1.93 + % and thus T(max)-T(min) = 0.05 . + % Considering that this is the axis range + % in which tick labels and plot points need to be computed, we + % only have two or three digits left! That happens because the + % prefix '19' is common and is cancelled in the subtraction. + % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 + % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). + % + \pgfplots@loop@CONTINUEtrue + \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \loop + \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% + \pgfplots@actual@trafo{\pgfplots@min@float}% + \let\pgfplots@min@fixed=\pgfmathresult + \ifpgfplots@loop@CONTINUE + \pgfplots@actual@trafo{\pgfplots@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...}% + \ifdim\data@tmp<0pt + % I need absolute values here: + \multiply\data@tmp by-1\relax + \fi + \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 + \advance\data@EXPONENT by1 + \pgfplots@loop@CONTINUEtrue + \fi + \fi + \fi + \repeat + \xdef\pgfplots@TMP{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% + \xdef\pgfplots@TMPB{\pgfplots@min@fixed}% + \endgroup +%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@TMP*#1 - \pgfplots@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% + % + % ... and apply transformation to any user input + % + % Transform axis limits: +%\message{#1-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]}% + % + % Convert any user-specified ticks: + \edef\pgfplots@TMP{\csname pgfplots@#1tick\endcsname}% + % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. + \ifx\pgfplots@TMP\pgfutil@empty + \else + \pgfplots@toka=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% + \def\pgfplots@TMPB{data}% + \ifx\pgfplots@TMP\pgfplots@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 + \else + \pgfplotslist@TOK@a=\expandafter{\pgfplots@TMP}% +%\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 + \fi + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@TMPC + \fi + % + % Convert any extra-ticks, see above. + \edef\pgfplots@TMP{\csname pgfplots@extra@#1tick\endcsname}% + \ifx\pgfplots@TMP\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 + \fi + % + % Transform any explicit axis unit scalings: + \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + \else +%\message{Converting #1 unit scale='\csname pgfplots@#1\endcsname' ... }% + \expandafter\pgfmathparse\expandafter{\csname pgfplots@#1\endcsname}% + \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% + \expandafter\edef\csname pgfplots@#1\endcsname{\pgfmathresult pt}% +%\message{to #1='\csname pgfplots@#1\endcsname'.}% + \fi +} + +\newif\ifpgfplots@determinedefaultvalues@xisuniform +\newif\ifpgfplots@determinedefaultvalues@yisuniform +\newif\ifpgfplots@determinedefaultvalues@needs@check@uniformtick + +\def\pgfplots@determinedefaultvalues{% + \ifpgfplots@limits@are@computed + \else + % EMPTY AXIS: + \pgfplots@warning{WARNING: You have a plot with empty range. This may produce errors!}% + \fi + % + \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 + \let\pgfplots@xtick=\pgfplots@firstplot@coords@x + \fi + \let\pgfplots@xmin@unscaled@as@float=\pgfutil@empty + \let\pgfplots@xmax@unscaled@as@float=\pgfutil@empty + \fi + \ifpgfplots@apply@datatrafo@y + \let\pgfplots@ymin@unscaled@as@float=\pgfplots@ymin + \let\pgfplots@ymax@unscaled@as@float=\pgfplots@ymax + \pgfplots@apply@data@scale@trafo@to@options@for y% + \else + \def\pgfplots@TMPB{data}% + \ifx\pgfplots@ytick\pgfplots@TMPB + \let\pgfplots@ytick=\pgfplots@firstplot@coords@y + \fi + \let\pgfplots@ymin@unscaled@as@float=\pgfutil@empty + \let\pgfplots@ymax@unscaled@as@float=\pgfutil@empty + \fi + \pgfplots@datascaletrafo@initialisedtrue + % + % From now on, we can always work with pgfmath. + % We simply need to apply the data scaling trafo before doing so. + \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 + \ifnum\pgfplots@minor@xtick@num=0\relax + \pgfplots@xminorticksfalse + \pgfplots@xminorgridsfalse + \else + \pgfplots@xminortickstrue + \fi + \fi + \ifpgfplots@yislinear + \ifnum\pgfplots@minor@ytick@num=0\relax + \pgfplots@yminorticksfalse + \pgfplots@yminorgridsfalse + \else + \pgfplots@yminortickstrue + \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@avoid@empty@axis@range@for x% + \pgfplots@avoid@empty@axis@range@for y% + % + \pgfplots@initsizes + % + \pgfplots@determinedefaultvalues@xisuniformtrue + \pgfplots@determinedefaultvalues@yisuniformtrue + \pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \ifx\pgfplots@xtick\pgfutil@empty + \pgfplots@assign@default@tick@foraxis{x}% + \fi + \ifpgfplots@determinedefaultvalues@needs@check@uniformtick + \ifpgfplots@xislinear + \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@xtick}% + \ifpgfplots@isuniformtick + \pgfplots@determinedefaultvalues@xisuniformtrue + \else + \pgfplots@determinedefaultvalues@xisuniformfalse + \fi + \else + \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@xtick}% + \ifpgfplots@isuniformtick + \pgfplots@determinedefaultvalues@xisuniformtrue + \else + \pgfplots@determinedefaultvalues@xisuniformfalse + \fi + \fi + \fi + \ifpgfplots@determinedefaultvalues@xisuniform + \else + \pgfplots@xminorticksfalse + \fi + % + % + % + \pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \ifx\pgfplots@ytick\pgfutil@empty + \pgfplots@assign@default@tick@foraxis{y}% + \fi + \ifpgfplots@determinedefaultvalues@needs@check@uniformtick + \ifpgfplots@yislinear + \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ytick}% + \ifpgfplots@isuniformtick + \pgfplots@determinedefaultvalues@yisuniformtrue + \else + \pgfplots@determinedefaultvalues@yisuniformfalse + \fi + \else + \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ytick}% + \ifpgfplots@isuniformtick + \pgfplots@determinedefaultvalues@yisuniformtrue + \else + \pgfplots@determinedefaultvalues@yisuniformfalse + \fi + \fi + \fi + \ifpgfplots@determinedefaultvalues@yisuniform + \else + \pgfplots@yminorticksfalse + \fi + % + \ifx\pgfplots@xticklabel\pgfutil@empty + \ifpgfplots@xislinear + \def\pgfplots@xticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@xticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@xticklabel\pgfutil@empty + \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel + \fi + \ifx\pgfplots@yticklabel\pgfutil@empty + \ifpgfplots@yislinear + \def\pgfplots@yticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@yticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@yticklabel\pgfutil@empty + \let\pgfplots@extra@yticklabel=\pgfplots@yticklabel + \fi + % + % + \pgfplots@prepare@ZERO@coordinates +} + +% This code is mainly interesting for bar plots. +% +% It precomputes x = 0 and y = 0 - which is not necessarily +% trivial in case of data scaling. Furthermore, it applies +% coordinate clipping to the resulting values and multiplies them +% with x- and y scale vectors. +\def\pgfplots@prepare@ZERO@coordinates{% + \ifpgfplots@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 + % + \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 + \pgfinterruptboundingbox% + \pgfpointxy{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}% + \xdef\pgfplots@ZERO@x{\the\pgf@x}% + \xdef\pgfplots@ZERO@y{\the\pgf@y}% + \endpgfinterruptboundingbox% +}% + + +% Helper method for initsizes. +% +% It computes a scaling such that \pgfplots@width = SCALE * ACTUAL WIDTH. +% +% The actual width is +% c + x*(xmax-xmin) +% based on +% - x*xmax = \pgfplots@xcoordmaxTEX +% - x*xmin = \pgfplots@xcoordminTEX +% - c = estimated, a constant for the axis label/tick labels +% +% Arguments: +% #1: the output argument for the SCALE. +\def\pgfplots@initsizes@getXscale\into#1{% + \expandafter\pgfplots@tmpa\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: + \ifpgfplots@scale@only@axis + \else + \advance\pgfplots@tmpa by-45pt% FIXME determine 'c' correctly! + \fi + \ifdim\pgfplots@tmpa<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 + \fi + % \pgfplots@tmpb := x*(xmax-xmin): + \pgfplots@tmpb=\pgfplots@xcoordmaxTEX + \advance\pgfplots@tmpb by-\pgfplots@xcoordminTEX + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber\pgfplots@tmpa}% + {\pgf@sys@tonumber\pgfplots@tmpb}% + }% + \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 +% -> x-scale =#1 }% +} + +% The same as \pgfplots@initsizes@getXscale, just for the height. +\def\pgfplots@initsizes@getYscale\into#1{% + \expandafter\pgfplots@tmpa\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: + \ifpgfplots@scale@only@axis + \else + \advance\pgfplots@tmpa by-45pt\relax% FIXME determine 'c' correctly! + \fi + \ifdim\pgfplots@tmpa<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 + \fi + % \pgfplots@tmpb := x*(xmax-xmin): + \pgfplots@tmpb=\pgfplots@ycoordmaxTEX + \advance\pgfplots@tmpb by-\pgfplots@ycoordminTEX + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber\pgfplots@tmpa}% + {\pgf@sys@tonumber\pgfplots@tmpb}% + }% + \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 +% -> y-scale =#1 }% +} + + +\newif\ifpgfplots@avoid@emptyrange@@range@is@approx@equal +% Checks whether axis limits in coordinate #1 are approximately equal. +% +% If that is the case, force a non-zero width of the range. +% +\def\pgfplots@avoid@empty@axis@range@for#1{% + % 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 + \let\min@d=\pgf@xa + \let\max@d=\pgf@xb + \let\diff=\pgf@xc + \expandafter\min@d\min pt + \expandafter\max@d\max pt + \diff=\max@d + \advance\diff by-\min@d + % FIXME : I need a RELATIVE check here! + % but: real number point division is expensive + \if@cur@is@scaled + % this here should be sufficient because the axis + % has absolute values of order O( 10^3 ) or so. + \ifdim\diff<0.01pt + \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 + \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 + % + % enlarge \max and shrink \min: + \ifdim\max@d<0pt + \ifdim\max@d<-1pt + \max@d=0.8\max@d + \min@d=1.2\min@d + \else + \advance\max@d by-1pt + \advance\min@d by1pt + \fi + \else + \ifdim\max@d>1pt + \max@d=1.2\max@d + \min@d=0.8\min@d + \else + \ifdim\max@d=0pt + \if@cur@is@scaled + % we can't simply add a constant in the + % transformed range. + % + % So: set limits to [-1,1] = [-1.0e0,+1.0e0] + \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 + \else + \advance\max@d by1pt + \advance\min@d by-1pt + \fi + \else + \advance\max@d by1pt + \advance\min@d by-1pt + \fi + \fi + \fi + \xdef\pgfplots@TMP{\pgf@sys@tonumber{\min@d}}% + \xdef\pgfplots@TMPB{\pgf@sys@tonumber{\max@d}}% +%\pgfplots@message{ -> #1 = \pgfplots@TMP : \pgfplots@TMPB;}% + \else + \global\let\pgfplots@TMP=\min% + \global\let\pgfplots@TMPB=\max% + \fi + \endgroup + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@TMP + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@TMPB +} + +% PRECONDITION: +% none +% POSTCONDITION: +% \pgfplots@default@aspect@ratio is set. +\def\pgfplots@compute@default@aspect@ratio{% + \expandafter\pgfmath@x\axisdefaultwidth + \expandafter\pgfmath@y\axisdefaultheight + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber{\pgfmath@x}}% + {\pgf@sys@tonumber{\pgfmath@y}}% + }% + \let\pgfplots@default@aspect@ratio=\pgfmathresult +} + +\def\pgfplots@set@default@size@options{% + % The axes 'x' and 'y' vectors will be scaled such that the total + % size is (\axisdefaultwidth, \axisdefaultheight). + % + % If the user specifies ONE of width OR height, + % the plot will be resized; keeping the aspect ratio. + % + \let\pgfplots@default@aspect@ratio=\pgfutil@empty + % CASES: + % hasx := 'x' option non-empty + % hasy := 'y' option non-empty + % W := 'width' option non-empty + % H := 'height' option non-empty + % + % hasx = 1 -> width is not interesting; we use 'x' option. + % hasx = 0 -> determine final width: + % W H + % 0 0 -> \axisdefaultwidth + % 0 1 -> determine width out of H and the default aspect ratio + % 1 X -> ok, use the user parameter. + % + % hasy = 1 -> height is not interesting, we use 'y' option. + % hasy = 0 -> determine final height: + % W H + % 0 0 -> \axisdefaultheight + % X 1 -> ok, use the user parameter + % 1 0 -> determine height out of W and the default aspect ratio + % + \ifx\pgfplots@x\pgfutil@empty + \ifx\pgfplots@y\pgfutil@empty + % hasx=0, hasy=0 + % + % -> KEEP ASPECT RATIO if just one W, or H is given! + \ifx\pgfplots@width\pgfutil@empty + \ifx\pgfplots@height\pgfutil@empty + % The case hasx=0, hasy=0, W=0 H=0: + \let\pgfplots@width=\axisdefaultwidth + \let\pgfplots@height=\axisdefaultheight + \else + % The case hasx=0, hasy=0, W=0 H=1: + \pgfplots@compute@default@aspect@ratio + \expandafter\pgfmath@y\pgfplots@height + \pgfmathlog@invoke@expanded\pgfmathmultiply@{% + {\pgf@sys@tonumber{\pgfmath@y}}% + {\pgfplots@default@aspect@ratio}% + }% + \edef\pgfplots@width{\pgfmathresult pt}% + \fi + \else + \ifx\pgfplots@height\pgfutil@empty + % The case hasx=0, hasy=0, W=1 H=0: + \pgfplots@compute@default@aspect@ratio + \expandafter\pgfmath@x\pgfplots@width + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber{\pgfmath@x}}% + {\pgfplots@default@aspect@ratio}% + }% + \edef\pgfplots@height{\pgfmathresult pt}% + \else + % The case hasx=0, hasy=0, W=1 H=1: + \fi + \fi + \else + % hasx=0, hasy=1, W=0: + \ifx\pgfplots@width\pgfutil@empty + \let\pgfplots@width=\axisdefaultwidth + \fi + \fi + \else + \ifx\pgfplots@y\pgfutil@empty + % hasx=1, hasy=0, H=0 + \ifx\pgfplots@height\pgfutil@empty + \let\pgfplots@height=\axisdefaultheight + \fi + \fi + \fi +} + +% PRECONDITION: +% - final axis limits are given in transformed range +% - \pgfplots@set@default@size@options has been invoked before +% POSTCONDITION: +% - the current x- and y unit vectors are changed; +% - \pgfplots@[xy]coord{min,max}TEX are set +% +\def\pgfplots@initsizes{% + % INIT. + % + % + \pgfpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \pgfplots@xcoordminTEX=\pgf@x + \pgfplots@ycoordminTEX=\pgf@y + \pgfpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + \pgfplots@xcoordmaxTEX=\pgf@x + \pgfplots@ycoordmaxTEX=\pgf@y + % + % + %----------------------------------------- + % PROCESS THE 'width' and 'height' options + %----------------------------------------- + % + % FIXME: make these variables LOCAL: + % + \let\pgfplots@rectangle@width=\pgfutil@empty + \let\pgfplots@rectangle@height=\pgfutil@empty + % + \ifx\pgfplots@x\pgfutil@empty + \ifx\pgfplots@width\pgfutil@empty + \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}% + \fi + \pgfplots@initsizes@getXscale\into\pgfplots@tmpXscale + \ifpgfplots@scale@only@axis + \let\pgfplots@rectangle@width=\pgfplots@width + \fi + \else + \def\pgfplots@tmpXscale{1}% + \fi + % + \ifx\pgfplots@y\pgfutil@empty + \ifx\pgfplots@height\pgfutil@empty + \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% + \fi + \pgfplots@initsizes@getYscale\into\pgfplots@tmpYscale + \ifpgfplots@scale@only@axis + \let\pgfplots@rectangle@height=\pgfplots@height + \fi + \else + \def\pgfplots@tmpYscale{1}% + \fi + % + % + % assert( \pgfplots@tmpXscale != \pgfutil@empty && \pgfplots@tmpYscale != \pgfutil@empty ) + % + % 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}% + \ifx\pgfplots@x\pgfutil@empty + \pgfsetxvec{\pgfqpoint{\pgfplots@tmpa}{0pt}}% + \else + \pgfsetxvec{\pgfpoint{\pgfplots@x}{0pt}}% + \fi + \ifx\pgfplots@y\pgfutil@empty + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@tmpb}}% + \else + \pgfsetyvec{\pgfpoint{0pt}{\pgfplots@y}}% + \fi + % + % Determine final rectangle dimensions. + % There are the following cases: + % 1. the user really wants a fixed dimension, + % i.e. he used 'scale only axis'. + % Then, we have to work to get the correct dimension! + % + % Up to now, the scaling mechanism looses to many significant + % digits such that the final width/height differs by 1-2 pt. + % + % If I am not mistaken, this does ONLY affect the final size, + % not the relative plot precision. + % + % FIXME : really compute the plot precision! + % + % 2. The use specified width and/or height, but not 'scale only + % axis'. Accept inaccurate final widths/heights (see above). + % + % 3. The user supplied 'x' and or 'y'. Simply use them, its + % accurate. + % + \pgfpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \pgfplots@xcoordminTEX=\pgf@x + \pgfplots@ycoordminTEX=\pgf@y + \pgfpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + \ifx\pgfplots@rectangle@width\pgfutil@empty + \pgfplots@xcoordmaxTEX=\pgf@x + \else + % this 'if' here should only make a difference of about + % 1-2pt, not more. + % + % and I am quite sure that this inaccuracy (and this + % work-around) only affects the + % final size, not the relative plot accuracy. + \pgfplots@xcoordmaxTEX=\pgfplots@xcoordminTEX + \expandafter\advance\expandafter\pgfplots@xcoordmaxTEX\pgfplots@width + \fi + \ifx\pgfplots@rectangle@height\pgfutil@empty + \pgfplots@ycoordmaxTEX=\pgf@y + \else + \pgfplots@ycoordmaxTEX=\pgfplots@ycoordminTEX + \expandafter\advance\expandafter\pgfplots@ycoordmaxTEX\pgfplots@height + \fi +%-------------------------------------------------- +% \begingroup +% \pgf@x=\pgfplots@xcoordmaxTEX\advance\pgf@x by-\pgfplots@xcoordminTEX +% \pgf@y=\pgfplots@ycoordmaxTEX\advance\pgf@y by-\pgfplots@ycoordminTEX +% \message{Axis scaling x=\pgfplots@tmpXscale, y=\pgfplots@tmpYscale\ yields lower-left-corner (\pgfplots@xmin,\pgfplots@ymin) = (\the\pgfplots@xcoordminTEX,\the\pgfplots@ycoordminTEX) and upper right (\pgfplots@xmax,\pgfplots@ymax) = (\the\pgfplots@xcoordmaxTEX,\the\pgfplots@ycoordmaxTEX). Axis dimensions are width=\the\pgf@x, height=\the\pgf@y.}% +% \endgroup +%-------------------------------------------------- +} + + +% This is the main axis shape. +% +% It has one node part, which is the complete image. It provides a lot +% of anchors. +\pgfdeclareshape{pgfplots@low@level@shape}{% + \savedanchor\upperrightcorner{ + \pgf@x=\wd\pgfnodepartimagebox + \pgf@y=\ht\pgfnodepartimagebox + }% + \savedanchor\lowerleftinnercorner{% + \pgfpoint{\pgfplots@savedanchor@inner@lowerleft@x}{\pgfplots@savedanchor@inner@lowerleft@y}% + }% + \savedanchor\upperrightinnercorner{% + \pgfpoint{\pgfplots@savedanchor@inner@upperright@x}{\pgfplots@savedanchor@inner@upperright@y}% + }% + % + \nodeparts{image}% + \anchor{image}{% + \pgf@x=0pt + \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 + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \upperrightinnercorner + \advance\pgf@xa by\pgf@x + \pgf@x=.5\pgf@xa + \advance\pgf@xb by\pgf@y + \pgf@y=.5\pgf@xb + }% + \anchor{north}{% + \lowerleftinnercorner + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \upperrightinnercorner + \advance\pgf@xa by\pgf@x + \pgf@x=.5\pgf@xa + }% + \anchor{north east}{\upperrightinnercorner}% + \anchor{east}{% + \lowerleftinnercorner + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \upperrightinnercorner + \advance\pgf@xb by\pgf@y + \pgf@y=.5\pgf@xb + }% + \anchor{south east}{% + \lowerleftinnercorner + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \upperrightinnercorner + \pgf@y=\pgf@xb + }% + \anchor{south}{% + \lowerleftinnercorner + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \upperrightinnercorner + \advance\pgf@xa by\pgf@x + \pgf@x=.5\pgf@xa + \pgf@y=\pgf@xb + }% + \anchor{south west}{\lowerleftinnercorner}% + \anchor{west}{% + \lowerleftinnercorner + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \upperrightinnercorner + \pgf@x=\pgf@xa + \advance\pgf@xb by\pgf@y + \pgf@y=.5\pgf@xb + }% + \anchor{north west}{% + \lowerleftinnercorner + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \upperrightinnercorner + \pgf@x=\pgf@xa + }% + %% + %% + \anchor{above north}{% + \upperrightcorner + \pgf@xa=\pgf@y + \lowerleftinnercorner + \pgf@xb=\pgf@x + \upperrightinnercorner + \advance\pgf@xb by\pgf@x + \pgf@x=.5\pgf@xb + \pgf@y=\pgf@xa + }% + \anchor{above north east}{% + \upperrightcorner + \pgf@xa=\pgf@y + \upperrightinnercorner + \pgf@y=\pgf@xa + }% + \anchor{right of north east}{% + \upperrightcorner + \pgf@xa=\pgf@x + \upperrightinnercorner + \pgf@x=\pgf@xa + }% + \anchor{right of east}{% + \upperrightcorner + \pgf@xa=\pgf@x + \upperrightinnercorner + \pgf@xb=\pgf@y + \lowerleftinnercorner + \advance\pgf@xb by\pgf@y + \pgf@x=\pgf@xa + \pgf@y=.5\pgf@xb + }% + \anchor{right of south east}{% + \upperrightcorner + \pgf@xa=\pgf@x + \lowerleftinnercorner + \pgf@x=\pgf@xa + }% + \anchor{below south east}{% + \upperrightinnercorner + \pgf@y=0pt + }% + \anchor{below south}{% + \lowerleftinnercorner + \pgf@xa=\pgf@x + \upperrightinnercorner + \pgf@y=0pt + \advance\pgf@xa by\pgf@x + \pgf@x=.5\pgf@xa + }% + \anchor{below south west}{% + \lowerleftinnercorner + \pgf@y=0pt + }% + \anchor{left of south west}{% + \lowerleftinnercorner + \pgf@x=0pt + }% + \anchor{left of west}{% + \lowerleftinnercorner + \pgf@xa=\pgf@y + \upperrightinnercorner + \advance\pgf@xa by\pgf@y + \pgf@y=.5\pgf@xa + \pgf@x=0pt + }% + \anchor{left of north west}{% + \upperrightinnercorner + \pgf@x=0pt + }% + \anchor{above north west}{% + \upperrightcorner + \pgf@xa=\pgf@y + \lowerleftinnercorner + \pgf@y=\pgf@xa + }% + %% + %% + %% + \anchorborder{% + % Call a function that computes a border point. Since this + % function will modify dimensions like \pgf@x, we must move them to + % other dimensions. + \@tempdima=\pgf@x + \@tempdimb=\pgf@y + \pgfpointborderrectangle% + {\pgfpoint{\@tempdima}{\@tempdimb}}% + {\pgfpointadd{\upperrightcorner}{\pgfpoint{\width}{\height}}} + }% + \backgroundpath{\pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}}% + \foregroundpath{}% + \behindbackgroundpath{}% + \beforebackgroundpath{}% + \behindforegroundpath{}% + \beforeforegroundpath{}% +} + +\def\pgfplots@BEGIN@init@and@draw@axis{% + \pgfplots@determinedefaultvalues + \setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup + \pgfinterruptpicture + \tikzpicture[/pgfplots/every axis]% + %\pgfqkeys{/tikz}{every axis}% + % set baseline for sub-picture to default value. + % the baseline option will be applied to the OUTER picture. + \pgfsetbaseline{\pgf@picminy}% + % + \scope + \ifpgfplots@hide + \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}% + \fi + \clip + (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) + rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX); +} + + +\def\pgfplots@END@init@and@draw@axis{% + \endscope% +} + +% Writes output to \pgfplots@TMP +\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}% + \else + \xdef\pgfplots@TMP{\pgfplots@TMP,\pgfmathresult}% + \fi + }% +} + +\tikzdeclarecoordinatesystem{axis}{\pgfplots@evalute@tikz@coord@system@interface#1\pgfplots@coord@end} + + +% Assigns \pgfmathresult := canvas coordinate (#2) for axis #1. +\long\def\pgfplots@evalute@tikz@coord@system@interface@for#1#2{% + \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}% + \fi + \else + \pgfmathlog@{#2}% + \fi +} + +\long\def\pgfplots@evalute@tikz@coord@system@interface#1,#2\pgfplots@coord@end{% + \begingroup + \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}% + \endgroup + \pgfpointxy{\pgfplots@TMP}{\pgfplots@TMPB}% +} + +% In case of (semi-) logplots, this command will +% - assign a filter which invokes \pgfmathlog@{} for each coordinate +% - replace any user-specified coordinate by its log. +% +% All subsequent commands will then work with logarithmic coordinates. +% +% @see pgfmathlog.sty for details about the implementation of log(). +% +% PRECONDITION: +% - The user input options have been set correctly, +% - the option processing has not yet begun +% +% POSTCONDITION: +% - any user input for log-axis has been replaced by its log +% - coordinate filters to compute logs are installed +% +% See also: +% \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 + \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}% + \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 + \ifpgfplots@apply@datatrafo + % Check for any existing axis limits: + \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1min\endcsname + \ifx\pgfplots@TMP\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1max\endcsname + \ifx\pgfplots@TMP\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@TMP}% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult + \fi + \fi + \else + \ifpgfplots@disablelogfilter + \else + % any user-specified axis limits: + \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1min\endcsname + \ifx\pgfplots@TMP\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@TMP}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@#1max\endcsname + \ifx\pgfplots@TMP\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@TMP}% + \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 + \else + \def\pgfplots@TMPB{data}% + \ifx\pgfplots@TMP\pgfplots@TMPB + \else + \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@TMP}% + \expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfplots@TMP}% + \fi + \fi + \expandafter\let\expandafter\pgfplots@TMP\csname pgfplots@extra@#1tick\endcsname + \ifx\pgfplots@TMP\pgfutil@empty + \else + \expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@TMP}% + \expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfplots@TMP}% + \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 + %-------------------------------------------------- + \fi + \fi +} + +\def\pgfplots@create@axis@descriptions{% + \ifpgfplots@hide + \else + \ifx\pgfplots@xlabel\pgfutil@empty + \else + \pgfplots@show@label{x}% + \fi + \ifx\pgfplots@ylabel\pgfutil@empty + \else + \pgfplots@show@label{y}% + \fi + \fi + \ifx\pgfplots@title\pgfutil@empty + \else + \pgfplots@show@title + \fi + \pgfplots@createlegend +} + +\def\pgfplots@datascaletrafo@undoshift@x#1{% + \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@x}% +}% +\def\pgfplots@datascaletrafo@redoshift@x#1{% + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@x}% +}% +\def\pgfplots@datascaletrafo@undoshift@y#1{% + \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% +}% +\def\pgfplots@datascaletrafo@redoshift@y#1{% + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% +}% + +% DATA TRANSFORMATION T(x) = X - xmin +% +% Input: +% a number in the original data range, given in **floating** point representation +% Output: +% a fixed point number in transformed range +% stored in \pgfmathresult +% @see +% \pgfplots@datascaletrafo@fromfixed@x +\def\pgfplots@datascaletrafo@x#1{% + \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}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} + +% Overloaded function. +% Input: +% a FIXED point number instead of a floating point one. +% @see \pgfplots@datascaletrafo@x +\def\pgfplots@datascaletrafo@fromfixed@x#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfplots@datascaletrafo@x\expandafter{\pgfmathresult}% +} + +\def\pgfplots@datascaletrafo@y#1{% + \pgfmathfloatshift{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@y}% +} +\def\pgfplots@datascaletrafo@fromfixed@y#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfplots@datascaletrafo@y\expandafter{\pgfmathresult}% +} +\def\pgfplots@datascaletrafo@y@noshift#1{% + \pgfmathfloatshift{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} + +% INVERSE transformation x = T^{-1}( X ) +% Input: +% a fixed point number in transformed domain +% Output: +% a number in the data domain, given in floating point +% representation +% +% If the input number is approximately X=0, we will return x=0 as +% well. +% +% This allows to handle rounding inaccuracies and should not pose any +% problems. +\def\pgfplots@inverse@datascaletrafo@x#1{% + \begingroup + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@x}% + \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult + \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% + \edef\pgfplots@data@scale@trafo@EXPONENT@x{-\pgfplots@data@scale@trafo@EXPONENT@x}% + \expandafter\pgfmathfloatshift\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@x}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\def\pgfplots@inverse@datascaletrafo@x@noshift#1{% + \begingroup + \pgfmathapproxequalto@{#1}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \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}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +\def\pgfplots@inverse@datascaletrafo@y#1{% + \begingroup + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% + \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult + \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% + \edef\pgfplots@data@scale@trafo@EXPONENT@y{-\pgfplots@data@scale@trafo@EXPONENT@y}% + \expandafter\pgfmathfloatshift\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@y}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +% Overloaded function. This one does only apply the scaling, no shift. +\def\pgfplots@inverse@datascaletrafo@y@noshift#1{% + \begingroup + \pgfmathapproxequalto@{#1}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \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}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + +% Overloaded function. +% +% In contrast to \pgfplots@inverse@datascaletrafo@x, this method +% returns a number in FIXED point representation. +% @see \pgfplots@inverse@datascaletrafo@x +\def\pgfplots@inverse@datascaletrafo@tofixed@x#1{% + \pgfplots@inverse@datascaletrafo@x{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} +\def\pgfplots@inverse@datascaletrafo@tofixed@y#1{% + \pgfplots@inverse@datascaletrafo@y{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} + +% Overloaded function. +% +% This one does only apply the scale, no shift. +\def\pgfplots@inverse@datascaletrafo@tofixed@x@noshift#1{% + \pgfplots@inverse@datascaletrafo@x@noshift{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} +\def\pgfplots@inverse@datascaletrafo@tofixed@y@noshift#1{% + \pgfplots@inverse@datascaletrafo@y@noshift{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} + +% Parses all options in #1 which are known in the currently active families. +% +% The result will be stored back into the TikZ-style named #1 without +% further processing. +% +% Example: +% \tikzstyle{every axis}=[xmin=0,xmax=1,line width=1pt +% \pgfplots@set@keys@from@tikz@style\tmpmacro{every axis}{/pgfplots} +% +% - sets axis options 'xmin' and 'xmax' +% - calls \tikzstyle{every axis}={line width=1pt} +% +% I assume that this method is called within local TeX groups so +% nothing will be destroyed outside. +% +% #1: A style name. +\def\pgfplots@set@keys@from@tikz@style#1{% + \let\pgfplots@rmopts=\pgfutil@empty + \pgfqkeysfiltered{/pgfplots}{/pgfplots/#1}% + \pgfplots@set@keymacro@to@style\pgfplots@rmopts{#1}% +} + +% The same as \pgfplots@set@keys@from@tikz@style but this one appends +% unmatched options to style #2. +% +% #1: A style name. +% #2: A style name which will be filled with unprocessed options. +\def\pgfplots@set@keys@from@tikz@style@append@to#1#2{% + \let\pgfplots@rmopts=\pgfutil@empty + \pgfqkeysfiltered{/pgfplots}{/pgfplots/#1}% + \pgfplots@append@keymacro@to@style\pgfplots@rmopts{#2}% +} + +% #1: A sequence of options. +% #2: A style name which will be filled with unprocessed options. +\def\pgfplots@set@keys@and@append@remaining@to@style#1#2{% + \let\pgfplots@rmopts=\pgfutil@empty + \pgfqkeysfiltered{/pgfplots}{#1}% + \pgfplots@append@keymacro@to@style\pgfplots@rmopts{#2}% +}% + +% #1: input macro +\def\pgfplots@setkeys@from@macro#1{% + \let\pgfplots@rmopts=\pgfutil@empty + \def\pgfplots@TMP{\pgfqkeysfiltered{/pgfplots}}% + \expandafter\pgfplots@TMP\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}}% + \expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}% +%\pgfplots@message{tikzstyle{#2}+=[#1]}% +} + +% #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}}% + \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 + % + % Temporarily assign families to 'name' and 'alias' options. + % This allows to get the names - they should not be appended to + % 'every axis'! + \pgfkeys{% + /tikz/domain/.belongs to family=/pgfplots, + /pgfplots/domain/.code={\pgfkeysalso{/tikz/domain=##1}}, + /tikz/name/.belongs to family=/pgfplots/naming commands, + /tikz/alias/.belongs to family=/pgfplots/naming commands, + % and provide aliases in the '/pgfplots/' tree to avoid + % search path problems just for these two options: + /pgfplots/name/.belongs to family=/pgfplots/naming commands, + /pgfplots/alias/.belongs to family=/pgfplots/naming commands, + /pgfplots/name/.code={\pgfkeysalso{/tikz/name=##1}}, + /pgfplots/alias/.code={\pgfkeysalso{/tikz/alias=##1}}, + % + % + /pgf/key filter handlers/append filtered to/.install key filter handler=\pgfplots@rmopts, + }% + \let\tikz@alias=\pgfutil@empty + \let\tikz@fig@name=\pgfutil@empty + % + % Step 1: acquire ONLY 'xmode' and 'ymode' (necessary to decide + % which axis style shall be loaded): + \let\pgfplots@rmopts=\pgfutil@empty + \pgfkeysinstallkeyfilter + {/pgf/key filters/active families or no family} + {{/pgf/key filters/false}{/pgf/key filters/false}} + % + \pgfqkeysactivatesinglefamilyandfilteroptions{/pgfplots/scale}% + {/pgfplots} + {#1}% + \let\pgfplots@remaining@input=\pgfplots@rmopts + % + % Step 2: parse any pgfplots options out of styles. + \pgfkeysactivatefamily{/pgfplots/style commands}% + \pgfkeysinstallkeyfilter + {/pgf/key filters/active families or no family}% DEBUG} + {{/pgf/key filters/is descendant of=/pgfplots}% for keys without family + {/pgf/key filters/false}% for unknown keys + }% + % + \pgfkeysactivatefamilies + {/pgfplots,/pgfplots/naming commands,/pgfplots/tick,/pgfplots/legend,/pgfplots/descriptions,/pgfplots/scale} + {\pgfplots@deactivefamiliescmd}% + \pgfplots@set@keys@from@tikz@style{every axis}% + \pgfkeysdeactivatefamily{/pgfplots/scale}% + % + \ifpgfplots@xislinear + \ifpgfplots@yislinear + \pgfplots@set@keys@from@tikz@style@append@to{every linear axis}{every axis}% + \else + \pgfplots@set@keys@from@tikz@style@append@to{every semilogy axis}{every axis}% + \fi + \else + \ifpgfplots@yislinear + \pgfplots@set@keys@from@tikz@style@append@to{every semilogx axis}{every axis}% + \else + \pgfplots@set@keys@from@tikz@style@append@to{every loglog axis}{every axis}% + \fi + \fi + \pgfplots@deactivefamiliescmd + % + % Acquire style commands and nameing commands from direct input + % options '#1' BEFORE the 'every' styles are processed: + \pgfkeysactivatefamily{/pgfplots/naming commands}% + \pgfplots@setkeys@from@macro\pgfplots@remaining@input% + \let\pgfplots@remaining@input=\pgfplots@rmopts + \pgfkeysdeactivatefamily{/pgfplots/naming commands}% + % + % Now, any 'name' and 'alias' options have been processed. + % + % Remember their current meaning and reset the tikz options! + \let\pgfplots@fig@name=\tikz@fig@name + \let\pgfplots@fig@alias=\tikz@alias + \let\tikz@alias=\pgfutil@empty + \let\tikz@fig@name=\pgfutil@empty + % + % And protocol all named sub-nodes! Their positions need to be + % updated later. + \let\pgfplots@named@child@node@list=\pgfutil@empty + \pgfkeysgetvalue{/tikz/name/.@cmd}\pgfplots@old@name@impl + \pgfkeysgetvalue{/tikz/alias/.@cmd}\pgfplots@old@alias@impl + \pgfkeysdef{/tikz/name}{% + \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{##1}}% + \pgfplots@old@name@impl##1\pgfeov + }% + \pgfkeysdef{/tikz/alias}{% + \xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{##1}}% + \pgfplots@old@alias@impl##1\pgfeov + }% + % + % Now, continue to process the 'every' styles. Please note that + % the 'legend style={}' like options have already been processed; + % their values are already inside of the associated 'every' + % styles. + % + % What I am doing here is: set every pgfplots-option directly, and + % discard it from the every-style. Any non-pgfplots-option will + % be set in its context. + % + \pgfkeysactivatefamily{/pgfplots/legend}% + \pgfplots@set@keys@from@tikz@style{every axis legend}% + \pgfkeysdeactivatefamily{/pgfplots/legend}% + % + % + \pgfkeysactivatefamily{/pgfplots/descriptions}% + \pgfplots@set@keys@from@tikz@style{every axis label}% + \pgfplots@set@keys@from@tikz@style{every axis x label}% + \pgfplots@set@keys@from@tikz@style{every axis y label}% + \pgfplots@set@keys@from@tikz@style{every axis title}% + \pgfkeysdeactivatefamily{/pgfplots/descriptions}% + % + \pgfkeysactivatefamily{/pgfplots/tick}% + \pgfplots@set@keys@from@tikz@style{every tick}% + \pgfplots@set@keys@from@tikz@style{every minor tick}% + \pgfplots@set@keys@from@tikz@style{every major tick}% + \pgfplots@set@keys@from@tikz@style{every axis grid}% + \pgfplots@set@keys@from@tikz@style{every minor grid}% + \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/descriptions}% + \pgfkeysactivatefamily{/pgfplots/tick}% + \pgfplots@set@keys@from@tikz@style{every x tick label}% + \pgfplots@set@keys@from@tikz@style{every y tick label}% + \pgfplots@set@keys@from@tikz@style{every tick label}% + \pgfkeysdeactivatefamily{/pgfplots/tick}% + \pgfkeysdeactivatefamily{/pgfplots/descriptions}% + % + % Step 3: Set all remaining options of '#1'. They should have + % highest precedence. + \pgfkeysactivatefamilies + {/pgfplots,/pgfplots/tick,/pgfplots/legend,/pgfplots/descriptions}% + {\pgfplots@deactivefamiliescmd}% + \expandafter + \pgfplots@set@keys@and@append@remaining@to@style + \expandafter + {\pgfplots@remaining@input}% + {every axis}% + \pgfplots@deactivefamiliescmd +%\pgfkeysgetvalue{/tikz/every axis/.@cmd}\pgfplots@TMP +%\message{every axis is now '\meaning\pgfplots@TMP'}% + % + \pgfkeysdeactivatefamily{/pgfplots/style commands}% + \global\pgfkeysgetvalue{/pgfplots/xmin}{\pgfplots@xmin}% + \global\pgfkeysgetvalue{/pgfplots/xmax}{\pgfplots@xmax}% + \global\pgfkeysgetvalue{/pgfplots/ymin}{\pgfplots@ymin}% + \global\pgfkeysgetvalue{/pgfplots/ymax}{\pgfplots@ymax}% + % + \def\pgfplots@TMP{data}% + \pgfplots@collect@firstplot@astickfalse + \ifx\pgfplots@xtick\pgfplots@TMP + \pgfplots@collect@firstplot@asticktrue + \fi + \ifx\pgfplots@ytick\pgfplots@TMP + \pgfplots@collect@firstplot@asticktrue + \fi + \ifpgfplots@collect@firstplot@astick + \let\pgfplots@firstplot@coords@x=\pgfutil@empty + \let\pgfplots@firstplot@coords@y=\pgfutil@empty + \fi +} + +\def\pgfplots@install@abbrev@commands{ + \let\pgfplots@orig@path=\path + \let\pgfplots@orig@plot=\plot + % + \let\axispath=\pgfplots@path + % + \let\addplot=\pgfplots@addplot + \let\plot=\addplot + % + \def\logten{2.3025851}% + \def\reciproclogten{0.434294}% + % + \def\logi##1{% + \ifcase##1 + \or0 + \or0.693147 + \or1.098612 + \or1.386294 + \or1.60943791 + \or1.7917594 + \or1.94591014 + \or2.07944154 + \or2.197224 + \fi + }% + % + \let\legend=\pgfplots@command@legend + \let\addlegendentry=\pgfplots@addlegendentry +} + +\def\pgfplots@environment{% + \pgfutil@ifnextchar[{% + \pgfplots@environment@opt + }{% + \pgfplots@environment@opt[]% + }% +}% + +% temporary (local) variables inside of axis +\newif\ifpgfplots@autocomputelimits +\newif\ifpgfplots@autocompute@xlim +\newif\ifpgfplots@autocompute@ylim +\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 +% +% They are defined as +% \pgfplots@stored@current@precmd +% \pgfplots@stored@current@cmd +% \pgfplots@stored@current@data +% \pgfplots@stored@current@postcmd +\def\pgfplots@stored@plotlist@EXTRACTENTRY#1#2#3#4{% + \def\pgfplots@stored@current@precmd{#1}% + \def\pgfplots@stored@current@cmd{#2}% + \def\pgfplots@stored@current@data{#3}% + \def\pgfplots@stored@current@postcmd{#4}% +} + +\def\pgfplots@environment@opt[#1]{% + \begingroup + \pgfplots@install@abbrev@commands + \pgfplots@stacked@initialise + % + % + % The explicit specification of 'x' and 'y' as 1pt is to avoid + % numeric overflow/underflow during scale computations: + % + % The scaling (i.e. proper values for 'x' and 'y') will be + % determined later-on, dependend on the axis limits. Since axis + % limits are implicitly in units of 1pt, it is reasonable to use + % '1pt' here as well. + \pgfsetxvec{\pgfqpoint{1pt}{0pt}}% + \pgfsetyvec{\pgfqpoint{0pt}{1pt}}% + % + \pgfplots@set@options{#1}% + % + % -------------------- + % 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 + % + % -------------------- + % Option preprocessing + % -------------------- + \pgfplots@prepare@coord@filtering@for x + \pgfplots@prepare@coord@filtering@for y + \ifpgfplots@apply@datatrafo + \pgfplots@datascaletrafo@initialisedfalse + \else + \pgfplots@datascaletrafo@initialisedtrue% there is no trafo. + \fi + % + \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 + \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 + \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 + \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 + \fi + % + \global\pgfplots@limits@are@computedtrue + \ifpgfplots@autocompute@xlim + \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 + % + % + % -------------------- + % Start axis: + % either postponed to \end or directly. + % -------------------- + % + % Since I've introduced a public \numplots macro, I should + % make sure it's filled correctly: + \pgfplots@draw@at@endtrue + % + \ifpgfplots@collect@firstplot@astick + \pgfplots@draw@at@endtrue + \fi + \ifpgfplots@apply@datatrafo + % ALWAYS TRUE. This allows to use inline plots because the data + % scale transformation will be applied after I know that it should + % be disabled. + \pgfplots@draw@at@endtrue + \fi + \ifpgfplots@stackedmode + % Stacked plots require special attention: they are drawn in + % REVERSE order. + \pgfplots@draw@at@endtrue + \else + % we have no stacked plots and thus no reversing. + \pgfplots@stacked@reversefalse + \fi + % + % any \path command is invalid inside of an axis. + % Use \axispath instead: + \def\numplots{\the\pgfplots@numplots}% + \let\path=\pgfplots@replacement@for@tikz@path + \let\closedcycle=\pgfplots@path@closed@cycle + \ifpgfplots@draw@at@end + \let\pgfplots@nextcommand=\relax + \else + \def\pgfplots@nextcommand{\pgfplots@BEGIN@init@and@draw@axis}% + \fi + \pgfplots@nextcommand +} +\def\endpgfplots@environment@opt{% + \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% + \xdef\numplots{\the\pgfplots@numplots}% + % + % restore old \path command: + \let\path=\pgfplots@orig@path + \let\plot=\pgfplots@orig@plot + % + %\end{axis}: + % -------------------- + % All plotting commands have been read. + % -> apply postponed drawing commands! + % -------------------- + \ifpgfplots@draw@at@end + \def\pgfplots@nextcommand{% + \pgfplots@BEGIN@init@and@draw@axis + \pgfplots@stacked@initialise + \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 +%\message{Processing stored plot with precommand '\meaning\pgfplots@stored@current@precmd'; pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd' postcommand '\meaning\pgfplots@stored@current@postcmd'}% + \pgfplots@stored@current@precmd + \ifx\pgfplots@stored@current@cmd\pgfutil@empty + \pgfplots@stored@current@data% + \else + % this code here means we REALLY have a plotting + % command! + \ifpgfplots@stacked@reverse + % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. + \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 + \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 + }% + \global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents. + }% + \else + \let\pgfplots@nextcommand=\relax + \fi + \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}% + % + \pgfplots@tmpa=\pgfplots@xcoordmaxTEX + \advance\pgfplots@tmpa by-\pgfplots@xcoordminTEX + \pgfsetxvec{\pgfqpoint{\pgfplots@tmpa}{0cm}}% + % + \pgfplots@tmpa=\pgfplots@ycoordmaxTEX + \advance\pgfplots@tmpa by-\pgfplots@ycoordminTEX + \pgfsetyvec{\pgfqpoint{0cm}{\pgfplots@tmpa}}% + % + \pgfplots@create@axis@descriptions + \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% + \endgroup + \endtikzpicture% + \begingroup + % Protocol sizes for the axis-shape. + % I fear that needs to be done globally, do avoid all those + % \endgroup's in and after \endpgfinterruptpicture ... + \ifdim\pgf@picmaxx=-16000pt\relax% + \pgf@picmaxx=0pt\relax% + \pgf@picminx=0pt\relax% + \pgf@picmaxy=0pt\relax% + \pgf@picminy=0pt\relax% + \fi% + % + \xdef\pgfplots@saveddimen@picminx{\the\pgf@picminx}% + \xdef\pgfplots@saveddimen@picminy{\the\pgf@picminy}% + % + \pgf@xa=\pgfplots@xcoordmaxTEX + \advance\pgf@xa by-\pgf@picminx + \xdef\pgfplots@savedanchor@inner@upperright@x{\the\pgf@xa}% + % + \pgf@xa=\pgfplots@xcoordminTEX + \advance\pgf@xa by-\pgf@picminx + \xdef\pgfplots@savedanchor@inner@lowerleft@x{\the\pgf@xa}% + % + \pgf@xa=\pgfplots@ycoordmaxTEX + \advance\pgf@xa by-\pgf@picminy + \xdef\pgfplots@savedanchor@inner@upperright@y{\the\pgf@xa}% + % + \pgf@xa=\pgfplots@ycoordminTEX + \advance\pgf@xa by-\pgf@picminy + \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% + \endgroup + \endpgfinterruptpicture + \egroup\egroup% end of pgfnodepartimagebox + % + \let\tikz@fig@name=\pgfplots@fig@name + \tikz@fig@mustbenamed + \pgftransformshift{\pgfplots@at}% + \pgfmultipartnode{pgfplots@low@level@shape}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + \pgfplots@fig@alias + % + \pgfplots@finally@correct@child@node@positions + \pgfplots@stacked@finalize + \endgroup +} + +% Now, we need to process all named nodes inside of our +% axis-image. +% +% The situation at this point is as follows: +% 1. the complete axis image has been "typeset" into a box. That +% means its coordinate system is LOST up to those variables +% which have been saved explicitly. +% +% 2. the \pgfmultipartnode above knows about all axis anchors and +% saved dimensions. +% +% 3. All sub-nodes don't know about their position any more. Any +% saved anchors are wrong. +% +% The approach: +% 1. we shift each named node's saved anchors such that it's +% coordinate is valid inside of the TeX box. +% +% 2. we also shift each named node's saved anchors to reflect the +% axis' anchor. +% +% Afterwards, everything should be fine. +\def\pgfplots@finally@correct@child@node@positions{% + \ifx\pgfplots@named@child@node@list\pgfutil@empty% + \else% + \begingroup + \pgftransformreset% FIXME: what's that for!? Copied from matrix code... + % + % Use the 'image' anchor here - the internal anchor + % transformation matrix already has the shift for + % \pgfplots@anchorname. + \pgfpointanchor{\tikz@fig@name}{image}% + \pgf@xa=\pgf@x + \pgf@xb=\pgf@y + \pgf@process{\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}}% + \advance\pgf@xa by-\pgf@x + \advance\pgf@xb by-\pgf@y + \pgf@x=\pgf@xa + \pgf@y=\pgf@xb + \edef\pgfplots@offset{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% + % + \pgfutil@for\pgfplots@child@node@name:=\pgfplots@named@child@node@list\do{% + \ifx\pgfplots@child@node@name\pgfutil@empty + \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.}% + }{% + \pgf@shift@node{\pgfplots@child@node@name}{\pgfplots@offset}% + \expandafter\let\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname=\pgfutil@empty% + }% + \fi + \fi + }% + \endgroup + \fi% +}% + +\def\pgfplots@environment@axis{% + \pgfutil@ifnextchar[{\pgfplots@@environment@axis}{\pgfplots@@environment@axis[]}% +} +\let\endpgfplots@environment@axis=\endpgfplots@environment@opt +\def\pgfplots@@environment@axis[#1]{% + \pgfplots@environment@opt[/pgfplots/xmode=linear,/pgfplots/ymode=linear,#1]% +} + +\def\pgfplots@environment@semilogxaxis{% + \pgfutil@ifnextchar[{\pgfplots@@environment@semilogxaxis}{\pgfplots@@environment@semilogxaxis[]}% +} +\let\endpgfplots@environment@semilogxaxis=\endpgfplots@environment@opt +\def\pgfplots@@environment@semilogxaxis[#1]{% + \pgfplots@environment@opt[/pgfplots/xmode=log,/pgfplots/ymode=linear,#1]% +} + +\def\pgfplots@environment@semilogyaxis{% + \pgfutil@ifnextchar[{\pgfplots@@environment@semilogyaxis}{\pgfplots@@environment@semilogyaxis[]}% +} +\let\endpgfplots@environment@semilogyaxis=\endpgfplots@environment@opt +\def\pgfplots@@environment@semilogyaxis[#1]{% + \pgfplots@environment@opt[/pgfplots/xmode=linear,/pgfplots/ymode=log,#1]% +} + +\def\pgfplots@environment@loglogaxis{% + \pgfutil@ifnextchar[{\pgfplots@@environment@loglogaxis}{\pgfplots@@environment@loglogaxis[]}% +} +\let\endpgfplots@environment@loglogaxis=\endpgfplots@environment@opt +\def\pgfplots@@environment@loglogaxis[#1]{% + \pgfplots@environment@opt[/pgfplots/xmode=log,/pgfplots/ymode=log,#1]% +} + + +\pgfutil@ifundefined{tikzaddtikzonlycommandshortcutlet}{% + \def\tikzaddtikzonlycommandshortcutlet#1#2{% + \expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands + \let#1=#2 + }% + }% +}{} + +\tikzaddtikzonlycommandshortcutlet\axis\pgfplots@environment@axis +\tikzaddtikzonlycommandshortcutlet\endaxis\endpgfplots@environment@axis + +\tikzaddtikzonlycommandshortcutlet\semilogxaxis\pgfplots@environment@semilogxaxis +\tikzaddtikzonlycommandshortcutlet\endsemilogxaxis\endpgfplots@environment@semilogxaxis + +\tikzaddtikzonlycommandshortcutlet\semilogyaxis\pgfplots@environment@semilogyaxis +\tikzaddtikzonlycommandshortcutlet\endsemilogyaxis\endpgfplots@environment@semilogyaxis + +\tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis +\tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.stackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.stackedplots.code.tex new file mode 100644 index 00000000000..1612ca8c7f5 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots/pgfplots.stackedplots.code.tex @@ -0,0 +1,365 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +% +% This file contains the implementation for stacked plots. +% +% Stacked plots always keep record of the last plotted coordinates. +% Any new plot will be ADDED on top of the last plotted coordinates. +% +% Terminology: "last plotted coordinates" are called "zero levels" +% because they actually work like shifts. +% +% Programming Structure: +% +% 1. We keep TWO lists of coordinates: a list of CURRENT zero level +% coordinates and a list of NEXT zero level coordinates. +% +% The first one will be queried whenever a zero level coordinate is +% requested. +% +% The second one will be used to form zero levels for the next plot. +% +% 2. At the beginning and end of each plot, the lists in 1.) are +% initialised properly. +% +% 3. While plot coordinates are processed, the following methods +% interact with the stacked API: +% \pgfplots@stacked@preparepoint@inmacro +% -> compute the 'stacked' sum. +% This may need to be done with floating point arithmetics because +% the data scaling trafo is not yet initialised +% +% \pgfplots@stacked@finishpoint +% -> takes coordinates as they will be given to Tikz. This method is +% used to +% - communicate zero level coordinates to Tikz +% - implement the 'closed paths' option (allows filled stacked plots). +% +% \pgfplots@stacked@rememberzerolevelpoint@for@next@plot +% \pgfplots@stacked@getnextzerolevelpoint +% +% 4. Zero levels are communicated to Tikz by +% \pgfplots@stacked@initzerolevelhandler. This routine initialises an +% input stream for Tikz plot handlers which produces a sequence of +% zero levels. It is used by [xy]comb and [xy]bar. +% +% +% REMARK: +% the state of the boolean \ifpgfplots@datascaletrafo@initialised +% determines whether these routines expect and return floating point +% numbers or fixed point numbers. + +\let\pgfplots@stacked@zerolevelpoint@x=\pgfutil@empty +\let\pgfplots@stacked@zerolevelpoint@y=\pgfutil@empty +\newif\ifpgfplots@stacked@isfirstplot +\newif\ifpgfplots@stacked@isinitialised + +% Pre-initialisation. +% Needs to be called before the first call to +% \pgfplots@stacked@beginplot. +\def\pgfplots@stacked@initialise{% + \pgfplots@stacked@isfirstplottrue + \pgfplots@stacked@isinitialisedtrue +}% + +% Cleanup method. Truncates any global variables to reduce string +% space. +\def\pgfplots@stacked@finalize{% + \global\pgfplotslistnewempty\pgfplots@stacked@zerolevellist + \global\pgfplotslistnewempty\pgfplots@stacked@nextzerolevellist + \pgfplots@stacked@isinitialisedfalse +}% + +% (Re)defines the macro \pgfplots@stacked@getnextzerolevelpoint +% at the beginning of each plot. +% +% The macro \pgfplots@stacked@getnextzerolevelpoint fills +% \pgfplots@stacked@zerolevelpoint@[xy]. +% +% ATTENTION: call \pgfplots@stacked@initialise before the first call +% to beginplot! +\def\pgfplots@stacked@beginplot{% +%\message{pgfplots@stacked@beginplot: PLOT STARTED.}% + \ifpgfplots@stacked@isinitialised + \else + \pgfplots@error{LOGIC ERROR: please call \string\pgfplots@stacked@initialise.}% + \fi + \global\pgfplotslistnewempty\pgfplots@stacked@PGFzerolevels + % accumulate this command here for \closedcycle: + \let\pgfplots@stacked@closedcycle@impl=\pgfutil@empty + \ifpgfplots@stacked@isfirstplot + \global\pgfplotslistnewempty\pgfplots@stacked@zerolevellist + \def\pgfplots@stacked@zerolevelpoint@x{0}% + \def\pgfplots@stacked@zerolevelpoint@y{0}% + \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 + \pgfmathfloatcreate{0}{0.0}{0}% + \let\pgfplots@stacked@zerolevelpoint@x=\pgfmathresult + \fi + \ifpgfplots@float@numerics@mode@y + \pgfmathfloatcreate{0}{0.0}{0}% + \let\pgfplots@stacked@zerolevelpoint@y=\pgfmathresult + \fi + \fi + \def\pgfplots@stacked@getnextzerolevelpoint{}% will remain constant anyway. + \else + {\globaldefs=1 + \pgfplotslistcopy\pgfplots@stacked@nextzerolevellist\to\pgfplots@stacked@zerolevellist + }% + \def\pgfplots@stacked@getnextzerolevelpoint{% + {\globaldefs=1 + \pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult + }% + \expandafter\pgfplots@stacked@parsezerolevelpoint\pgfmathresult + }% + \fi + \global\pgfplotslistnewempty\pgfplots@stacked@nextzerolevellist +}% + +\def\pgfplots@stacked@parsezerolevelpoint(#1,#2){% + \def\pgfplots@stacked@zerolevelpoint@x{#1}% + \def\pgfplots@stacked@zerolevelpoint@y{#2}% +} + +\def\pgfplots@stacked@endplot{% + \ifpgfplots@stacked@isfirstplot + \let\pgfplots@stacked@closedcycle@impl=\pgfplots@path@closed@cycle@std + \else + \pgfplots@toka=\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} + --cycle + }% + \fi + \global\pgfplots@stacked@isfirstplotfalse +%\message{pgfplots@stacked@endplot: PLOT ENDED}% +}% + +% WARNING: when this method is called, NEITHER +% \ifpgfplots@stacked@isfirstplot NOR the zero level lists are +% initialised! +\def\pgfplots@stacked@initzerolevelhandler{% + \ifpgfplots@stacked@x + \pgfplotxzerolevelstream@@list + \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% + \else + \pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}% + \pgfplotyzerolevelstream@@list + \fi +}% + +\def\pgfplots@stacked@rememberzerolevelpoint@for@next@plot#1{% + \edef\pgfplots@TMP{#1}% + {\globaldefs=1 + \expandafter\pgfplotslistpushback\pgfplots@TMP\to\pgfplots@stacked@nextzerolevellist + }% +} + +\def\pgfplots@stacked@finishpoint#1#2{% + \ifpgfplots@stacked@isfirstplot + \else + \pgfpointxy{\pgfplots@stacked@zerolevelpoint@x}{\pgfplots@stacked@zerolevelpoint@y}% + \ifpgfplots@stacked@x + \edef\pgfplots@TMP{\the\pgf@x}% + \else + \edef\pgfplots@TMP{\the\pgf@y}% + \fi + {\globaldefs=1 + \expandafter\pgfplotslistpushback\pgfplots@TMP\to\pgfplots@stacked@PGFzerolevels + }% + \pgfplotslist@TOK@a=\expandafter{\pgfplots@stacked@closedcycle@impl}% + \edef\pgfplots@stacked@closedcycle@impl{% + (\pgfplots@stacked@zerolevelpoint@x,\pgfplots@stacked@zerolevelpoint@y)% + \the\pgfplotslist@TOK@a}% + \fi +}% + +\def\pgfplots@stacked@preparepoint@inmacro#1#2{% + \pgfplots@stacked@getnextzerolevelpoint + \ifpgfplots@stacked@x + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathadd@ + \else + \let\pgfplots@stacked@op=\pgfmathsubtract@ + \fi + \ifpgfplots@float@numerics@mode@x + \ifpgfplots@datascaletrafo@initialised + \else + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathfloatadd@ + \else + \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ + \fi + \fi + \fi + \pgfplots@stacked@op{\pgfplots@stacked@zerolevelpoint@x}{#1}% + \let#1=\pgfmathresult + \else + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathadd@ + \else + \let\pgfplots@stacked@op=\pgfmathsubtract@ + \fi + \ifpgfplots@float@numerics@mode@y + \ifpgfplots@datascaletrafo@initialised + \else + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathfloatadd@ + \else + \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ + \fi + \fi + \fi + \pgfplots@stacked@op{\pgfplots@stacked@zerolevelpoint@y}{#2}% + \let#2=\pgfmathresult + \fi + \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(#1,#2)}% +} + +% This here is a re-implementation of the stored plot processing. +% +% The idea is simply, 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 +% plots). This is especially unfortunate if we use filled bar plots +% or comb plots. +% +% IDEA: draw plots in REVERSE order. The positioning, styles and +% whatever must not be affected, only the sequence of drawing commands +% shall change. +% +% So, this command here does all numerics which is to be done and +% assembles a NEW, REVERSED STORED PLOT LIST. +\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 + \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 + \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}}% + % Reverse sequence: + \expandafter\pgfplotslistpushfront\pgfplots@TMP\to\pgfplots@stored@plotlist@reversed + }% + % Now, overwrite the original list: + \global\let\pgfplots@stored@plotlist=\pgfplots@stored@plotlist@reversed + \endgroup +}% + +\def\pgfplots@stacked@path@closed@cycle{% + \pgfplots@stacked@closedcycle@impl +} + +% Saves the finalized variables into macro #1 such that a call to #1 +% restores them. +% +% 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}% + \ifpgfplots@stacked@isfirstplot + \pgfplotslist@TOK@b={\pgfplots@stacked@isfirstplottrue}% + \else + \pgfplotslist@TOK@b={\pgfplots@stacked@isfirstplotfalse}% + \fi + \pgfplots@toka=\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}% + }% +} + +% PGF interfaces: +\def\pgfplotxzerolevelstream@@list{% + \def\pgf@plotxzerolevelstreamstart{% + \global\let\pgfplotxzerolevelstream@@list@@backup=\pgfplots@stacked@PGFzerolevels + \gdef\pgf@plotxzerolevelstreamnext{% + \pgfplotslistcheckempty\pgfplots@stacked@PGFzerolevels + \ifpgfplotslistempty + \global\pgf@x=\pgfplots@ZERO@x\relax + \else + {\globaldefs=1\relax + \pgfplotslistpopfront\pgfplots@stacked@PGFzerolevels\to\pgfmathresult + }% + \global\pgf@x=\pgfmathresult\relax + \fi + }% + }% + \def\pgf@plotxzerolevelstreamend{% + \global\let\pgfplots@stacked@PGFzerolevels=\pgfplotxzerolevelstream@@list@@backup + }% +}% + +\def\pgfplotyzerolevelstream@@list{% + \def\pgf@plotyzerolevelstreamstart{% + \global\let\pgfplotyzerolevelstream@@list@@backup=\pgfplots@stacked@PGFzerolevels + \gdef\pgf@plotyzerolevelstreamnext{% + \pgfplotslistcheckempty\pgfplots@stacked@PGFzerolevels + \ifpgfplotslistempty + \global\pgf@x=\pgfplots@ZERO@y\relax + \else + {\globaldefs=1\relax + \pgfplotslistpopfront\pgfplots@stacked@PGFzerolevels\to\pgfmathresult + }% + \global\pgf@x=\pgfmathresult\relax + \fi + }% + }% + \def\pgf@plotyzerolevelstreamend{% + \global\let\pgfplots@stacked@PGFzerolevels=\pgfplotyzerolevelstream@@list@@backup + }% +}% diff --git a/Master/texmf-dist/tex/latex/pgfplots/liststructure.sty b/Master/texmf-dist/tex/latex/pgfplots/liststructure.sty deleted file mode 100644 index c5930374f7d..00000000000 --- a/Master/texmf-dist/tex/latex/pgfplots/liststructure.sty +++ /dev/null @@ -1,196 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% This is a helper package with an elementary list datastructure. -% -% Its implementation is based on Knuth's list macros in "The TeXbook". -% -% The following macros are supplied: -% -% \listnewempty -% \listnew -% \listcopy -% \listpopfront -% \listpushback -% \listpushfront -% \listsize -% \listselect -% \listcheckempty -% \listforeach -% -% 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{liststructure}[2008/02/17 Version 0.9.4] - -\newtoks\TOKL@ta -\newtoks\TOKL@tb -\newif\iflistempty - -% Creates a new, empty list. -\long\def\listnewempty#1{\let#1=\empty} - -% Creates a new list with an abirtrary number of elements. -% Arguments: -% #1: the list's name (a macro name) -% #2: the elements in the form -% first\\second\\third\\ ...\\ -% like in tabular with one column. -% -% Example: -% \listnew\foolist{First Element\\Second Element\\Third Element\\} -% -% WARNING: do NOT forget the final '\\'! -\long\def\listnew#1#2{% - \listnewempty{#1}% - \long\def\listnew@impl@rest{#2}% - \loop - \ifx\listnew@impl@rest\empty - \else - \expandafter\listnew@impl\listnew@impl@rest\tolist#1\relax - \repeat -} - -% Copies list #1 to list #2. -\def\listcopy#1\to#2{\let#2=#1} - - -% helper macro for \listnew -\long\def\listnew@impl#1\\#2\tolist#3{% - \listpushback#1\to#3\relax% - \def\listnew@impl@rest{#2}% -} - - -% #1: the item to prepend -% #2: the list as macro name -% Example: -% \listpushfront Next first Element\to\foolist -\long\def\listpushfront#1\to#2{% - \TOKL@ta={\list@sep{#1}}% - \TOKL@tb=\expandafter{#2}% - \edef#2{\the\TOKL@ta\the\TOKL@tb}% -} - -% #1: the item to append -% #2: the list as macro name -% Example: -% \listpushback Next last element\to\foolist -\long\def\listpushback#1\to#2{% - \TOKL@ta={\list@sep{#1}}% - \TOKL@tb=\expandafter{#2}% - \edef#2{\the\TOKL@tb\the\TOKL@ta}% -} - -% Concatenates two lists #2 and #3 into #1 -% Example: -% \listconcat\result=\foolist&\bar -\long\def\listconcat#1=#2{% - \TOKL@ta=\expandafter{#2}% - \TOKL@tb=\expandafter{#3}% - \edef#1{\the\TOKL@ta\the\TOKL@tb}% -} - -% implements #2 := pop_front(#1) -% Example: -% \listpopfront\foolist\to\poppedfirstelem -\long\def\listpopfront#1\to#2{% - \listcheckempty#1\relax - \iflistempty - \errmessage{ERROR: \string\listpopfront\ from \string#1\ although list is EMPTY}% - \else - \expandafter\listpopfront@impl#1\listpopfront@macronames#1#2% - \fi -} - -% implementation helper for listpopfront -\long\def\listpopfront@impl\list@sep#1#2\listpopfront@macronames#3#4{% - \def#4{#1}% - \def#3{#2}% -} - -% Counts the number of elements in list #1, storing it into the count -% register #2. -% Example: -% \listsize\foo\to{\count0}% -% \the\count0 -\long\def\listsize#1\to#2{% - #2=0% - \long\def\list@sep##1{\advance#2 by 1 }% - #1% -} - -% Returns the #1th element of list #2 into macro #3 -% Arguments: -% #1: a count 0,...,N-1 where N is the list size. -% You may specify a number of a count. -% #2: a list -% #3: a macro name -% Example: -% Element 0: -% \listselect0\of\foo\to\elem -% \elem -% Element \count1: -% \listselect\count1\of\foo\to\elem -\long\def\listselect#1\of#2\to#3{% - \def#3{\errmessage{The requested item #1 of \string#2 is OUT OF RANGE.}}% - \begingroup - \count0=#1\relax - \long\def\list@sep##1{% - \advance\count0-1 - \ifnum\count0=-1 - \global\def\listselect@tmp{\def#3{##1}}% - % the command \listselect@tmp will be expander AFTER - % '\endgroup' - \aftergroup\listselect@tmp% - \fi% - }% - #2% - \endgroup -} - -% Sets the boolean \iflistempty depending on whether list #1 is empty -% or not. -% Example: -% -% \listcheckempty\foolist -% \iflistempty -% List foolist is empty! -% \else -% List is not empty. -% \fi -\def\listcheckempty#1{% - \ifx#1\empty - \listemptytrue - \else - \listemptyfalse - \fi -} - - -% Iterates through each list element, names it #2 and calls code #3. -% Example: -% \listnew\foolist{Eins\\Zwei\\Drei\\}% -% \listforeach\foolist\as\foo{Element \foo\par}% -% results in -% Element Eins -% Element Zwei -% Element Drei -\long\def\listforeach#1\as#2#3{{% - \long\def\list@sep##1{\def#2{##1}#3}% - #1\relax -}} diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty deleted file mode 100644 index 9e9b57ea137..00000000000 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfmathlog.sty +++ /dev/null @@ -1,215 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Package pgfmathlog.sty. -% -% This file provides the public functions -% -% \pgfmathnormalisedfloatingpoint#1\to#2\powten#3 -% like -% \pgfmathnormalisedfloatingpoint 412.02451e-5to\M\powten\E -% -% and -% \pgfmathlog -% \pgfmathlog@ -% which both assign \pgfmathresult to the natural number of a given -% number (without units). -% -% It is based on Till Tantaus pgfmath package which comes as part of -% the PGF bundle, but it provides its own number parsing routines to -% circumvent TeXs limited real number representations. -% -% 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{pgfmathlog}[2008/02/17 Version 0.9.4] -\RequirePackage{pgf}[2007/01/01] -\RequirePackage{sciformat}[2008/02/17] -\RequirePackage{pgfplotshelpers}[2008/02/17] - -% See \sciparse docs -\def\pgfmathnormalisedfloatingpoint#1\to#2\powten#3{% - \sciparse#1\to#2\powten{#3}% -} - -% Evaluates the natural logarithm, log(x) for 0.1<=x<=1. -% @see \pgfmathlog@ for the general method. -% NON ACCURATE ENOUGH! -\def\pgfmathlogzeroone#1{% - \begingroup% - \message{EVAL log(#1) STARTS:}% - \pgfmath@x=#1pt\relax - \pgfmath@y=\pgfmath@x - \advance\pgfmath@x by-1pt - \advance\pgfmath@y by 1pt - \pgfmathdivide{\pgfmath@x}{\pgfmath@y}% - % pgfmath@ya = tmp := (#1 -1)/ (#1+1) - \expandafter\pgfmath@ya\pgfmathresult pt - % pgfmath@xa := [ (#1 -1)/ (#1+1) ]^2 - \pgfmathmultiply{\pgfmathresult}{\pgfmathresult}% - \expandafter\pgfmath@xa\pgfmathresult pt - % returnvalue: - \pgfmath@y=0pt - % loop counter: - \c@pgfmath@counta=0 - % j: - \c@pgfmath@countb=1 - \loop - \ifnum\c@pgfmath@counta<6 - \let\multmp=\pgfmath@ya - \divide\pgfmath@ya by\c@pgfmath@countb - \advance\pgfmath@y by\pgfmath@ya - \let\pgfmath@ya=\multmp - \advance\c@pgfmath@countb by2 - \message{[tmp *= x*x tmp =\the\pgfmath@ya, x*x=\the\pgfmath@xa]}% - \pgfmathmultiply{\pgfmath@ya}{\pgfmath@xa}% - \expandafter\pgfmath@ya\pgfmathresult pt - \advance\c@pgfmath@counta by1 - \message{[cur/2 = \the\pgfmath@y]}% - \repeat - \multiply\pgfmath@y by2 - \message{fertiges Resultat fuer log(#1): \the\pgfmath@y}% - \pgfmath@returnone\pgfmath@y% - \endgroup% -} - - -% Computes a good guess for log(X.XXXX) where the input number should -% be between 0 < x < 10. -% -% If it is not in this range, the returned value will be bad. -% -% For use in the newton implementation of log(x). Please note that we -% first compute a normalized floating point representation of x, and -% the mantisse is always between 0 and 10. -\def\pgfmathlog@smaller@ten@newton@startval#1#2#3\to#4{% - \ifnum0<#1\relax - \def\axis@TMP{#2}% - \def\axis@TMPB{.}% - \ifx\axis@TMP\axis@TMPB - \ifcase#1 - \errmessage{pgfmathlog.sty: INTERNAL ERROR: should not happen! - [\#1=0 should have been caught before!]}% - \or#4=0.53062825106217pt - \or#4=0.993pt - \or#4=1.308pt - \or#4=1.5pt - \or#4=1.71pt - \or#4=1.872pt - \or#4=2.01pt - \or#4=2.145pt - \or#4=2.24pt - \fi -% \message{Newton: Start value \the#4 assigned}% - \else -% \message{Kein Komma an zweiter stelle (statt dessen: #2); Nehme standardstartwert.}% - #4=0.1pt - \fi - \else -% \message{Argument #1 <= 0. Nehme standardstartwert.}% - #4=0.1pt - \fi -} - -% Computes log(x) into \pgfmathresult. -% -% REMARK -% This method does NOT use TeX Registers to represent the numbers! The -% computation is COMPLETELY STRING BASED. -% This allows numbers such at 10000000 or 5.23e-10 to be represented -% properly, although TeX-registers would produce overflow/underflow -% errors in these cases. -% -% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y -\def\pgfmathlog@#1{% - \pgfmathlog@newton{#1}% -} - -% Public interface method. This is expected to use \pgfmathparse but -% it DOESN'T do that. \pgfmathparse naturally can't handle numbers -% which exceed TeX's numerical capabilities. However, exponentials are -% typically either too large or too small for TeX. -% -% @see \pgfmathnormalisedfloatingpoint for how we parse arguments. -% @see \pgfmathlog@ -\def\pgfmathlog#1{% - \pgfmathlog@newton{#1}% -} - -% This implementation of log(X) is done with a newton method applied to x-exp(y) = 0. -% The implementation \pgfmathexp is used for exp(y). -% -% see \pgfmathlog@ -\def\pgfmathlog@newton#1{% - \begingroup% - % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX - \sciparse#1\to\newtoninput@mantisse\powten\newtoninput@exponent - % - % Now, compute log(#1) = log(M) + E*log(10) -% \message{EVAL log(#1) = log(\newtoninput@mantisse) + \newtoninput@exponent*log(10) mit newton STARTS:}% - % input argument into \pgfmath@x - \expandafter\pgfmath@x\newtoninput@mantisse pt - \ifdim\pgfmath@x>0pt - % return value: - \expandafter\pgfmathlog@smaller@ten@newton@startval\newtoninput@mantisse\to\pgfmath@y - % loop counter: - \c@pgfmath@counta=0 - \loop - %\message{Newton iter \#\the\c@pgfmath@counta: log(\newtoninput@mantisse) = \the\pgfmath@y }% - \ifnum\c@pgfmath@counta<2 - % \pgfmathexp\pgfmath@y% - \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% - \let\tmp=\pgfmathresult - %\pgfmathdivide\pgfmath@x\tmp% - \pgfmathlog@invoke@expanded\pgfmathdivide@{{\pgf@sys@tonumber{\pgfmath@x}}{\tmp}}% - \expandafter\pgfmath@ya\pgfmathresult pt - \advance\pgfmath@y by\pgfmath@ya - \advance\pgfmath@y by-1pt - \advance\c@pgfmath@counta by1 - \repeat - \pgfmath@x=2.302585pt% = log(10) - \multiply\expandafter\pgfmath@x\newtoninput@exponent - \advance\pgfmath@y by\pgfmath@x -%\message{Newton final result: log(\newtoninput@mantisse)+\newtoninput@exponent*log(10) = \the\pgfmath@y [ nur \newtoninput@exponent * log(10) = \the\pgfmath@x]}% - \pgfmath@returnone\pgfmath@y% - \else - \global\let\pgfmathresult=\empty% - \fi - \endgroup% -} - -% Usage: -% \pgfmathapproxequalto@macro\argone\argtwo\result -% -% -> will set \resulttrue or \resultfalse -% -> check with \ifresult -\def\pgfmathlog@approxequalto@macro#1#2#3{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \expandafter\pgfmath@y#2pt\relax% - \advance\pgfmath@x-\pgfmath@y% - \ifdim\pgfmath@x<0pt - \multiply\pgfmath@x by-1 - \fi - \ifdim\pgfmath@x<0.0001pt\relax% - \expandafter\aftergroup\csname #3true\endcsname - \else% - \expandafter\aftergroup\csname #3false\endcsname - \fi% - \endgroup% -} - diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty index 114db197b55..3e63fdfa8b7 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty @@ -23,8 +23,8 @@ % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- -\def\pgfplotsversion{0.92.4} -\ProvidesPackage{pgfplots}[2008/02/17 Version \pgfplotsversion] +\def\pgfplotsversion{1.0} +\ProvidesPackage{pgfplots}[2008/06/07 Version \pgfplotsversion] % ATTENTION: % you MAY need one of @@ -39,2559 +39,12 @@ % 'pdftex' for 'pdflatex' % -> dvipdfm needs special attention. -\RequirePackage{xkeyval}[2006/11/18] -\RequirePackage{ifthen} -\RequirePackage{liststructure} -\RequirePackage{tikz}[2007/06/07] -\RequirePackage{sciformat} -\RequirePackage{pgfmathlog} -\usetikzlibrary{plotmarks} - -\def\prefix{pgfplots} - -% FIXME: reduce number of variables! -\newcount\axisticknum -\newcount\axis@tickposnum -\newcount\axis@xmode -\newcount\axis@ymode -\newcount\axis@numplots -\newdimen\axis@xcoordminTEX -\newdimen\axis@xcoordmaxTEX -\newdimen\axis@ycoordminTEX -\newdimen\axis@ycoordmaxTEX -\newdimen\axis@tmpa -\newdimen\axis@tmpb -\newif\ifaxis@isuniformtick -\newif\ifaxis@enlargelimits -\newif\ifaxis@enlargelimits@rel@thresh -\newif\ifaxis@enlargelimits@auto -\let\axis@TMP=\empty -\let\axis@TMPB=\empty -\let\axis@TMPC=\empty - -\def\axis@leftover{} -\def\axis@rightover{} -\def\axisdefaultwidth{240pt} -\def\axisdefaultheight{207pt} -\def\axisdefaulttickwidth{35}% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt') -\def\axisdefaulttryminticks{4} - -\listnew{\blackwhiteplotspeclist}{% - mark options={fill=gray},mark=*\\% - mark options={fill=gray},mark=square*\\% - mark options={fill=gray},mark=otimes*\\% - mark=star\\% - mark options={fill=gray},mark=diamond*\\% - densely dashed,mark options={solid,fill=gray},mark=*\\% - densely dashed,mark options={solid,fill=gray},mark=square*\\% - densely dashed,mark options={solid,fill=gray},mark=otimes*\\% - densely dashed,mark options={solid},mark=star\\% - densely dashed,mark options={solid,fill=gray},mark=diamond*\\% -} -\listnew{\coloredplotspeclist}{% - blue,mark options={fill=blue!80!black},mark=*\\% - red,mark options={fill=red!80!black},mark=square*\\% - brown!60!black,mark options={fill=brown!80!black},mark=otimes*\\% - black,mark=star\\% - blue,mark options={fill=blue!80!black},mark=diamond*\\% - red,densely dashed,mark options={solid,fill=red!80!black},mark=*\\% - brown!60!black,densely dashed,mark options={solid,fill=brown!80!black},mark=square*\\% - black,densely dashed,mark options={solid,fill=gray},mark=otimes*\\% - blue,densely dashed,mark=star,mark options=solid\\% - red,densely dashed,mark options={solid,fill=red!80!black},mark=diamond*\\% -} - - -\listcopy\coloredplotspeclist\to\autoplotspeclist% -%\listcopy\blackwhiteplotspeclist\to\autoplotspeclist% - -\tikzstyle{every axis}=[] -\tikzstyle{every axis plot}=[] -\tikzstyle{every axis label}=[] -\tikzstyle{every axis x label}=[at={(0.5,0)},below,yshift=-15pt] -\tikzstyle{every axis y label}=[at={(0,0.5)},xshift=-35pt,rotate=90] -\tikzstyle{every axis title}=[at={(0.5,1)},above,yshift=6pt] -\tikzstyle{every tick}=[very thin,gray] -\tikzstyle{every minor tick}=[] -\tikzstyle{every major tick}=[] -\tikzstyle{every axis grid}=[style=help lines] -\tikzstyle{every minor grid}=[] -\tikzstyle{every major grid}=[] -\tikzstyle{every tick label}=[] -\tikzstyle{every x tick label}=[] -\tikzstyle{every y tick label}=[] - -% specifies how and where to draw the axis. -% \tikzstyle{every axis legend}+=[at={(0,0)}] -% will draw it at the lower left corner of the axis while -% \tikzstyle{every axis legend}+=[at={(1,1)}] -% means the upper right corner. -% -% The legend is a 'node' so you can use any tikz option which affects -% nodes. The option 'text width' is set automatically, depending on -% the \legend[textwidth=...] option. -% -% Examples: -% - \tikzstyle{every axis legend}+=[at={(1.02,1)},anchor=north west] -% draws the legend OUTSIDE TOP RIGHT. -% -% - \tikzstyle{every axis legend}+=[at={(1,0.5)},anchor=east,outer sep=0.5cm] -% draws the legend INSIDE MIDDLE RIGHT, separated by 0.5cm from the axis. -\tikzstyle{every axis legend}=[% - cells={anchor=center}, - inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em}, - anchor=north east,% - shape=rectangle,% - fill=white,% - draw=black, - at={(0.98,0.98)} - ] -% at={(1,1)}, -% outer sep=0.1cm] - - -\define@cmdkeys[\prefix]{axis}[axis@]{% - xmin,xmax,xticklabel,xtick,xtickten,xlabel,% - ymin,ymax,yticklabel,ytick,ytickten,ylabel,% - subtickwidth,tickwidth,% - xfilter,yfilter,% - width,height,% - title,% - execute at begin plot,% - execute at end plot,% - enlargelimits,% - legend columns,% - x,y}% - -\long\def\axis@foreach@to@list#1\to#2{% - \listnewempty\axis@TMP - \begingroup - \foreach \i in {#1} {% - \globaldefs=1 - \expandafter\listpushback\i\to\axis@TMP - \globaldefs=0 - }% - \endgroup - \listcopy\axis@TMP\to#2\relax -} - -\define@cmdkey[\prefix]{axis}[axis@]{xticklabels}{% - \expandafter\axis@foreach@to@list\axis@xticklabels\to\axis@xticklabels - %\expandafter\listnew\expandafter\axis@xticklabels\expandafter{\axis@xticklabels}% - \let\axis@xticklabel=\axis@user@ticklabel@list@x -} -\define@cmdkey[\prefix]{axis}[axis@]{yticklabels}{% - \expandafter\axis@foreach@to@list\axis@yticklabels\to\axis@yticklabels - %\expandafter\listnew\expandafter\axis@yticklabels\expandafter{\axis@yticklabels}% - \let\axis@yticklabel=\axis@user@ticklabel@list@y -} - -\define@cmdkey[\prefix]{axis}[axis@]{minor tick length}{% - \expandafter\let\expandafter\axis@subtickwidth\csname axis@minor tick length\endcsname -} -\define@cmdkey[\prefix]{axis}[axis@]{major tick length}{% - \expandafter\let\expandafter\axis@tickwidth\csname axis@major tick length\endcsname -} - -% sets \axis@tickposnum to -% left=0 -% right=1 -% both=2 -\define@choicekey[\prefix]{axis}{tickpos}[\val\nr]{left,right,both}{% - \axis@tickposnum=\nr\relax -} -\define@choicekey[\prefix]{axis}{legend plot pos}[\val\nr]{left,right,none}{% - \edef\axis@legend@plot@pos{\nr}% -} - -\define@choicekey[\prefix]{axis}{anchor}[\val\nr]{north,north west,west,south west,south,south east,east,north east,center}{% - \edef\axis@anchorchoicenum{\nr}% -} - -\define@choicekey[\prefix]{axis}{ticks}[\val\nr]{none,major,minor,both}{% - \expandafter\ifcase\nr\relax - \axis@xminorticksfalse - \axis@yminorticksfalse - \axis@xmajorticksfalse - \axis@ymajorticksfalse - \or - \axis@xminorticksfalse - \axis@yminorticksfalse - \axis@xmajortickstrue - \axis@ymajortickstrue - \or - \axis@xminortickstrue - \axis@yminortickstrue - \axis@xmajorticksfalse - \axis@ymajorticksfalse - \or - \axis@xminortickstrue - \axis@yminortickstrue - \axis@xmajortickstrue - \axis@ymajortickstrue - \fi -} -\define@choicekey[\prefix]{axis}{grid}[\val\nr]{none,major,minor,both}{% - \expandafter\ifcase\nr\relax - \axis@xminorgridsfalse - \axis@yminorgridsfalse - \axis@xmajorgridsfalse - \axis@ymajorgridsfalse - \or - \axis@xminorgridsfalse - \axis@yminorgridsfalse - \axis@xmajorgridstrue - \axis@ymajorgridstrue - \or - \axis@xminorgridstrue - \axis@yminorgridstrue - \axis@xmajorgridsfalse - \axis@ymajorgridsfalse - \or - \axis@xminorgridstrue - \axis@yminorgridstrue - \axis@xmajorgridstrue - \axis@ymajorgridstrue - \fi -} - - -\define@boolkeys[\prefix]{axis}[axis@]{% - xminorticks,% - xmajorticks,% - yminorticks,% - ymajorticks,% - xminorgrids,% - xmajorgrids,% - yminorgrids,% - ymajorgrids,% - disablelogfilter,% - disabledatascaling,% - hide axis,% - scale only axis}[true] - -% sets \axis@xmode to -% normal=0 -% log=1 -\define@choicekey[\prefix]{axis}{xmode}[\val\nr]{normal,log}{% - \axis@xmode=\nr\relax -} - -% sets \axis@ymode to -% normal=0 -% log=1 -\define@choicekey[\prefix]{axis}{ymode}[\val\nr]{normal,log}{% - \axis@ymode=\nr\relax -} - -\long\def\axispreset#1{% - \presetkeys[\prefix]{axis}{#1}{}% -} -\long\def\legendpreset#1{% - \errmessage{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% -} - -\presetkeys[\prefix]{axis}{% - xmode=normal, - xmin=, - xmax=, - xlabel=, - xtick=, - xtickten=, - xticklabel=, - xminorticks=true, - xmajorticks=true, - xminorgrids=false, - xmajorgrids=false, - ymode=normal, - ymin=, - ymax=, - ylabel=, - ytick=, - ytickten=, - yticklabel=, - yminorticks=true, - ymajorticks=true, - yminorgrids=false, - ymajorgrids=false, - grid=none,% - tickpos=both, - xfilter=, - yfilter=, - title=, - width=, - height=, - anchor=south west, - subtickwidth=0.1cm, - tickwidth=0.15cm, - scale only axis=false, - hide axis=false, - legend columns=1, - legend plot pos=left, - x=,% is implicitly set by 'width' and/or '\axisdefaultwidth' - y=,% is implicitly set by 'height' and/or '\axisdefaultheight' - execute at begin plot=,% - execute at end plot=,% - enlargelimits=auto, - disablelogfilter=false}{} - -\def\logten{2.3025851} -\def\reciproc@logten{0.434294481903252} - -\newcommand{\logi}[1]{% - \ifcase#1 - \or0 - \or0.693147 - \or1.098612 - \or1.386294 - \or1.60943791 - \or1.7917594 - \or1.94591014 - \or2.07944154 - \or2.197224 - \fi -} - -\newcommand{\show@yticklabel}[2]{{% - \let\ticknum=#1% - \ifaxis@float@numerics@mode@y - % this here stores \\tick@S, \\tick@M, \\tick@E - \axis@inverse@datascaletrafo@y{#2}\to\tick - % .. and this here provides \tick as fixed point repr: - \scitofixedsingle\tick\tick - \else - \def\tick{#2}% - \fi - \axis@yticklabel -}} - -% x-Achsenbeschriftung zum #1.ten Tick: -% #1: die ticknum -% #2: der x wert dafuer -\newcommand{\show@xticklabel}[2]{{% - \let\ticknum=#1% - \ifaxis@float@numerics@mode@x - % this here stores \\tick@S, \\tick@M, \\tick@E - \axis@inverse@datascaletrafo@x{#2}\to\tick - % .. and this here provides \tick as fixed point repr: - \scitofixedsingle\tick\tick - \else - \def\tick{#2}% - \fi - \axis@xticklabel -}} - -\def\axis@user@ticklabel@list@x{% - \listselect\ticknum\of\axis@xticklabels\to\tick - \tick -} -\def\axis@user@ticklabel@list@y{% - \listselect\ticknum\of\axis@yticklabels\to\tick - \tick -} - -\newcommand{\axisdefaultticklabel}[0]{% - $\prettyprintnumber{\tick}$% -} - -\newcommand{\axisdefaultticklabellog}[0]{% - \logtologtentomacro{\tick}{\roundedtick}% - $10^{\prettyprintnumber{\roundedtick}}$% -} - - -\newcommand{\axisshowxlabel}{% - \node - [style=every axis label,% - style=every axis x label] - {\axis@xlabel}; - -} -\newcommand{\axisshowylabel}{% - \node - [style=every axis label, - style=every axis y label] - {\axis@ylabel}; -} -\newcommand{\axisshowtitle}{% - \node% - [style=every axis title] - {\axis@title}; -} - -% Y-Achsen und Achsenbeschriftung LOG: -% 1: Ticks -\newcommand{\axis@drawyaxis}[1]{% - \begingroup - \newif\ifneedsminorloop - \axisticknum=0 - \edef\axis@TMP{#1}% - \ifx\axis@TMP\empty - \else - \ifaxis@yminorticks - \needsminorlooptrue - \fi - \ifaxis@yminorgrids - \needsminorlooptrue - \fi - \def\axis@placecomputedtick##1[##2]{% - \draw[##2] - \ifcase\axis@tickposnum - (\axis@xcoordminTEX\axis@leftover, \axis@tmpa) - -- (\axis@xcoordminTEX+##1, \axis@tmpa) - \or - (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa) - -- (\axis@xcoordmaxTEX-##1, \axis@tmpa) - \or - (\axis@xcoordminTEX\axis@leftover, \axis@tmpa) - -- (\axis@xcoordminTEX+##1, \axis@tmpa) - - (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa) - -- (\axis@xcoordmaxTEX-##1, \axis@tmpa) - \fi - ; - }% - \def\placecomputedgridline[##1]{% - \draw[##1] - (\axis@xcoordminTEX\axis@leftover, \axis@tmpa) - -- (\axis@xcoordmaxTEX\axis@rightover, \axis@tmpa) - ; - }% - \foreach \y in {#1} { - \pgfextracty{\axis@tmpa}{\pgfpointxy{0}{\y}}% - % - \ifdim\axis@tmpa<\axis@ycoordminTEX - \else - \ifdim\axis@tmpa>\axis@ycoordmaxTEX - \else - % Achsenbeschriftung: - \ifnum\axis@tickposnum=1 - \node at - (\axis@xcoordmaxTEX\axis@leftover,\axis@tmpa) - [right,style=every tick label,style=every y tick label] - {\show@yticklabel\axisticknum\y}; - \else - \node at - (\axis@xcoordminTEX\axis@leftover,\axis@tmpa) - [left,style=every tick label,style=every y tick label] - {\show@yticklabel\axisticknum\y}; - \fi - \fi - \fi - \global\advance\axisticknum by1 - \begin{scope} - \clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover) - rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover); - % Y-ticks left and/or right - % in log: - % log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9 - \ifneedsminorloop - \foreach \i in {1,...,9} { - % this code here is scoped inside of \foreach. - \pgfextracty{\axis@tmpb}{\pgfpointxy{0}{\logi\i}}% - \advance\axis@tmpa by\axis@tmpb - \ifaxis@yminorgrids - \placecomputedgridline[style=every axis grid,style=every minor grid]% - \fi - \ifaxis@yminorticks - \axis@placecomputedtick\axis@subtickwidth[style=every tick,style=every minor tick]% - \fi - }% - \fi - \ifaxis@ymajorgrids - \placecomputedgridline[style=every axis grid,style=every major grid]% - \fi - \ifaxis@ymajorticks - \axis@placecomputedtick\axis@tickwidth[style=every tick,style=every major tick]% - \fi - \end{scope} - }% - \fi - \endgroup -} - -% X-Achsen und Achsenbeschriftung -% 1: Ticks -\newcommand{\axis@drawxaxis}[1]{% - \begingroup - \axisticknum=0 - \newif\ifneedsminorloop - \edef\axis@TMP{#1}% - \ifx\axis@TMP\empty - \else - \ifaxis@xminorticks - \needsminorlooptrue - \fi - \ifaxis@xminorgrids - \needsminorlooptrue - \fi - \def\axis@placecomputedtick##1[##2]{% - \draw[##2] - \ifcase\axis@tickposnum - (\axis@tmpa, \axis@ycoordminTEX\axis@leftover) - -- (\axis@tmpa, \axis@ycoordminTEX+##1) - \or - (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover) - -- (\axis@tmpa, \axis@ycoordmaxTEX-##1) - \or - (\axis@tmpa, \axis@ycoordminTEX\axis@leftover) - -- (\axis@tmpa, \axis@ycoordminTEX+##1) - - (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover) - -- (\axis@tmpa, \axis@ycoordmaxTEX-##1) - \fi - ; - }% - \def\placecomputedgridline[##1]{% - \draw[##1] - (\axis@tmpa, \axis@ycoordminTEX\axis@leftover) - -- (\axis@tmpa, \axis@ycoordmaxTEX\axis@rightover) - ; - }% - \foreach \x in {#1} { - \pgfextractx{\axis@tmpa}{\pgfpointxy{\x}{0}}% - % - \ifdim\axis@tmpa<\axis@xcoordminTEX - \else - \ifdim\axis@tmpa>\axis@xcoordmaxTEX - \else - % Achsenbeschriftung: - \ifnum\axis@tickposnum=1 - \node at - (\axis@tmpa,\axis@ycoordmaxTEX\axis@leftover) - [above,style=every tick label,style=every x tick label] - {\show@xticklabel\axisticknum\x}; - \else - \node at - (\axis@tmpa,\axis@ycoordminTEX\axis@leftover) - [below,style=every tick label,style=every x tick label] - {\show@xticklabel\axisticknum\x}; - \fi - \fi - \fi - \global\advance\axisticknum by1 - % - \begin{scope} - \clip (\axis@xcoordminTEX\axis@leftover, \axis@ycoordminTEX\axis@leftover) - rectangle (\axis@xcoordmaxTEX\axis@rightover, \axis@ycoordmaxTEX\axis@rightover); - % X-Axis ticks bottom and top - % in log: - % log( i*10^k ) = log\i + k\log10 -> draw ticks for i=1..9 - \ifneedsminorloop - \foreach \i in {1,...,9} { - \pgfextractx{\axis@tmpb}{\pgfpointxy{\logi\i}{0}}% - \advance\axis@tmpa by\axis@tmpb - \ifaxis@xminorgrids - \placecomputedgridline[style=every axis grid,style=every minor grid]% - \fi - \ifaxis@xminorticks - \axis@placecomputedtick\axis@subtickwidth[style=every tick,style=every minor tick]% - \fi - }% - \fi - \ifaxis@xmajorgrids - \placecomputedgridline[style=every axis grid,style=every major grid]% - \fi - \ifaxis@xmajorticks - \axis@placecomputedtick\axis@tickwidth[style=every tick,style=every major tick]% - \fi - \end{scope} - }% - \fi - \endgroup -} - -\def\axis@rememberplotspec#1{{% - \globaldefs=1 - \listpushback#1\to\axis@plotspeclist - \advance\axis@numplots by1% -}} - -\def\axis@getautoplotspec into#1{% - \listsize\autoplotspeclist\to\c@pgf@counta - \ifnum\c@pgf@counta=0 - \let#1=\empty - \else - \c@pgf@countb=\axis@numplots - \loop - \ifnum\c@pgf@countb<\c@pgf@counta - \else - \advance\c@pgf@countb by-\c@pgf@counta - \repeat - \listselect\c@pgf@countb\of\autoplotspeclist\to#1 -%\message{pgfplots.sty: using \string\autoplotspeclist\ specification no\#\the\c@pgf@countb (of \the\c@pgf@counta): #1}% - \fi -} - -% The main interface to draw a plot into an axis. -% -% Usage: -% \addplot -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% or -% -% \addplot[color=blue,mark=*] -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% The first syntax will use the next plot specification in the list -% \autoplotspeclist -% and the first will use blue color and * markers. -% -% The linespec. will be used in the legend. -\long\def\addplot{% - \@ifnextchar+{% - \axis@getautoplotspec into\nextplotspec - \axis@addplotimplAPPEND - }{% - \@ifnextchar[{% - \axis@addplotimpl% - }{% - \axis@getautoplotspec into\nextplotspec - % the space after ']' is required here: - % FIXME: - % - \addplot[]plot coordinates is NOT allowed!? - \expandafter\axis@addplotimpl\expandafter[\nextplotspec] - }% - }% -} - -\long\def\axis@addplotimplAPPEND+[{% - \expandafter\axis@addplotimpl\expandafter[\nextplotspec, -} - -\long\def\axis@addplotimpl[#1] #2;{% -%\tracingmacros=2\tracingcommands=2 - % #2 = plot coordinates {...} - \ifx\csname axis@execute at begin plot\endcsname\empty - \else - \csname axis@execute at begin plot\endcsname - \fi - \axis@rememberplotspec{[#1]}% - \ifaxis@filtercoords - % FIXME : FREE THIS VARIABLE: - \axis@filtercoords@and@up@limits#2;\newplotcmdto\axis@filteredcoordinateplotcmd - \def\axis@TMP{\axispath@impl{\draw[style=every axis plot,#1]}}% - \expandafter\axis@TMP\axis@filteredcoordinateplotcmd% - \else - \ifaxis@draw@at@end - \axis@update@limits{#2;}% - \fi - \axispath@impl{\draw[style=every axis plot,#1]}#2;% - \fi - \ifx\csname axis@execute at end plot\endcsname\empty - \else - \csname axis@execute at end plot\endcsname - \fi -%\tracingmacros=0\tracingcommands=0 -}% - -\long\def\axis@update@limits#1{% - \axis@foreach@plot@coord@do% - \axis@update@limits@for@one@point - \for - #1% - \EOI -} - -% PRECONDITIONS: -% - 'floating point numerics active' -% => coordinate filtering is active -% => #1 and #2 are MACRO names -% => these macros are encoded with \scisetcomponents -% - no coordinate filters active -% => #1 and #2 MAY be macros, but they must be valid TeX -% length (without unit). -\long\def\axis@update@limits@for@one@point#1#2{% -%\tracingmacros=2\tracingcommands=2 -%\message{Updating limits for (#1,#2) ...}% - \ifaxis@autocompute@xlim - \ifaxis@float@numerics@mode@x -%\scitofixedsingle\axis@xmin\axis@TMP -%\scitofixedsingle\axis@xmax\axis@TMPB -%\message{current limits: xmin=\axis@TMP, xmax=\axis@TMPB}% - \scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scigetcomponents\axis@xmin\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmin% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@xmin\axis@lim@S\axis@lim@M\axis@lim@E - % - \scigetcomponents\axis@xmax\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmax% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@xmax\axis@lim@S\axis@lim@M\axis@lim@E -%\scitofixedsingle\axis@xmin\axis@TMP -%\scitofixedsingle\axis@xmax\axis@TMPB -%\message{updated limits: xmin=\axis@TMP, xmax=\axis@TMPB}% - \else - \pgfmathmin{\axis@xmin}{#1}% - \let\axis@xmin=\pgfmathresult - \pgfmathmax{\axis@xmax}{#1}% - \let\axis@xmax=\pgfmathresult - \fi - \fi - \ifaxis@autocompute@ylim - \ifaxis@float@numerics@mode@y -%\scitofixedsingle\axis@ymin\axis@TMP -%\scitofixedsingle\axis@ymax\axis@TMPB -%\message{current limits: ymin=\axis@TMP, ymax=\axis@TMPB}% - \scigetcomponents#2\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scigetcomponents\axis@ymin\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmin% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@ymin\axis@lim@S\axis@lim@M\axis@lim@E - % - \scigetcomponents\axis@ymax\axis@lim@S\axis@lim@M\axis@lim@E - \scimathmax% - \axis@lim@S\axis@lim@M\axis@lim@E - \and% - \axis@tmp@S\axis@tmp@M\axis@tmp@E - \to% - \axis@lim@S\axis@lim@M\axis@lim@E - \scisetcomponents\axis@ymax\axis@lim@S\axis@lim@M\axis@lim@E -%\scitofixedsingle\axis@ymin\axis@TMP -%\scitofixedsingle\axis@ymax\axis@TMPB -%\message{updated limits: ymin=\axis@TMP, ymax=\axis@TMPB}% - \else - \pgfmathmin{\axis@ymin}{#2}% - \let\axis@ymin=\pgfmathresult - \pgfmathmax{\axis@ymax}{#2}% - \let\axis@ymax=\pgfmathresult - \fi - \fi - \axis@limits@are@computedtrue -%\tracingmacros=0\tracingcommands=0 -} - -% Filters coordinates and writes a new, modified 'plot coordinates' -% command to macro #2. -\long\def\axis@filtercoords@and@up@limits#1\newplotcmdto#2{% - \let#2=\empty - \let\axis@filter@output=#2 - \axis@foreach@plot@coord@do% - \axis@filter@one@coord@pair - \for - #1% - \EOI - \edef#2{plot coordinates {\axis@filter@output};}% -}% - -\def\axis@filter@one@coord@pair#1#2{% - \ifx\axis@xfilter\empty - \def\axis@filter@tmp@x{#1}% - \else - \let\axis@filter@tmp@x=\empty - \axis@xfilter#1\to\axis@filter@tmp@x - \fi - \ifx\axis@yfilter\empty - \def\axis@filter@tmp@y{#2}% - \else - \let\axis@filter@tmp@y=\empty - \axis@yfilter#2\to\axis@filter@tmp@y - \fi - \ifx\axis@filter@tmp@x\empty - \message{NOTE: coordinate (#1,#2) has been dropped because of the x-coordinate filter.}% - \else - \ifx\axis@filter@tmp@y\empty - \message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}% - \else - \ifaxis@draw@at@end - % update also axis limits: - \axis@update@limits@for@one@point{\axis@filter@tmp@x}{\axis@filter@tmp@y}% - \else - % apply data transformation directly. - \ifaxis@float@numerics@mode@x - \axis@datascaletrafo@x\axis@filter@tmp@x\to\axis@filter@tmp@x - \fi - \ifaxis@float@numerics@mode@y - \axis@datascaletrafo@y\axis@filter@tmp@y\to\axis@filter@tmp@y - \fi - \fi - % remind: - % \the\tokenregister - % will yield the contents of the token register, it will - % NOT expand recursively (like \expandafter)! - % - % Employ that here to maintain macros inside of - % \axis@filter@tmp[xy] - % (macros inside of those things are used by the floating - % point numerics to scale input data to TeX-lengths) - \pgfplots@toka=\expandafter{\axis@filter@output}% - \TOKL@ta=\expandafter{\axis@filter@tmp@x}% - \TOKL@tb=\expandafter{\axis@filter@tmp@y}% - \edef\axis@filter@output{\the\pgfplots@toka (\the\TOKL@ta,\the\TOKL@tb)}% -%\message{FILTERING: appended \axis@filter@tmp@x,\axis@filter@tmp@y}% -> results in \axis@filter@output}% - \fi - \fi -} - - -% A looping command to loop through plot coordinates. -% For every point, #3{X}{Y} will be invoked. -% -% No scoping is used during this operation, so you can access outer -% variables. -\long\def\axis@foreach@plot@coord@do#1\for plot coordinates #2;\EOI{% - \axis@foreach@plot@coord@ITERATE#1\n#2\EOI% -} - -\def\axis@foreach@plot@coord@ITERATE#1\n{% - \@ifnextchar;{% - \axis@foreach@plot@coord@FINISH@SEMICOLON% - }{% - \@ifnextchar\EOI{% - \axis@foreach@plot@coord@FINISH% - }{% - \axis@foreach@plot@coord@NEXT#1\n% - }% - }% -} - -\def\axis@foreach@plot@coord@NEXT#1\n(#2,#3){% - #1{#2}{#3}% - \axis@foreach@plot@coord@ITERATE#1\n -} - -\def\axis@foreach@plot@coord@FINISH\EOI{} -\def\axis@foreach@plot@coord@FINISH@SEMICOLON;\EOI{} - -% INPUT: -% a sequence of points (SMeE,SMeE) (terminated with ';') -% where S=sign, M=mantisse, E = exponent. -% Such input is generated in the case axis@float@numerics@modetrue -% by the coordinate filters. -% OUTPUT: -% proper sequence of fixed point coordinates which are the result of the -% data scaling transformation (\axis@datascaletrafo@x). -% -% The output will be written into the macro #1. -\long\def\axis@apply@data@scaletrafo@to@plot@data#1\to#2{% - \let#2=\empty - \let\axis@data@scaletrafo@result=\empty - \axis@foreach@plot@coord@do - \axis@apply@data@scaletrafo@to@one@point - \for - #1% - \EOI - \edef#2{plot coordinates {\axis@data@scaletrafo@result};}% - %\axis@apply@data@scaletrafo@to@plot@data@ITERATE\to#2 #1;% -} - -\def\axis@apply@data@scaletrafo@to@one@point#1#2{% - \ifaxis@float@numerics@mode@x - \axis@decode@filtered@float@numerics#1\to\axis@filter@tmp@x - \axis@datascaletrafo@x\axis@filter@tmp@x\to\axis@filter@tmp@x - \else - \def\axis@filter@tmp@x{#1}% - \fi - \ifaxis@float@numerics@mode@y - \axis@decode@filtered@float@numerics#2\to\axis@filter@tmp@y - \axis@datascaletrafo@y\axis@filter@tmp@y\to\axis@filter@tmp@y - \else - \def\axis@filter@tmp@y{#2}% - \fi - \edef\axis@data@scaletrafo@result{\axis@data@scaletrafo@result (\axis@filter@tmp@x,\axis@filter@tmp@y)}% -} - - -\def\axis@decode@filtered@float@numerics#1#2e#3\to#4{% - \scisetcomponents#4{#1}{#2}{#3}% -} - - -\long\def\axispath#1;{% - \axispath@impl{}#1; -} - -% low-level \axispath implementation. -% #1: -% the command which is responsable for drawing. -% - If #1 is NOT '\empty', we expect #2 to contain only -% EXPANDABLE DATA. -% That's important for postponed floating point arithmetics in #2. -% - If #1='\empty', we don't make any assumption about #2 -% and process it as-is. -% -% #2: see above. -\long\def\axispath@impl#1#2;{% - \ifaxis@draw@at@end - \listpushback{#1}\to\axis@stored@plot@cmds - \listpushback{#2;}\to\axis@stored@plot@data - \else - #1#2;% - \fi -} - - -% Assigns a legend. -% Syntax: -% \legend{entry 1\\entry2\\entry3} -\newcommand{\legend}[2][]{ - {% - \globaldefs=1% this will ONLY store the options and the legend into global variables - \def\axis@TMP{#1}% - \ifx\axis@TMP\empty - \else - \errmessage{Sorry, legend are now deprecated. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% - \fi - \def\axis@TMP{#2}% - \ifx\axis@TMP\empty - \else - \listnew\axis@legend{#2}% - \fi - } -} - -\newcommand{\addlegendentry}[1]{% - {% - \globaldefs=1% this will ONLY store the options and the legend into global variables - \listpushback#1\to\axis@legend - }% -} - -\def\axis@pop@next@legend{{% - \globaldefs=1 - \listcheckempty\axis@plotspeclist - \iflistempty - \let\axis@curplotlist=\empty - \else - \listpopfront\axis@plotspeclist\to\axis@curplotlist - \fi - % - \listcheckempty\axis@legend - \iflistempty - \let\axis@curlegend=\empty - \else - \listpopfront\axis@legend\to\axis@curlegend - \fi - \advance\axis@numplots by-1 -}} +\RequirePackage{tikz} -\long\def\axis@show@small@legendplots#1{ - \draw#1 - [mark repeat=2,mark phase=2] - plot coordinates { - (0cm,0cm) - (0.3cm,0cm) - (0.6cm,0cm)% - };% -} -% Typesets a legend node. -% -% It will either typeset a previously computed legend (which needs to be -% stored in the macro \axis@already@computed@legend@node) -% -% or it creates a legend, stores the commands into the macro named -% above and typesets it. -\newcommand\axis@createlegend{% - \ifx\axis@already@computed@legend@node\empty - \listcheckempty\axis@legend - \iflistempty - \else - % - % - \begingroup - % assemble a - % \matrix { - % small plot & legend1\\ - % small plot & legend2\\ - % ... - % }; - % command [and using the 'legend columns' option] - % - % \TOKL@ta={ - % small plot & legend1\\ - % small plot & legend2\\ - % ... - % } - % ( I have allocated the token register in my simplelist.sty) - % - % \global\def\axis@TMP{ - % \matrix { - % \TOKL@TA - % }; - % } - % -> finally, \axis@TMP will contain the complete command. - \TOKL@ta={}% - \let\curcolumnNum=\c@pgf@counta - \let\maxcolumnCount=\c@pgf@countb - \let\legendplotpos=\c@pgf@countc - \legendplotpos\expandafter=\axis@legend@plot@pos - \curcolumnNum=0 - \maxcolumnCount\expandafter=\csname axis@legend columns\endcsname\relax - % - \loop - \ifnum0<\axis@numplots\relax - \axis@pop@next@legend - \ifx\axis@curlegend\empty - \else - \advance\curcolumnNum by1 - \edef\axis@TMP{% - \the\TOKL@ta - \ifcase\legendplotpos - % legend plot pos=left - \noexpand\axis@show@small@legendplots{\axis@curplotlist}% - \noexpand\pgfmatrixnextcell - \noexpand\node {\axis@curlegend}; - \or - % legend plot pos=right - \noexpand\node {\axis@curlegend}; - \noexpand\pgfmatrixnextcell - \noexpand\axis@show@small@legendplots{\axis@curplotlist}% - \or - % legend plot pos=none - \noexpand\node {\axis@curlegend}; - \fi - \ifnum\curcolumnNum=\maxcolumnCount - \noexpand\\ - \else - \ifnum\axis@numplots=0 - \noexpand\\ - \else - \noexpand\pgfmatrixnextcell - \fi - \fi - }% - \ifnum\curcolumnNum=\maxcolumnCount - \curcolumnNum=0 - \fi - \expandafter\TOKL@ta\expandafter{\axis@TMP}% - \fi - \repeat - \TOKL@tb={\matrix[style=every axis legend]}% - \xdef\axis@TMP{% - \the\TOKL@tb {% - \the\TOKL@ta - };% - }% - \endgroup - \let\axis@already@computed@legend@node=\axis@TMP - \fi - \fi - \axis@already@computed@legend@node -} - -% Checks whether the argument to xtick or ytick is a UNIFORM tick -% sequence. -% -% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but -% NOT 0,2,4 or 4,10. -% -% Furthermore, any NON-integer tick arguments are also assumed to be -% NOT uniform. -% -% INPUT: -% #1: a tick argument (i.e. something which can be put to -% \foreach \x in {#1}) -% -% OUTPUT: -% \axis@isuniformticktrue -% or -% \axis@isuniformtickfalse -% depending on the check. -% This variable will be set globally. -\def\axis@checkisuniformLOGtick#1{% - \begingroup - \global\axis@isuniformticktrue - \newif\ifisfirst - \newif\iftwo@are@equal - \isfirsttrue - \foreach \x in {#1}{% - \pgfmathmultiply@\x\reciproc@logten - \let\cur=\pgfmathresult - % check whether - % \cur - last == 1 (last = \axis@TMPB) - \ifisfirst - \global\isfirstfalse - \else - \pgfmathsubtract@\cur\axis@TMPB% - \pgfmathlog@approxequalto@macro\pgfmathresult{1.0}{two@are@equal}% - \iftwo@are@equal - \else - \global\axis@isuniformtickfalse - \breakforeach - \fi - \fi - \global\let\axis@TMPB=\cur - }% - \endgroup -} - -\def\skipsuffixzero#1.#2|{ - {% - \def\axis@TMP{#2}% - \def\axis@TMPB{0}% - \ifx\axis@TMP\axis@TMPB - \global\def\pgfmathresult{#1}% - \else - \global\def\pgfmathresult{#1.#2}% - \fi - }% -} - -\def\logtologtentomacro#1#2{% - \pgfmathmultiply@{#1}\reciproc@logten% - \expandafter\skipsuffixzero\pgfmathresult|% - \let#2=\pgfmathresult -} - -% Expands to #1/log(10). It will also skip a suffix '.0' -\def\logtologten#1{% - \pgfmathmultiply@{#1}\reciproc@logten% - \expandafter\skipsuffixzero\pgfmathresult|% - \pgfmathresult -} - -% helper method which computes log10*\x foreach \x in {#1}. -% The result will be \xdef'ed into #2. -\def\axis@compute@tick@times@logten#1\to#2{% - \global\let#2=\empty - \foreach \axis@TMPB in {#1} {% - \pgfmathmultiply@\axis@TMPB\logten% - \ifx#2\empty - \xdef#2{\pgfmathresult}% - \else - \xdef#2{#2,\pgfmathresult}% - \fi - }% -} - -\def\axis@init@enlarge@limit@booleans{% - \axis@enlargelimits@autofalse - \axis@enlargelimitsfalse - \axis@enlargelimits@rel@threshfalse - \edef\axis@TMP{\axis@enlargelimits}% - % - \def\axis@TMPB{true}% - \ifx\axis@TMP\axis@TMPB - \axis@enlargelimitstrue - \else - \def\axis@TMPB{false}% - \ifx\axis@TMP\axis@TMPB - \else - \def\axis@TMPB{auto}% - \ifx\axis@TMP\axis@TMPB - \axis@enlargelimits@autotrue - \else - \begingroup - % try to read it as number: - \expandafter\pgf@xa\axis@enlargelimits pt\relax - \endgroup - \axis@enlargelimitstrue - \axis@enlargelimits@rel@threshtrue - \fi - \fi - \fi -} - -\def\axis@enlarge@limit@for#1{% - \begingroup - \expandafter\let\expandafter\min\expandafter=\csname axis@#1min\endcsname - \expandafter\let\expandafter\max\expandafter=\csname axis@#1max\endcsname - \ifcase\csname axis@#1mode\endcsname - \ifaxis@enlargelimits@rel@thresh - \edef\enlargepercent{\axis@enlargelimits}% - \else - \def\enlargepercent{0.1}% FIXME : pack 10% as default into option 'enlargelimits' or so - \fi - \pgfmathsubtract@\max\min% - \expandafter\pgf@xa\pgfmathresult pt - \expandafter\pgf@xb\enlargepercent\pgf@xa - \ifdim\pgf@xb>0.001pt - % the case with - % enlargeabsolute ~= 0 - % means that \min ~= \max. - % It is handled in another method. - \edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}% - % - % compute xmin := xmin - enlargeabsolute - \pgfmathsubtract@\min\enlargeabsolute% - \let\min=\pgfmathresult - \pgfmathadd@\max\enlargeabsolute% - \let\max=\pgfmathresult - \fi - \or - % compute - % \pgfmathsetmacro{\min}{\min - 0.5*\logten}% - % \pgfmathsetmacro{\max}{\max + 0.5*\logten}% - % just a more efficiently (I hope so): - \expandafter\pgfmath@x\logten pt - \divide\pgfmath@x by2 - \pgfmathlog@invoke@expanded\pgfmathsubtract@{{\min}{\pgf@sys@tonumber{\pgfmath@x}}}% - \let\min=\pgfmathresult - \pgfmathlog@invoke@expanded\pgfmathadd@{{\max}{\pgf@sys@tonumber{\pgfmath@x}}}% - \let\max=\pgfmathresult - \fi - \xdef\axis@TMP{\min}% - \xdef\axis@TMPB{\max}% - \endgroup - \expandafter\let\csname axis@#1min\endcsname=\axis@TMP - \expandafter\let\csname axis@#1max\endcsname=\axis@TMPB -} - -% Computes tick positions using the current axis limits. -% -% Parameters: -% \axisdefaulttickwidth -% Determines the maximum space which is not filled by at least one -% tick label (approximate, there is some rounding internally) -% \axisdefaulttryminticks -% see manual -% -% Idea: -% We want ticks at each -% { i*H, i in \Z }. -% Of course, there shouldn't be TOO MUCH ticks. -% -% Our heuristics is to set -% desirednumticks = round(ACTUAL WIDTH / axisdefaulttickwidth) -% and generate H = (axis range) / desirednumticks. -% -% Since not all step sizes H look well, restrict H to a set of allowed -% step sizes such as -% { 1, 1/2, 1/5, 1/10 }, -% or, to be more precise: -% { 1*10^e, 2*10^e, 5*10^e } -% -> round to the nearest matching number! -% -% Then, the resulting tick is -% TICK={MIN,MIN+H,...,MAX} -% where -% MIN = I*H -% is chosen such that -% axis minimum limit = I*H + rest; |rest| < H. -% -% -% PRECONDITION: -% - limits are correct -% - axis width/height is set correctly -% -% POSTCONDITION: -% - Tick for axis #1 is assigned -% - \ifaxis@needs@check@uniformtick is set -\def\axis@assign@default@tick@foraxis#1{% - \begingroup - % Shortcut-names: - \expandafter\let\expandafter\ifaxis@is@datascaled\csname ifaxis@float@numerics@mode@#1\endcsname - \expandafter\let\expandafter\axis@data@scale@trafo\csname axis@datascaletrafo@#1\endcsname - \expandafter\let\expandafter\axis@data@scale@inverse@trafo\csname axis@inverse@datascaletrafo@#1\endcsname - % - \let\desirednumticks=\c@pgf@countd - \let\Wr=\pgf@xc - \Wr=\csname axis@#1coordmaxTEX\endcsname - \advance\Wr by-\csname axis@#1coordminTEX\endcsname - % r = max place without ticks in pt -> choose desirednumticks >= W/r - \expandafter\expandafter\divide\Wr\axisdefaulttickwidth - \pgfmathsetcount{\desirednumticks}{\Wr}% - \advance\desirednumticks by1 - \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks - \expandafter\desirednumticks\axisdefaulttryminticks - \fi - \ifcase\csname axis@#1mode\endcsname - % compute tick := MIN,MIN+H,....,MAX - \let\MINH=\pgf@xa - \let\H=\pgf@xb - \let\MAX=\axis@tmpa - \let\MIN=\axis@tmpb - % compute step size 'H': - \expandafter\MAX\csname axis@#1max\endcsname pt - \advance\MAX by0.001pt% avoid round errors - %\expandafter\MIN\the\c@pgf@counta pt - \expandafter\MIN\csname axis@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN - \c@pgf@counta=\desirednumticks - \advance\c@pgf@counta by-1 - \divide\H by\c@pgf@counta -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - % - \edef\Hmacro{\pgf@sys@tonumber\H}% - \ifaxis@is@datascaled - \expandafter\axis@data@scale@inverse@trafo\Hmacro\to\Hmacro - \else - \expandafter\sciparsesignsingle\expandafter{\Hmacro}\Hmacro - \fi - \scigetcomponents\Hmacro\H@S\H@M\H@E -%\message{Got T^{-1}(H) = [\H@S] \H@M * 10^\H@E}% - % modify the mantisse: - \expandafter\H\H@M pt - \ifdim\H<2pt - \ifdim\H<1.5pt - \def\H@M{1.0}% - \else - \def\H@M{2.0}% - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \def\H@M{2.0}% - \else - \def\H@M{5.0}% - \fi - \else - \ifdim\H<7.5pt - \def\H@M{5.0}% - \else - \def\H@M{1.0}% - \expandafter\c@pgf@counta\H@E - \advance\c@pgf@counta by1 - \edef\H@E{\the\c@pgf@counta}% - \fi - \fi - \fi - \scisetcomponents\Hmacro\H@S\H@M\H@E - \ifaxis@is@datascaled - \axis@data@scale@trafo\Hmacro\to\Hmacro - \else - \scitofixedsingle\Hmacro\Hmacro - \fi -%\message{I have computed H=\Hmacro}% - \expandafter\H\Hmacro pt -%\message{final H=\the\H}% - % - % Now, we want to activate the Tick set {i*H, i in \Z} - % compute I such that - % xmin = I * H + rest; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\pgf@sys@tonumber\H}% - }% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \MIN=\H - \multiply\MIN by\c@pgf@counta - \MINH=\MIN - \advance\MINH by\H - \xdef\axis@TMP{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% - \aftergroup\axis@needs@check@uniformtickfalse - \or - \expandafter\ifx\csname axis@#1tickten\endcsname\empty - % I want ticks at 10^k. So determine k_min and k_max. - % - % FIXME: optimize! - \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1min\endcsname*\reciproc@logten-1}% - \pgfmathsetmacro{\tmp@min}{\c@pgf@counta*\logten}% - \pgfmathsetcount{\c@pgf@counta}{\csname axis@#1max\endcsname*\reciproc@logten}% - \pgfmathsetmacro{\tmp@max}{\c@pgf@counta*\logten}% - \pgfmathadd\tmp@min\logten% - \xdef\axis@TMP{\tmp@min,\pgfmathresult,...,\tmp@max}% - \aftergroup\axis@needs@check@uniformtickfalse - \else - \edef\axis@TMP{\csname axis@#1tickten\endcsname}% - \expandafter\axis@compute@tick@times@logten\axis@TMP\to\axis@TMP - \aftergroup\axis@needs@check@uniformticktrue - \fi - \fi - \endgroup - \expandafter\let\csname axis@#1tick\endcsname=\axis@TMP -%\message{pgfplots.sty: #1tick set to \csname axis@#1tick\endcsname [#1mode=\the\csname axis@#1mode\endcsname, #1min=\csname axis@#1min\endcsname, #1max=\csname axis@#1max\endcsname].}% -} - -% Helper method for -% \axis@apply@data@scale@trafo@to@options@for -% #1: the ticks -% #2: the trafo macro name (the form taking three args) -% #3: the output macro name -\long\def\axis@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% - \let#3=\empty - \foreach \axis@TMPB in {#1} {% - \expandafter\sciparsesign\expandafter{\axis@TMPB}\sci@S\sci@M\sci@E - #2\sci@S\sci@M\sci@E\to\axis@TMPB - \ifx#3\empty - \xdef#3{\axis@TMPB}% - \else - \xdef#3{#3,\axis@TMPB}% - \fi - }% - % -}% - -% helper for \axis@apply@data@scale@trafo@to@options@for. -\def\axis@compute@number@order@for@trafo@isdimen#1\tocount#2{% - \edef\axis@TMP{\pgf@sys@tonumber{#1}}% - \expandafter\sciparsesign\expandafter{\axis@TMP}\S\M\E - \expandafter#2\E\relax - \advance#2 by1 -} - -% helper for \axis@apply@data@scale@trafo@to@options@for. -% -\def\axis@compute@number@order@for@trafo@isfloat#1\tocount#2{% - \scigetcomponents#1\S\M\E - \expandafter#2\E\relax - \advance#2 by1 -} - -% Initialises the data scale transformation and applies it to any -% user specified options. -% -% PRECONDITION: -% - all axis limits are available in float representation -% (i.e. with \scisetcomponents) -% - \axis@set@default@size@options has been called before -% POSTCONDITION: -% - the scaling transformation is set up, -% - all axis limits are transformed, -% - any user input (like ticks and tick labels) -% will reflect the changes. -\def\axis@apply@data@scale@trafo@to@options@for#1{% - % initialise data scale transformation - % T(x) = 10^{q-m} * x - % - \begingroup - \let\data@max@order=\c@pgf@counta - \let\data@cur@order=\c@pgf@countb - \let\data@dimen=\pgf@xa - \let\data@dimen@order=\c@pgf@countc - % - % Step 1: compute 'm', the data order - \expandafter\axis@compute@number@order@for@trafo@isfloat - \csname axis@#1min\endcsname - \tocount\data@cur@order - % - \data@max@order=\data@cur@order - % - \expandafter\axis@compute@number@order@for@trafo@isfloat - \csname axis@#1max\endcsname - \tocount\data@cur@order - % - \ifnum\data@cur@order>\data@max@order - \data@max@order=\data@cur@order - \fi - % - % Step 2: compute 'q', the #1-size of the axis. - \expandafter\ifx\csname axis@#1\endcsname\empty - % We have 'width' or 'height'. - % - % Use the order of these parameters. - \def\axis@TMP{#1}% - \def\axis@TMPB{x}% - \ifx\axis@TMP\axis@TMPB - \expandafter\data@dimen\axis@width\relax - \else - \def\axis@TMPB{y}% - \ifx\axis@TMP\axis@TMPB - \expandafter\data@dimen\axis@height\relax - \fi - \fi - \axis@compute@number@order@for@trafo@isdimen - \data@dimen - \tocount\data@dimen@order - % This here is to avoid inaccuracies in the final - % axis rectangle size, see \axis@initsizes: - \advance\data@dimen@order by-1 - \else - % FIXME: - % we have either the 'x=1cm' or 'y=1cm' option! - % How should I initialise the trafo!? - \data@dimen@order=3 - \fi - % -%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% - \advance\data@dimen@order by-\data@max@order - \xdef\axis@TMP{\the\data@dimen@order}% - \endgroup -%\message{Initialising the data scale transformation in direction #1 to \axis@TMP...}% - % COMPLETE INITIALISATION: - \ifaxis@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY - \message{WARNING: the automatic scaling of input data has been DISABLED to allow axispath commands [otherwise, axispath commands would not know of the pgfplots scalings - leading to wrong images). DISABLING THE DATA SCALING LIMITS THE DATA RANGE! I hope I can fix this issue as soon as possible. Please take a look at the manual for more information. If you get 'OVERFLOW' or 'UNDERFLOW' errors, you may need to disable the axispath.}% - \def\axis@TMP{0}% - \expandafter\let\csname axis@data@scale@trafo@SHIFT@#1\endcsname\axis@TMP - \else - \expandafter\let\csname axis@data@scale@trafo@SHIFT@#1\endcsname\axis@TMP - \fi - % - % ... and apply transformation to any user input - % - % Transform axis limits: - \expandafter\expandafter\csname axis@datascaletrafo@#1\endcsname\csname axis@#1min\endcsname\to\axis@TMP - \expandafter\let\csname axis@#1min\endcsname=\axis@TMP - % - \expandafter\expandafter\csname axis@datascaletrafo@#1\endcsname\csname axis@#1max\endcsname\to\axis@TMP - \expandafter\let\csname axis@#1max\endcsname=\axis@TMP - % - % Convert any user-specified ticks: - \edef\axis@TMP{\csname axis@#1tick\endcsname}% - % this here should also work with 'xtick=\empty', the "No tick" command. - \ifx\axis@TMP\empty - \else -%\message{Converting #1tick='\csname axis@#1tick\endcsname'}% - \pgfplots@toka=\expandafter{\csname axis@datascaletrafo@#1@three\endcsname}% - \edef\axis@TMP{{\csname axis@#1tick\endcsname}\the\pgfplots@toka}% - \expandafter\axis@apply@data@scale@trafo@to@user@ticks\axis@TMP\to\axis@TMPC - \expandafter\let\csname axis@#1tick\endcsname=\axis@TMPC - \fi - % - % Transform any explicit axis unit scalings: - \expandafter\ifx\csname axis@#1\endcsname\empty - \else -%\message{Converting #1 unit scale='\csname axis@#1\endcsname' ... }% - \expandafter\pgfmathparse\expandafter{\csname axis@#1\endcsname}% - \expandafter\expandafter\csname axis@inverse@datascaletrafo@tofixed@#1\endcsname\pgfmathresult\to\axis@TMP - \edef\axis@TMP{\axis@TMP pt}% - \expandafter\edef\csname axis@#1\endcsname{\axis@TMP}% -%\message{to #1='\csname axis@#1\endcsname'.}% - \fi -} - -\def\axis@determinedefaultvalues{% - \ifx\axis@xmin\empty - \errmessage{Sorry, the argument 'xmin=NUM' is mandatory to draw axes }% - \def\axis@xmin{0}% - \fi - \ifx\axis@xmax\empty - \errmessage{Sorry, the argument 'xmax=NUM' is mandatory to draw axes }% - \def\axis@xmax{1}% - \fi - \ifx\axis@ymin\empty - \errmessage{Sorry, the argument 'ymin=NUM' is mandatory to draw axes }% - \def\axis@ymin{0}% - \fi - \ifx\axis@ymax\empty - \errmessage{Sorry, the argument 'ymax=NUM' is mandatory to draw axes }% - \def\axis@ymax{1}% - \fi - % - \axis@set@default@size@options - % - \ifaxis@float@numerics@mode@x - \axis@apply@data@scale@trafo@to@options@for x% - \fi - \ifaxis@float@numerics@mode@y - \axis@apply@data@scale@trafo@to@options@for y% - \fi - % - \ifnum\axis@xmode=0 - \axis@xminorticksfalse - \fi - \ifnum\axis@ymode=0 - \axis@yminorticksfalse - \fi - % - \axis@init@enlarge@limit@booleans - \ifaxis@enlargelimits - % relax the sizes. - % - % Idea: if the user chose his xmin,xmax tight to his data, - % this here will look better. - \axis@enlarge@limit@for x - \axis@enlarge@limit@for y - \else - \ifaxis@enlargelimits@auto - \ifaxis@hide - % there is no axis, so skip this enlargement (unless - % the user explizitly requests it) - \else - % FIXME : this here should be user-configurable! - \ifaxis@autocompute@xlim - \axis@enlarge@limit@for x - \fi - \ifaxis@autocompute@ylim - \axis@enlarge@limit@for y - \fi - \fi - \fi - \fi - % - \axis@avoid@empty@axis@range@for x% - \axis@avoid@empty@axis@range@for y% - % - \axis@initsizes - % - \newif\ifaxis@xisuniform - \newif\ifaxis@yisuniform - \axis@xisuniformtrue - \axis@yisuniformtrue - \newif\ifaxis@needs@check@uniformtick - \axis@needs@check@uniformticktrue - \ifx\axis@xtick\empty - \axis@assign@default@tick@foraxis{x}% - \fi - \ifaxis@needs@check@uniformtick - \ifnum\axis@xmode=1 - \expandafter\axis@checkisuniformLOGtick\expandafter{\axis@xtick}% - \fi - \ifaxis@isuniformtick - \axis@xisuniformtrue - \else - \axis@xminorticksfalse - \axis@xisuniformfalse - \fi - \fi - % - % - % - \axis@needs@check@uniformticktrue - \ifx\axis@ytick\empty - \axis@assign@default@tick@foraxis{y}% - \fi - \ifaxis@needs@check@uniformtick - \ifnum\axis@ymode=1 - \expandafter\axis@checkisuniformLOGtick\expandafter{\axis@ytick}% - \fi - \ifaxis@isuniformtick - \axis@yisuniformtrue - \else - \axis@yminorticksfalse - \axis@yisuniformfalse - \fi - \fi - \ifx\axis@xticklabel\empty - \ifcase\axis@xmode - \def\axis@xticklabel{\axisdefaultticklabel}% - \or - \def\axis@xticklabel{\axisdefaultticklabellog}% - \fi - \fi - \ifx\axis@yticklabel\empty - \ifcase\axis@ymode - \def\axis@yticklabel{\axisdefaultticklabel}% - \or - \def\axis@yticklabel{\axisdefaultticklabellog}% - %-------------------------------------------------- - % \def\axis@yticklabel{% - % \pgfmathexp\tick - % \expandafter\skipsuffixzero\pgfmathresult|% - % $\pgfmathresult$}% - %-------------------------------------------------- - \fi - \fi -} - - -% Helper method for initsizes. -% -% It computes a scaling such that \axis@width = SCALE * ACTUAL WIDTH. -% -% The actual width is -% c + x*(xmax-xmin) -% based on -% - x*xmax = \axis@xcoordmaxTEX -% - x*xmin = \axis@xcoordminTEX -% - c = estimated, a constant for the axis label/tick labels -% -% Arguments: -% #1: the output argument for the SCALE. -\def\axis@initsizes@getXscale\into#1{% - \expandafter\axis@tmpa\axis@width\relax - % EXPECTED WIDTH = X = \axis@width - % ACTUAL WIDTH = c + x * (xmax-xmin) - % where c is a CONSTANT (for the axis labels/tick labels). - % -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin)) - % - % \axis@tmpa := X-c: - \ifaxis@scale@only@axis - \else - \advance\axis@tmpa by-45pt% FIXME determine 'c' correctly! - \fi - \ifdim\axis@tmpa<0pt - \errmessage{Error: Plot width `\axis@width' is too small. This can't be realised while maintaining constant width for y-labels. Sorry, label width are only approximate. You will need to adjust your width.}% - \axis@tmpa=0pt - \fi - % \axis@tmpb := x*(xmax-xmin): - \axis@tmpb=\axis@xcoordmaxTEX - \advance\axis@tmpb by-\axis@xcoordminTEX - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\axis@tmpa}% - {\pgf@sys@tonumber\axis@tmpb}% - }% - \let#1=\pgfmathresult -%\message{pgfplots.sty: Computing 'x' such that 'width = c + x*(xmax-xmin)'; -% c=estimated, -% width-c =\the\axis@tmpa, -% x*(xmax[=\the\axis@xcoordmaxTEX] - xmin[=\the\axis@xcoordminTEX)]) = \the\axis@tmpb -% -> x-scale =#1 }% -} - -% The same as \axis@initsizes@getXscale, just for the height. -\def\axis@initsizes@getYscale\into#1{% - \expandafter\axis@tmpa\axis@height\relax - % EXPECTED WIDTH = X = \axis@width - % ACTUAL WIDTH = c + x * (xmax-xmin) - % where c is a CONSTANT (for the axis labels/tick labels). - % -> \axis@tmpXscale = (X - c) / (x *(xmax-xmin)) - % - % \axis@tmpa := X-c: - \ifaxis@scale@only@axis - \else - \advance\axis@tmpa by-45pt\relax% FIXME determine 'c' correctly! - \fi - \ifdim\axis@tmpa<0pt - \errmessage{Error: Plot height `\axis@height' is too small. This can't be realised while maintaining constant height for x-labels. Sorry, label heights are only approximate. You will need to adjust your height.}% - \axis@tmpa=0pt - \fi - % \axis@tmpb := x*(xmax-xmin): - \axis@tmpb=\axis@ycoordmaxTEX - \advance\axis@tmpb by-\axis@ycoordminTEX - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\axis@tmpa}% - {\pgf@sys@tonumber\axis@tmpb}% - }% - \let#1=\pgfmathresult -%\message{pgfplots.sty: Computing 'y' such that 'height = c + y*(ymax-ymin)'; -% height=\axis@height, -% c=estimated, -% height-c =\the\axis@tmpa, -% y*(ymax[=\the\axis@ycoordmaxTEX] - ymin[=\the\axis@ycoordminTEX)]) = \the\axis@tmpb -% -> y-scale =#1 }% -} - - -% Checks whether axis limits in coordinate #1 are approximately equal. -% -% If that is the case, force a non-zero width of the range. -% -\def\axis@avoid@empty@axis@range@for#1{% - % Check if axis limits are empty: - \begingroup - \expandafter\let\expandafter\if@cur@is@scaled\csname ifaxis@float@numerics@mode@#1\endcsname - \expandafter\let\expandafter\min\csname axis@#1min\endcsname - \expandafter\let\expandafter\max\csname axis@#1max\endcsname - \let\min@d=\pgf@xa - \let\max@d=\pgf@xb - \let\diff=\pgf@xc - \newif\ifrange@is@approx@equal - \expandafter\min@d\min pt - \expandafter\max@d\max pt - \diff=\max@d - \advance\diff by-\min@d - % FIXME : I need a RELATIVE check here! - % but: real number point division is expensive - \if@cur@is@scaled - % this here should be sufficient because the axis - % has absolute values of order O( 10^3 ) or so. - \ifdim\diff<1pt - \range@is@approx@equaltrue - \fi - \else - % there is no data scaling, so I should be much more defensive - % with absolute thresholds... - \ifdim\diff<0.05pt - \range@is@approx@equaltrue - \fi - \fi - \ifrange@is@approx@equal -%\message{avoid range is approx equal for coord #1: MODIFYING (\min,\max)...}% - % the case \min ~= \max - % - % enlarge \max and shrink \min: - \ifdim\max@d<0pt - \ifdim\max@d<-1pt - \max@d=0.8\max@d - \min@d=1.2\min@d - \else - \advance\max@d by-1pt - \advance\min@d by1pt - \fi - \else - \ifdim\max@d>1pt - \max@d=1.2\max@d - \min@d=0.8\min@d - \else - \ifdim\max@d=0pt - \if@cur@is@scaled - % we can't simply add a constant in the - % transformed range. - % - % So: set limits to [-1,1] = [-1.0e0,+1.0e0] - \def\sci@S{2}% - \def\sci@M{1.0}% - \def\sci@E{0}% - \csname axis@datascaletrafo@#1@three\endcsname\sci@S\sci@M\sci@E\to\min - \def\sci@S{1}% - \def\sci@M{1.0}% - \def\sci@E{0}% - \csname axis@datascaletrafo@#1@three\endcsname\sci@S\sci@M\sci@E\to\max -%\message{[trafo shift = \csname axis@data@scale@trafo@SHIFT@#1\endcsname; setting limits -1:1]}% - \expandafter\min@d\min pt - \expandafter\max@d\max pt - \else - \advance\max@d by1pt - \advance\min@d by-1pt - \fi - \else - \advance\max@d by1pt - \advance\min@d by-1pt - \fi - \fi - \fi - \xdef\axis@TMP{\pgf@sys@tonumber{\min@d}}% - \xdef\axis@TMPB{\pgf@sys@tonumber{\max@d}}% -%\message{ -> #1 = \axis@TMP : \axis@TMPB;}% - \else - \global\let\axis@TMP=\min% - \global\let\axis@TMPB=\max% - \fi - \endgroup - \expandafter\let\csname axis@#1min\endcsname=\axis@TMP - \expandafter\let\csname axis@#1max\endcsname=\axis@TMPB -} - -% PRECONDITION: -% none -% POSTCONDITION: -% \axis@default@aspect@ratio is set. -\def\axis@compute@default@aspect@ratio{% - \expandafter\pgfmath@x\axisdefaultwidth - \expandafter\pgfmath@y\axisdefaultheight - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber{\pgfmath@x}}% - {\pgf@sys@tonumber{\pgfmath@y}}% - }% - \let\axis@default@aspect@ratio=\pgfmathresult -} - -\def\axis@set@default@size@options{% - % The axes 'x' and 'y' vectors will be scaled such that the total - % size is (\axisdefaultwidth, \axisdefaultheight). - % - % If the user specifies ONE of width OR height, - % the plot will be resized; keeping the aspect ratio. - % - \let\axis@default@aspect@ratio=\empty - % CASES: - % hasx := 'x' option non-empty - % hasy := 'y' option non-empty - % W := 'width' option non-empty - % H := 'height' option non-empty - % - % hasx = 1 -> width is not interesting; we use 'x' option. - % hasx = 0 -> determine final width: - % W H - % 0 0 -> \axisdefaultwidth - % 0 1 -> determine width out of H and the default aspect ratio - % 1 X -> ok, use the user parameter. - % - % hasy = 1 -> height is not interesting, we use 'y' option. - % hasy = 0 -> determine final height: - % W H - % 0 0 -> \axisdefaultheight - % X 1 -> ok, use the user parameter - % 1 0 -> determine height out of W and the default aspect ratio - % - \ifx\axis@x\empty - \ifx\axis@y\empty - % hasx=0, hasy=0 - % - % -> KEEP ASPECT RATIO if just one W, or H is given! - \ifx\axis@width\empty - \ifx\axis@height\empty - % The case hasx=0, hasy=0, W=0 H=0: - \let\axis@width=\axisdefaultwidth - \let\axis@height=\axisdefaultheight - \else - % The case hasx=0, hasy=0, W=0 H=1: - \axis@compute@default@aspect@ratio - \expandafter\pgfmath@y\axis@height - \pgfmathlog@invoke@expanded\pgfmathmultiply@{% - {\pgf@sys@tonumber{\pgfmath@y}}% - {\axis@default@aspect@ratio}% - }% - \edef\axis@width{\pgfmathresult pt}% - \fi - \else - \ifx\axis@height\empty - % The case hasx=0, hasy=0, W=1 H=0: - \axis@compute@default@aspect@ratio - \expandafter\pgfmath@x\axis@width - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber{\pgfmath@x}}% - {\axis@default@aspect@ratio}% - }% - \edef\axis@height{\pgfmathresult pt}% - \else - % The case hasx=0, hasy=0, W=1 H=1: - \fi - \fi - \else - % hasx=0, hasy=1, W=0: - \ifx\axis@width\empty - \let\axis@width=\axisdefaultwidth - \fi - \fi - \else - \ifx\axis@y\empty - % hasx=1, hasy=0, H=0 - \ifx\axis@height\empty - \let\axis@height=\axisdefaultheight - \fi - \fi - \fi -} - -% PRECONDITION: -% - final axis limits are given in transformed range -% - \axis@set@default@size@options has been invoked before -% POSTCONDITION: -% - the current x- and y unit vectors are changed; -% - \axis@[xy]coord{min,max}TEX are set -% -\def\axis@initsizes{% - % INIT. - % - % - \pgfpointxy{\axis@xmin}{\axis@ymin}% - \axis@xcoordminTEX=\pgf@x - \axis@ycoordminTEX=\pgf@y - \pgfpointxy{\axis@xmax}{\axis@ymax}% - \axis@xcoordmaxTEX=\pgf@x - \axis@ycoordmaxTEX=\pgf@y - % - % - %----------------------------------------- - % PROCESS THE 'width' and 'height' options - %----------------------------------------- - % - % FIXME: make these variables LOCAL: - % - \let\axis@rectangle@width=\empty - \let\axis@rectangle@height=\empty - % - \ifx\axis@x\empty - \ifx\axis@width\empty - \errmessage{INTERNAL LOGIC ERROR! WIDTH NOT SET}% - \fi - \axis@initsizes@getXscale\into\axis@tmpXscale - \ifaxis@scale@only@axis - \let\axis@rectangle@width=\axis@width - \fi - \else - \def\axis@tmpXscale{1}% - \fi - % - \ifx\axis@y\empty - \ifx\axis@height\empty - \errmessage{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% - \fi - \axis@initsizes@getYscale\into\axis@tmpYscale - \ifaxis@scale@only@axis - \let\axis@rectangle@height=\axis@height - \fi - \else - \def\axis@tmpYscale{1}% - \fi - % - % - % assert( \axis@tmpXscale != \empty && \axis@tmpYscale != \empty ) - % - % Apply scaling: - \pgfpointxy{\axis@tmpXscale}{\axis@tmpYscale}% - \axis@tmpa=\pgf@x - \axis@tmpb=\pgf@y - \ifx\axis@x\empty - \pgfsetxvec{\pgfpoint{\axis@tmpa}{0pt}}% - \else - \pgfsetxvec{\pgfpoint{\axis@x}{0pt}}% - \fi - \ifx\axis@y\empty - \pgfsetyvec{\pgfpoint{0pt}{\axis@tmpb}}% - \else - \pgfsetyvec{\pgfpoint{0pt}{\axis@y}}% - \fi - % - % Determine final rectangle dimensions. - % There are the following cases: - % 1. the user really wants a fixed dimension, - % i.e. he used 'scale only axis'. - % Then, we have to work to get the correct dimension! - % - % Up to now, the scaling mechanism looses to many significant - % digits such that the final width/height differs by 1-2 pt. - % - % If I am not mistaken, this does ONLY affect the final size, - % not the relative plot precision. - % - % FIXME : really compute the plot precision! - % - % 2. The use specified width and/or height, but not 'scale only - % axis'. Accept inaccurate final widths/heights (see above). - % - % 3. The user supplied 'x' and or 'y'. Simply use them, its - % accurate. - % - \pgfpointxy{\axis@xmin}{\axis@ymin}% - \axis@xcoordminTEX=\pgf@x - \axis@ycoordminTEX=\pgf@y - \pgfpointxy{\axis@xmax}{\axis@ymax}% - \ifx\axis@rectangle@width\empty - \axis@xcoordmaxTEX=\pgf@x - \else - % this 'if' here should only make a difference of about - % 1-2pt, not more. - % - % and I am quite sure that this inaccuracy (and this - % work-around) only affects the - % final size, not the relative plot accuracy. - \axis@xcoordmaxTEX=\axis@xcoordminTEX - \expandafter\advance\expandafter\axis@xcoordmaxTEX\axis@width - \fi - \ifx\axis@rectangle@height\empty - \axis@ycoordmaxTEX=\pgf@y - \else - \axis@ycoordmaxTEX=\axis@ycoordminTEX - \expandafter\advance\expandafter\axis@ycoordmaxTEX\axis@height - \fi -%-------------------------------------------------- -% \begingroup -% \pgf@x=\axis@xcoordmaxTEX\advance\pgf@x by-\axis@xcoordminTEX -% \pgf@y=\axis@ycoordmaxTEX\advance\pgf@y by-\axis@ycoordminTEX -% \message{Axis scaling x=\axis@tmpXscale, y=\axis@tmpYscale\ yields lower-left-corner (\axis@xmin,\axis@ymin) = (\the\axis@xcoordminTEX,\the\axis@ycoordminTEX) and upper right (\axis@xmax,\axis@ymax) = (\the\axis@xcoordmaxTEX,\the\axis@ycoordmaxTEX). Axis dimensions are width=\the\pgf@x, height=\the\pgf@y.}% -% \endgroup -%-------------------------------------------------- -} - -\def\axis@BEGIN@init@and@draw@axis{% - \axis@determinedefaultvalues - - % move the anchor to (0,0): - \expandafter\ifcase\axis@anchorchoicenum - % north: - \begin{scope}[ - yshift=-\axis@ycoordmaxTEX, - xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX - ] - \or% north west: - \begin{scope}[ - yshift=-\axis@ycoordmaxTEX, - xshift=-\axis@xcoordminTEX - ] - \or% west: - \begin{scope}[ - yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX, - xshift=-\axis@xcoordminTEX - ] - \or% south west: - \begin{scope}[ - yshift=-\axis@ycoordminTEX, - xshift=-\axis@xcoordminTEX - ] - \or% south: - \begin{scope}[ - yshift=-\axis@ycoordminTEX, - xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX - ] - \or% south east: - \begin{scope}[ - yshift=-\axis@ycoordminTEX, - xshift=-\axis@xcoordmaxTEX - ] - \or% east: - \begin{scope}[ - yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX, - xshift=-\axis@xcoordmaxTEX - ] - \or% north east: - \begin{scope}[ - yshift=-\axis@ycoordmaxTEX, - xshift=-\axis@xcoordmaxTEX - ] - \or% center - \begin{scope}[ - yshift=-0.5\axis@ycoordminTEX-0.5\axis@ycoordmaxTEX, - xshift=-0.5\axis@xcoordminTEX-0.5\axis@xcoordmaxTEX - ] - \fi - - \begin{scope} - \ifaxis@hide - \clip - (\axis@xcoordminTEX, \axis@ycoordminTEX) - rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX); - \else - - % X-Achsenbeschriftung: - % LADE DIE \axis@xtick -variable REIN - \expandafter\axis@drawxaxis\expandafter{\axis@xtick} - % - % Y-Achsen und Achsenbeschriftung: - \expandafter\axis@drawyaxis\expandafter{\axis@ytick}% - \draw[clip] - (\axis@xcoordminTEX, \axis@ycoordminTEX) - rectangle (\axis@xcoordmaxTEX, \axis@ycoordmaxTEX); - - \fi -} - -\def\axis@END@init@and@draw@axis{% - \end{scope}% -} - -% Writes output to \axis@TMP -\def\axis@filter@input@ticks@with@log#1{% - \let\axis@TMP=\empty - \foreach \axis@TMPB in {#1} {% - \expandafter\pgfmathlog@\expandafter{\axis@TMPB}% - \ifx\axis@TMP\empty - \xdef\axis@TMP{\pgfmathresult}% - \else - \xdef\axis@TMP{\axis@TMP,\pgfmathresult}% - \fi - }% -} - -\tikzdeclarecoordinatesystem{axis}{\axis@evalute@tikz@coord@system@interface#1\axis@coord@end} - - -% Assigns \pgfmathresult := canvas coordinate (#2) for axis #1. -\long\def\axis@evalute@tikz@coord@system@interface@for#1#2{% - \expandafter\let\expandafter\if@datascaled@cur\csname ifaxis@float@numerics@mode@#1\endcsname - \expandafter\ifcase\csname axis@#1mode\endcsname - \if@datascaled@cur - \csname axis@datascaletrafo@fromfixed@#1\endcsname#2\to\pgfmathresult - \else - \def\pgfmathresult{#2}% - \fi - \or - \pgfmathlog@{#2}% - \fi -} - -\long\def\axis@evalute@tikz@coord@system@interface#1,#2\axis@coord@end{% - \begingroup - \axis@evalute@tikz@coord@system@interface@for{x}{#1}% - \let\axis@evaluate@tikz@coord@x=\pgfmathresult - \axis@evalute@tikz@coord@system@interface@for{y}{#2}% - \xdef\axis@TMP{\axis@evaluate@tikz@coord@x pt}% - \xdef\axis@TMPB{\pgfmathresult pt}% - \endgroup - \pgfpointxy{\axis@TMP}{\axis@TMPB}% -} - -% In case of (semi-) logplots, this command will -% - assign a filter which invokes \pgfmathlog@{} for each coordinate -% - replace any user-specified coordinate by its log. -% -% All subsequent commands will then work with logarithmic coordinates. -% -% @see pgfmathlog.sty for details about the implementation of log(). -% -% PRECONDITION: -% - The user input options have been set correctly, -% - the option processing has not yet begun -% -% POSTCONDITION: -% - any user input for log-axis has been replaced by its log -% - coordinate filters to compute logs are installed -% -% See also: -% \axis@apply@data@scale@trafo@to@options@for -\def\axis@prepare@coord@filtering@for#1{% - \expandafter\ifcase\csname axis@#1mode\endcsname - \ifaxis@disabledatascaling - \csname axis@float@numerics@mode@#1false\endcsname - \axis@float@numerics@modefalse - \else - \csname axis@float@numerics@mode@#1true\endcsname - \axis@float@numerics@modetrue - \fi - \ifaxis@float@numerics@mode - % Install coordinate filters that - % - read input as normalised floating point numbers, - % - return [SIGN][MANTISSE]eEXPONENT - % Motivation: - % 1. we can compute axis limits using such data - % 2. we can remember the floating point representation for - % the data scaling transformation. - % ATTENTION: - % this here is a preprocessing step! You will need to - % apply the data scaling later! - % see - % \axis@apply@data@scaletrafo@to@plot@data - \expandafter\let\expandafter\axis@TMP\csname axis@#1filter\endcsname - \ifx\axis@TMP\empty - \expandafter\def\csname addplot@float@numerics@#1filter\endcsname##1\to##2{% - \sciparsesign{##1}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scisetcomponents{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \edef##2{\axis@tmp@S\axis@tmp@M e\axis@tmp@E}% - }% - \else - \expandafter\let\csname axis@#1filter@orig\endcsname=\axis@TMP - \expandafter\def\csname addplot@float@numerics@#1filter\endcsname##1\to##2{% - \csname axis@#1filter@orig\endcsname##1\to##2\relax - \ifx##2\empty - \else - \expandafter\sciparsesign\expandafter{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \scisetcomponents{##2}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \edef##2{\axis@tmp@S\axis@tmp@M e\axis@tmp@E}% - \fi - }% - \fi - \expandafter\let\expandafter\axis@TMP\csname addplot@float@numerics@#1filter\endcsname - \expandafter\let\csname axis@#1filter\endcsname\axis@TMP - % - % Check for any existing axis limits: - \expandafter\let\expandafter\axis@TMP\csname axis@#1min\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\sciparsesign\expandafter{\axis@TMP}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \expandafter\scisetcomponents\csname axis@#1min\endcsname\axis@tmp@S\axis@tmp@M\axis@tmp@E - \fi - \expandafter\let\expandafter\axis@TMP\csname axis@#1max\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\sciparsesign\expandafter{\axis@TMP}\axis@tmp@S\axis@tmp@M\axis@tmp@E - \expandafter\scisetcomponents\csname axis@#1max\endcsname\axis@tmp@S\axis@tmp@M\axis@tmp@E - \fi - \fi - \or - \ifaxis@disablelogfilter - \else - % any user-specified axis limits: - \expandafter\let\expandafter\axis@TMP\csname axis@#1min\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\pgfmathlog@\expandafter{\axis@TMP}% - \expandafter\let\csname axis@#1min\endcsname=\pgfmathresult - \fi - \expandafter\let\expandafter\axis@TMP\csname axis@#1max\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\pgfmathlog@\expandafter{\axis@TMP}% - \expandafter\let\csname axis@#1max\endcsname=\pgfmathresult - \fi - % - % any user specified axis ticks: - \expandafter\let\expandafter\axis@TMP\csname axis@#1tick\endcsname - \ifx\axis@TMP\empty - \else - \expandafter\axis@filter@input@ticks@with@log\expandafter{\axis@TMP}% - \expandafter\edef\csname axis@#1tick\endcsname{\axis@TMP}% - \fi - % - \expandafter\let\expandafter\axis@TMP\csname axis@#1filter\endcsname - \ifx\axis@TMP\empty - \expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{% - \pgfmathlog@{##1}% - \let##2=\pgfmathresult - }% - \else - \expandafter\let\csname axis@#1filter@orig\endcsname=\axis@TMP - \expandafter\def\csname addplot@log@compute@#1filter\endcsname##1\to##2{% - \pgfmathlog@{##1}% - \ifx\pgfmathresult\empty - \let##2=\empty - \else - \expandafter\expandafter\csname axis@#1filter@orig\endcsname\pgfmathresult\to##2\relax - \fi - }% - \fi - \expandafter\let\expandafter\axis@TMP\csname addplot@log@compute@#1filter\endcsname - \expandafter\let\csname axis@#1filter\endcsname\axis@TMP - \fi - \fi -} - -\def\axis@create@axis@descriptions{% - \ifaxis@hide - \else - \ifx\axis@xlabel\empty - \else - \axisshowxlabel - \fi - \ifx\axis@ylabel\empty - \else - \axisshowylabel - \fi - \fi - \ifx\axis@title\empty - \else - \axisshowtitle - \fi - \axis@createlegend -} - -% DATA TRANSFORMATION T(x) = X -% -% Input: -% a number in the original data range, given in **floating** point representation -% Output: -% a fixed point number in transformed range -% @see -% \axis@datascaletrafo@x@three -% \axis@datascaletrafo@fromfixed@x -\def\axis@datascaletrafo@x#1\to#2{% - \scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E - \axis@datascaletrafo@x@three\axis@tmp@S\axis@tmp@M\axis@tmp@E\to#2 -} - -% Overloaded function. -% Input: -% The same as above, but with Sign, Mantisse, Exponent. -% #1,#2 and #3 are expected to be MACRO NAMES. -\def\axis@datascaletrafo@x@three#1#2#3\to#4{% - \def\axis@TMP{\scimathshift{#1}{#2}{#3}}% - \expandafter\axis@TMP\expandafter{\axis@data@scale@trafo@SHIFT@x}% - \scitofixed{#1}{#2}{#3}{#4}% -} - -% Overloaded function. -% Input: -% a FIXED point number instead of a floating point one. -% @see \axis@datascaletrafo@x -\def\axis@datascaletrafo@fromfixed@x#1\to#2{% - \begingroup - \sciparsesign{#1}\axis@S\axis@M\axis@E - \axis@datascaletrafo@x@three\axis@S\axis@M\axis@E\to{#2}% - \global\let\axis@TMP=#2\relax - \endgroup - \let#2=\axis@TMP -} - -\def\axis@datascaletrafo@y#1\to#2{% - \scigetcomponents#1\axis@tmp@S\axis@tmp@M\axis@tmp@E - \axis@datascaletrafo@y@three\axis@tmp@S\axis@tmp@M\axis@tmp@E\to#2 -} -\def\axis@datascaletrafo@y@three#1#2#3\to#4{% - \def\axis@TMP{\scimathshift{#1}{#2}{#3}}% - \expandafter\axis@TMP\expandafter{\axis@data@scale@trafo@SHIFT@y}% - \scitofixed{#1}{#2}{#3}{#4}% -} -\def\axis@datascaletrafo@fromfixed@y#1\to#2{% - \begingroup - \sciparsesign{#1}\axis@S\axis@M\axis@E - \axis@datascaletrafo@y@three\axis@S\axis@M\axis@E\to{#2}% - \global\let\axis@TMP=#2\relax - \endgroup - \let#2=\axis@TMP -} - -% INVERSE transformation x = T^{-1}( X ) -% Input: -% a fixed point number in transformed domain -% Output: -% a number in the data domain, given in floating point -% representation -\def\axis@inverse@datascaletrafo@x#1\to#2{% - \expandafter\sciparsesignsingle\expandafter{#1}#2 - \edef\axis@TMP{\noexpand#2{-\axis@data@scale@trafo@SHIFT@x}}% - \expandafter\scimathshiftsingle\axis@TMP -} - -\def\axis@inverse@datascaletrafo@y#1\to#2{% - \expandafter\sciparsesignsingle\expandafter{#1}#2 - \edef\axis@TMP{\noexpand#2{-\axis@data@scale@trafo@SHIFT@y}}% - \expandafter\scimathshiftsingle\axis@TMP -} - -% Overloaded function. -% -% In contrast to \axis@inverse@datascaletrafo@x, this method -% returns a number in FIXED point representation. -% @see \axis@inverse@datascaletrafo@x -\def\axis@inverse@datascaletrafo@tofixed@x#1\to#2{% - \axis@inverse@datascaletrafo@x#1\to{#2}% - \scitofixedsingle{#2}{#2}% -} -\def\axis@inverse@datascaletrafo@tofixed@y#1\to#2{% - \axis@inverse@datascaletrafo@y#1\to{#2}% - \scitofixedsingle{#2}{#2}% -} - -\newenvironment{axis}[1][]{% - \begingroup -% \def\axis@setkeys{\setkeys*[\prefix]{axis}}% -%\tracingmacros=2\tracingcommands=2 -% \message{Der every-axis-style ist gerade \csname tikz@st@every axis\endcsname}% -%\tracingmacros=0\tracingcommands=0 -% \expandafter\expandafter\expandafter\axis@setkeys - % \expandafter\expandafter\expandafter{\csname tikz@st@every axis\endcsname}% - \begin{scope}[style=every axis,% - x=1pt,y=1pt% see below - ] - % The explicit specification of 'x' and 'y' as 1pt is to avoid - % numeric overflow/underflow during scale computations: - % - % The scaling (i.e. proper values for 'x' and 'y') will be - % determined later-on, dependend on the axis limits. Since axis - % limits are implicitly in units of 1pt, it is reasonable to use - % '1pt' here as well. - % - % -%-------------------------------------------------- -% \draw[very thin,color=gray,xstep=1,ystep=\logten] -% (\xcoordmin\axis@leftover,\ycoordmin) -% grid (\xcoordmax\axis@rightover,\ycoordmax); -%-------------------------------------------------- - \setkeys[\prefix]{axis}{#1}% - % - % -------------------- - % Allocations: - % -------------------- - \listnewempty\axis@plotspeclist - \listnewempty\axis@legend - \listnewempty\axis@stored@plot@cmds - \listnewempty\axis@stored@plot@data - \newif\ifaxis@autocompute@xlim - \newif\ifaxis@autocompute@ylim - \newif\ifaxis@filtercoords - \newif\ifaxis@float@numerics@mode@x - \newif\ifaxis@float@numerics@mode@y - \newif\ifaxis@float@numerics@mode - % rename '\ifaxis@hide axis' to mask the white space: - \expandafter\let\expandafter\ifaxis@hide\csname ifaxis@hide axis\endcsname - % the same for other options with white spaces: - \expandafter\let\expandafter\ifaxis@scale@only@axis\csname ifaxis@scale only axis\endcsname - \newif\ifaxis@draw@at@end - \newif\ifaxis@limits@are@computed - \newif\ifaxis@EMERGENCY@FORCE@DATA@TRAFO@TO@IDENTITY - \axis@numplots=0 - \let\axis@already@computed@legend@node=\empty - % - % -------------------- - % Option preprocessing - % -------------------- - \axis@prepare@coord@filtering@for x - \axis@prepare@coord@filtering@for y - % - \ifx\axis@xfilter\empty - \else - \axis@filtercoordstrue - \fi - \ifx\axis@yfilter\empty - \else - \axis@filtercoordstrue - \fi - % - \ifx\axis@xmin\empty - \axis@autocompute@xlimtrue - \def\axis@xmin{16300}% - \ifaxis@float@numerics@mode@x - \scisetcomponents\axis@xmin{1}{1.0}{324}% - \fi - \fi - \ifx\axis@xmax\empty - \axis@autocompute@xlimtrue - \def\axis@xmax{-16300}% - \ifaxis@float@numerics@mode@x - \scisetcomponents\axis@xmax{2}{1.0}{324}% - \fi - \fi - \ifx\axis@ymin\empty - \axis@autocompute@ylimtrue - \def\axis@ymin{16300}% - \ifaxis@float@numerics@mode@y - \scisetcomponents\axis@ymin{1}{1.0}{324}% - \fi - \fi - \ifx\axis@ymax\empty - \axis@autocompute@ylimtrue - \def\axis@ymax{-16300}% - \ifaxis@float@numerics@mode@y - \scisetcomponents\axis@ymax{2}{1.0}{324}% - \fi - \fi - % - \ifaxis@autocompute@xlim - \axis@draw@at@endtrue - \axis@limits@are@computedfalse - \else - \axis@limits@are@computedtrue - \fi - \ifaxis@autocompute@ylim - \axis@draw@at@endtrue - \axis@limits@are@computedfalse - \else - \axis@limits@are@computedtrue - \fi - % - % - % -------------------- - % Start axis: - % either postponed to \end or directly. - % -------------------- - % - \ifaxis@draw@at@end - \else - \axis@BEGIN@init@and@draw@axis - \fi -}{% - %\end{axis}: - % -------------------- - % All plotting commands - % have been done. - % -> apply postponed drawing commands! - % -------------------- - \ifaxis@draw@at@end - \ifaxis@limits@are@computed - \else - % EMPTY AXIS: - \def\axis@xmin{0}% - \def\axis@xmax{1}% - \def\axis@ymin{0}% - \def\axis@ymax{1}% - \fi - \axis@BEGIN@init@and@draw@axis - \listforeach\axis@stored@plot@cmds\as\plotcmd{% - \listpopfront\axis@stored@plot@data\to\plotdata - \ifaxis@float@numerics@mode - \ifx\plotcmd\empty - \plotdata - \else - % Apply the data scaling transformation - \expandafter\axis@apply@data@scaletrafo@to@plot@data\plotdata\to\plotdata - \expandafter\plotcmd\plotdata - \fi - \else - \expandafter\plotcmd\plotdata - \fi - }% - \fi - \axis@END@init@and@draw@axis - % - \begin{scope}[% - xshift=+\axis@xcoordminTEX, - yshift=\axis@ycoordminTEX, - x={\axis@xcoordmaxTEX-\axis@xcoordminTEX}, - y={\axis@ycoordmaxTEX-\axis@ycoordminTEX} - ]% - \axis@create@axis@descriptions - \end{scope}% - \end{scope}% this scope starts inside of \axis@BEGIN@init@and@draw@axis - % - \end{scope}% - \endgroup -} +\input pgfplots.code.tex +\usetikzlibrary{plotmarks} -\newenvironment{semilogxaxis}[1][]{% - \begin{axis}[xmode=log,ymode=normal,#1] -}{% - \end{axis}% -} -\newenvironment{semilogyaxis}[1][]{% - \begin{axis}[xmode=normal,ymode=log,#1] -}{% - \end{axis}% -} -\newenvironment{loglogaxis}[1][]{% - \begin{axis}[xmode=log,ymode=log,#1] -}{% - \end{axis}% -} +\endinput diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplotshelpers.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplotshelpers.sty deleted file mode 100644 index 304448fbef4..00000000000 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplotshelpers.sty +++ /dev/null @@ -1,208 +0,0 @@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% Low-level helper methods for string parsing and number conversion. -% -% This file comes as part of the pgfplots-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/>. -% -% -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\ProvidesPackage{pgfplotshelpers}[2008/02/17 Version 0.9.4] - -\newtoks\pgfplots@toka - -\def\prettyprintnumberprecision{2} - -\def\pgfmathlog@tonumber#1pt{#1} - -% Invokes command #1 with #2 without the 'pt' suffix. -\def\invokepgf@math@one#1#2{% - %\edef\pgfmath@resulttemp{\pgf@sys@tonumber{#2}}% - %\expandafter#1\expandafter{\pgfmath@resulttemp}% - \edef\pgfmath@resulttemp{{\pgf@sys@tonumber{#2}}}% - \expandafter#1\pgfmath@resulttemp% -} - -% Expands #2 using \edef and invokes #1 with the resulting string. -% -% Example: -% \pgfmath@y=7.9pt -% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% -% will invoke -% \pgfmathexp@{7.9} -\def\pgfmathlog@invoke@expanded#1#2{% - \edef\pgfmath@resulttemp{#2}% - \expandafter#1\pgfmath@resulttemp -} - -% Expands the NUMBER (without units) to a pretty printed string argument: rounded to -% several digits, discard any suffix zeros etc. -% -% It uses \prettyprintnumberprecision digits after the comma. -\def\prettyprintnumber#1{% - \begingroup -% \edef\argument{#1}% -% \expandafter\prettyprintnumber@impl\argument.\END - \edef\argument{#1\noexpand\prec\prettyprintnumberprecision}% - \expandafter\fixedpointround\argument\to\result - \result - \endgroup -} - -\def\prettyprintnumber@impl#1.#2\END{% - % This implementation is really bad. - % I hope I find time to get something better... - \def\tmp{#2}% - \ifx\tmp\empty - % there was no '.' in the original arg - #1 - \else - % ok, there is a dot in the arg. - % 1. ROUND - % 2. DISCARD ZEROS - \toksdef\tokens=2 - \let\i=\c@pgf@counta - \let\lastdigit=\c@pgf@countb - \let\numberAsDIM=\pgfmath@x - \let\zeroFilledNum=\pgfmath@y - \i=0 - \tokens={}% - \def\D{#2}% - \def\DOT{.}% - \ifx\D\DOT - % the number '#1.' - \let\D=\empty - \else - \expandafter\prettyprintnumber@impl@getfirst - \prettyprintnumberprecision - \of#2% - \to\tokens% - \nextto\D - \count\i - \fi - %\message{Pretty print: first <= \prettyprintnumberprecision\ digits after period: \the\tokens, (strlen=\the\i), next rounding-relevant-digit: '\D'}% - \ifx\D\empty - \numberAsDIM=#1\expandafter.\the\tokens pt - % Nothing to do - we have our desired precision. - \else - \lastdigit\expandafter=\D\relax -% \message{D=\D!}% - \ifnum\lastdigit>4 - \numberAsDIM=#1\expandafter.\expandafter\the\tokens\D pt - % round up: - % compute numberAsDIM += 0.0000[10-digit] - \advance\lastdigit by-10 - \multiply\lastdigit by-1 - \tokens={0.}% - \loop - \ifnum\i>0 - \tokens=\expandafter{\the\tokens0}% - \advance\i by-1 - \repeat - \edef\D{\the\tokens\the\lastdigit pt}% - \expandafter\zeroFilledNum\D - \ifdim\numberAsDIM<0pt - \advance\numberAsDIM by-\zeroFilledNum - \else - \advance\numberAsDIM by\zeroFilledNum - \fi - \else - \numberAsDIM=#1\expandafter.\the\tokens pt - \fi - \fi - %\message{Pretty print: Result after rounding = \the\numberAsDIM / zeroFilledNum = \the\zeroFilledNum [only defined on up-rounding}% - \edef\D{\pgf@sys@tonumber{\numberAsDIM}}% - \expandafter\prettyprintnumber@onlyrelevant@digits\D\to\D - % FIXME : I could return '\D' as macro!? May thats a better - % way... - \D - \fi -} - -% This macro takes the first \prettyprintnumberprecision digits after -% the period and squeezes away any trailing zeros. -% -% If no digits after the period remain, the period will be discarded -% as well. -\def\prettyprintnumber@onlyrelevant@digits#1.#2\to#3{% - \begingroup - \toksdef\tokens=2 - \let\i=\c@pgf@counta - \let\maxDigits=\c@pgf@countc - \let\numsuffixZeros=\c@pgf@countb - \tokens={#1.}% - \i=0 - \expandafter\maxDigits\prettyprintnumberprecision - \numsuffixZeros=0 - \prettyprintnumber@onlyrelevant@digits@leftshift#2\to#3 - \ifnum\numsuffixZeros>0 - \ifnum\numsuffixZeros=\i - \tokens={#1}% - \else - \maxDigits=\i - \advance\maxDigits by-\numsuffixZeros - \tokens={#1.}% - \i=0 - \prettyprintnumber@onlyrelevant@digits@leftshift#2\to#3 - \fi - \fi - \xdef\pgfplotshelpersTMP{\the\tokens}% - \endgroup - \let#3=\pgfplotshelpersTMP -} - - -% shifts the input argument until either no more input is left or -% \maxDigits entries have been acquired. -% -% It also updates \i (will contain the number of acquired elements) -% and \numsuffixZeros (the number of zeros at the tail of #3 on -% output). -\def\prettyprintnumber@onlyrelevant@digits@leftshift#1#2\to#3{% - \ifnum\i<\maxDigits - \tokens=\expandafter{\the\tokens#1}% - \advance\i by1 - \ifnum#1=0 - \advance\numsuffixZeros by1 - \else - \numsuffixZeros=0 - \fi - \def\tmp{#2}% - \ifx\tmp\empty - \else - \prettyprintnumber@onlyrelevant@digits@leftshift#2\to#3 - \fi - \fi -} - -\def\prettyprintnumber@impl@getfirst#1\of#2#3.\to#4\nextto#5\count#6{% - \edef#5{#3}% - #4=\expandafter{\the#4#2}% - \advance#6 by1 - \ifx#5\empty - \else - \ifnum#6<#1 - \prettyprintnumber@impl@getfirst #1\of#3.\to#4\nextto#5\count{#6}% - \else - \prettyprintnumber@impl@firstof#3\to#5 - \fi - \fi -} - -\def\prettyprintnumber@impl@firstof#1#2\to#3{\def#3{#1}}% - diff --git a/Master/texmf-dist/tex/latex/pgfplots/sciformat.sty b/Master/texmf-dist/tex/latex/pgfplots/sciformat.sty deleted file mode 100644 index 493aca948d1..00000000000 --- a/Master/texmf-dist/tex/latex/pgfplots/sciformat.sty +++ /dev/null @@ -1,861 +0,0 @@ -%-------------------------------------------- -% -% Package sciformat.sty -% -% Provides support for floating point number representations of the -% form -% -% S * M * 10^e -% -% with S in [-,+,0], 0<M<10, e in Z. -% -% Example: -% -% +1.62452*10^-8 -% -% The conversion routines are complete text-based. -% -% 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{sciformat}[2008/02/17 v.0.9.4] -\RequirePackage{pgf}[2007/01/01] -\RequirePackage{pgfplotshelpers}[2008/02/17] - -% Computes a normalised floating point representation for #1 of the -% form -% [+-]X.XXXXXXX*10^C -% where -% X.XXXXXX is a mantisse with first number != 0 -% and C is a count. -% -% This method does NOT use TeX Registers to represent the numbers! The -% computation is COMPLETELY STRING BASED. -% This allows numbers such at 10000000 or 5.23e-10 to be represented -% properly, although TeX-registers would produce overflow/underflow -% errors in these cases. -% -% It is to be used to compute logs, because log(X*10^Y) = log(X) + log(10)*Y -% -% Arguments: -% #1 a -possibly non-normalized- number representation. Accepted input -% format is -% [+-]XXXXX.XXXXXX -% [+-]XXXXX.XXXXXXeXXXX -% [+-]0.0000XXXXXX -% [+-]0.0000XXXXXXeXXXX -% NOT accepted input format is -% [+-]0000.XXXXXX [leading zeros not supported] -% [+-]XXXXX.XXXXXXEXXXXX [E notation not yet implemented] -% #2 a macro name. \def#2{.....} will be used to assign the mantisse. -% #3 a macro name. \def#3{.....} will be used to assign the exponent (base 10). -% -% Example: -% \def\normalize#1{% -% \sciparse#1\to\M\powten\E -% \[ #1 \mapsto \M\cdot 10^{\E} \] -% } -% \normalize{123.41251}% -% \normalize{3.26101452e-06}% -% -% REMARKS: -% - the mantisse will ALWAYS have a period and one following number. -% - Special case: the number +- 0 will always have the mantisse 0.0. The sign and -% the exponent is undefined. -\def\sciparse#1\to#2\powten#3{% - \begingroup - \sciparse@impl@possibly@signed#1\to#2\powten{#3}% - \xdef\sciparseTMP{% - \noexpand\def\noexpand#2{#2}% - \noexpand\def\noexpand#3{#3}% - }% - \endgroup - \sciparseTMP -} - -% Overloaded scientific parser. -% -% In addition to '\sciparse', this method checks for '+- 0' cases -% and sets #2 accordingly. -% -% \S #2: will be \def'ed to one of [0,1,2] with -% 0 == '0', ( \def#2{0} ) -% 1 == '+', -% 2 == '-', -% -> can be used with \ifcase -% \M #3: will be filled with a positive mantisse (undefined in case \S=0). -% \E #4: the exponent basis 10 (an integer). Undefined in case \S = 0. -% -% Example: -% \sciparsesign141.212\S\M\E -% -> \S = 1, \M = 1.41212, \E =2 -% -\def\sciparsesign#1#2#3#4{% - \begingroup - \sciparsesign@impl@possibly@signed#1\S#2\M#3\E{#4}% - \def\sciparseTMP{0}% - \ifx\sciparseTMP#2\relax - \def#4{0}% - \fi - \xdef\sciparseTMP{% - \noexpand\def\noexpand#2{#2}% - \noexpand\def\noexpand#3{#3}% - \noexpand\def\noexpand#4{#4}% - }% - \endgroup - \sciparseTMP -} - -\def\sciparsesignsingle#1#2{% - \begingroup - \sciparsesign{#1}\sci@S\sci@M\sci@E - \xdef\sciparseTMP{\noexpand\scisetcomponents{\noexpand#2}{\sci@S}{\sci@M}{\sci@E}}% - \endgroup - \sciparseTMP -} - -% Compares -% x = Sign(#1) #2 * 10^#3 -% with -% y = Sign(#4) #5 * 10^#6 -% -% example: -% \scimathlessthan\S\M\E\and\SS\MM\EE -% \ifscimathlessthan -% is smaller! -% \else -% is not smaller. -% \fi -% -% and sets the boolean -% \ifscimathlessthan := (x<y). -\def\scimathlessthan#1#2#3\and#4#5#6{% - \scimathlessthanfalse - \begingroup - \let\S@first=\c@pgf@counta - \let\S@second=\c@pgf@countb - \S@first\expandafter=#1\relax - \S@second\expandafter=#4\relax - \ifcase\S@first - % x = 0 -> (x<y <=> y >0) - \ifnum1=\S@second - \aftergroup\scimathlessthantrue - \fi - \or - % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) - \ifnum1=\S@second - % y>0: - \scimathlessthan@positive\M#2\E#3\MM#5\EE{#6}% - \fi - \or - % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) - \ifnum2=\S@second - % 'y<0': - \scimathlessthan@positive\M#5\E#6\MM#2\EE{#3}% - \else - \aftergroup\scimathlessthantrue - \fi - \fi - \endgroup -} - -\def\scimathmax#1#2#3\and#4#5#6\to#7#8#9{% - \scimathlessthan#1#2#3\and#4#5#6\relax - \ifscimathlessthan - \let#7=#4 - \let#8=#5 - \let#9=#6 - \else - \let#7=#1 - \let#8=#2 - \let#9=#3 - \fi -} - -\def\scimathmin#1#2#3\and#4#5#6\to#7#8#9{% - \scimathlessthan#1#2#3\and#4#5#6\relax - \ifscimathlessthan - \let#7=#1 - \let#8=#2 - \let#9=#3 - \else - \let#7=#4 - \let#8=#5 - \let#9=#6 - \fi -} - -% Takes \S, \M and \E as sign, mantisse and exponent and computes a -% fixed point representation for that number. -% -% example: -% \S=1 -% \M=4.2 -% \E=1 -% \scitofixed\S\M\E\result -% -> 42.0 -\def\scitofixed#1#2#3#4{% - \begingroup - \let\sci@sign=\c@pgf@counta - \sci@sign\expandafter=#1\relax - \ifnum0=\sci@sign - \xdef\sciparseTMP{0.0}% - \else - \expandafter\scitofixed@impl#2\E#3\END - \ifnum2=\sci@sign - \xdef\sciparseTMP{-\sciparseTMP}% - \fi - \fi - \endgroup - \let#4=\sciparseTMP -} - -% Single macro SCI-representation to #2. -\def\scitofixedsingle#1#2{% - \begingroup - \scigetcomponents{#1}\sci@S\sci@M\sci@E - \scitofixed\sci@S\sci@M\sci@E{#2}% - \global\let\sciparseTMP=#2% - \endgroup - \let#2=\sciparseTMP -} - -% Takes a SINGLE macro representing a floating point and extracts -% sign, mantisse and exponent. -% #1: the name of the single macro. -% The expansion of #1 is COMPLETELY independend of associated -% floating point number. You can even use \def#1{foo bar} -% so change the meaning of #1 without affecting the number. -% #2: will be set to #1's sign -% #3: will be set to #1's mantisse -% #4: will be set to #1's exponent -% -% @see scisetcomponents -\def\scigetcomponents#1#2#3#4{% - \expandafter\let\expandafter#2\csname\string#1@S\endcsname - \expandafter\let\expandafter#3\csname\string#1@M\endcsname - \expandafter\let\expandafter#4\csname\string#1@E\endcsname -} - -% Assigns sign #2, mantisse #3 and exponent #4 to a single macro -% representing the floating point. -% -% #1: the target name. Will create macros #1@S, #1@M and #1@E -% which will be filled with #2, #3 and #4. -% -% Remark: -% It is perfectly save to use the macro name #1 for other uses since -% only the '@{S,M,E}' - macros are used to maintain the numerical -% information. -% -% @see scigetcomponents -\def\scisetcomponents#1#2#3#4{% - \expandafter\edef\csname\string#1@S\endcsname{#2}% - \expandafter\edef\csname\string#1@M\endcsname{#3}% - \expandafter\edef\csname\string#1@E\endcsname{#4}% -} - -% Divides or multiplies the input number by 10^#4 using an arithmetic -% left/right shift. -% -% Input: -% #1 Sign macro -% #2 Mantisse macro -% #3 exponent macro -% #4 a positive or negative integer number denoting the shift. -% -% Example: -% \scimathshift\S\M\E4 -\def\scimathshift#1#2#3#4{% - \begingroup - \c@pgf@counta\expandafter=#3\relax - \advance\c@pgf@counta by#4\relax - \xdef\sciparseTMP{\the\c@pgf@counta}% - \endgroup - \let#3=\sciparseTMP -} - -\def\scimathshiftsingle#1#2{% - \begingroup - \expandafter\let\expandafter\E\csname\string#1@E\endcsname - \c@pgf@counta\expandafter=\E\relax - \advance\c@pgf@counta by#2\relax - \xdef\sciparseTMP{\the\c@pgf@counta}% - \endgroup - \expandafter\let\csname\string#1@E\endcsname\sciparseTMP% -} - - -% Rounds a fixed point number #1 to #2 digits precision and returns -% the result into macro #3. -% -% This method is PURELY text based and can work with arbirtrary -% precision (well, limited to TeX's stack size and integer size). -\def\fixedpointround#1\prec#2\to#3{% - \begingroup - \pgfplots@toka={}% - \let\fp@round@next=\empty - \let\fp@round@prec=\c@pgf@countb - \let\fp@offsetbehindperiod=\c@pgf@counta - \let\fp@round@lastzeros=\c@pgf@countc - \let\fp@round@trg=#3\relax - \def\fp@round@input{#1}% - \fp@round@prec=#2\relax - \fp@round@lastzeros=0 - \fp@offsetbehindperiod=-1 % means: no period found so far - \fixedpointround@impl@ITERATE@NODOT #1\fp@round@EOI - \xdef\sciparseTMP{\fp@round@trg}% - \endgroup - \let#3=\sciparseTMP -} - - - -%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% IMPL -% -%%%%%%%%%%%%%%%%%%%%%%%%%% - -% \fixedpointround implementation in WORDS: -% -% coarse idea: -% 1. collect all digits/sign BEFORE the first period in REVERSE order -% 2. then, collect UP TO \prec digits after the period in REVERSE order -% Steps 1. and 2. lead to the digit [sign] sequence -% "x_{-p} x_{-p+1} ... x_{-2} x_{-1} '.' x_0 ... x_r" -% where 'r' is the total number of digits. The integer 'p' denotes the -% ACTUALLY collected number of digits behind the period. -% -% Let 'k' be the desired precision. -% -% There are exactly TWO cases: -% 1. The case with p<=k and x_{-p-1} = end of input. -% 2. The case with p=k and x_{-p-1} is a further, next character. -% -% Then, we do in case 1.) -% discard any unused zeros at the tail of our number (possibly -% including the period) -% -% and in case 2.) -% if NEXT DIGIT < 5: -% do exactly the same as in case 1.) above and discard any -% following digits. -% else -% let q := -p -% while(x_q = 9 and q<=r ) -% if q>=0 -% set x_q = '0' -% else -% discard digit x_q='9' -% fi -% ++q -% if q=0 -% discard the period -% fi -% end while -% if q = r+1 -% insert a '1' -% else -% set x_q = x_q + 1 -% fi -% fi -% -% All these loops have been implemented in spaghetti-code below. -% Sorry, I fear its hard to understand. In principle, everything is -% realised using more or less finite state machines (with some number -% counting logic). -% -% Some comments: -% - The token register \pgfplots@toka is used to accumulate the REVERSED input number. -% - \fp@round@EOI always denotes 'END OF INPUT'. -% - in the second stage, we need to reverse \pgfplots@toka. -% This is -again- done with \pgfplots@toka. - -\def\fixedpointround@impl@discard@period#1.#2\fp@round@EOI{% - \def\fp@round@trg{#1}% -} - -\def\fixedpointround@impl@gobble@rest@and@start#1\fp@round@EOI{% - \fixedpointround@impl@start -} -\def\fixedpointround@impl@gobble@and@start\fp@round@EOI{% - \fixedpointround@impl@start -} -\def\fixedpointround@impl@gobble\fp@round@EOI{}% - -\def\fixedpointround@impl@start{% - \ifx\fp@round@next\empty - \ifnum\fp@offsetbehindperiod<0 - \edef\fp@round@trg{\fp@round@input}% - \else - \ifnum\fp@offsetbehindperiod>\fp@round@prec - \errmessage{Internal logic error in fixedpointround at [I] - should not have happened!?}% - \fi - \fixedpointround@impl@discard@suffix@zeros - \fi - \else - \ifnum\fp@offsetbehindperiod=\fp@round@prec - \else - \errmessage{Internal logic error in fixedpointround at [II] - should not have happened!? I have offsetbehindperiod=\the\fp@offsetbehindperiod and prec = \the\fp@round@prec}% - \fi - \expandafter\ifnum\fp@round@next<5 - \fixedpointround@impl@discard@suffix@zeros - \else - \multiply\fp@offsetbehindperiod by-1 - %\edef\fp@round@trg{B\the\pgfplots@toka B}% - \expandafter\fixedpointround@impl@ADD@ONE\the\pgfplots@toka\fp@round@EOI - \fi - \fi -} - -\def\fixedpointround@impl@ADD@ONE{% - \pgfplots@toka={}% - \fixedpointround@impl@ADD@ONE@ITERATE -} -\def\fixedpointround@impl@ADD@ONE@ITERATE{% - \@ifnextchar\fp@round@EOI{% - \edef\fp@round@trg{1\the\pgfplots@toka}% - \fixedpointround@impl@gobble - }{% - \@ifnextchar.{% - \fixedpointround@impl@ADD@ONE@NEXT@COLLECT - }{% - \@ifnextchar+{% - \fixedpointround@impl@ADD@ONE@NEXT@COLLECT - }{% - \@ifnextchar-{% - \fixedpointround@impl@ADD@ONE@NEXT@COLLECT - }{% - \fixedpointround@impl@ADD@ONE@NEXT - }% - }% - }% - }% -} - -\def\fixedpointround@impl@ADD@ONE@ITERATE@gobble@dot.{% - \fixedpointround@impl@ADD@ONE@ITERATE -} - -\def\fixedpointround@impl@ADD@ONE@NEXT@COLLECT#1{% - \pgfplots@toka=\expandafter{\expandafter#1\the\pgfplots@toka}% - \fixedpointround@impl@ADD@ONE@ITERATE -} -\def\fixedpointround@impl@ADD@ONE@NEXT#1{% - \ifnum#1=9 - \ifnum\fp@offsetbehindperiod<0 - % silently DROP digit - \else - \pgfplots@toka=\expandafter{\expandafter0\the\pgfplots@toka}% - \fi - \advance\fp@offsetbehindperiod by1 - \ifnum\fp@offsetbehindperiod=0 - \def\fp@round@nextcmd{\fixedpointround@impl@ADD@ONE@ITERATE@gobble@dot}% - \else - \def\fp@round@nextcmd{\fixedpointround@impl@ADD@ONE@ITERATE}% - \fi - \else - % re-use this counter: - \fp@round@lastzeros=#1 - \advance\fp@round@lastzeros by1 - \edef\fp@round@trg{\the\fp@round@lastzeros\the\pgfplots@toka}% - \pgfplots@toka=\expandafter{\fp@round@trg}% - \def\fp@round@nextcmd{\fixedpointround@impl@REVERSE@ITERATE}% - \fi - \fp@round@nextcmd -} - - -\def\fixedpointround@impl@discard@suffix@zeros{% - \ifnum\fp@round@lastzeros=\fp@offsetbehindperiod - \expandafter\fixedpointround@impl@discard@period\fp@round@input\fp@round@EOI - \else - \ifnum\fp@round@lastzeros=0 - \expandafter\fixedpointround@impl@REVERSE\the\pgfplots@toka\fp@round@EOI - \else - \expandafter\fixedpointround@impl@discard@suffix@zeros@ITERATE\the\pgfplots@toka\fp@round@EOI - \fi - \fi -} - -% PRECONDITION: -% \fp@round@lastzeros > 0 -\def\fixedpointround@impl@discard@suffix@zeros@ITERATE#1{% - \advance\fp@round@lastzeros by-1 - \ifnum\fp@round@lastzeros=0 - \def\fp@round@nextcmd{\fixedpointround@impl@REVERSE}% - \else - \def\fp@round@nextcmd{\fixedpointround@impl@discard@suffix@zeros@ITERATE}% - \fi - \fp@round@nextcmd -} - -\def\fixedpointround@impl@REVERSE{% - \pgfplots@toka={}% - \fixedpointround@impl@REVERSE@ITERATE -} - -\def\fixedpointround@impl@REVERSE@ITERATE{% - \@ifnextchar\fp@round@EOI{% - \edef\fp@round@trg{\the\pgfplots@toka}% - \fixedpointround@impl@gobble - }{% - \fixedpointround@impl@REVERSE@NEXT - }% -} - -\def\fixedpointround@impl@REVERSE@NEXT#1{% - \pgfplots@toka=\expandafter{\expandafter#1\the\pgfplots@toka}% - \fixedpointround@impl@REVERSE@ITERATE -} - -\def\fixedpointround@impl@BEGIN@DOT.{% - \pgfplots@toka=\expandafter{\expandafter.\the\pgfplots@toka}% - \fp@offsetbehindperiod=0 - \fixedpointround@impl@ITERATE@DOT -} -\def\fixedpointround@impl@ITERATE@DOT{% - \@ifnextchar\fp@round@EOI{% - % finished. - \fixedpointround@impl@gobble@and@start - }{% - \fixedpointround@impl@NEXT@DOT - }% -} -\def\fixedpointround@impl@NEXT@DOT#1{% - \ifnum\fp@offsetbehindperiod=\fp@round@prec - \def\fp@round@next{#1}% - \def\fp@round@nextcmd{\fixedpointround@impl@gobble@rest@and@start}% - \else - \advance\fp@offsetbehindperiod by1 - \ifnum#1=0 - \advance\fp@round@lastzeros by1 - \else - \fp@round@lastzeros=0 - \fi - \pgfplots@toka=\expandafter{\expandafter#1\the\pgfplots@toka}% - \def\fp@round@nextcmd{\fixedpointround@impl@ITERATE@DOT}% - \fi - \fp@round@nextcmd -}% - -\def\fixedpointround@impl@ITERATE@NODOT{% - \@ifnextchar\fp@round@EOI{% - \fixedpointround@impl@gobble@and@start - }{% - \@ifnextchar.{% - \fixedpointround@impl@BEGIN@DOT - }{% - \fixedpointround@impl@NEXT@NODOT - }% - }% -} -\def\fixedpointround@impl@NEXT@NODOT#1{% - \pgfplots@toka=\expandafter{\expandafter#1\the\pgfplots@toka}% - \fixedpointround@impl@ITERATE@NODOT -}% - -%-------------------------------------------- -% END of fixedpointround implementation. -%-------------------------------------------- - -\newif\ifscimathlessthan - -% first character MAY be + or -. This is checked, then -% \sciparse@impl@positive will be called for the -% absolute value. The sign is inserted afterwards. -\def\sciparse@impl@possibly@signed#1#2\to#3\powten#4{% - \def\sciparseTMP{#1}% - \def\sciparseTMPB{-}% - \if\sciparseTMP\sciparseTMPB - \sciparse@impl@positive@possibly@noperiod#2.\to#3\powten#4\S\sciparseTMPB% - \edef#3{-#3}% - \else - \def\sciparseTMPB{+}% - \if\sciparseTMP\sciparseTMPB - \sciparse@impl@positive@possibly@noperiod#2.\to#3\powten#4\S\sciparseTMPB% - \else - \sciparse@impl@positive@possibly@noperiod#1#2.\to#3\powten#4\S\sciparseTMPB% - \fi - \fi -} - -% the same as above, only the return value is different. -\def\sciparsesign@impl@possibly@signed#1#2\S#3\M#4\E#5{% - \def\sciparseTMP{#1}% - \def\sciparseTMPB{-}% - \if\sciparseTMP\sciparseTMPB - \def#3{2}% - \sciparse@impl@positive@possibly@noperiod#2.\to#4\powten#5\S#3% - \else - \def#3{1}% - \def\sciparseTMPB{+}% - \if\sciparseTMP\sciparseTMPB - \sciparse@impl@positive@possibly@noperiod#2.\to#4\powten#5\S#3% - \else - \sciparse@impl@positive@possibly@noperiod#1#2.\to#4\powten#5\S#3% - \fi - \fi -} - -% XXXX -> XXXX.0 -% XXXX.YYY -> XXXX.YYYY -\def\sciparse@impl@positive@possibly@noperiod#1.#2\to#3\powten#4\S#5{% -%\tracingmacros=2\tracingcommands=2 - \def\sciparseTMP{#2}% - \ifx\sciparseTMP\empty - \sciparse@impl@positive@noperiod@possibly@SCI#1e\to#3\powten#4\S{#5}% - \else - \expandafter\sciparse@impl@positive\sciformat@pop@last@of@two@dots#1.#2\to#3\powten#4\S{#5}% - \fi -} -\def\sciformat@pop@last@of@two@dots#1.#2.{#1.#2}% - -\def\sciparse@impl@positive@noperiod@possibly@SCI#1e#2\to#3\powten#4\S#5{% - \def\sciparseTMP{#2}% - \ifx\sciparseTMP\empty - % this case applies to - % 1234 -> 1234.0 - \sciparse@impl@positive#1.0\to#3\powten#4\S{#5}% - \else - % this case applies to - % 1e1 -> 1.0e1 - % in this case, #1e#2 = 1e1e, so we have to discard a suffix 'e'. - \edef\sciparseTMP{#1.0e\sciformat@popsuffix@e@expansion#2}% - \expandafter\sciparse@impl@positive\sciparseTMP\to#3\powten#4\S{#5}% - \fi -} - -% XXXXX.XXXXX -> X.XXXXXXX * 10^4 -% 0.0000XXXXX -> X.XXXX * 10^{-5} -% -% or -% XXXX.XXXXXeYYY -> X.XXXXXX* 10^{3+YYY} -% 0.0000XXXXeYYY -> X.XXX* 10^{-5+YYY} -% -% this version does not accept a sign. A period is required. -% -% The return value #6 will be \def'ed to '0' if the resulting mantisse is '0'. -% Won't be touched otherwise. -\def\sciparse@impl@positive#1#2.#3\to#4\powten#5\S#6{% -% \begingroup -% FIXME! restore variables!! -%\tracingmacros=2\tracingcommands=2 -%\tracingmacros=0\tracingcommands=0 - \sciparse@positive@getexisting@exponent@e#3e\preexponentto\preexponentstring\exponenttocount\c@pgf@counta - % will \c@pgf@counta will be initialised in the line above - % \c@pgf@counta=0 - \ifnum#1=0 - % the case 0.0000XXXX - % does also handle 0.0000XXXXeXXX - \def\sciparseTMP{#2}% - \ifx\sciparseTMP\empty - \c@pgf@countb=0 - \expandafter\sciformat@count@leading@zeros\preexponentstring\to\c@pgf@countb - \advance\c@pgf@countb by1 - \advance\c@pgf@counta by-\c@pgf@countb - \edef#5{\the\c@pgf@counta}% - \expandafter\sciformat@assignmantisse\preexponentstring\to#4\countdownzerosfrom\c@pgf@countb\S{#6}% - \else - % the case 000.0000XXXXX - % is not allowed and does not make sense. - \errmessage{INVALID NUMBER FORMAT: leading zeros 00*.* not supported yet}% - \fi - \else - % the case NXXXXX.XXXXXXX - % or NXXXXXX.XXXXXXeXXXX - % where N in [1-9] - \sciformat@strlen#1#2\to\c@pgf@counta - \advance\c@pgf@counta by-1 - \edef#4{#1.#2\preexponentstring}% - \edef#5{\the\c@pgf@counta}% - \fi -%\tracingmacros=0\tracingcommands=0 -% \endgroup -} - -% parses scientific notation and returns the exponent and everything -% before the exponent like -% -% XXXXXXXeYYYY -> \def#2{XXXXXXX} #3=YYYY -% or -% XXXXXXXXe -> \def#2{XXXXXXXX} #3=0 -% -% Examples: -% - \sciparse@exponent@e123456e\preexponentto\M\exponenttocount\acount -% \M->123456 -% \acount=0 -% Please note that the input was 123456e -> at least 'e' is expected! -% -% - \sciparse@exponent@e123456e-10e\preexponentto\M\exponenttocount\acount -% \M->123456 -% \acount=-10 -% Again, the suffix 'e' is REQUIRED. This allows to reduce \ifs. -\def\sciparse@positive@getexisting@exponent@e#1e#2\preexponentto#3\exponenttocount#4{% - \def#3{#1}% - \def\sciparseTMP{#2}% - \ifx\sciparseTMP\empty - #4=0 - \else - \sciformat@popsuffix@e#2\tocount{#4}% - \fi -} - -% XXXXXe -> #2=XXXXX where X in [+-0-9]. -\def\sciformat@popsuffix@e#1e\tocount#2{% - #2=#1 -} - -\def\sciformat@popsuffix@e@expansion#1e{% - #1% -}% - -% 00000XXXXXX -> X.XXXXX -% Inputs: -% #1 = 00000XXXXXX -% #2 a macro name -% #3 a count in which the number of zeros plus one is contained (i.e. -% the number of shifts). -% #4 a macro name which will be \def'ed to '0' if the resulting -% mantisse is 0. Won't be touched otherwise. -\def\sciformat@assignmantisse#1\to#2\countdownzerosfrom#3\S#4{% - \pgfplots@toka={#1}% - \loop - \ifnum#3=1 - \else - \expandafter\sciformat@popfirst\the\pgfplots@toka\to{\pgfplots@toka}% - \advance#3 by-1 - \repeat - \edef\sciformat@assignmantisseTMP{\the\pgfplots@toka}% - \ifx\sciformat@assignmantisseTMP\empty - % The case 0.0 * 10^0 - \def#2{0.0}% - \def#4{0}% - \else - \expandafter\sciformat@insertperiod\the\pgfplots@toka\to{#2}% - \fi -} - -% XXXXXX -> X.XXXXX into #3 -\def\sciformat@insertperiod#1#2\to#3{% - \def\sciparseTMP{#2}% - \ifx\sciparseTMP\empty - \def#3{#1.0}% - \else - \def#3{#1.#2}% - \fi -} - -% discards the first token. -\def\sciformat@popfirst#1#2\to#3{% - #3={#2}% -} - -% adds the string length of #1#2 into the count register #3. -% -% The register won't be initialised to zero! -\def\sciformat@strlen#1#2\to#3{% - \advance#3 by1 - \def\sciparseTMP{#2}% - \ifx\sciparseTMP\empty - \else - \sciformat@strlen#2\to{#3}% - \fi -} - -% Adds the number of leadings zeros of #1#2 into the count register -% #3. -% -% The register won't be initialised to zero! -\def\sciformat@count@leading@zeros#1#2\to#3{% - \ifnum#1=0 - \advance#3 by1 - \def\sciparseTMP{#2}% - \ifx\sciparseTMP\empty - \else - \sciformat@count@leading@zeros#2\to{#3}% - \fi - \fi -} - - - - - - -\def\scimathlessthan@positive\M#1\E#2\MM#3\EE#4{% - \c@pgf@counta\expandafter=#2\relax - \c@pgf@countb\expandafter=#4\relax - \ifnum\c@pgf@counta<\c@pgf@countb - \aftergroup\scimathlessthantrue - \else - \ifnum\c@pgf@counta=\c@pgf@countb\relax - \pgfmath@xa\expandafter=#1 pt\relax - \pgfmath@xb\expandafter=#3 pt\relax - \ifdim\pgfmath@xa<\pgfmath@xb - \aftergroup\scimathlessthantrue - \fi - \fi - \fi -} - -\def\scitofixed@impl#1.#2\E#3\END{% - \let\scitofixed@exponent=\c@pgf@countb - \scitofixed@exponent\expandafter=#3\relax - \ifnum\scitofixed@exponent<0 - \pgfplots@toka={0.}% - \loop - \ifnum\scitofixed@exponent<-1 - \pgfplots@toka=\expandafter{\the\pgfplots@toka 0}% - \advance\scitofixed@exponent by1 - \repeat - \def\sciparseTMPB{#2}% - \def\sciparseTMPC{0}% - \ifx\sciparseTMPB\sciparseTMPC - \xdef\sciparseTMP{\the\pgfplots@toka #1}% - \else - \xdef\sciparseTMP{\the\pgfplots@toka #1#2}% - \fi - \else - \ifnum\scitofixed@exponent=0 - \xdef\sciparseTMP{#1.#2}% - \else - \pgfplots@toka={#1}% - \scitofixed@impl@collectmantisse#2\count\scitofixed@exponent - \xdef\sciparseTMP{\the\pgfplots@toka}% - \fi - \fi -} - -\def\scitofixed@impl@collectmantisse#1#2\count#3{% - \pgfplots@toka=\expandafter{\the\pgfplots@toka #1}% - \advance\scitofixed@exponent by-1 - \def\sciparseTMPB{#2}% - \ifx\sciparseTMPB\empty - \loop - \ifnum\scitofixed@exponent>0 - \pgfplots@toka=\expandafter{\the\pgfplots@toka 0}% - \advance\scitofixed@exponent by-1 - \repeat - \else - \ifnum\scitofixed@exponent=0 - \pgfplots@toka=\expandafter{\the\pgfplots@toka .#2}% - \else - \scitofixed@impl@collectmantisse#2\count#3% - \fi - \fi -} diff --git a/Master/texmf-dist/tex/plain/pgfplots/pgfplots.tex b/Master/texmf-dist/tex/plain/pgfplots/pgfplots.tex new file mode 100644 index 00000000000..22e526ef23e --- /dev/null +++ b/Master/texmf-dist/tex/plain/pgfplots/pgfplots.tex @@ -0,0 +1,49 @@ +%-------------------------------------------- +% +% 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/>. +% +%-------------------------------------------- +% 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 tikz.tex% +% +\edef\pgfplotscatcode{\the\catcode`\@}% +\catcode`\@=11 +% +\input pgfplots.code.tex% +\usetikzlibrary{plotmarks}% +% +\catcode`\@=\pgfplotscatcode +% +\endinput |