diff options
77 files changed, 9221 insertions, 3036 deletions
diff --git a/Master/texmf-dist/doc/context/third/pgfplots/pgfplotsexample.pdf b/Master/texmf-dist/doc/context/third/pgfplots/pgfplotsexample.pdf Binary files differnew file mode 100644 index 00000000000..b449ad1afbd --- /dev/null +++ b/Master/texmf-dist/doc/context/third/pgfplots/pgfplotsexample.pdf diff --git a/Master/texmf-dist/doc/generic/pgfplots/README b/Master/texmf-dist/doc/generic/pgfplots/README index 8001a16e128..fbbdbad8246 100644 --- a/Master/texmf-dist/doc/generic/pgfplots/README +++ b/Master/texmf-dist/doc/generic/pgfplots/README @@ -27,7 +27,7 @@ The virus killer Avira Antivir reports the virus HTML/Malicious PDF.Gen in pgfpl This is a FALSE ALARM caused by the pgfplots library for interactive, clickable plots (based on javascript). It is virus-free. -Copyright 2007/2008/2009 by Christian Feuersaenger. +Copyright 2007-2010 by Christian Feuersaenger. 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 diff --git a/Master/texmf-dist/doc/latex/pgfplots/ChangeLog b/Master/texmf-dist/doc/latex/pgfplots/ChangeLog index e39a4175aba..ff3097dc1a4 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/ChangeLog +++ b/Master/texmf-dist/doc/latex/pgfplots/ChangeLog @@ -1,7 +1,211 @@ +2010-07-14 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - RELEASED VERSION 1.4 Release notes: + - Added support for detached legends and detached colorbars + - ybar (and similar plots) can now be mixed with other plot types + like line plots. + - improved legend formatting + - added 'restrict x to domain*' which cups coordinates outside of a specified domain (same for y and z) + - Added support for linear regression + - Inline tables, + - Lots of bug fixes + + +2010-07-14 Christian Feuersaenger <ludewich@users.sourceforge.net> + - added sanity checking for empty colorbars. + - using colorbar source now implies 'point meta rel=per plot' to get + consistency between the plot's colors and the colorbar. + +2010-07-10 Christian Feuersaenger <ludewich@users.sourceforge.net> + - fixed bug: 'xlabels at=edge top' and 'ylabels at=edge right' did not + adjust the ticklabel pos. + - improved error messages when \usepackage{pgfplotstable} is required + - documented (briefly) how '\addplot table[x={create col/.....}] works in the reference + for \addplot table + - documented and improved 'trim left' / 'trim right' feature (EXPERIMENTAL + PGF CVS VERSION REQUIRED) + - improved docs for alignment section. + - improved docs for 'legend image post style' + +2010-07-09 Christian Feuersaenger <ludewich@users.sourceforge.net> + - fixed bug: the check whether lists are terminated by '\\' failed if '\\' + occured within the list. This affected mainly legends and tick label + lists. + - improved and documented customized legends, including optional + appearance keys for specific legend texts + |\addlegendentry[<options>]{<text>}| and documentation for multiline + legend entries. + +2010-07-06 Christian Feuersaenger <ludewich@users.sourceforge.net> + - the 'colorbar to name' and 'legend to name' features are now implemented + using \label. Thus, the common way to insert the resulting pictures is to + use \ref -- it works in the same way as any other latex label. + - fixed bug: 'clip=false' did not apply to markers. + +2010-07-04 Christian Feuersaenger <ludewich@users.sourceforge.net> + - groupplots: added support for 'xlabels at=edge top', + 'ylabel at=edge right' and adjusted the 'xdescriptions at=edge top' and + 'ydescriptions at=edge right' accordingly. + + +2010-07-01 Christian Feuersaenger <ludewich@users.sourceforge.net> + - documented linear regression feature in pgfplots.pdf + + +2010-06-29 Christian Feuersaenger <ludewich@users.sourceforge.net> + - ybar now also supports line plots. + - added 'update limits' boolean as shortcut for \pgfplotsinterruptdatabb + - wrote \numplotsofactualtype and \plotnumofactualtype (allows to combined + bar plots with other plot types (like line plots) --> tests to check + combination of bar plots with other plot types would be good) + - implemented ybar with these macros + - reimplemented key filter such that it allows plot handlers. (might break + compatibility with existing images; recompile many old documents to check + it) + +2010-06-27 Christian Feuersaenger <ludewich@users.sourceforge.net> + - fixed bug: 'point meta=f(x)' was evaluated too early. Now it is + evaluated inside of \addplot in the survey phase. + +2010-06-25 Christian Feuersaenger <ludewich@users.sourceforge.net> + - fixed bug: 'each nth point' worked only for #1<10 + +2010-06-21 Christian Feuersaenger <ludewich@users.sourceforge.net> + - nodes near coords align now accepts some standard anchor names and + appends 'anchor=<value>' automatically. + +2010-06-17 Christian Feuersaenger <ludewich@users.sourceforge.net> + - legend to name: now supports \numplots + - added support for \scope/\endscope inside of an axis. + - added preliminary support for 'ycomb' and 'ybar' + +2010-06-16 Christian Feuersaenger <ludewich@users.sourceforge.net> + - fixed bug: plot graphics and legends did not work. + - fixed bug: providing a colormap inside of \addplot resulted in problems + with dimen parsing. + - fixed bug: 'every extra [xyz] tick' did not allow all tikz options (I + introduced a scope to fix it) + - \ref, \pgfplotslegendfromname, \pgfplotscolorbarfromname etc now support + separate file names when used with the external library. + - fixed bug: colorbars and french babel have been incompatible. + +2010-06-11 Christian Feuersaenger <ludewich@users.sourceforge.net> + - optimized runtime of colormap serialized from O(N^2) to O(N) + +2010-06-09 Christian Feuersaenger <ludewich@users.sourceforge.net> + - fixed bug: the 'every table' style now has higher precedence than + options provided in square brackets (the old variant yielded either problems with + row sep,col sep keys or with '/.add={}{}' inside of options) + - improved compatibility of detached legends/colorbar/\ref legends with + external lib + - fixed sanity checking for 'table/unique' style and provided meaningful error messages + +2010-06-08 Christian Feuersaenger <ludewich@users.sourceforge.net> + - fixed bug: 'ybar,every node near coord/.append style={scale=0.7}' + did not work properly. + To do so, I eliminated unnecessary key family assignments + - fixed bug: 'nodes near coords' and stacked plots did not work + - fixed bug: 'point meta' and stacked plots did not work + +2010-05-28 Christian Feuersaenger <ludewich@users.sourceforge.net> + - reduced save stack usage + - linear regression: x value is now determined from context + - \addplot table: allowed simple in-line create-on-use specifications + like \addplot table[y=create col/linear regression] + +2010-05-26 Christian Feuersaenger <ludewich@users.sourceforge.net> + - added key aliases 'legend reversed' = 'reverse legend' and 'legend + transposed' = 'transpose legend' + - generation of .dep files is now postponed until it is clear that the + file exists. + - fixed bug: shader=interp and mesh/ordering=y varies produced corrupted + results. + - fixed bug: shader=interp consumed too much stack save space. + +2010-05-19 Christian Feuersaenger <ludewich@users.sourceforge.net> + - table package: during lazy column creation, the macro \pgfplotstablename + expands to the currently processed table. This is now used as default for + linear regression. + - \addplot table: read completely now has the default value `auto' which + checks for 'create on use'. Thus, you can provide 'create on use' columns + in plot sources. + - linear regression: the scaling (linear/log) is now taken automatically + from an embedding axis. + - added 'transpose legend' style + +2010-05-10 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added 'legend cell align=left|right|center' styles to reduce the amount + of typing for this task. + +2010-05-06 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - table package: improved accuracy during gradient loglog. + - added possibility to exchange \includegraphics in plot graphics. + +2010-05-05 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed handling of colormap mesh width + reinterpolation. It seems it was + broken or at least not fully functional. + Now it appears to work, is more robust and provides more information on error. + +2010-05-03 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed bug: \addplot table (without '[]') sets 'x index=0,y index=1' + instead of using their actual value. + +2010-04-29 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - implemented missing \thisrowno (and \nextrowno and \prevrowno) macros + inside of \pgfplotstablecreatecol. + +2010-04-25 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed bug: named nodes inside of groupplots produced infinite loop + +2010-04-22 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed bug: 'enlargelimits' did not properly update axis fields; leading + to wrong automatically generated ticks. + +2010-04-21 Christian Feuersaenger <ludewich@users.sourceforge.net> + - table package: Fixed bug in 'unique' style. It worked only for the first + column. + - fixed bug: named nodes did not function properly in conjunction with pgf 2.00 + +2010-04-12 Christian Feuersaenger <ludewich@users.sourceforge.net> + - added 'restrict x to domain*' which truncates to domain boundaries + instead of assigning -inf or +inf. + +2010-04-10 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - legend to name and colorbar to name: Improved compatibility with context by introducing proper \protect ion + +2010-04-08 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed bug: setting ticklabel pos and axis lines to an incompatible + choice discarded tick lines. + - colorbar data ranges (point meta min/max) is now provided in scientific + notation, not as low level float. + - Fixed bug: |colorbar sampled line| and |colorbar left| where + incompatible. + +2010-04-06 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Added 'colorbar source' feature + +2010-04-01 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed 3D axis scaling inaccuracies (by using float arithmetics) + 2010-03-31 Christian Feuersaenger <ludewich@users.sourceforge.net> - Released version 1.3.1 +2010-03-30 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Added 'colorbar sampled' and 'colorbar sampled line' + 2010-03-25 Christian Feuersaenger <ludewich@users.sourceforge.net> - Imported all patches to PGF written by Christian Feuersaenger. @@ -13,11 +217,173 @@ - Fixed bug: overlay did not work properly - Fixed bug: grids worked only for boxed axes + - Now, anchor can also be the value of a named node inside of the axis. 2010-03-23 Christian Feuersaenger <ludewich@users.sourceforge.net> - Fixed bug: \pgfplotstablesave did not reset 'postproc cell content' +2010-03-12 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - removed spurious spaces in table package + +2010-03-09 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Added |sort| key for tabletypeset. + +2010-02-24 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed bug: the auto-generation of .dep files could fail. + Now, it will only be generated (automatically) if we are currently + externalizing. + +2010-02-23 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added \pgfplotsutilstrcmp + - rewrote API for 'iflessthan' of the array sort. It is now a general + utility function. + - added a lot if styles for comparison functions, among them + 'fixed <', 'float <', 'int <', 'string <', 'date <' and corresponding '>' + variations. + - Fixed bug: the 'date type' was broken due to a missing comma + +2010-02-22 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed bug: providing a point meta expression twice as in 'point meta=<expr>, point meta=<expr>' yielded an infinite recursion + - Provided first rudimentary version for \pgfplotstablesort + +2010-02-18 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - number printing: added 'sci generic' style to customize the appearance + of scientific format and a 'verbatim' style which doesn't use TeX macros + for the formatted numbers. + +2010-02-16 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added 'variance list' to regression feature + - added |trim cells| to table input. + - the table typesetting routines are now in a separate file. + It is now necessary to use \usepackage{pgfplotstable} to use them (as + documented). + +2010-02-12 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed problem with table prepare catcodes and argument parsing + - finished user interface and continued implementation for 'linear + regression' + +2010-02-10 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - implemented col sep=& (or col sep=ampersand) + - added support for 'linear regression' + +2010-02-09 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Added support for inline data as argument to + \pgfplotstableread{ + row + row2 + }{\macro} + - inline tables are now accepted directly for \addplot table and + \pgfplotstabletypeset + +2010-02-08 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Added choice 'point meta={TeX Code={\def\pgfplotspointmeta{42}}}' and + 'TeX code symbolic'. + +2010-02-04 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed problem with spurious white space occuring during table input command + +2010-02-02 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Added 'numeric type' to table package to switch back from string type or + data type. + - added 'numeric as string type' to table package. + +2010-01-26 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Introduced 'compat=1.3' . The name 'compat=newest' was not not such a + good idea since it might introduce a problem for following releases. + - Emphasized key names in references to show that /pgfplots/, /tikz/ and + similar prefixes are unnecessary. + - Fixed the 'xticklabels' key such that it also accepts '\\' terminated + lists. This fixes strange bugs with dots '.' as last characters in + entries. + +2010-01-21 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added sanity checks such that 'xmin/max' and friends can't be invoked + within an \addplot. + - plot gnuplot: added user customizable styles to change the dummy + variables. The initial config will now use 'x' for 1d, 'x,y' for 2d, 't' + for 1d parametric and 'u,v' for 2d parametric plots. + - fixed bug: one couldn't use different log/normal scalings in a group + plot. Relaxed sanity checking here. + - added docs for |variable| and |variable y| which appeared to be missing. + +2010-01-14 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed that '\addlegendimage' did not respect the every plot styles. + - added 'every legend image post' style. + +2010-01-26 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Introduced 'compat=1.3' . The name 'compat=newest' was not not such a + good idea since it might introduce a problem for following releases. + - Emphasized key names in references to show that /pgfplots/, /tikz/ and + similar prefixes are unnecessary. + - Added character lists |table/ignore chars| and |table/white space chars| + to handle special characters in input files. + - Fixed the 'xticklabels' key such that it also accepts '\\' terminated + lists. This fixes strange bugs with dots '.' as last characters in + entries. + +2010-01-21 Christian Feuersaenger <ludewich@users.sourceforge.net> + - added sanity checks such that 'xmin/max' and friends can't be invoked + within an \addplot. + - plot gnuplot: added user customizable styles to change the dummy + variables. The initial config will now use 'x' for 1d, 'x,y' for 2d, 't' + for 1d parametric and 'u,v' for 2d parametric plots. + - fixed bug: one couldn't use different log/normal scalings in a group + plot. Relaxed sanity checking here. + - added docs for |variable| and |variable y| which appeared to be missing. + +2010-01-15 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added support to generate makefile dependencies for pgfplots input files + automatically + +2010-01-14 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed that '\addlegendimage' did not respect the every plot styles. + - added 'every legend image post' style. + + +>>>>>>> +2010-03-23 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed bug: \pgfplotstablesave did not reset 'postproc cell content' + +2010-03-22 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed bug: \pgfplotstablesave did not reset 'include outfiles' + - Added 'colorbar to name' feature: no, colorbars can be placed + independently of an axis, even into the document's main text. + +2010-03-19 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - changed 'legend to macro' to 'legend to name'. + +2010-03-18 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed bug: axis descriptions for |small| and |footnotesize| styles were + too large + - added |tiny| style + - added |legend to macro|, a method to export the legend to a macro which + can be used *outside* of the axis where it belongs to. + 2010-03-16 Christian Feuersaenger <ludewich@users.sourceforge.net> - Fixed bug: 'draw=none' wasn't handled correctly. diff --git a/Master/texmf-dist/doc/latex/pgfplots/Makefile b/Master/texmf-dist/doc/latex/pgfplots/Makefile index 576def59f2f..daed5651ffe 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/Makefile +++ b/Master/texmf-dist/doc/latex/pgfplots/Makefile @@ -8,18 +8,23 @@ notes: TeX-programming-notes.pdf pgfplots: pgfplots.pdf pgfplotstable: pgfplotstable.pdf -%.pdf: update-git-hooks FORCE +include pgfplots.makefile + +%.pdf: FORCE mkdir -p gnuplot @export TEXMFCNF=.: && $(PDFLATEX) $(@:.pdf=.tex) @bibtex $(@:.pdf=) || exit 0 @makeindex $(@:.pdf=) || exit 0 @echo "" @echo "$@ compiled successfully. You may need to re-run make several times to get all cross-references right." + +pgfplots.pdf: $(ALL_FIGURES) + +pgfplots.makefile: + @export TEXMFCNF=.: && $(PDFLATEX) pgfplots clean: rm -f *.aux *.ind *.idx *.toc *.out *.log *.ilg *.dvi pgfplots.pdf pgfplotstable.pdf *.djs *.bbl *.blg figures/expensiveexample* -update-git-hooks: - @ FORCE: diff --git a/Master/texmf-dist/doc/latex/pgfplots/TeX-programming-notes.pdf b/Master/texmf-dist/doc/latex/pgfplots/TeX-programming-notes.pdf Binary files differindex adc6b7268fa..fb1a4b62ce7 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/TeX-programming-notes.pdf +++ b/Master/texmf-dist/doc/latex/pgfplots/TeX-programming-notes.pdf diff --git a/Master/texmf-dist/doc/latex/pgfplots/gnuplot/pgfplots_exp b/Master/texmf-dist/doc/latex/pgfplots/gnuplot/pgfplots_exp new file mode 100644 index 00000000000..8cea9808f2c --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/gnuplot/pgfplots_exp @@ -0,0 +1 @@ +gnuplot 4.2 patchlevel 6 diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex index 037fd69d3eb..92a024a6035 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex @@ -21,7 +21,6 @@ \makeatother }% - \makeatletter \def\pgfplotsmakefilelinkifuseful#1#2{% \protect\pgfplotsmakefilelinkifuseful@{#1}{#2}% @@ -255,6 +254,30 @@ { \end{pgfmanualentry} } +\newenvironment{codeargskey}[2]{% + \begin{pgfmanualentry} + {\toks0={#2}% + \xdef\argpattern{\the\toks0 }% + }% + \pgfmanual@command@to@string\argpattern\argpattern + \pgfmanualentryheadline{{\ttfamily\declarekey{#1}\textcolor{gray}{/\pgfmanualpdfref{/handlers/.code}{.code args}}=\texttt{\{\argpattern\}}\marg{...}}\hfill}% + \def\mykey{#1}% + \def\mypath{}% + \def\myname{}% + \firsttimetrue% + \decompose#1/\nil% + \pgfmanualbody +} +{ + \end{pgfmanualentry} +} +\def\pgfmanual@command@to@string#1#2{% + \expandafter\pgfmanual@command@to@string@@\meaning#1\pgfmanual@EOI{#2}% +}% +\xdef\pgfmanual@glob@TMPa{\meaning\pgfutil@empty}% +\expandafter\def\expandafter\pgfmanual@command@to@string@@\pgfmanual@glob@TMPa#1\pgfmanual@EOI#2{% + \def#2{#1}% +}% \newenvironment{pgfplotscodekey}[1]{% \begin{codekey}{/pgfplots/#1}% diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.basic.reference.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.basic.reference.tex index bb705ef1831..a51bcaed5b8 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.basic.reference.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.basic.reference.tex @@ -127,12 +127,19 @@ Generates pretty--printed output\footnote{This method was previously \texttt{\te The number is printed using the current number printing options, see the manual of \PGFPlotstable\ which comes with this package for the different number styles, rounding precision and rounding methods. \end{command} +\begin{command}{\numplots} + Inside of any of the axis environments, associated style, option or command, |\numplots| expands to the total number of plots. +\end{command} +\begin{command}{\numplotsofactualtype} + Like |\numplots|, this macro returns the total number of plots which have the same plot handler. Thus, if you have |sharp plot| active, it returns the number of all |sharp plots|. If you have |ybar| active, it returns the number of |ybar| plots and so on. +\end{command} + \begin{command}{\plotnum} Inside of |\addplot| or any associated style, option or command, |\plotnum| expands to the current plot's number, starting with~$0$. \end{command} -\begin{command}{\numplots} - Inside of any of the axis environments, associated style, option or command, |\numplots| expands to the total number of plots. +\begin{command}{\plotnumofactualtype} + Like |\plotnum|, but it returns the number among all plots of the same type (see |\numplotsofactualtype|). \end{command} \begin{command}{\coordindex} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.figlist b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.figlist index acc4eee1e0f..cea2b0e7b56 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.figlist +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.figlist @@ -45,3 +45,4 @@ figures/expensiveexamplepgfplots-figure43 figures/expensiveexamplepgfplots-figure44 figures/expensiveexamplepgfplots-figure45 figures/expensiveexamplepgfplots-figure46 +figures/expensiveexamplepgfplots-figure47 diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex index ac8b4ba4bcb..87c87058fc1 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex @@ -190,6 +190,12 @@ pdflatex -shell-escape main \end{codeexample} \end{command} +\begin{command}{\tikzappendtofigurename\marg{suffix}} + Appends \meta{suffix} to the actual value of |figure name|. + + It is a shortcut for |\tikzset{external/figure name/.add={}|\marg{suffix}|}| (a shortcut which is also supported if \tikzname\ is not installed, see below). +\end{command} + \begin{key}{/tikz/external/system call=\marg{template}} \label{extlib:systemcall:option} @@ -217,6 +223,29 @@ pdflatex -shell-escape main Contains the command line option for |latex| which enables the |\write18| feature. For \TeX-Live, this is |-shell-escape|. For Mik\TeX, you should use |\tikzexternalize[shell escape=-enable-write18]|. \end{key} +\paragraph{Support for Labels and References In External Files} +The |external| library comes with extra support for |\label| and |\ref| (and other commands which usually store information in the |.aux| file) inside of external files. + +There are, however, some points which need your attention when you try to use +\begin{enumerate} + \item[a)] |\ref| to something in the main document inside of an externalized graphics or + \item[b)] |\label| in the externalized graphics which is referenced in the main document. +\end{enumerate} + +For point a), a |\ref| inside of an externalized graphics works \emph{only} if you issue the required system call \emph{manually} or by |make|. The initial configuration |mode=convert with system call| does \emph{not} support |\ref|. But you can copy--paste the system call generated by |mode=convert with system call| and issue it manually. The reason is that |\ref| information is stored in the main |.aux| file -- but this auxiliary file is not completely written when |mode=convert with system call| is invoked (there is a race condition). Note that |\pageref| is not supported (sorry). Thus: if you have |\ref| inside of external graphics, consider using |mode=list and make| or copy--paste the system call for the image(s) and issue it manually. + +Point b) is realized automatically by the external library. In detail, a |\label| inside of an externalized graphics causes the external library to generate separate auxiliary files for every external image. These files are called \meta{imagename}|.dpth|. The extension |.dpth| indicates that the file also contains the image's depth (the |baseline| key of \tikzname). Furthermore, anything which would have been written to an |.aux| file will be redirected to the |.dpth| file -- but only things which occur inside of the externalized |tikzpicture| environment. When the main document loads the image, it will copy the |.dpth| file into the main |.aux| file. Then, successive compilations of the main document contain the external |\label| information. In other words, a |\label| in an external graphics needs the following work flow: +\begin{enumerate} + \item The external graphics needs to be generated together with its |.dpth| (usually automatically by \tikzname). + \item The main document includes the external graphics and copies the |.dpth| content into its main |.aux| file. + \item The main document needs to be translated one further time to re-read its |.aux| file\footnote{Note that it is not possible to activate the content of an auxiliary file after \texttt{\textbackslash begin\{document\}} in \LaTeX.}. +\end{enumerate} +There is just one special case which occurs if a |\label|/|\ref| combination is realized itsself by a |tikzpicture|. This is, for example, the case for the legend |\ref| images or for the |\pgfplotslegendfromname| feature. In such cases, you need to proceed as for case a) since |mode=convert with system call| can't handle that stuff on its own. + +In other words: a |\label| in an external document works automatically, just translate the main document often enough. A |\ref| might need manual adjustments as described for case a) above. + + +\paragraph{Operation Modes} \begin{key}{/tikz/external/mode=\mchoice{convert with system call,list and make,$\dotsc$} (initially convert with system call)} This allows to change the default operation mode. There are a handful of choices possible, all of them are described in detail in~\cite[section ``Externalization Library'']{tikz}. The most useful ones are probably the initial configuration |convert with system call| and the specialized choice |list and make|. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex index ec1686dadfb..a66239c4b25 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex @@ -271,7 +271,7 @@ then we can plot |Cost| versus |Error| using The first plot employs inline coordinates; the second one reads numerical data from file and plots column `|Cost|' versus `|Error|'. \noindent -Besided the environment ``|loglogaxis|'' you can use +Besides the environment ``|loglogaxis|'' you can use \begin{itemize} \item |\begin{axis}...\end{axis}| for normal plots, \item |\begin{semilogxaxis}...\end{semilogxaxis}| for plots which have a normal~$y$ axis and a logarithmic~$x$ axis, diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex index 056f80c7334..ed18c1a5ffe 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.groupplot.tex @@ -1,15 +1,18 @@ \subsection{Grouping plots} +{ \label{sec:group:plot} {\noindent {\emph{by Nick Papior Andersen}}} \index{Group library!Subplots}% +\pgfkeys{/pdflinks/search key prefixes in/.add={/pgfplots/group/,}{}} + \begin{pgfplotslibrary}{groupplots} A library which allows the user to typeset several plots in a matrix like structure. Often one has to compare two plots to one another, or you simply need to display two plots in conjunction with each other. Either way the following - section describes this library which makes this typesetting easy. + section describes this library which makes matrix structure easier than alternative methods discussed in Section~\ref{sec:pgfplots:arrayform}. \end{pgfplotslibrary} \begin{environment}{{groupplot}\oarg{options}} @@ -53,11 +56,11 @@ With such an environment one can typeset plots in matrix like styles The equivalent code is seen as the second example and it is clear that you have to type a lot less. So how do you use it? First of all you need to utilize the new environment |groupplot|. Within this environment the following command works. -\begin{command}{\nextgroupplot\oarg{options} \meta{normal plot commands}} +\begin{command}{\nextgroupplot\oarg{axis options} \meta{normal plot commands}} \label{cmd:pgfplots:nextgroupplot} This command shifts the placement of the plot. Therefore one should always start the environment |groupplot| with the command -\textbackslash|nextgroupplot| in order to create the first plot. The \oarg{options} are the options that are supplied to the following plot commands until -the next \textbackslash|nextgroupplot| command is seen by \TeX. +|\nextgroupplot| in order to create the first plot. The \oarg{axis options} are the options that are supplied to the following axes until +the next |\nextgroupplot| command is seen by \TeX. The order in which figures are typeset are as seen in the next example. % \usepgfplotslibrary{groupplots} \begin{codeexample}[] @@ -131,17 +134,19 @@ Or for instance zooming in on data as in the next example. \subsubsection{Grouping options} \label{sec:pgfplots:group:options} -Here the various available options of the library resides. +Here the various available options of the library reside. + +\begin{pgfplotskey}{group style=\marg{options with {\normalfont\texttt{group/}} prefix}} + This key sets all \meta{options} using the |/pgfplots/group/| prefix. + + Note that the distinction between |group/| and normal options is important has some of them are quite similar. -\begin{pgfplotskey}{group style=group/.cd,\marg{options}} - This key allows one to faster reach the group options. Some of the options are very similar to the normal commands so they are supplied in another - subdirectory |group|. So the following are equivalent. + For example, the following statements are all equivalent: \begin{codeexample}[code only] \pgfplotsset{group style={a=2,b=3}} \pgfplotsset{group/a=2,group/b=3} \pgfplotsset{group/.cd,a=2,b=3} \end{codeexample} -It can thus decrease the size of your options with out destroying the clearness of where options belong. \end{pgfplotskey} All the following keys are in the subdirectory |group|. @@ -149,7 +154,7 @@ All the following keys are in the subdirectory |group|. group/columns=\meta{columns} (initially 1), group/rows=\meta{rows} (initially 1)} These keys determines the total number of plots that can be in one environment |groupplot|. It is thus important not to add more - \textbackslash|nextgroupplot| in the environment than \meta{columns}$\times$\meta{rows}. This is critical to set if one uses more than 1 more plot. As + |\nextgroupplot| in the environment than \meta{columns}$\times$\meta{rows}. This is critical to set if one uses more than 1 more plot. As the key |group size| uses |columns| and |rows| you should stick to either |group size| or both |columns| and |rows|. \end{pgfplotskeylist} @@ -163,8 +168,46 @@ All the following keys are in the subdirectory |group|. This style is used on every plot as the first style. It is thus equivalent as \meta{options} in the |groupplot| environment. \end{pgfplotskey} -\begin{pgfplotskeylist}{group/xticklabels at=\mchoice{all,edge top,edge bottom} (initially all),% - group/yticklabels at=\mchoice{all,edge left,edge right} (initially all)} +\begin{pgfplotskeylist}{% + group/xlabels at=\mchoice{all,edge bottom,edge top} (initially all),% + group/ylabels at=\mchoice{all,edge left,edge right} (initially all)} + In order to determine which plots get labels typeset one can use these keys. By default all axis gets typeset normally and thus have both $x$ and + $y$ axis labels. +% \usepgfplotslibrary{groupplots} +\begin{codeexample}[] +\begin{tikzpicture} + \begin{groupplot}[ + group style={ + group name=my plots, + group size=2 by 2, + xlabels at=edge bottom, + ylabels at=edge left, + }, + footnotesize, + width=4cm, + height=4cm, + % + xlabel=time $t$ / h, + ylabel=$c$ / mol/L, + ] + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \end{groupplot} +\end{tikzpicture} +\end{codeexample} +In the example above, only the bottom row gets the label defined in the beginning |groupplot|-environment on the $x$ axis and only the first column of plots gets labels on the +$y$ axis on their left side. These keys are especially handy when using \textit{glued} plots. +\end{pgfplotskeylist} + +\begin{pgfplotskeylist}{% + group/xticklabels at=\mchoice{all,edge top,edge bottom} (initially all),% + group/yticklabels at=\mchoice{all,edge left,edge right} (initially all)} In order to determine which plots get tick labels typeset one can use these keys. By default all axis gets typeset normally and thus have both $x$ and $y$ axis tick labels. If one sets @@ -173,6 +216,52 @@ All the following keys are in the subdirectory |group|. \end{codeexample} only the bottom row gets tick labels on the $x$ axis and only the last column gets tick labels on the $y$ axis on their right side. These keys are specially handy when using \textit{glued} plots. + + Keep in mind that this is implies the same ticks for all plots. +\end{pgfplotskeylist} + +\begin{pgfplotskeylist}{% + group/x descriptions at=\mchoice{all,edge top,edge bottom} (initially all),% + group/y descriptions at=\mchoice{all,edge left,edge right} (initially all)} + These are simply a short hand for both using both |xticklabels at| and |xlabels at| simultaneously: + +% \usepgfplotslibrary{groupplots} +\begin{codeexample}[] +\begin{tikzpicture} + \begin{groupplot}[ + group style={ + group name=my plots, + group size=2 by 2, + % + x descriptions at=edge bottom, + y descriptions at=edge right, + horizontal sep=0.5cm, + vertical sep=0.5cm, + }, + footnotesize, + width=4cm, + height=4cm, + % + xlabel=time $t$ / h, + ylabel=$c$ / mol/L, + ] + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \nextgroupplot + \addplot coordinates{(0,0) (1,2) (2,1)}; + \end{groupplot} +\end{tikzpicture} +\end{codeexample} + +Here, |x descriptions at=edge bottom| yields that $x$ descriptions (|xlabel| and |xticklabel|) are only used for the lowest row. Furthermore, |y descriptions at=edge right| places $y$ descriptions only for the rightmost column. Consider modifying the |horizontal sep| and |vertical sep| for your needs. + + As for |xticklabels at|, usage of this key implies the same ticks for all plots. + + This might \emph{require} |compat=1.3| (or newer). \end{pgfplotskeylist} \begin{pgfplotskey}{group/group name=\marg{name} (initially group)} @@ -205,7 +294,7 @@ specially handy when using \textit{glued} plots. \end{pgfplotskey} \begin{pgfplotskey}{group/empty plot/.style=\marg{style} (initially /pgfplots/hide axis)} - This key can be used as an option to the command \textbackslash|nextgroupplot|. This makes the next plot invisible (only the axes) but maintains it anchors and + This key can be used as an option to the command |\nextgroupplot|. This makes the next plot invisible (only the axes) but maintains it anchors and name. If you want it to behave in another style then you can redefine it. Consider the same example as before. % \usepgfplotslibrary{groupplots} \begin{codeexample}[] @@ -231,5 +320,6 @@ specially handy when using \textit{glued} plots. circle (3pt) node {North west}; \end{tikzpicture} \end{codeexample} -Notice that you need to call a \textbackslash|nextgroupplot| again after to jump to the next plot. +Notice that you need to call a |\nextgroupplot| again after to jump to the next plot. \end{pgfplotskey} +} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.tex index 0049ec089bf..fb3692ea979 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.tex @@ -67,10 +67,16 @@ This section describes some libraries which come with \PGFPlots, but they are mo \item The library does not yet support rotated axes. Use |clickable=false| for those axes. \item The library works only with |pdflatex|, |dvips| or |dvipdfm| are not supported\footnote{In fact, they should be. I don't really know why they don't $\hdots$ any hint is welcome.}. - \item Up to now, it is \emph{not} possible to use this library together with the |external| library and other image externalization methods of section~\ref{sec:pgfplots:importexport}. + \item Up to now, it is \emph{not} possible to use this library together with the |external| library and other image externalization methods of section~\ref{sec:pgfplots:importexport}. - To be more precise, the exported \pdf\ documents will work correctly, but the |\includegraphics| command does not import the dynamic features. - Please note that the exported \pdf\ documents will only work if |\usepackage[pdftex]{eforms}| is placed \emph{before} loading \pgfname, \Tikz\ or \PGFPlots. + To be more precise, you can (with two extra preamble lines, see below) get correctly annotated, exported \pdf\ documents, but the |\includegraphics| command does not import the dynamic features. + + In case you decide to use this work--around, you need to insert +\begin{codeexample}[code only] +% \maxdeadcycles=10000 % in case you get the error `Output loop---<N> consecutive dead cycles.' +\usepackage[pdftex]{eforms} +\end{codeexample} + \noindent \emph{before} loading \pgfname, \Tikz\ or \PGFPlots. The |\maxdeadcycles| appears to be necessary for large documents, try it out. As long as you are working on a draft version of your document, you might want to use \begin{codeexample}[code only] diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.makefile b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.makefile index 1f9688988df..5d37416311e 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.makefile +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.makefile @@ -152,3 +152,6 @@ figures/expensiveexamplepgfplots-figure45.pdf: figures/expensiveexamplepgfplots-figure46.pdf: pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "figures/expensiveexamplepgfplots-figure46" "pgfplots" +figures/expensiveexamplepgfplots-figure47.pdf: + pdflatex -shell-escape -halt-on-error -interaction=batchmode -jobname "figures/expensiveexamplepgfplots-figure47" "pgfplots" + diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.pdf b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.pdf Binary files differindex 238d646785b..ffa57bd68ab 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.pdf +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.pdf diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.preamble.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.preamble.tex index 8d2bf40ada7..f062f124be0 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.preamble.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.preamble.tex @@ -53,6 +53,25 @@ \let\@wrindex=\@old@wrindex \makeatother + +\makeatletter +% disables colorlinks for all following \ref commands +\def\pgfplotsmanualdisablecolorforref{% + \pgfutil@ifundefined{pgfplotsmanual@oldref}{% + \let\pgfplotsmanual@oldref=\ref + }{}% + \def\ref##1{% + \begingroup + \let\Hy@colorlink=\pgfplots@disabled@Hy@colorlink + \let\Hy@endcolorlink=\pgfplots@disabled@Hy@endcolorlink + \pgfplotsmanual@oldref{##1}% + \endgroup + }% +}% +\def\pgfplots@disabled@Hy@colorlink#1{\begingroup}% +\def\pgfplots@disabled@Hy@endcolorlink{\endgroup}% +\makeatother + % Formatiere Seitennummern im Index: \newcommand{\indexpageno}[1]{% {\bfseries\hyperpage{#1}}% @@ -92,6 +111,7 @@ \fi %\def\pgfsysdriver{pgfsys-pdftex.def} \usepackage{pgfplots} +\usepackage{pgfplotstable} \ifpdf % this allows to disable the clickable lib from command line using @@ -115,6 +135,7 @@ \usepackage[latin1]{inputenc} \usepackage{amsmath} \usepackage{eurosym} +\usepackage{nicefrac} \input{pgfplots-macros} \usepackage{nicefrac} @@ -155,7 +176,7 @@ \pgfqkeys{/codeexample}{% every codeexample/.append style={ width=8cm, - /pgfplots/every axis/.append style={legend style={fill=graphicbackground}} + /pgfplots/legend style={fill=graphicbackground} }, tabsize=4, } diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.2dplots.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.2dplots.tex index cb55235b94d..1eccd01e5c9 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.2dplots.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.2dplots.tex @@ -161,9 +161,9 @@ The style is defined as follows. /pgf/bar shift={% % total width = n*w + (n-1)*skip % i.e. subtract half for centering - -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + -0.5*(\numplotsofactualtype*\pgfplotbarwidth + (\numplotsofactualtype-1)*#1) + % the '0.5*w' is for centering - (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1% + (.5+\plotnumofactualtype)*\pgfplotbarwidth + \plotnumofactualtype*#1% }, }, } @@ -207,11 +207,16 @@ The formular for |bar shift| assigns shifts dependent on the total number of plo \addplot coordinates {(1930,15e6) (1940,12e6) (1950,13e6) (1960,25e6) (1970,35e6)}; -\legend{Far,Near,Here} + +\addplot[red,sharp plot,update limits=false] + coordinates {(1910,4.3e7) (1990,4.3e7)} + node[above] at (axis cs:1950,4.3e7) {Houses}; + +\legend{Far,Near,Here,Annot} \end{axis} \end{tikzpicture} \end{codeexample} -Here |ybar| yields |/pgfplots/ybar| because it is an argument to the axis, not to a single plot. +Here |ybar| yields |/pgfplots/ybar| because it is an argument to the axis, not to a single plot. The style affects the first three |\addplot| commands. Note that it shifts them horizontally around the plot coordinates. The fourth |\addplot| command is some kind of annotation which doesn't |update limits|. As for |xbar|, the bar width and shift can be configured with |bar width| and |bar shift|. However, the bar shift is better provided as argument to |/pgfplots/ybar| since this style will overwrite the bar shift. Thus, prefer |/pgfplots/ybar=4pt| to set the bar shift. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.3dplots.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.3dplots.tex index 05c431c0588..d518cddce4b 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.3dplots.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.3dplots.tex @@ -313,6 +313,7 @@ A more sophisticated example is to draw the approximated function as a |surf| pl % `pgfplotsexample4.dat' contains similar data as in % `pgfplotsexample4_grid.dat', but it uses a uniform % matrix structure (same number of points in every scanline). + % See examples above for extracts. \addplot3[surf,mesh/ordering=y varies] table {plotdata/pgfplotsexample4.dat}; \addplot3[scatter,scatter src=\thisrow{f(x)},only marks, z filter/.code={\def\pgfmathresult{1.4}}] @@ -328,7 +329,7 @@ A more sophisticated example is to draw the approximated function as a |surf| pl \noindent to get exactly the same effect. Choose whatever you like best. The |z filter| works for every coordinate input routine, the |z expr| feature is only available for |plot table|. -The following example uses |mark=cube*| and |z buffer=sort| to place boxes at each input coordinate. Each boxes color is determines by |point meta={x+y+3}|, so the sum of the input coordinates determines the colors. The remaining keys are just for pretty printing. +The following example uses |mark=cube*| and |z buffer=sort| to place boxes at each input coordinate. The color for each box is determined by |point meta={x+y+3}|. The remaining keys are just for pretty printing. \pgfplotsexpensiveexample \begin{codeexample}[] \begin{tikzpicture} @@ -566,7 +567,7 @@ The following example uses |mark=cube*| and |z buffer=sort| to place boxes at ea \end{description} The choice |flat| is actually the same as |flat mean|. Please note that |shader=flat mean| and |shader=flat corner| also influence mesh plots -- the choices determine the mesh segment color. - Another choice is |shader=interp| which uses Goraud shading (bilinear interpolation) to fill the segments. + Another choice is |shader=|\declareandlabel{interp} which uses Goraud shading (smooth linear interpolation of two triangles approximating rectangles) to fill the segments. \pgfplotsexpensiveexample \begin{codeexample}[] diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex index 9386714999c..593f7961b80 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.alignment.tex @@ -128,7 +128,37 @@ And finally, we have origin anchors which are especially useful when axis lines \showit{origin}{135} \end{tikzpicture} \end{center} -The default value is |anchor=south west|. You can use anchors in conjunction with the \Tikz\ |baseline| option and/or |\begin{pgfinterruptboundingbox}| to perform alignment. + + \noindent There is a fifth anchor which is not directly related to the axis: you can provide the anchor of \emph{a named inner node}. Thus, you can define your own anchor, by writing |\node (|\meta{name}|) at |\parg{point coordinate}| {};| as follows (using the |baseline| option described below): +\begin{codeexample}[] +Aligning at ....... +\begin{tikzpicture}[baseline] +\begin{axis}[small,anchor=aninnernode.center] + \addplot {sin(deg(x))}; + \node + [pin=-90:(aninnernode),fill=black,circle,scale=0.3] + (aninnernode) at (axis cs:-2,0.75) {}; + \draw[help lines] (axis cs:-6,0.75) -- (axis cs:6,0.75); +\end{axis} +\end{tikzpicture} +\end{codeexample} +\noindent What happens is that a node is placed at |(axis cs:-2,0.75)|. Note that the options |[pin=...]| are merely to show the |\node| (the pin style has been defined by the \PGFPlots\ manual). Since a name can also be assigned using |name=|\meta{node's name} and since any \PGFPlots\ description is also a |\node|, you can align your plot at selected axis descriptions: +\begin{codeexample}[] +Aligning at ....... +\begin{tikzpicture}[baseline] +\begin{axis}[ + small, + title={The function $\sin x$ is very pretty.}, + title style={name=MyTitleNode}, + anchor=MyTitleNode.base, +] + \addplot {sin(deg(x))}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + +The default value is |anchor=south west|. +You can use anchors in conjunction with the \Tikz\ |baseline| option and/or |\begin{pgfinterruptboundingbox}| to perform alignment. \paragraph{Remarks:} Each of the anchors on the axis rectangle has an equivalent to a coordinate in the |axis description cs| described in section~\ref{pgfplots:sec:axis:description:cs}. That means the first set of anchors actually lives on the \emph{tight bounding box around the axis} (without any ticks or descriptions). The |south west| anchor will always be the lower left corner of this bounding box, even in case of a rotated or skewed coordinate system\footnote{Note that this is only true for versions since 1.3.}. Similar statements hold for the other anchors. } @@ -180,7 +210,14 @@ The |baseline| key is related to |\begin{minipage}|\oarg{align how} or |\begin{t \subsubsection{Horizontal Alignment} \label{sec:halign}% -If you place multiple |axes| into a single |tikzpicture| and use the `|anchor|'-option, you can control horizontal alignment: +Horizontal alignment can be done in two ways: +\begin{enumerate} + \item Using separate |tikzpicture| environments which have reduced bounding boxes or + \item A single |tikzpicture| environment in which the complete alignment is done. +\end{enumerate} +The first approach requires the use of reduced bounding boxes and is discussed in Section~\ref{sec:bb}. + +The second approach, a single |tikzpicture| environment, employs the |at| and |anchor| keys to align parts of the images. For example, if you place multiple |axes| into a single |tikzpicture| and use the `|anchor|'-option, you can control horizontal alignment: \begin{codeexample}[] \begin{tikzpicture} \pgfplotsset{every axis/.append style={ @@ -202,11 +239,8 @@ cycle list={ (0.109967, 1.000027)}; \end{axis} -% introduce named coordinate: -\path (main plot.below south west) ++(0,-0.1cm) - coordinate (lower plot position); - -\begin{axis}[at={(lower plot position)}, +\begin{axis}[ + at={(main plot.below south west)},yshift=-0.1cm, anchor=north west, width=4cm,scale only axis,height=0.8cm, ytick=\empty] @@ -220,13 +254,153 @@ cycle list={ \end{codeexample} +\subsubsection{Alignment In Array Form (Subplots)} +\label{sec:pgfplots:arrayform} +\index{Subplots}% +\index{Alignment!Subplots}% +\index{Alignment!Array}% +\index{array!Array Alignment}% +\pgfmanualpdflabel{\textbackslash matrix}{}% +Sometimes multiple alignment axes in array form are desired. \PGFPlots\ supports this task in several ways which are described in the following. There are basically three related, yet different, approaches: +\begin{enumerate} + \item Simply place |\begin{tikzpicture}...\end{tikzpicture}| into a \LaTeX\ table. + This is straight--forward; you would do the very same thing with |\includegraphics|. + + In addition to |\includegraphics|, the |baseline| feature allows simple yet effective vertical alignment. At the time of this writing, the experimental \PGF\ version available from |texexample.net| also supports the |trim left| and |trim right| features which allow simple yet effective horizontal alignment (see below). + + \item Use a \emph{single} picture which contains an array of axes, i.e.\ a pattern like + + |\begin{tikzpicture} \matrix{ |\meta{multiple axes}|}; \end{tikzpicture}|. + + This allows considerably simpler alignment! Alas, it needs special handling for |legend entries| due to a weakness of |\matrix|. If you use the |external| library (which is recommended), it takes more time since the picture gets larger. + + \item Use the |groupplots| library shipped with \PGFPlots. It is specialized on axes in array form with particular strength if the axes are closely related (for example if they share axis descriptions like |xlabel| or even tick labels). Note, however, that the other approaches are better when it comes to automatic handling of bounding boxes. +\end{enumerate} +The |groupplots| library is discussed in all detail in Section~\ref{sec:group:plot}. This section discusses the other two approaches. + + +\paragraph{Array Alignment using \LaTeX\ Tables} +The idea is simple: use a \LaTeX\ table and provide one |tikzpicture| for every cell. You are probably familiar with this sort of alignment, perhaps together with |\includegraphics|. It works in the very same way for \PGFPlots. The approach is the simplest one since it doesn't need special knowledge. Its disadvantage, however, is more difficulty to control positions \emph{inside} of the image (like differently sized axis descriptions). + +Is is strongly recommended to employ the |baseline| option for each cell picture, which simplifies vertical alignment considerably. If you want a simple solution to place separate axes in array form, and you prefer to use one |tikzpicture| for every axis, the probably most simple and most effective way to realize horizontal alignment is the |trim left| and |trim right| feature. Unfortunately, it will only be available as part of the \emph{next} stable \PGF\ release (or available as part of the experimental \PGF\ version from |texample.net|). Since I am aware of many users who downloaded the experimental \PGF\ version, I document it here as well. + +The |trim left| feature can be used to exclude axis descriptions on the left from the bounding box, and the |trim right| can exclude axis descriptions on the right from the bounding box. Thus, alignment is done using the vertical axis lines. Since both keys effectively modify the bounding box, they are documented in Section~\ref{sec:bb} ``Bounding Box Restrictions''. Here is just a small example for array alignment by means of |tabular|, |baseline| and the |trim| features: + +\begin{codeexample}[vbox] +\pgfplotsset{ + small, + title=Requires experimental PGF! +} +\begin{center} +\begin{tabular}{rl} + \begin{tikzpicture}[baseline,trim axis left] + \begin{axis} + \addplot {x}; + \end{axis} + \end{tikzpicture} + & + \begin{tikzpicture}[baseline,trim axis right] + \begin{axis}[ + ylabel={$f(x)=x^2$}, + yticklabel pos=right, + ylabel style={font=\Huge}] + \addplot {x^2}; + \end{axis} + \end{tikzpicture} + \\ + % + \begin{tikzpicture}[baseline,trim axis left] + \begin{axis}[xlabel=$x$,xlabel style={font=\Huge}] + \addplot {x^3}; + \end{axis} + \end{tikzpicture}% + & + \begin{tikzpicture}[baseline,trim axis right] + \begin{axis}[yticklabel pos=right] + \addplot {x^4}; + \end{axis} + \end{tikzpicture}% + \\ +\end{tabular}% +\end{center} +\end{codeexample} +\noindent The example has $2 \times 2$ axes. The |baseline| feature controls the vertical alignment: the lower axis lines are always on the same height. The |trim axis left| key is a style which tells \Tikz\ to trim everything which is left of the left axis line. Similarly, the |trim axis right| key does not include picture parts right of the right axis line. Together with |\begin{center}| and the |yticklabel pos=right| key, we get correct horizontal and vertical alignment together with centering at the left- and right axis lines (without descriptions). + +A strong advantage is that this type of alignment requires almost no changes to your pictures. Thus, you can copy--paste existing images (\TeX\ code) relatively simple. + +Note that the approach is fully compatible with the image |external|ization library: each picture is exported separately, and the bounding box restrictions (and the |baseline| offset) are stored in separate |.dpth| files. The |trim left| / |trim right| approach for horizontal alignment is the \emph{only} supported way for reduced bounding boxes and image externalization. + +Unfortunately, |trim left| and |trim right| are not shipped with \PGFPlots\ and will be part of the next stable \Tikz\ release. + + +\paragraph{Array Alignment using \Tikz\ Matrices} +While it is possible to use (for example) |tabular| combined with the vertical and horizontal alignment methods discussed above, it might be better to use a \Tikz\ |matrix| since it automatically handles the size of axis descriptions. + +A \Tikz\ matrix is some sort of ``graphical'' table. It knows everything about picture alignment and it has more flexibility than |tabular| when it comes to graphics. The idea is to pack the complete array into a \emph{single} picture. + +The complete documentation of a \Tikz\ matrix is beyond the scope of this manual, please refer to \cite{tikz} for details. But we provide an example here: +\pgfmanualpdflabel{/tikz/matrix}{}% +\begin{codeexample}[] +\begin{tikzpicture} + \pgfplotsset{small} + \matrix { + \begin{axis} + \addplot {x}; + \end{axis} + & + % differently large labels are aligned automatically: + \begin{axis}[ylabel={$f(x)=x^2$},ylabel style={font=\Huge}] + \addplot {x^2}; + \end{axis} + \\ + % + \begin{axis}[xlabel=$x$,xlabel style={font=\Huge}] + \addplot {x^3}; + \end{axis} + & + \begin{axis} + \addplot {x^4}; + \end{axis} + \\ + }; +\end{tikzpicture} +\end{codeexample} +\noindent So, a matrix is a picture element inside of |tikzpicture|. Its cells are separated by `|&|' as in tabular (or, if `|&|' causes problems, with |\pgfmatrixnextcell|). Its rows are separated by `|\\|'. Each cell is aligned using the cells' anchor. Since, by default, the anchor of an axis is placed at the lower left corner, the example above is completely aligned, without the need for any bounding box modifications -- even the labels are aligned correctly. If another anchor shall be used, simply place +\begin{codeexample}[code only] +\pgfplotsset{anchor=....} +\matrix { + ... +}; +\end{codeexample} +\noindent in front of the matrix. This will use the same configuration for every sub-plot. + +\paragraph{Attention:} Unfortunately, the array alignment with |\matrix| need special \emph{attention with legends}. A legend is also a |\matrix| and \Tikz\ matrizes can't be nested. You will need to use the |legend to name| feature (or to assemble a legend by means of |\label| and |\ref|) to overcome this weakness (see Section~\ref{pgfplots:legend:labelref} for details). + + +\subsubsection{Miscellaneous for Alignment} + +\begin{predefinednode}{current axis} + A node which refers to the current axis or the last typeset axis. + + You can use this node in axis descriptions, for example to place axis labels or titles. + + \paragraph{Remark:} If you use |current axis| inside of axis descriptions, the ``current axis'' is not yet finished. That means you \emph{can't use any outer anchor} inside of axis descriptions. + + It is also possible to use |current axis| in any drawing or plotting commands inside of an axis (but no outer anchor as these are not defined when drawing commands are processed). This usage is similar to the |axis description cs|. +\end{predefinednode} + \subsubsection{Bounding box restrictions} +\label{sec:bb} Bounding box restrictions can be realized with several methods of \PGF: \begin{enumerate} \item The |overlay| option, \item The |pgfinterruptboundingbox| environment, - \item The |\useasboundingbox| path. + \item The |\pgfresetboundingbox| command, + \item The |\useasboundingbox| path, + \item The |trim left| and |trim right| feature (which is the \emph{only} supported way of restricted bounding boxes and image externalization; at least for pdf output). \end{enumerate} +Note that image externalization (the |external| library) is more or less incompatible with methods (1.)--(4.). The problem is that |pdflatex| crops everything outside of the bounding box away. There are only two safe ways to ``restrict'' bounding boxes of external |.pdf| images: the first is the mentioned |trim left| / |trim right| feature and the second is to use negative |\hspace| or |\vspace| commands (or options to |\includegraphics|). Unfortunately, the |trim left| / |trim right| feature is currently unavailable, it needs a more recent \PGF\ version than the current stable release \PGF\ $2.00$ (I only mention the method here because many users downloaded a more recent \PGF\ from \url{http://www.texample.net/tikz/builds/}). + \begin{key}{/tikz/overlay} \index{Bounding Box Control!Excluding Image Parts} A special key of \PGF\ which disables bounding box updates for (parts of) the image. The effect is that those parts are an ``overlay'' over the document. @@ -277,6 +451,36 @@ The following example places a legend somewhere without affecting the bounding b More information about the |overlay| option can be found in the \PGF\ manual~\cite{tikz}. \end{key} +\begin{command}{\pgfresetboundingbox} + This command of \pgfname\ resets the bounding box of the current picture. The computation starts from scratch afterwards, allowing to compute a user--defined bounding box. + +\begin{codeexample}[] +\setlength{\fboxsep}{0pt}% +\fbox{% +\begin{tikzpicture}% + \begin{axis}[ + title=A title, + xlabel={$x$}, + ylabel={$y$}, + legend style={at={(0.5,0.97)}, + anchor=north,legend columns=-1}, + domain=-2:2 + ] + \addplot {x^2}; + \addplot {x^3}; + \addplot {x^4}; + \legend{$x^2$,$x^3$,$x^4$} + \end{axis} + + \pgfresetboundingbox + \path + (current axis.south west) + rectangle (current axis.north east); +\end{tikzpicture}% +}% +\end{codeexample}% + The example draws a normal picture, containing an axis. Afterwards, it throws the bounding box away and creates a new one based on the |current axis| node and its anchors. +\end{command} \begin{environment}{{pgfinterruptboundingbox}} \label{sec:bounding:box:example}% @@ -284,14 +488,13 @@ The following example places a legend somewhere without affecting the bounding b \index{Bounding Box Control!pgfinterruptboundingbox} {% \pgfmanualpdflabel{\textbackslash useasboundingbox}{}% -An alternative to |overlay| is shown below: the figure has a truncated bounding box with is shown using |\fbox|. + Yet another approach with the same effect is shown below: the bounding box is interrupted manually, and resumed afterwards. \begin{codeexample}[] \setlength{\fboxsep}{0pt}% \fbox{% \begin{tikzpicture}% \begin{pgfinterruptboundingbox} \begin{axis}[ - name=my plot, title=A title, xlabel={$x$}, ylabel={$y$}, @@ -307,8 +510,8 @@ An alternative to |overlay| is shown below: the figure has a truncated bounding \end{pgfinterruptboundingbox} \useasboundingbox - (my plot.below south west) - rectangle (my plot.above north east); + (current axis.below south west) + rectangle (current axis.above north east); \end{tikzpicture}% }% \end{codeexample}% @@ -316,68 +519,30 @@ An alternative to |overlay| is shown below: the figure has a truncated bounding The |pgfinterruptboundingbox| environment does not include its content into the image's bounding box, and |\useasboundingbox| sets the pictures bounding box to the following argument (see~\cite{tikz}). \end{environment} -\end{pgfplotskey} +\begin{keylist}{% + /tikz/trim left=\marg{$x$ coordinate or point} (default 0pt), + /tikz/trim right=\marg{$x$ coordinate or point}} + These two keys allow to reduce the size of the bounding box. -\subsubsection{Alignment In Array Form (Subplots)} -\index{Subplots}% -\index{Alignment!Subplots}% -\index{Alignment!Array}% -\index{array!Array Alignment}% -\pgfmanualpdflabel{\textbackslash matrix}{}% -Sometimes alignment in array form is desired. One can use the following approach or use the library |groupplots| on page \ref{sec:group:plot} which does -not utilize \Tikz\ matrices. + {\bfseries They are only available in the experimental version of \PGF, not in \PGF\ 2.00! You may need the \PGF\ version from |texexample.net|!} -While it is possible to use (for example) |tabular| combined with the vertical and horizontal alignment methods discussed above, it might be better to use a \Tikz\ |matrix|. + The |trim left| key expects either a single $x$ coordinate like |1cm| or a point like |(current axis.west)|. If a point is provided, is uses only the $x$ coordinate of that point. Then, the left end of the bounding box is set to the resulting $x$ coordinate and everything left of it is outside of the bounding box. -A \Tikz\ matrix is some sort of ``graphical'' table. It knows everything about picture alignment and it has more flexibility than |tabular|. The complete documentation of a \Tikz\ matrix is beyond the scope of this manual, please refer to \cite{tikz} for details. But we provide an example here: -\pgfmanualpdflabel{/tikz/matrix}{}% -\begin{codeexample}[] -\begin{tikzpicture} - \matrix { - \begin{axis} - \addplot {x}; - \end{axis} - & - % differently large labels are aligned automatically: - \begin{axis}[ylabel={$f(x)=x^2$},ylabel style={font=\Huge}] - \addplot {x^2}; - \end{axis} - \\ - % - \begin{axis}[xlabel=$x$,xlabel style={font=\Huge}] - \addplot {x^3}; - \end{axis} - & - \begin{axis} - \addplot {x^4}; - \end{axis} - \\ - }; -\end{tikzpicture} -\end{codeexample} -\noindent So, a matrix is a picture element inside of |tikzpicture|. Its cells are separated by `|&|' as in tabular (or, if `|&|' causes problems, with |\pgfmatrixnextcell|). Its rows are separated by `|\\|'. Each cell is aligned using the cells' anchor. Since, by default, the anchor of an axis is placed at the lower left corner, the example above is completely aligned, without the need for any bounding box modifications -- even the labels are aligned correctly. If another anchor shall be used, simply place -\begin{codeexample}[code only] -\pgfplotsset{anchor=....} -\matrix { - ... -}; -\end{codeexample} -\noindent in front of the matrix. This will use the same configuration for every sub-plot. - -\paragraph{Attention:} Unfortunately, the array alignment with |\matrix| is \emph{incompatible} with legends. A legend is also a matrix and, unfortunately, -\Tikz\ matrizes can't be nested. Of course, this does not affect the manually created legends by means of |\label| and |\ref|, see -section~\ref{pgfplots:legend:labelref} for details. + The |trim right| key has the same effect, only for the right end of the bounding box. -If one wishes to have an easier approach of aligning one should refer to the library |groupplots| on p. \ref{sec:group:plot}. -\subsubsection{Miscellaneous for Alignment} + More detailed documentation can be found in the \Tikz\ manual. +\end{keylist} -\begin{predefinednode}{current axis} - A node which refers to the current axis or the last typeset axis. +\begin{stylekey}{/tikz/trim axis left} + A style with value |trim left=(current axis.south west)|. - You can use this node in axis descriptions, for example to place axis labels or titles. + The style needs to be provided as argument to |\begin{tikzpicture}[trim axis left]|. It expects (at least) one \PGFPlots\ environment in the picture. The effect is to trim everything which is left of the last axis' anchor |south west| (i.e.\ everything left of the left axis boundary). +\end{stylekey} - \paragraph{Remark:} If you use |current axis| inside of axis descriptions, the ``current axis'' is not yet finished. That means you \emph{can't use any outer anchor} inside of axis descriptions. +\begin{stylekey}{/tikz/trim axis right} + A style with value |trim right=(current axis.south east)|. - It is also possible to use |current axis| in any drawing or plotting commands inside of an axis (but no outer anchor as these are not defined when drawing commands are processed). This usage is similar to the |axis description cs|. -\end{predefinednode} + It works similarly to |trim axis left|: the effect is that everything right of the right axis line of the last axis environment is truncated from the bounding box. +\end{stylekey} +\end{pgfplotskey} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axis-addplot.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axis-addplot.tex index 4af602d4fd8..2f4884e4cff 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axis-addplot.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axis-addplot.tex @@ -361,30 +361,54 @@ one may want to plot `|dof|' versus `|L2|' or `|dof|' versus `|Lmax|'. This can \end{loglogaxis} \end{tikzpicture} \end{codeexample} -or +or, for the |Lmax| column, using \begin{codeexample}[code only] \begin{tikzpicture} \begin{loglogaxis}[ xlabel=Dof, - ylabel=$L_infty$ error] + ylabel=$L_\infty$ error] \addplot table[x=dof,y=Lmax] {datafile.dat}; \end{loglogaxis} \end{tikzpicture} \end{codeexample} -Alternatively, you can load the table \emph{once} and use it \emph{multiple} times: +It is also possible to provide the data inline, i.e.\ directly as argument in curly braces: \begin{codeexample}[code only] -\pgfplotstableread{datafile.dat}\loadedtable +\begin{tikzpicture} +\begin{loglogaxis}[ + xlabel=Dof, + ylabel=$L_\infty$ error] +\addplot table[x=dof,y=Lmax] { + dof L2 Lmax maxlevel + 5 8.31160034e-02 1.80007647e-01 2 + 17 2.54685628e-02 3.75580565e-02 3 + 49 7.40715288e-03 1.49212716e-02 4 + 129 2.10192154e-03 4.23330523e-03 5 + 321 5.87352989e-04 1.30668515e-03 6 + 769 1.62269942e-04 3.88658098e-04 7 + 1793 4.44248889e-05 1.12651668e-04 8 + 4097 1.20714122e-05 3.20339285e-05 9 + 9217 3.26101452e-06 8.97617707e-06 10 +}; +\end{loglogaxis} +\end{tikzpicture} +\end{codeexample} +\noindent Inline table may be convenient together with `|\\|' and |row sep=\\|, see below for more information. + +Alternatively, you can load the table \emph{once} into an internal structure and use it \emph{multiple} times: +\begin{codeexample}[code only] +\pgfplotstableread{datafile.dat}\loadedtable % use any custom name in place of `\loadedtable' ... -\addplot table[x=dof,y=L2] from \loadedtable; +\addplot table[x=dof,y=L2] {\loadedtable}; ... -\addplot table[x=dof,y=Lmax] from \loadedtable; +\addplot table[x=dof,y=Lmax] {\loadedtable}; ... \end{codeexample} -I am not really sure how much time can be saved, but it works anyway. As a rule of thumb, decide as follows: +I am not really sure how much time can be saved, but it works anyway. The |\pgfplotstableread| command is documented in all detail in the manual for \PGFPlotstable. As a rule of thumb, decide as follows: \begin{enumerate} - \item If tables contain few rows and many columns, the |from |\meta{\textbackslash macro} framework will be more efficient. + \item If tables contain few rows and many columns, the \meta{\textbackslash macro} framework will be more efficient. \item If tables contain more than~$200$ data points (rows), you should always use file input (and reload if necessary). \end{enumerate} +Occasionally, it might be handy to load a table, apply manual preparation steps (for example |\pgfplotstabletranspose|) and plot the result tables afterwards. If you do prefer to access columns by column indices instead of column names (or your tables do not have column names), you can also use \begin{codeexample}[code only] @@ -394,24 +418,29 @@ If you do prefer to access columns by column indices instead of column names (or Summary and remarks: \begin{itemize} - \item Use |plot table[||x||=|\marg{column name}|,||y||=|\marg{column name}|]| to access column names. Those names are case sensitive and need to exist. - \item Use |plot table[||x index||=|\marg{column index}|,||y index||=|\marg{column index}|]| to access column indices. Indexing starts with~$0$. You may also use an index for~$x$ and a column name for~$y$. - \item Use |plot table[||header||=false] |\marg{file name} if your input file has no column names. Otherwise, the first non-comment line is checked for column names: if all entries are numbers, they are treated as numerical data; if one of them is not a number, all are treated as column names. + \item Use |\addplot table[||x||=|\marg{column name}|,||y||=|\marg{column name}|]| to access column names. Those names are case sensitive and need to exist. + \item Use |\addplot table[||x index||=|\marg{column index}|,||y index||=|\marg{column index}|]| to access column indices. Indexing starts with~$0$. You may also use an index for~$x$ and a column name for~$y$. + \item Use |\addplot table[||x expr=\coordindex,y=|\marg{column name}|]| to plot the coordinate index versus some $y$ data. + \item Use |\addplot table[||header||=false] |\marg{file name} if your input file has no column names. Otherwise, the first non-comment line is checked for column names: if all entries are numbers, they are treated as numerical data; if one of them is not a number, all are treated as column names. \item It is possible to read error coordinates from tables as well. Simply add options `|x error|', `|y error|' or `|x error index|'/`|y error index|' to \marg{source columns}. See section~\ref{sec:errorbars} for details about error bars. \item It is possible to read per point meta data (usable in |scatter src|, see page~\pageref{pgfplots:scatter:src}) as has been discussed for |plot coordinates| and |plot file| above. The meta data column can be provided using the |meta| key (or the |meta index| key). - \item Use |plot table[|\meta{source columns}|] from |\marg{\textbackslash macro} to use a pre--read table. Tables can be read using + \item Use |\addplot table[|\meta{source columns}|] |\marg{\textbackslash macro} to use a pre--read table. Tables can be read using \begin{codeexample}[code only] \pgfplotstableread{datafile.dat}\macroname. \end{codeexample} - The keyword `|from|' can be omitted. + If you like, you can insert the optional keyword `|from|' before |\macroname|. - \item The accepted input format of those tables is as follows: + \item The accepted input format of tables is as follows: \begin{itemize} + \item Rows are separated by new line characters. + + Alternatively, you can use |row sep=\\| which enables `|\\|' as row separator. This might become necessary for inline table data, more precisely: if newline characters have been converted to white spaces by \TeX's character processing before \PGFPlots\ had a chance to see them. This happens if inline tables are provided inside of macros. Use |row sep=\\| and separate the rows by `|\\|' if you experience such problems. + \item Columns are usually separated by white spaces (at least one tab or space). If you need other column separation characters, you can use the - \declare{col sep}\pgfmanualpdflabel{/pgfplots/table/col sep}{}|=|\mchoice{space,tab,comma,colon,semicolon,braces} + \declare{col sep}\pgfmanualpdflabel{/pgfplots/table/col sep}{}|=|\mchoice{space,tab,comma,colon,semicolon,braces,\&,ampersand} option which is documented in all detail in the manual for \PGFPlotstable\ which is part of \PGFPlots. \item Any line starting with `\#' or `\%' is ignored. @@ -425,9 +454,18 @@ Summary and remarks: \index{table@\textcolor {gray}{\texttt {plot}}\texttt { table}!Unbalanced Columns}% \end{itemize} \item It is also possible to use \textbf{mathematical expressions} together with `|plot table|'. This is documented in all detail in section~\ref{pgfplots:addplot:table:expr}, but the key idea is to use one of |x expr|, |y expr|, |z expr| or |meta expr| as in `|plot table[||x expr=\thisrow{maxlevel}+3,y=L2]|'. - \item The enhanced column generation methods provided by \PGFPlotstable\ are also accessible for plots, see the \PGFPlotstable\ manual section ``Postprocessing Data in New Columns''. + \item The \PGFPlotstable\ package coming with \PGFPlots\ has a the feature ``Postprocessing Data in New Columns'' (see its manual). + + This allows to compute new columns based on existing data. One of these features is |create col/linear regression| (described in Section~\ref{sec:linefitting}). + + You can invoke all the |create col/|\meta{key name} features directly in |\addplot table| using + + |\addplot table[x={create col/|\meta{key name}|=|\meta{arguments}|}]|. + + In this case, a new column will be created using the functionality of \meta{key name}. This column generation is described in all detail in \PGFPlotstable. Finally, the resulting data is available as $x$ coordinate (the same holds for |y=| or |z=|). + + One application (with several examples how to use this syntax) is line fitting with |create col/linear regression|, see Section~\ref{sec:linefitting} for details. - In this context, you should consider using the key |read completely|, see below. \item Technical note: every opened file will be protocolled into your log file. \end{itemize} \end{addplotoperation} @@ -469,17 +507,51 @@ The following list of keys allow different methods to select input data or diffe table/meta index=\marg{column index}} These keys define input sources for per point meta data. Please see page~\pageref{pgfplots:scatter:src} for details about meta data or the documentation for |plot coordinates| and |plot file| for further information. \end{pgfplotsxykeylist} -\begin{key}{/pgfplots/table/col sep=\mchoice{space,tab,comma,semicolon,colon,braces} (initially space)} + + +\begin{pgfplotskey}{table/row sep=\mchoice{newline,\string\\} (initially newline)} + Configures the character to separate rows. + + The choice \declaretext{newline} uses the end of line as it appears in the table data (i.e.\ the input file or any inline table data). + + The choice \declaretext{\string\\} uses `|\\|' to indicate the end of a row. + + Note that \declaretext{newline} for inline table data is ``fragile'': you can't provide such data inside of \TeX\ macros (this does not apply to input files). Whenever you experience problems, proceed as follows: + \begin{enumerate} + \item First possibility: call |\pgfplotstableread|\marg{data}|\yourmacro| \emph{outside} of any macro declaration. + \item Use |row sep=\\|. + \end{enumerate} + The same applies if you experience problems with inline data and special |col sep| choices (like |col sep=tab|). + + The reasons for such problems is that \TeX\ scans the macro bodies and replaces newlines by white spaces. It does other substitutions of this sort as well, and these substitutions can't be undone (maybe not even found). +\end{pgfplotskey} + +\begin{key}{/pgfplots/table/col sep=\mchoice{space,tab,comma,semicolon,colon,braces,\&,ampersand} (initially space)} Allows to choose column separators for |plot table|. Please refer to the manual of \PGFPlotstable\ which comes with this package for details about |col sep|. \end{key} -\begin{key}{/pgfplots/table/read completely=\marg{true,false} (initially false)} +\begin{key}{/pgfplots/table/read completely=\marg{auto,true,false} (initially auto)} Allows to customize \verbpdfref{\addplot table}\marg{file name} such that it always reads the entire table into memory. This key has just one purpose, namely to create postprocessing columns on-the-fly and to plot those columns afterwards. This ``lazy evaluation'' which creates missing columns on-the-fly is documented in the \PGFPlotstable\ manual (in section ``Postprocessing Data in New Columns''). + The initial configuration |auto| checks whether one of the keys |table/x|, |table/y|, |table/z| or |table/meta| contains a |create on use| column. If so, it enables |read completely|, otherwise it prefers to load the file in the normal way. + \paragraph{Attention:} Usually, \verbpdfref{\addplot table} only picks required entries, requiring linear runtime complexity. As soon as |read completely| is activated, tables are loaded completely into memory. Due to datastructures issues (``macro append runtime''), the runtime complexity for |read completely| is $O(N^2)$ where $N$ is the number of rows. Thus: use this feature only for ``small'' tables\footnote{This remark might be deprecated; many of the slow routines have been optimized in the meantime to have at least pseudo-linear runtime.}. \end{key} +\begin{key}{/pgfplots/table/ignore chars=\marg{comma-separated-list} (initially empty)} + Allows to silently remove a set of single characters from input files. The characters are separated by commas. The documentation for this command, including cases like `|\%,\#,\ |' or binary character codes like `|\^^ff|' can be found in the manual for \PGFPlotstable. + + This setting applies to |\addplot file| as well. +\end{key} + +\begin{key}{/pgfplots/table/white space chars=\marg{comma-separated-list} (initially empty)} + Allows to define a list of single characters which are actually treated like white spaces (in addition to tabs and spaces). Please refer to the manual of \PGFPlotstable\ for details. + + This setting applies to |\addplot file| as well. +\end{key} + + \subsubsection{Computing Coordinates with Mathematical Expressions} \begin{addplotoperation}[]{\marg{math expression}}{} @@ -535,7 +607,7 @@ Please note that \PGF's math parser uses degrees for trigonometric functions: \item If the $x$ axis is logarithmic, samples will be drawn logarithmically. - \item Please note that plot expression does not allow per point meta data (color data). + \item Please note that plot expression does not allow separate per point meta data (color data). You can, of course, use |point meta=f(x)| or |point meta=x|. \end{enumerate} \paragraph{About the precision and number range:} @@ -715,7 +787,7 @@ Since system calls are a potential danger, they need to be enabled explicitly us \begin{codeexample}[code only] pdflatex -shell-escape filename.tex. \end{codeexample} -Sometimes it is called |shell-escape| or |enable-write18|. Sometimes one needs two slashes -- that all depends on your \TeX\ distribution. +Sometimes it is called |shell-escape| or |enable-write18|. Sometimes one needs two hyphens -- that all depends on your \TeX\ distribution. \begin{codeexample}[] \begin{tikzpicture} \begin{axis} @@ -743,7 +815,7 @@ Some remarks: For |parametric| plots, the variable names need to be adjusted with |parametric/var 1d| and |parametric/var 2d| (since gnuplot uses |t| and |u,v| as initial values for |parametric| plots). \item -Please note that |plot gnuplot| does not allow per point meta data (color data for each coordinate). +Please note that |plot gnuplot| does not allow separate per point meta data (color data for each coordinate). You can, however, use |point meta=f(x)| or |point meta=x|. \item The generated output file name can be customized with |id|, see below. \end{itemize} @@ -943,6 +1015,25 @@ Using |gv|, I determined that the bounding box needs to be shifted |12| units to The \meta{options} are any arguments provided to the |includegraphics| key (see below) and |width| and |height| determined such that the graphics fits exactly into the rectangle denoted by the |xmin|, |ymin| and |xmax|, |ymax| coordinates. The scaling will thus ignore the aspect ratio of the external image and prefer the one used by \PGFPlots. You will need to provide |width| and |height| to the \PGFPlots\ axis to change its scaling. Use the |scale only axis| key in such a case. + +\paragraph{Legends in \texttt{plot graphics}:} A legend for |plot graphics| uses the current plot handler and the current plot |mark|: +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[axis on top,title=Graphics Import] + % provide options for the legend: + \addplot[red,only marks,mark=*,mark size=1pt] + graphics + [xmin=0,xmax=1,ymin=0,ymax=1, + % trim=left bottom right top + includegraphics={trim=12 9 12 8,clip}] + {external2}; + + \addplot coordinates {(0,0) (1,1)}; + + \legend{Scatter,Line} +\end{axis} +\end{tikzpicture} +\end{codeexample} \end{addplotoperation} \subsubsection*{Keys To Configure Plot Graphics} @@ -957,6 +1048,9 @@ The following list of keys configure |\addplot graphics|. Note that the common p \begin{pgfplotskey}{plot graphics/includegraphics=\marg{options}} A list of options which will be passed as--is to |\includegraphics|. Interesting options include the \declareandlabel{trim}|=|\meta{left} \meta{bottom} \meta{right} \meta{top} key which reduces the bounding box and \pgfmanualpdflabel{/pgfplots/plot graphics/clip}{\declaretext{clip}} which discards everything outside of the bounding box. The scaling options won't have any effect, they will be overwritten by \PGFPlots. \end{pgfplotskey} +\begin{pgfplotskey}{plot graphics/includegraphics cmd=\marg{\textbackslash macro} (initially \textbackslash includegraphics)} + Allows to use a different graphics routine. A possible choice could be |\pgfimage|. The macro should accept the |width| and |height| arguments (in brackets) and the file name as first argument. +\end{pgfplotskey} \begin{stylekey}{/pgfplots/plot graphics/node} A predefined style used for the \Tikz\ node containing the graphics. The predefined value is \begin{codeexample}[code only] diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axisdescription.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axisdescription.tex index 746c007d1eb..f2b4ad810de 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axisdescription.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.axisdescription.tex @@ -454,7 +454,7 @@ As all other axis descriptions, the code can use $(0,0)$ to access the lower lef Legends can be generated in two ways: the first is to use |\addlegendentry| or |\legend| inside of an axis. The other method is to use the key |legend entries|. -\begin{command}{\addlegendentry\marg{name}} +\begin{command}{\addlegendentry\oarg{options}\marg{name}} Adds a single legend entry to the legend list. This will also enable legend drawing. \begin{codeexample}[] \begin{tikzpicture} @@ -479,11 +479,12 @@ Adds a single legend entry to the legend list. This will also enable legend draw \end{codeexample} It does not matter where |\addlegendentry| commands are placed, only the sequence matters. You will need one |\addlegendentry| for every |\addplot| command (unless you prefer an empty legend). +The optional \meta{options} affect how the text is drawn; they apply only for this particular description text. For example, |\addlegendentry[red]{Text}| would yield a red legend text. Behind the scenes, the text is placed with |\node|\oarg{options} \marg{name}|;|, so \meta{options} can be any \Tikz\ option which affects nodes. Using |\addlegendentry| disables the key |legend entries|. \end{command} -\begin{command}{\addlegendentryexpanded\marg{\TeX\ text}} +\begin{command}{\addlegendentryexpanded\oarg{options}\marg{\TeX\ text}} A variant of |\addlegendentry| which provides a method to deal with macros inside of \meta{\TeX\ text}. Suppose \meta{\TeX\ text} contains some sort of parameter which varies \emph{for every plot}. Moreover, you like to use a loop to generate the plots. Then, it is simpler to use |\addlegendentryexpanded|: @@ -528,12 +529,17 @@ Two different delimiters are supported: \begin{codeexample}[code only] \legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$} \end{codeexample} - These lists are processed using the \PGF\ |\foreach| command. + These lists are processed using the \PGF\ |\foreach| command and are quite powerful. + + The |\foreach| command supports a dots--notation to denote ranges like |\legend{1,2,...,5}| or even |\legend{$x^1$,$x^...$,$x^d$}|. + + \paragraph{Attention with periods:} to avoid confusion with the dots |...| notation, you may need to encapsulate a legend entry containing periods by curly braces: |\legend{{ML spcm.},{CW spcm.},{ML AC}}| (or use the |\\| delimiter, see below). + \item It is also possible to delimit the list by `|\\|'. In this case, the \emph{last element must be terminated} by |\\| as well: \begin{codeexample}[code only] \legend{$a=1, b=2$\\,$a=2, b=3$\\$a=3, b=5$\\} \end{codeexample} - This syntax simplifies the use of `|,|' inside of legend entries. + This syntax simplifies the use of `|,|' inside of legend entries, but it does not support the dots--notation. \end{enumerate} The short marker/line combination shown in legends is acquired from the \marg{style options} argument of |\addplot|. @@ -563,20 +569,20 @@ Using |\legend| overwrites any other existing legend entries. \end{tikzpicture} \end{codeexample} Please be careful with whitespaces in \marg{comma separated list}: they will contribute to legend entries. Consider using `|%|' at the end of each line in multiline arguments (the end of line character is also a whitespace in \TeX). -\end{pgfplotskey} - - -\begin{command}{\addlegendimage\marg{options}} - Adds a further ``plot style'' for legend creation. - Each |\addplot| command appends its plot style options to a list, and |\addlegendimage| adds \meta{options} to the very same list. - - Thus, the effect is as if you had provided |\addplot|\oarg{options}, but |\addlegendimage| bypasses all the logic usually associated with a plot. In other words: except for the legend, the state of the axis remains as if the command would not have been drawn. Not even the current plot's index is advanced, making |\addlegendimage| compatible with any plot styles like |ybar|. - - Use |\addlegendimage| to provide custom styles into legends, for example to document custom |\draw| commands inside of an axis. + Just as for |\addlegendentry|, it is possible to provide \oarg{options} to single descriptions. To do so, place the options in square brackets right before the text: +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[legend entries={$x$,[red]$x^2$,$x^3$}] + \addplot {x}; + \addplot {x^2}; + \addplot {x^3}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + If the square brackets contain a comma, you can enclose the complete entry in curly braces like |{[red,font=\Huge]Text}| (or you can use the `|\\|' delimiters). +\end{pgfplotskey} - You can call |\label| after |\addlegendimage| just as for a normal style. -\end{command} \subsubsection{Legend Appearance} @@ -770,6 +776,46 @@ Whenever possible, consider using |/.append style| to keep the default styles ac \end{codeexample} \end{pgfplotskey} + +\begin{pgfplotskey}{legend cell align=\mchoice{left,right,center} (initially center)} + These keys provide horizontal alignment of legend cells. +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[legend cell align=left, + legend pos=outer north east] +\addplot coordinates {(0,0) (1,1)}; +\addplot coordinates {(0,1) (1,2)}; +\addplot coordinates {(0,2) (1,3)}; +\legend{a,fine,legend} +\end{axis} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[legend cell align=center, + legend pos=outer north east] +\addplot coordinates {(0,0) (1,1)}; +\addplot coordinates {(0,1) (1,2)}; +\addplot coordinates {(0,2) (1,3)}; +\legend{a,fine,legend} +\end{axis} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[legend cell align=right, + legend pos=outer north east] +\addplot coordinates {(0,0) (1,1)}; +\addplot coordinates {(0,1) (1,2)}; +\addplot coordinates {(0,2) (1,3)}; +\legend{a,fine,legend} +\end{axis} +\end{tikzpicture} +\end{codeexample} + They are actually just styles for commonly used alignment choices: the choice |left| is equivalent to |legend style={cells={anchor=west}}|, the choice |right| is equivalent to |legend style={cells={anchor=east}}| and |center| to |legend style={cells={anchor=center}}|. Using different values allows more control over cell alignment. +\end{pgfplotskey} } \begin{pgfplotskey}{legend columns=\marg{number} (default 1)} @@ -785,12 +831,28 @@ Configures where the small line specifications will be drawn: left of the descri \begin{stylekey}{/pgfplots/every legend image post} \label{key:legendimagepost} A style which can be used to provide drawing options to every small legend image. These options apply after |current plot style| has been set, allowing users different line styles for legends than for plots. + + For example, suppose you have a line plot and you plot selected markers on top of it (in the same color). Then, you may want to draw just a \emph{single} legend entry (which should contain both the line \emph{and} the markers). The following example shows a solution: +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[legend image post style={mark=*}] + \addplot+[only marks,forget plot] + coordinates {(0.5,0.75) (1,1) (1.5,0.75)}; + \addplot+[mark=none,smooth,domain=0:2] + {-x*(x-2)}; + \addlegendentry{Parable} + \end{axis} +\end{tikzpicture} +\end{codeexample} + \noindent The example has two |\addplot| commands, one for the line and one for markers. Due to the |forget plot| option, the marker plot (the first one) doesn't advance the |cycle list|. The axis has only one legend entry, and since |legend image post style={mark=*}| has been used, the legend has a plot mark as well. Due to the |forget plot| option, the marker plot will not get a separate legend label. \end{stylekey} +\pgfplotsshortstylekey legend image post style=every legend image post\pgfeov + \begin{pgfplotscodekey}{legend image code} \label{opt:legend:image:code} Allows to replace the default images which are drawn inside of legends. When this key is evaluated, the current plot specification has already been activated (using |\begin{scope}[current plot style]|)% -\footnote{This was different in versions before 1.3. The new scope features allows plot styles to change |legend image code|.}, so any drawing operations use the same styles as the |\addplot| command. +\footnote{This was different in versions before 1.3. The new scope features allows plot styles to change \texttt{legend image code}.}, so any drawing operations use the same styles as the |\addplot| command. The default is the style |line legend|. @@ -818,6 +880,9 @@ The default is the style |line legend|. The style |line legend| can also be used to use a different legend style for one particular plot (see the docs for |area legend| for an example). \end{stylekey} +\begin{stylekey}{/pgfplots/empty legend} + A style which clears |legend image code|, thereby omitting the legend image. +\end{stylekey} \begin{stylekey}{/pgfplots/area legend} A style which sets |legend image code| to @@ -917,7 +982,9 @@ The initial values for these styles might be interesting if someone wants to mod \end{codeexample} \end{pgfplotskey} -\begin{pgfplotskey}{reverse legend=\mchoice{true,false} (initially false)} +\begin{pgfplotskeylist}{% + reverse legend=\mchoice{true,false} (initially false),% + legend reversed=\mchoice{true,false} (initially false)} Allows to reverse the order in which the pairs (legend entry, plot style) are drawn. \begin{codeexample}[] \begin{tikzpicture} @@ -931,7 +998,62 @@ The initial values for these styles might be interesting if someone wants to mod \end{axis} \end{tikzpicture} \end{codeexample} -\end{pgfplotskey} +\end{pgfplotskeylist} + +\begin{pgfplotskeylist}{% + transpose legend=\mchoice{true,false} (initially false),% + legend transposed=\mchoice{true,false} (initially false)} + Allows to transpose the order in which the pairs (legend entry, plot style) are drawn. + + Consider a set of $3$ experiments, each consisting of $2$ parameter. We might want to draw them together as in the following example: +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[ + legend columns=2, + legend pos=outer north east, + cycle multi list={% + color list\nextlist + [2 of]mark list + }] + \addplot {-x}; \addlegendentry{A1} + \addplot {-x+1}; \addlegendentry{A2} + + \addplot {-1.2*x + 4}; \addlegendentry{B1} + \addplot {-1.2*x + 5}; \addlegendentry{B2} + + \addplot {-1.3*x + 9}; \addlegendentry{C1} + \addplot {-1.4*x + 10}; \addlegendentry{C2} + \end{axis} +\end{tikzpicture} +\end{codeexample} + + An alternative might be to draw them horizontally -- then, we'd like to use |transpose legend| to get a flat legend: +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[ + transpose legend, + legend columns=2, + legend style={at={(0.5,-0.1)},anchor=north}, + cycle multi list={% + color list\nextlist + [2 of]mark list + }] + \addplot {-x}; \addlegendentry{A1} + \addplot {-x+1}; \addlegendentry{A2} + + \addplot {-1.2*x + 4}; \addlegendentry{B1} + \addplot {-1.2*x + 5}; \addlegendentry{B2} + + \addplot {-1.3*x + 9}; \addlegendentry{C1} + \addplot {-1.4*x + 10}; \addlegendentry{C2} + \end{axis} +\end{tikzpicture} +\end{codeexample} + + Thus, |legend columns| defines the \emph{input} columns, before the transposition (in other words, |legend columns| indicates the \emph{rows} of the resulting legend). + + Transposing legends has only an effect if |legend columns|$>1$. Note that |reverse legend| has higher precedence: it is applied first. +\end{pgfplotskeylist} \subsubsection{Legends with \texttt{\textbackslash label} and \texttt{\textbackslash ref}} @@ -970,8 +1092,8 @@ Finally, \ref{pgfplots:label3} is only here to get three examples. Label3 = \ref{pgfplots:label3}; Label2 = \ref{pgfplots:label2} \end{codeexample} - The label is assembled using |legend image code| and the plot style of the last plot. Any \PGFPlots\ option is expanded until only \Tikz\ (or \pgfname) options remain; these options are used to get an independent label\footnote{Please note that you can't use the label/ref mechanism in conjunction with image externalization as this will (naturally) lead to undefined references.}. - + The label is assembled using |legend image code| and the plot style of the last plot. Any \PGFPlots\ option is expanded until only \Tikz\ (or \pgfname) options remain; these options are used to get an independent label. + More precisely, the small image generated by |\ref|\marg{label name} is \begin{codeexample}[code only] \tikz[/pgfplots/every crossref picture] {...} @@ -979,6 +1101,9 @@ Label2 = \ref{pgfplots:label2} \noindent where the contents is determined by |legend image code| and the plot style. The second syntax, |\label|\oarg{reference}\marg{label name} allows to label particular pieces of an |\addplot| command. It is (currently) only interesting for |scatter/classes|: there, it allows to reference particular classes of the scatter plot. See page~\pageref{pgfplots:scatterclasses} for more details. + + + Note that |\label| information, even the small \Tikz\ pictures here, can be combined with the |external| library for image externalization, see section~\ref{sec:pgfplots:export} for details (in particular, the |external/mode| key). In other words, references remain valid even if the defining axis has been externalized. \end{commandlist} \begin{command}{\ref\marg{label name}} @@ -1002,6 +1127,186 @@ Label2 = \ref{pgfplots:label2} \end{codeexample} \end{stylekey} +\begin{pgfplotskeylist}{% + invoke before crossref tikzpicture=\marg{\TeX\ code}, + invoke after crossref tikzpicture=\marg{\TeX\ code}} + Code which is invoked just before or just after every cross reference picture. This applies to legend images generated with |\ref|, |legend to name| and |colorbar to name| images. + + The initial configuration checks if the |external| library is in effect. If so, it calls |\tikzappendtofigurename{_crossref}|. + \index{crossref file suffix} +\end{pgfplotskeylist} + +\subsubsection{Legends Outside Of an Axis} +Occasionally, one has multiple adjacent plots, each with the same legend -- and just \emph{one} legend suffices. But where shall it be placed? And how? One solution is to use the |overlay| key to exclude the legend from bounding box computations, and place it absolutely such that it fits. Another is the |legend to name| feature: + +\begin{pgfplotskey}{legend to name=\marg{name} (initially empty)} +\label{key:legend:to:name} + Enables a legend export mode: instead of drawing the legend, a self--contained, independent set of drawing commands will be stored using the label \meta{name}. The definition is done using |\label|\marg{name}, just like any other \LaTeX\ label. The name can be referenced using + + |\ref|\marg{name}. + +Thus, typing |\ref|\marg{name} somewhere outside of the axis, maybe even outside of any picture, will cause the legend to be drawn. +{ +\pgfplotsmanualdisablecolorforref +\begin{codeexample}[vbox] +\pgfplotsset{footnotesize,samples=10} +\begin{center}% note that \centering uses less vspace... +\begin{tikzpicture} + \begin{axis}[ + legend columns=-1, + legend entries={$(x+0)^k$;,$(x+1)^k$;,$(x+2)^k$;,$(x+3)^k$}, + legend to name=named, + title={$k=1$}] + \addplot {x}; + \addplot {x+1}; + \addplot {x+2}; + \addplot {x+3}; + \end{axis} +\end{tikzpicture} +% +\begin{tikzpicture} + \begin{axis}[title={$k=2$}] + \addplot {x^2}; + \addplot {(x+1)^2}; + \addplot {(x+2)^2}; + \addplot {(x+3)^2}; + \end{axis} +\end{tikzpicture} +% +\begin{tikzpicture} + \begin{axis}[title={$k=3$}] + \addplot {x^3}; + \addplot {(x+1)^3}; + \addplot {(x+2)^3}; + \addplot {(x+3)^3}; + \end{axis} +\end{tikzpicture} +\\ + +\ref{named} +\end{center} +\end{codeexample} +} + + Note that only the \emph{first} plot has |legend entries|. Thus, its legend will be created as usual, and stored under the name `|named|', but it won't be drawn. The stored legend can then be drawn with |\ref{named}| below the three plots. Since there is no picture in this context, a |\tikz| picture is created and a |\matrix[/pgfplots/every axis legend]| path is drawn inside of it, resulting in the legend as if it had been placed inside of the axis. + + The stored legend will contain the currently active values of legend- and plot style related options. This includes |legend image code|, |every axis legend|, and any plot style options (and some more). The algorithm works in the same way as for |\label| and |\ref|, i.e.\ it keeps any options with |/tikz/| prefix and expands those with |/pgfplots/| prefix. + + Note that the legend is drawn with |every axis legend|, even though the placement options might be chosen to fit into an axis. You may want to adjust the style in the same axis in which the stored legend has been defined (the value will be copied and restored as well). + + \paragraph{About \texttt{\string\ref}\marg{name}} The |\ref|\marg{name} command retrieves a stored legend (one defined by |legend to name|) and draws it. + +{ +\pgfplotsmanualdisablecolorforref + |\ref{named}: | \ref{named} +} + + + If you want the legend to be exported \emph{and} drawn inside of the current axis, consider using |extra description/.append code={\ref|\marg{name}|}|. + + Note that |\ref| can be combined with the |external| library for image externalization. In other words, the legend will work even if the defining axis has been externalized, see section~\ref{sec:pgfplots:export} for details (in particular the |external/mode| key). + + Note furthermore that this |.aux| file related stuff is (currently) only supported for \LaTeX, sorry. + \begin{command}{\pgfplotslegendfromname\marg{name}} + This command poses an equivalent alternative for |\ref|\marg{name}: it has essentially the same effect, but it does not create links when used with the |hyperref| package\footnote{Since this manual uses colored links, the text in \texttt{\string\ref} would usually be blue. Using \texttt{\string\pgfplotslegendfromname} avoids link text colors in the legend (this has been applied to the manual styles here).}. + \end{command} + + \begin{stylekey}{/pgfplots/every legend to name picture} + A style which is installed when |\ref| is used outside of a picture: a new picture will be created with |\tikz[/pgfplots/every legend to name picture]|. + + Thus, you can re-define this style to set alignment options (such as |baseline|). + For example, the initialisation +\begin{codeexample}[code only] +\pgfplotsset{ + legend style={matrix anchor=west,at={(0pt,0pt)}}, + every legend to name picture/.style={baseline}, +} +... +\end{codeexample} + \noindent will cause the legend to be positioned such that its |west| anchor is at |y=0pt|. The |baseline| option will align this point of the legend with the text baseline (please refer to the documentation for |baseline| in section~\ref{pgfplots:sec:align} for details). + \end{stylekey} +\end{pgfplotskey} + +\subsubsection{Legends with Customized Texts or Multiple Lines} + +\begin{command}{\addlegendimage\marg{options}} + Adds a further legend image for legend creation. + + Each |\addplot| command appends its plot style options to a list, and |\addlegendimage| adds \meta{options} to the very same list. + + Thus, the effect is as if you had provided |\addplot|\oarg{options}, but |\addlegendimage| bypasses all the logic usually associated with a plot. In other words: except for the legend, the state of the axis remains as if the command would not have been drawn. Not even the current plot's index is advanced. + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{semilogyaxis}[ + domain=0:4, +] + \addplot {x}; \addlegendentry{$x$} + \addplot {x^2}; \addlegendentry{$x^2$} + \addplot {x^3}; \addlegendentry{$x^3$} + \addlegendimage{empty legend} + \addlegendentry{---} + \addplot {x^(-1)}; \addlegendentry{$x^{-1}$} + \addplot {x^(-2)}; \addlegendentry{$x^{-2}$} + \addplot {x^(-3)}; \addlegendentry{$x^{-3}$} +\end{semilogyaxis} +\end{tikzpicture} +\end{codeexample} + The example above has six plots, each with its legend entry. Furthermore, it has an |\addlegendimage| command and its separate legend entry. We see that |\addlegendimage| needs its own legend entry, but it is detached from the processing of plots as such. In our case, we chose |empty legend| as style for the separator. + + Use |\addlegendimage| to provide custom styles into legends, for example to document custom |\draw| commands inside of an axis. + + You can call |\label| after |\addlegendimage| just as for a normal style. +\end{command} + +Occasionally, one may want multiple lines for legend entries. That is possible as well using a fixed |text width|: +\begin{codeexample}[] +\begin{tikzpicture} +\begin{semilogyaxis}[ + domain=0:4, +] + \addplot {x}; \addlegendentry{$x$} + \addplot {x^2}; \addlegendentry{$x^2$} + \addplot {x^3}; \addlegendentry{$x^3$} + \addlegendimage{empty legend} + \addlegendentry[text width=25pt,text depth=] + {Neg Sign:} + \addplot {x^(-1)}; \addlegendentry{$x^{-1}$} + \addplot {x^(-2)}; \addlegendentry{$x^{-2}$} + \addplot {x^(-3)}; \addlegendentry{$x^{-3}$} +\end{semilogyaxis} +\end{tikzpicture} +\end{codeexample} +\noindent The example provides options for the single multiline element. Note that the initial configuration of |legend style| employs |text depth=0.15em|, which needs to be reset manually to |text depth={}|\footnote{Perhaps I can reset \texttt{text depth} automatically in the future.}. + +\noindent There are two approaches with the same effect which are subject of the following example: +\begin{codeexample}[] +\begin{tikzpicture} +\begin{semilogyaxis}[ + domain=0:4, + legend entries={% + $x$,$x^2$,$x^3$,% + {[text width=25pt,text depth=]Neg. Sign:},% + $x^{-1}$,$x^{-2}$,$x^{-3}$}, + % same effect: + % legend style={ + % nodes={text width=25pt,text depth=}} +] + \addplot {x}; + \addplot {x^2}; + \addplot {x^3}; + \addlegendimage{empty legend} + \addplot {x^(-1)}; + \addplot {x^(-2)}; + \addplot {x^(-3)}; +\end{semilogyaxis} +\end{tikzpicture} +\end{codeexample} +\noindent Here, the |legend entries| are provided using the single key syntax. Note that the special options are provided as part of the legend entry, using square brackets right before the text as such. The comments indicate that you could also add the |text width| stuff to |legend style|, in which case it would hold for every node. + + +Note that legend texts are realized using |\node|\oarg{options} \marg{text}|;|, so anything which produces a valid \Tikz\ node is permitted (this includes |minipage| or |tabular| environments inside of \meta{text}). + \subsubsection{Axis Lines} {\small \emph{An extension by Pascal Wolkotte}} @@ -1242,17 +1547,17 @@ Note that three dimensional axes only support to use the same value for every ax \noindent with similar values for the |y|-variant. Feel free to redefine this style to your needs / taste. \end{pgfplotsxykey} -\subsubsection[Two Ordinates]{Two Ordinates ($y$ axis)} +\subsubsection[Two Ordinates]{Two Ordinates ($y$ axis) or Multiple Axes} {% \pgfplotsset{every axis/.append style={width=4.5cm}}% -In some applications, more than one $y$ axis is used if the $x$ range is the same. This section demonstrates how to create them. +In some applications, more than one $y$ axis is used if the $x$ range is the same. This section demonstrates how to create them. The idea in \PGFPlots\ is to draw two axes on top of each other, one with descriptions only on the left and the second with descriptions only on the right: \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[ scale only axis, xmin=-5,xmax=5, - axis y line=left, + axis y line*=left,% the '*' avoids arrow heads xlabel=$x$, ylabel=First ordinate] \addplot {x^2}; @@ -1261,14 +1566,14 @@ In some applications, more than one $y$ axis is used if the $x$ range is the sam \begin{axis}[ scale only axis, xmin=-5,xmax=5, - axis y line=right, + axis y line*=right, axis x line=none, ylabel=Second ordinate] \addplot[red] {3*x}; \end{axis} \end{tikzpicture} \end{codeexample} -\noindent The basic idea is to draw two axis ``on top'' of each other -- one, which contains the $x$ axis and the left $y$ axis, and one which has \emph{only} the right $y$ axis. Since \PGFPlots\ does not really know what it's doing here, user attention in the following possibly non-obvious aspects is required: +\noindent Thus, the two axes are drawn ``on top'' of each other -- one, which contains the $x$ axis and the left $y$ axis, and one which has \emph{only} the right $y$ axis. Since \PGFPlots\ does not really know what it's doing here, user attention in the following possibly non-obvious aspects is required: \begin{enumerate} \item Scaling. You should set |scale only axis| because this forces equal dimensions for both axis, without respecting any labels. \item Same $x$ limits. You should set those limits explicitly. @@ -1282,7 +1587,7 @@ It is also possible to use only the axis, without any plots: \begin{axis}[ scale only axis, xmin=-5,xmax=5, - axis y line=left, + axis y line*=left,%'*' avoids arrow heads xlabel=$x$, ylabel=Absolute] \addplot {x^2}; @@ -1294,9 +1599,8 @@ It is also possible to use only the axis, without any plots: ymin=0,ymax=1000, yticklabel= {$\pgfmathprintnumber{\tick}$\textperthousand}, - axis y line=right, + axis y line*=right, axis x line=none, - y label style={yshift=-10pt}, ylabel=per thousand] \end{axis} \end{tikzpicture} @@ -1440,8 +1744,8 @@ Axis scaling and clipping will be done as if you did not use |hide axis|. \end{tikzpicture} \end{codeexample} - A color bar is only useful for plots which actually use color data -- that is, the special data which is called ``point meta'' in \PGFPlots\ (see section~\ref{pgfplots:point:meta}). Activating color bars for a plot without color map results in an empty color bar. - + A color bar is only useful for plots with non--zero color data range, more precisely, for which minimum and maximum |point meta| data is available. Usually, this is the case for |scatter|, |mesh| or |surf| (or similar) plots, but you can also set |point meta min| and |point meta max| manually in order to draw a |colorbar|. + Color bars are just normal axes which are placed right besides their parent axes. The only difference is that they inherit several styles such as line width and fonts and they contain a bar shaded with the color map of the current axis. Color bars are drawn internally with @@ -1454,7 +1758,7 @@ Axis scaling and clipping will be done as if you did not use |hide axis|. \paragraph{Remarks for special cases:} \begin{itemize} - \item Since there is always only one color bar per plot, this color bar uses the axis wide configurations of color map and color data. + \item Since there is always only one color bar per plot, this color bar uses the axis wide configurations of color map and color data. Consider using |colorbar source| to select color data limits of a particular |\addplot| command instead. \item If someone needs more than one color bar, the draw command above needs to be updated. See the key |colorbar/draw/.code| for this special case. \end{itemize} @@ -1610,6 +1914,7 @@ Axis scaling and clipping will be done as if you did not use |hide axis|. \end{stylekey} \begin{stylekey}{/pgfplots/every colorbar} + \label{key:every:colorbar} This style governs the placement, alignment and appearance of color bars. Any desired detail changes for color bars can be put into this style. Additionally, there is a style |colorbar shift| which is set after |every colorbar|. The latter style is intended to contain only shift transformations like |xshift| or |yshift| (making it easier to overwrite or deactivate them). While a color bar is drawn, the predefined node |parent axis| can be used to align at the parent axis. @@ -1634,7 +1939,22 @@ Axis scaling and clipping will be done as if you did not use |hide axis|. The values of these keys contain the lower and upper bound of the color map, i.e.\ the lower and upper limit for the color bar. The value is |\pgfkeysvalueof{/pgfplots/point meta min}| inside of |every colorbar|. + + The value is usually determined using the axis wide point meta limits, i.e.\ they are computed as minimum and maximum value over all plots (unless the user provided limits manually). Consider the |colorbar source| key if you'd like to select point meta limits of one specific |\addplot| command. \end{pgfplotskeylist} +\begin{pgfplotskey}{colorbar source=\marg{true,false} (initially false)} + Allows to select a specific |\addplot| command whose point meta limits are taken as upper and lower limit of a |colorbar|'s data range. This affects the tick descriptions of the |colorbar|. It needs to be provided as argument to |\addplot|, i.e.\ using +\begin{codeexample}[code only] +\addplot[...,colorbar source] ... +% or +\addplot+[colorbar source] ... +\end{codeexample} + \noindent or as key inside of a |cycle list|. + + Using |colorbar source| automatically implies |point meta rel=per plot| for that specific plot. + + If there are more than one |\addplot| commands with |colorbar source|, the last one is preferred. +\end{pgfplotskey} \begin{pgfplotskeylist}{parent axis width,parent axis height} The values of these keys contain the size of the parent axis. They can be used as |width| and/or |height| arguments for |every colorbar| with |\pgfkeysvalueof{/pgfplots/parent axis width}|. @@ -1752,6 +2072,101 @@ Axis scaling and clipping will be done as if you did not use |hide axis|. Please note that a color bar axis is nothing special as such -- it is just a normal axis with one |plot graphics| command and it is invoked with a special set of options. The only special thing is that a set of styles and some variables are inherited from its parent axis. \end{pgfplotscodekey} +\begin{stylekey}{/pgfplots/colorbar sampled=\marg{optional options} (default surf,mark=none,shader=flat)} + A style which installs a discretely sampled color bar. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[colorbar sampled] + \addplot[mesh,samples=40] {sin(deg(x))}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + The style uses |\addplot3|\oarg{options} to draw the |colorbar|, with |domain| set to the color range. In other words: it uses |plot expression| and a surface plot to visualize the |colorbar|. Use |colorbar style={samples=10}| to change the number of samples. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[colorbar sampled,colorbar style={samples=8}] + \addplot[mesh,samples=40] {sin(deg(x))}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + The \meta{options} can be used to change the |\addplot3| options used for the colorbar visualization. For example, |colorbar sampled={surf,shader=interp}| will use gouraud shading which has visually the same effect as the standard colorbar. +\end{stylekey} + +\begin{stylekey}{/pgfplots/colorbar sampled line=\marg{optional options} (default scatter,only marks)} + A style which draws a discrete colorbar. In contrast to |colorbar sampled|, it visualizes the |colorbar| using a line plot, not a |surf| plot. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[colorbar sampled line] + \addplot+[scatter] {sin(deg(x))}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + The initial configuration uses a |scatter| plot to visualize the |colorbar|, it can be changed by specifying \meta{options}. + + Furthermore, the axis appearance is changed using |axis y line*=|\mchoice{left,right}, depending on the position of the color bar or (or |axis x line*=bottom| for |colorbar horizontal|). + + Consider the |tick align=outside| feature if you prefer tick lines outside of the colorbar instead of inside. + + \begin{stylekey}{/pgfplots/every colorbar sampled line} + A style which is used by |colorbar sampled line| to change the color of the line without ticks. + + It is initially set to |help lines|. + \end{stylekey} +\end{stylekey} + +\subsubsection{Color Bars Outside Of an Axis} + +Occasionally, one has multiple adjacent plots, each with the same |colormap| and the same |point meta min| and |point meta max| values and we'd like to show a \emph{single} |colorbar|. \PGFPlots\ supports the |colorbar to name| feature which is similar to the related method for legends, |legend to name|: + + +\begin{pgfplotskey}{colorbar to name=\marg{name} (initially empty)} + Enables to detach a |colorbar| from its parent axis: instead of drawing the |colorbar|, a self--contained, independent set of drawing commands will be stored using the label \meta{name}. The label is defined using |\label|\marg{name}, just as for any other \LaTeX\ label. The name can be referenced using + + |\ref|\marg{name}. + +Thus, typing |\ref|\marg{name} somewhere outside of the axis, maybe even outside of any picture, will cause the |colorbar| to be drawn. + +{ +\pgfplotsmanualdisablecolorforref +\begin{codeexample}[vbox] +\pgfplotsset{footnotesize,samples=10, domain=0:1,point meta min=0, point meta max=1} +\begin{center}% note that \centering uses less vspace... +\begin{tikzpicture} + \begin{axis}[colorbar,colorbar horizontal,colorbar to name={storedcolorbar}] + \addplot[scatter,only marks,mark=*] {rnd}; + \end{axis} +\end{tikzpicture} +% +\begin{tikzpicture} + \begin{axis} + \addplot+[domain=0:1,mark=none,mesh] {x^2}; + \end{axis} +\end{tikzpicture} +% +\begin{tikzpicture} + \begin{axis}[view={0}{90}] + \addplot3[surf] {x*y}; + \end{axis} +\end{tikzpicture} +\\ + +\ref{storedcolorbar} +\end{center} +\end{codeexample} +} + + The feature works in the same way as described for |legend to name|, please refer to its description on page~\pageref{key:legend:to:name} for the details. We only summarize the differences here. + \begin{command}{\pgfplotscolorbarfromname\marg{name}} + This command poses an equivalent alternative for |\ref|\marg{name}: it has essentially the same effect, but it does not create links when used with the |hyperref| package. + \end{command} + + \begin{stylekey}{/pgfplots/every colorbar to name picture} + A style which is installed when |\ref| is used outside of a picture: a new picture will be created with |\tikz[/pgfplots/every colorbar to name picture]|. + + See also the |every legend to name picture| style. + \end{stylekey} +\end{pgfplotskey} + \subsubsection{Scaling Descriptions: Predefined Styles} \label{sec:scaling:styles} It is reasonable to change font sizes, marker sizes etc. together with the overall plot size: Large plots should also have larger fonts and small plots should have small fonts and a smaller distance between ticks. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.coordfiltering.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.coordfiltering.tex index b0377e3e004..baceab56f8e 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.coordfiltering.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.coordfiltering.tex @@ -75,13 +75,17 @@ There is also a style key which simplifies selection by index, see below. \index{Downsampling} \end{pgfplotskey} -\begin{pgfplotsxykey}{restrict \x\space to domain=\meta{min}:\meta{max}} +\begin{pgfplotsxykeylist}{ + restrict \x\space to domain=\meta{min}:\meta{max}, + restrict \x\space to domain*=\meta{min}:\meta{max}} \label{key:restrict:x:to:domain} - Appends $x$ (or $y$ or $z$) coordinate filters which set the respective coordinate to |-inf| if it is below \meta{min} and to |+inf| if it is above \meta{max}. + These keys append $x$ (or $y$ or $z$) coordinate filters to restrict the respective coordinate to a domain. + + The versions without star (like |restrict x to domain|) will assign the value |-inf| if the coordinate is below \meta{min} and |+inf| if the coordinate is above \meta{max}. The starred versions (like |restrict x to domain*|) will truncate coordinates to $[\hbox{\meta{min}}, \hbox{\meta{max}}]$, i.e.\ they assign the value \meta{min} if the coordinate falls outside of the lower limit and \meta{max} if the value falls outside of the upper limit. For logarithmic axes, \meta{min} and \meta{max} are \emph{logs} of the respective values. A variant which uses the non-logarithmic number might be to use |restrict expr to domain={\pgfmathrawx}|\marg{min}\marg{max}. - Furthermore, it sets the |unbounded coords=jump| key which leads to interrupted plots. + The non-starred versions also set |unbounded coords=jump| which leads to interrupted plots. \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[ @@ -100,15 +104,20 @@ There is also a style key which simplifies selection by index, see below. \end{axis} \end{tikzpicture} \end{codeexample} -\end{pgfplotsxykey} +\end{pgfplotsxykeylist} -\begin{pgfplotskey}{restrict expr to domain=\marg{expression}\marg{\meta{min}:\meta{max}}} +\begin{pgfplotskeylist}{% + restrict expr to domain=\marg{expression}\marg{\meta{min}:\meta{max}},% + restrict expr to domain*=\marg{expression}\marg{\meta{min}:\meta{max}}% + } Appends an $x$ coordinate filter which sets the $x$ coordinate to |-inf| if the \meta{expression} evaluates to something less than \meta{min} and to |inf| if \meta{expression} evaluates to something larger than \meta{max}. - Furthermore, it sets the |unbounded coords=jump| key which leads to interrupted plots. + The starred variant, |restrict to domain*| assigns \meta{min} if \meta{expression} is less then the lower limit and \meta{max} if it is larger than the upper limit. + + The non-starred version also sets |unbounded coords=jump| which leads to interrupted plots. In contrast to |restrict x to domain|, \meta{expression} can depend on anything which is valid during |\addplot|, in particular |\coordindex| or table columns (|\thisrow|\marg{column name} and friends). The expression doesn't need to depend on $x$ at all. -\end{pgfplotskey} +\end{pgfplotskeylist} \begin{pgfplotskey}{filter discard warning=\mchoice{true,false} (initially true)} Issues a notification in your logfile whenever coordinate filters discard coordinates. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex new file mode 100644 index 00000000000..cd4cba421a5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.linefitting.tex @@ -0,0 +1,146 @@ +\subsection{Fitting Lines -- Regression} +\label{sec:linefitting} +{ +\pgfkeys{ + /pgfmanual/gray key prefixes={/pgfplots/table}, +} + +This section documents the attempts of \PGFPlots\ to fit lines to input coordinates. \PGFPlots\ currently supports |create col/linear regression| applied to columns of input tables. The feature relies on \PGFPlotstable, it is actually implemented as a table postprocessing method. + + +\begin{stylekey}{/pgfplots/table/create col/linear regression=\marg{key-value-config}}% +\pgfkeys{ + /pgfmanual/gray key prefixes={/pgfplots/table/create col/linear regression/}, + /pdflinks/search key prefixes in/.add={/pgfplots/table/create col/linear regression/,}{}, +} + A style for use in |\addplot table| which computes a linear (least squares) regression $y(x) = a \cdot x + b$ using the sample data $(x_i,y_i)$ which has to be specified inside of \meta{key-value-config} (see below). + + It creates a new column on-the-fly which contains the values $y(x_i) = a \cdot x_i + b$. The values $a$ and $b$ will be stored (globally) into \declareandlabel{\pgfplotstableregressiona} and \declareandlabel{\pgfplotstableregressionb}. + + +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[legend pos=outer north east] + \addplot table[row sep=\\] {% plot X versus Y. This is original data. + X Y\\ + 1 1 \\ + 2 4\\ + 3 9\\ + 4 16\\ + 5 25\\ + 6 36\\ + }; + \addplot table[row sep=\\, + y={create col/linear regression={y=Y}}] % compute a linear regression from the input table + { + X Y\\ + 1 1 \\ + 2 4\\ + 3 9\\ + 4 16\\ + 5 25\\ + 6 36\\ + }; + %\xdef\slope{\pgfplotstableregressiona} %<-- might be handy occasionally + \addlegendentry{$y(x)$} + \addlegendentry{% + $\pgfmathprintnumber{\pgfplotstableregressiona} \cdot x + \pgfmathprintnumber[print sign]{\pgfplotstableregressionb}$} + \end{axis} +\end{tikzpicture} +\end{codeexample} + The example above has two plots: one showing the data and one containing the |linear regression| line. We use |y={create col/linear regression={}}| here, which means to create a new column\footnote{The \texttt{y=\{create col/} feature is available for any other \PGFPlotstable\ postprocessing style, see the \texttt{create on use} documentation in the \PGFPlotstable\ manual.} containing the regression values automatically. + As arguments, we need to provide the $y$ column name explicitly\footnote{In fact, \PGFPlots\ sees that there are only two columns and uses the second as default. But you need to provide it if there are at least 3 columns.}. The $x$ value is determined from context: |linear regression| is evaluated inside of |\addplot table|, so it uses the same $x$ as |\addplot table| (i.e.\ if you write |\addplot table[x=|\marg{col name}|]|, the regression will also use \marg{col name} as its |x| input). Furthermore, it shows the line parameters $a$ and $b$ in the legend. + + + + The following \meta{key-value-config} keys are accepted as comma--separated list: + + \begin{key}{% + /pgfplots/table/create col/linear regression/table=\marg{\textbackslash macro {\normalfont or} file name} (initially empty)} + Provides the table from where to load the |x| and |y| columns. It defaults to the currently processed one, i.e.\ to the value of |\pgfplotstablename|. + \end{key} + \begin{keylist}{% + /pgfplots/table/create col/linear regression/x=\marg{column} (initially empty), + /pgfplots/table/create col/linear regression/y=\marg{column} (initially empty)} + Provides the source of $x_i$ and $y_i$ data, respectively. The argument \meta{column} is usually a column name of the input table, yet it can also contains |[index]|\meta{integer} to designate column indizes (starting with $0$), |create on use| specifications or |alias|es (see the \PGFPlotstable\ manual for details on |create on use| and |alias|). + + The initial configuration (an empty value) checks the context where the |linear regression| is evaluated. If it is evaluated inside of |\pgfplotstabletypeset|, it uses the first and second table columns. If it is evaluated inside of |\addplot table|, it uses the same $x$ input as the |\addplot table| statement. The |y| key needs to be provided explicitly (unless the table has only two columns). + \end{keylist} + + \begin{keylist}{% + /pgfplots/table/create col/linear regression/xmode=\mchoice{auto,linear,log} (initially auto), + /pgfplots/table/create col/linear regression/ymode=\mchoice{auto,linear,log} (initially auto)} + Enables or disables processing of logarithmic coordinates. Logarithmic processing means to apply $\ln$ before computing the regression line and $\exp$ afterwards. + + The choice |auto| checks if the column is evaluated inside of a \PGFPlots\ axis. If so, it uses the axis scaling of the embedding axis. Otherwise, it uses |linear|. + + In case of logarithmic coordinates, the |log basis x| and |log basis y| keys determine the basis. + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{loglogaxis} + \addplot table[x=dof,y=error2] + {pgfplotstable.example1.dat}; + \addlegendentry{$y(x)$} + + \addplot table[ + x=dof, + y={create col/linear regression={y=error2}}] + {pgfplotstable.example1.dat}; + + % might be handy occasionally: + %\xdef\slope{\pgfplotstableregressiona} + \addlegendentry{slope + $\pgfmathprintnumber{\pgfplotstableregressiona}$} +\end{loglogaxis} +\end{tikzpicture} +\end{codeexample} + + The (commented) line containing |\slope| is explained above; it allows to remember different regression slopes in our example. + \end{keylist} + + \begin{keylist}{% + /pgfplots/table/create col/linear regression/variance list=\marg{list} (initially empty),% + /pgfplots/table/create col/linear regression/variance=\marg{column name} (initially empty)% + } + Both keys allow to provide uncertainties (variances) to single data points. + A high (relative) variance indicates an unreliable data point, a value of $1$ is standard. + + The |variance list| key allows to provide variances directly as comma--separated list, for example + + |variance list={1000,1000,500,200,1,1}|. + + The |variance| key allows to load values from a table \meta{column name}. Such a column name is (initially, see below) loaded from the same table where data points have been found. The \meta{column name} may also be a |create on use| name. +\begin{codeexample}[] +\begin{tikzpicture} +\begin{loglogaxis} + \addplot table[x=dof,y=error2] + {pgfplotstable.example1.dat}; + \addlegendentry{$y(x)$} + + \addplot table[ + x=dof, + y={create col/linear regression={ + y=error2, + variance list={1000,800,600,500,400}} + } + ] + {pgfplotstable.example1.dat}; + + \addlegendentry{slope + $\pgfmathprintnumber{\pgfplotstableregressiona}$} +\end{loglogaxis} +\end{tikzpicture} +\end{codeexample} + + If both, |variance list| and |variance| are given, the first one will be preferred. Note that it is not necessary to provide variances for every data point. + \end{keylist} + + \begin{key}{/pgfplots/table/create col/linear regression/variance src=\marg{\textbackslash table {\normalfont or} file name} (initially empty)} + Allows to load the |variance| from another table. The initial setting is empty. It is acceptable if the |variance| column in the external table has fewer entries than expected, in this case, only the first ones will be used. + \end{key} +\end{stylekey} + +\paragraph{Limitations:} Currently, \PGFPlots\ supports only linear regression, and it only supports regression together with |\addplot table|. Furthermore, long input tables might need quite some time. +} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.markers-meta.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.markers-meta.tex index 6fcce13a478..7bd15bf2a25 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.markers-meta.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.markers-meta.tex @@ -560,7 +560,7 @@ The usage of the result \meta{\textbackslash macro} is a little bit low--level. \begin{pgfplotskeylist}{cycle list=\marg{list},cycle list name=\marg{\textbackslash macro}} Allows to specify a list of plot specifications which will be used for each \hbox{|\addplot|}-command without explicit plot specification. Thus, the currently active |cycle list| will be used if you write either |\addplot+|\oarg{keys}| ...;| or if you \emph{don't} use square brackets as in |\addplot|\oarg{explicit plot specification}| ...;|. -The list element with index~$i$ will be chosen where~$i$ is the index of the current |\addplot| command. This indexing does also include plot commands which don't use the |cycle list|. +The list element with index~$i$ will be chosen where~$i$ is the index of the current |\addplot| command (see also the |cycle list shift| key which allows to use $i+n$ instead). This indexing does also include plot commands which don't use the |cycle list|. There are several possibilities to change the currently active |cycle list|: \begin{enumerate} @@ -925,7 +925,7 @@ In this case, the \emph{last} entry also needs a terminating `|\\|', but one can \begin{axis}[ title={Cycle 2 marks between successive plots, then colors}, cycle multi list={% - blue,red\nextlist + color list\nextlist [2 of]mark list }, samples=3, @@ -949,6 +949,20 @@ In this case, the \emph{last} entry also needs a terminating `|\\|', but one can \end{codeexample} \end{pgfplotskey} +\begin{pgfplotskey}{cycle list shift=\marg{integer} (initially empty)} + Allows to \emph{shift} the index into the |cycle list|. If \meta{integer} is $n$, the list element $i+n$ will be taken instead of the $i$'th one. Remember that $i$ is the index of the current |\addplot| command (starting with~$0$). + + Since a |cycle list| is queried \emph{immediately} when |\addplot| (or |\addplot+|) is called, you can adjust the |cycle list shift| for selected plots: +\begin{codeexample}[code only] +\pgfplotsset{cycle list shift=3} +\addplot .... + +\pgfplotsset{cycle list shift=-1} +\addplot .... +\end{codeexample} + \paragraph{Special case:} If the result is negative, $i+n <0$, the list index $-(i+n)$ will be taken. For example, |cycle list shift=-10| and $i<10$ will result in list index $10-i$. Note that you can use |reverse legend| to reverse legends, so this feature is probably never needed. +\end{pgfplotskey} + \subsubsection{Axis Background} \begin{pgfplotskey}{axis background (initially empty)} This is a style to configure the appearance of the axis as such. It can be defined and/or changed using the |axis background/.style=|\marg{options} method. A background path will be generated with \meta{options}, which may contain fill colors or shadings. @@ -1086,18 +1100,22 @@ A further common idea is the use of color maps: if the point meta data is in the Currently, this choice can only be used for scatter plots. - \item[\declare{\meta{expression}}] This choice finally allows to compute point meta data using a mathematical expression. The \meta{expression} may depend on |x|, |y|, |z| which yield the current $x$, $y$ or $z$ coordinate, respectively. The coordinates are completely processed (transformations, logs) as mentioned above for the choice |x|. Furthermore, the \meta{expression} may depend on commands which are valid during |\addplot| like |\plotnum| or |\coordindex| (see section~\ref{pgfplots:misc} for details). Computations are performed using the floating point unit of \PGF, and all supported arithmetical operations can be used. - - In essence, the \meta{expression} may depend on everything which is known to all |\addplot| commands: the $x$, $y$ and (if any) $z$ coordinates. In addition, it may depend upon |rawx|, |rawy| or |rawz|. These three expressions yield the unprocessed $x$, $y$ or $z$ value as it has been found in the input stream (no logs, no user transformations). If used together with |plot table|, you may also access other table columns (for example with |\thisrow|\marg{colname}). + \item[\normalfont\declare{\meta{expression}}] This choice allows to compute point meta data using a mathematical expression. The \meta{expression} may depend on |x|, |y|, |z| which yield the current $x$, $y$ or $z$ coordinate, respectively. The coordinates are completely processed (transformations, logs) as mentioned above for the choice |x|. Furthermore, the \meta{expression} may depend on commands which are valid during |\addplot| like |\plotnum| or |\coordindex| (see section~\ref{pgfplots:misc} for details). Computations are performed using the floating point unit of \PGF, and all supported arithmetical operations can be used. - The \meta{expression} is checked after the other possible choices have already been evaluated. In other words, the statement + In essence, the \meta{expression} may depend on everything which is known to all |\addplot| commands: the $x$, $y$ and (if any) $z$ coordinates. In addition, it may depend upon |rawx|, |rawy| or |rawz|. These three expressions yield the unprocessed $x$, $y$ or $z$ value as it has been found in the input stream (no logs, no user transformations)% + \footnote{% + In rare circumstances, it might be interesting to apply a math expression to another source of point meta (one of the other choices. To this end, the \meta{expression} is checked after the other possible choices have already been evaluated. In other words, the statement \texttt{point meta=explicit, point meta=meta*meta+3} will evaluate the expression with |meta| set to whatever data has been provided explicitly.}. + If used together with |plot table|, you may also access other table columns (for example with |\thisrow|\marg{colname}). + + \item[\normalfont\declaretext{TeX code}\texttt{=}\meta{code}] A rather low level choice which allows to provide \TeX\ \meta{code} to compute a numerical value. The \meta{code} should define the macro |\pgfplotspointmeta|. It is evaluated in a locally scoped environment (it's local variables are freed afterwards). It may depend on the same values as described for \meta{expression} above, especially on |\thisrow|\marg{colname} for table input. - |point meta=explicit, point meta=meta^2+3| + Note that the math parser will be configured to use the |fpu| at this time, so |\pgfmathparse| yields floats. - will evaluate the expression with |meta| set to whatever data has been provided explicitly. + \item[\normalfont\declaretext{TeX code symbolic}\texttt{=}\meta{code}] Just as |TeX code|, you can provide \meta{code} which defines the macro |\pgfplotspointmeta|, but the result is not interpreted as a number. It is like the |explicit symbolic| choice. + \end{description} - It has been mentioned several times that one application of point meta data is to determine (marker/face/edge) colors using a linear map into the range $[0,1000]$ (maybe for use in the current color map). This map works as follows: it is a function + As already mentioned, a main application of point meta data is to determine (marker/face/edge) colors using a linear map into the range $[0,1000]$ (maybe for use in the current color map). This map works as follows: it is a function \[ \phi\colon [m_{\text{min}},m_{\text{max}}] \to [0,1000] \] with \[ \phi(m) = \frac{m - m_{\text{min}}} {1000} \] @@ -1145,6 +1163,8 @@ A further common idea is the use of color maps: if the point meta data is in the \end{axis} \end{tikzpicture} \end{codeexample} + + Note that a |colorbar| will still use the |axis wide| point meta limits. Consider the |colorbar source| key if you want the color data limits of a \emph{particular} plot for your color bar. The |point meta rel| key configures how point meta maps to colors in the |colormap|. \end{pgfplotskey} \begin{pgfplotskeylist}{point meta min=\marg{number},point meta max=\marg{number}} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.specifyrange.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.specifyrange.tex index 6997afc53a1..fb074d59ca8 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.specifyrange.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.specifyrange.tex @@ -165,7 +165,16 @@ You can set |xmin|, |xmax| and |ymin|, |ymax| to the minimum/maximum values of y \end{pgfplotsxykeylist} + +\begin{pgfplotskey}{update limits=\mchoice{true,false} (initially true)} + Can be used to interrupt updates of the data limits (for example, for single |\addplot| commands). + + This has the same effect as |\pgfplotsinterruptdatabb| ... |\endpgfplotsinterruptdatabb|. +\end{pgfplotskey} + \begin{environment}{{pgfplotsinterruptdatabb}} \index{Bounding Box Control!Disable \protect\emph{data} bounding box modifications} Everything in \marg{environment contents} will not contribute to the data bounding box. + + The same effect can be achieved with |update limits=false| inside curly braces. \end{environment} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.styleoptions.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.styleoptions.tex index 69fe108fac9..99dfc3a5137 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.styleoptions.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.styleoptions.tex @@ -130,6 +130,17 @@ which can be reset if needed. This key is also documented on page~\pageref{key:legendimagepost}. \end{stylekey} +\pgfplotsshortstylekey legend image post style=every legend image post\pgfeov + +\begin{stylekey}{/pgfplots/every legend to name picture} + A style for use with |legend to image|, see the documentation therein. +\end{stylekey} + +\begin{stylekey}{/pgfplots/every colorbar} + A style to change the |colorbar|. See page~\pageref{key:every:colorbar} for the reference documentation of |every colorbar|. +\end{stylekey} + +\pgfplotsshortstylekey colorbar style=every colorbar\pgfeov \subsubsection*{Styles for axis lines} \begin{xystylekey}{/pgfplots/every outer \x\ axis line (initially empty)} @@ -159,6 +170,10 @@ Please refer to section~\ref{pgfplots:page:axislines} on page~\pageref{pgfplots: \pgfplotsshortstylekey 3d box foreground style=every 3d box foreground\pgfeov +\begin{stylekey}{/pgfplots/every colorbar sampled line} + To be used in conjunction with |colorbar sampled line|, see the documentation therein. +\end{stylekey} +\pgfplotsshortstylekey colorbar sampled line style=every colorbar sampled line\pgfeov \subsubsection*{Styles for ticks} @@ -237,6 +252,16 @@ The initial setting is \pgfplotsset{every extra x tick/.append style={grid=major}} \pgfplotsset{every extra x tick/.append style={major tick length=0pt}} \pgfplotsset{every extra x tick/.append style={/pgf/number format=sci subscript}} +\pgfplotsset{extra x tick style={ + color=red, + tickwidth=3mm, + % the initial 'every tick style' defines a 'line width'. + % this here redefines it: + tick style={ + line width=2mm, + }, + } +} \end{codeexample} \end{xystylekey} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex index b2a92e7868d..b12dd75e90f 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex @@ -20,4 +20,5 @@ \input pgfplots.reference.closingplots.tex \input pgfplots.reference.symbolic-transformations.tex \input pgfplots.reference.coordfiltering.tex +\input pgfplots.reference.linefitting.tex \input pgfplots.reference.miscellaneous.tex diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex index 0cb1556035f..228d9d8533a 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tickoptions.tex @@ -241,7 +241,9 @@ xticklabels={{0,5}, $e$}. $-\frac 12$, $0$, $\frac 12$, - $1$} + $1$}, + % note: \frac can be done automatically: + % xticklabel style={/pgf/number format/frac}, ] \addplot[smooth,blue,mark=*] coordinates { @@ -321,7 +323,7 @@ That means you can configure the appearance of linear axis with the number forma \end{tikzpicture} \end{codeexample} -The following example uses explicitly formatted $x$ tick labels and a small \TeX\ script to format $y$ tick labels in the form \meta{sign}\meta{number}|/10|. +The following example uses explicitly formatted $x$ tick labels and a small \TeX\ script to format $y$ tick labels as fractions in the form \meta{sign}\meta{number}|/10| (note that the |/pgf/number format/frac| style can do similar things automatically, see \PGFPlotstable\ and the documentation therein). % \usepackage{nicefrac} \begin{codeexample}[width=4cm] % \usepackage{nicefrace}% required @@ -345,6 +347,9 @@ The following example uses explicitly formatted $x$ tick labels and a small \TeX \fi \fi }, + % NOTE: this here does the same: + % yticklabel style={/pgf/number format/.cd,frac, + % frac TeX=\nicefrac,frac whole=false,frac denom=10}, ymajorgrids, title=A special Prewavelet, axis x line=center, diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex index 87b7a54d236..54688463c10 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex @@ -34,6 +34,21 @@ \end{tikzpicture} \end{codeexample} +\pgfplotsexpensiveexample +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[ + title=$120 \times 120$ Smooth Surface, + xlabel=$x$, + ylabel=$y$] +\addplot3[surf,samples=120,shader=interp,domain=0:1] + {sin(deg(8*pi*x))* exp(-20*(y-0.5)^2) + + exp(-(x-0.5)^2*30 + - (y-0.25)^2 - (x-0.5)*(y-0.25))}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + \PGFPlots\ relies completely on \TeX\ to do all typesetting. It uses the front-end-layer and basic layer of \PGF\ to perform all drawing operations. For complicated plots, this may take some time, and you may want to read section~\ref{sec:pgfplots:importexport} for how to write single figures to external graphics files. Externalization is the best way to reduce typesetting time. However, for large scale plots with a lot of points, limitations of \TeX's capacities are reached easily. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex index 4d4364563b1..1e4ce7cbf4d 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex @@ -184,7 +184,7 @@ I apologize for any inconvenience caused by these changes. If you are interested in writing something but don't know how, consider reading the auxiliary manual \href{file:TeX-programming-notes.pdf}{TeX-programming-notes.pdf} which comes with \PGFPlots. It is far from complete, but maybe it is a good starting point (at least for more literature). \subsection{Acknowledgements} -I thank God for all hours of enjoyed programming. I thank Pascal Wolkotte and Nick Papior Andersen for their programming efforts and contributions as part of the development team. I thank Stefan Tibus, who contributed the |plot shell| feature. I thank Tom Cashman for the contribution of the |reverse legend| feature. Furthermore, I thank Dr.~Schweitzer for many fruitful discussions and Dr.~Meine for his ideas and suggestions. +I thank God for all hours of enjoyed programming. I thank Pascal Wolkotte and Nick Papior Andersen for their programming efforts and contributions as part of the development team. I thank Stefan Tibus, who contributed the |plot shell| feature. I thank Tom Cashman for the contribution of the |reverse legend| feature. Special thanks go to Stefan Pinnow whose tests of \PGFPlots\ lead to numerous quality improvements. Furthermore, I thank Dr.~Schweitzer for many fruitful discussions and Dr.~Meine for his ideas and suggestions. Thanks as well to the many international contributors who provided feature requests or identified bugs or simply manual improvements! Last but not least, I thank Till Tantau and Mark Wibrow for their excellent graphics (and more) package \PGF\ and \Tikz\ which is the base of \PGFPlots. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.dat b/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.dat new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.dat diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.script b/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.script new file mode 100644 index 00000000000..093dcd3ba70 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.script @@ -0,0 +1 @@ +unset surface; set cntrparam levels 5; set contour; set table "pgfplots_contourtmp0.table"; splot "pgfplots_contourtmp0.dat"; diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.table b/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.table new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots_contourtmp0.table diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotsexample.pdf b/Master/texmf-dist/doc/latex/pgfplots/pgfplotsexample.pdf Binary files differnew file mode 100644 index 00000000000..b1b36a8f11b --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotsexample.pdf diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example5.dat b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example5.dat new file mode 100644 index 00000000000..f6e42d61ed6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example5.dat @@ -0,0 +1,4 @@ +first,second +(1)(0),2 1#2) +(3)(0),4 1#3) +(5)(0),6 1#3) diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.pdf b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.pdf Binary files differindex 2876de353a3..c88e6098e8f 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.pdf +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.pdf diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex index c4be25d48f4..1db93c31c52 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex @@ -26,6 +26,7 @@ \usepackage{colortbl} \usepackage{booktabs} \usepackage{eurosym} +\usepackage{multirow} \pgfqkeys{/codeexample}{% every codeexample/.style={ @@ -143,10 +144,29 @@ Lines starting with `|%|' or `|#|' are considered to be comment lines and are ig There is future support for a second header line which must start with `|$flags |' (the space is obligatory, even if the column separator is \emph{not} space!). Currently, such a line is ignored. It may be used to provide number formatting options like precision and number format. -\begin{command}{\pgfplotstabletypeset\oarg{optional arguments}\marg{file name or \textbackslash macro}} +\begin{command}{\pgfplotstabletypeset\oarg{optional arguments}\marg{file name {\normalfont or} \textbackslash macro {\normalfont or} inline table}} Loads (or acquires) a table and typesets it using the current configuration of number formats and table options. - In case the first argument is a file name, the table will be loaded from disk. Otherwise, it is assumed to be an already loaded table (see |\pgfplotstableread| or |\pgfplotstablenew|). + In case the first argument is a file name, the table will be loaded from disk. If it is an already loaded table (see |\pgfplotstableread| or |\pgfplotstablenew|), it will be used. Otherwise, if it is inline table data, this data will be parsed just as if it would have been found in a file (see |\pgfplotstableread|). +{ + % allow to typeset the example. I couldn't get the \catcodes + % correctly... + \pgfplotstableset{ + /codeexample/newline=\noexpand\\, + row sep=\\, + }% +\begin{codeexample}[] +\pgfplotstabletypeset[sci zerofill]{ + a b + 5000 1.234e5 + 6000 1.631e5 + 7000 2.1013e5 + 9000 1000000 +} +\end{codeexample} +}% + + \begin{codeexample}[] \pgfplotstabletypeset{pgfplotstable.example1.dat} \end{codeexample} @@ -190,6 +210,26 @@ There is future support for a second header line which must start with `|$flags \end{codeexample} \noindent All of these options are explained in all detail in the following sections. +You may also use a similar input format as for tabular environment: +\begin{codeexample}[width=8cm] +\pgfplotstabletypeset + [col sep=&,row sep=\\,sci zerofill] +{ + level & dof & error \\ + 1 & 4 & 2.50000000e-01 \\ + 2 & 16 & 6.25000000e-02 \\ + 3 & 64 & 1.56250000e-02 \\ + 4 & 256 & 3.90625000e-03 \\ + 5 & 1024 & 9.76562500e-04 \\ + 6 & 4096 & 2.44140625e-04 \\ + 7 & 16384 & 6.10351562e-05 \\ + 8 & 65536 & 1.52587891e-05 \\ + 9 & 262144 & 3.81469727e-06 \\ + 10 & 1048576 &9.53674316e-07 \\ +} +\end{codeexample} + + Technical note: every opened file will be protocolled into your log file. \end{command} @@ -198,22 +238,51 @@ Technical note: every opened file will be protocolled into your log file. \end{command} -\begin{command}{\pgfplotstableread\marg{file name}\marg{\textbackslash macro}} - Loads the table \marg{file name} into a \TeX-macro \meta{\textbackslash macro}. This macro can then be used several times. +\begin{commandlist}{% + \pgfplotstableread\marg{file name}\marg{\textbackslash macro}, + \pgfplotstableread\marg{inline table}\marg{\textbackslash macro}} + Loads a table into the \TeX-macro \meta{\textbackslash macro}. This macro will store the table as internal structure and can be used several times. \begin{codeexample}[] \pgfplotstableread{pgfplotstable.example1.dat}\loadedtable \pgfplotstabletypeset[columns={dof,error1}]\loadedtable \hspace{2cm} \pgfplotstabletypeset[columns={dof,error2}]\loadedtable \end{codeexample} - There are variants of this command which do not really built up a struct but which report every line to a ``listener''. There is also a struct which avoids protection by \TeX\ scopes. In case you need such things, consider reading the source code comments. + The first argument can be either a \meta{file name} as in the example here. It is also possible to provide the table data directly: +\begin{codeexample}[code only] +% Alternative: inline table data: +\pgfplotstableread{ +level dof error1 error2 info grad(log(dof),log(error2)) quot(error1) +1 4 2.50000000e-01 7.57858283e-01 48 0 0 +2 16 6.25000000e-02 5.00000000e-01 25 -3.00000000e-01 4 +3 64 1.56250000e-02 2.87174589e-01 41 -3.99999999e-01 4 +4 256 3.90625000e-03 1.43587294e-01 8 -5.00000003e-01 4 +5 1024 9.76562500e-04 4.41941738e-02 22 -8.49999999e-01 4 +6 4096 2.44140625e-04 1.69802322e-02 46 -6.90000001e-01 4 +7 16384 6.10351562e-05 8.20091159e-03 40 -5.24999999e-01 4 +8 65536 1.52587891e-05 3.90625000e-03 48 -5.35000000e-01 3.99999999e+00 +9 262144 3.81469727e-06 1.95312500e-03 33 -5.00000000e-01 4.00000001e+00 +10 1048576 9.53674316e-07 9.76562500e-04 2 -5.00000000e-01 4.00000001e+00 +}\loadedtable +% can be used as above: +\pgfplotstabletypeset[columns={dof,error1}]\loadedtable +\hspace{2cm} +\pgfplotstabletypeset[columns={dof,error2}]\loadedtable +\end{codeexample} + It is checked automatically whether the first argument contains inline data or a file name. -Technical note: every opened file will be protocolled into your log file. + The check whether the first argument is inline data or a file name works as follows: if |format=auto|, the first argument is considered to be a file name unless it contains the |row sep| character (see |row sep|). If |format=inline|, it is always considered to be inline data. If |format=file|, it is a file name. - Note: avoid using `|\table|' as name, it conflicts with |\begin{table}| of \LaTeX. -\end{command} + \paragraph{Special cases and more details:} + \begin{itemize} + \item The inline data format is ``fragile''. If you experience problems, terminate your tables with `|\\|' combined with |row sep=\\| (the docs for |row sep| contain alternative ways and more explanation). + \item There are variants of this command which do not really built up a struct but which report every line to a ``listener''. There is also a struct which avoids protection by \TeX\ scopes. In case you need such things, consider reading the source code comments. + \item Technical note: every opened file will be protocolled into your log file. + \item Note: avoid using `|\table|' as name, it conflicts with |\begin{table}| of \LaTeX. + \end{itemize} +\end{commandlist} -\begin{key}{/pgfplots/table/col sep=\mchoice{space,tab,comma,semicolon,colon,braces} (initially space)} +\begin{key}{/pgfplots/table/col sep=\mchoice{space,tab,comma,semicolon,colon,braces,\&,ampersand} (initially space)} Specifies the column separation character for table reading. The initial choice, |space| means ``at least one white space''. White spaces are tab stops or spaces (newlines always delimit lines). For example, the file |pgfplotstable.example1.csv| uses commas as separation characters. @@ -247,6 +316,14 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) The value |col sep=braces| is special since it actually uses two separation characters. Every single cell entry is delimited by an opening and a closing brace, \marg{entry}, for this choice. Furthermore, any white spaces (spaces and tabs) between cell entries are \emph{skipped} in case |braces| until the next \marg{entry} is found. A further speciality of |col sep=braces| is that it has support for \emph{multi-line} cells: everything within balanced braces is considered to be part of a cell. This includes newlines\footnote{This treatment of newlines within balanced braces actually applies to every other column separator as well (it is a \TeX\ readline feature). In other words: you \emph{can} have multi line cells for every column separator if you enclose them in balanced curly braces. However, \texttt{col sep=braces} has the special treatment that end-of-line counts as white space character; for every other \texttt{col sep} value, this white space is suppressed to remove spurious spaces.}. + + The |col sep=&| case (probably together with |row sep=\\|) allows to read tables as you'd usually type them in \LaTeX. This will automatically enable |trim cells|. +\end{key} + +\begin{key}{/pgfplots/table/trim cells=\mchoice{true,false} (initially false)} + If enabled, leading and trailing white spaces will be removed while tables are read. + + This might be necessary if you have |col sep|$\neq$|space| but your cells contain spaces. It will be activated automatically for |col sep=&|. \end{key} \begin{key}{/pgfplots/table/header=\mchoice{true,false,has colnames} (initially true)} @@ -261,7 +338,67 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) Finally, the choice \declaretext{has colnames} is the opposite of |false|: it assumes that the first non--comment line \emph{contains} column names. In other words: even if only numbers are contained in the first line, they are considered to be column \emph{names}. \end{key} -\subsection{Selecting Columns} +\begin{pgfplotskey}{table/format=\mchoice{auto,inline,file} (initially auto)} + Configures the format expected as first argument for |\pgfplotstableread|\marg{input}. + + The choice \declaretext{inline} expects the table data directly as argument where rows are separated by |row sep|. Inline data is ``fragile'', because \TeX\ may consume end--of--line characters (or |col sep| characters). See |row sep| for details. + + The choice \declaretext{file} expects a file name. + + The choice \declaretext{auto} searches for a |row sep| in the first argument supplied to |\pgfplotstableread|. If a |row sep| has been found, it is inline data, otherwise it is a file name. +\end{pgfplotskey} +\begin{pgfplotskey}{table/row sep=\mchoice{newline,\string\\} (initially newline)} + Configures the character to separate rows of the inline table data format (see |format=inline|). + + The choice \declaretext{newline} uses the end of line as it appears in the table data (i.e.\ the input file or any inline table data). + + The choice \declaretext{\string\\} uses `|\\|' to indicate the end of a row. + + Note that \declaretext{newline} for inline table data is ``fragile'': you can't provide such data inside of \TeX\ macros (this does not apply to input files). Whenever you experience problems, proceed as follows: + \begin{enumerate} + \item First possibility: call |\pgfplotstableread|\marg{data}|\yourmacro| \emph{outside} of any macro declaration. + \item Use |row sep=\\|. + \end{enumerate} + The same applies if you experience problems with inline data and special |col sep| choices (like |col sep=tab|). + + The reasons for such problems is that \TeX\ scans the macro bodies and replaces newlines by white spaces. It does other substitutions of this sort as well, and these substitutions can't be undone (maybe not even found). +\end{pgfplotskey} + +\begin{key}{/pgfplots/table/ignore chars=\marg{comma-separated-list} (initially empty)} + Allows to define an ``ignore list'' for single characters. Any characters found in an input file which occur also in \meta{comma-separated-list} will silently by thrown away. The processing is exactly the same as if you did not write them at all in the first place. + + For example, suppose we are given |pgfplotstable.example5.dat| with +\lstinputlisting[basicstyle=\ttfamily\footnotesize]{pgfplotstable.example5.dat} + + \noindent then, we can ignore several of the characters by writing +\begin{codeexample}[] +\pgfplotstabletypeset + [col sep=comma,ignore chars={(,),\ ,\#}] + {pgfplotstable.example5.dat} +\end{codeexample} + + The \meta{comma-separated-list} should contain exactly one character in each list element, and the single characters should be separated by commas. Some special characters like commas, white spaces, hashes, percents or backslashes need to be escaped by prefixing them with a backslash. + + Besides normal characters, it is also supported to eliminate any binary code from your input files. For example, suppose you have binary characters of code |0x01| (hex notation) in your files. Then, use +\begin{codeexample}[code only] +\pgfplotstableset{ignore chars={\^^01}} +\end{codeexample} + \noindent to eliminate them silently. The |^^|\meta{digit}\meta{digit} notation is a \TeX\ feature to provide characters in hexadecimal encoding where \meta{digit} is one of |0123456789abcdef|. I don't know if the backslash in |\^^01| is always necessary, try it out. There is also a character based syntax, in which |\^^M| is \meta{newline} and |\^^I| is \meta{tab}. Refer to~\cite{texbook} for more details. + + Note that after stripping all these characters, the input table must be valid -- it should still contain column separators and balanced columns. + + This setting applies to |\addplot table| and |\addplot file| for \PGFPlots\ as well. + + Note that |ignore chars| is ``fragile'' when it is applied to |format=inline| or |format=auto|. Consider |format=file| if you experience problems\footnote{See also |row\ sep| for more information about dealing with fragile inline tables formats.}. +\end{key} + +\begin{key}{/pgfplots/table/white space chars=\marg{comma-separated-list} (initially empty)} + Allows to define a list of single characters which are actually treated like white spaces (in addition to tabs and spaces). It might be useful in order to get more than one column separator character. + + The |white space chars| list is used in exactly the same way as |ignore chars|, and the same remarks as above apply as well. +\end{key} + +\subsection{Selecting Columns and their Appearance Styles} \begin{key}{/pgfplots/table/columns=\marg{comma-separated-list}} Selects particular columns the table. If this option is empty (has not been provided), all available columns will be selected. @@ -275,7 +412,23 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) \begin{pgfplotstablealiaskey} Assigns the new name \meta{col name} for the column denoted by \meta{real col name}. Afterwards, accessing \meta{col name} will use the data associated with column \meta{real col name}. - +\begin{codeexample}[] +% in preamble: +\pgfplotstableset{ + alias/newname/.initial=b, +}% +% +% in document: +\pgfplotstabletypeset[ + row sep=\\, + columns={a,newname},% access to `newname' is the same as to `b' +]{ + a b\\ + 1 2\\ + 3 4\\ + 5 6\\ +}% +\end{codeexample} You can use |columns/|\meta{col name}|/.style| to assign styles for the alias, not for the original column name. If there exists both an alias and a column of the same name, the column name will be preferred. Furthermore, if there exists a |create on use| statement with the same name, this one will also be preferred. @@ -482,6 +635,27 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) A style which can be used together with the |dcolumn| package of David Carlisle. It also enables alignment at the decimal separator. However, the decimal separator needs to be exactly one character which is incompatible with `|{,}|' (the default setting for |use comma|). \end{stylekey} +\begin{pgfplotskey}{table/sort=\marg{true,false} (initially false)} + If set to |true|, |\pgfplotstabletypeset| will sort the table before applying its operation. + + See the description of |\pgfplotstablesort| for how to configure |sort key| and |sort cmp|. + +\begin{codeexample}[] +\pgfplotstabletypeset[ + sort,sort key=error2, + columns={dof,error1,error2}, + columns/error1/.style={sci,sci subscript,sci zerofill,dec sep align}, + columns/error2/.style={sci,sci subscript,sci zerofill,dec sep align}, +] + {pgfplotstable.example1.dat} +\end{codeexample} + + The |sort| mechanism is applied before the actual typesetting routine starts, i.e.\ it has the same effect as if you'd call |\pgfplotstablesort| manually before typesetting the table (however, the |sort| key has the advantage of respective the |include outfiles| caching mechanism). Any |create on use| specifications are resolved before calling the |sort key|. + + + %The |sort| key applies also to |\addplot table[sort,read completely]|. +\end{pgfplotskey} + \begin{stylekey}{/pgfplots/table/every first column} A style which is installed for every first column only. \begin{codeexample}[narrow] @@ -579,7 +753,7 @@ A style which is installed for every column with odd column index (starting with \end{command} -\subsection{Configuring Row Appearance} +\subsection{Configuring Row Appearance: Styles} The following styles allow to configure the final table code \emph{after any cell contents have been assigned}. \begin{key}{/pgfplots/table/before row=\marg{\TeX\ code}} @@ -671,8 +845,9 @@ The following styles allow to configure the final table code \emph{after any cel \end{stylekey} \subsection{Customizing and Getting the Tabular Code} +The following keys allow changes of alignment (|begin table|) and |font| and they allow to write the generated code to |outfile|s (see also |write to macro|). Furthermore, the generated code can be fine--tuned to provide other sorts of table output, beyond \LaTeX. \begin{stylekey}{/pgfplots/table/every table=\marg{file name}} - A style which is installed at the beginning of every |\pgfplotstabletypeset| command. + A style which is installed at the beginning of every |\pgfplotstabletypeset| command\footnote{The \texttt{every table} style is installed \emph{after} options provided to \texttt{\textbackslash pgfplotstabletypeset}; it has higher precedence.}. The table file name is given as first argument. \end{stylekey} @@ -776,7 +951,7 @@ The command |\pgfutilensuremath| checks whether math mode is active and switches The comment sign which is inserted into outfiles to suppress trailing white spaces. \end{key} -\noindent As last example, we use \PGFPlotstable\ to write an |.html| (without number formatting, however): +\noindent As last example, we use \PGFPlotstable\ to write an |.html| file (including number formatting and rounding!): % \usepackage{listings} \begin{codeexample}[width=8cm] \pgfplotstabletypeset[ @@ -785,9 +960,10 @@ The command |\pgfutilensuremath| checks whether math mode is active and switches /pgfplots/table/@cell content={<td>#1</td>} }, before row=<tr>,after row=</tr>, - skip coltypes, typeset=false, string type, + skip coltypes, typeset=false, + verbatim,% configures number printer TeX comment=, - columns={level,dof}, + columns={level,dof,error1}, outfile=pgfplotstable.example1.out.html, ]{pgfplotstable.example1.dat} \lstinputlisting @@ -907,7 +1083,7 @@ See section~\ref{sec:number:styles} for how to change the appearance. \end{key} \begin{key}{/pgf/number format/sci} -Configures |\pgfmathprintnumber| to display numbers in scientific format, that means sign, mantisse and exponent (basis~$10$). The mantisse is rounded to the desired precision. +Configures |\pgfmathprintnumber| to display numbers in scientific format, that means sign, mantisse and exponent (basis~$10$). The mantisse is rounded to the desired |precision| (or |sci precision|, see below). \begin{codeexample}[] \pgfkeys{/pgf/number format/.cd,sci,precision=2} @@ -996,6 +1172,62 @@ Truncates every number to integers (discards any digit after the period). \end{codeexample} \end{key} +\begin{key}{/pgf/number format/frac} +Displays numbers as fractionals. + +\begin{codeexample}[width=3cm] +\pgfkeys{/pgf/number format/frac} +\pgfmathprintnumber{0.333333333333333}\hspace{1em} +\pgfmathprintnumber{0.5}\hspace{1em} +\pgfmathprintnumber{2.133333333333325e-01}\hspace{1em} +\pgfmathprintnumber{0.12}\hspace{1em} +\pgfmathprintnumber{2.666666666666646e-02}\hspace{1em} +\pgfmathprintnumber{-1.333333333333334e-02}\hspace{1em} +\pgfmathprintnumber{7.200000000000000e-01}\hspace{1em} +\pgfmathprintnumber{6.666666666666667e-02}\hspace{1em} +\pgfmathprintnumber{1.333333333333333e-01}\hspace{1em} +\pgfmathprintnumber{-1.333333333333333e-02}\hspace{1em} +\pgfmathprintnumber{3.3333333}\hspace{1em} +\pgfmathprintnumber{1.2345}\hspace{1em} +\pgfmathprintnumber{1}\hspace{1em} +\pgfmathprintnumber{-6} +\end{codeexample} + +\begin{key}{/pgf/number format/frac TeX=\marg{\textbackslash macro} (initially \texttt{\textbackslash frac})} + Allows to use a different implementation for |\frac| inside of the |frac| display type. +\end{key} +\begin{key}{/pgf/number format/frac denom=\meta{int} (initially empty)} + Allows to provide a custom denominator for |frac|. +\begin{codeexample}[width=3cm] +\pgfkeys{/pgf/number format/.cd,frac, frac denom=10} +\pgfmathprintnumber{0.1}\hspace{1em} +\pgfmathprintnumber{0.5}\hspace{1em} +\pgfmathprintnumber{1.2}\hspace{1em} +\pgfmathprintnumber{-0.6}\hspace{1em} +\pgfmathprintnumber{-1.4}\hspace{1em} +\end{codeexample} +\end{key} +\begin{key}{/pgf/number format/frac whole=\mchoice{true,false} (initially true)} + Configures whether complete integer parts shall be placed in front of the fractional part. In this case, the fractional part will be less then $1$. Use |frac whole=false| to avoid whole number parts. +\begin{codeexample}[width=3cm] +\pgfkeys{/pgf/number format/.cd,frac, frac whole=false} +\pgfmathprintnumber{20.1}\hspace{1em} +\pgfmathprintnumber{5.5}\hspace{1em} +\pgfmathprintnumber{1.2}\hspace{1em} +\pgfmathprintnumber{-5.6}\hspace{1em} +\pgfmathprintnumber{-1.4}\hspace{1em} +\end{codeexample} +\end{key} +\begin{key}{/pgf/number format/frac shift=\marg{integer} (initially 4)} + In case you experience problems because of stability problems, try experimenting with a different |frac shift|. + Higher shift values $k$ yield higher sensitivity to inaccurate data or inaccurate arithmetics. + + Technically, the following happens. If $r < 1$ is the fractional part of the mantissa, then a scale $i = 1/r \cdot 10^k$ is computed where $k$ is the shift; fractional parts of $i$ are neglected. The value $1/r$ is computed internally, its error is amplified. + + If you still experience stability problems, use |\usepackage{fp}| in your preamble. The |frac| style will then automatically employ the higher absolute precision of |fp| for the computation of $1/r$. +\end{key} +\end{key} + \begin{key}{/pgf/number format/precision=\marg{number}} Sets the desired rounding precision for any display operation. For scientific format, this affects the mantisse. \end{key} @@ -1273,7 +1505,7 @@ Allows to define an own number style for the scientific format. Here, \meta{keys -\section{Fine Tuning of Loaded Data} +\section{From Input Data To Output Tables: Data Processing} The conversion from an unprocessed input table to a final typesetted |tabular| code uses four stages for every cell, \begin{enumerate} \item Loading the table, @@ -1293,6 +1525,38 @@ Typesetting cells means to take their value and ``do something''. In many cases, Allows to redefine the algorithm which assigns cell contents. The argument |#1| is the (unformatted) contents of the input table. The resulting output needs to be written to |/pgfplots/table/@cell content|. +% \usepackage{booktabs} +% \usepackage{multirow} +\begin{codeexample}[] +% An example how to use +% \usepackage{multirow} and +% \usepackage{booktabs}: +\pgfplotstabletypeset[ + columns/Z/.style={ + column name={}, + assign cell content/.code={% use \multirow for Z column: + \ifnum\pgfplotstablerow=0 + \pgfkeyssetvalue{/pgfplots/table/@cell content} + {\multirow{4}{*}{##1}}% + \else + \pgfkeyssetvalue{/pgfplots/table/@cell content}{}% + \fi + }, + }, + % use \booktabs as well (compare examples above): + every head row/.style={before row=\toprule,after row=\midrule}, + every last row/.style={after row=\bottomrule}, + row sep=\\,col sep=&, +]{% here: inline data in tabular format: + Z & a & b \\ + data & 1 & 2 \\ + & 3 & 4 \\ + & 5 & 6 \\ + & 7 & 8 \\ +} +\end{codeexample} +\index{multirow}% +\noindent The example above uses |\usepackage{multirow}| to format column |Z|. More precisely, it uses |\multirow{4}{*}{data}| for row \#0 of column |Z| and the empty string for any other row in column |Z|. Please note that you may need special attention for |#1=|\marg{}, i.e. the empty string. This may happen if a column has less rows than the first column. \PGFPlotstable\ will balance columns automatically in this case, inserting enough empty cells to match the number of rows of the first column. @@ -1301,16 +1565,26 @@ Typesetting cells means to take their value and ``do something''. In many cases, This key is evaluated inside of a local \TeX\ group, so any local macro assignments will be cleared afterwards. \end{codekey} -\begin{key}{/pgfplots/table/assign cell content as number} - This here is the default implementation of |assign cell content|. - +\begin{stylekey}{/pgfplots/table/numeric type} + A style which (re)-defines |assign cell content| back to its original value which assumes numerical data. + It invokes |\pgfmathprintnumberto| and writes the result into |@cell content|. -\end{key} +\end{stylekey} \begin{stylekey}{/pgfplots/table/string type} A style which redefines |assign cell content| to simply return the ``raw'' input data, that means as text column. This assumes input tables with valid \LaTeX\ content (verbatim printing is not supported). \end{stylekey} +\begin{stylekey}{/pgfplots/table/verb string type} + A style which redefines |assign cell content| to return the ``raw'' as--is. Thus, it is quite similar to |string type| -- but it will return control sequences and (many, not all) special characters without expanding them. + + You may need to combine |verb string type| with |special chars|. +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/numeric as string type} + A style which redefines |assign cell content| such that it assumes numerical input data. It returns a string literal describing the input number either as integer or in scientific (exponential) notation. In contrast to |numeric type|, it does not apply number formatting. +\end{stylekey} + \begin{stylekey}{/pgfplots/table/date type=\marg{date format}}% (initially \year-\month-\day)} A style which expects ISO dates of the form |YYYY-MM-DD| in each cell and produces pretty-printed strings on output. The output format is given as \marg{date format}. Inside of \marg{date format}, several macros which are explained below can be used. % \usepackage{pgfcalendar} @@ -1343,7 +1617,6 @@ Typesetting cells means to take their value and ``do something''. In many cases, \begin{codeexample}[code only] \usepackage{pgfcalendar} \end{codeexample} -\end{stylekey} \begin{command}{\year} Inside of \marg{date format}, this macro expands to the year as number (like |2008|). @@ -1373,8 +1646,10 @@ Typesetting cells means to take their value and ``do something''. In many cases, Inside of \marg{date format}, this macro expands to the weekday's short name in the current language (like |Wed|). See below for how to change the language. \end{command} + \subsubsection*{Changing the language for dates} The date feature is implemented using the \PGF\ calendar module. This module employs the package |translator| (if it is loaded). I don't have more detail yet, sorry. Please refer to \cite{tikz} for more details. +\end{stylekey} \subsection{Preprocessing Cell Content} \label{sec:pgfplotstable:preproc} @@ -1796,6 +2071,7 @@ The following macros are useful during cell assignments: \item |\pgfplotstablerow| and |\pgfplotstablerows| which contain the current row's index and the total number of rows, respectively. See page~\pageref{pgfplotstable:page:tablerow} for details. \item \declareandlabel{\pgfmathaccuma} and \declareandlabel{\pgfmathaccumb} can be used to transport intermediate results. Both maintain their value from one column assignment to the next. All other local variables will be deleted after leaving the assignment routines. The initial value is the empty string for both of them unless they are already initialised by column creation styles. + \item \declareandlabel{\pgfplotstablename} a macro containing the name of the currently processed table (i.e.\ it contains the second argument of |\pgfplotstablecreatecol|). \item commands which are valid throughout every part of this package, for example |\pgfplotstablerow| to get the current row index or |\pgfplotstablerows| to get the total number of rows. \end{enumerate} The \marg{col name} is expected to be a \emph{physical} column name, no alias or column index is allowed (unless column indices and column names are the same). @@ -2080,6 +2356,37 @@ The example creates two columns: the |new| column is just the sum of each value This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-6}$ ($6$ significant digits in the mantisse). \end{keylist} +\begin{stylekey}{/pgfplots/table/create col/linear regression=\marg{key-value-config}}% + Computes a linear (least squares) regression $y(x) = a \cdot x + b$ using the sample data $(x_i,y_i)$ which has to be specified inside of \meta{key-value-config}. + +\begin{codeexample}[pre={\vbox\bgroup\hsize=3cm},post=\egroup] +% load table from somewhere: +\pgfplotstableread[row sep=\\]{ + x y\\ + 1 1 \\ + 2 4\\ + 3 9\\ + 4 16\\ + 5 25\\ + 6 36\\ +}\loadedtbl + +% create the `regression' column: +\pgfplotstablecreatecol[linear regression] + {regression} + {\loadedtbl} +% store slope +\xdef\slope{\pgfplotstableregressiona} + +\pgfplotstabletypeset\loadedtbl\\ + +The slope is `\slope'. +\end{codeexample} + \noindent The example above loads a table from inline data, appends a column named `|regression|' and typesets it. Since no \meta{key-value-config} has been provided, |x=[index]0| and |y=[index]1| will be used. The |\xdef\slope{...}| command stores the `$a$' value of the regression line into a newly defined macro `|\slope|'\footnote{The \texttt{\textbackslash xdef} means ``global expanded definition'': it expands the argument until it can't be expanded any further and assigns a (global) name to the result. See any \TeX\ book for details.}. + + The complete documentation for this feature has been moved to \PGFPlots\ due to its close relation to plotting. Please refer to the \PGFPlots\ manual coming with this package. +\end{stylekey} + \begin{stylekey}{/pgfplots/table/create col/function graph cut y=\marg{cut value}\marg{common options}\marg{one key-value set for each plot}} A specialized style for use in |create on use| statements which computes cuts of (one or more) discrete plots $y(x_1), \dotsc, y(x_N)$ with a fixed \marg{cut value}. The $x_i$ are written into the table's cells. @@ -2089,10 +2396,10 @@ The example creates two columns: the |new| column is just the sum of each value \begin{codeexample}[] \pgfplotstablenew[ create on use/cut/.style={create col/function graph cut y= - {2.5e-4}% search for fixed L2 = 2.5e-4 - {x=Basis,y=L2,ymode=log,xmode=log}% double log, each function is L2(Basis) -% now, provide each single function f_i(Basis): -{{table=plotdata/newexperiment1.dat},{table=plotdata/newexperiment2.dat}} + {2.5e-4} % search for fixed L2 = 2.5e-4 + {x=Basis,y=L2,ymode=log,xmode=log} % double log, each function is L2(Basis) + % now, provide each single function f_i(Basis): + {{table=plotdata/newexperiment1.dat},{table=plotdata/newexperiment2.dat}} }, columns={cut}] {2} @@ -2166,7 +2473,9 @@ The example creates two columns: the |new| column is just the sum of each value This command simply invokes |\pgfplotstabletypeset| with cleared output parameters. That means any of the column creation methods apply here as well, including any postprocessing steps (without the final typesetting). - |\pgfplotstablesave| uses the keys |reset styles| and |disable rowcol styles| to clear any typesetting related options. Furthermore, it sets |string type| to allow verbatim output. + |\pgfplotstablesave| uses the keys |reset styles| and |disable rowcol styles| to clear any typesetting related options. + + Furthermore, it sets |string type| to allow verbatim output. You may want to use |numeric as string type| instead in case you only have numerical data -- this will display integers resulting from arithmetics not in scientific notation\footnote{Note however, that |string type| doesn't round or truncate integers as well, even though they are displayed as floats.}. \begin{codeexample}[] \pgfplotstablesave[ create on use/postproc1/.style={create col/dyadic refinement rate=error1}, @@ -2227,6 +2536,10 @@ This section summarizes features of |pgfkeys|. The complete documentation can be Use |\pgfplotstableset{|\meta{key}|/.append style={|\meta{key-value-list}|}}| to append \marg{key-value-list} to the style \meta{key}. This will assume the prefix |/pgfplots/table|. \end{handler} +\begin{handler}{{.initial}=\marg{value}} + Defines a new \meta{key} and assigns \meta{value}. +\end{handler} + \begin{handler}{{.add}=\marg{before}\marg{after}} Changes \meta{key} by prepending \meta{before} and appending \meta{after}. \begin{codeexample}[] @@ -2334,9 +2647,11 @@ The value (2,0) is `\pgfplotsretval'. \paragraph{Attention:} If possible, avoid using this command inside of loops. It is quite slow. \end{command} -\begin{command}{\pgfplotstablegetrowsof\marg{file name or \textbackslash loadedtable}} +\begin{commandlist}{% + \pgfplotstablegetrowsof\marg{file name or \textbackslash loadedtable}, + \pgfplotstablegetcolsof\marg{file name or \textbackslash loadedtable}} Defines |\pgfplotsretval| to be the number of rows in a table\footnote{It will also assign \texttt{\textbackslash pgfmathresult} to the same value.}. The argument may be either a file name or an already loaded table (the \meta{\textbackslash macro} of |\pgfplotstableread|). -\end{command} +\end{commandlist} \begin{command}{\pgfplotstablevertcat\marg{\textbackslash table1}\marg{\textbackslash table2 or filename}} @@ -2383,7 +2698,7 @@ The value (2,0) is `\pgfplotsretval'. \begin{pgfplotskey}{table/input colnames to=\marg{name} (initially colnames)} Inside of |\pgfplotstabletranspose|, this key handles what to do with \emph{input} column names. - Will create a further column named \meta{name} which will be filled with the input column names (as string type). + This key will create a further column named \meta{name} which will be filled with the input column names (as string type). \begin{codeexample}[] \pgfplotstabletranspose[input colnames to=Input]\loadedtable{pgfplotstable.example3.dat} \pgfplotstabletypeset[string type]\loadedtable @@ -2400,7 +2715,7 @@ The value (2,0) is `\pgfplotsretval'. If \meta{list} is empty, all columns of the input table will be used (which is the initial configuration). - If \meta{list} is not empty, it is expected to be a list of column names. Only these columns will be used as input for the transposition, just as if the remaining one weren't there. It is acceptable to provide column aliases or |create on use| arguments inside of \meta{list}. + If \meta{list} is not empty, it is expected to be a list of column names. Only these columns will be used as input for the transposition, just as if the remaining ones weren't there. It is acceptable to provide column aliases or |create on use| arguments inside of \meta{list}. \begin{codeexample}[] \pgfplotstabletranspose[columns={a,b}]\loadedtable{pgfplotstable.example3.dat} \pgfplotstabletypeset[string type]\loadedtable @@ -2410,6 +2725,75 @@ The value (2,0) is `\pgfplotsretval'. \end{pgfplotskey} \end{commandlist} +\begin{command}{\pgfplotstablesort\oarg{options}\meta{\textbackslash resulttable}\meta{\textbackslash table or filename}} + Sorts \meta{\textbackslash table or filename} according to \meta{options} and writes the sorted table to \meta{\textbackslash resulttable}. + + Use the high level |sort| key to enable sorting automatically during |\pgfplotstabletypeset|. + +\begin{codeexample}[] +\pgfplotstablesort[row sep=\\]\result{% + a b c \\ + 19 2 [a]\\ + -6 -14 [b]\\ + 4 -14 [c]\\ + -11 -9 [d]\\ + 11 14 [e]\\ + -9 -9 [f]\\ + 1 13 [g]\\ + 8 -10 [h]\\ + 16 18 [i]\\ + 19 -6 [j]\\ +} +\pgfplotstabletypeset[columns/c/.style={string type}]{\result}% +\end{codeexample} + + The sort key and comparison function can be customized using the following keys: + \begin{key}{/pgfplots/table/sort key=\marg{column} (initially [index]0)} + Specifies the column which contains the sort key. The argument \meta{column} can be any of the columns of the input table, including |create on use|, |alias| or |[index]|\meta{integer} specifications. The initial setting uses the first available column. + \end{key} + \begin{key}{/pgfplots/table/sort key from=\marg{table} (initially empty)} + Allows to load the |sort key| from a different \meta{table}, which can be either a \meta{\textbackslash macro} or a \meta{file name}. + \end{key} + + \begin{key}{/pgfplots/table/sort cmp=\marg{less than routine} (initially float <)} + Allows to use a different comparison function. + \begin{pgfplotskeylist}{% + fixed <, + fixed >, + int <, + int >, + float <, + float >, + date <, + date >, + string <, + string >} + These styles constitute the predefined comparison functions. The |fixed <|, |int <| and |float <| routines operate on numerical data where |int <| expects positive or negative integers and the other two expect real numbers. The |fixed <| has considerably smaller number range but is slightly faster than |float <|. + + The |date <| compares dates of the form |YYYY-MM-DD|. The |string <| uses lexicographical string comparison based on the ASCII character codes of the sort keys. The |string <| routine also evaluates ASCII codes of control sequences or active characters\footnote{As long as they haven't been consumed by \TeX's preprocessing.}. +\begin{codeexample}[] +\pgfplotstablesort[row sep=\\,sort cmp=string <]\result{% + Header:\\% the column name + the\\ + quick\\ + brown\\ + fox\\ + jumps\\ + over\\ + the\\ + lazy\\ + dog\\ +} +\pgfplotstabletypeset[string type]{\result}% +\end{codeexample} + \end{pgfplotskeylist} + \begin{codeargskey}{/pgfplots/iflessthan}{#1#2#3#4} + Allows to define custom comparison functions (a strict ordering). It compares |#1 < #2| and invokes |#3| in case the comparison is true and |#4| if not. + The comparison will be evaluated in local scopes (local variables are freed afterwise). + \end{codeargskey} + \end{key} +\end{command} + \subsection{Repeating Things: Loops} \begin{command}{\foreach \meta{variables} |in| \meta{list} \marg{commands}} A powerful loop command provided by \Tikz, see~\cite[Section Utilities]{tikz}. diff --git a/Master/texmf-dist/doc/latex/pgfplots/texmf.cnf b/Master/texmf-dist/doc/latex/pgfplots/texmf.cnf index 9a104eb686c..0d1f1d5198f 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/texmf.cnf +++ b/Master/texmf-dist/doc/latex/pgfplots/texmf.cnf @@ -21,7 +21,7 @@ % For some xy-pic samples, you may need as much as 700000 words of memory. % For the vast majority of documents, 60000 or less will do. % -main_memory = 230000000 % words of inimemory available; also applies to inimf&mp +main_memory = 30000000 % words of inimemory available; also applies to inimf&mp extra_mem_top = 10000000 % extra high memory for chars, tokens, etc. extra_mem_bot = 10000000 % extra low memory for boxes, glue, breakpoints, etc. diff --git a/Master/texmf-dist/doc/latex/pgfplots/todo.txt b/Master/texmf-dist/doc/latex/pgfplots/todo.txt index baca906ec89..a64bbb6353b 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/todo.txt +++ b/Master/texmf-dist/doc/latex/pgfplots/todo.txt @@ -10,13 +10,13 @@ Testing last test verifications: pgf CVS pgf 2.00 pgf 2.00+compat=default -pgfplotstests for 1.3.1 for 1.3.1 2009-12-30 -manual for 1.3.1 for 1.3.1 -pgfplotstable.pdf for 1.3.1 for 1.3.1 -example latex for 1.3 2009-12-30 -example context for 1.3 2009-12-30 -example plain tex for 1.3 2009-12-30 -tests context 2009-12-30 +pgfplotstests for 1.4 for 1.4 2009-12-30 +manual for 1.4 for 1.4 +pgfplotstable.pdf for 1.4 for 1.4 +example latex for 1.4 2009-12-30 +example context for 1.4 2009-12-30 +example plain tex for 1.4 2009-12-30 +tests context for 1.4 I NEED MORE TESTS! The test suite needs to be developed! @@ -34,6 +34,27 @@ The test suite needs to be developed! + test those tickpos num keys! especially in combination with axis line variations. Also test ticklabel pos + + +--------------- +pgfplots 1.4 todo: +--------------- ++ improve docs on alignment things ++ document how to make multi-line legends ++ document how to add custom things into a legend (add examples) ++ fix the \ref thing for legends/colorbar. It introduces a further stroke color + somehow. ++ check if the \ref thing for legends can suppress the hyperref link color. ++ incorporate the bugfix for 'point meta=f(x)' ++ should fix the "\numplots per plot handler" feature, i.e. should allow bar + plots / line plots in the same axis with 'ybar'. ++ document new regression feature in pgfplots.pdf (is currently in + pgfplotstable.pdf) ++ document new table input in pgfplots.pdf ++ fix bugs ++ update docs for external lib + + --------------- pgfplots 1.3.1: --------------- @@ -44,15 +65,15 @@ pgfplots 1.3.1: + critical: external lib and its backw. compat layer perhaps I should disable them completely for the stable version? There are no branches, either fully CVS or not at all. -- import docs for recent number printing styles ++ import docs for recent number printing styles + set version number + set release dates for pgfplots.sty and pgfplotstable.sty + update ChangeLog to reflect the release and tag git - update ubuntu PPA -- upload sourceforge images -- release makefile -- CTAN: communicate sourceforge link -- make short, summarized changelog: +x upload sourceforge images ++ release makefile ++ CTAN: communicate sourceforge link ++ make short, summarized changelog: - improved parametric plots with gnuplot - improved normalsize, small and footnotesize scale styles and added tiny - fixed a lot of bugs @@ -72,9 +93,34 @@ MISC + disable pgfplots CVS? - documentation todo: - - pgfplots.sty: try to insert the SHA hash of the commit (for non-stable + - document the new 'getcolumnbyname={create col/....}' feature + + document linear regression + - document how to identify the source of "dimension too large" errors: + tracingstuff. + - external lib + dvi/ps + windows: it seems the ';' doesn't work; use '&' to + separate commands + - external lib: improve docs for how to deal with \label/\ref things and how + it works + - document how to fix dimension too large problems: restrict to domain for + example + + document \pgfresetboundingbox + + document how to plot against the column index + + colorbar sampled + + colorbar sampled line + - colorbar styles are not consistent between docs and code + - It seems as if the AMS command $\text{\ref{ref:to:a:plot}}$ instantiates the + \ref at least four times. Document somehow that it is better to use '\hbox' + instead + + pgfplots.sty: try to insert the SHA hash of the commit (for non-stable versions) - - pgfplotstable: the '[b]' option is mysterious in output listings. Hide it + -> echo '\def\pgfplotsrevision{'`git rev-parse HEAD`'}' > + tex/generic/pgfplots/pgfplots.revision.tex + -> this file shouldn't be part of the repo + -> load it from pgfplots.sty + -> should be updated during checkout and, probably, as post-commit + -> if it doesn't work: ok, then leave it blank. + try on windows. + + pgfplotstable: the '[b]' option is mysterious in output listings. Hide it there! - pgfplotstable: show how to use '\begin{longtable}' + gnuplot + parametric is not documented. @@ -199,7 +245,12 @@ MISC ------------------------------------------------------------- PGF / TikZ Development: ------------------------------------------------------------- - - provide '\times' or more general formatting rules to number printer + - consider a matrix style which applies only to the outer matrix node style + (see feature request + https://sourceforge.net/tracker/?func=detail&atid=1060657&aid=3019259&group_id=224188 + ) + - code 2 args doesn't work correctly with spaces between the arguments!? + + provide '\times' or more general formatting rules to number printer + external lib: implement \tikzpicturedependsonfile#1 + in pgfplots: invoke \tikzpicturedependsonfile. perhaps the plot-from-table-struct should also use it. @@ -216,8 +267,10 @@ PGF / TikZ Development: + in the manual, the first two arguments of pgfqkeysactivatesinglefamilyandfilteroptions were inverted. + some predefined filters do not process unknown options correctly - - external lib in pgf: think whether 'empty image extension' is a bug or a + + external lib in pgf: think whether 'empty image extension' is a bug or a feature. + -> feature of \pgfimage! Otherwise it wouldn't be possible to provide an extension! + -> bug for external lib which never uses extensions! - fix landscape bug (pdflscape) in external lib (PGF) + the pgf math parser has wrong precedence for '-' prefix op: exp(-x^2) is wrong. @@ -233,6 +286,216 @@ PGF / TikZ Development: BUGS / FIXES ------------------------------------------------------------- +- groupplots + extra braces or \foreach are incompatible. + +- clickable and Windows Acrobat Reader 9 has been reported to fail + +- /pgfplots/samples at and /tikz/samples at work on the same axe. Tantau says that this key support \foreach statement and thus the dotes notation. Howerver, when I want to use two or more different dots notation within pgfplots, latex crashes ! +Here is an example which clarify this issue : +\addplot+[mark=none,variable={\t}, samples at = {\foreach \x in {0,10,...,180,200,...340} {\x, }360}] ({sin(t*2)}, {cos(t)}); + +- potential incompatibility: clickable and external. The clickable lib writes + into pgfplots.djs which might cause multithreaded problems. + +- groupplots: mixing 2d/3d in one groupplot doesn't reset 'zmin,zmax' ? + + +- 'clip=false' does not disable marker clipping! + +- mark position clipping may fail: see + \begin{tikzpicture} + \begin{axis} + \addplot3[surf,shader=faceted, + scatter,mark=*, + samples=10,domain=0:1] + {x^2*y}; + \end{axis} +\end{tikzpicture} + in the manual (shader docs) + +- multiple ordinates: grid lines are drawn on top of function plots; that's bad. +Check: + I think you have to change the process line previousely invoked, and make the axes generation at the end : +1. generating adequate grid --> 2. plotting functions --> 3. creating axes, tick nodes... +You can take a minute look at figure 1 @ "The \addplot Command: Coordinate Input" section 4.2 p 19. +and you can remark that colour filling overlaps x- and y-axis ! So I suggest that you use "excute at end picture=<axis generation code>" tikz option or similar to avoid this issue. + +- patch plots: type rectangle & shader=interp & mesh input=patches doesn't work + correctly as it seems. + +- 3D axes: it is difficult to get an 1:1 correspondence to tikz. + +- 3D axes: providing three unit vectors is not sufficient, one also needs to set + 'view={}{}'. That should be done automatically. + +- 3D axes: Providing three unit vectors manually yields incorrect axis + initialisation. + +- 3D axis: provide support for manual axis configuration, + - depth (n vector), + - foreground/background, + - tick label axes, + - ... + +- Patch plots: directly transform cdata. Should simplify interpolation during + refine/triangulation etc. and shouldn't make a difference otherwise. + +manual errors of given pgfplots_unstable version: + 94 2.5.12 \addplot+[patch] --> \addplot3+[patch] +162 "xmode, ymode, zmode" and "x dir, ..." + come again on page 177 + +- don't loose \ref's when externalizing + I'll provide a minimal later + + +- incompatibility pdfpages (most recent version), MikTeX and tikz external lib + (something with shipout routine) + +- plot graphics: \ref legend doesn't work properly + +- french babel and colorbars are not fully compatible. The problem is that + colorbars use '\addplot graphics {};' with a fixed catcode for the ';' -- + which might lead to problems. + +- \ref{} legends for 'surf' in unstable version do not work properly + ++ plot graphics braucht + every legend image post/.append style={sharp plot} + +- markers should not be drawn on top of everything else. Always restore the + clipping region for each plot. + ++ extra ticks need a scope to enable drawing options: + \begin{axis}[ + extra x ticks={0.7}, + extra x tick style={ + line width=3mm, + color=red, + tickwidth=3mm, % <-- only thing applied + }, + ] + \addplot coordinates { (0,0) (1,1) }; + \end{axis} + + ++ new coordmath framework is broken for log basis. + TODO: 1. the functions must be parameterized with A) the coordmath class *and* + B) the coordmathid. + For example 'pgfmath,x' and 'pgfmath,y'. Everything else doesn't work... + +- \ref and detached legends/colorbars do NOT work with external library and + convert with system call. + -> provide special handling! + ++ providing 'thick' to linespecifications causes problems during the survey + phase: \pgfmathsetlength{} will use the FPU. + +- shader=interp,z buffer=sort ---> should use 'shader=faceted interp,faceted + color=none,z buffer=sort' instead! + +- mesh/patch plots: + - jump thing + z buffer=sort probably doesn't work + +- ternary axes: the 'marker clipping' doesn't work (naturally) + ++ shader=interp: I stumbled over a data set for which gv,xpdf,kpdf and acrobat + bail out with an error. (data file in feuersaenger's thesis) + ---> That's y varies! For x varies, it works! + +- polar axes: + + is wrong since 'near ticklabel' anchor uses pointunitx which is not correctly initialised for polar axes. + - axis equal + + data scaling needs to be disabled for X axis. + + auto tick labels work only for the case of disabledatascaling + +- contour: + the table/meta=2 default is wrong. + +- OK : 'every node near coord/.append style={scale=0.7}' + NOT OK: 'every node near coord/.append style={scale=0.7},ybar' + --> sequence of shift and scale matters ... + +- french babel and colorbars are not fully compatible. The problem is that + colorbars use '\addplot graphics {};' with a fixed catcode for the ';' -- + which might lead to problems. + +- OK : 'every node near coord/.append style={scale=0.7}' + NOT OK: 'every node near coord/.append style={scale=0.7},ybar' + --> sequence of shift and scale matters ... + ++ shader=interp: I stumbled over a data set for which gv,xpdf,kpdf and acrobat + bail out with an error. (data file in feuersaenger's thesis) + ---> That's y varies! For x varies, it works! + +- dimension too large sanity checking: TeX uses the maximum value instead. + Perhaps that can be checked? + +- provide remark at end document "Package pgfplots: consider using the preamble + command \pgfplotsset{compat=1.3} to improve label placement" + +- there are a lot of .code 2 args styles which do not support spaces between + their arguments. Fix this. + +- colormap serialization has N^2 runtime. + +- `1.23456e4;' in a log plot resulted in hard-to-read error messages. Improve + sanity checking here. + +- stack plots + log scale is wrong: it stacks visually, but that's more or less + meaningless. Try + \begin{tikzpicture} + \begin{semilogyaxis}[ + ybar stacked, + ymin=1e1, ymax=1e6, + ] + \addplot coordinates { (1,100) (2,100) }; + \addplot coordinates { (1,100) (2,1000) }; + \end{semilogyaxis} + \end{tikzpicture} + +- the title style for 'footnotesize' is not as I want it to: it doesn't respect + the depth below the baseline. Or does it need a \strut? + ++ the 'enlarge x limits={abs=3}' key doesn't work: it increases the lower + limits, but it doesn't draw any tick labels (neither major nor minor) + + ++ portability of externalized \label commands: define \tikzifinpicture which + should be part of the external separate package (in which case it is always + false). + +- avoid dimension too large errors which occur due to a data range restrictions. + Example: + data range = 0:6000 + view range = 0:1 + -> results in error. + But that's easy to detect! Just compute the point coordinate in float (after + the scaling is complete). Then, install a filter somewhere. perhaps an "a + posteriori" filter in the pointxyz command? + +- the 'colorbar sampled line' and 'colorbar left' styles are incompatible: + there are no tick lines. + +X bug in linux printer drivers: colorbar shadings are not interpolated + correctly, the interp shadings work (also the colormap sampled style). + Version: + Linux 2.6.24-26-generic #1 SMP Tue Dec 1 17:55:03 UTC 2009 x86_64 GNU/Linux + + ++ the colorbar with surf mode is too short; the 3D colorbar axis won't be scaled correctly + +- the 'at' key appears to be broken. It happens if + - pgf 2.00 is used, + - at=(anode) is used where (anode) was originally in a different axis + +- the autodetection of the '\\' list format is buggy: it should return true if + and only if the last element is '\\', not if '\\' occurs inside of the + argument. + ++ gnuplot compatibility is broken since gnuplot 4.4 changed its table format for + logscale. Excellent. + + the \pgfplots@ifgridlines@onorientedsurf@should@be@drawn#1#2 is WRONG. It works ONLY for boxed axes. All others need special handling... @@ -266,13 +529,15 @@ BUGS / FIXES - unbounded inputs: improve warning messages: they should not contain low level FPU args. -- in tick label reference: the example with \nicefrac has ymajorgrids, but ++ in tick label reference: the example with \nicefrac has ymajorgrids, but doesn't display them! Check! ->>>>>>> origin/stable:doc/latex/pgfplots/todo.txt - parametric gnuplot plots do not work correctly (see mail of Gabriel Lera) + -> require user interface method to set 'variable' and 'variable y' for this case. + Default should be 't' and 'u,v' ! - the user interface to set 'tickwidth=0' for a SINGLE axis is not very good: it seems one needs 'xtick style={/pgfplots/tickwidth=0}' to do so... + -> can be solved if tickwidth has a family, I guess. Something like 'draw' which will not be pulled by pgfplots. But then remains a problem of key paths. + the tick pos stuff works (puh!) @@ -287,7 +552,7 @@ BUGS / FIXES probably should (tests in pgfplotstest.axislines.tex). -> check also display styles for labels! -- manual: 'label style' and 'xticklabel style' are not auto-crossrefed ++ manual: 'label style' and 'xticklabel style' are not auto-crossrefed + extra ticks do not work with '3d box=complete' @@ -310,9 +575,6 @@ BUGS / FIXES -> I improved them for 2d and 3d -> needs some further checks, I guess -- the every colorbar style is more or less unusable because it is redefined by - the 'color horizontal' styles etc. Is there something more intelligent? - + reversed axes: + color bars can't be reversed; the shading disappears + reversed axes and centered axis lines: @@ -326,7 +588,7 @@ BUGS / FIXES FIXME - tickpos is wrong -- coordinate filters for log axis are not as documented: the 'unbounded coords' key won't be processed correctly. ++ coordinate filters for log axis are not as documented: the 'unbounded coords' key won't be processed correctly. - providing zmin/xmax to an axis activates 3D mode, ok -- but lower dimensional input routines appear to fail. @@ -346,9 +608,7 @@ prints without complaint). 27.11.2009 reported by J. Goebel Is that still up-to-date? NO Perhaps it should be replaced with something better? YES -- |xlabel near ticks| links to |xlabel| in manual - -- recently, I used \pgfplots@command@to@string. But: for arguments like `\table' this yields `\table ' including a space. Check if that poses harm. ++ recently, I used \pgfplots@command@to@string. But: for arguments like `\table' this yields `\table ' including a space. Check if that poses harm. + the pretty printer appends '{}' to known csnames. + the pretty printer appends ')' to |(| @@ -454,9 +714,6 @@ X change UI of ticklabel cs: provide an option 'ticklabel cs:[<interpreter>]<coo - the ybar style won't be set inside of \label{} -- fix the bug-related FIXMEs in src - -> collect them: - - + providing 'ybar stacked' to the axis and 'ybar' to each plot seems to cause problems (see test case per Mail) @@ -540,12 +797,12 @@ X change UI of ticklabel cs: provide an option 'ticklabel cs:[<interpreter>]<coo Idea: implement all that stuff when 'every axis' is used. But that has '/tikz/' has default search path... -- I fear plot gnuplot may not reflect the latest changes - at least not for 3D! - - log basis - - plots R^1 -> R^3 (parametric) ++ I fear plot gnuplot may not reflect the latest changes - at least not for 3D! + + log basis + + plots R^1 -> R^3 (parametric) + plots R^2 -> R^3 (parametric) -> may require 'u' and 'v' - - using other variable names (see 'set dummy') + + using other variable names (see 'set dummy') + ydomain is not set + the \x, \y, \z etc. macros in the table expression plotter should be @@ -1173,11 +1430,225 @@ X verschiebung des ylabels ist komisch, wegen der rotate option FEATURES ------------------------------------------------------------- -- external lib + makefile support: provide data files automatically as prereqs +- nested axes would be a nice feature. + TODO: + - update the list of global state variables + - "interrupt" these variables somehow. + - make sure local redefinitions of TikZ commands (like point commands) + work; the \let...@orig= assignments should be handled somehow. + - What about keys? They will be inherited from the outer axis... + perhaps the best would be an + \endgroup + <nested axis> + \begingroup + <restore state> + which includes the keys of the outer axis!? + +- support for "spy"glass into particular parts of an axis + +- groupplots: group-wide axis labels + +- It would be really great to have the possibility to attach a style to every nth row of a data table. For example, I would like to have a \midrule not after every line or after odd/even lines but after every fifth (or whatever) line. + + + +- new \plotnumofactualtype thing: if you set /tikz/ plot handlers in + \begin{axis}, they won't be set before the visualization phase. consequently, + I can't con't them! + Idea: add a 'family' to each of them. Or wright a coord filter which checks + for \tikz@plot@handler . Or write pgfplots styles which set them. + +- improve access to `create on use' things in \addplot table. + Ideas: + - check if a `create on use' statement for table/[xyz] exists, if so: load the complete + table. + - allow a simplified syntax like 'y=create col/linear regression{<args>}'. + This should be possible; just introduce a temporary name (or column + index). + +- Mail by Hubertus Bromberger: + + Period in legend, without the need of using the math environment? + \legend{ML spcm$.$, CW spcm$.$, ML AC}; + - Maybe a more straight forward way for legend to implement something like + shown in the graph. (see his mail .tex) + -> plot marks only at specific points. + thus, the legend image should contain both lines and marks, but there + are effectively two \addplot commands. + - As a physicist, I often have the problem to fit curves. A job gnuplot can do + very well. It should be possible using "raw gnuplot" but maybe you can either + provide an example or even implement a more straight forward way for this + purpose. + - The color scheme is not really my taste. + In CONTEXT: + cycle list={% + {Col1,mark=*}, + {Col2,mark=square*}, + {Col3,mark=diamond*}, + {Col4,mark=star}, + {Col5,mark=pentagon*}, + {Col6,mark=square*}, + {Col7,mark=diamond*}, + {Col8,mark=triangle*} }} + + \definecolor[Col1][r=0.24106,g=0.05490,b=0.90588] % blau + \definecolor[Col2][r=1,g=0.05490,b=0.06667] % rot + \definecolor[Col3][r=0.65490,g=0.73333,b=0.01176] % grün + \definecolor[Col4][r=0.08627,g=0.92549,b=0.91373] % tyrkis + \definecolor[Col5][r=1,g=0.5,b=0] % orange + \definecolor[Col6][r=0.54118,g=0.51765,b=0.51765] % grau + \definecolor[Col7][r=0.80784,g=0.49804,b=0.06275] % okker + \definecolor[Col8][r=0.74902,g=0.07451,b=0.91765] % lila + - Sometimes it would be good to have a bit more of a programming language, but + still that's not what tex is made for. The python-script looks promising, it's + just, that I think it doesn't work with context. + +- add something like + \pgfplotstabletypeset[ + cell { 1 }{ 2 }={\multirow{*}{3}{text}} + ] + +- I got several feature requests for non-cartesian axes. + Perhaps there is a way to generalize the complete procedure... as far as I + remember, I use the pointxyz routines anyway to place tick marks and so on. + Perhaps it can be reconfigured to do something "advanced". + Idea: nonlinear transformation into the axis combined with special drawing + rotuines for the axis? + ternary diagrams + http://staff.aist.go.jp/a.noda/programs/ternary/ternary-en.html. + smith charts + http://www.mathworks.com/access/helpdesk/help/toolbox/rf/f2-999699.html + http://www.siart.de/lehre/smithdgr.pdf + +- idea: 'mesh/ordering=auto'. Just check for 'x varies' and 'y varies'! The two + first points inside of a scanline are enough. + +- it is possible to output contour data into files with gnuplot (and with + matlab): + unset surface + set contour + # set cntrparam ... + set table 'P.dat' + splot [x=0:1] [y=0:1] x*y; + unset table + # contour info now in filename +- contourf: I guess filled contour plots could be possible if always two + adjacent color levels are combined into a single path which is then filled + with the simplified even/odd rule (not the winding fill rule). With the + underlying smoothness assumption C^0, there can't be any level between two + adjacent ones, and there can't be self-intersections. +- it would be very interesting to allow more flexible handling of empty lines in + input data, especially files. + For example 'empty lines=auto|scanline|nan|jump' -> allows to use "interrupted + line plots" -> contour! + Implementation ideas: + - in table: check the mode. If "nan|jump" and "previous coord was no jump": + insert a "nan nan nan.... nan" line into the table. + - in plot coords: same, but it is simpler. + - perhaps I can implement the stuff like \pgfplotsscanlinecomplete: it + should stream a coordinate if it fails. The coordinate will use + x=inf,y=inf,z=inf and all remaining fields are kept from the last valid + coordinate. Should not hurt... + - the choice "auto" could be used as follows: + 3d plot ---> use "scanline" + 2d plot ---> use "nan" + +- interesting: add "path after line segment". Idea: allow nodes on the path + \tikz \draw (0,0) -- (3,1) + node[pos=0]{0} node[pos=0.5]{1/2} node[pos=0.9]{9/10}; + -> perhaps such a feature can be the low level implementation for contour + labels. + Problems: how should the positions be determined automatically? Overlap should + be reduced somehow. + furthermore, a contour uses more than one path... + + + ++ colorbar styles: + - colorbar flat + - colorbar faceted + -> use \addplot3[surf] to draw a colorbar + - colorbar scatter + -> use \addplot3[scatter] to draw a colorbar + -> requires to set samples, and to use plot expression. Should be enough... + +- implement simplified constructions to access DIFFERENCE coordinates. + For example, \draw ellipse needs x radius and y radius. + + ++ allow to anchor an axis at any labeled node inside of it (like for a matrix) + +- it might be interesting to fill the area between two paths. Perhaps there is + such a feature in pgf; or perhaps I can generalize the \closedcycle + implementation written for stacked plots. + +- provide a \numplotsperplothandler or something like that. This would improve + things for bar plots! + +- the 'table/y index' should be changed. It should be min(numcols,1) instead of 1. + +- table package & axes should improve their communication. + Namely: + - communicate table names. + - communicate xmode/ymode + - communicate log basis [xy] + ++ provide col sep=& + +- provide and document access to (sanitized?) mesh/rows and mesh/cols fields + during the survey phase. This might allow 2d key filters + +- Praktisch fände ich, wenn man folgende Dinge spezifizieren kann: + +1. Welche Zeilen aus der Datei ausgelesen sollen (häufig gibt es nicht +nur 1, sondern mehrere Header-Zeilen, oder auch am Ende noch sonstige +Zeilen) + +2. Welche Zeichen in der Datei schlicht ignoriert werden. + +Damit würde ich es mir sparen, mein Ausgabeformat anzupassen. +Derzeit ist dies jedoch für mich die einfachste Lösung. + +- the coordindex shouldn't be changed by z buffer=sort + +- table package: provide abstract layer for low level storage interface. + Idea: the interface should allow the container interface + - push_back() + - get(i) + - set(i) + - foreach() + - pop_front() + - newempty() + - clone() + - unscope() + - startPushBackSequence() + - stopPushBackSequence() + -> this could allow to use arrays for fast algorithms. At least it would make + things easier to read. + Problem as always: the 'unscope()' operation. + Currently, I have two different structures: the applists which have fast + construction properties and the standard lists which implement the rest. + Can I combine both? Yes, by means of the incremental construction pattern: + \startPushBackSequence + \push_back + \push_back + \push_back + \stopPushBackSequence + -> inside of the construction, only \push_back is allowed and the structure is + in "locked state" (low level: applist repr) + -> Idea: the creation is fast, afterwards, it has flexibility. + ++ external lib + makefile support: provide data files automatically as prereqs + +- support \multicolumn for legends + +- it appears line breaks in legend descriptions are a problem (?) + -> bug in pgf: \\ is overwritten and won't be restored. + ++ external lib + makefile support: provide data files automatically as prereqs - pgfplotstable file open protocol: provide public listener interface -- allow to advance cycle list(s) manually ++ allow to advance cycle list(s) manually - \addplot coordinates {\macro}; @@ -1224,7 +1695,7 @@ FEATURES Perhaps its better to check if the argument is a macro (at creation time, thus only once) and call \edef#1{\string#1} to assign some sort of name to it. This will invoke \string only once. Is this faster? -- implement 'point meta=symbolic command:<cmd>' and 'point meta=command:<cmd>' ++ implement 'point meta=symbolic command:<cmd>' and 'point meta=command:<cmd>' the command should assign '\pgfplotsretval' + It would be a valueable addition if the external lib would be available for the next stable release. @@ -1458,7 +1929,7 @@ style={at={(0.05,0.05)},anchor=south west}' or something similar. + provide a simpler method to replace the '\cdot' in tick scale labels with a different sign, for example '\times'. -- provide a feature for bar plots which add the bar value as node on top of the ++ provide a feature for bar plots which add the bar value as node on top of the bar. Idea: provide some sort of "every coordinate path" - an optional feature which has access to both, the logical coordinates and the low level path coordinates @@ -1634,9 +2105,9 @@ dictionary) -- provide a public basic level API to pgfplotstable: - - access, iterate and read table elements - - manipulate elements ++ provide a public basic level API to pgfplotstable: + + access, iterate and read table elements + + manipulate elements + binary input subroutines: use a simply scaling for dimen registers. The scaling should be such it maps @@ -1805,29 +2276,7 @@ dictionary) The \prevrow and \nextrow features won't be possible (?) - improve support for multiple ordinates -- improve support for negative (reversed) axes - - 'x dir =-1' -> scale automatically - - x=-5.5cm, yticklabel pos=right, yticklabel style=left - could be a style (combined with x dir) - - the anchor names are now strange - they are mirrored :-( - \begin{tikzpicture} - - \begin{axis}[ - title={Test}, - xlabel={Time [s]}, - ylabel={Segment}, - x=0.9cm, y=-0.9mm, - %xlabel style={at={(0.5,1)}}, - %ylabel style={yshift=-6pt}, - %title style={at={(0.5,0)}}, - %xticklabel style={yshift=-6mm}, - %xticklabel pos=top, - ] - - \addplot plot coordinates {(0,30) (3,0) }; - \end{axis} - \end{tikzpicture} - - furthermore tick scale labels should be shifted ++ improve support for negative (reversed) axes @@ -1857,13 +2306,9 @@ dictionary) - what about a feature like 'draw[xmin=...,xmax=...] fitline between points (a) (b)'? -- define a 'cycle list' style which simply inserts different colors into the ++ define a 'cycle list' style which simply inserts different colors into the predefined style (thus, markers are fixed, colors vary). One could also think about a complementary style. - -> even better: I could provide up to three different lists which can be - combined. - Example: colorlist, markerlist, linespeclist - -> iterate through all possible combinations! - cycle list should be implemented using an array structure. That's faster. @@ -1915,29 +2360,8 @@ X the coordinate preparation routines should assign global registers. This would Idea: enable/disable clipping separately for each drawing command! -- provide 'only each nth coordinate' or so as style on top of 'x filter'. - -+ 3D axes: my axis is "heavy weighted". - Possible improvements: - + draw exactly 3 axis lines (unless one really wants the complete box). - + draw only one tick line per tick, in a direction which "looks well" - (one of the two possible directions). - this would also avoid double placing of tick labels in corners. - + attach tick labels generally at the end of tick lines. Provide a - distance option configuring the distance. - -> my idea: - + for "normal" orthogonal axes (i.e. view={0,0}), the tick labels - are positioned directly at tick positions using proper anchors. - + for "non-standard" axes (skewed, rotated, 3D), tick labels are placed - at anchor 'center'; but the 'at' position it computed by pgfplots: - it is positioned parallel to the surfaces' 'b' axes at a predefined - distance. - + user interface: [xy]ticklabel pos in - {left,right,top,bottom,auto,paraxial:<distance>} - -> 'auto' implements the behavior above; all other choices are user - defined. - + automatically decide WHICH axis lines shall be drawn. - + see http://mathworld.wolfram.com/EulerAngles.html ++ provide 'only each nth coordinate' or so as style on top of 'x filter'. + + implement simply style 'scatter classes'. + sanity checking feature: try if 'pgfmathfloattofixed' results in a known @@ -1959,21 +2383,12 @@ X the coordinate preparation routines should assign global registers. This would Maybe it is even faster to re-use these lists for markers than to create a new one. -- I could compute maximum PGF logical coordinates which are then inserted just - before qpointxy - + optimize the new code by re-defining \pgfqpointxy for the case of scaled standard unit vectors. X perhaps I can use pdf line annotations to improve clickable lib? -> no: there are right restrictions when using latex. -- there is a possibility to get that \label/\ref construction to work in - conjunction with image externalization: I only need to write those commands - into a separate AUX file and make sure they will remain ... even if the - generating source has been externalized. - The same could be done for javascript features; but that also requires bounding - box control. - asymmetric error bars @@ -2023,8 +2438,6 @@ X perhaps I can use pdf line annotations to improve clickable lib? + the 1000sep character should be placed for numbers >= 10000, not before. -- provide predefined style for raised dots as 1000 seps. - + improve scaled ticks: allow manual control over the automatic tick scaling. Idea: accept '[xy]scaled ticks=[false,true,auto,10^<k>,<real>]' + true = auto: as it is now. @@ -2160,18 +2573,6 @@ X re-implement 'dec sep align' of table package natively, not as high-level allows something like 'columns={A,B,A,B,A,B}' and distributes entries of input columns A and B equally to output columns. -+ TDS directory structure is not completely correct. Should be everything under - directory 'pgfplots': - $package = "pgfplots"; - &SYSTEM ("$MV README ext_scripts test doc/generic/$package/"); - &SYSTEM ("$MV generic tex/generic/$package/"); - &SYSTEM ("$MV context latex plain tex/"); - and context files should be in - tex/context/third/pgfplots/... - doc/context/third/pgfplots/... - (reference: mail conversation with Karl Berry) - - + automatic disabling of enlargelimits when axis lines are not drawn as a box + copy my personal' homepages short images to pgfplots website @@ -2179,7 +2580,7 @@ X re-implement 'dec sep align' of table package natively, not as high-level + interrupt single plots at discontinuities (for example tan(x)) -> don't draw from +infty to -infty -- optimize plot expression ++ optimize plot expression + optimize tick generation code for speed diff --git a/Master/texmf-dist/doc/plain/pgfplots/pgfplotsexample.pdf b/Master/texmf-dist/doc/plain/pgfplots/pgfplotsexample.pdf Binary files differnew file mode 100644 index 00000000000..763f8e2f590 --- /dev/null +++ b/Master/texmf-dist/doc/plain/pgfplots/pgfplotsexample.pdf diff --git a/Master/texmf-dist/source/context/third/pgfplots/pgfplotstests.zip b/Master/texmf-dist/source/context/third/pgfplots/pgfplotstests.zip Binary files differindex e279c9897e5..d4d4591871c 100644 --- a/Master/texmf-dist/source/context/third/pgfplots/pgfplotstests.zip +++ b/Master/texmf-dist/source/context/third/pgfplots/pgfplotstests.zip diff --git a/Master/texmf-dist/source/latex/pgfplots/pgfplotstests.zip b/Master/texmf-dist/source/latex/pgfplots/pgfplotstests.zip Binary files differindex e73eb57943b..601cfbf2b2c 100644 --- a/Master/texmf-dist/source/latex/pgfplots/pgfplotstests.zip +++ b/Master/texmf-dist/source/latex/pgfplots/pgfplotstests.zip diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex index 616c0730726..58664dc323d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex @@ -139,13 +139,15 @@ }% \def\pgfplotslibrarysurfstreamend{% \pgfplotsapplistXlet\pgfplotslibrarysurf@binarystream=\pgfplotslibrarysurf@binarystream@accum + \pgfplotsapplistXnewempty\pgfplotslibrarysurf@binarystream@accum }% % #1: a pgf point. % #2: a color coordinate in the range [0,1000] \def\pgfplotslibrarysurfstreamcoord#1#2{% \pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercoordinate% - \pgf@process{#1}% + %\pgf@process{#1}% this here causes `{retaining \pgf@x}' messages and pollutes the save stack! Avoid it. See \tracingrestores=2 + #1% % The idea is to map % the low-level point coordinates LINEARLY into [0,2^{8*<bytes>}]. % @@ -159,12 +161,14 @@ % The decode procedure tells the pdf viewer how to invert that % stuff. % - \pgf@sys@bp@correct\pgf@x% - \pgfplotsbinaryencodedimenmaplinearly\pgf@x + \pgf@xa=\pgf@x + \pgf@sys@bp@correct\pgf@xa% + \pgfplotsbinaryencodedimenmaplinearly\pgf@xa %\message{POINT \the\c@pgfplots@scanlineindex: ENCODING(x=\the\pgf@x)=\pgfplotsbinaryresult.}\advance\c@pgfplots@scanlineindex by1 \t@pgfplots@toka=\expandafter{\pgfplotsbinaryresult}% - \pgf@sys@bp@correct\pgf@y% - \pgfplotsbinaryencodedimenmaplinearly\pgf@y + \pgf@ya=\pgf@y + \pgf@sys@bp@correct\pgf@ya% + \pgfplotsbinaryencodedimenmaplinearly\pgf@ya %\message{ENCODING(y=\the\pgf@y)=\pgfplotsbinaryresult.}% \t@pgfplots@tokb=\expandafter{\pgfplotsbinaryresult}% {% diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex index bb5ea8de194..5086fef9d47 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex @@ -28,6 +28,8 @@ \def\pgfplots@group@xticklabels{} \def\pgfplots@group@yticklabels{} +\def\pgfplots@group@xlabels{} +\def\pgfplots@group@ylabels{} \def\pgfplots@group@totalplots{1} \def\pgfplots@group@columns{1} \def\pgfplots@group@rows{1} @@ -54,14 +56,38 @@ /pgfplots/group/shared labels=false, /pgfplots/group/xticklabels at/.is choice, /pgfplots/group/xticklabels at/all/.code=\def\pgfplots@group@xticklabels{all}, - /pgfplots/group/xticklabels at/edge top/.code=\def\pgfplots@group@xticklabels{edgeT}, - /pgfplots/group/xticklabels at/edge bottom/.code=\def\pgfplots@group@xticklabels{edgeB}, + /pgfplots/group/xticklabels at/edge top/.code=\def\pgfplots@group@xticklabels{upper}, + /pgfplots/group/xticklabels at/edge bottom/.code=\def\pgfplots@group@xticklabels{lower}, /pgfplots/group/xticklabels at=all, /pgfplots/group/yticklabels at/.is choice, /pgfplots/group/yticklabels at/all/.code=\def\pgfplots@group@yticklabels{all}, - /pgfplots/group/yticklabels at/edge left/.code=\def\pgfplots@group@yticklabels{edgeL}, - /pgfplots/group/yticklabels at/edge right/.code=\def\pgfplots@group@yticklabels{edgeR}, + /pgfplots/group/yticklabels at/edge left/.code=\def\pgfplots@group@yticklabels{left}, + /pgfplots/group/yticklabels at/edge right/.code=\def\pgfplots@group@yticklabels{right}, /pgfplots/group/yticklabels at=all, + /pgfplots/group/xlabels at/.is choice, + /pgfplots/group/xlabels at/all/.code=\def\pgfplots@group@xlabels{all}, + /pgfplots/group/xlabels at/edge top/.code=\def\pgfplots@group@xlabels{upper}, + /pgfplots/group/xlabels at/edge bottom/.code=\def\pgfplots@group@xlabels{lower}, + /pgfplots/group/xlabels at=all, + /pgfplots/group/ylabels at/.is choice, + /pgfplots/group/ylabels at/all/.code=\def\pgfplots@group@ylabels{all}, + /pgfplots/group/ylabels at/edge left/.code=\def\pgfplots@group@ylabels{left}, + /pgfplots/group/ylabels at/edge right/.code=\def\pgfplots@group@ylabels{right}, + /pgfplots/group/ylabels at=all, + /pgfplots/group/x descriptions at/.is choice, + /pgfplots/group/x descriptions at/all/.style= + {/pgfplots/group/xlabels at=all,/pgfplots/group/xticklabels at=all}, + /pgfplots/group/x descriptions at/edge bottom/.style= + {/pgfplots/group/xlabels at=edge bottom, /pgfplots/group/xticklabels at=edge bottom}, + /pgfplots/group/x descriptions at/edge top/.style= + {/pgfplots/group/xlabels at=edge top, /pgfplots/group/xticklabels at=edge top}, + /pgfplots/group/y descriptions at/.is choice, + /pgfplots/group/y descriptions at/all/.style= + {/pgfplots/group/ylabels at=all, /pgfplots/group/yticklabels at=all}, + /pgfplots/group/y descriptions at/edge left/.style= + {/pgfplots/group/ylabels at=edge left, /pgfplots/group/yticklabels at=edge left}, + /pgfplots/group/y descriptions at/edge right/.style= + {/pgfplots/group/ylabels at=edge right, /pgfplots/group/yticklabels at=edge right}, /pgfplots/group/group name/.store in=\pgfplots@group@name, /pgfplots/group/empty plot/.style={/pgfplots/hide axis=true}, } @@ -83,6 +109,7 @@ % If there has been other plots before then end the plot % \ifnum0<\pgfplots@group@current@plot\relax + % DEBUG: \message{DEBUG: Ending plot} \endpgfplots@environment@opt \fi % Prepare for next plot, increment plot, row and column @@ -148,10 +175,97 @@ \fi% } +% +% Determine the labels of both x and y. +% +\def\pgfplots@group@determine@labels{% + \def\pgfplots@loc@TMPa{all} + \def\pgfplots@loc@TMPb{lower} + \ifx\pgfplots@loc@TMPa\pgfplots@group@xlabels% + % xlabels at=all + % Do nothing as all should have xlabels + \fi + \gdef\pgfplots@glob@TMPa{} + \ifx\pgfplots@loc@TMPb\pgfplots@group@xlabels% + % xlabels at=lower + \ifnum1<\pgfplots@group@rows\relax + \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {% + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \ifnum\pgfplots@row=\pgfplots@group@rows\relax% + \else + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xlabel={}}}% + \fi + }% + }% + \fi% + \else + \def\pgfplots@loc@TMPb{upper}% + \ifx\pgfplots@loc@TMPb\pgfplots@group@xlabels% + % xlabels at=upper + \ifnum1<\pgfplots@group@rows\relax + \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {% + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \ifnum\pgfplots@row=1 % + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xticklabel pos=upper}}% + \else + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xlabel={}}}% + \fi + }% + }% + \fi% + \fi + \fi + % + % Defining styles for the y's + % + \ifx\pgfplots@loc@TMPa\pgfplots@group@ylabels% + % ylabels at=all + % Do nothing as all should have ylabels + \else + \def\pgfplots@loc@TMPb{left}% + \ifx\pgfplots@loc@TMPb\pgfplots@group@ylabels% + % ylabels at=left + \ifnum1<\pgfplots@group@columns\relax + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \foreach \pgfplots@column in {2,...,\pgfplots@group@columns} {% + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/ylabel={}}}% + }% + }% + \fi% + \else + \def\pgfplots@loc@TMPb{right}% + \ifx\pgfplots@loc@TMPb\pgfplots@group@ylabels% + % ylabels at=right + \ifnum1<\pgfplots@group@columns\relax + \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {% + \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {% + \ifnum\pgfplots@column=\pgfplots@group@columns\relax + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/yticklabel pos=upper}}% + \else + \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{% + \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/ylabel={}}}% + \fi + }% + }% + \fi + \fi% + \fi + \fi + \expandafter\pgfkeys\expandafter{\pgfplots@glob@TMPa} +} + +% +% Determine the ticklabels of both x and y. +% \def\pgfplots@group@determine@ticklabels{% \def\pgfplots@loc@TMPa{all} - \def\pgfplots@loc@TMPb{edgeT} - \def\pgfplots@loc@TMPc{edgeB} + \def\pgfplots@loc@TMPb{upper} + \def\pgfplots@loc@TMPc{lower} \ifx\pgfplots@loc@TMPa\pgfplots@group@xticklabels% % Do nothing as all should have xticklabels \fi @@ -184,8 +298,8 @@ % % Defining styles for the ytick's % - \def\pgfplots@loc@TMPb{edgeL} - \def\pgfplots@loc@TMPc{edgeR} + \def\pgfplots@loc@TMPb{left} + \def\pgfplots@loc@TMPc{right} \ifx\pgfplots@loc@TMPa\pgfplots@group@yticklabels% % Do nothing as all should have yticklabels \fi @@ -307,6 +421,7 @@ % \pgfplots@group@individual@setup \pgfplots@group@determine@ticklabels + \pgfplots@group@determine@labels \pgfplots@group@current@plot=0% \pgfplots@group@current@row=1% \pgfplots@group@current@column=0% diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex index 5326db78aba..084d076b289 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex @@ -64,21 +64,21 @@ /pgfplots/x unit/.initial={},% /pgfplots/x unit prefix/.initial={},% /pgfplots/change x base/.is if=pgfplots@units@change@x@base,% - /pgfplots/change x base/.initial=false,% + /pgfplots/change x base=false,% % % Setup basic y settings % /pgfplots/y unit/.initial={},% /pgfplots/y unit prefix/.initial={},% /pgfplots/change y base/.is if=pgfplots@units@change@y@base,% - /pgfplots/change y base/.initial=false,% + /pgfplots/change y base=false,% % % Setup basic z settings % /pgfplots/z unit/.initial={},% /pgfplots/z unit prefix/.initial={},% /pgfplots/change z base/.is if=pgfplots@units@change@z@base,% - /pgfplots/change z base/.initial=false,% + /pgfplots/change z base=false,% % % default markings of units. I.e. the surroundings of the unit: % [unit markings=curly braces] yields {<unit>} @@ -221,4 +221,4 @@ \fi% \fi% } -\endinput
\ No newline at end of file +\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 index 7464dc43876..d62273eca51 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex @@ -96,6 +96,15 @@ \fi } +% #1 the array's name (a macro name +% #2 a list created by \pgfplotslistnew +\def\pgfplotsarrayfrompgfplotslist#1#2{% + \pgfplotsarraynewempty#1% + \pgfplotslistforeachungrouped#2\as\pgfplotsarray@TMPa{% + \expandafter\pgfplotsarraypushback\expandafter{\pgfplotsarray@TMPa}\to#1% + }% +}% + \def\pgfplotsarraynew@backslash#1#2{% \pgfplotsarraynewempty{#1}% \long\def\pgfplotsarraynew@impl@rest{#2}% @@ -199,6 +208,9 @@ \def\pgfplotsarrayselect#1\of#2\to#3{% \c@pgfplotsarray@tmp=#1\relax \expandafter\let\expandafter#3\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname% + \ifx#3\relax + \pgfplotsthrow{no such element}{#1}{No such element: \string\pgfplotsarrayselect\the\c@pgfplotsarray@tmp\string\of{\string#2}}\pgfeov% + \fi } % Expands to the value at index #1 of array #2. @@ -315,12 +327,7 @@ \let\pgfplotsarrayforeachindex=\relax% } -% #1: arg1 (possibly not fully expanded) -% #2: arg2 (possibly not fully expanded) -% #3: code to invoke in case arg1<arg2 -% #4: code to invoke in case arg1>=arg2 \pgfkeys{% - /pgfplots/array/iflessthan/.code args={#1#2#3#4}{\ifnum#1<#2\relax#3\else#4\fi},% /pgfplots/array/unscope pre/.code={% % That's more or less efficient (although some runtime factors % could be saved). @@ -349,7 +356,8 @@ % Sorts array '#1' using N log N time. % % The sort key is provided as argument in -% /pgfplots/array/iflessthan/.code args={#1#2#3#4}, see above. +% /pgfplots/iflessthan/.code args={#1#2#3#4}, see docs in +% pgfplotsutil.code.tex. % % Remarks: % - the sorting algorithm is a sub-optimal mergesort currently - @@ -400,13 +408,22 @@ % [\pgfplotsarrayforeach\testarray\as\elem{\elem\space}] % %-------------------------------------------------- -\def\pgfplotsarraysort#1{% +\def\pgfplotsarraysort{% + \pgfutil@ifnextchar[{\pgfplotsarraysort@opt}{\pgfplotsarraysort@opt[]}% +}% +\def\pgfplotsarraysort@opt[#1]#2{% % I admit, the implementation is more-or less copy-paste of an % experiment I had done at university. It does its job, but it is - % certainly not optimal. + % certainly not optimal (that means: it is slow). \begingroup - \pgfkeysgetvalue{/pgfplots/array/iflessthan/.@cmd}\pgfplotsarraysort@iflt - \pgfplotsarraysize{#1}\to\c@pgfplotsarray@tmp + \pgfqkeys{/pgfplots/array}{#1}% + \pgfkeysifdefined{/pgfplots/array/iflessthan/.@cmd}{% + \pgfplots@warning{Warning: /pgfplots/array/iflessthan/.@cmd is deprecated. Please use /pgfplots/iflessthan/.@cmd instead.}% + \pgfkeysgetvalue{/pgfplots/array/iflessthan/.@cmd}\pgfplotsarraysort@iflt + }{% + \pgfkeysgetvalue{/pgfplots/iflessthan/.@cmd}\pgfplotsarraysort@iflt + }% + \pgfplotsarraysize{#2}\to\c@pgfplotsarray@tmp \pgfplotsarrayresizeglobal{pgfparraytmp}{\the\c@pgfplotsarray@tmp}% \countdef\c@pgfplotsarraysort@m=0 \countdef\c@pgfplotsarraysort@k=1 @@ -414,15 +431,15 @@ \countdef\c@pgfplotsarraysort@l=3 \countdef\c@pgfplotsarraysort@j=4 \countdef\c@pgfplotsarraysort@q=5 - \def\pgfplotsarray@mergesort@{\pgfplotsarray@mergesort{#1}}% - \def\pgfplotsarray@mergesort@recurse@{\pgfplotsarray@mergesort@recurse{#1}}% + \def\pgfplotsarray@mergesort@{\pgfplotsarray@mergesort{#2}}% + \def\pgfplotsarray@mergesort@recurse@{\pgfplotsarray@mergesort@recurse{#2}}% \edef\pgfplotsarray@mergesort@@{{0}{\the\c@pgfplotsarray@tmp}}% \expandafter\pgfplotsarray@mergesort@\pgfplotsarray@mergesort@@ % % copy the complete, sorted result outside of the current scope. - \pgfkeysvalueof{/pgfplots/array/unscope pre/.@cmd}#1\pgfeov + \pgfkeysvalueof{/pgfplots/array/unscope pre/.@cmd}#2\pgfeov \endgroup - \pgfkeysvalueof{/pgfplots/array/unscope post/.@cmd}#1\pgfeov + \pgfkeysvalueof{/pgfplots/array/unscope post/.@cmd}#2\pgfeov }% % #1: array name, @@ -473,20 +490,27 @@ \c@pgfplotsarraysort@j=\c@pgfplotsarraysort@k \advance\c@pgfplotsarraysort@j by#2 \pgfplotsarrayselect{\c@pgfplotsarraysort@j}\of{#1}\to\pgfplotsarray@x@k + \begingroup \pgfplotsarraysort@iflt {\pgfplotsarray@x@mpl}% {\pgfplotsarray@x@k}% {% x[m+l] < x[k] - \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@mpl - \advance\c@pgfplotsarraysort@i by1 - \advance\c@pgfplotsarraysort@l by1 + \aftergroup\pgfplots@loc@tmptrue }% {% x[k] <= x[m+l] - \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@k - \advance\c@pgfplotsarraysort@i by1 - \advance\c@pgfplotsarraysort@k by1 + \aftergroup\pgfplots@loc@tmpfalse }% \pgfeov + \endgroup + \ifpgfplots@loc@tmp + \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@mpl + \advance\c@pgfplotsarraysort@i by1 + \advance\c@pgfplotsarraysort@l by1 + \else + \pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@k + \advance\c@pgfplotsarraysort@i by1 + \advance\c@pgfplotsarraysort@k by1 + \fi \pgfutil@repeat % % append: diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex index 87ce40e586b..b60ff65c4f7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex @@ -78,59 +78,85 @@ % Use braces '{}' to use '\\' or ',' as arguments. % \long\def\pgfplotslistnew#1#2{% - \pgfplots@check@backwards@compatible@list@format #2\\\pgfplots@EOI - \ifpgfplots@is@old@list@format - \pgfplotslistnew@backslash{#1}{#2}% + \pgfplotslist@check@backslash@list #2\\\pgfplotslist@EOI + \ifpgfplotslist@is@backslash@terminated + \pgfplotslistnew@backslash@{#1}{#2}% \else \pgfplots@foreach@to@list{#2}\to#1% \fi } +% Is this here *ever* used!? I guess not. \long\def\pgfplotslistnew@backslash#1#2{% \pgfplotslistnewempty{#1}% - \long\def\pgfplotslistnew@impl@rest{#2}% \pgfplotslist@check@backslash@list #2\\\pgfplotslist@EOI \ifpgfplotslist@is@backslash@terminated + \long\def\pgfplotslistnew@impl@rest{#2\pgfplotslist@EOI\\}% + \def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl{#1}}% \else - \expandafter\def\expandafter\pgfplotslistnew@impl@rest\expandafter{\pgfplotslistnew@impl@rest,}% + \def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl@comma{#1}}% + \long\def\pgfplotslistnew@impl@rest{#2\pgfplotslist@EOI,}% \fi - \pgfutil@loop - \ifx\pgfplotslistnew@impl@rest\pgfutil@empty - \pgfplots@loop@CONTINUEfalse + \expandafter\pgfplotslistnew@backslash@loop\pgfplotslistnew@impl@rest +}% +\long\def\pgfplotslistnew@backslash@#1#2{% + \pgfplotslistnewempty{#1}% + \def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl{#1}}% + \pgfplotslistnew@backslash@loop#2\pgfplotslist@EOI\\% +}% + +% helper macro for \pgfplotslistnew +\long\def\pgfplotslistnew@impl#1#2\\{% + \def\pgfplotslist@loc@TMPa{#2}% + \ifx\pgfplotslist@loc@TMPa\pgfplotslist@EOI \else - \pgfplots@loop@CONTINUEtrue + \pgfplotslistpushback{#2}\to#1\relax% + \expandafter\pgfplotslistnew@backslash@loop \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 - \pgfutil@repeat -}% +} +\long\def\pgfplotslistnew@impl@comma#1#2,{% + \def\pgfplotslist@loc@TMPa{#2}% + \ifx\pgfplotslist@loc@TMPa\pgfplotslist@EOI + \else + \pgfplotslistpushback{#2}\to#1\relax% + \expandafter\pgfplotslistnew@backslash@loop + \fi +} \def\pgfplotslist@EOI{\pgfplotslist@EOI} +\def\pgfplotslist@backslashsep{\\} \long\def\pgfplotslist@check@backslash@list#1\\#2\pgfplotslist@EOI{% - \def\pgfplotslist@loc@TMPa{#2}% - \ifx\pgfplotslist@loc@TMPa\pgfutil@empty + \def\pgfplotslist@loc@TMPx{#2}% + \ifx\pgfplotslist@loc@TMPx\pgfutil@empty \pgfplotslist@is@backslash@terminatedfalse + \let\pgfplotslist@check@backslash@list@next=\relax \else - \pgfplotslist@is@backslash@terminatedtrue + \def\pgfplotslist@loc@TMPy{ }% + \ifx\pgfplotslist@loc@TMPx\pgfplotslist@loc@TMPy + \pgfplotslist@is@backslash@terminatedfalse + \let\pgfplotslist@check@backslash@list@next=\relax + \else + \ifx\pgfplotslist@loc@TMPx\pgfplotslist@backslashsep + % ok. The list is something like 'a\\b\\' so the + % complete input is + % 'a\\b\\ \\ \EOI' + % we have iterated long enough to find only the '\\' + % right before the \EOI. It is thus backslash + % terminated. + \pgfplotslist@is@backslash@terminatedtrue + \let\pgfplotslist@check@backslash@list@next=\relax + \else + % Iterate. We want to check the last list element. + \long\def\pgfplotslist@check@backslash@list@next{\pgfplotslist@check@backslash@list#2\pgfplotslist@EOI}% + \fi + \fi \fi + \pgfplotslist@check@backslash@list@next }% % 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 diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex index 157f8874691..b2c3d7bf946 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -1,6 +1,6 @@ %-------------------------------------------- % -% Package numtable +% Package pgfplotstable % % Provides support to read and work with abstact numeric tables of the % form @@ -11,7 +11,7 @@ % 1e124 0.00001 1.2345e-12 % ... % -% Copyright 2007/2008 by Christian Feuersänger. +% Copyright 2007-2010 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 @@ -32,45 +32,18 @@ % This file provides a high-level table manipulation and typesetting % package. % -% -% --------------------------------------------- -% Implementation notes for programmers: -% --------------------------------------------- -% -% The table data structure consists of -% 1. A name which must be a valid TeX macro like '\table' -% 2. A column list in the \pgfplotslist format. -% In fact, the column list is stored in the table's name: -% \pgfplotslistnewempty\table -% 3. A "file name" stored in -% \csname\string<\namemacro>@@table@name\endcsname -% 4. A "scan line length" number stored in -% \csname\string<\namemacro>@@table@scanline\endcsname -% It contains the value of \pgfplotsscanlinelength which has -% been identified right after \pgfplotstableread. -% 5. foreach column, there is a list of row-values (a row-vector) in -% the \pgfplotslist format named -% \csname\string<\namemacro>@<column name>\endcsname -% +% see pgfplotstableshared.code.tex for the low level routines. -\newif\ifpgfplotstable@search@header -\newif\ifpgfplotstable@firstline@is@header -\newcount\c@pgfplotstable@counta -\newwrite\pgfplotstable@outfile \newif\ifpgfplotstabletypesetdebug +\newif\ifpgfplotstable@sort \newif\ifpgfplotstabletypesetskipcoltypes \newif\ifpgfplotstabletypesetresult \newif\ifpgfplotstableuserow \newif\ifpgfplotstabletypeset@includeoutfiles \newif\ifpgfplotstabletypeset@force@remake -\newif\ifpgfplots@addplotimpl@readcompletely \newif\ifpgfplotstable@disable@rowcolstyles -% should always be false; use only in grouped internal macros -\newif\ifpgfplots@table@options@areset -\newif\ifpgfplots@tableread@to@listener -\newif\ifpgfplots@tableread@use@begingroup \input pgfplotstable.coltype.code.tex @@ -96,34 +69,6 @@ % /pgfplots/table/display columns/<col index>/.style={} % /pgfplots/table/create on use/<col name>/.style={create options} \pgfkeys{% - /pgfplots/table/header/.is choice, - /pgfplots/table/header/true/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headertrue}, - /pgfplots/table/header/false/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headerfalse}, - /pgfplots/table/header/has colnames/.code={\pgfplotstable@firstline@is@headertrue\pgfplotstable@search@headerfalse}, - /pgfplots/table/header=true, - /pgfplots/table/x index/.initial=0, - /pgfplots/table/x/.initial=, - /pgfplots/table/x expr/.initial=, - /pgfplots/table/y index/.initial=1, - /pgfplots/table/y/.initial=, - /pgfplots/table/y expr/.initial=, - /pgfplots/table/z index/.initial=2, - /pgfplots/table/z/.initial=, - /pgfplots/table/z expr/.initial=, - /pgfplots/table/meta index/.initial=, - /pgfplots/table/meta/.initial=, - /pgfplots/table/meta expr/.initial=, - /pgfplots/table/x error index/.initial=, - /pgfplots/table/y error index/.initial=, - /pgfplots/table/z error index/.initial=, - /pgfplots/table/x error/.initial=, - /pgfplots/table/y error/.initial=, - /pgfplots/table/z error/.initial=, - /pgfplots/table/x error expr/.initial=, - /pgfplots/table/y error expr/.initial=, - /pgfplots/table/z error expr/.initial=, - /pgfplots/table/read completely/.is if=pgfplots@addplotimpl@readcompletely, - /pgfplots/table/read completely/.default=true, /pgfplots/table/disable rowcol styles/.is if=pgfplotstable@disable@rowcolstyles, /pgfplots/table/disable rowcol styles/.default=true, /pgfplots/table/row predicate/.code={}, @@ -173,30 +118,38 @@ \pgfkeys{/pgfplots/table/row predicate/.append code={% \ifnum\pgfplotstablerow=0 \ifnum\pgfplotstablecol=0 + \pgfutil@ifundefined{pgfplotstable@unique@bitlist@backup}{% + }{% + \pgfplots@error{It seems there are *multiple* 'unique' keys running on one table. That doesn't work correctly, I guess. Consider using '\string\pgfplotstableset{row predicate/.code={}}' to reset it.}% + }% % PREPARE ONCE! Assemble the boolean results into % a list which is used for the complete table: - \expandafter\pgfplotstablegetcolumnfromstruct\expandafter{\expandafter\pgfplotstablecolname\expandafter}\expandafter\of\pgfplotstablename\to\pgfplotstable@unique@col + \def\pgfplotstable@loc@TMPd{\pgfplotstablegetcolumnfromstruct{#1}\of}% + \expandafter\pgfplotstable@loc@TMPd\pgfplotstablename\to\pgfplotstable@unique@col \pgfplotslistnewempty\pgfplotstable@unique@bitlist - \let\pgfplotstable@unique@LAST=\relax + \let\pgfplotstable@unique@LAST=\pgfutil@empty \pgfplotslistforeachungrouped\pgfplotstable@unique@col\as\pgfplotstable@unique@cur{% \def\pgfplotstable@unique@bit{1}% - \ifx\pgfplotstable@unique@LAST\relax + \ifx\pgfplotstable@unique@LAST\pgfutil@empty \else \ifx\pgfplotstable@unique@LAST\pgfplotstable@unique@cur \def\pgfplotstable@unique@bit{0}% \fi \fi + \ifpgfplotstabletypesetdebug + \pgfplots@message{unique={#1}: cur == last <=> ( \pgfplotstable@unique@cur\space == \pgfplotstable@unique@LAST ) = \pgfplotstable@unique@bit.}% + \fi \expandafter\pgfplotslistpushback\pgfplotstable@unique@bit\to\pgfplotstable@unique@bitlist \let\pgfplotstable@unique@LAST=\pgfplotstable@unique@cur }% \global\let\pgfplotstable@unique@bitlist@backup=\pgfplotstable@unique@bitlist \else - \ifx\pgfplotstable@unique@bitlist@backup\relax + \pgfutil@ifundefined{pgfplotstable@unique@bitlist@backup}{% % this sanity checking is NOT fool proof: it % fails if there are different occurances of % unique in the same file - \pgfplotstable@error{Sorry, the row predicate /pgfplots/table/unique={#1} has been used in the wrong context: it needs to be invoked for the very first processed column, not column no \pgfplotstablecol. Please provide it as argument to \string\pgfplotstabletypeset[unique={#1}] and not inside of column-specific styles.}% - \fi + \pgfplotstable@error{Sorry, the row predicate /pgfplots/table/unique={#1} has been used in the wrong context: it needs to be invoked for the very first processed column, not column no \pgfplotstablecol. Please provide it as argument to \string\pgfplotstabletypeset[unique={#1}] and not inside of column-specific styles}% + }{}% \fi % acquire the assembled list here: we'll do a lot of % popfronts with it. @@ -212,16 +165,18 @@ \pgfplotstableuserowfalse \fi \fi + % cleanup: + {% + \count0=\pgfplotstablecol\relax \advance\count0 by1 + \ifnum\count0=\pgfplotstablecols\relax + \count0=\pgfplotstablerow\relax \advance\count0 by1 + \ifnum\count0=\pgfplotstablerows\relax + \global\let\pgfplotstable@unique@bitlist@backup=\relax + \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/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}}, - /pgfplots/table/col sep=space, % columns={name1,name2} % or % columns={[index]2,name2,name3,[index]5} @@ -377,7 +332,6 @@ }, /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={}, @@ -402,6 +356,7 @@ /pgfplots/table/skip coltypes/.is if=pgfplotstabletypesetskipcoltypes, /pgfplots/table/skip coltypes/.default=true, /pgfplots/table/debug/.is if=pgfplotstabletypesetdebug, + /pgfplots/table/debug level/.initial=0,% % % will be redefined by |assign cell content| for every cell: /pgfplots/table/@cell content/.initial=, @@ -427,11 +382,32 @@ \fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, + /pgfplots/table/numeric type/.code={% + \pgfkeysgetvalue{/pgfplots/table/assign cell content as number/.@cmd}\pgfplotstable@loc@TMPa% + \pgfkeyslet{/pgfplots/table/assign cell content/.@cmd}\pgfplotstable@loc@TMPa + }, /pgfplots/table/string type/.style={% /pgfplots/table/assign cell content/.style={% /pgfplots/table/@cell content={##1}% }% },% + /pgfplots/table/verb string type/.style={% + /pgfplots/table/assign cell content/.code={% + \def\pgfplotstable@loc@TMPa{##1}% + \pgfplots@command@to@string\pgfplotstable@loc@TMPa\pgfplotstable@loc@TMPa + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfplotstable@loc@TMPa}% + }% + },% + /pgfplots/table/numeric as string type/.style={% + /pgfplots/table/assign cell content/.code={% + \def\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathifisint{##1}{\let\pgfmathresult=\pgfretval}{\pgfmathfloattosci{\pgfretval}}% + \fi + \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult + }% + },% /pgfplots/table/date type/.style={% /pgfplots/table/assign cell content/.code={% \begingroup @@ -659,6 +635,19 @@ \fi }% }, + /pgfplots/table/create col/linear regression/.code={% + \pgfplotstable@linear@regression{#1}% + \pgfkeysalso{/pgfplots/table/create col/@from list struct=\pgfplotsretval}% + }, + /pgfplots/table/create col/linear regression/.default=,% + /pgfplots/table/create col/linear regression/x/.initial=,% + /pgfplots/table/create col/linear regression/y/.initial=,% + /pgfplots/table/create col/linear regression/table/.initial=,% + /pgfplots/table/create col/linear regression/variance/.initial=,% + /pgfplots/table/create col/linear regression/variance list/.initial=,% + /pgfplots/table/create col/linear regression/variance src/.initial=,% + /pgfplots/table/create col/linear regression/xmode/.initial=,% auto + /pgfplots/table/create col/linear regression/ymode/.initial=,% auto /pgfplots/table/create col/quotient/.style={% /pgfplots/table/columns={#1}, /pgfplots/table/create col/assign first/.style={% @@ -814,12 +803,16 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \ifdim\pgfmathdiff@x pt=0.0pt + % FPU is more robust: + \pgfmathfloatparsenumber\pgfmathdiff@x\let\pgfmathdiff@x=\pgfmathresult + \pgfmathfloatparsenumber\pgfmathdiff@y\let\pgfmathdiff@y=\pgfmathresult + \pgfplots@ifzero\pgfmathdiff@x{% \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% - \else - \pgfmathdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% - \fi + }% \else % \pgfmathfloatcreate{3}{0.0}{0}% % \pgfmathfloattosci@\pgfmathresult @@ -921,18 +914,14 @@ }, /pgfplots/table/colnames from/.initial=,% for \pgfplotstabletranspose /pgfplots/table/input colnames to/.initial=colnames,% for \pgfplotstabletranspose -} -\pgfkeys{ - % #1: the argument which should have been assigned. - % #2: an error message. - /pgfplots/exception/non unique colname/.code 2 args={% - \ifx\pgfplotsexceptionmsg\relax - \pgfplots@error{#2}% - \else - \pgfplots@error{\pgfplotsexceptionmsg}% - \fi - \let#1=\pgfutil@empty - },% + /pgfplots/table/sort/.is if=pgfplotstable@sort, + /pgfplots/table/sort/.default=true, + /pgfplots/table/sort key/.initial=[index]0,% + % the argument of `sort cmp' will be evaluates as style in the key + % path /pgfplots/. See pgfplotsutil.code.tex for available + % styles. + /pgfplots/table/sort cmp/.initial=float <, + /pgfplots/table/sort key from/.initial=, } % 'function graph cut y'={<epsilon>}{<options>}{comma-separated-list of specs where to get yi} % @@ -946,8 +935,8 @@ % \pgfplotstableset{ % create on use/cut/.style={create col/function graph cut y={7e-4}{x=Basis,ymode=log,xmode=log}{{table=regtable,y=special-L2}}}, %} -\pgfkeysdefargs{/pgfplots/table/create col/function graph cut y}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{y}{x}} -\pgfkeysdefargs{/pgfplots/table/create col/function graph cut x}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{x}{y}} +\pgfkeysdefnargs{/pgfplots/table/create col/function graph cut y}{3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{y}{x}} +\pgfkeysdefnargs{/pgfplots/table/create col/function graph cut x}{3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{x}{y}} \pgfkeys{% /pgfplots/table/create col/function graph cut/xmode/.is choice, /pgfplots/table/create col/function graph cut/xmode/linear/.code={\def\pgfplotstable@fgc@xmode{0}},% @@ -995,116 +984,6 @@ }% }% -% \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. -% -% \pgfplotstableread[<options>]{<file>}{<\macro>} -% \pgfplotstableread[<options>]{<file>} to listener{<\macro>} -% -% The 'to listener' variant does NOT assemble a table data structure. -% Instead, it processes the input table row-wise and invokes <\macro> -% after each complete row. During the evaluation of <\macro>, the -% following methods can be used to query values: -% \pgfplotstablereadgetcolindex{<index>}{<\macro>} -% \pgfplotstablereadgetcolname{<name>}{<\macro>} -% \pgfplotstablereadvalueofcolname{<name>} -% \pgfplotstablereadvalueofcolindex{<index>} -% \thisrow{<name>} (equivalent to \pgfplotstablereadvalueofcolname) -% \getthisrow{<name>}{<\macro>} (equivalent to \pgfplotstablereadgetcolname) -% \thisrowno{<index>} (equivalent to \pgfplotstablereadvalueofcolindex) -% \getthisrowno{<index>}{<\macro>} -% \pgfplotstableforeachcolumn\as{<\iteratemacro>}{<loop body>} -% (the '\as' is required directly after -% \pgfplotstableforeachcolumn in this context) -% Attention: 'to listener' is scoped by TeX groups, so any assignments -% need to be done globally (or with aftergroup magic). -% -% More remarks about scoping: -% \pgfplotstableread to listener works as follows: -% \begingroup -% // load table -% while file has more lines: -% load line, read every column; -% invoke listener; -% repeat -% \endgroup -% -% In short: all invocations of listener have the same level of -% scoping: they are inside of one TeX group. But single listener -% invocations as such are not scoped. Make sure you don't -% accidentally overwrite one of the internals in listener. And: make -% sure you don't change temporary registers without scoping them! -% -% Note: this command also updates \pgfplotsscanlinelength. -\def\pgfplotstableread{% - \pgfutil@ifnextchar*{% - \pgfplots@tableread@use@begingroupfalse - \pgfplotstableread@impl@star - }{% - \pgfplots@tableread@use@begingrouptrue - \pgfplotstableread@impl@star*% - }% -}% -\def\pgfplotstableread@impl@star*{% - \pgfutil@ifnextchar[{% - \pgfplotstableread@impl - }{% - \pgfplotstableread@impl[]% - }% -} - -% BACKWARDS COMPATIBILITY -\let\pgfnumtableread=\pgfplotstableread - -% Invokes #2 if '#1' is an already loaded table and #3 if not. -\long\def\pgfplotstable@isloadedtable#1#2#3{% - \pgfplotsutil@ifdefinedui@withsuffix{#1}{@@table@name}{#2}{#3}% -}% - -% Defines \pgfmathresult (and now also \pgfplotsretval) to be the number of rows in table #1. -% -% #1 may be either a loaded table structure (a macro name) or a table -% file name. In the latter case, the file will be loaded temporarily. -\def\pgfplotstablegetrowsof#1{% - \pgfplotstable@isloadedtable{#1}{% - % ah - it is an already loaded table! - \begingroup - \pgfplotslistfront#1\to\pgfplotstablegetrows@@ - \expandafter\pgfplotslistsize\csname\string#1@\pgfplotstablegetrows@@\endcsname\to\c@pgfplotstable@counta - \edef\pgfmathresult{\the\c@pgfplotstable@counta}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - }{% - % ah - it is a file name. - \begingroup - \pgfplotstableread{#1}\pgfplotstablegetrows@ - \pgfplotstablegetrowsof{\pgfplotstablegetrows@}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - }% - \let\pgfplotsretval=\pgfmathresult -}% % \pgfplotstablesave[<options>]{<\tablename>}{file name} \def\pgfplotstablesave{% @@ -1149,6 +1028,9 @@ \or % col sep=tab: \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\pgfplotstableread@tab}% + \or + % col sep=&: + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka&}% \fi \endgroup \pgfkeyslet{/pgfplots/table/@cell content}\pgfplots@glob@TMPc% @@ -1167,15 +1049,19 @@ /pgfplots/table/col sep/semicolon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{2}},% /pgfplots/table/col sep/colon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{3}},% /pgfplots/table/col sep/braces/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{4}},% - /pgfplots/table/col sep/tab/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{5}},% + /pgfplots/table/col sep/tab/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{5}},% + /pgfplots/table/col sep/&/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{6}},% + /pgfplots/table/col sep/ampersand/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{6}},% /pgfplots/table/col sep=space,% /pgfplots/table/in col sep/.is choice,% /pgfplots/table/in col sep/space/.code = {\def\pgfplotstableread@COLSEP@CASE{0}},% /pgfplots/table/in col sep/comma/.code = {\def\pgfplotstableread@COLSEP@CASE{1}},% /pgfplots/table/in col sep/semicolon/.code = {\def\pgfplotstableread@COLSEP@CASE{2}},% /pgfplots/table/in col sep/colon/.code = {\def\pgfplotstableread@COLSEP@CASE{3}},% - /pgfplots/table/in col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}},% - /pgfplots/table/in col sep/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}},% + /pgfplots/table/in col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}},% + /pgfplots/table/in col sep/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}},% + /pgfplots/table/in col sep/&/.code = {\def\pgfplotstableread@COLSEP@CASE{6}},% + /pgfplots/table/in col sep/ampersand/.code = {\def\pgfplotstableread@COLSEP@CASE{6}},% /pgfplots/table/in col sep=space,% % WARNING: you NEED a '%' before '#1': #1,% @@ -1271,7 +1157,7 @@ % % #1 a table macro. % #2 either a file name or a table macro. -\def\pgfplotstablevertcat#1#2{% +\long\def\pgfplotstablevertcat#1#2{% \pgfplotstable@isloadedtable{#2}{% \pgfplotstable@isloadedtable{#1}{% % for each column in '#1': @@ -1315,7 +1201,7 @@ }% } \def\pgfplotstabletranspose@star*{\pgfutil@ifnextchar[{\pgfplotstabletranspose@opt}{\pgfplotstabletranspose@opt[]}}% -\def\pgfplotstabletranspose@opt[#1]#2#3{% +\long\def\pgfplotstabletranspose@opt[#1]#2#3{% \pgfplotstable@isloadedtable{#3}{% \pgfplotstabletranspose@[#1]{#2}{#3}% }{% @@ -1324,315 +1210,6 @@ }% }% -% Iterates through every column of table '#1' and invokes the code -% '#3' for each column. The current column name will be available as -% '#2' and the current column index as |\pgfplotstablecol| (starting -% with 0). -% -% Example: -% \pgfplotstableforeachcolumn{\table}\as\colname{% -% The column name is `\colname'; its index \pgfplotstablecol.\par -% }% -% -% REMARK: this routine does NOT introduce TeX groups. -\long\def\pgfplotstableforeachcolumn#1\as#2#3{% - \def\pgfplotstablecol{0}% - \pgfplotslistforeachungrouped#1\as#2{% - #3\relax% - \pgfplotsutil@advancestringcounter\pgfplotstablecol - }% - \let\pgfplotstablecol=\relax -}% -% A variant of \pgfplotstableforeachcolumn which is used inside of -% \pgfplotstableread to listener. -% -% It is used as \pgfplotstableforeachcolumn\as\cur{<do something with \cur>} -\long\def\pgfplotstableforeachcolumn@listener\as#1#2{% - \def\pgfplotstablecol{0}% - \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as#1{% - #2\relax% - \pgfplotsutil@advancestringcounter\pgfplotstablecol - }% - \let\pgfplotstablecol=\relax -}% - -% Reports every element t_{ij} for a fixed column j (in read-only -% mode). -% -% For every cell, the code '#4' will be executed where '#3' will -% contain the cell's value. During code '#4', the macro -% \pgfplotstablerow will contain the current row index. -% -% #1: either a column name or the string '[index]' followed by a -% number denoting a column index Access by column name is much faster.. -% #2: the table (macro or file name) -% #3: the macro in which the cell values shall be written -% #4: the code to execute. -% -% Example: -% \pgfplotstableforeachcolumnelement{colname}\of\table\as\cellelem{% -% I have now cell element `\cellelem' at row index -% `\pgfplotstablerow'. -% \par -% } -% -% REMARK: this routine does NOT introduce TeX groups. -\long\def\pgfplotstableforeachcolumnelement#1\of#2\as#3#4{% - \def\pgfplotstablerow{0}% - \pgfplotstablegetcolumn{#1}\of{#2}\to\pgfplotstableforeachcolumnelement@list - \pgfplotslistforeachungrouped\pgfplotstableforeachcolumnelement@list\as#3{% - % allow nesting by copying the old value of \pgfplotstablerow: - \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% - }% - \let\pgfplotstablerow=\relax -}% -% helper method to allow nesting. It copies \pgfplotstablerow. -% #1: the expanded value of \pgfplotstablerow. -\long\def\pgfplotstableforeachcolumnelement@#1#2{% - #2\relax - \def\pgfplotstablerow{#1}% restore to old value. - % advance. - \pgfplotsutil@advancestringcounter\pgfplotstablerow -}% - -% A routine which is similar to \pgfplotstableforeachcolumnelement, -% but this here checks for changes in \pgfplotsretval and writes them -% back into the respected cell. -% -% The runtime is quadratic in the number of rows. -\long\def\pgfplotstablemodifyeachcolumnelement#1\of#2\as#3#4{% - \def\pgfplotstablerow{0}% - % - % Step 0: get the REAL column name for '#1'. - % This needs modifications if '#1' is [index]<integer>. - % -> store the colname to \pgfplotstable@loc@TMPc: - \def\pgfplotstable@loc@TMPc{#1}% - \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% - \ifpgfplotstableread@foundcolnames - \else - \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc - \fi - % Step 0.1: prepare a command which re-assembles column '#1' - % (using the real column name). - % The re-assemblation command will be invoked at the end of each - % iteration. This complicated macro preparation allows nested - % calls to \pgfplotstablemodifyeachcolumnelement. - \t@pgfplots@toka={\expandafter\pgfplotslistpushback\expandafter{#3}\to}% - \edef\pgfplotstable@loc@TMPd{% - \the\t@pgfplots@toka{\expandafter\noexpand\csname\string#2@\pgfplotstable@loc@TMPc\endcsname}}% - % Step 1: copy the column data to \pgfplotstable@loc@TMPb - \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to\pgfplotstable@loc@TMPb% - % - % clear the original column: - \expandafter\pgfplotslistnewempty\csname\string#2@\pgfplotstable@loc@TMPc\endcsname - % - % Call loop. The prepared re-assemble macro will be provided as macro argument - % to allow nested calls: - \expandafter\pgfplotstablemodifyeachcolumnelement@\expandafter{\pgfplotstable@loc@TMPd} - {\pgfplotstable@loc@TMPb}{#3}{#4}% - \let\pgfplotstablerow=\relax -}% -% #1: post-iteration code -% #2: the row list -% #3: the loop macro to assign -% #4: the loop body -\long\def\pgfplotstablemodifyeachcolumnelement@#1#2#3#4{% - \pgfplotslistforeachungrouped{#2}\as#3{% - % allow nesting by copying the old value of \pgfplotstablerow: - \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% - #1% - }% -} - -% Selects a single table element at row #1 and column #2 from table -% #3. -% -% #1: a row index. -% #2: a column name or the string '[index]' followed by a number -% denoting a column index. Access by column name is much faster. -% #3: the table (macro or file name). -% -% The cell value will be written into the macro \pgfplotsretval. -% -% REMARK: -% this routine is supposed to be very slow: it needs time O(N) where N -% is the number of rows. This may change in future versions. -% -% Example: -% \pgfplotstablegetelem{0}{[index]2}\of\table -% The elem is `\pgfplotsretval'. -\def\pgfplotstablegetelem#1#2\of#3{% - \begingroup - \pgfplotstablegetcolumn{#2}\of{#3}\to\pgfplotstable@loc@TMPa - \def\pgfplotsexceptionmsg{Sorry, row `#1' does not exist in table \pgfplotstablenameof{#3}}% - \pgfplotslistselect#1\of\pgfplotstable@loc@TMPa\to\pgfplotsretval - \pgfmath@smuggleone\pgfplotsretval - \endgroup -}% - -\def\pgfplotstablegetcolumnlist#1\to#2{\let#2=#1} - -% Returns a column vector in form of \pgfplotslist -% into #3. -% -% #1: the column name (not a macro) -% #2: the table structure -% #3: the output macro name. -% -% @throw `no such element' on error -\def\pgfplotstablegetcolumnbyname#1\of#2\to#3{% - \pgfutil@ifundefined{\string#2@#1}{% - % Oh, there is no column '#1' in table '#2'! - % - % Ok, then check for the 'create on use' and the 'alias' - % features... - % 1. create on use: - % - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - \def\pgfplotstable@loc@TMPa{/pgfplots/table/create on use/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa/.@cmd}{% - % aah - a 'create on use' style exists. Apply it! - \expandafter\pgfplotstablecreatecol\expandafter[\pgfplotstable@loc@TMPa]{#1}{#2}% - % and return the newly generated col: - \expandafter\let\expandafter#3\csname\string#2@#1\endcsname - }{% - % ok, then it is either an alias or it is simply not - % existant. - \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% - \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% - \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb - \pgfutil@ifundefined{\string#2@\pgfplotstable@loc@TMPa}{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.}\pgfeov% - }{% - \expandafter\let\expandafter#3\csname\string#2@\pgfplotstable@loc@TMPa\endcsname - }% - }{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).}\pgfeov% - }% - }% - }{% - \expandafter\let\expandafter#3\csname\string#2@#1\endcsname - }% -} - -% Retrieves the column *NAME* '#1' of table #2 and writes it into -% '#3'. -% -% If there is no such column, column aliases will be checked. Finally -% if there are no aliases, the command fails with an error. -% -% The 'create on use' statements can't be used in this context. -% @see \pgfplotstablegetcolumnbyname -% -% #1: a column name (not a macro) -% #2: the table structure -% #3: a macro name which will be filled with the (probably modified) -% column name into #2. -\def\pgfplotstableresolvecolname#1\of#2\to#3{% - \pgfutil@ifundefined{\string#2@#1}{% - % Oh, there is no column '#1' in table '#2'! - % - % Ok, then check for the 'alias' feature ... - % - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% - \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% - \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb - \pgfutil@ifundefined{\string#2@\pgfplotstable@loc@TMPa}{% - \def\pgfplotstable@loc@TMPb{/pgfplots/table/create on use/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPb/.@cmd}{% - \pgfplotstable@error{Sorry, '\pgfplotstable@loc@TMPb' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% - }{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.}\pgfeov% - }% - }{% - \let#3=\pgfplotstable@loc@TMPa - }% - }{% - \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).}\pgfeov% - }% - }{% - \def#3{#1}% - }% -} - -% Invokes either \pgfplotstablegetcolumnbyindex or -% \pgfplotstablegetcolumnbyname. -% -% #1: either a column name, alias or create on use specification, or -% [index]<integer> denoting a column index. -% #2: either a loaded table or a table macro. -% #3: a macro name which will be filled with the column, in the format -% accepted of \pgfplotslist... -\def\pgfplotstablegetcolumn#1\of#2\to#3{% - \begingroup - \pgfplotstable@isloadedtable{#2}{% - \pgfplotstablegetcolumnfromstruct{#1}\of{#2}\to{#3}% - }{% - \pgfplotstableread{#2}\pgfplotstable@tmptbl - \pgfplotstablegetcolumnfromstruct{#1}\of\pgfplotstable@tmptbl\to{#3}% - }% - \pgfmath@smuggleone#3% - \endgroup -}% -\def\pgfplotstablegetcolumnfromstruct#1\of#2\to#3{% - \def\pgfplotstable@loc@TMPc{#1}% - \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% - \ifpgfplotstableread@foundcolnames - \else - \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc - \fi - \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to{#3}% -}% - -\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% - \pgfplotstablegetname#1\pgfplotstable@loc@TMPa - \expandafter\let\csname\string#2@@table@name\endcsname=\pgfplotstable@loc@TMPa - \expandafter\edef\csname\string#2@@table@scanline\endcsname{\pgfplotstablescanlinelengthof{#1}}% - \pgfplotslistforeachungrouped#1\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\let\csname\string#2@\pgfplotstable@loc@TMPa\endcsname}% - \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname - }% -} - -% Returns the file name of table '#1' into macro #2. -\def\pgfplotstablegetname#1#2{% - \expandafter\let\expandafter#2\csname\string#1@@table@name\endcsname -} - -% expands to the table file name of table '#1' -\def\pgfplotstablenameof#1{% - \csname\string#1@@table@name\endcsname -} - -% Returns the value of \pgfplotsscanlinelength for table '#1' into -% macro #2. -\def\pgfplotstablegetscanlinelength#1#2{% - \expandafter\let\expandafter#2\csname\string#1@@table@scanline\endcsname -}% - -% Expands to the scan line length of table '#1'. -\def\pgfplotstablescanlinelengthof#1{\csname\string#1@@table@scanline\endcsname}% % Creates a new column named #1 and appends it to table #2. % @@ -1695,21 +1272,32 @@ \pgfplotstabletypeset@opt[]% }% } -\def\pgfplotstabletypeset@opt[#1]#2{% +\long\def\pgfplotstabletypeset@opt[#1]{% + \begingroup + \ifpgfplots@table@options@areset + \else + \pgfplotstableset{#1}% + \fi + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplotstabletypeset@opt@collectarg[#1]% + }% +} +\long\def\pgfplotstabletypeset@opt@collectarg[#1]#2{% \pgfplotstable@isloadedtable{#2}% {\pgfplotstabletypeset@opt@[#1]{#2}}% {\pgfplotstabletypesetfile@opt@[#1]{#2}}% } + % Like \pgfplotstabletypeset, but the first argument is a file name. % This is the same now; it will be recognised automatically. \let\pgfplotstabletypesetfile=\pgfplotstabletypeset -\def\pgfplotstabletypesetfile@opt@[#1]#2{% - \begingroup +\long\def\pgfplotstabletypesetfile@opt@[#1]#2{% + %\begingroup <--- is already opened! \ifpgfplots@table@options@areset \else + \pgfplotstableset@every@table{#2}{#1}% \pgfplots@table@options@aresettrue - \pgfplotstableset{/pgfplots/table/every table={#2},#1}% \fi \ifpgfplotstabletypeset@force@remake \pgfplotstabletypeset@includeoutfilesfalse @@ -1756,822 +1344,25 @@ % IMPLEMENTATION % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newif\ifpgfplotstableread@curline@contains@colnames -\newif\ifpgfplotstableread@foundcolnames -\newif\ifpgfplotstableread@skipline - -% Accept one of -% \pgfplotstableread[#1]{<file>}{<\macro>} -% \pgfplotstableread[#1]{<file>} to listener{<\macro>} -% or -% \pgfplotstableread[#1]{<file>} to {<\macro>} (DEPRECATED) -\def\pgfplotstableread@impl[#1]#2{% - \pgfutil@ifnextchar t{% - \pgfplotstableread@impl@@{#1}{#2}% - }{% - \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 {% - \pgfutil@ifnextchar l{% - \pgfplotstableread@impl@@listener{#1}{#2}% - }{% - \pgfplotstableread@impl@{#1}{#2}% - }% -}% -\def\pgfplotstableread@impl@@listener#1#2listener#3{% - \pgfplots@tableread@to@listenertrue - \pgfplotstableread@impl@{#1}{#2}{#3}% - \pgfplots@tableread@to@listenerfalse -}% - -\def\pgfplotstableread@impl@#1#2#3{% - \ifpgfplots@tableread@use@begingroup - \begingroup - \fi -%\pgfplots@message{ATTEMPTING TO READ #2}% - \openin\r@pgfplots@reada=#2.tex - \ifeof\r@pgfplots@reada - \openin\r@pgfplots@reada=#2\relax - \else - \pgfplots@warning{% - You requested to open table '#2', but there is also a '#2.tex'. - TeX will automatically append the suffix '.tex', so I will now open '#2.tex'. - Please make sure you don't accidentally load TeX files - this may produce unrecoverable errors.}% - \closein\r@pgfplots@reada - \openin\r@pgfplots@reada=#2\relax - \fi - \pgfplots@logfileopen{#2}% - % - \edef\pgfplotstableread@oldendlinechar{\the\endlinechar}% - \endlinechar=-1 % do not append a white space after each line - % - \pgfplotstableread@impl@prepare{#1}{#2}{#3}% - \ifeof\r@pgfplots@reada - \pgfplotsthrow{no such table file}{\pgfplots@loc@TMPa}{#2}{Could not read table file '#2'.}\pgfeov% - \global\let\pgfplotstable@colnames@glob=\pgfplots@loc@TMPa - \else - % - \pgfplotstableread@loop@over@lines - % - \closein\r@pgfplots@reada - % - \pgfplotstableread@finish - \fi - \endlinechar=\pgfplotstableread@oldendlinechar - \pgfplotsscanlinelengthcleanup - \pgfplotstable@copy@to@globalbuffers@simple{#2}% - \ifpgfplots@tableread@use@begingroup - \endgroup - \fi - \ifpgfplots@tableread@to@listener - % there are no data structures in this case. - \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline - \else - % Now, we can access the global variables! - % copy them to #3. - \pgfplotstable@copy@globalbuffers@to#3% - \fi -} - -% #1: any options to set (respect \ifpgfplots@table@options@areset ) -% #2: the file name -% #3: the output macro (or listener) -\def\pgfplotstableread@impl@prepare#1#2#3{% - \ifpgfplots@table@options@areset - \else - \pgfplotstableset{/pgfplots/table/every table={#2},#1}% - \fi - \def\pgfplotstableread@filename{#2}% - % - % local counter definitions: - \ifpgfplots@tableread@use@begingroup - \let\pgfplotstableread@lineno=\c@pgf@counta - \let\pgfplotstableread@numcols=\c@pgf@countb - \let\pgfplotstableread@curcol=\c@pgf@countc - \let\pgfplotstableread@usablelineno=\c@pgf@countd - \def\thepgfplotstableread@lineno{\the\pgfplotstableread@lineno}% - \def\thepgfplotstableread@usablelineno{\the\pgfplotstableread@usablelineno}% - \def\thepgfplotstableread@curcol{\the\pgfplotstableread@curcol}% - \def\thepgfplotstableread@numcols{\the\pgfplotstableread@numcols}% - \def\pgfplotstableread@countreset##1{##1=0 }% - \def\pgfplotstableread@countset##1##2{##1=##2\relax}% - \def\pgfplotstableread@countadvance##1{\advance##1 by1 }% - \else - % don't re-use integers! We have no protecting scopes! - \def\thepgfplotstableread@lineno{\pgfplotstableread@lineno}% - \def\thepgfplotstableread@usablelineno{\pgfplotstableread@usablelineno}% - \def\thepgfplotstableread@curcol{\pgfplotstableread@curcol}% - \def\thepgfplotstableread@numcols{\pgfplotstableread@numcols}% - \def\pgfplotstableread@countreset##1{\def##1{0}}% - \def\pgfplotstableread@countset##1##2{\def##1{##2}}% - \def\pgfplotstableread@countadvance##1{\pgfplotsutil@advancestringcounter{##1}}% - \fi - \pgfplotstableread@countreset\pgfplotstableread@lineno - \pgfplotstableread@countreset\pgfplotstableread@usablelineno - \pgfplotstableread@countreset\pgfplotstableread@numcols - \pgfplotstableread@countreset\pgfplotstableread@curcol - % - \pgfplotstableread@impl@prepare@DO - \def\pgfplotstableread@isgnuplotformat{0}% - \global\pgfplotslistnewempty\pgfplotstable@colnames@glob - \pgfplotsscanlinelengthinitzero - \ifpgfplots@tableread@to@listener - \def\pgfplotstablerow{\thepgfplotstableread@usablelineno}% - \def\pgfplotstablelineno{\thepgfplotstableread@lineno}% - \let\pgfplotstable@listener=#3% - \let\pgfplotstableread@impl@nextrow@NEXT=\pgfplotstableread@impl@nextrow@NEXT@listener - \let\pgfplotstablereadgetcolindex=\pgfplotstablereadgetcolindex@ - \let\pgfplotstablereadgetcolname=\pgfplotstablereadgetcolname@ - \let\pgfplotstablereadgetptrtocolname=\pgfplotstablereadgetptrtocolname@ - \let\pgfplotstablereadgetptrtocolindex=\pgfplotstablereadgetptrtocolindex@ - \let\pgfplotstablereadevalptr=\pgfplotstablereadevalptr@ - \let\pgfplotstablereadvalueofptr=\pgfplotstablereadvalueofptr@ - \let\pgfplotstableforeachcolumn=\pgfplotstableforeachcolumn@listener - \let\pgfplotstablereadvalueofcolname=\pgfplotstablereadvalueofcolname@ - \let\pgfplotstablereadvalueofcolindex=\pgfplotstablereadvalueofcolindex@ - \let\getthisrow=\pgfplotstablereadgetcolname - \let\thisrow=\pgfplotstablereadvalueofcolname - \let\thisrowno=\pgfplotstablereadvalueofcolindex - \let\getthisrowno=\pgfplotstablereadgetcolindex - \fi -}% - -% Copies the table column list and the column vectors of #1 to global buffers. -% @see \pgfplotstable@copy@globalbuffers@to -% -% Use these two methods to avoid scoping problems. -% -% #1: the <\macro> name of the table which is to be copied to global buffers. -% #2: the table file name. -\def\pgfplotstable@copy@to@globalbuffers#1#2{% - \global\let\pgfplotstable@colnames@glob=#1\relax - \c@pgfplotstable@counta=0\relax% - \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname% - }% - \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname - \advance\c@pgfplotstable@counta by1\relax - }% - \pgfplotstable@copy@to@globalbuffers@simple{#2}% -}% -% A variant of \pgfplotstable@copy@to@globalbuffers which copies only -% the member variables of a loaded table (the name and scanline length) to -% global buffers. -% -% #1: the table's file name. -% -% @PRECONDITION: any other variables and cell data of the table are already stored -% in global buffers. -\def\pgfplotstable@copy@to@globalbuffers@simple#1{% - \gdef\pgfplotstable@glob@buf@name{#1}% - \global\let\pgfplotstable@glob@buf@scanline=\pgfplotsscanlinelength -}% - -% copies the global column list and the global column vectors to #1 -% (NOT the table file name). -% @see \pgfplotstable@copy@to@globalbuffers -% -% @PRECONDITION the global buffers contain all members of a table. -% -% @POSTCONDITION The table '#1' is be initialised to these members. -% Furthermore, \pgfplotsscanlinelength is set. -\def\pgfplotstable@copy@globalbuffers@to#1{% - \let#1=\pgfplotstable@colnames@glob - \c@pgfplotstable@counta=0\relax% - \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\let\csname\string#1@\pgfplotstable@loc@TMPa\endcsname}% - \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname -%\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% - \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty - \advance\c@pgfplotstable@counta by1\relax - }% - \global\let\pgfplotstable@colnames@glob=\pgfutil@empty - \expandafter\let\csname\string#1@@table@scanline\endcsname=\pgfplotstable@glob@buf@scanline - \expandafter\let\csname\string#1@@table@name\endcsname=\pgfplotstable@glob@buf@name - \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline -}% - -\def\pgfplotstableread@finish{% - \pgfplotsscanlinecomplete - \ifpgfplots@tableread@to@listener - \else - \ifpgfplotstableread@foundcolnames - \else - \pgfplotstableread@create@column@names@with@numbers - \fi - \pgfplotstableread@countreset\pgfplotstableread@curcol% - \pgfutil@loop - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \expandafter\pgfplotsapplistXflushbuffers\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \pgfutil@repeat - \fi -} -\def\pgfplotstableread@loop@over@lines{% - \ifeof\r@pgfplots@reada -%\pgfplots@message{EOF}% - \else - \read\r@pgfplots@reada to\pgfplotstable@LINE - \ifeof\r@pgfplots@reada - \else - \pgfplotstableread@loop@processnextline - \fi - \expandafter\pgfplotstableread@loop@over@lines - \fi -} -% PRECONDITION: -% \pgfplotstable@LINE contains the current input line. -\def\pgfplotstableread@loop@processnextline{% - \expandafter\pgfplotstableread@checkspecial@line\pgfplotstable@LINE\pgfplotstable@EOI - \ifpgfplotstableread@skipline - \def\pgfplotstableread@gnuplotcheck{####x y type}% - \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE - \def\pgfplotstableread@isgnuplotformat{1}% - \fi - \def\pgfplotstableread@gnuplotcheck{####x y z type}% - \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE - \def\pgfplotstableread@isgnuplotformat{1}% - \fi - \else - %-------------------------------------------------- - % \ifnum\pgfplotstableread@lineno=0 - % \let\pgfplotstable@firstline=\pgfplotstable@LINE - % \fi - %-------------------------------------------------- -%\pgfplots@message{READING LINE \thepgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% - \pgfplotstableread@curline@contains@colnamesfalse - \ifnum\pgfplotstableread@numcols=0\relax - % STEP 0: initialise - % - count columns - % - find header data - \pgfplotstableread@countreset\pgfplotstableread@curcol - \ifpgfplotstable@firstline@is@header - \pgfplotstableread@curline@contains@colnamestrue - \fi - \pgfplotstableread@impl@DO\pgfplotstableread@impl@countcols@and@identifynames@NEXT\pgfplotstable@LINE - \pgfplotstableread@countset\pgfplotstableread@numcols{\pgfplotstableread@curcol}% - \pgfplotstableread@countreset\pgfplotstableread@curcol - % Create empty column lists: - \pgfplotstableread@create@column@lists - % - \ifnum\pgfplotstableread@usablelineno=0\relax - \if1\pgfplotstableread@isgnuplotformat% - % The file started with - % #... - % #x y type - % X Y i - % -> thats a gnuplot file! - \pgfplotstableread@curline@contains@colnamesfalse - \fi - \fi - % Now, read the first line. - % It contains either - % - column names, - % - numerical data, - % - nothing (comments). - \ifpgfplotstableread@curline@contains@colnames - \pgfplotstableread@foundcolnamestrue - \pgfplotstableread@countreset\pgfplotstableread@curcol - \pgfplotstableread@impl@DO\pgfplotstableread@impl@collectcolnames@NEXT\pgfplotstable@LINE - \else - \pgfplotsscanlinelengthincrease - \pgfplotstableread@foundcolnamesfalse - \pgfplotstableread@countreset\pgfplotstableread@curcol - % Leave column name lists empty... - \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE - \fi -%\pgfplots@message{After reading first row: found '\thepgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames@glob'}% - \else - \pgfplotsscanlinelengthincrease - \pgfplotstableread@countreset\pgfplotstableread@curcol - \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE - \fi - \ifnum\pgfplotstableread@curcol=\pgfplotstableread@numcols\relax - \else - \pgfplotstable@error{input table '\pgfplotstableread@filename' has an unbalanced number of columns in row '\thepgfplotstableread@lineno' (expected '\thepgfplotstableread@numcols' cols; got '\thepgfplotstableread@curcol'). Maybe the input table is corrupted? If you need unbalanced data, consider using 'nan' in empty cells (perhaps combined with 'unbounded coords=jump')}% - \fi - \ifpgfplots@tableread@to@listener - \ifpgfplotstableread@curline@contains@colnames - \else - % report row! - \pgfplotstable@listener - \fi - \fi - \pgfplotstableread@countadvance\pgfplotstableread@usablelineno - \fi - \pgfplotstableread@countadvance\pgfplotstableread@lineno -}% - -% WARNING: this routine is also used in pgfplots.code.tex ... -\def\pgfplotstableread@checkspecial@line{% - \pgfutil@ifnextchar##{% - \pgfplotstableread@skiplinetrue - \pgfplotstableread@impl@gobble - }{% - \pgfutil@ifnextchar${% - \pgfplotstableread@process@flags@line - }{% - \pgfutil@ifnextchar\pgfplotstable@EOI{% - \pgfplotstableread@skiplinetrue - \pgfplotsscanlinecomplete% the line is empty; same as \par! - \pgfplotstableread@impl@gobble - }{% - \pgfutil@ifnextchar\par{% - \pgfplotstableread@skiplinetrue - \pgfplotsscanlinecomplete - \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{% - \pgfutil@loop - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \def\pgfplots@loc@TMPa{\pgfplotsapplistXnewempty[to global]}% - \expandafter\pgfplots@loc@TMPa\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \pgfutil@repeat -} - -\def\pgfplotstableread@create@column@names@with@numbers{% - \pgfplotstableread@countreset\pgfplotstableread@curcol - \pgfutil@loop - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \edef\pgfplotstable@loc@TMPb{\thepgfplotstableread@curcol}% - \expandafter\pgfplotslistpushbackglobal\pgfplotstable@loc@TMPb\to\pgfplotstable@colnames@glob - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \pgfutil@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. -\long\def\pgfplotstableread@impl@DO#1#2{% - \let\pgfplotstableread@impl@ITERATE@NEXT@=#1\relax - \expandafter\pgfplotstableread@impl@DO@\expandafter{#2}% -} -{% - \catcode`\ =10 - \catcode`\;=12 - \catcode`\:=12 - \gdef\pgfplotstableread@impl@prepare@DO{% - \ifcase\pgfplotstableread@COLSEP@CASE\relax - % col sep=space: - \catcode`\ =10 - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1 \pgfplotstable@EOI}% - \or - % col sep=comma: - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COMMA - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1,\pgfplotstable@EOI}% - \or - % col sep=semicolon: - \catcode`\;=12 - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1;\pgfplotstable@EOI}% - \or - % col sep=colon: - \catcode`\:=12 - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COLON - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1:\pgfplotstable@EOI}% - \or - % col sep=brace: - % allow multi line cells: - \endlinechar=\pgfplotstableread@oldendlinechar\relax - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@BRACE - \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1\pgfplotstable@EOI}% - \or - % col sep=tab: - \catcode`\^^I=12 - \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@TAB - \long\edef\pgfplotstableread@impl@DO@##1{\noexpand\pgfplotstableread@impl@ITERATE##1\pgfplotstableread@tab\noexpand\pgfplotstable@EOI}% - \fi - }% -}% -\long\def\pgfplotstableread@impl@ITERATE{% - \pgfutil@ifnextchar\pgfplotstable@EOI{% - \pgfplotstableread@impl@gobble - }{% - \pgfplotstableread@impl@ITERATE@NEXT - }% -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT#1 {% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@COMMA#1,{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON#1;{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@COLON#1:{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\long\def\pgfplotstableread@impl@ITERATE@NEXT@BRACE#1{% - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\begingroup -\catcode`\^^I=12 -\gdef\pgfplotstableread@tab{^^I}% -\long\gdef\pgfplotstableread@impl@ITERATE@NEXT@TAB#1^^I{% the following white spaces are SPACES, not tabs: - \pgfplotstableread@impl@ITERATE@NEXT@{#1}% - \pgfplotstableread@impl@ITERATE -}% -\endgroup -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -% these values are only usable for a read-listener, that means: -% when using -% -% \pgfplotstableread{<file>} to listener<\macro> -% -% -> <\macro> can than use the methods -% -% \pgfplotstablereadgetcolindex{<index>}{<\content>} -% performs \let\content=<content of column no <index> > -\def\pgfplotstablereadgetcolindex@#1#2{% - \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% - \pgfplotsthrow{no such element}{#2}{Sorry, the requested column number '#1' in table '\pgfplotstableread@filename' does not exist!? Please verify you used the correct index 0 <= i < N.}\pgfeov% - }{% - \expandafter\let\expandafter#2\csname pgfplotstblread@colcontent@no#1\endcsname - }% -}% - -\pgfkeysdef{/pgfplots/table/@undefined column text}{#1__column_not_found.}% -\def\pgfplotstable@undefinedtext#1{\pgfkeysvalueof{/pgfplots/table/@undefined column text/.@cmd}#1\pgfeov}% - -% As \pgfplotstablereadgetcolindex, but -% \pgfplotstablereadvalueofcolindex{<index>} -% directly expands to the value stored in the desired column. -% -% Example: -% \pgfplotstablereadvalueofcolindex{3} -> expands to '42' if '42' is -% written in column no 3. -% -% Column indexing starts at 0. -% -% @ATTENTION: since such a command may occur within an \edef or an -% \csname, it can't perform sanity checking. Proving an invalid index -% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. -\def\pgfplotstablereadvalueofcolindex@#1{% - \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% - \pgfplotstable@undefinedtext{colindex#1}% - }{% - \csname pgfplotstblread@colcontent@no#1\endcsname - }% -} - -% \pgfplotstablereadgetcolname{<name>}{<\content>} -% performs \let\content=<content of column named <name> > -\def\pgfplotstablereadgetcolname@#1#2{% - \pgfplotstablereadgetptrtocolname{#1}{\pgfplots@loc@TMPa}% - \pgfplotstablereadevalptr\pgfplots@loc@TMPa{#2}% -}% - -% This here is the implementation of \pgfplotstablereadvalueofcolname -% (and \thisrow{<colname>}) for use inside of the 'read to listener' -% framework. -% -% Like \pgfplotstablereadgetcolname, but this one expands directly to -% the value of the desired column. -% -% #1: a column name or a column alias. -% -% @ATTENTION: since such a command may occur within an \edef or an -% \csname, it can't perform sanity checking. Proving an invalid index -% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. -\def\pgfplotstablereadvalueofcolname@#1{% - \pgfplotstable@thisrow@impl{#1}{pgfplotstblread@colindex@for@name}{\pgfplotstable@thisrow@impl@read}% -}% -\def\pgfplotstable@thisrow@impl@read#1{\csname pgfplotstblread@colcontent@no#1\endcsname}% - -% This implements \thisrow in different contexts. -% -% Usage: -% \def\thisrow#1{\pgfplotstable@thisrow@impl{#1}{macroprefix@}{\pgfplotstable@thisrow@impl@}} -% -% Then, \thisrow{existingcol} -% will expand to -% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@existingcol\endcsname} -% -> \csname macroprefix@existingcol\endcsname -% -% Furthermore, if '#1' is no existing col and there exists /pgfplots/table/alias/#1, -% \thisrow{aliased} -% will expand to -% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname} -% -> \csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname -% -% #1: the argument for \thisrow{#1} -% #2: a macro prefix such that \csname #2<colname>\endcsname contains -% the value of the current row for (physical) column <colname> -% #3: the name of a one-argument-macro which will get \csname #2<colname>\endcsname -% as argument. This is the last step of \thisrow. It allows indirect -% access by translating colnames to col indices in '\pgfplotstableread to listener' -\def\pgfplotstable@thisrow@impl#1#2#3{% - \pgfutil@ifundefined{#2#1}% - {% - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - \pgfkeysifdefined{/pgfplots/table/alias/#1}{% - \pgfutil@ifundefined{#2\pgfkeysvalueof{/pgfplots/table/alias/#1}}{% - \pgfplotstable@undefinedtext{\pgfkeysvalueof{/pgfplots/table/alias/#1}}% - }{% - #3{\csname #2\pgfkeysvalueof{/pgfplots/table/alias/#1}\endcsname}% - }% - }{% - \pgfplotstable@undefinedtext{#1}% - }% - }% - {% - #3{\csname #2#1\endcsname}% - }% -}% -\def\pgfplotstable@thisrow@impl@#1{#1}% - -% \pgfplotstablereadgetptrtocolname{<name>}{\ptr} -% Creates some sort of "pointer" to the column named <name>. This -% pointer can than be used every time a new line has been reported to -% the listener. It works like this: -% -% \let\ptr=\pgfutil@empty -% \def\macro{% -% \ifx\ptr\empty -% \pgfplotstablereadgetptrtocolname{<my col>}{\ptr}% -% \fi -% \pgfplotstablereadevalptr{\ptr}{\content}% -% -> do something with \content! -% } -% -% \pgfplotstableread{<file>} to listener<\macro> -% -% -> will evaluate \macro foreach row. -% -% The advantage of such a prepared pointer over \thisrow{#1} or -% \getthisrow{#1} is simply efficiency and sanity checking: the checks -% are done at the time of pointer creation, dereferencing the pointer -% is fast. -\def\pgfplotstablereadgetptrtocolname@#1#2{% - % Implementation note: it is necessary to replicate code becuase - % in this context, the table structure is NOT available. - \pgfutil@ifundefined{pgfplotstblread@colindex@for@name#1}{% - % Oh, there is no column '#1'! - % - % Check for the 'alias' feature! - % - % WARNING : this code has been REPLICATED in - % *** \pgfplotstablereadgetptrtocolname *** - % *** \pgfplotstablegetcolumnbyname *** - % *** \pgfplotstableresolvecolname *** - % *** \pgfplotstablereadvalueofcolname *** - % - \def\pgfplotstable@loc@TMPa{/pgfplots/table/alias/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa}{% - \pgfkeysgetvalue{\pgfplotstable@loc@TMPa}{\pgfplotstable@loc@TMPb}% - \let\pgfplotstable@loc@TMPa=\pgfplotstable@loc@TMPb - \pgfutil@ifundefined{pgfplotstblread@colindex@for@name\pgfplotstable@loc@TMPa}{% - \pgfplotsthrow{no such element}{#2}{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename'. The original request was for '#1', which does not exist either.}\pgfeov% - \def#2{0}% - }{% - \edef#2{\csname pgfplotstblread@colindex@for@name\pgfplotstable@loc@TMPa\endcsname}% - }% - }{% - \def\pgfplotstable@loc@TMPa{/pgfplots/table/create on use/#1}% - \pgfkeysifdefined{\pgfplotstable@loc@TMPa/.@cmd}{% - \pgfplotstable@error{Sorry, '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% - }{% - \pgfplotsthrow{no such element}{#2}{Sorry, could not retrieve column '#1' from table '\pgfplotstableread@filename'. Please check spelling (or introduce name aliases).}\pgfeov% - }% - \def#2{0}% - }% - }{% - \edef#2{\csname pgfplotstblread@colindex@for@name#1\endcsname}% - }% -}% - -% As \pgfplotstablereadgetptrtocolname, but this here access columns -% by index. -\def\pgfplotstablereadgetptrtocolindex@#1#2{\def#2{#1}}% - -% \pgfplotstablereadevalptr{<\ptr>}{<\content} -% writes the current value of <\ptr> to <\content>. The pointer <\ptr> -% must be initialised with \pgfplotstablereadgetptrtocolname -\let\pgfplotstablereadevalptr@=\pgfplotstablereadgetcolindex@ - -% \pgfplotstablereadvalueofptr{<\ptr>} -> expands to the pointers value. -% -% The pointer \ptr must be initialised with -% \pgfplotstablereadgetptrtocolname. -\let\pgfplotstablereadvalueofptr@=\pgfplotstablereadvalueofcolindex@ -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -\long\def\pgfplotstableread@impl@nextrow@NEXT@listener#1{% - \expandafter\def\csname pgfplotstblread@colcontent@no\thepgfplotstableread@curcol\endcsname{#1}% - \pgfplotstableread@countadvance\pgfplotstableread@curcol -} - -\long\def\pgfplotstableread@impl@nextrow@NEXT#1{% -%\pgfplots@message{Inserting '#1' at (\thepgfplotstableread@lineno, \thepgfplotstableread@curcol).}% - \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax - \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc - \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% - \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \else - \begingroup - \t@pgfplots@tokc={#1}% - \pgfplotstable@error{Table '\pgfplotstableread@filename' has too much columns in line \thepgfplotstableread@lineno: Ignoring '\the\t@pgfplots@tokc'. Please verify that every cell entry is separated correctly (use braces {<cell entry>} if necessary). This error is not critical}% - \endgroup - \fi -} - - - -\long\def\pgfplotstableread@impl@collectcolnames@NEXT#1{% -%\pgfplots@message{Got column name no \thepgfplotstableread@curcol\ as '#1'}% - \pgfutil@ifundefined{pgfplotstableread@impl@COLNAME@#1}{% - \def\pgfplotstable@loc@TMPa{#1}% - }{% generate unique column names warning: - \pgfplots@warning{Table '\pgfplotstableread@filename' has non-unique column name '#1'. Only the first occurence can be accessed via column names.}% - \edef\pgfplotstable@loc@TMPa{#1--index\thepgfplotstableread@curcol}% - }% - \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. - \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames@glob - \ifpgfplots@tableread@to@listener - % create an associative container colindex -> colname - % for use in a listener. - \expandafter\edef\csname pgfplotstblread@colindex@for@name#1\endcsname{\thepgfplotstableread@curcol}% - \fi - \pgfplotstableread@countadvance\pgfplotstableread@curcol -} - - - - -\long\def\pgfplotstableread@impl@countcols@and@identifynames@NEXT#1{% - \pgfplotstableread@countadvance\pgfplotstableread@curcol - \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{\pgfplotsthrow{unsupported operation}{#1}\pgfeov}% - - -\def\pgfplotstableset{% - \pgfqkeys{/pgfplots/table}% -}% - -% Accepts a macro #1 which contains an argument denoting a column -% name. -% -% It checks whether #1 starts with '[index]', 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\pgfplotstable@is@colname#1{% - \expandafter\pgfplotstabletypeset@is@colname@#1\pgfplotstable@EOI - \ifpgfplotstableread@foundcolnames - \else - \let#1=\pgfplotstable@loc@TMPa - \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@loc@TMPa{#1}% - \ifx\pgfplotstable@loc@TMPa\pgfplotstabletypeset@is@colname@index@@ - \pgfplotstableread@foundcolnamesfalse - \edef\pgfplotstable@loc@TMPa{#2}% - \else - \pgfplotstableread@foundcolnamestrue - \fi -}% -\def\pgfplotstabletypeset@is@colname@name#1\pgfplotstable@EOI{}% \long\def\pgfplotstabletypeset@getfinalentry#1#2{% \begingroup \def\pgfplotstablepartno{0}% \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1}% \pgfkeyssetvalue{/pgfplots/table/@unprocessed cell content}{#1}% + \pgfplotstable@debug@notify@cellcontent% \pgfkeysvalueof{/pgfplots/table/preproc cell content/.@cmd}#1\pgfeov \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% \pgfkeyslet{/pgfplots/table/@preprocessed cell content}\pgfmathresult% + \pgfplotstable@debug@notify@cellcontent@preprocessed% % \pgfkeysgetvalue{/pgfplots/table/assign cell content/.@cmd}\pgfplotstable@assigncell \expandafter\pgfplotstable@assigncell\pgfmathresult\pgfeov + \pgfplotstable@debug@notify@cellcontent@assigned% % \pgfkeysgetvalue{/pgfplots/table/postproc cell content/.@cmd}\pgfplotstable@postproccellcontent \ifx\pgfplotstable@postproccellcontent\pgfplotstable@postproccellcontent@EMPTY @@ -2591,12 +1382,84 @@ \expandafter\pgfplotstable@postproccellcontent\pgfplotstabletypeset@rawinput\pgfeov \fi \fi + \pgfplotstable@debug@notify@cellcontent@postprocessed% \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% \pgfmath@smuggleone\pgfmathresult \endgroup \let#2=\pgfmathresult }% +\def\pgfplotstable@debug@notify@cellcontent{}% +\def\pgfplotstable@debug@notify@cellcontent@preprocessed{}% +\def\pgfplotstable@debug@notify@cellcontent@assigned{}% +\def\pgfplotstable@debug@notify@cellcontent@postprocessed{}% +\def\pgfplotstable@debug@notify@preprocess@incol#1{}% +\def\pgfplotstable@debug@notify@preprocess@col#1{}% +\def\pgfplotstable@debug@notify@preprocessed@col#1{}% +\def\pgfplotstable@debug@notify@balancingcell{}% + +\def\pgfplotstable@debug@notify@cellcontent@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: Before cell content processing: `\the\toks0'}% + \endgroup +}% +\def\pgfplotstable@debug@notify@cellcontent@preprocessed@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: After '@preproc cell content : `\the\toks0'}% + \endgroup +}% +\def\pgfplotstable@debug@notify@cellcontent@assigned@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: After 'assign cell content : `\the\toks0'}% + \endgroup +}% +\def\pgfplotstable@debug@notify@cellcontent@postprocessed@ACTIVE{% + \begingroup + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult% + \toks0=\expandafter{\pgfmathresult}% + \immediate\write16{Row \pgfplotstablerow/out \the\c@pgfplotstable@counta: After 'postproc cell content : `\the\toks0'}% + \endgroup +} +\def\pgfplotstable@debug@notify@balancingcell@ACTIVE{% + \immediate\write16{Row --/out \the\c@pgfplotstable@counta: Inserting empty cell to balance rows}% +}% +\def\pgfplotstable@debug@notify@preprocess@incol@ACTIVE#1{% + \begingroup + \toks0=\expandafter{#1}% + \immediate\write16{>=== Loading input column `\the\toks0' <===}% + \endgroup +}% +\def\pgfplotstable@debug@notify@preprocess@col@ACTIVE#1{% + \begingroup + \toks0=\expandafter{#1}% + \immediate\write16{>=== Preprocessing output column `\the\toks0' <===}% + \endgroup +}% +\def\pgfplotstable@debug@notify@preprocessed@col@ACTIVE#1{% + \begingroup + \toks0=\expandafter{#1}% + \immediate\write16{>=== output column `\the\toks0' prepared, ok. <===}% + \endgroup +}% +\def\pgfplotstable@debug@activate{% + \ifnum\pgfkeysvalueof{/pgfplots/table/debug level}>0 + \let\pgfplotstable@debug@notify@preprocess@incol=\pgfplotstable@debug@notify@preprocess@incol@ACTIVE + \let\pgfplotstable@debug@notify@preprocess@col=\pgfplotstable@debug@notify@preprocess@col@ACTIVE + \let\pgfplotstable@debug@notify@preprocessed@col=\pgfplotstable@debug@notify@preprocessed@col@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent=\pgfplotstable@debug@notify@cellcontent@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent@preprocessed=\pgfplotstable@debug@notify@cellcontent@preprocessed@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent@assigned=\pgfplotstable@debug@notify@cellcontent@assigned@ACTIVE + \let\pgfplotstable@debug@notify@cellcontent@postprocessed=\pgfplotstable@debug@notify@cellcontent@postprocessed@ACTIVE + \let\pgfplotstable@debug@notify@balancingcell=\pgfplotstable@debug@notify@balancingcell@ACTIVE + \fi +}% + % This routine invokes 'postproc cell content' for columns which % contain the column separator '&'. % @@ -2641,12 +1504,12 @@ \pgfutil@in@,{#1}% \fi \fi - }% \def\pgfplotstable@insertemptycells@forbalance{% \pgfutil@loop \ifnum\c@pgfplotstable@counta<\pgfplotstable@firstnumrows\relax + \pgfplotstable@debug@notify@balancingcell % let's hope @getfinalentry handles empty strings! \pgfplotstabletypeset@getfinalentry{}{\pgfplotstable@entry}% \expandafter\pgfplotslistpushback\pgfplotstable@entry\to\pgfplotstable@col@processed @@ -2658,8 +1521,8 @@ % TODO % - replace grouped list foreach by popfront-loop and use arrays % directly -> group only the pgfkeys eval -\def\pgfplotstabletypeset@opt@[#1]#2{% - \begingroup +\long\def\pgfplotstabletypeset@opt@[#1]#2{% + %\begingroup <--- is already opened! %-------------------------------------------------- % \pgfutil@ifundefined{#2}{% % \pgfplots@error{There is no such table '\string#2' loaded into memory. Maybe you meant to use '\string\pgfplotstabletypesetfile{\string#2}' instead of '\string\pgfplotstabletypeset{\string#2}'?}% @@ -2675,9 +1538,7 @@ \ifpgfplots@table@options@areset \else \pgfplotstablegetname{#2}\pgfplotstable@loc@TMPa - \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% - \edef\pgfplotstable@loc@TMPa{/pgfplots/table/every table={\the\t@pgfplots@toka}}% - \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa,#1}% + \expandafter\pgfplotstableset@every@table\expandafter{\pgfplotstable@loc@TMPa}{#1}% \fi \pgfkeysgetvalue{/pgfplots/table/outfile}\pgfplotstable@outfilename \pgfkeysgetvalue{/pgfplots/table/TeX comment}\pgfplots@TeX@comment @@ -2696,8 +1557,18 @@ \fi \fi \ifpgfplotstabletypeset@includeoutfiles - \input \pgfplotstable@outfilename\relax + \def\pgfplots@loc@TMPa{% + \input \pgfplotstable@outfilename\relax + \endgroup + }% \else + \def\pgfplots@loc@TMPa{% + \pgfplotstabletypeset@opt@prepare{#2}% + }% + \fi + \pgfplots@loc@TMPa +}% +\def\pgfplotstabletypeset@opt@prepare#1{% % % Prepare outfile and debug options: \let\pgfplotstable@notify@finished@line=\pgfutil@empty @@ -2723,6 +1594,7 @@ \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \immediate\write16{\the\t@pgfplots@toka\pgfplots@TeX@comment}% }% + \pgfplotstable@debug@activate \fi \ifx\pgfplotstable@outfilename\pgfutil@empty \else @@ -2736,10 +1608,39 @@ % Start operation: \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% \ifx\pgfplotstable@colnames\pgfutil@empty - \pgfplotstablegetcolumnlist#2\to\pgfplotstable@colnames + \pgfplotstablegetcolumnlist#1\to\pgfplotstable@colnames \else \expandafter\pgfplotslistnew\expandafter\pgfplotstable@colnames\expandafter{\pgfplotstable@colnames}% \fi + % + % + \ifpgfplotstable@sort + % make sure any columns exist (especially create on use). + % this can be done by calling getcolumnbyname once for every + % column: + \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@colname{% + \pgfplotstable@is@colname\pgfplotstable@colname + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#1\to\pgfplotstable@colname + \fi + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@colname}\of#1\to\pgfplotstable@col + }% + \let\pgfplotstable@colname=\relax + \let\pgfplotstable@col=\relax + % + \def\pgfplots@loc@TMPa{% + \pgfplotstablesort\pgfplotstable@sortedtbl{#1}% + \pgfplotstabletypeset@opt@@{\pgfplotstable@sortedtbl}% + }% + \else + \def\pgfplots@loc@TMPa{% + \pgfplotstabletypeset@opt@@{#1}% + }% + \fi + \pgfplots@loc@TMPa +} +\def\pgfplotstabletypeset@opt@@#1{% \global\pgfplotslistnewempty\pgfplotstabletypeset@final@colnames \global\pgfplotslistnewempty\pgfplotstabletypeset@final@coltypes \global\pgfplotslistnewempty\pgfplotstabletypeset@final@cols @@ -2753,13 +1654,15 @@ \c@pgfplotstable@colindex=0\relax % FOREACH COLUMN: \pgfplotslistforeach\pgfplotstable@colnames\as\pgfplotstable@colname{% + \pgfplotstable@debug@notify@preprocess@incol\pgfplotstable@colname + % \c@pgfplotstable@rowindex=0\relax \pgfplotstable@is@colname\pgfplotstable@colname \ifpgfplotstableread@foundcolnames \else - \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#2\to\pgfplotstable@colname + \pgfplotstablegetcolumnnamebyindex\pgfplotstable@colname\of#1\to\pgfplotstable@colname \fi - \pgfplotstablegetcolumnbyname\pgfplotstable@colname\of#2\to\pgfplotstable@col + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@colname}\of#1\to\pgfplotstable@col % % Init number of *input* rows here. This may not be the same % as the number of *output* rows (see the row predicate @@ -2815,6 +1718,9 @@ \let\pgfplotstable@colname@out=\pgfplotstable@colname \fi \expandafter\pgfplotstabletypeset@assign@final@colname\expandafter{\pgfplotstable@colname@out}\pgfplotstable@colname@out + % + \pgfplotstable@debug@notify@preprocess@col\pgfplotstable@colname@out + % \expandafter\pgfplotslistpushbackglobal\pgfplotstable@colname@out\to\pgfplotstabletypeset@final@colnames \pgfkeysgetvalue{/pgfplots/table/column type}{\pgfplotstable@coltype}% \expandafter\pgfplotslistpushbackglobal\pgfplotstable@coltype\to\pgfplotstabletypeset@final@coltypes @@ -2850,217 +1756,225 @@ % balance columns: \pgfplotstable@insertemptycells@forbalance \fi + % + \pgfplotstable@debug@notify@preprocessed@col\pgfplotstable@colname@out + % \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@col@processed}\to\pgfplotstabletypeset@final@cols \global\advance\c@pgfplotstable@colindex by1\relax }% % - % 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 - \c@pgfplotstable@rowindex=-1\relax - \let\pgfplotstable@result=\pgfutil@empty - % - \pgfkeysgetvalue{/pgfplots/table/font}{\pgfplotstable@font}% - \ifx\pgfplotstable@font\pgfutil@empty + \pgfplotslistcheckempty\pgfplotstabletypeset@final@colnames + \ifpgfplotslistempty + \let\pgfplotstable@result=\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplotstable@font}% - \edef\pgfplotstable@curline{\noexpand\begingroup\the\t@pgfplots@toka}% - \pgfplotstable@curline@FLUSH - \fi - % - \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka}% - % - \ifpgfplotstabletypesetskipcoltypes - \else - % STEP 1.1: collect column types: - \def\pgfplotstable@resulttypes{}% - \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% - \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% - \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - }% - \ifx\pgfplotstable@resulttypes\pgfutil@empty + % 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 + \c@pgfplotstable@rowindex=-1\relax + \let\pgfplotstable@result=\pgfutil@empty + % + \pgfkeysgetvalue{/pgfplots/table/font}{\pgfplotstable@font}% + \ifx\pgfplotstable@font\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@font}% + \edef\pgfplotstable@curline{\noexpand\begingroup\the\t@pgfplots@toka}% + \pgfplotstable@curline@FLUSH \fi - \fi - \ifx\pgfplotstable@curline\pgfutil@empty - \else - \pgfplotstable@curline@FLUSH - \fi - % - % Step 1.2: Collect FIRST ROW (column names) - \begingroup - \pgfplotstableset{every head row}% - \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% - \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \xdef\pgfplots@glob@TMPc{% - \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% - \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% - }% - \endgroup - \pgfplots@glob@TMPc - % insert 'before row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% - \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% - % - \def\pgfplotstablecolname{\pgfplotstable@colname@out}% - \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% % - \advance\c@pgfplotstable@colindex by1\relax - % typeset the cell: - \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa - \expandafter\pgfplots@loc@TMPa\pgfplotstable@colname@out\pgfeov - \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka}% % - % append this cell: - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfmathresult}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - }% - % insert 'after row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - % - \pgfplotstable@curline@FLUSH - % -%\message{I have now \meaning\pgfplotstable@result.}% - % Step 2: column contents. - % 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 - \def\pgfplotstablecolname{\pgfplotstable@error{Sorry, you can't evaluate \string\pgfplotstablecolname\space in this context.}}% - \pgfutil@loop - \ifpgfplots@loop@CONTINUE - \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed - \pgfplotslistcheckempty\pgfplotstable@col@processed - \ifpgfplotslistempty - % assume that each column has the same number of entries - % (normalised tables): - \pgfplots@loop@CONTINUEfalse + \ifpgfplotstabletypesetskipcoltypes \else - \ifnum\c@pgfplotstable@colindex=0\relax - % Install styles for the next row. - \begingroup - \ifodd\c@pgfplotstable@rowindex - \t@pgfplots@toka={every odd row}% - \else - \t@pgfplots@toka={every even row}% - \fi - \ifnum\c@pgfplotstable@rowindex=0\relax - \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first row}% - \fi - \ifpgfplotstable@disable@rowcolstyles - \else - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% - \fi - % misuse as temporary variable: - \c@pgfplotstable@colindex=\c@pgfplotstable@rowindex - \advance\c@pgfplotstable@colindex by1\relax - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numrows - \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last row}% - \fi - \expandafter\pgfplotstableset\expandafter{\the\t@pgfplots@toka}% - \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% - \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \xdef\pgfplots@glob@TMPc{% - \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% - \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% - }% - \endgroup - \pgfplots@glob@TMPc - % insert 'before row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% - \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + % STEP 1.1: collect column types: + \def\pgfplotstable@resulttypes{}% + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% + \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% + \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + }% + \ifx\pgfplotstable@resulttypes\pgfutil@empty + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% \fi + \fi + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH + \fi + % + % Step 1.2: Collect FIRST ROW (column names) + \begingroup + \pgfplotstableset{every head row}% + \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% + \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \xdef\pgfplots@glob@TMPc{% + \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% + \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% + }% + \endgroup + \pgfplots@glob@TMPc + % insert 'before row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + % + \def\pgfplotstablecolname{\pgfplotstable@colname@out}% + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% % - % - \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 % typeset the cell: \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa - \expandafter\pgfplots@loc@TMPa\pgfplotstable@entry\pgfeov + \expandafter\pgfplots@loc@TMPa\pgfplotstable@colname@out\pgfeov \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult % % append this cell: \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \t@pgfplots@tokb=\expandafter{\pgfmathresult}% \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - % - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \c@pgfplotstable@colindex=0\relax - % insert 'after row' here: + }% + % insert 'after row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % + \pgfplotstable@curline@FLUSH + % + %\message{I have now \meaning\pgfplotstable@result.}% + % Step 2: column contents. + % 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 + \def\pgfplotstablecolname{\pgfplotstable@error{Sorry, you can't evaluate \string\pgfplotstablecolname\space in this context.}}% + \pgfutil@loop + \ifpgfplots@loop@CONTINUE + \pgfplotsarrayselect\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array\to\pgfplotstable@col@processed + \pgfplotslistcheckempty\pgfplotstable@col@processed + \ifpgfplotslistempty + % assume that each column has the same number of entries + % (normalised tables): + \pgfplots@loop@CONTINUEfalse + \else + \ifnum\c@pgfplotstable@colindex=0\relax + % Install styles for the next row. + \begingroup + \ifodd\c@pgfplotstable@rowindex + \t@pgfplots@toka={every odd row}% + \else + \t@pgfplots@toka={every even row}% + \fi + \ifnum\c@pgfplotstable@rowindex=0\relax + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first row}% + \fi + \ifpgfplotstable@disable@rowcolstyles + \else + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \fi + % misuse as temporary variable: + \c@pgfplotstable@colindex=\c@pgfplotstable@rowindex + \advance\c@pgfplotstable@colindex by1\relax + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numrows + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last row}% + \fi + \expandafter\pgfplotstableset\expandafter{\the\t@pgfplots@toka}% + \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% + \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \xdef\pgfplots@glob@TMPc{% + \noexpand\def\noexpand\pgfplotstable@before{\the\t@pgfplots@toka}% + \noexpand\def\noexpand\pgfplotstable@after{\the\t@pgfplots@tokb}% + }% + \endgroup + \pgfplots@glob@TMPc + % insert 'before row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \fi + % + % + \pgfplotslistpopfront\pgfplotstable@col@processed\to\pgfplotstable@entry + \pgfplotsarrayletentry\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array=\pgfplotstable@col@processed + \advance\c@pgfplotstable@colindex by1\relax + % typeset the cell: + \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa + \expandafter\pgfplots@loc@TMPa\pgfplotstable@entry\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + % + % append this cell: \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \t@pgfplots@tokb=\expandafter{\pgfmathresult}% \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - \advance\c@pgfplotstable@rowindex by1\relax - \pgfplotstable@curline@FLUSH + % + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax + \c@pgfplotstable@colindex=0\relax + % insert 'after row' here: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \advance\c@pgfplotstable@rowindex by1\relax + \pgfplotstable@curline@FLUSH + \fi + %\message{I have now \meaning\pgfplotstable@result.}% \fi -%\message{I have now \meaning\pgfplotstable@result.}% + \pgfutil@repeat + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \pgfkeysgetvalue{/pgfplots/table/end table}{\pgfplotstable@entry}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH + \fi + % + \ifx\pgfplotstable@font\pgfutil@empty + \else + \edef\pgfplotstable@curline{\noexpand\endgroup}% + \pgfplotstable@curline@FLUSH + \fi + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \immediate\closeout\pgfplotstable@outfile + \fi + %\message{I have now \meaning\pgfplotstable@result.}% + \def\pgfplotstablecol{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablecol\ in this context. It is ONLY valid during the preparation routines (please check the 'display columns/<index>' style in the manual).}}% + \def\pgfplotstablerow{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablerow\ in this context. It is ONLY valid during the preparation routines (please check the 'every row no <index>' style).}}% + \ifpgfplotstabletypesetresult + \pgfplotstable@result \fi - \pgfutil@repeat - \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% - \pgfkeysgetvalue{/pgfplots/table/end table}{\pgfplotstable@entry}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry}% - \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - \ifx\pgfplotstable@curline\pgfutil@empty - \else - \pgfplotstable@curline@FLUSH - \fi - % - \ifx\pgfplotstable@font\pgfutil@empty - \else - \edef\pgfplotstable@curline{\noexpand\endgroup}% - \pgfplotstable@curline@FLUSH - \fi - \ifx\pgfplotstable@outfilename\pgfutil@empty - \else - \immediate\closeout\pgfplotstable@outfile - \fi -%\message{I have now \meaning\pgfplotstable@result.}% - \def\pgfplotstablecol{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablecol\ in this context. It is ONLY valid during the preparation routines (please check the 'display columns/<index>' style in the manual).}}% - \def\pgfplotstablerow{\pgfplotstable@error{Sorry, you can't access the \string\pgfplotstablerow\ in this context. It is ONLY valid during the preparation routines (please check the 'every row no <index>' style).}}% - \ifpgfplotstabletypesetresult - \pgfplotstable@result \fi \pgfkeysgetvalue{/pgfplots/table/write to macro}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -3069,7 +1983,6 @@ \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% \xdef\pgfplots@glob@TMPa{\noexpand\def\expandafter\noexpand\pgfplots@loc@TMPa{\the\t@pgfplots@toka}}% \fi - \fi \endgroup \pgfplots@glob@TMPa% execute 'write to macro' if set. }% @@ -3080,6 +1993,7 @@ \def\pgfplotstablecreatecol@opt[#1]#2#3{% \begingroup + \def\pgfplotstablename{#3}% \pgfplotstableset{columns=,#1,% /pgf/fpu/handlers/empty number/.code 2 args={% \pgfmathfloatcreate{0}{0.0}{0}% @@ -3095,6 +2009,7 @@ \t@pgfplots@toka=\expandafter{#2}% this should handle macro names in '#2'. \edef\pgfplotstable@newcolname{\the\t@pgfplots@toka}% \global\pgfplotstablecreatecol@isreallynewtrue + \c@pgf@countd=0 \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@colname{% \pgfplotstable@is@colname\pgfplotstable@colname \ifpgfplotstableread@foundcolnames @@ -3106,7 +2021,10 @@ \ifx\pgfplotstable@colname\pgfplotstable@newcolname \global\pgfplotstablecreatecol@isreallynewfalse \fi + \expandafter\edef\csname pgfplotstablecreate@index@to@name@\the\c@pgf@countd\endcsname{\pgfplotstable@colname}% + \advance\c@pgf@countd by1 }% + \edef\pgfplotstablecols{\the\c@pgf@countd}% \pgfplotstable@isfirstrowtrue \pgfplotstable@islastrowfalse \pgfplotslistnewempty\pgfplotstable@newcol @@ -3121,6 +2039,17 @@ \def\prevrow##1{\pgfplotstable@thisrow@impl{##1}{pgfplotstablecreate@prev@}{\pgfplotstable@thisrow@impl@}}% \def\thisrow##1{\pgfplotstable@thisrow@impl{##1}{pgfplotstablecreate@cur@}{\pgfplotstable@thisrow@impl@}}% \def\nextrow##1{\pgfplotstable@thisrow@impl{##1}{pgfplotstablecreate@next@}{\pgfplotstable@thisrow@impl@}}% + \def\pgfplotstable@rowno@impl##1##2{% + \pgfutil@ifundefined{pgfplotstablecreate@index@to@name@##1}{% + \csname ##2row\endcsname{colindex##1}% + }{% + \csname ##2row\endcsname{\csname pgfplotstablecreate@index@to@name@##1\endcsname}% + }% + }% + \def\prevrowno##1{\pgfplotstable@rowno@impl{##1}{prev}}% + \def\thisrowno##1{\pgfplotstable@rowno@impl{##1}{this}}% + \def\nextrowno##1{\pgfplotstable@rowno@impl{##1}{next}}% + % \def\getprevrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@prev@##1\endcsname}% \def\getthisrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@cur@##1\endcsname}% \def\getnextrow##1##2{\expandafter\let\expandafter##2\csname pgfplotstablecreate@next@##1\endcsname}% @@ -3463,12 +2392,12 @@ % \ifx\pgfplotstable@colnames\pgfutil@empty \pgfplotstableforeachcolumn{#3}\as\pgfplots@colname{% + \t@pgfplots@toka=\expandafter{\pgfplots@colname}% \ifnum\pgfplotstablecol=0 - \let\pgfplotstable@colnames=\pgfplots@colname + \edef\pgfplotstable@colnames{{\the\t@pgfplots@toka}}% \else - \t@pgfplots@toka=\expandafter{\pgfplots@colname}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@colnames}% - \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,\the\t@pgfplots@toka}% + \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,{\the\t@pgfplots@toka}}% \fi }% \fi @@ -3476,15 +2405,19 @@ % sanity checking: \ifx\pgfplotstabletranspose@outcolnames\pgfutil@empty \else - \def\pgfplotstable@loc@TMPa{\expandafter\pgfutil@in@\expandafter{\pgfplotstabletranspose@outcolnames}}% - \expandafter\pgfplotstable@loc@TMPa\expandafter{\pgfplotstable@colnames}% - \ifpgfutil@in@ + \def\pgfplotstabletranspose@outcolnames@foundit{0}% + \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotstable@colnames}\as\pgfplots@colname{% + \ifx\pgfplots@colname\pgfplotstabletranspose@outcolnames + \def\pgfplotstabletranspose@outcolnames@foundit{1}% + \fi + }% + \if1\pgfplotstabletranspose@outcolnames@foundit \else % insert the 'colnames from' column into 'columns': \pgfplots@warning{table transposition: the 'colnames from=\pgfplotstabletranspose@outcolnames' is not part of 'columns'. Adding it.}% \t@pgfplots@toka=\expandafter{\pgfplotstabletranspose@outcolnames}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@colnames}% - \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,\the\t@pgfplots@toka}% + \edef\pgfplotstable@colnames{\the\t@pgfplots@tokb,{\the\t@pgfplots@toka}}% \fi \fi % @@ -3578,4 +2511,323 @@ \pgfplotstable@copy@globalbuffers@to{#2}% }% +% #1: keys +\def\pgfplotstable@linear@regression#1{% + \begingroup + \pgfqkeys{/pgfplots/table/create col/linear regression}{/pgf/fpu,#1}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/x}{\pgfplotstable@xsrc}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/y}{\pgfplotstable@ysrc}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/table}{\pgfplotstable@table}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/xmode}{\pgfplotstable@xmode}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/ymode}{\pgfplotstable@ymode}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/variance}{\pgfplotstable@variance@colname}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/variance list}{\pgfplotstable@variance@list}% + \pgfkeysgetvalue{/pgfplots/table/create col/linear regression/variance src}{\pgfplotstable@variance@table}% + % + \ifx\pgfplotstable@table\pgfutil@empty + \pgfutil@ifundefined{pgfplotstablename}{}{% + \let\pgfplotstable@table=\pgfplotstablename + }% + \fi + \ifx\pgfplotstable@table\pgfutil@empty + \pgfplots@error{Sorry, I couldn't determine a value for create col/linear regression/table. Which table should I load?}% + \fi + \ifx\pgfplotstable@xsrc\pgfutil@empty + \pgfplotsifinaddplottablestruct{% + \pgfutil@ifundefined{pgfplots@plot@tbl@x}{}{% + \let\pgfplotstable@xsrc=\pgfplots@plot@tbl@x + \ifx\pgfplotstable@ysrc\pgfutil@empty + \pgfplotstablegetcolsof\pgfplots@table + \ifnum\pgfplotsretval=2 + \else + \pgfplotsthrow{invalid argument}{\pgfplotstable@ysrc}{Sorry, I don't which column should be used as `y' for the linear regression. Please provide 'linear regression={y=<colname>}'}\pgfeov% + \fi + \fi + }% + }{}% + \fi + \ifx\pgfplotstable@xsrc\pgfutil@empty + \def\pgfplotstable@xsrc{[index]0}% + \fi + \ifx\pgfplotstable@ysrc\pgfutil@empty + \def\pgfplotstable@ysrc{[index]1}% + \fi + % + \t@pgfplots@toka=\expandafter{\pgfplotstable@table}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@xsrc}% + \t@pgfplots@tokc=\expandafter{\pgfplotstable@ysrc}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@tokb}\noexpand\of{\the\t@pgfplots@toka}}% + \edef\pgfplots@loc@TMPb{{\the\t@pgfplots@tokc}\noexpand\of{\the\t@pgfplots@toka}}% + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPa\to\pgfplotstable@X + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPb\to\pgfplotstable@Y + % + \edef\pgfplotstable@xmode{\pgfplotstable@xmode}% + \expandafter\pgfplotstable@linear@regression@prepare@mode\expandafter{\pgfplotstable@xmode}{x}%% + \edef\pgfplotstable@ymode{\pgfplotstable@ymode}% + \expandafter\pgfplotstable@linear@regression@prepare@mode\expandafter{\pgfplotstable@ymode}{y}%% + % + \ifx\pgfplotstable@variance@list\pgfutil@empty + % check 'variance' key (loaded from table) + \pgfplotslistnewempty\pgfplotstable@VARIANCE + \ifx\pgfplotstable@variance@colname\pgfutil@empty + \else + \ifx\pgfplotstable@variance@table\pgfutil@empty + \t@pgfplots@toka=\expandafter{\pgfplotstable@table}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@variance@table}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@tokb}\noexpand\of{\the\t@pgfplots@toka}}% + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPa\to\pgfplotstable@VARIANCE + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@variance@colname}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@variance@table}% + \edef\pgfplotstable@loc@TMPa{% + \noexpand\pgfplotstablegetcolumn{\the\t@pgfplots@toka}\noexpand\of{\the\t@pgfplots@tokb}\noexpand\to\noexpand\pgfplotstable@VARIANCE}% + \pgfplotstable@loc@TMPa + \fi + \fi + \else + % load from list: + \expandafter\pgfplotslistnew\expandafter\pgfplotstable@VARIANCE\expandafter{\pgfplotstable@variance@list}% + \fi + % + \pgfplotslistnewempty\pgfplotstable@Xparsed + % + \pgfmathfloatcreate{0}{0.0}{0}% + \let\pgfplotstable@S=\pgfmathresult + \let\pgfplotstable@Sxx=\pgfmathresult + \let\pgfplotstable@Sx=\pgfmathresult + \let\pgfplotstable@Sy=\pgfmathresult + \let\pgfplotstable@Sxy=\pgfmathresult + \pgfutil@loop + \pgfplotslistcheckempty\pgfplotstable@X + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \pgfplotslistpopfront\pgfplotstable@X\to\pgfplotstable@x + \pgfplotslistpopfront\pgfplotstable@Y\to\pgfplotstable@y + % + \pgfplotstableparsex{\pgfplotstable@x}% + \let\pgfplotstable@x=\pgfmathresult + \expandafter\pgfplotslistpushback\pgfmathresult\to\pgfplotstable@Xparsed + \pgfplotstableparsey{\pgfplotstable@y}% + \let\pgfplotstable@y=\pgfmathresult + % + \pgfplotslistcheckempty\pgfplotstable@VARIANCE + \ifpgfplotslistempty + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfplotstable@invsqr=\pgfmathresult + \else + \pgfplotslistpopfront\pgfplotstable@VARIANCE\to\pgfplotstable@variance + \pgfmathfloatparsenumber{\pgfplotstable@variance}% + \let\pgfplotstable@variance=\pgfmathresult + \pgfmathfloatmultiply@{\pgfplotstable@variance}{\pgfplotstable@variance}% + \let\pgfplotstable@sqr=\pgfmathresult + \pgfmathfloatreciprocal@{\pgfplotstable@sqr}% + \let\pgfplotstable@invsqr=\pgfmathresult + \fi + % + \pgfmathfloatadd@{\pgfplotstable@S}{\pgfplotstable@invsqr}% + \let\pgfplotstable@S=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplotstable@invsqr}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sx}{\pgfplots@table@accum}% + \let\pgfplotstable@Sx=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplots@table@accum}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sxx}{\pgfplots@table@accum}% + \let\pgfplotstable@Sxx=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@y}{\pgfplotstable@invsqr}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sy}{\pgfplots@table@accum}% + \let\pgfplotstable@Sy=\pgfmathresult + % + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplots@table@accum}% + \let\pgfplots@table@accum=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@Sxy}{\pgfplots@table@accum}% + \let\pgfplotstable@Sxy=\pgfmathresult + \pgfutil@repeat + % + \pgfmathparse{\pgfplotstable@S * \pgfplotstable@Sxx - \pgfplotstable@Sx *\pgfplotstable@Sx}% + \let\pgfplotstable@delta=\pgfmathresult + % + \pgfmathparse{(\pgfplotstable@S * \pgfplotstable@Sxy - \pgfplotstable@Sx * \pgfplotstable@Sy) / \pgfplotstable@delta}% + \let\pgfplotstable@a=\pgfmathresult + % + \pgfmathparse{(\pgfplotstable@Sxx * \pgfplotstable@Sy - \pgfplotstable@Sx * \pgfplotstable@Sxy) / \pgfplotstable@delta}% + \let\pgfplotstable@b=\pgfmathresult + % + \pgfplotslistnewempty\pgfplotstable@RESULT + \pgfplotslistforeachungrouped\pgfplotstable@Xparsed\as\pgfplotstable@x{% + \pgfmathfloatmultiply@{\pgfplotstable@x}{\pgfplotstable@a}% + \let\pgfplotstable@tmp=\pgfmathresult + \pgfmathfloatadd@{\pgfplotstable@tmp}{\pgfplotstable@b}% + \ifx\pgfplotstableparseylogbase\pgfutil@empty + \else + \pgfplotstableparseyinv@{\pgfmathresult}% + \fi + \pgfmathfloattosci{\pgfmathresult}% + \expandafter\pgfplotslistpushback\pgfmathresult\to\pgfplotstable@RESULT + }% + \pgfmathfloattosci\pgfplotstable@a + \let\pgfplotstable@a=\pgfmathresult + % + \pgfmathfloattosci\pgfplotstable@b + \let\pgfplotstable@b=\pgfmathresult + % + \global\let\pgfplotstableregressiona\pgfplotstable@a% + \global\let\pgfplotstableregressionb\pgfplotstable@b% + \let\pgfplotsretval=\pgfplotstable@RESULT + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% +\def\pgfplotstable@linear@regression@prepare@mode#1#2{% + \expandafter\def\csname pgfplotstableparse#2\endcsname##1{\pgfmathfloatparsenumber{##1}}% + \expandafter\def\csname pgfplotstableparse#2logbase\endcsname{}% + \edef\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{auto}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@loc@TMPa{}% auto == empty string + \fi + % + \ifx\pgfplots@loc@TMPa\pgfutil@empty + % `auto' mode. + \pgfplotsifinaxis{% + \pgfplots@if{pgfplots@#2islinear}{% + \def\pgfplots@loc@TMPa{linear}% + }{% + \def\pgfplots@loc@TMPa{log}% + }% + }{% + \def\pgfplots@loc@TMPa{linear}% + }% + \fi + % + \def\pgfplots@loc@TMPb{linear}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \else + \def\pgfplots@loc@TMPb{log}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \pgfplotsmathdefinemacrolnbase{pgfplotstableparse#2}{\pgfkeysvalueof{/pgfplots/log basis #2}}% + \else + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, the value '#1' is unexpected for 'linear regression/#2mode'}\pgfeov% + \fi + \fi +}% + + +% Sorts table #3 according to options defined in #1 and writes result +% to #2. +% +% \pgfplotstablesort[sort key=<colname>]\result{<input table>} +% \pgfplotstablesort[sort key=<colname>,sort key source=<\table>]\result{<input table>} +\def\pgfplotstablesort{\pgfutil@ifnextchar[{\pgfplotstablesort@opt}{\pgfplotstablesort@opt[]}} +\def\pgfplotstablesort@opt[#1]#2{% + \begingroup + \pgfplotstableset{#1}% + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplotstablesort@{#2}% + }% +} +\def\pgfplotstablesort@#1#2{% + \pgfkeysgetvalue{/pgfplots/table/sort key}\pgfplotstable@sort@key@colname + \pgfkeysgetvalue{/pgfplots/table/sort key from}\pgfplotstable@sort@key@table + \pgfkeysgetvalue{/pgfplots/table/sort cmp}\pgfplotstable@sort@cmp + % + % + \pgfplotstable@isloadedtable{#2}{% + \pgfplotstablegetrowsof{#2}% + \let\pgfplotstable@numrows=\pgfplotsretval + % + \pgfplotstabletranspose[input colnames to=,colnames from=]\pgfp@tmp{#2}% + \def\pgfplotstable@table{#2}% + \let\pgfplotstable@input@colnames=#2\relax + }{% + \pgfplotstableread{#2}\pgfp@tmp@in + \pgfplotstablegetrowsof\pgfp@tmp@in + \let\pgfplotstable@numrows=\pgfplotsretval + \def\pgfplotstable@table{\pgfp@tmp@in}% + \let\pgfplotstable@input@colnames=\pgfp@tmp@in + % + \pgfplotstabletranspose[input colnames to=,colnames from=]\pgfp@tmp\pgfp@tmp@in + }% + % + \ifx\pgfplotstable@sort@key@colname\pgfutil@empty + \else + \ifx\pgfplotstable@sort@key@table\pgfutil@empty + \t@pgfplots@toka=\expandafter{\pgfplotstable@table}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@sort@key@colname}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@tokb}\noexpand\of{\the\t@pgfplots@toka}}% + \expandafter\pgfplotstablegetcolumn\pgfplots@loc@TMPa\to\pgfplotstable@sort@key + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@sort@key@colname}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@sort@key@table}% + \edef\pgfplotstable@loc@TMPa{% + \noexpand\pgfplotstablegetcolumn{\the\t@pgfplots@toka}\noexpand\of{\the\t@pgfplots@tokb}\noexpand\to\noexpand\pgfplotstable@sort@key}% + \pgfplotstable@loc@TMPa + \fi + \fi + \pgfplotsarraynewempty\pgfplotstable@sort@key@array + \pgfplotslistforeachungrouped{\pgfplotstable@sort@key}\as\pgfplotstable@loc@TMPa{% + \expandafter\pgfplotsarraypushback\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@sort@key@array + }% + % + % + % use a side effect: columns are integers, they are stored as + % '\pgfp@tmp@<index>'. Thus, column names and array indices are + % essentially the same! That simplifies the operation and explains + % why we transposed the table. + % We simply interprete the transposed table as array. We don't + % even need to copy anything. + \pgfplotsarrayresize{\pgfp@tmp}{\pgfplotstable@numrows}% + % Oh, we also need the index to access the sort key. Well, then we + % did not win anything. + \pgfplotsarrayforeachungrouped\pgfp@tmp\as\pgfplotstable@loc@TMPa{% + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \edef\pgfplotstable@loc@TMPa{\pgfplotsarrayforeachindex:{\the\t@pgfplots@toka}}% + \pgfplotsarrayletentry{\pgfplotsarrayforeachindex}\of\pgfp@tmp=\pgfplotstable@loc@TMPa + }% + % extract current row index and row content: + \def\pgfplotstable@sort@extractindex##1:##2{% + \def\pgfmathresult{##1}% + \def\pgfplotstable@row{##2}% + }% + % + \expandafter\pgfplotsset\expandafter{\pgfplotstable@sort@cmp}% + \pgfkeysgetvalue{/pgfplots/iflessthan/.@cmd}\pgfplotstable@sort@cmp@routine + \def\pgfplotstable@sort@iflt##1##2##3##4{\pgfplotstable@sort@cmp@routine{##1}{##2}{##3}{##4}\pgfeov}% + % + \pgfkeysdefargs{/pgfplots/iflessthan}{##1##2##3##4}{% + \expandafter\pgfplotstable@sort@extractindex##1% + \pgfplotsarrayselect{\pgfmathresult}\of\pgfplotstable@sort@key@array\to\pgfplotstable@arga + \expandafter\pgfplotstable@sort@extractindex##2% + \pgfplotsarrayselect{\pgfmathresult}\of\pgfplotstable@sort@key@array\to\pgfplotstable@argb + \pgfplotstable@sort@iflt{\pgfplotstable@arga}{\pgfplotstable@argb}{##3}{##4}% + }% + \pgfkeysdef{/pgfplots/array/unscope pre}{% + % remove the row index: + \pgfplotsarrayforeachungrouped\pgfp@tmp\as\pgfplotstable@loc@TMPa{% + \expandafter\pgfplotstable@sort@extractindex\pgfplotstable@loc@TMPa% + \pgfplotsarrayletentry{\pgfplotsarrayforeachindex}\of\pgfp@tmp=\pgfplotstable@row + }% + % restore original form: + \pgfplotstabletranspose[input colnames to=,colnames from=]\pgfp@tmp@result\pgfp@tmp + % technical, transport result out of the current scope ... + \pgfplotstable@copy@to@globalbuffers\pgfp@tmp@result{\pgfplotstablenameof\pgfp@tmp}% + % ... and use this lowlevel thing to transport the original column names. + \global\let\pgfplotstable@colnames@glob=\pgfplotstable@input@colnames + }% + \pgfkeysdef{/pgfplots/array/unscope post}{}% + \pgfplotsarraysort{\pgfp@tmp}% + \endgroup + \pgfplotstable@copy@globalbuffers@to{#1}% +}% + +\pgfutil@ifundefined{pgfcalendardatetojulian}{% + \def\pgfcalendardatetojulian#1#2{\pgfplots@error{Sorry, you need to use \string\usepackage{pgfcalendar} before using date specific methods}}% +}{}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex new file mode 100644 index 00000000000..4a31f8fc84d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex @@ -0,0 +1,1826 @@ +%-------------------------------------------- +% +% Package pgfplotstable +% +% 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-2010 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 provides a high-level table manipulation and typesetting +% package. +% +% +% --------------------------------------------- +% Implementation notes for programmers: +% --------------------------------------------- +% +% The table data structure consists of +% 1. A name which must be a valid TeX macro like '\table' +% 2. A column list in the \pgfplotslist format. +% In fact, the column list is stored in the table's name: +% \pgfplotslistnewempty\table +% 3. A "file name" stored in +% \csname\string<\namemacro>@@table@name\endcsname +% 4. A "scan line length" number stored in +% \csname\string<\namemacro>@@table@scanline\endcsname +% It contains the value of \pgfplotsscanlinelength which has +% been identified right after \pgfplotstableread. +% 5. foreach column, there is a list of row-values (a row-vector) in +% the \pgfplotslist format named +% \csname\string<\namemacro>@<column name>\endcsname +% + +\newif\ifpgfplotstable@search@header +\newif\ifpgfplotstable@firstline@is@header +\newcount\c@pgfplotstable@counta +\newtoks\t@pgfplotstable@a +\newwrite\pgfplotstable@outfile +\newif\ifpgfplots@addplotimpl@readcompletely +% should always be false; use only in grouped internal macros +\newif\ifpgfplots@table@options@areset +\newif\ifpgfplots@tableread@to@listener +\newif\ifpgfplots@tableread@use@begingroup +\newif\ifpgfplotstable@trimcells + +\pgfkeys{% + /pgfplots/table/every table/.style={}, + /pgfplots/table/.unknown/.code={% + \pgfplotstable@error@pkg{Sorry, I do not know the key `\pgfkeyscurrentkeyRAW' and I am going to ignore it. Perhaps you need \string\usepackage{pgfplotstable}? (The table typesetting parts are a separate package)}% + },% + /pgfplots/table/header/.is choice, + /pgfplots/table/header/true/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headertrue}, + /pgfplots/table/header/false/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headerfalse}, + /pgfplots/table/header/has colnames/.code={\pgfplotstable@firstline@is@headertrue\pgfplotstable@search@headerfalse}, + /pgfplots/table/header=true, + /pgfplots/table/x index/.initial=0, + /pgfplots/table/x/.initial=, + /pgfplots/table/x expr/.initial=, + /pgfplots/table/y index/.initial=1, + /pgfplots/table/y/.initial=, + /pgfplots/table/y expr/.initial=, + /pgfplots/table/z index/.initial=2, + /pgfplots/table/z/.initial=, + /pgfplots/table/z expr/.initial=, + /pgfplots/table/meta index/.initial=, + /pgfplots/table/meta/.initial=, + /pgfplots/table/meta expr/.initial=, + /pgfplots/table/x error index/.initial=, + /pgfplots/table/y error index/.initial=, + /pgfplots/table/z error index/.initial=, + /pgfplots/table/x error/.initial=, + /pgfplots/table/y error/.initial=, + /pgfplots/table/z error/.initial=, + /pgfplots/table/x error expr/.initial=, + /pgfplots/table/y error expr/.initial=, + /pgfplots/table/z error expr/.initial=, + /pgfplots/table/ignore chars/.initial=, + /pgfplots/table/white space chars/.initial=, + /pgfplots/table/trim cells/.is if=pgfplotstable@trimcells, + /pgfplots/table/trim cells/.default=true, + /pgfplots/table/read completely/.is choice, + /pgfplots/table/read completely/true/.code= \pgfplots@addplotimpl@readcompletelytrue\def\pgfplots@addplotimpl@readcompletely@auto{0}, + /pgfplots/table/read completely/false/.code=\pgfplots@addplotimpl@readcompletelyfalse\def\pgfplots@addplotimpl@readcompletely@auto{0}, + /pgfplots/table/read completely/auto/.code=\pgfplots@addplotimpl@readcompletelyfalse\def\pgfplots@addplotimpl@readcompletely@auto{1}, + /pgfplots/table/read completely/.default=true, + /pgfplots/table/read completely=auto, + /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/tab/.code = {\def\pgfplotstableread@COLSEP@CASE{5}}, + /pgfplots/table/col sep/&/.code = {\def\pgfplotstableread@COLSEP@CASE{6}\pgfplotstable@trimcellstrue}, + /pgfplots/table/col sep/ampersand/.code = {\def\pgfplotstableread@COLSEP@CASE{6}\pgfplotstable@trimcellstrue}, + /pgfplots/table/col sep=space, + /pgfplots/table/format/.is choice, + /pgfplots/table/format/auto/.code = {\def\pgfplotstableread@FORMAT@CASE{0}}, + /pgfplots/table/format/inline/.code = {\def\pgfplotstableread@FORMAT@CASE{1}}, + /pgfplots/table/format/file/.code = {\def\pgfplotstableread@FORMAT@CASE{2}}, + /pgfplots/table/format=auto, + /pgfplots/table/row sep/.code={% + \pgfplotsutilifstringequal{#1}{\\}{% + \def\pgfplotstableread@ROWSEP@CASE{1}% + }{% + \pgfplotsutilifstringequal{#1}{crcr}{% + \def\pgfplotstableread@ROWSEP@CASE{1}% + }{% + \pgfplotsutilifstringequal{#1}{newline}{% + \def\pgfplotstableread@ROWSEP@CASE{0}% + }{% + {% + \t@pgfplots@tokc={#1}% + \pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Sorry, the choice `row sep=\the\t@pgfplots@tokc' is not known. Maybe you misspelled it? Try `\string\\' or `newline'.}\pgfeov% + }% + }% + }% + }% + },% + /pgfplots/table/row sep=newline, +} + +\pgfkeys{ + % #1: the argument which should have been assigned. + % #2: an error message. + /pgfplots/exception/non unique colname/.code 2 args={% + \ifx\pgfplotsexceptionmsg\relax + \pgfplots@error{#2}% + \else + \pgfplots@error{\pgfplotsexceptionmsg}% + \fi + \let#1=\pgfutil@empty + },% +} + +% \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. +% +% \pgfplotstableread[<options>]{<file>}{<\macro>} +% \pgfplotstableread[<options>]{<file>} to listener{<\macro>} +% \pgfplotstableread* ... +% +% The '*' does not protect its local variables with TeX groups, +% everything is added to the current scope (useful to the 'to +% listener' thing. +% +% The 'to listener' variant does NOT assemble a table data structure. +% Instead, it processes the input table row-wise and invokes <\macro> +% after each complete row. During the evaluation of <\macro>, the +% following methods can be used to query values: +% \pgfplotstablereadgetcolindex{<index>}{<\macro>} +% \pgfplotstablereadgetcolname{<name>}{<\macro>} +% \pgfplotstablereadvalueofcolname{<name>} +% \pgfplotstablereadvalueofcolindex{<index>} +% \thisrow{<name>} (equivalent to \pgfplotstablereadvalueofcolname) +% \getthisrow{<name>}{<\macro>} (equivalent to \pgfplotstablereadgetcolname) +% \thisrowno{<index>} (equivalent to \pgfplotstablereadvalueofcolindex) +% \getthisrowno{<index>}{<\macro>} +% \pgfplotstableforeachcolumn\as{<\iteratemacro>}{<loop body>} +% (the '\as' is required directly after +% \pgfplotstableforeachcolumn in this context) +% Attention: 'to listener' is scoped by TeX groups, so any assignments +% need to be done globally (or with aftergroup magic). +% +% More remarks about scoping: +% \pgfplotstableread to listener works as follows: +% \begingroup +% // load table +% while file has more lines: +% load line, read every column; +% invoke listener; +% repeat +% \endgroup +% +% In short: all invocations of listener have the same level of +% scoping: they are inside of one TeX group. But single listener +% invocations as such are not scoped. Make sure you don't +% accidentally overwrite one of the internals in listener. And: make +% sure you don't change temporary registers without scoping them! +% +% Note: this command also updates \pgfplotsscanlinelength. +\def\pgfplotstableread{% + \pgfutil@ifnextchar*{% + \pgfplots@tableread@use@begingroupfalse + \pgfplotstableread@impl@star + }{% + \pgfplots@tableread@use@begingrouptrue + \pgfplotstableread@impl@star*% + }% +}% +\def\pgfplotstableread@impl@star*{% + \pgfutil@ifnextchar[{% + \pgfplotstableread@impl + }{% + \pgfplotstableread@impl[]% + }% +} + +% BACKWARDS COMPATIBILITY +\let\pgfnumtableread=\pgfplotstableread + +% Invokes #2 if '#1' is an already loaded table and #3 if not. +\long\def\pgfplotstable@isloadedtable#1#2#3{% + \pgfplotsutil@ifdefinedui@withsuffix{#1}{@@table@name}{#2}{#3}% +}% + +% If the colum name `#1' is a `create on use' speicifcation, #2 is +% invoked, #3 otherwise. +\long\def\pgfplotstableifiscreateonuse#1#2#3{% + \pgfkeysifdefined{/pgfplots/table/create on use/#1/.@cmd}{#2}{% + \pgfutil@in@{create col/}{#1}% + \ifpgfutil@in@ + #2% + \else + #3% + \fi + }% +}% + +% Defines \pgfplotsretval to be a column name which does not already +% occur in the column names of table #1. +\def\pgfplotstablegenerateuniquecolnamefor#1{% + \begingroup + \c@pgf@countd=0 + \pgfplotstableforeachcolumn{#1}\as\pgfplots@loc@TMPa{% + \def\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% + \edef\pgfplots@loc@TMPb{autocol\the\c@pgf@countd}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \advance\c@pgf@countd by1 + \fi + }% + \edef\pgfplotsretval{autocol\the\c@pgf@countd}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup +} + +% Returns a column vector in form of \pgfplotslist +% into #3. +% +% #1: the column name (not a macro) +% #2: the table structure +% #3: the output macro name. +% +% @throw `no such element' on error +\def\pgfplotstablegetcolumnbyname#1\of#2\to#3{% + \let#3=\pgfutil@empty% just for sanity checking. + \pgfplotstable@getcol{#1}\of{#2}\to{#3}\getcolmethod{STD}% +} + +% Declares a new getcolmethod class #1. +% The argument '#1' can then be used as argument for +% \pgfplotstable@getcol...\getcolmethod{#1}. +% +% #2: a set of keys which redefine the behavior. +% See below for available choices. +\def\pgfplotstable@definegetcolmethod#1#2{% + \edef\pgfplotstable@definegetcolmethod@{#1}% + \pgfqkeys{/pgfplots/table/@getcol}{% + % Checks if column '#1' exists in table `#2' and invokes `#3' if that + % is the case and `#4' if not. + % + % Note that the check is only for physically existent colums, no alias + % or create on use is checked here. + % #1: colname + % #2: table struct + % #3: true code + % #4: false code + ifexists =\pgfutil@ifundefined{\string##2@##1}{##4}{##3}, + % + % Low level method to return (the actual content) of column #1 of + % table #2 to macro #3. + % #1: colname + % #2: table struct + % #3: result macro + getexisting =\expandafter\let\expandafter##3\csname\string##2@##1\endcsname, + % + % no arguments, the value is a boolean (0 or 1) + createonuse =1, + % + % error handling. + % #1: colname + % #2: table struct + % #3: result macro + lazyforbidden=\pgfplotstablegetcolumnbyname@impl@createonuseforbidden{##1}\of{##2}\to{##3}, + noalias =\pgfplotstablegetcolumnbyname@impl@nosuchalias{##1}\of{##2}\to{##3}, + nocol =\pgfplotstablegetcolumnbyname@impl@nocolumn{##1}\of{##2}\to{##3}, + #2% + }% +}% +\pgfqkeys{/pgfplots/table/@getcol}{% + ifexists/.code ={\expandafter\def\csname pgfplotstable@getcol@ifexists@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2##3##4{#1}},% + getexisting/.code ={\expandafter\def\csname pgfplotstable@getcol@getexisting@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% + createonuse/.code ={\expandafter\def\csname pgfplotstable@getcol@createonuse@\pgfplotstable@definegetcolmethod@\endcsname{#1}},% + lazyforbidden/.code ={\expandafter\def\csname pgfplotstable@getcol@lazyforbidden@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% + noalias/.code ={\expandafter\def\csname pgfplotstable@getcol@noalias@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% + nocol/.code ={\expandafter\def\csname pgfplotstable@getcol@nocol@\pgfplotstable@definegetcolmethod@\endcsname##1\of##2\to##3{#1}},% +}% + +\pgfplotstable@definegetcolmethod{STD}{}% +\pgfplotstable@definegetcolmethod{getptr}{% + ifexists =\pgfutil@ifundefined{pgfplotstblread@colindex@for@name#1}{#4}{#3},% + getexisting =\edef#3{\csname pgfplotstblread@colindex@for@name#1\endcsname},% +} +\pgfplotstable@definegetcolmethod{resolvename}{% + getexisting =\edef#3{#1},% +} + +% The low level implementation of \pgfplotstablegetcolumnbyname. +% +% #4: is a getcolmethod declared with \pgfplotstable@definegetcolmethod +% +% ATTENTION: this macro should be expandable! It is also used inside +% of \thisrow{}. +\def\pgfplotstable@getcol#1\of#2\to#3\getcolmethod#4{% + \csname pgfplotstable@getcol@ifexists@#4\endcsname{#1}\of{#2}{% + \csname pgfplotstable@getcol@getexisting@#4\endcsname{#1}\of{#2}\to#3% + }{% + % Oh, there is no column '#1' in table '#2'! + % + % Ok, then check for special features. + % + % 1. 'create col/...' + % 2. 'create on use' + % 3. 'alias' + % + % WARNING : this code has been REPLICATED in + % *** \pgfplotstablereadvalueofcolname *** + \if1\csname pgfplotstable@getcol@createonuse@#4\endcsname% + \pgfutil@in@{create col/}{#1}% + \ifpgfutil@in@ + \pgfplotstablegenerateuniquecolnamefor{#2}% + \def\pgfplotstable@loc@TMPa##1{% + \pgfkeysdef{/pgfplots/table/create on use/##1}{\pgfkeysalso{#1}}% + \pgfplotstablecreatecol[/pgfplots/table/create on use/##1]{##1}{#2}% + % and return the newly generated col: + \csname pgfplotstable@getcol@getexisting@#4\endcsname{##1}\of{#2}\to#3% + }% + \expandafter\pgfplotstable@loc@TMPa\expandafter{\pgfplotsretval}% + \else + \pgfplotstable@getcol@next{#1}\of{#2}\to{#3}\getcolmethod{#4}% + \fi + \else + \pgfplotstable@getcol@next{#1}\of{#2}\to{#3}\getcolmethod{#4}% + \fi + }% +}% +\def\pgfplotstable@getcol@next#1\of#2\to#3\getcolmethod#4{% + \pgfkeysifdefined{/pgfplots/table/create on use/#1/.@cmd}{% + % aah - a 'create on use' style exists. Apply it! + \if1\csname pgfplotstable@getcol@createonuse@#4\endcsname% + \pgfplotstablecreatecol[/pgfplots/table/create on use/#1]{#1}{#2}% + % and return the newly generated col: + \csname pgfplotstable@getcol@getexisting@#4\endcsname{#1}\of{#2}\to#3% + \else + \csname pgfplotstable@getcol@lazyforbidden@#4\endcsname{#1}\of{#2}\to#3% + \fi + }{% + % ok, then it is either an alias or it simply doesn't exist + \pgfkeysifdefined{/pgfplots/table/alias/#1}{% + \csname pgfplotstable@getcol@ifexists@#4\endcsname{\pgfkeysvalueof{/pgfplots/table/alias/#1}}\of{#2}{% + \csname pgfplotstable@getcol@getexisting@#4\endcsname{\pgfkeysvalueof{/pgfplots/table/alias/#1}}\of{#2}\to#3% + }{% + \csname pgfplotstable@getcol@noalias@#4\endcsname{#1}\of{#2}\to{#3}% + }% + }{% + \csname pgfplotstable@getcol@nocol@#4\endcsname{#1}\of{#2}\to{#3}% + }% + }% +} +\def\pgfplotstablegetcolumnbyname@impl@createonuseforbidden#1\of#2\to#3{% + \pgfplotstablegetcolumnbyname@impl@nocolumn@{#1}\of{#2}\to{#3}\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@ +} + +\def\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@#1{% + \space Note that I found a 'create on use/#1' style, but unfortunately, I can't evaluate it in this context. Please use the 'read completely' key such that it is processed earlier (see the manual for details)% +}% +\def\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@disable#1{}% + +\def\pgfplotstablegetcolumnbyname@impl@nosuchalias#1\of#2\to#3{ + \pgfplotstablegetcolumnbyname@impl@nosuchalias@{#1}\of{#2}\to{#3}\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@disable +}% + +\def\pgfplotstablegetcolumnbyname@impl@nosuchalias@#1\of#2\to#3#4{% + \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve aliased column '\pgfkeysvalueof{/pgfplots/table/alias/#1}' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.#4{#1}}\pgfeov% +}% + +\def\pgfplotstablegetcolumnbyname@impl@nocolumn#1\of#2\to#3{% + \pgfplotstablegetcolumnbyname@impl@nocolumn@{#1}\of{#2}\to{#3}\pgfplotstablegetcolumnbyname@impl@createonuseforbiddentext@disable +}% +\def\pgfplotstablegetcolumnbyname@impl@nocolumn@#1\of#2\to#3#4{% + \pgfplotsthrow{no such element}{#3}{Sorry, could not retrieve column '#1' from table '\pgfplotstablenameof{#2}'. Please check spelling (or introduce name aliases).#4{#1}}\pgfeov% +}% + + +% Retrieves the column *NAME* '#1' of table #2 and writes it into +% '#3'. +% +% If there is no such column, column aliases will be checked. Finally +% if there are no aliases, the command fails with an error. +% +% The 'create on use' statements can't be used in this context. +% @see \pgfplotstablegetcolumnbyname +% +% #1: a column name (not a macro) +% #2: the table structure +% #3: a macro name which will be filled with the (probably modified) +% column name into #2. +\def\pgfplotstableresolvecolname#1\of#2\to#3{% + \let#3=\pgfutil@empty% just for sanity checking. + \pgfplotstable@getcol{#1}\of{#2}\to{#3}\getcolmethod{resolvename}% +} + +% Invokes either \pgfplotstablegetcolumnbyindex or +% \pgfplotstablegetcolumnbyname. +% +% #1: either a column name, alias or create on use specification, or +% [index]<integer> denoting a column index. +% #2: either a loaded table or a table macro. +% #3: a macro name which will be filled with the column, in the format +% accepted of \pgfplotslist... +\long\def\pgfplotstablegetcolumn#1\of#2\to#3{% + \begingroup + \pgfplotstable@isloadedtable{#2}{% + \pgfplotstablegetcolumnfromstruct{#1}\of{#2}\to{#3}% + }{% + \pgfplotstableread{#2}\pgfplotstable@tmptbl + \pgfplotstablegetcolumnfromstruct{#1}\of\pgfplotstable@tmptbl\to{#3}% + }% + \pgfmath@smuggleone#3% + \endgroup +}% +\def\pgfplotstablegetcolumnfromstruct#1\of#2\to#3{% + \def\pgfplotstable@loc@TMPc{#1}% + \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% + \ifpgfplotstableread@foundcolnames + \else + \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc + \fi + \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to{#3}% +}% + +\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% + \pgfplotstablegetname#1\pgfplotstable@loc@TMPa + \expandafter\let\csname\string#2@@table@name\endcsname=\pgfplotstable@loc@TMPa + \expandafter\edef\csname\string#2@@table@scanline\endcsname{\pgfplotstablescanlinelengthof{#1}}% + \pgfplotslistforeachungrouped#1\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\let\csname\string#2@\pgfplotstable@loc@TMPa\endcsname}% + \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname + }% +} + +% Returns the file name of table '#1' into macro #2. +\def\pgfplotstablegetname#1#2{% + \expandafter\let\expandafter#2\csname\string#1@@table@name\endcsname +} + +% expands to the table file name of table '#1' +\def\pgfplotstablenameof#1{% + \csname\string#1@@table@name\endcsname +} + +% Returns the value of \pgfplotsscanlinelength for table '#1' into +% macro #2. +\def\pgfplotstablegetscanlinelength#1#2{% + \expandafter\let\expandafter#2\csname\string#1@@table@scanline\endcsname +}% + +% Expands to the scan line length of table '#1'. +\def\pgfplotstablescanlinelengthof#1{\csname\string#1@@table@scanline\endcsname}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% IMPLEMENTATION +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\ifpgfplotstableread@curline@contains@colnames +\newif\ifpgfplotstableread@foundcolnames +\newif\ifpgfplotstableread@skipline + +% A method which is necessary to work with inline table data. +% +% It does nothing if format=file. +% +% It needs to be invoked BEFORE the inline table data has been +% seen the first time. "Seen" means collected as argument! +% +% The macro changes \catcodes in order to implement the 'row sep=newline', +% some special 'col sep' choices and the 'ignore chars' features. +% +% ATTENTION: this changes the processing of ALL following newline +% characters. +% @see \pgfplotstablecollectoneargwithpreparecatcodes +\def\pgfplotstablereadpreparecatcodes{% + \ifx\pgfplotstablereadrestorecatcodes\relax + \edef\pgfplotstablereadrestorecatcodes{% + \noexpand\pgfplotstableuninstallignorechars + \noexpand\catcode`\noexpand\^^M=\the\catcode`\^^M\noexpand\space + \noexpand\catcode`\noexpand\ =\the\catcode`\ \noexpand\space + \noexpand\catcode`\noexpand\;=\the\catcode`\;\noexpand\space + \noexpand\catcode`\noexpand\:=\the\catcode`\:\noexpand\space + \noexpand\catcode`\noexpand\^^I=\the\catcode`\^^I\noexpand\space + \noexpand\let\noexpand\pgfplotstablereadrestorecatcodes=\noexpand\relax + }% + \ifcase\pgfplotstableread@FORMAT@CASE\relax + % format=auto + \pgfplotstablereadpreparecatcodes@ + \or + % format=inline + \pgfplotstablereadpreparecatcodes@ + \fi + \fi +} +\let\pgfplotstablereadrestorecatcodes=\relax +\def\pgfplotstablereadpreparecatcodes@{% + \if0\pgfplotstableread@ROWSEP@CASE\relax + % row sep = newline + \catcode`\^^M=12 + \fi + \ifcase\pgfplotstableread@COLSEP@CASE\relax + % col sep=space: + \catcode`\ =10 + \or + % col sep=comma: + \or + % col sep=semicolon: + \catcode`\;=12 + \or + % col sep=colon: + \catcode`\:=12 + \or + % col sep=brace: + \or + % col sep=tab: + \catcode`\^^I=12 + \fi + \pgfplotstableinstallignorechars +}% + +% Logically, this routine does +% \pgfplotstablereadpreparecatcodes +% #1 +% and that's all. However, It makes sure that any white space +% characters (especially newlines) between '#1' and the following +% argument are gobbled! +% +% To show the problem, consider +% \pgfplotstabletypeset[<options>] +% \loadedtable +% +% and we want to set the catcodes *before* \loadedtable is seen. +% Well, there is a newline character after ']'! If we change the +% catcodes, this newline will be considered as character and will make +% up the first argument, the \loadedtable will be ignored. +% +% \pgfplotstablecollectoneargwithpreparecatcodes avoids this problem +% by gobbling all space (newline) characters *before* collecting the +% directly following argument token. Furthermore, it restores the +% catcodes directly after the argument has been collected. +% +% @see \pgfplotstablecollectoneargwithpreparecatcodesnorestore +\long\def\pgfplotstablecollectoneargwithpreparecatcodes#1{% + \begingroup + \t@pgfplotstable@a{{#1}}% this allows '#' characters in '#1' + \def\pgfplotstablecollectoneargwithpreparecatcodes@@{% + \pgfplotstablereadpreparecatcodes + \expandafter\pgfplotstablecollectoneargwithpreparecatcodes@end\the\t@pgfplotstable@a% + }% + % equivalent to + %\let\pgfplotstable@loc@TMPa=<next token>\pgfplotstablecollectoneargwithpreparecatcodes@@<next token> + \futurelet\pgfplotstable@loc@TMPa\pgfplotstablecollectoneargwithpreparecatcodes@@ + % this employs a side effect: \futurelet gobbles any spaces + % (including newlines). +}% +\def\pgfplotstablecollectoneargwithpreparecatcodes@end#1#2{% + \endgroup + #1{#2}% +}% + +% An overloaded method of +% \pgfplotstablecollectoneargwithpreparecatcodes which does not +% restore the catcodes after collecting one arg. +\long\def\pgfplotstablecollectoneargwithpreparecatcodesnorestore#1{% + \t@pgfplotstable@a{{#1}}% + \def\pgfplotstablecollectoneargwithpreparecatcodes@@{% + \expandafter\pgfplotstablereadpreparecatcodes\t@pgfplotstable@a + }% + % equivalent to + %\let\pgfplotstable@loc@TMPa=<next token>\pgfplotstablecollectoneargwithpreparecatcodes@@<next token> + \futurelet\pgfplotstable@loc@TMPa\pgfplotstablecollectoneargwithpreparecatcodes@@ +}% + +% Accept one of +% \pgfplotstableread[#1]{<file>}{<\macro>} +% \pgfplotstableread[#1]{<file>} to listener{<\macro>} +% or +% \pgfplotstableread[#1]{<file>} to {<\macro>} (DEPRECATED) +\long\def\pgfplotstableread@impl[#1]{% + \ifpgfplots@tableread@use@begingroup + \begingroup + \def\endgroup@@pgfplotstableread{\endgroup}% + \else + \let\endgroup@@pgfplotstableread=\relax% + \fi + % set options here, although we can't evaluate 'every table' yet + % (the file name is not yet known). + % But #1 may contain input format specifiers which are important + % for \catcodes, BEFORE we have read the second argument: + \pgfplotstableset{#1}% + % + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplotstableread@impl@collectfirstarg{#1}% + }% +}% +\long\def\pgfplotstableread@impl@collectfirstarg#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: +\long\def\pgfplotstableread@impl@@#1#2to {% + \pgfutil@ifnextchar l{% + \pgfplotstableread@impl@@listener{#1}{#2}% + }{% + \pgfplotstableread@impl@{#1}{#2}% + }% +}% +\long\def\pgfplotstableread@impl@@listener#1#2listener#3{% + \pgfplots@tableread@to@listenertrue + \pgfplotstableread@impl@{#1}{#2}{#3}% + \pgfplots@tableread@to@listenerfalse +}% + +\newif\ifpgfplotstableread@inline +\long\def\pgfplotstableread@checkinlineformat@CRCR#1\\#2\pgfplotstable@EOI{% + \def\pgfplotstable@loc@TMPa{#2}% + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty + \pgfplotstableread@inlinefalse + \else + \pgfplotstableread@inlinetrue + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@CRCR + \fi +}% +\long\def\pgfplotstableread@loop@next@CRCR#1\\{% + \long\def\pgfplotstable@LINE{#1}% + \pgfplotstableread@loop@processnextline + \pgfplotstableread@loop@over@lines +}% +\begingroup +\catcode`\^^M=12\relax% +\long\gdef\pgfplotstableread@checkinlineformat@NL@#1^^M#2\pgfplotstable@EOI{% + \def\pgfplotstable@loc@TMPa{#2}% + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty% + \pgfplotstableread@inlinefalse% + \else% + \pgfplotstableread@inlinetrue% + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@NL% + \fi% +}% +\long\gdef\pgfplotstableread@checkinlineformat@NL#1{% + \pgfplotstableread@checkinlineformat@NL@ #1^^M\pgfplotstable@EOI% +}% +\long\gdef\pgfplotstableread@loop@next@NL#1^^M{% + \long\def\pgfplotstable@LINE{#1}% + \pgfplotstableread@loop@processnextline% + \pgfplotstableread@loop@over@lines% +}% +\endgroup + +% #1: options. +% #2: the table content (file name or inline data) +% #3: the result macro. +\long\def\pgfplotstableread@impl@#1#2#3{% + \ifcase\pgfplotstableread@FORMAT@CASE\relax + % format=auto + \ifcase\pgfplotstableread@ROWSEP@CASE\relax + % row sep=newline + \pgfplotstableread@checkinlineformat@NL{#2}% + \or + % row sep=crcr + \pgfplotstableread@checkinlineformat@CRCR #2\\\pgfplotstable@EOI + \fi + \or + % format=inline + \pgfplotstableread@inlinetrue + \ifcase\pgfplotstableread@ROWSEP@CASE\relax + % row sep=newline + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@NL + \or + % row sep=crcr + \let\pgfplotstableread@loop@next=\pgfplotstableread@loop@next@CRCR + \fi + \or + \pgfplotstableread@inlinefalse + \fi + % + \ifpgfplotstableread@inline + \def\pgfplotstableread@impl@fCLOSE{}% + \let\pgfplotstableread@loop@over@lines=\pgfplotstableread@loop@over@lines@frominline% + \long\def\pgfplotstableread@start@loop{% + \pgfplotstableread@loop@over@lines #2\pgfplotstable@EOI + }% + \def\pgfplotstableread@ready{1}% + \def\pgfplotstableread@filename{<inline_table>}% + \else + \def\pgfplotstableread@ready{1}% + \def\pgfplotstableread@filename{#2}% + \pgfplotstableread@openfile + \def\pgfplotstableread@impl@fCLOSE{% + \closein\r@pgfplots@reada + }% + \let\pgfplotstableread@loop@over@lines=\pgfplotstableread@loop@over@lines@fromfile% + \def\pgfplotstableread@start@loop{\pgfplotstableread@loop@over@lines}% + \pgfplotstableinstallignorechars + \fi + \edef\pgfplotstableread@oldendlinechar{\the\endlinechar}% + \endlinechar=-1 % do not append a white space after each line for file input +%\pgfplots@message{ATTEMPTING TO READ \pgfplotstableread@filename}% + % + \def\pgfplots@loc@TMPa{\pgfplotstableread@impl@prepare{#1}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplotstableread@filename}{#3}% + % + \if1\pgfplotstableread@ready + \pgfplotstableread@start@loop + % + \pgfplotstableread@impl@fCLOSE% + % + \pgfplotstableread@finish + % + \fi + \endlinechar=\pgfplotstableread@oldendlinechar + \pgfplotsscanlinelengthcleanup + \expandafter\pgfplotstable@copy@to@globalbuffers@simple\expandafter{\pgfplotstableread@filename}% + \endgroup@@pgfplotstableread + \ifpgfplots@tableread@to@listener + % there are no data structures in this case. + \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline + \else + % Now, we can access the global variables! + % copy them to #3. + \pgfplotstable@copy@globalbuffers@to#3% + \fi +} + +{\catcode`\"=12 \gdef\pgfplots@dquote{"}} + +% Opens \pgfplotstableread@filename. +\def\pgfplotstableread@openfile{% + \def\pgfplotstable@loc@TMPa{\pgfutil@in@{ }}% + \expandafter\pgfplotstable@loc@TMPa\expandafter{\pgfplotstableread@filename}% + \ifpgfutil@in@ + \t@pgfplots@toka=\expandafter{\pgfplotstableread@filename}% + \edef\pgfplotstableread@filename{\pgfplots@dquote\the\t@pgfplots@toka\pgfplots@dquote}% + \fi + \let\pgfplotstableread@old@crcr=\\% + \def\\{\string\\}% just to make sure we don't try to open inline table data... + \openin\r@pgfplots@reada=\pgfplotstableread@filename.tex + \ifeof\r@pgfplots@reada + \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax + \else + \pgfplots@warning{% + You requested to open table '\pgfplotstableread@filename', but there is also a '\pgfplotstableread@filename.tex'. + TeX will automatically append the suffix '.tex', so I will now open '\pgfplotstableread@filename.tex'. + Please make sure you don't accidentally load TeX files - this may produce unrecoverable errors.}% + \closein\r@pgfplots@reada + \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax + \fi + % + \ifeof\r@pgfplots@reada + \pgfplotsthrow{no such table file}{\pgfplots@loc@TMPa}{\pgfplotstableread@filename}{Could not read table file '\pgfplotstableread@filename'. In case you intended to provide inline data: maybe TeX screwed up your end-of-lines? Try `row sep=crcr' and terminate your lines with `\string\\' (refer to the pgfplotstable manual for details)}\pgfeov% + \global\let\pgfplotstable@colnames@glob=\pgfplots@loc@TMPa + \def\pgfplotstableread@ready{0}% + \fi + \pgfplots@logfileopen{\pgfplotstableread@filename}% + \let\\=\pgfplotstableread@old@crcr +} + +\def\pgfplotstableinstallignorechars{% + \ifx\pgfplotstableuninstallignorechars\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/ignore chars}\pgfplotstable@loc@TMPa + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty + \else + \pgfplotstableinstallignorechars@\pgfplotstable@loc@TMPa{9}% + \fi + \pgfkeysgetvalue{/pgfplots/table/white space chars}\pgfplotstable@loc@TMPa + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty + \else + \pgfplotstableinstallignorechars@\pgfplotstable@loc@TMPa{10}% + \fi + \ifx\pgfplotstableuninstallignorechars\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplotstableuninstallignorechars\expandafter{% + \pgfplotstableuninstallignorechars + \let\pgfplotstableuninstallignorechars=\pgfutil@empty + }% + \fi + \fi +}% +\let\pgfplotstableuninstallignorechars\pgfutil@empty% +% #1 macro containing the characters as comma-separated list +% #2 the catcode to assign +\def\pgfplotstableinstallignorechars@#1#2{% + \expandafter\pgfplotsutilforeachcommasep\expandafter{#1}\as\pgfplotstable@loc@TMPa{% + \t@pgfplots@toka=\expandafter{\pgfplotstableuninstallignorechars}% + \edef\pgfplotstableuninstallignorechars{% + \the\t@pgfplots@toka + \noexpand\catcode`\expandafter\noexpand\pgfplotstable@loc@TMPa=\expandafter\the\expandafter\catcode\expandafter`\pgfplotstable@loc@TMPa\noexpand\space + }% + \expandafter\catcode\expandafter`\pgfplotstable@loc@TMPa=#2\relax + }% +}% + +% #1: any options to set (respect \ifpgfplots@table@options@areset ) +% #2: the file name (if any) +% #3: the output macro (or listener) +\def\pgfplotstableread@impl@prepare#1#2#3{% + \ifpgfplots@table@options@areset + \else + \pgfplotstableset@every@table{#2}{#1}% + \fi + % + % local counter definitions: + \ifpgfplots@tableread@use@begingroup + \let\pgfplotstableread@lineno=\c@pgf@counta + \let\pgfplotstableread@numcols=\c@pgf@countb + \let\pgfplotstableread@curcol=\c@pgf@countc + \let\pgfplotstableread@usablelineno=\c@pgf@countd + \def\thepgfplotstableread@lineno{\the\pgfplotstableread@lineno}% + \def\thepgfplotstableread@usablelineno{\the\pgfplotstableread@usablelineno}% + \def\thepgfplotstableread@curcol{\the\pgfplotstableread@curcol}% + \def\thepgfplotstableread@numcols{\the\pgfplotstableread@numcols}% + \def\pgfplotstableread@countreset##1{##1=0 }% + \def\pgfplotstableread@countset##1##2{##1=##2\relax}% + \def\pgfplotstableread@countadvance##1{\advance##1 by1 }% + \else + % don't re-use integers! We have no protecting scopes! + \def\thepgfplotstableread@lineno{\pgfplotstableread@lineno}% + \def\thepgfplotstableread@usablelineno{\pgfplotstableread@usablelineno}% + \def\thepgfplotstableread@curcol{\pgfplotstableread@curcol}% + \def\thepgfplotstableread@numcols{\pgfplotstableread@numcols}% + \def\pgfplotstableread@countreset##1{\def##1{0}}% + \def\pgfplotstableread@countset##1##2{\def##1{##2}}% + \def\pgfplotstableread@countadvance##1{\pgfplotsutil@advancestringcounter{##1}}% + \fi + \pgfplotstableread@countreset\pgfplotstableread@lineno + \pgfplotstableread@countreset\pgfplotstableread@usablelineno + \pgfplotstableread@countreset\pgfplotstableread@numcols + \pgfplotstableread@countreset\pgfplotstableread@curcol + % + \pgfplotstableread@impl@prepare@DO + \def\pgfplotstableread@isgnuplotformat{0}% + \global\pgfplotslistnewempty\pgfplotstable@colnames@glob + \pgfplotsscanlinelengthinitzero + \ifpgfplots@tableread@to@listener + \def\pgfplotstablerow{\thepgfplotstableread@usablelineno}% + \def\pgfplotstablelineno{\thepgfplotstableread@lineno}% + \let\pgfplotstable@listener=#3% + \let\pgfplotstableread@impl@nextrow@NEXT=\pgfplotstableread@impl@nextrow@NEXT@listener + \let\pgfplotstablereadgetcolindex=\pgfplotstablereadgetcolindex@ + \let\pgfplotstablereadgetcolname=\pgfplotstablereadgetcolname@ + \let\pgfplotstablereadgetptrtocolname=\pgfplotstablereadgetptrtocolname@ + \let\pgfplotstablereadgetptrtocolindex=\pgfplotstablereadgetptrtocolindex@ + \let\pgfplotstablereadevalptr=\pgfplotstablereadevalptr@ + \let\pgfplotstablereadvalueofptr=\pgfplotstablereadvalueofptr@ + \let\pgfplotstableforeachcolumn=\pgfplotstableforeachcolumn@listener + \let\pgfplotstablereadvalueofcolname=\pgfplotstablereadvalueofcolname@ + \let\pgfplotstablereadvalueofcolindex=\pgfplotstablereadvalueofcolindex@ + \let\getthisrow=\pgfplotstablereadgetcolname + \let\thisrow=\pgfplotstablereadvalueofcolname + \let\thisrowno=\pgfplotstablereadvalueofcolindex + \let\getthisrowno=\pgfplotstablereadgetcolindex + \fi +}% + +% Copies the table column list and the column vectors of #1 to global buffers. +% @see \pgfplotstable@copy@globalbuffers@to +% +% Use these two methods to avoid scoping problems. +% +% #1: the <\macro> name of the table which is to be copied to global buffers. +% #2: the table file name. +\def\pgfplotstable@copy@to@globalbuffers#1#2{% + \global\let\pgfplotstable@colnames@glob=#1\relax + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname% + }% + \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname + \advance\c@pgfplotstable@counta by1\relax + }% + \pgfplotstable@copy@to@globalbuffers@simple{#2}% +}% +% A variant of \pgfplotstable@copy@to@globalbuffers which copies only +% the member variables of a loaded table (the name and scanline length) to +% global buffers. +% +% #1: the table's file name. +% +% @PRECONDITION: any other variables and cell data of the table are already stored +% in global buffers. +\def\pgfplotstable@copy@to@globalbuffers@simple#1{% + \gdef\pgfplotstable@glob@buf@name{#1}% + \global\let\pgfplotstable@glob@buf@scanline=\pgfplotsscanlinelength +}% + +% copies the global column list and the global column vectors to #1 +% (NOT the table file name). +% @see \pgfplotstable@copy@to@globalbuffers +% +% @PRECONDITION the global buffers contain all members of a table. +% +% @POSTCONDITION The table '#1' is be initialised to these members. +% Furthermore, \pgfplotsscanlinelength is set. +\def\pgfplotstable@copy@globalbuffers@to#1{% + \let#1=\pgfplotstable@colnames@glob + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\let\csname\string#1@\pgfplotstable@loc@TMPa\endcsname}% + \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname +%\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty + \advance\c@pgfplotstable@counta by1\relax + }% + \global\let\pgfplotstable@colnames@glob=\pgfutil@empty + \expandafter\let\csname\string#1@@table@scanline\endcsname=\pgfplotstable@glob@buf@scanline + \expandafter\let\csname\string#1@@table@name\endcsname=\pgfplotstable@glob@buf@name + \let\pgfplotsscanlinelength=\pgfplotstable@glob@buf@scanline +}% + +\def\pgfplotstableread@finish{% + \pgfplotsscanlinecomplete + \ifpgfplots@tableread@to@listener + \else + \ifpgfplotstableread@foundcolnames + \else + \pgfplotstableread@create@column@names@with@numbers + \fi + \pgfplotstableread@countreset\pgfplotstableread@curcol% + \pgfutil@loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \expandafter\pgfplotsapplistXflushbuffers\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \pgfutil@repeat + \fi +} + +\def\pgfplotstableread@loop@over@lines@fromfile{% + \ifeof\r@pgfplots@reada +%\pgfplots@message{EOF}% + \else + \read\r@pgfplots@reada to\pgfplotstable@LINE + \ifeof\r@pgfplots@reada + \else + \pgfplotstableread@loop@processnextline + \fi + \expandafter\pgfplotstableread@loop@over@lines + \fi +}% +\def\pgfplotstableread@loop@over@lines@frominline{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfutil@gobble + }{% + \pgfplotstableread@loop@next + }% +}% + +% PRECONDITION: +% \pgfplotstable@LINE contains the current input line. +\def\pgfplotstableread@loop@processnextline{% + \expandafter\pgfplotstableread@checkspecial@line\pgfplotstable@LINE\pgfplotstable@EOI + \ifpgfplotstableread@skipline + \def\pgfplotstableread@gnuplotcheck{####x y type}% + \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE + \def\pgfplotstableread@isgnuplotformat{1}% + \fi + \def\pgfplotstableread@gnuplotcheck{####x y z type}% + \ifx\pgfplotstableread@gnuplotcheck\pgfplotstable@LINE + \def\pgfplotstableread@isgnuplotformat{1}% + \fi + \else + %-------------------------------------------------- + % \ifnum\pgfplotstableread@lineno=0 + % \let\pgfplotstable@firstline=\pgfplotstable@LINE + % \fi + %-------------------------------------------------- +%\pgfplots@message{READING LINE \thepgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% + \pgfplotstableread@curline@contains@colnamesfalse + \ifnum\pgfplotstableread@numcols=0\relax + % STEP 0: initialise + % - count columns + % - find header data + \pgfplotstableread@countreset\pgfplotstableread@curcol + \ifpgfplotstable@firstline@is@header + \pgfplotstableread@curline@contains@colnamestrue + \fi + \pgfplotstableread@impl@DO\pgfplotstableread@impl@countcols@and@identifynames@NEXT\pgfplotstable@LINE + \pgfplotstableread@countset\pgfplotstableread@numcols{\pgfplotstableread@curcol}% + \pgfplotstableread@countreset\pgfplotstableread@curcol + % Create empty column lists: + \pgfplotstableread@create@column@lists + % + \ifnum\pgfplotstableread@usablelineno=0\relax + \if1\pgfplotstableread@isgnuplotformat% + % The file started with + % #... + % #x y type + % X Y i + % -> thats a gnuplot file! + \pgfplotstableread@curline@contains@colnamesfalse + \fi + \fi + % Now, read the first line. + % It contains either + % - column names, + % - numerical data, + % - nothing (comments). + \ifpgfplotstableread@curline@contains@colnames + \pgfplotstableread@foundcolnamestrue + \pgfplotstableread@countreset\pgfplotstableread@curcol + \pgfplotstableread@impl@DO\pgfplotstableread@impl@collectcolnames@NEXT\pgfplotstable@LINE + \else + \pgfplotsscanlinelengthincrease + \pgfplotstableread@foundcolnamesfalse + \pgfplotstableread@countreset\pgfplotstableread@curcol + % Leave column name lists empty... + \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE + \fi +%\pgfplots@message{After reading first row: found '\thepgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames@glob'}% + \else + \pgfplotsscanlinelengthincrease + \pgfplotstableread@countreset\pgfplotstableread@curcol + \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE + \fi + \ifnum\pgfplotstableread@curcol=\pgfplotstableread@numcols\relax + \else + \pgfplotstable@error{input table '\pgfplotstableread@filename' has an unbalanced number of columns in row '\thepgfplotstableread@lineno' (expected '\thepgfplotstableread@numcols' cols; got '\thepgfplotstableread@curcol'). Maybe the input table is corrupted? If you need unbalanced data, consider using 'nan' in empty cells (perhaps combined with 'unbounded coords=jump')}% + \fi + \ifpgfplots@tableread@to@listener + \ifpgfplotstableread@curline@contains@colnames + \else + % report row! + \pgfplotstable@listener + \fi + \fi + \pgfplotstableread@countadvance\pgfplotstableread@usablelineno + \fi + \pgfplotstableread@countadvance\pgfplotstableread@lineno +}% + +% WARNING: this routine is also used in pgfplots.code.tex ... +\def\pgfplotstableread@checkspecial@line{% + \pgfutil@ifnextchar##{% + \pgfplotstableread@skiplinetrue + \pgfplotstableread@impl@gobble + }{% + \pgfutil@ifnextchar${% + \pgfplotstableread@process@flags@line + }{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfplotstableread@skiplinetrue + \pgfplotsscanlinecomplete% the line is empty; same as \par! + \pgfplotstableread@impl@gobble + }{% + \pgfutil@ifnextchar\par{% + \pgfplotstableread@skiplinetrue + \pgfplotsscanlinecomplete + \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{% + \pgfutil@loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \def\pgfplots@loc@TMPa{\pgfplotsapplistXnewempty[to global]}% + \expandafter\pgfplots@loc@TMPa\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \pgfutil@repeat +} + +\def\pgfplotstableread@create@column@names@with@numbers{% + \pgfplotstableread@countreset\pgfplotstableread@curcol + \pgfutil@loop + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \edef\pgfplotstable@loc@TMPb{\thepgfplotstableread@curcol}% + \expandafter\pgfplotslistpushbackglobal\pgfplotstable@loc@TMPb\to\pgfplotstable@colnames@glob + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \pgfutil@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. +\long\def\pgfplotstableread@impl@DO#1#2{% + \ifpgfplotstable@trimcells + \def\pgfplotstableread@impl@ITERATE@NEXT@##1{% + \pgfkeys@spdef\pgfplotstableread@impl@ITERATE@NEXT@@@{##1}% + \expandafter#1\expandafter{\pgfplotstableread@impl@ITERATE@NEXT@@@}% + }% + \else + \let\pgfplotstableread@impl@ITERATE@NEXT@=#1\relax + \fi + \expandafter\pgfplotstableread@impl@DO@\expandafter{#2}% +} +{% + \catcode`\ =10 + \catcode`\;=12 + \catcode`\:=12 + \gdef\pgfplotstableread@impl@prepare@DO{% + \ifcase\pgfplotstableread@COLSEP@CASE\relax + % col sep=space: + \catcode`\ =10 + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1 \pgfplotstable@EOI}% + \or + % col sep=comma: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COMMA + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1,\pgfplotstable@EOI}% + \or + % col sep=semicolon: + \catcode`\;=12 + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1;\pgfplotstable@EOI}% + \or + % col sep=colon: + \catcode`\:=12 + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@COLON + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1:\pgfplotstable@EOI}% + \or + % col sep=brace: + % allow multi line cells: + \endlinechar=\pgfplotstableread@oldendlinechar\relax + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@BRACE + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1\pgfplotstable@EOI}% + \or + % col sep=tab: + \catcode`\^^I=12 + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@TAB + \long\edef\pgfplotstableread@impl@DO@##1{\noexpand\pgfplotstableread@impl@ITERATE##1\pgfplotstableread@tab\noexpand\pgfplotstable@EOI}% + \or + % col sep=&: + \let\pgfplotstableread@impl@ITERATE@NEXT=\pgfplotstableread@impl@ITERATE@NEXT@AMPERSAND + \long\def\pgfplotstableread@impl@DO@##1{\pgfplotstableread@impl@ITERATE##1&\pgfplotstable@EOI}% + \fi + }% +}% +\long\def\pgfplotstableread@impl@ITERATE{% + \pgfutil@ifnextchar\pgfplotstable@EOI{% + \pgfplotstableread@impl@gobble + }{% + \pgfplotstableread@impl@ITERATE@NEXT + }% +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT#1 {% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@COMMA#1,{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@SEMICOLON#1;{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@COLON#1:{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@BRACE#1{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\long\def\pgfplotstableread@impl@ITERATE@NEXT@AMPERSAND#1&{% + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\begingroup +\catcode`\^^I=12 +\gdef\pgfplotstableread@tab{^^I}% +\long\gdef\pgfplotstableread@impl@ITERATE@NEXT@TAB#1^^I{% the following white spaces are SPACES, not tabs: + \pgfplotstableread@impl@ITERATE@NEXT@{#1}% + \pgfplotstableread@impl@ITERATE +}% +\endgroup +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% these values are only usable for a read-listener, that means: +% when using +% +% \pgfplotstableread{<file>} to listener<\macro> +% +% -> <\macro> can than use the methods +% +% \pgfplotstablereadgetcolindex{<index>}{<\content>} +% performs \let\content=<content of column no <index> > +\def\pgfplotstablereadgetcolindex@#1#2{% + \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% + \pgfplotsthrow{no such element}{#2}{Sorry, the requested column number '#1' in table '\pgfplotstableread@filename' does not exist!? Please verify you used the correct index 0 <= i < N.}\pgfeov% + }{% + \expandafter\let\expandafter#2\csname pgfplotstblread@colcontent@no#1\endcsname + }% +}% + +\pgfkeysdef{/pgfplots/table/@undefined column text}{#1__column_not_found.}% +\def\pgfplotstable@undefinedtext#1{\pgfkeysvalueof{/pgfplots/table/@undefined column text/.@cmd}#1\pgfeov}% + +% As \pgfplotstablereadgetcolindex, but +% \pgfplotstablereadvalueofcolindex{<index>} +% directly expands to the value stored in the desired column. +% +% Example: +% \pgfplotstablereadvalueofcolindex{3} -> expands to '42' if '42' is +% written in column no 3. +% +% Column indexing starts at 0. +% +% @ATTENTION: since such a command may occur within an \edef or an +% \csname, it can't perform sanity checking. Proving an invalid index +% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. +\def\pgfplotstablereadvalueofcolindex@#1{% + \pgfutil@ifundefined{pgfplotstblread@colcontent@no#1}{% + \pgfplotstable@undefinedtext{colindex#1}% + }{% + \csname pgfplotstblread@colcontent@no#1\endcsname + }% +} + +% \pgfplotstablereadgetcolname{<name>}{<\content>} +% performs \let\content=<content of column named <name> > +\def\pgfplotstablereadgetcolname@#1#2{% + \pgfplotstablereadgetptrtocolname{#1}{\pgfplots@loc@TMPa}% + \pgfplotstablereadevalptr\pgfplots@loc@TMPa{#2}% +}% + +% This here is the implementation of \pgfplotstablereadvalueofcolname +% (and \thisrow{<colname>}) for use inside of the 'read to listener' +% framework. +% +% Like \pgfplotstablereadgetcolname, but this one expands directly to +% the value of the desired column. +% +% #1: a column name or a column alias. +% +% @ATTENTION: since such a command may occur within an \edef or an +% \csname, it can't perform sanity checking. Proving an invalid index +% expands to \pgfkeysvalueof{/pgfplots/table/@undefined column text}. +\def\pgfplotstablereadvalueofcolname@#1{% + \pgfplotstable@thisrow@impl{#1}{pgfplotstblread@colindex@for@name}{\pgfplotstable@thisrow@impl@read}% +}% +\def\pgfplotstable@thisrow@impl@read#1{\csname pgfplotstblread@colcontent@no#1\endcsname}% + +% This implements \thisrow in different contexts. +% +% Usage: +% \def\thisrow#1{\pgfplotstable@thisrow@impl{#1}{macroprefix@}{\pgfplotstable@thisrow@impl@}} +% +% Then, \thisrow{existingcol} +% will expand to +% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@existingcol\endcsname} +% -> \csname macroprefix@existingcol\endcsname +% +% Furthermore, if '#1' is no existing col and there exists /pgfplots/table/alias/#1, +% \thisrow{aliased} +% will expand to +% -> \pgfplotstable@thisrow@impl@{\csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname} +% -> \csname macroprefix@\pgfkeysvalueof{/pgfplots/table/alias/aliased}\endcsname +% +% #1: the argument for \thisrow{#1} +% #2: a macro prefix such that \csname #2<colname>\endcsname contains +% the value of the current row for (physical) column <colname> +% #3: the name of a one-argument-macro which will get \csname #2<colname>\endcsname +% as argument. This is the last step of \thisrow. It allows indirect +% access by translating colnames to col indices in '\pgfplotstableread to listener' +\def\pgfplotstable@thisrow@impl#1#2#3{% + \pgfutil@ifundefined{#2#1}% + {% + % WARNING : this code has been REPLICATED in + % *** \pgfplotstablereadgetptrtocolname *** + % *** \pgfplotstablegetcolumnbyname *** + % *** \pgfplotstableresolvecolname *** + % *** \pgfplotstablereadvalueofcolname *** + \pgfkeysifdefined{/pgfplots/table/alias/#1}{% + \pgfutil@ifundefined{#2\pgfkeysvalueof{/pgfplots/table/alias/#1}}{% + \pgfplotstable@undefinedtext{\pgfkeysvalueof{/pgfplots/table/alias/#1}}% + }{% + #3{\csname #2\pgfkeysvalueof{/pgfplots/table/alias/#1}\endcsname}% + }% + }{% + \pgfplotstable@undefinedtext{#1}% + }% + }% + {% + #3{\csname #2#1\endcsname}% + }% +}% +\def\pgfplotstable@thisrow@impl@#1{#1}% + +% \pgfplotstablereadgetptrtocolname{<name>}{\ptr} +% Creates some sort of "pointer" to the column named <name>. This +% pointer can than be used every time a new line has been reported to +% the listener. It works like this: +% +% \let\ptr=\pgfutil@empty +% \def\macro{% +% \ifx\ptr\empty +% \pgfplotstablereadgetptrtocolname{<my col>}{\ptr}% +% \fi +% \pgfplotstablereadevalptr{\ptr}{\content}% +% -> do something with \content! +% } +% +% \pgfplotstableread{<file>} to listener<\macro> +% +% -> will evaluate \macro foreach row. +% +% The advantage of such a prepared pointer over \thisrow{#1} or +% \getthisrow{#1} is simply efficiency and sanity checking: the checks +% are done at the time of pointer creation, dereferencing the pointer +% is fast. +\def\pgfplotstablereadgetptrtocolname@#1#2{% + \def#2{0}% + \pgfplotstable@getcol{#1}\of{\pgfplotstableread@filename}\to{#2}\getcolmethod{getptr}% +}% + +% As \pgfplotstablereadgetptrtocolname, but this here access columns +% by index. +\def\pgfplotstablereadgetptrtocolindex@#1#2{\def#2{#1}}% + +% \pgfplotstablereadevalptr{<\ptr>}{<\content} +% writes the current value of <\ptr> to <\content>. The pointer <\ptr> +% must be initialised with \pgfplotstablereadgetptrtocolname +\let\pgfplotstablereadevalptr@=\pgfplotstablereadgetcolindex@ + +% \pgfplotstablereadvalueofptr{<\ptr>} -> expands to the pointers value. +% +% The pointer \ptr must be initialised with +% \pgfplotstablereadgetptrtocolname. +\let\pgfplotstablereadvalueofptr@=\pgfplotstablereadvalueofcolindex@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\long\def\pgfplotstableread@impl@nextrow@NEXT@listener#1{% + \expandafter\def\csname pgfplotstblread@colcontent@no\thepgfplotstableread@curcol\endcsname{#1}% + \pgfplotstableread@countadvance\pgfplotstableread@curcol +} + +\long\def\pgfplotstableread@impl@nextrow@NEXT#1{% +%\pgfplots@message{Inserting '#1' at (\thepgfplotstableread@lineno, \thepgfplotstableread@curcol).}% + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols\relax + \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc + \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% + \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\thepgfplotstableread@curcol\endcsname + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \else + \begingroup + \t@pgfplots@tokc={#1}% + \pgfplotstable@error{Table '\pgfplotstableread@filename' has too much columns in line \thepgfplotstableread@lineno: Ignoring '\the\t@pgfplots@tokc'. Please verify that every cell entry is separated correctly (use braces {<cell entry>} if necessary). This error is not critical}% + \endgroup + \fi +} + + + +\long\def\pgfplotstableread@impl@collectcolnames@NEXT#1{% +%\pgfplots@message{Got column name no \thepgfplotstableread@curcol\ as '#1'}% + \pgfutil@ifundefined{pgfplotstableread@impl@COLNAME@#1}{% + \def\pgfplotstable@loc@TMPa{#1}% + }{% generate unique column names warning: + \pgfplots@warning{Table '\pgfplotstableread@filename' has non-unique column name '#1'. Only the first occurence can be accessed via column names.}% + \edef\pgfplotstable@loc@TMPa{#1--index\thepgfplotstableread@curcol}% + }% + \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames@glob + \ifpgfplots@tableread@to@listener + % create an associative container colindex -> colname + % for use in a listener. + \expandafter\edef\csname pgfplotstblread@colindex@for@name#1\endcsname{\thepgfplotstableread@curcol}% + \fi + \pgfplotstableread@countadvance\pgfplotstableread@curcol +} + + + + +\long\def\pgfplotstableread@impl@countcols@and@identifynames@NEXT#1{% + \pgfplotstableread@countadvance\pgfplotstableread@curcol + \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{\pgfplotsthrow{unsupported operation}{#1}\pgfeov}% + + +\def\pgfplotstableset{% + \pgfqkeys{/pgfplots/table}% +}% + +% Accepts a macro #1 which contains an argument denoting a column +% name. +% +% It checks whether #1 starts with '[index]', 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\pgfplotstable@is@colname#1{% + \expandafter\pgfplotstabletypeset@is@colname@#1\pgfplotstable@EOI + \ifpgfplotstableread@foundcolnames + \else + \let#1=\pgfplotstable@loc@TMPa + \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@loc@TMPa{#1}% + \ifx\pgfplotstable@loc@TMPa\pgfplotstabletypeset@is@colname@index@@ + \pgfplotstableread@foundcolnamesfalse + \edef\pgfplotstable@loc@TMPa{#2}% + \else + \pgfplotstableread@foundcolnamestrue + \fi +}% +\def\pgfplotstabletypeset@is@colname@name#1\pgfplotstable@EOI{}% + +% calls \pgfplotstableset{every table={#1}} where '#1' is the table +% file name. +% +% Note that 'every table' is usually set *AFTER* any other option. In +% other words: settings in 'every table' have higher precedence than +% those provided, for example, at +% \pgfplotstabletypeset[<options>]{...}. +% +% Why? Well, the <options> need to be set *before* the file name +% argument is read. After all, it might contain an inline table for +% which \catcodes need to be adjusted -- and <options> might explain +% how. +% +% REMARK: An early attempt to change the precendence for 'every table' +% was to set <options> again after 'every table'. But that is +% incompatible with, for example '/.add={}{}' key handlers. +% +% This macro does nothing if 'every table' is empty. +% +% #1: the table name (argument to 'every table') +% #2: The <options> which have already been set. +\long\def\pgfplotstableset@every@table#1#2{% + \pgfkeysgetvalue{/pgfplots/table/every table/.@cmd}\pgfplotstable@loc@TMPa + \ifx\pgfplotstable@loc@TMPa\pgfplots@empty@style@key + \else + \pgfplotstableset{/pgfplots/table/every table={#1}}%,#2}% + \fi +}% + +\def\pgfplotstabletypeset{% + \pgfutil@ifnextchar[{% + \pgfplotstabletypeset@opt + }{% + \pgfplotstabletypeset@opt[]% + }% +} +\long\def\pgfplotstabletypeset@opt[#1]#2{% + \pgfplotstable@error@pkg{Please load \string\usepackage{pgfplotstable} before using \string\pgfplotstabletypeset}% +} +\let\pgfplotstabletypesetfile=\pgfplotstabletypeset + +\def\pgfplotstablecreatecol{% + \pgfutil@ifnextchar[{% + \pgfplotstablecreatecol@opt + }{% + \pgfplotstablecreatecol@opt[]% + }% +}% +\def\pgfplotstablecreatecol@opt[#1]#2#3{% + \pgfplotstable@error@pkg{Please load \string\usepackage{pgfplotstable} before using \string\pgfplotstablecreatecol}% +}% + +% Iterates through every column of table '#1' and invokes the code +% '#3' for each column. The current column name will be available as +% '#2' and the current column index as |\pgfplotstablecol| (starting +% with 0). +% +% Example: +% \pgfplotstableforeachcolumn{\table}\as\colname{% +% The column name is `\colname'; its index \pgfplotstablecol.\par +% }% +% +% REMARK: this routine does NOT introduce TeX groups. +\long\def\pgfplotstableforeachcolumn#1\as#2#3{% + \def\pgfplotstablecol{0}% + \pgfplotslistforeachungrouped#1\as#2{% + #3\relax% + \pgfplotsutil@advancestringcounter\pgfplotstablecol + }% + \let\pgfplotstablecol=\relax +}% +% A variant of \pgfplotstableforeachcolumn which is used inside of +% \pgfplotstableread to listener. +% +% It is used as \pgfplotstableforeachcolumn\as\cur{<do something with \cur>} +\long\def\pgfplotstableforeachcolumn@listener\as#1#2{% + \def\pgfplotstablecol{0}% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as#1{% + #2\relax% + \pgfplotsutil@advancestringcounter\pgfplotstablecol + }% + \let\pgfplotstablecol=\relax +}% + +% Reports every element t_{ij} for a fixed column j (in read-only +% mode). +% +% For every cell, the code '#4' will be executed where '#3' will +% contain the cell's value. During code '#4', the macro +% \pgfplotstablerow will contain the current row index. +% +% #1: either a column name or the string '[index]' followed by a +% number denoting a column index Access by column name is much faster.. +% #2: the table (macro or file name) +% #3: the macro in which the cell values shall be written +% #4: the code to execute. +% +% Example: +% \pgfplotstableforeachcolumnelement{colname}\of\table\as\cellelem{% +% I have now cell element `\cellelem' at row index +% `\pgfplotstablerow'. +% \par +% } +% +% REMARK: this routine does NOT introduce TeX groups. +\long\def\pgfplotstableforeachcolumnelement#1\of#2\as#3#4{% + \def\pgfplotstablerow{0}% + \pgfplotstablegetcolumn{#1}\of{#2}\to\pgfplotstableforeachcolumnelement@list + \pgfplotslistforeachungrouped\pgfplotstableforeachcolumnelement@list\as#3{% + % allow nesting by copying the old value of \pgfplotstablerow: + \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% + }% + \let\pgfplotstablerow=\relax +}% +% helper method to allow nesting. It copies \pgfplotstablerow. +% #1: the expanded value of \pgfplotstablerow. +\long\def\pgfplotstableforeachcolumnelement@#1#2{% + #2\relax + \def\pgfplotstablerow{#1}% restore to old value. + % advance. + \pgfplotsutil@advancestringcounter\pgfplotstablerow +}% + +% A routine which is similar to \pgfplotstableforeachcolumnelement, +% but this here checks for changes in \pgfplotsretval and writes them +% back into the respected cell. +% +% The runtime is quadratic in the number of rows. +\long\def\pgfplotstablemodifyeachcolumnelement#1\of#2\as#3#4{% + \def\pgfplotstablerow{0}% + % + % Step 0: get the REAL column name for '#1'. + % This needs modifications if '#1' is [index]<integer>. + % -> store the colname to \pgfplotstable@loc@TMPc: + \def\pgfplotstable@loc@TMPc{#1}% + \pgfplotstable@is@colname{\pgfplotstable@loc@TMPc}%% + \ifpgfplotstableread@foundcolnames + \else + \expandafter\pgfplotstablegetcolumnnamebyindex\pgfplotstable@loc@TMPc\of{#2}\to\pgfplotstable@loc@TMPc + \fi + % Step 0.1: prepare a command which re-assembles column '#1' + % (using the real column name). + % The re-assemblation command will be invoked at the end of each + % iteration. This complicated macro preparation allows nested + % calls to \pgfplotstablemodifyeachcolumnelement. + \t@pgfplots@toka={\expandafter\pgfplotslistpushback\expandafter{#3}\to}% + \edef\pgfplotstable@loc@TMPd{% + \the\t@pgfplots@toka{\expandafter\noexpand\csname\string#2@\pgfplotstable@loc@TMPc\endcsname}}% + % Step 1: copy the column data to \pgfplotstable@loc@TMPb + \expandafter\pgfplotstablegetcolumnbyname\pgfplotstable@loc@TMPc\of#2\to\pgfplotstable@loc@TMPb% + % + % clear the original column: + \expandafter\pgfplotslistnewempty\csname\string#2@\pgfplotstable@loc@TMPc\endcsname + % + % Call loop. The prepared re-assemble macro will be provided as macro argument + % to allow nested calls: + \expandafter\pgfplotstablemodifyeachcolumnelement@\expandafter{\pgfplotstable@loc@TMPd} + {\pgfplotstable@loc@TMPb}{#3}{#4}% + \let\pgfplotstablerow=\relax +}% +% #1: post-iteration code +% #2: the row list +% #3: the loop macro to assign +% #4: the loop body +\long\def\pgfplotstablemodifyeachcolumnelement@#1#2#3#4{% + \pgfplotslistforeachungrouped{#2}\as#3{% + % allow nesting by copying the old value of \pgfplotstablerow: + \expandafter\pgfplotstableforeachcolumnelement@\expandafter{\pgfplotstablerow}{#4}% + #1% + }% +} + +% Selects a single table element at row #1 and column #2 from table +% #3. +% +% #1: a row index. +% #2: a column name or the string '[index]' followed by a number +% denoting a column index. Access by column name is much faster. +% #3: the table (macro or file name). +% +% The cell value will be written into the macro \pgfplotsretval. +% +% REMARK: +% this routine is supposed to be very slow: it needs time O(N) where N +% is the number of rows. This may change in future versions. +% +% Example: +% \pgfplotstablegetelem{0}{[index]2}\of\table +% The elem is `\pgfplotsretval'. +\def\pgfplotstablegetelem#1#2\of#3{% + \begingroup + \pgfplotstablegetcolumn{#2}\of{#3}\to\pgfplotstable@loc@TMPa + \def\pgfplotsexceptionmsg{Sorry, row `#1' does not exist in table \pgfplotstablenameof{#3}}% + \pgfplotslistselect#1\of\pgfplotstable@loc@TMPa\to\pgfplotsretval + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% + +\def\pgfplotstablegetcolumnlist#1\to#2{\let#2=#1} + +% Defines \pgfmathresult (and now also \pgfplotsretval) to be the number of rows in table #1. +% +% #1 may be either a loaded table structure (a macro name) or a table +% file name. In the latter case, the file will be loaded temporarily. +\long\def\pgfplotstablegetrowsof#1{% + \pgfplotstable@isloadedtable{#1}{% + % ah - it is an already loaded table! + \begingroup + \pgfplotslistfront#1\to\pgfplotstablegetrows@@ + \expandafter\pgfplotslistsize\csname\string#1@\pgfplotstablegetrows@@\endcsname\to\c@pgfplotstable@counta + \edef\pgfmathresult{\the\c@pgfplotstable@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }{% + % ah - it is a file name. + \begingroup + \pgfplotstableread{#1}\pgfplotstablegetrows@ + \pgfplotstablegetrowsof{\pgfplotstablegetrows@}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }% + \let\pgfplotsretval=\pgfmathresult +}% + +% Defines \pgfplotsretval to contain the number of columns in table +% #1. +% +% #1 may be either a loaded table structure (a macro name) or a table +% file name. In the latter case, the file will be loaded temporarily. +\long\def\pgfplotstablegetcolsof#1{% + \pgfplotstable@isloadedtable{#1}{% + % ah - it is an already loaded table! + \begingroup + \pgfplotslistsize#1\to\c@pgfplotstable@counta + \edef\pgfplotsretval{\the\c@pgfplotstable@counta}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup + }{% + % ah - it is a file name. + \begingroup + \pgfplotstableread{#1}\pgfplots@table + \pgfplotstablegetcolsof{\pgfplots@table}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup + }% + \let\pgfmathresult=\pgfplotsretval +} diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex index 6d1cb8a2ee1..180ca8ce195 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -1,4 +1,7 @@ +%\input pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex +%\beginpgfmathparsecheckfornumber + \pgfutil@ifundefined{pgfmathlessthan@}{% \let\pgfmathlessthan@=\pgfmathless@ \let\pgfmathgreaterthan@=\pgfmathgreater@ @@ -13,8 +16,8 @@ % #1: for backwards compatibility % #2: for normal processing. \def\pgfplots@ifneedspgfcompabitibilitycode#1#2{% - %\pgfkeysifdefined{/handlers/.search also/.@cmd}{#2}{#1}% - \pgfutil@ifundefined{pgfkeysdefnargs}{#1}{#2}% + %\pgfkeysifdefined{/pgf/number format/sci precision/.@cmd}{#2}{#1}% + \pgfutil@ifundefined{tikzifinpicture}{#1}{#2}% }% \pgfplots@ifneedspgfcompabitibilitycode diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex index 178da4c3510..12d308255bd 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex @@ -12,6 +12,9 @@ \fi \let\pgfutil@inputcheck=\r@pgf@reada +\pgfutil@ifundefined{pgf@texdist@protect}{% + \def\pgf@texdist@protect{}% +}{} % from pgfutil-common.tex: @@ -241,6 +244,13 @@ \def\pgfutilensuremath#1{% \ifmmode#1\else$#1$\fi } +\def\tikzifinpicture#1#2{% + \pgfutil@ifundefined{filldraw}{#2}{#1}% +}% + +\def\tikz@fig@scan@name(#1){% + \pgfkeysvalueof{/tikz/name/.@cmd}#1\pgfeov% CF : this is now ALWAYS consistent with 'name=' option; allows overrides. + \tikz@@scan@fig}% \tikzoption{ybar}[]{\let\tikz@plot@handler=\pgfplothandlerybar} \tikzoption{xbar}[]{\let\tikz@plot@handler=\pgfplothandlerxbar} @@ -425,3 +435,10 @@ \fi } +% From pgfcorescopes.code.tex: +\def\pgfresetboundingbox{% + \global\pgf@picmaxx=-16000pt\relax% + \global\pgf@picminx=16000pt\relax% + \global\pgf@picmaxy=-16000pt\relax% + \global\pgf@picminy=16000pt\relax% +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex index d9e6476398f..ee2c38fba38 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreexternal.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -27,15 +27,15 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.1 2010/03/25 20:57:13 ludewich Exp $ +\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.8 2010/07/10 20:51:57 ludewich Exp $ -\newif\ifpgfexternal@allow@aux +\newif\ifpgfexternal@aux@in@dpth \pgfkeys{ /pgf/images/include external/.code={\pgfimage{#1}}, - /pgf/images/aux in dpth/.is if=pgfexternal@allow@aux, + /pgf/images/aux in dpth/.is if=pgfexternal@aux@in@dpth, /pgf/images/aux in dpth/.default=true } @@ -103,14 +103,14 @@ \ifx\pgf@tempa\pgf@tempb% \else% \pgf@external@grabshipouttrue% - \pgfexternal@nofiles + \pgfexternal@nofiles% see also \pgf@external@init@aux@in@dpth \ifpgfexternalreadmainaux % and reset the jobname. This should allow to handle any % \label/\ref constructions which are stored in \jobname.aux (and % which won't be found otherwise) \gdef\jobname{#1}% \fi - \ifpgfexternal@allow@aux + \ifpgfexternal@aux@in@dpth \csname newwrite\endcsname\w@pgfexternal@auxout \fi \fi% @@ -136,20 +136,37 @@ \newif\ifpgf@external@grabshipout \newbox\pgfexternal@startupbox -\AtBeginDocument{% - \ifpgf@external@grabshipout% - \global\let\pgfexternal@originalshipout=\shipout% - \global\def\shipout{\setbox\pgfpic=}% - \maxdeadcycles=10000% - % Ok, gather everything we have seen up to now in a box. This box - % will contain any specials that have been used. - {% - \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% - \hbox{}\eject% - }% - \fi% +\pgfutil@ifundefined{AtBeginDocument}{}{% + \AtBeginDocument{% + \ifpgf@external@grabshipout% + \global\let\pgfexternal@originalshipout=\shipout% + \global\def\shipout{\setbox\pgfpic=}% + \maxdeadcycles=10000% + % Ok, gather everything we have seen up to now in a box. This box + % will contain any specials that have been used. + {% + \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% + \hbox{}\eject% + }% + \fi% + } +}% + +\pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{% + \ifpgf@external@grabshipout + \pgfutil@ifundefined{pgfexternal@did@a@shipout}{% + \pgfexternal@error@no@shipout + }{}% + \fi + }% } +% This will be overwritten by the tikz external lib if it is loaded. +\def\pgfexternal@error@no@shipout{% + \PackageError{pgf}{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname'. Perhaps there was a typo somewhere? Please check that your document contains '\string\beginpgfgraphicnamed{\pgfactualjobname} ... \string\endpgfgraphicnamed'}% +}% + % "Environment" for an external graphic. % @@ -210,21 +227,47 @@ % the first line (if any). \def\pgfincludeexternalgraphics#1{% \begingroup + \pgfexternalreaddpth{#1}% + \pgfkeysifdefined{/pgf/images/include external/#1/.@cmd}{% + \pgfkeysgetvalue{/pgf/images/include external/#1/.@cmd}\pgf@tempa + \pgfkeysgetlet{/pgf/images/include external/.@cmd}\pgf@tempa + }{}% \setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}% - % - \let\pgfincludeexternalgraphics@dp=\pgfutil@empty - \endlinechar=-1 % suppress white space at end - \catcode`\@=11 - \openin\r@pgf@reada=#1.dpth - \pgfincludeexternalgraphics@read@dpth - \ifx\pgfincludeexternalgraphics@dp\pgfutil@empty + \ifdim\pgfexternaltrimleft=0sp \else \kern\pgfexternaltrimleft\relax \fi + \ifdim\pgfexternaldepth=0pt \box1 \else - \dimen0=\pgfincludeexternalgraphics@dp\relax + \dimen0=\pgfexternaldepth\relax \hbox{\lower\dimen0 \box1 }% \fi + \ifdim\pgfexternaltrimright=0sp \else \kern\pgfexternaltrimright\relax \fi \endgroup } + +% Defines \pgfexternaldepth to be the depth of the external picture +% '#1' and \pgfexternaltrimleft / \pgfexternaltrimright to be the 'hbaseline' shift. +% +% +% Furthermore, it handles any auxiliary information stored in the +% .dpth file (it appends it to the main aux file). +% +\def\pgfexternalreaddpth#1{% + % no \begingroup. Handle that manually: + \edef\pgfexternalreaddpth@restore{% + \noexpand\endlinechar=\the\endlinechar\space + \noexpand\catcode`\noexpand\@=\the\catcode`\@\space + }% + % + \def\pgfexternaldepth{0sp}% + \def\pgfexternaltrimleft{0sp}% + \def\pgfexternaltrimright{0sp}% + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + % + \pgfexternalreaddpth@restore +}% % % The .dpth consists of 0-N lines, where each is either a single % dimension (the box' depth) or something which belongs to the .aux @@ -241,32 +284,51 @@ \expandafter\pgfincludeexternalgraphics@read@dpth \fi }% + +\def\pgfexternal@restore#1{}% + \long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% \ifcat\noexpand#1\relax % Ah -- the first token is a control sequence. It belongs to % the .aux file. % - % #1#2\relax% do NOT set the information! many LaTeX commands don't support it (\label for example) - \pgfutil@ifundefined{if@filesw}{% - % sorry, .aux file support only for latex - }{% - % append to main .aux file (for forward references) - \if@filesw - {% - \toks0={#1#2}% - % believe it or not, but the - % \def\dpthimport{...}\dpthimport *makes* a - % difference! In ensures any occuring `##' characters - % are properly expanded to `#'. - \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% - }% - \fi - }% - \else - \def\pgfincludeexternalgraphics@dp{#1#2}% + \ifx#1\pgfexternal@restore + #2% + \else + % do NOT execute #1#2! many LaTeX commands don't support it (\label for example) + \pgfutil@ifundefined{if@filesw}{% + % sorry, .aux file support only for latex + }{% + % append to main .aux file (for forward references) + \if@filesw + {% + \toks0={#1#2}% + % believe it or not, but the + % \def\dpthimport{...}\dpthimport *makes* a + % difference! In ensures any occuring `##' characters are properly expanded to `#'. + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + }% + \fi + \else% it is the depth (which is simply a number for backwards compatibility) + \def\pgfexternaldepth{#1#2}% \fi }% +% Stores '#1' into (expanded!) into the .dpth file of the currently +% exported image. +% +% Just before the image is included into the main document, '#1' will be +% invoked. +% +% This command has only an effect if an image is being exported. +\def\pgfexternalstorecommand#1{% +}% +\def\pgfexternalstorecommand@isexporting#1{% + \immediate\write\w@pgfexternal@auxout{\noexpand\pgfexternal@restore{#1}}% +}% + % Grab operation: If jobname matches the graphic name, typeset this @@ -275,14 +337,35 @@ % this method is also invoked from within the tikz external library. \def\pgf@external@grab#1{% \def\pgf@filename{#1}% - \ifpgfexternal@allow@aux + \ifpgfexternal@aux@in@dpth \begingroup \pgf@external@init@aux@in@dpth + \let\G@refundefinedtrue=\pgf@external@grab@refundefinedtrue \fi + \gdef\pgf@trimleft@final{0sp}% + \gdef\pgf@trimright@final{0sp}% \setbox\pgfpic=\hbox\bgroup\bgroup% \let\endpgfgraphicnamed=\pgf@externalend% } +{\catcode`\^=12 \gdef\pgfexternal@hat{^}} + +\expandafter\let\expandafter\pgf@external@grab@refundefinedtrue@orig\csname G@refundefinedtrue\endcsname + +\def\pgf@external@grab@refundefinedtrue{% + \pgf@external@grab@refundefinedtrue@orig + \begingroup + \def\n{\pgfexternal@hat\pgfexternal@hat J}% + \pgfexternalstorecommand{% + \noexpand\immediate\noexpand\write16{\pgf@external@grab@refundefinedtrue@warning}% + \noexpand\G@refundefinedtrue + }% + \endgroup +}% +\def\pgf@external@grab@refundefinedtrue@warning{% + LaTeX Warning: External picture `\pgfactualjobname' contains undefined references\noexpand\on@line.\n +}% + \let\pgf@external@@protected@write@orig=\protected@write \long\def\pgf@external@@protected@write@immediate#1#2#3{% \begingroup @@ -293,6 +376,8 @@ }% \def\pgf@external@init@aux@in@dpth{% + \let\pgfexternalstorecommand=\pgfexternalstorecommand@isexporting + % % tell LaTeX to write aux files... \csname @fileswtrue\endcsname % ... but redirect output to the .dpth file! @@ -304,11 +389,38 @@ \let\protected@write=\pgf@external@@protected@write@immediate }% +\def\pgf@externalend@storeshifts#1{% + \immediate\write#1{\the\dp\pgfpic}% + \ifx\pgf@trimleft@final\pgfutil@empty\else + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimleft{\pgf@trimleft@final}}}% + \fi + \ifx\pgf@trimright@final\pgfutil@empty\else + \immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimright{\pgf@trimright@final}}}% + \fi +} % REMARK: % this method is also invoked from within the tikz external library. \def\pgf@externalend{% \unskip\egroup\egroup% {% + \def\pgf@external@trim{0}% + \def\pgf@external@store@dpth{0}% + % + \ifdim\pgf@trimleft@final=0sp \gdef\pgf@trimleft@final{} \else\def\pgf@external@trim{1}\fi + \ifdim\pgf@trimright@final=0sp \gdef\pgf@trimright@final{} \else\def\pgf@external@trim{1}\fi + \if1\pgf@external@trim + % UNDO the trimming! export to pdf doesn't supported trimmed + % bounding boxes (has to do with the mediabox/trimbox etc). + % I'll keep the bounding box intact and store the trim information + % into the .dpth file. + \setbox\pgfpic=\hbox{% + \ifx\pgf@trimleft@final\pgfutil@empty\else\kern-\pgf@trimleft@final\fi + \box\pgfpic + \ifx\pgf@trimright@final\pgfutil@empty\else\kern-\pgf@trimright@final\fi + }% + \def\pgf@external@store@dpth{1}% + \fi + % \parindent0pt % leave the space % \leftmargin0pt% % \rightmargin0pt% @@ -316,12 +428,16 @@ \advance\dimen0\dp\pgfpic% \ifdim\dp\pgfpic=0pt\relax \else% store the picture's depth. Otherwise, it would be lost. - \ifpgfexternal@allow@aux - \immediate\write\@auxout{\the\dp\pgfpic}% + \def\pgf@external@store@dpth{1}% + \fi + % + \if1\pgf@external@store@dpth + \ifpgfexternal@aux@in@dpth + \pgf@externalend@storeshifts\@auxout \immediate\closeout\@auxout \else \immediate\openout\pgf@plotwrite=\pgf@filename.dpth - \immediate\write\pgf@plotwrite{\the\dp\pgfpic}% + \pgf@externalend@storeshifts\pgf@plotwrite \immediate\closeout\pgf@plotwrite \fi \fi @@ -339,13 +455,27 @@ \box\pgfpic% \kern 1truein }% \kern1truein }% + % + % compatibility with eso-pic package: \nointerlineskip is not + % allowed here, but the eso-pic package uses \nointerlineskip in + % its shipout routine. + \let\pgfexternal@nointerlineskip@orig=\nointerlineskip + \let\nointerlineskip=\pgfexternal@nointerlineskip + % \pgfexternal@originalshipout\box0 % + \gdef\pgfexternal@did@a@shipout{1}% }% - \ifpgfexternal@allow@aux + \ifpgfexternal@aux@in@dpth \endgroup \fi } +\def\pgfexternal@nointerlineskip{% + \ifvmode + \pgfexternal@nointerlineskip@orig + \else + \relax% \nointerlineskip in horizontal mode not allowed. Silently ignore the error message. + \fi +}% \endinput - diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreimage.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreimage.code.tex new file mode 100644 index 00000000000..5283de70b9d --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfcoreimage.code.tex @@ -0,0 +1,580 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% This file is a copy of some part of PGF/Tikz. +%%% It has been copied here to provide : +%%% - compatibility with older PGF versions +%%% - availability of PGF contributions by Christian Feuersaenger +%%% which are necessary or helpful for pgfplots. +%%% +%%% For reasons of simplicity, I have copied the whole file, including own contributions AND +%%% PGF parts. The copyrights are as they appear in PGF. +%%% +%%% Note that pgfplots has compatible licenses. +%%% +%%% This copy has been modified in the following ways: +%%% - nested \input commands have been updated +%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Date of this copy: Mon Mar 22 16:42:03 CET 2010 %%% + + + +% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreimage.code.tex,v 1.14 2010/03/19 09:50:32 ludewich Exp $ + + + +% Declare an image +% +% #1 = optional argument: width, height, page specification +% #2 = name of the image for later use +% #4 = filename without extension, automatic extensions are .pdf, +% .jpg, and .png for PDF and .ps, .eps, .epsi for postscript. +% +% Description: +% +% This command declares an image file for later use. Even if the image +% is used several times in the document, in PDF it will only be stored +% once. +% +% Example: +% +% \pgfdeclareimage[width=2cm,page=2]{myimage}{imagefilename} + +\def\pgfdeclareimage{\pgfutil@ifnextchar[{\pgf@declareimage}{\pgf@declareimage[]}} +\def\pgf@declareimage[#1]#2#3{% + \pgfqkeys{/pgf/images}{height=,width=,page=,interpolate=false,mask=,#1}% + % Try to find the file + \gdef\pgf@filename{}% + % If page= parameter is not empty, try that file first: + \ifx\pgf@imagepage\pgfutil@empty% + \else% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3.page\pgf@imagepage}% + \fi% + \ifx\pgf@filename\pgfutil@empty% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}% + \else% + \pgfkeys{/pgf/images/page=}% make page empty + \fi% + \ifx\pgf@filename\pgfutil@empty% + \PackageWarning{pgf}% + {File "#3" not found when defining image "#2".\MessageBreak + Tried all extensions in "\pgfsys@imagesuffixlist"}% + \pgf@declaredraftimage{#2}{#3}% + \else% + \ifpgf@draftmode% + \pgf@declaredraftimage{#2}{#3}% + \else% + \pgfsys@defineimage% + \fi% + \fi% + \expandafter\global\expandafter\let\csname pgf@image@#2!\endcsname=\pgf@image% +} + +\newif\ifpgfexternal@allow@aux + +\pgfkeys{ + /pgf/images/include external/.code={\pgfimage{#1}}, + /pgf/images/aux in dpth/.is if=pgfexternal@allow@aux, + /pgf/images/aux in dpth/.default=true, + /pgf/images/draft/.is if=pgf@draftmode, + /pgf/images/draft/.default=true} +\pgfkeys{/pgf/images/width/.estore in=\pgf@imagewidth} +\pgfkeys{/pgf/images/height/.estore in=\pgf@imageheight} +\pgfkeys{/pgf/images/page/.estore in=\pgf@imagepage} +\pgfkeys{/pgf/images/interpolate/.cd,.code=\edef\pgf@imageinterpolate{#1},.default=true} +\pgfkeys{/pgf/images/mask/.code=% + {% + \edef\pgf@imagemask{#1}% + \ifx\pgf@imagemask\pgfutil@empty% + \else% + \pgfutil@ifundefined{pgf@mask@#1}% + {\PackageError{pgf}{Undefined mask "#1".}{}% + \edef\pgf@imagemask{}}% + {\edef\pgf@imagemask{\csname pgf@mask@#1\endcsname}% + }% + \fi% + }} + + +\def\pgf@findfile#1:#2+#3{% + \pgfutil@IfFileExists{#3#1}% + {\xdef\pgf@filename{#3#1}}% + {\def\pgf@mightbeempty{#2}% + \ifx\pgf@mightbeempty\pgfutil@empty\else% + \pgf@findfile#2+{#3}% + \fi}} + +% #1: image name +% #2: file name +\def\pgf@declaredraftimage#1#2{% + \ifx\pgf@imagewidth\pgfutil@empty% + \PackageWarning{pgf}{Missing width for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}% + \edef\pgf@imagewidth{1cm}% + \fi% + \ifx\pgf@imageheight\pgfutil@empty% + \PackageWarning{pgf}{Missing height for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}% + \edef\pgf@imageheight{1cm}% + \fi% + \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepagetext{ page \pgf@imagepage}\fi% + \edef\pgf@image{% + \hbox to \pgf@imagewidth{% + \vrule\kern-0.4pt% + \vbox to \pgf@imageheight{% + \hrule\vfil% + \hbox to \pgf@imagewidth{\hskip-10cm\hfil\noexpand\tiny#2\pgf@imagepage\hfil\hskip-10cm}% + \vfil\hrule}% + \kern-0.4pt\vrule}% + }% +} + + + +% Declare a soft mask +% +% #1 = optional argument: matte specification. default matte is +% white. +% #2 = name of the mask for later use +% #3 = filename without extension, automatic extensions are .pdf, +% .jpg, and .png for PDF. Postscript is not supported. +% +% Description: +% +% This command declares a soft mask for later masking an image. The +% declared mask should be used together with an image of exactly the +% same height/width if matte is defined. Matte should be the +% preblended background color (see pdf spec for details). +% +% Example: +% +% \pgfdeclaremask[matte=white]{maskname}{maskfilename} +% \pgfdeclareimage[mask=maskname]{image}{imagefilename} + +\def\pgfdeclaremask{\pgfutil@ifnextchar[\pgf@declaremask{\pgf@declaremask[]}} +\def\pgf@declaremask[#1]#2#3{% + \pgfqkeys{/pgf/images/mask}{matte={1 1 1},#1}% defaults + \def\pgf@mask{}% + % Try to find the file + \gdef\pgf@filename{}% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}% + \ifx\pgf@filename\pgfutil@empty% + \PackageWarning{pgf}% + {File "#3" not found when defining mask "#2".\MessageBreak + Tried all extensions in "\pgfsys@imagesuffixlist"}% + \else% + \pgfsys@definemask{#2}% + \fi% + \expandafter\global\expandafter\let\csname pgf@mask@#2\endcsname=\pgf@mask% +} + +\pgfkeys{/pgf/images/mask/matte/.cd,.estore in=\pgf@maskmatte,.value required} + + + +% Create an alias name for an image +% +% #1 = name of the alias +% #2 = name of the original +% +% Example: +% +% \pgfdeclareimage{image}{1cm}{1cm}{filename +% \pgfaliasimage{alias}{image} +% \pgfuseimage{alias} + +\def\pgfaliasimage#1#2{% + \expandafter\global\expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@image@#2!\endcsname% + \expandafter\global\expandafter\let\csname pgf@image@#1!\endcsname=\pgf@temp% + } + + +% Use an image +% +% #1 = name of a previously declared image +% +% Example: +% +% \pgfputat{\pgforigin}{\pgfbox[left,base]{\pgfuseimage{myimage}}} + +\def\pgfuseimage#1{% + \def\pgf@imagename{pgf@image@#1}% + \pgf@tryextensions{\pgf@imagename}{\pgfalternateextension}% + \expandafter\pgfutil@ifundefined\expandafter{\pgf@imagename}% + {\PackageError{pgf}{Undefined image "#1"}{}}% + {{\leavevmode\csname\pgf@imagename\endcsname}}} + +\def\pgf@tryextensions#1#2{% + \edef\pgf@args{[#2!]}\expandafter\pgf@@tryextensions\pgf@args{#1}} +\def\pgf@@tryextensions[#1!#2]#3{% + \expandafter\pgfutil@ifundefined\expandafter{#3#1!#2}% + {\def\pgf@temp{#2}% + \ifx\pgf@temp\pgfutil@empty% + \edef#3{#3!}% + \else% + \pgf@@tryextensions[#2]{#3}% + \fi}% + {\edef#3{#3#1!#2}}} + + +% Alternate image +% +% Description: +% +% When an image is used, pgf first attempts to use the image with the +% alternate extension added. If this fails, the original image is +% used. If the alternate extension contains ``!'', then the text up to +% the ! is successively removed and the remainder is tried as an +% alternate extension. +% +% Example: +% +% \def\pgfalternateextension{20!white} + +\def\pgfalternateextension{} + + + +% Directly insert an image +% +% #1 = optional argument: width, height, page specification +% #2 = file name +% +% Description: +% +% Directly inserts an image without declaration. You can, however, +% still access this image using the name pgflastimage. By using +% pgfaliasimage, you can also save this image for later. +% +% Example: +% +% \pgfimage[height=2cm]{filename} + +\def\pgfimage{\pgfutil@ifnextchar[\pgf@imagecom{\pgf@imagecom[]}} +\def\pgf@imagecom[#1]#2{% + \pgfdeclareimage[#1]{pgflastimage}{#2}% + \pgfuseimage{pgflastimage}} + + + + + + + + +% The external read/write mechanism is used as follows: +% +% In your document, you put a number or all of your pgfpicture (or +% tikzpicture) environments inside a pair of \beginpgfexternal and +% \endpgfexternal. The \beginpgfexternal gets one parameter called the +% graphics name. +% +% Once this is done, the next step is to declare the names of your +% graphics in the document at the beginning using the +% \pgfdeclaregraphicname command. +% +% Now, when you typeset your document, each time a \beginpgfexternal +% command is encountered, it will be checked whether the corresponding +% graphics file exists. If this is the case, it will be included and +% the code between \beginpgfexternal and \endpgfexternal is +% ignored. Otherwise, the code is executed normally. +% +% Things change when you run tex on your file with the \jobname set to +% the name of a decalred graphics name. In this case, only your +% graphic will be typeset, the rest of the document will be "thrown away". +% To be more precise, everything is gobbled up to the beginning +% of the first \beginpgfexternal with the given graphics name. Then, +% the content of the "environment" is put in a box (this "environment" +% need not contain a graphics, it may contain anything that can be put +% in a box). Then a single page is output whose size is exactly the +% size of the picture. +% +% So, once you have run tex repeatedly, each time with the jobname set +% to each of the graphics, you can then run tex on the whole document +% and this will cause all graphics to be included rather than begin +% typeset. +% +% Finally, once all the graphics have been created, you can also say +% \input pgfexternal.tex instead of including pgf/TikZ. + + +\newif\ifpgfexternalreadmainaux +\pgfexternalreadmainauxtrue + +% Tells pgf which jobname is the name of the real file +% +% #1 = name +% +% Description: +% +% This command is used to tell pgf that the file named #1 should be +% typeset normally. If \jobname is not equal to #1, only +% the graphic called \jobname will be typeset. +% +% Example: +% +% \pgfrealjobname{survey} +% +% Note that afterwards, \jobname will be set to the argument. In our +% example, \jobname will be 'survey'. This is to accomplish +% compatibility with aux-file generation. + +\def\pgfrealjobname#1{% + \global\let\pgfactualjobname=\jobname + \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb% + \else% + \pgf@external@grabshipouttrue% + \pgfexternal@nofiles + \ifpgfexternalreadmainaux + % and reset the jobname. This should allow to handle any + % \label/\ref constructions which are stored in \jobname.aux (and + % which won't be found otherwise) + \gdef\jobname{#1}% + \fi + \ifpgfexternal@allow@aux + \csname newwrite\endcsname\w@pgfexternal@auxout + \fi + \fi% + \gdef\pgfrealjobname##1{}% avoid multiple calls. +} + +\def\pgfexternal@nofiles{% + % replace \relax. The \nofiles macros does + % \let\makeglossary=\relax + % but the glossary.sty calls \renewcommand\makeglossary (which + % will fail if \makeglossary=\relax). Stupid, but it works. + \let\pgfexternal@nofiles@=\relax + \def\relax{\relax}% + % + % suppress generation of LaTeX .aux, .toc etc files. + % generation of these files is not thread-safe. + % the \csname \endcsname yields \relax if \nofiles doesn't exist. + \csname nofiles\endcsname + % + \let\relax=\pgfexternal@nofiles@ +}% + +\newif\ifpgf@external@grabshipout +\newbox\pgfexternal@startupbox + +\AtBeginDocument{% + \ifpgf@external@grabshipout% + \global\let\pgfexternal@originalshipout=\shipout% + \global\def\shipout{\setbox\pgfpic=}% + \maxdeadcycles=10000% + % Ok, gather everything we have seen up to now in a box. This box + % will contain any specials that have been used. + {% + \output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}% + \hbox{}\eject% + }% + \fi% +} + + +% "Environment" for an external graphic. +% +% #1 = graphic name +% +% Example: +% +% \beginpgfgraphicnamed{main-graphic2} +% \begin{tikzpicture} +% ... +% \end{tikzpicture} +% \endpgfgraphicnamed + +\def\pgf@externalbegin#1{% + % First, check whether we wish to grab this graphic: + \let\pgf@next=\pgf@external@normal% + \ifpgf@external@grabshipout% + \edef\pgf@tempa{\expandafter\string\csname #1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb% + \let\pgf@next=\pgf@external@grab% + \fi% + \fi% + \pgf@next{#1}% +} + + +\AtBeginDocument{ + \let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary + \let\endpgfgraphicnamed=\unskip +} + + +% Normal operation: Include an external graphic instead of the +% picture, if such an external picture exists. +\def\pgf@external@normal#1{% + \let\pgf@filename=\pgfutil@empty% + \expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}% + \ifx\pgf@filename\pgfutil@empty% + % Ok, no such image... Just typeset the picture normally. + \let\pgf@next=\relax% + \else% + \let\pgf@next=\pgf@replacepicturebygraphic% + \fi% + \pgf@next% +} + +\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{% + \expandafter\pgfincludeexternalgraphics\expandafter{\pgf@filename}\unskip +} + +% This is almost the same as \includegraphics{#1}, but it checks +% whether '#1.dpth' exists. In such case, it restores the boxes depth +% stored in #1.dpth. +% +% Furthermore, the .dpth file may contain .aux related information +% collected for the external graphics (references). They start after +% the first line (if any). +\def\pgfincludeexternalgraphics#1{% + \begingroup + \setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}% + % + \let\pgfincludeexternalgraphics@dp=\pgfutil@empty + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + \ifx\pgfincludeexternalgraphics@dp\pgfutil@empty + \box1 + \else + \dimen0=\pgfincludeexternalgraphics@dp\relax + \hbox{\lower\dimen0 \box1 }% + \fi + \endgroup +} +% +% The .dpth consists of 0-N lines, where each is either a single +% dimension (the box' depth) or something which belongs to the .aux +% file (such lines will always start with a macro). +\def\pgfincludeexternalgraphics@read@dpth{% + \ifeof\r@pgf@reada + \closein\r@pgf@reada + \else + \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline + \ifx\pgfincludeexternalgraphics@auxline\pgfutil@empty + \else + \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI + \fi + \expandafter\pgfincludeexternalgraphics@read@dpth + \fi +}% +\long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% + \ifcat\noexpand#1\relax + % Ah -- the first token is a control sequence. It belongs to + % the .aux file. + % + % #1#2\relax% do NOT set the information! many LaTeX commands don't support it (\label for example) + \pgfutil@ifundefined{if@filesw}{% + % sorry, .aux file support only for latex + }{% + % append to main .aux file (for forward references) + \if@filesw + {% + \toks0={#1#2}% + % believe it or not, but the + % \def\dpthimport{...}\dpthimport *makes* a + % difference! In ensures any occuring `##' characters + % are properly expanded to `#'. + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + }% + \else + \def\pgfincludeexternalgraphics@dp{#1#2}% + \fi +}% + + + +% Grab operation: If jobname matches the graphic name, typeset this +% picture normall. +% REMARK: +% this method is also invoked from within the tikz external library. +\def\pgf@external@grab#1{% + \def\pgf@filename{#1}% + \ifpgfexternal@allow@aux + \begingroup + \pgf@external@init@aux@in@dpth + \fi + \setbox\pgfpic=\hbox\bgroup\bgroup% + \let\endpgfgraphicnamed=\pgf@externalend% +} + +\let\pgf@external@@protected@write@orig=\protected@write +\long\def\pgf@external@@protected@write@immediate#1#2#3{% + \begingroup + \let\pgf@write@=\write + \def\write{\noexpand\immediate\pgf@write@}% + \pgf@external@@protected@write@orig{#1}{#2}{#3}% + \endgroup +}% + +\def\pgf@external@init@aux@in@dpth{% + % tell LaTeX to write aux files... + \csname @fileswtrue\endcsname + % ... but redirect output to the .dpth file! + \immediate\openout\w@pgfexternal@auxout=\pgf@filename.dpth + \let\@auxout=\w@pgfexternal@auxout + % ... and disable the correct page numbers. I can't get that + % (because the correct page number is only available in the + % shipout routine). Use immediate output: + \let\protected@write=\pgf@external@@protected@write@immediate +}% + +% REMARK: +% this method is also invoked from within the tikz external library. +\def\pgf@externalend{% + \unskip\egroup\egroup% + {% + \parindent0pt % leave the space +% \leftmargin0pt% +% \rightmargin0pt% + \dimen0\ht\pgfpic% + \advance\dimen0\dp\pgfpic% + \ifdim\dp\pgfpic=0pt\relax + \else% store the picture's depth. Otherwise, it would be lost. + \ifpgfexternal@allow@aux + \immediate\write\@auxout{\the\dp\pgfpic}% + \immediate\closeout\@auxout + \else + \immediate\openout\pgf@plotwrite=\pgf@filename.dpth + \immediate\write\pgf@plotwrite{\the\dp\pgfpic}% + \immediate\closeout\pgf@plotwrite + \fi + \fi + \pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}% + \setbox0=\vbox{% + \kern -1truein % + \hbox{% + \kern -1truein % + \hbox to0pt{% + \wd\pgfexternal@startupbox=0pt % + \ht\pgfexternal@startupbox=0pt % + \dp\pgfexternal@startupbox=0pt % + \box\pgfexternal@startupbox% + \pgfsys@atbegindocument\hss}% + \box\pgfpic% + \kern 1truein }% + \kern1truein }% + \pgfexternal@originalshipout\box0 % + }% + \ifpgfexternal@allow@aux + \endgroup + \fi +} + + +\endinput + diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex index 24203d3b330..98b203fbb68 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeys.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -829,6 +829,26 @@ .unknown/.style={/errors/unknown choice value=\pgfkeyscurrentkey\pgfkeyscurrentvalue}}} +% Repeatedly setting a key + +\pgfkeys{/handlers/.list/.code=% + {% + % Use foreach to unfold the list + \let\pgf@keys@temp=\pgfutil@empty% + \foreach \pgf@keys@key in{#1}% + {\expandafter\expandafter\expandafter\gdef% + \expandafter\expandafter\expandafter\pgf@keys@temp% + \expandafter\expandafter\expandafter{\expandafter\pgf@keys@temp\expandafter{\pgf@keys@key}}}% + \edef\pgf@keys@list@path{\pgfkeyscurrentpath}% + \expandafter\expandafter\expandafter\pgf@keys@do@list% + \expandafter\expandafter\expandafter{\expandafter\pgf@keys@list@path\expandafter}\pgf@keys@temp\pgf@stop% + }% +} +\def\pgf@keys@do@list#1{\pgfutil@ifnextchar\bgroup{\pgf@keys@do@list@item{#1}}\pgfutil@gobble} +\def\pgf@keys@do@list@item#1#2{\pgfkeysalso{#1={#2}}\pgf@keys@do@list{#1}} + + + % Inspection handlers \pgfkeys{/handlers/.show value/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{\pgfkeysshower}\show\pgfkeysshower} % inspect the value diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex index c795bc45ffb..1063569eeec 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex index 0af3c3887c5..35dc897fec7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -249,7 +249,7 @@ \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@ \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@ \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@ - \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd + \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd@ \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@ \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@ \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@ @@ -327,6 +327,7 @@ \pgfmathfloat@plots@install% \pgfmathfloat@parser@install@functions \let\pgfmathrand@=\pgfmath@basic@rand@ + \let\pgfmathrnd@=\pgfmath@basic@rnd@ \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo% \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo% \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}% @@ -645,6 +646,7 @@ \fi } \let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ +\let\pgfmathfloatless@=\pgfmathfloatlessthan@ % compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] \def\pgfmathfloatlessthan@positive{% @@ -675,6 +677,7 @@ \def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}} \let\pgfmathfloatgreaterthan=\pgfmathfloatgreaterthan@ +\let\pgfmathfloatgreater@=\pgfmathfloatgreaterthan@ \def\pgfmathfloatmax@#1{% \begingroup @@ -934,6 +937,7 @@ % or, equivalently % \pgfmathfloatifflags{\pgfmathresult}{+}{It's positive!}{It's not positive!}% % \pgfmathfloatifflags{\pgfmathresult}{-}{It's negative!}{It's not negative!}% +% it also supports #2=u which means 'unbounded' \def\pgfmathfloatifflags#1#2#3#4{% \if#2-% \pgfmathfloatifflags{#1}{2}{#3}{#4}% @@ -942,10 +946,18 @@ \pgfmathfloatifflags{#1}{1}{#3}{#4}% \else \pgfmathfloatgetflagstomacro#1\pgfmathfloat@loc@TMPa - \if\pgfmathfloat@loc@TMPa#2 - #3\relax + \if#2u% + \ifnum\pgfmathfloat@loc@TMPa>2 + #3\relax + \else + #4\relax + \fi \else - #4\relax + \if\pgfmathfloat@loc@TMPa#2 + #3\relax + \else + #4\relax + \fi \fi \fi \fi @@ -1315,6 +1327,8 @@ % % This operation is not limited to TeX's range of count registers (it % works symbolly) +% +% @see \pgfmathfloattoint \def\pgfmathfloatint@#1{% \begingroup \edef\pgfmathresult{#1}% @@ -1868,16 +1882,21 @@ \pgfutil@ifundefined{pgfmathdeclarefunction}{% % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00: \let\pgfmath@basic@rand=\pgfmathrand + \let\pgfmath@basic@rand@=\pgfmathrand@ \def\pgfmathfloatrand@{% \pgfmath@basic@rand \pgfmathfloatparsenumber{\pgfmathresult}% }% + \let\pgfmathfloatrand=\pgfmathfloatrand@% + % % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00: \let\pgfmath@basic@rnd=\pgfmathrnd + \let\pgfmath@basic@rnd@=\pgfmathrnd@ \def\pgfmathfloatrnd@{% \pgfmath@basic@rnd \pgfmathfloatparsenumber{\pgfmathresult}% }% + \let\pgfmathfloatrnd=\pgfmathfloatrnd@% }{} % Implements the factorial of '#1'. diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex index f93028724a3..af2c68353a7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -27,7 +27,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.14 2009/11/18 20:27:45 ludewich Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.15 2010/05/31 10:11:22 tantau Exp $ \newif\ifpgf@plot@started @@ -941,6 +941,102 @@ +% This handler turns creates a series of straight line segements +% between consecutive points, but leaving /pgf/gap around stream point +% space. +% +% Example: +% +% \pgfplothandlergaplineto +% \pgfplotxyfile{mytable} + +\pgfkeys{/pgf/gap around stream point/.initial=1.5pt} + +\def\pgfplothandlergaplineto{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler@initial% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\relax% + }% +} + +\def\pgf@plot@gap@lineto@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@lineto@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@lineto@handler% +} + +\def\pgf@plot@gap@lineto@handler#1{% + % Ok, compute normalized line vector + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@lineto@next{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgf@plot@gap@lineto@last}{\pgf@plot@gap@lineto@next}}}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfpathmoveto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgf@plot@gap@lineto@last}}% + \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@lineto@next}}% + \global\let\pgf@plot@gap@lineto@last=\pgf@plot@gap@lineto@next% +} + + + + +% This handler works like \pgfplothandlergaplineto, only the last +% point is connected to the first point, creating a closed curve +% space. +% +% Example: +% +% \pgfplothandlergapcycle +% \pgfplotxyfile{mytable} + +\def\pgfplothandlergapcycle{% + \def\pgf@plotstreamstart{% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler@initial% + \global\let\pgf@plotstreamspecial=\pgfutil@gobble% + \global\let\pgf@plotstreamend=\pgf@plot@gap@cycle@handler@finish% + \global\let\pgf@plot@gap@cycle@first=\relax% + }% +} + +\def\pgf@plot@gap@cycle@handler@initial#1{% + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@cycle@last{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \global\let\pgf@plot@gap@cycle@first=\pgf@plot@gap@cycle@last% + \global\let\pgf@plotstreampoint=\pgf@plot@gap@cycle@handler% +} + +\def\pgf@plot@gap@cycle@handler#1{% + % Ok, compute normalized line vector + \pgf@process{#1}% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \xdef\pgf@plot@gap@cycle@next{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% + \pgf@process{\pgfpointnormalised{\pgfpointdiff{\pgf@plot@gap@cycle@last}{\pgf@plot@gap@cycle@next}}}% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% + \pgfpathmoveto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{\pgf@xc}{\pgf@yc}}}{\pgf@plot@gap@cycle@last}}% + \pgfpathlineto{\pgfpointadd{\pgfpointscale{\pgfkeysvalueof{/pgf/gap + around stream point}}{\pgfqpoint{-\pgf@xc}{-\pgf@yc}}}{\pgf@plot@gap@cycle@next}}% + \global\let\pgf@plot@gap@cycle@last=\pgf@plot@gap@cycle@next% +} + +\def\pgf@plot@gap@cycle@handler@finish{% + \ifx\pgf@plot@gap@cycle@first\relax% + \else + \pgf@plot@gap@cycle@handler{\pgf@plot@gap@cycle@first}% + \fi +} + \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex index a03ef94d6a5..8677b488b82 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex index 0c20db997a3..09c012886d6 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex index 20e0bf1b4d2..e7154cc49ed 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex index 62a33269d8b..f403e35ff85 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -141,12 +141,7 @@ } % Extracts the flags of #1 into the macro #2. \def\pgfmathfloatgetflagstomacro#1#2{% - \begingroup - \edef\pgfmathfloat@loc@TMPa{#1}% - \expandafter\pgfmathfloat@decompose@F\pgfmathfloat@loc@TMPa\relax{\count0}% - \xdef\pgfmathfloat@glob@TMP{\the\count0 }% - \endgroup - \let#2=\pgfmathfloat@glob@TMP + \expandafter\pgfmathfloat@decompose@Fmacro#1\relax{#2}% }% % Extracts the mantisse of #1 into the dimen register #2. @@ -245,6 +240,14 @@ \fi #1#2% }% +\def\pgfmathfloat@decompose@Fmacro#1#2{% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@Fmacro@% + \else + \expandafter\pgfmathfloat@decompose@F@error% + \fi + #1#2% +}% \def\pgfmathfloat@decompose@M#1#2{% \ifx#2Y% \expandafter\pgfmathfloat@decompose@M@% @@ -270,6 +273,7 @@ #1#2% }% \def\pgfmathfloat@decompose@F@#1Y#2e#3]\relax#4{#4=#1\relax}% +\def\pgfmathfloat@decompose@Fmacro@#1Y#2e#3]\relax#4{\def#4{#1}}% \def\pgfmathfloat@decompose@M@#1Y#2e#3]\relax#4{#4=#2pt}% \def\pgfmathfloat@decompose@Mtok@#1Y#2e#3]\relax#4{#4={#2}}% \def\pgfmathfloat@decompose@E@#1Y#2e#3]\relax#4{#4=#3\relax}% @@ -378,6 +382,17 @@ } \let\pgfmathfloattofixed=\pgfmathfloattofixed@ +% Converts a float to an integer (in integer format). +% +% @see \pgfmathfloatint +\def\pgfmathfloattoint#1{% + \pgfmathfloattofixed{#1}% + \expandafter\pgfmathfloattoint@@\pgfmathresult\relax +}% +\def\pgfmathfloattoint@@#1.#2\relax{% + \def\pgfmathresult{#1}% +}% + % Converts a floating point number to scientific format 1.234e5. % % This operation is very fast. @@ -476,6 +491,9 @@ \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP \c@pgf@counta=#4\relax + \ifnum#2=0 + \c@pgf@counta=0 + \fi \def\pgfmathresult{}% \ifpgfmathfloatroundhasperiod \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI @@ -837,6 +855,9 @@ \newif\ifpgfmathprintnumber@assumemathmode \newif\ifpgfmathprintnumber@showpositive \newif\ifpgfmathprintnumber@frac@warn +\newif\ifpgfmathprintnumber@frac@whole + +\long\def\pgfmathfloatfrac@verbatim#1#2{#1/#2}% \pgfkeys{% /pgf/number format/.is family, @@ -849,6 +870,10 @@ int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC}, frac/.code= \pgfmath@set@number@printer{pgfmathprintnumber@frac},% frac TeX/.initial=\frac, + frac whole format/.code={\def\pgfmathresult{#1}}, + frac denom/.initial=, + frac whole/.is if=pgfmathprintnumber@frac@whole, + frac whole=true, frac shift/.initial=4, frac warning/.is if=pgfmathprintnumber@frac@warn, frac warning=true, @@ -905,15 +930,19 @@ sci generic/empty mantisse sep/.initial=,% sci generic/exponent/.initial=,% sci generic/.value required, - verbatim/.style={% - sci generic={mantisse sep=,exponent={e##1}}, - 1000 sep=, - skip 0.=false, - print sign=false, - dec sep=., - assume math mode, - @dec sep mark=, - @sci exponent mark=, + verbatim/.code={% + \pgfqkeys{/pgf/number format}{% + sci generic={mantisse sep=,exponent={e##1}}, + 1000 sep=, + skip 0.=false, + print sign=false, + dec sep=., + assume math mode, + frac TeX=\pgfmathfloatfrac@verbatim, + frac whole format/.code={\def\pgfmathresult{##1 }}, + @dec sep mark=, + @sci exponent mark=, + }% }, % sci may skip mantisse/.is if=pgfmathfloatround@allow@empty@mantisse, % sci may skip mantisse/.default=true, @@ -1000,21 +1029,39 @@ \def\pgfmathfloat@loc@TMPa{+}% \fi \else - % FIXME : doesn't respect show pos! + \ifx\pgfmathfloat@loc@TMPa-% + \else + \ifx\pgfmathfloat@loc@TMPa+% + \else + \ifpgfmathprintnumber@showpositive + \edef\pgfmathfloat@loc@TMPa{+\pgfmathfloat@loc@TMPa}% + \fi + \def\pgfmathfloat@loc@TMPb{\pgfkeysvalueof{/pgf/number format/frac whole format/.@cmd}}% + \expandafter\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPa\pgfeov + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \fi + \fi \fi \toks1=\expandafter{\pgfmathfloat@loc@TMPa}% \edef\pgfmathresult{% - \the\toks1 \the\toks0 {#2}{#3}% + \the\toks1 \ifnum#2=0 \else\the\toks0 {#2}{#3}\fi% }% \pgfmath@smuggleone\pgfmathresult \endgroup }% % Defines \pgfmathresult to contain three sets of braces containing -% the sign (optionally containing any components >1), the counter and the denominator for #1. +% the sign (optionally containing any components >1), the numerator and the denominator for #1. % % \pgfmathfloatgetfrac{0.5} -> \pgfmathresult contains {}{1}{2} % \pgfmathfloatgetfrac{-0.5} -> \pgfmathresult contains {-}{1}{2} +% \pgfmathfloatgetfrac{1.5} -> \pgfmathresult contains {1}{1}{2} +% +% special cases: +% \pgfmathfloatgetfrac{0} -> \pgfmathresult contains {0}{0}{1} +% \pgfmathfloatgetfrac{1} -> \pgfmathresult contains {1}{0}{1} +% +% The numerator and denominator is always a number (not empty) \def\pgfmathfloatgetfrac#1{% \begingroup \edef\pgfmathfloat@arg{#1}% @@ -1022,7 +1069,7 @@ \def\pgfmathfloat@loc@TMPa{0}% \ifcase\pgfmathfloat@a@S % #1 = 0: - \def\pgfmathresult{{}{0}{1}}% + \def\pgfmathresult{{0}{0}{1}}% \or% #1 > 0 \pgfmathfloat@a@S=1 \def\pgfmathfloat@loc@TMPa{1}% @@ -1040,7 +1087,8 @@ \ifnum\pgfmathfloat@a@E<0 \def\pgfmathfloat@wholenumber{}% \else - \pgfmathfloattofixed{#1}% + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmathfloattofixed\pgfmathresult% \def\pgfmathfloat@loc@TMPa##1.##2\relax{% \def\pgfmathfloat@wholenumber{##1}% \pgfmathfloatparsenumber{0.##2}% @@ -1048,7 +1096,6 @@ \expandafter\pgfmathfloat@loc@TMPa\pgfmathresult\relax \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E \fi - \pgfmathfloat@a@E=-\pgfmathfloat@a@E % \def\pgfmathfloat@loc@TMPa##1.##2\relax{% \def\pgfmathfloat@mantisse@first{##1}% @@ -1063,66 +1110,92 @@ \fi }% % - \ifdim\pgfmathfloat@mantisse@ltone pt=0pt - \def\pgfmathfloat@factor{1}% - \edef\pgfmathfloat@scaled@counter{\the\pgfmathfloat@a@Mtok}% - \else - % FIXME : this here is numerically instable. - % - % The errors of 1/r are magnified by 10^k which - % doesn't work. - \pgfutil@ifundefined{FPdiv}{% - \pgfmathfloatparsenumber{\pgfmathfloat@mantisse@ltone}% - \pgfmathfloatreciprocal@{\pgfmathresult}% - }{% - % \usepackage{fp}. - % yields higher absolute precision. - \FPmessagesfalse% - \FPdebugfalse% - \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantisse@ltone}% - \pgfmathfloatparsenumber{\pgfmathresult}% - }% - \let\pgfmathfloat@inv=\pgfmathresult - \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}% - \let\pgfmathfloat@scalebaseten=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}% - \let\pgfmathfloat@factor=\pgfmathresult - % - \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}% - \pgfmathfloattofixed\pgfmathresult - \let\pgfmathfloat@scaled@counter=\pgfmathresult - % - \pgfmathfloattofixed\pgfmathfloat@factor - \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}% - \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}% - \fi - % - \let\pgfmathresultcounter=\pgfmathfloat@b@S + % alias registers names: + \let\pgfmathresultnumerator=\pgfmathfloat@b@S \let\pgfmathresultdenom=\pgfmathfloat@b@E % - \pgfmathresultdenom=\pgfmathfloat@factor\relax - \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom - % - \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@counter\relax{\pgfmathresultcounter}% -%\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultcounter\space ( von \pgfmathfloat@scaled@counter), N = \the\pgfmathresultdenom.}% + \pgfkeysgetvalue{/pgf/number format/frac denom}\pgfmath@target@denominator + \ifx\pgfmath@target@denominator\pgfutil@empty % - \pgfmathgreatestcommondivisor{\pgfmathresultcounter}{\pgfmathresultdenom}% - \divide\pgfmathresultcounter by\pgfmathresult\relax - \divide\pgfmathresultdenom by\pgfmathresult\relax - \ifpgfmathprintnumber@frac@warn - \ifnum\pgfmathresultdenom>1000 + \pgfmathfloat@a@E=-\pgfmathfloat@a@E + \ifdim\pgfmathfloat@mantisse@ltone pt=0pt + \def\pgfmathfloat@factor{1}% + \edef\pgfmathfloat@scaled@numerator{\the\pgfmathfloat@a@Mtok}% + \else + % FIXME : this here is numerically instable. + % + % The errors of 1/r are magnified by 10^k which + % doesn't work. \pgfutil@ifundefined{FPdiv}{% - \pgfmathfloattosci@\pgfmathfloat@arg - \immediate\write16{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultcounter\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}% - }{}% + \pgfmathfloatparsenumber{\pgfmathfloat@mantisse@ltone}% + \pgfmathfloatreciprocal@{\pgfmathresult}% + }{% + % \usepackage{fp}. + % yields higher absolute precision. + \FPmessagesfalse% + \FPdebugfalse% + \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantisse@ltone}% + \pgfmathfloatparsenumber{\pgfmathresult}% + }% + \let\pgfmathfloat@inv=\pgfmathresult + \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}% + \let\pgfmathfloat@scalebaseten=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}% + \let\pgfmathfloat@factor=\pgfmathresult + % + \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}% + \pgfmathfloattofixed\pgfmathresult + \let\pgfmathfloat@scaled@numerator=\pgfmathresult + % + \pgfmathfloattofixed\pgfmathfloat@factor + \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}% + \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}% + \fi + % + % + \pgfmathresultdenom=\pgfmathfloat@factor\relax + \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom + % + \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% + %\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultnumerator\space ( von \pgfmathfloat@scaled@numerator), N = \the\pgfmathresultdenom.}% + % + \pgfmathgreatestcommondivisor{\pgfmathresultnumerator}{\pgfmathresultdenom}% + \divide\pgfmathresultnumerator by\pgfmathresult\relax + \divide\pgfmathresultdenom by\pgfmathresult\relax + \ifpgfmathprintnumber@frac@warn + \ifnum\pgfmathresultdenom>1000 + \pgfutil@ifundefined{FPdiv}{% + \pgfmathfloattosci@\pgfmathfloat@arg + \immediate\write16{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}% + }{}% + \fi + \fi + \else + % use target denominator: + \pgfmathresultdenom=\pgfmath@target@denominator\relax + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmathfloattofixed\pgfmathresult + \pgf@xa=\pgfmathresult pt + \multiply\pgf@xa by\pgfmathresultdenom + \edef\pgfmathfloat@scaled@numerator{\pgf@sys@tonumber\pgf@xa}% + \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% + \fi + \ifpgfmathprintnumber@frac@whole + \else + \ifx\pgfmathfloat@wholenumber\pgfutil@empty + \else + \count0=\pgfmathfloat@wholenumber\relax + \multiply\count0 by\pgfmathresultdenom + \advance\pgfmathresultnumerator by\count0 + \def\pgfmathfloat@wholenumber{}% \fi \fi \ifnum\pgfmathfloat@a@S<0 - \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultcounter}{\the\pgfmathresultdenom}}% + \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% \else - \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultcounter}{\the\pgfmathresultdenom}}% + \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% \fi \fi \pgfmath@smuggleone\pgfmathresult @@ -1311,7 +1384,7 @@ \def\pgfmathprintnumber{% % \protect allows to supply \pgfmathprintnumber inside of latex % captions. The \csname yields \relax in case protect is undefined. - \csname protect\endcsname\pgfmathprintnumber@protected + \pgf@texdist@protect\pgfmathprintnumber@protected }% \def\pgfmathprintnumber@protected{% \pgfutil@ifnextchar[% @@ -1937,6 +2010,7 @@ \newif\ifpgfmathfloatparsenumberpendingperiod \def\pgfflt@EOI{p@EOI}% +\def\pgfflt@EOI@unexpanded{\pgfflt@EOI}% % Starts a finite-start-machine parser to read a number. % @@ -2193,16 +2267,16 @@ \def\pgfflt@readexponent#1\pgfflt@EOI{% \afterassignment\pgfflt@readexponent@ - \pgfmathfloat@b@E=#1\relax\pgfflt@EOI + \pgfmathfloat@b@E=#1 \pgfflt@EOI% the white space is important, otherwise \pgfflt@EOI will be expanded. } -\def\pgfflt@readexponent@{% +\def\pgfflt@readexponent@#1{% \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E\relax - \afterassignment\pgfflt@readexponent@@ - \let\pgfmathfloat@loc@TMPb=}% -\def\pgfflt@readexponent@@#1\pgfflt@EOI{% - \ifx\pgfmathfloat@loc@TMPb\relax + % + % sanity checking: + \def\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloat@loc@TMPb\pgfflt@EOI@unexpanded \else - \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1\pgfflt@EOI}% + \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1}% \expandafter\pgfmathfloat@loc@TMPb \fi } diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex new file mode 100644 index 00000000000..e74d47c814e --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex @@ -0,0 +1,122 @@ +% A small optimization package which provides +% +% \beginpgfmathparsecheckfornumber +% ... +% \endpgfmathparsecheckfornumber +% +% in order to optimize \pgfmathparse. It works as follows: inside of +% the environment (which doesn't use scopes), \pgfmathparse is +% *replaced* by a different method which uses an extremely fast check +% to decide whether the input is a number number. Is so, it returns +% the number. Otherwise, it invokes the standard math parser. +% It is about 400% faster than \pgfmathparse if the argument *is* a +% number. +% +% The \endpgfmathparsecheckfornumber is optional (no groups are +% introduced) +% +% Copyright 2010 by Christian Feuersänger. +% +% Replaces \pgfmathparse by the fast number checker. +\def\beginpgfmathparsecheckfornumber{% + \let\pgfmathparse=\pgfmathparsehashedcheck +}% +\def\endpgfmathparsecheckfornumber{% + \let\pgfmathparse=\pgfmathparsehashedcheck@orig +}% + +\def\pgfmp@EOI{\pgfmp@EOI}% +\def\pgfmathparsehashedcheck@isnumber@gobble#1\pgfmp@EOI{} + +\newdimen\r@pgfmathparse@hashedcheck@ +\newcount\c@pgfmathparse@hashedcheck@ +\let\pgfmathparsehashedcheck@orig=\pgfmathparse + +\def\pgfmathparsehashedcheck#1{% + \edef\pgfmathparse@temp{#1}% + \expandafter\pgfmathparsehashedcheck@isnumber@loop\pgfmathparse@temp\pgfmp@EOI + \pgfmathparsehashedcheck@finalize{#1}% +}% +\def\pgfmathparsehashedcheck@finalize@isnonumber#1{% + \pgfmathparsehashedcheck@orig{#1}% + \let\pgfmathparsehashedcheck@finalize\pgfmathparsehashedcheck@finalize@isnumber +}% +\def\pgfmathparsehashedcheck@finalize@isnumber#1{% + \r@pgfmathparse@hashedcheck@=#1pt + \expandafter\pgfmathparsehashed@assign\the\r@pgfmathparse@hashedcheck@ + %-------------------------------------------------- + % % + % \let\KKK=\pgfmathresult + % \pgfmathparsehashedcheck@orig{#1}% + % \ifx\KKK\pgfmathresult + % \else + % \pgfplots@error{FAILED FOR #1: expected `\pgfmathresult'; got `\KKK' (temp = \pgf@temp)}% + % \fi + %-------------------------------------------------- +}% +{\catcode`\p=12\catcode`\t=12\gdef\PGF@TEMP{pt}} +\expandafter\def\expandafter\pgfmathparsehashed@assign\expandafter#\expandafter1\expandafter.\expandafter#\expandafter2\PGF@TEMP{% + \def\pgf@temp{#2}% + \ifx\pgf@temp0% + \def\pgfmathresult{#1}% + \else + \def\pgfmathresult{#1.#2}% + \fi +}% +\let\pgfmathparsehashedcheck@finalize\pgfmathparsehashedcheck@finalize@isnumber + +\expandafter\def\csname pgf@pp+\endcsname{1} +\expandafter\def\csname pgf@pp-\endcsname{1} +\expandafter\def\csname pgf@p0\endcsname{1} +\expandafter\def\csname pgf@p1\endcsname{1} +\expandafter\def\csname pgf@p2\endcsname{1} +\expandafter\def\csname pgf@p3\endcsname{1} +\expandafter\def\csname pgf@p4\endcsname{1} +\expandafter\def\csname pgf@p5\endcsname{1} +\expandafter\def\csname pgf@p6\endcsname{1} +\expandafter\def\csname pgf@p7\endcsname{1} +\expandafter\def\csname pgf@p8\endcsname{1} +\expandafter\def\csname pgf@p9\endcsname{1} +\expandafter\def\csname pgf@p.\endcsname{1} + +\pgfutil@ifundefined{ifcsname}{% + \def\pgfmathparsehashedcheck@isnumber@loop#1{% + \expandafter\ifx\csname pgf@pp\string#1\endcsname\relax + \expandafter\pgfmathparsehashedcheck@isnumber@loop + \else + \expandafter\pgfmathparsehashedcheck@isnumber@loop@\expandafter#1% + \fi + }% + \def\pgfmathparsehashedcheck@isnumber@loop@#1{% + \expandafter\ifx\csname pgf@p\string#1\endcsname\relax + \expandafter\pgfmathparsehashedcheck@isnumber@loop@ + \else + \expandafter\pgfmathparsehashedcheck@isnumber@endfalse\expandafter#1% + \fi + }% +}{% + \def\pgfmathparsehashedcheck@isnumber@loop#1{% + \ifcsname pgf@pp\string#1\endcsname + \expandafter\pgfmathparsehashedcheck@isnumber@loop + \else + \expandafter\pgfmathparsehashedcheck@isnumber@loop@\expandafter#1% + \fi + }% + \def\pgfmathparsehashedcheck@isnumber@loop@#1{% + \ifcsname pgf@p\string#1\endcsname + \expandafter\pgfmathparsehashedcheck@isnumber@loop@ + \else + \expandafter\pgfmathparsehashedcheck@isnumber@endfalse\expandafter#1% + \fi + }% +}% +\def\pgfmathparsehashedcheck@isnumber@endfalse#1{% + \ifx#1\pgfmp@EOI + \else + \let\pgfmathparsehashedcheck@finalize=\pgfmathparsehashedcheck@finalize@isnonumber + \expandafter\pgfmathparsehashedcheck@isnumber@gobble + \fi +}% + + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty index 7814fb566f6..62c7709616a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternal.sty @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -50,6 +50,7 @@ \def\tikzsetnextfilename#1{\gdef\tikzexternal@nextfile{#1}} \def\tikzsetexternalprefix#1{\def\tikzexternal@filenameprefix{#1}} \def\tikzsetfigurename#1{\def\tikzexternal@figurename{#1}}% +\def\tikzappendtofigurename#1{\expandafter\def\expandafter\tikzexternal@figurename\expandafter{\tikzexternal@figurename #1}}% \tikzsetnextfilename{} \tikzsetexternalprefix{} \tikzsetfigurename{\tikzexternal@realjob-figure}% @@ -107,21 +108,57 @@ \fi \endgroup \global\let\tikzexternal@nextfile=\empty - \tikzexternalimage\tikzexternal@curfilename + \pgfincludeexternalgraphics\tikzexternal@curfilename }% -\def\tikzexternalimage#1{% - % now check for (optional) .dpth files for the 'baseline' option: +\def\tikzset#1{}\def\pgfkeys#1{}\def\pgfqkeys#1#2{} +\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\pgfincludeexternalgraphics{#1}} +\def\tikzifinpicture#1#2{#2} +\def\pgfincludeexternalgraphics#1{% \begingroup + \pgfexternalreaddpth{#1}% \setbox1=\hbox{\includegraphics{#1}}% - \openin1=#1.dpth - \ifeof1 \box1 + \ifdim\pgfretval=0pt + \box1 \else - \read1 to\pgfincludeexternalgraphics@dp \closein1 - \dimen0=\pgfincludeexternalgraphics@dp\relax - \hbox{\lower\dimen0\box1}% + \dimen0=\pgfretval\relax + \hbox{\lower\dimen0 \box1 }% \fi \endgroup } -\def\tikzset#1{}\def\pgfkeys#1{}\def\pgfqkeys#1#2{} -\long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\tikzexternalimage{#1}} +\newread\r@pgf@reada +\def\pgfexternalreaddpth#1{% + \edef\pgfexternalreaddpth@restore{% + \noexpand\endlinechar=\the\endlinechar\space + \noexpand\catcode`\noexpand\@=\the\catcode`\@\space + }% + \def\pgfretval{0pt}% + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + \pgfexternalreaddpth@restore +}% +\def\pgfincludeexternalgraphics@read@dpth{% + \ifeof\r@pgf@reada + \closein\r@pgf@reada + \else + \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline + \ifx\pgfincludeexternalgraphics@auxline\empty + \else + \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI + \fi + \expandafter\pgfincludeexternalgraphics@read@dpth + \fi +}% +\long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% + \ifcat\noexpand#1\relax + \if@filesw + {\toks0={#1#2}% + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + \else% + \def\pgfretval{#1#2}% + \fi +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex index 1e788bd5a27..95597ec23c3 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzexternalshared.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% @@ -148,7 +148,7 @@ mode/list only/.code = {\def\tikzexternal@opmode{3}\tikzexternal@genfigurelisttrue}, mode/convert with system call/.code={% \def\tikzexternal@opmode{4}% - \pgfkeysalso{/tikz/external/figure list=false,/pgf/images/aux in dpth=false}% + \pgfkeysalso{/tikz/external/figure list=false,/pgf/images/aux in dpth=true}% ATTENTION: this *can't* work if \label{} contains pictures! }, mode/list and make/.code = {% \def\tikzexternal@opmode{5}% @@ -159,6 +159,7 @@ % system call/.initial={pdflatex -interaction=batchmode -jobname '\image' '\texsource'; pdftops -eps \image.pdf}, force remake/.is if=tikzexternal@force@remake, force remake/.default=true, + failed ref warnings for/.initial={\ref,\cite,\pageref}, export next/.is if=tikzexternalexportnext, export/.is if=tikzexternal@export@enabled, remake next/.is if=tikzexternalremakenext, @@ -166,9 +167,38 @@ verbose IO/.is if=tikzexternal@verboseio, verbose IO/.default=true, verbose IO=true, - shell escape/.initial=-shell-escape, verbose optimize/.is if=tikzexternal@verbose@optimize, + verbose/.style={ + verbose IO=#1, + verbose optimize=#1, + }, + shell escape/.initial=-shell-escape, read main aux/.is if=pgfexternalreadmainaux, + image discarded text/.initial={% + [[ {\sc Image Discarded Due To} {\tt`/tikz/external/% + \ifcase\tikzexternal@opmode\relax + mode=only graphics% + \or + mode=no graphics% + \or + mode=graphics if exists% + \or + mode=list only% + \or + mode=convert with system call% + \or + mode=list and make% + \fi + '}~]]% + \pgfutil@ifundefined{tikzexternal@warning@at@end}{% + \pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{% + \message{! Package tikz Warning: Some images are not up-to-date and need to be generated. }% + }% + }% + \gdef\tikzexternal@warning@at@end{1}% + }{}% + }, optimize/.is choice, optimize/true/.code={% \tikzexternal@optimizetrue @@ -241,6 +271,7 @@ } \def\tikzsetfigurename#1{\pgfkeyssetvalue{/tikz/external/figure name}{#1}}% +\def\tikzappendtofigurename#1{\pgfkeys{/tikz/external/figure name/.add={}{#1}}} % This method sets the file name prefix used for every import/export. % @@ -338,6 +369,9 @@ % inside of images. You will need to call the externalization command % manually. In this case, it should work. % +% The lock file allows to detect automatically whether an image is created by +% 'convert with system call' or if the user issued the required command manually. +% % @PRECONDITION : this command must be invoked AFTER % \tikzexternal@realjob has been defined but BEFORE \pgfrealjobname is % called. @@ -347,8 +381,12 @@ % with system call' if necessary. \def\tikzexternalauxlock@init{% \if4\tikzexternal@opmode + % mode=convert with system call \ifpgfexternalreadmainaux - % mode=convert with system call + % ohoh. This case needs care because the main.aux might + % not be ready at this time! + % check. + % \edef\pgf@tempa{\expandafter\string\csname\tikzexternal@realjob\endcsname}% \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% \ifx\pgf@tempa\pgf@tempb @@ -360,6 +398,8 @@ \tikzexternalauxlock@getlockvalue \if1\tikzexternallocked \pgfexternalreadmainauxfalse + % the main .aux file won't be read. Handle \ref commands: + \tikzexternalauxlock@handleref \else \pgfexternalreadmainauxtrue \fi @@ -397,6 +437,58 @@ \immediate\closeout\w@pgf@writea } + +% Installs a special \ref{} command such that externalized pictures +% can use \ref and the user gets a warning if something fails. +% +% The special \ref handling is installed for every reference command +% in the list '/tikz/external/failed ref warnings for' which contains +% '\ref,\pageref,\cite'. +% +% For use in the aux lock handling only. +\def\tikzexternalauxlock@handleref{% + \let\pgf@external@grab@refundefinedtrue=\pgf@external@grab@refundefinedtrue@orig + % + \pgfkeysgetvalue{/tikz/external/failed ref warnings for}\tikzexternal@temp + \expandafter\tikzexternalauxlock@handleref@loop\tikzexternal@temp,\@EOI,% +} +\def\tikzexternalauxlock@handleref@loop#1,{% + \def\tikzexternal@temp{#1}% + \ifx\tikzexternal@temp\pgfutil@empty + \expandafter\tikzexternalauxlock@handleref@loop + \else + \ifx#1\@EOI + \else + \expandafter\let\csname tikzexternalauxlock@handleref@orig@\string#1\endcsname=#1% + \def#1{\tikzexternalauxlock@handleref@repl{#1}}% + \expandafter\expandafter\expandafter\tikzexternalauxlock@handleref@loop + \fi + \fi +}% +\def\tikzexternalauxlock@handleref@repl#1{\pgfutil@ifnextchar[{\tikzexternalauxlock@handleref@repl@{#1}}{\tikzexternalauxlock@handleref@repl@{#1}[]}}% +\def\tikzexternalauxlock@handleref@repl@#1[#2]#3{% + \csname tikzexternalauxlock@handleref@orig@\string#1\endcsname{#3}% + \begingroup + \def\n{\pgfexternal@hat\pgfexternal@hat J}% + \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% + \def\space{\noexpand\space}% + \pgfexternalstorecommand{% + \noexpand\begingroup + \noexpand\toks0={\pgf@tempa}% + \noexpand\immediate\noexpand\write16{\tikzexternalauxlock@handleref@warning{#3}{\noexpand\the\noexpand\toks0}}% + \noexpand\G@refundefinedtrue + \noexpand\endgroup + }% + \endgroup +}% +\def\tikzexternalauxlock@handleref@warning#1#2{% + \n + LaTeX Warning: Reference `#1' in external picture `\pgfactualjobname' could not be resolved\noexpand\on@line.\n + This is because the \tikzexternal@realjob.aux file is not accessable in this context, you will need to issue the externalize command\n + \space\space\space#2\n + manually.\n% +} + % Expands to the default image extension (it is set by % \tikzexternalize). % @@ -886,38 +978,6 @@ \fi }% -\def\tikzexternal@externalizefig@GRAB{% - \iftikzexternal@optimize - \ifpgf@external@grabshipout - \tikzexternal@optimize@RESTORE - \fi - \fi - \def\tikzpicture{% - \def\tikzpicture{% make sure that nested \tikzpicture are processed normally. - \begingroup - \def\endtikzpicture{% - \tikzexternal@origendpicture - \endgroup - }% - \tikzexternal@origpicture - }% - \pgf@external@grab{\tikzexternal@curfilename}% - \tikzexternal@origpicture - }% - \def\endtikzpicture{% - \tikzexternal@origendpicture - \pgf@externalend - \let\tikzpicture=\tikzexternal@tikzpicture@replacement - \let\endtikzpicture=\tikzexternal@origendpicture - \iftikzexternal@optimize - \ifpgf@external@grabshipout - \tikzexternal@optimize@REPLACE - \fi - \fi - }% - \tikzpicture -}% - % Used by the optimization code. % It will be called if GRAB mode is on. @@ -1097,21 +1157,7 @@ \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@listmodepicture@@ } \long\def\tikzexternal@listmodepicture@@#1{% - [[ {\sc Image Discarded Due To} {\tt`/tikz/external/% - \ifcase\tikzexternal@opmode\relax - mode=only graphics% - \or - mode=no graphics% - \or - mode=graphics if exists% - \or - mode=list only% - \or - mode=convert with system call% - \or - mode=list and make% - \fi - '}~]]% + \pgfkeysvalueof{/tikz/external/image discarded text}% \tikzexternal@closeenvironments } @@ -1323,7 +1369,30 @@ \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% \pgf@tempa \ifx\pgf@filename\pgfutil@empty% - \PackageError{tikz}{Sorry, the system call '#1' did NOT result in a usable output file '\tikzexternal@curfilename' (expected one of \pgfsys@imagesuffixlist). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in '\tikzexternal@curfilename.log'. If you continue now, I'll try to typeset the picture.}% + \PackageError{tikz}{Sorry, the system call '#1' did NOT result in a usable output file '\tikzexternal@curfilename' (expected one of \pgfsys@imagesuffixlist). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in '\tikzexternal@curfilename.log'. If you continue now, I'll try to typeset the picture}% \fi }% +% Overwrite error message of pgf. +% This happens if the generated image was empty, i.e. if there was no \shipout. +\def\pgfexternal@error@no@shipout{% + \begingroup + \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% + \toks0=\expandafter{\pgf@tempa}% + \PackageError{tikz}{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname', but it seems there is no such image in the document!? + \if\tikzexternal@opmode4 ^^J +\space\space You are currently using 'mode=convert with system call'. This problem can happen if the image (or one of the images preceeding it) was declared inside of a \string\label{} (i.e. in the .aux file): 'convert with system call' has no access to the main aux file.^^J +\space\space Possible solutions in this case:^^J +\space\space a) Try using 'mode=list and make',^^J +\space\space b) Issue the externalization command '\the\toks0' *manually* (also check the preceeding externalized images, perhaps the file name sequence is not correct).^^J +\space\space Repeat: the resulting image was EMPTY, your attention is required +\else + \if\tikzexternal@opmode5 ^^J +\space\space You are currently using 'mode=list and make'. Possible solutions:^^J +\space\space a) Try to delete `\tikzexternal@realjob.makefile'. Perhaps it is not up-to-date.^^J +\space\space b) Perhaps pictures are declared inside of \string\label{} and the .aux file is not up-to-date. Re-run latex, perhaps re-generate the graphics as well.^^J +\space\space Repeat: the resulting image was EMPTY, your attention is required + \fi +\fi}% + \endgroup +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex index a850f7f3608..0983f904866 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex @@ -14,7 +14,7 @@ %%% - nested \input commands have been updated %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%% Date of this copy: Mi 31. Mär 21:41:41 CEST 2010 %%% +%%% Date of this copy: Mi 14. Jul 21:31:43 CEST 2010 %%% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index bcc43c4051e..14e4d2e9c3d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -50,6 +50,7 @@ \newif\ifpgfplots@axis@equal \newif\ifpgfplots@axis@equal@image \newif\ifpgfplots@reverse@legend +\newif\ifpgfplots@transpose@legend \newif\ifpgfplots@allow@reversal@of@rel@axis@cs \newif\ifpgfplots@scanline@verbose \newcount\pgfplots@numplots @@ -240,6 +241,17 @@ } } +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@center\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south west\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south east\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@east\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north east\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north west\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@west\endcsname{1} +\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@baseline\endcsname{1} + % Sets the keys for /pgfplots/[xyz]ticklabel anchor. % #1: one of [xyz] % #2: the value @@ -409,6 +421,50 @@ \pgfplots@cycle@multi@list@finalize@ }% +\def\pgfplots@pgfkeys@set@point@meta@value#1{% + % + \pgfutil@in@{=}{#1}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPa##1=##2\pgfplots@EOI{% + % remove spaces from ##1 and ##2: + \pgfkeys@spdef\pgfplots@loc@TMPa{##1}% + \pgfkeys@spdef\pgfplots@loc@TMPb{##2}% + % + % check if the argument is known: + \pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPa/.@cmd}{% + \def\pgfplots@loc@TMPc{% + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/\pgfplots@loc@TMPa/.@cmd}% + }% + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPb}% + }{% + \pgfplotsthrow{invalid argument} + {\pgfplots@loc@TMPa}% + {Sorry, `##1' is no valid choice for `point meta'. Maybe you misspelled it?}% + \pgfeov + }% + }% + % disassemble key'='value: + \pgfplots@loc@TMPa#1\pgfplots@EOI + \else + % the following code allows + % 'point meta=\thisrow{xcol}' even though + % \thisrow might be undefined in the context where keys are set. + % I convert the argument to a string. + \def\pgfplots@loc@TMPa{#1}% + \pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % + \pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{% + % ok, use it! + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{}% + }{% + % oh, then it will be a math expression. + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/expr/.@cmd}{#1}% + }% + \fi + % + % +}% + \pgfkeys{% /pgfplots/search path for tikz/.search also={/tikz,/pgfplots}, /pgfplots/.is family, @@ -664,8 +720,14 @@ % Colorbar interface: /pgfplots/colorbar/.is if=pgfplots@colorbar, /pgfplots/colorbar/.default=true, + /pgfplots/colorbar to label/.style={/pgfplots/colorbar to name={#1}}, + /pgfplots/colorbar to name/.initial=, + /pgfplots/colorbar source/.code={\pgfplots@error{Sorry, you can only set `colorbar source' inside of \string\addplot\space (or a cycle list)}}, + /pgfplots/colorbar source/.default=true, + /pgfplots/colorbar pos*/.initial=,% one of 'rltb' (right, left, top, bottom). for internal use, to handle checks. /pgfplots/colorbar right/.style={% /pgfplots/colorbar=true, + /pgfplots/colorbar pos*=r, /pgfplots/colorbar shift/.style={xshift=0.3cm}, /pgfplots/every colorbar/.style={% title=, @@ -688,26 +750,28 @@ enlargelimits=false, scale only axis, height=\pgfkeysvalueof{/pgfplots/parent axis height},% - x=\pgfkeysvalueof{/pgfplots/colorbar/width}, + width=\pgfkeysvalueof{/pgfplots/colorbar/width}, xtick=\empty, xticklabel=, ytick=, yticklabel=, - yticklabel pos=right, + yticklabel pos=right,% ATTENTION: I check for this setting in 'colorbar sampled line', see below! colorbar vertical/lowlevel, }% },% /pgfplots/colorbar left/.style={% /pgfplots/colorbar right, + /pgfplots/colorbar pos*=l, /pgfplots/colorbar shift/.style={xshift=-0.3cm}, /pgfplots/every colorbar/.append style={% at={(parent axis.left of north west)}, anchor=north east, - yticklabel pos=left, + yticklabel pos=left,% ATTENTION: I check for this setting in 'colorbar sampled line', see below! }% },% /pgfplots/colorbar horizontal/.style={% /pgfplots/colorbar=true, + /pgfplots/colorbar pos*=b, /pgfplots/colorbar shift/.style={yshift=-0.3cm}, /pgfplots/every colorbar/.style={% title=, @@ -730,7 +794,7 @@ enlargelimits=false, scale only axis, width=\pgfkeysvalueof{/pgfplots/parent axis width},% - y=\pgfkeysvalueof{/pgfplots/colorbar/width}, + height=\pgfkeysvalueof{/pgfplots/colorbar/width}, xticklabel pos=left, xtick=, xticklabel=, @@ -743,6 +807,7 @@ % styles is incompatible with '.add code' -- and therefor also % with '.append style'. This here is a work-around which works. /pgfplots/colorbar vertical/lowlevel/.style={% + /pgfplots/colorbar addplot=\addplot graphics {};, plot graphics/lowlevel draw/.code 2 args={% \if\pgfkeysvalueof{/pgfplots/y dir/value}n% \pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##2}\pgfplots@loc@TMPa @@ -755,6 +820,7 @@ },% }, /pgfplots/colorbar horizontal/lowlevel/.style={% + /pgfplots/colorbar addplot=\addplot graphics {};, plot graphics/lowlevel draw/.code 2 args={% \if\pgfkeysvalueof{/pgfplots/x dir/value}n% \pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{##1}\pgfplots@loc@TMPa @@ -770,11 +836,90 @@ /pgfplots/colorbar=false, /pgfplots/colorbar style/.style={/pgfplots/every colorbar/.append style={#1}}, /pgfplots/colorbar/width/.initial=0.5cm, + /pgfplots/colorbar addplot/.initial=\addplot graphics {};, /pgfplots/colorbar/draw/.code={% + % FIXME : the semicolon after ';' has a fixed catcode, namely + % the one assigned while pgfplots.code.tex has been read. + % + % The \pgfplots@checkandpreparefor@active@semicolon gets + % confused if the catcodes change... this here is a + % work-around for babel support. + \let\pgfplots@checkandpreparefor@active@semicolon=\relax \axis[every colorbar,colorbar shift,colorbar=false] - \addplot graphics {}; + \pgfkeysvalueof{/pgfplots/colorbar addplot}% \endaxis },% + /pgfplots/every colorbar sampled line/.style={help lines}, + /pgfplots/colorbar sampled line style/.style={/pgfplots/every colorbar sampled line/.append style={#1}}, + /pgfplots/colorbar sampled line/.style={% + colorbar, + /pgfplots/colorbar/draw/.code={% + \axis[ + cycle list={#1\\}, + domain=\pgfkeysvalueof{/pgfplots/point meta min}:\pgfkeysvalueof{/pgfplots/point meta max}, + every colorbar,colorbar shift,colorbar=false] + \pgfkeysvalueof{/pgfplots/colorbar addplot}% + \endaxis + },% + /pgfplots/colorbar horizontal/lowlevel/.code={% + \pgfkeysgetvalue{/pgfplots/colorbar pos*}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@loc@TMPa{b}% + \fi + \if b\pgfplots@loc@TMPa + \pgfkeysalso{axis x line*=bottom}% DEFAULT. + \else + \pgfkeysalso{axis x line*=top}% + \fi + \pgfkeysalso{% + y axis line style={/pgfplots/every colorbar sampled line}, + /pgfplots/colorbar addplot={\addplot {0.5};}, + point meta=x, + }% + },% + /pgfplots/colorbar vertical/lowlevel/.code={% + \pgfkeysgetvalue{/pgfplots/colorbar pos*}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@loc@TMPa{r}% + \fi + \if l\pgfplots@loc@TMPa + \pgfkeysalso{axis y line*=left}% + \else + \pgfkeysalso{axis y line*=right}% DEFAULT + \fi + \pgfkeysalso{% + x axis line style={/pgfplots/every colorbar sampled line}, + /pgfplots/colorbar addplot={\addplot (0.5,x);}, + point meta=y, + }% + },% + },% + /pgfplots/colorbar sampled line/.default={scatter,only marks}, + % + /pgfplots/colorbar sampled/.style={% + colorbar, + /pgfplots/colorbar/draw/.code={% + \axis[ + view={0}{90}, + cycle list={#1\\}, + domain=\pgfkeysvalueof{/pgfplots/point meta min}:\pgfkeysvalueof{/pgfplots/point meta max}, + samples y=2, + domain y=0:1, + zmin=0,zmax=1, + every colorbar,colorbar shift,colorbar=false] + \pgfkeysvalueof{/pgfplots/colorbar addplot}% + \endaxis + },% + /pgfplots/colorbar horizontal/lowlevel/.style={% + /pgfplots/colorbar addplot={\addplot3 {0};}, + point meta=x, + },% + /pgfplots/colorbar vertical/lowlevel/.style={% + /pgfplots/colorbar addplot={\addplot3 (y,x,0);}, + point meta=y, + },% + },% + /pgfplots/colorbar sampled/.default={surf,mark=none,shader=flat}, % tick options: /pgfplots/xticklabel/.store in= \pgfplots@xticklabel, /pgfplots/xticklabel/.belongs to family=/pgfplots/tick, @@ -1259,12 +1404,18 @@ % legend options: /pgfplots/legend entries/.initial={}, /pgfplots/legend entries/.belongs to family=/pgfplots/legend, + /pgfplots/legend to label/.style={/pgfplots/legend to name={#1}}, + /pgfplots/legend to name/.initial=,% /pgfplots/legend pos/.is choice, /pgfplots/legend pos/south west/.style={/pgfplots/legend style={at={(0.03,0.03)},anchor=south west}}, /pgfplots/legend pos/south east/.style={/pgfplots/legend style={at={(0.97,0.03)},anchor=south east}}, /pgfplots/legend pos/north west/.style={/pgfplots/legend style={at={(0.03,0.97)},anchor=north west}}, /pgfplots/legend pos/north east/.style={/pgfplots/legend style={at={(0.97,0.97)},anchor=north east}}, /pgfplots/legend pos/outer north east/.style={/pgfplots/legend style={at={(1.03,1)},anchor=north west}}, + /pgfplots/legend cell align/.is choice, + /pgfplots/legend cell align/left/.style= {/pgfplots/legend style={cells={anchor=west}}}, + /pgfplots/legend cell align/right/.style= {/pgfplots/legend style={cells={anchor=east}}}, + /pgfplots/legend cell align/center/.style= {/pgfplots/legend style={cells={anchor=center}}}, /pgfplots/legend columns/.store in=\pgfplots@legend@columns, /pgfplots/legend columns/.belongs to family=/pgfplots/legend, /pgfplots/legend columns=1, @@ -1278,6 +1429,8 @@ /pgfplots/legend plot pos/none/.belongs to family=/pgfplots/legend, /pgfplots/legend plot pos=left, /pgfplots/every legend image post/.code={},% + /pgfplots/legend image post style/.style={/pgfplots/every legend image post/.append style={#1}}, + /pgfplots/empty legend/.style={/pgfplots/legend image code/.code=}, /pgfplots/line legend/.style={% /pgfplots/legend image code/.code={% \draw[mark repeat=2,mark phase=2,##1] @@ -1292,6 +1445,10 @@ /pgfplots/legend image code/.belongs to family=/pgfplots/legend, /pgfplots/reverse legend/.is if=pgfplots@reverse@legend, /pgfplots/reverse legend/.default=true, + /pgfplots/transpose legend/.is if=pgfplots@transpose@legend, + /pgfplots/transpose legend/.default=true, + /pgfplots/legend transposed/.style={transpose legend=#1}, + /pgfplots/legend reversed/.style={reverse legend=#1}, % axis description options: /pgfplots/title/.initial=, /pgfplots/xlabel/.initial=, @@ -1313,6 +1470,22 @@ \pgfplots@assert@tikzinternal@exists{tikz@scan@one@point}% \tikz@scan@one@point\pgfplots@set@at#1}, /pgfplots/at/.belongs to family=/pgfplots, + /pgfplots/trim axis left/.code={% + \pgfutil@ifundefined{pgfsettrimleft}{% + \pgfplots@error{Sorry, the 'trim axis left' requires a more recent PGF version. At the time of this writing, only the experimental PGF version available from texexample.net supports it.}% + }{% + \pgfkeysalso{/tikz/trim left=(current axis.south west)}% + }% + },% + /tikz/trim axis left/.style={/pgfplots/trim axis left}, + /pgfplots/trim axis right/.code={% + \pgfutil@ifundefined{pgfsettrimleft}{% + \pgfplots@error{Sorry, the 'trim axis right' requires a more recent PGF version. At the time of this writing, only the experimental PGF version available from texexample.net supports it.}% + }{% + \pgfkeysalso{/tikz/trim right=(current axis.south east)}% + }% + },% + /tikz/trim axis right/.style={/pgfplots/trim axis right}, /pgfplots/clip limits/.is if=pgfplots@clip@limits, /pgfplots/clip limits/.default=true, /pgfplots/clip limits=true, @@ -1324,29 +1497,17 @@ /pgfplots/axis equal/.default=true, /pgfplots/axis equal image/.is if=pgfplots@axis@equal@image, /pgfplots/axis equal image/.default=true, - /pgfplots/xmin/.belongs to family=/pgfplots, /pgfplots/xmin/.initial=, - /pgfplots/xmax/.belongs to family=/pgfplots, /pgfplots/xmax/.initial=, - /pgfplots/ymin/.belongs to family=/pgfplots, /pgfplots/ymin/.initial=, - /pgfplots/ymax/.belongs to family=/pgfplots, /pgfplots/ymax/.initial=, - /pgfplots/zmin/.belongs to family=/pgfplots, /pgfplots/zmin/.initial=, - /pgfplots/zmax/.belongs to family=/pgfplots, /pgfplots/zmax/.initial=, - /pgfplots/xtickmin/.belongs to family=/pgfplots, /pgfplots/xtickmin/.initial=, - /pgfplots/xtickmax/.belongs to family=/pgfplots, /pgfplots/xtickmax/.initial=, - /pgfplots/ytickmin/.belongs to family=/pgfplots, /pgfplots/ytickmin/.initial=, - /pgfplots/ytickmax/.belongs to family=/pgfplots, /pgfplots/ytickmax/.initial=, - /pgfplots/ztickmin/.belongs to family=/pgfplots, /pgfplots/ztickmin/.initial=, - /pgfplots/ztickmax/.belongs to family=/pgfplots, /pgfplots/ztickmax/.initial=, /pgfplots/stack plots/.is choice, /pgfplots/stack plots/.belongs to family=/pgfplots, @@ -1379,19 +1540,28 @@ /pgfplots/z filter/.code={}, /pgfplots/z filter/.belongs to family=/pgfplots, /pgfplots/filter point/.code=, - /pgfplots/restrict x to domain/.style={/pgfplots/@restrict to domain={x}{}{#1}},% - /pgfplots/restrict y to domain/.style={/pgfplots/@restrict to domain={y}{}{#1}},% - /pgfplots/restrict z to domain/.style={/pgfplots/@restrict to domain={z}{}{#1}},% - /pgfplots/restrict expr to domain/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}},% + /pgfplots/restrict x to domain/.style={/pgfplots/@restrict to domain={x}{}{#1}{0}},% + /pgfplots/restrict y to domain/.style={/pgfplots/@restrict to domain={y}{}{#1}{0}},% + /pgfplots/restrict z to domain/.style={/pgfplots/@restrict to domain={z}{}{#1}{0}},% + /pgfplots/restrict expr to domain/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}{0}},% + /pgfplots/restrict x to domain*/.style={/pgfplots/@restrict to domain={x}{}{#1}{1}},% + /pgfplots/restrict y to domain*/.style={/pgfplots/@restrict to domain={y}{}{#1}{1}},% + /pgfplots/restrict z to domain*/.style={/pgfplots/@restrict to domain={z}{}{#1}{1}},% + /pgfplots/restrict expr to domain*/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}{1}},% % '#1': the filter to install % '#2': a mathematical expression (or empty) % '#3': the interval. must be numeric currently. - /pgfplots/@restrict to domain/.code args={#1#2#3}{% - \edef\pgfplots@loc@TMPa{#3}% + % '#4': bAssignLimits=0|1. if #4=1, any coordinate outside of the + % allowed domain will take the domain boundary as value. If #4=0, + % any coordinate outside of the allowed domain will get 'inf' or + % '-inf'. + /pgfplots/@restrict to domain/.code args={#1#2#3#4}{% + \if0#4% + \pgfkeysalso{/pgfplots/unbounded coords=jump}% + \fi % when invoked, ##1 and ##2 will be floats: \def\pgfplots@loc@TMPb##1:##2\relax{% \pgfkeysalso{% - /pgfplots/unbounded coords=jump,% /pgfplots/#1 filter/.append code={% \let\pgfplots@restrict@to@domain@orig=\pgfmathresult \def\pgfplots@restrict@to@domain@tmp{#2}% @@ -1405,11 +1575,11 @@ \let\pgfplots@restrict@to@domain@tmp=\pgfmathresult \pgfmathfloatlessthan@{\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument \ifpgfmathfloatcomparison - \def\pgfmathresult{inf}% + \edef\pgfmathresult{\if0#4inf\else ##1\fi}% \else \pgfmathfloatgreaterthan@{\pgfplots@restrict@to@domain@tmp}{##2}% \ifpgfmathfloatcomparison - \def\pgfmathresult{-inf}% + \edef\pgfmathresult{\if0#4-inf\else ##2\fi}% \else \let\pgfmathresult=\pgfplots@restrict@to@domain@orig \fi @@ -1425,10 +1595,11 @@ \edef\pgfplots@loc@TMPc{\pgfplots@rangea:\pgfmathresult}% \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPc\relax }% + \edef\pgfplots@loc@TMPa{#3}% \expandafter\pgfplots@loc@TMPc\pgfplots@loc@TMPa\relax },% % -> keeps only the nth point, all other ones will get ''. - /pgfplots/each nth point/.style 2 args={% + /pgfplots/each nth point/.style={% /pgfplots/x filter/.append code={% \ifnum\coordindex=0 \def\c@pgfplots@eachnthpoint@xfilter{0}% @@ -1453,6 +1624,9 @@ \fi} }, /pgfplots/translate gnuplot/.is if=pgfplots@translategnuplot, + /pgfplots/gnuplot writes logscale/.is choice, + /pgfplots/gnuplot writes logscale/true/.code={\gdef\pgfplots@gnuplot@logscale@writes@log{1}},% + /pgfplots/gnuplot writes logscale/false/.code={\gdef\pgfplots@gnuplot@logscale@writes@log{0}},% /pgfplots/parametric/var 2d/.initial={\u,\v}, /pgfplots/parametric/var 1d/.initial=\t, /pgfplots/xfilter/.initial=,% DEPRECATED @@ -1503,6 +1677,7 @@ /pgfplots/enlarge z limits=#1,% },% /pgfplots/enlargelimits/.default=true, + /pgfplots/update limits/.is if=pgfplots@bb@isactive, /pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/x/.belongs to family=/pgfplots, /pgfplots/y/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' @@ -1544,6 +1719,7 @@ }, /pgfplots/cycle list name/.belongs to family=/pgfplots, /pgfplots/cycle list name=color, + /pgfplots/cycle list shift/.initial=, % accepts arguments of the form % <first list spec>\nextlist <second list spec>\nextlist .... % where each list spec is EITHER a cycle list name OR a cycle list @@ -1936,43 +2112,30 @@ % 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, % set \pgfplots@yaxisdiscontnum % none = 0 % crunch = 1 % open = 2 /pgfplots/axis z discontinuity/.is choice, - /pgfplots/axis z discontinuity/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity/none/.code ={\def\pgfplots@zaxisdiscontnum{0}}, - /pgfplots/axis z discontinuity/none/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity/crunch/.code ={\def\pgfplots@zaxisdiscontnum{1}}, - /pgfplots/axis z discontinuity/crunch/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity/parallel/.code ={\def\pgfplots@zaxisdiscontnum{2}}, - /pgfplots/axis z discontinuity/parallel/.belongs to family=/pgfplots, %/axis, /pgfplots/axis z discontinuity=none, /pgfplots/scale only axis/.is if=pgfplots@scale@only@axis, /pgfplots/scale only axis/.default=true, - /pgfplots/scale only axis/.belongs to family=/pgfplots, /pgfplots/scale only axis=false, % sets \pgfplots@xislinear to % normal=true @@ -2137,6 +2300,13 @@ \def\pgfplots@nodes@near@coords@align{above}% }% \fi + \else + \pgfutil@ifundefined{pgfplots@nodesnearcoordsalign@isanchor@\pgfplots@nodes@near@coords@align} + {}% + {% + \t@pgfplots@toka=\expandafter{\pgfplots@nodes@near@coords@align}% + \edef\pgfplots@nodes@near@coords@align{anchor=\the\t@pgfplots@toka}% + }% \fi \fi % ok, place the node. @@ -2146,7 +2316,7 @@ {% \if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname% % point meta=explicit symbolic - % do no try to invoke \pgfmathprintnumber on + % do not try to invoke \pgfmathprintnumber on % symbolic data... this check should keep the user % interface simpler. \def\pgfplots@loc@TMPa{\pgfmathprintnumber\pgfplotspointmeta}% @@ -2192,9 +2362,9 @@ /pgf/bar shift={% % total width = n*w + (n-1)*skip % -> subtract half for centering - -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + -0.5*(\numplotsofactualtype*\pgfplotbarwidth + (\numplotsofactualtype-1)*#1) + % the '0.5*w' is for centering - (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + (.5+\plotnumofactualtype)*\pgfplotbarwidth + \plotnumofactualtype*#1},% /pgfplots/error bars/draw error bar/.code 2 args={% % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% @@ -2210,7 +2380,6 @@ /tikz/ybar, }, /pgfplots/ybar/.default=2pt, - /pgfplots/ybar/.belongs to family=/pgfplots, /pgfplots/xbar legend/.style={ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, }, @@ -2222,9 +2391,9 @@ /pgf/bar shift={% % total width = n*w + (n-1)*skip % -> subtract half for centering - -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + -0.5*(\numplotsofactualtype*\pgfplotbarwidth + (\numplotsofactualtype-1)*#1) + % the '0.5*w' is for centering - (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + (.5+\plotnumofactualtype)*\pgfplotbarwidth + \plotnumofactualtype*#1},% /pgfplots/error bars/draw error bar/.code 2 args={% % FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% @@ -2240,7 +2409,6 @@ /tikz/xbar, }, /pgfplots/xbar/.default=2pt, - /pgfplots/xbar/.belongs to family=/pgfplots, /pgfplots/ybar interval legend/.style={ /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, }, @@ -2252,12 +2420,11 @@ xtick align=outside, xtick=data, ybar interval legend, - bar interval width={#1/\numplots}, - bar interval shift={(\plotnum+0.5)/\numplots}, + bar interval width={#1/\numplotsofactualtype}, + bar interval shift={(\plotnumofactualtype+0.5)/\numplotsofactualtype}, /tikz/ybar interval, }, /pgfplots/ybar interval/.default=1, - /pgfplots/ybar interval/.belongs to family=/pgfplots, /pgfplots/xbar interval legend/.style={% /pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};}, }, @@ -2269,12 +2436,11 @@ ymajorgrids, ytick align=outside, xbar interval legend, - bar interval width={#1/\numplots}, - bar interval shift={(\plotnum+0.5)/\numplots}, + bar interval width={#1/\numplotsofactualtype}, + bar interval shift={(\plotnumofactualtype+0.5)/\numplotsofactualtype}, /tikz/xbar interval, }, /pgfplots/xbar interval/.default=1, - /pgfplots/xbar interval/.belongs to family=/pgfplots, /pgfplots/xbar stacked/.style={ /pgfplots/set point meta if empty=x,% bar cycle list, @@ -2283,7 +2449,6 @@ /tikz/xbar, }, /pgfplots/xbar stacked/.default=plus, - /pgfplots/xbar stacked/.belongs to family=/pgfplots, /pgfplots/ybar stacked/.style={ /pgfplots/set point meta if empty=f(x),% bar cycle list, @@ -2292,7 +2457,6 @@ /tikz/ybar, }, /pgfplots/ybar stacked/.default=plus, - /pgfplots/ybar stacked/.belongs to family=/pgfplots, /pgfplots/xbar interval stacked/.style={ /pgfplots/set point meta if empty=x,% bar cycle list, @@ -2301,7 +2465,6 @@ /tikz/xbar interval, }, /pgfplots/xbar interval stacked/.default=plus, - /pgfplots/xbar interval stacked/.belongs to family=/pgfplots, /pgfplots/ybar interval stacked/.style={ /pgfplots/set point meta if empty=f(x),% bar cycle list, @@ -2310,7 +2473,6 @@ /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}$} @@ -2327,6 +2489,7 @@ /pgfplots/plot graphics/.code={\let\tikz@plot@handler=\pgfplotsplothandlergraphics},% /pgfplots/plot graphics/src/.initial=, /pgfplots/plot graphics/includegraphics/.initial=, + /pgfplots/plot graphics/includegraphics cmd/.initial=\includegraphics, /pgfplots/plot graphics/xmin/.initial=, /pgfplots/plot graphics/xmax/.initial=, /pgfplots/plot graphics/ymin/.initial=, @@ -2435,6 +2598,19 @@ /pgfplots/clip marker paths/.default=true, /pgfplots/axis on top/.is if=pgfplots@axis@on@top, /pgfplots/axis on top/.default=true, + /pgfplots/invoke before crossref tikzpicture/.initial={% + \expandafter\ifx\csname tikzappendtofigurename\endcsname\relax + \else + \begingroup + \tikzappendtofigurename{_crossref}% + \fi + }, + /pgfplots/invoke after crossref tikzpicture/.initial={% + \expandafter\ifx\csname tikzappendtofigurename\endcsname\relax + \else + \endgroup + \fi + },% /pgfplots/every crossref picture/.style={% baseline,yshift=0.3em }, @@ -2505,30 +2681,20 @@ /pgfplots/symbolic z coords/.style={symbolic coords={z}{#1}},% % Defines the class name \pgfplotspointmetainputhandler: /pgfplots/point meta/.code={% - % this thing here converts control sequences to - % characters, they won't cause 'unknown control sequence' - % errors: - \def\pgfplots@loc@TMPa{#1}% - \pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{% - \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/#1/.@cmd}{}% - }{% - \pgfplotssetpointmetainput{expr}{#1}% - }% + \pgfplots@pgfkeys@set@point@meta@value{#1}% },% /pgfplots/point meta/none/.code ={\pgfplotssetpointmetainput{}{}},% /pgfplots/point meta/x/.code ={\pgfplotssetpointmetainput{x}{}},% /pgfplots/point meta/y/.code ={\pgfplotssetpointmetainput{y}{}},% /pgfplots/point meta/z/.code ={\pgfplotssetpointmetainput{z}{}},% + /pgfplots/point meta/expr/.code={\pgfplotssetpointmetainput{expr}{#1}},% /pgfplots/point meta/explicit/.code={\pgfplotssetpointmetainput{explicit}{}},% /pgfplots/point meta/explicit symbolic/.code={\pgfplotssetpointmetainput{explicit symbolic}{}},% - /pgfplots/point meta/f(x)/.code={ - \ifpgfplots@curplot@threedim - \pgfplotssetpointmetainput{z}{}% - \else - \pgfplotssetpointmetainput{y}{}% - \fi - }, + /pgfplots/point meta/f(x)/.code={\pgfplotssetpointmetainput{f(x)}{}},% + /pgfplots/point meta/TeX code/.code={\pgfplotssetpointmetainput{TeX code}{#1}},% + /pgfplots/point meta/TeX code/.value required, + /pgfplots/point meta/TeX code symbolic/.code={\pgfplotssetpointmetainput{TeX code symbolic}{#1}},% + /pgfplots/point meta/TeX code symbolic/.value required, /pgfplots/set point meta if empty/.code={% \ifx\pgfplotspointmetainputhandler\pgfutil@empty \pgfkeysalso{/pgfplots/point meta/#1}% @@ -2738,9 +2904,11 @@ /pgfplots/xtick placement tolerance/.initial=0.05pt, /pgfplots/ytick placement tolerance/.initial=0.05pt, /pgfplots/ztick placement tolerance/.initial=0.05pt, + % /pgfplots/compat/anchors/.is choice, /pgfplots/compat/anchors/pre 1.3/.code={\pgfplots@deprecated@anchorstrue},% FIXME: WAS \global /pgfplots/compat/anchors/1.3/.code= {\pgfplots@deprecated@anchorsfalse},% + /pgfplots/compat/anchors/1.4/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/newest/.style= {/pgfplots/compat/anchors/1.3},% /pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},% /pgfplots/compat/labels/.is choice, @@ -2750,8 +2918,9 @@ /pgfplots/compat/labels/1.3/.style={% /pgfplots/xlabel near ticks, /pgfplots/ylabel near ticks},% - /pgfplots/compat/labels/newest/.style={/pgfplots/compat/labels/1.3},% - /pgfplots/compat/labels/default/.style={/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( + /pgfplots/compat/labels/1.4/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/newest/.style= {/pgfplots/compat/labels/1.3},% + /pgfplots/compat/labels/default/.style= {/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility for labels :-( /pgfplots/compat/.style={% /pgfplots/compat/anchors=#1,% /pgfplots/compat/labels=#1,% @@ -2812,19 +2981,26 @@ \pgfprofilenewforcommand[pgfplotsapplistXX handling]{\pgfplotsapplistXXpushback}{1}% \pgfprofilenewforcommand[pgfplotsapplistXX handling]{\pgfplotsapplistXXflushbuffers}{0}% \pgfprofilenewforcommandpattern - [pgfplots(app|prepent)listX handling]{\pgfplotsapplistXpushback}{##1\to##2}{{##1}\to{##2}}% + [pgfplots(app|prepend)listX handling]{\pgfplotsapplistXpushback}{##1\to##2}{{##1}\to{##2}}% \pgfprofilenewforcommand - [pgfplots(app|prepent)listX handling]{\pgfplotsapplistXflushbuffers}{1}% + [pgfplots(app|prepend)listX handling]{\pgfplotsapplistXflushbuffers}{1}% \pgfprofilenewforcommandpattern - [pgfplots(app|prepent)listX handling]{\pgfplotsprependlistXpushfront}{##1\to##2}{{##1}\to{##2}}% + [pgfplots(app|prepend)listX handling]{\pgfplotsprependlistXpushfront}{##1\to##2}{{##1}\to{##2}}% \pgfprofilenewforcommand [pgfplots(app|prepend)listX handling]{\pgfplotsprependlistXflushbuffers}{1}% + \pgfprofilenewforcommand + [pgfsys buffer]{\pgfsyssoftpath@addtocurrentpath}{1}% + \pgfprofilenewforcommand + [pgfsys buffer]{\pgfsyssoftpath@flushcurrentpath}{0}% \pgfprofilenewforcommand[math parser (basic)]{\pgfmathparse}{1}% \pgfprofilenewforcommand[math parser (fpu)]{\pgfmathfloatparse@}{1}% \pgfprofilenewforcommand[math: division (basic)]{\pgfmathdivide@}{2}% \pgfprofilenewforcommand[math: division (basic)]{\pgfmath@basic@divide@}{2}% \pgfprofilenewforcommand[near ticklabel anchors]{\pgfplots@borderanchor@for@axis}{3}% \pgfprofilenewforcommand[ticklabel cs]{\pgfplotspointticklabelcs}{2}% + % \pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodeunsigned}{1}% + % \pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodesignedmaplinearly}{1}% + % \pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodedimenmaplinearly}{1}% },% } @@ -2841,11 +3017,15 @@ \pgfkeysdef{/pgfplots/empty command key}{}% \pgfkeysgetvalue{/pgfplots/empty command key/.@cmd}\pgfplots@loc@TMPa \global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa + +\pgfkeys{/empty/.style={}}% +\pgfkeysgetvalue{/empty/.@cmd}\pgfplots@loc@TMPa +\global\let\pgfplots@empty@style@key=\pgfplots@loc@TMPa } % Only define if it is undefined. It may be possible that related libraries % habe been loaded before pgfplots. -\pgfkeysifdefined{/pgfplots/@backgroundpath@hook}{\relax}{% +\pgfkeysifdefined{/pgfplots/@backgroundpath@hook/.@cmd}{\relax}{% \pgfkeysdef{/pgfplots/@backgroundpath@hook}{}% } @@ -3146,6 +3326,18 @@ \begingroup \let#1=\pgfutil@empty \pgfkeysgetvalue{/pgfplots/cycle multi list/@dim}\pgfplots@cycle@dim + % + \let\pgfplots@listindex=\pgfplots@numplots + \pgfkeysgetvalue{/pgfplots/cycle list shift}\pgfplots@listindex@shift + \ifx\pgfplots@listindex@shift\pgfutil@empty + \else + \c@pgf@counta=\pgfplots@listindex\relax + \advance\c@pgf@counta by\pgfplots@listindex@shift\relax + \ifnum\c@pgf@counta<0 + \c@pgf@counta=-\c@pgf@counta + \fi + \edef\pgfplots@listindex{\the\c@pgf@counta}% + \fi \ifnum\pgfplots@cycle@dim>0 % use the 'cycle multi list' feature. % @@ -3160,8 +3352,8 @@ % } % to get the different indices into the cycle lists. %-------------------------------------------------- - \c@pgf@counta=\pgfplots@cycle@dim - \c@pgf@countb=\pgfplots@numplots\relax + \c@pgf@counta=\pgfplots@cycle@dim\relax + \c@pgf@countb=\pgfplots@listindex\relax \advance\c@pgf@counta by-1 \pgfplotsloop{% \ifnum\c@pgf@counta<0 @@ -3187,7 +3379,7 @@ \else % normal cycle list: \pgfplotslistsize\autoplotspeclist\to\c@pgf@countd - \pgfplots@getautoplotspec@{\autoplotspeclist}{\c@pgf@countd}{\pgfplots@numplots}% + \pgfplots@getautoplotspec@{\autoplotspeclist}{\c@pgf@countd}{\pgfplots@listindex}% \let#1=\pgfplotsretval \fi \pgfmath@smuggleone#1% @@ -3217,6 +3409,9 @@ \long\def\pgfplots@replacement@for@tikz@path#1;{% \axispath\path#1;% } +\def\pgfplots@replacement@for@scope{\pgfutil@ifnextchar[{\pgfplots@replacement@for@scope@}{\pgfplots@replacement@for@scope@[]}}% +\def\pgfplots@replacement@for@scope@[#1]{\pgfplotsextra{\scope[#1]}}% +\def\pgfplots@replacement@for@endscope{\pgfplotsextra\endscope}% { % A block which handles active semicolons. @@ -3346,6 +3541,98 @@ \endgroup } +\def\pgfplots@transposelegend{% + \ifnum\pgfplots@legend@columns>1 + \begingroup + \pgfplots@transposelegend@ + \let\pgfplots@legend@columns=\c@pgfplots@row@end + \pgfmath@smuggleone\pgfplots@legend@columns + \endgroup + \fi +} +\def\pgfplots@transposelegend@{% + \let\c@pgfplots@row=\c@pgf@countb + \let\c@pgfplots@col=\c@pgf@countc + \let\c@pgfplots@no=\c@pgf@countd + \c@pgfplots@row=0 + \c@pgfplots@col=0 + \c@pgfplots@no=0 + \pgfplotslistforeachungrouped\pgfplots@legend\as\entry{% + \expandafter\let\csname m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname=\entry + \advance\c@pgfplots@col by1 + \ifnum\pgfplots@legend@columns=\c@pgfplots@col\relax + \c@pgfplots@col=0 + \advance\c@pgfplots@row by1 + \fi + \advance\c@pgfplots@no by1 + }% + \ifnum\c@pgfplots@col=0 + \else + \advance\c@pgfplots@row by1 + \fi + \edef\c@pgfplots@row@end{\the\c@pgfplots@row}% + \edef\c@pgfplots@no@leg{\the\c@pgfplots@no}% + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \c@pgfplots@row=0 + \c@pgfplots@col=0 + \c@pgfplots@no=0 + \pgfplotslistforeachungrouped\pgfplots@plotspeclist\as\entry{% + \expandafter\let\csname m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname=\entry + \advance\c@pgfplots@col by1 + \ifnum\pgfplots@legend@columns=\c@pgfplots@col\relax + \c@pgfplots@col=0 + \advance\c@pgfplots@row by1 + \fi + \advance\c@pgfplots@no by1 + }% + \ifnum\c@pgfplots@col=0 + \else + \advance\c@pgfplots@row by1 + \fi + \ifnum\c@pgfplots@row<\c@pgfplots@row@end + \edef\c@pgfplots@row@end{\the\c@pgfplots@row}% + \fi + \ifnum\c@pgfplots@no<\c@pgfplots@no@leg + \edef\c@pgfplots@no@leg{\the\c@pgfplots@no}% + \fi + % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \c@pgfplots@col=0 + \global\pgfplotslistnewempty\pgfplots@legend% + \global\pgfplotslistnewempty\pgfplots@plotspeclist% + \pgfplotsloop{% + \ifnum\pgfplots@legend@columns=\c@pgfplots@col + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + }{% + \c@pgfplots@row=0 + \pgfplotsloop{% + \ifnum\c@pgfplots@row@end=\c@pgfplots@row + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + }{% + \pgfutil@ifundefined{m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col}{% + }{% + \pgfutil@ifundefined{m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col}{% + }{% + \expandafter\let\expandafter\pgfplots@legendtmp\csname m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@legendtmp}\to\pgfplots@legend% + % + \expandafter\let\expandafter\pgfplots@legendtmp\csname m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@legendtmp}\to\pgfplots@plotspeclist% + }% + }% + \advance\c@pgfplots@row by1 + }% + \advance\c@pgfplots@col by1 + }% +}% + \def\pgfplots@addlegendentryexpanded{% \pgfutil@ifnextchar[{% @@ -3368,6 +3655,7 @@ \pgfplots@rememberplotspec[#1]{/pgfplots/every axis plot,#2,/pgfplots/.cd,/pgfplots/every axis plot post}% }% +% This implements \addlegendentry \def\pgfplots@addlegendentry{% \pgfutil@ifnextchar[{% \pgfplots@addlegendentry@opts @@ -3409,7 +3697,9 @@ \fi } -\long\def\pgfplots@show@small@legendplots#1#2{ +% #1: DEPRECATED. Unused. +% #2: plot style +\long\def\pgfplots@show@small@legendplots#1#2{% \begingroup \pgfplots@define@currentplotstyle@as{#1,#2}% \scope[/tikz/current plot style,/pgfplots/every legend image post]% this scoping construction allows plot styles to change 'legend image code'. @@ -3439,6 +3729,7 @@ % or it creates a legend, stores the commands into the macro named % above and typesets it. \def\pgfplots@createlegend{% + \pgfkeysgetvalue{/pgfplots/legend to name}\pgfplots@createlegend@toname \ifx\pgfplots@already@computed@legend@node\pgfutil@empty \pgfplotslistcheckempty\pgfplots@legend \ifpgfplotslistempty @@ -3453,9 +3744,27 @@ \ifpgfplots@reverse@legend \pgfplots@reverselegend \fi + \ifpgfplots@transpose@legend + \pgfplots@transposelegend + \fi % % \begingroup + \ifx\pgfplots@createlegend@toname\pgfutil@empty + % ok, draw legend. + \def\pgfplots@createlegend@prepareimage@to##1{% + \t@pgfplots@tokc=\expandafter{\pgfplots@curplotlist}% + \edef##1{\noexpand\pgfplots@show@small@legendplots{}{\the\t@pgfplots@tokc}}% + }% + \else + % export legend instead of drawing it. + \def\pgfplots@createlegend@prepareimage@to##1{% + \t@pgfplots@tokc=\expandafter{\pgfplots@curplotlist}% + \edef\pgfplots@loc@TMPa{\noexpand\pgfplots@export@legend@image@to@macro{\the\t@pgfplots@tokc}{}}% + \pgfplots@loc@TMPa + \let##1=\pgfplotsretval + }% + \fi % assemble a % \matrix { % small plot & legend1\\ @@ -3498,30 +3807,49 @@ \else \advance\curcolumnNum by1 \begingroup + % \pgfplots@curlegend@opts are any options for + % this single legend text, provided as + % \addlegendentry[<options>]{<text>} + % or + % legend entries={...,[<options>]<text>, ....} \expandafter\pgfplots@split@opts\pgfplots@curlegend\pgfplots@result@to{\pgfplots@curlegend}{\pgfplots@curlegend@opts}% + \pgfplots@createlegend@prepareimage@to{\pgfplotsretval}% + % + \t@pgfplots@tokb=\expandafter{\pgfplots@curlegend@opts}% + \t@pgfplots@tokc=\expandafter{\pgfplots@curlegend}% + % + % prepare the \node[<options>] {<text>} into \t@pgfplots@tokc + \edef\pgfplots@loc@TMPa{\noexpand\node[\the\t@pgfplots@tokb]{\the\t@pgfplots@tokc};}% + \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% + % + % and the legend image into \t@pgfplots@tokb: + \t@pgfplots@tokb=\expandafter{\pgfplotsretval}% + % ok. Now, the + % - 'b' register contains the IMAGE and + % - 'c' register contains the TEXT \ifcase\legendplotpos % legend plot pos=left - \t@pgfplots@tokb=\expandafter{% - \expandafter\pgfplots@show@small@legendplots - \expandafter{\pgfplots@curlegend@opts}}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curplotlist}% - \pgfmatrixnextcell\node}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{% - \expandafter\the\expandafter\t@pgfplots@tokb - \expandafter{\pgfplots@curlegend};}% + \edef\pgfplots@matrixentry{% + \the\t@pgfplots@tokb + \noexpand\pgfmatrixnextcell + \the\t@pgfplots@tokc% + }% \or % legend plot pos=right - \t@pgfplots@tokb=\expandafter{% - \expandafter\node - \expandafter{\pgfplots@curlegend};% - \pgfmatrixnextcell - \pgfplots@show@small@legendplots}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curlegend@opts}}% - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\t@pgfplots@tokb\expandafter{\pgfplots@curplotlist}}% + \edef\pgfplots@matrixentry{% + \the\t@pgfplots@tokc% + \noexpand\pgfmatrixnextcell + \the\t@pgfplots@tokb + }% \or % legend plot pos=none - \t@pgfplots@tokb=\expandafter{\expandafter\node\expandafter{\pgfplots@curlegend};}% + \edef\pgfplots@matrixentry{% + \the\t@pgfplots@tokc% + }% \fi + % copy it back to 'b' register: + \t@pgfplots@tokb=\expandafter{\pgfplots@matrixentry}% + % \ifnum\curcolumnNum=\maxcolumnCount \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else @@ -3554,6 +3882,7 @@ \t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}% \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\plotnum{0}% + \noexpand\def\noexpand\plotnumofactualtype{0}% \the\t@pgfplots@tokb {% \the\t@pgfplots@toka };% @@ -3562,10 +3891,107 @@ \let\pgfplots@already@computed@legend@node=\pgfplots@glob@TMPa \fi \fi -%\pgfplots@message{Vor legende: \meaning\pgfplots@already@computed@legend@node}% - \pgfplots@already@computed@legend@node +%\pgfplots@message{Vor legende: \meaning\pgfplots@already@computed@legend@node^^J}% + \ifx\pgfplots@createlegend@toname\pgfutil@empty + % DRAW: + \pgfplots@already@computed@legend@node + \else + % apply the 'legend to name' feature: + % + % store legend contents: + % + \t@pgfplots@toka=\expandafter{\pgfplots@already@computed@legend@node}% + \pgfkeysgetvalue{/pgfplots/every axis legend/.@cmd}\pgfplots@loc@TMPa + \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa\pgfeov}% + % + \pgfplots@assemble@ref@picture + {\pgfplots@legend@to@name} + {\tikz[/pgfplots/every legend to name picture/.try]{\pgfplots@legend@to@name}}% + \t@pgfplots@tokc=\expandafter{\pgfplotsretval}% + % + \expandafter\xdef\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname{% + \noexpand\begingroup + \noexpand\def\noexpand\pgfplots@legend@to@name{% + \noexpand\pgfkeysdef{/pgfplots/every axis legend}{\the\t@pgfplots@tokb}% + \noexpand\def\noexpand\numplots{\numplots}% + \the\t@pgfplots@toka + }% + \the\t@pgfplots@tokc + \noexpand\endgroup + }% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname}% + \pgfplots@auxwrite{% + \noexpand\expandafter + \noexpand\gdef + \noexpand\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\noexpand\endcsname% + {\the\t@pgfplots@toka}% + }% + \begingroup + % + % make sure \ref{<legendname>} works: + \pgfplots@label{\pgfplots@createlegend@toname}{pgfplots@legend@to@name@}% + \endgroup + \fi } +% Defines a new \label{#1}. When \ref{#1} is used, the code +% \csname #2#1\endcsname +% will be invoked. +\def\pgfplots@label#1#2{% + \begingroup + \edef\@currentlabel{% + \string\expandafter + \string\protect + \string\csname\space #2#1\string\endcsname + }% + \pgfutil@ifundefined{hyper@makecurrent}{}{% + \hyper@makecurrent{pgfplotslink}% + \hyper@anchorstart{\@currentHref}{}\hyper@anchorend + \pgfplotsutil@advancestringcounter@global\c@pgfplots@label + }% + \expandafter\label\expandafter{#1}% + \endgroup +}% +\gdef\c@pgfplots@label{0}% +\def\theHpgfplotslink{\theHsection.\c@pgfplots@label}% + +% this is deprecated. Use \ref{#1} instead. +\def\pgfplotslegendfromname#1{% + \pgfplots@texdist@protect\pgfplotslegendfromname@{#1}% +}% +\def\pgfplotslegendfromname@#1{% + \pgfutil@ifundefined{pgfplots@legend@to@name@#1}{% + \pgfutil@ifundefined{ref}{% + \pgfplots@warning{There is no `legend to name=#1', sorry. I am skipping it}% + \string\pgfplotslegendfromname{#1}: ??% + }{% + \ref{\string\pgfplotslegendfromname{#1}}% + }% + }{% + \csname pgfplots@legend@to@name@#1\endcsname + }% +}% +% this is deprecated. Use \ref{#1} instead. +\def\pgfplotscolorbarfromname#1{% + \pgfplots@texdist@protect\pgfplotscolorbarfromname@{#1}% +}% +\def\pgfplotscolorbarfromname@#1{% + \pgfutil@ifundefined{pgfplots@colorbar@to@name@#1}{% + \pgfutil@ifundefined{ref}{% + \pgfplots@warning{There is no `colorbar to name=#1', sorry. I am skipping it}% + \string\pgfplotscolorbarfromname{#1}: ??% + }{% + \ref{\string\pgfplotscolorbarfromname{#1}}% + }% + }{% + \csname pgfplots@colorbar@to@name@#1\endcsname + }% +}% + +\def\pgfplots@ifintikzpicture#1#2{% + \pgfutil@ifundefined{filldraw}{#2}{#1}% +}% + % DEPRECATED. \def\skipsuffixzero#1.#2|{ {% @@ -3680,8 +4106,12 @@ \if1\bool@pgfplots@loc@enlargeany \pgfplots@enlarge@limit@for{#1}% \fi + \global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany % assignments are made globally. \endgroup + \if1\pgfplots@glob@TMPa + \pgfplots@visphase@notify@changeofcanvaslimits{#1}% + \fi } % Helper method inside of \pgfplots@enlarge@limit@ifconfigured. @@ -4127,7 +4557,7 @@ % \let\pgfplots@ymax=\pgfmathresult % \fi %-------------------------------------------------- -%\message{x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax]}% +%\message{untransformed: x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax]. }% % % \pgfplots@set@default@size@options @@ -4144,6 +4574,7 @@ \pgfplots@check@and@apply@datatrafo@for z% \fi \pgfplots@datascaletrafo@initialisedtrue +%\message{transformed: x = [\pgfplots@xmin:\pgfplots@xmax] y = [\pgfplots@ymin:\pgfplots@ymax].}% % % From now on, we can always work with pgfmath. % We simply need to apply the data scaling trafo before doing so. @@ -4212,6 +4643,18 @@ \pgfplots@xminorgridsfalse \fi % + \if0\pgfplots@xaxislinesnum\else + % axis x line* != box + \let\pgfplots@xticklabel@pos=\pgfutil@empty + \fi + \if0\pgfplots@yaxislinesnum\else + % axis y line* != box + \let\pgfplots@yticklabel@pos=\pgfutil@empty + \fi + \if0\pgfplots@zaxislinesnum\else + % axis y line* != box + \let\pgfplots@zticklabel@pos=\pgfutil@empty + \fi % \ifx\pgfplots@xticklabel@pos\pgfutil@empty \def\pgfplots@xticklabel@pos{% @@ -4960,17 +5403,24 @@ %\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [+- \pgfplots@glob@TMPb]}% % % Update auxiliary data members: - \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % - \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % - \pgfplots@if{pgfplots@apply@datatrafo@#1}{% - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% - \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% - \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult - }{}% + \pgfplots@visphase@notify@changeofcanvaslimits{#1}% \fi } +% should be invoked whenever \pgfplots@#1min or \pgfplots@#1max have +% been changed during the visualization phase (for example, axis equal +% or enlargelimits) +\def\pgfplots@visphase@notify@changeofcanvaslimits#1{% + \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % + \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult + }{}% +}% + % Invokes #3 if % ( 10^{s1} * veclen1 < 10^{s2} * veclen2 ) % <=> @@ -5046,41 +5496,7 @@ % 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\pgfplots@initsizes@axisdiag@x\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\pgfplots@initsizes@axisdiag@y\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 ) % - \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% - \edef\pgfplots@tmpXscale{\the\pgf@x}% - \edef\pgfplots@tmpYscale{\the\pgf@y}% \pgfkeysgetvalue{/pgfplots/view/az}{\pgfplots@view@az}% \pgfkeysgetvalue{/pgfplots/view/el}{\pgfplots@view@el}% \ifpgfplots@threedim @@ -5095,11 +5511,45 @@ \def\pgfplots@view@dir@threedim@z{1}% \fi \ifx\pgfplots@view@az\pgfutil@empty - % FIXME : this does NOT work! it doesn't prepare the view@dir@threedim properly! + %\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\pgfplots@initsizes@axisdiag@x\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\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale + %\ifpgfplots@scale@only@axis + % \let\pgfplots@rectangle@height=\pgfplots@height + %\fi + \else + \def\pgfplots@tmpYscale{1}% + \fi + % + \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% + \edef\pgfplots@tmpXscale{\the\pgf@x}% + \edef\pgfplots@tmpYscale{\the\pgf@y}% + % \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}% \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}% \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}% \else + % 3D case is currently always initialised by `view': + \let\pgfplots@x=\pgfutil@empty + \let\pgfplots@y=\pgfutil@empty + \let\pgfplots@z=\pgfutil@empty \pgfplotssetaxesfromazel{\pgfplots@view@az}{\pgfplots@view@el}{\pgfplots@tmp@xisaxisparallel}% \if1\pgfplots@tmp@xisaxisparallel% \def\pgfplots@tmp@yisaxisparallel{1}% @@ -5160,7 +5610,7 @@ \def\pgfplotspointminmaxmin{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% \fi - \xdef\pgfplotspointminminmin{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointminminmin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% % ATTENTION: I re-use registers here! Make sure they won't be % overwritten! \pgfpointdiff and \pgfplotsqpointxy are ok in this respect. \let\pgfplots@xcoordminTEX=\pgf@xb @@ -5195,14 +5645,14 @@ \pgfpointdiff {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} {\pgfplotspointmaxminmin}% - \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointxaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfmathveclen{\pgf@x}{\pgf@y}% \xdef\pgfplotspointxaxislength{\pgfmathresult pt}% % \pgfpointdiff {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} {\pgfplotspointminmaxmin}% - \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointyaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfmathveclen{\pgf@x}{\pgf@y}% \xdef\pgfplotspointyaxislength{\pgfmathresult pt}% % @@ -5210,7 +5660,7 @@ \pgfpointdiff {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} {\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}% - \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointzaxis{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfmathveclen{\pgf@x}{\pgf@y}% \xdef\pgfplotspointzaxislength{\pgfmathresult pt}% % @@ -5225,10 +5675,10 @@ \pgfplotspointzaxis% \advance\pgf@xa by\pgf@x \advance\pgf@xb by\pgf@y - \pgf@x=\pgf@xa - \pgf@y=\pgf@xb + \global\pgf@x=\pgf@xa + \global\pgf@y=\pgf@xb }% - \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointcenter{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \else \global\let\pgfplotspointzaxis=\pgfpointorigin \gdef\pgfplotspointzaxislength{0pt}% @@ -5238,7 +5688,7 @@ \pgfplotspointxaxis% \pgfplotspointyaxis% }% - \xdef\pgfplotspointcenter{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \xdef\pgfplotspointcenter{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \fi \endgroup } @@ -5311,8 +5761,8 @@ \pgfdeclareshape{pgfplots@low@level@shape}{% % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ - \pgf@x=\wd\pgfnodepartimagebox - \pgf@y=\ht\pgfnodepartimagebox + \global\pgf@x=\wd\pgfnodepartimagebox + \global\pgf@y=\ht\pgfnodepartimagebox }% \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% @@ -5324,8 +5774,8 @@ % \nodeparts{image}% \anchor{image}{% - \pgf@x=0pt % - \pgf@y=0pt % + \global\pgf@x=0pt % + \global\pgf@y=0pt % }% % % @@ -5339,7 +5789,7 @@ \anchor{north}{% \pgfpointadd {\lowerleftinnercorner} - {\innerdiagonal\divide\pgf@x by2 }% + {\innerdiagonal\global\divide\pgf@x by2 }% }% \anchor{north east}{% \pgfpointadd @@ -5349,28 +5799,28 @@ \anchor{east}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@y by2 }% + {\innerdiagonal\global\divide\pgf@y by2 }% }% \anchor{south east}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@y=0sp }% + {\innerdiagonal\global\pgf@y=0sp }% }% \anchor{south}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@x by2 \pgf@y=0sp }% + {\innerdiagonal\global\divide\pgf@x by2 \global\pgf@y=0sp }% }% \anchor{south west}{\lowerleftinnercorner}% \anchor{west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp \divide\pgf@y by2 }% + {\innerdiagonal\global\pgf@x=0sp \global\divide\pgf@y by2 }% } \anchor{north west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp }% + {\innerdiagonal\global\pgf@x=0sp }% }% %% \anchor{origin}{% @@ -5379,69 +5829,69 @@ \anchor{above origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\pgf@x=0sp }} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@x=0sp }} + {\pgfpointadd{\origin}{\innerdiagonal\global\pgf@x=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@x=0sp }} {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}% }% \anchor{left of origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\multiply\pgf@x by-1 \pgf@y=0sp }} + {\pgfpointadd{\origin}{\innerdiagonal\global\multiply\pgf@x by-1 \global\pgf@y=0sp }} {\lowerleftinnercorner} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@x=0sp }}% + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@x=0sp }}% }% \anchor{right of origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\pgf@y=0sp }} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@y=0sp }} + {\pgfpointadd{\origin}{\innerdiagonal\global\pgf@y=0sp }} + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@y=0sp }} {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}% }% \anchor{below origin}{% \pgfpointintersectionoflines {\origin} - {\pgfpointadd{\origin}{\innerdiagonal\pgf@x=0sp \multiply\pgf@y by-1 }} + {\pgfpointadd{\origin}{\innerdiagonal\global\pgf@x=0sp \global\multiply\pgf@y by-1 }} {\lowerleftinnercorner} - {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\pgf@y=0sp }}% + {\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@y=0sp }}% }% % %% % \anchor{outer north}{% \upperrightcorner - \pgf@x=.5\pgf@x + \global\pgf@x=.5\pgf@x }% \anchor{outer north east}{\upperrightcorner}% \anchor{outer east}{% \upperrightcorner - \pgf@y=.5\pgf@y + \global\pgf@y=.5\pgf@y }% \anchor{outer south east}{% \upperrightcorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{outer south}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=0pt + \global\pgf@x=.5\pgf@x + \global\pgf@y=0pt }% \anchor{outer south west}{% - \pgf@x=0pt - \pgf@y=0pt + \global\pgf@x=0pt + \global\pgf@y=0pt }% \anchor{outer west}{% \upperrightcorner - \pgf@x=0pt - \pgf@y=.5\pgf@y + \global\pgf@x=0pt + \global\pgf@y=.5\pgf@y }% \anchor{outer north west}{% \upperrightcorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{outer center}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=.5\pgf@y + \global\pgf@x=.5\pgf@x + \global\pgf@y=.5\pgf@y }% % % @@ -5453,7 +5903,7 @@ \pgfpointadd {\lowerleftinnercorner} {\innerdiagonal\divide\pgf@x by2 }% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner @@ -5461,7 +5911,7 @@ \pgfpointadd \lowerleftinnercorner \innerdiagonal - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner @@ -5469,63 +5919,63 @@ \pgfpointadd \lowerleftinnercorner \innerdiagonal - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner \pgfutil@tempdima=\pgf@x \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@y by2 }% - \pgf@x=\pgfutil@tempdima + {\innerdiagonal\global\divide\pgf@y by2 }% + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner \pgfutil@tempdima=\pgf@x \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@y=0sp }% - \pgf@x=\pgfutil@tempdima + {\innerdiagonal\global\pgf@y=0sp }% + \global\pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@y=0sp }% - \pgf@y=0pt + {\innerdiagonal\global\pgf@y=0sp }% + \global\pgf@y=0pt }% \anchor{below south}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\divide\pgf@x by2 \pgf@y=0sp }% + {\innerdiagonal\global\divide\pgf@x by2 \global\pgf@y=0sp }% \pgf@y=0pt }% \anchor{below south west}{% \lowerleftinnercorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{left of south west}{% \lowerleftinnercorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{left of west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp \divide\pgf@y by2 }% - \pgf@x=0pt + {\innerdiagonal\global\pgf@x=0sp \global\divide\pgf@y by2 }% + \global\pgf@x=0pt }% \anchor{left of north west}{% \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp }% - \pgf@x=0pt + {\innerdiagonal\global\pgf@x=0sp }% + \global\pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner \pgfutil@tempdima=\pgf@y \pgfpointadd \lowerleftinnercorner - {\innerdiagonal\pgf@x=0sp }% - \pgf@y=\pgfutil@tempdima + {\innerdiagonal\global\pgf@x=0sp }% + \global\pgf@y=\pgfutil@tempdima }% %% %% @@ -5559,8 +6009,8 @@ \pgfdeclareshape{pgfplots@low@level@shape@deprecated}{% % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ - \pgf@x=\wd\pgfnodepartimagebox - \pgf@y=\ht\pgfnodepartimagebox + \global\pgf@x=\wd\pgfnodepartimagebox + \global\pgf@y=\ht\pgfnodepartimagebox }% \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% @@ -5573,8 +6023,8 @@ % \nodeparts{image}% \anchor{image}{% - \pgf@x=0pt % - \pgf@y=0pt % + \global\pgf@x=0pt % + \global\pgf@y=0pt % }% % % @@ -5656,39 +6106,39 @@ % \anchor{outer north}{% \upperrightcorner - \pgf@x=.5\pgf@x + \global\pgf@x=.5\pgf@x }% \anchor{outer north east}{\upperrightcorner}% \anchor{outer east}{% \upperrightcorner - \pgf@y=.5\pgf@y + \global\pgf@y=.5\pgf@y }% \anchor{outer south east}{% \upperrightcorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{outer south}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=0pt + \global\pgf@x=.5\pgf@x + \global\pgf@y=0pt }% \anchor{outer south west}{% - \pgf@x=0pt - \pgf@y=0pt + \global\pgf@x=0pt + \global\pgf@y=0pt }% \anchor{outer west}{% \upperrightcorner - \pgf@x=0pt - \pgf@y=.5\pgf@y + \global\pgf@x=0pt + \global\pgf@y=.5\pgf@y }% \anchor{outer north west}{% \upperrightcorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{outer center}{% \upperrightcorner - \pgf@x=.5\pgf@x - \pgf@y=.5\pgf@y + \global\pgf@x=.5\pgf@x + \global\pgf@y=.5\pgf@y }% % % @@ -5700,7 +6150,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner @@ -5708,7 +6158,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\yaxisvec}{\xaxisvec}}% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner @@ -5716,7 +6166,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\yaxisvec}{\xaxisvec}}% - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner @@ -5724,7 +6174,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner @@ -5732,39 +6182,39 @@ \pgfpointadd {\lowerleftinnercorner}% {\xaxisvec}% - \pgf@x=\pgfutil@tempdima + \global\pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% \pgfpointadd {\lowerleftinnercorner}% {\xaxisvec}% - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{below south}{% \pgfpointadd {\lowerleftinnercorner}% {\pgfpointscale{0.5}{\xaxisvec}}% - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{below south west}{% \lowerleftinnercorner - \pgf@y=0pt + \global\pgf@y=0pt }% \anchor{left of south west}{% \lowerleftinnercorner - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{left of west}{% \pgfpointadd {\lowerleftinnercorner}% {\pgfpointscale{0.5}{\yaxisvec}}% - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{left of north west}{% \pgfpointadd {\lowerleftinnercorner}% {\yaxisvec}% - \pgf@x=0pt + \global\pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner @@ -5772,7 +6222,7 @@ \pgfpointadd {\lowerleftinnercorner}% {\yaxisvec}% - \pgf@y=\pgfutil@tempdima + \global\pgf@y=\pgfutil@tempdima }% %% %% @@ -6480,11 +6930,15 @@ % set baseline for sub-picture to default value. % the baseline option will be applied to the OUTER picture. \pgfsetbaseline{\pgf@picminy}% + \pgfutil@ifundefined{pgfsettrimleft}{}{% + \pgfsettrimleft{\pgf@picminx}% + \pgfsettrimright{\pgf@picmaxx}% + }% \begingroup \pgfgettransformentries\aa\ab\ba\bb\pgfplots@loc@TMPa\pgfplots@loc@TMPb \xdef\pgfplots@savedtransformshift{% - \pgf@x=\pgfplots@loc@TMPa\space - \pgf@y=\pgfplots@loc@TMPb\space + \global\pgf@x=\pgfplots@loc@TMPa\space + \global\pgf@y=\pgfplots@loc@TMPb\space }% \xdef\pgfplots@glob@TMPa{{\aa}{\ab}{\ba}{\bb}}% \endgroup @@ -6736,13 +7190,13 @@ \else \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% - \edef\pgfplots@loc@TMPa{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPa{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}% - \edef\pgfplots@loc@TMPb{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPb{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% - \edef\pgfplots@loc@TMPc{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPc{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}% - \edef\pgfplots@loc@TMPd{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@TMPd{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \begingroup \toks0=\expandafter{\pgfplots@loc@TMPa}% \toks1=\expandafter{\pgfplots@loc@TMPb}% @@ -6798,8 +7252,8 @@ \expandafter\pgfplotspointbbdiagonal@\pgfplotspoint@bb@@@ }% \let\pgfplotspoint@bb@@@=\relax -\def\pgfplotspointbblowerleft@#1#2#3#4{\pgf@x=#1 \pgf@y=#2 }% -\def\pgfplotspointbbdiagonal@#1#2#3#4{\pgf@x=#3 \pgf@y=#4 }% +\def\pgfplotspointbblowerleft@#1#2#3#4{\global\pgf@x=#1 \global\pgf@y=#2 }% +\def\pgfplotspointbbdiagonal@#1#2#3#4{\global\pgf@x=#3 \global\pgf@y=#4 }% % #1: a complete \pgfusepath command what to do with the clip path. \def\pgfplots@clippath@install#1{% @@ -7318,55 +7772,59 @@ % \pgfplots@change@pgfpoints@to@descriptioncs % - \ifpgfplots@hide@x - \else - \ifpgfplots@units@use% - \pgfplots@show@label{x}{\pgfplots@label@units{x}}% - \else% - \pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty - \else - \pgfplots@show@label{x}{\pgfplots@label@}% - \fi - \fi - \fi - \ifpgfplots@hide@y - \else - \ifpgfplots@units@use% - \pgfplots@show@label{y}{\pgfplots@label@units{y}}% - \else% - \pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty - \else - \pgfplots@show@label{y}{\pgfplots@label@}% - \fi - \fi - \fi - \ifpgfplots@threedim - \ifpgfplots@hide@z - \else - \ifpgfplots@units@use% - \pgfplots@show@label{z}{\pgfplots@label@units{z}}% - \else% - \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% - \ifx\pgfplots@label@\pgfutil@empty - \else - \pgfplots@show@label{z}{\pgfplots@label@}% - \fi - \fi - \fi - \fi - % - \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa - \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfplots@create@axis@descriptions@ + \endgroup +} + +\def\pgfplots@create@axis@descriptions@{% + \ifpgfplots@hide@x + \else + \ifpgfplots@units@use% + \pgfplots@show@label{x}{\pgfplots@label@units{x}}% + \else% + \pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{x}{\pgfplots@label@}% + \fi + \fi + \fi + \ifpgfplots@hide@y + \else + \ifpgfplots@units@use% + \pgfplots@show@label{y}{\pgfplots@label@units{y}}% + \else% + \pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{y}{\pgfplots@label@}% + \fi + \fi + \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z \else - \expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}% + \ifpgfplots@units@use% + \pgfplots@show@label{z}{\pgfplots@label@units{z}}% + \else% + \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{z}{\pgfplots@label@}% + \fi + \fi \fi - \pgfplots@createlegend - % - \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% - % - \endgroup + \fi + % + \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}% + \fi + \pgfplots@createlegend + % + \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% + % } \def\pgfplots@datascaletrafo@undoshift@x#1{% @@ -7578,6 +8036,38 @@ \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +% Invokes '#1' foreach key which should be saved by a color bar. +% +% The current key name is available as '##1', the macro under which +% the key is / should be saved as '##2'. +\def\pgfplots@colorbar@foreach@saved@key#1{% + \def\pgfplots@colorbar@foreach@saved@key@body##1##2{#1}% + \pgfplotsutilforeachcommasep{% + {/pgfplots/colorbar/draw/.@cmd}\pgfplots@savedstyle@colorbar@draw,% + {/pgfplots/every colorbar/.@cmd}\pgfplots@savedstyle@colorbar,% + {/pgfplots/colorbar shift/.@cmd}\pgfplots@savedstyle@colorbarshift,% + {/pgfplots/colorbar horizontal/lowlevel/.@cmd}\pgfplots@savedstyle@colorbar@horizontal,% + {/pgfplots/colorbar vertical/lowlevel/.@cmd}\pgfplots@savedstyle@colorbar@vertical,% + {/pgfplots/every tick/.@cmd}\pgfplots@savedstyle@tick,% + {/pgfplots/every minor tick/.@cmd}\pgfplots@savedstyle@minortick,% + {/pgfplots/every major tick/.@cmd}\pgfplots@savedstyle@majortick,% + {/pgfplots/every axis grid/.@cmd}\pgfplots@savedstyle@grid,% + {/pgfplots/every minor grid/.@cmd}\pgfplots@savedstyle@minorgrid,% + {/pgfplots/every major grid/.@cmd}\pgfplots@savedstyle@majorgrid,% + {/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel,% + {/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel% + }% + \as\pgfplots@colorbar@foreach@saved@key@@ + {% + \expandafter\pgfplots@colorbar@foreach@saved@key@body\pgfplots@colorbar@foreach@saved@key@@ + }% +}% +\def\pgfplots@colorbar@restore@saved@keys{% + \pgfplots@colorbar@foreach@saved@key{% + \pgfkeyslet{##1}##2% + }% +}% + % Defines '#1' to be a macro which, upon execution, draws the color % bar for the current axis. It also handles any required style % inheritance and option preparation issues. @@ -7592,99 +8082,178 @@ \pgfkeyslet{/pgfplots/parent axis width}{\pgfplots@loc@TMPa}% \pgfkeyslet{/pgfplots/parent axis height}{\pgfplots@loc@TMPb}% % + \pgfkeysgetvalue{/pgfplots/colorbar to name}\pgfplots@colorbar@toname + % \pgfnodealias{parent axis}{current axis}% + % + % FIXME : + % I would really prefer to find a different way to move these + % variables out of the current scope. But expansion leads to + % mistakes with '#' characters ... :-( + \pgfplots@colorbar@foreach@saved@key{% + \pgfkeysgetvalue{##1}\pgfplots@loc@TMPa + \global\let##2=\pgfplots@loc@TMPa + }% + % + \toks1={}% + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \else + \toks1={% + \pgfkeysgetvalue{/pgfplots/at/.@cmd}\pgfplots@at@orig + \pgfkeyslet{/pgfplots/at/orig/.@cmd}\pgfplots@at@orig + % + \pgfkeysgetvalue{/pgfplots/colorbar to name/at/.@cmd}\pgfplots@colorbar@toname@at + \pgfkeyslet{/pgfplots/at/.@cmd}\pgfplots@colorbar@toname@at + }% + \pgfplots@colorbar@foreach@saved@key{% + \pgfplots@command@with@args@to@string##2\pgfplots@loc@TMPa + \pgfplots@auxwrite{% + \noexpand\expandafter + \noexpand\long + \noexpand\expandafter + \noexpand\gdef + \noexpand\csname pgfplots@colorbar@\pgfplots@colorbar@toname @\noexpand\string\noexpand##2\noexpand\endcsname% + \pgfplots@loc@TMPa + }% + \edef\pgfplots@loc@TMPa{% + \the\toks1 + \noexpand\expandafter + \noexpand\let + \noexpand\expandafter + \noexpand##2% + \noexpand\csname pgfplots@colorbar@\pgfplots@colorbar@toname @\noexpand\string\noexpand##2\noexpand\endcsname% + }% + \toks1=\expandafter{\pgfplots@loc@TMPa}% + }% + \fi + % % % we have to do a lot of work to move *some* of the current % settings out of the current TeX group: \pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa \expandafter\pgfplotscolormapserializetomacro\expandafter{\pgfplots@loc@TMPa}{\pgfplots@serializedcolormap}% \toks0=\expandafter{\pgfplots@serializedcolormap}% % - % FIXME : - % I would really prefer to find a different way to move these - % variables out of the current scope. But expansion lead to - % mistakes with '#' characters ... :-( - % I use these no-name globals in the hope they might be used - % in another place as well. - {\globaldefs=1 - \pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@savedstyle@colorbar@draw - \pgfkeysgetvalue{/pgfplots/every colorbar/.@cmd}\pgfplots@savedstyle@colorbar - \pgfkeysgetvalue{/pgfplots/colorbar shift/.@cmd}\pgfplots@savedstyle@colorbarshift - \pgfkeysgetvalue{/pgfplots/every tick/.@cmd}\pgfplots@savedstyle@tick - \pgfkeysgetvalue{/pgfplots/every minor tick/.@cmd}\pgfplots@savedstyle@minortick - \pgfkeysgetvalue{/pgfplots/every major tick/.@cmd}\pgfplots@savedstyle@majortick - \pgfkeysgetvalue{/pgfplots/every axis grid/.@cmd}\pgfplots@savedstyle@grid - \pgfkeysgetvalue{/pgfplots/every minor grid/.@cmd}\pgfplots@savedstyle@minorgrid - \pgfkeysgetvalue{/pgfplots/every major grid/.@cmd}\pgfplots@savedstyle@majorgrid - \pgfkeysgetvalue{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel - \pgfkeysgetvalue{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel - }% + \pgfkeysgetvalue{/pgfplots/colorbar addplot}\pgfplots@loc@TMPa + \toks2=\expandafter{\pgfplots@loc@TMPa}% + % + \ifx\pgfplots@colorbar@src@metamin\pgfutil@empty + \global\let\pgfplots@colorbar@src@metamin=\pgfplots@axiswide@metamin + \global\let\pgfplots@colorbar@src@metamax=\pgfplots@axiswide@metamax + \fi + % + \ifx\pgfplots@colorbar@src@metamax\pgfplots@invalidrange@metamax + \pgfplots@warning{Sorry, the colorbar is uninitialised - your axis has no color data. Consider using 'point meta=f(x)' or something like that. I am using a color range of [0,1] for the colorbar.}% + \pgfmathfloatparsenumber{0}% + \global\let\pgfplots@colorbar@src@metamin=\pgfmathresult + \pgfmathfloatparsenumber{1}% + \global\let\pgfplots@colorbar@src@metamax=\pgfmathresult + \fi + % + % normalize format: + \pgfmathfloattosci\pgfplots@colorbar@src@metamin + \global\let\pgfplots@colorbar@src@metamin=\pgfmathresult + \pgfmathfloattosci\pgfplots@colorbar@src@metamax + \global\let\pgfplots@colorbar@src@metamax=\pgfmathresult + % + \pgfplots@assemble@ref@picture + {\pgfplots@colorbar@draw} + {\tikz[/pgfplots/every colorbar to name picture/.try]{\pgfplots@colorbar@draw}}% + \toks3=\expandafter{\pgfplotsretval}% % \xdef#1{% \noexpand\begingroup - \the\toks0 % restore colormap definition - % restore relevant styles and variables: - \noexpand\pgfkeyslet{/pgfplots/colorbar/draw/.@cmd} {\noexpand\pgfplots@savedstyle@colorbar@draw}% - \noexpand\pgfkeyslet{/pgfplots/colorbar shift/.@cmd} {\noexpand\pgfplots@savedstyle@colorbarshift}% - \noexpand\pgfkeyslet{/pgfplots/every colorbar/.@cmd} {\noexpand\pgfplots@savedstyle@colorbar}% - \noexpand\pgfkeyslet{/pgfplots/every tick/.@cmd} {\noexpand\pgfplots@savedstyle@tick}% - \noexpand\pgfkeyslet{/pgfplots/every minor tick/.@cmd} {\noexpand\pgfplots@savedstyle@minortick}% - \noexpand\pgfkeyslet{/pgfplots/every major tick/.@cmd} {\noexpand\pgfplots@savedstyle@majortick}% - \noexpand\pgfkeyslet{/pgfplots/every axis grid/.@cmd} {\noexpand\pgfplots@savedstyle@grid}% - \noexpand\pgfkeyslet{/pgfplots/every minor grid/.@cmd} {\noexpand\pgfplots@savedstyle@minorgrid}% - \noexpand\pgfkeyslet{/pgfplots/every major grid/.@cmd} {\noexpand\pgfplots@savedstyle@majorgrid}% - \noexpand\pgfkeyslet{/pgfplots/every tick label/.@cmd} {\noexpand\pgfplots@savedstyle@ticklabel}% - \noexpand\pgfkeyssetvalue{/pgfplots/point meta min}{\pgfplots@axiswide@metamin}% - \noexpand\pgfkeyssetvalue{/pgfplots/point meta max}{\pgfplots@axiswide@metamax}% - \noexpand\pgfkeyssetvalue{/pgfplots/colormap name}{\pgfkeysvalueof{/pgfplots/colormap name}}% - \noexpand\pgfkeyssetvalue{/pgfplots/parent axis width}{\pgfkeysvalueof{/pgfplots/parent axis width}}% - \noexpand\pgfkeyssetvalue{/pgfplots/parent axis height}{\pgfkeysvalueof{/pgfplots/parent axis height}}% - \noexpand\pgfkeyssetvalue{/pgfplots/colorbar/width}{\pgfkeysvalueof{/pgfplots/colorbar/width}}% - \noexpand\pgfplots@colorbar@define@hook% - \noexpand\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\noexpand\pgfeov + \noexpand\def\noexpand\pgfplots@colorbar@draw{% + \the\toks0 % restore colormap definition + \noexpand\def\noexpand\pgfplots@colorbar@toname{\pgfplots@colorbar@toname}% + \the\toks1 % definitions for 'colorbar to name' + % + % restore relevant styles and variables: + \noexpand\pgfplots@colorbar@restore@saved@keys + \noexpand\pgfkeyssetvalue{/pgfplots/point meta min}{\pgfplots@colorbar@src@metamin}% + \noexpand\pgfkeyssetvalue{/pgfplots/point meta max}{\pgfplots@colorbar@src@metamax}% + \noexpand\pgfkeyssetvalue{/pgfplots/colormap name}{\pgfkeysvalueof{/pgfplots/colormap name}}% + \noexpand\pgfkeyssetvalue{/pgfplots/parent axis width}{\pgfkeysvalueof{/pgfplots/parent axis width}}% + \noexpand\pgfkeyssetvalue{/pgfplots/parent axis height}{\pgfkeysvalueof{/pgfplots/parent axis height}}% + \noexpand\pgfkeyssetvalue{/pgfplots/colorbar/width}{\pgfkeysvalueof{/pgfplots/colorbar/width}}% + \noexpand\pgfkeyssetvalue{/pgfplots/colorbar addplot}{\the\toks2 }% + \noexpand\pgfkeyssetvalue{/pgfplots/colorbar pos*}{\pgfkeysvalueof{/pgfplots/colorbar pos*}}% + \noexpand\pgfplots@colorbar@define@hook% + \noexpand\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\noexpand\pgfeov + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \noexpand\pgfnodealias{current colorbar axis}{current axis}% + \noexpand\pgfnodealias{current axis}{parent axis}% + \fi + }% + \the\toks3 \noexpand\endgroup - \noexpand\pgfnodealias{current colorbar axis}{current axis}% - \noexpand\pgfnodealias{current axis}{parent axis}% }% + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \else + % finalize the 'colorbar to name' feature + \toks0=\expandafter{#1}% + \pgfplots@auxwrite{% + \noexpand\expandafter + \noexpand\gdef\noexpand\csname pgfplots@colorbar@to@name@\pgfplots@colorbar@toname\endcsname{\the\toks0}}% + \xdef#1{}% NOP. + % + % make sure \ref{<colorbarname>} works: + \pgfplots@label{\pgfplots@colorbar@toname}{pgfplots@colorbar@to@name@}% + \fi +}% +\pgfkeysdef{/pgfplots/colorbar to name/at}{% + % automatically search-and-replace 'parent axis' which + % is not defined for a detached colorbar: + \pgfutil@in@{parent axis}{#1}% + \ifpgfutil@in@ + \pgfplots@invoke@pgfkeyscode{/pgfplots/at/orig/.@cmd}{(0pt,0pt)}% + \else + \pgfplots@invoke@pgfkeyscode{/pgfplots/at/orig/.@cmd}{#1}% + \fi }% \let\pgfplots@colorbar@position@hook\relax \def\pgfplots@colorbar@define@hook{% - \def\pgfplots@colorbar@position@hook{% - % I patch \pgfplots@at... - \let\pgfplots@at@orig=\pgfplots@at - % - % ... and I patch \pgfplotspointdescriptionxy (but only INSIDE - % of \pgfplots@at) ... - \let\pgfplotspointdescriptionxy@orig=\pgfplotspointdescriptionxy - \let\pgfplotsqpointdescriptionxy@orig=\pgfplotsqpointdescriptionxy - \def\pgfplots@colorbar@position@prepare@CS{% - % ... which needs to set up ONLY \pgfplotspoint@bb@@@, - % nothing more. - \pgfpointanchor{parent axis}{south west}% - \edef\pgfplotspoint@bb@@@{% - {\the\pgf@x}% - {\the\pgf@y}% - {\pgfkeysvalueof{/pgfplots/parent axis width}}% - {\pgfkeysvalueof{/pgfplots/parent axis height}}% - }% - }% - % - % Install replacements: - \def\pgfplots@at{% - \begingroup - \def\pgfplotspointdescriptionxy########1########2{% - \pgfplots@colorbar@position@prepare@CS - \pgfplotspointdescriptionxy@orig{########1}{########2}% + \ifx\pgfplots@colorbar@toname\pgfutil@empty + \def\pgfplots@colorbar@position@hook{% + % I patch \pgfplots@at... + \let\pgfplots@at@orig=\pgfplots@at + % + % ... and I patch \pgfplotspointdescriptionxy (but only INSIDE + % of \pgfplots@at) ... + \let\pgfplotspointdescriptionxy@orig=\pgfplotspointdescriptionxy + \let\pgfplotsqpointdescriptionxy@orig=\pgfplotsqpointdescriptionxy + \def\pgfplots@colorbar@position@prepare@CS{% + % ... which needs to set up ONLY \pgfplotspoint@bb@@@, + % nothing more. + \pgfpointanchor{parent axis}{south west}% + \edef\pgfplotspoint@bb@@@{% + {\the\pgf@x}% + {\the\pgf@y}% + {\pgfkeysvalueof{/pgfplots/parent axis width}}% + {\pgfkeysvalueof{/pgfplots/parent axis height}}% + }% }% - \def\pgfplotsqpointdescriptionxy########1########2{% - \pgfplots@colorbar@position@prepare@CS - \pgfplotsqpointdescriptionxy@orig{########1}{########2}% + % + % Install replacements: + \def\pgfplots@at{% + \begingroup + \def\pgfplotspointdescriptionxy########1########2{% + \pgfplots@colorbar@position@prepare@CS + \pgfplotspointdescriptionxy@orig{########1}{########2}% + }% + \def\pgfplotsqpointdescriptionxy########1########2{% + \pgfplots@colorbar@position@prepare@CS + \pgfplotsqpointdescriptionxy@orig{########1}{########2}% + }% + \pgfplots@deprecated@anchorsfalse + \pgfplots@change@pgfpoints@to@descriptioncs + \pgf@process{\pgfplots@at@orig}% + \endgroup }% - \pgfplots@deprecated@anchorsfalse - \pgfplots@change@pgfpoints@to@descriptioncs - \pgf@process{\pgfplots@at@orig}% - \endgroup }% - }% + \else + % nothing to do for colorbar to name: + \let\pgfplots@colorbar@position@hook=\relax + \fi }% % Parses all options in #1 which are known in the currently active families. @@ -7780,6 +8349,68 @@ \pgfkeyslet{/pgfplots/zmax/.@cmd}\pgfplots@cant@set@in@this@context }% +% This here is the main key filter for pgfplots. +% +% It sets keys if +% ( they have an active key family) +% OR +% ( they have /pgfplots/ key prefix ) +% OR +% ( they are a command key which contains \tikz@plot@handler ). +% +% In all other cases, the key filter will postpone the key. +% +% Note that \tikz@plot@handler should be defined before the survey +% phase starts. +\pgfkeysdef{/pgfplots/@@key filter}{% + \if\pgfkeyscasenumber0% + \pgfkeysfiltercontinuefalse + \else + \if\pgfkeyscasenumber3% + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + % it has a family. Check it! + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + % Check if it has /pgfplots/ prefix: + \expandafter\pgfplots@key@filter@isdescendantof\pgfkeyscurrentkey/pgfplots/\pgf@@eov + \fi + \fi +} +\def\pgfplots@key@filter@isdescendantof#1/pgfplots/#2\pgf@@eov{% + \def\pgfkeyspred@TMP{#1}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty + % Ah -- it *has* /pgfplots/ prefix. Use it! + \pgfkeysfiltercontinuetrue + \else + % Hm. Probably a /tikz/ key, but who knows. + \if1\pgfkeyscasenumber + % It is a command key. + % Check if the *body* of the command key contains + % \tikz@plot@handler. + \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}\pgfkeyspred@TMP% + \expandafter\pgfplots@key@filter@isplothandler\pgfkeyspred@TMP 123456789\pgfeov\tikz@plot@handler\pgfplots@EOI + \else + % Ok, it's no command key. Skip it directly. + \pgfkeysfiltercontinuefalse + \fi + \fi +}% +\def\pgfplots@key@filter@isplothandler#1\tikz@plot@handler#2\pgfplots@EOI{% + \def\pgfkeyspred@TMP{#2}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty + % I didn't find '\tikz@plot@handler' in the key's body. Ok. + % key won't be processed. + \pgfkeysfiltercontinuefalse + \else + % Aaah -- it is something like /tikz/ybar! process it. + \pgfkeysfiltercontinuetrue + \fi +}% + \def\pgfplots@set@options#1{% \pgfplots@bb@isactivetrue \pgfplots@curplot@threedimfalse @@ -7815,7 +8446,8 @@ % % Step 2: parse any pgfplots options out of styles. \pgfkeysactivatefamily{/pgfplots/style commands}% - \pgfkeysinstallkeyfilter{/pgf/key filters/active families or descendants of}{/pgfplots} + %\pgfkeysinstallkeyfilter{/pgf/key filters/active families or descendants of}{/pgfplots} + \pgfkeysinstallkeyfilter{/pgfplots/@@key filter}{}% % \pgfkeysactivatefamilies {/pgfplots,/pgfplots/naming commands,/pgfplots/tick,/pgfplots/legend,/pgfplots/scale}%/pgfplots/descriptions,} @@ -7858,9 +8490,11 @@ % % 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 + \global\let\pgfplots@named@child@node@list=\pgfutil@empty + \pgfutil@ifundefined{pgfplots@old@name@impl}{% + \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 @@ -8062,6 +8696,101 @@ \let\pgfplots@already@computed@legend@node=\pgfutil@empty } +% Takes a plot style and exports it to a self-contained drawing +% command which can be used outside of the current context. +% +% This macro is used inside for \label{} / \ref{}; it tries to be +% reasonable smart about restoring relevant flags stored in a pgfplots +% axis. If it forgets something... well, it is not too smart. +% +% #1: the style to export. +% #2: either empty or the fully qualified name of a code key. If #2 is not empty, +% the current value of the code key is remembered. It will be restored +% just before the exported \tikz statement is invoked, and \tikz[#2] +% will be called. The code key should not rely on any arguments (it +% won't be given any) +% +% The exported routine autodetects whether the result is used inside of +% a picture. In that case, the '#2' style will be set inside of a +% scope instead of \tikz[#2]. +% +% Assembles a macro \pgfplotsretval which, upon execution, draws the +% plot style. +% +% As a side effect, it returns the resulting plot style (nothing else) into +% \pgfplotsretvalb +\def\pgfplots@export@legend@image@to@macro#1#2{% + \begingroup + % I'd like to get all options which are INDEPENDENT of + % pgfplots. Idea: expand all /pgfplots-keys and collect + % everything which belongs NOT to /pgfplots. This is the + % completely expanded rest. At least, I hope so and it appears + % to work. + % + % FIXME : this was a good approach before. Now, there ARE + % /pgfplots keys which should be maintained. How shall I do that? + % I can't handle every option separately... !? + \pgfkeysinstallkeyfilter + {/pgf/key filters/and} + {{/pgf/key filters/is descendant of=/pgfplots}% + {/pgf/key filters/defined}}% + \def\pgfplots@label@tikzopts{}% + \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}% + \pgfqkeysfiltered{/tikz}{#1}% + % + \pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}% + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + \toks0=\expandafter{\pgfplots@curlegendcode\pgfeov}% + \toks1=\expandafter{\pgfplots@label@tikzopts}% + \toks3=\expandafter{\pgfplots@basiclevel@plothandler}% + \def\pgfplots@stylekey{#2}% + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \pgfkeysgetvalue{\pgfplots@stylekey/.@cmd}{\pgfplots@stylekey@}% + \toks4=\expandafter{\pgfplots@stylekey@\pgfeov}% + \fi + \edef\pgfplots@loc@TMPa{% + {% + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \noexpand\scope[#2]% + \fi + % + \noexpand\pgfplots@draw@image + % + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \noexpand\endscope% + \fi + }{% + \noexpand\tikz[#2]{% + \noexpand\pgfplots@draw@image + }% + }% + }% + \expandafter\pgfplots@assemble@ref@picture\pgfplots@loc@TMPa + \toks5=\expandafter{\pgfplotsretval}% + % + \edef\pgfplotsretval{% + \noexpand\begingroup + \noexpand\def\noexpand\pgfplots@draw@image{% + \noexpand\def\noexpand\tikz@plot@handler{\the\toks3}% + \noexpand\pgfkeysdef{/pgfplots/legend image code}{\the\toks0}% + \ifx\pgfplots@stylekey\pgfutil@empty + \else + \noexpand\pgfkeysdef{#2}{\the\toks4}% + \fi + \noexpand\pgfplots@show@small@legendplots{\the\toks1}{}% + }% + \the\toks5 + \noexpand\endgroup% + }% + \xdef\pgfplots@glob@TMPa{\the\toks1}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup + \let\pgfplotsretvalb=\pgfplots@glob@TMPa +}% + % The implementation for \label{foo} after \addplot. It allows to % \ref{foo} (it inserts the 'legend image code'). % @@ -8078,44 +8807,21 @@ \def\pgfplots@plot@label@[#1]#2{% \ifpgfplots@has@label@information \begingroup - % I'd like to get all options which are INDEPENDENT of - % pgfplots. Idea: expand all /pgfplots-keys and collect - % everything which belongs NOT to /pgfplots. This is the - % completely expanded rest. At least, I hope so and it appears - % to work. - % - % FIXME : this was a good approach before. Now, there ARE - % /pgfplots keys which should be maintained. So: maintain all - % of them! Why should that pose any problems? - \pgfkeysinstallkeyfilter - {/pgf/key filters/and} - {{/pgf/key filters/is descendant of=/pgfplots}% - {/pgf/key filters/defined}}% - \def\pgfplots@label@tikzopts{}% - \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}% - \def\pgfplots@loc@TMPa{\pgfqkeysfiltered{/tikz}}% \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@last@plot@style@#1\endcsname - \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@loc@TMPb}% + \expandafter\pgfplots@export@legend@image@to@macro\expandafter{\pgfplots@loc@TMPb}{/pgfplots/every crossref picture}% % - \pgfkeysgetvalue{/pgfplots/every crossref picture/.@cmd}{\pgfplots@crossref@pic}% - \pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}% - \t@pgfplots@toka=\expandafter{\pgfplots@curlegendcode current plot style\pgfeov}% - \t@pgfplots@tokb=\expandafter{\pgfplots@label@tikzopts}% - \t@pgfplots@tokc=\expandafter{\pgfplots@crossref@pic\pgfeov}% + \t@pgfplots@toka=\expandafter{\pgfplotsretval}% + \t@pgfplots@tokb=\expandafter{\pgfplotsretvalb}% % 1. prepare /pgfplots/refstyle={#2}: - \if@filesw - \immediate\write\@auxout{% + \pgfplots@auxwrite{% \noexpand\expandafter\noexpand\gdef \noexpand\csname pgfplots@labelstyle@#2\noexpand\endcsname{\the\t@pgfplots@tokb}% }% % 2. prepare \ref{#2} and \pageref{#2}: % % There are several nasty things to consider: - % a) macro expansion. I did not really understand what happens - % here... I only understand that it is enough if the new label - % makes it into the .aux file of latex. That is sufficient for - % me! So, I converted the label command to a string using the - % \meaning functionality. + % a) macro expansion. Use \string to allow a safe \write + % operation. % % b) \protect . If the resulting \ref{} command occurs within % a "moving argument" like \caption or so, we need to use @@ -8123,29 +8829,16 @@ % % this here is the low-level implementation of \ref{#2}. Write it into % the .aux file: - \immediate\write\@auxout{% + \pgfplots@auxwrite{% \noexpand\expandafter\noexpand\gdef \noexpand\csname pgfplots@show@ref@#2\noexpand\endcsname{% - \noexpand\begingroup - \noexpand\pgfplots@define@currentplotstyle@as{\the\t@pgfplots@tokb}% - \noexpand\pgfkeysdef{/pgfplots/every crossref picture}{\the\t@pgfplots@tokc}% - \noexpand\tikz[/pgfplots/every crossref picture]{\the\t@pgfplots@toka}% - \noexpand\endgroup% + \the\t@pgfplots@toka }% }% - \fi - % This here is the high-level implementation \ref{#2}. - % The \protect handles the cases of "moving arguments": - \edef\pgfplots@loc@TMPa{% - \noexpand\expandafter - \noexpand\protect - \noexpand\csname pgfplots@show@ref@#2\noexpand\endcsname - }% - \pgfplots@command@to@string{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}% - \global\let\pgfplots@glob@TMPb=\pgfplots@loc@TMPa + % create the \label command: + \let\label=\pgfplots@original@LaTeX@label + \pgfplots@label{#2}{pgfplots@show@ref@}% \endgroup - \let\@currentlabel=\pgfplots@glob@TMPb - \pgfplots@original@LaTeX@label{#2}% \else \pgfplots@error{Can't create \string\label{#2}: it needs to be called after \string\addplot.}% \fi @@ -8173,6 +8866,9 @@ % \addplot[every mark/.append style={...}] % or something like that is interpreted as /tikz/ key: \pgfplots@invoke@pgfkeyscode{/handler config/full or existing/.@cmd}{}% restrict + % + \pgfkeysdef{/pgfplots/colorbar source}{}% make it NO-OP here. It has already been processed. + % % set both, pgfplots and tikz keys: % the draw is important since \addplot visualizes its stuff % with \path coordinates ... @@ -8216,6 +8912,15 @@ }% }% +% Invokes #1 if the statement occurs within \begin{axis}...\end{axis} +% and #2 if not. +\long\def\pgfplotsifinaxis#1#2{% + \pgfutil@ifundefined{pgfplots@is@in@axis}{#2}{#1}% +}% + +\pgfutil@ifundefined{label}{\relax}{% +}% + % % \begin{axis}[#1] : % @@ -8264,6 +8969,13 @@ % basis the latter to globally for the complete axis. % - will be assigned globally. % - meta data is ALWAYS collected in floating point. +% - \pgfplots@colorbar@src@metamin +% - \pgfplots@colorbar@src@metamax +% - these keys are usually empty, unless one provides the +% 'colorbar source' key for an \addplot command. In that case, +% they will be filled (globally) with the point meta min/max +% ranges of that particular plot. The colorbar will use the +% result for its ranges. % - \pgfplots@numplots % - A count register indexing the current plot counter. Assigned % globally. @@ -8327,10 +9039,21 @@ % - assigned globally. % - \ifpgfplots@coord@stream@isfirst % - assigned globally during \addplot. +% - \pgfplotssurveyphase@setactiveplothandlers +% A macro which is used to implement '\numplotsofactualtype' +% see \pgfplots@countplots@advance for details. % % \def\pgfplots@environment@opt[#1]{% \begingroup + \pgfutil@ifundefined{pgfplots@is@in@axis}{}{% + \pgfplots@error{% + Sorry, nested axis environments are not supported. + Please move the inner axis environment below \string\end{axis} and + use alignment options (for example named nodes, see manual) to place it at the desired + position}% + }% + \def\pgfplots@is@in@axis{1}% \pgfplots@checkandpreparefor@active@semicolon \pgfplots@install@abbrev@commands \pgfplots@stacked@initialise @@ -8407,6 +9130,8 @@ \global\let\pgfplots@data@zmax=\pgfplots@invalidrange@zmax \global\let\pgfplots@axiswide@metamin=\pgfplots@invalidrange@metamin \global\let\pgfplots@axiswide@metamax=\pgfplots@invalidrange@metamax + \global\let\pgfplots@colorbar@src@metamin=\pgfutil@empty + \global\let\pgfplots@colorbar@src@metamax=\pgfutil@empty % \pgfplots@autocompute@all@limitstrue \ifx\pgfplots@xmin\pgfutil@empty @@ -8484,11 +9209,19 @@ % \global\pgfplots@has@label@informationfalse % + \def\numplots{\the\pgfplots@numplots}% + \global\let\pgfplotssurveyphase@setactiveplothandlers=\pgfutil@empty + \let\numplotsofactualtype=\pgfplots@numplotsofactualtype + % % 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 + \let\pgfplots@orig@scope=\scope + \let\pgfplots@orig@endscope=\endscope + \let\scope=\pgfplots@replacement@for@scope + \let\endscope=\pgfplots@replacement@for@endscope + % } % \end{axis} : @@ -8496,12 +9229,20 @@ % This command actually takes all collected (global) variables, % creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% + \pgfutil@ifundefined{label}{\relax}{% + % restore. + \let\label=\pgfplots@original@LaTeX@label + }% \xdef\numplots{\the\pgfplots@numplots}% \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% % % restore old \path command: \let\path=\pgfplots@orig@path \let\plot=\pgfplots@orig@plot + \let\scope=\pgfplots@orig@scope + \let\endscope=\pgfplots@orig@endscope + % + \pgfplotssurveyphase@setactiveplothandlers % %\end{axis}: % @@ -8533,6 +9274,7 @@ \ifx\pgfplots@stored@current@cmd\pgfutil@empty \pgfplots@stored@current@data% \else + % % this code here means we REALLY have a plotting % command! \scope[current plot style] % this does set BOTH pgfplots and tikz options. @@ -8588,9 +9330,9 @@ \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% % \pgfplotspointaxisorigin - \advance\pgf@x by-\pgf@picminx - \advance\pgf@y by-\pgf@picminy - \xdef\pgfplotspointaxisorigin{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \global\advance\pgf@x by-\pgf@picminx + \global\advance\pgf@y by-\pgf@picminy + \xdef\pgfplotspointaxisorigin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \endgroup \endpgfinterruptpicture \egroup\egroup% end of pgfnodepartimagebox @@ -8609,11 +9351,31 @@ % \pgftransformshift{\pgfplots@at}% % + \edef\pgfplots@shapename{pgfplots@low@level@shape\ifpgfplots@deprecated@anchors @deprecated\fi}% + \pgfutil@ifundefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{% + % Oh. Well, suppose \pgfplots@anchorname is associated to an + % INNER node. + \def\pgfplots@loc@TMPa##1{% + \pgftransformshift{% + % So far, the inner node's position has not been + % corrected (that happens in + % \pgfplots@finally@correct@child@node@positions). + % Do that here with \pgfplots@saveddimen@picminx: + \pgfpointdiff + {\pgfqpoint{\pgfplots@saveddimen@picminx}{\pgfplots@saveddimen@picminy}} + {##1}% + \global\pgf@x=-\pgf@x \global\pgf@y=-\pgf@y + }% + }% + \expandafter\tikz@scan@one@point\expandafter\pgfplots@loc@TMPa\expandafter(\pgfplots@anchorname)% + \def\pgfplots@anchorname{image}% that means: no shift! + }{}% + % \ifpgfplots@deprecated@anchors \pgfplots@restore@deprecated@lowlevel@shape - \pgfmultipartnode{pgfplots@low@level@shape@deprecated}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + \pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% \else - \pgfmultipartnode{pgfplots@low@level@shape}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% + \pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}% \fi \pgfplots@fig@alias \pgfnodealias{current axis}{\tikz@fig@name}% @@ -8667,14 +9429,14 @@ \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 + \global\pgf@x=\pgf@xa + \global\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 -%\message{Attempting to correct '\pgfplots@child@node@name' position (it is inside of an axis).}% +%\message{Attempting to correct '\pgfplots@child@node@name' position by \meaning\pgfplots@offset\space (the node is inside of an axis).}% \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% \pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex new file mode 100644 index 00000000000..6cf2d1c1e2b --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.revision.tex @@ -0,0 +1,3 @@ +\def\pgfplotsrevision{% +version_1.4-1-g38878fa +} diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex index 13b71f8e942..fa6547c6bf3 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex @@ -97,14 +97,14 @@ {\pgfqpointxy@orig{##1}{##2}}% }% }% - \edef\pgfplotspointunitx{\pgf@x=\the\pgf@xx\space\pgf@y=\the\pgf@xy\space}% - \edef\pgfplotspointunity{\pgf@x=\the\pgf@yx\space\pgf@y=\the\pgf@yy\space}% + \edef\pgfplotspointunitx{\global\pgf@x=\the\pgf@xx\space\global\pgf@y=\the\pgf@xy\space}% + \edef\pgfplotspointunity{\global\pgf@x=\the\pgf@yx\space\global\pgf@y=\the\pgf@yy\space}% \let\pgfplotsunitxlength=\pgfplots@x@veclength \let\pgfplotsunitylength=\pgfplots@y@veclength \let\pgfplotsunitxinvlength=\pgfplots@x@inverseveclength \let\pgfplotsunityinvlength=\pgfplots@y@inverseveclength \ifpgfplots@threedim - \edef\pgfplotspointunitz{\pgf@x=\the\pgf@zx\space\pgf@y=\the\pgf@zy\space}% + \edef\pgfplotspointunitz{\global\pgf@x=\the\pgf@zx\space\global\pgf@y=\the\pgf@zy\space}% \let\pgfplotsunitzlength=\pgfplots@z@veclength \let\pgfplotsunitzinvlength=\pgfplots@z@inverseveclength \fi @@ -937,7 +937,7 @@ \edef\pgfplots@loc@TMPa{#1}% \expandafter\pgfplotspointouternormalvectorofaxis@\pgfplots@loc@TMPa\relax% % \endgroup in \pgfplotspointouternormalvectorofaxis@. - \expandafter\xdef\csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + \expandafter\xdef\csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \else \csname pgfplotspointouternormalvectorofaxis@cache@#1\endcsname \fi @@ -1124,8 +1124,8 @@ % % do not allow upside down labels: \ifdim\pgf@x<0pt% - \pgf@x=-\pgf@x% - \pgf@y=-\pgf@y% + \global\pgf@x=-\pgf@x% + \global\pgf@y=-\pgf@y% \fi% % \pgf@ya=-\pgf@y% @@ -1228,7 +1228,7 @@ % % we apply the inverse CM onto it here: \pgf@pos@transform\pgf@x\pgf@y - \edef\pgfplots@tmp@normaldir{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@tmp@normaldir{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% % % Now: % auto-determine the canonical (north, north east etc) anchor @@ -1306,17 +1306,19 @@ \pgfqpointscale {\csname pgfplotsunit#1invlength\endcsname} {\csname pgfplotspointunit#1\endcsname}% - \pgf@pos@transform\pgf@x\pgf@y + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \pgf@pos@transform\pgf@xa\pgf@ya % \edef\pgfplots@LEQ{% % solve linear system - {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@x}% - {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@y}% + {\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@xa}% + {\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@ya}% }% % % apply inverse matrix to right-hand-side (and compute RHS): \pgf@sh@reanchor{#3}{center}% - \edef\pgfplots@loc@center{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}% + \edef\pgfplots@loc@center{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}% \pgfpointdiff% {<start>}{<end>} -> computes <end> - <start> {\pgfplots@loc@center}% {\pgf@sh@reanchor{#3}{\pgfplots@anchor}}% @@ -1554,7 +1556,12 @@ \endgroup %\message{got scalex = \pgfplots@glob@TMPa\space and scaley = \pgfplots@glob@TMPb.}% \pgfmathsubtract@{\pgfplots@xmax}{\pgfplots@xmin}% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + % compute 1/(xmax - xmin) in float. + % I observed that it is much more accurate (lead to scaling differences of up to 10pt!) + \pgfmathfloatparsenumber\pgfmathresult + \pgfmathfloatreciprocal@\pgfmathresult + \pgfmathfloattofixed\pgfmathresult + %\expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% %\message{and 1/(xmax-xmin) = 1/(\pgfplots@xmax-\pgfplots@xmin) = \pgfmathresult.}% \pgf@xx=\pgfplots@glob@TMPa\pgf@xx \pgf@xy=\pgfplots@glob@TMPb\pgf@xy @@ -1562,7 +1569,10 @@ \pgf@xy=\pgfmathresult\pgf@xy % \pgfmathsubtract@{\pgfplots@ymax}{\pgfplots@ymin}% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber\pgfmathresult + \pgfmathfloatreciprocal@\pgfmathresult + \pgfmathfloattofixed\pgfmathresult + %\expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% %\message{and 1/(ymay-ymin) = 1/(\pgfplots@ymax-\pgfplots@ymin) = \pgfmathresult.}% \pgf@yx=\pgfplots@glob@TMPa\pgf@yx \pgf@yy=\pgfplots@glob@TMPb\pgf@yy @@ -1571,7 +1581,10 @@ % \ifpgfplots@threedim \pgfmathsubtract@{\pgfplots@zmax}{\pgfplots@zmin}% - \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber\pgfmathresult + \pgfmathfloatreciprocal@\pgfmathresult + \pgfmathfloattofixed\pgfmathresult + %\expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% %\message{and 1/(zmaz-zmin) = 1/(\pgfplots@zmax-\pgfplots@zmin) = \pgfmathresult.}% \pgf@zx=\pgfplots@glob@TMPa\pgf@zx \pgf@zy=\pgfplots@glob@TMPb\pgf@zy @@ -1646,10 +1659,7 @@ % - \csname pgfpmeta@#1@assign\endcsname{} % During the survey phase, this macro is expected to assign % \pgfplots@current@point@meta -% This method should prepare everything which is needed to invoke -% the postprocessors, i.e. it prepares the input for point meta -% transformations to [0,1000] or the scatter plot things. In other -% words: if it is a numeric input method, it should return a +% if it is a numeric input method, it should return a % floating point number. % It is allowed to return an empty string to say "there is no point % meta". @@ -1661,13 +1671,19 @@ % - \pgfplots@current@point@meta is ready for use: % - EITHER a parsed floating point number % - OR an empty string, -% - OR a symbolic string (if #3=symbolic) +% - OR a symbolic string (if the issymbolic boolean is true) % The default implementation is % \let\pgfplots@current@point@meta=\pgfutil@empty % % - \csname pgfpmeta@#1@issymbolic\endcsname -> expands to either '1' or '0' -% A numeric source will be processed numerically, i.e. the final map -% to [0,1000] will be initialised and meta limits will be updated. +% A numeric source will be processed numerically in float +% arithmetics. Thus, the output of the @assign routine should be +% a macro \pgfplots@current@point@meta in float format. +% +% The output of a numeric point meta source will result in meta +% limit updates and the final map to [0,1000] will be +% initialised automatically. +% % A symbolic input routine won't be processed. % Default is '0' % @@ -1697,6 +1713,7 @@ \expandafter\def\csname pgfpmeta@#1@initfor\endcsname##1{}% \expandafter\def\csname pgfpmeta@#1@issymbolic\endcsname{0}% \expandafter\def\csname pgfpmeta@#1@explicitinput\endcsname{0}% + \expandafter\def\csname pgfpmeta@#1@activate\endcsname{}% \edef\pgfplotsdeclarepointmetasource@{#1}% \pgfqkeys{/pgfplots/@declare point meta src}{#2}% }% @@ -1705,6 +1722,10 @@ {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @assign\endcsname{#1}},% initfor/.code= {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @initfor\endcsname##1{#1}},% + % Called during the survey phase before the first 'assign' call. + % It is usually empty. + activate/.code= + {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @activate\endcsname{#1}},% issymbolic/.code= {\expandafter\def\csname pgfpmeta@\pgfplotsdeclarepointmetasource@ @issymbolic\endcsname{#1}},% explicitinput/.code= @@ -1777,6 +1798,48 @@ }% \pgfkeyssetvalue{/pgfplots/point meta/expr}{}% +\pgfplotsdeclarepointmetasource{f(x)}{% + activate={% + \ifpgfplots@curplot@threedim + \def\pgfplotspointmetainputhandler{z}% + \else + \def\pgfplotspointmetainputhandler{y}% + \fi + \csname pgfpmeta@\pgfplotspointmetainputhandler @activate\endcsname + }, +}% + + +\pgfplotsdeclarepointmetasource{TeX code}{% + assign={% + \begingroup + \let\pgfplotspointmeta=\pgfutil@empty + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/code/.@cmd}{}% + \pgfmathfloatparsenumber{\pgfplotspointmeta}% + \let\pgfplots@current@point@meta=\pgfmathresult + \pgfmath@smuggleone\pgfplots@current@point@meta + \endgroup + },% + initfor={% + \pgfkeysdef{/pgfplots/point meta/code}{#1}% + }, +}% +\pgfplotsdeclarepointmetasource{TeX code symbolic}{% + assign={% + \begingroup + \let\pgfplotspointmeta=\pgfutil@empty + \pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/code/.@cmd}{}% + \let\pgfplots@current@point@meta=\pgfplotspointmeta + \pgfmath@smuggleone\pgfplots@current@point@meta + \endgroup + },% + initfor={% + \pgfkeysdef{/pgfplots/point meta/code}{#1}% + }, + issymbolic=1% +}% +\pgfkeysdef{/pgfplots/point meta/code}{}% + % Internal stream methods. % % Please overwrite @@ -2513,6 +2576,7 @@ \pgfmathfloatcreate{0}{0.0}{0}% \fi }% + \csname pgfpmeta@\pgfplotspointmetainputhandler @activate\endcsname % % %%%%%%%%%%%%%% % @@ -2587,6 +2651,14 @@ \global\let\pgfplots@axiswide@metamax=\pgfmathresult \fi \fi + \if1\pgfplots@colorbar@set@src% this 0|1 switch is set in \pgfplots@start@plot@with@behavioroptions + \ifx\pgfplots@metamin\pgfutil@empty + \pgfplotsthrow{no such element}{\pgfplots@loc@TMPa}{Sorry, `colorbar source' can't be processed: the current \string\addplot\space command doesn't have point meta. Ignoring it.}\pgfeov% + \else + \global\let\pgfplots@colorbar@src@metamin=\pgfplots@metamin + \global\let\pgfplots@colorbar@src@metamax=\pgfplots@metamax + \fi + \fi \ifpgfplots@autocompute@all@limits \global\let\pgfplots@data@xmin=\pgfplots@xmin \global\let\pgfplots@data@xmax=\pgfplots@xmax @@ -2647,6 +2719,15 @@ {% precommand(s): \expandafter\noexpand\csname pgfplots@curplot@threedim\ifpgfplots@curplot@threedim true\else false\fi\endcsname \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% + % + % store \plotnumofactualtype + \noexpand\def\noexpand\plotnumofactualtype{\numplotsofactualtype}% + % ... and make sure that it + % remains the same type even if some plot handler uses + % other plot handlers internally: + \noexpand\def\noexpand\pgfplotsplothandlername@actual{\pgfplotsplothandlername@actual}% + \noexpand\let\noexpand\numplotsofactualtype\noexpand\pgfplots@numplotsofactualtype@duringplot + % \noexpand\def\noexpand\numcoords{\pgfplots@current@point@coordindex}% % \pgfplots@current@point@coordindex will always contain the current index. % Maybe overwritten if not provided using \c@pgfplots@coordindex. @@ -2804,7 +2885,7 @@ \message{PGFPlots: Scanline length is \pgfplotsscanlinelength.}% \else \ifnum\pgfplotsscanlinelength=-2 - \message{PGFPlots: Scanline length could not be determined as multiple, different scan line lengths have been found.}% + \message{PGFPlots: Scanline length could not be determined since multiple, different scan line lengths have been found.}% \else \message{PGFPlots: No end-of-scanline marker found in input stream.}% \fi @@ -4171,21 +4252,21 @@ \def\pgfplots@gnuplot@logdirs{}% \ifpgfplots@xislinear \else + \pgfplots@identify@gnuplot@logbehavior x% \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs x}% \fi \ifpgfplots@yislinear \else + \pgfplots@identify@gnuplot@logbehavior y% \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs y}% \fi \ifpgfplots@curplot@threedim \ifpgfplots@zislinear \else + \pgfplots@identify@gnuplot@logbehavior z% \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs z}% \fi - \pgfplots@disablelogfilter@ztrue \fi - \pgfplots@disablelogfilter@xtrue - \pgfplots@disablelogfilter@ytrue \ifpgfplots@curplot@threedim \if1\b@pgfplots@should@sample@LINE \pgfplots@error{Sorry, I do not know how to sample 3D LINE plots with gnuplot... I only know 2D line and 3D mesh. You may want to help the author of pgfplots to improve this feature.}% @@ -4222,6 +4303,55 @@ \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile }% +\def\pgfplots@identify@gnuplot@logbehavior#1{% + \pgfutil@ifundefined{pgfplots@gnuplot@logscale@writes@log}{% + \pgfplots@identify@gnuplot@logbehavior@checkversion% + }{}% + \if1\pgfplots@gnuplot@logscale@writes@log + \csname pgfplots@disablelogfilter@#1true\endcsname + \fi +}% +\def\pgfplots@identify@gnuplot@logbehavior@checkversion{% + \immediate\write18{gnuplot -V >\pgfplots@plot@filename}% + \openin\r@pgfplots@reada=\pgfplots@plot@filename\relax + \ifeof\r@pgfplots@reada + \pgfplots@warning{Sorry, I could not determine 'gnuplot -V' to check whether gnuplot and logscale writes results in log() or not. Please set `/pgfplots/gnuplot writes logscale=true|false' manually.}% + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% something doesn't work. set it somehow. + \else + \read\r@pgfplots@reada to\pgfplots@loc@TMPa + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% + \immediate\write-1{Package pgfplots: checking gnuplot -V : `\pgfplots@loc@TMPa' (if this fails, set `/pgfplots/gnuplot writes logscale=true|false')}% + \expandafter\pgfplots@identify@gnuplot@logbehavior@checkversion@\pgfplots@loc@TMPa\relax + \closein\r@pgfplots@reada + \fi +}% +\def\pgfplots@identify@gnuplot@logbehavior@checkversion@#1 #2.#3 #4\relax{% + % starting with gnuplot 4.4, output files are no longer in + % logarithmic scale for log plots. + \ifnum#2<4 + % version 3.X + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% + \else + \ifnum#2>4 + % version 5.X + \gdef\pgfplots@gnuplot@logscale@writes@log{0}% + \else + \ifnum#3<4 + % version 4.2 : + \gdef\pgfplots@gnuplot@logscale@writes@log{1}% + \else + % version 4.4 or later : + \gdef\pgfplots@gnuplot@logscale@writes@log{0}% + \fi + \fi + \fi + \if0\pgfplots@gnuplot@logscale@writes@log + \immediate\write-1{Package pgfplots: I found gnuplot version >= 4.4. This one doesn't write log() coordinates. I will apply log() manually.}% + \else + \immediate\write-1{Package pgfplots: I found gnuplot version < 4.4. This one writes log() coordinates. I'll handle it accordingly.}% + \fi +}% + \def\pgfplots@addplotimpl@gnuplotresult#1#2{% \begingroup \openin\r@pgfplots@reada=#2 @@ -4317,11 +4447,11 @@ \pgfplots@PREPARE@COORD@STREAM{#4}% \pgfplots@coord@stream@start \pgfplotsscanlinelengthinitzero - \pgfplots@logfileopen{#3}% \openin\r@pgfplots@reada=#3 \ifeof\r@pgfplots@reada \pgfplots@error{sorry, plot file{#3} could not be opened}% \else + \pgfplots@logfileopen{#3}% \let\pgfplots@current@point@x@error=\pgfutil@empty \let\pgfplots@current@point@y@error=\pgfutil@empty \let\pgfplots@current@point@z@error=\pgfutil@empty @@ -4337,6 +4467,7 @@ \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta \fi \fi + \pgfplotstableinstallignorechars% \pgfplots@addplotimpl@file@readall \fi \pgfplotsscanlinelengthcleanup @@ -4397,9 +4528,10 @@ }% }% % \addplot[#1] plot[#2] graphics[#3] {#4} #5; -\def\pgfplots@addplotimpl@graphics@#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% -\def\pgfplots@addplotimpl@graphics@@#1#2#3#4#5{% +\long\def\pgfplots@addplotimpl@graphics@#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% +\long\def\pgfplots@addplotimpl@graphics@@#1#2#3#4#5{% \pgfplots@start@plot@with@behavioroptions{#1,/pgfplots/.cd,#2,% + /pgfplots/plot graphics/@prepare legend, /pgfplots/plot graphics,% /pgfplots/plot graphics/.cd,% #3,% @@ -4491,18 +4623,23 @@ \pgfutil@ifnextchar[{% \pgfplots@addplotimpl@table@getopts{#1}% }{% - \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% + \pgfplots@addplotimpl@table@getopts{#1}[]% }% }% \def\pgfplots@addplotimpl@table@getopts#1[#2]{% + % set options outside of the following group. + % They may contain behavior options. + \pgfplots@addplotimpl@table@installkeypath + \pgfplotstableset{#2}% + % \pgfutil@ifnextchar s{% \pgfplots@addplotimpl@table@fromshell{#1}{#2}% }{% \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% + \pgfplots@addplotimpl@table@fromstructure@gobble@space{#1}{#2}% }{% - \pgfplots@addplotimpl@table@fromfile{#1}{#2}% + \pgfplots@addplotimpl@table@fromfile@gobble@space{#1}{#2}% }% }% } @@ -4523,15 +4660,42 @@ % \addplot[#1] table[#2] from {#3} #4; % % #1: arguments to \addplot[...] -% #2: arguments to table[...] +% #2: arguments to table[...] (already processed!) % #3: the argument of plot table{...} % #4: trailing path arguments after plot table{...}#4; +\long\def\pgfplots@addplotimpl@table@fromstructure@gobble@space#1#2from{% + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplots@addplotimpl@table@fromstructure{#1}{#2}from% + }% +}% + +\def\pgfplots@addplot@table@fromstructure@preparecolname#1#2#3#4{% + \pgfkeysgetvalue{/pgfplots/table/#1}{\pgfplots@loc@TMPa}% + % + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/#1 index}{\pgfplots@loc@TMPa}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfplotstablegetcolumnnamebyindex\pgfplots@loc@TMPa\of#2\to\pgfplots@loc@TMPa + \fi + \fi + \let#3=\pgfplots@loc@TMPa + % + % modify \pgfplots@plot@tbl@{x,y,z,meta} if there are + % corresponding '#1 expr' statements: + \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for{#1}{#3}{#4}% +} + +% Invokes `#1' if the command is invoked within +% \addplot table {<\macro>}; +% and `#2' if not. +\def\pgfplotsifinaddplottablestruct#1#2{% + \pgfutil@ifundefined{pgfplots@plot@tbl@meta}{#2}{#1}% +}% + \long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% % \addplot[#1] table[#2] from {#3} #4 ; \long\def\pgfplots@addplotimpl@table@fromstructure@#1#2#3#4{% - % set options here. They may contain behavior options! - \pgfplots@addplotimpl@table@installkeypath - \pgfplotstableset{#2}% \begingroup \pgfplotstablegetscanlinelength{#3}{\pgfplotsscanlinelength}% % FIXME : this thing here has runtime O(N^2) ! @@ -4539,57 +4703,28 @@ % % well, for a lot of columns which are used in different contexts % and few rows, this here IS more efficient. - \pgfplotstablecopy#3\to\pgfplots@table - \pgfkeysgetvalue{/pgfplots/table/x}{\pgfplots@plot@tbl@x}% - \pgfkeysgetvalue{/pgfplots/table/x index}{\pgfplots@plot@tbl@xindex}% - \pgfkeysgetvalue{/pgfplots/table/y}{\pgfplots@plot@tbl@y}% - \pgfkeysgetvalue{/pgfplots/table/y index}{\pgfplots@plot@tbl@yindex}% - \pgfkeysgetvalue{/pgfplots/table/z}{\pgfplots@plot@tbl@z}% - \pgfkeysgetvalue{/pgfplots/table/z index}{\pgfplots@plot@tbl@zindex}% - \pgfkeysgetvalue{/pgfplots/table/meta}{\pgfplots@plot@tbl@meta}% - \pgfkeysgetvalue{/pgfplots/table/meta index}{\pgfplots@plot@tbl@metaindex}% % - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\pgfplots@plot@tbl@x - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\pgfplots@plot@tbl@y - \fi + \pgfplots@addplot@table@fromstructure@preparecolname{x}{#3}\pgfplots@plot@tbl@x\columnx + \pgfplots@addplot@table@fromstructure@preparecolname{y}{#3}\pgfplots@plot@tbl@y\columny \ifpgfplots@curplot@threedim - \ifx\pgfplots@plot@tbl@z\pgfutil@empty - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@zindex\of\pgfplots@table\to\pgfplots@plot@tbl@z - \fi - \fi - \ifx\pgfplots@plot@tbl@meta\pgfutil@empty - \ifx\pgfplots@plot@tbl@metaindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@metaindex\of\pgfplots@table\to\pgfplots@plot@tbl@meta - \fi + \pgfplots@addplot@table@fromstructure@preparecolname{z}{#3}\pgfplots@plot@tbl@z\columnz \fi + \pgfplots@addplot@table@fromstructure@preparecolname{meta}{#3}\pgfplots@plot@tbl@meta\columnmeta % % % high level user interface functions: \let\lineno=\coordindex% is the same here % - % modify \pgfplots@plot@tbl@{x,y,z,meta} if there are - % corresponding '#1 expr' statements: - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for x\columnx% - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for y\columny% - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {meta}\columnmeta% + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@x}\of#3\to\addplot@tbl@x + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@y}\of#3\to\addplot@tbl@y \ifpgfplots@curplot@threedim - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for z\columnz% - \fi - % - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y - \ifpgfplots@curplot@threedim - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@z\of\pgfplots@table\to\addplot@tbl@z + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@z}\of#3\to\addplot@tbl@z \fi % \let\addplot@tbl@meta=\pgfutil@empty \ifx\pgfplots@plot@tbl@meta\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@meta\of\pgfplots@table\to\addplot@tbl@meta + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@meta}\of#3\to\addplot@tbl@meta \fi % % @@ -4597,57 +4732,26 @@ \let\addplot@tbl@error@y=\pgfutil@empty \let\addplot@tbl@error@z=\pgfutil@empty \ifpgfplots@errorbars@enabled - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \pgfkeysgetvalue{/pgfplots/table/z error index}\pgfplots@plot@tbl@error@zindex - \pgfkeysgetvalue{/pgfplots/table/z error}\pgfplots@plot@tbl@error@z - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\pgfplots@plot@tbl@error@x - \fi - \fi - % - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\pgfplots@plot@tbl@error@y - \fi - \fi - % + \pgfplots@addplot@table@fromstructure@preparecolname{x error}{#3}\pgfplots@plot@tbl@error@x\columnerrorx + \pgfplots@addplot@table@fromstructure@preparecolname{y error}{#3}\pgfplots@plot@tbl@error@y\columnerrory \ifpgfplots@curplot@threedim - \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@zindex\pgfutil@empty - \else - \pgfplotstablegetcolumnnamebyindex\pgfplots@plot@tbl@error@zindex\of\pgfplots@table\to\pgfplots@plot@tbl@error@z - \fi - \fi + \pgfplots@addplot@table@fromstructure@preparecolname{z error}{#3}\pgfplots@plot@tbl@error@z\columnerrorz \else \let\pgfplots@plot@tbl@error@z=\pgfutil@empty \fi % - % modify \pgfplots@plot@tbl@{x error,y error,z error} if there are - % corresponding '#1 expr' statements: - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {x error}\columnerrorx% - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {y error}\columnerrory% - \ifpgfplots@curplot@threedim - \pgfplots@addplotimpl@table@fromstructure@prepareexpr@for {z error}\columnerrorz% - \fi - % % now: load the columns: \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@error@x}\of#3\to\addplot@tbl@error@x \fi \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@error@y}\of#3\to\addplot@tbl@error@y \fi \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@z\of\pgfplots@table\to\addplot@tbl@error@z + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplots@plot@tbl@error@z}\of#3\to\addplot@tbl@error@z \fi % \else @@ -4719,13 +4823,19 @@ % temporary name). % The old value of \pgfplots@plot@tbl@#1 is available as column % alias. -% the high level user interface command '#2' will be set correctly. -\def\pgfplots@addplotimpl@table@fromstructure@prepareexpr@for#1#2{% +% the high level user interface command '#3' will be set correctly. +% +% #1: the key name of the current entity, for example 'x' for +% '/pgfplots/table/x' +% #2: the low level column name representing the data which is already +% defined somehow +% #3: a high level user interface command +\def\pgfplots@addplotimpl@table@fromstructure@prepareexpr@for#1#2#3{% % get old column name into a register: - \t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname pgfplots@plot@tbl@#1\endcsname}% + \t@pgfplots@tokb=\expandafter{#2}% % % high level user interface command: - \edef#2{\noexpand\thisrow{\the\t@pgfplots@tokb}}% + \edef#3{\noexpand\thisrow{\the\t@pgfplots@tokb}}% % \pgfkeysgetvalue{/pgfplots/table/#1 expr}{\pgfplots@loc@TMPa}% \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -4746,7 +4856,7 @@ % % tell `plot table' which column should be used for '#1': the % temporary column. - \expandafter\def\csname pgfplots@plot@tbl@#1\endcsname{#1expr@tempcol}% + \def#2{#1expr@tempcol}% \fi }% @@ -4759,31 +4869,30 @@ % number of rows is less than about 110000). % % #1: arguments to \addplot[...] -% #2: arguments to table[...] +% #2: arguments to table[...] (already processed!) % #3: the argument of plot table{...} % #4: trailing path arguments after plot table{...}#4; % +\long\def\pgfplots@addplotimpl@table@fromfile@gobble@space#1#2{% + \pgfplotstablecollectoneargwithpreparecatcodes{% + \pgfplots@addplotimpl@table@fromfile{#1}{#2}% + }% +}% \long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% % \addplot[#1] table[#2] {#3} {#4}; \long\def\pgfplots@addplotimpl@table@fromfile@#1#2#3#4{% - % set options outside of the following group. - % They may contain behavior options. - \pgfplots@addplotimpl@table@installkeypath - \pgfplotstableset{#2}% - %-------------------------------------------------- - % \begingroup - % \pgfplotstableset{#2}% - % \pgfplotstableread{#3}\pgfplots@table - % \pgfplots@addplotimpl@table@fromstructure{#1}{}from{\pgfplots@table}{#4};% - % \endgroup - %-------------------------------------------------- - %\begingroup + \if1\pgfplots@addplotimpl@readcompletely@auto + \pgfplots@addplotimpl@table@check@createonuse@for{x}% + \pgfplots@addplotimpl@table@check@createonuse@for{y}% + \ifpgfplots@curplot@threedim + \pgfplots@addplotimpl@table@check@createonuse@for{z}% + \fi + \pgfplots@addplotimpl@table@check@createonuse@for{meta}% + \fi + % \ifpgfplots@addplotimpl@readcompletely \pgfplotstableread{#3}\pgfplots@table \pgfplots@addplotimpl@table@fromstructure@{#1}{}{\pgfplots@table}{#4}% - % \pgfmath@smuggleone\pgfplotsscanlinelength - % \endgroup - % \pgfplotsscanlinedisablechanges \else \pgfplotsapplistXXglobalnewempty % @@ -4832,30 +4941,15 @@ \pgfplotstableread*{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED \fi \pgfplots@coord@stream@end - % FIXME : i'd be glad if I could save this group: check why not - % perhaps because \pgfplotstableread uses several pgf - % variables? - %\pgfmath@smuggleone\pgfplotsscanlinelength - %\endgroup - %\pgfplotsscanlinedisablechanges - % - %\pgfplots@PREPARE@COORD@STREAM{#4}% - %\pgfplotsapplistXXgloballet\pgfplots@coordlist - %\pgfplotsapplistXXglobalclear - %\ifpgfplots@errorbars@enabled - % \pgfplots@plot@coords@mathparserfalse - % \ifpgfplots@curplot@threedim - % \expandafter\pgfplots@coord@stream@foreach@threedim\expandafter{\pgfplots@coordlist}%% - % \else - % \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@coordlist}%% - % \fi - %\else - % this here is the usual case; it is faster than the error bar - % stuff. - % \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@coordlist}% - %\fi \fi } +\def\pgfplots@addplotimpl@table@check@createonuse@for#1{% + \pgfkeysgetvalue{/pgfplots/table/#1}\pgfplots@addplotimpl@table@check@createonuse@for@ + \expandafter\pgfplotstableifiscreateonuse\expandafter{\pgfplots@addplotimpl@table@check@createonuse@for@}{% + \pgfplots@addplotimpl@readcompletelytrue + }{% + }% +}% \def\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED{% \pgfplots@addplotimpl@table@fromfile@listener@ \pgfplots@coord@stream@coord @@ -5111,10 +5205,19 @@ \c@pgfplots@coordindex=0 \def\pgfplots@current@point@coordindex{\the\c@pgfplots@coordindex}% can be used inside of coordinate filters. \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot - \ifpgfplots@usefpu - \pgfkeys{/pgf/fpu=true}% - \fi \def\pgfplots@addplot@running{1}% + \def\pgfplots@colorbar@set@src{0}% + \pgfkeysdef{/pgfplots/colorbar source}{% + \pgfplotsutilifstringequal{##1}{true}{% + \def\pgfplots@colorbar@set@src{1}% + }{% + \pgfplotsutilifstringequal{##1}{false}{% + \def\pgfplots@colorbar@set@src{0}% + }{% + \pgfplots@error{Sorry, I don't know the value `colorbar source={##1}' and I am going to ignore it. Maybe you misspelled it?}% + }% + }% + }% % % these styles may contain behavior options (error bars, % samples,... ) activate them! @@ -5135,19 +5238,19 @@ % need to change the .unknown handler. See the available % compatibility styles! % - \pgfkeysdef{/pgfplots/.unknown}{% + % ATTENTION: starting with more recent versions (since the + % unstable version), I will also set /tikz keys here! This should + % work. It is well tested for the unstable... I hope it will also + % work for the master branch. + %\pgfkeysdef{/pgfplots/.unknown}{% %\message{In \string\addplot[#1]: I am silently ignoring key `\pgfkeyscurrentkeyRAW' during the preparation phase.}% - }% + %}% % % it is possible that '#1' contains 'forget plot'. So, we need to % set the options before checking % \ifpgfplots@curplot@isirrelevant: \pgfplotsset{/pgfplots/every axis plot,#1}% % - % hooks: - \pgfkeysvalueof{/pgfplots/execute at begin plot@@}% - \pgfkeysvalueof{/pgfplots/execute at begin plot}% - % \ifpgfplots@curplot@isirrelevant \def\pgfplots@addplot@survey@@optionlist{/pgfplots/every axis plot,/pgfplots/every forget plot}% \pgfplotsset{/pgfplots/every forget plot,/pgfplots/every axis plot post}% @@ -5155,6 +5258,21 @@ \edef\pgfplots@addplot@survey@@optionlist{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% \pgfplotsset{/pgfplots/every axis plot no \the\pgfplots@numplots/.try,/pgfplots/every axis plot post}% \fi + % + \ifpgfplots@usefpu + \pgfkeys{/pgf/fpu=true}% + \fi + \pgfplots@countplots@init + % + % hooks: + \pgfkeysvalueof{/pgfplots/execute at begin plot@@}% + \pgfkeysvalueof{/pgfplots/execute at begin plot}% + % + \if1\pgfplots@colorbar@set@src + \expandafter\def\expandafter\pgfplots@addplot@survey@@optionlist\expandafter{\pgfplots@addplot@survey@@optionlist,% + /pgfplots/point meta rel=per plot}% + \fi + % \expandafter\def\expandafter\pgfplots@addplot@survey@@optionlist\expandafter{\pgfplots@addplot@survey@@optionlist,% #1,/pgfplots/.cd,/pgfplots/every axis plot post}% \pgfplots@validate@plot@domain@arguments @@ -5210,13 +5328,76 @@ \def\pgfplots@end@plot{% \ifpgfplots@curplot@isirrelevant \else - \global\advance\pgfplots@numplots by1\relax% + \pgfplots@countplots@advance \fi \pgfkeysvalueof{/pgfplots/execute at end plot@@}% \pgfkeysvalueof{/pgfplots/execute at end plot}% \endgroup%<-- close the \begingroup of \pgfplots@addplotimpl@plot@withoptions } +% \numplotsofactualtype +% Expands to the number of plots which have been seen in the current +% axis and which have the same type as the actual plot handler. +% +% See also \plotnumofactualtype +\def\pgfplots@numplotsofactualtype{% + \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername}{% + 0% + }{% + \csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername\endcsname + }% +}% +% use this only inside of \addplot or during the visualization phase +% of a plot. +\def\pgfplots@numplotsofactualtype@duringplot{% + \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername@actual}{% + 0% + }{% + \csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname + }% +}% +% +% This macro may be overwritten inside of the \tikz@plot@handler +% macro. This here is just the default implementation. +% +% @INTERNAL HINT: I think the unstable version has another +% implementation. make sure it's not overwritten! +\def\pgfplotsplothandlername{\meaning\tikz@plot@handler}% +% +\def\pgfplots@countplots@init{% +% + % + \pgfplotssurveyphase@setactiveplothandlers + % + \let\numplotsofactualtype=\pgfplots@numplotsofactualtype@duringplot + % + % Store this name during the \addplot command. Thus, even if the + % plot handler changes, we will keep this one. + \edef\pgfplotsplothandlername@actual{\pgfplotsplothandlername}% + % + \pgfutil@ifundefined{pgfplotssurveyphase@setactiveplothandlers@\pgfplotsplothandlername@actual}{% + % oh. This is the first time \pgfplotsplothandlername was used + % in this axis. Set its counter to 0 and remember that it has + % been initialised. + \expandafter\xdef\csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname{0}% + \t@pgfplots@toka=\expandafter{\pgfplotssurveyphase@setactiveplothandlers}% + \t@pgfplots@tokb=\expandafter{\pgfplotsplothandlername@actual}% + \xdef\pgfplotssurveyphase@setactiveplothandlers{% + \the\t@pgfplots@toka + \noexpand\expandafter\noexpand\def\noexpand\csname pgfplotssurveyphase@setactiveplothandlers@\the\t@pgfplots@tokb\noexpand\endcsname{1}% + }% + \expandafter\def\csname pgfplotssurveyphase@setactiveplothandlers@\the\t@pgfplots@tokb\endcsname{1}% + }{% + % ok. do nothing. + }% + % +}% +\def\pgfplots@countplots@advance{% + \global\advance\pgfplots@numplots by1\relax% + % + \expandafter\pgfplotsutil@advancestringcounter@global\csname c@pgfplots@numplotsofactualtype@\pgfplotsplothandlername@actual\endcsname +}% + % \addplot[#1] [#2] {#3} #4; \long\def\pgfplots@addplotimpl@coordinates#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% % \addplot[#1] [#2] coordinates {#3} #4; @@ -5258,7 +5439,7 @@ \long\def\pgfplots@addplotimpl@table@fromstructure@AS#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% \long\def\pgfplots@addplotimpl@table@fromfile@AS#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% \long\def\pgfplots@addplotimpl@coordinates@AS#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% - \def\pgfplots@addplotimpl@graphics@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% + \long\def\pgfplots@addplotimpl@graphics@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@graphics@@{#1}{#2}{#3}{#4}{#5}}% % % Checks whether ';' is an active character and, if that is the % case, modifies all public macros for it. @@ -5346,6 +5527,16 @@ % Init the plot handlers: \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + % + \ifpgfplots@clip@limits + \else + % "clip marker paths=true" actually doesn't checks anything -- + % it leaves the checks to the clip path. But since there is no + % clip path, it is adequate to use it here: + \pgfplots@clip@marker@pathstrue + \fi + % + % \def\pgfplots@loc@TMPa{0}% <-- if (collectmark positions) \ifpgfplots@scatterplotenabled \def\pgfplots@loc@TMPa{1}% collect mark positions even if 'mark=none'! scatter might not even use markers. @@ -5424,6 +5615,7 @@ % Will be inserted in one of two possible places below (to collect % marker positions) \def\pgfplots@visualize@performserizalization{% + % ATTENTION: this here is replicated for stacked plots! \ifx\pgfplotspointmetainputhandler\pgfutil@empty % we don't have per-point meta data. Nothing special to % do: @@ -5457,29 +5649,33 @@ \ifpgfplots@curplot@threedim \E\pgf@yb=\E\pgfplots@current@point@z pt % \fi - \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg - \E\else - \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg + \ifpgfplots@clip + \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg \E\else - \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg + \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg \E\else - \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg \E\else - \ifpgfplots@curplot@threedim - \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg - \E\else - \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\else + \ifpgfplots@curplot@threedim + \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg \E\else - \pgfplots@visualize@performserizalization + \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\else + \pgfplots@visualize@performserizalization + \E\fi \E\fi - \E\fi - \else - \pgfplots@visualize@performserizalization - \fi + \else + \pgfplots@visualize@performserizalization + \fi + \E\fi \E\fi \E\fi \E\fi - \E\fi + \else + \pgfplots@visualize@performserizalization + \fi \fi \E\pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y! \advance\c@pgfplots@coordindex by1 @@ -5831,9 +6027,33 @@ % coordinates. \pgfplots@stacked@initzerolevelhandler \else - \pgfplotspointaxisorigin - \expandafter\pgfplotxzerolevelstreamconstant\expandafter{\the\pgf@x}% - \expandafter\pgfplotyzerolevelstreamconstant\expandafter{\the\pgf@y}% + \ifpgfplots@threedim + \def\pgfplotxzerolevelstreamstart{}% + \def\pgfplotxzerolevelstreamend{}% + \def\pgfplotxzerolevelstreamnext{% + \begingroup + \pgf@xa=\pgf@y + \pgfplotsqpointxyz{\pgfplots@logical@ZERO@x}{\pgfplots@current@point@y}{\ifpgfplots@curplot@threedim\pgfplots@current@point@z\else\pgfplots@logical@ZERO@z\fi}% + \global\pgf@x=\pgf@x + \global\pgf@y=\pgf@xa + \endgroup + }% + % + \def\pgfplotyzerolevelstreamstart{}% + \def\pgfplotyzerolevelstreamend{}% + \def\pgfplotyzerolevelstreamnext{% + \begingroup + \pgf@xa=\pgf@y + \pgfplotsqpointxyz{\pgfplots@current@point@x}{\pgfplots@current@point@y}{\pgfplots@logical@ZERO@z}% + \global\pgf@x=\pgf@y + \global\pgf@y=\pgf@xa + \endgroup + }% + \else + \pgfplotspointaxisorigin + \expandafter\pgfplotxzerolevelstreamconstant\expandafter{\the\pgf@x}% + \expandafter\pgfplotyzerolevelstreamconstant\expandafter{\the\pgf@y}% + \fi \fi } @@ -5902,7 +6122,7 @@ \fi \xdef\pgfplots@ZERO@x{\the\pgf@x}% \xdef\pgfplots@ZERO@y{\the\pgf@y}% - \xdef\pgfplotspointaxisorigin{\noexpand\pgf@x=\pgfplots@ZERO@x\space\noexpand\pgf@y=\pgfplots@ZERO@y\space}% + \xdef\pgfplotspointaxisorigin{\noexpand\global\pgf@x=\pgfplots@ZERO@x\space\noexpand\global\pgf@y=\pgfplots@ZERO@y\space}% }% @@ -5995,10 +6215,34 @@ \ifx\pgfplots@loc@TMPd\pgfutil@empty \pgfplots@error{Error using 'plot graphics': I don't have a graphics file name! Please set the '/pgfplots/plot graphics/src' key to the image file name. Skipping this plot.}% \else - \expandafter\includegraphics\expandafter[\pgfplots@loc@TMPc,width=#1,height=#2]{\pgfplots@loc@TMPd}% + \def\pgfplots@loc@TMPa{\pgfkeysvalueof{/pgfplots/plot graphics/includegraphics cmd}}% + \expandafter\pgfplots@loc@TMPa\expandafter[\pgfplots@loc@TMPc,width=#1,height=#2]{\pgfplots@loc@TMPd}% \fi }% +% legends for plot graphics should not use 'plot graphics' themselfes +% (for obvious reasons). +% This key handles that. Furthermore, it remembers the plot mark for +% the legend -- although no plot mark is allowed for plot graphics as +% such. +\pgfkeysdef{/pgfplots/plot graphics/@prepare legend}{% + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + % + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + \t@pgfplots@tokc=\expandafter{\pgfplots@basiclevel@plothandler}% + % + \edef\pgfplots@loc@TMPa{% + \noexpand\pgfkeys{/pgfplots/every legend image post/.append code={% + \noexpand\def\noexpand\tikz@plot@handler{\the\t@pgfplots@tokc}% + \ifx\tikz@plot@mark\pgfutil@empty + \else + \noexpand\pgfkeysalso{/tikz/mark=\tikz@plot@mark}% + \fi + }% + }% + }% + \pgfplots@loc@TMPa +} % The low-level tikz plot handler for 3D mesh and surface plots. @@ -6287,13 +6531,9 @@ \fi % PREPARE THE STREAM PROCESSING: \def\pgfplots@plothandler@unbounded@visualize@jump{% - \pgfplotstreampoint{\pgf@x=-16000.0pt \pgf@y=-16000.0pt }% - }% - \def\pgfplotsplothandlermesh@check@unbounded####1####2\relax{% - \ifdim####1=-16000pt - \pgfplots@loc@tmpfalse - \fi + \pgfplotstreampoint{\global\pgf@x=-16000.0pt \global\pgf@y=-16000.0pt }% }% + \let\pgfplotsplothandlermesh@check@unbounded=\pgfplotsplothandlermesh@check@unbounded@setbool \if\pgfplotsplothandlermesh@ONEDIMMODE1% % Special case: 1D mesh processing \global\let\pgf@plotstreampoint=\pgfplotsplothandlermesh@ONEDIM@draw% @@ -6362,6 +6602,8 @@ \pgfplotsplothandlermesh@i@jm }% % Init memory: + % in fact, this does only remember the maximum capacity; + % it doesn't fill the memory. \c@pgfplots@scanlineindex=\pgfplotsplothandlermesh@scanlinelength\relax \advance\c@pgfplots@scanlineindex by1 \pgfplotsdequenewempty{lastscanline}\capacity{\the\c@pgfplots@scanlineindex}% @@ -6427,6 +6669,12 @@ }% }% +\def\pgfplotsplothandlermesh@check@unbounded@setbool#1#2\relax{% + \ifdim#1=-16000pt + \pgfplots@loc@tmpfalse + \fi +}% + \long\def\pgfplotsplothandlermesh@defaultlegend@img#1{% \scope[% #1, @@ -6498,7 +6746,7 @@ \if\pgfplotsplothandlermesh@zbuffer@choice4% % z buffer=sort: % process the z buffer: - \pgfkeyslet{/pgfplots/array/iflessthan/.@cmd}\pgfplotsplothandlermesh@zbuffer@sort@iflessthen + \pgfkeyslet{/pgfplots/iflessthan/.@cmd}\pgfplotsplothandlermesh@zbuffer@sort@iflessthen \pgfkeysdef{/pgfplots/array/unscope pre}{% \pgfplotsarrayforeachungrouped\pgfplots@zbuffer@local\as\curelem{% \expandafter\pgfplotsplothandlermesh@draw@zbufferelement\curelem% @@ -6583,17 +6831,18 @@ \def\pgfplotsplothandlermesh@shader@interp@transpose@finish{% % Now, "execute" each row vector: \def\pgfplotsplothandlermesh@shader@interp@next##1##2##3{% - \pgfplotslibrarysurfstreamcoord{\pgf@x=##1 \pgf@y=##2 }{##3}% + \pgfplotslibrarysurfstreamcoord{\global\pgf@x=##1 \global\pgf@y=##2 }{##3}% }% \c@pgfplots@scanlineindex=0 \pgfutil@loop \ifnum\c@pgfplots@scanlineindex<\pgfplotsplothandlermesh@rows\relax - \expandafter\pgfplotsapplistXlet\expandafter\pgfplots@loc@TMPa\expandafter=\csname pgfp@transprow@\the\c@pgfplots@scanlineindex\endcsname% + \expandafter\pgfplotsapplistXlet\expandafter\pgfplots@loc@TMPd\expandafter=\csname pgfp@transprow@\the\c@pgfplots@scanlineindex\endcsname% \expandafter\pgfplotsapplistXnewempty\csname pgfp@transprow@\the\c@pgfplots@scanlineindex\endcsname% clear % execute the row: - \pgfplots@loc@TMPa + \pgfplots@loc@TMPd \advance\c@pgfplots@scanlineindex by1 \pgfutil@repeat + \let\pgfplots@loc@TMPd=\relax }% \def\pgfplotsplothandlermesh@draw@zbufferelement#1#2{% @@ -6638,12 +6887,12 @@ % #2: projected y coord % #3: per point meta (if any) \def\pgfplotsplothandlermesh@unpack@corner#1#2#3{% - \pgf@x=#1\relax - \pgf@y=#2\relax + \global\pgf@x=#1\relax + \global\pgf@y=#2\relax }% \def\pgfplotsplothandlermesh@unpack@mean@accum#1#2#3{% - \pgf@x=#1\relax - \pgf@y=#2\relax + \global\pgf@x=#1\relax + \global\pgf@y=#2\relax \def\pgfplots@current@point@meta{#3}% \pgfplots@perpointmeta@trafo@APPLY \global\advance\pgfplots@tmpa by\pgfplotspointmetatransformed pt @@ -6739,7 +6988,7 @@ \else \pgfplotsarrayresize\pgfplots@zbuffer@local{\c@pgfplots@scanlineindex}% \fi - \pgfkeyslet{/pgfplots/array/iflessthan/.@cmd}\pgfplots@apply@zbuffer@SORT@iflessthan + \pgfkeyslet{/pgfplots/iflessthan/.@cmd}\pgfplots@apply@zbuffer@SORT@iflessthan \pgfkeysdef{/pgfplots/array/unscope pre}{% \pgfplotsapplistXnewempty{\pgfp@sortedlist}% \pgfplotsarrayforeachungrouped\pgfplots@zbuffer@local\as\curelem{% diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex index 026a1c83f78..ec1642f9409 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex @@ -26,6 +26,7 @@ \def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% +\def\pgfplotstable@error@pkg#1{\PackageError{pgfplotstable}{#1}{}}% \def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}% \def\pgfplots@message#1{% \immediate\write16{#1}% @@ -49,6 +50,33 @@ \def\pgfplotsthrow#1#2\pgfeov{% \pgfkeysvalueof{/pgfplots/exception/#1/.@cmd}#2\pgfeov }% +\let\pgfplotsthrow@orig=\pgfplotsthrow + +% A primitive try #1 catch #2 end block. +% +% It tries code #1. If any exception occurs within, it suppresses the +% exception and tries to continue. It then invokes #2 as soon as it +% can. +% +% You can use \pgfplotsrethrow in #2. +% +% ATTENTION: this is a simple attempt to simulate error control. Don't +% rely on it too heavily! In the moment, I am not even sure if it can +% be nested (perhaps you need to introduce extra scopes since +% \pgfplotstry doesn't). +\long\def\pgfplotstry#1\catch#2\endpgfplotstry{% + \global\let\pgfplotstry@exception\pgfutil@empty + \def\pgfplotsthrow##1##2\pgfeov{\gdef\pgfplotstry@exception{{##1}{##2}}}% + #1\relax% + \let\pgfplotsthrow=\pgfplotsthrow@orig + \ifx\pgfplotstry@exception\pgfutil@empty + \else + #2% + \fi + \global\let\pgfplotstry@exception\pgfutil@empty +}% +\def\pgfplotsrethrow{\expandafter\pgfplotsthrow\pgfplotstry@exception\pgfeov}% + \pgfkeys{ % #1: the argument which should have been assigned. % #2: an error message. @@ -131,4 +159,8 @@ \fi } \let\pgfplotsiffileexists=\pgfplots@iffileexists + +\pgfutil@ifundefined{pgfplots@texdist@protect}{% + \def\pgfplots@texdist@protect{}% +}{} \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex index b0e18b0bf06..3c3e9dd7f6a 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsstackedplots.code.tex @@ -402,8 +402,16 @@ \pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro % Will be inserted in one of two possible places below: \def\pgfplots@loc@TMPa{% - \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% - \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds%% + \ifx\pgfplotspointmetainputhandler\pgfutil@empty + % we don't have per-point meta data. Nothing special to + % do: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream@{\E\the\E\c@pgfplots@coordindex}{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds% + \else + % Ok, then we need to process the meta data as well: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream@withmeta@{\E\the\E\c@pgfplots@coordindex}{\E\the\E\pgf@x}{\E\the\E\pgf@y}{\E\pgfplots@current@point@meta}}% + \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds% + \fi }% % This finalize command maps the logical coordinate into PGF's % point space. Furthermore, it collects marker coordinates diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex index 416d888a511..46367c7c43e 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -773,11 +773,14 @@ \csname pgfplots@#1minorgridsfalse\endcsname \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP - \pgfplotsset{/pgfplots/every extra #1 tick}% +% \pgfplotsset{/pgfplots/every extra #1 tick}% + % use a scope here such that line width and draw color can be set. + \scope[/pgfplots/.cd,/pgfplots/every extra #1 tick] \pgfplots@prepare@tick@coordlists@for{#1}{#2}% \pgfplots@drawgridlines@onorientedsurf% \pgfplots@drawticklines@onorientedsurf% \pgfplots@drawticklabels@onorientedsurf% + \endscope \endgroup } diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex index 7229bc36d58..df3f66d0dd7 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsbinary.code.tex @@ -38,286 +38,323 @@ \begingroup % prepare ONE-BYTE conversion [0-255] -> binary character: \count0=0 -\catcode`\^^00=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^00}\advance\count0 by1 -\catcode`\^^01=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^01}\advance\count0 by1 -\catcode`\^^02=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^02}\advance\count0 by1 -\catcode`\^^03=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^03}\advance\count0 by1 -\catcode`\^^04=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^04}\advance\count0 by1 -\catcode`\^^05=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^05}\advance\count0 by1 -\catcode`\^^06=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^06}\advance\count0 by1 -\catcode`\^^07=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^07}\advance\count0 by1 -\catcode`\^^08=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^08}\advance\count0 by1 +\countdef\counter=0 +\catcode`\^^00=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^00}\advance\counter by1 +\catcode`\^^01=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^01}\advance\counter by1 +\catcode`\^^02=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^02}\advance\counter by1 +\catcode`\^^03=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^03}\advance\counter by1 +\catcode`\^^04=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^04}\advance\counter by1 +\catcode`\^^05=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^05}\advance\counter by1 +\catcode`\^^06=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^06}\advance\counter by1 +\catcode`\^^07=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^07}\advance\counter by1 +\catcode`\^^08=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^08}\advance\counter by1 \begingroup -\catcode`\^^09=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^09}\endgroup\advance\count0 by1 +\catcode`\^^09=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^09}\endgroup\advance\counter by1 \begingroup -\catcode`\^^0a=12\expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0a}\endgroup\advance\count0 by1 +\catcode`\^^0a=11\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0a}\endgroup\advance\counter by1 \begingroup -\catcode`\^^0b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0b}\endgroup\advance\count0 by1 -\catcode`\^^0c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0c}\advance\count0 by1 +\catcode`\^^0b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0b}\endgroup\advance\counter by1 +\catcode`\^^0c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0c}\advance\counter by1 \begingroup -\catcode`\^^0d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0d}\endgroup\advance\count0 by1 -\catcode`\^^0e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0e}\advance\count0 by1 -\catcode`\^^0f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^0f}\advance\count0 by1 -\catcode`\^^10=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^10}\advance\count0 by1 -\catcode`\^^11=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^11}\advance\count0 by1 -\catcode`\^^12=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^12}\advance\count0 by1 -\catcode`\^^13=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^13}\advance\count0 by1 -\catcode`\^^14=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^14}\advance\count0 by1 -\catcode`\^^15=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^15}\advance\count0 by1 -\catcode`\^^16=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^16}\advance\count0 by1 -\catcode`\^^17=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^17}\advance\count0 by1 -\catcode`\^^18=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^18}\advance\count0 by1 -\catcode`\^^19=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^19}\advance\count0 by1 -\catcode`\^^1a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1a}\advance\count0 by1 -\catcode`\^^1b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1b}\advance\count0 by1 -\catcode`\^^1c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1c}\advance\count0 by1 -\catcode`\^^1d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1d}\advance\count0 by1 -\catcode`\^^1e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1e}\advance\count0 by1 -\catcode`\^^1f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^1f}\advance\count0 by1 +\catcode`\^^0d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0d}\endgroup\advance\counter by1 +\catcode`\^^0e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0e}\advance\counter by1 +\catcode`\^^0f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0f}\advance\counter by1 +\catcode`\^^10=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^10}\advance\counter by1 +\catcode`\^^11=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^11}\advance\counter by1 +\catcode`\^^12=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^12}\advance\counter by1 +\catcode`\^^13=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^13}\advance\counter by1 +\catcode`\^^14=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^14}\advance\counter by1 +\catcode`\^^15=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^15}\advance\counter by1 +\catcode`\^^16=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^16}\advance\counter by1 +\catcode`\^^17=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^17}\advance\counter by1 +\catcode`\^^18=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^18}\advance\counter by1 +\catcode`\^^19=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^19}\advance\counter by1 +\catcode`\^^1a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1a}\advance\counter by1 +\catcode`\^^1b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1b}\advance\counter by1 +\catcode`\^^1c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1c}\advance\counter by1 +\catcode`\^^1d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1d}\advance\counter by1 +\catcode`\^^1e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1e}\advance\counter by1 +\catcode`\^^1f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1f}\advance\counter by1 \begingroup -\catcode`\^^20=12^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\count0^^I\endcsname{^^20}\endgroup\advance\count0 by1 -\catcode`\^^21=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^21}\advance\count0 by1 -\catcode`\^^22=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^22}\advance\count0 by1 -\catcode`\^^23=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^23}\advance\count0 by1 -\catcode`\^^24=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^24}\advance\count0 by1 -\catcode`\^^25=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^25}\advance\count0 by1 -\catcode`\^^26=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^26}\advance\count0 by1 -\catcode`\^^27=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^27}\advance\count0 by1 -\catcode`\^^28=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^28}\advance\count0 by1 -\catcode`\^^29=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^29}\advance\count0 by1 -\catcode`\^^2a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2a}\advance\count0 by1 -\catcode`\^^2b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2b}\advance\count0 by1 -\catcode`\^^2c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2c}\advance\count0 by1 -\catcode`\^^2d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2d}\advance\count0 by1 -\catcode`\^^2e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2e}\advance\count0 by1 -\catcode`\^^2f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^2f}\advance\count0 by1 -\catcode`\^^30=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^30}\advance\count0 by1 -\catcode`\^^31=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^31}\advance\count0 by1 -\catcode`\^^32=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^32}\advance\count0 by1 -\catcode`\^^33=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^33}\advance\count0 by1 -\catcode`\^^34=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^34}\advance\count0 by1 -\catcode`\^^35=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^35}\advance\count0 by1 -\catcode`\^^36=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^36}\advance\count0 by1 -\catcode`\^^37=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^37}\advance\count0 by1 -\catcode`\^^38=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^38}\advance\count0 by1 -\catcode`\^^39=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^39}\advance\count0 by1 -\catcode`\^^3a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3a}\advance\count0 by1 -\catcode`\^^3b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3b}\advance\count0 by1 -\catcode`\^^3c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3c}\advance\count0 by1 -\catcode`\^^3d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3d}\advance\count0 by1 -\catcode`\^^3e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3e}\advance\count0 by1 -\catcode`\^^3f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^3f}\advance\count0 by1 -\catcode`\^^40=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^40}\advance\count0 by1 -\catcode`\^^41=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^41}\advance\count0 by1 -\catcode`\^^42=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^42}\advance\count0 by1 -\catcode`\^^43=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^43}\advance\count0 by1 -\catcode`\^^44=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^44}\advance\count0 by1 -\catcode`\^^45=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^45}\advance\count0 by1 -\catcode`\^^46=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^46}\advance\count0 by1 -\catcode`\^^47=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^47}\advance\count0 by1 -\catcode`\^^48=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^48}\advance\count0 by1 -\catcode`\^^49=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^49}\advance\count0 by1 -\catcode`\^^4a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4a}\advance\count0 by1 -\catcode`\^^4b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4b}\advance\count0 by1 -\catcode`\^^4c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4c}\advance\count0 by1 -\catcode`\^^4d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4d}\advance\count0 by1 -\catcode`\^^4e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4e}\advance\count0 by1 -\catcode`\^^4f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^4f}\advance\count0 by1 -\catcode`\^^50=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^50}\advance\count0 by1 -\catcode`\^^51=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^51}\advance\count0 by1 -\catcode`\^^52=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^52}\advance\count0 by1 -\catcode`\^^53=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^53}\advance\count0 by1 -\catcode`\^^54=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^54}\advance\count0 by1 -\catcode`\^^55=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^55}\advance\count0 by1 -\catcode`\^^56=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^56}\advance\count0 by1 -\catcode`\^^57=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^57}\advance\count0 by1 -\catcode`\^^58=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^58}\advance\count0 by1 -\catcode`\^^59=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^59}\advance\count0 by1 -\catcode`\^^5a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5a}\advance\count0 by1 -\catcode`\^^5b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5b}\advance\count0 by1 +\catcode`\^^20=11^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\counter^^I\endcsname{^^20}\endgroup\advance\counter by1 +\catcode`\^^21=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^21}\advance\counter by1 +\catcode`\^^22=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^22}\advance\counter by1 +\catcode`\^^23=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^23}\advance\counter by1 +\catcode`\^^24=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^24}\advance\counter by1 +\catcode`\^^25=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^25}\advance\counter by1 +\catcode`\^^26=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^26}\advance\counter by1 +\catcode`\^^27=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^27}\advance\counter by1 +\catcode`\^^28=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^28}\advance\counter by1 +\catcode`\^^29=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^29}\advance\counter by1 +\catcode`\^^2a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2a}\advance\counter by1 +\catcode`\^^2b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2b}\advance\counter by1 +\catcode`\^^2c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2c}\advance\counter by1 +\catcode`\^^2d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2d}\advance\counter by1 +\catcode`\^^2e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2e}\advance\counter by1 +\catcode`\^^2f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2f}\advance\counter by1 +\begingroup +\catcode`\^^30=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^30}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^31=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^31}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^32=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^32}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^33=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^33}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^34=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^34}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^35=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^35}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^36=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^36}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^37=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^37}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^38=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^38}\endgroup\advance\counter by1 +\begingroup +\catcode`\^^39=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^39}\endgroup\advance\counter by1 +\catcode`\^^3a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3a}\advance\counter by1 +\catcode`\^^3b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3b}\advance\counter by1 +\catcode`\^^3c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3c}\advance\counter by1 +\begingroup +\catcode`\^^3d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3d}\endgroup\advance\counter by1 +\catcode`\^^3e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3e}\advance\counter by1 +\catcode`\^^3f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3f}\advance\counter by1 +\catcode`\^^40=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^40}\advance\counter by1 +\catcode`\^^41=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^41}\advance\counter by1 +\catcode`\^^42=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^42}\advance\counter by1 +\catcode`\^^43=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^43}\advance\counter by1 +\catcode`\^^44=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^44}\advance\counter by1 +\catcode`\^^45=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^45}\advance\counter by1 +\catcode`\^^46=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^46}\advance\counter by1 +\catcode`\^^47=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^47}\advance\counter by1 +\catcode`\^^48=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^48}\advance\counter by1 +\catcode`\^^49=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^49}\advance\counter by1 +\catcode`\^^4a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4a}\advance\counter by1 +\catcode`\^^4b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4b}\advance\counter by1 +\catcode`\^^4c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4c}\advance\counter by1 +\catcode`\^^4d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4d}\advance\counter by1 +\catcode`\^^4e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4e}\advance\counter by1 +\catcode`\^^4f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4f}\advance\counter by1 +\catcode`\^^50=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^50}\advance\counter by1 +\catcode`\^^51=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^51}\advance\counter by1 +\catcode`\^^52=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^52}\advance\counter by1 +\catcode`\^^53=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^53}\advance\counter by1 +\catcode`\^^54=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^54}\advance\counter by1 +\catcode`\^^55=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^55}\advance\counter by1 +\catcode`\^^56=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^56}\advance\counter by1 +\catcode`\^^57=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^57}\advance\counter by1 +\catcode`\^^58=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^58}\advance\counter by1 +\catcode`\^^59=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^59}\advance\counter by1 +\catcode`\^^5a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5a}\advance\counter by1 +\catcode`\^^5b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5b}\advance\counter by1 \begingroup \catcode`\|=0 -\catcode`\\=12 |expandafter|xdef|csname pgfp@bin@|the|count0 |endcsname{^^5c}|endgroup\advance\count0 by1 -\catcode`\^^5d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5d}\advance\count0 by1 +\catcode`\\=11 |expandafter|xdef|csname pgfp@bin@|the|counter|endcsname{^^5c}|endgroup \advance\counter by1 +\catcode`\^^5d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5d}\advance\counter by1 +\begingroup +\catcode`\^^5e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^}\endgroup\advance\counter by1 +\catcode`\^^5f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5f}\advance\counter by1 \begingroup -\catcode`\^^5e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^}\endgroup\advance\count0 by1 -\catcode`\^^5f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^5f}\advance\count0 by1 -\catcode`\^^60=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^60}\advance\count0 by1 -\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^61}\advance\count0 by1 -\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^62}\advance\count0 by1 -\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^63}\advance\count0 by1 -\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^64}\advance\count0 by1 -\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^65}\advance\count0 by1 -\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^66}\advance\count0 by1 -\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^67}\advance\count0 by1 -\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^68}\advance\count0 by1 -\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^69}\advance\count0 by1 -\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6a}\advance\count0 by1 -\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6b}\advance\count0 by1 -\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6c}\advance\count0 by1 -\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6d}\advance\count0 by1 -\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6e}\advance\count0 by1 -\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^6f}\advance\count0 by1 -\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^70}\advance\count0 by1 -\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^71}\advance\count0 by1 -\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^72}\advance\count0 by1 -\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^73}\advance\count0 by1 -\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^74}\advance\count0 by1 -\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^75}\advance\count0 by1 -\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^76}\advance\count0 by1 -\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^77}\advance\count0 by1 -\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^78}\advance\count0 by1 -\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^79}\advance\count0 by1 -\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7a}\advance\count0 by1 +\catcode`\^^60=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^60}\endgroup\advance\counter by1 +\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^61}\advance\counter by1 +\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^62}\advance\counter by1 +\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^63}\advance\counter by1 +\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^64}\advance\counter by1 +\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^65}\advance\counter by1 +\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^66}\advance\counter by1 +\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^67}\advance\counter by1 +\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^68}\advance\counter by1 +\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^69}\advance\counter by1 +\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6a}\advance\counter by1 +\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6b}\advance\counter by1 +\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6c}\advance\counter by1 +\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6d}\advance\counter by1 +\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6e}\advance\counter by1 +\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6f}\advance\counter by1 +\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^70}\advance\counter by1 +\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^71}\advance\counter by1 +\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^72}\advance\counter by1 +\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^73}\advance\counter by1 +\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^74}\advance\counter by1 +\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^75}\advance\counter by1 +\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^76}\advance\counter by1 +\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^77}\advance\counter by1 +\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^78}\advance\counter by1 +\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^79}\advance\counter by1 +\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7a}\advance\counter by1 \begingroup \catcode`\q=1 -\catcode`\^^7b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname q^^7b}\endgroup\advance\count0 by1 -\catcode`\^^7c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7c}\advance\count0 by1 +\catcode`\^^7b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname q^^7b}\endgroup\advance\counter by1 +\catcode`\^^7c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7c}\advance\counter by1 \begingroup \catcode`\q=2 -\catcode`\^^7d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7dq\endgroup\advance\count0 by1 -\catcode`\^^7e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7e}\advance\count0 by1 -\catcode`\^^7f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^7f}\advance\count0 by1 -\catcode`\^^80=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^80}\advance\count0 by1 -\catcode`\^^81=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^81}\advance\count0 by1 -\catcode`\^^82=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^82}\advance\count0 by1 -\catcode`\^^83=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^83}\advance\count0 by1 -\catcode`\^^84=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^84}\advance\count0 by1 -\catcode`\^^85=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^85}\advance\count0 by1 -\catcode`\^^86=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^86}\advance\count0 by1 -\catcode`\^^87=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^87}\advance\count0 by1 -\catcode`\^^88=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^88}\advance\count0 by1 -\catcode`\^^89=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^89}\advance\count0 by1 -\catcode`\^^8a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8a}\advance\count0 by1 -\catcode`\^^8b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8b}\advance\count0 by1 -\catcode`\^^8c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8c}\advance\count0 by1 -\catcode`\^^8d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8d}\advance\count0 by1 -\catcode`\^^8e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8e}\advance\count0 by1 -\catcode`\^^8f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^8f}\advance\count0 by1 -\catcode`\^^90=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^90}\advance\count0 by1 -\catcode`\^^91=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^91}\advance\count0 by1 -\catcode`\^^92=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^92}\advance\count0 by1 -\catcode`\^^93=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^93}\advance\count0 by1 -\catcode`\^^94=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^94}\advance\count0 by1 -\catcode`\^^95=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^95}\advance\count0 by1 -\catcode`\^^96=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^96}\advance\count0 by1 -\catcode`\^^97=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^97}\advance\count0 by1 -\catcode`\^^98=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^98}\advance\count0 by1 -\catcode`\^^99=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^99}\advance\count0 by1 -\catcode`\^^9a=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9a}\advance\count0 by1 -\catcode`\^^9b=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9b}\advance\count0 by1 -\catcode`\^^9c=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9c}\advance\count0 by1 -\catcode`\^^9d=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9d}\advance\count0 by1 -\catcode`\^^9e=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9e}\advance\count0 by1 -\catcode`\^^9f=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^9f}\advance\count0 by1 -\catcode`\^^a0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a0}\advance\count0 by1 -\catcode`\^^a1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a1}\advance\count0 by1 -\catcode`\^^a2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a2}\advance\count0 by1 -\catcode`\^^a3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a3}\advance\count0 by1 -\catcode`\^^a4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a4}\advance\count0 by1 -\catcode`\^^a5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a5}\advance\count0 by1 -\catcode`\^^a6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a6}\advance\count0 by1 -\catcode`\^^a7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a7}\advance\count0 by1 -\catcode`\^^a8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a8}\advance\count0 by1 -\catcode`\^^a9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^a9}\advance\count0 by1 -\catcode`\^^aa=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^aa}\advance\count0 by1 -\catcode`\^^ab=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ab}\advance\count0 by1 -\catcode`\^^ac=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ac}\advance\count0 by1 -\catcode`\^^ad=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ad}\advance\count0 by1 -\catcode`\^^ae=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ae}\advance\count0 by1 -\catcode`\^^af=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^af}\advance\count0 by1 -\catcode`\^^b0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b0}\advance\count0 by1 -\catcode`\^^b1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b1}\advance\count0 by1 -\catcode`\^^b2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b2}\advance\count0 by1 -\catcode`\^^b3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b3}\advance\count0 by1 -\catcode`\^^b4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b4}\advance\count0 by1 -\catcode`\^^b5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b5}\advance\count0 by1 -\catcode`\^^b6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b6}\advance\count0 by1 -\catcode`\^^b7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b7}\advance\count0 by1 -\catcode`\^^b8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b8}\advance\count0 by1 -\catcode`\^^b9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^b9}\advance\count0 by1 -\catcode`\^^ba=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ba}\advance\count0 by1 -\catcode`\^^bb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bb}\advance\count0 by1 -\catcode`\^^bc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bc}\advance\count0 by1 -\catcode`\^^bd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bd}\advance\count0 by1 -\catcode`\^^be=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^be}\advance\count0 by1 -\catcode`\^^bf=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^bf}\advance\count0 by1 -\catcode`\^^c0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c0}\advance\count0 by1 -\catcode`\^^c1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c1}\advance\count0 by1 -\catcode`\^^c2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c2}\advance\count0 by1 -\catcode`\^^c3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c3}\advance\count0 by1 -\catcode`\^^c4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c4}\advance\count0 by1 -\catcode`\^^c5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c5}\advance\count0 by1 -\catcode`\^^c6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c6}\advance\count0 by1 -\catcode`\^^c7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c7}\advance\count0 by1 -\catcode`\^^c8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c8}\advance\count0 by1 -\catcode`\^^c9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^c9}\advance\count0 by1 -\catcode`\^^ca=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ca}\advance\count0 by1 -\catcode`\^^cb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cb}\advance\count0 by1 -\catcode`\^^cc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cc}\advance\count0 by1 -\catcode`\^^cd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cd}\advance\count0 by1 -\catcode`\^^ce=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ce}\advance\count0 by1 -\catcode`\^^cf=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^cf}\advance\count0 by1 -\catcode`\^^d0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d0}\advance\count0 by1 -\catcode`\^^d1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d1}\advance\count0 by1 -\catcode`\^^d2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d2}\advance\count0 by1 -\catcode`\^^d3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d3}\advance\count0 by1 -\catcode`\^^d4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d4}\advance\count0 by1 -\catcode`\^^d5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d5}\advance\count0 by1 -\catcode`\^^d6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d6}\advance\count0 by1 -\catcode`\^^d7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d7}\advance\count0 by1 -\catcode`\^^d8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d8}\advance\count0 by1 -\catcode`\^^d9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^d9}\advance\count0 by1 -\catcode`\^^da=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^da}\advance\count0 by1 -\catcode`\^^db=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^db}\advance\count0 by1 -\catcode`\^^dc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^dc}\advance\count0 by1 -\catcode`\^^dd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^dd}\advance\count0 by1 -\catcode`\^^de=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^de}\advance\count0 by1 -\catcode`\^^df=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^df}\advance\count0 by1 -\catcode`\^^e0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e0}\advance\count0 by1 -\catcode`\^^e1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e1}\advance\count0 by1 -\catcode`\^^e2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e2}\advance\count0 by1 -\catcode`\^^e3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e3}\advance\count0 by1 -\catcode`\^^e4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e4}\advance\count0 by1 -\catcode`\^^e5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e5}\advance\count0 by1 -\catcode`\^^e6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e6}\advance\count0 by1 -\catcode`\^^e7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e7}\advance\count0 by1 -\catcode`\^^e8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e8}\advance\count0 by1 -\catcode`\^^e9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^e9}\advance\count0 by1 -\catcode`\^^ea=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ea}\advance\count0 by1 -\catcode`\^^eb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^eb}\advance\count0 by1 -\catcode`\^^ec=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ec}\advance\count0 by1 -\catcode`\^^ed=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ed}\advance\count0 by1 -\catcode`\^^ee=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ee}\advance\count0 by1 -\catcode`\^^ef=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ef}\advance\count0 by1 -\catcode`\^^f0=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f0}\advance\count0 by1 -\catcode`\^^f1=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f1}\advance\count0 by1 -\catcode`\^^f2=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f2}\advance\count0 by1 -\catcode`\^^f3=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f3}\advance\count0 by1 -\catcode`\^^f4=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f4}\advance\count0 by1 -\catcode`\^^f5=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f5}\advance\count0 by1 -\catcode`\^^f6=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f6}\advance\count0 by1 -\catcode`\^^f7=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f7}\advance\count0 by1 -\catcode`\^^f8=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f8}\advance\count0 by1 -\catcode`\^^f9=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^f9}\advance\count0 by1 -\catcode`\^^fa=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fa}\advance\count0 by1 -\catcode`\^^fb=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fb}\advance\count0 by1 -\catcode`\^^fc=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fc}\advance\count0 by1 -\catcode`\^^fd=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fd}\advance\count0 by1 -\catcode`\^^fe=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^fe}\advance\count0 by1 -\catcode`\^^ff=12 \expandafter\xdef\csname pgfp@bin@\the\count0 \endcsname{^^ff}\advance\count0 by1 -\ifnum\count0=256 +\catcode`\^^7d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7dq\endgroup\advance\counter by1 +\catcode`\^^7e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7e}\advance\counter by1 +\catcode`\^^7f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7f}\advance\counter by1 +\catcode`\^^80=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^80}\advance\counter by1 +\catcode`\^^81=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^81}\advance\counter by1 +\catcode`\^^82=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^82}\advance\counter by1 +\catcode`\^^83=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^83}\advance\counter by1 +\catcode`\^^84=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^84}\advance\counter by1 +\catcode`\^^85=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^85}\advance\counter by1 +\catcode`\^^86=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^86}\advance\counter by1 +\catcode`\^^87=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^87}\advance\counter by1 +\catcode`\^^88=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^88}\advance\counter by1 +\catcode`\^^89=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^89}\advance\counter by1 +\catcode`\^^8a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8a}\advance\counter by1 +\catcode`\^^8b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8b}\advance\counter by1 +\catcode`\^^8c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8c}\advance\counter by1 +\catcode`\^^8d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8d}\advance\counter by1 +\catcode`\^^8e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8e}\advance\counter by1 +\catcode`\^^8f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8f}\advance\counter by1 +\catcode`\^^90=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^90}\advance\counter by1 +\catcode`\^^91=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^91}\advance\counter by1 +\catcode`\^^92=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^92}\advance\counter by1 +\catcode`\^^93=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^93}\advance\counter by1 +\catcode`\^^94=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^94}\advance\counter by1 +\catcode`\^^95=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^95}\advance\counter by1 +\catcode`\^^96=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^96}\advance\counter by1 +\catcode`\^^97=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^97}\advance\counter by1 +\catcode`\^^98=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^98}\advance\counter by1 +\catcode`\^^99=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^99}\advance\counter by1 +\catcode`\^^9a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9a}\advance\counter by1 +\catcode`\^^9b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9b}\advance\counter by1 +\catcode`\^^9c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9c}\advance\counter by1 +\catcode`\^^9d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9d}\advance\counter by1 +\catcode`\^^9e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9e}\advance\counter by1 +\catcode`\^^9f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9f}\advance\counter by1 +\catcode`\^^a0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a0}\advance\counter by1 +\catcode`\^^a1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a1}\advance\counter by1 +\catcode`\^^a2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a2}\advance\counter by1 +\catcode`\^^a3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a3}\advance\counter by1 +\catcode`\^^a4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a4}\advance\counter by1 +\catcode`\^^a5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a5}\advance\counter by1 +\catcode`\^^a6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a6}\advance\counter by1 +\catcode`\^^a7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a7}\advance\counter by1 +\catcode`\^^a8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a8}\advance\counter by1 +\catcode`\^^a9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a9}\advance\counter by1 +\catcode`\^^aa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^aa}\advance\counter by1 +\catcode`\^^ab=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ab}\advance\counter by1 +\catcode`\^^ac=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ac}\advance\counter by1 +\catcode`\^^ad=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ad}\advance\counter by1 +\catcode`\^^ae=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ae}\advance\counter by1 +\catcode`\^^af=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^af}\advance\counter by1 +\catcode`\^^b0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b0}\advance\counter by1 +\catcode`\^^b1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b1}\advance\counter by1 +\catcode`\^^b2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b2}\advance\counter by1 +\catcode`\^^b3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b3}\advance\counter by1 +\catcode`\^^b4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b4}\advance\counter by1 +\catcode`\^^b5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b5}\advance\counter by1 +\catcode`\^^b6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b6}\advance\counter by1 +\catcode`\^^b7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b7}\advance\counter by1 +\catcode`\^^b8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b8}\advance\counter by1 +\catcode`\^^b9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b9}\advance\counter by1 +\catcode`\^^ba=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ba}\advance\counter by1 +\catcode`\^^bb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bb}\advance\counter by1 +\catcode`\^^bc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bc}\advance\counter by1 +\catcode`\^^bd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bd}\advance\counter by1 +\catcode`\^^be=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^be}\advance\counter by1 +\catcode`\^^bf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bf}\advance\counter by1 +\catcode`\^^c0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c0}\advance\counter by1 +\catcode`\^^c1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c1}\advance\counter by1 +\catcode`\^^c2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c2}\advance\counter by1 +\catcode`\^^c3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c3}\advance\counter by1 +\catcode`\^^c4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c4}\advance\counter by1 +\catcode`\^^c5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c5}\advance\counter by1 +\catcode`\^^c6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c6}\advance\counter by1 +\catcode`\^^c7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c7}\advance\counter by1 +\catcode`\^^c8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c8}\advance\counter by1 +\catcode`\^^c9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c9}\advance\counter by1 +\catcode`\^^ca=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ca}\advance\counter by1 +\catcode`\^^cb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cb}\advance\counter by1 +\catcode`\^^cc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cc}\advance\counter by1 +\catcode`\^^cd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cd}\advance\counter by1 +\catcode`\^^ce=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ce}\advance\counter by1 +\catcode`\^^cf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cf}\advance\counter by1 +\catcode`\^^d0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d0}\advance\counter by1 +\catcode`\^^d1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d1}\advance\counter by1 +\catcode`\^^d2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d2}\advance\counter by1 +\catcode`\^^d3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d3}\advance\counter by1 +\catcode`\^^d4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d4}\advance\counter by1 +\catcode`\^^d5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d5}\advance\counter by1 +\catcode`\^^d6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d6}\advance\counter by1 +\catcode`\^^d7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d7}\advance\counter by1 +\catcode`\^^d8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d8}\advance\counter by1 +\catcode`\^^d9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d9}\advance\counter by1 +\catcode`\^^da=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^da}\advance\counter by1 +\catcode`\^^db=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^db}\advance\counter by1 +\catcode`\^^dc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dc}\advance\counter by1 +\catcode`\^^dd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dd}\advance\counter by1 +\catcode`\^^de=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^de}\advance\counter by1 +\catcode`\^^df=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^df}\advance\counter by1 +\catcode`\^^e0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e0}\advance\counter by1 +\catcode`\^^e1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e1}\advance\counter by1 +\catcode`\^^e2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e2}\advance\counter by1 +\catcode`\^^e3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e3}\advance\counter by1 +\catcode`\^^e4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e4}\advance\counter by1 +\catcode`\^^e5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e5}\advance\counter by1 +\catcode`\^^e6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e6}\advance\counter by1 +\catcode`\^^e7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e7}\advance\counter by1 +\catcode`\^^e8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e8}\advance\counter by1 +\catcode`\^^e9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e9}\advance\counter by1 +\catcode`\^^ea=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ea}\advance\counter by1 +\catcode`\^^eb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^eb}\advance\counter by1 +\catcode`\^^ec=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ec}\advance\counter by1 +\catcode`\^^ed=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ed}\advance\counter by1 +\catcode`\^^ee=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ee}\advance\counter by1 +\catcode`\^^ef=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ef}\advance\counter by1 +\catcode`\^^f0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f0}\advance\counter by1 +\catcode`\^^f1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f1}\advance\counter by1 +\catcode`\^^f2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f2}\advance\counter by1 +\catcode`\^^f3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f3}\advance\counter by1 +\catcode`\^^f4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f4}\advance\counter by1 +\catcode`\^^f5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f5}\advance\counter by1 +\catcode`\^^f6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f6}\advance\counter by1 +\catcode`\^^f7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f7}\advance\counter by1 +\catcode`\^^f8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f8}\advance\counter by1 +\catcode`\^^f9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f9}\advance\counter by1 +\catcode`\^^fa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fa}\advance\counter by1 +\catcode`\^^fb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fb}\advance\counter by1 +\catcode`\^^fc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fc}\advance\counter by1 +\catcode`\^^fd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fd}\advance\counter by1 +\catcode`\^^fe=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fe}\advance\counter by1 +\catcode`\^^ff=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ff}\advance\counter by1 +\ifnum\counter=256 \else - \pgfplots@error{Internal logic Error: initialisation failed. I have only \the\count0\space bytes initialised.} + \pgfplots@error{Internal logic Error: initialisation failed. I have only \the\counter\space bytes initialised.} \fi \endgroup -% Returns a single character (with catcode 11 or 12), which has the -% binary code '#1'. +% Returns a single character, which has the +% binary ASCII code '#1', with catcode 11. +% +% #1 (expands to) a number between 0 and 255 (inclusive). % -% #1 is a number between 0 and 255 (inclusive). +% @see \pgfplotsgetchar Note that \pgfplotsgetchar is more powerful, +% but can't be used inside of \edef (it is not expandable) whereas +% \pgfplotscharno is. \def\pgfplotscharno#1{\csname pgfp@bin@#1\endcsname}% +% Defines \pgfplotsretval to be the ASCII character for #1, with +% catcode 11. +% +% #1: either a number between 0 and 255 (inclusive) or a description +% of the character. +% +% Examples: +% \pgfplotsgetchar{35} +% \pgfplotsgetchar{`\#} % code for '#' +% \pgfplotsgetchar{`\^^M} % Newline +% \pgfplotsgetchar{`\^^ff}% 255 +% +% @see \pgfplotscharno +\def\pgfplotsgetchar#1{% + \begingroup + \count0=#1\relax + \edef\pgfplotsretval{\csname pgfp@bin@\the\count0 \endcsname}% + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% \def\pgfplotsbinary@apphighorderbytes@BIGENDIAN#1{\xdef\pgfplotsbinaryresult{#1\pgfplotsbinaryresult}}% \def\pgfplotsbinary@apphighorderbytes@LITTLEENDIAN#1{\xdef\pgfplotsbinaryresult{\pgfplotsbinaryresult#1}}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex index 290fbfe9292..b1496a8fc1b 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex @@ -56,6 +56,7 @@ \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MIN % PARSE IT: \edef\pgfplots@loc@TMPa{#2}% + \let\pgfplots@createcolormap@context=\pgfutil@empty % this does also init @H: \expandafter\pgfplots@createcolormap@startloop\pgfplots@loc@TMPa\pgfplots@EOI \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% @@ -77,6 +78,7 @@ %\pgfplots@colormap@showdebuginfofor{#1}% } \def\pgfplots@createcolormap@seth[#1]{% + \def\pgfplots@createcolormap@context{[#1]}% \pgfmathparse{#1}% \let\pgfplots@createcolormap@H=\pgfmathresult \pgfplots@createcolormap@ @@ -102,13 +104,20 @@ \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabcolor}% { \expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}% - {\pgfplots@error{Illformed colormap specification}}% + {\pgfplots@createcolormap@error}% }% }% }% }% }% } +\def\pgfplots@createcolormap@error#1#2\pgfplots@EOI{% + {% + \t@pgfplots@toka={#1#2}% + \t@pgfplots@tokb={#1}% + \pgfplots@error{Illformed colormap specification: I could not read the substring `\the\t@pgfplots@toka' starting at `\the\t@pgfplots@tokb'}% + }% +}% \def\pgfplots@createcolormap@grabsemicolon;{\pgfplots@createcolormap@}% { @@ -147,6 +156,7 @@ }% } \def\pgfplots@createcolormap@grabrgb@(#1)=(#2,#3,#4){% + \def\pgfplots@createcolormap@context{rgb(#1)=(#2,#3,#4)}% \pgfplots@createcolormap@nextRGB{#1}{#2}{#3}{#4}% \pgfplots@createcolormap@} \def\pgfplots@createcolormap@grabrgb@two@five@five@rescale#1{% @@ -157,6 +167,7 @@ \pgfplots@createcolormap@next } \def\pgfplots@createcolormap@grabrgb@two@five@five@(#1)=(#2,#3,#4){% + \def\pgfplots@createcolormap@context{rgb255(#1)=(#2,#3,#4)}% \pgfplots@createcolormap@grabrgb@two@five@five@rescale{#2}% \let\pgfplots@loc@TMPa=\pgfmathresult \pgfplots@createcolormap@grabrgb@two@five@five@rescale{#3}% @@ -171,6 +182,7 @@ \pgfplots@createcolormap@next }% \def\pgfplots@createcolormap@grabgray@(#1)=(#2){% + \def\pgfplots@createcolormap@context{gray(#1)=(#2)}% \pgfplots@createcolormap@nextRGB{#1}{#2}{#2}{#2}% \pgfplots@createcolormap@} \def\pgfplots@createcolormap@grabcolor color{% @@ -178,6 +190,7 @@ \pgfplots@createcolormap@next }% \def\pgfplots@createcolormap@grabcolor@(#1)=(#2){% + \def\pgfplots@createcolormap@context{color(#1)=(#2)}% \pgfutil@colorlet{pgf@tempcol}{#2}% \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% @@ -186,7 +199,7 @@ \pgfplots@createcolormap@nextRGB{#4}{#1}{#2}{#3}% \pgfplots@createcolormap@} \def\pgfplots@createcolormap@rgbrangeexception#1#2#3{% - \pgfplots@error{Sorry, RGB[#1,#2,#3] is not supported. The allowed range is 0 <= r,g,b <= 1.}% + \pgfplots@error{Sorry, RGB[#1,#2,#3] is not supported. The allowed range is 0 <= r,g,b <= 1. The error occured near `\pgfplots@createcolormap@context'}% }% % Ok, we parsed the next single spec. % #1: the width @@ -222,7 +235,7 @@ \ifpgfplotsarrayempty \ifdim\pgfplots@createcolormap@MAX pt=0pt \else - \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt.}% + \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt. The error occured near `\pgfplots@createcolormap@context'}% \def\pgfplots@createcolormap@MAX{0}% \fi \else @@ -243,9 +256,8 @@ \c@pgf@counta=\pgfmathresult\relax \pgfmath@smuggleone\pgfmathresult \endgroup - \if\pgfmathresult\pgfutil@empty + \ifx\pgfmathresult\pgfutil@empty % I can't do that yet. - \pgfplots@error{Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the mesh width h=\pgfplots@createcolormap@H pt. Perhaps it helps to provide the mesh widths as argument as in {<name>}{[1cm] <color arguments>}?}% \else \let\pgfplots@loc@TMPb=\pgfmathresult % interpolate missing values using the already fixed H. @@ -253,7 +265,7 @@ % only in forward direction - but it works at least. % For the backwards direction, you can provide the % meshwidth explicitly at - % \pgfplotscreatecolormap[h]{}{} + % \pgfplotscreatecolormap{}{[1pt]} \pgfplotsforeachungrouped \c@pgfplots@createcolormap in {1,2,...,\pgfplots@loc@TMPb} {% \ifdim\c@pgfplots@createcolormap pt=\pgfplots@loc@TMPb pt % omit the last. @@ -280,10 +292,27 @@ \edef\pgfplots@createcolormap@lastB{#4}% }% \def\pgfplots@createcolormap@nextRGB@consider@reinterpolation#1\relax{% - \ifdim#1pt<0.0005pt - \edef\pgfmathresult{\the\c@pgf@counta}% - \else + \pgf@xa=#1pt + \ifdim\pgf@xa>0.5pt % we have something like 99.995 or so. + % round up and compute 1 - #1: + \advance\c@pgf@counta by1 + \pgf@xa=1pt \advance\pgf@xa by-#1pt + \fi + % + % compute relative error: + \pgf@xb=\the\c@pgf@counta pt + \divide\pgf@xb by10000 +%\message{Checking H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space: \the\pgf@xa > \the\pgf@xb\space (relative to \the\c@pgf@counta)?}% + % + \ifdim\pgf@xa>\pgf@xb + \pgfplots@error{Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the mesh width h=\pgfplots@createcolormap@H pt (but I found one with H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space which is no integer). Perhaps it helps to provide the mesh widths as argument as in {<name>}{[1cm] <color arguments>}? The error occured near `\pgfplots@createcolormap@context'}% \let\pgfmathresult=\pgfutil@empty + \else + \ifnum\c@pgf@counta=0 + \let\pgfmathresult=\pgfutil@empty + \else + \edef\pgfmathresult{\the\c@pgf@counta}% + \fi \fi }% @@ -312,20 +341,23 @@ % #2: a macro name \def\pgfplotscolormapserializetomacro#1#2{% \begingroup - \pgfplotslistnewempty\pgfplots@serialize@list + \pgfplotsapplistXnewempty\pgfplots@serialize@list@ \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{% - \expandafter\pgfplotslistpushback\elem\to\pgfplots@serialize@list + \expandafter\pgfplotsapplistXpushback\expandafter{\elem},\to\pgfplots@serialize@list@ }% + \pgfplotsapplistXlet\pgfplots@serialize@list=\pgfplots@serialize@list@ \toks0={\expandafter\def\csname pgfpl@cm@#1@h\endcsname}% \toks1={\expandafter\def\csname pgfpl@cm@#1@invh\endcsname}% \toks2={% \pgfplotsarraynewempty{pgfpl@cm@#1}% - \pgfplotslistforeachungrouped\pgfplots@loc@TMPa\as\pgfplots@loc@TMPb{% - \expandafter\pgfplotsarraypushback\pgfplots@loc@TMPb\to{pgfpl@cm@#1}% + \expandafter\pgfplotsutilforeachcommasep\pgfplots@loc@TMPa\as\pgfplots@loc@TMPb{% + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \else + \expandafter\pgfplotsarraypushback\pgfplots@loc@TMPb\to{pgfpl@cm@#1}% + \fi }% }% \toks3=\expandafter{\pgfplots@serialize@list}% - \t@pgfplots@toka=\expandafter{\pgfplots@serialize@list}% \xdef\pgfplots@glob@TMPa{% \the\toks0 {\csname pgfpl@cm@#1@h\endcsname}% \the\toks1 {\csname pgfpl@cm@#1@invh\endcsname}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex index 97260a1dae9..60df282f8bb 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex @@ -65,18 +65,16 @@ % 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 +\def\pgfplots@check@backwards@compatible@list@format#1\pgfplots@EOI{% + \pgfplotslist@check@backslash@list#1\pgfplotslist@EOI + \ifpgfplotslist@is@backslash@terminated \pgfplots@is@old@list@formattrue + \else + \pgfplots@is@old@list@formatfalse \fi }% @@ -149,7 +147,7 @@ }% -% Converts an arbitrary command to a string in which all characters +% Converts an arbitrary command (without arguments) to a string in which all characters % have category 12. % % #1: a macro name (which takes no arguments) @@ -164,6 +162,30 @@ \def#2{#1}% }% +% As \pgfplots@command@to@string, but it works for commands accepting +% arguments. More precisely, #2 will be a string (!) of the form +% <argument pattern>{ <body> } +% such that you can write +% \def\test #2 +% into a file to restore the original macro. This IGNORES \long +% (sorry) +\def\pgfplots@command@with@args@to@string#1#2{% + \expandafter\PGFPLOTS@CS@WITH@ARGS@TO@STRING\meaning#1\EOI{#2}% +}% +{ +\let\CATCODE=\catcode +\let\LONG=\long +\CATCODE`\m=12 +\CATCODE`\a=12 +\CATCODE`\c=12 +\CATCODE`\r=12 +\CATCODE`\o=12 +\CATCODE`\:=12 +\CATCODE`\-=12 +\CATCODE`\>=12 +\LONG\gdef\PGFPLOTS@CS@WITH@ARGS@TO@STRING #1macro:#2->#3\EOI#4{\def#4{#2{#3}}}% +}% + % Defines \pgfplotsretval to be '#1' but without leading and trailing % spaces. \def\pgfplotsutil@trim#1{% @@ -211,7 +233,9 @@ { \catcode`\%=12 \gdef\pgfplots@PERCENT@TEXT{%} -} +\catcode`\^^I=12 +\gdef\pgfplots@TAB{^^I} +\catcode`\#=12 \gdef\pgfplots@ROUTE{#}} % Usage: % \pgfplots@if{pgfplots@scaled@ticks}{true-code}{false-code} @@ -402,8 +426,18 @@ % related. % % @see \pgfplotsqpointxy@orthogonal -\let\pgfplotsqpointxy=\pgfqpointxy -\let\pgfplotsqpointxyz=\pgfqpointxyz +\def\pgfplotsqpointxy#1#2{% + \global\pgf@x=#1\pgf@xx% + \global\advance\pgf@x by #2\pgf@yx% + \global\pgf@y=#1\pgf@xy% + \global\advance\pgf@y by #2\pgf@yy} +\def\pgfplotsqpointxyz#1#2#3{% + \global\pgf@x=#1\pgf@xx% + \global\advance\pgf@x by #2\pgf@yx% + \global\advance\pgf@x by #3\pgf@zx% + \global\pgf@y=#1\pgf@xy% + \global\advance\pgf@y by #2\pgf@yy% + \global\advance\pgf@y by #3\pgf@zy} % A "quick" quick variant of \pgfqpointxy which assumes that % the X unit vector is ( e_xx,0 )^T and the Y unit vector is ( 0, @@ -412,8 +446,8 @@ % In words, the unit vectors are orthogonal. This is the usual case % for two-dimensional plots and shall be optimized. \def\pgfplotsqpointxy@orthogonal#1#2{% - \pgf@x=#1\pgf@xx% - \pgf@y=#2\pgf@yy} + \global\pgf@x=#1\pgf@xx% + \global\pgf@y=#2\pgf@yy} % Takes a domain as input and generates a foreach argument which @@ -785,6 +819,15 @@ \def\pgfplots@logfileopen#1{% \immediate\write-1{PGFPlots: reading {#1}}% + \pgfutil@ifundefined{tikzifexternalizingcurrent}{% + % version not up-to-date!? + }{% + % adjust the .dep file only if we are externalizing. + % Otherwise, it may be overwritten by \pgfplotstableread + % commands which are *before* the tikzpicture (and the picture + % will be replaced by its graphics) + \tikzifexternalizingcurrent{\tikzpicturedependsonfile{#1}}{}% + }% }% % Expands #2 using \edef and invokes #1 with the resulting string. @@ -857,6 +900,74 @@ \fi }% +% String comparison of '#1' and '#2'. +% Defines +% \pgfplotsretval=0 if #1 == #2 +% \pgfplotsretval=1 if #1 < #2 +% \pgfplotsretval=2 if #1 > #2 +\def\pgfplotsutilstrcmp#1#2{% + \begingroup + \def\pgfplots@strcmp@arga{#1}% + \pgfplots@command@to@string\pgfplots@strcmp@arga\pgfplots@strcmp@arga + \def\pgfplots@strcmp@argb{#2}% + \pgfplots@command@to@string\pgfplots@strcmp@argb\pgfplots@strcmp@argb + % + % + \def\pgfplotsretval{0}% + % + \pgfplotsloop{% + \if0\pgfplotsretval + % get next token of arga: + \expandafter\pgfplotsutilstrcmp@popfront\pgfplots@strcmp@arga\relax\relax + \let\pgfplots@strcmp@arga=\pgfplots@strcmp@rest + \let\pgfplots@strcmp@arga@=\pgfplots@strcmp@cur + % + % get next token of argb: + \expandafter\pgfplotsutilstrcmp@popfront\pgfplots@strcmp@argb\relax\relax + \let\pgfplots@strcmp@argb=\pgfplots@strcmp@rest + \let\pgfplots@strcmp@argb@=\pgfplots@strcmp@cur + % + % if one of them is empty: set retval and break loop. + \ifx\pgfplots@strcmp@arga@\pgfplotsutilstrcmp@relaxtext + \ifx\pgfplots@strcmp@argb@\pgfplotsutilstrcmp@relaxtext + \else + \def\pgfplotsretval{1}% + \fi + \pgfplotsloopcontinuefalse + \else + \ifx\pgfplots@strcmp@argb@\pgfplotsutilstrcmp@relaxtext + \def\pgfplotsretval{2}% + \pgfplotsloopcontinuefalse + \else + \pgfplotsloopcontinuetrue + \fi + \fi + \else + \pgfplotsloopcontinuefalse + \fi + }{% + % + \ifnum\expandafter`\pgfplots@strcmp@arga@<\expandafter`\pgfplots@strcmp@argb@ + \def\pgfplotsretval{1}% + \let\pgfplots@strcmp@arga=\pgfutil@empty + \else + \ifnum\expandafter`\pgfplots@strcmp@arga@>\expandafter`\pgfplots@strcmp@argb@ + \def\pgfplotsretval{2}% + \let\pgfplots@strcmp@arga=\pgfutil@empty + \fi + \fi + }% + % + \pgfmath@smuggleone\pgfplotsretval + \endgroup +}% +\def\pgfplotsutilstrcmp@relaxtext{\relax}% +\def\pgfplotsutilstrcmp@popfront#1#2\relax{% + \def\pgfplots@strcmp@cur{#1}% + \def\pgfplots@strcmp@rest{#2}% +}% + + \pgfutil@ifundefined{pgfmathdeclarefunction}{% % BACKWARDS COMPATIBILITY: We have PGF 2.00 : \def\pgfplotsmathdeclarepseudoconstant#1#2{% @@ -876,6 +987,72 @@ }% }% +\def\pgfplotsmathfloatln@#1{% + \pgfmathfloatln@{#1}% +} + +% Defines a macro which computes ln(x)/ln(#2) in float. +% +% #1: a macro name without backslash +% #2: the log base as fixed point number. Maybe the empty string in +% which case the natural log is used. +% +% It will define the macros: +% <macro>##1 -> calls \pgfmathfloatparsenumber and then the '@' variant: +% <macro>@##1 -> expects and returns result in float +% <macro>@tofixed##1 -> expects result in float, returns it in fixed (or an empty string) +% <macro>inv@##1 -> the inverse (exponential) function, expects float, returns float +% % +% <macro>logbase -> the basis as number +% <macro>logofbasefixed -> log(#2) +% <macro>invlogofbasefixed -> 1/log(#2) +% <macro>logofbasefloat -> log(#2) in float +% <macro>invlogofbasefloat -> 1/log(#2) in float +\def\pgfplotsmathdefinemacrolnbase#1#2{% + \expandafter\edef\csname #1logbase\endcsname{#2}% + \expandafter\ifx\csname #1logbase\endcsname\pgfutil@empty + \expandafter\edef\csname #1logbase\endcsname{2.718281828459}% + \expandafter\def\csname #1logofbasefixed\endcsname{1}% + \expandafter\def\csname #1invlogofbasefixed\endcsname{1}% + \else + \pgfmathlog@{\csname #1logbase\endcsname}% + \expandafter\let\csname #1logofbasefixed\endcsname\pgfmathresult% + \expandafter\pgfmath@basic@reciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname #1invlogofbasefixed\endcsname\pgfmathresult% + \fi + % + \pgfmathfloatparsenumber{\csname #1logofbasefixed\endcsname}% + \expandafter\let\csname #1logofbasefloat\endcsname\pgfmathresult% + \pgfmathfloatparsenumber{\csname #1invlogofbasefixed\endcsname}% + \expandafter\let\csname #1invlogofbasefloat\endcsname\pgfmathresult% + % + \expandafter\def\csname #1@tofixed\endcsname##1{% + \pgfmathlog@float{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \expandafter\pgfmath@basic@multiply@\expandafter + {\pgfmathresult}% + {\csname #1invlogofbasefixed\endcsname}% + \fi + }% + \expandafter\def\csname #1@\endcsname##1{% + \expandafter\csname #1@tofixed\endcsname{##1}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi + }% + \expandafter\def\csname #1\endcsname##1{% + \pgfmathfloatparsenumber{##1}% + \csname #1@\endcsname{\pgfmathresult}% + }% + % + \expandafter\def\csname #1inv@\endcsname##1{% + \expandafter\pgfmathfloatmultiply@\expandafter{##1}{\csname #1logofbasefloat\endcsname}% + \pgfmathfloatexp@{\pgfmathresult}% + }% +}% % Usage: % \pgfplotsutilstrreplace{<token>}{<replacement>}{<string>} @@ -915,10 +1092,221 @@ % this command is in pgfplotscore.code.tex: % \pgfplotsiffileexists +% EXPERIMENTAL OPTIMIZATION: +\let\pgfmathparsex@orig=\pgfmathparse +\def\pgfmathparsex#1{% + \begingroup + \message{WORKING ON #1...}% + \tracingmacros=2 \tracingcommands=2 + \let\pgfmath@parse@@@operator\relax + \let\pgfmath@parse@@operator\relax + \let\pgfmath@parse@operator\relax + \let\pgfmath@stack@push@operand\pgfutil@gobble + \let\pgfmath@base=\pgfmath@empty + \let\pgfmath@number=\pgfmath@empty + \let\pgfmath@parse@number@failed=\relax + \edef\pgfmath@expression{#1}% + \expandafter\pgfmathparsex@first\pgfmath@expression\pgfmathparsex@EOI% + \if1\pgfmathparsex@recover@ + \xdef\pgfmathparsex@@{\noexpand\pgfmathparsex@orig{\pgfmath@expression}}% + \else + \xdef\pgfmathparsex@@{\noexpand\def\noexpand\pgfmathresult{\pgfmathresult}}% + \fi + \endgroup + \pgfmathparsex@@ +}% +\def\pgfmathparsex@first#1#2\pgfmathparsex@EOI{% + \def\pgfmath@token@next{#1}% + \pgfmath@parse@number{#2}% +}% +\def\pgfmathparsex@recover{\def\pgfmathparsex@recover@{1}}% +\def\pgfmathparsex@recover@{0}% + + +% compares YYYY-MM-DD < YYYY-MM-DD +% +% \pgfplotsutilifdatelessthan 2010-01-01\cmp 2011-01-01\relax{<true>}{<false>} +\long\def\pgfplotsutilifdatelessthan#1-#2-#3\cmp #4-#5-#6\relax#7#8{% + \long\def\pgfplotsutilifdatelessthan@true{#7}% + \long\def\pgfplotsutilifdatelessthan@false{#8}% + \ifnum#1<#4\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#1>#4\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#2<#5\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#2>#5\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#3<#6\relax + \pgfplotsutilifdatelessthan@true + \else + \pgfplotsutilifdatelessthan@false + \fi + \fi + \fi + \fi + \fi +}% +\long\def\pgfplotsutilifdategreaterthan#1-#2-#3\cmp #4-#5-#6\relax#7#8{% + \long\def\pgfplotsutilifdatelessthan@true{#7}% + \long\def\pgfplotsutilifdatelessthan@false{#8}% + \ifnum#1>#4\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#1<#4\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#2>#5\relax + \pgfplotsutilifdatelessthan@true + \else + \ifnum#2<#5\relax + \pgfplotsutilifdatelessthan@false + \else + \ifnum#3>#6\relax + \pgfplotsutilifdatelessthan@true + \else + \pgfplotsutilifdatelessthan@false + \fi + \fi + \fi + \fi + \fi +}% +\pgfkeys{% + % /pgfplots/iflessthan{#1}{#2}{#3}{#4}: + % #1: arg1 (a macro containing the first argument) + % #2: arg2 (a macro containing the second argument) + % #3: code to invoke in case arg1<arg2 + % #4: code to invoke in case arg1>=arg2 + % the iflessthan method will be invoked within local scopes. + /pgfplots/fixed </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt<##2pt\relax##3\else##4\fi},% + }, + /pgfplots/fixed <, + /pgfplots/fixed >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifdim##1pt>##2pt\relax##3\else##4\fi},% + }, + /pgfplots/int </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1<##2\relax##3\else##4\fi},% + }, + /pgfplots/int >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{\ifnum##1>##2\relax##3\else##4\fi},% + }, + /pgfplots/float </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \pgfmathfloatparsenumber{##1}% + \let\pgfplots@iflt@arga=\pgfmathresult + % + \pgfmathfloatparsenumber{##2}% + \let\pgfplots@iflt@argb=\pgfmathresult + % + \pgfmathfloatlessthan@{\pgfplots@iflt@arga}{\pgfplots@iflt@argb}% + \ifpgfmathfloatcomparison + ##3% + \else + ##4% + \fi + }% + },% + /pgfplots/float >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \pgfmathfloatparsenumber{##1}% + \let\pgfplots@iflt@arga=\pgfmathresult + % + \pgfmathfloatparsenumber{##2}% + \let\pgfplots@iflt@argb=\pgfmathresult + % + \pgfmathfloatgreaterthan@{\pgfplots@iflt@arga}{\pgfplots@iflt@argb}% + \ifpgfmathfloatcomparison + ##3% + \else + ##4% + \fi + }% + },% + % + % compares YYYY-MM-DD < YYYY-MM-DD + /pgfplots/date </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \edef\pgfplotsarray@ltdate{##1\noexpand\cmp ##2}% + \expandafter\pgfplotsutilifdatelessthan\pgfplotsarray@ltdate\relax{##3}{##4}% + }% + },% + /pgfplots/date >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \edef\pgfplotsarray@ltdate{##1\noexpand\cmp ##2}% + \expandafter\pgfplotsutilifdategreaterthan\pgfplotsarray@ltdate\relax{##3}{##4}% + }% + },% + % + /pgfplots/string </.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \t@pgfplots@toka=\expandafter{##1}% + \t@pgfplots@tokb=\expandafter{##2}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}{\the\t@pgfplots@tokb}}% + \expandafter\pgfplotsutilstrcmp\pgfplots@loc@TMPa + \if1\pgfplotsretval ##3\else ##4\fi + }% + },% + /pgfplots/string >/.style={% + /pgfplots/iflessthan/.code args={##1##2##3##4}{% + \t@pgfplots@toka=\expandafter{##1}% + \t@pgfplots@tokb=\expandafter{##2}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}{\the\t@pgfplots@tokb}}% + \expandafter\pgfplotsutilstrcmp\pgfplots@loc@TMPa + \if2\pgfplotsretval ##3\else ##4\fi + }% + },% +} + +% defines \pgfplotsretval to be +% +% \tikzifinpicture{#1}{#2} +% +% and handles the '/pgfplots/invoke before crossref tikzpicture' key. +% +% #1 first argument to \tikzifinpicture +% #2 second argument to \tikzifinpicture +\def\pgfplots@assemble@ref@picture#1#2{% + \begingroup + \pgfkeysgetvalue{/pgfplots/invoke before crossref tikzpicture}\pgfplots@loc@TMPa + \pgfkeysgetvalue{/pgfplots/invoke after crossref tikzpicture}\pgfplots@loc@TMPb + \toks0={#1}% + \toks1=\expandafter{\pgfplots@loc@TMPa}% + \toks2={#2}% + \toks3=\expandafter{\pgfplots@loc@TMPb}% + \xdef\pgfplots@glob@TMPa{% + \noexpand\tikzifinpicture + {\the\toks0}% + {% + \the\toks1 + \the\toks2 + \the\toks3 + }% + }% + \endgroup + \let\pgfplotsretval=\pgfplots@glob@TMPa +}% + +\def\pgfplots@auxwrite@latex#1{% + \if@filesw + \immediate\write\@auxout{#1}% + \fi +}% +\pgfutil@ifundefined{if@filesw}{% + \def\pgfplots@auxwrite#1{}% +}{% + \let\pgfplots@auxwrite=\pgfplots@auxwrite@latex +}% + \input pgfplotsliststructure.code.tex \input pgfplotsliststructureext.code.tex \input pgfplotsarray.code.tex -\input pgfplotstable.code.tex +\input pgfplotstableshared.code.tex \input pgfplotsdeque.code.tex \input pgfplotsbinary.code.tex diff --git a/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex b/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex index d68834a0ac0..a7df35d24c3 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex +++ b/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex @@ -480,7 +480,7 @@ function processAnnotatedPlot(formName, axisAnnotObj, displayOpts, bMouseUp ) \newif\ifpgfplots@annot@printable \pgfqkeys{/pgfplots}{ - @backgroundpath@hook/.add code={\ifpgfplots@threedim\else\pgfplots@create@clickable@plotarea@hook\fi}, + @backgroundpath@hook/.add code={}{\ifpgfplots@threedim\else\pgfplots@create@clickable@plotarea@hook\fi}, clickable/.is if=pgfplots@clickable, clickable/.default=true, clickable=true, diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty index 01e1c86bb01..1d774e62926 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty @@ -23,13 +23,13 @@ % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- -\def\pgfplotsversion{1.3.1} +\def\pgfplotsversion{1.4} \IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {\def\pgfplotsrevision{}} \ifx\pgfplotsrevision\pgfutil@empty \else \edef\pgfplotsrevision{\space(git show \pgfplotsrevision)}% \fi -\ProvidesPackage{pgfplots}[2010/03/31 Version \pgfplotsversion] +\ProvidesPackage{pgfplots}[2010/07/14 Version \pgfplotsversion\pgfplotsrevision] % ATTENTION: % you MAY need one of @@ -46,6 +46,7 @@ \RequirePackage{tikz} +\def\pgfplots@texdist@protect{\protect}% \input pgfplots.code.tex \usetikzlibrary{plotmarks} diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty index 45f0af5468f..186c41ad4ef 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplotstable.sty @@ -18,10 +18,14 @@ % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- -\ProvidesPackage{pgfplotstable}[2010/03/31 Part of pgfplots] +\ProvidesPackage{pgfplotstable}[2010/07/14 Part of pgfplots] -% everything is loaded by pgfplots. \RequirePackage{pgfplots} + +\def\pgfplots@texdist@protect{\protect}% + +\input pgfplotstable.code.tex + \RequirePackage{array} % for |dec sep align| \endinput |