diff options
57 files changed, 16162 insertions, 5548 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..aa4813d9ef5 --- /dev/null +++ b/Master/texmf-dist/doc/context/third/pgfplots/pgfplotsexample.pdf diff --git a/Master/texmf-dist/doc/latex/pgfplots/ChangeLog b/Master/texmf-dist/doc/latex/pgfplots/ChangeLog index dc60cdd20fc..382b4fd117e 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/ChangeLog +++ b/Master/texmf-dist/doc/latex/pgfplots/ChangeLog @@ -1,3 +1,403 @@ +2009-02-04 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Released version 1.2 + +2009-02-04 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - improved sanity checking in table package. + - fixed max/min implementation for fpu + +2009-02-03 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - patched key paths for plot file and plot table. One could not provide + options with key path /pgfplots. This will need a little bit more + attention later-on, see todo.txt. + +2009-02-01 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - removed missing character warnings + - fixed bug with domain processing for plot gnuplot. + - fixed bug in FPU : fpu+pgf 2.00 is problematic with unary minus signs + +2009-01-29 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - provided backwards compatibility for the domain and |samples at| key: + the tikz variants are used by default now. + +2009-01-27 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - manual improvements: fixed several typos in the manual; improved section + about alignment and section about upgrade remarks. + - manual improvements: replace a lot of gnuplot examples with 'plot + expression' commands. + - fixed the broken |axis equal| feature - it collided with the tickmin/max + processing. The tickmin/max is now processed somewhat different + - removed (some of the) 'no pt in nullfont' log warnings + - now, every input file will be protocolled to the log file (only). + +2009-01-24 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - re-implemented |domain|, |samples| and |samples at| keys. They are now + independ of the |/tikz/| variants - and provide the complete data range of + pgfplots. + - fixed missing \endgroup in plot gnuplot (in the case that -shell-escape + was not available) + - fixed small bug with empty-plot-special case and tickmin/max resetting + +2009-01-21 Pascal Wolkotte <wolkottept@users.sourceforge.net> + + - implemented '[x|y]tick[min|max]' option + +2009-01-20 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed bug: 'scatter/classes' couldn't be provided as behavior option. + +2009-01-16 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - improved fault tolerance of |scatter/classes|. + - fixed scoping bug with plot markers + +2009-01-12 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - implemented \pgfplotstablesave + - \pgfplotstabletypeset and \pgfplotstabletypesetfile are now the same; + the input format is autodetected. + + +2009-01-07 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - implemented simple test for 'samples at' vs. 'domain' + - implemented 'table/create col/set list' style + - implemented a method to create new tables from scratch + - implemented some more postprocessing routines for table package + +2009-01-06 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed bug in clickable lib: logarithmic scales in x axes have not been + processed properly. + - now, the logarithmic sampling won't be applied for parametric plot + expressions. Furthermore, it has been optimized. + - improved compatibility between FPU and fixed point library inside of + pgfplots + +2009-01-05 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - both, plot gnuplot and plot expression now sample their points + logarithmically if the x (y) axis is logarithmic. + +2009-01-03 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - the fpu is now used automatically for plot expression and for the table + create col/expr feature. However, it will be disabled during the low-level + drawing commands of pgfplots. I rewrote some of the internals to avoid + problems with the low data range of tikz (for example during domain + processing). + +2008-12-31 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - improved FPU support + +2008-12-30 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added backwards compatibility switches for my new PGF library FPU. + +2008-12-27 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed some issues with stacked plots and skewed axes + - fixed a lot of manual typos and mistakes, thanks to Jeremie Knuesel! + - Greatly simplified notation for |plot expression|. + - introduced |\addplot gnuplot| as alias for |\addplot function|. + +2008-12-17 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added |create col/expr accum| style: a variant of |expr| which now + allows simple accumulation of columns + - added a |date type| style based on the pgf calendar package + +2008-12-14 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - provided a further improvement for empty plot handling: the normal + processing is now applied for empty plots, with special handling for the + named start/end coordinates. + - improved future compatibility with FPU: just in case it moves to a + separate library, I will check for such a thing. + +2008-12-07 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - there was a bug with minorgrids auto-deactivation which has been fixed. + - fixed a 'plot function[domain=..]' bug introduced yesterday + - floating point methods now don't use 'fp' for mantisse computations if + the fixed point lib is used + +2008-12-06 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - scatter will now assign a mark if none is set. + - empty plot bug has been fixed. + - using xmode in wrong context leads to error message. + - xticklabel pos now accepts 'top' and 'bottom' + - manual has more compact index: I removed the '/pgfplots/' and '/tikz/' + collections. + - improved index formatting. + - re-implemented plot expression's sampling method. The PGF \foreach + statement does not allow sampling domains beyond PGF's native math parser, + the new implementation does also support the 'fp' package (combinded with + the associated PGF library). + Efficiency is expected to be higher than the previous \foreach + implementation. + - Provided a specialized processing of the |domain| argument for plot + function which avoids the pgf math parser. Now, plot function provides the + full data range of gnuplot. + + +2008-12-05 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - improved sanity checking for plot coordinate syntax; empty lines in plot + coordinates are now processed correctly. + - added alias for 'sample' key. It can now be provided as argument to axis + environments. + - added |no markers| shortcut style. + - Added documentation for interrupted plots (for example for + discontinuities in plots) + +2008-12-03 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - updated docs. + - Fixed bug when there are less legend entries than plots. + - added 'forget plot' option (and 'every forget plot' style) + - made '/pgfplots/domain' option a public key alias to '/tikz/domain' + +2008-12-01 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed a remaining bug with 'axis equal' + - fixed bug in pgfplots/tikz search path code + +2008-11-30 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added keys 'axis equal' and 'axis equal image' to get the same length + for each unit vector. + +2008-11-28 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - optimiziation of \pgfmathfloattofixed yields 7% time savings for + pgfplotstest. For plots with many points it will be even more. + +2008-11-27 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added '/pgfplots/refstyle={label}' key. + - added 'read completely' key. + - fixed bug with error bars: some of the latest changes must have been + during sleep. + - eliminated 6 dimen registers. + +2008-11-24 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - document bounding box modifications with 'overlay' option of pgf. + The examples require the latest CVS version of pgf, because pgf 2.00 has a + bug here (overlay and matrizes). + +2008-11-23 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added 'scaled ticks=manual' feature. It allows complete control + over the scaled tick algorithm and scaled tick label placement. + - improved support for french language, i.e. for active ';' and ':' + characters. The manual does not compile completely if switched to french, + but it is not much. + - updated pgfplotstable such that it can be adopted to more general tasks. + As example, html file output has been added to the manual. + +2008-11-22 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - the clickable lib can now be used independently of pgfplots. + +2008-11-21 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - improved compatibility between pgfplotstable and colortbl: \rowcolor + and dec sep align (sci sep align) now works properly. + - Added 'every col no <index>' style as alias for 'display columns/<index>'. + - provided error message if \pgfplotstablerow is used in the wrong + context. + - improved pgfplots documentation. + - improved pgfplotstable documentation + - 'sci sep align' and 'dec sep align' now only enable math mode for their + numbers, not for empty columns. + +2008-11-18 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added error bar adjustments for 'ybar' style + - fixed bug: error bars are now drawn after the main path + +2008-11-11 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed missing code portion for scatter and log plots + - added 'view' option which allows to specify pitch and yaw for definition + of a 3D viewport (definition of x,y and z unit vectors of PGF). + +2008-11-10 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - documented default values of cycle lists. + +2008-11-04 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - prepared more code for 3D-axis drawing. It is growing now and won't take + long for good-looking 3D figures. + +2008-10-30 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - used 'y domain='<empty> as feature for \addplot3 (\x,\x,\x): + this will sample from a line, not from a surface. + +2008-10-29 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - implemented user interface to manually place 2D/3D tick LABELS (docs + missing). + The next step is to predefine them automatically for 3D plots. + +2008-10-28 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - renamed 'scatter plot' keys to 'scatter' + - improved scatter plot user interface (not yet documented in parts) + - implemented input methods for scatter coordinates (not yet documented) + - worked on 3D axis generation. + +2008-10-27 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Implemented colormaps. + - Implemented scatter plots. + +2008-10-25 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed a bug introduced in latest changes: 'tick align' produced wrongly + positioned tick labels. + + +2008-10-23 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Fixed a bug related to auto-tick placement and special cases of the + scaling transformation. + - Documented the new freedom in axis unit vector placement, reversed and + skewed axes. + - Introduced optimization for orthogonal axes. + +2008-10-21 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added 'copy' and 'sqrt' features to table package. + + +2008-10-20 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Revised all new routines such that the 2D framework is running again. + All 2D tests appear to be ok. + The 3D stuff is neither documented nor ready, although early things + work. In the moment, it is only slowing things down, see todo. + - Updated clickable lib to work with the new framework. + - Removed remaining plain TeX '\loop' commands + +2008-10-14 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Restored state of 2008-09-25 because something did not work and I don't + have a stable version yet. + - Updated compatiblity for pgf 2.0: inserted 'min exponent for 1000 sep' + into compatibility files + +2008-10-12 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - implemented input routines for 3D plots using \addplot3: + - coordinates, + - gnuplot, + - file, + - table, + - expression. + - updated coordinate streaming methods to work with 3D data. + I also cleaned and optimized the 2D code. + -> stacked plots and error bars do not reflect this yet! + - added 'plot function[<further behavior options>]' which are merged + together with those after 'plot[<behavior options>]' + +2008-10-04 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - implemented first running 3D axis with orthogonal projection. + Most features work, especially tick placement, grid lines, tick label + placement. Some detail decisions of how to things look pretty have to + be done and realized. Scaling does not work yet and there are still + plenty of open problems. The user interface for setting views is crual. + +2008-10-03 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed bug related to 'current axis' and origin anchors which occured + if axis limits have been restricted manually and axis descriptions + employed origin anchors. + - continued the change to logical coordinates. + +2008-10-01 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - changed internals to use logical coordinates consistently. + - Added feature 'x={(10pt,-3pt)}, y=-1pt'; allowing + - skewed axes, + - reversed axes, + - rotated axes, + as preparation for 3d plots. + +2008-09-27 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - optimized number processing and log computations. Logs are now a factor + of 3.8 faster. + +2008-09-25 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Provided options to manually configure the tick scaling algorithm: + either 1/10^<exponent> or 1/<real> can be configured. + - Added check for PGF 2.00 availability + +2008-09-23 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Placed all drawing commands for plots and markers into separate scopes + to end the effect of 'fill opacity' and 'dotted' styles. + FIXME: check whether this affects any named nodes and such! + +2008-09-21 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Improved compatibility with figure-environments. I had to turn + "hidden=false" to fix this incompatiblity. I hope this does not produce + visible artefacts... needs to be checked. + +2008-09-17 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added 'include outfiles' option to table package, together with + 'force remake' + +2008-09-16 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - fixed spacing bug in table package. + - outfile and debug feature of table package now produce proper newlines. + +2008-09-11 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added error messages if the table typeset features rely on LaTeX + packages (array,booktabs) which have not yet been loaded. + +2008-09-03 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - added 'clear infinite' postprocessor to table package. + +2008-09-02 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - re-implemented minimum and maximum computation because the PGF math + parser interface has been changed. The changes are backwards compatible + now. + - fixed a bug in logarithm computation. + - fixed some bugs related to the pgfplotsclickable library + +2008-09-01 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Provided sanity checking for gradient computation in table package: + division by zero now leads to empty cells. + +2008-08-22 Christian Feuersaenger <ludewich@users.sourceforge.net> + + - Added pgfplotsclickable library which displays point coordinates when + clicking into the plot region (acrobat reader only; relies on acrotex + bundle) + 2008-08-04 Christian Feuersaenger <ludewich@users.sourceforge.net> - Release 1.1 diff --git a/Master/texmf-dist/doc/latex/pgfplots/Makefile b/Master/texmf-dist/doc/latex/pgfplots/Makefile index 8751da9863b..ab7aa8a5b89 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/Makefile +++ b/Master/texmf-dist/doc/latex/pgfplots/Makefile @@ -14,4 +14,7 @@ pgfplotstable: pgfplotstable.pdf @echo "" @echo "$@ compiled successfully. You may need to re-run make several times to get all cross-references right." +clean: + rm -f *.aux *.ind *.idx *.toc *.out *.log *.ilg *.dvi pgfplots.pdf pgfplotstable.pdf *.djs *.bbl *.blg + FORCE: diff --git a/Master/texmf-dist/doc/latex/pgfplots/README b/Master/texmf-dist/doc/latex/pgfplots/README new file mode 100644 index 00000000000..e0a52efb27b --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/README @@ -0,0 +1,36 @@ +pgfplots - A tool to work with scientific data. It draws normal and/or +logarithmic plots in LaTeX/TeX/ConTeXt. + +pgfplotstable - Loads, rounds and formats and postprocesses numerical tables. + +Pgfplots draws high-quality function plots in normal or logarithmic +scaling with a user-friendly interface. The user supplies axis labels, legend +entries and the plot coordinates for one or more plots and Pgfplots applies +axis scaling, computes any logarithms and axis ticks and draws the plots. +It is based on Till Tantau's package PGF/TikZ. + +Pgfplotstable displays numerical tables rounded to desired precision in various +display formats, for example scientific format, fixed point format or integer, +using TeX's math facilities for pretty printing. + +Please take a look at + doc/latex/pgfplots/pgfplots.pdf +and + doc/latex/pgfplots/pgfplotstable.pdf. + + +Copyright 2007/2008 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 +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/>. + diff --git a/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig1.png b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig1.png Binary files differnew file mode 100644 index 00000000000..1304cf23291 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig1.png diff --git a/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig2.png b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig2.png Binary files differnew file mode 100644 index 00000000000..873a372dd73 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig2.png diff --git a/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig3.png b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig3.png Binary files differnew file mode 100644 index 00000000000..79b4d2fe0ff --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig3.png diff --git a/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig4.png b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig4.png Binary files differnew file mode 100644 index 00000000000..636f307f42a --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/figures/pgfplotsclickable-fig4.png diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfmanual-en-macros.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfmanual-en-macros.tex index e4efc70dcfa..914383cdaf2 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfmanual-en-macros.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfmanual-en-macros.tex @@ -7,9 +7,14 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -% $Header: /cvsroot/pgfplots/pgfplots/doc/latex/pgfplots/pgfmanual-en-macros.tex,v 1.1 2008/05/24 12:09:27 ludewich Exp $ +% $Header: /cvsroot/pgfplots/pgfplots/doc/latex/pgfplots/pgfmanual-en-macros.tex,v 1.3 2008/12/27 21:39:10 ludewich Exp $ +% This file is part of the pgf manual; I re-use it here with +% permission. +% +% I have changed very few things (marked with 'CF') + \providecommand\href[2]{\texttt{#1}} @@ -238,7 +243,8 @@ \ifpgfutil@in@% \extractinitial{#1}#2\@nil% \else - \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}% +% \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill(\extrakeytext no default)}% + \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill}% \fi% \fi% \def\mykey{#1}% @@ -253,7 +259,8 @@ } \def\extractinitial#1#2(initially #3)\@nil{% - \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}% +% \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill (\extrakeytext no default, initially {\ttfamily#3})}% + \pgfmanualentryheadline{{\ttfamily\declare{#1}=}#2\hfill (\extrakeytext initially {\ttfamily#3})}% } \def\extractequalinitial#1 (initially #2)\@nil{% @@ -282,8 +289,17 @@ \def\myname{#1}% \else% \iffirsttime - \def\mypath{#1@\protect\texttt{/#1/}!}% - \firsttimefalse +% CF : disabled for /pgfplots/ prefix. +% \def\mypath{#1@\protect\texttt{/#1/}!}% +% \firsttimefalse + \def\pgfplotslocTMPa{pgfplots}% + \edef\pgfplotslocTMPb{#1}% + \ifx\pgfplotslocTMPb\pgfplotslocTMPa + \def\mypath{}% + \else + \def\mypath{#1@\protect\texttt{/#1/}!}% + \fi + \firsttimefalse \else \expandafter\def\expandafter\mypath\expandafter{\mypath#1@\protect\texttt{#1/}!}% \fi diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex index fbb96fa537d..f60170652e1 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots-macros.tex @@ -352,21 +352,21 @@ }}% }% -\def\pgfplotsshortstylekey #1=#2;{% +\def\pgfplotsshortstylekey #1=#2\pgfeov{% \pgfplotsassertcmdkeyexists{#1}% \pgfplotsassertcmdkeyexists{#2}% \begin{pgfplotskey}{#1=\marg{key-value-list}} An abbreviation for \texttt{#2/.append style=}\marg{key-value-list}. \end{pgfplotskey} } -\def\pgfplotsshortxystylekey #1=#2;{% +\def\pgfplotsshortxystylekey #1=#2\pgfeov{% \pgfplotsassertXYcmdkeyexists{#1}% \pgfplotsassertXYcmdkeyexists{#2}% \begin{pgfplotsxykey}{#1=\marg{key-value-list}} An abbreviation for {\def\x{x}\texttt{#2/.append style=}}\marg{key-value-list} (or the respective style for $y$, {\def\x{y}\texttt{#2}}). \end{pgfplotsxykey} } -\def\pgfplotsshortstylekeys #1,#2=#3;{% +\def\pgfplotsshortstylekeys #1,#2=#3\pgfeov{% \pgfplotsassertcmdkeyexists{#1}% \pgfplotsassertcmdkeyexists{#2}% \pgfplotsassertcmdkeyexists{#3}% @@ -376,7 +376,7 @@ Different abbreviations for \texttt{#3/.append style=}\marg{key-value-list}. \end{pgfplotskeylist} } -\def\pgfplotsshortxystylekeys #1,#2=#3;{% +\def\pgfplotsshortxystylekeys #1,#2=#3\pgfeov{% \pgfplotsassertXYcmdkeyexists{#1}% \pgfplotsassertXYcmdkeyexists{#2}% \pgfplotsassertXYcmdkeyexists{#3}% @@ -387,4 +387,19 @@ \end{pgfplotsxykeylist} } +% +% Creates and shows a colormap with specification '#1'. +\def\pgfplotsshowcolormapexample#1{% + \pgfplotscreatecolormap{tempcolormap}{#1}% + \pgfplotsshowcolormap{tempcolormap}% +} + +% Shows the colormap named '#1'. +\def\pgfplotsshowcolormap#1{% + \pgfplotscolormaptoshadingspec{#1}{8cm}\result + \def\tempb{\pgfdeclarehorizontalshading{tempshading}{1cm}}% + \expandafter\tempb\expandafter{\result}% + \pgfuseshading{tempshading}% +} + \makeatother diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.bib b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.bib index 37d144a7e99..0615f62d77c 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.bib +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.bib @@ -11,3 +11,16 @@ author = {Uwe Kern}, title = {{Extending \LaTeX's color facilities: the \texttt{xcolor} package}} } + +@misc{acrotex, + author = {D. P. Story}, + title = {{The Acro\TeX\ eDucation Bundle}}, + howpublished = {\url{http://www.ctan.org/tex-archive/macros/latex/contrib/acrotex}}, + note = {Sub packages |insdljs| and |eforms| are required for the clickable library.} +} + +@misc{phptojs, + author = {Kevin van Zonneveld}, + title = {{PhP to javascript conversion project (GPL)}}, + howpublished = {\url{http://kevin.vanzonneveld.net/techblog/article/phpjs_licensing}} +} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex index 048dc50e721..e4d0099f383 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.importexport.tex @@ -2,10 +2,10 @@ \label{sec:pgfplots:importexport} This section contains information of how to single pictures into separate \pdf\ graphics files (or \eps\ graphics files). Furthermore, it explains a matlab (tm) script which allows to convert from matlab to \PGFPlots. -\subsection{Export to \pdf/\eps} +\subsection[Export to pdf/eps]{Export to {\normalfont\pdf/\eps}} It is possible to export images to single \pdf-documents using routines of \pgfname\ and/or \Tikz. -\subsubsection{Using the Externalization framework of \pgfname\ ``by hand''} +\subsubsection[Using the Externalization framework of pgf by hand]{Using the Externalization framework of {\normalfont\pgfname} ``by hand''} The first way to export \TeX-pictures to single graphics files is to use the externalization framework of \pgfname. The basic idea is to encapsulate the desired parts with @@ -39,7 +39,7 @@ A complete example may look as follows. \beginpgfgraphicnamed{testfigure} \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \endpgfgraphicnamed @@ -50,7 +50,7 @@ A complete example may look as follows. \beginpgfgraphicnamed{testfigure2} \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^3); + \addplot {x^3}; \end{axis} \end{tikzpicture} \endpgfgraphicnamed @@ -82,7 +82,7 @@ It is also possible to externalize graphics with the high-level library |\usetikzlibrary{external}| -\noindent which comes with (recent versions of) \Tikz\footnote{At the time of this writing, it is only available in the CVS~$2.0$ version of \pgfname, sorry.}. It is a front-end for |\beginpgfgraphicnamed| which automatically encapsulates every picture in your document with the required externalization commands and performs commands to generate all required graphics files. +\noindent which comes with (very recent versions of) \Tikz. At the time of this writing, it is \textbf{only available in the CVS~$2.0$ version of} \pgfname, sorry. It is a front-end for |\beginpgfgraphicnamed| which automatically encapsulates every picture in your document with the required externalization commands and performs commands to generate all required graphics files. \begin{enumerate} \item Every |\begin{tikzpicture}| $\dotsc$ |\end{tikzpicture}| gets a file name. The file name can be assigned manually with |\tikzsetnextfilename|\marg{output file name} or automatically, in which case \meta{tex file name}|-figure|\meta{number} is used with an increasing \meta{number}. @@ -105,7 +105,7 @@ The only steps which are necessary is to use \begin{figure} \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \caption{Our first external graphics example} @@ -114,7 +114,7 @@ The only steps which are necessary is to use \begin{figure} \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^3); + \addplot {x^3}; \end{axis} \end{tikzpicture} \caption{A second graphics} @@ -123,7 +123,7 @@ The only steps which are necessary is to use \end{codeexample} \noindent To enable the system calls, we type \begin{codeexample}[code only] -pdflatex --shell-escape test +pdflatex -shell-escape test \end{codeexample} \noindent and \LaTeX\ will now generate the required graphics files |test-figure0.pdf| and |test-figure1.pdf| automatically. @@ -137,10 +137,12 @@ The command |\tikzsetexternalprefix|\marg{file prefix} can be used to prepend a \end{codeexample} \noindent to produce |figures/test-figure0.pdf| and |figures/test-figure1.pdf| in our example. -The complete reference documentation and remaining options are documented in the documentation for the ``PDF externalization library'' of~\cite{tikz}. This reference also contains information about how to typeset such a document without \pgfname\ installed. +The complete reference documentation and remaining options are documented in the documentation for the ``PDF externalization library'' of~\cite{tikz}. This reference also contains information about how to typeset such a document without \pgfname\ installed or how to provide work-arounds with |.pdf| images and bounding box restrictions. +\index{External Graphics!Bounding Box Issues} +\index{Bounding Box Control!Image Externalization Problems} \subsection{matlab2pgfplots.m} -This is a matlab (tm) script which attempts to convert a matlab figure to \PGFPlots. +This is a Matlab (tm) script which attempts to convert a matlab figure to \PGFPlots. It requires Matlab version 7.4 (or higher). The idea is to \begin{itemize} @@ -165,3 +167,6 @@ A \texttt{bash}-script which simply starts matlab and runs matlab2pgfplots( 'outputfile.pgf', 'fig', f ); \end{lstlisting} See matlab2pgfplots.m above. + +\subsection{SVG Output} +It is possible to write every single \Tikz\ picture into a scalable vector graphics (\texttt{.svg}) file. This has nothing to do with \PGFPlots, it is a separate driver of \PGF. Please refer to~\cite[Section ``Producing HTML / SVG Output'']{tikz}. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.install.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.install.tex index b94fa632f7b..e87dd0f8bd0 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.install.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.install.tex @@ -1,7 +1,7 @@ % main=manual.tex -\section{Installation} -\subsection{Licensing} +\subsection{Installation and Prerequisites} +\subsubsection{Licensing} 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 @@ -18,17 +18,23 @@ doc/latex/pgfplots/gpl-3.0.txt \end{verbatim} You may also visit~\url{http://www.gnu.org/licenses}. -\subsection{Prerequisites} +\subsubsection{Prerequisites} \PGFPlots\ requires \PGF\ with \textbf{at least version~$2.0$}. It is used with \begin{verbatim} \usepackage{pgfplots} \end{verbatim} -in your preamble (see section~\ref{sec:tex:dialects} for information about how to use it with Con{\TeX}t and plain \TeX). There are several ways how to teach \TeX\ where to find the files. Choose the option which fits your needs best. +in your preamble (see section~\ref{sec:tex:dialects} for information about how to use it with Con{\TeX}t and plain \TeX). -\subsection{Installation in Windows} -Windows users often use Mik\TeX\ which downloads the latest stable package versions automatically. As far as I know, you do not need to install anything manually here. -\subsection{Assigning the \texttt{TEXINPUTS} Variable} +%\subsubsection{Installation} +There are several ways how to teach \TeX\ where to find the files. Choose the option which fits your needs best. + +\subsubsection{Installation in Windows} +Windows users often use Mik\TeX\ which downloads the latest stable package versions automatically. As far as I know, you do not need to install anything manually here. However, Mik\TeX\ provides a feature to install packages locally in its own \TeX-Directory-Structure (TDS). This is the preferred way if you like to install newer version than those of Mik\TeX. The basic idea is to unzip \PGFPlots\ in a directory of your choice and use configure the Mik\TeX\ Package Manager to use this specific directory with higher priority than its default paths. + +See also section~\ref{pgfplots:tds} for more information about separate TDS directories. + +\subsubsection{Installation in Any Directory - the \texttt{TEXINPUTS} Variable} You can simply install \PGFPlots\ anywhere on your disc, for example into \begin{verbatim} /foo/bar/pgfplots. @@ -49,22 +55,45 @@ so that the \TeX-documentation system finds the files |pgfplots.pdf| and |pgfplo Please refer to your operating systems manual for how to set environment variables. -\subsection{Installation into a local \texttt{texmf}-directory} +\subsubsection{Installation Into a Local \texttt{texmf}-Directory} Copy \PGFPlots\ to a local \texttt{texmf} directory like \lstinline!~/texmf! in your home directory. Then, install \PGFPlots\ into the subdirectory \lstinline!texmf/tex/generic/pgfplots! and run \lstinline!texhash!. -\subsection{Installation into a local TDS compliant \texttt{texmf}-directory} -A TDS conforming installation will use the same base directory as in the last section, but it requires to merge the contents of `\texttt{latex}' into `\texttt{texmf/tex/latex}'; the contents of `\texttt{generic}' to `\texttt{texmf/tex/generic}' and the contents of `\texttt{doc}' to `\texttt{texmf/doc}'. +\subsubsection{Installation Into a Local TDS Compliant \texttt{texmf}-Directory} +\label{pgfplots:tds} +A TDS conforming installation will use the same base directory as in the last section. Since \PGFPlots\ comes in TDS conforming directory structure, you can simply unpack the files into a directory of your choice and configure \TeX\ to use this directory as further include path. Do not forget to run \lstinline!texhash!. -\subsection{If everything else fails...} -If \TeX\ still doesn't find your files, you can copy all \lstinline!.sty! and all |.tex|-files into your current project's working directory. +\subsubsection{Installation If Everything Else Fails...} +If \TeX\ still doesn't find your files, you can copy all \lstinline!.sty! and all |.code.tex|-files into your current project's working directory. Please refer to \url{http://www.ctan.org/installationadvice/} for more information about package installation. -\subsection{Restrictions for DVI-Viewers and \texttt{dvipdfm}} +\subsection{Troubleshooting -- Error Messages} +This section discusses some problems which may occur when using \PGFPlots. +Some of the error messages are shown in the index, take a look at the end of this manual (under ``Errors''). + + +\subsubsection{Problems with available Dimen-registers} +To avoid problems with the many required \TeX-registers for \PGF\ and \PGFPlots, you may want to include +\begin{verbatim} +\usepackage{etex} +\end{verbatim} +as first package. This avoids problems with ``no room for a new dimen'' +\index{Error Messages!No room for a new dimen}% +in most cases. It should work with any modern installation of \TeX\ (it activates the e-\TeX\ extensions). + +\subsubsection{Dimension Too Large Errors} +The core mathematical engine of \PGF\ relies on \TeX\ registers to perform fast arithmetics. To compute $50+299$, it actually computes |50pt+299pt| and strips the |pt| suffix of the result. Since \TeX\ registers can only contain numbers up to $\pm 16384$, overflow error messages like ``Dimension too large'' occur if the result leaves the allowed range. Normally, this should never happen -- \PGFPlots\ uses a floating point unit with data range $\pm 10^{324}$ and performs all mappings automatically. However, there are some cases where this fails. Some of these cases are: +\begin{enumerate} + \item The axis range (for example, for $x$) becomes \emph{relatively} small. It's no matter if you have absolutely small ranges like $[10^{-17},10^{-16}]$. But if you have an axis range like $[1.99999999,2]$, where a lot of significant digits are necessary, this may be problematic. + \item The |axis equal| key will be confused if $x$ and $y$ have a very different scale. + \item You may have found a bug -- please contact the developers. +\end{enumerate} + +\subsubsection{Restrictions for DVI-Viewers and \texttt{dvipdfm}} \label{sec:drivers}% \PGF\ is compatible with \begin{itemize} @@ -91,3 +120,9 @@ Furthermore, \PGF\ needs to know a \emph{driver} so that the DVI file can be con Please read the corresponding sections in~\cite[Section 7.2.1 and 7.2.2]{tikz} if you have further questions. These sections also contain limitations of particular drivers. The choice which won't produce any problems at all is |pdflatex|. + +\subsubsection{Problems with \TeX's Memory Capacities} +\PGFPlots\ can handle small up to medium sized plots. However, \TeX\ has never been designed for data plots -- you will eventually face the problem of small memory capacities. See section~\ref{sec:pgfplots:optimization} for how to enlarge them. + +\subsubsection{Other Problems} +Please contact the authors (preferrably by mail). Visit the webpages shown above to get contact information. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex index c81d1a1268e..9bdbed56dff 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.intro.tex @@ -7,7 +7,7 @@ \begin{description} \def\HEAD{% \small - \lstset{boxpos=b,breaklines=false,aboveskip=3pt,belowskip=3pt}% + %\lstset{boxpos=b,breaklines=false,aboveskip=3pt,belowskip=3pt}% %\hspace{-1cm}% \begin{tabular}{*{2}{p{4cm}}}% }% @@ -101,7 +101,6 @@ Plotting is done using \lstinline|\begin{axis} ... \addplot ...; \end{axis}|, wh \begin{tikzpicture} \begin{axis}[ xlabel=Cost, - name=an axis, ylabel=Error] \addplot[color=red,mark=x] coordinates { (2,-2.8559703) @@ -116,23 +115,38 @@ Plotting is done using \lstinline|\begin{axis} ... \addplot ...; \end{axis}|, wh \end{tikzpicture} \end{codeexample} + \begin{codeexample}[] -\begin{tikzpicture}% +\begin{tikzpicture} \begin{axis}[ xlabel=$x$, - ylabel=$\sin(x)$, - name=an axis, + ylabel={$f(x) = x^2 - x +4$} ] - \addplot plot[id=sin] function{sin(x)}; + % use TeX as calculator: + \addplot {x^2 - x +4}; \end{axis} -\end{tikzpicture}% +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[ + xlabel=$x$, + ylabel=$\sin(x)$ + ] + % invoke external gnuplot as + % calculator: + \addplot gnuplot[id=sin]{sin(x)}; + \end{axis} +\end{tikzpicture} \end{codeexample} -The |plot coordinates| and |plot function| commands are two of the several \Tikz\ ways to create plots, see section~\ref{sec:addplot} for more details\footnote{Please note that you need \lstinline{gnuplot} installed to use \lstinline{plot function}.}. The options `|xlabel|' and `|ylabel|' define axis descriptions. + +The |plot coordinates|, |plot gnuplot| and |plot expression| commands are three of the several supported ways to create plots, see section~\ref{sec:addplot} for more details\footnote{Please note that you need \lstinline{gnuplot} installed to use \lstinline{plot gnuplot}.} and the remaining ones (|plot file| and |plot table|). The options `|xlabel|' and `|ylabel|' define axis descriptions. \subsection{Two plots in the same axis} Multiple |\addplot|-commands can be placed into the same axis. % generated with this statement: - %\addplot plot[id=filesuffix_noise,domain=-6:5,samples=10] function{(-x**5 - 242 + (-300 + 600*rand(0)))}; + %\addplot plot[id=filesuffix_noise,domain=-6:5,samples=10] gnuplot{(-x**5 - 242 + (-300 + 600*rand(0)))}; \begin{codeexample}[leave comments] \begin{tikzpicture} \begin{axis}[ @@ -141,7 +155,7 @@ Multiple |\addplot|-commands can be placed into the same axis. grid=major, ] - \addplot plot[id=filesuffix] function{(-x**5 - 242)}; + \addplot plot[id=filesuffix] gnuplot{(-x**5 - 242)}; \addlegendentry{model} \addplot coordinates { @@ -298,7 +312,7 @@ The cycle list can be modified, see the reference below. \subsection{Scaling plots} You can use any of the \Tikz\ options to modify the appearance. For example, the ``|scale|'' transformation takes the picture as such and scales it. -{% + \begin{codeexample}[] \begin{tikzpicture}[scale=0.5] \begin{loglogaxis}[ @@ -344,3 +358,5 @@ However, you can also scale plots by assigning a |width=5cm| and/or |height=3cm| \end{loglogaxis} \end{tikzpicture} \end{codeexample} + +\endinput diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.tex new file mode 100644 index 00000000000..0c49dd0b0be --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.libs.tex @@ -0,0 +1,178 @@ +\section{Related Libraries} +This section describes some libraries which come with \PGFPlots, but they are more or less special and need to be activated separately. + +\subsection{Dates as Input Coordinates} +\begin{tikzlibrary}{dateplot} + A library which allows to use dates like |2008-01-01| as input coordinates in plots. The library converts dates to numbers and tick labels will be pretty-printed dates. + + This library is documented in section~\ref{pgfplots:sec:symbolic:coords} on page~\pageref{pgfplots:sec:date:coords}. +\end{tikzlibrary} + +\subsection{Clickable Plots} +\begin{tikzlibrary}{pgfplotsclickable} + A library which generates small popups whenever one clicks into a plot. The popup displays the coordinate under the mouse pointer. Furthermore, the library allows to display slopes if one holds the mouse pressed and drags it to another point in the plot. + + Although this library has been written for \PGFPlots, it can be used independently of an \PGFPlots\ environment. + + It is completely sufficient to write +\begin{codeexample}[code only] +\usetikzlibrary{pgfplotsclickable} +\end{codeexample} + \noindent in the document preamble. This will automatically prepare every plot. + + The library works with Acrobat Javascript and \pdf\ forms: every plot becomes a push--button. + + \includegraphics[height=6cm]{figures/pgfplotsclickable-fig1.png} + \rlap{\includegraphics[height=6cm]{figures/pgfplotsclickable-fig2.png}}\hfill + + \includegraphics[height=6cm]{figures/pgfplotsclickable-fig3.png} + \rlap{\includegraphics[height=6cm]{figures/pgfplotsclickable-fig4.png}}\hfill + + \nobreak + These screenshots show the result of clicking into the axis range (left column) and of dragging from one point to another (right column). The second case shows start- and end points and the slope of the line segment in--between. + + This document has been produces with |pgfplotsclickable|, so it is possible to load it into Acrobat Reader and simply click into a plot. + + A click places an annotation at the coordinate under the mouse pointer, a snap--to--nearest feature is not available (yet?). + + \paragraph{Requirements:} + \begin{itemize} + \item The library relies on the \LaTeX\ packages |insdljs| (``Insert document level Javascript'') and |eforms| which are both part of the freely available |AcroTeX| education bundle~\cite{acrotex}\footnote{These packages rely on \LaTeX, so the library is only available for \LaTeX, not for plain \TeX\ or Con\TeX t.}. The |insdljs| package creates a temporary file with extension |.djs|. + + \item At the time of this writing, only Adobe Acrobat Reader interpretes Javascript and Forms properly. The library doesn't have any effect if the resulting document is used in other viewers (as far as I know). + + \end{itemize} + + \paragraph{Compatibility issues:} + There a several restrictions when using this library. Most of them will vanish in future versions -- but up to now, I can't do magic. + \begin{itemize} + \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 in conjunction with the 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. + + \item The library automatically calls |\begin{Form}| at |\begin{document}| and |\end{Form}| at the end of the document. This environment of |hyperref| is necessary for dynamic user interaction and should be kept in mind if the document contains other form elements. + \end{itemize} + + \paragraph{Acknowledgements:} + \begin{itemize} + \item I have used a javascript |sprintf| implementation of Kevin van Zonneveld~\cite{phptojs} (the javascript API has only a limited set of conversions). + \end{itemize} +\end{tikzlibrary} + +It is possible to customize |pgfplotsclickable| with several options. + +\begin{pgfplotskey}{clickable=\mchoice{true,false} (initially true)} + Allows to disable the library for single plots. +\end{pgfplotskey} + +\begin{pgfplotskey}{annot/js fillColor=\marg{javascript color} (initially ["RGB",1,1,.855])} + Sets the background (fill) color of the short popup annotations. + + Possible choices are |transparent|, gray, RGB or CMYK color specified as four--element--arrays of the form + |["RGB", |\meta{red}|,|\meta{green}|,|\meta{blue}|]|. Each color component is between $0$ and $1$. + + Again: this option is for Javascript. It is \emph{not} possible to use colors as in \pgfname. +\end{pgfplotskey} + +\begin{pgfplotskey}{annot/point format=\marg{sprintf-format} (initially {(\%.1f,\%.1f)})} + Allows to provide an |sprintf| format string which is used to fill the annotations with text. + The first argument to |sprintf| is the $x$-coordinate and the second argument is the $y$-coordinate. + + The |every semilogx axis|, |every semilogy axis| and |every loglog axis| styles have been updated to +\begin{codeexample}[code only] +\pgfplotsset{ + every semilogy axis/.append style={/pgfplots/annot/point format={(\%.1f,\%.1e)}}, + every semilogx axis/.append style={/pgfplots/annot/point format={(\%.1e,\%.1f)}}, + every loglog axis/.append style={/pgfplots/annot/point format={(\%.1e,\%.1e)}} +} +\end{codeexample} + \noindent such that every logarithmic coordinate is displayed in scientific format. +\end{pgfplotskey} + +\begin{pgfplotskey}{annot/slope format=\marg{sprintf-format} (initially \%.1f*x \%+.1f)} + Allows to provide an |sprintf| format string which is used to fill the slope--annotation with text. + The first argument is the slope and the second the line offset. +\end{pgfplotskey} + +\begin{pgfplotskey}{annot/printable=\mchoice{true,false} (initially false)} + Allows to configure whether the small annotations will be printed. Otherwise, they are only available on screen. +\end{pgfplotskey} + +\begin{pgfplotskey}{annot/font=\marg{javascript font name} (initially font.Times)} + Allows to choose a javascript font for the annotations. Possible choices are limited to what javascripts accepts (which is \emph{not} the same as \LaTeX). The default fonts and its names are shown below. + + \begin{center} + \begin{tabular}{ll} + \toprule + Font Name & Name in Javascript\\ + \midrule + Times-Roman & font.Times\\ + Times-Bold & font.TimesB\\ + Times-Italic & font.TimesI\\ + Times-BoldItalic & font.TimesBI\\ + Helvetica & font.Helv\\ + Helvetica-Bold & font.HelvB\\ + Helvetica-Oblique & font.HelvI\\ + Helvetica-BoldOblique & font.HelvBI\\ + Courier & font.Cour\\ + Courier-Bold & font.CourB\\ + Courier-Oblique & font.CourI\\ + Courier-BoldOblique & font.CourBI\\ + Symbol & font.Symbol\\ + ZapfDingbats & font.ZapfD\\ + \bottomrule + \end{tabular} + \end{center} +\end{pgfplotskey} + +\begin{pgfplotskey}{annot/textSize=\marg{Size in Point} (initially 11)} + Sets the text size of annotations in points. +\end{pgfplotskey} + +\subsubsection{Using the Clickable Library in Other Contexts} +This library provides essentially one command, |\pgfplotsclickablecreate| which creates a clickable area of predefined size, combined with javascript interaction code. It can be used independently of \PGFPlots. + +\begin{command}{\pgfplotsclickablecreate\oarg{required key-value-options}} + Creates an area which is clickable. A click produces a popup which + contains information about the point under the cursor. + + The complete (!) context needs to be provided using key-value-pairs, either set before + calling this method of inside of \oarg{required key-value-options}. + + This command actually creates an AcroForm which invokes javascript + whenever it is clicked. A javascript Object is created which + represents the context (axis limits and options). This javascript + object is available at runtime. + + This method is public and it is \emph{not} restricted to \PGFPlots. + The \PGFPlots\ hook simply initialises the required key-value-pairs. + + This method does not draw anything. It initialises only a + clickable area and javascript code. + + The required key-value-pairs are documented below. + + \paragraph{Attention:} Complete key-value validation is \emph{not} performed here. It + can happen that invalid options will produce javascript bugs when + opened with Acrobat Reader. Use the javascript console to find them. +\end{command} + +\noindent All options described in the following are only interesting for users who intend to use this library without \PGFPlots. + +\begin{pgfplotskey}{annot/width=\marg{dimension} (initially -)} + This required key communicates the area's width to |\pgfplotsclickablecreate|. It must be a \TeX\ dimension like |5cm|. +\end{pgfplotskey} +\begin{pgfplotskey}{annot/height=\marg{dimension} (initially -)} + This required key communicates the area's height to |\pgfplotsclickablecreate|. It must be a \TeX\ dimension like |5cm|. +\end{pgfplotskey} +\begin{pgfplotskey}{annot/jsname=\marg{string} (initially -)} + This required key communicates a unique identifier to |\pgfplotsclickablecreate|. This identifier is used to identify the object in javascript, so there can't be more than one of them. If it is empty, a default identifier will be created. +\end{pgfplotskey} + +\begin{pgfplotskeylist}{annot/xmin=\marg{number},annot/xmax=\marg{number},annot/ymin=\marg{number},annot/ymax=\marg{number} (initially empty)} + These required keys communicate the axis limits to |\pgfplotsclickablecreate|. They should be set to numbers which can be assigned to a javascript floating point number (standard IEEE double precision). +\end{pgfplotskeylist} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.mst b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.mst new file mode 100644 index 00000000000..642be497a04 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.mst @@ -0,0 +1,17 @@ +headings_flag 1 +heading_prefix "{\\bf ---~" +heading_suffix "~---}" +delim_0 "\\dotfill\\indexpageno{" +delim_1 "\\dotfill\\indexpageno{" +delim_2 "\\dotfill\\indexpageno{" +delim_t "}" +delim_n "}, \\indexpageno{" +delim_r "} -- \\indexpageno{" +suffix_2p "}f.{" +suffix_3p "}ff.{" +symhead_negative "Symbols" +symhead_positive "Symbols" +numhead_negative "Numbers" +numhead_positive "Numbers" +quote '+' +line_max 255 diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.pdf b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.pdf Binary files differindex 5f8f5f5dc3e..5b9883b8734 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 fdc26bad5ad..640da6556ec 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.preamble.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.preamble.tex @@ -21,6 +21,14 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[a4paper]{ltxdoc} +\usepackage{makeidx} + +% DON't let hyperref overload the format of index and glossary. +% I want to do that on my own in the stylefiles for makeindex... +\makeatletter +\let\@old@wrindex=\@wrindex +\makeatother + \usepackage{ifpdf} \ifpdf \usepackage[pdftex]{hyperref} @@ -29,19 +37,31 @@ \fi \hypersetup{pdfborder={0 0 0}} +\makeatletter +\let\@wrindex=\@old@wrindex +\makeatother + +% Formatiere Seitennummern im Index: +\newcommand{\indexpageno}[1]{% + {\bfseries\hyperpage{#1}}% +} + + \newcommand{\R}{\mathbb{R}} \newcommand{\N}{\mathbb{N}} \newcommand{\Z}{\mathbb{Z}} +\long\def\COMMENTLOWLEVEL#1\ENDCOMMENT{} +\def\ENDCOMMENT{} + \usepackage{textcomp} +\usepackage{booktabs} \usepackage{calc} \usepackage[formats]{listings} %\usepackage{courier} % don't use it - the '^' character can't be copy-pasted in courier -%-------------------------------------------------- -% \usepackage{array} -%-------------------------------------------------- +\usepackage{array} \lstset{% basicstyle=\ttfamily, language=[LaTeX]tex, % Seems as if \lstset{language=tex} must be invoked BEFORE loading tikz!? @@ -61,13 +81,21 @@ %\def\pgfsysdriver{pgfsys-pdftex.def} \usepackage{pgfplots} +\ifpdf + \usetikzlibrary{pgfplotsclickable} +\fi + +%\usepackage{fp} +% ATTENTION: +% this requires pgf version NEWER than 2.00 : +%\usetikzlibrary{fixedpointarithmetic} + \usetikzlibrary{dateplot} \usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry} \usepackage{amsmath,amssymb} \usepackage{xxcolor} \usepackage{pifont} -\usepackage{makeidx} \usepackage[latin1]{inputenc} \usepackage{amsmath} \usepackage{eurosym} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex index 40049e9d851..e5ba9fe8f32 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.reference.tex @@ -77,7 +77,7 @@ coordinates \begin{axis} \addplot plot [id=parable,domain=-5:5] - function{4*x**2 - 5} + gnuplot{4*x**2 - 5} node[pin=180:{$4x^2-5$}]{}; \end{axis} \end{tikzpicture} @@ -129,6 +129,7 @@ Some more details: \item For normal plots, \PGFPlots\ applies floating point arithmetics to support large or small numbers like 0.00000001234 or $1.234\cdot 10^{24}$. Its number range is much larger than \TeX's native support for numbers. The relative precision is at least~$5$ significant decimal digits for the mantisse. As soon as the axes limits are completely known, \PGFPlots\ applies a transformation which maps these floating point numbers into \TeX-precision using transformations \[ T_x(x) = 10^{s_x} \cdot x - a_x \text{ and } T_y(y) = 10^{s_y} \cdot y - a_y \] with properly chosen integers $s_x, s_y \in \Z$ and shifts $a_x,a_y\in \R$. Section~\ref{sec:disabledatascaling} contains a description of |disabledatascaling| and provides more details about the transformation. + \index{Accuracy!Floating Point in \PGFPlots}% \item As a consequence of the coordinate parsing routines, you can't use the mathematical expression parsing method of \PGF\ as coordinates (that means: you will need to provide coordinates without suffixes like ``cm'' or ``pt'' and you can't invoke mathematical functions). @@ -136,12 +137,13 @@ Some more details: The automatic computation of axis limits works as follows: \begin{enumerate} \item Every coordinate will be checked. Care has been taken to avoid \TeX's limited numerical capabilities. - \item Since more than one |\addplot| command may be used inside an |\begin{axis}...\end{axis}|, all drawing commands will be postponed until |\end{axis}|. + \item Since more than one |\addplot| command may be used inside of |\begin{axis}...\end{axis}|, all drawing commands will be postponed until |\end{axis}|. \end{enumerate} \end{itemize} \end{command} -\subsubsection{Providing Input Coordinates} +\subsubsection{Coordinate Lists} +\label{pgfplots:providing:input} \begin{addplotoperation}[]{coordinates}{\marg{coordinate list}} The `|plot coordinates|' command is provided by \Tikz\ and reads its input data from a sequence of point coordinates. @@ -173,8 +175,19 @@ or These error coordinates are only used in case of error bars, see section~\ref{sec:errorbars}. You will also need to configure whether these values denote absolute or relative errors. The coordinates as such can be numbers as |+5|, |-1.2345e3|, |35.0e2|, |0.00000123| or |1e2345e-8|. They are not limited to \TeX's precision. + +Furthermore, |plot coordinates| allows to define ``meta data'' for each coordinate. The interpretation of meta data depends on the visualization technique: for scatter plots, meta data can be used to define colors or style associations for every point (see page~\pageref{pgfplots:scatterclasses} for an example). Meta data (if any) must be provided after the coordinates and after error bar bounds (if any) in square brackets: +\begin{codeexample}[code only] +\addplot plot coordinates { + (1300,1e-6) [1] + (2600,5e-7) [2] + (4000,1e-7) [3] +}; +\end{codeexample} +Please refer to the documentation of |scatter src| on page~\pageref{pgfplots:scatter:src} for more information about per point meta data. \end{addplotoperation} +\subsubsection{Reading Coordinates From Files} \begin{addplotoperation}[]{file}{\marg{name}} \PGFPlots\ supports two ways to read plot coordinates of external files, and one of them is the \Tikz-command `|plot file|'. It is to be used like @@ -204,13 +217,20 @@ Plot file accepts one optional argument, \noindent which allows to skip over a non-comment header line. This allows to read the same input files as |plot table| by skipping over column names. Please note that comment lines do not count as lines here. +The input method |plot file| can also read meta data for every coordinate. As already explained for |plot coordinates| (see above), meta data can be used to change colors or other style parameters for every marker separately. Now, if |scatter src| is set to |explicit| or to |explicit symbolic| and the input method is |plot file|, one further element will be read from disk - for every line. Meta data is always the last element which is read. See page~\pageref{pgfplots:scatter:src} for information and examples about per point meta data and page~\pageref{pgfplots:scatterclasses} for an application example using |scatter/classes|. + + Plot file is very similar to |plot table|: you can achieve the same effect with \begin{codeexample}[code only] \addplot table[x index=0,y index=0,header=false] {datafile.dat}; \end{codeexample} \noindent Due to its simplicity, |plot file| is slightly faster while |plot table| allows higher flexibility. + +Technical note: every opened file will be protocolled into your log file. \end{addplotoperation} +\subsubsection{Reading Coordinates From Tables} + \begin{addplotoperation}[]{table}{\oarg{column selection}\marg{file}} \PGFPlots\ comes with a new plotting command, the `|plot table|' macro. It's usage is similar in spirit to `|plot file|', but its flexibility is higher. Given a data file like \begin{codeexample}[code only] @@ -230,7 +250,7 @@ one may want to plot `|dof|' versus `|L2|' or `|dof|' versus `|Lmax|'. This can \begin{tikzpicture} \begin{loglogaxis}[ xlabel=Dof, - ylabel=$L_2$ error$] + ylabel=$L_2$ error] \addplot table[x=dof,y=L2] {datafile.dat}; \end{loglogaxis} \end{tikzpicture} @@ -240,7 +260,7 @@ or \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} @@ -268,14 +288,17 @@ 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[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 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 \begin{codeexample}[code only] \pgfplotstableread{datafile.dat}\macroname. \end{codeexample} + The keyword `|from|' can be omitted. + \item The accepted input format of those tables is as follows: \begin{itemize} \item Columns are usually separated by white spaces (at least one tab or space). @@ -292,6 +315,10 @@ Summary and remarks: \item The accepted number format is the same as for `|plot coordinates|', see above. \item If you omit column selectors, the default is to plot the first column against the second. That means |plot table| does exactly the same job as |plot file| for this case. \end{itemize} + \item It \emph{is} possible to create new columns out of existing ones, see the \PGFPlotstable\ manual section ``Postprocessing Data in New Columns''. + + 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} @@ -305,115 +332,244 @@ Summary and remarks: Please note that column \emph{aliases} will be considered if unknown column names are used. Please refer to the manual of \PGFPlotstable\ which comes with this package. \end{pgfplotsxykeylist} \begin{pgfplotsxykeylist}{% - \x\ error=\marg{column name}, - \x\ error index=\marg{column index}} + table/\x\ error=\marg{column name}, + table/\x\ error index=\marg{column index}} These keys define input sources for error bars with explicit error values. Please see section~\ref{sec:errorbars} for details. \end{pgfplotsxykeylist} +\begin{pgfplotsxykeylist}{% + table/meta=\marg{column name}, + 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,comma,semicolon,colon,braces} (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)} + Allows to customize |\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''). -\begin{addplotoperation}[]{function}{\marg{gnuplot code}} -The plot function command uses the external program |gnuplot| to compute coordinates. The resulting coordinates are written to a text file which will be plotted with |plot file|. \PGF\ checks whether coordinates need to be re-generated and calls |gnuplot| whenever necessary (this is usually the case if you change the number of samples, the argument to |plot function| or the plotted domain\footnote{Please note that \PGFPlots\ produces slightly different files than \Tikz\ when used with |plot function| (it configures high precision output). You should use different ids to avoid conflicts in such a case.}). + \paragraph{Attention:} Usually, |\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. +\end{key} -Since system calls are a potential danger, they need to be enabled explicitly using command line options, for example -\begin{codeexample}[code only] -pdflatex -shell-escape filename.tex. +\subsubsection{Computing Coordinates with Mathematical Expressions} + +\begin{addplotoperation}[]{expression \marg{math expr}}{} + This input method allows to provide mathematical expressions which will be sampled. But unlike |plot gnuplot|, the expressions are evaluated using the math parser of \PGF, no external program is required. + + Plot expression samples |x| from the interval $[a,b]$ where $a$ and $b$ are specified with the |domain| key. The number of samples can be configured with |samples=|\meta{N} as for plot gnuplot. + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis} + \addplot expression {x^2 + 4}; + \addplot expression {-5*x^3 - x^2}; +\end{axis} +\end{tikzpicture} \end{codeexample} -Sometimes it is called |shell-escape| or |enable-write18|. + +Please note that \PGF's math parser uses degrees for trigonometric functions: \begin{codeexample}[] \begin{tikzpicture} \begin{axis} -\addplot plot[id=sin] - function{sin(x)}; + \addplot expression[domain=0:360] + {sin(x)}; \end{axis} \end{tikzpicture} \end{codeexample} +\noindent If you want to use radians, use +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis} + \addplot expression[domain=-pi:pi] + {sin(deg(x))}; +\end{axis} +\end{tikzpicture} +\end{codeexample} +\noindent to convert the radians to degrees. The plot expression parser also accepts some more options like |samples at=|\marg{coordinate list} or |domain=|\meta{first}|:|\meta{last} which are described below. + +\paragraph{Remarks} +\begin{enumerate} + \item What really goes on is a loop which assigns the current sample coordinate to the macro |\x|. \PGFPlots\ defines a math constant |x| which always has the same value as |\x|. + + In short: it is the same whether you write |\x| or just |x| inside of math expressions. + + The variable name can be customized using |variable=\t|, for example. Then, |x| will be the same as |\t| (there won't be a short-hand name for user defined variable names). +\index{x@\texttt{\textbackslash x} In Coordinate Expressions}% +%\index{y@\texttt{\textbackslash y} In Coordinate Expressions}% + + \item The complete set of math expressions can be found in the \PGF\ manual. The most important mathematical operations are + |+|, |-|, |*|, |/|, |abs|, |round|, |floor|, |mod|, |<|, |>|, |max|, |min|, |sin|, |cos|, |tan|, |deg| (conversion from radians to degrees), |rad| (conversion from degrees to radians), |atan|, |asin|, |acos|, |cot|, |sec|, |cosec|, |exp|, |ln|, |sqrt|, the constanst |pi| and |e|, |^| (power operation), |factorial|\footnote{Starting with \PGF\ versions newer than $2.00$, you can use the postfix operator \texttt{!} instead of \texttt{factorial}.}, |rand| (random between $-1$ and $1$), |rnd| (random between $0$ and $1$), number format conversions |hex|, |Hex|, |oct|, |bin| and some more. The math parser has been written by Mark Wibrow and Till Tantau~\cite{tikz}, the FPU routines have been developed as part of \PGFPlots. The documentation for both parts can be found in~\cite{tikz}. + + Please note, however, that trigonometric functions are defined in degrees. The character `|^|' is used for exponentiation (not `|**|' as in gnuplot). + + \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. +\end{enumerate} + +\paragraph{About the precision and number range:} +\index{Accuracy!High Precision for Plot Expression}% +\index{Errors!dimension too large}% + \index{Precision}\index{Floating Point Unit} Starting with version 1.2, |plot expression| uses a floating point unit. The FPU provides the full data range of scientific computing with a relative precision between $10^{-4}$ and $10^{-6}$. The |/pgf/fpu| key provides some more details. + + In case the |fpu| does not provide the desired mathematical function or is too slow\footnote{Or in case you find a bug$\dotsc$}, you should consider using the |plot gnuplot| method which invokes the external, freely available program |gnuplot| as desktop calculator. \begin{codeexample}[] \begin{tikzpicture} -\begin{semilogyaxis} -\addplot plot[id=exp,domain=0:10] - function{exp(x)}; -\end{semilogyaxis} + \begin{loglogaxis}[ + title={$\frac{1}{x^2}$}] + \addplot[blue] + expression[domain=1:1e30] + {x^-2}; + \end{loglogaxis} \end{tikzpicture} \end{codeexample} -The \meta{style options} determine the appearance of the plotted function; these parameters also affect the legend. The \meta{behavior options} are specific to the gnuplot interface. These options are described in all detail in \cite[section~18.6]{tikz}. A short summary is shown below. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{semilogyaxis}[ + title={$e^x$ logarithmically plotted}] + \addplot[blue] + expression[domain=1:700] + {exp(x)}; + \end{semilogyaxis} +\end{tikzpicture} +\end{codeexample} \end{addplotoperation} -\begin{key}{/tikz/domain=\meta{start}:\meta{end} (initially [-5:5])} +\begin{addplotoperation}[]{\marg{math expression}}{} + Use + + |\addplot |\marg{math expression}|;| + + as short-hand equivalent for + + |\addplot expression |\marg{math expression}|;| +\end{addplotoperation} + +\begin{addplotoperation}[]{(\meta{$x$ expression},\meta{$y$ expression})}{} + A variant of |\addplot expression| which allows to provide different coordinate expressions for the $x$ and $y$ coordinates. This can be used to generate parameterized plots. + + Please note that |\addplot (\x,\x^2)| is equivalent to |\addplot expression {\x^2}|. + + Note further that since the complete point expression is surrounded by round braces, you can't use round braces for either \meta{$x$ expression} or \meta{$y$ expression}. You will need to introduce curly braces additionally to round braces. +\end{addplotoperation} + +\begin{key}{/pgfplots/domain=\meta{start}:\meta{end} (initially [-5:5])} Determines the plotted range. This is not necessarily the same as the axis limits (which are configured with the |xmin|/|xmax| options). - This option is also used for plot expression, see below. -\end{key} + This option is used for |plot expression| and for |plot gnuplot|. -\begin{key}{/tikz/id=\marg{unique string identifier}} - A unique identifier for the current plot. It is used to generate temporary filenames for |gnuplot| output. -\end{key} + The |domain| key won't be used if |samples at| is specified; |samples at| has higher precedence. -\begin{key}{/tikz/prefix=\marg{file name prefix}} - A common path prefix for temporary filenames (see \cite[section~18.6]{tikz} for details). + \paragraph{Remark for \Tikz-users:} |/pgfplots/domain| and |/tikz/domain| are independent options. Please prefer the \PGFPlots\ variant (i.e. provide |domain| to an axis, |\pgfplotsset| or a plot command). Since older versions also accepted something like |\begin{tikzpicture}[domain=|$\dotsc$|]|, this syntax is also accepted as long as no \PGFPlots\ |domain| key is set. \end{key} -\begin{key}{/tikz/samples=\marg{number}} - Sets the number of sample points. -\end{key} +\begin{key}{/pgfplots/samples=\marg{number} (initially 25)} + Sets the number of sample points for |plot expression| and |plot gnuplot|. -\begin{key}{/tikz/raw gnuplot} - Disables the use of |samples| and |domain|. + The |samples| key won't be used if |samples at| is specified; |samples at| has higher precedence. + + The same special treatment of |/tikz/samples| and |/pgfplots/samples| as for the |domain| key applies here. See above for details. \end{key} -\noindent -Please refer to \cite[section~18.6]{tikz} for more details about |plot function| and the |gnuplot| interaction. +\begin{pgfplotskey}{samples at=\marg{coordinate list}} + Sets the $x$ coordinates for |plot expression| explicitly. This overrides |domain| and |samples|. -\begin{addplotoperation}[]{(\meta{$x$ expression},\meta{$y$ expression})}{} - Similar to |plot function|, this input method allows to provide expressions which will be sampled. But unlike |plot function|, the expressions are evaluated using the math parser of \PGF, no external program is required. -\begin{codeexample}[] -\begin{tikzpicture} -\begin{axis} - \addplot (\x,\x^2 + 4); - \addplot (\x,-5*\x^3 - \x^2); -\end{axis} -\end{tikzpicture} + The \marg{coordinate list} is a |\foreach| expression, that means it can contain a simple list of coordinates (comma--separated) but also complex |...| expressions like\footnote{Unfortunately, the |...| is somewhat restrictive when it comes to extended accuracy. So, if you have particularly small or large numbers (or a small distance), you have to provide a comma--separated list (or use the \texttt{domain} key).} +\begin{codeexample}[code only] +\pgfplotsset{samples at={5e-5,7e-5,10e-5,12e-5}} +\pgfplotsset{samples at={-5,-4.5,...,5}} +\pgfplotsset{samples at={-5,-3,-1,-0.5,0,...,5}} \end{codeexample} -The number of points and the sampled range is configured as for |plot function|, that means using |samples| and |domain|. -Please note that \PGF's math parser uses degrees for trigonometric functions: + The same special treatment of |/tikz/samples at| and |/pgfplots/samples at| as for the |domain| key applies here. See above for details. + + \paragraph{Attention:} |samples at| overrides |domain|, even if |domain| has been set \emph{after} |samples at|! Use |samples at={}| to clear \marg{coordinate list} and re-activate |domain|. +\end{pgfplotskey} + +\subsubsection{Computing Coordinates with Mathematical Expressions (gnuplot)} + +\begin{addplotoperation}[]{gnuplot}{\marg{gnuplot code}} +In contrast to |plot expression|, the |plot gnuplot| command employs the external program |gnuplot| to compute coordinates. The resulting coordinates are written to a text file which will be plotted with |plot file|. \PGF\ checks whether coordinates need to be re-generated and calls |gnuplot| whenever necessary (this is usually the case if you change the number of samples, the argument to |plot gnuplot| or the plotted domain\footnote{Please note that \PGFPlots\ produces slightly different files than \Tikz\ when used with |plot gnuplot| (it configures high precision output). You should use different ids to avoid conflicts in such a case.}). + +The differences between |plot expression| and |plot gnuplot| are: +\begin{itemize} + \item |plot expression| does not require any external programs and requires no additional command line options. + \item |plot expression| does not produce a lot of temporary files. + \item |plot gnuplot| uses radians for trigonometric functions while |plot expression| has degrees. + \item |plot gnuplot| is faster. + \item |plot gnuplot| has a larger mathematical library. + \item |plot gnuplot| has a higher accuracy. However, starting with version 1.2, this is no longer a great problem. The new floating point unit for \TeX\ provides reasonable accuracy and the same data range as |gnuplot|. +\end{itemize} + +Since system calls are a potential danger, they need to be enabled explicitly using command line options, for example +\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. \begin{codeexample}[] \begin{tikzpicture} \begin{axis} - \addplot plot[domain=0:360] - (\x,{sin(\x)}); +\addplot plot[id=sin] + gnuplot{sin(x)}; \end{axis} \end{tikzpicture} \end{codeexample} -the braces are necessary to delimit the $y$ argument here. If you want to use radians, use + \begin{codeexample}[] \begin{tikzpicture} -\begin{axis} - \addplot plot[domain=-3.14159:3.14159] - (\x,{sin(\x r)}); -\end{axis} +\begin{semilogyaxis} +\addplot plot[id=exp,domain=0:10] + gnuplot{exp(x)}; +\end{semilogyaxis} \end{tikzpicture} \end{codeexample} -to convert the radians to degrees. The \Tikz\ plot expression parser also accepts some more options like |samples at=|\marg{coordinate list} or |variable=\t| which are described in the \Tikz\ manual. + +The \meta{style options} determine the appearance of the plotted function; these parameters also affect the legend. The \meta{behavior options} are specific to the gnuplot interface. These options are described in all detail in \cite[section~18.6]{tikz}. A short summary is shown below. + +Please note that |plot gnuplot| does not allow per point meta data. + +Please refer to \cite[section~18.6]{tikz} for more details about |plot function| and the |gnuplot| interaction. \end{addplotoperation} +\begin{addplotoperation}[]{function}{\marg{gnuplot code}} + Use + + |\addplot function |\marg{gnuplot code}|;| + + as alias for + + |\addplot gnuplot |\marg{gnuplot code}|;| +\end{addplotoperation} + +\begin{key}{/tikz/id=\marg{unique string identifier}} + A unique identifier for the current plot. It is used to generate temporary filenames for |gnuplot| output. +\end{key} + +\begin{key}{/tikz/prefix=\marg{file name prefix}} + A common path prefix for temporary filenames (see \cite[section~18.6]{tikz} for details). +\end{key} + +\begin{key}{/tikz/raw gnuplot} + Disables the use of |samples| and |domain|. +\end{key} + + \begin{command}{\addplot+\oarg{style options} \textcolor{gray}{\dots};} Does the same like |\addplot[|\meta{style options}|] ...;| except that \meta{style options} is \emph{appended} to the arguments which would have been taken for |\addplot ...| (the element of the default list). \begin{codeexample}[] \begin{tikzpicture} \begin{axis} -\addplot (\x,{sin(\x r)}); +\addplot {sin(deg(x))}; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis} -\addplot+[only marks] (\x,{sin(\x r)}); +\addplot+[only marks] {sin(deg(x))}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -451,9 +607,9 @@ It can be used to draw any \Tikz-graphics at axis coordinates. It is used like (553983, 3.053e-05) }; - \node[coordinate,pin=above:Bad!] + \node[coordinate,pin=above:{Bad!}] at (axis cs:5503,2.027e-03) {}; - \node[coordinate,pin=left:Good!] + \node[coordinate,pin=left:{Good!}] at (axis cs:187903,9.063e-05) {}; \end{loglogaxis} \end{tikzpicture} @@ -554,16 +710,16 @@ The legend appearance can be configured with the help of several styles and opti \begin{tikzpicture}[baseline] \begin{axis} \addplot+[only marks] - plot[samples=15, + expression[samples=15, error bars/y dir=both, error bars/y fixed=2.5] - (\x,3*\x+2.5*rand); + {3*x+2.5*rand}; \label{pgfplots:label1} - \addplot+[mark=none] (\x,3*\x); + \addplot+[mark=none] {3*x}; \label{pgfplots:label2} - \addplot (\x,{4*cos(\x r)}); + \addplot {4*cos(deg(x))}; \label{pgfplots:label3} \end{axis} \end{tikzpicture} @@ -598,10 +754,18 @@ Label2 = \ref{pgfplots:label2} This will also work together with |hyperref| links and |\pageref|. \end{command} +\begin{key}{/pgfplots/refstyle=\marg{label name}} + Can be used to set the \emph{styles} of a labeled, single plot. This allows to write +\begin{codeexample}[code only] +\addplot[/pgfplots/refstyle={pgfplots:label2}] +\end{codeexample} + \noindent somewhere. Please note that it may be easier to define a style with |.style|. +\end{key} + \begin{stylekey}{/pgfplots/every crossref picture} A style which will be used by the cross-referencing feature for plots. The default is \begin{codeexample}[code only] -\pgfplotsset{every crossref picture/.style={baseline,yshift=0.3em} +\pgfplotsset{every crossref picture/.style={baseline,yshift=0.3em}} \end{codeexample} \end{stylekey} @@ -615,7 +779,7 @@ Label2 = \ref{pgfplots:label2} \begin{codeexample}[] \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^2+2) \closedcycle; + \addplot {x^2+2} \closedcycle; \end{axis} \end{tikzpicture} \end{codeexample} @@ -623,7 +787,7 @@ Label2 = \ref{pgfplots:label2} \begin{codeexample}[] \begin{tikzpicture} \begin{axis} - \addplot+[fill] (\x,\x^2+2) \closedcycle; + \addplot+[fill] {x^2+2} \closedcycle; \end{axis} \end{tikzpicture} \end{codeexample} @@ -679,9 +843,6 @@ The number is printed using the current number printing options, see section~\re \begin{command}{\pgfplotstabletypeset\marg{\textbackslash macro}} Please refer to the manual of \PGFPlotstable, |pgfplotstable.pdf|, which is part of the \PGFPlots-bundle. \end{command} -\begin{command}{\pgfplotstabletypesetfile\marg{file}} - Please refer to the manual of \PGFPlotstable, |pgfplotstable.pdf|, which is part of the \PGFPlots-bundle. -\end{command} \section{Option Reference} There are several required and even more optional arguments to modify axes. They are used like @@ -700,6 +861,45 @@ The overall appeareance can be changed with \noindent for example. There are several other styles predefined to modify the appearance, see section~\ref{sec:styles}. +\begin{command}{\pgfplotsset\marg{key-value-list}} + Defines or sets all options in \marg{key-value-list}. + + It is a shortcut for |\pgfqkeys{/pgfplots}|\marg{key-value-list}, that means it inserts the prefix |/pgfplots| to any option which has no full path. + + This command can be used to define default options for the complete document or a part of the document. For example, +\begin{codeexample}[code only] +\pgfplotsset{ + cycle list={% + {red, mark=*}, {blue,mark=*}, + {red, mark=x}, {blue,mark=x}, + {red, mark=square*}, {blue,mark=square*}, + {red, mark=triangle*}, {blue,mark=triangle*}, + {red, mark=diamond*}, {blue,mark=diamond*}, + {red, mark=pentagon*}, {blue,mark=pentagon*} + }, + legend style={ + at={(0.5,-0.2)}, + anchor=north, + legend columns=2, + cells={anchor=west}, + font=\footnotesize, + rounded corners=2pt, + }, + xlabel=$x$,ylabel=$f(x)$ +} +\end{codeexample} + can be used to set document--wise styles for line specifications, the legend's style and axis labels. + + You can also define new styles (collections of key--value--pairs) with |.style| and |.append style|. +\begin{codeexample}[code only] +\pgfplotsset{ + My Style 1/.style={xlabel=$x$, legend entries={1,2,3} }, + My Style 2/.style={xlabel=$X$, legend entries={4,5,6} } +\end{codeexample} + The |.style| and |.append style| key handlers are described in section~\ref{sec:styles} in more detail. +\end{command} + + \subsection{Pgfplots Options and \Tikz\ Options} This section is more or less technical and can be skipped unless one really wants to know more about this topic. @@ -811,15 +1011,15 @@ coordinates \begin{plottype}{jump mark left} A variant of `|const plot mark left|' which does not draw vertical lines. \begin{codeexample}[] -\begin{tikzpicture}[samples=8] -\begin{axis} +\begin{tikzpicture} +\begin{axis}[samples=8] \addplot+[jump mark left] - plot[id=parablex,domain=-5:0] - function{4*x**2 - 5}; + expression[domain=-5:0] + {4*x^2 - 5}; \addplot+[jump mark right] - plot[id=cubic,domain=-5:0] - function{0.7*x**3 + 50}; + expression[domain=-5:0] + {0.7*x^3 + 50}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -848,6 +1048,7 @@ Bar plots place horizontal or vertical bars at coordinates. Multiple bar plots i Bars are centered at plot coordinates with width |bar width|. Using bar plots usually means more than just a different way of how to connect coordinates, for example to draw ticks outside of the axis, change the legend's appearance or introduce shifts if multiple |\addplot| commands appear. There is a preconfigured style for |xbar| which is installed automatically if you provide |xbar| as argument to the axis environment which provides this functionality. +% \usetikzlibrary{patterns} \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[xbar,enlargelimits=0.15] @@ -871,7 +1072,7 @@ Here |xbar| yields |/pgfplots/xbar| because it is an argument to the axis, not t \begin{stylekey}{/pgfplots/xbar=\marg{shift for multiple plots} (default 2pt)} This style sets |/tikz/xbar| \emph{and} some commonly used options concerning horizontal bars for the complete axis. This is automatically done if you provide |xbar| as argument to an axis argument, see above. -The |xbar| style defines shifts if multiple plots are placed into one axis. If draws bars adjacent to each other, separated by \marg{shift for multiple plots}. Furthermore, it sets the style |bar cycle list| and sets tick and legend appearance options. +The |xbar| style defines shifts if multiple plots are placed into one axis. It draws bars adjacent to each other, separated by \marg{shift for multiple plots}. Furthermore, it sets the style |bar cycle list| and sets tick and legend appearance options. The style is defined as follows. \begin{codeexample}[code only] @@ -882,7 +1083,10 @@ The style is defined as follows. {\draw[##1,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};}, /pgf/bar shift={% + % total width = n*w + (n-1)*skip + % -> subtract half for centering -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + + % the '0.5*w' is for centering (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1}, /tikz/xbar}, \end{codeexample} @@ -1044,7 +1248,7 @@ Here |ybar| yields |/pgfplots/ybar| because it is an argument to the axis, not t \end{pgfplotsxykey} \subsubsection{Comb Plots} -Comb plots are very similar to bar plots except that they emplot single horizontal/vertical lines instead of rectangles. +Comb plots are very similar to bar plots except that they employ single horizontal/vertical lines instead of rectangles. \begin{plottype}{xcomb} \begin{codeexample}[] @@ -1071,7 +1275,7 @@ Comb plots are very similar to bar plots except that they emplot single horizont \subsubsection{Stacked Plots} \begin{pgfplotskey}{stack plots=\mchoice{x,y,false} (initially false)} - Allows stacking of plots in either $x$ or $y$ direction. Stacking means add either $x$- or $y$ coordinates of successive |\addplot| commands on top of each other. + Allows stacking of plots in either $x$ or $y$ direction. Stacking means to add either $x$- or $y$ coordinates of successive |\addplot| commands on top of each other. \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[stack plots=y] @@ -1137,10 +1341,11 @@ Comb plots are very similar to bar plots except that they emplot single horizont \end{axis} \end{tikzpicture} \end{codeexample} +The current implementation for |stack plots| does \emph{not} interpolate missing coordinates. That means stacking will fail if the plots have different grids. \end{pgfplotskey} \begin{pgfplotskey}{stack dir=\mchoice{plus,minus} (initially plus)} - Configures the direction of |stack plots|. The value |plus| will adds coordinates of successive plots while |minus| subtracts them. + Configures the direction of |stack plots|. The value |plus| will add coordinates of successive plots while |minus| subtracts them. \end{pgfplotskey} \begin{pgfplotskey}{reverse stacked plots=\mchoice{true,false} (initially true, default true)} @@ -1159,10 +1364,10 @@ Comb plots are very similar to bar plots except that they emplot single horizont \end{stylekey} \begin{stylekey}{/pgfplots/xbar interval stacked=\mchoice{plus,minus} (default plus)} - A sttyle similar to |/pgfplots/xbar stacked| for the interval based bar plot variant. + A style similar to |/pgfplots/xbar stacked| for the interval based bar plot variant. \end{stylekey} \begin{stylekey}{/pgfplots/ybar interval stacked=\mchoice{plus,minus} (default plus)} - A sttyle similar to |/pgfplots/ybar stacked| for the interval based bar plot variant. + A style similar to |/pgfplots/ybar stacked| for the interval based bar plot variant. \end{stylekey} \subsubsection{Area Plots} @@ -1187,7 +1392,7 @@ Area plots are a combination of |\closedcycle| and |stack plots|. They can be co \end{tikzpicture} \end{codeexample} \noindent -Area plots may need modified legends, for example using the |area legend| key. Furthermore, one may want to consider the |axis on top| key such that filled areas to not overlap ticks and grid lines. +Area plots may need modified legends, for example using the |area legend| key. Furthermore, one may want to consider the |axis on top| key such that filled areas do not overlap ticks and grid lines. \begin{stylekey}{/pgfplots/area style} A style which sets @@ -1311,6 +1516,223 @@ Area plots may need modified legends, for example using the |area legend| key. F \end{tikzpicture} \end{codeexample} +\subsubsection{Scatter Plots} +\label{pgfplots:scatter} +For scatter plots, the marker appearance changes for each data point. An example is that marker colors depend on the magnitude of function values $f(x)$. + +Scatter plots require ``source'' coordinates. These source coordinates can be the $y$ coordinate, or explicitly provided additional values. + +\begin{plottype}{scatter} + Enables marker appearance modifications. The default implementation acquires ``source coordinates'' for every data point (see |scatter src| below) and maps them linearly into the current color map. The resulting color is used as draw and fill color of the marker. + +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis} + \addplot+[scatter,only marks] + expression[samples=50,scatter src=y] + {x-x^2}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + + The key |scatter| is simply a boolean variable which enables marker modifications. It applies only to markers and it can be combined with any other plot type. + +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis} + \addplot+[scatter] + expression[samples=50,scatter src=y] + {x^3}; + \end{axis} +\end{tikzpicture} +\end{codeexample} +\end{plottype} + +Scatter plots can be configured using a set of options. One of them is mandatory, the rest allows fine grained control over marker appearance options. + +\label{pgfplots:scatter:src} +\begin{pgfplotskey}{scatter src=\mchoice{none,x,y,z,explicit,explicit symbolic} (initially none)} + This key is necessary for any scatter plot. It needs to be provided as \marg{behavior option} for |\addplot| to configure the value used to determine marker appearances. + + The choices |x|, |y| and |z| will use either the $x$, $y$ or $z$ coordinates to determine marker options\footnote{The coordinates are used after any coordinate filters, logarithms or stacked-plot computations have been applied.}. The choice |explicit| expects the scatter source data as additional coordinate from the coordinate input streams (see section~\ref{pgfplots:providing:input} for how to provide input meta data). They will be treated as numerical data. Finally, |explicit symbolic| also expects scatter source data as additional meta information for each input coordinate, but it treats them as strings, not as numerical data. Consequently, no arithmetics is performed. It is task of the scatter plot style to do sometthing with it. See, for example, the |scatter/classes| style below. + + Please note that |scatter src|$\neq$|none| results in computational work even if |scatter=false|. +\end{pgfplotskey} + +\begin{stylekey}{/pgfplots/scatter/use mapped color=\marg{options for each marker} (initially draw=mapped color!80!black,fill=mapped color)} + This style is installed by default. When active, it recomputes the color |mapped color| for every processed point coordinate by transforming the |scatter src| coordinates into the current colormap linearly. Then, it evaluates the options provided as \marg{options for each marker} which are expected to depend on |mapped color|. + + The user interface for colormaps is described in section~\ref{pgfplots:colormap}. +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[title=Default arguments] +\addplot+[scatter] + expression[scatter src=y] + {2*x+3}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[ + title=Black fill color and varying draw color, + scatter/use mapped color= + {draw=mapped color,fill=black}] +\addplot+[scatter] + expression[scatter src=y] + {2*x+3}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[ + title=Black draw color and varying fill color, + scatter/use mapped color= + {draw=black,fill=mapped color}] +\addplot+[scatter] + expression[scatter src=y] + {2*x+3}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + This key is actually a style which redefines |@pre marker code| and |@post marker code| (see below). +\end{stylekey} + +\label{pgfplots:scatterclasses} +\begin{stylekey}{/pgfplots/scatter/classes=\marg{styles for each classname}} + A scatter plot style which visualizes points using several classes. The style assumes that every point coordinate has a class label attached, that means the choice |scatter src=explicit symbolic| is assumed\footnote{If \texttt{scatter src} is not \texttt{explicit symbolic}, we expect a numeric argument which is rounded to the nearest integer. The resulting integer is used a class label. If that fails, the numeric argument is truncated to the nearest integer. If that fails as well, the point has no label.}. A class label can be a number, but it can also be a symbolic constant. Given class labels for every point, \marg{styles for each classname} contains a comma-separated list which associates appearance options to each class label. + + If you need different |scatter/classes| arguments per plot, they must be given as \marg{behavior option}, not as style option. +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[scatter/classes={ + a={mark=square*,blue},% + b={mark=triangle*,red},% + c={mark=o,draw=black,fill=black}}] + + \addplot+[scatter,only marks] + plot[scatter src=explicit symbolic] + coordinates { + (0.1,0.15) [a] + (0.45,0.27) [c] + (0.02,0.17) [a] + (0.06,0.1) [a] + (0.9,0.5) [b] + (0.5,0.3) [c] + (0.85,0.52) [b] + (0.12,0.05) [a] + (0.73,0.45) [b] + (0.53,0.25) [c] + (0.76,0.5) [b] + (0.55,0.32) [c] + }; +\end{axis} +\end{tikzpicture} +\end{codeexample} +In this example, the coordinate |(0.1,0.15)| has the associated label `|a|' while |(0.45,0.27)| has the label `|c|' (see section~\ref{sec:addplot} for details about specifying point meta data). Now, The argument to |scatter/classes| contains styles for every label -- for label `|a|', square markers will be drawn in color blue. + +In general, the format of \marg{styles for each classname} is a comma separated list of \meta{label}|=|\marg{style options}. + +\paragraph{Attention:} The keys |every mark| and |mark options| have \emph{no effect} when used inside of \marg{styles for each classname}! So, instead of assigning |mark options|, you can simply provide the options directly. They apply only to markers anyway. +\end{stylekey} + +\begin{pgfplotsxycodekeylist}{ + scatter/@pre marker code, + scatter/@post marker code} + These two keys constitute the public low-level interface which determines the marker appearance depending on the scatter source coordinates. + + Redefining them allows fine grained control even over marker types, linestyles and colors. + + The scatter plot algorithm works as follows: +\begin{enumerate} +\item The scatter source coordinates form a data stream whose data limits are computed additionally to the axis limits. This step is skipped for |symbolic| meta data. +\item Before any markers are drawn, a linear coordinate transformation from these data limits to the interval $[0.0,1000.0]$ is initialised. +\item Every scatter source coordinate\footnote{During the evaluation, the public macros \texttt{\textbackslash pgfplotspointmeta} and \texttt{\textbackslash pgfplotspointmetarange} indicate the source coordinate and the source coordinate range in the format $a:b$ (for log--axis, they are given in fixed point representation and for linear axes in floating point).} will be transformed linearly and the result is available as macro |\pgfplotspointmetatransformed| $ \in [0.0,1000.0]$. + +The decision is thus based on per thousands of the data range. The transformation is skipped for |symbolic| meta data (and the meta data is simply contained in the mentioned macro). +\item The code of |scatter/@pre marker code| is evaluated (without arguments). +\item The standard code which draws markers is evaluated. +\item The code of |scatter/@post marker code| is evaluated (without arguments). +\end{enumerate} + The idea is to generate a set of appearance keys which depends on |\pgfplotspointmetatransformed|. Then, a call to |\scope|\oarg{generated keys} as |@pre| code and the associated |\endscope| as |@post| code will draw markers individually using \oarg{generated keys}. + +A technical example is shown below. It demonstrates how to write user defined routines, in this case a three--class system\footnote{Please note that you don't need to copy this particular example: the multiple--class example is also available as predefined style \texttt{scatter/classes}.}. +\begin{codeexample}[] +\begin{tikzpicture} +% Low-Level scatter plot interface Example: +% use three different marker classes +% 0% - 30% : first class +% 30% - 60% : second class +% 60% - 100% : third class +\begin{axis}[ +scatter/@pre marker code/.code={% + \ifdim\pgfplotspointmetatransformed pt<300pt + \def\markopts{mark=square*,fill=blue}% + \else + \ifdim\pgfplotspointmetatransformed pt<600pt + \def\markopts{mark=triangle*,fill=orange}% + \else + \def\markopts{mark=pentagon*,fill=red}% + \fi + \fi + \expandafter\scope\expandafter[\markopts] +},% +scatter/@post marker code/.code={% + \endscope +}] + +\addplot+[scatter] + expression[scatter src=y,samples=40] + {sin(deg(x))}; + +\end{axis} +\end{tikzpicture} +\end{codeexample} +Please note that |\ifdim| compares \TeX\ lengths, so the example employs the suffix |pt| for any number used in this context. That doesn't change the semantics. + +\end{pgfplotsxycodekeylist} + +\subsubsection{Interrupted Plots} +\index{Interrupted Plots}% +Sometimes it is desireable to draw parts of a single plot separately, without connection between the parts (discontinuities). There is limited support for such an application. +\label{pgfplots:interrupt} +\begin{pgfplotskey}{/pgfplots/forget plot=\marg{true,false} (initially false)} + This key tells \PGFPlots\ to add a plot without changing cycle list position and legends. This key is described in all detail on page~\pageref{pgfplots:forgetplot}. + + However, it can be used to get the interesting effect of ``interrupted plot'', so it is also discussed here: +\begin{codeexample}[width=4cm] +\begin{tikzpicture} +\begin{axis}[ + width=10cm, height=210pt, + xmin=-4.7124, xmax=4.7124, + ymin=-10, ymax=10, + xtick={-4.7124,-1.5708,...,10}, + xticklabels={$-\frac32 \pi$,$-\pi/2$,$\pi/2$,$\frac32 \pi$}, + axis x line=center,axis y line=center, + no markers, + samples=100] + +% Use gnuplot as calculator here. The first two plots won't be counted: +\addplot gnuplot[id=tan0,forget plot,domain=-1.5*pi+0.003:-0.5*pi-0.003] {tan(x)}; +\addplot gnuplot[id=tan1,forget plot,domain=-0.5*pi+0.003: 0.5*pi-0.003] {tan(x)}; +\addplot gnuplot[id=tan2, domain= 0.5*pi+0.003: 1.5*pi-0.003] {tan(x)}; +\legend{$\tan(x)$} +\end{axis} +\end{tikzpicture} +\end{codeexample} + + The interesting part is in the |\addplot| commands. The |id| is specific to the gnuplot interface (and can be omitted). The |domain| option defines separate domains for every plot part. Due to the |forget plot| key, the |cycle list| position is not updated so all three plots use the same line specification. Furthermore, only the last command affects the legend (and advances the cycle list). + + \paragraph{Remark:} The |forget plot| feature is \emph{not very sophisticated}. In particular, it has the following \textbf{restrictions}: + \begin{enumerate} + \item Besides the |cycle list| side--effect, no styles are communicated between successive plots. + \item It won't work together with |stack plots|. + \end{enumerate} +\end{pgfplotskey} + \subsection{Markers and Linestyles} \label{sec:markers}% The following options of \Tikz\ are available to plots. @@ -1395,7 +1817,9 @@ All these options have been drawn with the additional options \end{axis} \end{tikzpicture} \end{codeexample} +\end{key} +\begin{stylekey}{/pgfplots/every axis plot post (initially {})} The |every axis plot post| style can be used to overwrite parts (or all) of the drawing styles which are assigned for plots. \begin{codeexample}[] % Overwrite any cycle list: @@ -1410,7 +1834,11 @@ The |every axis plot post| style can be used to overwrite parts (or all) of the \end{axis} \end{tikzpicture} \end{codeexample} -\end{key} +\end{stylekey} + +\begin{stylekey}{/pgfplots/no markers} + A style which appends |mark=none| to |every axis plot post|, which disables markers for every plot (even if the cycle list contains markers). +\end{stylekey} \begin{key}{/tikz/mark options=\marg{options}} Resets |every mark| to \marg{options}. @@ -1456,7 +1884,15 @@ The following line styles are predefined in \Tikz. \begin{stylekey}{/tikz/loosely dashed} \showit{style=loosely dashed} \end{stylekey} -You may need the option |mark options={solid}| to avoid dotted or dashed marker boundaries. +\noindent since these styles apply to markers as well, you may want to consider using +\begin{codeexample}[code only] +\pgfplotsset{ + every mark/.append style={solid} +} +\end{codeexample} +\noindent in marker styles. + +Besides linestyles, \PGF\ also offers (a lot of) arrow heads. Please refer to~\cite{tikz} for details. \endgroup \subsubsection{Font Size and Line Width} @@ -1467,7 +1903,7 @@ Often, one wants to change line width and font sizes for plots. This can be done \end{key} \begin{key}{/tikz/line width=\marg{dimension} (initially 0.4pt)} - Sets the line width. Please note that line widths for tick lines and grid lines are predefined, so you may need to override the styles |every tick| and |every axis grid|. + Sets the line width. Please note that line widths for tick lines and grid lines are predefined, so it may be necessary to override the styles |every tick| and |every axis grid|. The |line width| key is changed quite often in \Tikz. You should use \begin{codeexample}[code only] @@ -1477,7 +1913,7 @@ Often, one wants to change line width and font sizes for plots. This can be done \begin{codeexample}[code only] \pgfplotsset{every axis/.append style={thick}} \end{codeexample} - to change the overall line width. To also adjust ticks and grid lines, you can use + to change the overall line width. To also adjust ticks and grid lines, one can use \begin{codeexample}[code only] \pgfplotsset{every axis/.append style={ line width=1pt, @@ -1509,6 +1945,7 @@ This example shows the same plots as on page~\pageref{page:plotcoords:src} (usin xlabel=\textsc{Dof}, ylabel=$L_2$ Error ] + % see above for this macro: \plotcoords \legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$} \end{loglogaxis} @@ -1525,6 +1962,7 @@ This example shows the same plots as on page~\pageref{page:plotcoords:src} (usin xlabel=\textsc{Dof}, ylabel=$L_2$ Error ] + % see above for this macro: \plotcoords \legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$} \end{loglogaxis} @@ -1566,18 +2004,18 @@ The package |xcolor| defines a set of predefined colors, namely \begin{tikzpicture} \begin{axis}[enlarge x limits=false] \addplot[red] - plot[samples=500] (\x,{sin(\x r)}); + expression[samples=500] {sin(deg(x))}; \addplot[orange] - plot[samples=7] (\x,{sin(\x r)}); + expression[samples=7] {sin(deg(x))}; \addplot[teal,const plot] - plot[samples=14] (\x,{sin(\x r)}); + expression[samples=14] {sin(deg(x))}; \end{axis} \end{tikzpicture} \end{codeexample} -Besides predefined colors, you can \emph{mix} two (or more) colors. For example, \showcolorandname{red!30!white} contains $30\%$ of \showcolorandname{red} and $70\%$ of \showcolorandname{white}. Consequently, one can build \showcolorandname{red!70!white} to get $70\%$ red and $30\%$ white or \showcolorandname{red!10!white} for $10\%$ red and $90\%$ white. This mixing can be done with any color, \showcolorandname{red!50!green}, \showcolorandname{blue!50!yellow}. +Besides predefined colors, it is possible to \emph{mix} two (or more) colors. For example, \showcolorandname{red!30!white} contains $30\%$ of \showcolorandname{red} and $70\%$ of \showcolorandname{white}. Consequently, one can build \showcolorandname{red!70!white} to get $70\%$ red and $30\%$ white or \showcolorandname{red!10!white} for $10\%$ red and $90\%$ white. This mixing can be done with any color, \showcolorandname{red!50!green}, \showcolorandname{blue!50!yellow}. A different type of color mixing is supported, which allows to take $100\%$ of \emph{each} component. For example, \showcolorandname{rgb,2:red,1;green,1} will add $1/2$ part \showcolorandname{red} and $1/2$ part \showcolorandname{green} and we reproduced the example from above. Using the denominator~$1$ instead of~$2$ leads to \showcolorandname{rgb,1:red,1;green,1} which uses $1$ part \showcolorandname{red} and $1$ part \showcolorandname{green}. Many programs allow to select pieces between $0,\dotsc,255$, so a denominator of $255$ is useful. Consequently, \showcolorandname{rgb,255:red,231;green,84;blue,121} uses $231/255$ red, $84/255$ green and $121/255$. This corresponds to the standard RGB color $(231,84,121)$. Other examples are \showcolorandname{rgb,255:red,32;green,127;blue,43}, \showcolorandname{rgb,255:red,178;green,127;blue,43}, \showcolorandname{rgb,255:red,169;green,178;blue,43}. @@ -1597,6 +2035,36 @@ It is also possible to use RGB values, the HSV color model or the HTML color syn \noindent creates the color with $208/255$ pieces red, $178/255$ pieces green and $43$ pieces blue, specified in standard HTML notation. Please refer to the |xcolor| manual~\cite{xcolor} for more details and color models. }% +\subsubsection{Color Maps} +\label{pgfplots:colormap} +\begin{pgfplotskey}{colormap name=\marg{color map name} (initially hot)} + Changes the current color map to the already defined map named \marg{color map name}. Available standard color maps are + + \begin{tabular}{>{\ttfamily}ll} + hot & \pgfplotsshowcolormap{hot}\\ + \end{tabular} + + Colormaps can be used, for example, in scatter plots (see section~\ref{pgfplots:scatter}). + + You can use |colormap| to create new color maps (see below). +\end{pgfplotskey} + +\begin{pgfplotskey}{colormap=\marg{name}\marg{color specification}} + Defines a new colormap named \marg{name} according to \marg{color specification} and activates it using |colormap name=|\marg{name}. + + The syntax of \marg{color specification} is the same as those for \PGF\ shadings described in~\cite[VIII -- Shadings]{tikz}: it consists of a series of colors along with a length. +\begin{codeexample}[code only] +rgb(0cm)=(1,0,0); rgb(1cm)=(0,1,0); rgb(2cm)=(0,0,1); gray(3cm)=(0.3); color(4cm)=(green) +\end{codeexample} +\pgfplotsshowcolormapexample{rgb(0cm)=(1,0,0); rgb(1cm)=(0,1,0); rgb(2cm)=(0,0,1); gray(3cm)=(0.3); color(4cm)=(green)} + +\noindent The single colors are separated by semicolons `|;|'. The length describes how much of the bar is occupied by the interval. Each entry has the form \meta{color model}|(|\meta{length}|)=(|\meta{arguments}|)|. The line above means that the left end of the colormap shall have RGB components $1,0,0$, indicating $100\%$ red and $0\%$ green and blue. The next entity starts at |1cm| and describes a color with $100\%$ green. Finally, |gray| specifies a color with the same value for each, R G and B and |color| accesses predefined colors. + +The complete length of a colormap is irrelevant: it will be mapped linearly to an internal range anyway (for efficient interpolation). The only requirement is that the left end must be at |0|. + +\paragraph{Remark:} Currently, only equidistant \marg{color specification}s are supported (each interval must have the same length). +\end{pgfplotskey} + \subsubsection{Options Controlling Linestyles} \label{sec:cycle:list}% @@ -1605,26 +2073,120 @@ Allows to specify a list of plot specifications which will be used for each \hbo There are several possiblities to change it: \begin{enumerate} - \item Use one of the predefined lists, + \item Use one of the predefined lists\footnote{These lists were named \texttt{\textbackslash coloredplotspeclist} and \texttt{\textbackslash blackwhiteplotspeclist} which appeared to be unnecessarily long, so they have been renamed. The old names are still accepted, however.}, + \begin{itemize} + \item |color| (from top to bottom) \begin{codeexample}[] \begin{tikzpicture} -\begin{loglogaxis}[ - cycle list name=\coloredplotspeclist] -\plotcoords -\legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$} -\end{loglogaxis} +\begin{axis}[ + stack plots=y,stack dir=minus, + cycle list name=color] +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\end{axis} \end{tikzpicture} \end{codeexample} -These examples employs the same coords as in the example on page~\pageref{page:plotcoords:src}. + + \item |exotic| (from top to bottom) \begin{codeexample}[] \begin{tikzpicture} -\begin{loglogaxis}[ - cycle list name=\blackwhiteplotspeclist] -\plotcoords -\legend{$d=2$,$d=3$,$d=4$,$d=5$,$d=6$} -\end{loglogaxis} +\begin{axis}[ + stack plots=y,stack dir=minus, + cycle list name=exotic] +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\end{axis} \end{tikzpicture} \end{codeexample} + + \item |black white| (from top to bottom) +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[ + stack plots=y,stack dir=minus, + cycle list name=black white] +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\addplot coordinates {(0,1) (0.5,1) (1,1)}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + \end{itemize} + +These predefined cycle lists habe been created with +\begin{codeexample}[code only] +\pgfplotscreateplotcyclelist{color}{% + blue,every mark/.append style={fill=blue!80!black},mark=*\\% + red,every mark/.append style={fill=red!80!black},mark=square*\\% + brown!60!black,every mark/.append style={fill=brown!80!black},mark=otimes*\\% + black,mark=star\\% + blue,every mark/.append style={fill=blue!80!black},mark=diamond*\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\% + brown!60!black,densely dashed,every mark/.append style={ + solid,fill=brown!80!black},mark=square*\\% + black,densely dashed,every mark/.append style={solid,fill=gray},mark=otimes*\\% + blue,densely dashed,mark=star,every mark/.append style=solid\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% +} +\pgfplotscreateplotcyclelist{black white}{% + every mark/.append style={fill=gray},mark=*\\% + every mark/.append style={fill=gray},mark=square*\\% + every mark/.append style={fill=gray},mark=otimes*\\% + mark=star\\% + every mark/.append style={fill=gray},mark=diamond*\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=*\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=square*\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=otimes*\\% + densely dashed,every mark/.append style={solid},mark=star\\% + densely dashed,every mark/.append style={solid,fill=gray},mark=diamond*\\% +} +\pgfplotscreateplotcyclelist{exotic}{% + teal,every mark/.append style={fill=teal!80!black},mark=*\\% + orange,every mark/.append style={fill=orange!80!black},mark=square*\\% + cyan!60!black,every mark/.append style={fill=cyan!80!black},mark=otimes*\\% + red!70!white,mark=star\\% + lime!80!black,every mark/.append style={fill=lime},mark=diamond*\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\% + yellow!60!black,densely dashed, + every mark/.append style={solid,fill=yellow!80!black},mark=square*\\% + black,every mark/.append style={solid,fill=gray},mark=otimes*\\% + blue,densely dashed,mark=star,every mark/.append style=solid\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% +} +\end{codeexample} + \item Provide the list explicitly, \begin{codeexample}[] \begin{tikzpicture} @@ -1645,7 +2207,7 @@ These examples employs the same coords as in the example on page~\pageref{page:p (This example list requires |\usetikzlibrary{plotmarks}|). \item Define macro names and use them with `|cycle list name|': \begin{codeexample}[code only] -\pgfcreateplotcyclelist{\mylist}{% +\pgfplotscreateplotcyclelist{mylist}{% {blue,mark=*}, {red,mark=square}, {dashed,mark=o}, @@ -1653,7 +2215,7 @@ These examples employs the same coords as in the example on page~\pageref{page:p {brown!60!black,mark options={fill=brown!40},mark=otimes*}} } ... -\begin{axis}[cycle list name=\mylist] +\begin{axis}[cycle list name=mylist] ... \end{axis} \end{codeexample} @@ -1673,21 +2235,21 @@ These examples employs the same coords as in the example on page~\pageref{page:p ... \end{axis} \end{codeexample} -In this case, the \emph{last} entry also needs a terminating `|\\|', but you can omit braces around the single entries. +In this case, the \emph{last} entry also needs a terminating `|\\|', but one can omit braces around the single entries. \end{pgfplotskeylist} \subsection{Axis Descriptions} -Axis descriptions are labels for $x$ and $y$ axis and titles. Axis descriptions are drawn after the plot is finished and they are not subjected to clipping. Their placement is always relative to the axis rectangle, where $(0,0)$ refers to the lower left corner and $(1,1)$ refers to the upper right one. +Axis descriptions are labels for $x$ and $y$ axis and titles. Axis descriptions are drawn after the plot is finished and they are not subjected to clipping. Their placement is always \emph{relative to the axis rectangle}, where $(0,0)$ refers to the lower left corner and $(1,1)$ refers to the upper right one. Furthermore, axis descriptions can be placed using the predefined node |current axis|. At the time when axis descriptions are drawn, all anchors which refer to the axis origin (that means the ``real'' point $(0,0)$) or any of the axis corners can be references using |current axis.|\meta{anchor name}. Please see section~\ref{pgfplots:sec:align}, Alignment, for further details. \subsubsection{Labels} \begin{pgfplotsxykey}{\x label=\marg{text}} -The options |xlabel| and |ylabel| change axis labels to \marg{text} which is any \TeX\ text. Use ``|xlabel={, = characters}|'' if you need to include `|=|' or `|,|' literally. +The options |xlabel| and |ylabel| change axis labels to \marg{text} which is any \TeX\ text. Use ``|xlabel={, = characters}|'' if characters like `|=|' or `|,|' need to be included literally. Labels are \Tikz-Nodes which are placed with \begin{codeexample}[code only] @@ -1712,7 +2274,7 @@ The default styles are xshift=-35pt, rotate=90}} \end{codeexample} -Whenever possible, you should use |.append style| instead of overwriting the default styles to ensure compatibility with future versions. +Whenever possible, consider using |.append style| instead of overwriting the default styles to ensure compatibility with future versions. \begin{codeexample}[code only] \pgfplotsset{every axis label/.append style={...}} \pgfplotsset{every axis x label/.append style={...}} @@ -1789,7 +2351,7 @@ As all other axis descriptions, the code can use $(0,0)$ to access the lower lef }}} \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -1801,12 +2363,12 @@ 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. This method has been presented in section~\ref{pgfplots:sec:legendcmds}, Legend Commands. The other method is to use a key. \begin{pgfplotskey}{legend entries=\marg{comma separated list}} - This key can be used to assign legend entries just like the commands |\addlegendentry| and |\legend|. + This key can be used to assign legend entries just like the commands |\addlegendentry| and |\legend|. Again, the positioning is relative to the axis rectangle (unless units like |cm| or |pt| are specified explicitly). \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[legend entries={$x$,$x^2$}] - \addplot (\x,\x); - \addplot (\x,\x^2); + \addplot {x}; + \addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -1815,12 +2377,13 @@ Legends can be generated in two ways: the first is to use |\addlegendentry| or | \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[legend entries={$x$,$x^2$}] - \addplot (\x,\x); - \addplot (\x,\x^2); + \addplot {x}; + \addplot {x^2}; \legend{$a$,$b$}% overrides the option \end{axis} \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} {% @@ -1840,7 +2403,7 @@ will draw it at the lower left corner of the axis while \end{codeexample} means the upper right corner. The `|anchor|' option determines which point \emph{of the legend} will be placed at $(0,0)$ or $(1,1)$. -The legend is a \Tikz-matrix, so you can use any \Tikz\ option which affects +The legend is a \Tikz-matrix, so one can use any \Tikz\ option which affects nodes and matrizes (see~\cite[section 13~and~14]{tikz}). The matrix is created by something like \begin{codeexample}[code only] \matrix[style=every axis legend] { @@ -1879,7 +2442,7 @@ Use |legend columns=|\marg{number} to configure the number of horizontal legend \end{tikzpicture} \end{codeexample} \noindent -Instead of the |.append style|, you can also use |legend style| as in the following example. It has the same effect. +Instead of the |.append style|, it is possible to use |legend style| as in the following example. It has the same effect. \begin{codeexample}[] \begin{tikzpicture} @@ -1914,6 +2477,8 @@ Whenever possible, consider using |.append style| to keep the default styles act \end{codeexample} \end{stylekey} +\pgfplotsshortstylekey legend style=every axis legend\pgfeov + } \begin{pgfplotskey}{legend columns=\marg{number} (default 1)} @@ -1953,6 +2518,7 @@ The default is \end{codeexample} \begin{codeexample}[] +% \usetikzlibrary{patterns} \begin{tikzpicture} \begin{axis}[area legend, axis x line=bottom, @@ -1963,13 +2529,13 @@ The default is axis on top,xmin=0] \addplot[pattern=crosshatch dots, pattern color=blue,draw=blue] -plot[samples=500] - (\x,{sqrt(\x)}) \closedcycle; +expression[samples=500] + {sqrt(x)} \closedcycle; \addplot[pattern=crosshatch, pattern color=blue!30!white, draw=blue!30!white] - (\x,\x^2) \closedcycle; +expression {x^2} \closedcycle; \addplot[red] coordinates {(0,0) (1,1)}; \legend{$\sqrt x$,$x^2$,$x$} @@ -2015,8 +2581,8 @@ Feel free to overwrite these styles if the default doesn't fit your needs or tas xlabel=$x$,ylabel=$\sin x$] \addplot[blue,mark=none] - plot[id=sinneg,domain=-10:0,samples=40] - function{sin(x)}; + expression[domain=-10:0,samples=40] + {sin(deg(x))}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2030,8 +2596,8 @@ Feel free to overwrite these styles if the default doesn't fit your needs or tas xlabel=$x$,ylabel=$\sin x$ ] \addplot[blue,mark=none] - plot[id=sinneg,domain=-10:0,samples=40] - function{sin(x)}; + expression[domain=-10:0,samples=40] + {sin(deg(x))}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2044,8 +2610,8 @@ Feel free to overwrite these styles if the default doesn't fit your needs or tas xlabel=$x$,ylabel=$\sqrt{|x|}$ ] \addplot[blue,mark=none] - plot[id=sqrtabsx,domain=-4:4,samples=501] - function{sqrt(abs(x))}; + expression[domain=-4:4,samples=501] + {sqrt(abs(x))}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2058,9 +2624,9 @@ Feel free to overwrite these styles if the default doesn't fit your needs or tas axis x line=middle, xlabel=$x$,ylabel=$\sin x$ ] - \addplot[blue,mark=none] - plot[domain=-5:5,samples=40] - (\x,{sin(\x r)}); + \addplot[smooth,blue,mark=none] + [domain=-5:5,samples=40] + {sin(deg(x))}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2073,9 +2639,9 @@ Feel free to overwrite these styles if the default doesn't fit your needs or tas axis x line=middle, xlabel=$x$,ylabel=$\sin x$ ] - \addplot[blue,mark=none] - plot[domain=-5:5,samples=40] - (\x,{sin(\x r)}); + \addplot[smooth,blue,mark=none] + [domain=-5:5,samples=40] + {sin(deg(x))}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2099,7 +2665,7 @@ In case |middle|, the style |every inner axis x line| allows to adjust the appea {|->>}, xlabel=$x$,ylabel=$y^3$ ] -\addplot[blue] plot[domain=-3:5] (\x,\x^3); +\addplot[blue] expression[domain=-3:5] {x^3}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2119,7 +2685,7 @@ In case |middle|, the style |every inner axis x line| allows to adjust the appea \addplot[blue] plot[id=DoG, samples=100, domain=-15:15] - function{1.3*exp(-x**2/10) - exp(-x**2/20)}; + gnuplot{1.3*exp(-x**2/10) - exp(-x**2/20)}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2130,7 +2696,7 @@ In case |middle|, the style |every inner axis x line| allows to adjust the appea Both cases have their advantages and disadvantages, I fear there is no reasonable default (suggestions are welcome). - The case |separate axis lines=true| allows to draw arrow heads on each single axis line, but it can't close edges very well -- in case of thick lines, you will see unsatisfactory edges. + The case |separate axis lines=true| allows to draw arrow heads on each single axis line, but it can't close edges very well -- in case of thick lines, unsatisfactory edges occur. \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[ @@ -2140,10 +2706,14 @@ In case |middle|, the style |every inner axis x line| allows to adjust the appea every outer y axis line/.append style= {-stealth,green!30!black}, ] -\addplot[blue] plot[id=DoG, +\addplot[blue] + expression[ samples=100, domain=-15:15] - function{1.3*exp(-x**2/10) - exp(-x**2/20)}; + {1.3*exp(0-x^2/10) - exp(0-x^2/20)}; + % Unfortunately, there is a bug in PGF 2.00 + % something like exp(-10^2) + % must be written as exp(0-10^2) :-( \end{axis} \end{tikzpicture} \end{codeexample} @@ -2161,7 +2731,7 @@ In case |middle|, the style |every inner axis x line| allows to adjust the appea \addplot[blue] plot[id=DoG, samples=100, domain=-15:15] - function{1.3*exp(-x**2/10) - exp(-x**2/20)}; + gnuplot{1.3*exp(-x**2/10) - exp(-x**2/20)}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2215,7 +2785,7 @@ In some applications, more than one $y$ axis is used if the $x$ range is the sam axis y line=left, xlabel=$x$, ylabel=First ordinate] - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \begin{axis}[ @@ -2224,11 +2794,11 @@ In some applications, more than one $y$ axis is used if the $x$ range is the sam axis y line=right, axis x line=none, ylabel=Second ordinate] - \addplot[red] (\x,3*\x); + \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. This requires attention in the following possibly non-obvious aspects: +\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: \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. @@ -2244,7 +2814,7 @@ It is also possible to use only the axis, without any plots: axis y line=left, xlabel=$x$, ylabel=Absolute] - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \begin{axis}[ @@ -2300,13 +2870,40 @@ The description applies |axis y discontinuity| as well, with interchanged meanin ymin=95, enlargelimits=false ] \addplot[blue,mark=none] - plot[id=square,domain=-4:4,samples=20] - function{x*x+x+104}; + expression[domain=-4:4,samples=20] + {x*x+x+104}; \end{axis} \end{tikzpicture} \end{codeexample} \end{pgfplotsxykey} +A problem might occur with the placement of the ticks on the axis. +This can be solved by specifying the minimum or maximum axis value for which a tick will be placed. + +\begin{pgfplotsxykeylist}{\x tickmin=\marg{coord} (default axis limits), \x tickmax=\marg{coord} (default axis limits)} +\label{key:xytickminmax} +The options |xtickmin|, |xtickmax| and |ytickmin|, |ytickmax| allow to define the axis tick limits, i.e. the axis values before respectively after no ticks will be placed. +Everything outside of the axis tick limits will be not drawn. +Their default values are equal to the axis limits. + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[ + axis x line=bottom, + axis y line=center, + tick align=outside, + axis y discontinuity=crunch, + xtickmax=3, + ytickmin=110, + ymin=95, enlargelimits=false +] + \addplot[blue,mark=none] + plot[domain=-4:4,samples=20] + expression{x*x+x+104}; +\end{axis} +\end{tikzpicture} +\end{codeexample} +\end{pgfplotsxykeylist} \begin{pgfplotsxykey}{hide \x\ axis=\mchoice{true,false} (initially false)} Allows to hide either the $x$ or the $y$ axis. No outer rectangle, no tick marks and no labels will be drawn. Only titles and legends will be processed as usual. @@ -2317,8 +2914,8 @@ Axis scaling and clipping will be done as if you did not use |hide x axis|. \begin{axis}[ hide x axis, hide y axis, - title={$\cos(x)$}] - \addplot (\x,{cos(\x)*\x^2}); + title={$x^2\cos(x)$}] + \addplot {cos(x)*x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2328,8 +2925,8 @@ Axis scaling and clipping will be done as if you did not use |hide x axis|. \begin{axis}[ hide x axis, axis y line=left, - title={$\cos(x)$}] - \addplot (\x,{cos(\x)*\x^2}); + title={$x^2\cos(x)$}] + \addplot {cos(x)*x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2386,17 +2983,53 @@ If |scale only axis| is enabled, label, tick and legend dimensions won't influen If |scale only axis=false| (the default), \PGFPlots\ will try to produce the desired width \emph{including} labels, titles and ticks. \end{pgfplotskey} -\begin{pgfplotsxykey}{\x=\marg{dimen}} -Sets the unit size for one $x$ (or $y$) coordinate to \marg{dimen}. - - Setting $x$ explicitly overrides the |width| option. Setting $y$ explicitly overrides the |height| option. +\begin{pgfplotsxykeylist}{ + \x=\marg{dimen}, + \x={\{(\meta{x},\meta{y})\}}} +Sets the unit vectors for $x$ (or $y$). Every logical plot coordinate $(x,y)$ is drawn at the position +\[ x \cdot \begin{bmatrix} e_{xx} \\ e_{xy} \end{bmatrix} + y \cdot \begin{bmatrix} e_{yx} \\ e_{yy} \end{bmatrix}. \] +The unit vectors $e_x$ and $e_y$ determine the paper position in the current (always two dimensional) image. + +The key |x=|\marg{dimen} simply sets $e_x = (\meta{dimen},0)^T $ while |y=|\marg{dimen} sets $e_y = (0,\meta{dimen})^T$. +Here, \marg{dimen} is any \TeX\ size like |1mm|, |2cm| or |5pt|. It is allowed to specify a negative \marg{dimen}. \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[x=1cm,y=1cm] -\addplot plot[domain=0:3] (\x,2*\x); +\addplot expression[domain=0:3] {2*x}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[x=1cm,y=-0.5cm] +\addplot expression[domain=0:3] {2*x}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + +The second syntax, |x={(|\meta{x}|,|\meta{y}|)}| sets $e_x = (\meta{x},\meta{y})^T$ explicitly\footnote{Please note that you need extra curly braces around the vector. Otherwise, the comma will be interpreted as separator for the next key-value pair.}; the corresponding |y| key works similiarly. This allows to define skewed or rotated axes. + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[x={(1cm,0.1cm)},y=1cm] +\addplot expression[domain=0:3] {2*x}; \end{axis} \end{tikzpicture} \end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[ + x={(5pt,1pt)}, + y={(-4pt,4pt)}] +\addplot {1-x^2}; +\end{axis} +\end{tikzpicture} +\end{codeexample} + + Setting $x$ explicitly overrides the |width| option. Setting $y$ explicitly overrides the |height| option. + Setting |x| and/or |y| for logarithmic axis will set the dimension used for $1 \cdot e \approx 2.71828$. Please note that it is \emph{not} possible to specify |x| as argument to |tikzpicture|. The option @@ -2408,7 +3041,75 @@ Sets the unit size for one $x$ (or $y$) coordinate to \marg{dimen}. \end{tikzpicture} \end{codeexample} won't have any effect because an axis rescales its coordinates (see the |width| option). -\end{pgfplotsxykey} + +\paragraph{Limitations:} Unfortunately, skewed axes are \textbf{not available for bar plots}. +\index{Errors!Skewed axes and bar plots}% +\index{Bar Plots!Skewed axes problems}% +\end{pgfplotsxykeylist} + +\begin{pgfplotskey}{axis equal=\marg{true,false} (initially false)} + Each unit vector is set to the same length while the axis dimensions stay constant. Afterwards, the size ratios for each unit in $x$ and $y$ will be the same. + + Axis limits will be enlarge to compensate for the scaling effect. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[axis equal=false] + \addplot[blue] expression[domain=0:2*pi,samples=300] {sin(deg(x))*sin(2*deg(x))}; + \end{axis} +\end{tikzpicture} +\hspace{1cm} +\begin{tikzpicture} + \begin{axis}[axis equal=true] + \addplot[blue] expression[domain=0:2*pi,samples=300] {sin(deg(x))*sin(2*deg(x))}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} + \begin{loglogaxis}[axis equal=false] + \addplot expression[domain=1:10000] {x^-2}; + \end{loglogaxis} +\end{tikzpicture} +\hspace{1cm} +\begin{tikzpicture} + \begin{loglogaxis}[axis equal=true] + \addplot expression[domain=1:10000] {x^-2}; + \end{loglogaxis} +\end{tikzpicture} +\end{codeexample} +\end{pgfplotskey} + +\begin{pgfplotskey}{axis equal image=\marg{true,false} (initially false)} + Similar to |axis equal|, but the axis limits will stay constant as well (leading to smaller images). +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[axis equal image=false] + \addplot[blue] expression[domain=0:2*pi,samples=300] {sin(deg(x))*sin(2*deg(x))}; + \end{axis} +\end{tikzpicture} +\hspace{1cm} +\begin{tikzpicture} + \begin{axis}[axis equal image=true] + \addplot[blue] expression[domain=0:2*pi,samples=300] {sin(deg(x))*sin(2*deg(x))}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + +\begin{codeexample}[] +\begin{tikzpicture} + \begin{loglogaxis}[axis equal image=false] + \addplot expression[domain=1:10000] {x^-2}; + \end{loglogaxis} +\end{tikzpicture} +\hspace{1cm} +\begin{tikzpicture} + \begin{loglogaxis}[axis equal image=true] + \addplot expression[domain=1:10000] {x^-2}; + \end{loglogaxis} +\end{tikzpicture} +\end{codeexample} +\end{pgfplotskey} \subsection{Error Bars} \label{sec:errorbars} @@ -2456,7 +3157,7 @@ coordinates { \pgfplotsset{anchor=center,/tikz/every picture/.append style={baseline}} \begin{codeexample}[] -\pgfplotstabletypesetfile{pgfplots.testtable2.dat} +\pgfplotstabletypeset{pgfplots.testtable2.dat} \begin{tikzpicture} \begin{loglogaxis} @@ -2547,7 +3248,7 @@ Allows to change the default drawing commands for error bars. The two arguments \item the target point, $(\tilde x,\tilde y)$. \end{itemize} Both are determined by \PGFPlots\ according to the options described above. The default code is -\begin{codeexample}[code only][basicstyle=\footnotesize\ttfamily] +\begin{codeexample}[code only] /pgfplots/error bars/draw error bar/.code 2 args={% \pgfkeysgetvalue{/pgfplots/error bars/error mark}% {\pgfplotserrorbarsmark}% @@ -2564,7 +3265,7 @@ Both are determined by \PGFPlots\ according to the options described above. The \subsubsection{Input Formats of Error Coordinates} \label{sec:errorbar:input}% -Error bars with explicit error estimations for single data points require some sort of input format. This applies to `|error bars/|\meta{[xy]}| explizit|' and `|error bars/|\meta{[xy]}| explizit relative|'. +Error bars with explicit error estimations for single data points require some sort of input format. This applies to `|error bars/|\meta{[xy]}| explicit|' and `|error bars/|\meta{[xy]}| explicit relative|'. Error bar coordinates can be read from `|plot coordinates|' or from `|plot table|'. The inline plot coordinates format is \begin{codeexample}[code only] @@ -2681,25 +3382,24 @@ where the `|log plot exponent style|' allows to change number formatting options \begin{pgfplotskey}{log plot exponent style=\marg{key-value-list}} Allows to configure the number format of log plot exponents. This style is installed just before `|log base 10 number format code|' will be invoked. Please note that this style will be installed within the default code for `|log number format code|'. \begin{codeexample}[] -\tikzset{samples=15} -\pgfplotsset{every axis/.append style={ - width=7cm, - xlabel=$x$, - ylabel=$f(x)$, - extra y ticks={45}, - legend style={at={(0.03,0.97)}, - anchor=north west}}} +\pgfplotsset{ + samples=15, + width=7cm, + xlabel=$x$, + ylabel=$f(x)$, + extra y ticks={45}, + legend style={at={(0.03,0.97)}, + anchor=north west}} \begin{tikzpicture} \begin{semilogyaxis}[ log plot exponent style/.style={ /pgf/number format/fixed zerofill, - /pgf/number format/precision=1}] + /pgf/number format/precision=1}, + domain=-5:10] - \addplot plot[id=gnuplot_exp,domain=-5:10] - function{exp(x)}; - \addplot plot[id=gnuplot_expv,domain=-5:10] - function{exp(2*x)}; + \addplot {exp(x)}; + \addplot {exp(2*x)}; \legend{$e^x$,$e^{2x}$} \end{semilogyaxis} @@ -2707,26 +3407,25 @@ Allows to configure the number format of log plot exponents. This style is insta \end{codeexample} \begin{codeexample}[] -\tikzset{samples=15} -\pgfplotsset{every axis/.append style={ - width=7cm, - xlabel=$x$, - ylabel=$f(x)$, - extra y ticks={45}, - legend style={at={(0.03,0.97)}, - anchor=north west}}} +\pgfplotsset{ + samples=15, + width=7cm, + xlabel=$x$, + ylabel=$f(x)$, + extra y ticks={45}, + legend style={at={(0.03,0.97)}, + anchor=north west}} \begin{tikzpicture} \begin{semilogyaxis}[ log plot exponent style/.style={ /pgf/number format/fixed, /pgf/number format/use comma, - /pgf/number format/precision=2}] + /pgf/number format/precision=2}, + domain=-5:10] - \addplot plot[id=gnuplot_exp,domain=-5:10] - function{exp(x)}; - \addplot plot[id=gnuplot_expv,domain=-5:10] - function{exp(2*x)}; + \addplot {exp(x)}; + \addplot {exp(2*x)}; \legend{$e^x$,$e^{2x}$} \end{semilogyaxis} @@ -2734,51 +3433,6 @@ Allows to configure the number format of log plot exponents. This style is insta \end{codeexample} \end{pgfplotskey} -%-------------------------------------------------- -% \subsubsection{Defining Own Display Styles} -% You can define own display styles, although this may require some insight into \TeX-programming. Here are two examples: -% \begin{enumerate} -% \item A new fixed point display style: The following code defines a new style named `\texttt{my own fixed point style}' which uses $1{\cdot}00$ instead of $1.00$. -% \begin{lstlisting} -% \def\myfixedpointstyleimpl#1.#2\relax{% -% #1{\cdot}#2% -% }% -% \def\myfixedpointstyle#1{% -% \pgfutilensuremath{% -% \ifpgfmathfloatroundhasperiod -% \expandafter\myfixedpointstyleimpl#1\relax -% \else -% #1% -% \fi -% }% -% } -% \pgfkeys{/my own fixed point style/.code={% -% \let\pgfmathprintnumber@fixed@style=\myfixedpointstyle} -% }% -% \end{codeexample} -% You only need to overwrite the macro |\pgfmathprintnumber@fixed@style|. This macro takes one argument (the result of any numerical computations). The \TeX-boolean |\ifpgfmathfloatroundhasperiod| is true if and only if the input number contains a period. -% -% \item An example for a new scientific display style: -% \begin{lstlisting} -% % #1: -% % 0 == '0' (the number is +- 0.0), -% % 1 == '+', -% % 2 == '-', -% % 3 == 'not a number' -% % 4 == '+ infinity' -% % 5 == '- infinity' -% % #2: the mantisse -% % #3: the exponent -% \def\myscistyle#1#2e#3\relax{% -% ... -% } -% \pgfkeys{/my own sci style/.code={% -% \let\pgfmathfloatrounddisplaystyle=\myscistyle}, -% }% -% \end{codeexample} -% \end{enumerate} -%-------------------------------------------------- - @@ -2789,13 +3443,13 @@ The options |xmin|, |xmax| and |ymin|, |ymax| allow to define the axis limits, i Each missing limit will be determined automatically. -If $x$-limits have been specified explicitly and $y$-limits are computed automatically, the automatic computation of $y$-limits will only considers points which fall into the specified $x$-range (and vice--versa). The same holds true if, for example, only |xmin| has been provided explicitly: in that case, |xmax| will be updated only for points for which $x \ge $|xmin| holds. This feature can be disable using |clip limits=false|. +If $x$-limits have been specified explicitly and $y$-limits are computed automatically, the automatic computation of $y$-limits will only considers points which fall into the specified $x$-range (and vice--versa). The same holds true if, for example, only |xmin| has been provided explicitly: in that case, |xmax| will be updated only for points for which $x \ge $|xmin| holds. This feature can be disabled using |clip limits=false|. Axis limits can be increased automatically using the |enlargelimits| option. \begin{codeexample}[] \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2803,7 +3457,7 @@ Axis limits can be increased automatically using the |enlargelimits| option. \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[xmin=0] - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2811,7 +3465,7 @@ Axis limits can be increased automatically using the |enlargelimits| option. \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[ymax=10] - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2846,12 +3500,13 @@ A small value of |enlarge x limits| may avoid problems with large markers near t \end{stylekey} \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. \end{environment} \subsection{Tick and Grid Options} -\begin{pgfplotsxykey}{\x tick=\mchoice{\textbackslash empty,data,\marg{coordinate list}} (initially \marg{})} +\begin{pgfplotsxykey}{\x tick=\mchoice{\textbackslash empty,data,\normalfont\marg{coordinate list}} (initially \marg{})} The options |xtick| and |ytick| assigns a list of \emph{Positions} where ticks shall be placed. The argument is either the command |\empty|, |data| or a list of coordinates. The choice |\empty| will result in no tick at all. The special value |data| will produce tick marks at every coordinate of the first plot. Otherwise, tick marks will be placed at every coordinate in \marg{coordinate list}. If this list is empty, \PGFPlots\ will compute a default list. \marg{coordinate list} will be used inside of a |\foreach \x in |\marg{coordinate list} statement. The format is as follows: @@ -2861,11 +3516,13 @@ The options |xtick| and |ytick| assigns a list of \emph{Positions} where ticks s \item |{0,2,...,10}| (the same as |{0,2,4,6,8,10}|), \item |{9,...,3.5}| (the same as |{9, 8, 7, 6, 5, 4}|), \item See \cite[Section~34]{tikz} for a more detailed definition of the options. + \item Please be careful with whitespaces inside of \marg{coordinate list} (at least around the dots). \end{itemize} For logplots, \PGFPlots\ will apply $\log(\cdot)$ to each element in `\marg{coordinate list}'. \begin{codeexample}[] \begin{tikzpicture} \begin{loglogaxis}[xtick={12,9897,1468864}] + % see above for this macro: \plotcoords \end{loglogaxis} \end{tikzpicture} @@ -2911,7 +3568,7 @@ or \end{codeexample} Please prefer the `|.append style|' versions whenever possible to ensure compatibility with future versions. -This style commands can be used at any time. The tick line width can be configured with `|major tick length|' and `|minor tick length|'. +These style commands can be used at any time. The tick line width can be configured with `|major tick length|' and `|minor tick length|'. \begin{codeexample}[] \begin{tikzpicture} @@ -2950,8 +3607,8 @@ This style commands can be used at any time. The tick line width can be configur \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[minor tick num=1] - \addplot (\x,\x^3); - \addplot (\x,-20*\x); + \addplot {x^3}; + \addplot {-20*x}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2959,8 +3616,8 @@ This style commands can be used at any time. The tick line width can be configur \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[minor tick num=3] - \addplot (\x,\x^3); - \addplot (\x,-20*\x); + \addplot {x^3}; + \addplot {-20*x}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2975,8 +3632,8 @@ This style commands can be used at any time. The tick line width can be configur \begin{tikzpicture} \begin{axis}[minor x tick num=1, minor y tick num=3] - \addplot (\x,\x^3); - \addplot (\x,-20*\x); + \addplot {x^3}; + \addplot {-20*x}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -2999,7 +3656,7 @@ Adds \emph{additional} tick positions and tick labels to the $x$~or~$y$ axis. `A rotate=90,anchor=east}}, extra x tick labels={Cut}, ] - \addplot (\x,{exp(\x)}); + \addplot {exp(x)}; \addlegendentry{$e^x$} \end{axis} \end{tikzpicture} @@ -3051,7 +3708,7 @@ They are affected by |major tick length| or options like |grid=major|. \end{pgfplotsxykey} \begin{pgfplotskeylist}{ - space between ticks=\marg{number} (initially 35), + max space between ticks=\marg{number} (initially 35), try min ticks=\marg{number} (initially 4), try min ticks log=\marg{number} (initially 3)} see Options |xtick| and |ytick| for a description. @@ -3070,18 +3727,18 @@ These options allow to place ticks at selected positions $10^k, k \in \text{\mar Using `|xtickten={1,2,3,4}|' is equivalent to `|xtick={1e1,1e2,1e3,1e4}|', but it requires fewer computational time and it allows to use the short syntax `|xtickten={1,...,4}|'. \begin{codeexample}[] -\begin{tikzpicture}[samples=8] +\begin{tikzpicture} \begin{semilogyaxis}[ + samples=8, ytickten={-6,-4,...,4}, domain=0:10] -% invoke gnuplot to generate coordinates: -\addplot plot[id=pow1] - function {2**(-2*x + 6)}; +\addplot {2^(-2*x + 6)}; \addlegendentry{$2^{-2x + 6}$} +% or invoke gnuplot to generate coordinates: \addplot plot[id=pow2] - function {2**(-1.5*x -3)}; + gnuplot {2**(-1.5*x -3)}; \addlegendentry{$2^{-1.5x -3}$} \end{semilogyaxis} \end{tikzpicture} @@ -3194,7 +3851,7 @@ which has the same effect as the `|every x tick label|' statement above. This is \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[x tick label as interval] - \addplot (\x,3*\x); + \addplot {3*x}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -3226,12 +3883,9 @@ which has the same effect as the `|every x tick label|' statement above. This is \label{sec:scaled:ticks}% \begin{pgfplotsxykeylist}{ - scaled \x\ ticks=\mchoice{true,false} (initially true), - scaled ticks=\mchoice{true,false} (initially true)} -Allows to factor out common exponents in tick labels. For example, if you have tick labels $20000,40000$ and $60000$, you may want to save some space and write $2,4,6$ with a separate factor `$\cdot 10^4$'. Use `|scaled ticks=true|' to enable this feature (default is |true|). - - The |scaled ticks| key is a style which simply enables scaled ticks for both, $x$ and $y$. - + scaled \x\ ticks=\mchoice{true,false,base 10:{\normalfont\meta{e}},real:{\normalfont\meta{number}},manual:{\normalfont\marg{text}\marg{tick scale code}}} (initially true), + scaled ticks=\mchoice{true,false,base 10:{\normalfont\meta{e}},real:{\normalfont\meta{number}},manual:{\normalfont\marg{text}\marg{tick scale code}\hfill}} (initially true)} +Allows to factor out common exponents in tick labels for \emph{linear axes}. For example, if you have tick labels $20000,40000$ and $60000$, you may want to save some space and write $2,4,6$ with a separate factor `$\cdot 10^4$'. Use `|scaled ticks=true|' to enable this feature. In case |true|, tick scaling will be triggered if the data range is either too large or too small (see below). \begin{codeexample}[] \begin{tikzpicture} \begin{axis}[scaled ticks=true] @@ -3255,13 +3909,102 @@ Allows to factor out common exponents in tick labels. For example, if you have t \end{axis} \end{tikzpicture} \end{codeexample} + + The |scaled ticks| key is a style which simply sets scaled ticks for both, $x$ and $y$. + + The value |base 10:|\meta{e} allows to adjust the algorithm manually. For example, |base 10:3| will divide every tick label by $10^3$: +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[scaled ticks=base 10:3, + /pgf/number format/sci subscript] + \addplot coordinates + {(-0.00001,2e12) (-0.00005,4e12) }; + \end{axis} +\end{tikzpicture} +\end{codeexample} +\noindent Here, the \texttt{sci subscript} option simply saves space. +In general, |base 10:|$e$ will divide every tick by $10^e$. The effect +is not limited by the ``too large or too small'' decisions mentioned +above. + + The value |real:|\meta{number} allows to divide every tick by a fixed \meta{number}. + For example, the following plot is physically ranged from $0$ to $2\pi$, but the tick scaling algorithm is configured to divide every tick label by $\pi$. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[ + xtick={0,1.5708,...,10}, + domain=0:2*pi, + scaled x ticks={real:3.1415}, + xtick scale label code/.code={$\cdot \pi$}] + \addplot {sin(deg(x))}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + \noindent Setting |scaled ticks=real:|\meta{number} also changes the |tick scale label code| to +\begin{codeexample}[code only] +\pgfkeys{/pgfplots/xtick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}. +\end{codeexample} + +A further -- not very useful -- example is shown below. Every $x$ tick label has been divided by $2$, every $y$ tick label by $3$. +\nobreak +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[ + scaled x ticks=real:2, + scaled y ticks=real:3] + \addplot {x^3}; + \node[pin=135:{$(3,9)$}] at (axis cs:3,9) {}; + \end{axis} +\end{tikzpicture} +\end{codeexample} + + Unfortunately, \meta{number} can't be evaluated with \PGF's math parser (yet) to maintain the full data range accepted by \PGFPlots. + + The last option, |scaled ticks=manual:|\marg{text}\marg{tick scale code} allows even more customization. It allows \emph{full control} over the displayed scaling label \emph{and} the scaling code: \marg{text} is used as-is inside of the tick scaling label while \marg{tick scale code} is supposed to be a one-argument-macro which scales each tick. Example: +\begin{codeexample}[] +\begin{tikzpicture} +\begin{axis}[ + % warning: the '%' signs are necessary (?) + scaled y ticks=manual:{$+65\,535$}{% + \pgfmathfloatcreate{1}{6.5535}{4}% + \pgfmathfloatsubtract{#1}{\pgfmathresult}% + }, + yticklabel style={ + /pgf/number format/fixed, + /pgf/number format/precision=1}, +] +\addplot plot coordinates { + (0, 65535) + (13, 65535) + (14, 65536) + (15, 65537) + (30, 65537) +}; +\end{axis} +\end{tikzpicture} +\end{codeexample} +\noindent The example uses |$+65\,535$| as tick scale label content. Furthermore, it defines the customized tick label formula $y - (+6.5535\cdot 10^4) = y - 65535$ to generate $y$ tick labels. + +The \marg{text} can be arbitrary. It is completely in user control. The second argument, \marg{tick scale code} is supposed to be a one-argument-macro in which |#1| is the current tick position in floating point representation. The macro is expected to assign |\pgfmathresult| (also in floating point representation). The \PGF\ manual~\cite{tikz} contains detailed documentation about its math engine (including floating point\footnote{However, that particular stuff is newer than \PGF\ $2.00$. At the time of this writing, it is only available as (public) CVS version.}). + +This feature may also be used do transform coordinates in case they can't be processed with \PGFPlots: transform them and supply a proper tick scaling method such that tick labels represent the original range. + +If \marg{text} is empty, the tick scale label won't be drawn (and no space will be occupied). + +Tick scaling does \emph{not} work for logarithmic axes. \end{pgfplotsxykeylist} -\begin{pgfplotscodekey}{tick scale label code} +\begin{pgfplotsxycodekeylist}{\x tick scale label code} Allows to change the default code for scaled tick labels. The default is \begin{codeexample}[code only] -tick scale label code/.code={$\cdot 10^{#1}$}. +xtick scale label code/.code={$\cdot 10^{#1}$}. \end{codeexample} + +If the code is empty, no tick scale label will be drawn (and no space is consumed). +\end{pgfplotsxycodekeylist} + +\begin{pgfplotscodekey}{tick scale label code} + A style which sets both, |xtick scale label code| and the corresponding variant for $y$. \end{pgfplotscodekey} \begin{pgfplotskey}{scale ticks below=\marg{exponent}} @@ -3282,7 +4025,7 @@ Allows fine tuning of the '|scaled ticks|' algorithm: if the axis limits are of \begin{pgfplotsxykey}{\x tick pos=\mchoice{left,right,both} (initially both)} Allows to choose where to place the small tick lines. In the default configuration, this does also affect tick \emph{labels}, see below. -For $y$, the additional choices |bottom| and |top| can be used which are equivalent to |left| and |right|, respectively. Both are accepted for $y$. +For $x$, the additional choices |bottom| and |top| can be used which are equivalent to |left| and |right|, respectively. Both are accepted for $y$. \end{pgfplotsxykey} \begin{pgfplotskey}{tickpos=\mchoice{left,right,both}} @@ -3292,7 +4035,7 @@ For $y$, the additional choices |bottom| and |top| can be used which are equival \begin{pgfplotsxykey}{\x ticklabel pos=\mchoice{left,right,default} (initially default)} Allows to choose where to place tick \emph{labels}. The choices |left| and |right| place tick labels either at the left or at the right side of the complete axis. The choice |default| uses the same setting as |xtick pos| (or |ytick pos|). This option is only useful for boxed axis -- keep it to |default| for non-boxed figures. -For $y$, the additional choices |bottom| and |top| can be used which are equivalent to |left| and |right|, respectively. Both are accepted for $y$. +For $x$, the additional choices |bottom| and |top| can be used which are equivalent to |left| and |right|, respectively. Both are accepted for $x$. \end{pgfplotsxykey} \begin{pgfplotskey}{ticklabelpos=\mchoice{left,right,default}} @@ -3386,6 +4129,7 @@ This example employs the coordinates defined on page~\pageref{page:plotcoords:sr ylabel={$L_2$ Error}, grid=major ] +% see above for this macro: \plotcoords \end{loglogaxis} \end{tikzpicture} @@ -3413,6 +4157,9 @@ Grid lines will be drawn before tick lines are processed, so ticks will be drawn \end{codeexample} \end{pgfplotsxykeylist} +\begin{pgfplotsxykeylist}{\x tickmin=\marg{coord}, \x tickmax=\marg{coord}} + These keys can be used to modify minimum/maximum values before ticks are drawn. Because this applies to axis discontinuities, it is described on page~\pageref{key:xytickminmax} under section~\ref{key:xytickminmax}, ``Axis Discontinuities"'. +\end{pgfplotsxykeylist} @@ -3435,14 +4182,6 @@ Grid lines will be drawn before tick lines are processed, so ticks will be drawn Use |\pgfplotsset{|\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|. \end{handler} -\begin{command}{\pgfplotsset\marg{key-value-list}} - Defines or sets all options in \marg{key-value-list}. - - It is a shortcut for |\pgfqkeys{/pgfplots}|\marg{key-value-list}, that means it inserts the prefix |/pgfplots| to any option which has no full path. - - You can define new style keys with |.style| and |.append style|, see above. -\end{command} - \subsubsection*{Styles installed for linear/logarithmic axis} \begin{stylekey}{/pgfplots/every axis (initially empty)} @@ -3469,8 +4208,6 @@ Grid lines will be drawn before tick lines are processed, so ticks will be drawn \begin{stylekey}{/pgfplots/every axis plot (initially empty)} Installed for each plot. This style may contain \meta{behavior options} like samples, gnuplot parameters, error bars and it may contain \meta{style options} which affect the final drawing commands. - -% \FIXME{currently, pgfplots options need to be prefixed with /pgfplots/} \end{stylekey} \begin{stylekey}{/pgfplots/every axis plot post (initially empty)} @@ -3485,8 +4222,8 @@ Grid lines will be drawn before tick lines are processed, so ticks will be drawn legend style={ at={(0.03,0.97)},anchor=north west}, domain=0:1] - \addplot (\x,\x^2); - \addplot (\x,{exp(\x)}); + \addplot {x^2}; + \addplot {exp(x)}; \legend{$x^2$,$e^x$} \end{axis} \end{tikzpicture} @@ -3494,7 +4231,11 @@ Grid lines will be drawn before tick lines are processed, so ticks will be drawn \end{stylekey} \begin{stylekey}{/pgfplots/every axis plot no \# (initially empty)} - Used for every \#th plot where $\#=1,2,3,4,\dotsc$. This option may also contain \meta{behavior options}. + Used for every \#th plot where $\#=0,1,2,3,4,\dotsc$. This option may also contain \meta{behavior options}. +\end{stylekey} + +\begin{stylekey}{/pgfplots/every forget plot (initially empty)} + Used for every plot which has |forget plot| activated. This option may also contain \meta{behavior options}. \end{stylekey} \subsubsection*{Styles for axis descriptions} @@ -3503,7 +4244,7 @@ Grid lines will be drawn before tick lines are processed, so ticks will be drawn Used for $x$~and~$y$ axis label. You can use `|at=|\parg{x,y} to set its position where $(0,0)$ refers to the lower left corner and $(1,1)$ to the upper right one. \end{stylekey} -\pgfplotsshortstylekey label style=every axis label; +\pgfplotsshortstylekey label style=every axis label\pgfeov \begin{xystylekey}{/pgfplots/every axis \x\ label} Used only~$x$ or only for~$y$ labels, installed after `|every axis label|'. @@ -3524,7 +4265,7 @@ Grid lines will be drawn before tick lines are processed, so ticks will be drawn \paragraph{Attention:} These styles will be overwritten by |axis x line| and/or |axis y line|. Please remember to place your modifications after the axis line variations. \end{xystylekey} -\pgfplotsshortxystylekeys \x\ label style,\x label style=every axis \x\ label; +\pgfplotsshortxystylekeys \x\ label style,\x label style=every axis \x\ label\pgfeov \begin{stylekey}{/pgfplots/every axis title} Used for any axis title. The |at=|\parg{x,y} command works as for `|every axis label|'. @@ -3535,7 +4276,7 @@ The initial setting is \end{codeexample} \end{stylekey} -\pgfplotsshortstylekey title style=every axis title; +\pgfplotsshortstylekey title style=every axis title\pgfeov \begin{stylekey}{/pgfplots/every axis legend} Installed for each legend. As for |every axis label|, the legend's position can be placed using coordinates between $0$~and~$1$, see above. @@ -3552,7 +4293,7 @@ The initial setting is \end{codeexample} \end{stylekey} -\pgfplotsshortstylekey legend style=every axis legend; +\pgfplotsshortstylekey legend style=every axis legend\pgfeov \subsubsection*{Styles for axis lines} \begin{xystylekey}{/pgfplots/every outer \x\ axis line (initially empty)} @@ -3584,19 +4325,19 @@ Please refer to section~\ref{pgfplots:page:axislines} on page~\pageref{pgfplots: Installed for each of the small tick \emph{lines}. \end{stylekey} -\pgfplotsshortstylekey tick style=every tick; +\pgfplotsshortstylekey tick style=every tick\pgfeov \begin{stylekey}{/pgfplots/every minor tick (initially empty)} Used for each minor tick line, installed after `|every tick|'. \end{stylekey} -\pgfplotsshortstylekey minor tick style=every minor tick; +\pgfplotsshortstylekey minor tick style=every minor tick\pgfeov \begin{stylekey}{/pgfplots/every major tick (initially empty)} Used for each major tick line, installed after `|every tick|'. \end{stylekey} -\pgfplotsshortstylekey major tick style=every major tick; +\pgfplotsshortstylekey major tick style=every major tick\pgfeov \begin{stylekey}{/pgfplots/every tick label (initially empty)} Used for each $x$~and~$y$ tick labels. @@ -3606,7 +4347,7 @@ Please refer to section~\ref{pgfplots:page:axislines} on page~\pageref{pgfplots: Used for each $x$ (or $y$, respectively) tick label, installed after `|every tick label|'. \end{xystylekey} -\pgfplotsshortxystylekeys \x\ tick label style,\x ticklabel style=every \x\ tick label; +\pgfplotsshortxystylekeys \x\ tick label style,\x ticklabel style=every \x\ tick label\pgfeov \begin{xystylekey}{/pgfplots/every \x\ tick scale label} Configures placement and display of the nodes containing the order of magnitude of tick labels, see section~\ref{sec:scaled:ticks} for more information about |scaled ticks|. @@ -3619,24 +4360,24 @@ The initial settings are \end{codeexample} \end{xystylekey} -\pgfplotsshortxystylekey \x\ tick scale label style=every \x\ tick scale label; +\pgfplotsshortxystylekey \x\ tick scale label style=every \x\ tick scale label\pgfeov \begin{xystylekey}{/pgfplots/every \x\ tick (initially empty)} Installed for tick \emph{lines} on either $x$ or $y$ axis. \end{xystylekey} -\pgfplotsshortxystylekey \x\ tick style=every \x\ tick; +\pgfplotsshortxystylekey \x\ tick style=every \x\ tick\pgfeov \begin{xystylekey}{/pgfplots/every minor \x\ tick (initially empty)} Installed for minor tick lines on either $x$ or $y$ axis. \end{xystylekey} -\pgfplotsshortxystylekey minor \x\ tick style=every minor \x\ tick; +\pgfplotsshortxystylekey minor \x\ tick style=every minor \x\ tick\pgfeov \begin{xystylekey}{/pgfplots/every major \x\ tick (initially empty)} Installed for major tick lines on either $x$ or $y$ axis. \end{xystylekey} -\pgfplotsshortxystylekey major \x\ tick style=every major \x\ tick; +\pgfplotsshortxystylekey major \x\ tick style=every major \x\ tick\pgfeov \begin{xystylekey}{/pgfplots/every extra \x\ tick} Allows to configure the appearance of `|extra x ticks|'. This style is installed before touching the first extra $x$~tick. It is possible to set any option which affects tick or grid line generation. @@ -3656,7 +4397,7 @@ The initial setting is \end{codeexample} \end{xystylekey} -\pgfplotsshortxystylekey extra \x\ tick style=every extra \x\ tick; +\pgfplotsshortxystylekey extra \x\ tick style=every extra \x\ tick\pgfeov @@ -3666,37 +4407,37 @@ The initial setting is Used for each grid line. \end{stylekey} -\pgfplotsshortstylekey grid style=every axis grid; +\pgfplotsshortstylekey grid style=every axis grid\pgfeov \begin{stylekey}{/pgfplots/every minor grid (initially empty)} Used for each minor grid line, installed after `|every axis grid|'. \end{stylekey} -\pgfplotsshortstylekey minor grid style=every minor grid; +\pgfplotsshortstylekey minor grid style=every minor grid\pgfeov \begin{stylekey}{/pgfplots/every major grid (initially empty)} Likewise, for major grid lines. \end{stylekey} -\pgfplotsshortstylekey major grid style=every major grid; +\pgfplotsshortstylekey major grid style=every major grid\pgfeov \begin{xystylekey}{/pgfplots/every axis \x\ grid (initially empty)} Used for each grid line in either $x$ or $y$ direction. \end{xystylekey} -\pgfplotsshortxystylekey \x\ grid style=every axis \x\ grid; +\pgfplotsshortxystylekey \x\ grid style=every axis \x\ grid\pgfeov \begin{xystylekey}{/pgfplots/every minor \x\ grid (initially empty)} Used for each minor grid line in either $x$ or $y$ direction. \end{xystylekey} -\pgfplotsshortxystylekey minor \x\ grid style=every minor \x\ grid; +\pgfplotsshortxystylekey minor \x\ grid style=every minor \x\ grid\pgfeov \begin{xystylekey}{/pgfplots/every major \x\ grid (initially empty)} Used for each major grid line in either $x$ or $y$ direction. \end{xystylekey} -\pgfplotsshortxystylekey major \x\ grid style=every major \x\ grid; +\pgfplotsshortxystylekey major \x\ grid style=every major \x\ grid\pgfeov \subsubsection*{Styles for error bars} @@ -3704,7 +4445,7 @@ The initial setting is Installed for every error bar. \end{stylekey} -\pgfplotsshortstylekey error bars/error bar style=every error bar; +\pgfplotsshortstylekey error bars/error bar style=every error bar\pgfeov \subsubsection{(Re-)Defining Own Styles} \label{sec:styles:own}% @@ -3721,7 +4462,7 @@ to create own styles. If \meta{style name} exists already, it will be replaced. \end{tikzpicture} \end{codeexample} -\subsection{Alignment Options} +\subsection{Alignment Options and Bounding Box Control} \label{pgfplots:sec:align} \begin{pgfplotskey}{anchor=\marg{name} (initially south west)} @@ -3748,7 +4489,7 @@ There are four sets of anchors available: anchors positioned on the axis rectang \addplot table from{\plottable}; %\addplot coordinates {(0,0) (1,1)}; \addlegendentry{$f(x)$} - \addplot[red] plot[id=gnuplot_ppp,domain=-40:40,samples=120] function{10000*sin(x/3)}; + \addplot[red] plot[id=gnuplot_ppp,domain=-40:40,samples=120] gnuplot{10000*sin(x/3)}; \addlegendentry{$g(x)$} \end{axis} }% @@ -3827,7 +4568,7 @@ And finally, we have origin anchors which are especially useful when axis lines every axis y label/.style={at={(current axis.above origin)},anchor=north east}, inner axis line style={->}, ] - \addplot plot[domain=-2:5] (\x,20*\x); + \addplot plot[domain=-2:5] {20*x}; \end{axis} {\pgfplotsset{every pin/.append style={pin distance=1cm}}% \showit{above origin}{45} @@ -3851,13 +4592,13 @@ The default axis anchor is |south west|, which means that the picture coordinate \tikzset{domain=-1:1} \begin{tikzpicture} \begin{axis}[xlabel=A normal sized $x$ label] - \addplot[smooth,blue,mark=*] (\x,\x^2); + \addplot[smooth,blue,mark=*] {x^2}; \end{axis} \end{tikzpicture}% \hspace{0.15cm} \begin{tikzpicture} \begin{axis}[xlabel={$\displaystyle \sum_{i=0}^N n_i $ }] - \addplot[smooth,blue,mark=*] (\x,\x^2); + \addplot[smooth,blue,mark=*] {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -3866,13 +4607,13 @@ The default axis anchor is |south west|, which means that the picture coordinate \tikzset{domain=-1:1} \begin{tikzpicture}[baseline] \begin{axis}[xlabel=A normal sized $x$ label] - \addplot[smooth,blue,mark=*] (\x,\x^2); + \addplot[smooth,blue,mark=*] {x^2}; \end{axis} \end{tikzpicture}% \hspace{0.15cm} \begin{tikzpicture}[baseline] \begin{axis}[xlabel={$\displaystyle \sum_{i=0}^N n_i $ }] - \addplot[smooth,blue,mark=*] (\x,\x^2); + \addplot[smooth,blue,mark=*] {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -3921,12 +4662,70 @@ cycle list={ \end{codeexample} -\item[Bounding box restrictions] +\item[Bounding box restrictions] 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. +\end{enumerate} +\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. + + For \PGFPlots, |overlay| can be useful to position legends or other axis descriptions outside of the axis~-- without affecting its size (and without affecting alignment). + +For example, one may want to include only certain parts of the axis into the final bounding box. This would allow horizontal alignment (centering): +\begin{codeexample}[] +\begin{tikzpicture}% + \begin{axis}[ + title=A title, + ylabel style={overlay}, + yticklabel style={overlay}, + 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} +\end{tikzpicture}% +\end{codeexample} +\noindent Now, the left axis descriptions ($y$ label and $y$ ticks) stick out of the bounding box. + +The following example places a legend somewhere without affecting the bounding box. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{axis}[ + domain=0:6.2832,samples=200, + legend style={ + overlay, + at={(-0.5,0.5)}, + anchor=center}, + every axis plot post/.append style={mark=none}, + enlargelimits=false] + + \addplot {sin(deg(x)+3)+rand*0.05}; + \addplot {cos(deg(x)+2)+rand*0.05}; + \legend{Signal 1,Signal 2} + \end{axis} +\end{tikzpicture} +\end{codeexample} + + More information about the |overlay| option can be found in the \PGF\ manual~\cite{tikz}. +\end{key} + + \label{sec:bounding:box:example}% +\index{Bounding Box Control} +\index{Bounding Box Control!pgfinterruptboundingbox} {% -The following figure is centered and encapsulated with an |\fbox| to show its bounding box. -\setlength{\fboxsep}{0pt}% +An alternative to |overlay| is shown below: the figure has a truncated bounding box with is shown using |\fbox|. \begin{codeexample}[] +\setlength{\fboxsep}{0pt}% \fbox{% \begin{tikzpicture}% \begin{pgfinterruptboundingbox} @@ -3939,9 +4738,9 @@ The following figure is centered and encapsulated with an |\fbox| to show its bo anchor=north,legend columns=-1}, domain=-2:2 ] - \addplot (\x,\x^2); - \addplot (\x,\x^3); - \addplot (\x,\x^4); + \addplot {x^2}; + \addplot {x^3}; + \addplot {x^4}; \legend{$x^2$,$x^3$,$x^4$} \end{axis} \end{pgfinterruptboundingbox} @@ -3953,7 +4752,7 @@ The following figure is centered and encapsulated with an |\fbox| to show its bo }% \end{codeexample}% }% -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. +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{description} \end{pgfplotskey} @@ -3967,10 +4766,11 @@ The |pgfinterruptboundingbox| environment does not include its content into the \end{predefinednode} \begin{pgfplotskey}{at=\marg{coordinate expression}} -Assigns a position for the complete axis image. This option works similarly to the |at|-option of |\node[at=|\marg{coordinate expression}|]|, see~\cite{tikz}. The common syntax is |at=|\parg{x,y}. +Assigns a position for the complete axis image. This option works similarly to the |at|-option of |\node[at=|\marg{coordinate expression}|]|, see~\cite{tikz}. The common syntax is |at={|\parg{x,y}|}|. \end{pgfplotskey} \subsection{Symbolic Coordinates and User Transformations} +\label{pgfplots:sec:symbolic:coords} \PGFPlots\ supports user transformations which can be applied to input and output coordinates. Suppose the plot shall display days versus account statements over time. Then, one wants to visualize date versus credit balance. But: dates need to be transformed to numbers before doing so! Furthermore, tick labels shall be displayed as dates as well. This, and more general transformations, can be realized using the |x coord trafo| and |y coord trafo| keys. \begin{pgfplotsxycodekeylist}{ @@ -4005,7 +4805,8 @@ Assigns a position for the complete axis image. This option works similarly to t \noindent which simply disables the transformation (the same for $y$, of course). \end{pgfplotsxycodekeylist} -\subsubsection{Dates as input coordinates} +\subsubsection{Dates as Input Coordinates} +\label{pgfplots:sec:date:coords} The already mentioned application of using dates as input coordinates has been predefined. It relies on the \pgfname\ calendar library which converts dates to numbers in the julian calendar. Then, one coordinate unit is one day. \begin{tikzlibrary}{dateplot} @@ -4029,10 +4830,11 @@ The already mentioned application of using dates as input coordinates has been p A complete example (with fictional data) is shown below. \pgfplotsset{anchor=center,/tikz/every picture/.append style={baseline}} +% \usetikzlibrary{dateplot}\usepackage{eurosym} \begin{codeexample}[] % requires \usetikzlibrary{dateplot} ! -\pgfplotstabletypesetfile[string type]{plotdata/accounts.dat} +\pgfplotstabletypeset[string type]{plotdata/accounts.dat} \begin{tikzpicture} \begin{axis}[ @@ -4072,6 +4874,8 @@ where $y = \log(m)$ is computed with a newton method applied to $\exp(y) - m$. T \label{sec:disabledatascaling}% \begin{pgfplotskey}{disabledatascaling=\mchoice{true,false} (initally false, default true)} +\index{Accuracy!Data Transformation}% +\index{Errors!dimension too large}% Disables internal re-scaling of input data. Normally, every input data like plot coordinates, tick positions or whatever, are parsed without using \TeX's limited number precision. Then, a transformation like \[ T(x) = 10^{q-m} \cdot x - a \] is applied to every input coordinate/position where $m$ is ``the order of $x$'' base~$10$. Example: $x=1234 = 1.234\cdot 10^3$ has order~$m=4$ while $x=0.001234 = 1.234\cdot 10^{-3}$ has order $m=-2$. The parameter~$q$ is the order of the axis' width/height. @@ -4085,10 +4889,10 @@ So far, the data scale transformation applies only to normal axis (logarithmic s \end{pgfplotskey} -\begin{pgfplotsxykey}{\x\ filter/.code=\marg{...}} % FIXME create a xycodekey environment +\begin{pgfplotsxycodekeylist}{\x\ filter} The code keys |x filter| and |y filter| allow coordinate filtering. A coordinate filter gets an input coordinate as |#1|, applies some operation and writes the result into the macro |\pgfmathresult|. If |\pgfmathresult| is empty afterwards, the coordinate is discarded. -It is allowed if filters do not |\pgfmathresult|. In this case, the unfiltered coordinate will be used. +It is allowed if filters do not change |\pgfmathresult|. In this case, the unfiltered coordinate will be used. Coordinate filters are useful in automatic processing system, where \PGFPlots\ is used to display automatically generated plots. You may not want to filter your coordinates by hand, so these options provide a tool to do this automatically. @@ -4118,7 +4922,7 @@ During evaluation of the filter, the macro |\coordindex| contains the number of \fi \fi }] -\addplot (\x,\x^2); +\addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -4129,7 +4933,7 @@ There is also a style key which simplifies selection by index, see below. If the corresponding axis is logarithmic, |#1| is the \emph{logarithm} of the coordinate as a real number, for example |#1=4.2341|. The arguments to coordinate filters are not transformed. You may need to call coordinate parsing routines. -\end{pgfplotsxykey} +\end{pgfplotsxycodekeylist} \begin{stylekey}{/pgfplots/skip coords between index=\marg{begin}\marg{end}} A style which appends an |x filter| which discards selected coordinates. The selection is done by index where indexing starts with~$0$, see |\coordindex|. Every coordinate with index $\meta{begin} \le i < \meta{end}$ will be skipped. @@ -4140,7 +4944,7 @@ There is also a style key which simplifies selection by index, see below. skip coords between index={5}{11}, skip coords between index={15}{18}] -\addplot (\x,\x^2); +\addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -4153,13 +4957,49 @@ There is also a style key which simplifies selection by index, see below. \begin{pgfplotskey}{execute at begin plot=\marg{commands}} This axis option allows to invoke \marg{commands} at the beginning of each |\addplot| command. The argument \marg{commands} can be any \TeX\ content. -You may use this in conjunction with |xfilter=...| to reset any counters or whatever. An example would be to change every $4$th coordinate. +You may use this in conjunction with |x filter=...| to reset any counters or whatever. An example would be to change every $4$th coordinate. \end{pgfplotskey} \begin{pgfplotskey}{execute at end plot=\marg{commands}} This axis option allows to invoke \marg{commands} after each |\addplot| command. The argument \marg{commands} can be any \TeX\ content. \end{pgfplotskey} +\begin{pgfplotskey}{forget plot=\marg{true,false} (initially false)} +\label{pgfplots:forgetplot} + Allows to include plots which are not remembered for legend entries, which do not increase the number of plots and which are not considered for cycle lists. + + A forgotten plot can be some sort of decoration which has a separate style and does not influence the axis state, although it is processed as any other plot. + Please provide this option as \meta{behavior option} to |\addplot| as in the following example. +\begin{codeexample}[] +\begin{tikzpicture} + \begin{loglogaxis}[ + table/x=Basis, + table/y={L2/r}, + xlabel=Degrees of Freedom, + ylabel=relative Error, + title=New Experiments (old in gray), + legend entries={$e_1$,$e_2$,$e_3$} + ] + \addplot[black!15] plot[forget plot] + table {plotdata/oldexperiment1.dat}; + \addplot[black!15] plot[forget plot] + table {plotdata/oldexperiment2.dat}; + \addplot[black!15] plot[forget plot] + table {plotdata/oldexperiment3.dat}; + \addplot table {plotdata/newexperiment1.dat}; + \addplot table {plotdata/newexperiment2.dat}; + \addplot table {plotdata/newexperiment3.dat}; + \end{loglogaxis} +\end{tikzpicture} +\end{codeexample} + Since forgotten plots won't increase the plot index, they will use the same |cycle list| entry as following plots. This can be used to ``interrupt'' plots as is described in section~\ref{pgfplots:interrupt}. +\index{Interrupted Plots} + + The style |every forget plot| can be used to configure styles for each such plot. Please note that |every plot no |\meta{index} styles are not applicable here. + + A forgotten plot will be stacked normally if |stack plots| is enabled! +\end{pgfplotskey} + \begin{pgfplotscodekey}{before end axis} Allows to insert \marg{commands} just before the axis is ended. This option takes effect inside of the clipped area. \begin{codeexample}[] @@ -4172,7 +5012,7 @@ Allows to insert \marg{commands} just before the axis is ended. This option take }}} \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -4189,7 +5029,7 @@ Allows to insert \marg{commands} right after the end of the clipped drawing comm }}} \begin{tikzpicture} \begin{axis} - \addplot (\x,\x^2); + \addplot {x^2}; \end{axis} \end{tikzpicture} \end{codeexample} @@ -4207,7 +5047,7 @@ Allows to insert \marg{commands} right after the end of the clipped drawing comm axis on top=true, axis x line=middle, axis y line=middle] - \addplot+[fill] (\x,\x^3) \closedcycle; + \addplot+[fill] {x^3} \closedcycle; \end{axis} \end{tikzpicture} \end{codeexample} @@ -4218,9 +5058,23 @@ Allows to insert \marg{commands} right after the end of the clipped drawing comm axis on top=false, axis x line=middle, axis y line=middle] - \addplot+[fill] (\x,\x^3) \closedcycle; + \addplot+[fill] {x^3} \closedcycle; \end{axis} \end{tikzpicture} \end{codeexample} Please note that this feature does not affect plot marks. I think it looks unfamiliar if plot marks are crossed by axis descriptions. \end{pgfplotskey} + +\begin{key}{/pgf/fpu=\marg{true,false} (initially true)} +\index{Precision} + This key activates or deactivates the floating point unit. If it is disabled (|false|), the core \PGF\ math engine written by Mark Wibrow and Till Tantau will be used for |plot expression|. + However, this engine has been written to produce graphics and is not suitable for scientific computing. It is limited to fixed point numbers in the range $\pm 16384.00000$. + + If the |fpu| is enabled (|true|, the initial configuration) the high-precision floating point library of \PGF\ written by Christian Feuersänger will be used. It offers the full range of IEEE double precision computing in \TeX. This FPU is also part of \PGFPlotstable, and it is activated by default for |create col/expr| and all other predefined mathematical methods. + + Use +\begin{codeexample}[code only] +\pgfkeys{/pgf/fpu=false} +\end{codeexample} + \noindent in order to de-activate the extended precision. If you prefer using the |fp| (fixed point) package, possibly combined with Mark Wibrows corresponding \PGF\ library, the |fpu| will be deactivated automatically. Please note, however, that |fp| has a smaller data range (about $\pm 10^{17}$) and may be slower. +\end{key} diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex index 38e4a884194..d915a4f8a1a 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.resources.tex @@ -32,7 +32,7 @@ \end{codeexample} \message{ok, passed.}% -\PGFPlots\ relies completely on \TeX\ to do all typesetting. In 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. +\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. @@ -72,4 +72,4 @@ stack_size = n \end{codeexample} The log--file usually contains information about the parameter which needs to be enlarged. \end{enumerate} -Unfortunately, \TeX\ does not allow arbirtrary memory limits, there is an upper bound hard coded in the executables. +Unfortunately, \TeX\ does not allow arbitrary memory limits, there is an upper bound hard coded in the executables. diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex index 36fce7596e1..bc136eeb2f2 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplots.tex @@ -20,10 +20,21 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \input{pgfplots.preamble.tex} +%\RequirePackage[english,francais]{babel} %\usetikzlibrary{external} %\tikzexternalize[prefix=figures/]{pgfplots} +\title{% + Manual for Package \PGFPlots\\ + {\small Version \pgfplotsversion}\\ + {\small\href{http://sourceforge.net/projects/pgfplots}{http://sourceforge.net/projects/pgfplots}}} + +%\includeonly{pgfplots.reference} + + +\begin{document} + \def\plotcoords{% \addplot coordinates { (5,8.312e-02) (17,2.547e-02) (49,7.407e-03) @@ -56,16 +67,6 @@ (1496065,4.670e-05) }; }% - -\title{% - Manual for Package \PGFPlots\\ - {\small Version \pgfplotsversion}\\ - {\small\href{http://sourceforge.net/projects/pgfplots}{http://sourceforge.net/projects/pgfplots}}} - -%\includeonly{pgfplots.reference} - - -\begin{document} \maketitle \begin{abstract}% \PGFPlots\ draws high--quality function plots in normal or logarithmic scaling with a user-friendly interface directly in \TeX. The user supplies axis labels, legend entries and the plot coordinates for one or more plots and \PGFPlots\ applies axis scaling, computes any logarithms and axis ticks and draws the plots, supporting line plots, piecewise constant plots, bar plots and area plots. It is based on Till Tantau's package \PGF/\Tikz. @@ -76,18 +77,35 @@ This package provides tools to generate plots and labeled axes easily. It draws It is build completely on \Tikz\ and \PGF\ and may be used as \Tikz\ library. -\section{Upgrade remarks} -This release provides a lot of improvements which can be found in all detail in \texttt{ChangeLog} for interested readers. However, some attention is useful for upgrades, which does especially affect style options: although |\tikzstyle| is still supported, you should replace any occurance of |\tikzstyle| with |\pgfplotsset{|\meta{style name}|/.style={|\meta{key-value-list}|}}| or the associated |.append style| variant. See section~\ref{sec:styles} for more detail. +\section[About PGFPlots: Preliminaries]{About {\normalfont\PGFPlots}: Preliminaries} +This section contains information about upgrades, the team, the installation (in case you need to do it manually) and troubleshooting. You may skip it completely except for the upgrade remarks. + +\subsection{Upgrade remarks} +This release provides a lot of improvements which can be found in all detail in \texttt{ChangeLog} for interested readers. However, some attention is useful with respect to the following changes: +\begin{enumerate} + \item Due to a small math bug in \PGF\ $2.00$: you \emph{can't} write `|-x^2|' -- use `|0-x^2|' instead. The same holds for + `|exp(-x^2)|' -- use `|exp(0-x^2)|' instead. + + \item Starting with \PGFPlots\ $1.1$, |\tizkstyle| should \emph{no longer be used} to set \PGFPlots\ options. + + Although |\tikzstyle| is still supported for some older \PGFPlots\ options, you should replace any occurance of |\tikzstyle| with |\pgfplotsset{|\meta{style name}|/.style={|\meta{key-value-list}|}}| or the associated |.append style| variant. See section~\ref{sec:styles} for more detail. +\end{enumerate} +I apologize for any inconvenience caused by these changes. -\section{Acknowledgements} +This library requires at least \PGF\ version $2.00$. At the time of this writing, many \TeX-distributions still contain the older \PGF\ version $1.18$, so it may be necessary to install a recent \PGF\ prior to using \PGFPlots. + +\subsection{The Team} +\PGFPlots\ has been written by Christian Feuersänger and Pascal Wolkotte as a spare time project. We hope it is useful and provides valueable plots. + +\subsection{Acknowledgements} I thank God for all hours of enjoyed programming. I thank Pascal Wolkotte, author of package |pgfgraph|, who joined development and contributed code for axis lines and tick alignment. Furthermore, I thank Dr.~Schweitzer for many fruitful discussions and Dr.~Meine for his ideas and suggestions. 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. - \include{pgfplots.install}% \include{pgfplots.intro}% \include{pgfplots.reference}% +\include{pgfplots.libs}% \include{pgfplots.resources}% \include{pgfplots.importexport}% diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotsJS.djs b/Master/texmf-dist/doc/latex/pgfplots/pgfplotsJS.djs new file mode 100644 index 00000000000..47c30e2e85f --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotsJS.djs @@ -0,0 +1,373 @@ +\begingroup +\obeyspaces\obeylines\global\let^^M=\jsR% +\catcode`\"=12% +\gdef\dljspgfplotsJSiii{% +/********************************************************************************* + * function sprintf() - written by Kevin van Zonneveld as part of the php to javascript + * conversion project. + * + * More info at: http://kevin.vanzonneveld.net/techblog/article/phpjs_licensing/ + * + * This is version: 1.33 + * php.js is copyright 2008 Kevin van Zonneveld. + * + * Portions copyright Michael White (http://crestidg.com), _argos, Jonas + * Raoni Soares Silva (http://www.jsfromhell.com), Legaev Andrey, Ates Goral + * (http://magnetiq.com), Philip Peterson, Martijn Wieringa, Webtoolkit.info + * (http://www.webtoolkit.info/), Carlos R. L. Rodrigues + * (http://www.jsfromhell.com), Ash Searle (http://hexmen.com/blog/), + * Erkekjetter, GeekFG (http://geekfg.blogspot.com), Johnny Mast + * (http://www.phpvrouwen.nl), marrtins, Alfonso Jimenez + * (http://www.alfonsojimenez.com), Aman Gupta, Arpad Ray + * (mailto:arpad@php.net), Karol Kowalski, Mirek Slugen, Thunder.m, Tyler + * Akins (http://rumkin.com), d3x, mdsjack (http://www.mdsjack.bo.it), Alex, + * Alexander Ermolaev (http://snippets.dzone.com/user/AlexanderErmolaev), + * Allan Jensen (http://www.winternet.no), Andrea Giammarchi + * (http://webreflection.blogspot.com), Arno, Bayron Guevara, Ben Bryan, + * Benjamin Lupton, Brad Touesnard, Brett Zamir, Cagri Ekin, Cord, David, + * David James, DxGx, FGFEmperor, Felix Geisendoerfer + * (http://www.debuggable.com/felix), FremyCompany, Gabriel Paderni, Howard + * Yeend, J A R, Leslie Hoare, Lincoln Ramsay, Luke Godfrey, MeEtc + * (http://yass.meetcweb.com), Mick@el, Nathan, Nick Callen, Ozh, Pedro Tainha + * (http://www.pedrotainha.com), Peter-Paul Koch + * (http://www.quirksmode.org/js/beat.html), Philippe Baumann, Sakimori, + * Sanjoy Roy, Simon Willison (http://simonwillison.net), Steve Clay, Steve + * Hilder, Steven Levithan (http://blog.stevenlevithan.com), T0bsn, Thiago + * Mata (http://thiagomata.blog.com), Tim Wiel, XoraX (http://www.xorax.info), + * Yannoo, baris ozdil, booeyOH, djmix, dptr1988, duncan, echo is bad, gabriel + * paderni, ger, gorthaur, jakes, john (http://www.jd-tech.net), kenneth, + * loonquawl, penutbutterjelly, stensi + * + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +// ATTENTION: this method has been masked such that special characters of TeX and javascript +// don't produce problems. +function sprintf( ) { + // Return a formatted string + // + // + discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_sprintf/ + // + version: 804.1712 + // + original by: Ash Searle (http://hexmen.com/blog/) + // + namespaced by: Michael White (http://crestidg.com) + // * example 1: sprintf("\pgfplotsPERCENT01.2f", 123.1); + // * returns 1: 123.10 + + var regex = /\pgfplotsPERCENT\pgfplotsPERCENT\pgfplotsVERTBAR\pgfplotsPERCENT(\d+\$)?([-+\pgfplotsHASH0 ]*)(\*\d+\$\pgfplotsVERTBAR\*\pgfplotsVERTBAR\d+)?(\.(\*\d+\$\pgfplotsVERTBAR\*\pgfplotsVERTBAR\d+))?([scboxXuidfegEG])/g; + var a = arguments, i = 0, format = a[i++]; + + // pad() + var pad = function(str, len, chr, leftJustify) { + var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr); + return leftJustify ? str + padding : padding + str; + }; + + // justify() + var justify = function(value, prefix, leftJustify, minWidth, zeroPad) { + var diff = minWidth - value.length; + if (diff > 0) { + if (leftJustify \pgfplotsVERTBAR\pgfplotsVERTBAR !zeroPad) { + value = pad(value, minWidth, ' ', leftJustify); + } else { + value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length); + } + } + return value; + }; + + // formatBaseX() + var formatBaseX = function(value, base, prefix, leftJustify, minWidth, precision, zeroPad) { + // Note: casts negative numbers to positive ones + var number = value >>> 0; + prefix = prefix && number && {'2': '0b', '8': '0', '16': '0x'}[base] \pgfplotsVERTBAR\pgfplotsVERTBAR ''; + value = prefix + pad(number.toString(base), precision \pgfplotsVERTBAR\pgfplotsVERTBAR 0, '0', false); + return justify(value, prefix, leftJustify, minWidth, zeroPad); + }; + + // formatString() + var formatString = function(value, leftJustify, minWidth, precision, zeroPad) { + if (precision != null) { + value = value.slice(0, precision); + } + return justify(value, '', leftJustify, minWidth, zeroPad); + }; + + // finalFormat() + var doFormat = function(substring, valueIndex, flags, minWidth, _, precision, type) { + if (substring == '\pgfplotsPERCENT\pgfplotsPERCENT') return '\pgfplotsPERCENT'; + + // parse flags + var leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false; + for (var j = 0; flags && j < flags.length; j++) switch (flags.charAt(j)) { + case ' ': positivePrefix = ' '; break; + case '+': positivePrefix = '+'; break; + case '-': leftJustify = true; break; + case '0': zeroPad = true; break; + case '\pgfplotsHASH': prefixBaseX = true; break; + } + + // parameters may be null, undefined, empty-string or real valued + // we want to ignore null, undefined and empty-string values + if (!minWidth) { + minWidth = 0; + } else if (minWidth == '*') { + minWidth = +a[i++]; + } else if (minWidth.charAt(0) == '*') { + minWidth = +a[minWidth.slice(1, -1)]; + } else { + minWidth = +minWidth; + } + + // Note: undocumented perl feature: + if (minWidth < 0) { + minWidth = -minWidth; + leftJustify = true; + } + + if (!isFinite(minWidth)) { + throw new Error('sprintf: (minimum-)width must be finite'); + } + + if (!precision) { + precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : void(0); + } else if (precision == '*') { + precision = +a[i++]; + } else if (precision.charAt(0) == '*') { + precision = +a[precision.slice(1, -1)]; + } else { + precision = +precision; + } + + // grab value using valueIndex if required? + var value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++]; + + switch (type) { + case 's': return formatString(String(value), leftJustify, minWidth, precision, zeroPad); + case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad); + case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad).toUpperCase(); + case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'i': + case 'd': { + var number = parseInt(+value); + var prefix = number < 0 ? '-' : positivePrefix; + value = prefix + pad(String(Math.abs(number)), precision, '0', false); + return justify(value, prefix, leftJustify, minWidth, zeroPad); + } + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': + { + var number = +value; + var prefix = number < 0 ? '-' : positivePrefix; + var method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())]; + var textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) \pgfplotsPERCENT 2]; + value = prefix + Math.abs(number)[method](precision); + return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform](); + } + default: return substring; + } + }; + + return format.replace(regex, doFormat); +} +/*********************************************************************************/ + + +var lastMouseX = -1; +var lastMouseY = -1; +var posOnMouseDownX = -1; +var posOnMouseDownY = -1; + +// preallocation. +var tmpArray1 = new Array(2); +var tmpArray2 = new Array(2); + +/** + * Takes an already existing TextField, changes its value to \c value and places it at (x,y). + * Additional \c displayOpts will be used to format it. + */ +function initTextField( x,y, textField, displayOpts, value ) +{ +textField.value = ""+value; +var R = textField.rect; +R[0] = x; +R[1] = y; +R[2] = R[0] + displayOpts.textSize/2*Math.max( 5,value.length ); +R[3] = R[1] - 1.5*displayOpts.textSize; +textField.rect = R; +textField.textFont = displayOpts.textFont; +textField.textSize = displayOpts.textSize; +textField.fillColor = displayOpts.fillColor;//["RGB",1,1,.855]; +textField.doNotSpellCheck = true; +textField.readonly = true; +if( displayOpts.printable ) +textField.display = display.visible; +else +textField.display = display.noPrint; +} + +/** + * Changes all required Field values of \c plotRegionField, inserts the proper + * value and displays it at the pdf positions (x,y) . + * + * @param plotRegionField a reference to a Field object. + * @param x the x coordinate where the annotation shall be placed and which is used to determine + * the annotation text. + * @param y the corresponding y coord. + * @param axisAnnotObj An object containing axis references. + * @param displayOpts An object for display flags. + * @param[out] retCoords will be filled with the point in axis coordinates. + */ +function placeAnnot( plotRegionField, x,y, textField, axisAnnotObj, displayOpts, retCoords ) +{ +// Get and modify bounding box. The mouse movement is only accurate up to one point +// (mouseX and mouseY are integers), so the bounding box should be an integer as well. +var R = plotRegionField.rect; +R[0] = Math.round(R[0]); +R[1] = Math.round(R[1]); +R[2] = Math.round(R[2]); +R[3] = Math.round(R[3]); +plotRegionField.rect= R; + +var w = R[2] - R[0]; +var h = R[1] - R[3]; + +// compute position 0 <= mx <= 1, 0<= my <= 1 relative to lower(!) left corner. +var mx = x - R[0]; +var my = h - (R[1] - y); + +var unitx = mx / w; +var unity = my / h; + +var realx = axisAnnotObj.xmin + unitx * (axisAnnotObj.xmax - axisAnnotObj.xmin); +var realy = axisAnnotObj.ymin + unity * (axisAnnotObj.ymax - axisAnnotObj.ymin); + +if( retCoords ) { +retCoords[0] = realx; +retCoords[1] = realy; +} + +if( axisAnnotObj.xscale == "log" ) +realx = Math.exp(realx); +if( axisAnnotObj.yscale == "log" ) +realy = Math.exp(realy); + +// console.println( "w = " + w + "; h = " + h ); +// console.println( "mx = " + mx + "; my = " + my ); +// console.println( "unitx = " + unitx + "; unity " + unity ); + +initTextField( x,y, textField, displayOpts, +//util.printf( "(\pgfplotsPERCENT.2f,\pgfplotsPERCENT.2f)", realx,realy ) +sprintf( displayOpts.pointFormat, realx,realy) ); + +} + +/** + * @param formName the name of the clickable button. It is expected to be as large as the underlying plot. + * @param axisAnnotObj an object with the fields + * - xmin, xmax + * - ymin, ymax + * - xscale, yscale + * @param displayOpts an object with the fields + * - pointFormat an sprintf format string to format the final point coordinates. + * The default is "(\pgfplotsPERCENT.2f,\pgfplotsPERCENT.2f)" + * - fillColor the fill color for the annotation. Options are + * transparent, gray, RGB or CMYK color. Default is + * ["RGB",1,1,.855] + * - textFont / textSize + */ +function processAnnotatedPlot(formName, axisAnnotObj, displayOpts, bMouseUp ) +{ +if( !bMouseUp ) { +posOnMouseDownX = mouseX; +posOnMouseDownY = mouseY; +return; +} +var result = this.getField( formName + "-result"); +var result2 = this.getField( formName + "-result2"); +var slope = this.getField( formName + "-slope" ); +if( !result ) { +console.println( "WARNING: there is no TextField \"" + formName + "-result\" to display results for interactive element \"" + formName + "\""); +return; +} +result2.display = display.hidden; +slope.display = display.hidden; + +// clicking twice onto the same point hides it: +if( result.display != display.hidden && +Math.abs(lastMouseX - mouseX) < 5 && +Math.abs(lastMouseY - mouseY) < 5 ) +{ +result.display = display.hidden; +return; +} +lastMouseX = mouseX; +lastMouseY = mouseY; + +var a = this.getField(formName); +if( ! a ) { +console.println( "Warning: there is no form named \"" + formName + "\"" ); +return; +} +if( Math.abs( lastMouseX - posOnMouseDownX ) > 6 \pgfplotsVERTBAR\pgfplotsVERTBAR +Math.abs( lastMouseY - posOnMouseDownY ) > 6 ) +{ +// dragging the mouse results in slope computation: +placeAnnot( a, posOnMouseDownX, posOnMouseDownY, result, axisAnnotObj, displayOpts, tmpArray1 ); +placeAnnot( a, lastMouseX, lastMouseY, result2, axisAnnotObj, displayOpts, tmpArray2 ); + +var m = ( tmpArray2[1] - tmpArray1[1] ) / ( tmpArray2[0] - tmpArray1[0] ); +var n = tmpArray1[1] - m * tmpArray1[0]; + +initTextField( +0.5 * ( lastMouseX + posOnMouseDownX ), +0.5 * ( lastMouseY + posOnMouseDownY ), +slope, +displayOpts, +sprintf( displayOpts.slopeFormat, m, n ) ); + +%-------------------------------------------------- +% var lineobj = this.getAnnot( a.page, formName + '-line' ); +% console.println( 'lineobj = ' + lineobj ); +% lineobj.points = [[lastMouseX,lastMouseY],[posOnMouseDownX,posOnMouseDownY]]; +% lineobj.display = display.visible; +%-------------------------------------------------- + +} else { +placeAnnot( a, lastMouseX, lastMouseY, result, axisAnnotObj, displayOpts, null ); +} +} +}% +\endgroup +\begingroup +\ccpdftex% +\input{dljscc.def}% +\immediate\pdfobj{ << /S /JavaScript /JS (\dljspgfplotsJSiii) >> } +\xdef\objpgfplotsJSiii{\the\pdflastobj\space0 R} +\endgroup +\endinput diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotsexample.pdf b/Master/texmf-dist/doc/latex/pgfplots/pgfplotsexample.pdf Binary files differindex 6c0214828ac..28c1fb14eb9 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplotsexample.pdf +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotsexample.pdf diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.dat b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.dat new file mode 100644 index 00000000000..c6a2c7ca618 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.dat @@ -0,0 +1,11 @@ +dof error1 postproc1 +4 2.50000000e-01 {} +16 6.25000000e-02 1.99998 +64 1.56250000e-02 1.99998 +256 3.90625000e-03 1.99998 +1024 9.76562500e-04 1.99998 +4096 2.44140625e-04 1.99998 +16384 6.10351562e-05 1.99998 +65536 1.52587891e-05 1.99998 +262144 3.81469727e-06 1.99998 +1048576 9.53674316e-07 1.99998 diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.html b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.html new file mode 100644 index 00000000000..e68495bbbad --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.html @@ -0,0 +1,13 @@ +<table> +<tr><td>level</td><td>dof</td></tr> +<tr><td>1</td><td>4</td></tr> +<tr><td>2</td><td>16</td></tr> +<tr><td>3</td><td>64</td></tr> +<tr><td>4</td><td>256</td></tr> +<tr><td>5</td><td>1024</td></tr> +<tr><td>6</td><td>4096</td></tr> +<tr><td>7</td><td>16384</td></tr> +<tr><td>8</td><td>65536</td></tr> +<tr><td>9</td><td>262144</td></tr> +<tr><td>10</td><td>1048576</td></tr> +</table> diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.tex b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.tex index c46056ebe5a..127872722ab 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.example1.out.tex @@ -1 +1,13 @@ -\begin {tabular}{cc}dof&error1\\\pgfutilensuremath {4}&\pgfutilensuremath {0.25}\\\pgfutilensuremath {16}&\pgfutilensuremath {6.25\cdot 10^{-2}}\\\pgfutilensuremath {64}&\pgfutilensuremath {1.56\cdot 10^{-2}}\\\pgfutilensuremath {256}&\pgfutilensuremath {3.91\cdot 10^{-3}}\\\pgfutilensuremath {1{,}024}&\pgfutilensuremath {9.77\cdot 10^{-4}}\\\pgfutilensuremath {4{,}096}&\pgfutilensuremath {2.44\cdot 10^{-4}}\\\pgfutilensuremath {16{,}384}&\pgfutilensuremath {6.1\cdot 10^{-5}}\\\pgfutilensuremath {65{,}536}&\pgfutilensuremath {1.53\cdot 10^{-5}}\\\pgfutilensuremath {2.62\cdot 10^{5}}&\pgfutilensuremath {3.81\cdot 10^{-6}}\\\pgfutilensuremath {1.05\cdot 10^{6}}&\pgfutilensuremath {9.54\cdot 10^{-7}}\\\end {tabular} +\begin {tabular}{cc}% +dof&error1\\% +\pgfutilensuremath {4}&\pgfutilensuremath {0.25}\\% +\pgfutilensuremath {16}&\pgfutilensuremath {6.25\cdot 10^{-2}}\\% +\pgfutilensuremath {64}&\pgfutilensuremath {1.56\cdot 10^{-2}}\\% +\pgfutilensuremath {256}&\pgfutilensuremath {3.91\cdot 10^{-3}}\\% +\pgfutilensuremath {1{,}024}&\pgfutilensuremath {9.77\cdot 10^{-4}}\\% +\pgfutilensuremath {4{,}096}&\pgfutilensuremath {2.44\cdot 10^{-4}}\\% +\pgfutilensuremath {16{,}384}&\pgfutilensuremath {6.1\cdot 10^{-5}}\\% +\pgfutilensuremath {65{,}536}&\pgfutilensuremath {1.53\cdot 10^{-5}}\\% +\pgfutilensuremath {2.62\cdot 10^{5}}&\pgfutilensuremath {3.81\cdot 10^{-6}}\\% +\pgfutilensuremath {1.05\cdot 10^{6}}&\pgfutilensuremath {9.54\cdot 10^{-7}}\\% +\end {tabular}% diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.mst b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.mst new file mode 100644 index 00000000000..642be497a04 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.mst @@ -0,0 +1,17 @@ +headings_flag 1 +heading_prefix "{\\bf ---~" +heading_suffix "~---}" +delim_0 "\\dotfill\\indexpageno{" +delim_1 "\\dotfill\\indexpageno{" +delim_2 "\\dotfill\\indexpageno{" +delim_t "}" +delim_n "}, \\indexpageno{" +delim_r "} -- \\indexpageno{" +suffix_2p "}f.{" +suffix_3p "}ff.{" +symhead_negative "Symbols" +symhead_positive "Symbols" +numhead_negative "Numbers" +numhead_positive "Numbers" +quote '+' +line_max 255 diff --git a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.pdf b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.pdf Binary files differindex 420896cd09c..54c36d3054d 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 f32467d7779..5663043b17c 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex +++ b/Master/texmf-dist/doc/latex/pgfplots/pgfplotstable.tex @@ -52,9 +52,10 @@ \section{Introduction} \PGFPlotstable\ is a lightweight sub-package of \PGFPlots\ which employs its table input methods and the number formatting techniques to convert tab-separated tables into tabulars. -Its input is a text file containing space separated rows, possibly starting with column names. Its output is a \LaTeX\ tabular\footnote{Please see the remarks in section~\ref{sec:pgfplotstable:context} for plain \TeX\ and Con\TeX t.} which contains selected columns of the text table, rounded to the desired precision, printed in the desired number format (fixed point, integer, scientific etc). +Its input is a text file containing space separated rows, possibly starting with column names. Its output is a \LaTeX\ tabular\footnote{Please see the remarks in section~\ref{sec:pgfplotstable:context} for plain \TeX\ and Con\TeX t.} which contains selected columns of the text table, rounded to the desired precision, printed in the desired number format (fixed point, integer, scientific etc.). It is used with +% NO GALLERY \begin{codeexample}[code only] \usepackage{pgfplotstable} % recommended: @@ -64,10 +65,29 @@ It is used with \end{codeexample} \noindent and requires \PGFPlots\ and \PGF\ $ \ge 2.00$ installed. -Knowledge of |pgfkeys| is useful for a deeper insight into this package. Please refer to the \PGF\ manual,~\cite[section pgfkeys]{tikz} if you want a deeper insight into |pgfkeys|. Otherwise, simply skip over to the examples provided in this document. +\begin{command}{\pgfplotstableset\marg{key-value-options}} + The user interface of this package is based on key-value-options. They determine what to display, how to format and what to compute. + + Key-value pairs can be set in two ways: + \begin{enumerate} + \item As default settings for the complete document (or maybe a part of the document), using |\pgfplotstableset|\marg{options}. For example, the document's preamble may contain +% NO GALLERY +\begin{codeexample}[code only] +\pgfplotstableset{fixed zerofill,precision=3} +\end{codeexample} + to configure a precision of $3$ digits after the period, including zeros to get exactly $3$ digits for all fixed point numbers. + \item As option which affects just a single table. This is provided as optional argument to the respective table typesetting command, for example |\pgfplotstabletypeset|\oarg{options}\marg{file}. + \end{enumerate} + Both ways are shown in the examples below. + + Knowledge of |pgfkeys| is useful for a deeper insight into this package, as |.style|, |.append style| etc. are specific to |pgfkeys|. Please refer to the \PGF\ manual,~\cite[section pgfkeys]{tikz} if you want a deeper insight into |pgfkeys|. Otherwise, simply skip over to the examples provided in this document. + + You will find key prefixes |/pgfplots/table/| and |/pgf/number format/|. These prefixes can be skipped if they are used in \PGFPlotstable; they belong to the ``default key path'' of |pgfkeys|. +\end{command} -\section{Text table input format} -\PGFPlotstable\ works with plain text file tables in which entries (``cells'') are separated by a separation character. The initial separation character is ``white space'' which means ``at least one space or tab''. Those tables can have a header line which contains column names and most other columns typically contain numerical data. +\section{Loading and Displaying data} +\subsection{Text Table Input Format} +\PGFPlotstable\ works with plain text file tables in which entries (``cells'') are separated by a separation character. The initial separation character is ``white space'' which means ``at least one space or tab'' (see option |col sep| below). Those tables can have a header line which contains column names and most other columns typically contain numerical data. \noindent The following listing shows |pgfplotstable.example1.dat| and is used often throughout this documentation. \begin{codeexample}[code only] @@ -89,6 +109,75 @@ 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}} + 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|). +\begin{codeexample}[] +\pgfplotstabletypeset{pgfplotstable.example1.dat} +\end{codeexample} + + \noindent The configuration can be customized with \meta{optional arguments}. Configuration can be done for the complete table or for particular columns (or rows). + +\begin{codeexample}[] +\pgfplotstableset{% global config, for example in the preamble + columns/dof/.style={int detect,column type=r,column name=\textsc{Dof}}, + columns/error1/.style={ + sci,sci zerofill,sci sep align,precision=1,sci superscript, + column name=$e_1$, + }, + columns/error2/.style={ + sci,sci zerofill,sci sep align,precision=2,sci 10e, + column name=$e_2$, + }, + columns/{grad(log(dof),log(error2))}/.style={ + string replace={0}{}, % erase '0' + column name={$\nabla e_2$}, + dec sep align, + }, + columns/{quot(error1)}/.style={ + string replace={0}{}, % erase '0' + column name={$\frac{e_1^{(n)}}{e_1^{(n-1)}}$} + }, + empty cells with={--}, % replace empty cells with '--' + every head row/.style={before row=\toprule,after row=\midrule}, + every last row/.style={after row=\bottomrule} +} +\pgfplotstabletypeset[ % local config, applies only for this table + 1000 sep={\,}, + columns/info/.style={ + fixed,fixed zerofill,precision=1,showpos, + column type=r, + } +] +{pgfplotstable.example1.dat} +\end{codeexample} +\noindent All of these options are explained in the following sections. + +Technical note: every opened file will be protocolled into your log file. +\end{command} + +\begin{command}{\pgfplotstabletypesetfile\oarg{optional arguments}\marg{file name}} + Loads the table \marg{file name} and typesets it. As of \PGFPlotstable\ 1.2, this command is an alias to |\pgfplotstabletypeset|, that means the first argument can be either a file name or an already loaded table. +\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 than be used several times. +\begin{codeexample}[] +\pgfplotstableread{pgfplotstable.example1.dat}\table +\pgfplotstabletypeset[columns={dof,error1}]\table +\hspace{2cm} +\pgfplotstabletypeset[columns={dof,error2}]\table +\end{codeexample} + +Technical note: every opened file will be protocolled into your log file. +\end{command} + +\begin{command}{\pgfplotstablegetrowsof\marg{file name or \textbackslash loadedtable}} + Defines |\pgfmathresult| to be the number of rows in a table. The argument may be either a file name or an already loaded table (the \meta{\textbackslash macro} of |\pgfplotstableread|). +\end{command} + \begin{key}{/pgfplots/table/col sep=\mchoice{space,comma,semicolon,colon,braces} (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). @@ -110,7 +199,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) \end{codeexample} Thus, we need to specify |col sep=comma| when we read it. \begin{codeexample}[] -\pgfplotstabletypesetfile[col sep=comma]{pgfplotstable.example1.csv} +\pgfplotstabletypeset[col sep=comma]{pgfplotstable.example1.csv} \end{codeexample} You may call |\pgfplotstableset{col sep=comma}| once in your preamble if all your tables use commas as column separator. @@ -118,36 +207,9 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) Furthermore, if you need empty cells in case |col sep=space|, you have to provide |{}| to delimit such a cell since |col sep=space| uses \emph{at least} one white space (consuming all following ones). - 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 wite spaces (spaces and tabs) between cell entries are \emph{skipped} in case |braces| until the next \marg{entry} is found. + 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. \end{key} -\begin{command}{\pgfplotstabletypesetfile\oarg{optional arguments}\marg{file name}} - This command loads the table file \marg{file name} and typesets it using the current configuration of number formats and table options. -\begin{codeexample}[] -\pgfplotstabletypesetfile{pgfplotstable.example1.dat} -\end{codeexample} - - \noindent The configuration can be customized with \meta{optional arguments}. - -\begin{codeexample}[] -\pgfplotstabletypesetfile[sci subscript,sci zerofill]{pgfplotstable.example1.dat} -\end{codeexample} -\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 than be used several times. -\begin{codeexample}[] -\pgfplotstableread{pgfplotstable.example1.dat}\table -\pgfplotstabletypeset[columns={dof,error1}]\table -\hspace{2cm} -\pgfplotstabletypeset[columns={dof,error2}]\table -\end{codeexample} -\end{command} - -\begin{command}{\pgfplotstabletypeset\oarg{optional arguments}\marg{\textbackslash macro}} - Works in the same way as |\pgfplotstabletypesetfile|, but it accepts an already loaded table. -\end{command} - \begin{key}{/pgfplots/table/header=\marg{boolean} (initially true)} Configures if column names shall be identified during input operations. @@ -158,13 +220,13 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) Use |header=false| to force this last case, i.e. even if the first line contains strings, they won't be recognised as column names. \end{key} -\section{Selecting columns} -\begin{key}{/pgfplots/table/columns=\marg{comma-separated-list} (initially all available ones)} - Selects particular columns the table. If this option is missing, all available columns will be selected. +\subsection{Selecting Columns} +\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. - Inside of \marg{comma-separated-list}, column names as they appear in the table's header are expected. If there is no header, simply use column names. If there are column names, the special syntax |[index]|\meta{integer} can be used to select columns by index. The first column has index~$0$. + Inside of \marg{comma-separated-list}, column names as they appear in the table's header are expected. If there is no header, simply use column indices. If there are column names, the special syntax |[index]|\meta{integer} can be used to select columns by index. The first column has index~$0$. \begin{codeexample}[] -\pgfplotstabletypesetfile[columns={dof,level,[index]4}]{pgfplotstable.example1.dat} +\pgfplotstabletypeset[columns={dof,level,[index]4}]{pgfplotstable.example1.dat} \end{codeexample} \end{key} @@ -182,7 +244,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) Sets all options in \marg{key-value-list} exclusively for \marg{column name}. \begin{codeexample}[] -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ columns/error1/.style={ column name=$L_2$, sci,sci zerofill,sci subscript, @@ -200,7 +262,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) \end{codeexample} If your column name contains commas `|,|', slashes `|/|' or equal signs `|=|', you need to enclose the column name in braces. \begin{codeexample}[narrow] -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ columns={dof,error1,{grad(log(dof),log(error2))}}, columns/error1/.style={ column name=$L_2$, @@ -229,6 +291,12 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) Display column styles override input column styles. \end{pgfplotstabledisplaycolumnkey} +\begin{stylekey}{/pgfplots/table/every col no \meta{index}} + A style which is identical with |display columns/|\meta{index}: it applies exclusively to the column at position \meta{index} in the output table. + + See |display columns/|\meta{index} for details. +\end{stylekey} + \begin{key}{/pgfplots/table/column type=\marg{tabular column type} (initially c)} Contains the column type for |tabular|. @@ -236,7 +304,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) Use |\pgfplotstableset{column type/.add=|\marg{before}\marg{after}|}| to \emph{modify} a value instead of overwriting it. The |.add| key handler works for other options as well. \begin{codeexample}[narrow] -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ columns={dof,error1,info}, column type/.add={|}{}% results in '|c' ] @@ -266,12 +334,12 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) The first argument determines the alignment of the header column. - The style |dec sep align| actually introduces two new |tabular| columns, namely |r@{}l|. It introduces multicolumns for column names accordingly and handles numbers which do not have a decimal separator. + The style |dec sep align| actually introduces two new |tabular| columns\footnote{Unfortunately, \texttt{dec sep align} is currently not very flexible when it comes to column type modifications. In particular, it is not possible to use colored columns or cells in conjunction with \texttt{dec sep align}. The \texttt{\textbackslash rowcolor} command works properly; the color hangover introduced by \texttt{colortbl} is adjusted automatically.}, namely |r@{}l|. It introduces multicolumns for column names accordingly and handles numbers which do not have a decimal separator. Please note that you need |\usepackage{array}| for this style. \begin{codeexample}[] % requires \usepackage{array} -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ columns={dof,error1,error2,info,{grad(log(dof),log(error2))}}, columns/error1/.style={dec sep align}, columns/error2/.style={sci,sci subscript,sci zerofill,dec sep align}, @@ -284,7 +352,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) Or with comma as decimal separator: \begin{codeexample}[] % requires \usepackage{array} -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ use comma, columns={dof,error1,error2,info,{grad(log(dof),log(error2))}}, columns/error1/.style={dec sep align}, @@ -318,7 +386,7 @@ level,dof,error1,error2,info,{grad(log(dof),log(error2))},quot(error1) \begin{stylekey}{/pgfplots/table/every first column} A style which is installed for every first column only. \begin{codeexample}[narrow] -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ every head row/.style={before row=\hline,after row=\hline\hline}, every last row/.style={after row=\hline}, every first column/.style={ @@ -370,7 +438,7 @@ A style which is installed for every column with even column index (starting wit \begin{codeexample}[narrow,graphic=white] % requires \usepackage{colortbl} -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ every even column/.style={ column type/.add={>{\columncolor[gray]{.8}}}{} }] @@ -400,7 +468,7 @@ A style which is installed for every column with odd column index (starting with \end{command} -\section{Configuring row appearance} +\subsection{Configuring Row Appearance} 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}} @@ -446,7 +514,7 @@ The following styles allow to configure the final table code \emph{after any cel \begin{codeexample}[narrow,graphic=white] % requires \usepackage{booktabs} -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ every head row/.style={ before row=\toprule,after row=\midrule}, every last row/.style={ @@ -457,7 +525,7 @@ The following styles allow to configure the final table code \emph{after any cel \begin{codeexample}[narrow,graphic=white] % requires \usepackage{booktabs,colortbl} -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ every even row/.style={ before row={\rowcolor[gray]{0.9}}}, every head row/.style={ @@ -487,201 +555,11 @@ The following styles allow to configure the final table code \emph{after any cel A style which is installed for each last \emph{data} row. \end{stylekey} -\section{Determining cell contents} -The conversion from an unprocessed input table to a final typesetted |tabular| code uses three stages for every cell, -\begin{enumerate} - \item Preprocessing, - \item Typesetting, - \item Postprocessing. -\end{enumerate} -The main idea is to select one typesetting algorithm (for example ``format my numbers with the configured number style''). This algorithm usually doesn't need to be changed. Fine tuning can then be done using zero, one or more preprocessors and postprocessors. Preprocessing can mean to select only particular rows or to apply some sort of operation before the typesetting algorithm sees the content. Postprocessing means to apply fine-tuning to the resulting \TeX\ output -- for example to deal with empty cells or to insert unit suffixes or modify fonts for single cells. - -\subsection{Typesetting cells} -\begin{codekey}{/pgfplots/table/assign cell content} - 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|. - - 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. - - Please note further that if any column has more entries than the first column, these entries will be skipped and a warning message will be issued into the log file. - - 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 contents|. - - It invokes |\pgfmathprintnumberto| and writes the result into |@cell content|. -\end{key} - -\begin{stylekey}{/pgfplots/table/string type} - A style which redefines |assign cell contents| 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} - - -\subsection{Preprocessing cells} -\begin{codekey}{/pgfplots/table/preproc cell content} - Allows to \emph{modify} the contents of cells \emph{before} |assign cell contents| is called. - - The semantics is as follows: before the preprocessor, |@cell content| contains the raw input data (or, maybe, the result of another preprocessor call). After the preprocessor, |@cell content| is filled with a -- possibly modified -- value. The resulting value is then used as input to |assign cell contents|. - - In the default settings, |assign cell contents| expects numerical input. So, the preprocessor is expected to produce numerical output. - - It is possible to provide multiple preprocessor directives using |.append code| or |.append style| key handlers. - - In case you don't want (or need) stackable preprocessors, you can also use `|#1|' to get the raw input datum as it is found in the file. -\end{codekey} - -\begin{stylekey}{/pgfplots/table/multiply -1} - Appends code to current |preproc cell content| value which multiplies every cell with $-1$. -\begin{codeexample}[] -\pgfplotstableset{ - columns={dof,error2,slopes2}, - columns/error2/.style={sci,sci zerofill}, - columns/slopes2/.style={dec sep align,empty cells with={\ensuremath{-}}}, - create on use/slopes2/.style= - {create col/gradient loglog={dof}{error2}}} - -\pgfplotstabletypesetfile{pgfplotstable.example1.dat} - -\pgfplotstabletypesetfile[columns/slopes2/.append style={multiply -1}] - {pgfplotstable.example1.dat} -\end{codeexample} -\end{stylekey} - -\begin{codekey}{/pgfplots/table/row predicate} - A boolean predicate which allows to select particular rows of the input table. The argument |#1| contains the current row's index (starting with~$0$, not counting comment lines or column names). - - The return value is assigned to the \TeX-if |\ifpgfplotstableuserow|. If the boolean is not changed, the return value is true. -\begin{codeexample}[narrow] -% requires \usepackage{booktabs} -\pgfplotstabletypesetfile[ - every head row/.style={ - before row=\toprule,after row=\midrule}, - every last row/.style={ - after row=\bottomrule}, - row predicate/.code={% - \ifnum#1>4\relax - \ifnum#1<8\relax - \pgfplotstableuserowfalse - \fi - \fi} -] - {pgfplotstable.example1.dat} -\end{codeexample} - Please note that |row predicate| is applied \emph{before} any other option which affects row appearance. It is evaluated before |assign cell contents|. For example, the even/odd row styles refer to those rows for which the predicate returns |true|. In fact, you can use |row predicate| to truncate the complete table before it as actually processed. - - During |row predicate|, the macro |\pgfplotstablerows| contains the total number of \emph{input} rows. - - Furthermore, |row predicate| applies only to the typeset routines, not the read methods. If you want to plot only selected table entries with |\addplot table|, use the \PGFPlots\ coordinate filter options. -\end{codekey} - -\begin{stylekey}{/pgfplots/table/skip rows between index=\marg{begin}\marg{end}} - A style which appends an |row predicate| which discards selected rows. The selection is done by index where indexing starts with~$0$. Every row with index $\meta{begin} \le i < \meta{end}$ will be skipped. -\begin{codeexample}[narrow] -% requires \usepackage{booktabs} -\pgfplotstabletypesetfile[ - every head row/.style={ - before row=\toprule,after row=\midrule}, - every last row/.style={ - after row=\bottomrule}, - skip rows between index={2}{4}, - skip rows between index={7}{9} -] - {pgfplotstable.example1.dat} -\end{codeexample} -\end{stylekey} - -\begin{stylekey}{/pgfplots/table/select equal part entry of=\marg{part no}\marg{part count}} - A style which overwrites |row predicate| with a subset selection predicate. The idea is to split the current column into \marg{part count} equally sized parts and select only \marg{part no}. - - This can be used to simulate multicolumn tables. -\begin{codeexample}[] -% requires \usepackage{booktabs} -\pgfplotstableset{ - every head row/.style={before row=\toprule,after row=\midrule}, - every last row/.style={after row=\bottomrule}} - -\pgfplotstabletypesetfile[string type]{pgfplotstable.example2.dat} - -\pgfplotstabletypesetfile[ - display columns/0/.style={select equal part entry of={0}{2},string type}, - display columns/1/.style={select equal part entry of={0}{2},string type}, - display columns/2/.style={select equal part entry of={1}{2},string type}, - display columns/3/.style={select equal part entry of={1}{2},string type}, - columns={A,B,A,B} -] - {pgfplotstable.example2.dat} -\end{codeexample} - The example above shows the original file as-is on the left side. The right side shows columns A,B,A,B~-- but only half of the elements are shown, selected by indices \#0 or \#1 of \#2. The parts are equally large, up to a remainder. - - If the available number of rows is not dividable by \marg{part count}, the remaining entries are distributed equally among the first parts. +\begin{stylekey}{/pgfplots/table/every row no \meta{index}} + A style which is installed for the row with index \meta{index}. \end{stylekey} - -\subsection{Postprocessing cells} -\begin{codekey}{/pgfplots/table/postproc cell content} - Allows to \emph{modify} assigned cell content \emph{after} it has been assigned, possibly content-dependend. Ideas could be to draw negative numbers in red, typeset single entries in bold face or insert replacement text. - - This key is evaluated \emph{after} |assign cell content|. Its semantics is to modify an existing |@cell content| value. - - There may be more than one |postproc cell content| command, if you use |.append code| or |.append style| to define them: -\begin{codeexample}[] -% requires \usepackage{eurosym} -\pgfplotstabletypesetfile[ - column type=r, - columns={dof,info}, - columns/info/.style={ - postproc cell content/.append style={ - /pgfplots/table/@cell content/.add={$\bf}{$}}, - postproc cell content/.append style={ - /pgfplots/table/@cell content/.add={}{\EUR{}}} - }] - {pgfplotstable.example1.dat} -\end{codeexample} - The code above modifies |@cell content| successively. First, ``|$\bf ... $|'' is inserted, then ``|...\EUR|''. It should be noted that |pgfkeys| handles |.style| and |.code| in (quasi) the same way -- both are simple code keys and can be used as such. You can combine both with |.append style| and |.append code|. Please refer to~\cite[section about pgfkeys]{tikz} for details. - - As in |assign cell contents|, the code can evaluate helper macros like |\pgfplotstablerow| to change only particular entries. Furthermore, the argument ``|#1|'' expands to the \emph{unformatted} input argument which was found in the input table. This allows complete context based formatting options. Please remember that empty strings may appear due to column balancing -- introduce special treatment if necessary. - - There is one special case which occurs if |@cell content| itsself contains the cell separation character `|&|'. In this case, |postproc cell contents| is invoked \emph{separately} for each part before and after the ampersand and the ampersand is inserted afterwards. This allows compatibility with special styles which create artificial columns in the output (which is allowed, see |dec sep align|). To allow separate treatment of each part, you can use the macro |\pgfplotstablepartno|. It is defined only during the evaluation of |postproc cell content| and it evaluates to the current part index (starting with~$0$). If there is no ampersand in your text, the value will always be~$0$. - - This key is evaluated inside of a local \TeX\ group, so any local macro assignments will be cleared afterwards. - - The following example can be used to insert a dash, $-$, in a slope column: -\begin{codeexample}[] -\pgfplotstableset{ - create on use/slopes1/.style= - {create col/gradient loglog={dof}{error1}}} - -\pgfplotstabletypesetfile[ - columns={dof,error1,slopes1}, - columns/error1/.style={sci,sci zerofill}, - columns/slopes1/.style={ - postproc cell content/.append code={% - \ifnum\pgfplotstablerow=0 - \pgfkeyssetvalue{/pgfplots/table/@cell content}{\ensuremath{-}}% - \fi - }% - }] - {pgfplotstable.example1.dat} -\end{codeexample} -Since this may be useful in a more general context, it is available as |empty cells with| style. -\end{codekey} - -\begin{stylekey}{/pgfplots/table/empty cells with=\marg{replacement}} - Appends code to |postproc cell content| which replaces any empty cell with \marg{replacement}. - - If |dec sep align| is active, the replacement will be inserted only for the part before the decimal separator. -\end{stylekey} - -\begin{stylekey}{/pgfplots/table/set content=\marg{content}} - A style which redefines |postproc cell contents| to always return the value \marg{content}. -\end{stylekey} - - - -\section{Customizing and getting the tabular code} +\subsection{Customizing and Getting the Tabular Code} \begin{stylekey}{/pgfplots/table/every table=\marg{file name}} A style which is installed at the beginning of every |\pgfplotstabletypeset| command. @@ -695,30 +573,93 @@ Since this may be useful in a more general context, it is available as |empty ce \begin{key}{/pgfplots/table/begin table=\marg{code} (initially \textbackslash begin\{tabular\})} Contains \marg{code} which is generated as table start. \end{key} + +\begin{codekey}{/pgfplots/table/typeset cell} + A code key which assigns |/pgfplots/table/@cell content| to the final output of the current cell. + + The first argument, |#1|, is the final cell's value. After this macro, the value of |@cell content| will be written to the output. + + The default implementation is +\begin{codeexample}[code only] +\ifnum\pgfplotstablecol=\pgfplotstablecols + \pgfkeyssetvalue{/pgfplots/table/cell content}{#1\\}% +\else + \pgfkeyssetvalue{/pgfplots/table/cell content}{#1&}% +\fi +\end{codeexample} + \paragraph{Attention:} The value of |\pgfplotstablecol| is now in the range $1,\dotsc,n$ where $n=$ |\pgfplotstablecols|. This simplifies checks whether we have the last column. +\end{codekey} + \begin{key}{/pgfplots/table/end table=\marg{code} (initially \textbackslash end\{tabular\})} Contains \marg{code} which is generated as table end. \end{key} \begin{key}{/pgfplots/table/outfile=\marg{file name} (initially empty)} +\label{page:outfile} Writes the generated tabular code into \marg{file name}. It can then be used with |\input|\marg{file name}, \PGFPlotstable\ is no longer required since it contains a completely normal |tabular|. \begin{codeexample}[] -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ columns={dof,error1}, outfile=pgfplotstable.example1.out.tex] {pgfplotstable.example1.dat} \end{codeexample} and |pgfplotstable.example1.out.tex| contains -\lstdefineformat{inp}{\\\\=\string\newline}% -\lstinputlisting[basicstyle=\ttfamily\footnotesize,format=inp]{pgfplotstable.example1.out.tex} +%\lstdefineformat{inp}{\\\\=\string\newline}% +\lstinputlisting[basicstyle=\ttfamily\footnotesize]{pgfplotstable.example1.out.tex} The command |\pgfutilensuremath| checks whether math mode is active and switches to math mode if necessary\footnote{Please note that \lstinline{\\pgfutilensuremath} needs to be replaced by \lstinline{\\ensuremath} if you want to use the output file independent of \PGF. That can be done by \lstinline{\\let\\pgfutilensuremath=\\ensuremath} which enables the \LaTeX-command \lstinline{\\ensuremath}.}. \end{key} +\begin{key}{/pgfplots/table/include outfiles=\marg{boolean} (initially false)} + If enabled, any already existing outfile will be |\input| instead of overwritten. +\begin{codeexample}[code only] +\pgfplotstableset{include outfiles} % for example in the document's preamble +\end{codeexample} + This allows to place any corrections manually into generated output files. +\end{key} +\begin{key}{/pgfplots/table/force remake=\marg{boolean} (initially false)} + If enabled, the effect of |include outfiles| is disabled. As all key settings only last until the next brace (or |\end|\meta{}), this key can be used to re-generate some output files while others are still included. +\end{key} + +\begin{key}{/pgfplots/table/write to macro=\marg{\textbackslash macroname}} + If the value of |write to macro| is not empty, the completely generated (tabular) code will be written into the macro \marg{\textbackslash macroname}. +\end{key} + +\begin{key}{/pgfplots/table/skip coltypes=\mchoice{true,false} (initially false)} + Allows to skip the \marg{coltypes} in |\begin{tabular}|\marg{coltypes}. This allows simplifications for other table types which don't have \LaTeX's table format. +\end{key} + +\begin{key}{/pgfplots/table/typeset=\mchoice{true,false} (initially true)} + A boolean which disables the final typesetting stage. Use |typeset=false| in conjunction with |write to macro| if only the generated code is of interest and \TeX\ should not attempt to produce any content in the output |pdf|. +\end{key} + \begin{key}{/pgfplots/table/debug=\marg{boolean} (initially false)} If enabled, will write every final tabular code to your log file. \end{key} -\section{Defining column types for \texttt{tabular}} +\begin{key}{/pgfplots/table/TeX comment=\marg{comment sign} (initially \%)} + 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): +\begin{codeexample}[width=8cm] +\pgfplotstabletypeset[ + begin table={<table>}, end table={</table>}, + typeset cell/.style={ + /pgfplots/table/@cell content={<td>#1</td>} + }, + before row=<tr>,after row=</tr>, + skip coltypes, typeset=false, string type, + TeX comment=, + columns={level,dof}, + outfile=pgfplotstable.example1.out.html, +]{pgfplotstable.example1.dat} +\lstinputlisting + [basicstyle=\ttfamily\footnotesize] + {pgfplotstable.example1.out.html} +\end{codeexample} + +\subsection{Defining Column Types for \texttt{tabular}} Besides input of text files, it is sometimes desireable to define column types for existing \texttt{tabular} environments. \begin{command}{\newcolumntype\marg{letter}\oarg{number of arguments}$>$\marg{before column}\meta{column type}$<$\marg{after column}} @@ -777,9 +718,9 @@ Now, the environment |pgfplotstablecoltype| can be used in \marg{before column} \end{codeexample} \end{command} -\section{Number formatting options} +\subsection{Number Formatting Options} \label{sec:number:printing}% -The following extract of \cite{tikz} explains how to configure number formats. +The following extract of \cite{tikz} explains how to configure number formats. The common option prefix |/pgf/number format| can be omitted; it will be recognised automatically. \begin{command}{\pgfmathprintnumber\marg{x}} Generates pretty-printed output for the (real) number \marg{x}. The input number \marg{x} is parsed using |\pgfmathfloatparsenumber| which allows arbitrary precision. @@ -906,7 +847,7 @@ Truncates every number to integers (discards any digit after the period). Sets the desired rounding precision for any display operation. For scientific format, this affects the mantisse. \end{key} -\subsection{Changing display styles}% +\subsubsection{Changing Number Format Display Styles}% \label{sec:number:styles}% You can change the way how numbers are displayed. For example, if you use the `\texttt{fixed}' style, the input number is rounded to the desired precision and the current fixed point display style is used to typeset the number. The same is applied to any other format: first, rounding routines are used to get the correct digits, afterwards a display style generates proper \TeX-code. @@ -968,6 +909,33 @@ The last example employs commas and disables the default comma-spacing. Just another name for |set thousands separator|. \end{key} +\begin{key}{/pgf/number format/min exponent for 1000 sep=\marg{number} (initially 0)} + Defines the smalles exponent in scientific notation which is required to draw thousand separators. The exponent is the number of digits minus one, so $\meta{number}=4$ will use thousand separators starting with $1e4 = 10000$. +\begin{codeexample}[] +\pgfkeys{/pgf/number format/.cd, + int detect, + 1000 sep={\,}, + min exponent for 1000 sep=0} +\pgfmathprintnumber{5000}; \pgfmathprintnumber{1000000} +\end{codeexample} + +\begin{codeexample}[] +\pgfkeys{/pgf/number format/.cd, + int detect, + 1000 sep={\,}, + min exponent for 1000 sep=4} +\pgfmathprintnumber{1000}; \pgfmathprintnumber{5000} +\end{codeexample} +\begin{codeexample}[] +\pgfkeys{/pgf/number format/.cd, + int detect, + 1000 sep={\,}, + min exponent for 1000 sep=4} +\pgfmathprintnumber{10000}; \pgfmathprintnumber{1000000} +\end{codeexample} +\noindent A value of |0| disables this feature (negative values are ignored). +\end{key} + \begin{key}{/pgf/number format/use period} A predefined style which installs periods `\texttt{.}' as decimal separators and commas `\texttt{,}' as thousands separators. This style is the default. @@ -1075,6 +1043,15 @@ Typesets the exponent as subscript for any number displayed in scientific format \end{codeexample} \end{key} +\begin{key}{/pgf/number format/sci superscript} +Typesets the exponent as superscript for any number displayed in scientific format. This style requires very few space. + +\begin{codeexample}[] +\pgfkeys{/pgf/number format/.cd,sci,sci superscript} +\pgfmathprintnumber{12.345} +\end{codeexample} +\end{key} + \begin{key}{/pgf/number format/@dec sep mark=\marg{text}} Will be placed right before the place where a decimal separator belongs to. However, \marg{text} will be inserted even if there is no decimal separator. It is intented as place-holder for auxiliary routines to find alignment positions. @@ -1093,15 +1070,356 @@ Typesets the exponent as subscript for any number displayed in scientific format The initial setting installs a |\pgfutilensuremath| around each final number to change to math mode if necessary. Use |assume math mode=true| if you know that math mode is active and you don't want |\pgfutilensuremath|. \end{key} -\section{Changing tables} -After tables have been loaded from disk, it is possible to change their contents. The methods are limited up to now and they reflect mostly what I needed in my applications. Nevertheless, the approaches are quite general and can be customized. + + +\section{Fine Tuning of Loaded Data} +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, + \item Preprocessing, + \item Typesetting, + \item Postprocessing. +\end{enumerate} +The main idea is to select one typesetting algorithm (for example ``format my numbers with the configured number style''). This algorithm usually doesn't need to be changed. Fine tuning can then be done using zero, one or more preprocessors and postprocessors. Preprocessing can mean to select only particular rows or to apply some sort of operation before the typesetting algorithm sees the content. Postprocessing means to apply fine-tuning to the resulting \TeX\ output -- for example to deal with empty cells or to insert unit suffixes or modify fonts for single cells. + +\subsection{Loading the table} +This first step to typeset a table involves the obvious input operations. Furthermore, the ``new column creation'' operations explained in section~\ref{pgfplotstable:createcol} are processed at this time. The table data is read (or acquired) as already explained earlier in this manual. Then, if columns are missing, column alias and |create on use| specifications will be processed as part of the loading procedure. See section~\ref{pgfplotstable:createcol} for details about column creation. + +\subsection{Typesetting Cell Content} +Typesetting cells means to take their value and ``do something''. In many cases, this involves number formatting routines. For example, the ``raw'' input data |12.56| might become |1.235| |\cdot| |10^1|. The result of this stage is no longer useful for content-based computations. The typesetting step follows the preprocessing step. + +\begin{codekey}{/pgfplots/table/assign cell content} + 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|. + + 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. + + Please note further that if any column has more entries than the first column, these entries will be skipped and a warning message will be issued into the log file. + + 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 contents|. + + It invokes |\pgfmathprintnumberto| and writes the result into |@cell content|. +\end{key} + +\begin{stylekey}{/pgfplots/table/string type} + A style which redefines |assign cell contents| 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/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. +\begin{codeexample}[] +% Requires +% \usepackage{pgfcalendar} +\pgfplotstableset{columns={date,account1}} + +\pgfplotstabletypeset[ + columns/date/.style={string type} +]{plotdata/accounts.dat} +\hspace{1cm} +\pgfplotstabletypeset[ + columns/date/.style={date type={\monthname\ \year}} +]{plotdata/accounts.dat} +\end{codeexample} + This style \textbf{requires} to load the \PGF\ \textbf{calendar package}: +\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|). +\end{command} +\begin{command}{\month} + Inside of \marg{date format}, this macro expands to the month as number, starting with~$1$ (like |1|). +\end{command} +\begin{command}{\monthname} + Inside of \marg{date format}, this macro expands to the month's name as set in the current language (like |January|). + See below for how to change the language. +\end{command} +\begin{command}{\monthshortname} + Inside of \marg{date format}, this macro expands to the month's short name as set in the current language (like |Jan|). + See below for how to change the language. +\end{command} +\begin{command}{\day} + Inside of \marg{date format}, this macro expands to the day as number (like |31|). +\end{command} +\begin{command}{\weekday} + Inside of \marg{date format}, this macro expands to the weekday number ($0$ for Monday, $1$ for Tuesday etc.). +\end{command} +\begin{command}{\weekdayname} + Inside of \marg{date format}, this macro expands to the weekday's name in the current language (like |Wednesday|). + See below for how to change the language. +\end{command} +\begin{command}{\weekdayshortname} + 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. + +\subsection{Preprocessing Cell Content} +The preprocessing step allows to change cell contents \emph{before} any typesetting routine (like number formatting) has been applied. The data is available in numerical format and math operations can be applied. Furthermore, cells can be erased depending on their numerical value. The preprocess step follows the data acquisition step (``loading step''). This means in particular that you can create (or copy) columns and apply operations on them. + +\begin{codekey}{/pgfplots/table/preproc cell content} + Allows to \emph{modify} the contents of cells \emph{before} |assign cell contents| is called. + + The semantics is as follows: before the preprocessor, |@cell content| contains the raw input data (or, maybe, the result of another preprocessor call). After the preprocessor, |@cell content| is filled with a -- possibly modified -- value. The resulting value is then used as input to |assign cell contents|. + + In the default settings, |assign cell contents| expects numerical input. So, the preprocessor is expected to produce numerical output. + + It is possible to provide multiple preprocessor directives using |.append code| or |.append style| key handlers. + + In case you don't want (or need) stackable preprocessors, you can also use `|#1|' to get the raw input datum as it is found in the file. +\end{codekey} + +\begin{stylekey}{/pgfplots/table/string replace=\marg{pattern}\marg{replacement}} + Appends code to the current |preproc cell content| value which replace every occurence of \marg{pattern} with \marg{replacement}. No expansion is performed during this step; \marg{pattern} must match literally. +\begin{codeexample}[] +\pgfplotstabletypeset[columns={level,dof}] + {pgfplotstable.example1.dat} + + +\pgfplotstabletypeset[ + columns={level,dof}, + columns/level/.style={string replace={A}{B}}, % does nothing because there is no 'A' + columns/dof/.style={string replace={256}{-42}}] % replace '256' with '-42' + {pgfplotstable.example1.dat} +\end{codeexample} +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/clear infinite} + Appends code to the current |preproc cell content| value which replaces every infinite number with the empty string. This clears any cells with $\pm \infty$ and NaN. +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/multiply with=\marg{real number}} + Appends code to the current |preproc cell content| value which multiplies every cell with \marg{real number}. Arithmetics are carried out in floating point. +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/divide by=\marg{real number}} + Appends code to the current |preproc cell content| value which divides every cell by \marg{real number}. Arithmetics are carried out in floating point. +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/sqrt} + Appends code to the current |preproc cell content| value which applies $\sqrt{x}$ to every non-empty cell. Arithmetics are carried out in floating point. + + The following example copies the column |error1| and applies |sqrt| to the copy. +\begin{codeexample}[] +\pgfplotstableset{ + columns={error1,sqrterror1}, + create on use/sqrterror1/.style={create col/copy=error1}, + columns/error1/.style={column name=$\epsilon$}, + columns/sqrterror1/.style={sqrt,column name=$\sqrt \epsilon$}, + sci,sci 10e,precision=3,sci zerofill +} +\pgfplotstabletypeset{pgfplotstable.example1.dat} +\end{codeexample} + Please take a look at section~\ref{pgfplotstable:createcol} for details about |create on use|. +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/multiply -1} + Appends code to current |preproc cell content| value which multiplies every cell with $-1$. This style does the same job as |multiply with=-1|, it is just faster because only the sign changes. +\begin{codeexample}[] +\pgfplotstableset{ + columns={dof,error2,slopes2}, + columns/error2/.style={sci,sci zerofill}, + columns/slopes2/.style={dec sep align,empty cells with={\ensuremath{-}}}, + create on use/slopes2/.style= + {create col/gradient loglog={dof}{error2}}} + +\pgfplotstabletypeset{pgfplotstable.example1.dat} + +\pgfplotstabletypeset[columns/slopes2/.append style={multiply -1}] + {pgfplotstable.example1.dat} +\end{codeexample} +\end{stylekey} + +\begin{codekey}{/pgfplots/table/row predicate} + A boolean predicate which allows to select particular rows of the input table. The argument |#1| contains the current row's index (starting with~$0$, not counting comment lines or column names). + + The return value is assigned to the \TeX-if |\ifpgfplotstableuserow|. If the boolean is not changed, the return value is true. +\begin{codeexample}[narrow] +% requires \usepackage{booktabs} +\pgfplotstabletypeset[ + every head row/.style={ + before row=\toprule,after row=\midrule}, + every last row/.style={ + after row=\bottomrule}, + row predicate/.code={% + \ifnum#1>4\relax + \ifnum#1<8\relax + \pgfplotstableuserowfalse + \fi + \fi} +] + {pgfplotstable.example1.dat} +\end{codeexample} + Please note that |row predicate| is applied \emph{before} any other option which affects row appearance. It is evaluated before |assign cell contents|. For example, the even/odd row styles refer to those rows for which the predicate returns |true|. In fact, you can use |row predicate| to truncate the complete table before it as actually processed. + + During |row predicate|, the macro |\pgfplotstablerows| contains the total number of \emph{input} rows. + + Furthermore, |row predicate| applies only to the typeset routines, not the read methods. If you want to plot only selected table entries with |\addplot table|, use the \PGFPlots\ coordinate filter options. +\end{codekey} + +\begin{stylekey}{/pgfplots/table/skip rows between index=\marg{begin}\marg{end}} + A style which appends an |row predicate| which discards selected rows. The selection is done by index where indexing starts with~$0$. Every row with index $\meta{begin} \le i < \meta{end}$ will be skipped. +\begin{codeexample}[narrow] +% requires \usepackage{booktabs} +\pgfplotstabletypeset[ + every head row/.style={ + before row=\toprule,after row=\midrule}, + every last row/.style={ + after row=\bottomrule}, + skip rows between index={2}{4}, + skip rows between index={7}{9} +] + {pgfplotstable.example1.dat} +\end{codeexample} +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/select equal part entry of=\marg{part no}\marg{part count}} + A style which overwrites |row predicate| with a subset selection predicate. The idea is to split the current column into \marg{part count} equally sized parts and select only \marg{part no}. + + This can be used to simulate multicolumn tables. +\begin{codeexample}[] +% requires \usepackage{booktabs} +\pgfplotstableset{ + every head row/.style={before row=\toprule,after row=\midrule}, + every last row/.style={after row=\bottomrule}} + +\pgfplotstabletypeset[string type]{pgfplotstable.example2.dat} + +\pgfplotstabletypeset[ + display columns/0/.style={select equal part entry of={0}{2},string type}, + display columns/1/.style={select equal part entry of={0}{2},string type}, + display columns/2/.style={select equal part entry of={1}{2},string type}, + display columns/3/.style={select equal part entry of={1}{2},string type}, + columns={A,B,A,B} +] + {pgfplotstable.example2.dat} +\end{codeexample} + The example above shows the original file as-is on the left side. The right side shows columns A,B,A,B~-- but only half of the elements are shown, selected by indices \#0 or \#1 of \#2. The parts are equally large, up to a remainder. + + If the available number of rows is not dividable by \marg{part count}, the remaining entries are distributed equally among the first parts. +\end{stylekey} + + +\subsection{Postprocessing Cell Content} +The postprocessing step is applied after the typesetting stage, that means it can't access the original input data. However, it can apply final formatting instructions which are not content based. + +\begin{codekey}{/pgfplots/table/postproc cell content} + Allows to \emph{modify} assigned cell content \emph{after} it has been assigned, possibly content-dependend. Ideas could be to draw negative numbers in red, typeset single entries in bold face or insert replacement text. + + This key is evaluated \emph{after} |assign cell content|. Its semantics is to modify an existing |@cell content| value. + + There may be more than one |postproc cell content| command, if you use |.append code| or |.append style| to define them: +\begin{codeexample}[] +% requires \usepackage{eurosym} +\pgfplotstabletypeset[ + column type=r, + columns={dof,info}, + columns/info/.style={ + postproc cell content/.append style={ + /pgfplots/table/@cell content/.add={$\bf}{$}}, + postproc cell content/.append style={ + /pgfplots/table/@cell content/.add={}{\EUR{}}} + }] + {pgfplotstable.example1.dat} +\end{codeexample} + The code above modifies |@cell content| successively. First, ``|$\bf ... $|'' is inserted, then ``|...\EUR|''. It should be noted that |pgfkeys| handles |.style| and |.code| in (quasi) the same way -- both are simple code keys and can be used as such. You can combine both with |.append style| and |.append code|. Please refer to~\cite[section about pgfkeys]{tikz} for details. + + As in |assign cell contents|, the code can evaluate helper macros like |\pgfplotstablerow| to change only particular entries. Furthermore, the argument ``|#1|'' expands to the \emph{unformatted} input argument which was found in the input table. This allows complete context based formatting options. Please remember that empty strings may appear due to column balancing -- introduce special treatment if necessary. + + There is one special case which occurs if |@cell content| itsself contains the cell separation character `|&|'. In this case, |postproc cell contents| is invoked \emph{separately} for each part before and after the ampersand and the ampersand is inserted afterwards. This allows compatibility with special styles which create artificial columns in the output (which is allowed, see |dec sep align|). To allow separate treatment of each part, you can use the macro |\pgfplotstablepartno|. It is defined only during the evaluation of |postproc cell content| and it evaluates to the current part index (starting with~$0$). If there is no ampersand in your text, the value will always be~$0$. + + This key is evaluated inside of a local \TeX\ group, so any local macro assignments will be cleared afterwards. + + The following example can be used to insert a dash, $-$, in a slope column: +\begin{codeexample}[] +\pgfplotstableset{ + create on use/slopes1/.style= + {create col/gradient loglog={dof}{error1}}} + +\pgfplotstabletypeset[ + columns={dof,error1,slopes1}, + columns/error1/.style={sci,sci zerofill}, + columns/slopes1/.style={ + postproc cell content/.append code={% + \ifnum\pgfplotstablerow=0 + \pgfkeyssetvalue{/pgfplots/table/@cell content}{\ensuremath{-}}% + \fi + }% + }] + {pgfplotstable.example1.dat} +\end{codeexample} +Since this may be useful in a more general context, it is available as |empty cells with| style. +\end{codekey} + +\begin{stylekey}{/pgfplots/table/empty cells with=\marg{replacement}} + Appends code to |postproc cell content| which replaces any empty cell with \marg{replacement}. + + If |dec sep align| is active, the replacement will be inserted only for the part before the decimal separator. +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/set content=\marg{content}} + A style which redefines |postproc cell contents| to always return the value \marg{content}. +\end{stylekey} + + +\section{Generating Data in New Tables or Columns} +\label{pgfplotstable:createcol} +It is possible to create new tables from scratch or to change tables after they have been loaded from disk. + +\subsection{Creating New Tables From Scratch} +\begin{command}{\pgfplotstablenew\oarg{options}\marg{row count}\marg{\textbackslash table}} + Creates a new table from scratch. + + The new table will contain all columns listed in the |columns| key + which needs to be provided in \oarg{options}\footnote{Currently, you need to provide at least one column here: the implementation gets confused for completely empty tables. If you do not provide any column name, a dummy column will be created.}. + + Furthermore, there must be |create on use| statements (see the next subsection) for every + column which shall be generated. Columns are generated + independently, in the order of appearance in |columns|. + + The table will contain exactly \marg{row count} rows. If \marg{row count} is an |\pgfplotstablegetrowsof| statement, that statement will be executed and the resulting number of rows be used. Otherwise, \marg{row count} will be evaluated as number. +\begin{codeexample}[] +% this key setting could be provided in the document's preamble: +\pgfplotstableset{ + % define how the 'new' column shall be filled: + create on use/new/.style={create col/set list={4,5,6,7,...,10}}} +% create a new table with 11 rows and column 'new': +\pgfplotstablenew[columns={new}]{11}\table +% show it: +\pgfplotstabletypeset[empty cells with={---}]\table +\end{codeexample} + +\begin{codeexample}[] +% create a new table with 11 rows and column 'new': +\pgfplotstablenew[ + % define how the 'new' column shall be filled: + create on use/new/.style={create col/expr={factorial(15+\pgfplotstablerow)}}, + columns={new}] + {11} + \table +% show it: +\pgfplotstabletypeset\table +\end{codeexample} +\end{command} + +\subsection{Creating New Columns From Existing Ones} \begin{command}{\pgfplotstablecreatecol\oarg{options}\marg{new col name}\marg{\textbackslash table}} -Creates a new column named \marg{new col name} and appends it to table \marg{\textbackslash table}. +Creates a new column named \marg{new col name} and appends it to an already existing table \marg{\textbackslash table}. -This command is technical, but it offers a flexible framework to generate new columns. It has been designed to create new columns using the already existing values -- for example using logical or numerical methods to combine existing values. It provides fast access to a row's value and the next row's value. +End users probably don't need to use |\pgfplotstablecreatecol| directly at all -- there is the high--level framework |create on use| which invokes it internally and can be used with simple key--value assignments (see below). However, this documentation explains how to use values of existing columns to fill new cells. -The following documentation is for all who want to \emph{write} specialised columns. It is not particularly difficult; it is just technical and it requires some knowledge of |pgfkeys|. If you don't like it, you can resort to some predefined column generation styles - and enable those styles in \marg{options}. +This command offers a flexible framework to generate new columns. It has been designed to create new columns using the already existing values -- for example using logical or numerical methods to combine existing values. It provides fast access to a row's value, the previous row's value and the next row's value. + +The following documentation is for all who want to \emph{write} specialised columns. It is not particularly difficult; it is just technical and it requires some knowledge of |pgfkeys|. If you don't like it, you can resort to predefined column generation styles - and enable those styles in \marg{options}. The column entries will be created using the command key |create col/assign|. It will be invoked for every row of the table. It is supposed to assign contents to |create col/next content|. @@ -1110,9 +1428,11 @@ expands to the current row's value of the column identified by \marg{col name}. Furthermore, |\nextrow|\marg{col name} expands to the \emph{next} row's value of the designated column and |\prevrow|\marg{col name} expands to the value of the \emph{previous} row. +So, the idea is to simply redefine the command key |create col/assign| in such a way that it fills new cells as desired. + Two special |assign| routines are available for the first and last row: The contents for the \emph{last} row is computed with |create col/assign last|. Its semantics is the same. The contents for the \emph{first} row is computed with |create col/assign first| to simplify special cases here. These first and last commands are optional, their default is to invoke the normal |assign| routine. -The evaluation of the |assign| keys is done in local \TeX\ groups. +The evaluation of the |assign| keys is done in local \TeX\ groups (i.e. any local definitions will be cleared afterwards). The following macros are useful during cell assignments: \begin{enumerate} @@ -1130,7 +1450,8 @@ 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 |\pgfmathaccuma| and |\pgfmathaccumb| can be used to transport intermediate results. - Both maintain their value from one call to the next. All other local variables will be deleted after leaving the assignment routines. + 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 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). @@ -1166,52 +1487,157 @@ The default implementation of |assign| is to produce empty strings. The default \begin{codeexample}[narrow] % requires \usepackage{array} -\pgfplotstableset{ +\pgfplotstableset{% could be used in preamble create on use/quot1/.style= {create col/quotient={error1}}} -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[ columns={error1,quot1}, columns/error1/.style={sci,sci zerofill}, columns/quot1/.style={dec sep align}] {pgfplotstable.example1.dat} \end{codeexample} - The example above queries |quot1| which does not yet exist in the input file. Therefor, it is checked whether a |create on use| style for |quot1| exists. This is the case, so it is used to create the missing column. + The example above queries |quot1| which does not yet exist in the input file. Therefor, it is checked whether a |create on use| style for |quot1| exists. This is the case, so it is used to create the missing column. The |create col/quotient| key is discussed below; it computes quotients of successive rows in column |error1|. A |create on use| specification is translated into - |\pgfplotstablecreatecol[|\meta{create options}|]|\marg{col name}\marg{the table}. + |\pgfplotstablecreatecol[|\meta{create options}|]|\marg{col name}\marg{the table}, + + or, equivalently, into - This feature allows some lazyness, because you can omit the lengthy table modifications. However, lazyness may cost something: in the example above, the generated column will be \emph{lost} after returning from |\pgfplotstabletypesetfile|. + |\pgfplotstablecreatecol[|create on use/\meta{col name}|]|\marg{col name}\marg{the table}. + + This feature allows some lazyness, because you can omit the lengthy table modifications. However, lazyness may cost something: in the example above, the generated column will be \emph{lost} after returning from |\pgfplotstabletypeset|. The |create on use| has higher priority than |alias|. In case \meta{col name} contains characters which are required for key settings, you need to use braces around it: ``|create on use/{name=wi/th,special}/.style={...}|''. + + More examples for |create on use| are shown below while discussing the available column creation styles. \end{pgfplotstablecreateonusekey} +\subsection{Predefined Column Generation Methods} +The following keys can be used in both |\pgfplotstablecreatecol| and the easier |create on use| frameworks. + +\subsubsection{Acquiring Data Somewhere} +\begin{stylekey}{/pgfplots/table/create col/set=\marg{value}} + A style for use in column creation context which creates a new column and writes \marg{value} into each new cell. The value is written as string (verbatim). +\begin{codeexample}[] +\pgfplotstableset{ + create on use/my new col/.style={create col/set={--empty--}}, + columns/my new col/.style={string type} +} + +\pgfplotstabletypeset[ + columns={level,my new col}, +]{pgfplotstable.example1.dat} +\end{codeexample} +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/create col/set list=\marg{comma-separated-list}} + A style for use in column creation context which creates a new column consisting of the entries in \marg{comma-separated-list}. The value is written as string (verbatim). + + The \marg{comma-separated-list} is processed via \Tikz's |\foreach| command, that means you can use |...| expressions to provide number (or character) ranges. +\begin{codeexample}[] +\pgfplotstableset{ + create on use/my new col/.style={ + create col/set list={A,B,C,4,50,55,...,100}}, + columns/my new col/.style={string type} +} + +\pgfplotstabletypeset[ + columns={level,my new col}, +]{pgfplotstable.example1.dat} +\end{codeexample} + \noindent The new column will be padded or truncated to the required number of rows. If the list does not contain enough elements, empty cells will be produced. +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/create col/copy=\marg{column name}} + A style for use in column creation context which simply copies the existing column \marg{column name}. +\begin{codeexample}[] +\pgfplotstableset{ + create on use/new/.style={create col/copy={level}} +} + +\pgfplotstabletypeset[ + columns={level,new}, + columns/new/.style={column name=Copy of level} +]{pgfplotstable.example1.dat} +\end{codeexample} +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/create col/copy column from table=\marg{file name or \textbackslash macro}\marg{column name}} + A style for use in column creation context which creates a new column consisting of the entries in \marg{column name} of the provided table. The argument may be either a file name or an already loaded table (i.e. a \meta{\textbackslash macro} as returned by |\pgfplotstableread|). + + You can use this style, possibly combined with |\pgfplotstablenew|, to merge one common sort of column from different tables into one large table. + + The cell values are written as string (verbatim). + + \noindent The new column will be padded or truncated to the required number of rows. If the list does not contain enough elements, empty cells will be produced. +\end{stylekey} + + +\subsubsection{Mathematical Operations} + +\begin{key}{/pgf/fpu=\marg{true,false}} +\index{Precision} + Before we start to describe the column generation methods, one word about the math library. The core is always the \PGF\ math engine written by Mark Wibrow and Till Tantau. However, this engine has been written to produce graphics and is not suitable for scientific computing. + + I added a high-precision floating point library to \PGF\ which will be part of releases newer than \PGF\ $2.00$. It offers the full range of IEEE double precision computing in \TeX. This FPU is also part of \PGFPlotstable, and it is activated by default for |create col/expr| and all other predefined mathematical methods. + + The FPU won't be active for newly defined numerical styles. If you want to add own routines or styles, you will need to use +\begin{codeexample}[code only] +\pgfkeys{/pgf/fpu=true} +\end{codeexample} + \noindent in order to activate the extended precision. The standard math parser is limited to fixed point numbers in the range $\pm 16384.00000$. +\end{key} + \begin{stylekey}{/pgfplots/table/create col/expr=\marg{math expression}} A style for use in |\pgfplotstablecreatecol| which uses \marg{math expression} to assign contents for the new column. \begin{codeexample}[] -\pgfplotstableread{pgfplotstable.example1.dat}\table -\pgfplotstablecreatecol[ - create col/expr={\thisrow{level}*2}] - {new}\table +\pgfplotstableset{ + create on use/new/.style={ + create col/expr={\thisrow{level}*2}} +} \pgfplotstabletypeset[ columns={level,new}, columns/new/.style={column name=$2\cdot $level} -]\table +]{pgfplotstable.example1.dat} \end{codeexample} The macros |\thisrow|\marg{col name} and |\nextrow|\marg{col name} can be used to use values of the existing table. Please see |\pgfplotstablecreatecol| for more information. - \paragraph{Attention:} Currently, |expr| uses the math parser of \PGF. Although very powerful, it has never been intended for scientific applications. Its $5.5$ fixed point arithmetic has its limitations. + \paragraph{Accumulated columns:} The |expr| style initialises |\pgfmathaccuma| to |0| before its first column. Whenever it computes a new column value, it redefines |\pgfmathaccuma| to be the result. That means you can use |\pgfmathaccuma| inside of \marg{math expression} to accumulate columns. See |create col/expr accum| for more details. + + \paragraph{About the precision and number range:}\index{Precision}\index{Floating Point Unit} Starting with version 1.2, |expr| uses a floating point unit. The FPU provides the full data range of scientific computing with a relative precision between $10^{-4}$ and $10^{-6}$. The |/pgf/fpu| key provides some more details. + + \paragraph{Accepted operations:} The math parser of \PGF, combined with the FPU, provides the following function and operators: + + |+|, |-|, |*|, |/|, |abs|, |round|, |floor|, |mod|, |<|, |>|, |max|, |min|, |sin|, |cos|, |tan|, |deg| (conversion from radians to degrees), |rad| (conversion from degrees to radians), |atan|, |asin|, |acos|, |cot|, |sec|, |cosec|, |exp|, |ln|, |sqrt|, the constanst |pi| and |e|, |^| (power operation), |factorial|\footnote{Starting with \PGF\ versions newer than $2.00$, you can use the postfix operator \texttt{!} instead of \texttt{factorial}.}, |rand| (random between $-1$ and $1$), |rnd| (random between $0$ and $1$), number format conversions |hex|, |Hex|, |oct|, |bin| and some more. The math parser has been written by Mark Wibrow and Till Tantau~\cite{tikz}, the FPU routines have been developed as part of \PGFPlots. The documentation for both parts can be found in~\cite{tikz}. \textbf{Attention:} Trigonometric functions work with degrees, not with radians! + +\end{stylekey} + +\begin{stylekey}{/pgfplots/table/create col/expr accum=\marg{math expression}\marg{accum initial}} + A variant of |create col/expr| which also allows to define the initial value of |\pgfmathaccuma|. The case \marg{accum initial}=|0| is \emph{equivalent} to |expr=|\marg{math expression}. - There is limited support for float point arithmetics, but that is far from complete and every elementary operation needs to be programmed by hand. Some of the following numerical styles employ these routines, they have been included into the \PGF\ math library (but not into the parser). +\begin{codeexample}[] +\pgfplotstableset{ + create on use/new/.style={ + create col/expr={\pgfmathaccuma + \thisrow{level}}}, + create on use/new2/.style={ + create col/expr accum={\pgfmathaccuma - \thisrow{level}}{100}} +} - Furthermore, you can create new columns using the |fp| package which allows precise fixed point arithmetics. +\pgfplotstabletypeset[ + columns={level,new,new2}, + columns/new/.style={column name=$\sum$level}, + columns/new2/.style={column name=$\prod$level} +]{pgfplotstable.example1.dat} +\end{codeexample} +The example creates two columns: the |new| column is just the sum of each value in the \meta{level} column (it employs the default |\pgfmathaccuma=0|). The |new2| column initialises |\pgfmathaccuma=100| and then successively subtracts the value of \meta{level}. \end{stylekey} \begin{stylekey}{/pgfplots/table/create col/quotient=\marg{column name}} @@ -1219,19 +1645,19 @@ The default implementation of |assign| is to produce empty strings. The default \begin{codeexample}[] % requires \usepackage{array} -\pgfplotstableread{pgfplotstable.example1.dat}\table -\pgfplotstablecreatecol[create col/quotient=error1] - {quot1}\table -\pgfplotstablecreatecol[create col/quotient=error2] - {quot2}\table - -\pgfplotstabletypeset[ +\pgfplotstableset{% configuration, for example, in preamble: + create on use/quot1/.style={create col/quotient=error1}, + create on use/quot2/.style={create col/quotient=error2}, columns={error1,error2,quot1,quot2}, + % + % display styles: columns/error1/.style={sci,sci zerofill}, columns/error2/.style={sci,sci zerofill}, columns/quot1/.style={dec sep align}, - columns/quot2/.style={dec sep align}] -\table + columns/quot2/.style={dec sep align} +} + +\pgfplotstabletypeset{pgfplotstable.example1.dat} \end{codeexample} This style employs methods of the floating point unit, that means it works with a relative precision of about $10^{-7}$ ($7$ significant digits in the mantisse). \end{stylekey} @@ -1247,7 +1673,7 @@ The default implementation of |assign| is to produce empty strings. The default \begin{codeexample}[] % requires \usepackage{array} -\pgfplotstabletypesetfile[ +\pgfplotstabletypeset[% here, configuration options apply only to this single statement: create on use/rate1/.style={create col/dyadic refinement rate={error1}}, create on use/rate2/.style={create col/dyadic refinement rate={error2}}, columns={error1,error2,rate1,rate2}, @@ -1275,42 +1701,141 @@ The default implementation of |assign| is to produce empty strings. The default \begin{codeexample}[] % requires \usepackage{array} -\pgfplotstableread{pgfplotstable.example1.dat}\table -\pgfplotstablecreatecol[create col/gradient loglog={dof}{error1}] - {slopes1}\table -\pgfplotstablecreatecol[create col/gradient loglog={dof}{error2}] - {slopes2}\table - -\pgfplotstabletypeset[ +\pgfplotstableset{% configuration, for example in preamble: + create on use/slopes1/.style={create col/gradient loglog={dof}{error1}}, + create on use/slopes2/.style={create col/gradient loglog={dof}{error2}}, columns={dof,error1,error2,slopes1,slopes2}, + % display styles: columns/dof/.style={int detect}, columns/error1/.style={sci,sci zerofill}, columns/error2/.style={sci,sci zerofill}, columns/slopes1/.style={dec sep align}, - columns/slopes2/.style={dec sep align}] -\table + columns/slopes2/.style={dec sep align} +} +\pgfplotstabletypeset{pgfplotstable.example1.dat} \end{codeexample} \begin{codeexample}[] % requires \usepackage{array} -\pgfplotstableread - {pgfplotstable.example1.dat}\table -\pgfplotstablecreatecol - [create col/gradient semilogy={level}{error1}] - {slopes1}\table - -\pgfplotstabletypeset[ +\pgfplotstableset{% configuration, for example in preamble: + create on use/slopes1/.style={create col/gradient semilogy={level}{error1}}, columns={level,error1,slopes1}, + % display styles: columns/level/.style={int detect}, - columns/error1/.style= - {sci,sci zerofill,sci subscript}, - columns/slopes1/.style={dec sep align}] -\table + columns/error1/.style={sci,sci zerofill,sci subscript}, + columns/slopes1/.style={dec sep align} +} +\pgfplotstabletypeset{pgfplotstable.example1.dat} \end{codeexample} 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} -\section{Plain \TeX\ and Con\TeX t support} +\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. + + In a cost--accuracy plot, this feature allows to extract the cost for fixed accuracy. The dual feature with |cut x| allows to compute the accuracy for fixed cost. + + \pgfplotsset{anchor=center,/tikz/baseline} +\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}} + }, + columns={cut}] + {2} + \table +\pgfplotstabletypeset{\table} + +\begin{tikzpicture} +\begin{loglogaxis} + \addplot table[x=Basis,y=L2] {plotdata/newexperiment1.dat}; + \addplot table[x=Basis,y=L2] {plotdata/newexperiment2.dat}; + \draw[blue!30!white] (axis cs:1,2.5e-4) -- (axis cs:1e5,2.5e-4); + \node[pin=-90:{$x=53.66$}] at (axis cs:53.66,2.5e-4) {}; + \node[pin=45:{$x=601.83$}] at (axis cs:601.83,2.5e-4) {}; +\end{loglogaxis} +\end{tikzpicture} +\end{codeexample} + In the example above, we are searching for $x_1$ and $x_2$ such that $f_1(x_1) = \pgfmathprintnumber{2.5e-4}$ and $f_2(x_2) =\pgfmathprintnumber{2.5e-4}$. On the left is the automatically computed result. On the right is a problem illustration with proper annotation. + The \marg{cut value} is set to |2.5e-4|. The \marg{common options} contain the problem setup; in our case logarithmic scales and column names. The third argument is a comma-separated-list. Each element $i$ is a set of keys describing how to get $f_i(\cdot)$. + + During both, \marg{common options} and the key sets, the following keys can be used: + \begin{itemize} + \item |table|: either a file name or an already loaded table where to get the data points, + \item |x|: the column name of the $x$ axis, + \item |y|: the column name of the $y$ axis. + \end{itemize} + The keys |xmode| and |ymode| can take either |log| or |linear|. All mentioned keys have the common key path + + \textcolor{red!75!black}{\texttt{/pgfplots/table/create col/function graph cut/}}. +\end{stylekey} +\begin{stylekey}{/pgfplots/table/create col/function graph cut x=\marg{cut value}\marg{common options}\marg{one key-value set for each plot}} + As above, just with $x$ and $y$ exchanged. +\end{stylekey} + +\section{Miscellaneous} +\subsection{Writing (Modified) Tables To Disk} +\begin{key}{/pgfplots/table/outfile=\marg{file name} (initially empty)} + Writes the completely processed table as \TeX\ file to \marg{file name}. This key is described in all detail on page~\pageref{page:outfile}. +\end{key} + +\begin{command}{\pgfplotstablesave\oarg{options}\marg{\textbackslash macro or input file name}\marg{output file name}} + This command takes a table and writes it to a new data file (without performing any typesetting). + + If the first argument is a file name, that file is loaded first. + + 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. +\begin{codeexample}[] +\pgfplotstablesave[ + create on use/postproc1/.style={create col/dyadic refinement rate=error1}, + columns={dof,error1,postproc1} +] + {pgfplotstable.example1.dat} + {pgfplotstable.example1.out.dat} +\end{codeexample} +Now, |pgfplotstable.example1.out.dat| is +\lstinputlisting[basicstyle=\ttfamily\footnotesize,tabsize=8]{pgfplotstable.example1.out.dat} + +You can use the |col sep| key inside of \meta{options} to define a column separator for the output file. In case you need a different input column separator, use |in col sep| instead of |col sep|. + +\paragraph{Remarks} +\begin{itemize} + \item +Empty cells will be filled with |{}| if |col sep=space|. Use the |empty cells with| style to change that. + \item Use |disable rowcol styles=false| inside of \meta{options} if you need to change column/row based styles. +\end{itemize} +\end{command} + +\subsection{Miscellaneous Keys} +\begin{key}{/pgfplots/table/disable rowcol styles=\mchoice{true,false} (initially false)} + Set this to |true| if |\pgfplotstabletypeset| shall \emph{not} set any styles which apply only to specific columns or only to specific rows. + + This disables the styles + \begin{itemize} + \item |columns/|\meta{column name}, + \item |display columns/|\meta{column index}, + \item |every col no |\meta{column index}, + \item |every row no |\meta{row index}. + \end{itemize} +\end{key} + +\begin{key}{/pgfplots/table/reset styles} + Resets all table typesetting styles which do not explicitly depend on column or row names and indices. The affected styles are + \begin{itemize} + \item |every table|, + \item |every even row|, |every odd row|, |every even column|, |every odd column|, + \item |every first column|, |every last column|, |every first row|, |every last row|, + \item |every head row|. + \end{itemize} + In case you want to reset all, you should also consider the key |disable rowcol styles|. +\end{key} + +\subsection{Plain \TeX\ and Con\TeX t support} \label{sec:pgfplotstable:context} The table code generator is initialised to produce \LaTeX\ |tabular| environments. However, it only relies on~`|&|' being the column separator and~`|\\|' the row terminator. The |column type| feature is more or less specific to |tabular|, but you can disable it completely. Replace |begin table| and |end table| with appropriate \TeX- or Con\TeX t commands to change it. If you have useful default styles (or bug reports), let me know. diff --git a/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment1.dat b/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment1.dat new file mode 100644 index 00000000000..9a346a82afa --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment1.dat @@ -0,0 +1,14 @@ +Basis L2 L2/r ref_L2 maxlevel +5 2.97101314e-02 5.59380138e-02 5.31125962e-01 2 +5 2.97101314e-02 5.59380138e-02 5.31125962e-01 2 +13 5.26652234e-03 9.91576898e-03 5.31125962e-01 4 +15 3.79838856e-03 7.15157764e-03 5.31125962e-01 5 +29 8.40740227e-04 1.58293943e-03 5.31125962e-01 6 +37 5.01257065e-04 9.43763063e-04 5.31125962e-01 6 +83 1.10546226e-04 2.08135609e-04 5.31125962e-01 7 +117 5.41319568e-05 1.01919245e-04 5.31125962e-01 8 +243 1.24678404e-05 2.34743569e-05 5.31125962e-01 9 +359 6.00916462e-06 1.13140103e-05 5.31125962e-01 10 +839 1.11358143e-06 2.09664282e-06 5.31125962e-01 11 +1159 5.90008838e-07 1.11086424e-06 5.31125962e-01 11 +2583 1.03238273e-07 1.94376251e-07 5.31125962e-01 12 diff --git a/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment2.dat b/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment2.dat new file mode 100644 index 00000000000..2bf049df8d8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment2.dat @@ -0,0 +1,14 @@ +Basis L2 L2/r ref_L2 maxlevel +9 1.24298689e-01 5.23997221e-01 2.37212496e-01 1 +9 1.24298689e-01 5.23997221e-01 2.37212496e-01 1 +21 3.92062884e-02 1.65279187e-01 2.37212496e-01 2 +25 1.87518223e-02 7.90507358e-02 2.37212496e-01 3 +117 2.67078613e-03 1.12590449e-02 2.37212496e-01 5 +129 2.22236154e-03 9.36865293e-03 2.37212496e-01 5 +361 5.03665412e-04 2.12326678e-03 2.37212496e-01 7 +481 3.78427622e-04 1.59531066e-03 2.37212496e-01 8 +1273 6.25699533e-05 2.63771743e-04 2.37212496e-01 9 +1917 3.23577823e-05 1.36408423e-04 2.37212496e-01 9 +4689 7.29465016e-06 3.07515426e-05 2.37212496e-01 11 +6741 4.10049305e-06 1.72861596e-05 2.37212496e-01 11 +16761 8.28799652e-07 3.49391228e-06 2.37212496e-01 12 diff --git a/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment3.dat b/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment3.dat new file mode 100644 index 00000000000..b1e82795f60 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/plotdata/newexperiment3.dat @@ -0,0 +1,14 @@ +Basis L2 L2/r ref_L2 maxlevel +27 5.50720207e-02 6.18174259e-01 8.90881817e-02 1 +27 5.50720207e-02 6.18174259e-01 8.90881817e-02 1 +27 5.50720207e-02 6.18174259e-01 8.90881817e-02 1 +27 5.50720207e-02 6.18174259e-01 8.90881817e-02 1 +117 9.92745366e-03 1.11434014e-01 8.90881817e-02 3 +225 8.98732438e-03 1.00881219e-01 8.90881817e-02 4 +683 1.82403693e-03 2.04745107e-02 8.90881817e-02 5 +959 9.61978751e-04 1.07980512e-02 8.90881817e-02 6 +3017 3.85075698e-04 4.32241056e-03 8.90881817e-02 8 +4421 1.47321463e-04 1.65365888e-03 8.90881817e-02 8 +12211 5.60095626e-05 6.28698010e-04 8.90881817e-02 10 +19029 1.83972055e-05 2.06505568e-04 8.90881817e-02 11 +51407 4.47833372e-06 5.02685500e-05 8.90881817e-02 12 diff --git a/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment1.dat b/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment1.dat new file mode 100644 index 00000000000..de4fe964587 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment1.dat @@ -0,0 +1,13 @@ +Basis L2 L2/r ref_L2 maxlevel +3 2.60508254e-01 4.90482999e-01 5.31125962e-01 1 +5 5.66241980e-02 1.06611618e-01 5.31125962e-01 2 +9 3.96350405e-02 7.46245586e-02 5.31125962e-01 3 +17 1.03555656e-02 1.94973817e-02 5.31125962e-01 4 +33 2.61539205e-03 4.92424065e-03 5.31125962e-01 5 +65 6.55520492e-04 1.23420909e-03 5.31125962e-01 6 +129 1.63984908e-04 3.08749561e-04 5.31125962e-01 7 +257 4.10027722e-05 7.71997136e-05 5.31125962e-01 8 +513 1.02510486e-05 1.93005978e-05 5.31125962e-01 9 +1025 2.56253402e-06 4.82471994e-06 5.31125962e-01 10 +2049 6.38710772e-07 1.20255988e-06 5.31125962e-01 11 +4097 1.46570173e-07 2.75961228e-07 5.31125962e-01 12 diff --git a/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment2.dat b/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment2.dat new file mode 100644 index 00000000000..09153af54f4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment2.dat @@ -0,0 +1,16 @@ +Basis L2 L2/r ref_L2 maxlevel +9 1.98638983e-01 8.37388363e-01 2.37212496e-01 1 +21 5.64326131e-02 2.37898990e-01 2.37212496e-01 2 +49 2.92574780e-02 1.23338688e-01 2.37212496e-01 3 +113 1.22483110e-02 5.16343414e-02 2.37212496e-01 4 +257 4.49960253e-03 1.89686573e-02 2.37212496e-01 5 +577 1.99398950e-03 8.40592102e-03 2.37212496e-01 6 +1281 7.23795581e-04 3.05125402e-03 2.37212496e-01 7 +2817 2.38389007e-04 1.00495974e-03 2.37212496e-01 8 +6145 7.40547620e-05 3.12187441e-04 2.37212496e-01 9 +13313 2.21347558e-05 9.33119303e-05 2.37212496e-01 10 +28673 6.43912576e-06 2.71449687e-05 2.37212496e-01 11 +61441 1.83662857e-06 7.74254562e-06 2.37212496e-01 12 +131073 5.08287160e-07 2.14275036e-06 2.37212496e-01 13 +278529 1.34832867e-07 5.68405415e-07 2.37212496e-01 14 +589825 1.44807933e-07 6.10456597e-07 2.37212496e-01 15 diff --git a/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment3.dat b/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment3.dat new file mode 100644 index 00000000000..def06e749d8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/pgfplots/plotdata/oldexperiment3.dat @@ -0,0 +1,16 @@ +Basis L2 L2/r ref_L2 maxlevel +27 1.09332286e-01 1.22723670e+00 8.90881817e-02 1 +81 5.01947271e-02 5.63427451e-01 8.90881817e-02 2 +225 1.73080188e-02 1.94279628e-01 8.90881817e-02 3 +593 8.27911552e-03 9.29316926e-02 8.90881817e-02 4 +1505 3.07418413e-03 3.45072047e-02 8.90881817e-02 5 +3713 1.50713390e-03 1.69173270e-02 8.90881817e-02 6 +8961 6.74034243e-04 7.56592210e-03 8.90881817e-02 7 +21249 2.80328651e-04 3.14664241e-03 8.90881817e-02 8 +49665 1.15461176e-04 1.29603247e-03 8.90881817e-02 9 +114689 4.47345923e-05 5.02138347e-04 8.90881817e-02 10 +262145 1.63023256e-05 1.82990890e-04 8.90881817e-02 11 +593921 5.64639994e-06 6.33798987e-05 8.90881817e-02 12 +1335297 1.88007387e-06 2.11035160e-05 8.90881817e-02 13 +2981889 5.97852515e-07 6.71079489e-06 8.90881817e-02 14 +6619137 2.63533023e-07 2.95811429e-06 8.90881817e-02 15 diff --git a/Master/texmf-dist/doc/latex/pgfplots/todo.txt b/Master/texmf-dist/doc/latex/pgfplots/todo.txt index 23880977b8f..0c9e581e428 100644 --- a/Master/texmf-dist/doc/latex/pgfplots/todo.txt +++ b/Master/texmf-dist/doc/latex/pgfplots/todo.txt @@ -1,11 +1,237 @@ ------------------------------------------------------------- -BUGS +TODO pgfplots release 1.2 ------------------------------------------------------------- ++ redefine domain and samples key: the current implementation doesn't accept the + extended number range if provided outside of plot expression or plot gnuplot. ++ -> but it is now slightly incompatible FIXED ++ search for 'pt' suffixes which produce log message warnings ++ verify that plot expression and the fpu works with pgf 2.00 (which is not trivial) +X the unary '-' operator has the wrong precedence in both, pgf 2.00 and pgf CVS. + (can't be solved) ++ eliminate some of the dimen registers which are not absolutely necessary ++ check manual for missing features and updates ++ update manual: authors section ++ manual should contain more 'plot expression' than 'plot gnuplot' ++ there is a bug with 'axis equal' -> see manual examples ++ clean .table files from repository (at least the unused ones) ++ run all tests: + PGF 2.00 PGF CVS + FPU 2009-02-01 2009-02-01 + example plain 2009-02-01 2009-02-01 + example latex 2009-02-01 2009-02-01 + example context 2009-02-01 2009-02-01 + tests latex 2009-02-01 2009-02-01 + tests context 2009-02-01 2009-02-01 + clickable lib 2009-02-01 2009-02-01 + manual 2009-02-01 2009-02-01 ++ compile manuals ++ fix latest bugs +- submit ZIP files +- further features should be either very stable or should wait + + + +------------------------------------------------------------- +BUGS / FIXES +------------------------------------------------------------- + ++ something with the table package appears to be buggy!? + ++ the plot table[] search path is not good - it should include /pgfplots + +- introduce backwards compatibility with old pgfmathfloat.code.tex file + [ not interesting for pgfplots 1.2, only for pgfplots 1.1 !] + ++ there is a bug related with empty axes - I suppose in conjunction with the + tickmin/max feature (it won't be reset properly) + +- the arguments to plot file[#1] and plot table[#1] are not consistent with + rest. They need to be treated as behavior options (maybe in a different key + path). + + +- there is a space too much in some behavior messages (occured in test + processing) + +X introduce backwards compatibility with old pgfmathfloat.code.tex file + +- the pgf math parser has wrong precedence for '-' prefix op: + exp(-x^2) is wrong. + +- the auto-generated tick labels for non-unit-distance log axes could be better. + ++ verify that the domain key always accepts the extended data range + ++ I observed problems with opacity set for just one plot which was used for + every plot in the axes!? + + ++ the stacked plots impl is not yet in logical coords - that means it + won't work with non-standard unit vectors! + +- fix version stuff in package header +- introduce CVS Header Variables in every sourcefile + ++ The floating point math routines should be put into a separate library. + Provide compatibility support for that in pgfplots! + ++ empty plots cause bugs. ++ empty plots and the named nodes may not work correctly -> check that + ++ newlines in plot coordinates cause an error. + + provide sanity checking and correct error messages! + ++ 'domain' can't be used to increase the data range, even when combined with fp. ++ huge 'domain' arguments for 'plot function' lead to an 'dimension too large' error + although everything works fine + ++ the float math methods should be affected by the fixedpoint library, but they + are (because the underlying pgf math routines are exchanged). + +X scaled ticks is not properly implemented for log axes + + it is not available for log axes, so that's ok + ++ pgfplotstable and \rowcolor and 'sci sep align' in conjunction produces + overwritten digits! The color seems to be on top of the numbers left of the + sci separator. + -> This is caused by the left/right overhang of the colortbl package and my + implementation of 'sci sep align' as an extra column. That's bad. + -> Idea: + - manually overwrite \rowcolor/\columncolor/\cellcolor in a portable way such + that overhangs are made properly. + Maybe there is a macro in colortbl? + [fixed for \rowcolor] + + ++ stacked plots + error bars don't work correctly together: I need to shift the + error bars + ++ error bars should be drawn on top of the plot to avoid conflicts with filling. + ++ [xy]ticklabel pos values 'top' and 'bottom' are somewhat inconsistent with + the actual placement + ++ the auto-disable-feature for logarithmic minor ticks can be overruled (of + minor grid lines) which should not be possible + -> provide a good policy how to deal with user inputs: + 1. draw minor tick/grids if requested + 2. provide error message + ++ scatter is disabled if no default mark has been set. + ++ filter warnings are broken because they don't output the input coordinates + ++ tick align=center is broken since last revision. Possibly tick align=outside + as well. + ++ clickable lib is broken somehow + ++ check for clickable lib if multiple axes are in the same tikzpicture + -> doesn't work. Why!? + - I can't reproduce that bug. Maybe it is fixed in the meantime? + ++ the case + ymin=629.65, + ymax=629.70, + FAILS with math errors because the affine data transformation is deactivated + for the automatic tick computation! Providing tick labels manually works. + -> FIX THAT! Ticks should be computed without this restriction (if necessary, + in float arithmetics)! + ++ it is not possible to provide '[xy]mode' in styles. + -> ok, provided error message. + ++ check whether there are any plots before processing something like + 'xtick=data' or so + ++ the clipping of tick/grid lines is currently disabled due to the change to + logical coordinates and needs attention. + +- In 3D case axis [xyz] line != box, there is just ONE hyperplane. + My implementation works only if either ALL are box or ALL are 'middle'. + +- 3D case : which hyperplane gets tick LABELS? + The current implementation based on '[xzy]ticklabel pos' is not sufficient + +- 3D case: something fails with disabledatascaling + +- 3D case : grid lines work correctly, but they are not satisfactory. + I'd like grid lines in the background only. + +- 3D case : tick/grid lines are on top of the axis lines. This leads to + poor quality. + ++ '\coordinate (<aname>) at (axis cs:0,0);' does NOT work; + '\node[name=<aname>] at ... ' DOES work. + -> I can't hook into the 'at' syntax; I can only override the 'name' + key. + ++ check whether the \label/\ref construction requires \protect\tikz and + \protect\path etc. if it is placed inside of \caption... + -> no; it has catcode 12 + ++ check whether named nodes are still ok. Since the 'fill opacity' bugfix, these + may be broken... + maybe the scoping needs to be improved + -> there is still need for scopes in case 'clip markers'! + ++ error messages if the PGF version is wrong should be added + -> check for \pgfkeys + -> I should also check whether the float routines are available! + Maybe they will migrate to a tikz library someday. + + ++ \addplot [fill opacity=...] is not scoped properly! ++ I suppose the same problem holds true for dotted line styles. ++ setting mark options to dashed also changes the legend's appearance + + ++ the clickable library does *not* work inside of figure environments + + + ++ renormalization bug in + log(9.999998e-01) = 4.70201 != 0 + +X Bug in table input: if colnames contain (some?) UTF8 characters, \csname <colname>\endcsname FAILS. + That means table column names can't use UTF8 characters. + Possible solution: for each character in <colname>, check whether it is active. If yes, change its meaning. + I am not sure if that's acceptable... + +X error recovery: it is sometimes almost impossible to find errors in + key-value-settings because \end{axis} or \pgfplotstabletypesetfile does not + is NOT the correct context. + -> possibly with \errorcontextlines=10? + ++ the error message for gnuplot invocation is wrong; gnuplot should be called on + the '.gnuplot' file instead of the '.table' file + ++ there are still plain TeX loops in the legend code!? + ++ javascript stuff is incompatible with a lot of active characters, + for example the german package: + + bug in insdljs: workaround introduced. + + bug in my code fixed + +- javascript stuff does not work if the complete figure is rotated (sidewaysfigure). + +- javascript: incompatiblity with external library: + 1. filenames: \jobname contains characters with incompatible catcodes and + that funny insdljs package tries to assemble macros with these + characters. + -> fixed; I simply use pgfplotsJS as temporary file name. + 2. the images as such have corrupted forms + -> Can be fixed if + \usepackage{eforms} + is used BEFORE loading pgf. The reason: \begin{Form} and the shipout-hackery + of the pgf externalization bite each other. + \begin{Form} must come before the shipout hackery of pgf. + 3. \includegraphics does not preserve PDF forms. - the interrupt bounding box feature should still update the data bounding box. Otherwise, transformations may fail. -- to check: it *could* be possible that errorbars + stacked plots are ++ to check: it *could* be possible that errorbars + stacked plots are incompatible. + the 'alias' and 'create on use' features may lead to errors. Check it! @@ -55,7 +281,7 @@ X active semicolons may be a problem + handle 'nan' and +-inf in plots -- 'every axis plot post' is not reflected in legend (at least not properly) ++ 'every axis plot post' is not reflected in legend (at least not properly) + plot function: incompatibility with 'german' package and " catcodes @@ -84,7 +310,7 @@ X active semicolons may be a problem + specifying axis limits for X should also limit those for Y (some sort of clipping) -- the text height of every axis x tick should be adjusted to allow tick scale +X the text height of every axis x tick should be adjusted to allow tick scale labels on the same vertical alignment -> bug in pgf: text height does not properly respect to the current font!? @@ -172,7 +398,219 @@ X verschiebung des ylabels ist komisch, wegen der rotate option FEATURES ------------------------------------------------------------- -- it would be interesting to get an high-level coordinate mapping +- the FPU uninstall command can be assembled ONCE (globally). No need to do that + multiple times. + +- What about something like '/pgfplots/table/x expr={<math expression>}' ? + -> I could still use the lazy eval framework of pgfplotstable, i.e. + \thisrow{} commands, \pgfplotstablerow, \pgfplotstablecol etc. + The \prevrow and \nextrow features won't be possible (?) + +- improve support for multiple ordinates +- improve support for negative axes + ++ improve plot expression + + accuracy + + UI + +- it would be useful if the clipping could be disabled for certain parts of the + axis. Is that possible? + -> yes. + Idea: start clipping for every axis element separately! Shouldn't be + much more expensive than a single marker path. + - should work in the same way as before, there is no difference! + - scopes should introduce no further problems + - I could eliminate the nasty marker list + ++ what about an optimized version of plot expression which does not need the + brace hack (\x,{sin(\x r)}) ? + +- allow math expressions for axis limits etc. Idea: try float parsing routine; + if it fails: use math parser first. + ++ plot expression for log plots would be more valueable, if it could sample + points exponentially, i.e. linear between log(xmin) ... log(xmax): + x_i = exp( log(xmin) + i * ( log(xmax)-log(xmin) )/(N-1) ) + +- 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 + predefined style (thus, markers are fixed, colors vary). One could also think + about a complementary style. + -> even better: I could prodive 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. + + ++ create public key alias for '/pgfplots/domain' -> '/tikz/domain' + +X the coordinate preparation routines should assign global registers. This would + deal properly with grouped '\addplot' commands and it allows several + optimizations in the coordinate processing (elimination of list allocations). + +- document 'bar interval shift' and 'bar interval width' + ++ document line styles with arrows + +- think about quiver plots + +- interpolate missing coordinates for stacked plots. + +- think about a low-level contour plot interface in which PREPARED contours are + provided as input. The contours as such could be computed with an external + program (so far). + +- the error bar implementation is relatively inefficient. Think about something like + '/pgfplots/error bars/prepare drawing' + which sets common style keys for every error bar + +- think about using a combination of the visualization engine of pgf CVS and my + prepared-list-structure. Maybe I can adjust the list format for the current + plot type? I need + - scatter/line plots 2D + - meta coords + - quiver may need extra vectors + - matrix plots may need twodimensional structure + - error bars could be handled more consistently + - ... + -> implement a visualization class which provides methods + - prepare() + - visualize() + - serialize() + - visualizestream() + and provide protected pgfplots methods + - axis->preprocesscoordinate (filters, logs) + - visualizer->prepare() + - axis->processcoordinate() + - visualizer->serialize() + - axis->postprocesscoordinate() + The markers as they are implememted now don't really fit into this framework. + The clipping region is not really what I want here... + 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 + ++ implement simply style 'scatter classes'. + + sanity checking feature: try if 'pgfmathfloattofixed' results in a known + class! -> but catch exceptions if the value is no number! + ++ allow symbolic meta data + ++ provide input options for 'meta' data + + plot file + + plot table + + plot coordinates + - document that stuff + +- I could extend the clickable library such that a click into a TABLE + opens a marker into one (or more) designated plots. + ++ Optimization: normalize *internal* preprocessed stored point coordinate lists, + for example as 'x1,y1,z1,x2,y2,z2,x3,y2,z3,' -> I have 100% control! + 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 + +- Store the axis limits into the axis' node as saved macros. This would allow + - 'use [xy] limits of=<axis name>' + - access to axis limits from other macros. + -> provide a command + \pgfplotslimits{current axis}{x}{min} + which expands to the 'xmin' limit. + PROBLEM: to WHICH limit: the untransformed one? The transformed one? The + logarithmized one? + -> I can't compute exp(xmin) in log plots! + - Ideas: + - provide both, if possible. It is NOT possible for log axes. + - use log-limits ( possibly combined with 'logxmin=' option ?) + - The operation requires several operations because floats need to + be converted. Idea: do that only for NAMED AXES. + -> all user-interface macros must be expandable! + - I don't want to spent time for number format conversions + unnecessarily here! + - provide \pgfplotslimits and \pgfplotstransformedlimits + combined with simpler key-value interfaces + - I could also provide access to the unit lengths (they are + available as macro anyway) + - ALTERNATIVE: implement access to axis limits as a math function + which simply defines \pgfmathresult. + -> that is probably the most efficient way to do it. I only need to + register the new function(s) to PGF MATH. + -> PGF 2.00: use \csname pgfmath@parsefunction@\pgfmath@parsedfunctionname\endcsname + -> PGF > 2.00: use \pgfmathdeclarefunction + Is it possible to provide 'string' arguments which are not + parsed? No. +- I could provide public macros for the data transformations (and inverse + transformations). This would also allow relatively simple access to axis + limits. + + + ++ I could optimize the number parser with '\csname ...#1\endcsname' + constructions where '#1' is the currently identified character. + If #1 in {0-9,e,E,+-} etc., I could save a lot of macro assignments and + \ifx character comparisons. + ++ Speaking about optimiziation: I always wanted to test \pgfmathln inside of the + log code (combined with float support). + ++ 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. + + false: as it is now. + + 10^k : accept an integer shift base 10. Should pose no impl. problem + + <real>: use float math and quotients + ++ it would be interesting to get an high-level coordinate mapping X : K -> \R X(k) \in \R is the x-coordinate. Idea: K can be any type of input, for example @@ -184,6 +622,42 @@ FEATURES all output (tick labels) are given in K as well (requires X^{-1}). -> that's not difficult. ++ a scatter plot feature in which each mark gets its own set of options would be nice. + More precisely, a general feature which sets keys according to the current value should be + added -> this would also allow a (very early) visualisation of twodimensional functions. + Ideas: + + linearly map data range to colormap as in matlab. Could use the result of + the scaling trafo; no need to work with float here (?) + + scope around each marker + + The colormap thing is generally useful and may be used in other contexts + as well. Ideas: + + specification of colormap. An array of colors of size K? A color expression? + + providing color coordinates. Use the y coord? Or the z coord? Or + an expression of one of them? Maybe I still need high-level math + here? + + I guess the best is to use the same syntax as for pgfshadings. + Then, I will need to map linearly into a shading specification. + Technically, it is nothing but piecewise linear interpolation on + a non-equidistant grid. To improve lookup speed, I could + normalize the input to an equidistant grid. The interpolation + procedure involves one lookup operation and one interpolation step + between two adjacent color specs (given as RGB). + -> FIRST STEP: + + define normalized format (RGB, equidistant etc.). + + provide lookup + interpolation routine. + + force normalized input. Auto-normalizations (conversions) are + a second step. + + Implement scatter plots based on this spec. + + provide a 'color data source' key which is one of + 1. 'xyz' (copy coordinate) + 2. f(T(x),T(y),T(z)) as expression in transformed range + 3. f(x,y,z) as expression in untransformed range (float + required) + 4. explicit color spec 'c' + the cases 3. and 4. need changes in the coordinate preparation + routines. + + + styles are named very unintuitively. I should add something more convenient (for example like the 'legend style={}' command). Idea: use the *same* name @@ -199,7 +673,7 @@ FEATURES - It would be useful to get access to axis coordinates, for example in 'circle (XXX)' -- axis equal option ++ axis equal option - consider 'plot image[xmin=,xmax=,ymin=,ymax=] {<graphics>}; -> load external plot image!? Only useful for matlab, if matlab would allow 100% @@ -234,7 +708,7 @@ X re-implement 'dec sep align' of table package natively, not as high-level Technical thing: map the CLIPPED data range or the TOTAL data range? What advantages/disadvantes appear? -- [Tikz] document how to use internal registers can be used in libraries. ++ [Tikz] document how to use internal registers can be used in libraries. + [Tikz] add an 'every plot mark' option and adjust 'mark options' accordingly @@ -281,7 +755,7 @@ X re-implement 'dec sep align' of table package natively, not as high-level + copy my personal' homepages short images to pgfplots website -- interrupt single plots at discontinuities (for example tan(x)) ++ interrupt single plots at discontinuities (for example tan(x)) -> don't draw from +infty to -infty - optimize plot expression @@ -295,7 +769,7 @@ X re-implement 'dec sep align' of table package natively, not as high-level + the non-boxed axis lines are placed at 'ZERO'. Maybe this zero level should get an anchor!? -> allows to place axis labels above it -- default style for axis lines to: {thin, black!25} ? ++ default style for grid lines to: {thin, black!25} ? X implement an axis as path-command @@ -401,10 +875,10 @@ X implement an axis as path-command + read just strings, no parsing - optimal: '\t' as separator. How can I teach TeX to use '\t' as separator!? - - would allow + + would allow + \addplot plot table[x=X,y=Z] {\table} and - - \typesettable[columns=...,format=sci,...,formatting options=...] {\table} + + \typesettable[columns=...,format=sci,...,formatting options=...] {\table} + implementation: simple run through column lists -> CONSISTENT data representation, powerful display options diff --git a/Master/texmf-dist/doc/plain/pgfplots/pgfplotsexample.pdf b/Master/texmf-dist/doc/plain/pgfplots/pgfplotsexample.pdf Binary files differindex bce1e290e9b..b7ba113133c 100644 --- a/Master/texmf-dist/doc/plain/pgfplots/pgfplotsexample.pdf +++ b/Master/texmf-dist/doc/plain/pgfplots/pgfplotsexample.pdf diff --git a/Master/texmf-dist/scripts/pgfplots/matlab2pgfplots.m b/Master/texmf-dist/scripts/pgfplots/matlab2pgfplots.m index 8d4ce820083..d8922238e18 100644 --- a/Master/texmf-dist/scripts/pgfplots/matlab2pgfplots.m +++ b/Master/texmf-dist/scripts/pgfplots/matlab2pgfplots.m @@ -28,7 +28,7 @@ function matlab2pgfplots(varargin ) % a boolean indicating whether line styles, markers and colors shall be exported (default 1). % - 'axes',0|1 % a boolean indicating whether axis ticks, tick labels and limits shall be exported (default 0). -% - 'maxpoints',100 +% - 'maxpoints',100000 % an integer denoting the maximum number of points exported to tex. If the actual number is larger, % the data will be interpolated to 'maxpoints'. The interpolation assumes % parametric plots if x and y are not monotonically increasing. @@ -41,6 +41,7 @@ function matlab2pgfplots(varargin ) % % Copyright Christian Feuersaenger 2008 % +% This script requires Matlab version 7.4 (or above). parser = inputParser; parser.addRequired( 'outfile', @(x) ischar(x) ); @@ -57,6 +58,10 @@ fighandle = parser.Results.fig; lineobjs = findobj(fighandle, 'Type', 'line' ); axesobj = findobj( fighandle, 'Type', 'axes' ); +% As far as I know, 'scatter' and 'scatter3' produce groups of this class: +scatterobjs = findobj(fighandle, 'Type', 'hggroup' ); +lineobjs = [ lineobjs scatterobjs ]; + legendobj = findobj( fighandle, 'tag', 'legend' ); if length(legendobj) > 0 allchildsoflegend = [ findobj( legendobj ) ]; @@ -217,7 +222,7 @@ for i = 1:length(lineobjs) case ':' linestyle = 'densely dotted'; case '-:' - linestyle = 'dash pattern=on 2pt off 3pt on 1pt off 3pt]'; + linestyle = 'dash pattern={on 2pt off 3pt on 1pt off 3pt}'; case '--' linestyle = 'densely dashed'; end 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 0c3dfd3e97a..87dff9fa732 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 ec540cb2bfa..862f68faa6c 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/liststructure/pgfplotsarray.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex index 77fc52b1115..6f0d12ee115 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsarray.code.tex @@ -125,6 +125,10 @@ \long\def\pgfplotsarraysize#1\to#2{% #2=\csname\string#1@size\endcsname\relax } +\long\def\pgfplotsarraysizetomacro#1\to#2{% + \expandafter\let\expandafter#2\csname\string#1@size\endcsname +} + % Returns the #1th element of array #2 into macro #3 % Arguments: @@ -158,8 +162,7 @@ % List is not empty. % \fi \def\pgfplotsarraycheckempty#1{% - \pgfplotsarraysize{#1}\to\c@pgfplotsarray@tmp - \ifnum\c@pgfplotsarray@tmp=0\relax + \ifnum\csname\string#1@size\endcsname=0 \pgfplotsarrayemptytrue \else \pgfplotsarrayemptyfalse diff --git a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex index d7bd7dc73ed..91caf2a033f 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/liststructure/pgfplotsliststructure.code.tex @@ -282,9 +282,7 @@ \long\def\pgfplotslistforeach#1\as#2#3{% \begingroup \long\def\pgfpl@@##1{\def#2{##1}% - \begingroup - #3 - \endgroup}% + \begingroup #3\endgroup}% #1\relax \endgroup } diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex index 77a40d51ed5..2d0ec9c1911 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstable.code.tex @@ -28,11 +28,39 @@ % %-------------------------------------------- + +% This file provides a high-level table manipulation and typesetting +% package. +% +% +% --------------------------------------------- +% Implementation notes for programmers: +% --------------------------------------------- +% +% The table data structure consists of +% 1. A name which must be a valid TeX macro like '\table' +% 2. A column list in the \pgfplotslist format. +% In fact, the column list is stored in the table's name: +% \pgfplotslistnewempty\table +% 3. A "file name" stored in +% \csname\string<\namemacro>@@table@name\endcsname +% 4. foreach column, there is a list of row-values (a row-vector) in +% the \pgfplotslist format named +% \csname\string<\namemacro>@<column name>\endcsname +% + + \newif\ifpgfplotstable@search@header \newcount\c@pgfplotstable@counta \newwrite\pgfplotstable@outfile \newif\ifpgfplotstabletypesetdebug +\newif\ifpgfplotstabletypesetskipcoltypes +\newif\ifpgfplotstabletypesetresult \newif\ifpgfplotstableuserow +\newif\ifpgfplotstabletypeset@includeoutfiles +\newif\ifpgfplotstabletypeset@force@remake +\newif\ifpgfplots@addplotimpl@readcompletely +\newif\ifpgfplotstable@disable@rowcolstyles % should always be false; use only in grouped internal macros \newif\ifpgfplots@table@options@areset @@ -40,6 +68,22 @@ \input pgfplotstable.coltype.code.tex +% #1= floating point number +% #2= TeX code to execute if #1 == 0 +% #3= TeX code to execute if #1 != 0 +\def\pgfplots@ifzero#1#2#3{% + \expandafter\pgfmathfloat@decompose@F#1\relax\pgfmathfloat@a@S + \ifnum\pgfmathfloat@a@S=0 #2\else#3\fi +}% + +% just make sure no-one complaints if manual example are used without +% booktabs loaded: +\pgfutil@ifundefined{toprule}{% + \def\toprule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\toprule}}% + \def\midrule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\midrule}}% + \def\bottomrule{\pgfplots@assert@LaTeX@package@loaded{booktabs}{\string\bottomrule}}% +}{\relax}% + % keys which are NOT predefined: % /pgfplots/table/alias/<col alias>/.initial={<real col>} % /pgfplots/table/columns/<col name>/.style={} @@ -48,18 +92,24 @@ \pgfkeys{% /pgfplots/table/header/.is if=pgfplotstable@search@header, /pgfplots/table/header=true, - /pgfplots/table/x index/.store in=\pgfplots@plot@tbl@xindex, - /pgfplots/table/x index=0, - /pgfplots/table/x/.store in=\pgfplots@plot@tbl@x, - /pgfplots/table/x=, - /pgfplots/table/y index/.store in=\pgfplots@plot@tbl@yindex, - /pgfplots/table/y index=1, - /pgfplots/table/y/.store in=\pgfplots@plot@tbl@y, - /pgfplots/table/y=, + /pgfplots/table/x index/.initial=0, + /pgfplots/table/x/.initial=, + /pgfplots/table/y index/.initial=1, + /pgfplots/table/y/.initial=, + /pgfplots/table/z index/.initial=2, + /pgfplots/table/z/.initial=, + /pgfplots/table/meta index/.initial=, + /pgfplots/table/meta/.initial=, /pgfplots/table/x error index/.initial=, /pgfplots/table/y error index/.initial=, + /pgfplots/table/z error index/.initial=, /pgfplots/table/x error/.initial=, /pgfplots/table/y error/.initial=, + /pgfplots/table/z error/.initial=, + /pgfplots/table/read completely/.is if=pgfplots@addplotimpl@readcompletely, + /pgfplots/table/read completely/.default=true, + /pgfplots/table/disable rowcol styles/.is if=pgfplotstable@disable@rowcolstyles, + /pgfplots/table/disable rowcol styles/.default=true, /pgfplots/table/row predicate/.code={}, /pgfplots/table/skip rows between index/.style 2 args={% /pgfplots/table/row predicate/.append code={% @@ -140,52 +190,65 @@ }% }, /pgfplots/table/multicolumn names/.default=c, - /pgfplots/table/dec sep align/.style={% + /pgfplots/table/dec sep align/.code={% + \pgfplots@assert@LaTeX@package@loaded{array}{dec sep align}% + \pgfkeysalso{% /pgf/number format/assume math mode, - /pgf/number format/@dec sep mark={&}, + /pgf/number format/@dec sep mark={$&$}, /pgfplots/table/assign column name/.code={% \pgfkeyssetvalue{/pgfplots/table/column name}{\multicolumn{2}{#1}{##1}}% },% - /pgfplots/table/column type={>{$}r<{$}@{}>{$}l<{$}}, + /pgfplots/table/column type={% + r<{\pgfplotstableresetcolortbloverhangright}% + @{}% + l<{\pgfplotstableresetcolortbloverhangleft}% + }, /pgfplots/table/assign cell content/.code={% \def\pgfmathresult{##1}% \ifx\pgfmathresult\pgfutil@empty \def\pgfmathresult{&}% - % \pgfutil@in@false \else \pgfmathprintnumberto{##1}\pgfmathresult% - % \expandafter\pgfutil@in@\expandafter&\expandafter{\pgfmathresult}% + % now make sure we have math mode for the single + % columns: + \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter$\pgfmathresult$}% \fi - %\ifpgfutil@in@ - %\else - % \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult&}% - %\fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, + }% }, /pgfplots/table/dec sep align/.default=c, - /pgfplots/table/sci sep align/.style={% + /pgfplots/table/sci sep align/.code={% + \pgfplots@assert@LaTeX@package@loaded{array}{sci sep align}% + \pgfkeysalso{% /pgf/number format/assume math mode, - /pgf/number format/@sci exponent mark={&}, + /pgf/number format/@sci exponent mark={$&$}, /pgfplots/table/assign column name/.code={% \pgfkeyssetvalue{/pgfplots/table/column name}{\multicolumn{2}{#1}{##1}}% },% - /pgfplots/table/column type={>{$}r<{$}@{}>{$}l<{$}}, + /pgfplots/table/column type={% + r<{\pgfplotstableresetcolortbloverhangright}% + @{}% + l<{\pgfplotstableresetcolortbloverhangleft}% + }, /pgfplots/table/assign cell content/.code={% \def\pgfmathresult{##1}% \ifx\pgfmathresult\pgfutil@empty \def\pgfmathresult{&}% - \pgfutil@in@true \else \pgfmathprintnumberto{##1}\pgfmathresult% \expandafter\pgfutil@in@\expandafter&\expandafter{\pgfmathresult}% - \fi - \ifpgfutil@in@ - \else - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult&}% + % now make sure we have math mode for the single + % columns: + \ifpgfutil@in@ + \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter$\pgfmathresult$}% + \else + \expandafter\def\expandafter\pgfmathresult\expandafter{\expandafter\pgfutilensuremath\expandafter{\pgfmathresult}&}% + \fi \fi \pgfkeyslet{/pgfplots/table/@cell content}\pgfmathresult }, + }% }, /pgfplots/table/sci sep align/.default=c, % @@ -215,6 +278,15 @@ /pgfplots/table/begin table/.initial={\begin{tabular}}, /pgfplots/table/end table/.initial={\end{tabular}}, /pgfplots/table/outfile/.initial=, + /pgfplots/table/include outfiles/.is if=pgfplotstabletypeset@includeoutfiles, + /pgfplots/table/include outfiles/.default=true, + /pgfplots/table/force remake/.is if=pgfplotstabletypeset@force@remake, + /pgfplots/table/force remake/.default=true, + /pgfplots/table/write to macro/.initial=, + /pgfplots/table/typeset/.is if=pgfplotstabletypesetresult, + /pgfplots/table/typeset=true, + /pgfplots/table/skip coltypes/.is if=pgfplotstabletypesetskipcoltypes, + /pgfplots/table/skip coltypes/.default=true, /pgfplots/table/debug/.is if=pgfplotstabletypesetdebug, % % will be redefined by |assign cell content| for every cell: @@ -246,6 +318,23 @@ /pgfplots/table/@cell content={##1}% }% },% + /pgfplots/table/date type/.style={% + /pgfplots/table/assign cell content/.code={% + \begingroup + \pgfcalendardatetojulian{##1}\c@pgfplotstable@counta + \pgfcalendarjuliantodate{\c@pgfplotstable@counta}\year\month\day + \pgfcalendarjuliantoweekday\c@pgfplotstable@counta\c@pgf@countc + \edef\weekday{\the\c@pgf@countc }% + \edef\weekdayname{\pgfcalendarweekdayname\c@pgf@countc}% + \edef\weekdayshortname{\pgfcalendarweekdayshortname\c@pgf@countc}% + \edef\monthname{\pgfcalendarmonthname\month}% + \edef\monthshortname{\pgfcalendarmonthshortname\month}% + \xdef\pgfplots@glob@TMPa{#1}% + \endgroup + \pgfkeyslet{/pgfplots/table/@cell content}\pgfplots@glob@TMPa% + }% + },% + /pgfplots/table/date type/.default={\year/\month/\day}% /pgfplots/table/set content/.style={% /pgfplots/table/postproc cell content/.style={% /pgfplots/table/@cell content={#1}% @@ -255,10 +344,40 @@ /pgfplots/table/postproc cell content/.code={}, /pgfplots/table/preproc cell content/.code={}, % + /pgfplots/table/clear infinite/.style={% + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\pgfmatharga=\pgfmathresult + {% + \pgfmathfloatgetflags\pgfmatharga\c@pgfplotstable@counta + \xdef\pgfplots@glob@TMPc{\the\c@pgfplotstable@counta}% + }% + \ifnum\pgfplots@glob@TMPc<3 + \pgfmathfloattosci@\pgfmathresult + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfmathresult}% + \else + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfutil@empty}% + \fi + \fi + } + }, + /pgfplots/table/string replace/.style 2 args={% + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfmathresult\pgfplots@loc@TMPa + \def\pgfplots@loc@TMPb{#2}% + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfplots@loc@TMPb}% + \fi + } + }, /pgfplots/table/multiply -1/.style={% /pgfplots/table/preproc cell content/.append code={% \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult - \ifx\pgfmathresult\empty + \ifx\pgfmathresult\pgfutil@empty \else \pgfmathfloatparsenumber{\pgfmathresult}% \let\pgfmatharga=\pgfmathresult @@ -270,6 +389,44 @@ \fi } }, + /pgfplots/table/multiply with/.code={% + \pgfmathfloatparsenumber{#1}% + \let\pgfplotstable@scale=\pgfmathresult + \pgfkeysalso{ + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\pgfmatharga=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmatharga}{\pgfplotstable@scale}% + \pgfmathfloattosci@\pgfmathresult + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfmathresult}% + \fi + }% + }% + }, + /pgfplots/table/divide by/.code={% + \pgfkeysalso{/pgfplots/table/multiply with=#1}% + \let\pgfplotstable@divisor=\pgfplotstable@scale + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfplotstable@ONE=\pgfmathresult + \pgfmathfloatdivide@{\pgfplotstable@ONE}{\pgfplotstable@divisor}% + \let\pgfplotstable@scale=\pgfmathresult + }, + /pgfplots/table/sqrt/.style={% + /pgfplots/table/preproc cell content/.append code={% + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\pgfmatharga=\pgfmathresult + \pgfmathfloatsqrt@{\pgfmatharga}% + \pgfmathfloattosci@\pgfmathresult + \pgfkeyslet{/pgfplots/table/@cell content}{\pgfmathresult}% + \fi + }% + }, /pgfplots/table/empty cells with/.style={% /pgfplots/table/postproc cell content/.append code={% \ifnum\pgfplotstablepartno=0 @@ -283,7 +440,8 @@ % /pgfplots/table/font/.initial=, /pgfplots/table/.unknown/.code={% - \pgfqkeys{/pgf/number format}{\pgfkeyscurrentname=#1}% + \let\pgfplots@table@curkeyname=\pgfkeyscurrentname + \pgfqkeys{/pgf/number format}{\pgfplots@table@curkeyname=#1}% },% /pgfplots/table/create col/assign first/.style={ /pgfplots/table/create col/assign% @@ -295,12 +453,63 @@ /pgfplots/table/create col/next content={}% }, /pgfplots/table/create col/next content/.initial={}, - /pgfplots/table/create col/expr/.style={% + /pgfplots/table/create col/copy/.style={% /pgfplots/table/create col/assign/.code={% + \getthisrow{#1}\pgfmathresult + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% + }, + /pgfplots/table/create col/set/.style={% + /pgfplots/table/create col/assign/.code={% + \def\pgfmathresult{#1}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% + },% + /pgfplots/table/create col/set list/.code={% + \pgfplots@assign@list\pgfmathaccumb{#1}% + \pgfkeysalso{/pgfplots/table/create col/@from list struct=\pgfmathaccumb}% + },% + /pgfplots/table/create col/expr accum/.code 2 args={% + \ifpgfplots@usefpu + \pgfkeysalso{/pgf/fpu=true,/pgf/fpu/output format=sci}% + \fi + \pgfkeysdef{/pgfplots/table/create col/assign}{% + \ifx\pgfmathaccuma\pgfutil@empty + \pgfmathparse{#2}% + \let\pgfmathaccuma=\pgfmathresult + \fi \pgfmathparse{#1}% \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \let\pgfmathaccuma=\pgfmathresult }% + }, + /pgfplots/table/create col/expr/.style={% + /pgfplots/table/create col/expr accum={#1}{0}% },% + /pgfplots/table/create col/copy column from table/.code 2 args={% + \pgfplotstable@isloadedtable{#1}{% + \pgfplotstablegetcolumnbyname{#2}\of#1\to\pgfmathaccumb + }{% + \begingroup + \pgfplotstableread{#1}\pgfplotstable@tmptbl + \pgfplotstablegetcolumnbyname{#2}\of\pgfplotstable@tmptbl\to\pgfmathaccumb + \pgfmath@smuggleone\pgfmathaccumb + \endgroup + }% + \pgfkeysalso{/pgfplots/table/create col/@from list struct=\pgfmathaccumb}% + }, + /pgfplots/table/create col/@from list struct/.code={% + \pgfplotslistcopy#1\to\pgfmathaccumb + \pgfkeysdef{/pgfplots/table/create col/assign}{% + \pgfplotslistcheckempty\pgfmathaccumb + \ifpgfplotslistempty + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + \else + \pgfplotslistpopfront\pgfmathaccumb\to\pgfmathresult + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \fi + }% + }, /pgfplots/table/create col/quotient/.style={% /pgfplots/table/columns={#1}, /pgfplots/table/create col/assign first/.style={% @@ -312,9 +521,13 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmathargb=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% /pgfplots/table/create col/iquotient/.style={% @@ -328,9 +541,13 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmatharga=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% % @@ -350,13 +567,17 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmathargb=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \pgfmathlog@float{\pgfmathresult}% - \ifx\pgfmathresult\pgfutil@empty - \else - \pgfmathmultiply@{1.442695}{\pgfmathresult}% - \fi - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \pgfmathlog@float{\pgfmathresult}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathmultiply@{1.442695}{\pgfmathresult}% + \fi + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% /pgfplots/table/create col/idyadic refinement rate/.style={% @@ -370,13 +591,17 @@ \pgfmathfloatparsenumber{\thisrow{#1}}% \let\pgfmatharga=\pgfmathresult \let\pgfmathaccuma=\pgfmathargb - \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% - \pgfmathlog@float{\pgfmathresult}% - \ifx\pgfmathresult\pgfutil@empty - \else - \pgfmathmultiply@{1.442695}{\pgfmathresult}% - \fi - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathargb{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmatharga}{\pgfmathargb}% + \pgfmathlog@float{\pgfmathresult}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfmathmultiply@{1.442695}{\pgfmathresult}% + \fi + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% }% },% /pgfplots/table/create col/gradient/.style 2 args={% @@ -402,9 +627,13 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathfloatsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathdiff@x{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% },% },% /pgfplots/table/create col/gradient loglog/.style 2 args={% @@ -436,12 +665,18 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \ifdim\pgfmathdiff@x pt=0.0pt + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + \else + \pgfmathdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \fi \else - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloattosci@\pgfmathresult + % \pgfmathfloatcreate{3}{0.0}{0}% + % \pgfmathfloattosci@\pgfmathresult + % \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% \fi - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% },% },% /pgfplots/table/create col/gradient semilogx/.style 2 args={% @@ -478,9 +713,13 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathfloatsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathdiff@x{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% },% },% /pgfplots/table/create col/gradient semilogy/.style 2 args={% @@ -517,14 +756,95 @@ \let\pgfmathdiff@x=\pgfmathresult \pgfmathfloatsubtract@{\pgfmathnext@y}{\pgfmathcur@y}% \let\pgfmathdiff@y=\pgfmathresult - \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% - \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% - \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \pgfplots@ifzero\pgfmathdiff@x{% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + }{% + \pgfmathfloatdivide@{\pgfmathdiff@y}{\pgfmathdiff@x}% + \expandafter\pgfmathfloattosci@\expandafter{\pgfmathresult}% + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + }% },% },% + /pgfplots/table/typeset cell/.code={% + \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax + \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\\}% + \else + \pgfkeyssetvalue{/pgfplots/table/@cell content}{#1&}% + \fi + }, + /pgfplots/table/reset styles/.style={ + /pgfplots/table/every table/.code=, + /pgfplots/table/every odd column/.code=, + /pgfplots/table/every even column/.code=, + /pgfplots/table/every first column/.code=, + /pgfplots/table/every last column/.code=, + /pgfplots/table/every head row/.code=, + /pgfplots/table/every odd row/.code=, + /pgfplots/table/every even row/.code=, + /pgfplots/table/every first row/.code=, + /pgfplots/table/every last row/.code=, + }, } + +% 'function graph cut y'={<epsilon>}{<options>}{comma-separated-list of specs where to get yi} +% +% fills the column with x1,...,xN such that yi(xi) == epsilon where +% +% In other words, it computes cuts points between the line +% y == epsilon and one or more other plots yi(x) and returns the 'x' +% values of the cuts. +% +% Example: +% \pgfplotstableset{ +% create on use/cut/.style={create col/function graph cut y={7e-4}{x=Basis,ymode=log,xmode=log}{{table=regtable,y=special-L2}}}, +%} +\pgfkeysdefargs{/pgfplots/table/create col/function graph cut y}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{y}{x}} +\pgfkeysdefargs{/pgfplots/table/create col/function graph cut x}{#1#2#3}{\pgfplotstable@fgc@init{#1}{#2}{#3}{x}{y}} +\pgfkeys{% + /pgfplots/table/create col/function graph cut/xmode/.is choice, + /pgfplots/table/create col/function graph cut/xmode/linear/.code={\def\pgfplotstable@fgc@xmode{0}},% + /pgfplots/table/create col/function graph cut/xmode/log/.code={\def\pgfplotstable@fgc@xmode{1}},% + /pgfplots/table/create col/function graph cut/ymode/.is choice, + /pgfplots/table/create col/function graph cut/ymode/linear/.code={\def\pgfplotstable@fgc@ymode{0}},% + /pgfplots/table/create col/function graph cut/ymode/log/.code={\def\pgfplotstable@fgc@ymode{1}},% + /pgfplots/table/create col/function graph cut/x/.initial=, + /pgfplots/table/create col/function graph cut/y/.initial=, + /pgfplots/table/create col/function graph cut/table/.initial=, +} + + +\pgfkeyslet{/pgfplots/table/TeX comment}\pgfplots@PERCENT@TEXT \pgfkeysgetvalue{/pgfplots/table/postproc cell content/.@cmd}\pgfplotstable@postproccellcontent@EMPTY + +% A helper macro to automatically remove the "hangover" created by +% 'colortbl'. +% This allows compatibility between my 'sci sep align' and 'dec sep align' +% implementations and \rowcolor. Otherwise, the hangover +% would overwrite digits near the separator. +% +% @remark This does also work if colortbl is not loaded. +\def\pgfplotstableresetcolortbloverhangright{% + \pgfutil@ifundefined{CT@row@color}{\relax}{% + \global\let\pgfplots@origrowcolorcmd=\CT@row@color + \gdef\CT@row@color{% + \pgfplots@origrowcolorcmd + \@tempdimc=0pt + \global\let\CT@row@color=\pgfplots@origrowcolorcmd + }% + }% +}% +\def\pgfplotstableresetcolortbloverhangleft{% + \pgfutil@ifundefined{CT@row@color}{\relax}{% + \global\let\pgfplots@origrowcolorcmd=\CT@row@color + \gdef\CT@row@color{% + \pgfplots@origrowcolorcmd + \@tempdimb=0pt + \global\let\CT@row@color=\pgfplots@origrowcolorcmd + }% + }% +}% + % \pgfplotstableread[OPTIONS] {FILE} to \name % % This method reads a table from FILE to macro \name. @@ -571,10 +891,172 @@ % BACKWARDS COMPATIBILITY \let\pgfnumtableread=\pgfplotstableread -\def\pgfplotstablegetcolumnlist#1\to#2{% - \let#2=#1 +% Invokes #2 if '#1' is an already loaded table and #3 if not. +\long\def\pgfplotstable@isloadedtable#1#2#3{% + \pgfutil@ifundefined{\string#1@@table@name}{#3}{#2}% +}% + +% Defines \pgfmathresult to be the number of rows in table #1. +% +% #1 may be either a loaded table structure (a macro name) or a table +% file name. In the latter case, the file will be loaded temporarily. +\def\pgfplotstablegetrowsof#1{% + \pgfplotstable@isloadedtable{#1}{% + % ah - it is an already loaded table! + \begingroup + \pgfplotslistfront#1\to\pgfplotstablegetrows@@ + \expandafter\pgfplotslistsize\csname\string#1@\pgfplotstablegetrows@@\endcsname\to\c@pgfplotstable@counta + \edef\pgfmathresult{\the\c@pgfplotstable@counta}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }{% + % ah - it is a file name. + \begingroup + \pgfplotstableread{#1}\pgfplotstablegetrows@ + \pgfplotstablegetrowsof{\pgfplotstablegetrows@}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + }% +}% + +% \pgfplotstablesave[<options>]{<\tablename>}{file name} +\def\pgfplotstablesave{% + \pgfutil@ifnextchar[{% + \pgfplotstablesave@impl + }{% + \pgfplotstablesave@impl[]% + }% +} + +{ +\catcode`\^^I=12 +\gdef\pgfplotstablesave@impl@TAB{^^I} } +\def\pgfplotstablesave@impl[#1]#2#3{% + \pgfplotstabletypeset[% + reset styles,% + disable rowcol styles,% + begin table={}, end table={},% + typeset cell/.code={% + \begingroup + \t@pgfplots@toka={##1}% + \ifcase\pgfplotstableread@OUTCOLSEP@CASE\relax + % SPACE: + \t@pgfplots@tokb=\expandafter{\pgfplotstablesave@impl@TAB}% + \pgfplots@ifempty{##1}{% + \t@pgfplots@toka={{}}% + }{}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % comma: + \t@pgfplots@tokb={,}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % semicolon: + \t@pgfplots@tokb={;}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % colon: + \t@pgfplots@tokb={:}% + \xdef\pgfplots@glob@TMPc{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \or + % braces: + \xdef\pgfplots@glob@TMPc{{\the\t@pgfplots@toka}}% + \fi + \endgroup + \pgfkeyslet{/pgfplots/table/@cell content}\pgfplots@glob@TMPc% + },% + before row=,after row=,% + skip coltypes, typeset=false, string type,% + TeX comment=,% + columns=,% + font=,% + /pgfplots/table/col sep/.is choice,% + /pgfplots/table/col sep/space/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{0}},% + /pgfplots/table/col sep/comma/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{1}},% + /pgfplots/table/col sep/semicolon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{2}},% + /pgfplots/table/col sep/colon/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{3}},% + /pgfplots/table/col sep/braces/.code = {\def\pgfplotstableread@OUTCOLSEP@CASE{4}},% + /pgfplots/table/col sep=space,% + /pgfplots/table/in col sep/.is choice,% + /pgfplots/table/in col sep/space/.code = {\def\pgfplotstableread@COLSEP@CASE{0}},% + /pgfplots/table/in col sep/comma/.code = {\def\pgfplotstableread@COLSEP@CASE{1}},% + /pgfplots/table/in col sep/semicolon/.code = {\def\pgfplotstableread@COLSEP@CASE{2}},% + /pgfplots/table/in col sep/colon/.code = {\def\pgfplotstableread@COLSEP@CASE{3}},% + /pgfplots/table/in col sep/braces/.code = {\def\pgfplotstableread@COLSEP@CASE{4}},% + /pgfplots/table/in col sep=space,% + % WARNING: you NEED a '%' before '#1': + #1,% + outfile={#3}% + ]{#2}% +}% + +% \pgfplotstablenew[<options>]{<numrows>}{<\name>} +% +% Creates a new table from scratch. +% +% The new table will contain all columns listed in the 'columns' key +% which must be present in <options>. +% +% Furthermore, there must be 'create on use' statements for every +% column which shall be generated. Columns are generated +% independently, in the order of appearance in 'columns'. +% The table will contain exactly <numrows> rows. +\def\pgfplotstablenew{% + \pgfutil@ifnextchar[{% + \pgfplotstablenew@impl + }{% + \pgfplotstablenew@impl[]% + }% +}% +\def\pgfplotstablenew@impl[#1]#2#3{% + \pgfutil@namedef{\string#3@@table@name}{newlycreatedtable}% + \begingroup + % create a temporary column with the desired number of rows: + \pgfutil@in@\pgfplotstablegetrowsof{#2}% + \ifpgfutil@in@ + #2% + \let\pgfplotstable@loc@TMPa=\pgfmathresult + \else + \def\pgfplotstable@loc@TMPa{#2}% + \fi + \pgfplotslistnew#3{@@@@@temporary@column@\\}% + \expandafter\pgfplots@assign@list\csname\string#3@@@@@@temporary@column@\endcsname{1,2,...,\pgfplotstable@loc@TMPa}% + % + % now, create all real columns: + \pgfkeyslet{/pgfplots/table/columns}{\pgfutil@empty}% + \pgfplotstableset{#1}% + \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% + \ifx\pgfplotstable@colnames\pgfutil@empty + \pgfplots@warning{\string\pgfplotstablenew[columns={},...]{#2}{\string#3} has been invoked - but empty tables are currently not really supported, sorry. You will have to live with an artifical column which contains temporary values.}% + \else + \expandafter\pgfplots@assign@list\expandafter\pgfplotstablenew@cols\expandafter{\pgfplotstable@colnames}% + % make sure every requested column exists: + \pgfutil@loop + \pgfplotslistcheckempty\pgfplotstablenew@cols + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \pgfplotslistpopfront\pgfplotstablenew@cols\to\pgfplotstablenew@col + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstablenew@col}\of#3\to\pgfplotstable@loc@TMPa + \pgfutil@repeat + % remove the temporary column: + % FIXME this should be done after the '\fi'. But that will + % lead to an error because empty tables are currently + % unsupported! + \pgfplotslistpopfront#3\to\pgfplotstable@loc@TMPa + \fi + \pgfplotstable@copy@to@globalbuffers#3 + \endgroup + \pgfplotstable@copy@globalbuffers@to#3 +}% + +\def\pgfplotstablegetcolumnlist#1\to#2{\let#2=#1} + % Returns a column vector in form of \pgfplotslist % into #3. % @@ -652,7 +1134,7 @@ \pgfutil@ifundefined{\string#2@\pgfplotstable@loc@TMPa}{% \def\pgfplotstable@loc@TMPb{/pgfplots/table/create on use/#1}% \pgfkeysifdefined{\pgfplotstable@loc@TMPb/.@cmd}{% - \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPb' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here.}% + \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPb' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% }{% \pgfplots@error{Sorry, could not retrieve aliased column '\pgfplotstable@loc@TMPa' from table '\pgfplotstablenameof{#2}'. The original request was for '#1', which does not exist either.}% }% @@ -731,6 +1213,8 @@ % - \getthisrow{<col name>}{\macro} % - \nextrow{<col name>}, % - \getnextrow{<col name>}{\macro} +% +% FIXME this documentation is incomplete. Please refer to pgfplotstable.pdf . \def\pgfplotstablecreatecol{% \pgfutil@ifnextchar[{% \pgfplotstablecreatecol@opt @@ -743,6 +1227,8 @@ % Typesets a table. % % \pgfplotstabletypeset[<options>]<\tablestructure> +% or +% \pgfplotstabletypeset[<options>]{<file name>} % % If you do not select any columns, the complete table is drawn. % @@ -765,24 +1251,55 @@ \pgfplotstabletypeset@opt[]% }% } +\def\pgfplotstabletypeset@opt[#1]#2{% + \pgfplotstable@isloadedtable{#2}% + {\pgfplotstabletypeset@opt@[#1]{#2}}% + {\pgfplotstabletypesetfile@opt@[#1]{#2}}% +} % Like \pgfplotstabletypeset, but the first argument is a file name. -\def\pgfplotstabletypesetfile{% - \pgfutil@ifnextchar[{% - \pgfplotstabletypesetfile@opt - }{% - \pgfplotstabletypesetfile@opt[]% - }% -} -\def\pgfplotstabletypesetfile@opt[#1]#2{% +% This is the same now; it will be recognised automatically. +\let\pgfplotstabletypesetfile=\pgfplotstabletypeset +\def\pgfplotstabletypesetfile@opt@[#1]#2{% \begingroup \ifpgfplots@table@options@areset \else \pgfplots@table@options@aresettrue \pgfplotstableset{/pgfplots/table/every table={#2},#1}% \fi - \pgfplotstableread{#2}\pgfplotstabletypesetfile@opt@@ - \pgfplotstabletypeset\pgfplotstabletypesetfile@opt@@ + \ifpgfplotstabletypeset@force@remake + \pgfplotstabletypeset@includeoutfilesfalse + \else + \ifpgfplotstabletypeset@includeoutfiles + \pgfplotstabletypeset@includeoutfilesfalse + \pgfkeysgetvalue{/pgfplots/table/outfile}\pgfplotstable@outfilename + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \openin1=\pgfplotstable@outfilename\relax + \ifeof1 + \else + \pgfplotstabletypeset@includeoutfilestrue + \fi + \closein1 + \fi + \fi + \fi + \ifpgfplotstabletypeset@includeoutfiles + \input \pgfplotstable@outfilename\relax + \else + \pgfplotstableread{#2}\pgfplotstabletypesetfile@opt@@ + \pgfplotstabletypeset\pgfplotstabletypesetfile@opt@@ + \fi + \pgfkeysgetvalue{/pgfplots/table/write to macro}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \def\pgfplots@loc@TMPa{\pgfutil@empty}% + \else + \expandafter\ifx\pgfplots@loc@TMPa\relax + % is it really defined? NO! Sanity checking here: + \def\pgfplots@loc@TMPa{\pgfutil@empty}% + \fi + \fi + \expandafter\pgfmath@smuggleone\pgfplots@loc@TMPa \endgroup }% @@ -843,6 +1360,7 @@ \closein1 \openin1=#2\relax \fi + \pgfplots@logfileopen{#2}% \def\pgfplotstableread@filename{#2}% \let\pgfplotstableread@lineno=\c@pgf@counta \let\pgfplotstableread@numcols=\c@pgf@countb @@ -851,10 +1369,10 @@ \pgfplotstableread@lineno=0 \pgfplotstableread@usablelineno=0 \pgfplotstableread@numcols=0 - \global\pgfplotslistnewempty\pgfplotstable@colnames + \global\pgfplotslistnewempty\pgfplotstable@colnames@glob \ifeof1 \pgfplotstable@error{Could not read table file '#2'.}% - \global\pgfplotslistnewempty\pgfplotstable@colnames + \global\pgfplotslistnewempty\pgfplotstable@colnames@glob \else \ifpgfplots@tableread@to@listener \let\pgfplotstable@listener=#3% @@ -877,21 +1395,44 @@ \else % Now, we can access the global variables! % copy them to #3. - \let#3=\pgfplotstable@colnames \expandafter\def\csname\string#3@@table@name\endcsname{#2}% - \c@pgfplotstable@counta=0\relax% - \pgfplotslistforeachungrouped\pgfplotstable@colnames\as\pgfplotstable@loc@TMPa{% - \def\pgfplotstable@loc@TMPb{% - \expandafter\let\csname\string#3@\pgfplotstable@loc@TMPa\endcsname}% - \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname - %\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% - \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty - \advance\c@pgfplotstable@counta by1\relax - }% + \pgfplotstable@copy@globalbuffers@to#3 \fi - \global\let\pgfplotstable@colnames=\pgfutil@empty } +% Copies the table column list and the column vectors of #1 to global buffers. +% @see \pgfplotstable@copy@globalbuffers@to +% +% Use these two methods to avoid scoping problems. +\def\pgfplotstable@copy@to@globalbuffers#1{% + \global\let\pgfplotstable@colnames@glob=#1 + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname% + }% + \expandafter\pgfplotstable@loc@TMPb\csname\string#1@\pgfplotstable@loc@TMPa\endcsname + \advance\c@pgfplotstable@counta by1\relax + }% +}% + +% copies the global column list and the global column vectors to #1 +% (NOT the table file name). +% @see \pgfplotstable@copy@to@globalbuffers +\def\pgfplotstable@copy@globalbuffers@to#1{% + \let#1=\pgfplotstable@colnames@glob + \c@pgfplotstable@counta=0\relax% + \pgfplotslistforeachungrouped\pgfplotstable@colnames@glob\as\pgfplotstable@loc@TMPa{% + \def\pgfplotstable@loc@TMPb{% + \expandafter\let\csname\string#1@\pgfplotstable@loc@TMPa\endcsname}% + \expandafter\pgfplotstable@loc@TMPb\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname +%\message{Column '\pgfplotstable@loc@TMPa' has entries: \expandafter\meaning\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname}% + \expandafter\global\expandafter\let\csname pgfp@numtable@glob@col@\the\c@pgfplotstable@counta\endcsname=\pgfutil@empty + \advance\c@pgfplotstable@counta by1\relax + }% + \global\let\pgfplotstable@colnames@glob=\pgfutil@empty +}% + \def\pgfplotstableread@finish{% \ifpgfplots@tableread@to@listener \else @@ -926,6 +1467,9 @@ %\pgfplots@message{READING LINE \the\pgfplotstableread@lineno: '\meaning\pgfplotstable@LINE'.}% \pgfplotstableread@curline@contains@colnamesfalse \ifnum\pgfplotstableread@numcols=0\relax + % STEP 0: initialise + % - count columns + % - find header data \pgfplotstableread@curcol=0\relax \pgfplotstableread@impl@DO\pgfplotstableread@impl@countcols@and@identifynames@NEXT\pgfplotstable@LINE %\expandafter\pgfplotstableread@impl@countcols@and@identifynames@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI @@ -963,7 +1507,7 @@ \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE %\expandafter\pgfplotstableread@impl@nextrow@ITERATE\pgfplotstable@LINE\pgfplotstable@EOI \fi -%\pgfplots@message{After reading first row: found '\the\pgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames'}% +%\pgfplots@message{After reading first row: found '\the\pgfplotstableread@numcols' columns; column name list='\meaning\pgfplotstable@colnames@glob'}% \else \pgfplotstableread@curcol=0\relax \pgfplotstableread@impl@DO\pgfplotstableread@impl@nextrow@NEXT\pgfplotstable@LINE @@ -1032,7 +1576,7 @@ \pgfplotstableread@curcol=0\relax \pgfutil@loop \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols - \expandafter\pgfplotslistpushbackglobal\the\pgfplotstableread@curcol\to\pgfplotstable@colnames + \expandafter\pgfplotslistpushbackglobal\the\pgfplotstableread@curcol\to\pgfplotstable@colnames@glob \advance\pgfplotstableread@curcol by1\relax \pgfutil@repeat } @@ -1173,7 +1717,7 @@ }{% \def\pgfplotstable@loc@TMPa{/pgfplots/table/create on use/#1}% \pgfkeysifdefined{\pgfplotstable@loc@TMPa/.@cmd}{% - \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here.}% + \pgfplots@error{Sorry, '\pgfplotstable@loc@TMPa' from table '\pgfplotstableread@filename' can't be evaluated in this context. Please prepare the table before using it here. You can do this using the 'read completely' key, see the manual for details.}% }{% \pgfplots@error{Sorry, could not retrieve column '#1' from table '\pgfplotstableread@filename'. Please check spelling (or introduce name aliases).}% }% @@ -1201,10 +1745,17 @@ \long\def\pgfplotstableread@impl@nextrow@NEXT#1{% %\pgfplots@message{Inserting '#1' at (\the\pgfplotstableread@lineno, \the\pgfplotstableread@curcol).}% - \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc - \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% - \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\the\pgfplotstableread@curcol\endcsname - \advance\pgfplotstableread@curcol by1\relax + \ifnum\pgfplotstableread@curcol<\pgfplotstableread@numcols + \pgfplotslist@assembleentry{#1}\into\t@pgfplots@tokc + \def\pgfplotstableread@TMP{\expandafter\pgfplotsapplistXpushback\expandafter{\the\t@pgfplots@tokc}\to}% + \expandafter\pgfplotstableread@TMP\csname pgfp@numtable@glob@col@\the\pgfplotstableread@curcol\endcsname + \advance\pgfplotstableread@curcol by1\relax + \else + \begingroup + \t@pgfplots@tokc={#1}% + \pgfplots@error{Table '\pgfplotstableread@filename' has too much columns in line \the\pgfplotstableread@lineno: Ignoring '\the\t@pgfplots@tokc'. Please verify that every cell entry is separated correctly (use braces {<cell entry>} if necessary). This error is not critical}% + \endgroup + \fi } @@ -1218,7 +1769,7 @@ \edef\pgfplotstable@loc@TMPa{#1--index\the\pgfplotstableread@curcol}% }% \expandafter\def\csname pgfplotstableread@impl@COLNAME@#1\endcsname{foo}% remember this name. - \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotstable@loc@TMPa}\to\pgfplotstable@colnames@glob \ifpgfplots@tableread@to@listener % create an associative container colindex -> colname % for use in a listener. @@ -1404,6 +1955,7 @@ % processes the option 'assign column name' \def\pgfplotstabletypeset@assign@final@colname#1#2{% \pgfkeysifdefined{/pgfplots/table/assign column name/.@cmd}{% + \pgfkeysdef{/pgfplots/table/column name}{#1}% \pgfkeysvalueof{/pgfplots/table/assign column name/.@cmd}#1\pgfeov \pgfkeysgetvalue{/pgfplots/table/column name}{#2}% }{}% @@ -1439,7 +1991,7 @@ % TODO % - replace grouped list foreach by popfront-loop and use arrays % directly -> group only the pgfkeys eval -\def\pgfplotstabletypeset@opt[#1]#2{% +\def\pgfplotstabletypeset@opt@[#1]#2{% \begingroup %-------------------------------------------------- % \pgfutil@ifundefined{#2}{% @@ -1458,6 +2010,61 @@ \edef\pgfplotstable@loc@TMPa{/pgfplots/table/every table={\the\t@pgfplots@toka}}% \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa,#1}% \fi + \pgfkeysgetvalue{/pgfplots/table/outfile}\pgfplotstable@outfilename + \pgfkeysgetvalue{/pgfplots/table/TeX comment}\pgfplots@TeX@comment + \ifpgfplotstabletypeset@force@remake + \pgfplotstabletypeset@includeoutfilesfalse + \else + \ifpgfplotstabletypeset@includeoutfiles + \pgfplotstabletypeset@includeoutfilesfalse + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \pgfplots@logfileopen{\pgfplotstable@outfilename}% + \openin1=\pgfplotstable@outfilename\relax + \ifeof1 \else\pgfplotstabletypeset@includeoutfilestrue \fi + \closein1 + \fi + \fi + \fi + \ifpgfplotstabletypeset@includeoutfiles + \input \pgfplotstable@outfilename\relax + \else + % + % Prepare outfile and debug options: + \let\pgfplotstable@notify@finished@line=\pgfutil@empty + % + % FLUSH assumes that \pgfplotstable@curline is finished. It + % appends all its contents as-is to \pgfplotstable@result. + % + % Furthermore, it calls \pgfplotstable@notify@finished@line which + % in turn may invoke additional output routines for the debug and + % outfile options. + % + % Finally, it resets \pgfplotstable@curline. + \def\pgfplotstable@curline@FLUSH{% + \pgfplotstable@notify@finished@line + \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \let\pgfplotstable@curline=\pgfutil@empty + }% + \ifpgfplotstabletypesetdebug + \immediate\write16{------- PGFPLOTSTABLE DEBUG MODE: --------}% + \expandafter\def\expandafter\pgfplotstable@notify@finished@line\expandafter{\pgfplotstable@notify@finished@line + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \immediate\write16{\the\t@pgfplots@toka\pgfplots@TeX@comment}% + }% + \fi + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \immediate\openout\pgfplotstable@outfile=\pgfplotstable@outfilename\relax + \expandafter\def\expandafter\pgfplotstable@notify@finished@line\expandafter{\pgfplotstable@notify@finished@line + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \immediate\write\pgfplotstable@outfile{\the\t@pgfplots@toka\pgfplots@TeX@comment}% + }% + \fi + % + % Start operation: \pgfkeysgetvalue{/pgfplots/table/columns}{\pgfplotstable@colnames}% \ifx\pgfplotstable@colnames\pgfutil@empty \pgfplotstablegetcolumnlist#2\to\pgfplotstable@colnames @@ -1494,6 +2101,8 @@ \global\c@pgfplotstable@numrows=\c@pgfplotstable@numrows \fi % + % + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Set keys for columns! \ifodd\c@pgfplotstable@colindex \t@pgfplots@toka={every odd column}% @@ -1504,23 +2113,30 @@ \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first column}% \fi % save this now before we increment '\c@pgfplotstable@colindex': - \edef\pgfplotstable@displaycolkey{display columns/\the\c@pgfplotstable@colindex/.try}% + \edef\pgfplotstable@displaycolkey{display columns/\the\c@pgfplotstable@colindex/.try,every col no \the\c@pgfplotstable@colindex/.try}% % \global\advance\c@pgfplotstable@colindex by1\relax \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last column}% \fi - \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname}% - \expandafter\pgfplotstable@checkspecialchars@pgfkeys\the\t@pgfplots@tokb\pgfplotstable@EOI - \ifpgfutil@in@ - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/{\the\t@pgfplots@tokb}/.try}% + \ifpgfplotstable@disable@rowcolstyles + % ok, then don't check for 'columns/<name>' and + % 'display columns/<index>': + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka}% \else - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/\the\t@pgfplots@tokb/.try}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname}% + \expandafter\pgfplotstable@checkspecialchars@pgfkeys\the\t@pgfplots@tokb\pgfplotstable@EOI + \ifpgfutil@in@ + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/{\the\t@pgfplots@tokb}/.try}% + \else + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,columns/\the\t@pgfplots@tokb/.try}% + \fi + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@displaycolkey}% + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}% \fi - \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@displaycolkey}% - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}% \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa}% + % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \pgfkeysgetvalue{/pgfplots/table/column name}{\pgfplotstable@colname@out}% \ifx\pgfplotstable@colname@out\pgfplotstabletypeset@nocolname @@ -1583,31 +2199,42 @@ %\message{I have now \meaning\pgfplotstabletypeset@final@colnames, and \meaning\pgfplotstabletypeset@final@cols.}% % Step 1: column names. \c@pgfplotstable@colindex=0\relax - % STEP 1.1: collect column types: - \def\pgfplotstable@resulttypes{}% - \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% - \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% - \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% - }% - \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% - \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% - \ifx\pgfplotstable@resulttypes\pgfutil@empty - \edef\pgfplotstable@result{\the\t@pgfplots@toka}% - \else - \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% - \fi + \c@pgfplotstable@rowindex=-1\relax + \let\pgfplotstable@result=\pgfutil@empty % \pgfkeysgetvalue{/pgfplots/table/font}{\pgfplotstable@font}% \ifx\pgfplotstable@font\pgfutil@empty \else \t@pgfplots@toka=\expandafter{\pgfplotstable@font}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\noexpand\begingroup\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\noexpand\begingroup\the\t@pgfplots@toka}% + \pgfplotstable@curline@FLUSH + \fi + % + \pgfkeysgetvalue{/pgfplots/table/begin table}{\pgfplotstable@entry}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@entry}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka}% + % + \ifpgfplotstabletypesetskipcoltypes + \else + % STEP 1.1: collect column types: + \def\pgfplotstable@resulttypes{}% + \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@coltypes\as\pgfplotstable@coltype{% + \t@pgfplots@toka=\expandafter{\pgfplotstable@resulttypes}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@coltype}% + \edef\pgfplotstable@resulttypes{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + }% + \ifx\pgfplotstable@resulttypes\pgfutil@empty + \else + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@resulttypes}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}% + \fi + \fi + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH \fi % - % Step 1.2: Collect FIRST ROW (column names) \begingroup \pgfplotstableset{every head row}% @@ -1623,23 +2250,28 @@ \pgfplots@glob@TMPc % insert 'before row' here: \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% % \pgfplotslistforeachungrouped\pgfplotstabletypeset@final@colnames\as\pgfplotstable@colname@out{% + % \advance\c@pgfplotstable@colindex by1\relax - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname@out \\}% - \else - \t@pgfplots@tokb=\expandafter{\pgfplotstable@colname@out &}% - \fi - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % typeset the cell: + \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa + \expandafter\pgfplots@loc@TMPa\pgfplotstable@colname@out\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + % + % append this cell: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfmathresult}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% }% % insert 'after row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % + \pgfplotstable@curline@FLUSH % %\message{I have now \meaning\pgfplotstable@result.}% % Step 2: column contents. @@ -1682,15 +2314,18 @@ \ifnum\c@pgfplotstable@rowindex=0\relax \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every first row}% \fi + \ifpgfplotstable@disable@rowcolstyles + \else + \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@loc@TMPa}% + \fi % misuse as temporary variable: \c@pgfplotstable@colindex=\c@pgfplotstable@rowindex \advance\c@pgfplotstable@colindex by1\relax \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numrows - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try,every last row}% - \else - \edef\pgfplotstable@loc@TMPa{\the\t@pgfplots@toka,every row no \the\c@pgfplotstable@rowindex/.try}% + \t@pgfplots@toka=\expandafter{\the\t@pgfplots@toka,every last row}% \fi - \expandafter\pgfplotstableset\expandafter{\pgfplotstable@loc@TMPa}% + \expandafter\pgfplotstableset\expandafter{\the\t@pgfplots@toka}% \pgfkeysgetvalue{/pgfplots/table/before row}{\pgfplotstable@before}% \pgfkeysgetvalue{/pgfplots/table/after row}{\pgfplotstable@after}% \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% @@ -1703,58 +2338,70 @@ \pgfplots@glob@TMPc % insert 'before row' here: \t@pgfplots@toka=\expandafter{\pgfplotstable@before}% - \t@pgfplots@tokb=\expandafter{\pgfplotstable@result}% - \edef\pgfplotstable@result{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \t@pgfplots@tokb=\expandafter{\pgfplotstable@curline}% + \edef\pgfplotstable@curline{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% \fi % % \pgfplotslistpopfront\pgfplotstable@col@processed\to\pgfplotstable@entry \pgfplotsarrayletentry\c@pgfplotstable@colindex\of\pgfplotstabletypeset@final@cols@array=\pgfplotstable@col@processed \advance\c@pgfplotstable@colindex by1\relax - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax - \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry \\}% - \else - \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry &}% - \fi - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % typeset the cell: + \pgfkeysgetvalue{/pgfplots/table/typeset cell/.@cmd}\pgfplots@loc@TMPa + \expandafter\pgfplots@loc@TMPa\pgfplotstable@entry\pgfeov + \pgfkeysgetvalue{/pgfplots/table/@cell content}\pgfmathresult + % + % append this cell: + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% + \t@pgfplots@tokb=\expandafter{\pgfmathresult}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + % \ifnum\c@pgfplotstable@colindex=\c@pgfplotstable@numcols\relax \c@pgfplotstable@colindex=0\relax % insert 'after row' here: - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@after}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% \advance\c@pgfplotstable@rowindex by1\relax + \pgfplotstable@curline@FLUSH \fi %\message{I have now \meaning\pgfplotstable@result.}% \fi \pgfutil@repeat - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% + \t@pgfplots@toka=\expandafter{\pgfplotstable@curline}% \pgfkeysgetvalue{/pgfplots/table/end table}{\pgfplotstable@entry}% \t@pgfplots@tokb=\expandafter{\pgfplotstable@entry}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \edef\pgfplotstable@curline{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + \ifx\pgfplotstable@curline\pgfutil@empty + \else + \pgfplotstable@curline@FLUSH + \fi + % \ifx\pgfplotstable@font\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplotstable@result\endgroup}% - \edef\pgfplotstable@result{\the\t@pgfplots@toka}% + \edef\pgfplotstable@curline{\noexpand\endgroup}% + \pgfplotstable@curline@FLUSH \fi - \ifpgfplotstabletypesetdebug - \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \immediate\write16{------- PGFPLOTSTABLE DEBUG MODE: --------}% - \immediate\write16{{\the\t@pgfplots@toka}}% + \ifx\pgfplotstable@outfilename\pgfutil@empty + \else + \immediate\closeout\pgfplotstable@outfile \fi - \pgfkeysgetvalue{/pgfplots/table/outfile}{\pgfplotstable@entry}% - \ifx\pgfplotstable@entry\pgfutil@empty +%\message{I have now \meaning\pgfplotstable@result.}% + \def\pgfplotstablecol{\pgfplots@error{Sorry, you can't access the \string\pgfplotstablecol\ in this context. It is ONLY valid during the preparation routines (please check the 'display columns/<index>' style in the manual).}}% + \def\pgfplotstablerow{\pgfplots@error{Sorry, you can't access the \string\pgfplotstablerow\ in this context. It is ONLY valid during the preparation routines (please check the 'every row no <index>' style).}}% + \ifpgfplotstabletypesetresult + \pgfplotstable@result + \fi + \pgfkeysgetvalue{/pgfplots/table/write to macro}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \global\let\pgfplots@glob@TMPa=\relax \else - \begingroup - \immediate\openout\pgfplotstable@outfile=\pgfplotstable@entry\relax \t@pgfplots@toka=\expandafter{\pgfplotstable@result}% - \immediate\write\pgfplotstable@outfile{\the\t@pgfplots@toka}% - \immediate\closeout\pgfplotstable@outfile - \endgroup + \xdef\pgfplots@glob@TMPa{\noexpand\def\expandafter\noexpand\pgfplots@loc@TMPa{\the\t@pgfplots@toka}}% + \fi \fi - \pgfplotstable@result \endgroup + \pgfplots@glob@TMPa% execute 'write to macro' if set. }% \newif\ifpgfplotstable@isfirstrow @@ -1806,8 +2453,12 @@ % \pgfplots@loop@CONTINUEtrue % allow this here to accumulate something. - \let\pgfmathaccuma=\pgfutil@empty - \let\pgfmathaccumb=\pgfutil@empty + \pgfutil@ifundefined{pgfmathaccuma}{% + \let\pgfmathaccuma=\pgfutil@empty + }{}% + \pgfutil@ifundefined{pgfmathaccumb}{% + \let\pgfmathaccumb=\pgfutil@empty + }{}% \pgfutil@loop% loop over each row until there are no more rows. \ifpgfplots@loop@CONTINUE \ifnum\c@pgfplotstable@numrows=-1\relax @@ -1883,4 +2534,181 @@ \expandafter\let\csname\string#3@\pgfplots@glob@TMPb\endcsname=\pgfplots@glob@TMPc }% + +%----------------------------------------------------------- +% +% Implementation of '/pgfplots/table/create col/function graph cut y': +% +%----------------------------------------------------------- + +% create on use/cut/.style={create col/function graph cut y={7e-4}{x=Basis,ymode=log,xmode=log}{{table=regtable,y=special-L2}}}, +% #1 = value of fixed line (I call it epsilon) +% #2 = options +% #3 = specification where to get the y from. It is a comma separated +% list of key-value sets, on set for every y(x) graph which shall be +% used. +% #4 = the direction in which the line does NOT vary (either 'x' or 'y') +% #5 = the direction in which the line DOES vary (either 'x' or 'y') +\def\pgfplotstable@fgc@init#1#2#3#4#5{% + \def\pgfplotstable@fgc@xmode{0}% + \def\pgfplotstable@fgc@ymode{0}% + % + \pgfkeysalso{/pgf/fpu=true}% + % + \pgfqkeys{/pgfplots/table/create col/function graph cut}{#2}% + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/table}\pgfplotstable@fgc@table + \ifx\pgfplotstable@fgc@table\pgfutil@empty + \else + % ok, we need to query (or load) a table! + \pgfplotstable@isloadedtable{\pgfplotstable@fgc@table}{% + }{% + \expandafter\pgfplotstableread\expandafter{\pgfplotstable@fgc@table}{\pgfplotstable@fgc@table}% + }% + \fi + % + \ifnum\csname pgfplotstable@fgc@#4mode\endcsname=1 + \pgfmathparse{ln(#1)}% + \else + \pgfmathparse{#1}% + \fi + \let\pgfplotstable@fgc@eps=\pgfmathresult + \pgfplots@assign@list\pgfmathaccumb{#3}% + % + \pgfkeysdef{/pgfplots/table/create col/assign}{% +%\message{working on next cell ...}% + \pgfplotslistcheckempty\pgfmathaccumb + \ifpgfplotslistempty + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfutil@empty% + \else + \pgfplotslistpopfront\pgfmathaccumb\to\pgfmathresult + \begingroup + % set local keys: + \def\pgfplots@loc@TMPa{\pgfqkeys{/pgfplots/table/create col/function graph cut}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}% + % acquire any sources: + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/table}\pgfplotstable@fgc@table + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/x}\pgfplotstable@fgc@x + \pgfkeysgetvalue{/pgfplots/table/create col/function graph cut/y}\pgfplotstable@fgc@y + \ifx\pgfplotstable@fgc@table\pgfutil@empty + \else + % ok, we need to query (or load) a table! + \pgfplotstable@isloadedtable{\pgfplotstable@fgc@table}{% + }{% + \expandafter\pgfplotstableread\expandafter{\pgfplotstable@fgc@table}{\pgfplotstable@fgc@table}% + }% + \fi + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@fgc@x}\of\pgfplotstable@fgc@table\to\pgfplotstable@fgc@x@col + \expandafter\pgfplotstablegetcolumnbyname\expandafter{\pgfplotstable@fgc@y}\of\pgfplotstable@fgc@table\to\pgfplotstable@fgc@y@col + % + % search for epsilon in the y values: + \expandafter\pgfplotstable@fgc@findintervalwitheps\expandafter{\csname pgfplotstable@fgc@#4@col\endcsname}{\csname pgfplotstable@fgc@#4mode\endcsname}% + \ifx\pgfplotstable@fgc@second\pgfutil@empty + \let\pgfmathresult=\pgfutil@empty + \else + % + % acquire the associated x values: + \expandafter\pgfplotstable@fgc@getassociated\expandafter{\csname pgfplotstable@fgc@#5@col\endcsname}{\csname pgfplotstable@fgc@#5mode\endcsname}% + % + % Interpolate: + \pgfmathparse{ + \pgfplotstable@fgc@abscissafirst + + (\pgfplotstable@fgc@eps - \pgfplotstable@fgc@first) / (\pgfplotstable@fgc@second-\pgfplotstable@fgc@first) + * (\pgfplotstable@fgc@abscissasecond - \pgfplotstable@fgc@abscissafirst) }% + \if\pgfplotstable@fgc@xmode1 + \pgfmathfloatexp@{\pgfmathresult}% + \fi + \pgflibraryfpuifactive{\pgfmathfloattosci{\pgfmathresult}}{}% +%\message{FGC: found \pgfplotstable@fgc@eps\space in no \pgfplotstable@fgc@index; \pgfplotstable@fgc@first:\pgfplotstable@fgc@second; lastwasless=\pgfplotstable@fgc@lastwasless; abscissa interval = \pgfplotstable@fgc@abscissafirst:\pgfplotstable@fgc@abscissasecond; result = \pgfmathresult}% + \fi + % + \pgfmath@smuggleone\pgfmathresult + \endgroup + \pgfkeyslet{/pgfplots/table/create col/next content}\pgfmathresult% + \fi + }% +}% + +% #1 : the coordinate list to query +% #2 : the mode +% +% POSTCONDITION: +% - \pgfplotstable@fgc@abscissafirst and \pgfplotstable@fgc@abscissasecond +% contain the abscissa values +% +\def\pgfplotstable@fgc@getassociated#1#2{% + \c@pgfplotstable@counta=\pgfplotstable@fgc@index + \pgfplotslistselect\c@pgfplotstable@counta\of#1\to\pgfplotstable@fgc@abscissasecond + \advance\c@pgfplotstable@counta by-1 + \pgfplotslistselect\c@pgfplotstable@counta\of#1\to\pgfplotstable@fgc@abscissafirst + \pgfmathfloatparsenumber{\pgfplotstable@fgc@abscissafirst}% + \let\pgfplotstable@fgc@abscissafirst=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplotstable@fgc@abscissasecond}% + \let\pgfplotstable@fgc@abscissasecond=\pgfmathresult + \if1#2 + \pgfmathln@{\pgfplotstable@fgc@abscissafirst}% + \let\pgfplotstable@fgc@abscissafirst=\pgfmathresult + \pgfmathln@{\pgfplotstable@fgc@abscissasecond}% + \let\pgfplotstable@fgc@abscissasecond=\pgfmathresult + \fi +}% + +% Search for the (first) interval in #1 containing epsilon and return +% \pgfplotstable@fgc@first and \pgfplotstable@fgc@second. +% +% #1 : the list of values. +% #2 : the mode (0 = linear, 1 = log) +% +% PRECONDITION: +% - \pgfplotstable@fgc@eps contains the value to search for +% +% POSTCONDITION +% On success, +% - \pgfplotstable@fgc@first and \pgfplotstable@fgc@second contain the interval. +% - \pgfplotstable@fgc@index contains the index of the @second coordinate. +% - \pgfplotstable@fgc@lastwasless is +% 1 if \pgfplotstable@fgc@second < eps +% 0 if \pgfplotstable@fgc@second >= eps +% If there was no such interval, +% \pgfplotstable@fgc@second will be empty. +\def\pgfplotstable@fgc@findintervalwitheps#1#2{% + \global\let\pgfplotstable@fgc@first=\pgfutil@empty + \global\let\pgfplotstable@fgc@second=\pgfutil@empty + \global\def\pgfplotstable@fgc@lastwasless{2}% + \global\def\pgfplotstable@fgc@break{0}% + \global\def\pgfplotstable@fgc@index{0}% + \pgfplotslistforeach#1\as\pgfplotstable@fgc@val{% + \if\pgfplotstable@fgc@break0 + \pgfmathfloatparsenumber{\pgfplotstable@fgc@val}% + \let\pgfplotstable@fgc@val=\pgfmathresult + \ifnum#2=1 + \pgfmathln@{\pgfplotstable@fgc@val}% + \let\pgfplotstable@fgc@val=\pgfmathresult + \fi + \pgfmathfloatlessthan@{\pgfplotstable@fgc@val}{\pgfplotstable@fgc@eps}% + \ifpgfmathfloatcomparison + \pgfplotstable@fgc@findintervalwitheps@updateresult 01 + \else + \pgfplotstable@fgc@findintervalwitheps@updateresult 10 + \fi + \fi + }% +} + +% #1 : the value of \pgfplotstable@fgc@lastwasless for which the loop +% shall break. +% #2 : the next value for \pgfplotstable@fgc@lastwasless +\def\pgfplotstable@fgc@findintervalwitheps@updateresult#1#2{% + \if\pgfplotstable@fgc@lastwasless#1 + % found it ! + \global\let\pgfplotstable@fgc@second=\pgfplotstable@fgc@val + \global\def\pgfplotstable@fgc@break{1}% + \else + \global\let\pgfplotstable@fgc@first=\pgfplotstable@fgc@val + \c@pgfplotstable@counta=\pgfplotstable@fgc@index + \advance\c@pgfplotstable@counta by1 + \xdef\pgfplotstable@fgc@index{\the\c@pgfplotstable@counta}% + \fi + \global\def\pgfplotstable@fgc@lastwasless{#2}% +}% + \endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex index ce780e866b2..6d89fd79532 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_loader.code.tex @@ -1,12 +1,29 @@ -%-------------------------------------------------- -% \pgfutil@ifundefined{pgfmathfloattosci} -% {}% -% {\endinput}% -%-------------------------------------------------- -\pgfkeysifdefined{/pgf/number format/@dec sep mark}{\endinput}{} - -\immediate\write16{Package pgfplots: loading complementary code for your PGF version...} -\input pgfplotsoldpgfsupp_misc.code.tex -\input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex -\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex -\input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex + +\pgfutil@ifundefined{pgfmathlessthan@}{% + \let\pgfmathlessthan@=\pgfmathless@ + \let\pgfmathgreaterthan@=\pgfmathgreater@ +}{}% + + +% check whether we need to load supplementary code. +% The development of pgfplots and pgf is intermingled, so pgfplots +% always uses up-to-date pgf CVS versions - the relevant complements between +% PGF 2.00 and PGF CVS are loaded here: +\pgfutil@ifundefined{pgfmathfloatparsenumber@handleerror}{% + %\pgfkeysifdefined{/pgf/number format/min exponent for 1000 sep}{\endinput}{} + \immediate\write16{Package pgfplots: loading complementary code for your PGF version...} + \input pgfplotsoldpgfsupp_misc.code.tex + \input pgfplotsoldpgfsupp_pgfkeysfiltered.code.tex + \input pgfplotsoldpgfsupp_pgfmathfloat.code.tex + \input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +} + {\relax} + +\pgfplots@iffileexists{pgflibraryfpu.code.tex}{% + \usepgflibrary{fpu}% +}{% + \immediate\write16{Package pgfplots: loading FPU library which doesn't appear to exist in your PGF version...} + \input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex +}% + +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex index def32476da4..8911ac2f14b 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_misc.code.tex @@ -91,6 +91,13 @@ \tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright} \tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft} +\tikzoption{mark}{ + \def\tikz@plot@mark{#1}% + \def\tikz@temp{none}% this check is relatively new + \ifx\tikz@temp\tikz@plot@mark + \let\tikz@plot@mark=\pgfutil@empty + \fi +} % the 'every mark' style is new: \tikzset{ every mark/.style={}, diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex new file mode 100644 index 00000000000..1c985f27d47 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryfpu.code.tex @@ -0,0 +1,1767 @@ +% Copyright 2008/2009 by Christian Feuersaenger +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU General Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +\newif\ifpgfmathfloatparseactive +\newif\ifpgfmathfloat@scaleactive + +% public macro which invokes '#1' if the fpu is installed and ready and '#2' +% otherwise. +\def\pgflibraryfpuifactive#1#2{% + \ifpgfmathfloatparseactive + #1% + \else + #2% + \fi +}% + +\pgfqkeys{/pgf}{ + % enable the FPU parser if it is not yet active + % + % It will be deactivated after the current TeX group + fpu/.is choice, + fpu/true/.code={% + \ifpgfmathfloatparseactive + \else + \pgfutil@ifundefined{pgfmathdeclarefunction}{% + % Ohoh - we are running on a TeX distribution with + % PGF 2.00 which doesn't have the new math engine. + % I can provide special treatment here, provided that + % all float commands are still able to run (that means + % more information needs to be copied from the pgf cvs + % to pgf 2.00 - for example pgfmathfloat.code.tex). + % + % I employ this to work with pgfplots and pgf 2.00 + % using all new features. + \pgfmathfloat@parser@install@pgf@two@null@null% + }{% + \pgfmathfloat@parser@install% + }% + \pgfmathfloatparseactivetrue + % improve compatibility with Marks FP library: + \pgfkeysalso{/pgf/fixed point arithmetic/.prefix style={/pgf/fpu=false}}% + \fi + },% + fpu/false/.code={% + \ifpgfmathfloatparseactive + \pgfmathfloat@uninstall% + \pgfmathfloatparseactivefalse + \fi + },% + fpu/.default=true, + % Use this to introduce a result scaling. + % Every expression in which the prefix '*' occurs + % will be multiplied with the result and converted to fixed point + % representation. + fpu/scale results/.code={% + \ifpgfmathfloatparseactive + \pgfmathparse{#1}% + \else + \pgfmathfloatparsenumber{#1}% + \fi + \let\pgfmathfloatscale=\pgfmathresult% + },% + % determines the output format of each complete expression parsing + % process. If 'scale results' is active, 'fixed' is assumed + % automatically. + fpu/output format/.is choice, + fpu/output format/float/.code= {\let\pgfmathfloatparse@output=\relax}, + fpu/output format/sci/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattosci@{\pgfmathresult}}}, + fpu/output format/fixed/.code= {\def\pgfmathfloatparse@output{\pgfmathfloattofixed@{\pgfmathresult}}}, + fpu/output format/float, +} + +\pgfmathfloatcreate{1}{1.0}{0}\let\pgfmathfloatscale=\pgfmathresult + +% This is the replacement parser invocation. +% It does two things which are different to \pgfmathparse: +% 1. it disables any dimension dependand scalings, +% 2. it implements the 'scale results' feature. +\def\pgfmathfloatparse{% + \begingroup% + % disable any dimension-dependant scalings: + \let\pgfmathpostparse=\relax% + \pgfmath@catcodes% + \pgfmath@quickparsefalse% + \pgfmathfloatparse@} + +% for pgf 2.00 : +\def\pgfmathfloatparse@pgf@two@null@null{% + \pgfmath@quickparsefalse% + \pgfmathfloatparse@} + +\def\pgfmathfloatparse@#1{% + \edef\pgfmathfloat@expression{#1}% + \expandafter\pgfmathfloatparse@@\pgfmathfloat@expression\pgfmathfloat@ + \ifpgfmathfloat@scaleactive + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloatscale} + \pgfmathfloattofixed{\pgfmathresult}% + \else + \pgfmathfloatparse@output + \fi +} + +\def\pgfmathfloat@char@asterisk{*} +\def\pgfmathfloatparse@@#1#2\pgfmathfloat@{% + \def\pgfmathfloat@test{#1}% + \ifx\pgfmathfloat@test\pgfmathfloat@char@asterisk% + \def\pgfmathfloat@expression{#2}% + \pgfmathfloat@scaleactivetrue + \fi% + \expandafter\pgfmathparse@\expandafter{\pgfmathfloat@expression}% + % \endgroup provided by \pgfpathmarse@end +} + +% Crude handling of file plots +% +\pgfkeys{/pgf/fpu/.cd, + scale file plot x/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalex{\pgfmathresult*}, + scale file plot y/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscaley{\pgfmathresult*}, + scale file plot z/.code=\pgfmathfloatparse{#1}\edef\pgfmathfloatplotscalez{\pgfmathresult*} +} + +\def\pgfmathfloat@uninstall@appendcmd#1{% + \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall #1}% +}% + +% If the uninstall command is already assembled, it will skip the +% uninstall assemblation. +\def\pgfmathfloat@plots@checkuninstallcmd{% + \pgfutil@ifundefined{pgfmathfloat@uninstall}{% + \global\let\pgfmathfloat@uninstall=\pgfutil@empty + }{% + % We already HAVE an uninstall command (prepared globally). + % So: don't waste time assembling one! + \def\pgfmathfloat@uninstall@appendcmd##1{}% + \def\pgfmathfloat@prepareuninstallcmd##1{}% + }% +}% + +% This assembles an uninstall command globally ON FIRST USAGE. +% See \pgfmathfloat@plots@checkuninstallcmd +\def\pgfmathfloat@prepareuninstallcmd#1{% + % and store backup information (globally - I don't want to do that + % all the time when the FPU is used!): + \expandafter\global\expandafter\let\csname pgfmathfloat@backup@\string#1\endcsname=#1% + \expandafter\gdef\expandafter\pgfmathfloat@uninstall\expandafter{\pgfmathfloat@uninstall + \expandafter\let\expandafter#1\csname pgfmathfloat@backup@\string#1\endcsname% + }% +} + +\def\pgfmathfloat@install#1=#2{% + \pgfmathfloat@prepareuninstallcmd{#1}% + \let#1=#2% +} +\def\pgfmathfloat@install@unimplemented#1{% + \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname% + \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}% +} +\def\pgfmathfloat@plots@install{% + \let\pgfmathfloatplotscalex=\pgfutil@empty + \let\pgfmathfloatplotscaley=\pgfutil@empty + \let\pgfmathfloatplotscalez=\pgfutil@empty + \pgfmathfloat@install\pgf@parsexyline=\pgfmathfloat@parsexyline% + \pgfmathfloat@install\pgf@parsexyzline=\pgfmathfloat@parsexyzline% +} +\def\pgfmathfloat@parsexyline#1 #2 #3\pgf@stop{% + \edef\pgfmathfloat@marshal{% + \noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}}% + }% + \pgfmathfloat@marshal% +} +\def\pgfmathfloat@parsexyzline#1 #2 #3 #4\pgf@stop{% + \edef\pgfmathfloat@marshal{% + \noexpand\pgfplotstreampoint{% + \noexpand\pgfpointxyz{\pgfmathfloatplotscalex#1}{\pgfmathfloatplotscaley#2}{\pgfmathfloatplotscalez#3}% + }% + }% + \pgfmathfloat@marshal% +} + +% +\def\pgfmathfloat@parser@install@functions{% + % Install float commands... + % + \pgfmathfloat@install\pgfmathadd@=\pgfmathfloatadd@% + \pgfmathfloat@install\pgfmathsubtract@=\pgfmathfloatsubtract@% + \pgfmathfloat@install\pgfmathneg@=\pgfmathfloatneg@% + \pgfmathfloat@install\pgfmathmultiply@=\pgfmathfloatmultiply@% + \pgfmathfloat@install\pgfmathdivide@=\pgfmathfloatdivide@% + \pgfmathfloat@install\pgfmathabs@=\pgfmathfloatabs@% + \pgfmathfloat@install\pgfmathround@=\pgfmathfloatround@% + \pgfmathfloat@install\pgfmathfloor@=\pgfmathfloatfloor@% + \pgfmathfloat@install\pgfmathmod@=\pgfmathfloatmod@% + \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmax@% + \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmin@% + \pgfmathfloat@install\pgfmathsin@=\pgfmathfloatsin@% + \pgfmathfloat@install\pgfmathcos@=\pgfmathfloatcos@% + \pgfmathfloat@install\pgfmathtan@=\pgfmathfloattan@% + \pgfmathfloat@install\pgfmathdeg@=\pgfmathfloatdeg@% + \pgfmathfloat@install\pgfmathrad@=\pgfmathfloatrad@% + \pgfmathfloat@install\pgfmathatan@=\pgfmathfloatatan@% + \pgfmathfloat@install\pgfmathasin@=\pgfmathfloatasin@% + \pgfmathfloat@install\pgfmathacos@=\pgfmathfloatacos@% + \pgfmathfloat@install\pgfmathcot@=\pgfmathfloatcot@% + \pgfmathfloat@install\pgfmathsec@=\pgfmathfloatsec@% + \pgfmathfloat@install\pgfmathcosec@=\pgfmathfloatcosec@% + \pgfmathfloat@install\pgfmathexp@=\pgfmathfloatexp@% + \pgfmathfloat@install\pgfmathln@=\pgfmathfloatln@% + \pgfmathfloat@install\pgfmathsqrt@=\pgfmathfloatsqrt@% + \pgfmathfloat@install\pgfmath@pi=\pgfmathfloatpi@% + \pgfmathfloat@install\pgfmathpi=\pgfmathfloatpi@% + \pgfmathfloat@install\pgfmathe@=\pgfmathfloate@% + \pgfmathfloat@install\pgfmathe=\pgfmathfloate@% + \pgfmathfloat@install\pgfmathlessthan@=\pgfmathfloatlessthan@% + \pgfmathfloat@install\pgfmathgreaterthan@=\pgfmathfloatgreaterthan@% + \pgfmathfloat@install\pgfmathpow@=\pgfmathfloatpow@ + \pgfmathfloat@install\pgfmathrand@=\pgfmathfloatrand@ + \pgfmathfloat@install\pgfmathrand=\pgfmathfloatrand@ + \pgfmathfloat@install\pgfmathrnd@=\pgfmathfloatrnd@ + \pgfmathfloat@install\pgfmathrnd=\pgfmathfloatrnd + \pgfmathfloat@install\pgfmathtrue@=\pgfmathfloattrue@ + \pgfmathfloat@install\pgfmathfalse@=\pgfmathfloatfalse@ + \pgfmathfloat@install\pgfmathnot@=\pgfmathfloatnot@ + \pgfmathfloat@install\pgfmathhex@=\pgfmathfloathex@ + \pgfmathfloat@install\pgfmathHex@=\pgfmathfloatHex@ + \pgfmathfloat@install\pgfmathoct@=\pgfmathfloatoct@ + \pgfmathfloat@install\pgfmathbin@=\pgfmathfloatbin@ + \pgfmathfloat@install\pgfmathand@=\pgfmathfloatand@ + \pgfmathfloat@install\pgfmathor@=\pgfmathfloator@ + \pgfmathfloat@install\pgfmathfactorial@=\pgfmathfloatfactorial@ + \pgfmathfloat@install@unimplemented{ceil}% + \pgfmathfloat@install@unimplemented{frac}% + \pgfmathfloat@install@unimplemented{log2}% + \pgfmathfloat@install@unimplemented{log10}% + \pgfmathfloat@install@unimplemented{veclen}% + \pgfmathfloat@install@unimplemented{equalto}% + \pgfmathfloat@install@unimplemented{random}% + \pgfmathfloat@install@unimplemented{setseed}% + \pgfmathfloat@install@unimplemented{Mod}% + \pgfmathfloat@install@unimplemented{real}% + \pgfmathfloat@install@unimplemented{notequal}% + \pgfmathfloat@install@unimplemented{sinh}% + \pgfmathfloat@install@unimplemented{cosh}% + \pgfmathfloat@install@unimplemented{tanh}% +% \pgfmathfloat@install@unimplemented{atan2}% +% \pgfmathfloat@install@unimplemented{height}% + % + % + \pgfmathfloat@install\pgfmathscientific=\pgfmathfloatscientific% +} + +\def\pgfmathfloat@parser@install{% + \pgfmathfloat@plots@checkuninstallcmd + \pgfmathfloat@plots@install% + \pgfmathfloat@parser@install@functions + % + % + % + % The following methods actually enable the parser to work with + % the internal floating point number representation. + % + % The idea is as follows: + % 1. Every operand must be given in internal float representation. + % 2. The internal float repr can be distinguished by a normal + % number. This is accomplished by introducing a new "exponent" + % token. + % 3. The stack-push-operation checks whether the argument is a + % float. If not, it is parsed properly before pushing it. + \pgfmath@tokens@make{exponent}{\pgfmathfloat@POSTFLAGSCHAR}% + \pgfmathfloat@uninstall@appendcmd{% + \expandafter\let\csname pgfmath@token@exponent@\pgfmathfloat@POSTFLAGSCHAR\endcsname=\relax + }% + \let\pgfmath@basic@parse@exponent=\pgfmath@parse@exponent% + \let\pgfmath@basic@stack@push@operand=\pgfmath@stack@push@operand + \pgfmathfloat@install\pgfmath@stack@push@operand=\pgfmathfloat@stack@push@operand + \pgfmathfloat@install\pgfmath@parse@exponent=\pgfmathfloat@parse@float@or@exponent + % + \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse% +}% + +\def\pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG#1{% + \edef\pgfmathfloat@loc@TMPa{% + \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1\endcsname{% + \noexpand\let\noexpand\pgfmath@parsepostgroup\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname% + \noexpand\expandafter\noexpand\pgfmath@parse@}% + \noexpand\def\expandafter\noexpand\csname pgfmath@parsefunction@#1@\endcsname{% + \noexpand\expandafter\expandafter\noexpand\csname pgfmath#1@\endcsname\noexpand\expandafter{\noexpand\pgfmathresult}% + \noexpand\pgfmath@postfunction% + }% + }% + \pgfmathfloat@loc@TMPa +}% +\def\pgfmathfloat@parser@install@pgf@two@null@null{% + \pgfmathfloat@plots@checkuninstallcmd + \pgfmathfloat@plots@install% + \pgfmathfloat@parser@install@functions + \let\pgfmathrand@=\pgfmath@basic@rand@ + \pgfmathfloat@install\pgfmathmax@=\pgfmathfloatmaxtwo% + \pgfmathfloat@install\pgfmathmin@=\pgfmathfloatmintwo% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{factorial}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{hex}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{bin}% + \pgfmathfloat@defineadapter@for@pgf@two@null@null@ONEARG{oct}% + % + % The following methods actually enable the parser to work with + % the internal floating point number representation. + % + % The idea is as follows: + % 1. Every operand must be given in internal float representation. + % 2. The internal float repr can be distinguished by a normal + % number. This is accomplished by introducing a new "exponent" + % token. + % 3. The stack-push-operation checks whether the argument is a + % float. If not, it is parsed properly before pushing it. + \let\pgfmath@basic@parsedecimalpoint=\pgfmath@parsedecimalpoint% + \let\pgfmath@basic@stack@push@operand=\pgfmath@stackpushoperand + \pgfmathfloat@install\pgfmath@stackpushoperand=\pgfmathfloat@stack@push@operand + \pgfmathfloat@install\pgfmath@parsedecimalpoint=\pgfmathfloat@parsedecimalpoint@pgf@two@null@null + \pgfmathfloat@install\pgfmath@endparse=\pgfmathfloat@endparse@pgf@two@null@null + \pgfmathfloat@install\pgfmath@endparsegroup=\pgfmathfloat@endparsegroup@pgf@two@null@null + \pgfmathfloat@install\pgfmath@postfunction=\pgfmathfloat@postfunction@pgf@two@null@null + \pgfmathfloat@install\pgfmath@@parseoperandgroup=\pgfmathfloat@@parseoperandgroup + % + \pgfmathfloat@install\pgfmathparse=\pgfmathfloatparse@pgf@two@null@null% +}% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Hacks to the basic level pgf math engine: +% +% WARNING: These methods rely heavily on the internal float representation! +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% for pgf2.00 : +\def\pgfmathfloat@parsedecimalpoint@pgf@two@null@null#1{% + \expandafter\ifx\pgfmathfloat@POSTFLAGSCHAR#1% check whether it is a float + \let\pgfmath@next=\pgfmathfloat@return@float@pgf@two@null@null% + \else + \def\pgfmath@next{\pgfmath@basic@parsedecimalpoint#1}% + \fi + \pgfmath@next +} +% for pgf2.00: +\def\pgfmathfloat@return@float@pgf@two@null@null#1]{% + \edef\pgfmathresult{\the\c@pgfmath@parsecounta\pgfmathfloat@POSTFLAGSCHAR#1]}% + \let\pgfmath@resulttemp=\pgfmathresult + \pgfmath@parseoperator% +}% +% for pgf2.00: +\def\pgfmathfloat@endparse@pgf@two@null@null#1\pgfmath@empty{% + \pgfmath@processalloperations% + \pgfmath@stackpop{\pgfmathresult}% + % delete the final unit scalings + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \ignorespaces% +} +% for pgf2.00: +\def\pgfmathfloat@endparsegroup@pgf@two@null@null{% + \pgfmath@processalloperations% + \pgfmath@stackpop{\pgfmathresult}% + % eliminated register usage here... + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \pgfmath@parsepostgroup% +} +% for pgf2.00: +\def\pgfmathfloat@postfunction@pgf@two@null@null{% + \let\pgfmath@parsepostgroup\pgfmath@parseoperator% + \ifnum\pgfmath@sign1<0 + \pgfmathfloatneg@{\pgfmathresult}% + \let\pgfmath@sign\pgfutil@empty + \fi + \pgfmath@parseoperator} +% for pgf2.00: +\def\pgfmathfloat@@parseoperandgroup{% + \let\pgfmath@postparsegroup\pgfmath@parseoperator% + \ifnum\pgfmath@sign1<0 + \pgfmathfloatneg@{\pgfmathresult}% + \let\pgfmath@sign\pgfutil@empty + \fi + \pgfmath@parseoperator% +} + + + + + + +% PRECONDITION: +% either +% <number>e +% ^ +% -> read the exponent. +% or +% <sign>\pgfmathfloat@POSTFLAGSCHAR +% ^ +% -> we have a parsed floating point number -> read it. +\def\pgfmathfloat@parse@float@or@exponent{% + \if\pgfmath@token \pgfmathfloat@POSTFLAGSCHAR% + % Ok, we actually HAVE a pre-parsed floating point number! + % Return it. + \expandafter\pgfmathfloat@return@float\expandafter\pgfmath@token@next + \else + % We have a standard number in scientific format. Parse it. + \expandafter\pgfmath@basic@parse@exponent + \fi +}% +\def\pgfmathfloat@return@float#1]{% + \edef\pgfmathresult{\pgfmath@number \pgfmathfloat@POSTFLAGSCHAR#1]}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \pgfmath@parse@@operator% +}% + +% This extends the functionality of the basic level operand stack: it +% assures every element on the stack is a float. +\def\pgfmathfloat@stack@push@operand#1{% + \pgfutil@ifnextchar\bgroup{% + \let\pgfmathfloat@stack@push@operand@list@=\pgfutil@empty + \pgfmathfloat@stack@push@operand@list + }{% + \pgfmathfloat@stack@push@operand@single + }% + #1\relax +}% +\def\pgfmathfloat@stack@push@operand@single#1\relax{% + \expandafter\pgfutil@in@\pgfmathfloat@POSTFLAGSCHAR{#1}% + \ifpgfutil@in@ + \pgfmath@basic@stack@push@operand{#1}% + \else + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathresult}% + \fi +}% +\def\pgfmathfloat@stack@push@operand@GOBBLE#1\relax{}% +\def\pgfmathfloat@stack@push@operand@list#1{% + \expandafter\pgfutil@in@ \pgfmathfloat@POSTFLAGSCHAR{#1}% + \ifpgfutil@in@ + \expandafter\def\expandafter\pgfmathfloat@stack@push@operand@list@\expandafter{% + \pgfmathfloat@stack@push@operand@list@{#1}% + }% + \else + \pgfmathfloatparsenumber{#1}% + \begingroup + \toks0=\expandafter{\pgfmathfloat@stack@push@operand@list@}% + \toks1=\expandafter{\pgfmathresult}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 {\the\toks1}}% + \endgroup + \let\pgfmathfloat@stack@push@operand@list@=\pgfmathfloat@glob@TMP + \fi + \pgfutil@ifnextchar\relax{% + \expandafter\pgfmath@basic@stack@push@operand\expandafter{\pgfmathfloat@stack@push@operand@list@}% + \pgfmathfloat@stack@push@operand@GOBBLE + }{% + \pgfmathfloat@stack@push@operand@list + }% +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% --- END --- Hacks to the basic level pgf math engine +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% Here starts the implementation of the floating point +% routines. +% +% They can be used even if the FPU parser is not active. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Remember the basic math commands. They will be invoked as subroutines in floating point routines. +\let\pgfmath@basic@add@=\pgfmathadd@ +\let\pgfmath@basic@subtract@=\pgfmathsubtract@ +\let\pgfmath@basic@multiply@=\pgfmathmultiply@ +\let\pgfmath@basic@divide@=\pgfmathdivide@ +\let\pgfmath@basic@abs@=\pgfmathabs@ +\let\pgfmath@basic@round@=\pgfmathround@ +\let\pgfmath@basic@rand@=\pgfmathrand@ +\let\pgfmath@basic@rnd@=\pgfmathrnd@ +\let\pgfmath@basic@setseed@=\pgfmathsetseed@ +\let\pgfmath@basic@random@=\pgfmathrandom@ +\let\pgfmath@basic@floor@=\pgfmathfloor@ +\let\pgfmath@basic@ceil@=\pgfmathceil@ +\let\pgfmath@basic@mod@=\pgfmathmod@ +\let\pgfmath@basic@max@=\pgfmathmax@ +\let\pgfmath@basic@min@=\pgfmathmin@ +\let\pgfmath@basic@sin@=\pgfmathsin@ +\let\pgfmath@basic@cos@=\pgfmathcos@ +\let\pgfmath@basic@tan@=\pgfmathtan@ +\let\pgfmath@basic@deg@=\pgfmathdeg@ +\let\pgfmath@basic@rad@=\pgfmathrad@ +\let\pgfmath@basic@atan@=\pgfmathatan@ +\let\pgfmath@basic@asin@=\pgfmathasin@ +\let\pgfmath@basic@acos@=\pgfmathacos@ +\let\pgfmath@basic@cot@=\pgfmathcot@ +\let\pgfmath@basic@sec@=\pgfmathsec@ +\let\pgfmath@basic@cosec@=\pgfmathcosec@ +\let\pgfmath@basic@pow@=\pgfmathpow@ +\let\pgfmath@basic@exp@=\pgfmathexp@ +\let\pgfmath@basic@ln@=\pgfmathln@ +\let\pgfmath@basic@sqrt@=\pgfmathsqrt@ +\let\pgfmath@basic@@pi=\pgfmath@pi +\let\pgfmath@basic@veclen@=\pgfmathveclen@ +\let\pgfmath@basic@e@=\pgfmathe@ +\let\pgfmath@basic@lessthan@=\pgfmathlessthan@ +\let\pgfmath@basic@greaterthan@=\pgfmathgreaterthan@ +\let\pgfmath@basic@equalto@=\pgfmathequalto@ +\let\pgfmath@basic@true@=\pgfmathtrue@ +\let\pgfmath@basic@false@=\pgfmathfalse@ + +\def\pgfmathfloatscientific#1#2{% + \edef\pgfmathresult{#1e#2}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfmathresult}% +} +% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0. +% +% It also sets the boolean \ifpgfmathfloatcomparison (globally. +\def\pgfmathfloatlessthan@#1#2{% +%\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{% + \global\pgfmathfloatcomparisonfalse + \begingroup + \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E + \ifcase\pgfmathfloat@a@S + % x = 0 -> (x<y <=> y >0) + \ifnum1=\pgfmathfloat@b@S + \global\pgfmathfloatcomparisontrue + \fi + \or + % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) + \ifnum1=\pgfmathfloat@b@S + % y>0: + \pgfmathfloatlessthan@positive + \fi + \or + % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) + \ifnum2=\pgfmathfloat@b@S + % 'y<0': + \pgfmathfloatgreaterthan@positive + \else + \global\pgfmathfloatcomparisontrue + \fi + \else + \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}{}% + \fi + \endgroup + \ifpgfmathfloatcomparison + \def\pgfmathresult{1.0}% + \else + \def\pgfmathresult{0.0}% + \fi +} +\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ + +% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] +\def\pgfmathfloatlessthan@positive{% + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +} + +% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME] +\def\pgfmathfloatgreaterthan@positive{% + \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E + \global\pgfmathfloatcomparisontrue + \else + \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E + \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M + \global\pgfmathfloatcomparisontrue + \fi + \fi + \fi +} + + +\def\pgfmathfloatgreaterthan@#1#2{\pgfmathfloatlessthan@{#2}{#1}} +\let\pgfmathfloatgreaterthan=\pgfmathfloatgreaterthan@ + +\def\pgfmathfloatmax@#1{% + \begingroup + \pgfmathfloatcreate{2}{1.0}{2147483644}% + \let\pgfmathmaxsofar=\pgfmathresult + \pgfmathfloatmax@@#1{}% +}% +\def\pgfmathfloatmax@@#1{% + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \expandafter\pgfmathfloatmax@@@% + \else% + \pgfmathfloatlessthan{\pgfmathmaxsofar}{#1}% + \ifpgfmathfloatcomparison + \edef\pgfmathmaxsofar{#1}% + \fi + \expandafter\pgfmathfloatmax@@% + \fi% +}% +\def\pgfmathfloatmax@@@{% + \let\pgfmathresult=\pgfmathmaxsofar + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup +}% +\def\pgfmathfloatmin@#1{% + \begingroup + \pgfmathfloatcreate{1}{1.0}{2147483644}% + \let\pgfmathminsofar=\pgfmathresult + \pgfmathfloatmin@@#1{}% +}% +\def\pgfmathfloatmin@@#1{% + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \expandafter\pgfmathfloatmin@@@% + \else% + \pgfmathfloatlessthan{#1}{\pgfmathminsofar}% + \ifpgfmathfloatcomparison + \edef\pgfmathminsofar{#1}% + \fi + \expandafter\pgfmathfloatmin@@% + \fi% +}% +\def\pgfmathfloatmin@@@{% + \let\pgfmathresult=\pgfmathminsofar + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup +}% + +\def\pgfmathfloatmaxtwo#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#2}% + \else + \edef\pgfmathresult{#1}% + \fi +} +\let\pgfmathfloatmax=\pgfmathfloatmaxtwo + +\def\pgfmathfloatmintwo#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +} +\let\pgfmathfloatmin=\pgfmathfloatmintwo + +% Renormalizes #1 to extended precision mantisse, meaning +% 100 <= m < 1000 +% instead of 1 <= m < 10. +% +% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses. +% +% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision). +% +% The operation is supposed to be very fast. +% +% @see \pgfmathfloatsetextprecision +% +% There is a routine for internal usage, +% \pgfmathfloattoextentedprecision@a. It also provides exponent and +% sign of #1 in output arguments and may be used to increase speed. +\def\pgfmathfloattoextentedprecision#1{% + \begingroup + \pgfmathfloattoextentedprecision@a{#1}% + \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1}% +}% +\def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1#2.#3}% +}% +\def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1#2#3.#4}% +}% +\def\pgfmathfloattoextentedprecision@@three#1.#2#3#4#5\pgfmathfloat@EOI{% + \edef\pgfmathresult{#1#2#3#4.#5}% +}% + +% Sets extended precision to 10^#1. +% +% The different choices are +% +% - 0: normalization 0 <= m < 1 (disable extended precision) +% - 1: normalization 10 <= m < 100 +% - 2: normalization 100 <= m < 1000 (default) +% - 3: normalization 1000 <= m < 10000 +% +% #1 is the exponent, #1 = 0,1,2 or 3. +% +% This setting applies to \pgfmathfloattoextentedprecision and friends. +\def\pgfmathfloatsetextprecision#1{% + \ifcase#1\relax + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero + \def\pgfmathfloatextprec@shift{0}% + \or + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one + \def\pgfmathfloatextprec@shift{1}% + \or + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two + \def\pgfmathfloatextprec@shift{2}% + \else + \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@three + \def\pgfmathfloatextprec@shift{3}% + \fi +}% +\pgfmathfloatsetextprecision{2}% + +% Does the "hard" work for \pgfmathfloattoextentedprecision. It +% provides additional outputs. +% +% INPUT: +% #1 normalized floating point number. Maybe a macro (it will be expanded ONCE) +% +% OUTPUT: +% - \pgfmathresult : the mantisse in extended precision +% - \pgfmathfloat@a@S : the sign of #1 +% - \pgfmathfloat@a@E : the exponent of #1, adjusted for extended precision +% - \pgfmathfloat@a@Mtok : undefined (its contents will be destroyed. +% +\def\pgfmathfloattoextentedprecision@a#1{% + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S<3 + \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift + \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 000\pgfmathfloat@EOI + \else + \edef\pgfmathresult{#1}% + \fi +}% + + +% Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers. +\def\pgfmathfloattoextentedprecision@b#1{% + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \ifnum\pgfmathfloat@b@S<3 + \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax + \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI + \else + \edef\pgfmathresult{#1}% + \fi +}% + +% Addition of two floating point numbers using 8 significant digits. +\def\pgfmathfloatadd@#1#2{% + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloattoextentedprecision@b{#2}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#2}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + % Shift lesser mantisse to fit the larger one: + \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E + \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}% + \else + \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}% + \fi + % add them! + \pgfmath@basic@add@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +% #1= floating point number +% #2= TeX code to execute if #1 == 0 +% #3= TeX code to execute if #1 != 0 +\def\pgfmathfloatifzero#1#2#3{% + \expandafter\pgfmathfloat@decompose@F#1\relax\pgfmathfloat@a@S + \ifnum\pgfmathfloat@a@S=0 #2\else#3\fi +}% + +% #1=mantisse which needs to be shifted (with smaller exponent) +% #2=smaller exponent +% #3=larger exponent +% +% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S. +\def\pgfmathfloatadd@shift#1#2#3{% + \pgf@xa=#1 pt% + \pgfmathfloat@a@S=#3\relax + \advance\pgfmathfloat@a@S by-#2\relax + \ifcase\pgfmathfloat@a@S + \or + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by100\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by1000\relax + \or + \divide\pgf@xa by10000\relax + \divide\pgf@xa by10000\relax + \else + \pgf@xa=0pt% + \fi + #2=#3\relax + \edef#1{\pgf@sys@tonumber\pgf@xa}% +} + +\let\pgfmathfloatadd=\pgfmathfloatadd@ + + +% Subtracts two floating point numbers. +\def\pgfmathfloatsubtract@#1#2{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E + \ifcase\pgfmathfloat@b@S + \edef\pgfmathresult{#1}% + \or + \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \or + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% + \let\pgfmathfloatsub@arg=\pgfmathresult + \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% + \else + \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@ + +% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply. +% +% Use this method if #2 is small number. +\def\pgfmathfloatmultiplyfixed@#1#2{% + \begingroup + % + % renormalize argument to 100 <= m < 1000 for extended accuracy: + \pgfmathfloattoextentedprecision@a{#1}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + \edef\pgfmathresult{#1}% + \pgfmathfloatcomparisonfalse + \or + \or + \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% + \else + \pgfmathfloatcomparisonfalse + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@multiply@{\pgfmathfloat@arga}{#2}% + % renormalize product. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@ + + +\def\pgfmathfloatmultiply@#1#2{% + \begingroup + \pgfmathfloatsetextprecision{1}% + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \edef\pgfmathfloat@argb{#2}% + \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% + + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{1}% + \or + \def\pgfmathresult@S{2}% + \else + \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% - + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{2}% + \or + \def\pgfmathresult@S{1}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% +infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% -infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@multiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatmultiply=\pgfmathfloatmultiply@ + +% Defines \pgfmathresult to be #1 / #2 for two floating point numbers. +% +% It employs the basic math engine internally to divide mantissas. +\def\pgfmathfloatdivide@#1#2{% + \begingroup + \pgfmathfloatsetextprecision{1}% is not too important, I think. After all, 0.1 <= #1/#2 < 10 or so due to normalization (no matter, which) + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \edef\pgfmathfloat@argb{#2}% + \pgfmathfloattoextentedprecision@b{\pgfmathfloat@argb}% + \let\pgfmathfloat@argb=\pgfmathresult + % + \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% + + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{1}% + \or + \def\pgfmathresult@S{2}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \else + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% - + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \def\pgfmathresult@S{2}% + \or + \def\pgfmathresult@S{1}% + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \else + \pgfmathfloatcreate{0}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or% +infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ? + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ? + \pgfmathfloatcomparisonfalse + \fi + \or% -infty + \ifcase\pgfmathfloat@b@S + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{3}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{5}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \or + \pgfmathfloatcreate{4}{0.0}{0}% + \pgfmathfloatcomparisonfalse + \fi + \fi + \ifpgfmathfloatcomparison + \pgfmath@basic@divide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% + \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E + % renormalize. This is the only part were an expensive float routine comes into play: + \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% + % And re-insert the proper sign: + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatdivide=\pgfmathfloatdivide@ + +\def\pgfmathfloatreciprocal@#1{% + \begingroup + % FIXME optimize + \edef\pgfmathfloat@loc@TMPa{#1}% + \pgfmathfloatcreate{1}{1.0}{0}% + \pgfmathfloatdivide@{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +% Computes sqrt(#1) in floating point arithmetics. +% +% It employs sqrt( m * 10^e ) = sqrt(m) * sqrt(10^e). +\def\pgfmathfloatsqrt@#1{% + \begingroup + \pgfmathfloatsetextprecision{3}% + \edef\pgfmathfloat@arga{#1}% + \pgfmathfloattoextentedprecision@a{\pgfmathfloat@arga}% + \let\pgfmathfloat@arga=\pgfmathresult + % + \ifcase\pgfmathfloat@a@S + % 0 + \pgfmathfloatcreate{0}{0.0}{0}% + \or% + + \pgfmath@basic@sqrt@{\pgfmathfloat@arga}% + \ifodd\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@E>0 + \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{3.16227766}% * sqrt(10) + \else + \expandafter\pgfmath@basic@multiply@\expandafter{\pgfmathresult}{0.316227766}% * sqrt(0.1) + \fi + \fi + \divide\pgfmathfloat@a@E by2 % sqrt(10^e) = 10^{e/2} (see above for odd e) + % renormalize sum. This is the only part were an expensive routine comes into play: + \edef\pgfmathfloat@arga{\pgfmathresult e\the\pgfmathfloat@a@E}% + \pgfmathfloatqparsenumber{\pgfmathfloat@arga}% + \or% - + \pgfmathfloatcreate{3}{0.0}{0}% + \or% nan + \pgfmathfloatcreate{3}{0.0}{0}% + \or% +infty + \pgfmathfloatcreate{4}{0.0}{0}% + \or% -infty + \pgfmathfloatcreate{3}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatsqrt=\pgfmathfloatsqrt@ + +% Returns the integer part of the floating point number #1. +% +% The result is returned as floating point as well. +% +% This operation is not limited to TeX's range of count registers (it +% works symbolly) +\def\pgfmathfloatint@#1{% + \begingroup + \edef\pgfmathresult{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % 0: nothing to do. + \or% + + \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or% - + \expandafter\pgfmathfloatint@@\the\pgfmathfloat@a@Mtok\pgfmathfloat@EOI + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \else + % nothing to do + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\def\pgfmathfloatint@@#1.{% + \ifnum\pgfmathfloat@a@E<0 + \pgfmathfloat@a@S=0 + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0 + \expandafter\pgfmathfloatint@@loop@gobble + \else + \pgfmathfloat@a@Mtok={#1.}% + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \expandafter\pgfmathfloatint@@loop + \fi +}% +\def\pgfmathfloatint@@loop#1{% + \def\pgfmathfloatint@@loop@{#1}% + \ifx\pgfmathfloatint@@loop@\pgfmathfloat@EOI + \let\pgfmathfloatint@@loop@next=\relax + \else + \ifnum\pgfmathfloat@b@E=0 + \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop@gobble + \else + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \advance\pgfmathfloat@b@E by-1 + \let\pgfmathfloatint@@loop@next=\pgfmathfloatint@@loop + \fi + \fi + \pgfmathfloatint@@loop@next +}% +\def\pgfmathfloatint@@loop@gobble#1\pgfmathfloat@EOI{}% +\let\pgfmathfloatint=\pgfmathfloatint@ +\let\pgfmathfloatfloor=\pgfmathfloatint +\let\pgfmathfloatfloor@=\pgfmathfloatint@ + +\def\pgfmathfloat@notimplemented#1{% + \pgfmath@error{Sorry, the operation '#1' has not yet been implemented in the floating point unit :-(}{}% + \pgfmathfloatcreate{0}{0.0}{0}% +}% + +% Divides or multiplies the input number by 10^#4 using an arithmetic +% left/right shift. +% +% Input: +% #1 a normalised floating point number. +% #2 a positive or negative integer number denoting the shift. +% +% Example: +% \pgfmathfloatshift{11e3}{4}% +% -> pgfmathresult = 11e7 +\def\pgfmathfloatshift@#1#2{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \advance\pgfmathfloat@a@E by#2\relax + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloatshift=\pgfmathfloatshift@ + +% Defines \pgfmathresult to be |#1|, the absolute value of the +% normalized floating point number #1. +\def\pgfmathfloatabs@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % 0: do nothing. + \or + % +: ok, is positive. + \or + % -: multiply with -1: + \pgfmathfloat@a@S=1 + \or + % nan: do nothing. + \or + % +infty: ok. + \or + % -infty: multiply with -1: + \pgfmathfloat@a@S=4 + \fi + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatabs=\pgfmathfloatabs@ + +% Computes the absolute error |#1 - #2| into \pgfmathresult. +\def\pgfmathfloatabserror@#1#2{% + \pgfmathfloatsubtract@{#1}{#2}% + \pgfmathfloatabs@{\pgfmathresult}% +}% +\let\pgfmathfloatabserror=\pgfmathfloatabserror@ + +% Computes the relative error |#1 - #2|/|#2| into \pgfmathresult, +% assuming #2 != 0. +\def\pgfmathfloatrelerror@#1#2{% + \pgfmathfloatsubtract@{#1}{#2}% + \pgfmathfloatdivide@{\pgfmathresult}{#2}% + \pgfmathfloatabs@{\pgfmathresult}% +}% +\let\pgfmathfloatrelerror=\pgfmathfloatrelerror@ + +% Computes \pgfmathresult = #1 mod #2 using truncated division. +% +\def\pgfmathfloatmod@#1#2{% + \begingroup + \pgfmathfloatdivide@{#1}{#2}% + \pgfmathfloatint@{\pgfmathresult}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloatmod=\pgfmathfloatmod@ + +% A modification of \pgfmathfloatmod@ where #3 = 1/#2 is already +% known. This may be faster. +\def\pgfmathfloatmodknowsinverse@#1#2#3{% + \begingroup + \pgfmathfloatmultiply@{#1}{#3}% + \pgfmathfloatint@{\pgfmathresult}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloatmodknowsinverse=\pgfmathfloatmodknowsinverse@ + +\def\pgfmathfloatpi@{% + \pgfmathfloatcreate{1}{3.14159265358979}{0}% +}% +\let\pgfmathfloatpi=\pgfmathfloatpi@ + +\def\pgfmathfloate@{% + \pgfmathfloatcreate{1}{2.71828182845905}{0}% +} +\let\pgfmathfloate=\pgfmathfloate@ + +% Converts #1 from radians to degrees. +\def\pgfmathfloatdeg@#1{% + \expandafter\ifx\csname pgfmfltdeg@factor\endcsname\relax + % Lazy evaluation: + \pgfmathfloatcreate{1}{5.72957795130823}{1}% + \global\let\pgfmfltdeg@factor=\pgfmathresult + \fi + \pgfmathfloatmultiply@{#1}\pgfmfltdeg@factor% +} +\let\pgfmathfloatdeg=\pgfmathfloatdeg@ + +% Converts #1 from degree to radians. +\def\pgfmathfloatrad@#1{% + \expandafter\ifx\csname pgfmfltrad@factor\endcsname\relax + % Lazy evaluation: + \pgfmathfloatcreate{1}{1.74532925199433}{-2}% + \global\let\pgfmfltrad@factor=\pgfmathresult + \fi + \pgfmathfloatmultiply@{#1}\pgfmfltrad@factor% +} +\let\pgfmathfloatrad=\pgfmathfloatrad@ + +% Computes #1(#2) where #1 is a trigonometric function, i.e. +% #1(#2) = #1( #2 + r*360 ) +% +% #1 is a one-argument macro which assigns \pgfmathresult. +\def\pgfmathfloatTRIG@#1#2{% + \expandafter\ifx\csname pgfmathfloatTRIG@NUM\endcsname\relax% why not directly!??? Did not work!?? + % Lazy evaluation: + \pgfmathfloatcreate{1}{3.6}{2}% + \global\let\pgfmathfloatTRIG@NUM=\pgfmathresult + \pgfmathfloatcreate{1}{2.77777777777778}{-3}% + \global\let\pgfmathfloatTRIG@NUM@INV=\pgfmathresult + \fi + \pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@NUM}{\pgfmathfloatTRIG@NUM@INV}% + \pgfmathfloattofixed@{\pgfmathresult}% + \expandafter#1\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% +}% + +\def\pgfmathfloatsin@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}} +\let\pgfmathfloatsin=\pgfmathfloatsin@ +\def\pgfmathfloatcos@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}} +\let\pgfmathfloatcos=\pgfmathfloatcos@ +\def\pgfmathfloattan@#1{% + % compute sin(#1) / cos(#1) + \begingroup + \pgfmathfloatcos@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatsin@{#1}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +\let\pgfmathfloattan=\pgfmathfloattan@ + +\def\pgfmathfloatcot@#1{% + % compute cos(#1) / sin(#1) + \begingroup + \pgfmathfloatsin@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatcos@{#1}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatcot=\pgfmathfloatcot@ + +\def\pgfmathfloatatan@#1{% + \begingroup + \expandafter\ifx\csname pgfmathfloatatan@TMP\endcsname\relax% why not directly!??? Did not work!?? + \pgfmathfloatcreate{1}{1.6}{4}% + \global\let\pgfmathfloatatan@TMP=\pgfmathresult + \pgfmathfloatcreate{2}{1.6}{4}% + \global\let\pgfmathfloatatan@TMPB=\pgfmathresult + \fi + \pgfmathfloatgreaterthan@{#1}{\pgfmathfloatatan@TMP}% + \ifpgfmathfloatcomparison + \pgfmathfloatcreate{1}{9.0}{1}% + \else + \pgfmathfloatlessthan{#1}{\pgfmathfloatatan@TMPB}% + \ifpgfmathfloatcomparison + \pgfmathfloatcreate{2}{9.0}{1}% + \else + \pgfmathfloattofixed@{#1}% + \expandafter\pgfmath@basic@atan@\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\let\pgfmathfloatatan=\pgfmathfloatatan@ + +\def\pgfmathfloatsec@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}} +\let\pgfmathfloatsec=\pgfmathfloatsec@ +\def\pgfmathfloatcosec@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}} +\let\pgfmathfloatcosec=\pgfmathfloatcosec@ + +% Expands #2 using \edef and invokes #1 with the resulting string. +% +% DEPRECATED +% Example: +% \pgfmath@y=7.9pt +% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% +% will invoke +% \pgfmathexp@{7.9} +\def\pgfmathlog@invoke@expanded#1#2{% + \edef\pgfmath@resulttemp{#2}% + \expandafter#1\pgfmath@resulttemp +} + +\def\pgfmathfloatln@#1{% + \pgfmathlog@float{#1}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloatcreate{3}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfmathresult}% + \fi +} +\let\pgfmathfloatln=\pgfmathfloatln@ + +% Computes log(x) into \pgfmathresult. +% +% This allows numbers such at 10000000 or 5.23e-10 to be represented +% properly, although TeX-registers would produce overflow/underflow +% errors in these cases. +% +% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y +% +% FIXME This routine is only kept for backwards compatibility! +% It does not work as expected because +% 1. it calls \pgfmathfloatparsenumber +% 2. it returns the result as fixed point number +% Use \pgfmathln@ instead! +\def\pgfmathlog@#1{% + \pgfmathfloatparsenumber{#1}% + \pgfmathlog@float{\pgfmathresult}% +} +\let\pgfmathlog=\pgfmathlog@ +\def\pgfmathlog@float#1{% + \begingroup% + % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S=1 + % Now, compute log(#1) = log(M) + E*log(10) + \expandafter\pgfmath@basic@ln@\expandafter{\the\pgfmathfloat@a@Mtok}% + \pgfmathfloat@b@M=\pgfmathresult pt% + \pgfmathfloat@a@M=2.302585pt% = log(10) + \multiply\pgfmathfloat@a@M by\pgfmathfloat@a@E\relax + \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}% + \else + \let\pgfmathresult=\pgfutil@empty% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup% +} + + +% Computes exp(#1) in floating point. +% +% The algorithm employs the identity +% exp(x) = exp(x - log(10^k) + log(10^k) +% = 10^k exp( x - k*log 10 ) +% with k choosen such that exp( x - k*log10) can be computed with the +% basic level math engine. +% +% The precision (relative error) is between 10^{-4} and 10^{-6}. For +% #1 = 700, it is even 10^{-3}. I will need to improve that someday. +\def\pgfmathfloatexp@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + % #1 = 0: + \pgfmathfloatcreate{1}{1.0}{0}% + \or% #1 > 0 + \pgfmathfloatexp@@{#1}% + \or% #1 < 0 + \pgfmathfloatexp@@{#1}% + \else + \edef\pgfmathresult{#1}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\def\pgfmathfloatexp@@#1{% + % Employ the identity + % exp(x) = exp(x - log(10^k) + log(10^k)) = 10^k exp( x - k *log(10)) + % + % I'd like to have x - k*log(10) <= 1 + % => compute k := int( (x - 1) * 1/log(10) ) + % that should suffice since \pgfmathexp@ should be + % accurate enough for those numbers. + % + % please note that we can do all this in TeX registers. + % exp(700) is almost the maximum of double precision + % anyway, and exp(16000) is certainly the largest we will + % ever need. + \pgfmathfloattofixed@{#1}% + \pgf@xa=\pgfmathresult pt + \pgf@xa=0.434294481\pgf@xa\relax + \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% + \expandafter\pgfmathfloatexp@@toint\pgfmathfloat@loc@TMPa\relax + \pgf@xa=2.302585092pt + \multiply\pgf@xa by-\pgfmathfloat@k\relax + \advance\pgf@xa by\pgfmathresult pt + \edef\pgfmathfloat@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% +%\message{computing exp(\pgfmathresult) = 10^\pgfmathfloat@k * exp(\pgfmathfloat@loc@TMPa)...}% + \pgfmath@basic@exp@{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatparsenumber{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatshift@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@k}% +} +% determine 'k'. This is a heuristics. The exponential series +% converges best for |x| <= 1. However, the fixed point arithmetics +% for tex results in best results for large |x|. Well, I'll need to +% tune this here. +\def\pgfmathfloatexp@@toint#1.#2\relax{% + \c@pgf@counta=#1\relax + \ifnum\c@pgf@counta<0 +\advance\c@pgf@counta by-1 % FIXME . this is a test for optimizations. + \c@pgf@countb=#2\relax + \ifnum\c@pgf@countb>0 + \advance\c@pgf@counta by-1 + \fi + \fi + \edef\pgfmathfloat@k{\the\c@pgf@counta}% +}% +\let\pgfmathfloatexp=\pgfmathfloatexp@ + +\def\pgfmathfloatround@#1{% + \begingroup + \pgfkeysvalueof{/pgf/number format/precision/.@cmd}0\pgfeov + \pgfmathfloattofixed{#1}% + \pgfmathroundto{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +\def\pgfmathfloatneg@#1{% + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S\relax + % 0: + \edef\pgfmathresult{#1}% + \or + % +: + \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % -: + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % nan: + \edef\pgfmathresult{#1}% + \or + % +infty: + \pgfmathfloatcreate{5}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \or + % -infty: + \pgfmathfloatcreate{4}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +\def\pgfmathfloatpow@#1#2{% + \begingroup% + \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S\relax + % #1 ^ 0 = 1 + \pgfmathfloatcreate{1}{1.0}{0}% + \or + % #2 > 0 + \pgfmathfloatpow@@{#1}{#2}% + \or + % #2 < 0 + \pgfmathfloatpow@@{#1}{#2}% + \or + % #2 = nan + \edef\pgfmathresult{#2}% + \or + % #2 = inf + \edef\pgfmathresult{#2}% + \or + % #2 = -inf + \pgfmathfloatcreate{0}{0.0}{0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + +% computes #1^#2 +% PRECONDITIONS +% - #2 is positive. +\def\pgfmathfloatpow@@#1#2{% + \pgfmathfloattofixed@{#2}% + \afterassignment\pgfmath@x% + \expandafter\c@pgfmath@counta\pgfmathresult pt\relax% + \ifdim\pgfmath@x=0pt % + % loop "manually"; we have an integer exponent! + \ifnum\c@pgfmath@counta<0 + \pgfmathfloatreciprocal@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \c@pgfmath@counta=-\c@pgfmath@counta + \else + \edef\pgfmathfloat@loc@TMPa{#1}% + \fi + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \pgfmathloop + \ifnum\c@pgfmath@counta>0\relax% + \ifodd\c@pgfmath@counta% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPb}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPb=\pgfmathresult + \fi + \ifnum\c@pgfmath@counta>1\relax% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \fi% + \divide\c@pgfmath@counta by2\relax% + \repeatpgfmathloop% + \else + % employ #1^#2 = exp( #2 * ln(#1) ) + \pgfmathfloatln@{#1}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \edef\pgfmathfloat@loc@TMPb{#2}% + \pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}% + \pgfmathfloatexp@{\pgfmathresult}% + \fi +} + +\def\pgfmathfloat@definemethodfrombasic@NOARG#1{% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP{% + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% +}% +\def\pgfmathfloat@definemethodfrombasic@ONEARG#1{% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP##1{% + \noexpand\pgfmathfloattofixed{##1}% + \noexpand\expandafter + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% + {\noexpand\pgfmathresult}% + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% +}% +\def\pgfmathfloat@definemethodfrombasic@TWOARGS#1{% + \pgfutil@ifundefined{pgfmath@basic@#1@}{% + \pgfutil@namelet{pgfmath@basic@#1@}{pgfmath#1@}% + }{}% + \edef\pgfmathfloat@glob@TMP##1##2{% + \noexpand\pgfmathfloattofixed{##2}% + \noexpand\let\noexpand\pgfmathfloat@loc@TMPa=\noexpand\pgfmathresult + \noexpand\pgfmathfloattofixed{##1}% + \noexpand\expandafter + \expandafter\noexpand\csname pgfmath@basic@#1@\endcsname\noexpand\expandafter% + {\noexpand\pgfmathresult}{\noexpand\pgfmathfloat@loc@TMPa}% + \noexpand\pgfmathfloatparsenumber{\noexpand\pgfmathresult}% + }% + \expandafter\let\csname pgfmathfloat#1@\endcsname=\pgfmathfloat@glob@TMP% + \expandafter\let\csname pgfmathfloat#1\endcsname=\pgfmathfloat@glob@TMP% +}% +\pgfmathfloat@definemethodfrombasic@NOARG{rand} +\pgfmathfloat@definemethodfrombasic@NOARG{rnd} +\pgfmathfloat@definemethodfrombasic@NOARG{false} +\pgfmathfloat@definemethodfrombasic@NOARG{true} +% arcsin, arccos +\pgfmathfloat@definemethodfrombasic@ONEARG{asin} +\pgfmathfloat@definemethodfrombasic@ONEARG{acos} +\pgfmathfloat@definemethodfrombasic@ONEARG{not} +\pgfmathfloat@definemethodfrombasic@ONEARG{hex} +\pgfmathfloat@definemethodfrombasic@ONEARG{Hex} +\pgfmathfloat@definemethodfrombasic@ONEARG{oct} +\pgfmathfloat@definemethodfrombasic@ONEARG{bin} +\pgfmathfloat@definemethodfrombasic@TWOARGS{and} +\pgfmathfloat@definemethodfrombasic@TWOARGS{or} + +\pgfutil@ifundefined{pgfmathdeclarefunction}{% + % special treatment: \pgfmathrand@ was not properly defined for pgf 2.00: + \let\pgfmath@basic@rand=\pgfmathrand + \def\pgfmathfloatrand@{% + \pgfmath@basic@rand + \pgfmathfloatparsenumber{\pgfmathresult}% + }% + % special treatment: \pgfmathrnd@ was not properly defined for pgf 2.00: + \let\pgfmath@basic@rnd=\pgfmathrnd + \def\pgfmathfloatrnd@{% + \pgfmath@basic@rnd + \pgfmathfloatparsenumber{\pgfmathresult}% + }% +}{} + +% Implements the factorial of '#1'. +% This does only work if '#1 < 2^32'. +\def\pgfmathfloatfactorial@#1{% + \begingroup + \pgfmathfloattofixed{#1}% + % collect integer part into a 32 bit register: + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\pgfmathresult\relax\pgfmath@% + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathloop + \ifnum\c@pgfmath@counta<2 % + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfmathfloat@loc@TMPa}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \advance\c@pgfmath@counta by-1\relax% + \repeatpgfmathloop + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex index 0d120a8b722..871bb8b03b0 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex,v 1.3 2008/06/07 17:08:33 ludewich Exp $ +\ProvidesFileRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/libraries/pgflibraryplothandlers.code.tex,v 1.13 2008/05/22 14:32:36 ludewich Exp $ \newif\ifpgf@plot@started diff --git a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex index e199d44f811..3d0cad1b196 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_pgfmathfloat.code.tex @@ -10,7 +10,7 @@ % This file contains methods for basic floating point arithmetics, rounding % to arbitrary precision and number pretty printing. % -% Version 0.9.4 2008/03/18 +% Version 1.0 2008/09/17 \global\newif\ifpgfmathfloatcomparison \newif\ifpgfmathfloatroundhasperiod @@ -90,12 +90,11 @@ \def\pgfmathfloatparsenumber#1{% \begingroup \edef\pgfmathresult{#1}% - \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI + \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% \fi - \edef\pgfmathresult{% - \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% \pgfmath@smuggleone\pgfmathresult \endgroup } @@ -103,18 +102,27 @@ % The same as \pgfmathfloatparsenumber, but does not perform sanity checking. \def\pgfmathfloatqparsenumber#1{% \begingroup - \let\pgfmathfloatparsenumber@sanitize@digit=\relax \edef\pgfmathresult{#1}% - \expandafter\pgfmathfloatparsenumber@impl\pgfmathresult\pgfmathfloat@EOI + \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% \fi - \edef\pgfmathresult{% - \the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% \pgfmath@smuggleone\pgfmathresult \endgroup } +% Assigns \pgfmathresult to be a float encoded as +% <FLAGS><MANTISSE>e<EXPONENT> +% +% example: +% \pgfmathfloatcreate{1}{2.0}{10} +% \pgfmathfloat@to@FMeE@style\pgfmathresult +% -> +% \pgfmathresult is now '12.0e10' regardless of the internal float +% format. +\def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax}% +\def\pgfmathfloat@to@FMeE@style@#1Y#2e#3]\relax{\def\pgfmathresult{#1#2e#3}}% % decomposes a lowlevel floating point representation into flags, % mantisse and exponent. @@ -122,22 +130,22 @@ % #4: integer register for the flags. % #5: dimen registers for the mantisse. % #6: integer register for the exponent. -\def\pgfmathfloat@decompose#1#2e#3\relax#4#5#6{% +\def\pgfmathfloat@decompose#1Y#2e#3]\relax#4#5#6{% #4=#1\relax #5=#2pt% #6=#3\relax% } % overloaded, #5 needs to be a token register for the mantisse. -\def\pgfmathfloat@decompose@tok#1#2e#3\relax#4#5#6{% +\def\pgfmathfloat@decompose@tok#1Y#2e#3]\relax#4#5#6{% #4=#1\relax #5={#2}% #6=#3\relax% } % overloaded, returns only ONE of the three components into #4: -\def\pgfmathfloat@decompose@F#1#2e#3\relax#4{#4=#1\relax}% -\def\pgfmathfloat@decompose@M#1#2e#3\relax#4{#4=#2pt}% -\def\pgfmathfloat@decompose@Mtok#1#2e#3\relax#4{#4={#2}}% -\def\pgfmathfloat@decompose@E#1#2e#3\relax#4{#4=#3\relax}% +\def\pgfmathfloat@decompose@F#1Y#2e#3]\relax#4{#4=#1\relax}% +\def\pgfmathfloat@decompose@M#1Y#2e#3]\relax#4{#4=#2pt}% +\def\pgfmathfloat@decompose@Mtok#1Y#2e#3]\relax#4{#4={#2}}% +\def\pgfmathfloat@decompose@E#1Y#2e#3]\relax#4{#4=#3\relax}% % Takes a floating point number #1 as input and writes flags to macro % #2, mantisse to macro #3 and exponent to macro #4. @@ -187,525 +195,15 @@ % % All arguments are characters and will be expanded using '\edef'. \def\pgfmathfloatcreate#1#2#3{% - \edef\pgfmathresult{#1#2e#3}% -}% - - -% Compares #1 with #2 and sets \pgfmathresult either to 1.0 or 0.0. -% -% It also sets the boolean \ifpgfmathfloatcomparison (globally. -\def\pgfmathfloatlessthan@#1#2{% -%\def\pgfmathfloatlessthan#1#2#3\and#4#5#6{% - \global\pgfmathfloatcomparisonfalse - \begingroup - \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose#2\relax\pgfmathfloat@b@S\pgfmathfloat@b@M\pgfmathfloat@b@E - \ifcase\pgfmathfloat@a@S - % x = 0 -> (x<y <=> y >0) - \ifnum1=\pgfmathfloat@b@S - \global\pgfmathfloatcomparisontrue - \fi - \or - % x > 0 -> (x<y <=> ( y > 0 && |x| < |y|) ) - \ifnum1=\pgfmathfloat@b@S - % y>0: - \pgfmathfloatlessthan@positive - \fi - \or - % x < 0 -> (x<y <=> (y >= 0 || |x| > |y|) ) - \ifnum2=\pgfmathfloat@b@S - % 'y<0': - \pgfmathfloatgreaterthan@positive - \else - \global\pgfmathfloatcomparisontrue - \fi - \else - \pgfmath@error{Sorry, 'pgfmathfloatlessthan@{#1}{#2}' not yet supported.}% - \fi - \endgroup - \ifpgfmathfloatcomparison - \def\pgfmathresult{1.0}% - \else - \def\pgfmathresult{0.0}% - \fi -} -\let\pgfmathfloatlessthan=\pgfmathfloatlessthan@ - -% compares \pgfmathfloat@a@[SME] < \pgfmathfloat@b@[SME] -\def\pgfmathfloatlessthan@positive{% - \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E - \global\pgfmathfloatcomparisontrue - \else - \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E - \ifdim\pgfmathfloat@a@M<\pgfmathfloat@b@M - \global\pgfmathfloatcomparisontrue - \fi - \fi - \fi -} - -% compares \pgfmathfloat@a@[SME] > \pgfmathfloat@b@[SME] -\def\pgfmathfloatgreaterthan@positive{% - \ifnum\pgfmathfloat@a@E>\pgfmathfloat@b@E - \global\pgfmathfloatcomparisontrue - \else - \ifnum\pgfmathfloat@a@E=\pgfmathfloat@b@E - \ifdim\pgfmathfloat@a@M>\pgfmathfloat@b@M - \global\pgfmathfloatcomparisontrue - \fi - \fi - \fi -} - - -\def\pgfmathfloatmax@#1#2{% - \pgfmathfloatlessthan{#1}{#2}% - \ifpgfmathfloatcomparison - \edef\pgfmathresult{#2}% - \else - \edef\pgfmathresult{#1}% - \fi -} -\let\pgfmathfloatmax=\pgfmathfloatmax@ - -\def\pgfmathfloatmin@#1#2{% - \pgfmathfloatlessthan{#1}{#2}% - \ifpgfmathfloatcomparison - \edef\pgfmathresult{#1}% - \else - \edef\pgfmathresult{#2}% - \fi -} -\let\pgfmathfloatmin=\pgfmathfloatmin@ - -% Renormalizes #1 to extended precision mantisse, meaning -% 100 <= m < 1000 -% instead of 1 <= m < 10. -% -% The 'extended precision' means we have higher accuracy when we apply pgfmath operations to mantisses. -% -% The input argument is expected to be a normalized floating point number; the output argument is a non-normalized floating point number (well, normalized to extended precision). -% -% The operation is supposed to be very fast. -\def\pgfmathfloattoextentedprecision#1{% - \begingroup - \pgfmathfloattoextentedprecision@a{#1}% - \pgfmathfloatcreate{\pgfmathfloat@a@S}{\pgfmathresult}{\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - -\def\pgfmathfloattoextentedprecision@@zero#1\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1}% -}% -\def\pgfmathfloattoextentedprecision@@one#1.#2#3\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2.#3}% -}% -\def\pgfmathfloattoextentedprecision@@two#1.#2#3#4\pgfmathfloat@EOI{% - \edef\pgfmathresult{#1#2#3.#4}% -}% - -% Sets extended precision to 10^#1. -% -% The default is 10^2, which means mantissas in extended precision are -% normalised to 100 <= m < 1000. -% -% The case 10^1 means they are normalised to 10 <= m < 100 and 10^0 -% deactivates extended precision. -% -% #1 is the exponent, #1 = 0,1 or 2. -% -% This setting applies to \pgfmathfloattoextentedprecision. -\def\pgfmathfloatsetextprecision#1{% - \ifcase#1\relax - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@zero - \def\pgfmathfloatextprec@shift{0}% - \or - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@one - \def\pgfmathfloatextprec@shift{1}% - \else - \let\pgfmathfloattoextentedprecision@@=\pgfmathfloattoextentedprecision@@two - \def\pgfmathfloatextprec@shift{2}% - \fi + \edef\pgfmathresult{#1Y#2e#3]}% }% -\pgfmathfloatsetextprecision{2}% +% This is the character present in any low-level floating point +% number. It is assumed to be the SECOND character of a float (after +% the flags integer). +\def\pgfmathfloat@POSTFLAGSCHAR{Y} -% Does the same work as \pgfmathfloattoextentedprecision, but this one here fills the -% registers \pgfmathfloat@a@S and \pgfmathfloat@a@E with the flags and (renormalized) exponent. -% It destroys the content of \pgfmathfloat@a@Mtok. -\def\pgfmathfloattoextentedprecision@a#1{% - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifnum\pgfmathfloat@a@S<3 - \advance\pgfmathfloat@a@E by-\pgfmathfloatextprec@shift\relax% compensate for shift - \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI - \else - \edef\pgfmathresult{#1}% - \fi -}% -% Similar to \pgfmathfloattoextentedprecision@a, this one here fills the '@b' registers. -\def\pgfmathfloattoextentedprecision@b#1{% - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E - \ifnum\pgfmathfloat@b@S<3 - \advance\pgfmathfloat@b@E by-\pgfmathfloatextprec@shift\relax - \expandafter\pgfmathfloattoextentedprecision@@\the\pgfmathfloat@a@Mtok 00\pgfmathfloat@EOI - \else - \edef\pgfmathresult{#1}% - \fi -}% - -% Addition of two floating point numbers using 8 significant digits. -\def\pgfmathfloatadd@#1#2{% - \begingroup - % - % renormalize argument to 100 <= m < 1000 for extended accuracy: - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - \edef\pgfmathresult{#2}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% - \fi - \ifcase\pgfmathfloat@b@S - \edef\pgfmathresult{#1}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@argb{-\pgfmathfloat@argb}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% - \fi - \ifpgfmathfloatcomparison - % Shift lesser mantisse to fit the larger one: - \ifnum\pgfmathfloat@a@E<\pgfmathfloat@b@E - \pgfmathfloatadd@shift{\pgfmathfloat@arga}{\pgfmathfloat@a@E}{\pgfmathfloat@b@E}% - \else - \pgfmathfloatadd@shift{\pgfmathfloat@argb}{\pgfmathfloat@b@E}{\pgfmathfloat@a@E}% - \fi - % add them! - \pgfmathadd@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - - -% #1=mantisse which needs to be shifted (with smaller exponent) -% #2=smaller exponent -% #3=larger exponent -% -% ATTENTION: this helper method DESTROYS contents of \pgfmathfloat@a@S. -\def\pgfmathfloatadd@shift#1#2#3{% - \pgf@xa=#1 pt% - \pgfmathfloat@a@S=#3\relax - \advance\pgfmathfloat@a@S by-#2\relax - \ifcase\pgfmathfloat@a@S - \or - \divide\pgf@xa by10\relax - \or - \divide\pgf@xa by100\relax - \or - \divide\pgf@xa by1000\relax - \or - \divide\pgf@xa by10000\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by10\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by100\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by1000\relax - \or - \divide\pgf@xa by10000\relax - \divide\pgf@xa by10000\relax - \else - \pgf@xa=0pt% - \fi - #2=#3\relax - \edef#1{\pgf@sys@tonumber\pgf@xa}% -} - -\let\pgfmathfloatadd=\pgfmathfloatadd@ - - -% Subtracts two floating point numbers. -\def\pgfmathfloatsubtract@#1#2{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#2\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@b@E - \ifcase\pgfmathfloat@b@S - \edef\pgfmathresult{#1}% - \or - \pgfmathfloatcreate{2}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% - \let\pgfmathfloatsub@arg=\pgfmathresult - \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% - \or - \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@b@E}% - \let\pgfmathfloatsub@arg=\pgfmathresult - \pgfmathfloatadd@{#1}{\pgfmathfloatsub@arg}% - \else - \pgfmathfloatcreate{\the\pgfmathfloat@b@S}{0.0}{0}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - -\let\pgfmathfloatsubtract=\pgfmathfloatsubtract@ - -% Scales a floating point number #1 with a fixed point number #2 using pgfmathmultiply. -% -% Use this method if #2 is small number. -\def\pgfmathfloatmultiplyfixed@#1#2{% - \begingroup - % - % renormalize argument to 100 <= m < 1000 for extended accuracy: - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - \edef\pgfmathresult{#1}% - \pgfmathfloatcomparisonfalse - \or - \or - \edef\pgfmathfloat@arga{-\pgfmathfloat@arga}% - \else - \pgfmathfloatcomparisonfalse - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{0.0}{0}% - \fi - \ifpgfmathfloatcomparison - \pgfmathmultiply@{\pgfmathfloat@arga}{#2}% - % renormalize product. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% - -\let\pgfmathfloatmultiplyfixed=\pgfmathfloatmultiplyfixed@ - - -\def\pgfmathfloatmultiply@#1#2{% - \begingroup - \pgfmathfloatsetextprecision{1}% - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - % 0 - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% + - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{1}% - \or - \def\pgfmathresult@S{2}% - \else - \expandafter\pgfmathfloatcreate\the\pgfmathfloat@b@S{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% - - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{2}% - \or - \def\pgfmathresult@S{1}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% nan - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% +infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% -infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \fi - \ifpgfmathfloatcomparison - \pgfmathmultiply@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% -\let\pgfmathfloatmultiply=\pgfmathfloatmultiply@ - -\def\pgfmathfloatdivide@#1#2{% - \begingroup - \pgfmathfloatsetextprecision{1}% - \pgfmathfloattoextentedprecision@a{#1}% - \let\pgfmathfloat@arga=\pgfmathresult - % - \pgfmathfloattoextentedprecision@b{#2}% - \let\pgfmathfloat@argb=\pgfmathresult - % - \pgfmathfloatcomparisontrue% re-use this boolean here to handle special cases. - \ifcase\pgfmathfloat@a@S - % 0 - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% + - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{1}% - \or - \def\pgfmathresult@S{2}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \else - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% - - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \def\pgfmathresult@S{2}% - \or - \def\pgfmathresult@S{1}% - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \else - \pgfmathfloatcreate{0}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \or% nan - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or% +infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% what is inf/inf ? - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% or inf/-inf ? - \pgfmathfloatcomparisonfalse - \fi - \or% -infty - \ifcase\pgfmathfloat@b@S - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{3}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{5}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \or - \pgfmathfloatcreate{4}{0.0}{0}% - \pgfmathfloatcomparisonfalse - \fi - \fi - \ifpgfmathfloatcomparison - \pgfmathdivide@{\pgfmathfloat@arga}{\pgfmathfloat@argb}% - \advance\pgfmathfloat@a@E by-\pgfmathfloat@b@E - % renormalize sum. This is the only part were an expensive routine comes into play: - \edef\pgfmathresult{\pgfmathresult e\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloatqparsenumber\expandafter{\pgfmathresult}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatcreate{\pgfmathresult@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup -}% -\let\pgfmathfloatdivide=\pgfmathfloatdivide@ - % Converts a composed floating point representation to fixed point. % % Example: @@ -720,7 +218,8 @@ \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax \or \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax - \edef\pgfmathresult{-\pgfmathresult}% + \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}% + \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}% \or\def\pgfmathresult{nan}% \or\def\pgfmathresult{inf}% \or\def\pgfmathresult{-inf}% @@ -751,127 +250,6 @@ }% \let\pgfmathfloattosci=\pgfmathfloattosci@ -% Divides or multiplies the input number by 10^#4 using an arithmetic -% left/right shift. -% -% Input: -% #1 a normalised floating point number. -% #2 a positive or negative integer number denoting the shift. -% -% Example: -% \pgfmathfloatshift{11e3}{4}% -% -> pgfmathresult = 11e7 -\def\pgfmathfloatshift@#1#2{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \expandafter\advance\expandafter\pgfmathfloat@a@E#2\relax - \edef\pgfmathresult{\the\pgfmathfloat@a@S\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup -} -\let\pgfmathfloatshift=\pgfmathfloatshift@ - -% Computes a good guess for log(X.XXXX) where the input number should -% be between 0 < x < 10. -% -% If it is not in this range, the returned value will be bad. -% -% For use in the newton implementation of log(x). Please note that we -% first compute a normalized floating point representation of x, and -% the mantisse is always between 0 and 10. -\def\pgfmathlog@smaller@ten@newton@startval#1.#2\to#3{% - \ifcase#1 - \pgfmath@error{pgfmathlog@newton: INTERNAL ERROR: should not happen! - [\#1=0 should have been caught before!]}% - \or#3=0.530628pt - \or#3=0.993pt - \or#3=1.308pt - \or#3=1.5pt - \or#3=1.71pt - \or#3=1.872pt - \or#3=2.01pt - \or#3=2.145pt - \or#3=2.24pt - \fi -} - -% FIXME : eliminate \pgfmathlog@invoke@expanded ? - -% Expands #2 using \edef and invokes #1 with the resulting string. -% -% Example: -% \pgfmath@y=7.9pt -% \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmath@y}}}% -% will invoke -% \pgfmathexp@{7.9} -\def\pgfmathlog@invoke@expanded#1#2{% - \edef\pgfmath@resulttemp{#2}% - \expandafter#1\pgfmath@resulttemp -} - -% This implementation of log(X) is done with a newton method applied to x-exp(y) = 0. -% The implementation \pgfmathexp is used for exp(y). -% -% see \pgfmathlog@ -\def\pgfmathlog@newton#1{% - \pgfmathfloatparsenumber{#1}% - \pgfmathlog@newton@float{\pgfmathresult}% -} - -% the same as \pgfmathlog@newton, but this one takes a floating point number as input. -\def\pgfmathlog@newton@float#1{% - \begingroup% - % compute #1 = M*10^E with normalised mantisse M = [+-]*[1-9].XXXXX - \expandafter\pgfmathfloat@decompose#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E - \let\pgfmathlog@loopcount=\pgfmathfloat@b@S% this counter is not used here... use it as loop counter. - % - \ifnum\pgfmathfloat@a@S=1 - % Now, compute log(#1) = log(M) + E*log(10) - \expandafter\pgfmathlog@smaller@ten@newton@startval\the\pgfmathfloat@a@M.\to\pgfmathfloat@b@M - \pgfmathlog@loopcount=0 - \pgfutil@loop - \ifnum\pgfmathlog@loopcount<3 - \pgfmathlog@invoke@expanded\pgfmathexp@{{\pgf@sys@tonumber{\pgfmathfloat@b@M}}}% - \let\pgfmathlog@tmp=\pgfmathresult - \pgfmathlog@invoke@expanded\pgfmathdivide@{{\pgf@sys@tonumber{\pgfmathfloat@a@M}}{\pgfmathlog@tmp}}% - \expandafter\pgfmath@ya\pgfmathresult pt - \advance\pgfmathfloat@b@M by\pgfmath@ya - \advance\pgfmathfloat@b@M by-1pt - \advance\pgfmathlog@loopcount by1 - \pgfutil@repeat - \pgfmathfloat@a@M=2.302585pt% = log(10) - \multiply\expandafter\pgfmathfloat@a@M\pgfmathfloat@a@E - \advance\pgfmathfloat@b@M by\pgfmathfloat@a@M - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfmathfloat@b@M}}% - \else - \let\pgfmathresult=\pgfutil@empty% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup% -} - -% Computes log(x) into \pgfmathresult. -% -% REMARK -% This method does NOT use TeX Registers to represent the numbers! The -% computation is COMPLETELY STRING BASED. -% This allows numbers such at 10000000 or 5.23e-10 to be represented -% properly, although TeX-registers would produce overflow/underflow -% errors in these cases. -% -% The natural logarithm is computed using log(X*10^Y) = log(X) + log(10)*Y -\let\pgfmathlog@=\pgfmathlog@newton - -\let\pgfmathlog@float=\pgfmathlog@newton@float - -% Public interface method. This is expected to use \pgfmathparse but -% it DOESN'T do that. \pgfmathparse naturally can't handle numbers -% which exceed TeX's numerical capabilities. However, exponentials are -% typically either too large or too small for TeX. -% -% @see \pgfmathnormalisedfloatingpoint for how we parse arguments. -% @see \pgfmathlog@ -\let\pgfmathlog=\pgfmathlog@newton % Rounds a fixed point number #1 to \pgfmathfloat@round@precision digits precision and returns % the result into \pgfmathresult. @@ -891,7 +269,7 @@ % -> \pgfmathresult = '20000' % % Arguments: -% #1 may be either a number or a macro expanding to a number. +% #1 may be either a number or a macro (\pgfmathresult is allowed) expanding to a number. % % SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set. \def\pgfmathroundto#1{% @@ -984,15 +362,20 @@ \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% \else - \advance\c@pgf@counta by1% counta:= total number of digits, N. - \c@pgf@countb=\c@pgf@counta - \divide\c@pgf@countb by3% countb := N DIV 3 - \c@pgf@countc=\c@pgf@countb - \multiply\c@pgf@countc by3 - \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3 - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign - }% + \ifnum\c@pgf@counta<\pgfkeysvalueof{/pgf/number format/min exponent for 1000 sep}\relax + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% + \else + \advance\c@pgf@counta by1 % counta:= total number of digits, N. + \c@pgf@countb=\c@pgf@counta + \divide\c@pgf@countb by3 % countb := N DIV 3 + \c@pgf@countc=\c@pgf@countb + \multiply\c@pgf@countc by3 + \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3 + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign + }% + \fi \fi \fi \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT @@ -1069,7 +452,7 @@ % \def\pgfmathfloat@loc@TMPc{#1#2#3}% % \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb % \else - % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}% + % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}{}% % \fi %-------------------------------------------------- \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax @@ -1120,7 +503,9 @@ % Input: % #1 the fixed point number to be displayed (maybe a macro). -% #2#3e#4: the (possibly unformatted) floating point representation which belongs to #1. +% #2#3e#4: the (possibly unformatted) floating point representation +% which belongs to #1. This format is returned (only!) by +% \pgfmathfloat@to@FMeE@style. % It is used to determine sign and exponent. \let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT @@ -1182,15 +567,15 @@ \or\pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax% \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% \or - \pgfmathfloatrounddisplaystyle@shared@impl@{NaN}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{NaN}{}% \or \ifpgfmathprintnumber@showpositive - \pgfmathfloatrounddisplaystyle@shared@impl@{+\infty}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}% \else - \pgfmathfloatrounddisplaystyle@shared@impl@{\infty}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}% \fi \or - \pgfmathfloatrounddisplaystyle@shared@impl@{-\infty}{}% + \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}% \fi } @@ -1203,6 +588,17 @@ }% \let\pgfmathresult=\pgfmathfloat@glob@TMP }% +% Same as \pgfmathfloatrounddisplaystyle@shared@impl@, but it also +% inserts the '@dec sep mark' at the end. +\def\pgfmathfloatrounddisplaystyle@shared@impl@@#1#2{% + {\toks0={#1}% + \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% + \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK + \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }% + }% + \let\pgfmathresult=\pgfmathfloat@glob@TMP +} \def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{% \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}% @@ -1210,6 +606,9 @@ \def\pgfmathfloatrounddisplaystyle@subscript#1#2e#3\relax{% \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}% } +\def\pgfmathfloatrounddisplaystyle@superscript#1#2e#3\relax{% + \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{^{#3}}% +} \def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{% \ifnum#3<0\relax {\count0=#3\relax @@ -1237,7 +636,7 @@ \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% } -% A macro which takes three arguments, sign, mantisse and exponent and +% A macro which takes the argument '<SIGN><MANTISSE>e<EXPONENT>' and % expands to the final TeX-representation for that floating point % number. % @@ -1245,9 +644,8 @@ % the floating point number has already been rounded properly and % the mantisse has been rounded correcty. % -% #1: SIGN -% #2: MANTISSE -% #3: EXPONENT +% The argument needs to be in the format returned by +% \pgfmathfloat@to@FMeE@style and terminated by '\relax'. \let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std \newif\ifpgfmathfloat@usezerofill@sci \newif\ifpgfmathfloat@usezerofill@fixed @@ -1278,6 +676,7 @@ @sci exponent mark/.initial=, set thousands separator/.initial=, 1000 sep/.style={/pgf/number format/set thousands separator=#1}, + min exponent for 1000 sep/.initial=0, use period/.style= {/pgf/number format/set decimal separator={.},/pgf/number format/set thousands separator={{{,}}}}, use comma/.style= {/pgf/number format/set decimal separator={{{,}}},/pgf/number format/set thousands separator={.}}, showpos/.is if=pgfmathprintnumber@showpositive, @@ -1293,6 +692,7 @@ sci e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@e}, sci E/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@E}, sci subscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@subscript}, + sci superscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@superscript}, % sci may skip mantisse/.is if=pgfmathfloatround@allow@empty@mantisse, % sci may skip mantisse/.default=true, } @@ -1302,6 +702,7 @@ \def\pgfmathprintnumber@STD#1{% % parse the input: \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax } @@ -1329,6 +730,7 @@ \def\pgfmathprintnumber@INT@TRUNC#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax } @@ -1338,7 +740,8 @@ } \def\pgfmathprintnumber@INT@TRUNC@issci#1#2e#3\relax{% \ifnum#1<3\relax - \pgfmathfloattofixed{#1#2e#3}% + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax \else \pgfmathfloatrounddisplaystyle#1#2e#3\relax% @@ -1348,13 +751,15 @@ \def\pgfmathprintnumber@INT@DETECT#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax } \def\pgfmathprintnumber@INT@DETECT@issci#1#2e#3\relax{% \begingroup \ifnum#1<3\relax - \pgfmathfloattofixed{#1#2e#3}% + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% \def\pgfmathfloat@round@precision{6}% \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% \ifpgfmathfloatroundhasperiod @@ -1371,13 +776,15 @@ \def\pgfmathprintnumber@FIXED#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax } \def\pgfmathprintnumber@FIXED@issci#1#2e#3\relax{% \begingroup \ifnum#1<3 - \pgfmathfloattofixed{#1#2e#3}% + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% \ifpgfmathfloat@usezerofill@fixed \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}% \else @@ -1401,15 +808,18 @@ \def\pgfmathprintnumber@SCI#1{% \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax } \def\pgfmathprintnumber@SCI@issci#1#2e#3\relax{% + \pgfmathfloatcreate{#1}{#2}{#3}% \ifpgfmathfloat@usezerofill@sci - \pgfmathfloatroundzerofill{#1#2e#3}% + \pgfmathfloatroundzerofill{\pgfmathresult}% \else - \pgfmathfloatround{#1#2e#3}% + \pgfmathfloatround{\pgfmathresult}% \fi + \pgfmathfloat@to@FMeE@style\pgfmathresult \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax } @@ -1426,6 +836,7 @@ \def\pgfmathprintnumber@noopt#1{% \pgfmathprintnumber@{#1}% \ifpgfmathprintnumber@assumemathmode + \pgfmathresult \else \pgfutilensuremath{\pgfmathresult}% \fi @@ -1435,6 +846,7 @@ \pgfqkeys{/pgf/number format}{#1}% \pgfmathprintnumber@{#2}% \ifpgfmathprintnumber@assumemathmode + \pgfmathresult \else \pgfutilensuremath{\pgfmathresult}% \fi @@ -1519,12 +931,12 @@ % current TeX group. % \ifpgfmathfloatroundmayneedrenormalize will be set globally \def\pgfmathroundto@impl#1{% + \edef\pgfmathround@input{#1}% \global\pgfmathfloatroundmayneedrenormalizefalse \pgfmathfloat@tmptoks={}% \let\pgfmathround@next=\pgfutil@empty \let\pgfmathround@cur=\pgfutil@empty \let\pgfmathresult=\pgfutil@empty - \edef\pgfmathround@input{#1}% \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax \c@pgfmathroundto@lastzeros=0 \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far @@ -1628,14 +1040,14 @@ \fi \else %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec - % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}% + % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}{}% %\fi \pgfmathroundto@impl@finish@with@truncation \fi \else %\ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec %\else - % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}% + % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}{}% %\fi \expandafter\ifnum\pgfmathround@next<5\relax \pgfmathroundto@impl@finish@with@truncation @@ -1909,7 +1321,7 @@ \fi \advance\pgfmathfloat@a@E by1 \fi - \edef\pgfmathresult{\the\pgfmathfloat@a@S\pgfmathresult e\the\pgfmathfloat@a@E}% + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}% } \def\pgfmathfloatround@impl@renormalize#1#2.#3\pgfmathfloat@EOI{% @@ -1924,12 +1336,36 @@ % collects everything into \pgfmathresult \def\pgfmathfloattofixed@impl#1.#2\relax{% \ifnum\pgfmathfloat@a@E<0 - \pgfmathfloat@a@Mtok={0.}% - \pgfutil@loop - \ifnum\pgfmathfloat@a@E<-1 - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% - \advance\pgfmathfloat@a@E by1 - \pgfutil@repeat + \ifcase-\pgfmathfloat@a@E + \or%e-1 + \pgfmathfloat@a@Mtok={0.}% + \or%e-2 + \pgfmathfloat@a@Mtok={0.0}% + \or%e-3 + \pgfmathfloat@a@Mtok={0.00}% + \or%e-4 + \pgfmathfloat@a@Mtok={0.000}% + \or%e-5 + \pgfmathfloat@a@Mtok={0.0000}% + \or%e-6 + \pgfmathfloat@a@Mtok={0.00000}% + \or%e-7 + \pgfmathfloat@a@Mtok={0.000000}% + \or%e-8 + \pgfmathfloat@a@Mtok={0.0000000}% + \or%e-9 + \pgfmathfloat@a@Mtok={0.00000000}% + \or%e-10 + \pgfmathfloat@a@Mtok={0.000000000}% + \else%<= -11 + \pgfmathfloat@a@Mtok={0.0000000000}% + \advance\pgfmathfloat@a@E by10 + \pgfutil@loop + \ifnum\pgfmathfloat@a@E<-1 + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% + \advance\pgfmathfloat@a@E by1 + \pgfutil@repeat + \fi \def\pgfmathfloat@loc@TMPb{#2}% \def\pgfmathfloat@loc@TMPc{0}% \ifx\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPc @@ -1938,15 +1374,48 @@ \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}% \fi \else - \ifnum\pgfmathfloat@a@E=0% - \edef\pgfmathresult{#1.#2}% - \else - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloattofixed@impl@collectmantisse#2\count\pgfmathfloat@a@E - \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% - \fi + %-------------------------------------------------- + % \ifnum\pgfmathfloat@a@E=0% + % \edef\pgfmathresult{#1.#2}% + % \else + % \pgfmathfloat@a@Mtok={#1}% + % \pgfmathfloattofixed@impl@collectmantisse#2\count\pgfmathfloat@a@E + % \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% + % \fi + %-------------------------------------------------- + \pgfmathfloat@a@Mtok{#1}% + \pgfmathfloattofixed@impl@pos#2000000000\pgfmathfloat@EOI + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% + \fi +} + +% FIXME: this implementation here is very fast, but it introduces trailing zeros. Is that acceptable? +\def\pgfmathfloattofixed@impl@pos#1#2#3#4#5#6#7#8#9\pgfmathfloat@EOI{% + \ifcase\pgfmathfloat@a@E + % e+0 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok .#1#2#3#4#5#6#7#8#9}% + \or%e+1 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1.#2#3#4#5#6#7#8#9}% + \or%e+2 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2.#3#4#5#6#7#8#9}% + \or%e+3 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3.#4#5#6#7#8#9}% + \or%e+4 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4.#5#6#7#8#9}% + \or%e+5 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5.#6#7#8#9}% + \or%e+6 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6.#7#8#9}% + \or%e+7 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7.#8#9}% + \or%e+8 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8.#9}% + \else%>=9 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8}% + \advance\pgfmathfloat@a@E by-8 + \pgfmathfloattofixed@impl@collectmantisse#9\count\pgfmathfloat@a@E \fi -} +}% \def\pgfmathfloattofixed@impl@collectmantisse#1#2\count#3{% \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}% @@ -1977,117 +1446,124 @@ % % ============================================ - % accepted parser tokens: -\def\pgfmathfloatparsenumber@tok@ONE{1} -\def\pgfmathfloatparsenumber@tok@TWO{2} -\def\pgfmathfloatparsenumber@tok@THREE{3} -\def\pgfmathfloatparsenumber@tok@FOUR{4} -\def\pgfmathfloatparsenumber@tok@FIVE{5} -\def\pgfmathfloatparsenumber@tok@SIX{6} -\def\pgfmathfloatparsenumber@tok@SEVEN{7} -\def\pgfmathfloatparsenumber@tok@EIGHT{8} -\def\pgfmathfloatparsenumber@tok@NINE{9} \def\pgfmathfloatparsenumber@tok@ZERO{0} -\def\pgfmathfloatparsenumber@tok@e{e} -\def\pgfmathfloatparsenumber@tok@E{E} \def\pgfmathfloatparsenumber@tok@PLUS{+} \def\pgfmathfloatparsenumber@tok@MINUS{-} -\def\pgfmathfloatparsenumber@tok@n{n} -\def\pgfmathfloatparsenumber@tok@N{N} -\def\pgfmathfloatparsenumber@tok@i{i} -\def\pgfmathfloatparsenumber@tok@I{I} \def\pgfmathfloatparsenumber@tok@PERIOD{.} \newif\ifpgfmathfloatparsenumberpendingperiod +\def\pgfflt@EOI{p@EOI}% + % Starts a finite-start-machine parser to read a number. % +% The machine's state is represented by the macro which is currently +% processed; state transitions are realised using \csname...#1\endcsname +% constructions. +% % It assigns \pgfmathfloat@a@S, \pgfmathfloat@a@Mtok, \pgfmathfloat@a@E. -\def\pgfmathfloatparsenumber@impl#1{% +\def\pgfflt@impl#1{% \pgfmathfloatparsenumberpendingperiodfalse \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS \pgfmathfloat@a@E=0 % start parsing: check for sign: - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PLUS - \pgfmathfloat@a@S=1\relax% - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}% + \expandafter\ifx\csname pgfflt@#1\endcsname\relax + \pgfmathfloat@a@S=1 + \expandafter\pgfflt@init\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@MINUS - \pgfmathfloat@a@S=2\relax% - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init}% - \else - \pgfmathfloat@a@S=1\relax% - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@init#1}% - \fi + \expandafter\expandafter\csname pgfflt@#1\endcsname + \fi +} +% State transitions: +\expandafter\def\csname pgfflt@+\endcsname{% + \pgfmathfloat@a@S=1 % + \pgfflt@init}% +\expandafter\def\csname pgfflt@-\endcsname{% + \pgfmathfloat@a@S=2 % + \pgfflt@init}% +\expandafter\def\csname pgfflt@\pgfflt@EOI\endcsname{% + \pgfmathfloatparsenumber@handleerror{empty number}{}{}}% + +\pgfkeys{ + /pgf/fpu/handlers/empty number/.style 2 args={% + /pgf/fpu/handlers/invalid number={#1}{#2}% + }, + /pgf/fpu/handlers/invalid number/.code 2 args={% + \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near '#2'.}{}% + }, +} + +% #1 the error handler +% #2 the number which was invalid. +% #3 the part which produced the error +\def\pgfmathfloatparsenumber@handleerror#1#2#3{% + \let\pgfmathresult=\pgfutil@empty + \pgfmathfloatparsenumberpendingperiodfalse + \pgfkeys{/pgf/fpu/handlers/#1={#2}{#3}}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloat@a@S=3 + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0 + \else + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E \fi - \pgfmathfloatparsenumber@NEXT } +\def\pgfflt@error#1\pgfflt@EOI{% + \begingroup + \pgfmathfloat@a@Mtok={#1}% + \xdef\pgfmathfloat@glob@TMP{% + \noexpand\pgfmathfloatparsenumber@handleerror + {invalid number}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}% + \endgroup + \pgfmathfloat@glob@TMP +}% + -\def\pgfmathfloatparsenumber@sanitize@digit{% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ONE - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@TWO - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@THREE - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FOUR - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@FIVE - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SIX - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@SEVEN - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@EIGHT - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@NINE - \else - \def\pgfmathfloatparsenumber@NEXT{\expandafter\pgfmathfloatparsenumber@impl@error\pgfmathfloatparsenumber@curtok}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi -} % FROM: checksign. % -\def\pgfmathfloatparsenumber@impl@init#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@n - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readnan}% +\def\pgfflt@init#1{% + \expandafter\ifx\csname pgffltA@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@i - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readinf}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@leadingzero}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloatparsenumberpendingperiodtrue - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi - \fi - \fi - \pgfmathfloatparsenumber@NEXT -} - -\def\pgfmathfloatparsenumber@impl@error#1\pgfmathfloat@EOI{% - \begingroup + \expandafter\expandafter\csname pgffltA@#1\endcsname + \fi} +% state transitions: +\expandafter\def\csname pgffltA@0\endcsname{\pgfflt@leadingzero}% FIXME: inline optimization! +\expandafter\def\csname pgffltA@1\endcsname{\pgfflt@nonzerodigit1}% +\expandafter\def\csname pgffltA@2\endcsname{\pgfflt@nonzerodigit2}% +\expandafter\def\csname pgffltA@3\endcsname{\pgfflt@nonzerodigit3}% +\expandafter\def\csname pgffltA@4\endcsname{\pgfflt@nonzerodigit4}% +\expandafter\def\csname pgffltA@5\endcsname{\pgfflt@nonzerodigit5}% +\expandafter\def\csname pgffltA@6\endcsname{\pgfflt@nonzerodigit6}% +\expandafter\def\csname pgffltA@7\endcsname{\pgfflt@nonzerodigit7}% +\expandafter\def\csname pgffltA@8\endcsname{\pgfflt@nonzerodigit8}% +\expandafter\def\csname pgffltA@9\endcsname{\pgfflt@nonzerodigit9}% +\def\pgfflt@nonzerodigit#1{% \pgfmathfloat@a@Mtok={#1}% - \pgfmath@error{Could not read input number, sorry. The unreadable part was near '\the\pgfmathfloat@a@Mtok'.}% - \endgroup -}% + \pgfmathfloatparsenumberpendingperiodtrue + \pgfflt@positiveexp}% +\expandafter\def\csname pgffltA@n\endcsname{\pgfflt@readnan}% FIXME: inlining? +\expandafter\def\csname pgffltA@N\endcsname{\pgfflt@readNaN}% FIXME: inlining? +\expandafter\def\csname pgffltA@i\endcsname{\pgfflt@readinf}% FIXME: inlining? +\expandafter\def\csname pgffltA@I\endcsname{\pgfflt@readINF}% FIXME: inlining? -\def\pgfmathfloatparsenumber@impl@finish#1\pgfmathfloat@EOI{} +\def\pgfflt@finish#1\pgfflt@EOI{} -\def\pgfmathfloatparsenumber@impl@readnan an{% +\def\pgfflt@readnan an{% + \pgfmathfloat@a@S=3\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@finish +} +\def\pgfflt@readNaN aN{% \pgfmathfloat@a@S=3\relax% \pgfmathfloat@a@Mtok={0.0}% \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@finish + \pgfflt@finish } -\def\pgfmathfloatparsenumber@impl@readinf nf{% +\def\pgfflt@readinf nf{% \ifnum\pgfmathfloat@a@S=1 \pgfmathfloat@a@S=4\relax% \pgfmathfloat@a@Mtok={0.0}% @@ -2096,227 +1572,228 @@ \pgfmathfloat@a@Mtok={0.0}% \fi \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@finish + \pgfflt@finish } -\def\pgfmathfloatparsenumber@impl@leadingzero#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloatparsenumber@impl@leadingzero}% +\def\pgfflt@readINF NF{% + \ifnum\pgfmathfloat@a@S=1 + \pgfmathfloat@a@S=4\relax% + \pgfmathfloat@a@Mtok={0.0}% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@E=-1 - \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - }% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloatparsenumberpendingperiodtrue - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi + \pgfmathfloat@a@S=5\relax% + \pgfmathfloat@a@Mtok={0.0}% \fi - \pgfmathfloatparsenumber@NEXT + \pgfmathfloat@a@E=0% + \pgfflt@finish } +\def\pgfflt@leadingzero#1{% + \expandafter\ifx\csname pgffltB@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltB@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltB@0\endcsname{\pgfflt@leadingzero}% +\expandafter\def\csname pgffltB@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} +\expandafter\def\csname pgffltB@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfmathfloat@a@Mtok={0}\pgfflt@readlowlevelfloat}% +\expandafter\def\csname pgffltB@.\endcsname{% + \pgfmathfloat@a@E=-1 + \pgfflt@leadingzero@foundperiod}% +\expandafter\def\csname pgffltB@e\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@readexponent}% +\let\pgffltB@E=\pgffltB@e +\expandafter\def\csname pgffltB@\pgfflt@EOI\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0}% -\def\pgfmathfloatparsenumber@impl@leadingzero@foundperiod#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by-1 - \pgfmathfloatparsenumber@impl@leadingzero@foundperiod}% +\def\pgfflt@leadingzero@foundperiod#1{% + \expandafter\ifx\csname pgffltC@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - }% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloatparsenumberpendingperiodtrue - \pgfmathfloatparsenumber@impl@finish@number@after@period}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi - \pgfmathfloatparsenumber@NEXT -} + \expandafter\expandafter\csname pgffltC@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltC@0\endcsname{% + \advance\pgfmathfloat@a@E by-1 + \pgfflt@leadingzero@foundperiod}% +\expandafter\def\csname pgffltC@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@4\endcsname{\pgfmathfloat@a@Mtok={4}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@5\endcsname{\pgfmathfloat@a@Mtok={5}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@6\endcsname{\pgfmathfloat@a@Mtok={6}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@7\endcsname{\pgfmathfloat@a@Mtok={7}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% +\expandafter\def\csname pgffltC@e\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@readexponent}% +\let\pgffltC@E=\pgffltC@e +\expandafter\def\csname pgffltC@\pgfflt@EOI\endcsname{% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0}% -\def\pgfmathfloatparsenumber@impl@positiveexp#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by1 - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}% +\def\pgfflt@positiveexp#1{% + \expandafter\ifx\csname pgffltD@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by1 - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi + \expandafter\expandafter\csname pgffltD@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltD@0\endcsname{% + \advance\pgfmathfloat@a@E by1 + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros@positiveexp}% +\expandafter\def\csname pgffltD@1\endcsname{\pgffltD@nonzerodigit1}% +\expandafter\def\csname pgffltD@2\endcsname{\pgffltD@nonzerodigit2}% +\expandafter\def\csname pgffltD@3\endcsname{\pgffltD@nonzerodigit3}% +\expandafter\def\csname pgffltD@4\endcsname{\pgffltD@nonzerodigit4}% +\expandafter\def\csname pgffltD@5\endcsname{\pgffltD@nonzerodigit5}% +\expandafter\def\csname pgffltD@6\endcsname{\pgffltD@nonzerodigit6}% +\expandafter\def\csname pgffltD@7\endcsname{\pgffltD@nonzerodigit7}% +\expandafter\def\csname pgffltD@8\endcsname{\pgffltD@nonzerodigit8}% +\expandafter\def\csname pgffltD@9\endcsname{\pgffltD@nonzerodigit9}% +\expandafter\def\csname pgffltD@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfflt@readlowlevelfloat}% +\expandafter\def\csname pgffltD@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining? +\expandafter\def\csname pgffltD@e\endcsname{\pgfflt@readexponent}% FIXME : inlining? +\let\pgffltD@E=\pgffltD@e +\expandafter\def\csname pgffltD@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltD@nonzerodigit#1{% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@positiveexp}% -\def\pgfmathfloatparsenumber@impl@readexponent#1\pgfmathfloat@EOI{% +% Read a low-level floating point. +% Since we are in the second state, \pgfmathfloat@a@Mtok contains the +% FLAGS. The post-flags-char has also been read. +\def\pgfflt@readlowlevelfloat#1e#2]\pgfflt@EOI{% + \pgfmathfloatparsenumberpendingperiodfalse + \pgfmathfloat@a@S=\the\pgfmathfloat@a@Mtok\relax + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloat@a@E=#2 +}% + +\def\pgfflt@readexponent#1\pgfflt@EOI{% \advance\pgfmathfloat@a@E by#1\relax } -\def\pgfmathfloatparsenumber@impl@pendingzeros@positiveexp#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \advance\pgfmathfloat@a@E by1 - \pgfmathfloatparsenumber@impl@pendingzeros@positiveexp}% +\def\pgfflt@pendingzeros@positiveexp#1{% + \expandafter\ifx\csname pgffltE@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@PERIOD - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@finish@number@after@period}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \advance\pgfmathfloat@a@E by1 - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@positiveexp}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi - \fi + \expandafter\expandafter\csname pgffltE@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltE@0\endcsname{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \advance\pgfmathfloat@a@E by1 + \pgfflt@pendingzeros@positiveexp}% +\expandafter\def\csname pgffltE@1\endcsname{\pgffltE@nonzerodigit1}% +\expandafter\def\csname pgffltE@2\endcsname{\pgffltE@nonzerodigit2}% +\expandafter\def\csname pgffltE@3\endcsname{\pgffltE@nonzerodigit3}% +\expandafter\def\csname pgffltE@4\endcsname{\pgffltE@nonzerodigit4}% +\expandafter\def\csname pgffltE@5\endcsname{\pgffltE@nonzerodigit5}% +\expandafter\def\csname pgffltE@6\endcsname{\pgffltE@nonzerodigit6}% +\expandafter\def\csname pgffltE@7\endcsname{\pgffltE@nonzerodigit7}% +\expandafter\def\csname pgffltE@8\endcsname{\pgffltE@nonzerodigit8}% +\expandafter\def\csname pgffltE@9\endcsname{\pgffltE@nonzerodigit9}% +\expandafter\def\csname pgffltE@.\endcsname{\pgfflt@finish@number@after@period}% FIXME : inlining? +\def\pgffltE@e{\pgfflt@readexponent}% FIXME : inlining? +\let\pgffltE@E=\pgffltE@e +\expandafter\def\csname pgffltE@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltE@nonzerodigit#1{% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@positiveexp}% -\def\pgfmathfloatparsenumber@impl@finish@number@after@period#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfmathfloatparsenumber@impl@pendingzeros}% +\def\pgfflt@finish@number@after@period#1{% + \expandafter\ifx\csname pgffltF@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@finish@number@after@period}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi + \expandafter\expandafter\csname pgffltF@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltF@0\endcsname{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros}% +\expandafter\def\csname pgffltF@1\endcsname{\pgffltF@nonzerodigit1}% +\expandafter\def\csname pgffltF@2\endcsname{\pgffltF@nonzerodigit2}% +\expandafter\def\csname pgffltF@3\endcsname{\pgffltF@nonzerodigit3}% +\expandafter\def\csname pgffltF@4\endcsname{\pgffltF@nonzerodigit4}% +\expandafter\def\csname pgffltF@5\endcsname{\pgffltF@nonzerodigit5}% +\expandafter\def\csname pgffltF@6\endcsname{\pgffltF@nonzerodigit6}% +\expandafter\def\csname pgffltF@7\endcsname{\pgffltF@nonzerodigit7}% +\expandafter\def\csname pgffltF@8\endcsname{\pgffltF@nonzerodigit8}% +\expandafter\def\csname pgffltF@9\endcsname{\pgffltF@nonzerodigit9}% +\def\pgffltF@e{\pgfflt@readexponent}% +\let\pgffltF@E=\pgffltF@e +\expandafter\def\csname pgffltF@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltF@nonzerodigit#1{% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@finish@number@after@period}% -\def\pgfmathfloatparsenumber@impl@pendingzeros#1{% - \def\pgfmathfloatparsenumber@curtok{#1}% - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@ZERO - \def\pgfmathfloatparsenumber@NEXT{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfmathfloatparsenumber@impl@pendingzeros}% + +\def\pgfflt@pendingzeros#1{% + \expandafter\ifx\csname pgffltG@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@e - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloatparsenumber@tok@E - \def\pgfmathfloatparsenumber@NEXT{\pgfmathfloatparsenumber@impl@readexponent}% - \else - \ifx\pgfmathfloatparsenumber@curtok\pgfmathfloat@EOI - \def\pgfmathfloatparsenumber@NEXT{}% - \else - \def\pgfmathfloatparsenumber@NEXT{% - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfmathfloatparsenumber@impl@finish@number@after@period}% - \pgfmathfloatparsenumber@sanitize@digit - \fi\fi\fi + \expandafter\expandafter\csname pgffltG@#1\endcsname + \fi} +% State transitions: +\expandafter\def\csname pgffltG@0\endcsname{% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros}% +\expandafter\def\csname pgffltG@1\endcsname{\pgffltG@nonzerodigit1}% +\expandafter\def\csname pgffltG@2\endcsname{\pgffltG@nonzerodigit2}% +\expandafter\def\csname pgffltG@3\endcsname{\pgffltG@nonzerodigit3}% +\expandafter\def\csname pgffltG@4\endcsname{\pgffltG@nonzerodigit4}% +\expandafter\def\csname pgffltG@5\endcsname{\pgffltG@nonzerodigit5}% +\expandafter\def\csname pgffltG@6\endcsname{\pgffltG@nonzerodigit6}% +\expandafter\def\csname pgffltG@7\endcsname{\pgffltG@nonzerodigit7}% +\expandafter\def\csname pgffltG@8\endcsname{\pgffltG@nonzerodigit8}% +\expandafter\def\csname pgffltG@9\endcsname{\pgffltG@nonzerodigit9}% +\def\pgffltG@e{\pgfflt@readexponent}% FIXME: inlining? +\let\pgffltG@E=\pgffltG@e +\expandafter\def\csname pgffltG@\pgfflt@EOI\endcsname{}% NOP +\def\pgffltG@nonzerodigit#1{% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse \fi - \pgfmathfloatparsenumber@NEXT -} - - + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@finish@number@after@period}% +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex index 53b602b0d9a..03b56e28bdc 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.code.tex @@ -24,21 +24,35 @@ % %-------------------------------------------- -\input pgfplotsutil.code.tex +\edef\pgfplots@oldcatcodesemicolon{\the\catcode`\;}% +\catcode`\;=12 + +\input pgfplotscore.code.tex \input pgfplotsoldpgfsupp_loader.code.tex +\input pgfplotsutil.code.tex +\input pgfplotscolormap.code.tex \input pgfplots.stackedplots.code.tex +\input pgfplotscoordprocessing.code.tex +\input pgfplotsticks.code.tex + \usetikzlibrary{decorations,decorations.pathmorphing,decorations.pathreplacing} % FIXME: reduce number of variables! +\newif\ifpgfplots@bb@isactive \newif\ifpgfplots@xislinear \newif\ifpgfplots@yislinear +\newif\ifpgfplots@zislinear +\newif\ifpgfplots@axis@equal +\newif\ifpgfplots@axis@equal@image \newcount\pgfplots@numplots -\newdimen\pgfplots@xcoordminTEX -\newdimen\pgfplots@xcoordmaxTEX -\newdimen\pgfplots@ycoordminTEX -\newdimen\pgfplots@ycoordmaxTEX +\newdimen\pgfplots@xmin@reg +\newdimen\pgfplots@xmax@reg +\newdimen\pgfplots@ymin@reg +\newdimen\pgfplots@ymax@reg +\newdimen\pgfplots@zmin@reg +\newdimen\pgfplots@zmax@reg \newif\ifpgfplots@warn@for@filter@discards \newif\ifpgfplots@isuniformtick \newif\ifpgfplots@clip@limits @@ -46,40 +60,50 @@ \newif\ifpgfplots@enlargelimits@rel@thresh \newif\ifpgfplots@enlargelimits@auto \newif\ifpgfplots@tickshow +\newif\ifpgfplots@scatterplotenabled \newif\ifpgfplots@xminorticks \newif\ifpgfplots@xmajorticks \newif\ifpgfplots@yminorticks \newif\ifpgfplots@ymajorticks +\newif\ifpgfplots@zminorticks +\newif\ifpgfplots@zmajorticks \newif\ifpgfplots@xminorgrids \newif\ifpgfplots@xmajorgrids \newif\ifpgfplots@yminorgrids \newif\ifpgfplots@ymajorgrids +\newif\ifpgfplots@zminorgrids +\newif\ifpgfplots@zmajorgrids \newif\ifpgfplots@clip@marker@paths \newif\ifpgfplots@axis@on@top \newif\ifpgfplots@separate@axis@lines -\newif\ifpgfplots@scaled@ticks@x -\newif\ifpgfplots@scaled@ticks@y \newif\ifpgfplots@identify@log@minor@tick@pos -\newif\ifpgfplots@disablelogfilter +\newif\ifpgfplots@disablelogfilter@x +\newif\ifpgfplots@disablelogfilter@y +\newif\ifpgfplots@disablelogfilter@z \newif\ifpgfplots@disabledatascaling \newif\ifpgfplots@hide@x \newif\ifpgfplots@hide@y +\newif\ifpgfplots@hide@z \newif\ifpgfplots@is@old@list@format \newif\ifpgfplots@errorbars@enabled \newif\ifpgfplots@scale@only@axis \newif\ifpgfplots@xticklabel@interval \newif\ifpgfplots@yticklabel@interval -\newif\ifpgfplots@stacked@x +\newif\ifpgfplots@zticklabel@interval \newif\ifpgfplots@stackedmode \newif\ifpgfplots@stacked@reverse \newif\ifpgfplots@stacked@plus \newif\ifpgfplots@plot@file@skipfirst +\newif\ifpgfplots@threedim +\newif\ifpgfplots@curplot@isirrelevant +\newif\ifpgfplots@perpointmeta@usesfloat \let\pgfnodepartimagebox=\pgfnodeparttextbox \newif\ifpgfplots@collect@firstplot@astick \def\pgfplots@errorbars@xdirection{0}% pre-init, see below \def\pgfplots@errorbars@ydirection{0}% +\def\pgfplots@errorbars@zdirection{0}% \def\axisdefaultwidth{240pt} \def\axisdefaultheight{207pt} @@ -93,9 +117,9 @@ % #2: the list entries. You can use either a comma-separated list or % a '\\'-terminated list. The latter case also requires '\\' % AFTER the last entry. -\def\pgfcreateplotcyclelist#1#2{\pgfplots@assign@list#1{#2}} +\def\pgfplotscreateplotcyclelist#1#2{\expandafter\pgfplots@assign@list\csname pgfp@cyclist@\string#1@\endcsname{#2}} -\pgfcreateplotcyclelist{\blackwhiteplotspeclist}{% +\pgfplotscreateplotcyclelist{black white}{% every mark/.append style={fill=gray},mark=*\\% every mark/.append style={fill=gray},mark=square*\\% every mark/.append style={fill=gray},mark=otimes*\\% @@ -107,7 +131,8 @@ densely dashed,every mark/.append style={solid},mark=star\\% densely dashed,every mark/.append style={solid,fill=gray},mark=diamond*\\% } -\pgfcreateplotcyclelist{\coloredplotspeclist}{% + +\pgfplotscreateplotcyclelist{color}{% blue,every mark/.append style={fill=blue!80!black},mark=*\\% red,every mark/.append style={fill=red!80!black},mark=square*\\% brown!60!black,every mark/.append style={fill=brown!80!black},mark=otimes*\\% @@ -119,6 +144,25 @@ blue,densely dashed,mark=star,every mark/.append style=solid\\% red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% } +\pgfplotscreateplotcyclelist{exotic}{% + teal,every mark/.append style={fill=teal!80!black},mark=*\\% + orange,every mark/.append style={fill=orange!80!black},mark=square*\\% + cyan!60!black,every mark/.append style={fill=cyan!80!black},mark=otimes*\\% + red!70!white,mark=star\\% + lime!80!black,every mark/.append style={fill=lime},mark=diamond*\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\% + yellow!60!black,densely dashed,every mark/.append style={solid,fill=yellow!80!black},mark=square*\\% + black,every mark/.append style={solid,fill=gray},mark=otimes*\\% + blue,densely dashed,mark=star,every mark/.append style=solid\\% + red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\% +} + + +% backwards compatibility: +\let\pgfcreateplotcyclelist=\pgfplotscreateplotcyclelist +\pgfplots@letcsname{pgfp@cyclist@\string\blackwhiteplotspeclist @}={pgfp@cyclist@black white@}% +\pgfplots@letcsname{pgfp@cyclist@\string\coloredplotspeclist @}={pgfp@cyclist@color@}% +%%%% \def\pgfplotsset#{\pgfqkeys{/pgfplots}} @@ -137,6 +181,43 @@ }{}% }% +\def\pgfplots@scaled@ticks@setargs#1#2{% + \pgfutil@in@{:}{#2}% + \ifpgfutil@in@ + \pgfplots@scaled@ticks@setargs@{#1}#2\pgfplots@EOI + \else + \expandafter\pgfutil@in@\expandafter{\pgfplots@activecolon}{#2}% + \ifpgfutil@in@ + \pgfplots@scaled@ticks@setargs@active{#1}#2\pgfplots@EOI + \else + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2}% + \fi + \fi +}% +\def\pgfplots@scaled@ticks@setargs@#1#2:#3\pgfplots@EOI{% + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2=#3}% +} + +{ + \catcode`\:=\active + \gdef\pgfplots@scaled@ticks@setargs@active#1#2:#3\pgfplots@EOI{% + \pgfkeysalso{/pgfplots/scaled #1 ticks/#2=#3}% + } +} + +% does the work for '[xyz]ticklabel pos'. +% #1 : one of [xyz] +% #2 : an axis line spec. +\def\pgfplots@setticklabelpos@for#1#2{% + \pgfkeysifdefined{/pgfplots/#1ticklabel pos/#2/.@cmd}{% + \pgfkeysvalueof{/pgfplots/#1ticklabel pos/#2/.@cmd}\pgfeov + }{% + \expandafter\def\csname pgfplots@#1ticklabelaxisspec\endcsname{#2}% + }% +}% + + + \pgfkeys{% /pgfplots/search path for tikz/.unknown/.code={% \let\searchname=\pgfkeyscurrentname% @@ -174,6 +255,7 @@ /pgfplots/every axis plot/.belongs to family=/pgfplots/style commands, /pgfplots/every axis plot post/.style={}, /pgfplots/every axis plot post/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis plot}}, + /pgfplots/no markers/.style={/pgfplots/every axis plot post/.append style={mark=none}}, /pgfplots/every axis label/.style={}, /pgfplots/every axis label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis label}}, /pgfplots/every axis label/.belongs to family=/pgfplots/style commands, @@ -183,6 +265,9 @@ /pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, /pgfplots/every axis y label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis y label}}, /pgfplots/every axis y label/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis z label/.style={at={(0,0.5)},xshift=-35pt,rotate=90}, + /pgfplots/every axis z label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis z label}}, + /pgfplots/every axis z label/.belongs to family=/pgfplots/style commands, /pgfplots/every axis title/.style={at={(0.5,1)},above,yshift=6pt}, /pgfplots/every axis title/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis title}}, /pgfplots/every axis title/.belongs to family=/pgfplots/style commands, @@ -191,8 +276,10 @@ /pgfplots/every tick/.belongs to family=/pgfplots/style commands, /pgfplots/every inner x axis line/.style={}, /pgfplots/every inner y axis line/.style={}, + /pgfplots/every inner z axis line/.style={}, /pgfplots/every outer x axis line/.style={}, /pgfplots/every outer y axis line/.style={}, + /pgfplots/every outer z axis line/.style={}, /pgfplots/x axis line style/.style={ /pgfplots/every outer x axis line/.append style={#1}, /pgfplots/every inner x axis line/.append style={#1}, @@ -201,13 +288,19 @@ /pgfplots/every outer y axis line/.append style={#1}, /pgfplots/every inner y axis line/.append style={#1}, }, + /pgfplots/z axis line style/.style={ + /pgfplots/every outer z axis line/.append style={#1}, + /pgfplots/every inner z axis line/.append style={#1}, + }, /pgfplots/outer axis line style/.style={ /pgfplots/every outer x axis line/.append style={#1}, /pgfplots/every outer y axis line/.append style={#1}% + /pgfplots/every outer z axis line/.append style={#1}% }, /pgfplots/inner axis line style/.style={ /pgfplots/every inner x axis line/.append style={#1}, /pgfplots/every inner y axis line/.append style={#1}% + /pgfplots/every inner z axis line/.append style={#1}% }, /pgfplots/axis line style/.style={ /pgfplots/inner axis line style={#1}, @@ -239,6 +332,15 @@ /pgfplots/every major y tick/.style={}, /pgfplots/every major y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y tick}}, /pgfplots/every major y tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every z tick/.style={}, + /pgfplots/every z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick}}, + /pgfplots/every z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor z tick/.style={}, + /pgfplots/every minor z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor z tick}}, + /pgfplots/every minor z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/every major z tick/.style={}, + /pgfplots/every major z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major z tick}}, + /pgfplots/every major z tick/.belongs to family=/pgfplots/style commands, %/pgfplots/every axis grid/.style={help lines}, /pgfplots/every axis grid/.style={thin,black!25}, /pgfplots/every axis grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis grid}}, @@ -267,6 +369,15 @@ /pgfplots/every major y grid/.style={}, /pgfplots/every major y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y grid}}, /pgfplots/every major y grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every axis z grid/.style={}, + /pgfplots/every axis z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis z grid}}, + /pgfplots/every axis z grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every minor z grid/.style={}, + /pgfplots/every minor z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor z grid}}, + /pgfplots/every minor z grid/.belongs to family=/pgfplots/style commands, + /pgfplots/every major z grid/.style={}, + /pgfplots/every major z grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major z grid}}, + /pgfplots/every major z grid/.belongs to family=/pgfplots/style commands, /pgfplots/every tick label/.style={}, /pgfplots/every tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every tick label}}, /pgfplots/every tick label/.belongs to family=/pgfplots/style commands, @@ -300,6 +411,21 @@ /pgfplots/every y tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, /pgfplots/every y tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick scale label}}, /pgfplots/every y tick scale label/.belongs to family=/pgfplots/style commands, + /pgfplots/every z tick label/.style={}, + /pgfplots/every z tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick label}}, + /pgfplots/every z tick label/.belongs to family=/pgfplots/style commands, + /pgfplots/every extra z tick/.style={ + /pgfplots/log identify minor tick positions=true, + }, + /pgfplots/every extra z tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every extra z tick}}, + /pgfplots/every extra z tick/.belongs to family=/pgfplots/style commands, + /pgfplots/extra z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/extra z tick style/.code={% + \pgfkeysalso{/pgfplots/every extra z tick/.append style={#1}}% + }, + /pgfplots/every z tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em}, + /pgfplots/every z tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every z tick scale label}}, + /pgfplots/every z tick scale label/.belongs to family=/pgfplots/style commands, /pgfplots/every axis legend/.style={% cells={anchor=center}, inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em}, @@ -328,12 +454,23 @@ /pgfplots/yticklabel/.store in= \pgfplots@yticklabel, /pgfplots/yticklabel/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel=, + /pgfplots/zticklabels/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@zticklabels + \let\pgfplots@zticklabel=\pgfplots@user@ticklabel@list@z + }, + /pgfplots/zticklabel/.store in= \pgfplots@zticklabel, + /pgfplots/zticklabel/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel=, /pgfplots/x tick label as interval/.is if=pgfplots@xticklabel@interval, /pgfplots/x tick label as interval/.default=true, /pgfplots/x tick label as interval/.belongs to family=/pgfplots/tick, /pgfplots/y tick label as interval/.is if=pgfplots@yticklabel@interval, /pgfplots/y tick label as interval/.default=true, /pgfplots/y tick label as interval/.belongs to family=/pgfplots/tick, + /pgfplots/z tick label as interval/.is if=pgfplots@zticklabel@interval, + /pgfplots/z tick label as interval/.default=true, + /pgfplots/z tick label as interval/.belongs to family=/pgfplots/tick, /pgfplots/extra x tick label/.store in= \pgfplots@extra@xticklabel, /pgfplots/extra x tick label/.belongs to family=/pgfplots/tick, /pgfplots/extra x tick label=, @@ -346,6 +483,10 @@ \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@yticklabels \let\pgfplots@extra@yticklabel=\pgfplots@user@extra@ticklabel@list@y }, + /pgfplots/extra z tick labels/.code={% + \pgfplots@foreach@to@list{#1}\to\pgfplots@extra@zticklabels + \let\pgfplots@extra@zticklabel=\pgfplots@user@extra@ticklabel@list@z + }, /pgfplots/xtick/.store in= \pgfplots@xtick, /pgfplots/xtick/.belongs to family=/pgfplots/tick, /pgfplots/xtick=, @@ -367,17 +508,70 @@ /pgfplots/ytickten/.store in= \pgfplots@ytickten, /pgfplots/ytickten/.belongs to family=/pgfplots/tick, /pgfplots/ytickten=, - /pgfplots/tick scale label code/.code={$\cdot 10^{#1}$}, - /pgfplots/tick scale label code/.belongs to family=/pgfplots/tick, - /pgfplots/scaled x ticks/.is if=pgfplots@scaled@ticks@x, + /pgfplots/extra z tick label/.store in= \pgfplots@extra@zticklabel, + /pgfplots/extra z tick label/.belongs to family=/pgfplots/tick, + /pgfplots/extra z tick label=, + /pgfplots/ztick/.store in= \pgfplots@ztick, + /pgfplots/ztick/.belongs to family=/pgfplots/tick, + /pgfplots/ztick=, + /pgfplots/extra z ticks/.store in=\pgfplots@extra@ztick, + /pgfplots/extra z ticks/.belongs to family=/pgfplots/tick, + /pgfplots/extra z ticks=, + /pgfplots/ztickten/.store in= \pgfplots@ztickten, + /pgfplots/ztickten/.belongs to family=/pgfplots/tick, + /pgfplots/ztickten=, + /pgfplots/xtick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/xtick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/ytick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/ytick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/ztick scale label code/.code={$\cdot 10^{#1}$}, + /pgfplots/ztick scale label code/.belongs to family=/pgfplots/tick, + /pgfplots/tick scale label code/.style={% + /pgfplots/xtick scale label code={#1}, + /pgfplots/ytick scale label code={#1}% + /pgfplots/ztick scale label code={#1}% + },% + /pgfplots/scaled x ticks/.code={\pgfplots@scaled@ticks@setargs{x}{#1}}, + /pgfplots/scaled x ticks/false/.code= {\def\pgfplots@scaled@ticks@x@choice{0}}, + /pgfplots/scaled x ticks/true/.code= {\def\pgfplots@scaled@ticks@x@choice{1}}, + /pgfplots/scaled x ticks/base 10/.code= {\def\pgfplots@scaled@ticks@x@choice{2}\def\pgfplots@scaled@ticks@x@arg{#1}}, + /pgfplots/scaled x ticks/real/.code= {% + \def\pgfplots@scaled@ticks@x@choice{3}\def\pgfplots@scaled@ticks@x@arg{#1}% + \pgfkeys{/pgfplots/xtick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled x ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@x@choice{4}\def\pgfplots@scaled@ticks@x@arg##1{#2}% + \pgfkeys{/pgfplots/xtick scale label code/.code={#1}}}, /pgfplots/scaled x ticks/.belongs to family=/pgfplots/tick, /pgfplots/scaled x ticks=true, - /pgfplots/scaled y ticks/.is if=pgfplots@scaled@ticks@y, + /pgfplots/scaled y ticks/.code={\pgfplots@scaled@ticks@setargs{y}{#1}}, + /pgfplots/scaled y ticks/false/.code= {\def\pgfplots@scaled@ticks@y@choice{0}}, + /pgfplots/scaled y ticks/true/.code= {\def\pgfplots@scaled@ticks@y@choice{1}}, + /pgfplots/scaled y ticks/base 10/.code= {\def\pgfplots@scaled@ticks@y@choice{2}\def\pgfplots@scaled@ticks@y@arg{#1}}, + /pgfplots/scaled y ticks/real/.code= {% + \def\pgfplots@scaled@ticks@y@choice{3}\def\pgfplots@scaled@ticks@y@arg{#1}% + \pgfkeys{/pgfplots/ytick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled y ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@y@choice{4}\def\pgfplots@scaled@ticks@y@arg##1{#2}% + \pgfkeys{/pgfplots/ytick scale label code/.code={#1}}}, /pgfplots/scaled y ticks/.belongs to family=/pgfplots/tick, /pgfplots/scaled y ticks=true, + /pgfplots/scaled z ticks/.code={\pgfplots@scaled@ticks@setargs{z}{#1}}, + /pgfplots/scaled z ticks/false/.code= {\def\pgfplots@scaled@ticks@z@choice{0}}, + /pgfplots/scaled z ticks/true/.code= {\def\pgfplots@scaled@ticks@z@choice{1}}, + /pgfplots/scaled z ticks/base 10/.code= {\def\pgfplots@scaled@ticks@z@choice{2}\def\pgfplots@scaled@ticks@z@arg{#1}}, + /pgfplots/scaled z ticks/real/.code= {% + \def\pgfplots@scaled@ticks@z@choice{3}\def\pgfplots@scaled@ticks@z@arg{#1}% + \pgfkeys{/pgfplots/ztick scale label code/.code={$\cdot \pgfmathprintnumber{#1}$}}}, + /pgfplots/scaled z ticks/manual/.code 2 args= {% + \def\pgfplots@scaled@ticks@z@choice{4}\def\pgfplots@scaled@ticks@z@arg##1{#2}% + \pgfkeys{/pgfplots/ztick scale label code/.code={#1}}}, + /pgfplots/scaled z ticks/.belongs to family=/pgfplots/tick, + /pgfplots/scaled z ticks=true, /pgfplots/scaled ticks/.style={% /pgfplots/scaled x ticks=#1, - /pgfplots/scaled y ticks=#1}, + /pgfplots/scaled y ticks=#1, + /pgfplots/scaled z ticks=#1 + }, /pgfplots/scale ticks above exponent/.store in= \pgfplots@scale@ticks@above@exponent, /pgfplots/scale ticks above exponent/.belongs to family=/pgfplots/tick, /pgfplots/scale ticks above exponent=3, @@ -394,7 +588,13 @@ /pgfplots/minor x tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor y tick num/.initial=0, /pgfplots/minor y tick num/.belongs to family=/pgfplots/tick, - /pgfplots/minor tick num/.style={/pgfplots/minor x tick num=#1,/pgfplots/minor y tick num=#1}, + /pgfplots/minor z tick num/.initial=0, + /pgfplots/minor z tick num/.belongs to family=/pgfplots/tick, + /pgfplots/minor tick num/.style={ + /pgfplots/minor x tick num=#1, + /pgfplots/minor y tick num=#1, + /pgfplots/minor z tick num=#1, + }, /pgfplots/minor tick num/.belongs to family=/pgfplots/tick, /pgfplots/minor tick length/.estore in=\pgfplots@subtickwidth, /pgfplots/minor tick length/.belongs to family=/pgfplots/tick, @@ -451,30 +651,60 @@ /pgfplots/ytick pos/top/.style={/pgfplots/ytick pos/right}, /pgfplots/ytick pos/bottom/.style={/pgfplots/ytick pos/left}, /pgfplots/ytick pos=both, - /pgfplots/tickpos/.style={/pgfplots/xtick pos={#1},/pgfplots/ytick pos={#1}}, + /pgfplots/ztick pos/.is choice, + /pgfplots/ztick pos/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/left/.code ={\def\pgfplots@ztickposnum{1}}, + /pgfplots/ztick pos/left/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/right/.code ={\def\pgfplots@ztickposnum{3}}, + /pgfplots/ztick pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/both/.code ={\def\pgfplots@ztickposnum{0}}, + /pgfplots/ztick pos/both/.belongs to family=/pgfplots/tick, + /pgfplots/ztick pos/top/.style={/pgfplots/ztick pos/right}, + /pgfplots/ztick pos/bottom/.style={/pgfplots/ztick pos/left}, + /pgfplots/ztick pos=both, + /pgfplots/tickpos/.style={ + /pgfplots/xtick pos={#1}, + /pgfplots/ytick pos={#1}, + /pgfplots/ztick pos={#1} + }, /pgfplots/tickpos/.belongs to family=/pgfplots/tick, -% sets the tick LABEL position, \pgfplots@[xy]ticklabelposnum - /pgfplots/xticklabel pos/.is choice, +% sets the tick LABEL position, \pgfplots@[xy]ticklabelaxisspec +% to one of +% default : 0 +% left : 1 +% right : 3 + /pgfplots/xticklabel pos/.code={\pgfplots@setticklabelpos@for x{#1}}, /pgfplots/xticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelposnum{0}}, + /pgfplots/xticklabel pos/default/.code ={\def\pgfplots@xticklabelaxisspec{}}, /pgfplots/xticklabel pos/default/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/left/.code ={\def\pgfplots@xticklabelposnum{1}}, + /pgfplots/xticklabel pos/left/.code ={\def\pgfplots@xticklabelaxisspec{v00}}, /pgfplots/xticklabel pos/left/.belongs to family=/pgfplots/tick, - /pgfplots/xticklabel pos/right/.code ={\def\pgfplots@xticklabelposnum{3}}, + /pgfplots/xticklabel pos/right/.code ={\def\pgfplots@xticklabelaxisspec{v10}}, /pgfplots/xticklabel pos/right/.belongs to family=/pgfplots/tick, + /pgfplots/xticklabel pos/top/.style={/pgfplots/xticklabel pos/right}, + /pgfplots/xticklabel pos/bottom/.style={/pgfplots/xticklabel pos/left}, /pgfplots/xticklabel pos=default, - /pgfplots/yticklabel pos/.is choice, + /pgfplots/yticklabel pos/.code={\pgfplots@setticklabelpos@for y{#1}}, /pgfplots/yticklabel pos/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelposnum{0}}, + /pgfplots/yticklabel pos/default/.code ={\def\pgfplots@yticklabelaxisspec{}}, /pgfplots/yticklabel pos/default/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/left/.code ={\def\pgfplots@yticklabelposnum{1}}, + /pgfplots/yticklabel pos/left/.code ={\def\pgfplots@yticklabelaxisspec{0v0}}, /pgfplots/yticklabel pos/left/.belongs to family=/pgfplots/tick, - /pgfplots/yticklabel pos/right/.code ={\def\pgfplots@yticklabelposnum{3}}, + /pgfplots/yticklabel pos/right/.code ={\def\pgfplots@yticklabelaxisspec{1v0}}, /pgfplots/yticklabel pos/right/.belongs to family=/pgfplots/tick, /pgfplots/yticklabel pos/top/.style={/pgfplots/yticklabel pos/right}, /pgfplots/yticklabel pos/bottom/.style={/pgfplots/yticklabel pos/left}, /pgfplots/yticklabel pos=default, - /pgfplots/ticklabelpos/.style={/pgfplots/xticklabel pos={#1},/pgfplots/yticklabel pos={#1}}, + /pgfplots/zticklabel pos/.code={\pgfplots@setticklabelpos@for z{#1}}, + /pgfplots/zticklabel pos/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel pos/default/.code ={\def\pgfplots@zticklabelaxisspec{}}, + /pgfplots/zticklabel pos/default/.belongs to family=/pgfplots/tick, + /pgfplots/zticklabel pos=default, + /pgfplots/ticklabelpos/.style={ + /pgfplots/xticklabel pos={#1}, + /pgfplots/yticklabel pos={#1}, + % /pgfplots/zticklabel pos={#1}, + }, % sets \pgfplots@{x,y}tickalignnum to % inside=0 % outside=1 @@ -497,10 +727,20 @@ /pgfplots/ytick align/center/.code ={\def\pgfplots@ytickalignnum{2}}, /pgfplots/ytick align/center/.belongs to family=/pgfplots/tick, /pgfplots/ytick align=inside, + /pgfplots/ztick align/.is choice, + /pgfplots/ztick align/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/inside/.code ={\def\pgfplots@ztickalignnum{0}}, + /pgfplots/ztick align/inside/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/outside/.code ={\def\pgfplots@ztickalignnum{1}}, + /pgfplots/ztick align/outside/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align/center/.code ={\def\pgfplots@ztickalignnum{2}}, + /pgfplots/ztick align/center/.belongs to family=/pgfplots/tick, + /pgfplots/ztick align=inside, /pgfplots/tick align/.belongs to family=/pgfplots/tick, /pgfplots/tick align/.style={% /pgfplots/xtick align=#1, /pgfplots/ytick align=#1, + /pgfplots/ztick align=#1, },% % 'axis' options: /pgfplots/anchor/.belongs to family=/pgfplots, @@ -513,29 +753,37 @@ /pgfplots/ticks/none/.code={% \pgfplots@xminorticksfalse \pgfplots@yminorticksfalse + \pgfplots@zminorticksfalse \pgfplots@xmajorticksfalse \pgfplots@ymajorticksfalse + \pgfplots@zmajorticksfalse }, /pgfplots/ticks/major/.belongs to family=/pgfplots/tick, /pgfplots/ticks/major/.code={% \pgfplots@xminorticksfalse \pgfplots@yminorticksfalse + \pgfplots@zminorticksfalse \pgfplots@xmajortickstrue \pgfplots@ymajortickstrue + \pgfplots@zmajortickstrue }, /pgfplots/ticks/minor/.belongs to family=/pgfplots/tick, /pgfplots/ticks/minor/.code={% \pgfplots@xminortickstrue \pgfplots@yminortickstrue + \pgfplots@zminortickstrue \pgfplots@xmajorticksfalse \pgfplots@ymajorticksfalse + \pgfplots@zmajorticksfalse }, /pgfplots/ticks/both/.belongs to family=/pgfplots/tick, /pgfplots/ticks/both/.code={% \pgfplots@xminortickstrue \pgfplots@yminortickstrue + \pgfplots@zminortickstrue \pgfplots@xmajortickstrue \pgfplots@ymajortickstrue + \pgfplots@zmajortickstrue }, /pgfplots/ticks=both, /pgfplots/grid/.is choice, @@ -544,29 +792,37 @@ /pgfplots/grid/none/.code={% \pgfplots@xminorgridsfalse \pgfplots@yminorgridsfalse + \pgfplots@zminorgridsfalse \pgfplots@xmajorgridsfalse \pgfplots@ymajorgridsfalse + \pgfplots@zmajorgridsfalse }, /pgfplots/grid/major/.belongs to family=/pgfplots/tick, /pgfplots/grid/major/.code={% \pgfplots@xminorgridsfalse \pgfplots@yminorgridsfalse + \pgfplots@zminorgridsfalse \pgfplots@xmajorgridstrue \pgfplots@ymajorgridstrue + \pgfplots@zmajorgridstrue }, /pgfplots/grid/minor/.belongs to family=/pgfplots/tick, /pgfplots/grid/minor/.code={% \pgfplots@xminorgridstrue \pgfplots@yminorgridstrue + \pgfplots@zminorgridstrue \pgfplots@xmajorgridsfalse \pgfplots@ymajorgridsfalse + \pgfplots@zmajorgridsfalse }, /pgfplots/grid/both/.belongs to family=/pgfplots/tick, /pgfplots/grid/both/.code={% \pgfplots@xminorgridstrue \pgfplots@yminorgridstrue + \pgfplots@zminorgridstrue \pgfplots@xmajorgridstrue \pgfplots@ymajorgridstrue + \pgfplots@zmajorgridstrue }, /pgfplots/grid=none, /pgfplots/grid/.default=major, @@ -582,6 +838,12 @@ /pgfplots/ymajorticks/.is if=pgfplots@ymajorticks, /pgfplots/ymajorticks/.default=true, /pgfplots/ymajorticks/.belongs to family=/pgfplots/tick, + /pgfplots/zminorticks/.is if=pgfplots@zminorticks, + /pgfplots/zminorticks/.default=true, + /pgfplots/zminorticks/.belongs to family=/pgfplots/tick, + /pgfplots/zmajorticks/.is if=pgfplots@zmajorticks, + /pgfplots/zmajorticks/.default=true, + /pgfplots/zmajorticks/.belongs to family=/pgfplots/tick, /pgfplots/xminorgrids/.is if=pgfplots@xminorgrids, /pgfplots/xminorgrids/.default=true, /pgfplots/xminorgrids/.belongs to family=/pgfplots/tick, @@ -594,6 +856,12 @@ /pgfplots/ymajorgrids/.is if=pgfplots@ymajorgrids, /pgfplots/ymajorgrids/.default=true, /pgfplots/ymajorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/zminorgrids/.is if=pgfplots@zminorgrids, + /pgfplots/zminorgrids/.default=true, + /pgfplots/zminorgrids/.belongs to family=/pgfplots/tick, + /pgfplots/zmajorgrids/.is if=pgfplots@zmajorgrids, + /pgfplots/zmajorgrids/.default=true, + /pgfplots/zmajorgrids/.belongs to family=/pgfplots/tick, % legend options: /pgfplots/legend entries/.initial={}, /pgfplots/legend entries/.belongs to family=/pgfplots/legend, @@ -625,6 +893,8 @@ /pgfplots/xlabel/.belongs to family=/pgfplots/descriptions, /pgfplots/ylabel/.initial=, /pgfplots/ylabel/.belongs to family=/pgfplots/descriptions, + /pgfplots/zlabel/.initial=, + /pgfplots/zlabel/.belongs to family=/pgfplots/descriptions, /pgfplots/before end axis/.code=, /pgfplots/after end axis/.code=, /pgfplots/extra description/.code=, @@ -638,6 +908,10 @@ /pgfplots/clip limits/.default=true, /pgfplots/clip limits=true, /pgfplots/clip limits/.belongs to family=/pgfplots, + /pgfplots/axis equal/.is if=pgfplots@axis@equal, + /pgfplots/axis equal/.default=true, + /pgfplots/axis equal image/.is if=pgfplots@axis@equal@image, + /pgfplots/axis equal image/.default=true, /pgfplots/xmin/.belongs to family=/pgfplots, /pgfplots/xmin/.initial=, /pgfplots/xmax/.belongs to family=/pgfplots, @@ -646,12 +920,30 @@ /pgfplots/ymin/.initial=, /pgfplots/ymax/.belongs to family=/pgfplots, /pgfplots/ymax/.initial=, + /pgfplots/zmin/.belongs to family=/pgfplots, + /pgfplots/zmin/.initial=, + /pgfplots/zmax/.belongs to family=/pgfplots, + /pgfplots/zmax/.initial=, + /pgfplots/xtickmin/.belongs to family=/pgfplots, + /pgfplots/xtickmin/.initial=, + /pgfplots/xtickmax/.belongs to family=/pgfplots, + /pgfplots/xtickmax/.initial=, + /pgfplots/ytickmin/.belongs to family=/pgfplots, + /pgfplots/ytickmin/.initial=, + /pgfplots/ytickmax/.belongs to family=/pgfplots, + /pgfplots/ytickmax/.initial=, + /pgfplots/ztickmin/.belongs to family=/pgfplots, + /pgfplots/ztickmin/.initial=, + /pgfplots/ztickmax/.belongs to family=/pgfplots, + /pgfplots/ztickmax/.initial=, /pgfplots/stack plots/.is choice, /pgfplots/stack plots/.belongs to family=/pgfplots, - /pgfplots/stack plots/x/.code={\pgfplots@stacked@xtrue\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/x/.code={\def\pgfplots@stacked@dir{x}\pgfplots@stackedmodetrue}, /pgfplots/stack plots/x/.belongs to family=/pgfplots, - /pgfplots/stack plots/y/.code={\pgfplots@stacked@xfalse\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/y/.code={\def\pgfplots@stacked@dir{y}\pgfplots@stackedmodetrue}, /pgfplots/stack plots/y/.belongs to family=/pgfplots, + /pgfplots/stack plots/z/.code={\def\pgfplots@stacked@dir{z}\pgfplots@stackedmodetrue}, + /pgfplots/stack plots/z/.belongs to family=/pgfplots, /pgfplots/stack plots/false/.code={\pgfplots@stackedmodefalse}, /pgfplots/stack plots/false/.belongs to family=/pgfplots, /pgfplots/stack plots=false, @@ -672,6 +964,8 @@ /pgfplots/x filter/.belongs to family=/pgfplots, /pgfplots/y filter/.code={}, /pgfplots/y filter/.belongs to family=/pgfplots, + /pgfplots/z filter/.code={}, + /pgfplots/z filter/.belongs to family=/pgfplots, /pgfplots/skip coords between index/.style 2 args={% /pgfplots/x filter/.append code={% \ifnum\coordindex<#1\relax @@ -682,9 +976,25 @@ \fi} }, /pgfplots/xfilter/.initial=,% DEPRECATED - /pgfplots/xfilter/.belongs to family=/pgfplots, /pgfplots/yfilter/.initial=,% DEPRECATED - /pgfplots/yfilter/.belongs to family=/pgfplots, + /pgfplots/zfilter/.initial=,% DEPRECATED + % interpretation: + % if 'samples at'==empty && 'domain' == empty + % use tikz option processing! + % else if 'samples at' == empty + % use 'domain' + % else + % use 'samples at' + /pgfplots/domain/.initial=,% empty -> use value of /tikz/domain! see \pgfplots@validate@plot@domain@arguments + /pgfplots/samples at/.initial=,% empty -> use value of /tikz/samples at! + /pgfplots/samples/.initial=,% empty -> use /tikz/samples! + % and provide aliases in the '/pgfplots/' tree to avoid + % search path problems just for these two options: + /pgfplots/name/.belongs to family=/pgfplots/naming commands, + /pgfplots/name/.code={\pgfkeysalso{/tikz/name={#1}}}, + /pgfplots/alias/.belongs to family=/pgfplots/naming commands, + /pgfplots/alias/.code={\pgfkeysalso{/tikz/alias={#1}}}, + /pgfplots/y domain/.initial=-5:5, /pgfplots/width/.store in= \pgfplots@width, /pgfplots/width/.belongs to family=/pgfplots, /pgfplots/width=, @@ -701,22 +1011,42 @@ /pgfplots/enlarge x limits/.default=true, /pgfplots/enlarge y limits/.initial=auto, /pgfplots/enlarge y limits/.default=true, + /pgfplots/enlarge z limits/.initial=auto, + /pgfplots/enlarge z limits/.default=true, /pgfplots/enlargelimits/.style={% /pgfplots/enlarge x limits=#1,% /pgfplots/enlarge y limits=#1,% + /pgfplots/enlarge z limits=#1,% },% /pgfplots/enlargelimits/.default=true, - /pgfplots/x/.store in= \pgfplots@x, + /pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/x/.belongs to family=/pgfplots, - /pgfplots/x=,% is implicitly set by 'width' and/or '\axisdefaultwidth' - /pgfplots/y/.store in= \pgfplots@y, + /pgfplots/y/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth' /pgfplots/y/.belongs to family=/pgfplots, - /pgfplots/y=,% is implicitly set by 'width' and/or '\axisdefaultwidth' + /pgfplots/z/.initial=, + /pgfplots/z/.belongs to family=/pgfplots, + /pgfplots/view/.code 2 args={% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \let\pgfplots@view@pitch=\pgfutil@empty + \let\pgfplots@view@yaw=\pgfutil@empty + \else + \pgfmathparse{#1}\let\pgfplots@view@pitch=\pgfmathresult + \pgfmathparse{#2}\let\pgfplots@view@yaw=\pgfmathresult + \fi + }, + /pgfplots/view={}{}, /pgfplots/cycle list/.code={\pgfplots@assign@list\autoplotspeclist{#1}}, /pgfplots/cycle list/.belongs to family=/pgfplots, - /pgfplots/cycle list name/.code={\let\autoplotspeclist=#1\relax}, + /pgfplots/cycle list name/.code={% + \pgfutil@ifundefined{pgfp@cyclist@\string#1@}{% + \pgfplots@error{Sorry, there is no such cycle list named \string#1. Maybe you misspelled it?}% + }{% + \expandafter\let\expandafter\autoplotspeclist\csname pgfp@cyclist@\string#1@\endcsname + }% + }, /pgfplots/cycle list name/.belongs to family=/pgfplots, - /pgfplots/cycle list name=\coloredplotspeclist, + /pgfplots/cycle list name=color, /pgfplots/legend style/.belongs to family=/pgfplots/style commands, /pgfplots/legend style/.code={% \pgfkeysalso{/pgfplots/every axis legend/.append style={#1}}% @@ -733,6 +1063,10 @@ /pgfplots/y label style/.code={% \pgfkeysalso{/pgfplots/every axis y label/.append style={#1}}% }, + /pgfplots/z label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z label style/.code={% + \pgfkeysalso{/pgfplots/every axis z label/.append style={#1}}% + }, /pgfplots/title style/.belongs to family=/pgfplots/style commands, /pgfplots/title style/.code={% \pgfkeysalso{/pgfplots/every axis title/.append style={#1}}% @@ -749,6 +1083,10 @@ /pgfplots/y tick label style/.code={% \pgfkeysalso{/pgfplots/every y tick label/.append style={#1}}% }, + /pgfplots/z tick label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick label style/.code={% + \pgfkeysalso{/pgfplots/every z tick label/.append style={#1}}% + }, /pgfplots/x tick scale label style/.belongs to family=/pgfplots/style commands, /pgfplots/x tick scale label style/.code={% \pgfkeysalso{/pgfplots/every x scale tick label/.append style={#1}}% @@ -757,6 +1095,10 @@ /pgfplots/y tick scale label style/.code={% \pgfkeysalso{/pgfplots/every y scale tick label/.append style={#1}}% }, + /pgfplots/z tick scale label style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick scale label style/.code={% + \pgfkeysalso{/pgfplots/every z scale tick label/.append style={#1}}% + }, /pgfplots/tick style/.belongs to family=/pgfplots/style commands, /pgfplots/tick style/.code={% \pgfkeysalso{/pgfplots/every tick/.append style={#1}}% @@ -793,6 +1135,18 @@ /pgfplots/major y tick style/.code={% \pgfkeysalso{/pgfplots/every major y tick/.append style={#1}}% }, + /pgfplots/z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/z tick style/.code={% + \pgfkeysalso{/pgfplots/every z tick/.append style={#1}}% + }, + /pgfplots/minor z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor z tick style/.code={% + \pgfkeysalso{/pgfplots/every minor z tick/.append style={#1}}% + }, + /pgfplots/major z tick style/.belongs to family=/pgfplots/style commands, + /pgfplots/major z tick style/.code={% + \pgfkeysalso{/pgfplots/every major z tick/.append style={#1}}% + }, /pgfplots/grid style/.belongs to family=/pgfplots/style commands, /pgfplots/grid style/.code={% \pgfkeysalso{/pgfplots/every axis grid/.append style={#1}}% @@ -829,10 +1183,29 @@ /pgfplots/major y grid style/.code={% \pgfkeysalso{/pgfplots/every major y grid/.append style={#1}}% }, - /pgfplots/disablelogfilter/.is if=pgfplots@disablelogfilter, - /pgfplots/disablelogfilter/.default=true, - /pgfplots/disablelogfilter/.belongs to family=/pgfplots, - /pgfplots/disablelogfilter=false, + /pgfplots/y grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/y grid style/.code={% + \pgfkeysalso{/pgfplots/every axis z grid/.append style={#1}}% + }, + /pgfplots/minor z grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/minor z grid style/.code={% + \pgfkeysalso{/pgfplots/every minor z grid/.append style={#1}}% + }, + /pgfplots/major z grid style/.belongs to family=/pgfplots/style commands, + /pgfplots/major z grid style/.code={% + \pgfkeysalso{/pgfplots/every major z grid/.append style={#1}}% + }, + /pgfplots/disablelogfilter x/.is if=pgfplots@disablelogfilter@x, + /pgfplots/disablelogfilter x/.default=true, + /pgfplots/disablelogfilter y/.is if=pgfplots@disablelogfilter@y, + /pgfplots/disablelogfilter y/.default=true, + /pgfplots/disablelogfilter z/.is if=pgfplots@disablelogfilter@z, + /pgfplots/disablelogfilter z/.default=true, + /pgfplots/disablelogfilter/.style={ + /pgfplots/disablelogfilter x=#1, + /pgfplots/disablelogfilter y=#1, + /pgfplots/disablelogfilter z=#1, + }, /pgfplots/disabledatascaling/.is if=pgfplots@disabledatascaling, /pgfplots/disabledatascaling/.default=true, /pgfplots/disabledatascaling/.belongs to family=/pgfplots, @@ -843,9 +1216,13 @@ /pgfplots/hide y axis/.is if=pgfplots@hide@y, /pgfplots/hide y axis/.default=true, /pgfplots/hide y axis=false, + /pgfplots/hide z axis/.is if=pgfplots@hide@y, + /pgfplots/hide z axis/.default=true, + /pgfplots/hide z axis=false, /pgfplots/hide axis/.style={% /pgfplots/hide x axis=#1, /pgfplots/hide y axis=#1, + /pgfplots/hide z axis=#1, }, /pgfplots/hide axis/.default=true, /pgfplots/every non boxed x axis/.style={% @@ -858,8 +1235,14 @@ enlarge y limits=false, y axis line style={-stealth} }, + /pgfplots/every non boxed z axis/.style={% + ytick align=center, + enlarge z limits=false, + y axis line style={-stealth} + }, /pgfplots/every boxed x axis/.style={}, /pgfplots/every boxed y axis/.style={}, + /pgfplots/every boxed z axis/.style={}, % /pgfplots/hide axis/.belongs to family=/pgfplots, % sets \pgfplots@xaxislinesnum to % box=0 @@ -953,6 +1336,55 @@ }% },% /pgfplots/axis y line/none/.style ={axis y line*/none,hide y axis}, +% +% sets \pgfplots@zaxislinesnum to +% box=0 +% left=1 +% center=2 ( aliased with middle ) +% right=3 + /pgfplots/axis z line*/.is choice, + /pgfplots/axis z line*/box/.code ={\def\pgfplots@zaxislinesnum{0}\def\pgfplots@ztickposnum{0}}, + /pgfplots/axis z line*/left/.code ={\def\pgfplots@zaxislinesnum{1}\def\pgfplots@ztickposnum{1}}, + /pgfplots/axis z line*/center/.code ={\def\pgfplots@zaxislinesnum{2}\def\pgfplots@ztickposnum{2}}, + /pgfplots/axis z line*/middle/.style ={/pgfplots/axis z line*/center}, + /pgfplots/axis z line*/right/.code ={\def\pgfplots@zaxislinesnum{3}\def\pgfplots@ztickposnum{3}}, + /pgfplots/axis z line*/none/.code ={\def\pgfplots@zaxislinesnum{4}\def\pgfplots@ztickposnum{4}}, + /pgfplots/axis z line*=box, + % + /pgfplots/axis z line/.is choice, + /pgfplots/axis z line/box/.style ={ + /pgfplots/axis z line*/box, + /pgfplots/every boxed z axis + }, + /pgfplots/axis z line/left/.style ={ + /pgfplots/axis z line*/left, + /pgfplots/every non boxed z axis + }, + /pgfplots/axis z line/center/.code ={ + \ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then + \pgfkeysalso{% + /pgfplots/every axis z label/.style={at={(current axis.below origin)},anchor=south west}}% + \else + \pgfkeysalso{% + /pgfplots/every axis z label/.style={at={(current axis.above origin)},anchor=north west}}% + \fi + \pgfkeysalso{% + /pgfplots/axis z line*/center, + /pgfplots/every non boxed z axis}% + }, + /pgfplots/axis z line/middle/.style ={/pgfplots/axis z line/center}, + /pgfplots/axis z line/right/.code ={% + \ifnum\pgfplots@xaxislinesnum=2 + \pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}% + \fi + \pgfkeysalso{ + axis z line*/right, + %every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt}, + every axis z label/.style={at={(1,0.5)},xshift=33pt,rotate=90}, + /pgfplots/every non boxed z axis + }% + },% + /pgfplots/axis z line/none/.style ={axis z line*/none,hide z axis}, % set \pgfplots@xaxisdiscontnum % none = 0 % crunch = 1 @@ -979,6 +1411,19 @@ /pgfplots/axis y discontinuity/parallel/.code ={\def\pgfplots@yaxisdiscontnum{2}}, /pgfplots/axis y discontinuity/parallel/.belongs to family=/pgfplots, %/axis, /pgfplots/axis y discontinuity=none, +% set \pgfplots@yaxisdiscontnum +% none = 0 +% crunch = 1 +% open = 2 + /pgfplots/axis z discontinuity/.is choice, + /pgfplots/axis z discontinuity/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/none/.code ={\def\pgfplots@zaxisdiscontnum{0}}, + /pgfplots/axis z discontinuity/none/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/crunch/.code ={\def\pgfplots@zaxisdiscontnum{1}}, + /pgfplots/axis z discontinuity/crunch/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity/parallel/.code ={\def\pgfplots@zaxisdiscontnum{2}}, + /pgfplots/axis z discontinuity/parallel/.belongs to family=/pgfplots, %/axis, + /pgfplots/axis z discontinuity=none, /pgfplots/scale only axis/.is if=pgfplots@scale@only@axis, /pgfplots/scale only axis/.default=true, /pgfplots/scale only axis/.belongs to family=/pgfplots, @@ -1004,6 +1449,15 @@ /pgfplots/ymode/log/.code={\pgfplots@yislinearfalse}, /pgfplots/ymode/log/.belongs to family=/pgfplots/scale, /pgfplots/ymode=linear, + /pgfplots/zmode/.is choice, + /pgfplots/zmode/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/normal/.code={\pgfplots@zislineartrue}, + /pgfplots/zmode/normal/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/linear/.code={\pgfplots@zislineartrue}, + /pgfplots/zmode/linear/.belongs to family=/pgfplots/scale, + /pgfplots/zmode/log/.code={\pgfplots@zislinearfalse}, + /pgfplots/zmode/log/.belongs to family=/pgfplots/scale, + /pgfplots/zmode=linear, /pgfplots/error bars/x fixed/.code= \def\pgfplots@errorbars@xfixed{#1}\def\pgfplots@errorbars@xmode{0}, /pgfplots/error bars/x fixed relative/.code= \def\pgfplots@errorbars@xrel{#1}\def\pgfplots@errorbars@xmode{1}, /pgfplots/error bars/x explicit/.code= \def\pgfplots@errorbars@xmode{2}, @@ -1016,11 +1470,19 @@ /pgfplots/error bars/y explicit relative/.code= \def\pgfplots@errorbars@ymode{3}, /pgfplots/error bars/y fixed relative=0, /pgfplots/error bars/y fixed=0, + /pgfplots/error bars/z fixed/.code= \def\pgfplots@errorbars@zfixed{#1}\def\pgfplots@errorbars@zmode{0}, + /pgfplots/error bars/z fixed relative/.code= \def\pgfplots@errorbars@zrel{#1}\def\pgfplots@errorbars@zmode{1}, + /pgfplots/error bars/z explicit/.code= \def\pgfplots@errorbars@zmode{2}, + /pgfplots/error bars/z explicit relative/.code= \def\pgfplots@errorbars@zmode{3}, + /pgfplots/error bars/z fixed relative=0, + /pgfplots/error bars/z fixed=0, /pgfplots/error bars/x dir/.is choice, /pgfplots/error bars/x dir/none/.code={% \def\pgfplots@errorbars@xdirection{0}% \ifnum\pgfplots@errorbars@ydirection=0 - \pgfplots@errorbars@enabledfalse + \ifnum\pgfplots@errorbars@zdirection=0 + \pgfplots@errorbars@enabledfalse + \fi \fi }, /pgfplots/error bars/x dir/plus/.code= \def\pgfplots@errorbars@xdirection{1}\pgfplots@errorbars@enabledtrue, @@ -1031,13 +1493,28 @@ /pgfplots/error bars/y dir/none/.code={% \def\pgfplots@errorbars@ydirection{0}% \ifnum\pgfplots@errorbars@xdirection=0 - \pgfplots@errorbars@enabledfalse + \ifnum\pgfplots@errorbars@zdirection=0 + \pgfplots@errorbars@enabledfalse + \fi \fi }, /pgfplots/error bars/y dir/plus/.code= \def\pgfplots@errorbars@ydirection{1}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir/minus/.code= \def\pgfplots@errorbars@ydirection{2}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir/both/.code= \def\pgfplots@errorbars@ydirection{3}\pgfplots@errorbars@enabledtrue, /pgfplots/error bars/y dir=none, + /pgfplots/error bars/z dir/.is choice, + /pgfplots/error bars/z dir/none/.code={% + \def\pgfplots@errorbars@zdirection{0}% + \ifnum\pgfplots@errorbars@xdirection=0 + \ifnum\pgfplots@errorbars@ydirection=0 + \pgfplots@errorbars@enabledfalse + \fi + \fi + }, + /pgfplots/error bars/z dir/plus/.code= \def\pgfplots@errorbars@zdirection{1}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir/minus/.code= \def\pgfplots@errorbars@zdirection{2}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir/both/.code= \def\pgfplots@errorbars@zdirection{3}\pgfplots@errorbars@enabledtrue, + /pgfplots/error bars/z dir=none, /pgfplots/error bars/error mark/.initial={-}, /pgfplots/error bars/error mark options/.initial={rotate=90}, /pgfplots/error bars/error bar style/.code={% @@ -1083,6 +1560,17 @@ -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + % the '0.5*w' is for centering (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /pgfplots/error bars/draw error bar/.code 2 args={% +% FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% + \draw[xshift={\pgfkeysvalueof{/pgf/bar shift}}] + ##1 -- ##2 node[pos=1,sloped,allow upside down] {% + \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% + \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% + \pgfusepath{stroke}}% + }; + },% /tikz/ybar, }, /pgfplots/ybar/.default=2pt, @@ -1097,6 +1585,17 @@ -0.5*(\numplots*\pgfplotbarwidth + (\numplots-1)*#1) + % the '0.5*w' is for centering (.5+\plotnum)*\pgfplotbarwidth + \plotnum*#1},% + /pgfplots/error bars/draw error bar/.code 2 args={% +% FIXME: simplify this code! It is just a replication of the default error stuff together with an xshift! + \pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}% + \pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}% + \draw[yshift={\pgfkeysvalueof{/pgf/bar shift}}] + ##1 -- ##2 node[pos=1,sloped,allow upside down] {% + \expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{% + \expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}% + \pgfusepath{stroke}}% + }; + },% /tikz/xbar, }, /pgfplots/xbar/.default=2pt, @@ -1169,6 +1668,10 @@ }, /pgfplots/plot file/skip first/.is if=pgfplots@plot@file@skipfirst, /pgfplots/plot file/skip first/.default=true, + /pgfplots/plot file/.unknown/.code={% + \let\pgfplots@table@curkeyname=\pgfkeyscurrentname + \pgfqkeys{/pgfplots}{\pgfplots@table@curkeyname=##1}% + }, /pgfplots/clip marker paths/.is if=pgfplots@clip@marker@paths, /pgfplots/clip marker paths/.default=true, /pgfplots/axis on top/.is if=pgfplots@axis@on@top, @@ -1180,6 +1683,171 @@ /pgfplots/x coord inv trafo/.code={}, /pgfplots/y coord trafo/.code={}, /pgfplots/y coord inv trafo/.code={}, + /pgfplots/z coord trafo/.code={}, + /pgfplots/z coord inv trafo/.code={}, +% Set \pgfplots@perpointmeta@choice to +% 0: mi is not available/not used. +% 1: mi = xi +% 2: mi = yi +% 3: mi = zi +% 4: mi = given explicitly somehow +% 5: mi = given explicitly somehow AS SYMBOLIC CONSTANTS. + /pgfplots/point meta/.is choice, + /pgfplots/point meta/none/.code={ + \def\pgfplots@perpointmeta@choice{0}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/x/.code={ + \def\pgfplots@perpointmeta@choice{1}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/y/.code={ + \def\pgfplots@perpointmeta@choice{2}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/z/.code={ + \def\pgfplots@perpointmeta@choice{3}% + \def\pgfplots@perpointmeta@arg{}% + }, + /pgfplots/point meta/explicit/.code={ + \def\pgfplots@perpointmeta@choice{4}% + \def\pgfplots@perpointmeta@arg{#1}% + }, + /pgfplots/point meta/explicit symbolic/.code={ + \def\pgfplots@perpointmeta@choice{5}% + \def\pgfplots@perpointmeta@arg{#1}% + }, + /pgfplots/point meta/none, + /pgfplots/colormap name/.initial=hot, + /pgfplots/colormap/.code 2 args={ + \pgfplotscreatecolormap{#1}{#2}% + \pgfkeysdef{/pgfplots/colormap name}{#1}% + }, + /pgfplots/scatter/.is choice, + /pgfplots/scatter/false/.code={% + \pgfplots@scatterplotenabledfalse + }, + /pgfplots/scatter/true/.code={% + \pgfplots@scatterplotenabledtrue + % make sure there is a mark set! + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + \def\pgfplots@loc@TMPa{none}% + \ifx\tikz@plot@mark\pgfplots@loc@TMPa + % this here happens only in older versions of pgf. + \pgfqkeys{/tikz}{mark=*}% + \else + \ifx\tikz@plot@mark\pgfutil@empty + \pgfqkeys{/tikz}{mark=*}% + \fi + \fi + }, + /pgfplots/scatter/.default=true, + /pgfplots/scatter src/.style={/pgfplots/point meta=#1}, + /tikz/scatter/.style={/pgfplots/scatter=#1}, + % + % ARGUMENTS: the macros + % - \pgfplotspointmeta + % - \pgfplotspointmetarange + % - \pgfplotspointmetatransformed + % - \pgfplotspointmetatransformedrange + % are set during @pre marker code and @post marker code. + % '#1' is empty. + /pgfplots/scatter/@pre marker code/.code={}, + /pgfplots/scatter/@post marker code/.code={}, + /pgfplots/scatter/use mapped color/.style={ + /pgfplots/scatter/@pre marker code/.code={ + \expandafter\pgfplotscolormapfind\expandafter[\pgfplotspointmetatransformedrange] + [1.0] + {\pgfplotspointmetatransformed} + {\pgfkeysvalueof{/pgfplots/colormap name}} +%\message{Color for current point is RGB '\pgfmathresult' (determined using meta 'phi(\pgfplotspointmeta) = \pgfplotspointmetatransformed')}% + \def\pgfplots@loc@TMPb{\definecolor{mapped color}{rgb}} + \expandafter\pgfplots@loc@TMPb\expandafter{\pgfmathresult} + \scope[#1] + }, + /pgfplots/scatter/@post marker code/.code={\endscope} + }, + /pgfplots/scatter/use mapped color/.default={draw=mapped color!80!black,fill=mapped color}, + /pgfplots/scatter/use mapped color, + % expect '#1 = {<class>=<style>,<class>=<style>,...} where <class> + % is expected as SYMBOL, not as number. See 'point meta/explicit symbolic' + /pgfplots/scatter/classes/.code={% + % Step 1: remember the per class-styles as + % \csname pgfp@scatter@class@<class name>\endcsname + % -> this is done locally! + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \def\pgfplots@loc@TMPa##1=##2\relax{% + \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% + \t@pgfplots@tokb={\expandafter\def\csname pgfp@scatter@class@##1\endcsname{##2}}% + \xdef\pgfplots@glob@TMPa{\the\t@pgfplots@toka\the\t@pgfplots@tokb}% + }% + % accumulate the \def-macros in a global macro because + % \foreach is scoped: + \foreach \entry in {#1} {% + \edef\eentry{\entry}% + \expandafter\pgfplots@loc@TMPa\eentry\relax + }% + % do the assignments: + \pgfplots@glob@TMPa + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \pgfkeysdef{/pgfplots/scatter/@pre marker code}{% + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + \let\pgfplots@loc@TMPa=\pgfplotspointmeta + % + % ups - no styles available? Maybe something went + % wrong with the 'scatter src' key. Check whether it + % was accidentally a numerical style: + \ifnum\pgfplots@perpointmeta@choice=5 + \else + % ok, be fault tolerant and round to an integer: + \pgfmathfloattofixed{\pgfplotspointmeta}% + \begingroup + \pgfkeys{/pgf/number format/precision=0}% + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplotspointmeta=\pgfmathresult + \fi + % now, check again: + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + % still not possible? Then, try truncating the + % number to an integer. + \expandafter\pgfutil@in@\expandafter.\expandafter{\pgfplotspointmeta}% + \ifpgfutil@in@ + \def\pgfplots@loc@TMPb####1.####2\relax{\def\pgfplotspointmeta{####1}}% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax + \fi + % now, check again: + \pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{% + \pgfutil@ifundefined{pgfp@scatter@WARNING@\pgfplotspointmeta}{% + \pgfplots@warning{scatter/classes: can't find class for '\pgfplotspointmeta'!? Please make sure you have specified 'scatter src=explicit symbolic'. Ignoring class '\pgfplotspointmeta' (this message will not come again).}% + \expandafter\gdef\csname pgfp@scatter@WARNING@\pgfplotspointmeta\endcsname{ALREADY CHECKED}% + }{}% + \def\pgfplots@loc@TMPa{}% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + }{% + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname + }% + \expandafter\scope\expandafter[\pgfplots@loc@TMPa]% + }% + \pgfkeysdef{/pgfplots/scatter/@post marker code}{\endscope}% + }, + /pgfplots/refstyle/.code={% + \pgfutil@ifundefined{pgfplots@labelstyle@#1}{% + \G@refundefinedtrue + \@latex@warning{Reference `#1' on page \thepage \space undefined}% + }{% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@labelstyle@#1\endcsname}% + \expandafter\pgfkeysalso\expandafter{\the\t@pgfplots@toka}% + }% + },% + /pgfplots/forget plot/.is if=pgfplots@curplot@isirrelevant, + /pgfplots/forget plot/.default=true, } { @@ -1188,302 +1856,80 @@ \global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa } +% Only define if it is undefined. It may be possible that related libraries +% habe been loaded before pgfplots. +\pgfkeysifdefined{/pgfplots/@backgroundpath@hook}{\relax}{% + \pgfkeysdef{/pgfplots/@backgroundpath@hook}{}% +} + \def\pgfplots@cmdkey@alias#1=#2;{% \pgfkeysgetvalue{/pgfplots/#2/.@cmd}\pgfplots@glob@TMPa \pgfkeyslet{/pgfplots/#1/.@cmd}\pgfplots@glob@TMPa }% \pgfplots@cmdkey@alias xlabel style=x label style; \pgfplots@cmdkey@alias ylabel style=y label style; +\pgfplots@cmdkey@alias zlabel style=z label style; \pgfplots@cmdkey@alias xticklabel style=x tick label style; \pgfplots@cmdkey@alias yticklabel style=y tick label style; +\pgfplots@cmdkey@alias zticklabel style=z tick label style; %\pgfplots@cmdkey@alias xtick scale label style=x tick scale label style; %\pgfplots@cmdkey@alias ytick scale label style=y tick scale label style; \pgfplots@cmdkey@alias xtick style=x tick style; \pgfplots@cmdkey@alias ytick style=y tick style; +\pgfplots@cmdkey@alias ztick style=z tick style; -\newif\ifpgfplots@log@tick@isminor@tick@pos -% Checks whether the tick position given as #1.#2=log10(T) belongs to -% T=i*10^j with an integer i>1. -% -% If T=i*10^j, \ifpgfplots@log@tick@isminor@tick@pos will be set to true and -% \pgfmathresult will contain T. -% -% Otherwise, \ifpgfplots@log@tick@isminor@tick@pos will be set to false and -% pgfmathresult to #1.#2 + +% A backwards compatibility method which works as follows: +% if any user specified arguments exist for the 'domain' or 'samples +% at' or 'samples' keys, nothing is done. % -% Arguments: -% #1.#2 the value log10(T) +% It these keys are empty, we switch to backwards compatibility mode +% and acquire the key settings from tikz. % -% Implementation: -% if T = i*10^j, log10(T) = log10(i) + j. -% That means if log10(T) in \Z, we have T = 10^j. If not, we need to -% check wether i is an integer. Please note that log10(i) < 1. +% This allows something like +% \begin{tikzpicture}[samples=70,domain=1:5] +% \begin{axis} +% \addplot {x^2}; +% \end{axis} +% \end{tikzpicture} % -% Further note: log(T) < 0 <=> j<0. -% In case j<0, we have -% #1.#2 = j + log(i) -% = - ( -j - log(i) ) -% = - ( -j - 1 + (1-log(i)) ) -% = #1 '.' #2 [ up to the '0.' -% that means #1 = j-1 and #2 = 1-log(i). -\def\pgfplots@is@log@tick@a@minor@tick@pos#1.#2\relax{% - \pgfmathapproxequalto@{#1.#2}{#1.0}% - \ifpgfmathcomparison - % in MOST cases, this here will be true: - \pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \else - % I guess this won't happen too often. In fact, it's a very - % special case. - \begingroup - \c@pgf@counta=#1\relax - \ifnum\c@pgf@counta<0 - \advance\c@pgf@counta by-1 - \pgfmathsubtract@{1}{0.#2}% - \expandafter\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi\pgfmathresult\relax - \ifpgfplots@log@tick@isminor@tick@pos - \aftergroup\pgfplots@log@tick@isminor@tick@postrue - \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% - \else - \aftergroup\pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \fi +% POSTCONDITION: +% - \pgfplots@plot@domain = value of '/pgfplots/domain', +% - \pgfplots@plot@samples@at = the value of '/pgfplots/samples at', +% - \pgfplots@plot@samples = value of '/pgfplots/samples', +% the values after any backwards compatibility issues will be used. +\def\pgfplots@validate@plot@domain@arguments{% + \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain + \pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at + \ifx\pgfplots@plot@domain\pgfutil@empty + \ifx\pgfplots@plot@samples@at\pgfutil@empty + \pgfplots@gettikzinternal@keyval{samples at}{tikz@plot@samplesat}{-5,-4.6,...,5}% + \pgfkeyslet{/pgfplots/samples at}{\tikz@plot@samplesat}% + \let\pgfplots@plot@samples@at=\tikz@plot@samplesat \else - \pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#2\relax - \ifpgfplots@log@tick@isminor@tick@pos - \aftergroup\pgfplots@log@tick@isminor@tick@postrue - \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% - \else - \aftergroup\pgfplots@log@tick@isminor@tick@posfalse - \def\pgfmathresult{#1.#2}% - \fi + % routines should use \pgfplots@plot@samples@at. \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup \fi -} - -% expects a positive number. -\def\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#1\relax{% - \pgfplots@log@tick@isminor@tick@postrue - \pgfmathapproxequalto@{0.#1}{0.3010299956639}% - \ifpgfmathcomparison - \def\pgfmathresult{2}% - \else - \pgfmathapproxequalto@{0.#1}{0.4771212547196}% - \ifpgfmathcomparison - \def\pgfmathresult{3}% - \else - \pgfmathapproxequalto@{0.#1}{0.6020599913279}% - \ifpgfmathcomparison - \def\pgfmathresult{4}% - \else - \pgfmathapproxequalto@{0.#1}{0.698970004}% - \ifpgfmathcomparison - \def\pgfmathresult{5}% - \else - \pgfmathapproxequalto@{0.#1}{0.7781512503}% - \ifpgfmathcomparison - \def\pgfmathresult{6}% - \else - \pgfmathapproxequalto@{0.#1}{0.8450980400}% - \ifpgfmathcomparison - \def\pgfmathresult{7}% - \else - \pgfmathapproxequalto@{0.#1}{0.9030899869}% - \ifpgfmathcomparison - \def\pgfmathresult{8}% - \else - \pgfmathapproxequalto@{0.#1}{0.954242509439}% - \ifpgfmathcomparison - \def\pgfmathresult{9}% - \else - \pgfplots@log@tick@isminor@tick@posfalse - \fi - \fi - \fi - \fi - \fi - \fi - \fi + \pgfkeysgetvalue{/pgfplots/samples}\pgfplots@plot@samples + \ifx\pgfplots@plot@samples\pgfutil@empty + \pgfplots@gettikzinternal@keyval{samples}{tikz@plot@samples}{25}% + \pgfkeyslet{/pgfplots/samples}{\tikz@plot@samples}% + \let\pgfplots@plot@samples=\tikz@plot@samples \fi -} - +}% \def\pgfplots@set@at#1{\def\pgfplots@at{#1}}% - -% converts a comma-separated list (PGF foreach) to my internal list -% structure. -\long\def\pgfplots@foreach@to@list#1\to#2{% - \global\pgfplotslistnewempty\pgfplots@glob@TMPa - \begingroup - \foreach \pgfplots@i in {#1} {% - \expandafter\pgfplotslistpushbackglobal\pgfplots@i\to\pgfplots@glob@TMPa - }% - \endgroup - \pgfplotslistcopy\pgfplots@glob@TMPa\to#2\relax -} - -% Several tick options: +% DEPRECATED \long\def\axispreset#1{% \pgfplotsset{every axis/.append style={#1}}% } +% DEPRECATED \long\def\legendpreset#1{% \pgfplots@error{Sorry, legendpreset is now deprecated, along with the legend options text width and font. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}% } -% Checks whether we need to create a separate 'tick scale label', -% a node with ' * 10^3' on the side of the axis: -% -% PRECONDITION: -% Axis limits for #1 are given. I need their values before any data -% scale transformation has been applied. -% If -% \pgfplots@#1min@unscaled@as@float -% and -% \pgfplots@#1max@unscaled@as@float -% exist; I will use these macros. -% Otherwise, I will use \pgfplots@#1min and \pgfplots@#1max; -% assuming that no data scale transformation is active. -% FIXME : does that need further attention? -\def\pgfplots@init@scaled@tick@for#1{% - \begingroup - % the \pgfplots@xmin@unscaled@as@float is set just before the data - % scale transformation is initialised. - % - % The variables are empty if there is no datascale transformation. - \expandafter\let\expandafter\pgfplots@cur@min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname - \expandafter\let\expandafter\pgfplots@cur@max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname - % - \ifx\pgfplots@cur@min@unscaled\pgfutil@empty - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1min\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% - \let\pgfplots@cur@min@unscaled=\pgfmathresult - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1max\endcsname}% - \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% - \let\pgfplots@cur@max@unscaled=\pgfmathresult - \fi - % - \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E - \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E - \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E - \pgfmathfloat@b@E=\pgfmathfloat@a@E - \fi - \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@above@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E - % ok, scale it: - \multiply\pgfmathfloat@b@E by-1 - \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% - \else - \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@below@exponent}% - \expandafter\ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E - % ok, scale it: - \multiply\pgfmathfloat@b@E by-1 - \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% - \else - % no scaling necessary: - \xdef\pgfplots@glob@TMPa{0}% - \fi - \fi - \endgroup - \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% -} - -% x-axis tick labels for #1th tick -% #1: the axis (x or y) -% #2: the value -% #3,#4: coordinates for tikz -% #5: ticknumber -\def\pgfplots@show@ticklabel#1#2(#3,#4)#5{{% - \csname ifpgfplots@#1ticklabel@interval\endcsname - \pgfmathparse{#3}% - \edef\pgfplots@show@ticklabel@coord@x@new{\pgfmathresult pt}% - \pgfmathparse{#4}% - \edef\pgfplots@show@ticklabel@coord@y@new{\pgfmathresult pt}% - % - \pgfplots@show@ticklabel@{#1}{#2}% - \let\nexttick=\tick - \ifx\pgfplots@show@ticklabel@LASTTICK\pgfutil@empty - % its the first call. Simply remember arguments and wait - % for interval boundary before proceeding. - \else - % acquire options of first interval boundary: - \pgfplots@show@ticklabel@LASTTICK - % compute new node position: - \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#1\endcsname + \csname pgfplots@show@ticklabel@coord@#1@new\endcsname)}% - \expandafter\edef\csname pgfplots@show@ticklabel@coord@#1\endcsname{\pgfmathresult pt}% - \let\ticknum=\pgfplots@show@ticklabel@num\relax% - \let\tick=\pgfplots@show@ticklabel@tick% - \edef\pgfplots@loc@TMPa{at (\pgfplots@show@ticklabel@coord@x,\pgfplots@show@ticklabel@coord@y)}% - \expandafter\node\pgfplots@loc@TMPa - {\csname pgfplots@#1ticklabel\endcsname};% - \fi - \xdef\pgfplots@show@ticklabel@LASTTICK{% - \noexpand\def\noexpand\pgfplots@show@ticklabel@tick{\nexttick}% - \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@x{\pgfplots@show@ticklabel@coord@x@new}% - \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@y{\pgfplots@show@ticklabel@coord@y@new}% - \noexpand\edef\noexpand\pgfplots@show@ticklabel@num{#5}% - }% - \else - \let\ticknum=#5\relax% - \pgfplots@show@ticklabel@{#1}{#2}% - \node at (#3,#4) {\csname pgfplots@#1ticklabel\endcsname};% - \fi -}} - -% Defines \tick by applying any necessary math to the (possibly -% transformed) tick value #2. -% -% #1: axis (x or y) -% #2: tick value. -\def\pgfplots@show@ticklabel@#1#2{% - \csname ifpgfplots@apply@datatrafo@#1\endcsname - \csname pgfplots@inverse@datascaletrafo@#1\endcsname{#2}% - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% - }\relax - % .. and this here provides \tick as fixed point repr: - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\tick=\pgfmathresult - \else - \edef\tick{#2}% - \pgfplots@if{pgfplots@#1islinear}{% - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \pgfmathfloatparsenumber{#2}% - \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\tick=\pgfmathresult - }{}% - }{}% - \fi - \pgfkeysgetvalue{/pgfplots/#1 coord inv trafo/.@cmd}\pgfplots@loc@TMPa - \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key - \else - \let\pgfmathresult=\tick% - \expandafter\pgfplots@loc@TMPa\expandafter{\tick}\pgfeov - \let\tick=\pgfmathresult - \fi -}% - -\def\pgfplots@user@ticklabel@list@x{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@xticklabels\to\tick - \tick -} -\def\pgfplots@user@ticklabel@list@y{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@yticklabels\to\tick - \tick -} -\def\pgfplots@user@extra@ticklabel@list@x{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@xticklabels\to\tick - \tick -} -\def\pgfplots@user@extra@ticklabel@list@y{% - \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@yticklabels\to\tick - \tick -} - % #1 axis (x or y) % #2 the label @@ -1500,280 +1946,70 @@ {#1}; } -% Check if a label does not cross the x-axis -\def\pgfplots@ytick@check@tickshow{% - \pgfplots@tickshowtrue - \ifnum\pgfplots@yaxislinesnum=2\relax - \ifcase\pgfplots@xaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ycoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ZERO@y\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ycoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \fi - \fi -} -% Fills the macros -% \pgfplots@tick@beg@a \pgfplots@tick@end@a -% \pgfplots@tick@beg@b \pgfplots@tick@end@b -% with coordinates such that -% (\pgfplots@tick@beg@a,\pgfplots@tmpa) -- (\pgfplots@tick@end@a,\pgfplots@tmpa) -% produces a correct tick line. -% -% The '@b' variant is only used in case of \pgfplots@ytickposnum = 0 -% -% #1 : the current axis (x or y). -% #2 : the axis which is NOT fixed. For x tick lines, this is the y -% axis and for y tick lines, this is the x axis (#1 = x or y) -% #3 : the current tick width -\def\pgfplots@prepare@tick@offsets@for@#1#2#3{% - \ifcase\csname pgfplots@#1tickposnum\endcsname\relax - %(\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt) - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordminTEX\endcsname}}% - \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - % - %(\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#3, 0pt) - \edef\pgfplots@tick@beg@b{\pgf@sys@tonumber{\csname pgfplots@#2coordmaxTEX\endcsname}}% - \pgfmathadd@{\pgfplots@tick@beg@b}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@b=\pgfmathresult - \pgfmathsubtract@{\pgfplots@tick@beg@b}{#3}% - \edef\pgfplots@tick@beg@b{\pgfplots@tick@beg@b pt}% - \edef\pgfplots@tick@end@b{\pgfmathresult pt}% - \or - % (\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt); - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordminTEX\endcsname}}% - \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \or - % (\pgfplots@ZERO@x -\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #3, 0pt); - \pgf@xa=\csname pgfplots@ZERO@#2\endcsname - \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{\pgf@xa}}% - \pgfmathsubtract@{\pgfplots@loc@TMPa}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathadd@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \or - % (\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#3, 0pt); - \edef\pgfplots@tick@beg@a{\pgf@sys@tonumber{\csname pgfplots@#2coordmaxTEX\endcsname}}% - \pgfmathadd@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% - \let\pgfplots@tick@beg@a=\pgfmathresult - \pgfmathsubtract@{\pgfplots@tick@beg@a}{#3}% - \edef\pgfplots@tick@beg@a{\pgfplots@tick@beg@a pt}% - \edef\pgfplots@tick@end@a{\pgfmathresult pt}% - \fi -}% - -\def\pgfplots@drawyaxis@placecomputedtick{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tick@beg@a}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tick@end@a}{\pgfplots@tmpa}}% - \ifnum\pgfplots@ytickposnum=0\relax - \pgfpathmoveto{\pgfqpoint{\pgfplots@tick@beg@b}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tick@end@b}{\pgfplots@tmpa}}% - \fi -}% -\def\pgfplots@drawyaxis@placecomputedgridline{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@tmpa}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@xcoordmaxTEX}{\pgfplots@tmpa}}% -}% - -\newif\ifpgfplots@needsminorloop - -\def\pgfplots@draw@tick@scale@label@for#1{% - \csname ifpgfplots@#1islinear\endcsname - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \begingroup - \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% - \expandafter\c@pgf@counta\pgfplots@glob@TMPa\relax - \multiply\c@pgf@counta by-1 - \ifnum\c@pgf@counta=0\relax - \global\let\pgfplots@glob@TMPa=\pgfutil@empty - \else - \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% - \fi - \endgroup - \ifx\pgfplots@glob@TMPa\pgfutil@empty - \else - \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/tick scale label code/.@cmd}{\pgfplots@glob@TMPa}}% - \node - [% - xshift=\pgfplots@xcoordminTEX,% - yshift=\pgfplots@ycoordminTEX,% - x=\pgfplots@xcoordmaxTEX-\pgfplots@xcoordminTEX,% - y=\pgfplots@ycoordmaxTEX-\pgfplots@ycoordminTEX,% - /pgfplots/every tick label,% - /pgfplots/every #1 tick label,% - /pgfplots/every #1 tick scale label] - {\pgfplots@tick@scale@labels}; - \fi - }{\relax}% - \fi -} - -% Simply invokes the code of PGF key #1 with value #2, that means -% #1#2\pgfeov -\def\pgfplots@invoke@pgfkeyscode#1#2{% - \pgfkeysgetvalue{#1}\pgfplots@invoke@pgfkeyscode@CODE - \pgfplots@invoke@pgfkeyscode@CODE#2\pgfeov -} - -% Check if the current tick position, stored in \pgfplots@tmpa, -% does not cross the y-axis. -% -% This is just a special case for centered axis lines. -\def\pgfplots@xtick@check@tickshow{% - \pgfplots@tickshowtrue - \ifnum\pgfplots@xaxislinesnum=2\relax - \ifcase\pgfplots@yaxislinesnum\relax - \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@xcoordminTEX\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@ZERO@x\relax - \pgfplots@tickshowfalse - \fi - \or - \ifdim\pgfplots@tmpa=\pgfplots@xcoordmaxTEX\relax - \pgfplots@tickshowfalse - \fi - \fi - \fi -} - -\def\pgfplots@drawxaxis@placecomputedtick{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@beg@a}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@end@a}}% - \ifnum\pgfplots@xtickposnum=0\relax - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@beg@b}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@tick@end@b}}% - \fi -}% -\def\pgfplots@drawxaxis@placecomputedgridline{% - \pgfpathmoveto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordminTEX}}% - \pgfpathlineto{\pgfqpoint{\pgfplots@tmpa}{\pgfplots@ycoordmaxTEX}}% -}% - -% #1: axis (x or y) -% #2: axis index (0 or 1) -% #3: tick position list -\def\pgfplots@draw@extra@ticks@for#1#2#3{% - \begingroup - \pgfplots@scaled@ticks@xfalse - \pgfplots@scaled@ticks@yfalse - \csname pgfplots@#1minorticksfalse\endcsname - \csname pgfplots@#1minorgridsfalse\endcsname - \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname - \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP - \pgfplotsset{/pgfplots/every extra #1 tick}% FIXME : used 'search path for tikz' before... - \pgfplots@prepare@ticks@for{#3}{#1}{#2}% - \pgfplots@drawgridlines@for{#1}{#2}% - \pgfplots@drawticklines@for{#1}{#2}% - \pgfplots@drawticklabels@for{#1}{#2}% - \endgroup -} - -\def\pgfplots@drawaxis@innerlines{% - \ifpgfplots@hide@y\else - \ifnum\pgfplots@yaxislinesnum=2 - \draw[/pgfplots/every inner y axis line,% - decorate,% - ydiscont,% - decoration={pre length=\ydisstart, post length=\ydisend}] - (\pgfplots@ZERO@x, \pgfplots@ycoordminTEX) -- (\pgfplots@ZERO@x, \pgfplots@ycoordmaxTEX); - \fi - \fi - \ifpgfplots@hide@x\else - \ifnum\pgfplots@xaxislinesnum=2 - \draw[/pgfplots/every inner x axis line,% - decorate,% - xdiscont,% - decoration={pre length=\xdisstart, post length=\xdisend}] - (\pgfplots@xcoordminTEX, \pgfplots@ZERO@y) -- (\pgfplots@xcoordmaxTEX, \pgfplots@ZERO@y); - \fi +% #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA) +% #2: the 'b' axis on the orentied surface (the same as \pgfplotspointonorientedsurfaceB) +\def\pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3{% + \ifnum\csname pgfplots@#1axislinesnum\endcsname=2 + \draw[/pgfplots/every inner #1 axis line,% + decorate,% + #1discont,% + decoration={pre length=\csname #1disstart\endcsname, post length=\csname #1disend\endcsname}] + \pgfextra + \csname pgfplotspointonorientedsurfaceabsetupforset#3\endcsname{\csname pgfplots@logical@ZERO@#3\endcsname}{2}% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@logical@ZERO@#2\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@logical@ZERO@#2\endcsname}}% + \endpgfextra + ; \fi }% % Ok, we don't mind whether edges with thick lines look ugly. We just % draw separate lines. This here is necessary if we want arrow heads. -\def\pgfplots@drawaxis@outerlines@separate{% - \ifpgfplots@hide@x - \else - \scope[/pgfplots/every outer x axis line, - xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] - \ifcase\pgfplots@xaxislinesnum - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) }; - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \or - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) }; - \or - \or +% +% #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA) +% #2: the 'b' axis on the orentied surface (the same as \pgfplotspointonorientedsurfaceB) +\def\pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2{% + \scope[/pgfplots/every outer #1 axis line, + #1discont,decoration={pre length=\csname #1disstart\endcsname, post length=\csname #1disend\endcsname}] + \ifcase\csname pgfplots@#1axislinesnum\endcsname\relax + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \fi - \endscope - \fi - \ifpgfplots@hide@y - \else - \scope[/pgfplots/every outer y axis line, - ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] - \ifcase\pgfplots@yaxislinesnum - \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) }; + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% + \endpgfextra + }; + }{\relax}% + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% \draw decorate { - (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \or + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2max\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% + \endpgfextra + }; + }{\relax}% + \or + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% \draw decorate { - (\pgfplots@xcoordminTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordminTEX,\pgfplots@ycoordmaxTEX) }; - \or - \or + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2min\endcsname}}% + \endpgfextra + }; + }{\relax}% + \or + \or + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% \draw decorate { - (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordminTEX) - -- (\pgfplots@xcoordmaxTEX,\pgfplots@ycoordmaxTEX) }; - - \fi - \endscope + \pgfextra + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\csname pgfplots@#2max\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#2max\endcsname}}% + \endpgfextra + }; + }{\relax}% \fi + \endscope }% % This here is complicated: we try to create good edges and draw a @@ -1783,494 +2019,104 @@ % | | % | | % ----- +% +% ATTENTION: this thing is used IF AND ONLY IF d=2 and the axis is +% drawn as box. \def\pgfplots@drawaxis@outerlines@cycledpath{% \draw[ /pgfplots/every outer x axis line, % FIXME! these outer styles need much more attention :-( /pgfplots/every outer y axis line] - (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) + (\pgfplots@xmin, \pgfplots@ymin) \ifpgfplots@hide@y - { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } + { (\pgfplots@xmin, \pgfplots@ymax) } \else \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordmaxTEX) } + decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } + \or decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}] { -- (\pgfplots@xmin, \pgfplots@ymax) } + \or { (\pgfplots@xmin, \pgfplots@ymax) } + \or { (\pgfplots@xmin, \pgfplots@ymax) } \fi \fi \ifpgfplots@hide@x - { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } + { (\pgfplots@xmax, \pgfplots@ymax) } \else \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } - \or decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX) } + decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } + \or { (\pgfplots@xmax, \pgfplots@ymax) } + \or { (\pgfplots@xmax, \pgfplots@ymax) } + \or decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}] { -- (\pgfplots@xmax, \pgfplots@ymax) } \fi \fi \ifpgfplots@hide@y - { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } + { (\pgfplots@xmax, \pgfplots@ymin) } \else \ifcase\pgfplots@yaxislinesnum - decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } - \or decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordminTEX) } + decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } + \or { (\pgfplots@xmax, \pgfplots@ymin) } + \or { (\pgfplots@xmax, \pgfplots@ymin) } + \or decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}] { -- (\pgfplots@xmax, \pgfplots@ymin) } \fi \fi \ifpgfplots@hide@x - { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } + { (\pgfplots@xmin, \pgfplots@ymin) } \else \ifcase\pgfplots@xaxislinesnum - decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } - \or { (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) } + decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } + \or decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}] { -- (\pgfplots@xmin, \pgfplots@ymin) } + \or { (\pgfplots@xmin, \pgfplots@ymin) } + \or { (\pgfplots@xmin, \pgfplots@ymin) } \fi% can't use cycle here! \fi ; % -- cycle; }% -\def\pgfplots@drawaxis@outerlines{% - \ifnum\pgfplots@xaxislinesnum>0 - \pgfplots@separate@axis@linestrue - \fi - \ifnum\pgfplots@yaxislinesnum>0 - \pgfplots@separate@axis@linestrue - \fi - \ifpgfplots@separate@axis@lines - \pgfplots@drawaxis@outerlines@separate - \else - \pgfplots@drawaxis@outerlines@cycledpath - \fi -}% - -\def\pgfplots@drawaxis@lines{% - \begingroup - \begingroup - % this group employs several temporary dimension registers - % and is therefor scoped: - \let\ydisstart=\pgf@xa - \let\ydisend=\pgf@xb - \let\xdisstart=\pgf@ya - \let\xdisend=\pgf@yb - \ydisend=\pgfplots@ycoordmaxTEX - \advance \ydisend by -\pgfplots@ycoordminTEX - \ifcase\pgfplots@yaxisdiscontnum\relax - \let\ydiscontstyle=\pgfutil@empty - \or - \def\ydiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% - \advance \ydisend by -16pt - \or - \def\ydiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% - \advance \ydisend by -8pt - \fi - \ifpgfplots@apply@datatrafo@y - \advance \pgfplots@ycoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@y pt - \fi - \ifdim\pgfplots@ycoordmaxTEX<0pt - \ydisstart=\ydisend - \ydisend=4pt - \else - \ydisstart=4pt - \fi - \ifpgfplots@apply@datatrafo@y - \advance \pgfplots@ycoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@y pt - \fi - \xdisend=\pgfplots@xcoordmaxTEX - \advance \xdisend by -\pgfplots@xcoordminTEX - \ifcase\pgfplots@xaxisdiscontnum\relax - \let\xdiscontstyle=\pgfutil@empty - \or - \def\xdiscontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% - \advance \xdisend by -16pt - \or - \def\xdiscontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% - \advance \xdisend by -8pt - \fi - \ifpgfplots@apply@datatrafo@x - \advance \pgfplots@xcoordmaxTEX by\pgfplots@data@scale@trafo@SHIFT@x pt - \fi - \ifdim\pgfplots@xcoordmaxTEX<0pt - \xdisstart=\xdisend - \xdisend=4pt - \else - \xdisstart=4pt - \fi - \ifpgfplots@apply@datatrafo@x - \advance \pgfplots@xcoordmaxTEX by-\pgfplots@data@scale@trafo@SHIFT@x pt - \fi - % carry local computations outside of group: - \xdef\pgfplots@glob@TMPa{% - \noexpand\def\noexpand\xdisstart{\the\xdisstart}% - \noexpand\def\noexpand\xdisend{\the\xdisend}% - \noexpand\def\noexpand\ydisstart{\the\ydisstart}% - \noexpand\def\noexpand\ydisend{\the\ydisend}% - \noexpand\pgfkeys{% - /tikz/xdiscont/.style={\xdiscontstyle},% - /tikz/ydiscont/.style={\ydiscontstyle}}% - }% - \endgroup - \pgfplots@glob@TMPa - \pgfplots@drawaxis@outerlines% - \pgfplots@drawaxis@innerlines% - \endgroup -}% - -% Computes final major and minor tick positions into global lists -% \pgfplots@prepared@tick@positions@major@x -% and -% \pgfplots@prepared@tick@positions@minor@x. -% -% The major tick list contains tuples (canvas position,logical position) -% while the minor tick list contains just the canvas position. +% Assigns the macros +% #1disstart +% #1disend +% and the key /tikz/#1discont for use in the axis line routines. % -% #1: the tick list. -% #2: the axis name as character, i.e. 'x' or 'y' -% #3: the axis name as integer, i.e. 0 or 1 -\def\pgfplots@prepare@ticks@for#1#2#3{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#2islinear\endcsname - \expandafter\let\expandafter\ifpgfplots@minorticks\csname ifpgfplots@#2minorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@minorgrids\csname ifpgfplots@#2minorgrids\endcsname - % these lists need to be global such that I can fill them inside - % of \foreach statements. And, yes: I have also added a TeX group - % on my own (but that's not the problem). - \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@major - \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@minor - \edef\pgfplots@loc@TMPa{#1}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \ifpgfplots@minorticks - \pgfplots@needsminorlooptrue - \else - \ifpgfplots@minorgrids - \pgfplots@needsminorlooptrue - \else - \pgfplots@needsminorloopfalse - \fi - \fi - \ifpgfplots@needsminorloop - \ifpgfplots@islinear - \expandafter\let\expandafter\pgfplots@minor@tick@num\csname pgfplots@minor@#2tick@num\endcsname - \begingroup - \c@pgf@counta=\pgfplots@minor@tick@num\relax - \advance\c@pgf@counta by1\relax - \pgfplots@tmpa=\csname pgfplots@tick@distance@#2\endcsname pt - \divide\pgfplots@tmpa by\c@pgf@counta - \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpa}}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgfplots@minor@tick@dist=\pgfmathresult - \else - \def\pgfplots@minor@tick@num{9}% - \fi - \fi - \foreach \x in {#1} {% - \ifcase#3\relax - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\x}{0}}% - \or - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\x}}% - \fi - \csname pgfplots@#2tick@check@tickshow\endcsname - % - \ifpgfplots@tickshow - \ifdim\pgfplots@tmpa<\csname pgfplots@#2coordminTEX\endcsname - \else - \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname - \else - \edef\pgfplots@loc@TMPa{{\the\pgfplots@tmpa}{\x}}% - \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@prepared@tick@positions@major - \fi - \fi - \fi - % X-Axis ticks bottom and top - % in log: - % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9 - \ifpgfplots@needsminorloop - \foreach \pgfplots@i in {1,...,\pgfplots@minor@tick@num} {% - \begingroup - \ifcase#3\relax - \ifpgfplots@islinear - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\pgfplots@i*\pgfplots@minor@tick@dist}{0}}% - \else - \pgfextractx{\pgfplots@tmpa}{\pgfpointxy{\logi\pgfplots@i}{0}}% - \fi - \or - \ifpgfplots@islinear - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\pgfplots@i*\pgfplots@minor@tick@dist}}% - \else - \pgfextracty{\pgfplots@tmpa}{\pgfpointxy{0}{\logi\pgfplots@i}}% - \fi - \fi - \edef\pgfmathresult{\the\pgfplots@tmpa}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \advance\pgfplots@tmpa by\pgfmathresult\relax - \ifdim\pgfplots@tmpa<\csname pgfplots@#2coordminTEX\endcsname - \else - \ifdim\pgfplots@tmpa>\csname pgfplots@#2coordmaxTEX\endcsname - \else - \expandafter\pgfplotslistpushbackglobal\the\pgfplots@tmpa\to\pgfplots@prepared@tick@positions@minor - \fi - \fi - }% - \fi - }% - \fi - \endgroup - \expandafter\let\csname pgfplots@prepared@tick@positions@minor@#2\endcsname=\pgfplots@prepared@tick@positions@minor - \expandafter\let\csname pgfplots@prepared@tick@positions@major@#2\endcsname=\pgfplots@prepared@tick@positions@major - \global\let\pgfplots@prepared@tick@positions@major=\relax - \global\let\pgfplots@prepared@tick@positions@minor=\relax -}% - -% Converts the tuples in major tick lists into two separate variables. -% -% Usage: -% \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@x\as\curelement{% -% \expandafter\pgfplots@parse@prepared@major@tickpos\curelement\canvas\logical -% } -% -% #1#2 : the tuples as they are found in the prepared major tick list, -% #3 : a dimen register which will be filled with #1 -% #4 : a macro which will be assigned with #2 -\def\pgfplots@parse@prepared@major@tickpos#1#2#3#4{% - #3=#1\relax% - \def#4{#2}% -}% - - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawgridlines@for#1#2{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorgrids\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorgrids\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - \pgfplots@loop@CONTINUEfalse - \ifpgfplots@major - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@minor - \pgfplots@loop@CONTINUEtrue - \fi - \ifpgfplots@loop@CONTINUE - \scope - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \ifcase#2\relax - \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX-5cm) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX+5cm); - \or - \clip (\pgfplots@xcoordminTEX-5cm, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX+5cm, \pgfplots@ycoordmaxTEX); - \fi - \endpgfinterruptboundingbox% - \ifpgfplots@major - \draw[% - /pgfplots/every axis grid, - /pgfplots/every major grid, - /pgfplots/every axis #1 grid, - /pgfplots/every major #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curgridpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curgridpos\pgfplots@tmpa\pgfplots@curgridpos - \csname pgfplots@draw#1axis@placecomputedgridline\endcsname - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every axis grid, - /pgfplots/every minor grid, - /pgfplots/every axis #1 grid, - /pgfplots/every minor #1 grid]% - \pgfextra - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curgridpos{% - \pgfplots@tmpa=\pgfplots@curgridpos - \csname pgfplots@draw#1axis@placecomputedgridline\endcsname - }% - \endpgfextra; - \fi - \endscope - \fi - \endgroup -} - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawticklines@for#1#2{% - \scope - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorticks\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname - %\clip (\pgfplots@xcoordminTEX\pgfplots@leftover, \pgfplots@ycoordminTEX\pgfplots@leftover) - % rectangle (\pgfplots@xcoordmaxTEX\pgfplots@rightover, \pgfplots@ycoordmaxTEX\pgfplots@rightover); - \pgfinterruptboundingbox% - \ifcase#2\relax - \clip (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX-5cm) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX+5cm); - \or - \clip (\pgfplots@xcoordminTEX-5cm, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX+5cm, \pgfplots@ycoordmaxTEX); - \fi - \endpgfinterruptboundingbox% - \ifpgfplots@major - \draw[% - /pgfplots/every tick, - /pgfplots/every major tick, - /pgfplots/every #1 tick, - /pgfplots/every major #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@tickwidth}% - \let\pgfplots@tickwidth@=\pgfmathresult - \edef\pgfplots@tickwidth{\pgfplots@tickwidth@ pt}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0} - \or - \let\pgfplots@tick@offset=\pgfplots@tickwidth@% - \or - \pgfmathmultiply@{0.5}{\pgfplots@tickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% - \fi - \ifcase#2\relax - \pgfplots@prepare@tick@offsets@for@{#1}{y}{\pgfplots@tickwidth@}% - \else - \pgfplots@prepare@tick@offsets@for@{#1}{x}{\pgfplots@tickwidth@}% - \fi - \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curtickpos\pgfplots@tmpa\pgfplots@curtickpos - \csname pgfplots@draw#1axis@placecomputedtick\endcsname - }% - \endpgfextra; - \fi - % - \ifpgfplots@minor - \draw[% - /pgfplots/every tick, - /pgfplots/every minor tick, - /pgfplots/every #1 tick, - /pgfplots/every minor #1 tick]% - \pgfextra - \pgfmathparse{\pgfplots@subtickwidth}% - \let\pgfplots@subtickwidth@=\pgfmathresult - \edef\pgfplots@subtickwidth{\pgfplots@subtickwidth@ pt}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfplots@tick@offset{0}% - \or - \let\pgfplots@tick@offset=\pgfplots@subtickwidth@% - \or - \pgfmathmultiply@{0.5}{\pgfplots@subtickwidth@}% - \let\pgfplots@tick@offset=\pgfmathresult% - \fi - \ifcase#2\relax - \pgfplots@prepare@tick@offsets@for@{#1}{y}{\pgfplots@subtickwidth@}% - \else - \pgfplots@prepare@tick@offsets@for@{#1}{x}{\pgfplots@subtickwidth@}% - \fi - \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curtickpos{% - \pgfplots@tmpa=\pgfplots@curtickpos - \csname pgfplots@draw#1axis@placecomputedtick\endcsname - }% - \endpgfextra; - \fi - \endscope -} - -% #1 : the verbatim axis name (either 'x' or 'y') -% #2 : the index of the axis (either 0 or 1) -\def\pgfplots@drawticklabels@for#1#2{% - \begingroup - \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname - \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname - \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname - \ifpgfplots@major - \ifpgfplots@islinear - \pgfplots@if{pgfplots@scaled@ticks@#1}{% - \pgfplots@init@scaled@tick@for{#1}% - }\relax% - \fi +% #1 : either x or y. +\def\pgfplots@drawaxis@lines@preparediscont@for#1{% + \ifnum\csname pgfplots@#1axisdiscontnum\endcsname>0 \begingroup - \pgfkeys{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}% - \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax - \def\pgfmathresult{0}% - \or - \pgfmathparse{\pgfplots@tickwidth}% + % this group employs several temporary dimension registers + % and is therefor scoped: + \let\disstart=\pgf@ya + \let\disend=\pgf@yb + \disend=\csname pgfplots@#1max@reg\endcsname + \advance\disend by -\csname pgfplots@#1min@reg\endcsname + \disend=\csname pgfplots@#1@veclength\endcsname\disend + \ifcase\csname pgfplots@#1axisdiscontnum\endcsname\relax + % has already been checked above. \or - \pgfmathmultiply{0.5}{\pgfplots@tickwidth}% - \fi - \let\pgfplots@tick@offset=\pgfmathresult - \ifnum\csname pgfplots@#1ticklabelposnum\endcsname=0 - % the choice '[xy]ticklabel pos=default': - \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1tickposnum\endcsname - \else - \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1ticklabelposnum\endcsname - \fi - \ifcase#2\relax - \ifcase\pgfplots@tmpposnum\relax - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordminTEX}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordminTEX}}% - \or - \pgf@xa=\pgfplots@ZERO@y - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgf@xa}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@ycoordmaxTEX}}% - \fi - \def\pgfplots@tickposchoicea{\tikzset{above}}% - \def\pgfplots@tickposchoiceb{\tikzset{below}}% + \def\discontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}% + \advance \disend by -16pt \or - \ifcase\pgfplots@tmpposnum\relax - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordminTEX}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordminTEX}}% - \or - \pgf@xa=\pgfplots@ZERO@x - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgf@xa}}% - \or - \edef\pgfplots@tick@origin{\pgf@sys@tonumber{\pgfplots@xcoordmaxTEX}}% - \fi - \def\pgfplots@tickposchoicea{\tikzset{right}}% - \def\pgfplots@tickposchoiceb{\tikzset{left}}% - \fi - \ifnum\pgfplots@tmpposnum=3 - \pgfplots@tickposchoicea - \pgfmathadd@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \def\discontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}% + \advance \disend by -8pt + \fi + % if #1max + shift < 0pt (shift is 0 without the scaling trafo) + \ifdim\csname pgfplots@#1max@reg\endcsname<-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt + % swap start and end + \disstart=\disend + \disend=4pt \else - \pgfplots@tickposchoiceb - \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \disstart=4pt \fi - \edef\pgfplots@tick@origin{\pgfmathresult pt}% - \def\pgfplots@ticknum{0}% - \xdef\pgfplots@show@ticklabel@LASTTICK{}% - \pgfplotslistforeachungrouped\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% - \expandafter\pgfplots@parse@prepared@major@tickpos\pgfplots@curtickpos\pgfplots@tmpa\pgfplots@curtickpos - \ifcase#2\relax - \pgfplots@show@ticklabel - {#1}{\pgfplots@curtickpos}(\pgfplots@tmpa,\pgfplots@tick@origin)% - {\pgfplots@ticknum}% - \or - \pgfplots@show@ticklabel - {#1}{\pgfplots@curtickpos}(\pgfplots@tick@origin,\pgfplots@tmpa)% - {\pgfplots@ticknum}% - \fi - \begingroup - \c@pgf@counta=\pgfplots@ticknum\relax - \advance\c@pgf@counta by1 - \edef\pgfplots@ticknum{\the\c@pgf@counta}% - \pgfmath@smuggleone\pgfplots@ticknum - \endgroup + % carry local computations outside of group: + \xdef\pgfplots@glob@TMPa{% + \noexpand\def\expandafter\noexpand\csname #1disstart\endcsname{\the\disstart}% + \noexpand\def\expandafter\noexpand\csname #1disend\endcsname{\the\disend}% + \noexpand\pgfkeysdef{/tikz/#1discont}{\noexpand\pgfkeysalso{\discontstyle}}% }% \endgroup - \pgfplots@draw@tick@scale@label@for #1% + \pgfplots@glob@TMPa + \else + \expandafter\def\csname #1disstart\endcsname{0pt}% + \expandafter\def\csname #1disend\endcsname{0pt}% + \pgfkeyslet{/tikz/#1discont}=\pgfutil@empty \fi - \endgroup -} +}% \def\pgfplots@rememberplotspec#1{% \pgfplotslistpushbackglobal{#1}\to\pgfplots@plotspeclist @@ -2283,7 +2129,7 @@ \else \c@pgf@countb=\pgfplots@numplots % offset modulo size: - \loop + \pgfutil@loop \ifnum\c@pgf@countb<\c@pgf@counta \pgfplots@loop@CONTINUEfalse \else @@ -2291,1474 +2137,42 @@ \fi \ifpgfplots@loop@CONTINUE \advance\c@pgf@countb by-\c@pgf@counta - \repeat + \pgfutil@repeat \pgfplotslistselect\c@pgf@countb\of\autoplotspeclist\to#1 %\pgfplots@message{pgfplots.sty: using \string\autoplotspeclist\ specification no\#\the\c@pgf@countb (of \the\c@pgf@counta): #1}% \fi } -% The main interface to draw a plot into an axis. -% -% Usage: -% \addplot -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% or -% -% \addplot[color=blue,mark=*] -% plot coordinates { -% (0,0) -% (1,1) -% }; -% -% The first syntax will use the next plot specification in the list -% \autoplotspeclist -% and the first will use blue color and * markers. -% -% \addplot[<style options>] plot[<behavior options>] <input type and args> <post plot path> ; -% -% -% The linespec. will be used in the legend. -% -% Low-level implementation: -% -% \pgfplots@addplot -% \pgfplots@addplotimpl -% \pgfplots@start@plot@with@behavioroptions <--- \begingroup -% ... -% ... remember options GLOBALLY -% ... update limits GLOBALLY -% ... \pgfplots@addplot@enqueue@coords GLOBALLY -% ... -% \pgfplots@end@plot <--- \endgroup -\long\def\pgfplots@addplot{% - \pgfutil@ifnextchar+{% - \pgfplots@getautoplotspec into\nextplotspec - \pgfplots@addplotimplAPPEND - }{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl% - }{% - \pgfplots@getautoplotspec into\nextplotspec - % the space after ']' is required here: - % FIXME: - % - \addplot[]plot coordinates is NOT allowed!? - \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec]% - }% - }% -} - -\long\def\pgfplots@addplotimplAPPEND+[{% - \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec, -} - -\long\def\pgfplots@addplotimpl[#1]{% - \pgfutil@ifnextchar p{% - \pgfplots@addplotimpl@plot{#1}% - }{% - \pgfplots@addplotimpl@plot{#1}plot - }% -} -\def\pgfplots@addplotimpl@plot#1plot{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@plot@withoptions{#1}% - }{% - \pgfplots@addplotimpl@plot@withoptions{#1}[]% - }% +\long\def\pgfplots@path#1;{% + \pgfplots@path@enqueue{#1;}% } -\def\pgfplots@addplotimpl@plot@withoptions#1[#2]{ - \pgfplots@start@plot@with@behavioroptions{#2}% - \pgfutil@ifnextchar c{% - \pgfplots@addplotimpl@coordinates{#1}plot - }{% - \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@f{#1}% - }{% - \pgfutil@ifnextchar t{% - \pgfplots@addplotimpl@table{#1}% - }{% - \pgfutil@ifnextchar ({% - \pgfplots@addplotimpl@expression{#1}% - }{% - \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots! Ignoring it.}% - \pgfplots@gobble@until@semicolon - }% - }% - }% - }% +% This thing here shall be used to replace any '\path' where \axispath +% shall be used. +\long\def\pgfplots@replacement@for@tikz@path#1;{% + \axispath\path#1;% } -\def\pgfplots@gobble@until@semicolon#1;{} - -% Currently, plot expression is really inefficient: -% -% 1. it invokes the math parser to get all coordinates. Ok, that's -% what one expects. -% -% 2. It collects the result into one large list instead of calling -% pgfplots' stream methods. That's because \foreach encapsulates its -% code in at least one TeX-group. -% -% 3. It processes the collected list; applying any floating point -% parser routines - it does NOT know that any numbers are already in -% TeX-precision! -% -\long\def\pgfplots@addplotimpl@expression#1(#2,#3)#4;{% - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - % - \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}% - \pgfplots@gettikzinternal@keyval{samples at}{tikz@plot@samplesat}{-5,-4.6,...,5}% - % - \edef\pgfplots@plot@data{\noexpand\foreach\expandafter\noexpand\tikz@plot@var in {\tikz@plot@samplesat}}% - \pgfplotsapplistXXglobalnewempty - \pgfplots@plot@data{% - \pgfmathparse{#2}% - \let\pgfplots@current@point@x=\pgfmathresult - \pgfmathparse{#3}% - \let\pgfplots@current@point@y=\pgfmathresult - \edef\pgfplots@loc@TMPa{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@loc@TMPa}% - }% - \pgfplotsapplistXXgloballet\pgfplots@loc@TMPa - \pgfplotsapplistXXglobalclear - \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@loc@TMPa}% -}% - -\def\pgfplots@addplotimpl@f#1f{% - \pgfutil@ifnextchar i{\pgfplots@addplotimpl@file{#1}}{\pgfplots@addplotimpl@function{#1}}% -}% - -\let\pgfplots@backupof@pgfplotxyfile=\pgfplotxyfile - -% the following code -% results finally in -% -% set format "%.7e";; set samples <...>; plot ... -% -% The windows port of gnuplot doesn't run without the second semicolon -% - for whatever reason. { - \catcode`\%=12 - \catcode`\"=12 - \xdef\pgfplots@gnuplot@format{set format "%.7e";} -} - -% #1: args of \addplot[...] -% #2: file name -% #3: trailing path commands until ';' -\def\pgfplots@addplotimpl@function#1unction#2#3;{% - \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}% - \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-plot}% - \pgfplots@gettikzinternal@keyval{samples}{tikz@plot@samples}{25}% - \pgfplots@gettikzinternal@keyval{domain}{tikz@plot@domain}{-5:5}% - \pgfplots@gettikzinternal@keyval{raw gnuplot}{iftikz@plot@raw@gnuplot}{\iffalse}% - \pgfplots@gettikzinternal@keyval{parametric}{iftikz@plot@parametric}{\iffalse}% - % - \def\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}% - \iftikz@plot@raw@gnuplot% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{#2}}% - \else% - \iftikz@plot@parametric% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% - \pgfplots@gnuplot@format; - set samples \tikz@plot@samples; - set parametric; - plot [t=\tikz@plot@domain] #2}}% - \else% - \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% - \pgfplots@gnuplot@format; - set samples \tikz@plot@samples; - plot [x=\tikz@plot@domain] #2}}% - \fi% - \fi% - \def\pgfplotxyfile{\pgfplots@addplotimpl@gnuplotresult{#1}{#3}}% - \pgfplots@plot@data - \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile -}% - -\def\pgfplots@addplotimpl@gnuplotresult#1#2#3{% - \begingroup - \openin1=#3 - \ifeof1 - \pgfplots@error{Sorry, the gnuplot-result file '#3' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot #3' manually.}% - \aftergroup\pgfplots@loop@CONTINUEfalse - \else - \aftergroup\pgfplots@loop@CONTINUEtrue - \fi - \closein1 - \endgroup - \ifpgfplots@loop@CONTINUE - \pgfplots@addplotimpl@file{#1}ile{#3}#2;% - \fi -} - -% #1: arguments to \addplot[...] -% #2: the file name -% #3: any additional path arguments -\def\pgfplots@addplotimpl@file#1ile{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@file@opt{#1}% - }{% - \pgfplots@addplotimpl@file@opt{#1}[]% - }% -} - -% \addplot[#1] file[#2] {#3} #4; -\def\pgfplots@addplotimpl@file@opt#1[#2]#3#4;{% - \begingroup - \def\pgfplots@loc@TMPa{#2}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \pgfqkeys{/pgfplots/plot file}{#2}% - \fi - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplots@coord@stream@start - \openin1=#3 - \ifeof1 - \pgfplots@warning{sorry, plot file{#3} could not be opened!?}% - \else - \pgfplots@addplotimpl@file@readall - \fi - \pgfplots@coord@stream@end - \endgroup -}% -\def\pgfplots@addplotimpl@file@readall{% - \read1 to\pgfplots@file@LINE - \expandafter\pgfplotstableread@checkspecial@line\pgfplots@file@LINE\pgfplotstable@EOI - \ifpgfplotstableread@skipline - \else - \ifpgfplots@plot@file@skipfirst - % Silently skip first data row, assuming it is a header. - \pgfplots@plot@file@skipfirstfalse - \else - \expandafter\pgfplots@addplotimpl@file@parsesingle\pgfplots@file@LINE\pgfplots@EOI - \fi - \fi - \ifeof1 - \else - \expandafter - \pgfplots@addplotimpl@file@readall - \fi -}% - -\def\pgfplots@addplotimpl@file@parsesingle#1 #2 #3\pgfplots@EOI{% - \pgfplots@coord@stream@coord{#1}{#2}{}{}% -}% - -\def\pgfplots@addplotimpl@table#1table{% - \pgfutil@ifnextchar[{% - \pgfplots@addplotimpl@table@getopts{#1}% - }{% - \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% - }% -}% - -\def\pgfplots@addplotimpl@table@getopts#1[#2]{% - \pgfutil@ifnextchar f{% - \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% - }{% - \pgfplots@addplotimpl@table@fromfile{#1}{#2}% - }% -} - -% #1: arguments to \addplot[...] -% #2: arguments to table[...] -% #3: the argument of plot table{...} -% #4: trailing path arguments after plot table{...}#4; -\long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{% - \begingroup - % FIXME : this thing here has runtime O(N^2) ! - % I fear it is faster to simply reload the data .... !? - % - % well, for a lot of columns which are used in different contexts - % and few rows, this here IS more efficient. - \pgfplotstableset{#2}% - \pgfplotstablecopy#3\to\pgfplots@table - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\addplot@tbl@x - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\addplot@tbl@y - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y - \fi + % A block which handles active semicolons. % - \ifpgfplots@errorbars@enabled - \let\addplot@tbl@error@x=\pgfutil@empty - \let\addplot@tbl@error@y=\pgfutil@empty - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \else - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\addplot@tbl@error@x - \fi - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x - \fi - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \else - \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\addplot@tbl@error@y - \fi - \else - \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y - \fi - \fi + % ATTENTION: this block does only work if + % \pgfplots@addplotimpl.... changes are reflected here! % - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplots@coord@stream@start - \loop - \pgfplotslistcheckempty\addplot@tbl@x - \ifpgfplotslistempty - \pgfplots@loop@CONTINUEfalse - \else - % This here is just for sanity checking: if the 'y' column is - % - for whatever reasons - invalid; provide good error - % recovery. - \pgfplotslistcheckempty\addplot@tbl@y - \ifpgfplotslistempty - \pgfplots@loop@CONTINUEfalse - \else - \pgfplots@loop@CONTINUEtrue - \fi - \fi - \ifpgfplots@loop@CONTINUE - \pgfplotslistpopfront\addplot@tbl@x\to\addplot@tbl@cur@x - \pgfplotslistpopfront\addplot@tbl@y\to\addplot@tbl@cur@y - \ifpgfplots@errorbars@enabled - \ifx\addplot@tbl@error@x\pgfutil@empty - \let\addplot@tbl@error@cur@x=\pgfutil@empty - \else - \pgfplotslistpopfront\addplot@tbl@error@x\to\addplot@tbl@error@cur@x - \fi - \ifx\addplot@tbl@error@y\pgfutil@empty - \let\addplot@tbl@error@cur@y=\pgfutil@empty - \else - \pgfplotslistpopfront\addplot@tbl@error@y\to\addplot@tbl@error@cur@y - \fi - \edef\pgfplots@loc@TMPa{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{\addplot@tbl@error@cur@x}{\addplot@tbl@error@cur@y}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@loc@TMPa - \else - \edef\pgfplots@loc@TMPa{{\addplot@tbl@cur@x}{\addplot@tbl@cur@y}{}{}}% - \expandafter\pgfplots@coord@stream@coord\pgfplots@loc@TMPa - \fi - \repeat - \pgfplots@coord@stream@end - \endgroup -} - - -% #1: arguments to \addplot[...] -% #2: arguments to table[...] -% #3: the argument of plot table{...} -% #4: trailing path arguments after plot table{...}#4; -\long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{% - %-------------------------------------------------- - % \begingroup - % \pgfplotstableset{#2}% - % \pgfplotstableread{#3}\pgfplots@table - % \pgfplots@addplotimpl@table@fromstructure{#1}{}from{\pgfplots@table}{#4};% - % \endgroup - %-------------------------------------------------- - \pgfplotsapplistXXglobalnewempty - \begingroup - \pgfplotstableset{#2}% - \let\pgfplots@table@PTR@x=\pgfutil@empty - \let\pgfplots@table@PTR@y=\pgfutil@empty - \ifpgfplots@errorbars@enabled - \let\pgfplots@table@ERRPTR@x=\pgfutil@empty - \let\pgfplots@table@ERRPTR@y=\pgfutil@empty - \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex - \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x - \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex - \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y - \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@witherrors - \else - \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener - \fi - \endgroup - % - \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% - \pgfplotsapplistXXgloballet\pgfplots@coordlist - \pgfplotsapplistXXglobalclear - \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@coordlist}%% -} -\def\pgfplots@addplotimpl@table@fromfile@listener{% - \pgfplots@addplotimpl@table@fromfile@listener@ - \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% -} -\def\pgfplots@addplotimpl@table@fromfile@listener@{% - \ifx\pgfplots@table@PTR@x\pgfutil@empty - % this here is only evaluated ONCE. - \ifx\pgfplots@plot@tbl@x\pgfutil@empty - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@xindex}{\pgfplots@table@PTR@x}% - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@x}{\pgfplots@table@PTR@x}% - \fi - \ifx\pgfplots@plot@tbl@y\pgfutil@empty - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@yindex}{\pgfplots@table@PTR@y}% - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@y}{\pgfplots@table@PTR@y}% - \fi - \fi - \pgfplotstablereadevalptr\pgfplots@table@PTR@x\pgfplots@current@point@x - \pgfplotstablereadevalptr\pgfplots@table@PTR@y\pgfplots@current@point@y -}% -\def\pgfplots@addplotimpl@table@fromfile@listener@witherrors{% - \pgfplots@addplotimpl@table@fromfile@listener@ - % - \ifx\pgfplots@table@ERRPTR@x\pgfutil@empty - % this here is only evaluated ONCE. - \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty - \let\pgfplots@table@ERRPTR@x=\relax% - \else - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@xindex}{\pgfplots@table@ERRPTR@x}% - \fi - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@x}{\pgfplots@table@ERRPTR@x}% - \fi - \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty - \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty - \let\pgfplots@table@ERRPTR@y=\relax% - \else - \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@yindex}{\pgfplots@table@ERRPTR@y}% - \fi - \else - \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@y}{\pgfplots@table@ERRPTR@y}% - \fi - \fi - \ifx\relax\pgfplots@table@ERRPTR@x - \let\addplot@tbl@error@cur@x=\pgfutil@empty - \else - \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@x\addplot@tbl@error@cur@x - \fi - \ifx\relax\pgfplots@table@ERRPTR@y - \let\addplot@tbl@error@cur@y=\pgfutil@empty - \else - \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@y\addplot@tbl@error@cur@y - \fi - \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)+-(\addplot@tbl@error@cur@x,\addplot@tbl@error@cur@y)}% - \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% -}% - -% #1: arguments to \addplot plot[#1] -% -> these are called 'behavior' options in the manual; they are set -% immediately. -\def\pgfplots@start@plot@with@behavioroptions#1{% - \begingroup - \def\pgfplots@current@point@coordindex{0}% can be used inside of coordinate filters. - \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot - \ifx\pgfplots@execute@at@begin@plot\pgfutil@empty - \else - \pgfplots@execute@at@begin@plot - \fi - \def\pgfplots@addplot@nonlegend@options{#1}% - \ifx\pgfplots@addplot@nonlegend@options\pgfutil@empty - \else - \pgfplotsset{#1}% - \fi - % these styles may contain behavior options (error bars, - % samples,... ) activate them! - \pgfplotsset{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% -} - -% Initialises -% \pgfplots@coord@stream@start -% \pgfplots@coord@stream@coord -% \pgfplots@coord@stream@end -% such that a following coordinate stream is processed properly. The -% following coordinate stream may come from different input methods. -% -% Arguments: -% #1: all options of \addplot[...] (the plot style) -% #2: any trailing path commands after the 'plot' command as such, -% for example \addplot plot coordinates {...} -- (0,0); -% would yield #2 =' -- (0,0)' -% -\long\def\pgfplots@PREPARE@COORD@STREAM#1#2{% - \def\pgfplots@coord@stream@start@{% - \pgfplotsapplistXXnewempty - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbar@recordto{\pgfplots@recordederrorbar}% - \pgfplots@streamerrorbarstart - \else - \let\pgfplots@recordederrorbar=\pgfutil@empty - \fi - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - % - %\let\pgfplots@coord@stream@recorded=\pgfutil@empty - % - }% - \let\pgfplots@coord@stream@coord@=\pgfplots@process@one@point - \def\pgfplots@coord@stream@end@{% - \ifpgfplots@errorbars@enabled - \pgfplots@streamerrorbarend - \fi - \ifpgfplots@coord@stream@isfirst - \pgfplots@warning{Empty plot silently dropped.}% - \else - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi - % Idea: use - % \scope[plot specification] - % <any paths for error bars> - % \endscope - % \draw plot coordinates {...}; - % to share plot specifications between error bars and plot - % coordinates. Unfortunately, it is NOT sufficient to use - % \tikzset{#1} - \edef\pgfplots@addplot@preoptionsTMP{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% - \expandafter\pgfplots@rememberplotspec\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% - % warning: rememberplotspec calls list macros which - % overwrite \t@pgfplots@toka - \t@pgfplots@toka=\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% - \xdef\pgfplots@last@plot@style{\the\t@pgfplots@toka}% store it for \label commands. - % ATTENTION: do NOT call list macros from here on! - % - \ifpgfplots@datascaletrafo@initialised - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa - \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% - \else - \t@pgfplots@tokc={}% - \fi - \ifx\pgfplots@recordederrorbar\pgfutil@empty - \let\pgfplots@loc@TMPb=\pgfutil@empty% - \else - \t@pgfplots@tokb=\expandafter{\pgfplots@recordederrorbar}% - \def\pgfplots@loc@TMPb{% - \noexpand\pgfplots@errorbars@finishwithstyleoptions[current plot style]{\the\t@pgfplots@tokb}% - }% - \fi - % assembe a \pgfplots@addplot@enqueue@coords command ... - % BEGIN HERE ... - % vvvvvvvvvv - \xdef\pgfplots@glob@TMPa{% - \noexpand\pgfplots@addplot@enqueue@coords - {% precommand: - \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% - \noexpand\pgfplots@initzerolevelhandler - \the\t@pgfplots@tokc% named start/end points (if already available) - \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@toka}}% - \pgfplots@loc@TMPb% error bar commands - }% - {% draw command: - \noexpand\draw% - }% - }% - \pgfplotsapplistXXlet\pgfplots@coord@stream@recorded - \pgfplotsapplistXXclear - \t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% - \t@pgfplots@tokb={#2;}% - \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% - \xdef\pgfplots@glob@TMPa{% - \the\t@pgfplots@toka - {% coordinates which need to be processed in \endaxis: - plot coordinates {\the\t@pgfplots@tokc}\the\t@pgfplots@tokb - }% - {% postcommand - }% - }% - \pgfplots@glob@TMPa - %^^^^^^^^^^^^ ... END of \pgfplots@addplot@enqueue@coords HERE - \pgfplots@end@plot - \fi - }% -}% - -\def\pgfplots@end@plot{% - \global\advance\pgfplots@numplots by1\relax% - \ifx\pgfplots@execute@at@end@plot\pgfutil@empty - \else - \pgfplots@execute@at@end@plot - \fi - \global\let\pgfplots@glob@TMPa=\relax - \ifpgfplots@collect@firstplot@astick - \ifnum\pgfplots@numplots=1\relax - \t@pgfplots@toka=\expandafter{\pgfplots@firstplot@coords@x}% - \t@pgfplots@tokb=\expandafter{\pgfplots@firstplot@coords@y}% - \xdef\pgfplots@glob@TMPa{% - \noexpand\def\noexpand\pgfplots@firstplot@coords@x{\the\t@pgfplots@toka}% - \noexpand\def\noexpand\pgfplots@firstplot@coords@y{\the\t@pgfplots@tokb}% - }% - \fi - \fi - \endgroup - \pgfplots@glob@TMPa% see above -} - -% #1: arguments to \addplot[...] -% #2: the plot coordinates -% #3: any trailing path command before the final ';'. It will be used as-is. -\long\def\pgfplots@addplotimpl@coordinates#1plot coordinates#2#3;{% -%\tracingmacros=2\tracingcommands=2 -%\pgfplots@message{processing plots coords with trailing path '#3'}% - \pgfplots@PREPARE@COORD@STREAM{#1}{#3}% - \pgfplots@coord@stream@foreach{#2}% -}% - -\newif\ifpgfplots@update@limits@for@one@point@ISCLIPPED -\def\pgfplots@math@ONE{1.0}% - -\def\pgfplots@streamerrorbarstart{% -}% -\def\pgfplots@streamerrorbarend{% -}% -\def\pgfplots@streamerrorbarcoords#1#2{% -}% - -\def\pgfplots@streamerrorbar@recordto#1{% - \def\pgfplots@streamerrorbarstart{% - \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@ - }% - \def\pgfplots@streamerrorbarend{% - \pgfplotsapplistXlet#1=\pgfplots@streamerrorbar@recordto@@ - \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@% clear - }% - \def\pgfplots@streamerrorbarcoords##1##2{% - \pgfplotsapplistXpushback{\pgfplots@errorbar@draw{##1}{##2}}\to\pgfplots@streamerrorbar@recordto@@ - }% -} -\def\pgfplots@streamerrorbar@directdraw{% - \def\pgfplots@streamerrorbarstart{}% - \def\pgfplots@streamerrorbarend{}% - \def\pgfplots@streamerrorbarcoords##1##2{% - \pgfplots@errorbar@draw{##1}{##2}% - }% -} - - - -% Updates the current x and y limits for point (#1,#2). -% -% The point coordinates may be given in floating point format, see -% below. -% -% Please note that if user specified limits are given, automatic -% limits are only applied to points which fall into the user specified -% clipping region. -% -% PRECONDITIONS: -% - the input coordinates have been parsed correctly (floating point -% format for linear axis, log applied for logarithmic ones) -% -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\long\def\pgfplots@update@limits@for@one@point#1#2#3#4{% -%\tracingmacros=2\tracingcommands=2 -%\pgfplots@message{Updating limits for (#1,#2) ...}% - \ifpgfplots@autocomputeanylimits - \pgfplots@update@limits@for@one@point@ISCLIPPEDfalse - \ifpgfplots@autocompute@all@limits - \else - % check whether we need to clip limits: - \ifpgfplots@clip@limits - \ifpgfplots@autocompute@xmin - \else - \ifpgfplots@xislinear - \pgfmathfloatlessthan@{#1}{\pgfplots@xmin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{#1}{\pgfplots@xmin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@xmax - \else - \ifpgfplots@xislinear - \pgfmathfloatlessthan@{\pgfplots@xmax}{#1}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{\pgfplots@xmax}{#1}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@ymin - \else - \ifpgfplots@yislinear - \pgfmathfloatlessthan@{#2}{\pgfplots@ymin}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{#2}{\pgfplots@ymin}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \ifpgfplots@autocompute@ymax - \else - \ifpgfplots@yislinear - \pgfmathfloatlessthan@{\pgfplots@ymax}{#2}% - \ifpgfmathfloatcomparison - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \else - \pgfmathlessthan@{\pgfplots@ymax}{#2}% - \ifx\pgfmathresult\pgfplots@math@ONE - \pgfplots@update@limits@for@one@point@ISCLIPPEDtrue - \fi - \fi - \fi - \fi - \fi - % - % - % - % Update limits: - \ifpgfplots@update@limits@for@one@point@ISCLIPPED - \else - \ifpgfplots@autocompute@xmin - \ifpgfplots@xislinear - \pgfmathfloatmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@xmin}{#1}% - \global\let\pgfplots@xmin=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@xmax - \ifpgfplots@xislinear - \pgfmathfloatmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \else - \pgfmathmax@{\pgfplots@xmax}{#1}% - \global\let\pgfplots@xmax=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@ymin - \ifpgfplots@yislinear - \pgfmathfloatmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \else - \pgfmathmin@{\pgfplots@ymin}{#2}% - \global\let\pgfplots@ymin=\pgfmathresult - \fi - \fi - \ifpgfplots@autocompute@ymax - \ifpgfplots@yislinear - \pgfmathfloatmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\pgfmathresult - \else - \pgfmathmax@{\pgfplots@ymax}{#2}% - \global\let\pgfplots@ymax=\pgfmathresult - \fi - \fi - \fi - \fi - % - % Compute data range: - \ifpgfplots@autocompute@all@limits - \global\let\pgfplots@data@xmin=\pgfplots@xmin - \global\let\pgfplots@data@xmax=\pgfplots@xmax - \global\let\pgfplots@data@ymin=\pgfplots@ymin - \global\let\pgfplots@data@ymax=\pgfplots@ymax - \else - % Attention: it is only done for linear axis! - \ifpgfplots@xislinear - \pgfmathfloatmin@{\pgfplots@data@xmin}{#1}% - \global\let\pgfplots@data@xmin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@data@xmax}{#1}% - \global\let\pgfplots@data@xmax=\pgfmathresult - \fi - \ifpgfplots@yislinear - \pgfmathfloatmin@{\pgfplots@data@ymin}{#2}% - \global\let\pgfplots@data@ymin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@data@ymax}{#2}% - \global\let\pgfplots@data@ymax=\pgfmathresult - \fi - \fi -%\pgfplots@message{Updated limits: (\pgfplots@xmin,\pgfplots@ymin) rectangle (\pgfplots@xmax,\pgfplots@ymax).}% -%\tracingmacros=0\tracingcommands=0 -} -\let\pgfplots@update@limits@for@one@point@orig=\pgfplots@update@limits@for@one@point - -\def\pgfplots@invoke@filter#1#2{% - \pgfkeysvalueof{/pgfplots/#2 filter/.@cmd}#1\pgfeov% -}% - -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\def\pgfplots@process@one@point#1#2#3#4{% - \pgfplots@prepare@xcoord{#1}% - \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{x}% - \let\pgfplots@current@point@x=\pgfmathresult - % - \pgfplots@prepare@ycoord{#2}% - \expandafter\pgfplots@invoke@filter\expandafter{\pgfmathresult}{y}% - \let\pgfplots@current@point@y=\pgfmathresult - % - \ifpgfplots@xislinear - \ifx\pgfplots@current@point@x\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@current@point@x}% - \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta - \ifnum\c@pgf@counta>2 - \let\pgfplots@current@point@x=\pgfutil@empty - \else - \let\pgfplots@current@point@x=\pgfmathresult - \fi - \fi - \fi - % - \ifpgfplots@yislinear - \ifx\pgfplots@current@point@y\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@current@point@y}% - \expandafter\pgfmathfloat@decompose@F\pgfmathresult\relax\c@pgf@counta - \ifnum\c@pgf@counta>2 - \let\pgfplots@current@point@y=\pgfutil@empty - \else - \let\pgfplots@current@point@y=\pgfmathresult - \fi - \fi - \fi - % - \ifx\pgfplots@current@point@x\pgfutil@empty - \ifpgfplots@warn@for@filter@discards - \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the x-coordinate filter.}% - \fi - \else - \ifx\pgfplots@current@point@y\pgfutil@empty - \ifpgfplots@warn@for@filter@discards - \pgfplots@message{NOTE: coordinate (#1,#2) has been dropped because of the y-coordinate filter.}% - \fi - \else - % - \ifpgfplots@apply@datatrafo - \ifpgfplots@datascaletrafo@initialised - % apply data transformation directly. - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x\pgfplots@current@point@x - \let\pgfplots@current@point@x=\pgfmathresult - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y\pgfplots@current@point@y - \let\pgfplots@current@point@y=\pgfmathresult - \fi - \fi - \fi - % All following routines (limit updating/stacking/error - % bars) will use float numerics if necessary (controlled - % by ifs). - \ifpgfplots@stackedmode - \pgfplots@stacked@preparepoint@inmacro{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \ifpgfplots@datascaletrafo@initialised% is also true if there is no scale trafo. - \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \else - % the finishpoint routine will be invoked at - % \endaxis. - \fi - \fi - % update also axis / data limits: - \pgfplots@update@limits@for@one@point{\pgfplots@current@point@x}{\pgfplots@current@point@y}{}{}% - \ifpgfplots@errorbars@enabled - \pgfplots@process@errorbar@for{\pgfplots@current@point@x}{\pgfplots@current@point@y}{#3}{#4}{#1}{#2}% - \fi - % - \edef\pgfplots@loc@TMPa{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \expandafter\pgfplotsapplistXXpushback\expandafter{\pgfplots@loc@TMPa}% - %\t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% - %\edef\pgfplots@coord@stream@recorded{\the\t@pgfplots@tokc (\pgfplots@current@point@x,\pgfplots@current@point@y)}% - % - \ifpgfplots@collect@firstplot@astick - \ifnum\pgfplots@numplots=0 - \ifx\pgfplots@firstplot@coords@x\pgfutil@empty - \t@pgfplots@tokc=\expandafter{}% - \else - \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@x,}% - \fi - \edef\pgfplots@firstplot@coords@x{\the\t@pgfplots@tokc\pgfplots@current@point@x}% - \ifx\pgfplots@firstplot@coords@y\pgfutil@empty - \t@pgfplots@tokc=\expandafter{}% - \else - \t@pgfplots@tokc=\expandafter{\pgfplots@firstplot@coords@y,}% - \fi - \edef\pgfplots@firstplot@coords@y{\the\t@pgfplots@tokc\pgfplots@current@point@y}% - \fi - \fi - \fi - \fi - % - % increase \pgfplots@current@point@coordindex: - \begingroup - \c@pgf@counta=\pgfplots@current@point@coordindex - \advance\c@pgf@counta by1\relax - \edef\pgfmathresult{\the\c@pgf@counta}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgfplots@current@point@coordindex=\pgfmathresult -} - -% Internal stream methods. -% -% Please overwrite \pgfplots@coord@stream@start@, -% \pgfplots@coord@stream@end@ and \pgfplots@coord@stream@coord@ -% if you implement streams. -% -% FIXME: REPLACE THIS HERE WITH METHODS OF THE VISUALIZATION FRAMEWORK -\newif\ifpgfplots@coord@stream@isfirst -\def\pgfplots@coord@stream@start{% - \pgfplots@coord@stream@isfirsttrue - \pgfplots@coord@stream@start@}% -\def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@} - -% Will be invoked for every point coordinate. -% -% It invokes \pgfplots@coord@stream@coord@. -% It is expected to assign \pgfplots@current@point@x and -% \pgfplots@current@point@y -% -% It is expected to -% (#1,#2) : x, y coordinates -% (#3,#4) : any x, y errors (or empty) -\def\pgfplots@coord@stream@coord#1#2#3#4{% - \pgfplots@coord@stream@coord@{#1}{#2}{#3}{#4}% - \ifpgfplots@coord@stream@isfirst - \ifx\pgfplots@currentplot@firstcoord@x\pgfutil@empty - \else - \ifx\pgfplots@currentplot@firstcoord@y\pgfutil@empty - \else - \let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y - \pgfplots@coord@stream@isfirstfalse - \fi - \fi - \fi - \ifx\pgfplots@current@point@x\pgfutil@empty - \else - \ifx\pgfplots@current@point@y\pgfutil@empty - \else - \let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x - \let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y - \fi - \fi -}% - -% A looping method which applies -% \pgfplots@coord@stream@start -% for each coordinate '(x,y)' or '(x,y) +- (ex,ey)', call -% \pgfplots@coord@stream@coord{x}{y}{ex}{ey} -% \pgfplots@coord@stream@end -% -% #1 a sequence of coordinates of the form -% '(x,y)' -% or -% '(x,y) +- (ex,ey)' -% separated by white-space. -\long\def\pgfplots@coord@stream@foreach#1{% - \pgfplots@coord@stream@start - \pgfplots@foreach@plot@coord@do% - \pgfplots@coord@stream@coord - \for - plot coordinates {#1};% - \pgfplots@EOI - \pgfplots@coord@stream@end -}% - -% this is a convenience macro to save storage in the long coordinate -% lists. -\def\pgfplots@stream#1#2{\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} - -\newif\ifpgfplots@record@marker@stream -% Takes a sequence of PREPARED coordinates which are given in floating -% point representation and applies the data scaling trafo (if -% necessary). -% -% Any coordinate will be plotted with the selected PGF plot handler. -% -% This stream is designed to be done at the end of an axis. -% See \pgfplots@coord@stream@finalize@storedcoords@START -% -% #1 : a macro which will be filled with a pgf plot stream for the -% marker points. -\def\pgfplots@coord@stream@INIT@finalize@storedcoords#1{% - % - % Init the plot handlers: - \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler - \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% - % - \ifx\tikz@plot@mark\pgfutil@empty - % mark=none : no need to waste time collecting marker - % positions. - \pgfplots@record@marker@streamfalse - \else - \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard - \ifpgfplots@clip@marker@paths - % only marks: draw markers directly; no need for the - % two-pass-approach. - \let\pgfplots@basiclevel@plothandler=\relax - \pgfplots@install@plotmark@handler - \pgfplots@record@marker@streamfalse - \else - % collect mark positions... they will be drawn after - % the clipped axis range. Clipping will only be - % applied to their *positions*, not their paths. - \pgfplots@record@marker@streamtrue - \fi - \else - % ok, mark!=none and we also have a plot handler. - % So, collect mark positions! - \pgfplots@record@marker@streamtrue - \fi - \fi - \gdef#1{}% - % - % Now, set up coordinate streams. - \def\pgfplots@coord@stream@start@{% - \ifpgfplots@apply@datatrafo - \ifpgfplots@stackedmode - \pgfplots@stacked@beginplot - \fi - \fi - \pgfplots@basiclevel@plothandler - \pgfplotstreamstart - \let\pgfplots@data@scaletrafo@result=\pgfutil@empty - \ifpgfplots@record@marker@stream - \pgfplotsapplistXXnewempty - \pgfplotsapplistXXpushback{\pgfplotstreamstart}% - %\gdef#1{\pgfplotstreamstart}% - \fi - }% - \def\pgfplots@coord@stream@end@{% - \ifpgfplots@apply@datatrafo - \ifpgfplots@stackedmode - \pgfplots@stacked@endplot - \fi - \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa - \pgfplots@loc@TMPa - \fi - \pgfplotstreamend - \ifpgfplots@record@marker@stream - \pgfplotsapplistXXpushback{\pgfplotstreamend}% - \pgfplotsapplistXXflushbuffers% - \global\let#1=\pgfplotsapplistXX - \pgfplotsapplistXXclear - %\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}% - \fi - }% - \ifpgfplots@apply@datatrafo - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \pgfplots@apply@data@scaletrafo@to@one@point{##1}{##2}{##3}{##4}% - \pgfplots@coord@stream@finalize@currentpt - }% - \else - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \def\pgfplots@current@point@x{##1}% - \def\pgfplots@current@point@y{##2}% - \pgfplots@coord@stream@finalize@currentpt - }% - \fi - % - \def\pgfplots@coord@stream@finalize@currentpt{% - \pgfqpointxy{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \ifpgfplots@record@marker@stream - \ifdim\pgf@x<\pgfplots@xcoordminTEX - \else - \ifdim\pgf@x>\pgfplots@xcoordmaxTEX - \else - \ifdim\pgf@y<\pgfplots@ycoordminTEX - \else - \ifdim\pgf@y>\pgfplots@ycoordmaxTEX - \else - \edef\pgfmathresult{\noexpand\pgfplots@stream{\the\pgf@x}{\the\pgf@y}}% - \expandafter\pgfplotsapplistXXpushback\expandafter{\pgfmathresult}% - \fi - \fi - \fi - \fi - \fi - \pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y! - }% -} -\def\pgfplots@addplot@get@named@startendpoints@command#1{% - \edef#1{% - \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfqpointxy{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}}% - \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfqpointxy{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}}% - }% -}% - -% INPUT: -% either floating point or fixed point coordinates (depending on the -% state of the \ifpgfplots@apply@datatrafo boolean) -% -\long\def\pgfplots@coord@stream@finalize@storedcoords@START plot coordinates #1#2;\pgfplots@EOI{% - \pgfplots@assert@tikzinternal@exists{tikz@make@last@position}% - \pgfplots@stored@current@cmd[current plot style] - \pgfextra - \tikzset{every plot/.try}% - \pgfplots@coord@stream@INIT@finalize@storedcoords\pgfplots@recorded@marker@stream% - \pgfplots@coord@stream@foreach{#1}% - \tikz@make@last@position{\pgfplotlastpoint}% - \endpgfextra - #2; - \ifx\pgfplots@recorded@marker@stream\pgfutil@empty - \else - \ifpgfplots@clip@marker@paths - % Draw markers on top of the plot lines: - % - % FIXME: inefficient! Use \scope to set variables of 'current plot style' !? - \pgfplots@stored@current@cmd[current plot style] - \pgfextra - \pgfplots@install@plotmark@handler - \pgfplots@recorded@marker@stream - \endpgfextra - ; - \else - % sigh... ok, store the marker list (once more again). - % They need to be drawn after the clipped area. - \pgfplots@stored@REMEMBER@MARK@COMMAND - \fi - \fi - \gdef\pgfplots@recorded@marker@stream{}% clear -}% - -% This method MUST be called while \pgfplots@stored@plotlist is -% evaluated, that means -% - \pgfplots@stored@* commands need to be valid, -% - the precommand has already been invoked. -% - pgfplots@recorded@marker@stream exists -% - current plot style is valid -\def\pgfplots@stored@REMEMBER@MARK@COMMAND{% - \pgfkeysgetvalue{/tikz/current plot style/.@cmd}{\pgfplots@loc@TMPa}% - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\pgfeov}% - \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@cmd[current plot style]}% - \t@pgfplots@tokc=\expandafter{\pgfplots@recorded@marker@stream}% - \edef\pgfplots@loc@TMPa{% - \noexpand\pgfkeysdef{/tikz/current plot style}{\the\t@pgfplots@toka}% - \the\t@pgfplots@tokb - \noexpand\pgfextra - \noexpand\pgfplots@install@plotmark@handler - \the\t@pgfplots@tokc - \noexpand\endpgfextra - ;}% - \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}\to\pgfplots@stored@markerlist -}% - -\def\pgfplots@install@plotmark@handler{% - \pgfplots@assert@tikzinternal@exists{tikz@options}% - % note: I can't check on tikz@transform because it can be - % '\relax'. - \pgfplots@gettikzinternal@keyval{mark indices}{tikz@mark@list}{}% - \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% - % - % do not reset \tikz@options: draw color may be acquired - % from 'current plot style' - %\let\tikz@options=\pgfutil@empty% - \let\tikz@transform=\pgfutil@empty% - \tikzset{every plot/.try,every mark}% - \tikz@options - \ifx\tikz@mark@list\pgfutil@empty% - \pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}% - \else - \pgfplothandlermarklisted{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}{\tikz@mark@list}% - \fi -}% - -% A looping command to loop through plot coordinates. -% For every point, #1{X}{Y} will be invoked. -% -% No scoping is used during this operation, so you can access outer -% variables. -\long\def\pgfplots@foreach@plot@coord@do#1\for plot coordinates #2;\pgfplots@EOI{% - \def\pgfplots@foreach@plot@coord@do@CMD{#1}% - \pgfplots@foreach@plot@coord@ITERATE#2\pgfplots@EOI% -} - -\def\pgfplots@foreach@plot@coord@ITERATE{% - \pgfutil@ifnextchar\pgfplots@EOI{% - \pgfplots@foreach@plot@coord@FINISH% - }{% - \pgfplots@foreach@plot@coord@NEXT% + \catcode`\;=\active + \globaldefs=1 + % 'AS' == 'active semicolon' + \def\pgfplots@path@AS#1;{\pgfplots@path@enqueue{#1;}}% + \long\def\pgfplots@replacement@for@tikz@path@AS#1;{% + \axispath\path#1;% }% -} - -\def\pgfplots@foreach@plot@coord@NEXT(#1,#2){% - \pgfutil@ifnextchar+{% - \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE{#1}{#2}% - }{% - \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{}{}% - \pgfplots@foreach@plot@coord@ITERATE + \pgfplots@appendto@activesemicolon@switcher{% + \let\pgfplots@path=\pgfplots@path@AS + \let\pgfplots@replacement@for@tikz@path=\pgfplots@replacement@for@tikz@path@AS }% } -% processing something like '(x,y) +- (error_x,error_y)' -\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE#1#2+-#3({% - \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@{#1}{#2}% -} -\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@#1#2#3,#4){% - \pgfplots@foreach@plot@coord@do@CMD{#1}{#2}{#3}{#4}% - \pgfplots@foreach@plot@coord@ITERATE -} - -\def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{} - - -% #1= x coord -% #2= y coord -% #3= error for x coord (or empty) -% #4= error for y coord (or empty) -\def\pgfplots@apply@data@scaletrafo@to@one@point#1#2#3#4{% - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x{#1}% - \let\pgfplots@current@point@x=\pgfmathresult - \else - \def\pgfplots@current@point@x{#1}% - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y{#2}% - \let\pgfplots@current@point@y=\pgfmathresult - \else - \def\pgfplots@current@point@y{#2}% - \fi - \ifpgfplots@stackedmode - % all these calls work with pgfmath; no more floating point - % arithmetics are applied. - \pgfplots@stacked@getnextzerolevelpoint - \pgfplots@stacked@finishpoint{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% - \fi -% \t@pgfplots@tokc=\expandafter{\pgfplots@data@scaletrafo@result}% -% \edef\pgfplots@data@scaletrafo@result{\the\t@pgfplots@tokc(\pgfplots@current@point@x,\pgfplots@current@point@y)}% -} - -% This thing here shall draw all error bar commands listed in '#2'. -% -% It will be invoked when any plotting commands take effect (that -% means all limits are computed; the axis has been drawn, -% transformations are set up...) -\def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{% - \scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it used the /pgfplots/.unknown - #2% - \endscope -} - -\def\pgfplots@errorbar@draw@float(#1,#2)(#3,#4){% - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@x{#1}% - \let\pgfplots@xarg=\pgfmathresult% - \pgfplots@datascaletrafo@x{#3}% - \let\pgfplots@error@xarg=\pgfmathresult% - \else - \def\pgfplots@xarg{#1}% - \def\pgfplots@error@xarg{#3}% - \fi - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@y{#2}% - \let\pgfplots@yarg=\pgfmathresult% - \pgfplots@datascaletrafo@y{#4}% - \let\pgfplots@error@yarg=\pgfmathresult% - \else - \def\pgfplots@yarg{#2}% - \def\pgfplots@error@yarg{#4}% - \fi - \edef\pgfplots@loc@TMPa{{(\pgfplots@xarg,\pgfplots@yarg)}{(\pgfplots@error@xarg,\pgfplots@error@yarg)}}% - \def\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}}% - \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfeov -} - -\def\pgfplots@errorbar@draw#1#2{% - \begingroup - \ifpgfplots@apply@datatrafo - \pgfplots@errorbar@draw@float#1#2 - \else - \pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov% - \fi - \endgroup -}% - -% Also provides UNFILTERED arguments x (#5) and y (#6). These are use -% in case of logplots, because we may need to compute log( x + e_x ) -% or log( y + e_y ). -\def\pgfplots@process@errorbar@for#1#2#3#4#5#6{% -% \begingroup - \edef\pgfplots@xarg{#1}% - \edef\pgfplots@yarg{#2}% - \def\pgfplots@xarg@unfiltered{#5}% - \def\pgfplots@yarg@unfiltered{#6}% - \edef\pgfplots@error@xarg{#3}% - \edef\pgfplots@error@yarg{#4}% - \def\pgfplots@loc@TMPa{0}% - \ifx\pgfplots@loc@TMPa\pgfplots@error@xarg - \let\pgfplots@error@xarg=\pgfutil@empty - \fi - \ifx\pgfplots@loc@TMPa\pgfplots@error@yarg - \let\pgfplots@error@yarg=\pgfutil@empty - \fi - % FIXME : INEFFICIENT! This code here does every computation - % multiple times! - \ifcase\pgfplots@errorbars@xdirection - \or - \pgfplots@process@errorbar@@for{x}{+}1% - \or - \pgfplots@process@errorbar@@for{x}{-}2% - \or - \pgfplots@process@errorbar@@for{x}{+}1% - \pgfplots@process@errorbar@@for{x}{-}2% - \fi - \ifcase\pgfplots@errorbars@ydirection - \or - \pgfplots@process@errorbar@@for{y}{+}1% - \or - \pgfplots@process@errorbar@@for{y}{-}2% - \or - \pgfplots@process@errorbar@@for{y}{+}1% - \pgfplots@process@errorbar@@for{y}{-}2% - \fi -% \endgroup -} - -% #1: either 'x' or 'y' -% #2: either '+' or '-' -% #3: an integer representing the argument #2. It is '1' if #2='+' -% and '2' is #2 = '-'. -\def\pgfplots@process@errorbar@@for#1#2#3{% - \csname ifpgfplots@#1islinear\endcsname - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \ifcase\csname pgfplots@errorbars@#1mode\endcsname - % fixed absolute error. - \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \let\pgfplots@error@coord=\pgfmathresult - \or% fixed relative error: - \pgfmathparse{(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \or% explicit absolute: - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \let\pgfplots@error@coord=\pgfmathresult - \fi - \or% explicit relative: - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathparse{(1#2\pgfplots@error@coord)}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \fi - \fi - \else - % LOGARITHMIC scaling. All errors are interpreted as - % log(x +- e_x) - % or - % log( x*(1+-e_x) ) - \ifcase\csname pgfplots@errorbars@#1mode\endcsname - % fixed absolute, log( x +- e_x ) - \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatparsenumber{\pgfplots@error@src}% - \let\pgfplots@error@src=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \pgfmathlog@float{\pgfmathresult}% - \let\pgfplots@error@coord=\pgfmathresult - \or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x) - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \pgfmathparse{\pgfplots@error@src + ln(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% - \let\pgfplots@error@coord=\pgfmathresult% - \or% explicit absolute - \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathfloatparsenumber{\pgfplots@error@coord}% - \let\pgfplots@error@coord=\pgfmathresult - \pgfmathfloatparsenumber{\pgfplots@error@src}% - \let\pgfplots@error@src=\pgfmathresult - \ifnum#3=1 - \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% - \else - \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% - \fi - \pgfmathlog@float{\pgfmathresult}% - \let\pgfplots@error@coord=\pgfmathresult - \fi - \or% explicit relative: - \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% - \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \pgfmathparse{\pgfplots@error@src + ln(1#2 \pgfplots@error@coord)}% - \let\pgfplots@error@coord=\pgfmathresult% - \fi - \fi - \fi - \ifx\pgfplots@error@coord\pgfutil@empty - \else - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \pgfplots@update@limits@for@one@point{\pgfplots@error@coord}{\pgfplots@yarg}{}{}% - \edef\pgfplots@loc@TMPa{% - {(\pgfplots@xarg,\pgfplots@yarg)}% - {(\pgfplots@error@coord,\pgfplots@yarg)}% - }% - \else - \pgfplots@update@limits@for@one@point{\pgfplots@xarg}{\pgfplots@error@coord}{}{}% - \edef\pgfplots@loc@TMPa{% - {(\pgfplots@xarg,\pgfplots@yarg)}% - {(\pgfplots@xarg,\pgfplots@error@coord)}% - }% - \fi - \expandafter\pgfplots@streamerrorbarcoords\pgfplots@loc@TMPa - \fi -} - -\long\def\pgfplots@path#1;{% - \pgfplots@path@enqueue{#1;}% -} - -% This thing here shall be used to replace any '\path' where \axispath -% shall be used. -\long\def\pgfplots@replacement@for@tikz@path#1;{% - \axispath\path#1;% -} - % Will be available as \closedcycle command inside of an axis. % @@ -3886,30 +2300,6 @@ \advance\pgfplots@numplots by-1 }} -% This routine is called at the begin of every plot. -% It initialised a zero level stream. -% -% The default is to use '0' as zero level streams. -% -% This method is called as "precommand"; before any Tikz drawing -% commands have been started. -\def\pgfplots@initzerolevelhandler{% - \ifpgfplots@stackedmode - % ATTENTION: this thing here says: - % "draw zero level coordinates from list XYZ." - % But at the time of this initialisation, the list will be EMPTY! - % - % It will be filled later. That's ok, because - % \pgfplots@initzerolevelhandler will be - % used as 'precommand', that means before Tikz sees any - % coordinates. - \pgfplots@stacked@initzerolevelhandler - \else - \pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}% - \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% - \fi -} - \def\pgfplots@try@mirror@plot@handler{% \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler % this method assigns '\tikz@plot@handler'. @@ -3998,7 +2388,7 @@ \curcolumnNum=0 \maxcolumnCount=\pgfplots@legend@columns\relax % - \loop + \pgfutil@loop \ifnum0<\pgfplots@numplots\relax \pgfplots@pop@next@legend \ifx\pgfplots@curlegend\pgfutil@empty @@ -4032,7 +2422,15 @@ \ifnum\curcolumnNum=\maxcolumnCount \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else + \pgfplotslistcheckempty\pgfplots@legend \ifnum\pgfplots@numplots=0 + \pgfplotslistemptytrue + \fi + \ifpgfplotslistempty + % Ok, either the legend list is empty or + % there are no more plots. + % + % Finalize matrix: \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}% \else \t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\pgfmatrixnextcell}% @@ -4048,7 +2446,7 @@ \fi \expandafter\t@pgfplots@toka\expandafter{\pgfplots@glob@TMPa}% \fi - \repeat + \pgfutil@repeat \t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}% \xdef\pgfplots@glob@TMPa{% \noexpand\def\noexpand\plotnum{0}% @@ -4064,90 +2462,7 @@ \pgfplots@already@computed@legend@node } -\newif\ifpgfplots@checkuniform@isfirst -% Checks whether the argument to xtick or ytick is a UNIFORM tick -% sequence. -% -% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but -% NOT 0,2,4 or 4,10. -% -% Furthermore, any NON-integer tick arguments are also assumed to be -% NOT uniform. -% -% INPUT: -% #1: a tick argument (i.e. something which can be put to -% \foreach \x in {#1}) -% -% OUTPUT: -% \pgfplots@isuniformticktrue -% or -% \pgfplots@isuniformtickfalse -% depending on the check. -% This variable will be set globally. -\def\pgfplots@checkisuniformLOGtick#1{% - \begingroup - \global\pgfplots@isuniformticktrue - \pgfplots@checkuniform@isfirsttrue - \foreach \x in {#1}{% - \pgfmathmultiply@\x\reciproclogten - \let\cur=\pgfmathresult - % check whether - % \cur - last == 1 (last = \pgfplots@glob@TMPb) - \ifpgfplots@checkuniform@isfirst - \global\pgfplots@checkuniform@isfirstfalse - \else - \pgfmathsubtract@\cur\pgfplots@glob@TMPb% - \pgfmathapproxequalto@\pgfmathresult{1.0}% - \ifpgfmathcomparison - \else - \global\pgfplots@isuniformtickfalse - \breakforeach - \fi - \fi - \global\let\pgfplots@glob@TMPb=\cur - }% - \endgroup -} - -% Checks whether the linear tick sequence #1 is a uniform tick. -% -% It also assigns pgfplots@tick@distance@#1 as the distance. -% -% see \pgfplots@checkisuniformLOGtick for details. -% -% #1: a tick sequence (expanded) -% #2: a macro which will be filled with the tick distance. This is -% only valid if \pgfplots@isuniformticktrue. -\def\pgfplots@checkisuniformLINEARtick#1#2{% - \begingroup - \global\pgfplots@isuniformticktrue - \pgfplots@checkuniform@isfirsttrue - \global\let\pgfplots@glob@TMPb=\pgfutil@empty - \global\def\pgfplots@glob@TMPa{1}% - \foreach \x in {#1}{% - \ifx\pgfplots@glob@TMPb\pgfutil@empty - \else - \pgfmathsubtract@\x\pgfplots@glob@TMPb - \ifpgfplots@checkuniform@isfirst - % remember first distance h = x_1 - x_0 - \global\let\pgfplots@glob@TMPa=\pgfmathresult - \global\pgfplots@checkuniform@isfirstfalse - \else - % check whether x_i - x_{i-1} = h - \pgfmathapproxequalto@\pgfmathresult\pgfplots@glob@TMPa% - \ifpgfmathcomparison - \else - \global\pgfplots@isuniformtickfalse - \breakforeach - \fi - \fi - \fi - \global\let\pgfplots@glob@TMPb=\x% - }% - \endgroup - \let#2=\pgfplots@glob@TMPa -} - +% DEPRECATED. \def\skipsuffixzero#1.#2|{ {% \def\pgfplots@loc@TMPa{#2}% @@ -4184,20 +2499,6 @@ \pgfmathresult } -% helper method which computes log10*\x foreach \x in {#1}. -% The result will be \xdef'ed into #2. -\def\pgfplots@compute@tick@times@logten#1\to#2{% - \global\let#2=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathmultiply@\pgfplots@loc@TMPb\logten% - \ifx#2\pgfutil@empty - \xdef#2{\pgfmathresult}% - \else - \xdef#2{#2,\pgfmathresult}% - \fi - }% -} - \def\pgfplots@enlarge@limit@ifconfigured#1{% \pgfplots@enlargelimits@autofalse \pgfplots@enlargelimitsfalse @@ -4297,423 +2598,8 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb } -% Computes tick positions using the current axis limits. -% -% Parameters: -% /pgfplots/max space between ticks -% Determines the maximum space which is not filled by at least one -% tick label (approximate, there is some rounding internally) -% /pgfplots/try min ticks -% see manual -% -% Idea: -% We want ticks at each -% { i*H, i in \Z }. -% Of course, there shouldn't be TOO MUCH ticks. -% -% Our heuristics is to set -% desirednumticks = round(ACTUAL WIDTH / (max space between ticks) ) -% and generate H = (axis range) / (desirednumticks). -% -% Since not all step sizes H look well, restrict H to a set of allowed -% step sizes such as -% { 1, 1/2, 1/5, 1/10 }, -% or, to be more precise: -% { 1*10^e, 2*10^e, 5*10^e } -% -> round to the nearest matching number! -% -% For log-plots, -% H in { j*log(10), j=1,2,3,... } -% where the usual case should be j = 1. -% -% Then, the resulting tick is -% TICK={MIN,MIN+H,...,MAX} -% where -% MIN = I*H -% is chosen such that -% axis minimum limit = I*H + rest; |rest| < H. -% -% Again, log plots follow a slightly different approach: here, -% MIN = I * log(10) -% is chosen such that -% axis minimum limit = I*log(10) + rest; |rest| < log(10) -% while H = j*log(10), j>=1. -% -% -% PRECONDITION: -% - limits are correct -% - axis width/height is set correctly -% -% POSTCONDITION: -% - Tick for axis #1 is assigned -% - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick is set -% -% REMARKS: -% - this algorithms works also if the data range has been transformed -% with a LINEAR transformation. -% ATTENTION: as of 2008-05-15, the scaling trafo is AFFINE LINEAR. -% That means we have to eliminate the 'affine' shifting before the -% algorithms works correctly. -\def\pgfplots@assign@default@tick@foraxis#1{% - \begingroup - % Shortcut-names: - \expandafter\let\expandafter\ifpgfplots@is@datascaled\csname ifpgfplots@apply@datatrafo@#1\endcsname - % Attention here: use UNSHIFTET scalings, see remark above - \expandafter\let\expandafter\pgfplots@data@scale@trafo\csname pgfplots@datascaletrafo@#1@noshift\endcsname - \expandafter\let\expandafter\pgfplots@data@scale@inverse@trafo\csname pgfplots@inverse@datascaletrafo@#1@noshift\endcsname - \expandafter\let\expandafter\ifpgfplots@cur@is@linear\csname ifpgfplots@#1islinear\endcsname - % - \let\desirednumticks=\c@pgf@countd - \let\Wr=\pgf@xc - \Wr=\csname pgfplots@#1coordmaxTEX\endcsname - \advance\Wr by-\csname pgfplots@#1coordminTEX\endcsname - % r = max place without ticks in pt -> choose desirednumticks >= W/r - \expandafter\expandafter\divide\Wr\axisdefaulttickwidth - \pgfmathsetcount{\desirednumticks}{\Wr}% - \advance\desirednumticks by1 - \csname ifpgfplots@#1islinear\endcsname - \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks - \desirednumticks=\axisdefaulttryminticks - \fi - \else - \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks - \desirednumticks=\pgfplots@default@try@minticks@log\relax - \fi - \expandafter\ifx\csname pgfplots@#1tickten\endcsname\pgfutil@empty - \else - % log plot and tickten-option: provide special processing. - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tickten\endcsname}% - \expandafter\pgfplots@compute@tick@times@logten\pgfplots@loc@TMPa\to\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa - \fi - \fi - % - \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty - % Ok, we have either log or linear axis and need default - % ticks MIN,MIN+H,...,MAX. - \let\MINH=\pgf@xa - \let\H=\pgf@xb - \let\MAX=\pgf@ya - \let\MIN=\pgf@yb - % compute step size 'H': - \expandafter\MAX\csname pgfplots@#1max\endcsname pt - \advance\MAX by0.001pt% avoid round errors - %\expandafter\MIN\the\c@pgf@counta pt - \expandafter\MIN\csname pgfplots@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN -%\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.}% - \c@pgf@counta=\desirednumticks - \advance\c@pgf@counta by-1 - \divide\H by\c@pgf@counta -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - \edef\Hmacro{\pgf@sys@tonumber\H}% - \ifpgfplots@cur@is@linear - % CASE LINEAR AXIS - \ifpgfplots@is@datascaled - % This here works if the scaling trafo is linear. - \expandafter\pgfplots@data@scale@inverse@trafo\expandafter{\Hmacro}% - \let\Hmacro=\pgfmathresult - \else - \pgfmathfloatparsenumber{\Hmacro}% - \let\Hmacro=\pgfmathresult - \fi - \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E -%\message{Got T^{-1}(H#1) = \Hmacro}% - % modify the mantisse: - \ifdim\H<2pt - \ifdim\H<1.5pt - \H=1.0pt - \else - \H=2.0pt - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \H=2.0pt\relax - \else - \H=5.0pt\relax - \fi - \else - \ifdim\H<7.5pt - \H=5.0pt\relax - \else - \H=1.0pt\relax - \advance\pgfmathfloat@a@E by1 - \fi - \fi - \fi -%\message{Computed H#1=\the\H [unscaled]; transforming ... }% - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% - \let\Hmacro=\pgfmathresult - \ifpgfplots@is@datascaled - \pgfplots@data@scale@trafo\Hmacro - \else - \pgfmathfloattofixed\Hmacro - \fi - \let\Hmacro=\pgfmathresult -%\message{got H#1=\Hmacro\ [transformed]}% - \expandafter\H\Hmacro pt - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname - % - % Now, we want to activate the Tick set {i*H, i in \Z} - % compute I such that - % xmin = I * H + rest; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - % - % but first: eliminate any 'affine' data scaling! - \ifpgfplots@is@datascaled - \advance\MIN by\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt - \fi - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\pgf@sys@tonumber\H}% - }% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \MIN=\H - \multiply\MIN by\c@pgf@counta - \ifpgfplots@is@datascaled - \advance\MIN by-\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname pt - \fi - \else - % CASE LOG AXIS - % - % search for the "best" H= j* log(10), j an integer. - % - % And prefer j=1 if that is possible (otherwise minor - % ticks are not useful). - \pgfmathmultiply@{\Hmacro}{\reciproclogten}% - \let\Hmacrobaseten=\pgfmathresult - \expandafter\H\pgfmathresult pt -%\message{ [ H / log(10) = \pgfmathresult ]}% - \ifdim\H<2pt - \H=1pt - \else - \ifnum\H<1pt - \H=1pt - \else - \expandafter\pgfmathfloor\expandafter{\pgfmathresult}% - \expandafter\H\pgfmathresult pt - \fi - \fi - \ifdim\H=1pt - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformtrue\endcsname - \pgfplots@isuniformticktrue - \else - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformfalse\endcsname - \pgfplots@isuniformtickfalse - \fi -%\message{final H=\pgf@sys@tonumber{\H} * log(10)}% - \H=\logten\H\relax - % Now, we want to activate the Tick set - % {lowest, lowest+H, ..., highest} - % - % Where - % lowest = I * log(10) + rest, |rest| < log(10). - % this is conceptionally different from the approach for - % linear axes, because H = j*log(10). - % - % remember the original xmin in MINH: - \MINH=\MIN - % - % and compute I and I*log(10) here: - \expandafter\MIN\reciproclogten\MIN\relax - \edef\pgfmathresult{\pgf@sys@tonumber{\MIN}}% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \expandafter\MIN\logten pt - \multiply\MIN by\c@pgf@counta - \ifpgfplots@isuniformtick - \else - % This here is a special case to move the first tick - % near the lower axis limit. - % - % "Near" means either directly above or directly below ymin. - % - % My application example is as follows: - % Let H = 2*log(10). - % Furthermore, ymin = 3e-6, ymax= 8e-2. That means we can choose either - % 10^{-5}, 10^{-3}, 10^{-1} - % or - % 10^{-4}, 10^{-2} - % as ticks. Well, I prefer the first one. - % - % HEURISTICS: start as near to ymin as possible! - % - % We check here if we can come nearer to ymin if we - % shift the current tick by log(10): - % if( ymin - I * log(10) < 0.5*H -> use I+1, that means add log(10). - % - % that's equivalent to - % 2*(ymin - I * log(10)) - H < 0. - \advance\MINH by-\MIN - \multiply\MINH by2 - \advance\MINH by-\H - % - \ifdim\MINH<0pt - \expandafter\advance\expandafter\MIN\logten pt - \fi - \fi - \fi - \MINH=\MIN - \advance\MINH by\H - % Ok, now it can happen that only ONE tick label is placed in - % this range. - % That's useless, so check for it. - % - % That's the case if - % MIN < ORIGMIN && MAX < MIN+2 H - % MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by - % construction, but I don't care about this case). - % So: check only the second condition. - \pgfplots@tmpa=\MINH - \advance\pgfplots@tmpa by\H - \ifdim\MAX<\pgfplots@tmpa - \expandafter\aftergroup\csname pgfplots@determinedefaultvalues@#1isuniformfalse\endcsname - % ok, do something special. - % - % The idea is now to place ticks at - % 10^{i*h} with properly choosen 'h'. - % - % So: apply basically the SAME code as above for linear - % axis, just everything log 10! And keep in mind that all - % coordinates are actually given as natural logarithms. - \expandafter\MIN\csname pgfplots@#1min\endcsname pt - \H=\MAX - \advance\H by-\MIN - \H=\reciproclogten\H -%\message{Axis limit #1: [\the\MIN:\the\MAX], diff/log(10) = \the\H.}% - \c@pgf@counta=\desirednumticks\relax - \advance\c@pgf@counta by-1 - \ifnum\c@pgf@counta>2 - % subtract one more. This algorithm here produces more - % ticks than the normal one which is designed for 10^i - \advance\c@pgf@counta by-1 - \fi - \divide\H by\c@pgf@counta\relax -%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% - % - % SEARCH for the NEXT FEASABLE H. - \edef\Hmacro{\pgf@sys@tonumber\H}% - \pgfmathfloatparsenumber{\Hmacro}% - \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E - % Determine properly snapped mantisse... - \ifdim\H<2pt - \ifdim\H<1.5pt - \H=1.0pt - \else - \H=2.0pt - \fi - \else - \ifdim\H<4.9999pt - \ifdim\H<3.5pt - \H=2.0pt\relax - \else - \H=5.0pt\relax - \fi - \else - \ifdim\H<7.5pt - \H=5.0pt\relax - \else - \H=1.0pt\relax - \advance\pgfmathfloat@a@E by1 - \fi - \fi - \fi - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% - \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% - \let\Hmacro=\pgfmathresult - \H=\Hmacro pt% - % Ok, our step size h for 10^{i*h} is ready! -%\message{determined step size 10^{\Hmacro}}% - % Now, we want to activate the Tick set {10^{i*H}, i in \Z} - % compute I such that - % 10^{min} = 10^{I * H + rest}; |rest| < H - % -> I = round(xmin/H) - % -> MIN = I * H - % BUT EVERYTHING to log(10) basis! - \MIN=\reciproclogten\MIN\relax - \pgfmathlog@invoke@expanded\pgfmathdivide@{% - {\pgf@sys@tonumber\MIN}% - {\Hmacro}% - }% - \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% - \ifdim\MIN<0pt - % the truncation rounds TOWARDS 0 which is not what I want. - \advance\c@pgf@counta by-1 - \fi - \MIN=\H\relax - \multiply\MIN by\c@pgf@counta\relax - % - % convert back to basis 'e': - \MIN=\logten\MIN\relax - \H=\logten\H\relax - \MINH=\MIN\relax - \advance\MINH by\H\relax - \fi -%\pgfplots@message{final H=\the\H.}% - \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% - \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\H}}% - \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformtickfalse - \else - \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname - \gdef\pgfplots@glob@TMPb{}% will be computed later, in 'check uniform tick' - \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformticktrue - \fi - \endgroup - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@glob@TMPb -%\pgfplots@message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% -} -% Helper method for -% \pgfplots@apply@data@scale@trafo@to@options@for -% #1: the ticks -% #2: the trafo macro name -% #3: the output macro name -\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% - \let#3=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - \pgfmathfloatparsenumber{\pgfplots@loc@TMPb}% - \expandafter#2\expandafter{\pgfmathresult}% - \ifx#3\pgfutil@empty - \xdef#3{\pgfmathresult}% - \else - \xdef#3{#3,\pgfmathresult}% - \fi - }% - % -}% - -% Helper method for -% \pgfplots@apply@data@scale@trafo@to@options@for -% #1: the ticks ALREADY IN FLOAT FORMAT -% #2: the trafo macro name -% #3: the output macro name -\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat#1#2\to#3{% - \let#3=\pgfutil@empty - \foreach \pgfplots@loc@TMPb in {#1} {% - #2{\pgfplots@loc@TMPb}% - \ifx#3\pgfutil@empty - \xdef#3{\pgfmathresult}% - \else - \xdef#3{#3,\pgfmathresult}% - \fi - }% - % -}% - -% helper for \pgfplots@apply@data@scale@trafo@to@options@for. +% helper for \pgfplots@check@and@apply@datatrafo@for. \def\pgfplots@compute@number@order@for@trafo@isdimen#1\tocount#2{% \edef\pgfplots@loc@TMPa{\pgf@sys@tonumber{#1}}% \pgfmathfloatparsenumber{\pgfplots@loc@TMPa}% @@ -4721,7 +2607,7 @@ \advance#2 by1\relax } -% helper for \pgfplots@apply@data@scale@trafo@to@options@for. +% helper for \pgfplots@check@and@apply@datatrafo@for. % \def\pgfplots@compute@number@order@for@trafo@isfloat#1\tocount#2{% \expandafter\pgfmathfloat@decompose@E#1\relax#2\relax @@ -4738,210 +2624,235 @@ % - the scaling transformation is set up, % - all axis limits are transformed, % - any user input (like ticks and tick labels) -% will reflect the changes. -\def\pgfplots@apply@data@scale@trafo@to@options@for#1{% - % initialise data scale transformation - % T(x) = 10^{q-m} * x - % - \begingroup - \let\data@max@order=\c@pgf@counta - \let\data@cur@order=\c@pgf@countb - \let\data@dimen=\pgf@xa - \let\data@tmp=\pgf@xb - \let\data@dimen@order=\c@pgf@countc - \let\data@EXPONENT=\c@pgf@countd - \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname - \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname - \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname - \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname - \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname - \ifpgfplots@autocompute@all@limits - \else - \pgfmathfloatmax@{\pgfplots@display@max@float}{\pgfplots@data@max@float}% - \let\pgfplots@data@max@float=\pgfmathresult - \pgfmathfloatmin@{\pgfplots@display@min@float}{\pgfplots@data@min@float}% - \let\pgfplots@data@min@float=\pgfmathresult - \fi - % - % Step 1: compute 'm', the data order - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@min@float - \tocount\data@cur@order - % - \data@max@order=\data@cur@order - % - \pgfplots@compute@number@order@for@trafo@isfloat - \pgfplots@data@max@float - \tocount\data@cur@order - % - \ifnum\data@cur@order>\data@max@order - \data@max@order=\data@cur@order - \fi - % - % Step 2: compute 'q', the #1-size of the axis. - \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty - % We have 'width' or 'height'. +% EXCEPT unit vectors will reflect the changes. +% +% Unit vectors will be scaled later. +\def\pgfplots@check@and@apply@datatrafo@for#1{% + \expandafter\let\expandafter\if@datascaled@cur\csname ifpgfplots@apply@datatrafo@#1\endcsname + \if@datascaled@cur + \pgfplots@letcsname pgfplots@#1min@unscaled@as@float={pgfplots@#1min}% + \pgfplots@letcsname pgfplots@#1max@unscaled@as@float={pgfplots@#1max}% + % initialise data scale transformation + % T(x) = 10^{q-m} * x % - % Use the order of these parameters. - \def\pgfplots@loc@TMPa{#1}% - \def\pgfplots@loc@TMPb{x}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@width\relax + \begingroup + \let\data@max@order=\c@pgf@counta + \let\data@cur@order=\c@pgf@countb + \let\data@dimen=\pgf@xa + \let\data@tmp=\pgf@xb + \let\data@dimen@order=\c@pgf@countc + \let\data@EXPONENT=\c@pgf@countd + \expandafter\let\expandafter\pgfplots@display@min@float\csname pgfplots@#1min\endcsname + \expandafter\let\expandafter\pgfplots@display@max@float\csname pgfplots@#1max\endcsname + \expandafter\let\expandafter\pgfplots@data@min@float\csname pgfplots@data@#1min\endcsname + \expandafter\let\expandafter\pgfplots@data@max@float\csname pgfplots@data@#1max\endcsname + \expandafter\let\expandafter\pgfplots@actual@trafo\csname pgfplots@datascaletrafo@#1\endcsname + \ifpgfplots@autocompute@all@limits \else - \def\pgfplots@loc@TMPb{y}% + \pgfplotsmathfloatmax{\pgfplots@display@max@float}{\pgfplots@data@max@float}% + \let\pgfplots@data@max@float=\pgfmathresult + \pgfplotsmathfloatmin{\pgfplots@display@min@float}{\pgfplots@data@min@float}% + \let\pgfplots@data@min@float=\pgfmathresult + \fi + % + % Step 1: compute 'm', the data order + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@data@min@float + \tocount\data@cur@order + % + \data@max@order=\data@cur@order + % + \pgfplots@compute@number@order@for@trafo@isfloat + \pgfplots@data@max@float + \tocount\data@cur@order + % + \ifnum\data@cur@order>\data@max@order + \data@max@order=\data@cur@order + \fi + % + % Step 2: compute 'q', the #1-size of the axis. + \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + % We have 'width' or 'height'. + % + % Use the order of these parameters. + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{x}% \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - \data@dimen=\pgfplots@height\relax + \data@dimen=\pgfplots@width\relax + \else + \def\pgfplots@loc@TMPb{y}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \data@dimen=\pgfplots@height\relax + \fi \fi + \pgfplots@compute@number@order@for@trafo@isdimen + \data@dimen + \tocount\data@dimen@order + % This here is to avoid inaccuracies in the final + % axis rectangle size, see \pgfplots@initsizes: + %\advance\data@dimen@order by-1 + \else + % FIXME: + % we have either the 'x=1cm' or 'y=1cm' option! + % How should I initialise the trafo!? + \data@dimen@order=3 \fi - \pgfplots@compute@number@order@for@trafo@isdimen - \data@dimen - \tocount\data@dimen@order - % This here is to avoid inaccuracies in the final - % axis rectangle size, see \pgfplots@initsizes: - %\advance\data@dimen@order by-1 - \else - % FIXME: - % we have either the 'x=1cm' or 'y=1cm' option! - % How should I initialise the trafo!? - \data@dimen@order=3 - \fi - % -%\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% - \data@EXPONENT=\data@dimen@order - \advance\data@EXPONENT by-\data@max@order - % Now, I introduce a loop which shall avoid cancellation of - % significant digits. - % - % Harmless Example: - % if we have data shift = -3 and - % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. - % In this case, the loop won't change anything. - % - % Critical Example: - % if we have data shift = -3 and - % max = 1980, min = 1930 then - % T(max) = 1.98 and T(min) = 1.93 - % and thus T(max)-T(min) = 0.05 . - % Considering that this is the axis range - % in which tick labels and plot points need to be computed, we - % only have two or three digits left! That happens because the - % prefix '19' is common and is cancelled in the subtraction. - % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 - % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). - % - \pgfplots@loop@CONTINUEtrue - \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% - \loop - \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% - \pgfplots@actual@trafo{\pgfplots@data@min@float}% - \let\pgfplots@min@fixed=\pgfmathresult - \ifpgfplots@loop@CONTINUE - \pgfplots@actual@trafo{\pgfplots@data@max@float}% - \let\pgfplots@max@fixed=\pgfmathresult - \expandafter\data@tmp\pgfplots@max@fixed pt -%\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% - \ifdim\data@tmp<0pt - % I need absolute values here: - \multiply\data@tmp by-1\relax - \fi - \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% - \expandafter\data@dimen\pgfmathresult pt - \pgfplots@loop@CONTINUEfalse - \ifdim\data@tmp<1500pt% a multiplication with '10' results in max = 15000 which is the upper limit. - \ifdim\data@dimen<100pt% I guess if max-min = O(100), we have quite good accuracy - \ifdim\data@dimen<0.0001pt - \else - \advance\data@EXPONENT by1 - \pgfplots@loop@CONTINUEtrue + % + %\message{Direction #1: data max order=\the\data@max@order; data dimen order=\the\data@dimen@order. }% + \data@EXPONENT=\data@dimen@order + \advance\data@EXPONENT by-\data@max@order + % Now, I introduce a loop which shall avoid cancellation of + % significant digits. + % + % Harmless Example: + % if we have data shift = -3 and + % max = 2e6, min = 1e6, then max-min = 1e6; T(max)-T(min) = 1e3 which is ok. + % In this case, the loop won't change anything. + % + % Critical Example: + % if we have data shift = -3 and + % max = 1980, min = 1930 then + % T(max) = 1.98 and T(min) = 1.93 + % and thus T(max)-T(min) = 0.05 . + % Considering that this is the axis range + % in which tick labels and plot points need to be computed, we + % only have two or three digits left! That happens because the + % prefix '19' is common and is cancelled in the subtraction. + % Idea: while T(max)-T(min) < O(10^2) -> increase shift by +1 + % (and make sure that T(max) < MAX_VALID_TEX_NUMBER). + % + \pgfplots@loop@CONTINUEtrue + \expandafter\edef\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \pgfutil@loop + \expandafter\edef\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname{\the\data@EXPONENT}% + \pgfplots@actual@trafo{\pgfplots@data@min@float}% + \let\pgfplots@min@fixed=\pgfmathresult + \ifpgfplots@loop@CONTINUE + \pgfplots@actual@trafo{\pgfplots@data@max@float}% + \let\pgfplots@max@fixed=\pgfmathresult + \expandafter\data@tmp\pgfplots@max@fixed pt + %\message{Current trafo EXPONENT for #1 direction: \the\data@EXPONENT; original #1 data limits: [\pgfplots@data@min@float:\pgfplots@data@max@float]; current transformed #1 limits: [\pgfplots@min@fixed:\pgfplots@max@fixed]; cancellation check max-min running...}% + \ifdim\data@tmp<0pt + % I need absolute values here: + \multiply\data@tmp by-1\relax + \fi + \pgfmathsubtract@{\pgfplots@max@fixed}{\pgfplots@min@fixed}% + \expandafter\data@dimen\pgfmathresult pt + \pgfplots@loop@CONTINUEfalse + \ifdim\data@tmp<1500pt % a multiplication with '10' results in max = 15000 which is the upper limit. + \ifdim\data@dimen<100pt % I guess if max-min = O(100), we have quite good accuracy + \ifdim\data@dimen<0.0001pt + \else + \advance\data@EXPONENT by1 + \pgfplots@loop@CONTINUEtrue + \fi \fi \fi + %-------------------------------------------------- + % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! + % \ifdim\data@dimen>7999pt + % \advance\data@EXPONENT by-2 + % \else + % \advance\data@EXPONENT by-1 + % \fi + % \pgfplots@loop@CONTINUEfalse + % \fi + %-------------------------------------------------- + \pgfutil@repeat + \xdef\pgfplots@glob@TMPa{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% + \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% + \endgroup + %\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% + % COMPLETE INITIALISATION: + \ifpgfplots@disabledatascaling + % this here is a waste of time, I know it. One could really + % safe a lot of CPU time when disabledatascaling is enabled... + % but it requires so much extra cases; I really don't want + % that! + \gdef\pgfplots@glob@TMPa{0}% + \gdef\pgfplots@glob@TMPb{0}% + \fi + \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@glob@TMPa + \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@glob@TMPb% + % + % ... and apply transformation to any user input + % + % Transform axis limits: + %\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1min\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + % + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1max\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult + %\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% + % Transform tick limits (if they are set): + %\message{#1- display tick limits BEFORE data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% + \expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty + \else + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmin\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult \fi - %-------------------------------------------------- - % \ifdim\data@dimen>1200pt% FIXME : is this here ok!? CHECK IT! - % \ifdim\data@dimen>7999pt - % \advance\data@EXPONENT by-2 - % \else - % \advance\data@EXPONENT by-1 - % \fi - % \pgfplots@loop@CONTINUEfalse - % \fi - %-------------------------------------------------- - \repeat - \xdef\pgfplots@glob@TMPa{\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname}% - \xdef\pgfplots@glob@TMPb{\pgfplots@min@fixed}% - \endgroup -%\message{Initialising the data scale transformation in direction #1 to 10^\pgfplots@glob@TMPa*#1 - \pgfplots@glob@TMPb...}% - % COMPLETE INITIALISATION: - \ifpgfplots@disabledatascaling - % this here is a waste of time, I know it. One could really - % safe a lot of CPU time when disabledatascaling is enabled... - % but it requires so much extra cases; I really don't want - % that! - \gdef\pgfplots@glob@TMPa{0}% - \gdef\pgfplots@glob@TMPb{0}% - \fi - \expandafter\let\csname pgfplots@data@scale@trafo@EXPONENT@#1\endcsname\pgfplots@glob@TMPa - \expandafter\let\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname\pgfplots@glob@TMPb% - % - % ... and apply transformation to any user input - % - % Transform axis limits: -%\message{#1- display limits BEFORE data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1min\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult - % - \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1max\endcsname}% - \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult -%\message{#1- display limits after data transformation: [\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname]}% - % - % Convert any user-specified ticks: - \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}% - % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb - % we have #1tick = data - % - % Since we have entered this method, we know that these - % coordinate ARE ALREADY in floating point representation. - \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + % + \expandafter\ifx\csname pgfplots@#1tickmax\endcsname\pgfutil@empty + \else + \expandafter\expandafter\csname pgfplots@datascaletrafo@#1\endcsname\expandafter{\csname pgfplots@#1tickmax\endcsname}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + %\message{#1- display tick limits after data transformation: [\csname pgfplots@#1tickmin\endcsname:\csname pgfplots@#1tickmax\endcsname]}% + % + % Convert any user-specified ticks: + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}% + % this here should also work with 'xtick=\pgfutil@empty', the "No tick" command. + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% + \def\pgfplots@loc@TMPb{data}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + % we have #1tick = data + % + % Since we have entered this method, we know that these + % coordinate ARE ALREADY in floating point representation. + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@firstplot@coords@#1\endcsname + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + % clear structure: + \expandafter\global\expandafter\let\csname pgfplots@firstplot@coords@#1\endcsname=\pgfutil@empty + \else + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + %\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% + \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \fi + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc + \fi + % + % Convert any extra-ticks, see above. + \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty \else - \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% -%\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}% - \edef\pgfplots@loc@TMPa{{\the\t@pgfplots@toka}\the\t@pgfplots@tokc}% + \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% + \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}\the\t@pgfplots@tokc}% \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc + \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc \fi - \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@loc@TMPc - \fi - % - % Convert any extra-ticks, see above. - \edef\pgfplots@loc@TMPa{\csname pgfplots@extra@#1tick\endcsname}% - \ifx\pgfplots@loc@TMPa\pgfutil@empty - \else - \t@pgfplots@tokc=\expandafter{\csname pgfplots@datascaletrafo@#1\endcsname}% - \edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}\the\t@pgfplots@tokc}% - \expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa\to\pgfplots@loc@TMPc - \expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc - \fi - % - % Transform any explicit axis unit scalings: - \expandafter\ifx\csname pgfplots@#1\endcsname\pgfutil@empty + % + % Transform any explicit axis unit scalings: + % WILL BE DONE LATER! \else -%\message{Converting #1 unit scale='\csname pgfplots@#1\endcsname' ... }% - \expandafter\pgfmathparse\expandafter{\csname pgfplots@#1\endcsname}% - \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% - \expandafter\edef\csname pgfplots@#1\endcsname{\pgfmathresult pt}% -%\message{to #1='\csname pgfplots@#1\endcsname'.}% + \expandafter\def\csname pgfplots@data@scale@trafo@SHIFT@#1\endcsname{0}% + \def\pgfplots@loc@TMPb{data}% + \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfplots@loc@TMPb + \pgfplots@letcsname pgfplots@#1tick={pgfplots@firstplot@coords@#1}% + % clear structure: + \expandafter\global\expandafter\let\csname pgfplots@firstplot@coords@#1\endcsname=\pgfutil@empty + \fi + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfutil@empty + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfutil@empty \fi } -\newif\ifpgfplots@determinedefaultvalues@xisuniform -\newif\ifpgfplots@determinedefaultvalues@yisuniform +\newif\ifpgfplots@determinedefaultvalues@isuniform \newif\ifpgfplots@determinedefaultvalues@needs@check@uniformtick \newif\ifpgfplots@limits@are@computed @@ -4959,6 +2870,8 @@ \gdef\pgfplots@xmin{0}% \gdef\pgfplots@xmax{1}% \fi + % unnecessary? they will be reset anyway because empty plots are + % recognised before any other axis limit routine \ifpgfplots@yislinear \pgfmathfloatcreate{0}{0.0}{0}% \global\let\pgfplots@ymin=\pgfmathresult @@ -4970,6 +2883,7 @@ \gdef\pgfplots@ymin{0}% \gdef\pgfplots@ymax{1}% \fi + \pgfplots@threedimfalse \def\pgfplots@xtick{}% \def\pgfplots@ytick{}% \def\pgfplots@extra@xtick{}% @@ -4984,15 +2898,23 @@ \ifx\pgfplots@xmin\pgfplots@invalidrange@xmin \pgfplots@limits@are@computedfalse \fi - \ifx\pgfplots@xmin\pgfplots@invalidrange@xmax + \ifx\pgfplots@xmax\pgfplots@invalidrange@xmax \pgfplots@limits@are@computedfalse \fi \ifx\pgfplots@ymin\pgfplots@invalidrange@ymin \pgfplots@limits@are@computedfalse \fi - \ifx\pgfplots@ymin\pgfplots@invalidrange@ymax + \ifx\pgfplots@ymax\pgfplots@invalidrange@ymax \pgfplots@limits@are@computedfalse \fi + \ifpgfplots@threedim + \ifx\pgfplots@zmin\pgfplots@invalidrange@zmin + \pgfplots@limits@are@computedfalse + \fi + \ifx\pgfplots@zmax\pgfplots@invalidrange@zmax + \pgfplots@limits@are@computedfalse + \fi + \fi \ifpgfplots@limits@are@computed \ifx\pgfplots@data@xmin\pgfplots@invalidrange@xmin \global\let\pgfplots@data@xmin=\pgfplots@xmin @@ -5006,19 +2928,32 @@ \ifx\pgfplots@data@ymin\pgfplots@invalidrange@ymax \global\let\pgfplots@data@ymax=\pgfplots@ymax \fi + \ifx\pgfplots@data@zmin\pgfplots@invalidrange@zmin + \global\let\pgfplots@data@zmin=\pgfplots@zmin + \fi + \ifx\pgfplots@data@zmin\pgfplots@invalidrange@zmax + \global\let\pgfplots@data@zmax=\pgfplots@zmax + \fi \ifpgfplots@clip@limits \else % there is a rare change that min > max. % Handle that ... - \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% \global\let\pgfplots@xmax=\pgfmathresult % - \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymin=\pgfmathresult - \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% \global\let\pgfplots@ymax=\pgfmathresult + % + \ifpgfplots@threedim + \pgfplotsmathfloatmin{\pgfplots@zmin}{\pgfplots@zmax}% + \global\let\pgfplots@zmin=\pgfmathresult + \pgfplotsmathfloatmax{\pgfplots@zmin}{\pgfplots@zmax}% + \global\let\pgfplots@zmax=\pgfmathresult + \fi \fi \else \pgfplots@handle@invalid@range @@ -5026,31 +2961,45 @@ }% +% This method finishes the accumulated information of axis limits and +% all internal flag fields. +% +% PRECONDITION: +% - all plots are finally finished; axis and data limits are known. +% +% POSTCONDITION: +% - the scaling transformation is set-up and applied to all user +% inputs and axis limits. +% - the \pgfplots@[xy][min,max] variables and associated TeX +% registers are set up and final. They should not be changed +% afterwards. +% - any tick lists etc. are final. +% \def\pgfplots@determinedefaultvalues{% \pgfplots@check@invalid@range % %-------------------------------------------------- %FIXME % \ifpgfplots@float@numerics@mode@x - % \pgfmathfloatmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathfloatmin{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmin=\pgfmathresult - % \pgfmathfloatmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathfloatmax{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmax=\pgfmathresult % \else - % \pgfmathmin@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathmin{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmin=\pgfmathresult - % \pgfmathmax@{\pgfplots@xmin}{\pgfplots@xmax}% + % \pgfplotsmathmax{\pgfplots@xmin}{\pgfplots@xmax}% % \let\pgfplots@xmax=\pgfmathresult % \fi % \ifpgfplots@float@numerics@mode@y - % \pgfmathfloatmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathfloatmin{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymin=\pgfmathresult - % \pgfmathfloatmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathfloatmax{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymax=\pgfmathresult % \else - % \pgfmathmin@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathmin{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymin=\pgfmathresult - % \pgfmathmax@{\pgfplots@ymin}{\pgfplots@ymax}% + % \pgfplotsmathmax{\pgfplots@ymin}{\pgfplots@ymax}% % \let\pgfplots@ymax=\pgfmathresult % \fi %-------------------------------------------------- @@ -5060,36 +3009,16 @@ \pgfplots@set@default@size@options % % - \ifpgfplots@apply@datatrafo@x - \let\pgfplots@xmin@unscaled@as@float=\pgfplots@xmin - \let\pgfplots@xmax@unscaled@as@float=\pgfplots@xmax - \pgfplots@apply@data@scale@trafo@to@options@for x% - \else - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@xtick\pgfplots@loc@TMPb - \let\pgfplots@xtick=\pgfplots@firstplot@coords@x - \fi - \let\pgfplots@xmin@unscaled@as@float=\pgfutil@empty - \let\pgfplots@xmax@unscaled@as@float=\pgfutil@empty - \fi - \ifpgfplots@apply@datatrafo@y - \let\pgfplots@ymin@unscaled@as@float=\pgfplots@ymin - \let\pgfplots@ymax@unscaled@as@float=\pgfplots@ymax - \pgfplots@apply@data@scale@trafo@to@options@for y% - \else - \def\pgfplots@loc@TMPb{data}% - \ifx\pgfplots@ytick\pgfplots@loc@TMPb - \let\pgfplots@ytick=\pgfplots@firstplot@coords@y - \fi - \let\pgfplots@ymin@unscaled@as@float=\pgfutil@empty - \let\pgfplots@ymax@unscaled@as@float=\pgfutil@empty + \pgfplots@check@and@apply@datatrafo@for x% + \pgfplots@check@and@apply@datatrafo@for y% + \ifpgfplots@threedim + \pgfplots@check@and@apply@datatrafo@for z% \fi \pgfplots@datascaletrafo@initialisedtrue % % From now on, we can always work with pgfmath. % We simply need to apply the data scaling trafo before doing so. \pgfkeysgetvalue{/pgfplots/minor x tick num}\pgfplots@minor@xtick@num - \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num \ifpgfplots@xislinear \ifnum\pgfplots@minor@xtick@num=0\relax \pgfplots@xminorticksfalse @@ -5098,6 +3027,11 @@ \pgfplots@xminortickstrue \fi \fi + % + \pgfplots@enlarge@limit@ifconfigured x + \pgfplots@avoid@empty@axis@range@for x% + % + \pgfkeysgetvalue{/pgfplots/minor y tick num}\pgfplots@minor@ytick@num \ifpgfplots@yislinear \ifnum\pgfplots@minor@ytick@num=0\relax \pgfplots@yminorticksfalse @@ -5106,17 +3040,27 @@ \pgfplots@yminortickstrue \fi \fi - % - \pgfplots@enlarge@limit@ifconfigured x \pgfplots@enlarge@limit@ifconfigured y - % - \pgfplots@avoid@empty@axis@range@for x% \pgfplots@avoid@empty@axis@range@for y% + + \ifpgfplots@threedim + \pgfkeysgetvalue{/pgfplots/minor z tick num}\pgfplots@minor@ztick@num + \ifpgfplots@zislinear + \ifnum\pgfplots@minor@ztick@num=0\relax + \pgfplots@zminorticksfalse + \pgfplots@zminorgridsfalse + \else + \pgfplots@zminortickstrue + \fi + \fi + \pgfplots@enlarge@limit@ifconfigured y + \pgfplots@avoid@empty@axis@range@for y% + \fi + % % \pgfplots@initsizes % - \pgfplots@determinedefaultvalues@xisuniformtrue - \pgfplots@determinedefaultvalues@yisuniformtrue + \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue \ifx\pgfplots@xtick\pgfutil@empty \pgfplots@assign@default@tick@foraxis{x}% @@ -5124,27 +3068,52 @@ \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@xislinear \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@xtick}{\pgfplots@tick@distance@x}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@xisuniformtrue - \else - \pgfplots@determinedefaultvalues@xisuniformfalse - \fi \else \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@xtick}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@xisuniformtrue - \else - \pgfplots@determinedefaultvalues@xisuniformfalse - \fi \fi \fi - \ifpgfplots@determinedefaultvalues@xisuniform + \ifpgfplots@isuniformtick \else \pgfplots@xminorticksfalse + \pgfplots@xminorgridsfalse + \fi + % + \ifx\pgfplots@xticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@xtickposnum=3 % right + \def\pgfplots@xticklabelaxisspec{v10}% + \else + \def\pgfplots@xticklabelaxisspec{v00}% + \fi + \fi + \ifx\pgfplots@yticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@ytickposnum=3 % right + \def\pgfplots@yticklabelaxisspec{1v0}% + \else + \def\pgfplots@yticklabelaxisspec{0v0}% + \fi + \fi + \ifx\pgfplots@zticklabelaxisspec\pgfutil@empty + \ifnum\pgfplots@ztickposnum=3 % right + \def\pgfplots@zticklabelaxisspec{01v}% + \else + \def\pgfplots@zticklabelaxisspec{00v}% + \fi + \fi + % + \ifx\pgfplots@xticklabel\pgfutil@empty + \ifpgfplots@xislinear + \def\pgfplots@xticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@xticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@xticklabel\pgfutil@empty + \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel \fi % % % + \pgfplots@isuniformticktrue \pgfplots@determinedefaultvalues@needs@check@uniformticktrue \ifx\pgfplots@ytick\pgfutil@empty \pgfplots@assign@default@tick@foraxis{y}% @@ -5152,35 +3121,16 @@ \ifpgfplots@determinedefaultvalues@needs@check@uniformtick \ifpgfplots@yislinear \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ytick}{\pgfplots@tick@distance@y}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@yisuniformtrue - \else - \pgfplots@determinedefaultvalues@yisuniformfalse - \fi \else \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ytick}% - \ifpgfplots@isuniformtick - \pgfplots@determinedefaultvalues@yisuniformtrue - \else - \pgfplots@determinedefaultvalues@yisuniformfalse - \fi \fi \fi - \ifpgfplots@determinedefaultvalues@yisuniform + \ifpgfplots@isuniformtick \else \pgfplots@yminorticksfalse + \pgfplots@yminorgridsfalse \fi % - \ifx\pgfplots@xticklabel\pgfutil@empty - \ifpgfplots@xislinear - \def\pgfplots@xticklabel{\axisdefaultticklabel}% - \else - \def\pgfplots@xticklabel{\axisdefaultticklabellog}% - \fi - \fi - \ifx\pgfplots@extra@xticklabel\pgfutil@empty - \let\pgfplots@extra@xticklabel=\pgfplots@xticklabel - \fi \ifx\pgfplots@yticklabel\pgfutil@empty \ifpgfplots@yislinear \def\pgfplots@yticklabel{\axisdefaultticklabel}% @@ -5192,49 +3142,40 @@ \let\pgfplots@extra@yticklabel=\pgfplots@yticklabel \fi % - % - \pgfplots@prepare@ZERO@coordinates -} - -% This code is mainly interesting for bar plots. -% -% It precomputes x = 0 and y = 0 - which is not necessarily -% trivial in case of data scaling. Furthermore, it applies -% coordinate clipping to the resulting values and multiplies them -% with x- and y scale vectors. -\def\pgfplots@prepare@ZERO@coordinates{% - \ifpgfplots@xislinear - \ifpgfplots@apply@datatrafo@x - \pgfplots@datascaletrafo@fromfixed@x{0}% - \global\let\pgfplots@ZERO@x=\pgfmathresult - \else - \gdef\pgfplots@ZERO@x{0}% + \ifpgfplots@threedim + \pgfplots@isuniformticktrue + \pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \ifx\pgfplots@ztick\pgfutil@empty + \pgfplots@assign@default@tick@foraxis{z}% \fi - \pgfmathmax@{\pgfplots@ZERO@x}{\pgfplots@xmin}% - \global\let\pgfplots@ZERO@x=\pgfmathresult - \else - \global\let\pgfplots@ZERO@x=\pgfplots@xmin% - \fi - % - \ifpgfplots@yislinear - \ifpgfplots@apply@datatrafo@y - \pgfplots@datascaletrafo@fromfixed@y{0}% - \global\let\pgfplots@ZERO@y=\pgfmathresult + \ifpgfplots@determinedefaultvalues@needs@check@uniformtick + \ifpgfplots@zislinear + \expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@ztick}{\pgfplots@tick@distance@z}% + \else + \expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@ztick}% + \fi + \fi + \ifpgfplots@isuniformtick \else - \gdef\pgfplots@ZERO@y{0}% + \pgfplots@zminorticksfalse + \pgfplots@zminorgridsfalse + \fi + % + \ifx\pgfplots@zticklabel\pgfutil@empty + \ifpgfplots@zislinear + \def\pgfplots@zticklabel{\axisdefaultticklabel}% + \else + \def\pgfplots@zticklabel{\axisdefaultticklabellog}% + \fi + \fi + \ifx\pgfplots@extra@zticklabel\pgfutil@empty + \let\pgfplots@extra@zticklabel=\pgfplots@zticklabel \fi - \pgfmathmax@{\pgfplots@ZERO@y}{\pgfplots@ymin}% - \global\let\pgfplots@ZERO@y=\pgfmathresult - \else - \global\let\pgfplots@ZERO@y=\pgfplots@ymin% \fi % - \pgfinterruptboundingbox% - \pgfpointxy{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}% - \xdef\pgfplots@ZERO@x{\the\pgf@x}% - \xdef\pgfplots@ZERO@y{\the\pgf@y}% - \endpgfinterruptboundingbox% -}% + % + \pgfplots@prepare@ZERO@coordinates +} % Helper method for initsizes. @@ -5244,13 +3185,12 @@ % The actual width is % c + x*(xmax-xmin) % based on -% - x*xmax = \pgfplots@xcoordmaxTEX -% - x*xmin = \pgfplots@xcoordminTEX % - c = estimated, a constant for the axis label/tick labels % % Arguments: -% #1: the output argument for the SCALE. -\def\pgfplots@initsizes@getXscale\into#1{% +% #1: is expected to be x*(xmax-xmin) measured in pt. +% #2: the output argument for the SCALE. +\def\pgfplots@initsizes@getXscale#1\into#2{% \begingroup \pgf@xa=\pgfplots@width\relax % EXPECTED WIDTH = X = \pgfplots@width @@ -5268,8 +3208,7 @@ \pgf@xa=0pt \fi % \pgf@xb := x*(xmax-xmin): - \pgf@xb=\pgfplots@xcoordmaxTEX - \advance\pgf@xb by-\pgfplots@xcoordminTEX + \pgf@xb=#1\relax \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% {\pgf@sys@tonumber\pgf@xb}% @@ -5278,14 +3217,14 @@ % c=estimated, % width-c =\the\pgf@xa, % x*(xmax[=\the\pgfplots@xcoordmaxTEX] - xmin[=\the\pgfplots@xcoordminTEX)]) = \the\pgf@xb -% -> x-scale =#1 }% +% -> x-scale =#2 }% \pgfmath@smuggleone\pgfmathresult \endgroup - \let#1=\pgfmathresult + \let#2=\pgfmathresult } % The same as \pgfplots@initsizes@getXscale, just for the height. -\def\pgfplots@initsizes@getYscale\into#1{% +\def\pgfplots@initsizes@getYscale#1\into#2{% \begingroup \expandafter\pgf@xa\pgfplots@height\relax % EXPECTED WIDTH = X = \pgfplots@width @@ -5302,9 +3241,8 @@ \pgfplots@error{Error: Plot height `\pgfplots@height' is too small. This can't be realised while maintaining constant height for x-labels. Sorry, label heights are only approximate. You will need to adjust your height.}% \pgf@xa=0pt \fi - % \pgf@xb := x*(xmax-xmin): - \pgf@xb=\pgfplots@ycoordmaxTEX - \advance\pgf@xb by-\pgfplots@ycoordminTEX + % \pgf@xb := y*(ymax-ymin): + \pgf@xb=#1% \pgfmathlog@invoke@expanded\pgfmathdivide@{% {\pgf@sys@tonumber\pgf@xa}% {\pgf@sys@tonumber\pgf@xb}% @@ -5314,10 +3252,10 @@ % c=estimated, % height-c =\the\pgf@xa, % y*(ymax[=\the\pgfplots@ycoordmaxTEX] - ymin[=\the\pgfplots@ycoordminTEX)]) = \the\pgf@xb -% -> y-scale =#1 }% +% -> y-scale =#2 }% \pgfmath@smuggleone\pgfmathresult \endgroup - \let#1=\pgfmathresult + \let#2=\pgfmathresult } @@ -5335,8 +3273,8 @@ \let\min@d=\pgf@xa \let\max@d=\pgf@xb \let\diff=\pgf@xc - \expandafter\min@d\pgfplots@@min pt - \expandafter\max@d\pgfplots@@max pt + \expandafter\min@d\pgfplots@@min pt % + \expandafter\max@d\pgfplots@@max pt % \diff=\max@d \advance\diff by-\min@d % FIXME : I need a RELATIVE check here! @@ -5359,20 +3297,20 @@ % the case \pgfplots@@min ~= \pgfplots@@max % % enlarge \pgfplots@@max and shrink \min: - \ifdim\max@d<0pt - \ifdim\max@d<-1pt + \ifdim\max@d<0pt% + \ifdim\max@d<-1pt% \max@d=0.8\max@d \min@d=1.2\min@d \else - \advance\max@d by-1pt - \advance\min@d by1pt + \advance\max@d by-1pt% + \advance\min@d by1pt% \fi \else - \ifdim\max@d>1pt + \ifdim\max@d>1pt% \max@d=1.2\max@d \min@d=0.8\min@d \else - \ifdim\max@d=0pt + \ifdim\max@d=0pt% \if@cur@is@scaled \expandafter\let\expandafter\min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname \expandafter\let\expandafter\max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname @@ -5465,6 +3403,10 @@ % the plot will be resized; keeping the aspect ratio. % \let\pgfplots@default@aspect@ratio=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/x}{\pgfplots@x}% + \pgfkeysgetvalue{/pgfplots/y}{\pgfplots@y}% + \pgfkeysgetvalue{/pgfplots/z}{\pgfplots@z}% + % % CASES: % hasx := 'x' option non-empty % hasy := 'y' option non-empty @@ -5535,6 +3477,320 @@ \fi } +% A helper method for \pgfplots@initsizes which +% - applies the data scaling trafo to user arguments +% - sets calls pgfset#1vec +% - computes \pgfplots@#1@veclength +% - computes \pgfplots@#1@inverseveclength +% +% #1: the vector to set (either 'x' or 'y') +% #2: the index of the vector to set (either 0 or 1) +% #3: the already precomputed temporary scale (see pgfplots@initsizes) +% #4: an output argument. It is a macro name which will be defined to +% '1' if and only if the finally set vector is parallel to the #1 axis +% of PGF, that means (x,0) for #1=x and (0,y) for #2=y. +\def\pgfplots@initsizes@setunitvector#1#2#3#4{% + \expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@#1\endcsname + \expandafter\let\expandafter\if@cur@is@scaled\csname ifpgfplots@apply@datatrafo@#1\endcsname + \ifx\pgfplots@loc@TMPb\pgfutil@empty + \def#4{1}% we have (#1,0) or (0,#1) + % +%\message{Setting unitvector(#1) to auto-computed multiple of e_#2 ...}% + \edef\pgfplots@loc@TMPa{#3}% + \begingroup + \pgf@xa=#3\relax + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup +% FIXME : '\pgfplots@loc@TMPa' contains 'pt' leading to missing +% character warning! + \ifcase#2\relax + \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPa}{0pt}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPa}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPa}}% + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi + % The numbers 1/||e_x|| and 1/||e_y|| are used by the tick + % placement code to convert between logical and physical + % coordinates. FIXME is that accurate enough!? + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \else + % Ok, we have a user-defined unit vector. + % + % That means we also need to apply the scaling trafo! + % + % + % 1. Check whether we have a complete vector of type (x,y): + \expandafter\pgfutil@in@\expandafter(\expandafter{\pgfplots@loc@TMPb}% + \ifpgfutil@in@ + % YES: we have (x,y): + % + \def#4{0}% we DON'T have (#1,0) or (0,#1). At least I think so. + % +%\message{Setting unitvector(#1) to non-standard \csname pgfplots@#1\endcsname ...}% + \def\pgfplots@loc@TMPa(##1,##2){% + \pgfmathparse{##1}% + \ifpgfplots@apply@datatrafo@x + \expandafter\pgfplots@inverse@datascaletrafo@tofixed@x@noshift\expandafter{\pgfmathresult}% + \fi + \let\pgfplots@loc@TMPb=\pgfmathresult + % + \pgfmathparse{##2}% + \ifpgfplots@apply@datatrafo@y + \expandafter\pgfplots@inverse@datascaletrafo@tofixed@y@noshift\expandafter{\pgfmathresult}% + \fi + \let\pgfplots@loc@TMPc=\pgfmathresult + \csname pgfset#1vec\endcsname{\pgfqpoint{\pgfplots@loc@TMPb pt}{\pgfplots@loc@TMPc pt}}% + }% + \expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb% + % + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \else + % NO we simply have a scalar value. + \def#4{1}% we have (#1,0) or (0,#1) +%\message{Setting unitvector(#1) to \csname pgfplots@#1\endcsname * e_{#2}...}% + \if@cur@is@scaled + \pgfmathparse{\csname pgfplots@#1\endcsname}% + \expandafter\expandafter\csname pgfplots@inverse@datascaletrafo@tofixed@#1@noshift\endcsname\expandafter{\pgfmathresult}% + \edef\pgfplots@loc@TMPb{\pgfmathresult pt}% + \fi + \begingroup + \pgf@xa=\pgfplots@loc@TMPb\relax + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup + \ifcase#2\relax + \pgfsetxvec{\pgfqpoint{\pgfplots@loc@TMPb}{0pt}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@loc@TMPb}}% + \pgfmathabs@{\pgfplots@glob@TMPb}% + \or + \pgfsetzvec{\pgfqpoint{\pgfplots@loc@TMPb}{\pgfplots@loc@TMPb}}% + \pgfmathveclen{\csname pgf@#1x\endcsname}{\csname pgf@#1y\endcsname}% + \fi + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \expandafter\pgfmathreciprocal@\expandafter{\pgfmathresult}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + \fi + \fi +}% + +% Applies the 'axis equal' feature. +% +% PRECONDITION: +% - final unit vectors have been set +% - final axis limits are given in transformed range +% - \pgfplots@set@default@size@options has been invoked before +% +% POSTCONDITION: +% - unit vectors have been set to equal length, +% - axis limits have been rescaled such that the axis dimensions +% remain fixed +% +% There is just one algorithmic difficulty: the data scaling +% transformation. All unit vector length above are only meaningful in +% the UNTRANSFORMED range, so we have to mingle with the scaling +% transformation. +\def\pgfplots@axis@equal@apply{% + % Step 1: compute the unit vector which STAYS CONSTANT. + % + % All other ones will be scaled to fit its length. + \ifpgfplots@threedim + \def\pgfplots@axis@equal@apply@reference{x}% + \pgfplots@if@unitveclenlessthan@untransformed xy{% + \pgfplots@if@unitveclenlessthan@untransformed xz{% + \def\pgfplots@axis@equal@apply@reference{x}% + }{}% + }{}% + \pgfplots@if@unitveclenlessthan@untransformed yx{% + \pgfplots@if@unitveclenlessthan@untransformed yz{% + \def\pgfplots@axis@equal@apply@reference{y}% + }{}% + }{}% + \pgfplots@if@unitveclenlessthan@untransformed zx{% + \pgfplots@if@unitveclenlessthan@untransformed zy{% + \def\pgfplots@axis@equal@apply@reference{z}% + }{}% + }{}% + \else + \pgfplots@if@unitveclenlessthan@untransformed xy{% + \def\pgfplots@axis@equal@apply@reference{x}% + }{% + \def\pgfplots@axis@equal@apply@reference{y}% + }% + \fi +%\message{USING REFERENCE UNIT VECTOR FROM \pgfplots@axis@equal@apply@reference.}% + \if x\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for x + \fi + \if y\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for y + \fi + \ifpgfplots@threedim + \if z\pgfplots@axis@equal@apply@reference + \else + \pgfplots@axis@equal@apply@for z + \fi + \fi +}% + +% Scales unit vector '#1' such that it has the same length as the unit +% vector in direction \pgfplots@axis@equal@apply@reference. +% +% The data limits for '#1' will be enlarged as well (for 'axis +% equal'). +\def\pgfplots@axis@equal@apply@for#1{% + \pgfmathmultiply@ + {\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname} + {\csname pgfplots@#1@inverseveclength\endcsname}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \pgfmathmultiply@ + {\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname} + {\csname pgfplots@#1@veclength\endcsname}% + \global\let\pgfplots@glob@TMPb=\pgfmathresult + % + % If the datascaling transformation is active (which is almost + % every the case here), we need to respect it here. + % + % We only need to respect the SCALING, translations (shifts) are + % not interesting. + % + % We want that || T^{-1} e_ref || = || T^{-1} E_#1 ||. + % + % So: T^{-1} E_#1 := s* T^{-1} e_#1 where + % s = ||T^{-1} e_ref|| / || T^{-1} e_#1 || + % = |10^{scale_ref}| / |10^{scale_#1}| * || e_ref|| / ||e_#1||. + % + % Then, E_#1 = T ( T^{-1} E_#1 ) = s * e_#1. + % + % -> compute 's'! We already have the quotient of unit vectors. + % Now, acquire the scale quotients. + % + \begingroup + \def\pgfplots@tmp@exponentref{0}% + \def\pgfplots@tmp@exponentK{0}% + \pgfplots@if{pgfplots@apply@datatrafo@\pgfplots@axis@equal@apply@reference}{% + \pgfplots@letcsname{pgfplots@tmp@exponentref}={pgfplots@data@scale@trafo@EXPONENT@\pgfplots@axis@equal@apply@reference}% + }{}% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplots@letcsname{pgfplots@tmp@exponentK}={pgfplots@data@scale@trafo@EXPONENT@#1}% + }{}% + \c@pgf@counta=\pgfplots@tmp@exponentref + \advance\c@pgf@counta by-\pgfplots@tmp@exponentK + \ifnum\c@pgf@counta=0 + \else + \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPa}{\c@pgf@counta}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \pgfplotsmathmultiplypowten@{\pgfplots@glob@TMPb}{-\c@pgf@counta}% + \global\let\pgfplots@glob@TMPb=\pgfmathresult + \fi + \xdef\pgfplots@glob@TMPc{\the\c@pgf@counta}% + \endgroup + % + \if x#1 + \pgfsetxvec{\pgfplotsqpointxy{\pgfplots@glob@TMPa}{0}}% + \else + \if y#1 + \pgfsetyvec{\pgfplotsqpointxy{0}{\pgfplots@glob@TMPa}}% + \else + \if z#1 + \pgfsetzvec{\pgfplotsqpointxyz{0}{0}{\pgfplots@glob@TMPa}}% + \fi + \fi + \fi + % + % + % Update auxiliary data members: + % This is only complicated due to the scaling transformation. If we would not have the scaling trafo, the following + % code would simply copy the vector length and inverse vectors length from the reference axis. + \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @veclength\endcsname}{\pgfplots@glob@TMPc}% + \expandafter\let\csname pgfplots@#1@veclength\endcsname=\pgfmathresult + \pgfplotsmathmultiplypowten@{\csname pgfplots@\pgfplots@axis@equal@apply@reference @inverseveclength\endcsname}{-\pgfplots@glob@TMPc}% + \expandafter\let\csname pgfplots@#1@inverseveclength\endcsname=\pgfmathresult + % + % + \ifpgfplots@axis@equal@image + \else + % + % Ok, now update the axis limits such that the axis' dimensions + % stay the same. + % + % My idea is to add half of the new range to 'max' and + % subtract the other half from 'min': + % 1/s( xmax - xmin) = (xmax+0.5d) - (xmin-0.5d) = xmax - xmin +d + % with d = 1/s (xmax-xmin) - (xmax-xmin) = (1/s - 1) (xmax-xmin) + % +%\message{'axis equal': Resizing data range for #1: from \csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname\ to}% + \pgfmathsubtract@{\csname pgfplots@#1max\endcsname}{\csname pgfplots@#1min\endcsname}% + \begingroup + \pgf@xa=\pgfmathresult pt + \pgfmathsubtract@{\pgfplots@glob@TMPb}{1.0}% + \pgf@xa=\pgfmathresult \pgf@xa + \divide\pgf@xa by2 + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\pgf@xa}}% + \endgroup + \pgfmathsubtract@{\csname pgfplots@#1min\endcsname}{\pgfplots@glob@TMPb}% + \expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult + \pgfmathadd@{\csname pgfplots@#1max\endcsname}{\pgfplots@glob@TMPb}% + \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult +%\message{\csname pgfplots@#1min\endcsname:\csname pgfplots@#1max\endcsname. [+- \pgfplots@glob@TMPb]}% + % + % Update auxiliary data members: + \csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt % + \csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt % + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1min\endcsname}% + \expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{\csname pgfplots@#1max\endcsname}% + \expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult + }{}% + \fi +} + +% Invokes #3 if +% ( 10^{s1} * veclen1 < 10^{s2} * veclen2 ) +% <=> +% ( 10^{s1-s2} * veclen1 < veclen2 ). +% +% If the condition is false, '#4' is invoked. +\def\pgfplots@if@unitveclenlessthan@untransformed#1#2#3#4{% + \def\pgfplots@loc@TMPa{0}% + \def\pgfplots@loc@TMPb{0}% + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% + \pgfplots@letcsname{pgfplots@loc@TMPa}={pgfplots@data@scale@trafo@EXPONENT@#1}% + }{}% + \pgfplots@if{pgfplots@apply@datatrafo@#2}{% + \pgfplots@letcsname{pgfplots@loc@TMPb}={pgfplots@data@scale@trafo@EXPONENT@#2}% + }{}% + \begingroup + \pgf@xb=\csname pgfplots@#2@veclength\endcsname pt + \c@pgf@counta=\pgfplots@loc@TMPa + \advance\c@pgf@counta by-\pgfplots@loc@TMPb + \ifnum\c@pgf@counta=0 + \pgf@xa=\csname pgfplots@#1@veclength\endcsname pt + \else + \pgfplotsmathmultiplypowten@{\csname pgfplots@#1@veclength\endcsname}{\c@pgf@counta}% + \pgf@xa=\pgfmathresult pt + \fi + \ifdim\pgf@xa<\pgf@xb + \gdef\pgfplots@glob@TMPc{1}% + \else + \gdef\pgfplots@glob@TMPc{0}% + \fi + \endgroup + \if1\pgfplots@glob@TMPc #3\else #4\fi +}% + % PRECONDITION: % - final axis limits are given in transformed range % - \pgfplots@set@default@size@options has been invoked before @@ -5546,12 +3802,22 @@ % INIT. % % - \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% - \pgfplots@xcoordminTEX=\pgf@x - \pgfplots@ycoordminTEX=\pgf@y - \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% - \pgfplots@xcoordmaxTEX=\pgf@x - \pgfplots@ycoordmaxTEX=\pgf@y + \pgfplots@xmin@reg=\pgfplots@xmin pt % + \pgfplots@xmax@reg=\pgfplots@xmax pt % + \pgfplots@ymin@reg=\pgfplots@ymin pt % + \pgfplots@ymax@reg=\pgfplots@ymax pt % + \ifpgfplots@threedim + \pgfplots@zmin@reg=\pgfplots@zmin pt % + \pgfplots@zmax@reg=\pgfplots@zmax pt % + \fi + % + \pgfpointdiff + {\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}} + {\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}% + % only used temporarily in this macro to compute the correct + % length for unit vectors: + \edef\pgfplots@initsizes@axisdiag@x{\the\pgf@x}% + \edef\pgfplots@initsizes@axisdiag@y{\the\pgf@y}% % % %----------------------------------------- @@ -5567,7 +3833,7 @@ \ifx\pgfplots@width\pgfutil@empty \pgfplots@error{INTERNAL LOGIC ERROR! WIDTH NOT SET}% \fi - \pgfplots@initsizes@getXscale\into\pgfplots@tmpXscale + \pgfplots@initsizes@getXscale\pgfplots@initsizes@axisdiag@x\into\pgfplots@tmpXscale \ifpgfplots@scale@only@axis \let\pgfplots@rectangle@width=\pgfplots@width \fi @@ -5579,7 +3845,7 @@ \ifx\pgfplots@height\pgfutil@empty \pgfplots@error{INTERNAL LOGIC ERROR! HEIGHT NOT SET}% \fi - \pgfplots@initsizes@getYscale\into\pgfplots@tmpYscale + \pgfplots@initsizes@getYscale\pgfplots@initsizes@axisdiag@y\into\pgfplots@tmpYscale \ifpgfplots@scale@only@axis \let\pgfplots@rectangle@height=\pgfplots@height \fi @@ -5590,19 +3856,35 @@ % % assert( \pgfplots@tmpXscale != \pgfutil@empty && \pgfplots@tmpYscale != \pgfutil@empty ) % - % Apply scaling: - \pgfpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% - \edef\pgfplots@tmpscale@x{\the\pgf@x}% - \edef\pgfplots@tmpscale@y{\the\pgf@y}% - \ifx\pgfplots@x\pgfutil@empty - \pgfsetxvec{\pgfqpoint{\pgfplots@tmpscale@x}{0pt}}% + \pgfplotsqpointxy{\pgfplots@tmpXscale}{\pgfplots@tmpYscale}% + \edef\pgfplots@tmpXscale{\the\pgf@x}% + \edef\pgfplots@tmpYscale{\the\pgf@y}% + \def\pgfplots@tmpZscale{1pt}% + \ifx\pgfplots@view@pitch\pgfutil@empty + \pgfplots@initsizes@setunitvector{x}{0}{\pgfplots@tmpXscale}{\pgfplots@tmp@xisaxisparallel}% + \pgfplots@initsizes@setunitvector{y}{1}{\pgfplots@tmpYscale}{\pgfplots@tmp@yisaxisparallel}% + \pgfplots@initsizes@setunitvector{z}{2}{\pgfplots@tmpZscale}{\pgfplots@loc@TMPc}% \else - \pgfsetxvec{\pgfpoint{\pgfplots@x}{0pt}}% + \pgfplotssetaxesfrompitchyaw{\pgfplots@view@pitch}{\pgfplots@view@yaw}{\pgfplots@tmp@xisaxisparallel}% + \if1\pgfplots@tmp@xisaxisparallel% + \def\pgfplots@tmp@yisaxisparallel{1}% + \fi \fi - \ifx\pgfplots@y\pgfutil@empty - \pgfsetyvec{\pgfqpoint{0pt}{\pgfplots@tmpscale@y}}% + \ifpgfplots@threedim \else - \pgfsetyvec{\pgfpoint{0pt}{\pgfplots@y}}% + \if1\pgfplots@tmp@xisaxisparallel% + \if1\pgfplots@tmp@yisaxisparallel% + % Optimize for axis-parallel case! + % puh. Did not make any measureable difference!? Ok... + \let\pgfplotsqpointxy=\pgfplotsqpointxy@orthogonal + \fi + \fi + \fi + \ifpgfplots@axis@equal@image + \pgfplots@axis@equaltrue + \fi + \ifpgfplots@axis@equal + \pgfplots@axis@equal@apply \fi % % Determine final rectangle dimensions. @@ -5625,12 +3907,19 @@ % 3. The user supplied 'x' and or 'y'. Simply use them, its % accurate. % - \pgfqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \begingroup + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \xdef\pgfplotspointsouthwest{\noexpand\pgf@x=\the\pgf@x\noexpand\relax\noexpand\pgf@y=\the\pgf@y}% + % ATTENTION: I re-use registers here! Make sure they won't be + % overwritten! \pgfpointdiff and \pgfplotsqpointxy are ok in this respect. + \let\pgfplots@xcoordminTEX=\pgf@xb + \let\pgfplots@ycoordminTEX=\pgf@yb \pgfplots@xcoordminTEX=\pgf@x \pgfplots@ycoordminTEX=\pgf@y - \pgfqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + % + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% \ifx\pgfplots@rectangle@width\pgfutil@empty - \pgfplots@xcoordmaxTEX=\pgf@x + \def\pgfplots@tmp@xmax@ymin{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}% \else % this 'if' here should only make a difference of about % 1-2pt, not more. @@ -5638,22 +3927,40 @@ % and I am quite sure that this inaccuracy (and this % work-around) only affects the % final size, not the relative plot accuracy. - \pgfplots@xcoordmaxTEX=\pgfplots@xcoordminTEX - \expandafter\advance\expandafter\pgfplots@xcoordmaxTEX\pgfplots@width + \pgf@x=\pgfplots@xcoordminTEX + \advance\pgf@x by\pgfplots@width + \edef\pgfplots@tmp@xmax@ymin{\noexpand\pgfqpoint{\the\pgf@x}{\noexpand\pgfplots@ycoordminTEX}}% \fi \ifx\pgfplots@rectangle@height\pgfutil@empty - \pgfplots@ycoordmaxTEX=\pgf@y + \def\pgfplots@tmp@xmin@ymax{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}% \else - \pgfplots@ycoordmaxTEX=\pgfplots@ycoordminTEX - \expandafter\advance\expandafter\pgfplots@ycoordmaxTEX\pgfplots@height + \pgf@x=\pgfplots@ycoordminTEX + \advance\pgf@x\pgfplots@height + \edef\pgfplots@tmp@xmin@ymax{\noexpand\pgfqpoint{\noexpand\pgfplots@xcoordminTEX}{\the\pgf@x}}% + \fi + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplots@tmp@xmax@ymin}% + \xdef\pgfplotspointxaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointxaxislength{\pgfmathresult pt}% + % + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplots@tmp@xmin@ymax}% + \xdef\pgfplotspointyaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointyaxislength{\pgfmathresult pt}% + % + \ifpgfplots@threedim + \pgfpointdiff + {\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ycoordminTEX}} + {\pgfplotsqpointxy{\pgfplots@zmin}{\pgfplots@zmax}}% + \xdef\pgfplotspointzaxis{\noexpand\pgf@x=\the\pgf@x\noexpand\pgf@y=\the\pgf@y}% + \pgfmathveclen{\pgf@x}{\pgf@y}% + \xdef\pgfplotspointzaxislength{\pgfmathresult pt}% \fi -%-------------------------------------------------- -% \begingroup -% \pgf@x=\pgfplots@xcoordmaxTEX\advance\pgf@x by-\pgfplots@xcoordminTEX -% \pgf@y=\pgfplots@ycoordmaxTEX\advance\pgf@y by-\pgfplots@ycoordminTEX -% \message{Axis scaling x=\pgfplots@tmpXscale, y=\pgfplots@tmpYscale\ yields lower-left-corner (\pgfplots@xmin,\pgfplots@ymin) = (\the\pgfplots@xcoordminTEX,\the\pgfplots@ycoordminTEX) and upper right (\pgfplots@xmax,\pgfplots@ymax) = (\the\pgfplots@xcoordmaxTEX,\the\pgfplots@ycoordmaxTEX). Axis dimensions are width=\the\pgf@x, height=\the\pgf@y.}% -% \endgroup -%-------------------------------------------------- + \endgroup } % This here is a low-weight node. It can ONLY be used during axis @@ -5678,17 +3985,41 @@ \anchor{west}{\pgfqpointxy{0}{0.5}}% \anchor{north west}{\pgfqpointxy{0}{1}}% %% - \anchor{origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}}% - \anchor{above origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ycoordmaxTEX}}% - \anchor{left of origin}{\pgfqpoint{\pgfplots@xcoordminTEX}{\pgfplots@ZERO@y\relax}}% - \anchor{right of origin}{\pgfqpoint{\pgfplots@xcoordmaxTEX}{\pgfplots@ZERO@y\relax}}% - \anchor{below origin}{\pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ycoordminTEX}}% + \anchor{origin}{\pgfplotspointORIGIN@tmp}% + \anchor{above origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointyaxis}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}} + {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}{\pgfplotspointxaxis}}% + }% + \anchor{left of origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointxaxis}}} + {\pgfqpointxy{0}{0}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointyaxis}}% + }% + \anchor{right of origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfplotspointxaxis}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}} + {\pgfpointadd{\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}{\pgfplotspointyaxis}}% + }% + \anchor{below origin}{% + \pgfpointintersectionoflines + {\pgfplotspointORIGIN@tmp} + {\pgfpointadd{\pgfplotspointORIGIN@tmp}{\pgfpointscale{-1}{\pgfplotspointyaxis}}} + {\pgfqpointxy{0}{0}} + {\pgfpointadd{\pgfqpointxy{0}{0}}{\pgfplotspointxaxis}}% + }% %% %% %% %% \anchorborder{}% - \backgroundpath{}%\pgfpathrectangle{\pgfpointorigin}{\upperrightinnercorner}}% + \backgroundpath{}% \foregroundpath{}% \behindbackgroundpath{}% \beforebackgroundpath{}% @@ -5701,6 +4032,7 @@ % It has one node part, which is the complete image. It provides a lot % of anchors. \pgfdeclareshape{pgfplots@low@level@shape}{% + % The '(0,0)' point is the LOWER LEFT OUTER CORNER. \savedanchor\upperrightcorner{ \pgf@x=\wd\pgfnodepartimagebox \pgf@y=\ht\pgfnodepartimagebox @@ -5708,107 +4040,91 @@ \savedanchor\lowerleftinnercorner{% \pgfqpoint{\pgfplots@savedanchor@inner@lowerleft@x\relax}{\pgfplots@savedanchor@inner@lowerleft@y\relax}% }% - \savedanchor\upperrightinnercorner{% - \pgfqpoint{\pgfplots@savedanchor@inner@upperright@x\relax}{\pgfplots@savedanchor@inner@upperright@y\relax}% - }% + \savedanchor\xaxisvec{\pgfplotspointxaxis}% + \savedanchor\yaxisvec{\pgfplotspointyaxis}% \savedanchor\origin{% \pgfqpoint{\pgfplots@ZERO@x\relax}{\pgfplots@ZERO@y\relax}% }% % \nodeparts{image}% \anchor{image}{% - \pgf@x=0pt - \pgf@y=0pt + \pgf@x=0pt % + \pgf@y=0pt % }% % % \anchor{center}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\pgfpointadd{\xaxisvec}{\yaxisvec}}}% }% \anchor{north}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + }% + \anchor{north east}{% + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% }% - \anchor{north east}{\upperrightinnercorner}% \anchor{east}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% }% \anchor{south east}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% }% \anchor{south}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa - \pgf@y=\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% }% \anchor{south west}{\lowerleftinnercorner}% \anchor{west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@x=\pgf@xa - \advance\pgf@xb by\pgf@y - \pgf@y=.5\pgf@xb + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% }% \anchor{north west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \pgf@xb=\pgf@y - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% }% %% \anchor{origin}{% \origin }% \anchor{above origin}{% - \origin - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\yaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}{\xaxisvec}}% }% \anchor{left of origin}{% - \origin - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@y=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\xaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}% }% \anchor{right of origin}{% - \origin - \pgf@xa=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\xaxisvec}} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}} + {\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}{\yaxisvec}}% }% \anchor{below origin}{% - \origin - \pgf@xa=\pgf@x - \lowerleftinnercorner - \pgf@x=\pgf@xa + \pgfpointintersectionoflines + {\origin} + {\pgfpointadd{\origin}{\pgfpointscale{-1}{\yaxisvec}}} + {\lowerleftinnercorner} + {\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}% }% % %% @@ -5855,53 +4171,55 @@ %% \anchor{above north}{% \upperrightcorner - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@xb=\pgf@x - \upperrightinnercorner - \advance\pgf@xb by\pgf@x - \pgf@x=.5\pgf@xb - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}% + \pgf@y=\pgfutil@tempdima }% \anchor{above north east}{% \upperrightcorner - \pgf@xa=\pgf@y - \upperrightinnercorner - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@y=\pgfutil@tempdima }% \anchor{right of north east}{% \upperrightcorner - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@x=\pgf@xa + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}% + \pgf@x=\pgfutil@tempdima }% \anchor{right of east}{% \upperrightcorner - \pgf@xa=\pgf@x - \upperrightinnercorner - \pgf@xb=\pgf@y - \lowerleftinnercorner - \advance\pgf@xb by\pgf@y - \pgf@x=\pgf@xa - \pgf@y=.5\pgf@xb + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}% + \pgf@x=\pgfutil@tempdima }% \anchor{right of south east}{% \upperrightcorner - \pgf@xa=\pgf@x - \lowerleftinnercorner - \pgf@x=\pgf@xa + \pgfutil@tempdima=\pgf@x + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% + \pgf@x=\pgfutil@tempdima }% \anchor{below south east}{% - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\xaxisvec}% \pgf@y=0pt }% \anchor{below south}{% - \lowerleftinnercorner - \pgf@xa=\pgf@x - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\xaxisvec}}% \pgf@y=0pt - \advance\pgf@xa by\pgf@x - \pgf@x=.5\pgf@xa }% \anchor{below south west}{% \lowerleftinnercorner @@ -5912,22 +4230,24 @@ \pgf@x=0pt }% \anchor{left of west}{% - \lowerleftinnercorner - \pgf@xa=\pgf@y - \upperrightinnercorner - \advance\pgf@xa by\pgf@y - \pgf@y=.5\pgf@xa + \pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointscale{0.5}{\yaxisvec}}% \pgf@x=0pt }% \anchor{left of north west}{% - \upperrightinnercorner + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% \pgf@x=0pt }% \anchor{above north west}{% \upperrightcorner - \pgf@xa=\pgf@y - \lowerleftinnercorner - \pgf@y=\pgf@xa + \pgfutil@tempdima=\pgf@y + \pgfpointadd + {\lowerleftinnercorner}% + {\yaxisvec}% + \pgf@y=\pgfutil@tempdima }% %% %% @@ -5935,13 +4255,16 @@ % Call a function that computes a border point. Since this % function will modify dimensions like \pgf@x, we must move them to % other dimensions. - \@tempdima=\pgf@x - \@tempdimb=\pgf@y + \pgfutil@tempdima=\pgf@x + \pgfutil@tempdimb=\pgf@y \pgfpointborderrectangle% - {\pgfpoint{\@tempdima}{\@tempdimb}}% - {\pgfpointadd{\upperrightcorner}{\pgfpoint{\width}{\height}}} + {\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}% + {\upperrightcorner}% + }% + \backgroundpath{% + \pgfkeysvalueof{/pgfplots/@backgroundpath@hook/.@cmd}\pgfeov + \pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}% }% - \backgroundpath{\pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}}% \foregroundpath{}% \behindbackgroundpath{}% \beforebackgroundpath{}% @@ -5950,47 +4273,359 @@ } \def\pgfplots@draw@axis{% - \ifpgfplots@hide@x\else - % compute tick position lists - % \pgfplots@prepared@tick@positions@minor@x - % and - % \pgfplots@prepared@tick@positions@major@x - \expandafter\pgfplots@prepare@ticks@for\expandafter{\pgfplots@xtick}{x}{0}% - \pgfplots@drawgridlines@for{x}{0}% - \fi - \ifpgfplots@hide@y\else - \expandafter\pgfplots@prepare@ticks@for\expandafter{\pgfplots@ytick}{y}{1}% - \pgfplots@drawgridlines@for{y}{1}% - \fi % - \ifpgfplots@hide@x\else - \pgfplots@drawticklines@for{x}{0}% + % Preparation for axis lines and discontinuities: + \pgfplots@drawaxis@lines@preparediscont@for{x}% + \pgfplots@drawaxis@lines@preparediscont@for{y}% + \ifpgfplots@threedim + \pgfplots@drawaxis@lines@preparediscont@for{z}% \fi - \ifpgfplots@hide@y\else - \pgfplots@drawticklines@for{y}{1}% + \ifpgfplots@threedim + \pgfplots@separate@axis@linestrue + \else + \ifnum\pgfplots@xaxislinesnum>0 + \pgfplots@separate@axis@linestrue + \fi + \ifnum\pgfplots@yaxislinesnum>0 + \pgfplots@separate@axis@linestrue + \fi \fi % - \pgfplots@drawaxis@lines + \pgfplots@decide@which@figure@surfaces@are@drawn % + % compute tick position lists + % \pgfplots@prepared@tick@positions@minor@x + % and + % \pgfplots@prepared@tick@positions@major@x \ifpgfplots@hide@x\else - \pgfplots@drawticklabels@for{x}{0}% + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter x\expandafter{\pgfplots@xtick}% \fi \ifpgfplots@hide@y\else - \pgfplots@drawticklabels@for{y}{1}% + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter y\expandafter{\pgfplots@ytick}% \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z\else + \expandafter\pgfplots@prepare@tick@coordlists@for\expandafter z\expandafter{\pgfplots@ztick}% + \fi + \ifcase\pgfplots@zaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% + \pgfplots@draw@axis@insurface@symmetric xyz0 + % + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}% + \pgfplots@draw@axis@insurface@symmetric xyz1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@logical@ZERO@z}{2}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \or + \pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}% + \pgfplots@draw@axis@insurface@symmetric xyz2 + \fi % - \ifpgfplots@hide@x\else - \ifx\pgfplots@extra@xtick\pgfutil@empty - \else - \expandafter\pgfplots@draw@extra@ticks@for\expandafter x\expandafter0\expandafter{\pgfplots@extra@xtick}% + \ifcase\pgfplots@xaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx0 + % + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx0 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@logical@ZERO@x}{2}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 + \or + \pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid yzx + \pgfplots@draw@axis@insurface zyx1 \fi + % + \ifcase\pgfplots@yaxislinesnum\relax + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + % + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@logical@ZERO@y}{2}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \or + \pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}% + \pgfplots@draw@axis@insurface@onlyticksandgrid xzy + \pgfplots@draw@axis@insurface@onlyticksandgrid zxy + \fi + \else + % Just use the 2d-point commands (assuming Z=0) + \let\pgfplotspointonorientedsurfaceabsetupforxyz=\pgfplotspointonorientedsurfaceabsetupforxy + \let\pgfplotspointonorientedsurfaceabsetupforyxz=\pgfplotspointonorientedsurfaceabsetupforyx + \pgfplots@draw@axis@insurface@symmetric xyz2 \fi - \ifpgfplots@hide@y\else - \ifx\pgfplots@extra@ytick\pgfutil@empty +}% + +% Defines booleans for every surface of the axis cube indicating +% whether they shall be drawn or not. +% +% For 2D, the only available surface is 'vv0' (x=variing; y=variing; z=zmin) +% For 3D, there are surfaces +% - 'vv0' 'vv1' +% - 'v0v' 'v1v' +% ' '0vv' '1vv' +% +% @see \pgfplotspointonorientedsurfaceabmatchaxisline for details +% about those three-character ids. +% +% @PRECONDITION +% +% @POSTCONDITION +% for every available surface, a macro '\pgfplots@surfenabled@CCC' +% is defined to be either '0' or '1'. +% Thus, we don't have real TeX booleans, "only" those one-character +% strings. +% +% ABOUT THE ALGORITHM: +% I find it really hard to decide exactly which surfaces shall be drawn. After +% all, PGF is 2D and notions like "above" are not possible. +% So, I resorted to an heuristic approach which will (hopefully) prove +% to be a good idea: +% +% ASSUMPTION: +% 1. We have a right-handed-coordinate system. The heuristics here +% WILL fail in every other case. +% 2. The z-axis points to the top of the paper. +% Again, the heuristics WILL fail if that is not the case. +% Both assumptions happen to be reasonable for most cases. +% I will have to think about those cases where they are not +% reasonable. +% +% Now, the heuristics ONLY CHECKS THE 'y' components of the the three +% basis vectors. Since per assumption (1.), z_y > 0, there remain only +% a handful of cases for x_y > 0, x_y <0, y_y > 0 and y_y <0. I have +% hard-coded good approaches for each of them below. +\def\pgfplots@decide@which@figure@surfaces@are@drawn{% + \ifpgfplots@threedim + \begingroup + \gdef\pgfplots@glob@TMPa{% + % This here is the "fall-back" solution: simple enable + % every axis. + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + }% + \let\xaxisy=\pgf@ya + \let\yaxisy=\pgf@yb + \let\zaxisy=\pgf@yc + \pgfplotspointxaxis + \xaxisy=\pgf@y + \pgfplotspointyaxis + \yaxisy=\pgf@y + \pgfplotspointzaxis + \zaxisy=\pgf@y + \ifdim\zaxisy>0pt + % CASE I : + \ifdim\xaxisy>0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{0}% + % + \def\pgfplots@xticklabelaxisspec{v00}% + \def\pgfplots@yticklabelaxisspec{1v0}% + \def\pgfplots@zticklabelaxisspec{00v}% + }% + \fi + \fi + % CASE II: + \ifdim\xaxisy<0pt + \else + \ifdim\yaxisy<0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + % + \def\pgfplots@xticklabelaxisspec{v00}% + \def\pgfplots@yticklabelaxisspec{0v0}% + \def\pgfplots@zticklabelaxisspec{01v}% + }% + \fi + \fi + % CASE III: + \ifdim\xaxisy<0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{1}% + % + \def\pgfplots@xticklabelaxisspec{v10}% + \def\pgfplots@yticklabelaxisspec{0v0}% + \def\pgfplots@zticklabelaxisspec{11v}% + }% + \fi + \fi + % CASE IV: + \ifdim\xaxisy>0pt + \else + \ifdim\yaxisy>0pt + \else + \gdef\pgfplots@glob@TMPa{% + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@vv1\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@v0v\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@v1v\endcsname{0}% + \expandafter\def\csname pgfplots@surfenabled@0vv\endcsname{1}% + \expandafter\def\csname pgfplots@surfenabled@1vv\endcsname{0}% + % + \def\pgfplots@xticklabelaxisspec{v10}% + \def\pgfplots@yticklabelaxisspec{1v0}% + \def\pgfplots@zticklabelaxisspec{10v}% + }% + \fi + \fi + \fi + \endgroup + % and activate the macro: + \pgfplots@glob@TMPa + \else + \expandafter\def\csname pgfplots@surfenabled@vv0\endcsname{1}% + \def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn##1##2##3{##2}% ALWAYS TRUE + \fi +} + +% Processes every tick mark in direction #1 and draws tick lines, tick +% labels, grid lines, axis lines and extra ticks. +% +% #1 : the direction into which tick positions are processed. +% #2 : the direction in which tick lines and grid lines shall be drawn. +% #3 : the direction which is currently fixed. +% #4 : an integer used to decide whether tick LABELS shall be drawn. +% The following values are accepted: +% 0 : we are on the "left". So, draw tick labels if '#3ticklabel pos==left' +% 1 : we are on the "right". So, draw tick labels if '#3ticklabel pos==right' +% 2 : draw tick labels anyway. +% +\def\pgfplots@draw@axis@insurface#1#2#3#4{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + % + \pgfplots@drawticklines@onorientedsurf + % + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2% + \pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3% + % + \pgfplots@drawticklabels@onorientedsurf + % + \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty \else - \expandafter\pgfplots@draw@extra@ticks@for\expandafter y\expandafter1\expandafter{\pgfplots@extra@ytick}% + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% \fi + }% +}% + +% A variant of \pgfplots@draw@axis@insurface which is equivalent to +% \pgfplots@draw@axis@insurface #1#2#3#4 +% \pgfplots@draw@axis@insurface #2#1#3#4 +% with slightly optimized execution sequence. +\def\pgfplots@draw@axis@insurface@symmetric#1#2#3#4{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + }% + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawticklines@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawticklines@onorientedsurf + }% + % + \ifpgfplots@separate@axis@lines + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2% + \pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3% + }% + % + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawaxis@outerlines@separate@onorientedsurf#2#1% + \pgfplots@drawaxis@innerlines@onorientedsurf#2#1#3% + }% + \else + % this happens if and only if d=2 and the axis lines are drawn + % as box. + \pgfplots@drawaxis@outerlines@cycledpath \fi + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawticklabels@onorientedsurf + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \pgfplots@drawticklabels@onorientedsurf + }% + % + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \expandafter\ifx\csname pgfplots@extra@#1tick\endcsname\pgfutil@empty + \else + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@xtick}% + \fi + }% + \pgfplots@if{pgfplots@hide@#2}{\relax}{% + \expandafter\ifx\csname pgfplots@extra@#2tick\endcsname\pgfutil@empty + \else + \csname pgfplotspointonorientedsurfaceabsetupfor#2#1#3\endcsname + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@extra@ytick}% + \fi + }% +}% + +\def\pgfplots@draw@axis@insurface@onlyticksandgrid#1#2#3{% + \pgfplots@if{pgfplots@hide@#1}{\relax}{% + \csname pgfplotspointonorientedsurfaceabsetupfor#1#2#3\endcsname + \pgfplots@drawgridlines@onorientedsurf + \pgfplots@drawticklines@onorientedsurf + }% }% \def\pgfplots@BEGIN@init@and@draw@axis{% @@ -5998,7 +4633,6 @@ \setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup \pgfinterruptpicture \tikzpicture[/pgfplots/every axis]% - %\pgfqkeys{/tikz}{every axis}% % set baseline for sub-picture to default value. % the baseline option will be applied to the OUTER picture. \pgfsetbaseline{\pgf@picminy}% @@ -6008,11 +4642,48 @@ \else \pgfplots@draw@axis \fi - \clip - (\pgfplots@xcoordminTEX, \pgfplots@ycoordminTEX) - rectangle (\pgfplots@xcoordmaxTEX, \pgfplots@ycoordmaxTEX); + % CLIPPING: + \pgfplots@clippath@prepare + \pgfplots@clippath@install } +% Defines \pgfplots@clippath@install. +% @PRECONDITION the axis limits must be ready. +\def\pgfplots@clippath@prepare{% + \ifpgfplots@threedim + % FIXME : this can't be done in three dimensions. :-( + % -> for 3d, I need to clip at least the 2d projection. + % FIXME : which path(s) do I need for 3d? + \let\pgfplots@clippath@install=\pgfutil@empty + \else + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}% + \edef\pgfplots@loc@TMPa{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}% + \edef\pgfplots@loc@TMPb{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}% + \edef\pgfplots@loc@TMPc{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}% + \edef\pgfplots@loc@TMPd{\noexpand\pgf@x=\the\pgf@x\space\noexpand\pgf@y=\the\pgf@y\space}% + \begingroup + \toks0=\expandafter{\pgfplots@loc@TMPa}% + \toks1=\expandafter{\pgfplots@loc@TMPb}% + \toks2=\expandafter{\pgfplots@loc@TMPc}% + \toks3=\expandafter{\pgfplots@loc@TMPd}% + \xdef\pgfplots@glob@TMPa{% + \noexpand\pgfpathmoveto{\the\toks0 }% + \noexpand\pgfpathlineto{\the\toks1 }% + \noexpand\pgfpathlineto{\the\toks2 }% + \noexpand\pgfpathlineto{\the\toks3 }% + \noexpand\pgfusepath{clip}% + }% + \endgroup + \let\pgfplots@clippath@install=\pgfplots@glob@TMPa + \fi +}% + +\def\pgfplots@clippath@install{% + \pgfplots@error{Can't install a clippath here - the command has not yet been prepared.}% +}% \def\pgfplots@END@init@and@draw@axis{% \endscope% @@ -6027,7 +4698,9 @@ \ifpgfplots@clip@marker@paths \else \pgfplotslistforeach\pgfplots@stored@markerlist\as\pgfplots@loc@TMPa{% + \scope% make sure that 'fill opacity' and 'dotted' styles remain local! \pgfplots@loc@TMPa + \endscope }% \global\pgfplotslistnewempty\pgfplots@stored@markerlist% clear. \fi @@ -6080,17 +4753,17 @@ \expandafter\pgfplots@loc@TMPc\expandafter{\pgfmathresult}\pgfeov \fi \let\pgfplots@loc@TMPc=\pgfmathresult% FIXME: is that necessary? I doubt it... but just to make sure... - \expandafter\let\expandafter\if@datascaled@cur\csname ifpgfplots@apply@datatrafo@#1\endcsname \csname ifpgfplots@#1islinear\endcsname - \if@datascaled@cur + \pgfplots@if{pgfplots@apply@datatrafo@#1}{% \csname pgfplots@datascaletrafo@fromfixed@#1\endcsname{\pgfplots@loc@TMPc}% - \fi + }{}% \else \pgfmathlog@{\pgfplots@loc@TMPc}% \fi } \long\def\pgfplots@evalute@tikz@coord@system@interface#1,#2\pgfplots@coord@end{% + \global\let\pgfplots@glob@TMPc=\pgfutil@empty \begingroup \pgfplots@evalute@tikz@coord@system@interface@for{x}{#1}% \let\pgfplots@evaluate@tikz@coord@x=\pgfmathresult @@ -6098,7 +4771,11 @@ \xdef\pgfplots@glob@TMPa{\pgfplots@evaluate@tikz@coord@x}% \xdef\pgfplots@glob@TMPb{\pgfmathresult}% \endgroup - \pgfqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% + \ifx\pgfplots@glob@TMPc\pgfutil@empty + \pgfplotsqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}% + \else + \pgfplotsqpointxyz{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}{\pgfplots@glob@TMPc}% FIXME: read 3D! + \fi } % In case of (semi-) logplots, this command will @@ -6116,7 +4793,7 @@ % - coordinate filters to compute logs are installed % % See also: -% \pgfplots@apply@data@scale@trafo@to@options@for +% \pgfplots@check@and@apply@datatrafo@for \def\pgfplots@prepare@coord@filtering@for#1{% \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \expandafter\let\csname pgfplots@highlevel@trafo@#1\endcsname=\pgfplots@loc@TMPc @@ -6124,12 +4801,12 @@ % no high-level external coord trafos. % Simply use identity: \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \def\pgfmathresult{##1}% + \edef\pgfmathresult{##1}% }% \else % Apply external coordinate trafo to all input values: \expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{% - \noexpand\def\noexpand\pgfmathresult{##1}% + \noexpand\edef\noexpand\pgfmathresult{##1}% \expandafter\noexpand\csname pgfplots@highlevel@trafo@#1\endcsname{##1}\noexpand\pgfeov }% % @@ -6149,6 +4826,20 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % + % any user-specified tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + % % any user specified axis ticks: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6194,13 +4885,25 @@ \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi + % Check for any existing tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi \fi \else % This here could be done using a high level coord trafo as % well! However, I don't want to risk accidentally overwritten % keys, so I replicate it here. - \ifpgfplots@disablelogfilter - \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{\relax}{% % any user-specified axis limits: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6215,6 +4918,20 @@ \expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult \fi % + % any user-specified tick limits: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmin\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult + \fi + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tickmax\endcsname + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\pgfmathlog@\expandafter{\pgfplots@loc@TMPa}% + \expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult + \fi + % % any user specified axis ticks: \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6238,16 +4955,37 @@ \pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc \ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key \expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{% - \pgfmathlog@{##1}% + \edef\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{% + \pgfmathfloatparsenumber{##1}% + \pgfmathfloattofixed{\pgfmathresult}% + }{% + \pgfmathlog@{##1}% + }% + \fi }% \else % This is a bit complicated... but it works. - \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@prepare@#1coord\endcsname{##1}\expandafter\pgfmathlog@\expandafter{\pgfmathresult}}% + \t@pgfplots@toka=\expandafter\expandafter\expandafter{% + \csname pgfplots@prepare@#1coord\endcsname{##1}% + \edef\pgfmathresult{##1}% + \ifx\pgfmathresult\pgfutil@empty + \else + \pgfplots@if{pgfplots@disablelogfilter@#1}{% + \pgfmathfloatparsenumber{##1}% + \pgfmathfloattofixed{\pgfmathresult}% + }{% + \expandafter\pgfmathlog@\expandafter{\pgfmathresult}% + }% + \fi + }% \edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka}% \expandafter\def\expandafter\pgfplots@loc@TMPa\expandafter##\expandafter1\expandafter{\pgfplots@loc@TMPa}% \expandafter\let\csname pgfplots@prepare@#1coord\endcsname=\pgfplots@loc@TMPa \fi - \fi + }% \fi } @@ -6268,6 +5006,16 @@ \pgfplots@show@label{y}{\pgfplots@label@}% \fi \fi + \ifpgfplots@threedim + \ifpgfplots@hide@z + \else + \pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}% + \ifx\pgfplots@label@\pgfutil@empty + \else + \pgfplots@show@label{z}{\pgfplots@label@}% + \fi + \fi + \fi % \pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa \ifx\pgfplots@loc@TMPa\pgfutil@empty @@ -6289,6 +5037,12 @@ \def\pgfplots@datascaletrafo@redoshift@y#1{% \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@y}% }% +\def\pgfplots@datascaletrafo@undoshift@z#1{% + \pgfmathsubtract@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% +}% +\def\pgfplots@datascaletrafo@redoshift@z#1{% + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% +}% % DATA TRANSFORMATION T(x) = X - xmin % @@ -6331,6 +5085,19 @@ \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@y}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@datascaletrafo@z#1{% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@SHIFT@z}% +} +\def\pgfplots@datascaletrafo@fromfixed@z#1{% + \pgfmathfloatparsenumber{#1}% + \expandafter\pgfplots@datascaletrafo@z\expandafter{\pgfmathresult}% +} +\def\pgfplots@datascaletrafo@z@noshift#1{% + \pgfmathfloatshift@{#1}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % INVERSE transformation x = T^{-1}( X ) % Input: @@ -6403,6 +5170,36 @@ \endgroup } +\def\pgfplots@inverse@datascaletrafo@z#1{% + \begingroup + \pgfmathadd@{#1}{\pgfplots@data@scale@trafo@SHIFT@z}% + \let\pgfplots@inverse@datascaletrafo@@shifted=\pgfmathresult + \pgfmathapproxequalto@{\pgfplots@inverse@datascaletrafo@@shifted}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{\pgfplots@inverse@datascaletrafo@@shifted}% + \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} +% Overloaded function. This one does only apply the scaling, no shift. +\def\pgfplots@inverse@datascaletrafo@z@noshift#1{% + \begingroup + \pgfmathapproxequalto@{#1}{0.0}% + \ifpgfmathcomparison + \pgfmathfloatcreate{0}{0.0}{0}% + \else + \pgfmathfloatparsenumber{#1}% + \edef\pgfplots@data@scale@trafo@EXPONENT@z{-\pgfplots@data@scale@trafo@EXPONENT@z}% + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\pgfplots@data@scale@trafo@EXPONENT@z}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup +} + % Overloaded function. % % In contrast to \pgfplots@inverse@datascaletrafo@x, this method @@ -6416,6 +5213,10 @@ \pgfplots@inverse@datascaletrafo@y{#1}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@inverse@datascaletrafo@tofixed@z#1{% + \pgfplots@inverse@datascaletrafo@z{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % Overloaded function. % @@ -6428,6 +5229,10 @@ \pgfplots@inverse@datascaletrafo@y@noshift{#1}% \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% } +\def\pgfplots@inverse@datascaletrafo@tofixed@z@noshift#1{% + \pgfplots@inverse@datascaletrafo@z@noshift{#1}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% +} % Parses all options in #1 which are known in the currently active families. % @@ -6501,6 +5306,9 @@ \let\prettyprintnumber=\pgfmathprintnumber% \def\pgfplots@set@options#1{% + \pgfplots@bb@isactivetrue + \pgfplots@curplot@threedimfalse + \global\pgfplots@threedimfalse \pgfutil@ifundefined{tikz@lastx}{% % no warning. Its not that important anyway, I think. \def\pgfplots@at{\pgfpointorigin}% @@ -6512,16 +5320,8 @@ % This allows to get the names - they should not be appended to % 'every axis'! \pgfkeys{% - /tikz/domain/.belongs to family=/pgfplots, - /pgfplots/domain/.code={\pgfkeysalso{/tikz/domain=##1}}, /tikz/name/.belongs to family=/pgfplots/naming commands, /tikz/alias/.belongs to family=/pgfplots/naming commands, - % and provide aliases in the '/pgfplots/' tree to avoid - % search path problems just for these two options: - /pgfplots/name/.belongs to family=/pgfplots/naming commands, - /pgfplots/alias/.belongs to family=/pgfplots/naming commands, - /pgfplots/name/.code={\pgfkeysalso{/tikz/name=##1}}, - /pgfplots/alias/.code={\pgfkeysalso{/tikz/alias=##1}}, % % /pgf/key filter handlers/append filtered to/.install key filter handler=\pgfplots@rmopts, @@ -6569,6 +5369,9 @@ \fi \fi \pgfplots@deactivefamiliescmd + \pgfkeysdef{/pgfplots/xmode}{\pgfplots@error{You can't set 'xmode' in this context, sorry.}}% + \pgfkeysdef{/pgfplots/ymode}{\pgfplots@error{You can't set 'ymode' in this context, sorry.}}% + \pgfkeysdef{/pgfplots/zmode}{\pgfplots@error{You can't set 'zmode' in this context, sorry.}}% % % Acquire style commands and nameing commands from direct input % options '#1' BEFORE the 'every' styles are processed: @@ -6662,6 +5465,14 @@ \global\pgfkeysgetvalue{/pgfplots/xmax}{\pgfplots@xmax}% \global\pgfkeysgetvalue{/pgfplots/ymin}{\pgfplots@ymin}% \global\pgfkeysgetvalue{/pgfplots/ymax}{\pgfplots@ymax}% + \global\pgfkeysgetvalue{/pgfplots/zmin}{\pgfplots@zmin}% + \global\pgfkeysgetvalue{/pgfplots/zmax}{\pgfplots@zmax}% + \pgfkeysgetvalue{/pgfplots/xtickmin}{\pgfplots@xtickmin}% + \pgfkeysgetvalue{/pgfplots/xtickmax}{\pgfplots@xtickmax}% + \pgfkeysgetvalue{/pgfplots/ytickmin}{\pgfplots@ytickmin}% + \pgfkeysgetvalue{/pgfplots/ytickmax}{\pgfplots@ytickmax}% + \pgfkeysgetvalue{/pgfplots/ztickmin}{\pgfplots@ztickmin}% + \pgfkeysgetvalue{/pgfplots/ztickmax}{\pgfplots@ztickmax}% % \def\pgfplots@loc@TMPa{data}% \pgfplots@collect@firstplot@astickfalse @@ -6671,13 +5482,17 @@ \ifx\pgfplots@ytick\pgfplots@loc@TMPa \pgfplots@collect@firstplot@asticktrue \fi + \ifx\pgfplots@ztick\pgfplots@loc@TMPa + \pgfplots@collect@firstplot@asticktrue + \fi \ifpgfplots@collect@firstplot@astick - \let\pgfplots@firstplot@coords@x=\pgfutil@empty - \let\pgfplots@firstplot@coords@y=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@x=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@y=\pgfutil@empty + \global\let\pgfplots@firstplot@coords@z=\pgfutil@empty \fi \pgfkeysdef{/pgfplots/.unknown}{% \let\pgfplots@searchname=\pgfkeyscurrentname - \pgfkeysalso{/tikz/\pgfplots@searchname=##1}% + \pgfkeysalso{/tikz/\pgfplots@searchname={##1}}% }% } @@ -6727,14 +5542,16 @@ }% % temporary (local) variables inside of axis -\newif\ifpgfplots@autocomputeanylimits \newif\ifpgfplots@autocompute@all@limits \newif\ifpgfplots@autocompute@xmin \newif\ifpgfplots@autocompute@xmax \newif\ifpgfplots@autocompute@ymin \newif\ifpgfplots@autocompute@ymax +\newif\ifpgfplots@autocompute@zmin +\newif\ifpgfplots@autocompute@zmax \newif\ifpgfplots@apply@datatrafo@x \newif\ifpgfplots@apply@datatrafo@y +\newif\ifpgfplots@apply@datatrafo@z \newif\ifpgfplots@apply@datatrafo \newif\ifpgfplots@datascaletrafo@initialised \newif\ifpgfplots@draw@at@end @@ -6793,6 +5610,12 @@ \t@pgfplots@toka=\expandafter{\pgfplots@curlegendcode current plot style\pgfeov}% \t@pgfplots@tokb=\expandafter{\pgfplots@label@tikzopts}% \t@pgfplots@tokc=\expandafter{\pgfplots@crossref@pic\pgfeov}% + % 1. prepare /pgfplots/refstyle={#1}: + \immediate\write\@auxout{% + \noexpand\expandafter\noexpand\gdef + \noexpand\csname pgfplots@labelstyle@#1\noexpand\endcsname{\the\t@pgfplots@tokb}% + }% + % 2. prepare \ref{#1} and \pageref{#1}: \edef\pgfplots@loc@TMPa{% \noexpand\begingroup \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@tokb}}% @@ -6808,15 +5631,121 @@ \fi }% -\def\pgfplots@interruptdatabb{% - \def\pgfplots@update@limits@for@one@point##1##2##3##4{}% -}% -\def\endpgfplots@interruptdatabb{% - \let\pgfplots@update@limits@for@one@point=\pgfplots@update@limits@for@one@point@orig -}% +\def\pgfplots@interruptdatabb{\pgfplots@bb@isactivefalse} +\def\endpgfplots@interruptdatabb{\pgfplots@bb@isactivetrue} + +% +% \begin{axis}[#1] : +% +% This command prepares the axis for collection. NOTHING will be drawn +% until \end{axis}. During the collect phase, axis limits will be +% computed. +% +% The following variables are accummulated between +% \begin{axis} +% and +% \end{axis}: +% +% - \pgfplots@[xyz]min +% \pgfplots@[xyz]max +% - These denote the axis limits. +% - They are always assigned globally. +% - For linear axes, they will be computed in floating point. +% - For log axes, they will be computed using pgf math engine. +% - \pgfplots@[xyz]min@reg +% - A register containing the value of macro \pgfplots@[xyz]min +% in pt. It is only valid during \end{axis}. +% - \pgfplots@[xyz]max@reg +% - The same for 'max'. +% - \pgfplots@invalidrange@[xyz]min +% \pgfplots@invalidrange@[xyz]max +% A value which is used for the axis limits before the +% limit computation starts. +% - \pgfplots@data@[xyz]min +% \pgfplots@data@[xyz]max +% - DATA limits. These limits are not affected by limit +% restrictions +% - They are used to initialise the data scaling trafo. +% - They WON'T be assigned for log axes. +% - Assigned globally. +% - \pgfplots@[xyz]min@unscaled@as@float +% - Assigned during \end{axis} (local variables). +% - Contain the value of axis limits as floating point numbers +% in the original data range. +% - \pgfplots@metamin +% \pgfplots@metamax +% - if meta data is active, these macros will contain the upper +% and lower bound for meta data. +% - will be assigned globally. +% - \pgfplots@numplots +% - A count register indexing the current plot counter. Assigned +% globally. +% - \ifpgfplots@apply@datatrafo +% A boolean which indicates whether any scaling trafo is +% active. +% - \ifpgfplots@apply@datatrafo@[xyz] +% Booleans indicating whether for which axes the scaling trafo +% is active. +% - \pgfplots@stored@plotlist +% - An instance of pgfplotslist. +% - It is assigned globally. +% - Every \addplot or tikz path command is collected into this +% structure. +% - The element type is a compound object containing everything +% needed to process the plot during \end{axis}. +% - \pgfplots@plotspeclist +% - instance of pgfplotslist +% - collects every line specification for \addplot. +% - Used to assemble legends. +% - Assigned globally. +% - \pgfplots@legend +% - instance of pgfplotslist +% - collects every legend entry. +% - Used to assemble legends. +% - Assigned globally. +% - \pgfplots@data@scale@trafo@SHIFT@[xyz] +% \pgfplots@data@scale@trafo@EXPONENT@[xyz] +% - For any direction for which the scaling trafo is active, +% these macros contain the two parameters for the affine scaling +% trafo. +% - \pgfplots@firstplot@coords@[xyz] +% - A macro containing a comma separated list +% - It is collected if and only if [xyz]tick = 'data'. +% - Contains a list of coordinates in floating point +% representation if the axis is linear. +% - The coordinates are in pgf math notation for log axes. +% - Assigned globally. +% - \pgfplots@[xyz]@veclength +% - A macro containing the vector length of the [xyz] unit +% vector. +% - Assigned in \end{axis} +% - \pgfplots@[xyz]@inverseveclength +% - A macro containing the INVERSE vector length of the [xyz] +% unit vector. +% - Assigned in \end{axis} +% - \pgfplotspoint[xyz]axis +% - A macro which sets 'pgf@x' and 'pgf@y' to the [xyz] axis. +% - \pgfplotspoint[xyz]axislength +% - A macro containing the vector length of the [xyz] axis +% (including the 'pt' suffix). +% +% - \ifpgfplots@curplot@threedim +% - valid during an '\addplot' preparation step. +% - \ifpgfplots@threedim +% - whether the axis shall be threedimensional. +% +% - \pgfplots@currentplot@firstcoord@[xyz] +% - \pgfplots@currentplot@lastcoord@[xyz] +% - contains the first/last coordinate of the current plot. +% - assigned globally. +% - \ifpgfplots@coord@stream@isfirst +% - assigned globally during \addplot. +% +% \def\pgfplots@environment@opt[#1]{% \begingroup + \pgfplots@checkandpreparefor@active@semicolon \pgfplots@install@abbrev@commands \pgfplots@stacked@initialise % @@ -6830,6 +5759,7 @@ % '1pt' here as well. \pgfsetxvec{\pgfqpoint{1pt}{0pt}}% \pgfsetyvec{\pgfqpoint{0pt}{1pt}}% + \pgfsetzvec{\pgfqpoint{1.2pt}{1.2pt}}% % \pgfplots@set@options{#1}% % @@ -6843,6 +5773,7 @@ % -------------------- \pgfplots@prepare@coord@filtering@for x \pgfplots@prepare@coord@filtering@for y + \pgfplots@prepare@coord@filtering@for z \ifpgfplots@apply@datatrafo \pgfplots@datascaletrafo@initialisedfalse \else @@ -6867,48 +5798,63 @@ \def\pgfplots@invalidrange@ymin{16300}% \def\pgfplots@invalidrange@ymax{-16300}% \fi + \ifpgfplots@zislinear + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@zmin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@zmax=\pgfmathresult + \else + \def\pgfplots@invalidrange@zmin{16300}% + \def\pgfplots@invalidrange@zmax{-16300}% + \fi % % These numbers will ONLY be filled for linear axis! \global\let\pgfplots@data@xmin=\pgfplots@invalidrange@xmin \global\let\pgfplots@data@xmax=\pgfplots@invalidrange@xmax \global\let\pgfplots@data@ymin=\pgfplots@invalidrange@ymin \global\let\pgfplots@data@ymax=\pgfplots@invalidrange@ymax + \global\let\pgfplots@data@zmin=\pgfplots@invalidrange@zmin + \global\let\pgfplots@data@zmax=\pgfplots@invalidrange@zmax % \pgfplots@autocompute@all@limitstrue \ifx\pgfplots@xmin\pgfutil@empty \pgfplots@autocompute@xmintrue \global\let\pgfplots@xmin=\pgfplots@invalidrange@xmin - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@xmax\pgfutil@empty \pgfplots@autocompute@xmaxtrue \global\let\pgfplots@xmax=\pgfplots@invalidrange@xmax - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@ymin\pgfutil@empty \pgfplots@autocompute@ymintrue \global\let\pgfplots@ymin=\pgfplots@invalidrange@ymin - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi \ifx\pgfplots@ymax\pgfutil@empty \pgfplots@autocompute@ymaxtrue \global\let\pgfplots@ymax=\pgfplots@invalidrange@ymax - \pgfplots@autocomputeanylimitstrue \else \pgfplots@autocompute@all@limitsfalse \fi - % - % autocomputelimits := at least one limit needs to be updated. - \ifpgfplots@autocomputeanylimits - \pgfplots@draw@at@endtrue + \ifx\pgfplots@zmin\pgfutil@empty + \pgfplots@autocompute@zmintrue + \global\let\pgfplots@zmin=\pgfplots@invalidrange@zmin + \else + \global\pgfplots@threedimtrue + \pgfplots@autocompute@all@limitsfalse + \fi + \ifx\pgfplots@zmax\pgfutil@empty + \pgfplots@autocompute@zmaxtrue + \global\let\pgfplots@zmax=\pgfplots@invalidrange@zmax + \else + \global\pgfplots@threedimtrue + \pgfplots@autocompute@all@limitsfalse \fi - % % % -------------------- % Start axis: @@ -6916,7 +5862,8 @@ % -------------------- % % Since I've introduced a public \numplots macro, I should - % make sure it's filled correctly: + % make sure it's filled correctly. + % All versions from now on will store plots until \end{axis}: \pgfplots@draw@at@endtrue % \ifpgfplots@collect@firstplot@astick @@ -6949,12 +5896,16 @@ \let\path=\pgfplots@replacement@for@tikz@path \let\closedcycle=\pgfplots@path@closed@cycle \ifpgfplots@draw@at@end - \let\pgfplots@nextcommand=\relax \else - \def\pgfplots@nextcommand{\pgfplots@BEGIN@init@and@draw@axis}% + \expandafter% remove the '\fi' + \pgfplots@BEGIN@init@and@draw@axis \fi - \pgfplots@nextcommand } + +% \end{axis} : +% +% This command actually takes all collected (global) variables, +% creates an axis and performs all postponed drawing operations. \def\endpgfplots@environment@opt{% \xdef\numplots{\the\pgfplots@numplots}% \pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov% @@ -6968,6 +5919,10 @@ % All plotting commands have been read. % -> apply postponed drawing commands! % -------------------- + + + + \ifpgfplots@draw@at@end% ALWAYS TRUE - this is obsolete \def\pgfplots@nextcommand{% \pgfplots@BEGIN@init@and@draw@axis @@ -6981,13 +5936,21 @@ \pgfplotslistforeach\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{% \expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa %\message{Processing stored plot with precommand '\meaning\pgfplots@stored@current@precmd'; pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd' postcommand '\meaning\pgfplots@stored@current@postcmd'}% - % The precmd processed any error bars. - \pgfplots@stored@current@precmd + % The precmd sets all required variables needed to + % finalize a plot. + % @see the stream preparation routines. \ifx\pgfplots@stored@current@cmd\pgfutil@empty + \pgfplots@stored@current@precmd \pgfplots@stored@current@data% \else % this code here means we REALLY have a plotting % command! + \pgfplots@stored@current@precmd + % de-activate the FPU here! I fear its number + % format may cause errors when used in low-level + % routines. + \pgfkeys{/pgf/fpu=false}% + % \ifpgfplots@stacked@reverse % has already been processed above, in \pgfplots@stacked@finalize@stored@plots. \pgfplots@stacked@draw@reversed@plot @@ -7009,20 +5972,22 @@ % \begingroup % set coordinate system to (0,0) rectangle (1,1) for descriptions: - \pgftransformxshift{\pgfplots@xcoordminTEX}% - \pgftransformyshift{\pgfplots@ycoordminTEX}% + \pgftransformshift{\pgfplotspointsouthwest}% + % This here is a preparation macro for \pgfplots@low@level@shape@INNER. + % It applies the shift to the ORIGIN as well. + % It will ONLY be expanded if someone uses origin-anchors + % inside of axis descriptions. + \def\pgfplotspointORIGIN@tmp{% + \pgfpointdiff + {\pgfplotspointsouthwest}% + {\pgfqpoint{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}}% + }% + \pgfsetxvec{\pgfplotspointxaxis}% + \pgfsetyvec{\pgfplotspointyaxis}% % - % create a 'current axis' node for anchor references. + % create a leight-weight 'current axis' node for anchor references. \pgfmultipartnode{pgfplots@low@level@shape@INNER}{south west}{current axis}{\pgfusepath{discard}}% % - \pgfplots@tmpa=\pgfplots@xcoordmaxTEX - \advance\pgfplots@tmpa by-\pgfplots@xcoordminTEX - \pgfsetxvec{\pgfqpoint{\pgfplots@tmpa}{0cm}}% - % - \pgfplots@tmpa=\pgfplots@ycoordmaxTEX - \advance\pgfplots@tmpa by-\pgfplots@ycoordminTEX - \pgfsetyvec{\pgfqpoint{0cm}{\pgfplots@tmpa}}% - % \pgfplots@create@axis@descriptions \pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov% \endgroup @@ -7041,19 +6006,12 @@ \xdef\pgfplots@saveddimen@picminx{\the\pgf@picminx}% \xdef\pgfplots@saveddimen@picminy{\the\pgf@picminy}% % - \pgf@xa=\pgfplots@xcoordmaxTEX - \advance\pgf@xa by-\pgf@picminx - \xdef\pgfplots@savedanchor@inner@upperright@x{\the\pgf@xa}% - % - \pgf@xa=\pgfplots@xcoordminTEX + \pgfplotspointsouthwest + \pgf@xa=\pgf@x \advance\pgf@xa by-\pgf@picminx \xdef\pgfplots@savedanchor@inner@lowerleft@x{\the\pgf@xa}% % - \pgf@xa=\pgfplots@ycoordmaxTEX - \advance\pgf@xa by-\pgf@picminy - \xdef\pgfplots@savedanchor@inner@upperright@y{\the\pgf@xa}% - % - \pgf@xa=\pgfplots@ycoordminTEX + \pgf@xa=\pgf@y \advance\pgf@xa by-\pgf@picminy \xdef\pgfplots@savedanchor@inner@lowerleft@y{\the\pgf@xa}% % @@ -7124,6 +6082,7 @@ \pgfutil@for\pgfplots@child@node@name:=\pgfplots@named@child@node@list\do{% \ifx\pgfplots@child@node@name\pgfutil@empty \else +%\message{Attempting to correct '\pgfplots@child@node@name' position (it is inside of an axis).}% \expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax% \pgfutil@ifundefined{pgf@sh@nt@\pgfplots@child@node@name}{% \pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}% @@ -7190,3 +6149,6 @@ \tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis \tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis + + +\catcode`\;=\pgfplots@oldcatcodesemicolon diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex index 90ca205c835..14b81c1a7c4 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplots.stackedplots.code.tex @@ -130,23 +130,47 @@ \fi \fi \def\pgfplots@stacked@getnextzerolevelpoint{}% will remain constant anyway. + \ifpgfplots@curplot@threedim + \def\pgfplots@stacked@zerolevelpoint@z{0}% + \ifpgfplots@datascaletrafo@initialised + \else + \ifpgfplots@zislinear + \pgfmathfloatcreate{0}{0.0}{0}% + \let\pgfplots@stacked@zerolevelpoint@z=\pgfmathresult + \fi + \fi + \fi \else {\globaldefs=1 \pgfplotslistcopy\pgfplots@stacked@nextzerolevellist\to\pgfplots@stacked@zerolevellist }% - \def\pgfplots@stacked@getnextzerolevelpoint{% - {\globaldefs=1 - \pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult + \ifpgfplots@curplot@threedim + \def\pgfplots@stacked@getnextzerolevelpoint{% + {\globaldefs=1 + \pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult + }% + \expandafter\pgfplots@stacked@parsezerolevelpoint@threedim\pgfmathresult\relax }% - \expandafter\pgfplots@stacked@parsezerolevelpoint\pgfmathresult - }% + \else + \def\pgfplots@stacked@getnextzerolevelpoint{% + {\globaldefs=1 + \pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult + }% + \expandafter\pgfplots@stacked@parsezerolevelpoint\pgfmathresult\relax + }% + \fi \fi \global\pgfplotslistnewempty\pgfplots@stacked@nextzerolevellist }% -\def\pgfplots@stacked@parsezerolevelpoint(#1,#2){% +\def\pgfplots@stacked@parsezerolevelpoint(#1,#2)\relax{% + \def\pgfplots@stacked@zerolevelpoint@x{#1}% + \def\pgfplots@stacked@zerolevelpoint@y{#2}% +} +\def\pgfplots@stacked@parsezerolevelpoint@threedim(#1,#2,#3)\relax{% \def\pgfplots@stacked@zerolevelpoint@x{#1}% \def\pgfplots@stacked@zerolevelpoint@y{#2}% + \def\pgfplots@stacked@zerolevelpoint@z{#3}% } \def\pgfplots@stacked@endplot{% @@ -168,7 +192,7 @@ % \ifpgfplots@stacked@isfirstplot NOR the zero level lists are % initialised! \def\pgfplots@stacked@initzerolevelhandler{% - \ifpgfplots@stacked@x + \if\pgfplots@stacked@dir x \pgfplotxzerolevelstream@@list \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% \else @@ -177,16 +201,25 @@ \fi }% +% #1: a point as (x,y) (or (x,y,z) ) \def\pgfplots@stacked@rememberzerolevelpoint@for@next@plot#1{% \edef\pgfplots@loc@TMPa{#1}% \expandafter\pgfplotslistpushbackglobal\pgfplots@loc@TMPa\to\pgfplots@stacked@nextzerolevellist } -\def\pgfplots@stacked@finishpoint#1#2{% +% PRECONDITION: +% Is in invoked inside of a coord preparation routine, that means +% - \pgfplots@current@point@[xyz] +% - \ifpgfplots@curplot@threedim +% are all set properly. +\def\pgfplots@stacked@finishpoint{% \ifpgfplots@stacked@isfirstplot \else + % FIXME : This needs to be converted to logical coords. + % + % FIXME : 3D is not supported by the low level plot interface (yet). \pgfpointxy{\pgfplots@stacked@zerolevelpoint@x}{\pgfplots@stacked@zerolevelpoint@y}% - \ifpgfplots@stacked@x + \if\pgfplots@stacked@dir x \edef\pgfplots@loc@TMPa{\the\pgf@x}% \else \edef\pgfplots@loc@TMPa{\the\pgf@y}% @@ -199,46 +232,42 @@ \fi }% -\def\pgfplots@stacked@preparepoint@inmacro#1#2{% +% PRECONDITION: +% Is in invoked inside of a coord preparation routine, that means +% - \pgfplots@current@point@[xyz] +% - \ifpgfplots@curplot@threedim +% are all set properly. +% +% POSTCONDITION: +% - \pgfplots@current@point@[xyz] are adjusted. +\def\pgfplots@stacked@preparepoint@inmacro{% \pgfplots@stacked@getnextzerolevelpoint - \ifpgfplots@stacked@x - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathadd@ - \else - \let\pgfplots@stacked@op=\pgfmathsubtract@ - \fi - \ifpgfplots@xislinear - \ifpgfplots@datascaletrafo@initialised - \else - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathfloatadd@ - \else - \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ - \fi - \fi - \fi - \pgfplots@stacked@op{\pgfplots@stacked@zerolevelpoint@x}{#1}% - \let#1=\pgfmathresult + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathadd@ \else - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathadd@ + \let\pgfplots@stacked@op=\pgfmathsubtract@ + \fi + \pgfplots@if{pgfplots@\pgfplots@stacked@dir islinear}{% + \ifpgfplots@datascaletrafo@initialised \else - \let\pgfplots@stacked@op=\pgfmathsubtract@ - \fi - \ifpgfplots@yislinear - \ifpgfplots@datascaletrafo@initialised + \ifpgfplots@stacked@plus + \let\pgfplots@stacked@op=\pgfmathfloatadd@ \else - \ifpgfplots@stacked@plus - \let\pgfplots@stacked@op=\pgfmathfloatadd@ - \else - \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ - \fi + \let\pgfplots@stacked@op=\pgfmathfloatsubtract@ \fi \fi - \pgfplots@stacked@op{\pgfplots@stacked@zerolevelpoint@y}{#2}% - \let#2=\pgfmathresult + }{}% + \edef\pgfplots@loc@TMPa{ + \noexpand\pgfplots@stacked@op + {\csname pgfplots@stacked@zerolevelpoint@\pgfplots@stacked@dir\endcsname}% + {\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}}% + \pgfplots@loc@TMPa + \expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname=\pgfmathresult + \ifpgfplots@curplot@threedim + \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z)}% + \else + \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\pgfplots@current@point@x,\pgfplots@current@point@y)}% \fi - \pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(#1,#2)}% } % This here is a re-implementation of the stored plot processing. @@ -301,13 +330,13 @@ % preparation commands to ensure the functionality of % \pgfplots@stacked@finalize@stored@plots % -% Instead, it generates a macro #4 which - if used as "precommand" -% befor a draw operation - restores all required options and performs +% The macro #4 will - if used as "precommand" +% befor a draw operation - restore all required options and performs % pre-drawing. -\long\def\pgfplots@stacked@finalize@stored@coords@START plot coordinates #1#2;\to#3#4{% +\long\def\pgfplots@stacked@finalize@stored@coords@START normalized coordinates #1#2;\to#3#4{% \pgfplots@stacked@beginplot \pgfplots@coord@stream@INIT@finalize@stackedcoords@recordto{#3}{\pgfplots@recorded@marker@stream}% - \pgfplots@coord@stream@foreach{#1}% + \pgfplots@coord@stream@foreach@NORMALIZED{#1}% \pgfplots@stacked@endplot \pgfplots@stacked@savestateto\pgfplots@loc@TMPa \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\def\pgfplots@stacked@stored@postpath{#2}}% @@ -345,43 +374,82 @@ \global\let#2=\pgfplots@loc@TMPa \fi }% + % + \begingroup + \let\E=\noexpand + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro + % Will be inserted in one of two possible places below: + \def\pgfplots@loc@TMPa{% + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\expandafter\E\pgfplotsapplistXpushback\E\expandafter{\E\pgfmathresult}\E\to\E\pgfplots@stacked@record@mark@cmds%% + }% + % This finalize command maps the logical coordinate into PGF's + % point space. Furthermore, it collects marker coordinates + % (properly clipped by position) if markers are required (see + % above). + % + % It is prepared here to eliminate if's. + \xdef\pgfplots@coord@stream@finalize@currentpt{% + \ifpgfplots@curplot@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{\E\pgfplots@current@point@z}% + \else + \ifpgfplots@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{0.0}% + \else + \E\pgfplotsqpointxy{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}% + \fi + \fi + \E\edef\E\pgfmathresult{{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\t@pgfplots@toka=\E\expandafter{\E#1}% + \E\t@pgfplots@tokb=\E\expandafter{\E\pgfmathresult}% + \E\xdef\E#1{\E\the\E\t@pgfplots@toka + \E\noexpand\E\pgfplots@stream\E\the\E\t@pgfplots@tokb}% + % + \ifpgfplots@record@marker@stream + \E\pgf@xa=\E\pgfplots@current@point@x pt % FIXME : SCOPE REGISTERS!? + \E\pgf@ya=\E\pgfplots@current@point@y pt % + \ifpgfplots@curplot@threedim + \E\pgf@yb=\E\pgfplots@current@point@z pt % + \fi + \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg + \E\else + \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg + \E\else + \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg + \E\else + \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\else + \ifpgfplots@curplot@threedim + \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg + \E\else + \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\else + \pgfplots@loc@TMPa + \E\fi + \E\fi + \else + \pgfplots@loc@TMPa + \fi + \E\fi + \E\fi + \E\fi + \E\fi + \fi + }% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \endgroup + % \ifpgfplots@apply@datatrafo - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \pgfplots@apply@data@scaletrafo@to@one@point{##1}{##2}{##3}{##4}% + \def\pgfplots@coord@stream@coord@{% + \pgfplots@apply@data@scaletrafo@to@one@point% \pgfplots@coord@stream@finalize@currentpt }% \else - \def\pgfplots@coord@stream@coord@##1##2##3##4{% - \def\pgfplots@current@point@x{##1}% - \def\pgfplots@current@point@y{##2}% + \def\pgfplots@coord@stream@coord@{% \pgfplots@coord@stream@finalize@currentpt }% \fi - \def\pgfplots@coord@stream@finalize@currentpt{% - \pgfqpointxy{\pgfplots@current@point@x}{\pgfplots@current@point@y}% - \edef\pgfmathresult{{\the\pgf@x}{\the\pgf@y}}% - \t@pgfplots@toka=\expandafter{#1}% - \t@pgfplots@tokb=\expandafter{\pgfmathresult}% - \xdef#1{\the\t@pgfplots@toka - \noexpand\pgfplots@stream\the\t@pgfplots@tokb}% - % - \ifpgfplots@record@marker@stream - \ifdim\pgf@x<\pgfplots@xcoordminTEX - \else - \ifdim\pgf@x>\pgfplots@xcoordmaxTEX - \else - \ifdim\pgf@y<\pgfplots@ycoordminTEX - \else - \ifdim\pgf@y>\pgfplots@ycoordmaxTEX - \else - \edef\pgfmathresult{\noexpand\pgfplots@stream{\the\pgf@x}{\the\pgf@y}}% - \expandafter\pgfplotsapplistXpushback\expandafter{\pgfmathresult}\to\pgfplots@stacked@record@mark@cmds% - \fi - \fi - \fi - \fi - \fi - }% } % This command gets called after the sequence reversal has been done. @@ -407,12 +475,14 @@ \ifx\pgfplots@recorded@marker@stream\pgfutil@empty \else \ifpgfplots@clip@marker@paths + \scope% make sure that 'fill opacity' and 'dotted' styles remain local! \pgfplots@stored@current@cmd[current plot style] \pgfextra \pgfplots@install@plotmark@handler \pgfplots@recorded@marker@stream \endpgfextra ; + \endscope \else \pgfplots@stored@REMEMBER@MARK@COMMAND \fi diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex new file mode 100644 index 00000000000..4e00a678252 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscoordprocessing.code.tex @@ -0,0 +1,3251 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +% This file contains the code to process coordinates +% - coordinate input: \addplot and its variants, +% - coordinate loops, +% - single coordinate processing + + + +% Denotes a point in a twodimensional hyperplane. The hyperplane is +% one of the six planes of the threedimensional axis cube. +% +% The meaning of coordinates #1 and #2 will be redefined depending on +% which surface we are currently processing. You can get the axis +% names for '#1' (a) and '#2' (b) using the macros +% \pgfplotspointonorientedsurfaceA +% and +% \pgfplotspointonorientedsurfaceB. +% +% Example: +% \pgfplotspointonorientedsurfaceabsetupforxyz{0} +% -> +% \pgfplotspointonorientedsurfaceA = x +% \pgfplotspointonorientedsurfaceB = y +% \pgfplotspointonorientedsurfaceab{3}{4} = \pgfqpointxyz{3}{4}{0} +% +% \pgfplotspointonorientedsurfaceabsetupforyxz{0} +% -> +% \pgfplotspointonorientedsurfaceA = y +% \pgfplotspointonorientedsurfaceB = x +% \pgfplotspointonorientedsurfaceab{3}{4} = \pgfqpointxyz{4}{3}{0} +% +% @see \pgfplotspointonorientedsurfaceabsetupforxyz +\def\pgfplotspointonorientedsurfaceab#1#2{% + \pgfplots@error{Internal logic error: \string\pgfplotspointonorientedsurfaceab\ used although surface has not been declared! You need to call \string\pgfplotspointonorientedsurfaceabsetupforxyz\ or its friends to do so.}% +}% + +% This macro will be defined after +% \pgfplotspointonorientedsurfaceabsetupfor... +% routines. It expands to a three-character string +% where the first character contains information about the x axis, +% the second about the y axis and the third about the z axis. +% +% The single characters can be one of +% - 'a' - the corresponding axis is the PRIMARY direction of the +% oriented surface. +% - 'b' - the corresponding axis is the SECONDARY direction of the +% oriented surface. +% - anything else - the characters provides as second argument for +% \pgfplotspointonorientedsurfaceabsetupforsetz{}{}, for example. +% Common choices are '0' for lower limit, '1' for upper limit and +% '2' for other. +\def\pgfplotspointonorientedsurfacespec{}% + +% Similar to \pgfplotspointonorientedsurfacespec, this macro encodes +% the currently active oriented surface. +% However, it only contains the characters 'v', '0' and '1' and '2'. +% The distinction 'v in {a,b}' is eliminated. +\def\pgfplotspointonorientedsurfacespecunordered{}% + +% Initialises \pgfplotspointonorientedsurfaceab such that 'a' is the x +% axis and 'b' is the y axis and the z coordinate has been fixed with +% \pgfplotspointonorientedsurfaceabsetupforsetz{}. +% +% The Z value needs to be fixed with +% \pgfplotspointonorientedsurfaceabsetupforsetz . +% +\def\pgfplotspointonorientedsurfaceabsetupforxyz{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##1}{##2}{\pgfplotspointonorientedsurfaceabsetupfor@fixedZ}}% + \def\pgfplotspointonorientedsurfaceA{x}% + \def\pgfplotspointonorientedsurfaceB{y}% + \edef\pgfplotspointonorientedsurfacespec{ab\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforyxz{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##2}{##1}{\pgfplotspointonorientedsurfaceabsetupfor@fixedZ}}% + \def\pgfplotspointonorientedsurfaceA{y}% + \def\pgfplotspointonorientedsurfaceB{x}% + \edef\pgfplotspointonorientedsurfacespec{ba\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforxzy{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##1}{\pgfplotspointonorientedsurfaceabsetupfor@fixedY}{##2}}% + \def\pgfplotspointonorientedsurfaceA{x}% + \def\pgfplotspointonorientedsurfaceB{z}% + \edef\pgfplotspointonorientedsurfacespec{a\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol b}% + \edef\pgfplotspointonorientedsurfacespecunordered{v\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol v}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforzxy{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{##2}{\pgfplotspointonorientedsurfaceabsetupfor@fixedY}{##1}}% + \def\pgfplotspointonorientedsurfaceA{z}% + \def\pgfplotspointonorientedsurfaceB{x}% + \edef\pgfplotspointonorientedsurfacespec{b\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol a}% + \edef\pgfplotspointonorientedsurfacespecunordered{v\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol v}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforyzx{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{\pgfplotspointonorientedsurfaceabsetupfor@fixedX}{##1}{##2}}% + \def\pgfplotspointonorientedsurfaceA{y}% + \def\pgfplotspointonorientedsurfaceB{z}% + \edef\pgfplotspointonorientedsurfacespec{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol ab}% + \edef\pgfplotspointonorientedsurfacespecunordered{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol vv}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforzyx{% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxyz{\pgfplotspointonorientedsurfaceabsetupfor@fixedX}{##2}{##1}}% + \def\pgfplotspointonorientedsurfaceA{z}% + \def\pgfplotspointonorientedsurfaceB{y}% + \edef\pgfplotspointonorientedsurfacespec{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol ba}% + \edef\pgfplotspointonorientedsurfacespecunordered{\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol vv}% +}% + +% Fixes 'x' to #1 for use in +% \pgfplotspointonorientedsurfaceabsetupforzyx and +% \pgfplotspointonorientedsurfaceabsetupforyzx. +% +% #1: The fixed value for 'x'. +% #2: a one-character symbol describing 'x'. +% Command characters are +% - 0 : x is the lower x-axis range. +% - 1 : x is the upper x-axis range. +% - 2 : other. +\def\pgfplotspointonorientedsurfaceabsetupforsetx#1#2{% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedX{#1}% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforsety#1#2{% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedY{#1}% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforsetz#1#2{% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedZ{#1}% + \edef\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{#2}% +}% + +% Helper methods which should be used if no Z component exists (pure +% 2d plots). +\def\pgfplotspointonorientedsurfaceabsetupforxy{% + \def\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{0}% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxy{##1}{##2}}% + \def\pgfplotspointonorientedsurfaceA{x}% + \def\pgfplotspointonorientedsurfaceB{y}% + \edef\pgfplotspointonorientedsurfacespec{ab\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% +\def\pgfplotspointonorientedsurfaceabsetupforyx{% + \def\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol{0}% + \def\pgfplotspointonorientedsurfaceab##1##2{\pgfplotsqpointxy{##2}{##1}}% + \def\pgfplotspointonorientedsurfaceA{y}% + \def\pgfplotspointonorientedsurfaceB{x}% + \edef\pgfplotspointonorientedsurfacespec{ba\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% + \edef\pgfplotspointonorientedsurfacespecunordered{vv\pgfplotspointonorientedsurfaceabsetupfor@fixedsymbol}% +}% + + +% Assuming that an oriented surface has been initialised, say 'a0b', +% we have the following possible axis lines which can be drawn: +% - b=0: 'v00' +% - b=1: 'v01' +% - b=2: 'v02' +% +% To check which of them should be drawn, this macro here convert 'a' +% to 'v' and 'b' to '#1'. +% +% The resulting three-character-string is written into '#2'. +\def\pgfplotspointonorientedsurfaceabgetcontainedaxisline#1#2{% + \expandafter\pgfplotspointonorientedsurfaceabgetcontainedaxisline@\pgfplotspointonorientedsurfacespec\relax{#1}% + \let#2=\pgfplots@loc@TMPa +}% +% writes into \pgfplots@loc@TMPa: +\def\pgfplotspointonorientedsurfaceabgetcontainedaxisline@#1#2#3\relax#4{% + \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#1}{#4}\to\pgfplots@loc@TMPa + \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#2}{#4}\to\pgfplots@loc@TMPb + \pgfplotspointonorientedsurfaceabgetcontainedaxisline@single{#3}{#4}\to\pgfplots@loc@TMPc + \edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa\pgfplots@loc@TMPb\pgfplots@loc@TMPc}% +}% +\def\pgfplotspointonorientedsurfaceabgetcontainedaxisline@single#1#2\to#3{% + \if#1a% + \def#3{v}% + \else + \if#1b% + \def#3{#2}% + \else + \def#3{#1}% + \fi + \fi +}% + + +% Finds the two surfaces which are adjacent to an axis line encoded as +% three-character-string. +% +% There are the following possibilities: +% #1 = 'v**' where '*' is not 'v'. +% -> #2 = 'vv*' and #3 = 'v*v' +% +% #1 = '*v*' +% -> #2 = 'vv*' and #3 = '*vv' +% +% #1 = '**v' +% -> #2 = 'v*v' and #3 = '*vv' +\def\pgfplotsgetadjacentsurfsforaxisline#1\to#2#3{% + \edef\pgfplots@loc@TMPa{#1}% + \expandafter\pgfplotsgetadjacentsurfsforaxisline@\pgfplots@loc@TMPa\relax{#2}{#3}% +}% +\def\pgfplotsgetadjacentsurfsforaxisline@#1#2#3\relax#4#5{% + \if#1v% + \def#4{vv#3}% + \def#5{v#2v}% + \else + \if#2v% + \def#4{vv#3}% + \def#5{#1vv}% + \else + \def#4{v#2v}% + \def#5{#1vv}% + \fi + \fi +}% + +% Executes code '#2' if the axis line with 'b=#1' on the current +% oriented surface shall be drawn. +% If that is not the case, the code '#3' will be executed. +% +% Example: +% Let's assume the current oriented surface is 'b0a'. +% Then, +% \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{draw it!}{\relax} +% will check whether the line '00v' shall be drawn while +% \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{draw it!}{\relax} +% will check whether the line '10v' shall be drawn. +% +% @see \pgfplotspointonorientedsurfaceabgetcontainedaxisline +% +% @ATTENTION : this command will be always true for the 2D case. (it +% will be overwritten, see \pgfplots@decide@which@figure@surfaces@are@drawn) +\def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn#1#2#3{% + \pgfplotspointonorientedsurfaceabgetcontainedaxisline#1\pgfplots@loc@TMPc + \pgfplotsgetadjacentsurfsforaxisline\pgfplots@loc@TMPc\to\pgfplots@loc@TMPb\pgfplots@loc@TMPc + \if1\csname pgfplots@surfenabled@\pgfplots@loc@TMPb\endcsname + #2% + \else + \if1\csname pgfplots@surfenabled@\pgfplots@loc@TMPc\endcsname + #2% + \else + #3% + \fi + \fi +}% + + +% Checks whether the line specified by a three-character-string '#1' +% is inside of the currently set-up oriented surface. +% +% The return value is encoded as integer into the macro #2 as +% described below. +% +% #1 : a three-character string uniquely identifing an axis line. +% Each of the three characters can be 'v', '0' or '1'. +% The value '0' denotes the lower axis range while '1' denotes +% the upper axis range. The character 'v' stands for 'varying' +% and indicates the direction in which the line varies. The first +% character contains the values for the 'x' axis, the second +% character for the 'y' axis and the third character for the 'z' +% axis. +% Example: +% 'v01' is the axis line with 'y=lower y limit' and 'z=upper z limit' +% '10v' is the axis line with 'x=upper x limit' and 'y=lower y limit' +% The 'v' character indicates the varying component. There may be +% only one 'v'. +% #2 : a macro name. It will be empty if the line is NOT on the +% current surface. If will be non-empty if it IS on the current +% surface. +% To be more precise, If the line IS on the current surface, '#2' will be set to +% the character in '#1' which belongs to the second oriented +% surface axis (which is called the 'b' axis). +% Thus, the following values for '#2' can be expected: +% - '' (empty) if the line is not on the surface, +% - 'v' if the line IS on the surface, and '#1' contains a 'v' +% in direction of the surface's 'b' axis. +% - '0' if the line IS on the surface and '#1' contains a '0' in +% direction of the surface's 'b' axis, +% - '1' if the line IS on the surface and '#1' contains a '1' in +% direction of the surface's 'b' axis. +% No other values are possible. +% +% Example: +% \pgfplotspointonorientedsurfaceabsetupforsetz{\zmax}{1} +% \pgfplotspointonorientedsurfaceabsetupforyxz +% \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result} +% -> \result will be 'v' because 'x=v' in '{v01} +% +% \pgfplotspointonorientedsurfaceabsetupforsety{\ymin}{0} +% \pgfplotspointonorientedsurfaceabsetupforxzy +% \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result} +% -> \result will be '1' because 'z=1' in '{v01} +% +% \pgfplotspointonorientedsurfaceabsetupforsety{\ymax}{1} +% \pgfplotspointonorientedsurfaceabsetupforxzy +% \pgfplotspointonorientedsurfaceabmatchaxisline{v01}{\result} +% -> \result will be empty because 'y=0' in '{v01} +% +% \pgfplotspointonorientedsurfaceabsetupforsetx{\xmax}{1} +% \pgfplotspointonorientedsurfaceabsetupforyzx +% \pgfplotspointonorientedsurfaceabmatchaxisline{10v}{\result} +% -> \result will be 'v' because 'z=v' in '{10v} +\def\pgfplotspointonorientedsurfaceabmatchaxisline#1#2{% + \pgfplotsmatchcubeparts{#1}{\pgfplotspointonorientedsurfacespec}{#2}% +}% + +% Checks whether the line or surface specified by a three-character-string '#1' +% is inside of the surface designated by the three-character-string '#2'. +% +% +% Arguments: +% #1 a cube-part (axis line or surface) encoded as three character +% string. Can be '0v1' or 'vv0' or so (see above). +% #2 a surface, also encoded as three character string. Maybe +% oriented. +% #3 The return value is encoded as integer into the macro #3 as +% described in \pgfplotspointonorientedsurfaceabmatchaxisline: +% '#3' will be EMPTY if '#1' NOT in '#2'. +% '#3' will be NON-EMPTY if '#1' IN '#2'. +\def\pgfplotsmatchcubeparts#1#2#3{% + \edef\pgfplots@loc@TMPa{#1:#2}% + \expandafter\pgfplotspointonorientedsurfaceabmatchaxisline@\pgfplots@loc@TMPa\pgfplots@EOI + \let#3=\pgfplots@loc@TMPa +}% + +% IMPLEMENTATION: +% The return value is 'yes, #1#2#3 is on the oriented surface #4#5#6' +% if and only if for all three character pairs, the following single +% relations hold. +% Input char oriented surface char +% 'v' : is either a or b or v +% '0' : is either 0, a, b, v or 2 (i.e. NOT 1) +% '1' : is either 1, a, b, v or 2 (i.e. NOT 0) +% That's all. +% +% If the 'oriented surface char' is 'v', then we actually don't have +% an oriented surface but just a surface. +% So, 'a0b' is the same surface as 'v0v', but the first choice has +% designated orientations. +% +% @POST \pgfplots@loc@TMPa contains the return value macro. +\def\pgfplotspointonorientedsurfaceabmatchaxisline@#1#2#3:#4#5#6\pgfplots@EOI{% + % Search for the 'b' character: + \if#4b% + \def\pgfplots@loc@TMPa{#1}% + \else + \if#5b% + \def\pgfplots@loc@TMPa{#2}% + \else + \if#6b% + \def\pgfplots@loc@TMPa{#3}% + \else + \def\pgfplots@loc@TMPa{v}% FALLBACK solution. + \fi + \fi + \fi + % Now, check whether we need to clear the return value (i.e. + % return false) + \pgfplotspointonorientedsurfaceabmatchaxisline@single{#1}{#4}% + \pgfplotspointonorientedsurfaceabmatchaxisline@single{#2}{#5}% + \pgfplotspointonorientedsurfaceabmatchaxisline@single{#3}{#6}% +} +\def\pgfplotspointonorientedsurfaceabmatchaxisline@single#1#2{% + \if#1v% + \if#2a% + \else + \if#2b% + \else + \if#2v% + \else + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \fi + \fi + \else + \if0#1% + \if1#2% + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \else + \if1#1% + \if0#2% + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \else + \pgfplots@error{The character '#1' is no valid element for a three-character axis line or surface description!}% + \fi + \fi + \fi +}% + +% Takes Pitch '#1' and Yaw '#2' (both in degrees) and computes +% x,y and z vectors which define the view in the direction +% defined by '#1' and '#2'. +% +% 'Pitch' means a rotation around the viewport's x axis. 'Yaw' means +% a rotation around the original coordinate system's z axis. +% +% The method works by computing +% Az = [ cos(yaw) -sin(yaw) 0; ... +% sin(yaw) cos(yaw) 0; ... +% 0 0 1 ]; +% Ax = [ 1 0 0; ... +% 0 cos(pitch) -sin(pitch) ;... +% 0 sin(pitch) cos(pitch) ]; +% v= Ax * Az; +% +% = [ ... +% cosy -siny cosp siny sinp; ... +% siny cosy cosp -sinp cosy; ... +% 0 sinp cosp ]; +% +% Then, we use the rotated XY plane as viewport, that means +% xvec = v * [1 0 0]' +% yvec = v * [0 1 0]' +% and we define the projection onto the twodimensional surface +% spanned by 'xvec' and 'yvec' as +% P( q ) = [ q^T xvec, q^T yvec ]' +% for q in R^3. +% As a consequence, we compute the three unit vectors as +% x = P( [1 0 0] ) +% y = P( [0 1 0] ) +% z = P( [0 0 1] ) +% and get thus in matlab notation: +% +% proj = 1:2; +% x = v(1,proj); +% y = v(2,proj); +% z = v(3,proj); +% +% INPUT: +% - #1 : pitch +% - #2 : yaw +% OUTPUT: +% - #3 : a macro which will be set to '1' if and only if +% the viewport is the standard XY axis (i.e. pitch=0,yaw=0). +% - \pgfplots@[xyz]@veclength +% \pgfplots@[xyz]@inverseveclength +% are set properly +\def\pgfplotssetaxesfrompitchyaw#1#2#3{% + \begingroup + \pgfmathsin@{#1}% + \let\sinp=\pgfmathresult + \pgfmathsin@{#2}% + \let\siny=\pgfmathresult + \pgfmathcos@{#1}% + \let\cosp=\pgfmathresult + \pgfmathcos@{#2}% + \let\cosy=\pgfmathresult + % x: + \pgfmathmultiply@{\siny}{-1}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\cosp}% + \xdef\pgfplots@glob@TMPa{\noexpand\pgfqpoint{\cosy pt}{\pgfmathresult pt}}% + % y: + \pgfmathmultiply@{\cosy}{\cosp}% + \xdef\pgfplots@glob@TMPb{\noexpand\pgfqpoint{\siny pt}{\pgfmathresult pt}}% + % z: + \xdef\pgfplots@glob@TMPc{\noexpand\pgfqpoint{0pt}{\sinp pt}}% + \endgroup +\message{Setting x,y and z from {#1}{#2} to x = \meaning\pgfplots@glob@TMPa, y = \meaning\pgfplots@glob@TMPb, z = \meaning\pgfplots@glob@TMPc...}% + \pgfsetxvec{\pgfplots@glob@TMPa}% + \pgfsetyvec{\pgfplots@glob@TMPb}% + \pgfsetzvec{\pgfplots@glob@TMPc}% + \def#3{0}% + \def\pgfplots@x@veclength{1.0}% + \def\pgfplots@y@veclength{1.0}% + \def\pgfplots@z@veclength{1.0}% + \def\pgfplots@x@inverseveclength{1.0}% + \def\pgfplots@y@inverseveclength{1.0}% + \def\pgfplots@z@inverseveclength{1.0}% +% FIXME : +\def\scale{200}% +\pgfmathreciprocal@{\scale}% +\let\invscale=\pgfmathresult +\pgfsetxvec{\pgfpointscale{\scale}{\pgfplots@glob@TMPa}}% +\pgfsetyvec{\pgfpointscale{\scale}{\pgfplots@glob@TMPb}}% +\pgfsetzvec{\pgfpointscale{\scale}{\pgfplots@glob@TMPc}}% +\let\pgfplots@x@veclength=\scale% +\let\pgfplots@y@veclength=\scale% +\let\pgfplots@z@veclength=\scale% +\let\pgfplots@x@inverseveclength=\invscale% +\let\pgfplots@y@inverseveclength=\invscale% +\let\pgfplots@z@inverseveclength=\invscale% +}% + + + +% Internal stream methods. +% +% Please overwrite +% - \pgfplots@coord@stream@start@, +% - \pgfplots@coord@stream@end@ and +% - \pgfplots@coord@stream@coord@ +% if you implement streams. +% +% REMARK: +% - the stream methods automatically collect first and last +% coordinates. +% - I have experimented with global \addplot accumulation to reduce +% copy operations. That experiment was not successfull (it was not +% faster :-( ). However, the streaming methods still assign their +% things globally... +\newif\ifpgfplots@coord@stream@isfirst +\def\pgfplots@coord@stream@start{% + \global\pgfplots@coord@stream@isfirsttrue + \global\let\pgfplots@currentplot@firstcoord@x=\pgfutil@empty + \global\let\pgfplots@currentplot@firstcoord@y=\pgfutil@empty + \global\let\pgfplots@currentplot@firstcoord@z=\pgfutil@empty + \global\let\pgfplots@currentplot@lastcoord@x=\pgfutil@empty + \global\let\pgfplots@currentplot@lastcoord@y=\pgfutil@empty + \global\let\pgfplots@currentplot@lastcoord@z=\pgfutil@empty + \let\pgfplots@current@point@x=\pgfutil@empty + \let\pgfplots@current@point@y=\pgfutil@empty + \let\pgfplots@current@point@z=\pgfutil@empty + \let\pgfplots@current@point@meta=\pgfutil@empty + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \pgfplots@coord@stream@start@}% +\def\pgfplots@coord@stream@end{\pgfplots@coord@stream@end@} + +% Will be invoked for every point coordinate. +% +% It invokes \pgfplots@coord@stream@coord@. +% +% Arguments: +% \pgfplots@current@point@[xyz] +% \pgfplots@current@point@[xyz]@error (if in argument list) +% \pgfplots@current@point@meta +\def\pgfplots@coord@stream@coord{% + \pgfplots@coord@stream@coord@% + % FIXME : needs to be updated for 3D + % FIXME : reduce \if's + \ifx\pgfplots@current@point@x\pgfutil@empty + \else + \ifx\pgfplots@current@point@y\pgfutil@empty + \else + \ifpgfplots@coord@stream@isfirst + \global\let\pgfplots@currentplot@firstcoord@x=\pgfplots@current@point@x + \global\let\pgfplots@currentplot@firstcoord@y=\pgfplots@current@point@y + \global\pgfplots@coord@stream@isfirstfalse + \fi + \global\let\pgfplots@currentplot@lastcoord@x=\pgfplots@current@point@x + \global\let\pgfplots@currentplot@lastcoord@y=\pgfplots@current@point@y + \fi + \fi +}% + +% Initialises +% \pgfplots@coord@stream@start +% \pgfplots@coord@stream@coord +% \pgfplots@coord@stream@end +% such that a following coordinate stream is processed properly. The +% following coordinate stream may come from different input methods. +% +% Arguments: +% #1: all options of \addplot[...] (the plot style) +% #2: any trailing path commands after the 'plot' command as such, +% for example \addplot plot coordinates {...} -- (0,0); +% would yield #2 =' -- (0,0)' +% +% PRECONDITION: +% - needs to be called inside of \addplot. +% +% REMARK: +% The following code is permissable: +% \pgfplots@PREPARE@COORD@STREAM{..}{...} +% \pgfplots@coord@stream@start +% ... +% \pgfplots@coord@stream@coord +% .. +% \pgfplots@coord@stream@coord +% .. +% \pgfplots@coord@stream@end +% -> All need to be the SAME LEVEL OF SCOPING! The '@coord' commands +% may not be scoped deeper than 'begin' and 'end'! +% - I had a version which allowed that. it was actually slower! +% - For now, the following things are global / local: +% - point coordinate list: local +% - meta data limits: global, +% - recorded error bar commands: local, +% - what about stacked plot stuff: appears to be a combination +% of local/global. +% +\long\def\pgfplots@PREPARE@COORD@STREAM#1#2{% + \ifpgfplots@curplot@threedim + \global\pgfplots@threedimtrue + \fi + \def\pgfplots@coord@stream@start@{% + \pgfplotsapplistXXnewempty + \ifpgfplots@errorbars@enabled + \pgfplots@streamerrorbar@recordto{\pgfplots@recordederrorbar}% + \pgfplots@streamerrorbarstart + \else + \let\pgfplots@recordederrorbar=\pgfutil@empty + \fi + \ifpgfplots@stackedmode + \pgfplots@stacked@beginplot + \fi + % + %\let\pgfplots@coord@stream@recorded=\pgfutil@empty + % + \pgfplots@perpointmeta@usesfloattrue + % %%%%%%%%%%%%%% + % + % Define \pgfplots@set@perpointmeta properly: + \ifcase\pgfplots@perpointmeta@choice + % disabled. + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfutil@empty + }% + \or + % point meta/x + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfplots@current@point@x + }% + \ifpgfplots@xislinear + \else + \pgfplots@perpointmeta@usesfloatfalse + \fi + \or + % point meta/y + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfplots@current@point@y + }% + \ifpgfplots@yislinear + \else + \pgfplots@perpointmeta@usesfloatfalse + \fi + \or + % point meta/z + \def\pgfplots@set@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfplots@current@point@z + }% + \ifpgfplots@zislinear + \else + \pgfplots@perpointmeta@usesfloatfalse + \fi + \or + % point meta/explicit : parse the information found + % somewhere: + \def\pgfplots@set@perpointmeta{% + \pgfmathfloatparsenumber{\pgfplots@current@point@meta}% + \let\pgfplots@current@point@meta=\pgfmathresult + }% + \or + % point meta/explicit symbolic : simply collect the + % information, no math. + \def\pgfplots@set@perpointmeta{}% + \fi + \ifnum\pgfplots@perpointmeta@choice=0 + \global\let\pgfplots@metamin=\pgfutil@empty + \global\let\pgfplots@metamax=\pgfutil@empty + \else + \ifnum\pgfplots@perpointmeta@choice=5 + \global\let\pgfplots@metamin=\pgfutil@empty + \global\let\pgfplots@metamax=\pgfutil@empty + \else + % We need to work with per point meta data. + % So, also compute the data range on a per-stream basis! + % These limits are important later. + \ifpgfplots@perpointmeta@usesfloat + \pgfmathfloatcreate{1}{1.0}{2147483645}% + \let\pgfplots@invalidrange@metamin=\pgfmathresult + \pgfmathfloatcreate{2}{1.0}{2147483645}% + \let\pgfplots@invalidrange@metamax=\pgfmathresult + \global\let\pgfplots@metamin=\pgfplots@invalidrange@metamin + \global\let\pgfplots@metamax=\pgfplots@invalidrange@metamax + \expandafter\def\expandafter\pgfplots@set@perpointmeta\expandafter{% + \pgfplots@set@perpointmeta + \pgfplotsmathfloatmin{\pgfplots@metamin}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamin=\pgfmathresult + \pgfplotsmathfloatmax{\pgfplots@metamax}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamax=\pgfmathresult + }% + \else + \def\pgfplots@invalidrange@metamin{16300}% + \def\pgfplots@invalidrange@metamax{-16300}% + \global\let\pgfplots@metamin=\pgfplots@invalidrange@metamin + \global\let\pgfplots@metamax=\pgfplots@invalidrange@metamax + \expandafter\def\expandafter\pgfplots@set@perpointmeta\expandafter{% + \pgfplots@set@perpointmeta + \pgfplotsmathmin{\pgfplots@metamin}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamin=\pgfmathresult + \pgfplotsmathmax{\pgfplots@metamax}{\pgfplots@current@point@meta}% + \global\let\pgfplots@metamax=\pgfmathresult + }% + \fi + \fi + \fi + }% + \begingroup + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \let\E=\noexpand + % + % Setup Just-In-Time-Macro Compilation: + % I compile a set of macros which is highly optimized for this + % particular plot. + % + % 1.\pgfplots@update@limits@for@one@point + % Updates the current x and y limits for point (#1,#2). + % + % To eliminate all those case distinctions, it is created with + % 'edef' and a lot of '\noexpand' calls here: + % + % + % The point coordinates may be given in floating point format, see + % below. + % + % Please note that if user specified limits are given, automatic + % limits are only applied to points which fall into the user specified + % clipping region. + % + % PRECONDITIONS: + % - the input coordinates have been parsed correctly (floating point + % format for linear axis, log applied for logarithmic ones) + % + % Arguments: + % \pgfplots@current@point@[xyz] + \xdef\pgfplots@update@limits@for@one@point{% +%\E\tracingmacros=2\E\tracingcommands=2 +%\E\pgfplots@message{Updating limits for (\E\pgfplots@current@point@x,\E\pgfplots@current@point@y) ...}% + % + % VIM SEARCH PATTERN: + % [^E]\zs\\\ze[^E] + % -> this finds '\' which is neither '\E' nor is it prefixed + % by 'E'. + % + % + % + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDfalse + % check whether we need to clip limits: + \ifpgfplots@clip@limits + \ifpgfplots@autocompute@xmin + \else + \ifpgfplots@xislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@current@point@x}{\E\pgfplots@xmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@current@point@x}{\E\pgfplots@xmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@xmax + \else + \ifpgfplots@xislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@ymin + \else + \ifpgfplots@yislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@current@point@y}{\E\pgfplots@ymin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@current@point@y}{\E\pgfplots@ymin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@ymax + \else + \ifpgfplots@yislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@curplot@threedim + \else + \ifpgfplots@autocompute@zmin + \else + \ifpgfplots@zislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@current@point@z}{\E\pgfplots@zmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@current@point@z}{\E\pgfplots@zmin}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \ifpgfplots@autocompute@zmax + \else + \ifpgfplots@zislinear + \E\pgfmathfloatlessthan@{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \else + \E\pgfplotsmathlessthan{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\ifpgfmathfloatcomparison + \E\pgfplots@update@limits@for@one@point@ISCLIPPEDtrue + \E\fi + \fi + \fi + \fi + \fi + % + % + % + % Update limits: + \E\ifpgfplots@update@limits@for@one@point@ISCLIPPED + \E\else + \ifpgfplots@autocompute@xmin + \ifpgfplots@xislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@xmin}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmin=\E\pgfmathresult + \else + \E\pgfplotsmathmin{\E\pgfplots@xmin}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmin=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@xmax + \ifpgfplots@xislinear + \E\pgfplotsmathfloatmax{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmax=\E\pgfmathresult + \else + \E\pgfplotsmathmax{\E\pgfplots@xmax}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@xmax=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@ymin + \ifpgfplots@yislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@ymin}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymin=\E\pgfmathresult + \else + \E\pgfplotsmathmin{\E\pgfplots@ymin}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymin=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@ymax + \ifpgfplots@yislinear + \E\pgfplotsmathfloatmax{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymax=\E\pgfmathresult + \else + \E\pgfplotsmathmax{\E\pgfplots@ymax}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@ymax=\E\pgfmathresult + \fi + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@autocompute@zmin + \ifpgfplots@zislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@zmin}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmin=\E\pgfmathresult + \else + \E\pgfplotsmathmin{\E\pgfplots@zmin}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmin=\E\pgfmathresult + \fi + \fi + \ifpgfplots@autocompute@zmax + \ifpgfplots@zislinear + \E\pgfplotsmathfloatmax{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmax=\E\pgfmathresult + \else + \E\pgfplotsmathmax{\E\pgfplots@zmax}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@zmax=\E\pgfmathresult + \fi + \fi + \fi + \E\fi + % + % Compute data range: + \ifpgfplots@autocompute@all@limits + % the data range will be acquired simply from the axis + % range, see below! + \else + % Attention: it is only done for linear axis! + \ifpgfplots@xislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@data@xmin}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@data@xmin=\E\pgfmathresult + \E\pgfplotsmathfloatmax{\E\pgfplots@data@xmax}{\E\pgfplots@current@point@x}% + \E\global\E\let\E\pgfplots@data@xmax=\E\pgfmathresult + \fi + \ifpgfplots@yislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@data@ymin}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@data@ymin=\E\pgfmathresult + \E\pgfplotsmathfloatmax{\E\pgfplots@data@ymax}{\E\pgfplots@current@point@y}% + \E\global\E\let\E\pgfplots@data@ymax=\E\pgfmathresult + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@zislinear + \E\pgfplotsmathfloatmin{\E\pgfplots@data@zmin}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@data@zmin=\E\pgfmathresult + \E\pgfplotsmathfloatmax{\E\pgfplots@data@zmax}{\E\pgfplots@current@point@z}% + \E\global\E\let\E\pgfplots@data@zmax=\E\pgfmathresult + \fi + \fi + \fi +%\E\pgfplots@message{Updated limits: (\E\pgfplots@xmin,\E\pgfplots@ymin) rectangle (\E\pgfplots@xmax,\E\pgfplots@ymax).}% +%\E\tracingmacros=0\E\tracingcommands=0 + }% +%\message{Assembled update-limits macro to {\meaning\pgfplots@update@limits@for@one@point}}% + \ifpgfplots@bb@isactive + \else + % we are inside of + % \pgfplotsinterruptdatabb + % .. + % \endpgfinterruptboundingbox + % -> don't change data limits! + \global\let\pgfplots@update@limits@for@one@point=\relax + \fi + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % + % This here is the MAIN code of \pgfplots@process@one@point . + % It is inserted below into the right, into one of two prepared + % places. + \def\pgfplots@loc@TMPa{% + \ifpgfplots@apply@datatrafo + \ifpgfplots@datascaletrafo@initialised + % apply data transformation directly. + \ifpgfplots@apply@datatrafo@x + \E\pgfplots@datascaletrafo@x\E\pgfplots@current@point@x + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + \fi + \ifpgfplots@apply@datatrafo@y + \E\pgfplots@datascaletrafo@y\E\pgfplots@current@point@y + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@apply@datatrafo@z + \E\pgfplots@datascaletrafo@z\E\pgfplots@current@point@z + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + \fi + \fi + \fi + \fi + % All following routines (limit updating/stacking/error + % bars) will use float numerics if necessary (controlled + % by ifs). + \ifpgfplots@stackedmode + \E\pgfplots@stacked@preparepoint@inmacro% + \ifpgfplots@datascaletrafo@initialised% is also true if there is no scale trafo. + \E\pgfplots@stacked@finishpoint + \else + % the finishpoint routine will be invoked at + % \endaxis. + \fi + \fi + % + % Prepare \pgfplots@current@point@meta (see the preparation + % routine above): + \E\pgfplots@set@perpointmeta + % + % update also axis / data limits: + % Arguments: \pgfplots@current@point@[xy] + \E\pgfplots@update@limits@for@one@point + \ifpgfplots@errorbars@enabled + % This thing gets the 'current@point@...' context, + % that means + % \pgfplots@current@point@[xy] + % \pgfplots@current@point@[xy]@error + % \pgfplots@current@point@[xy]@unfiltered + \E\pgfplots@process@errorbar@for% + \fi + % + % Store normalized point for list: + % We need + % xi,yi,zi,mi; + % where zi and mi may be empty. mi is the per-point meta + % information. It is used for per-coordinate marker + % modifications (like colormaps for scatter plots). + \E\edef\E\pgfplots@loc@TMPa{\E\pgfplots@current@point@x,\E\pgfplots@current@point@y,\E\pgfplots@current@point@z,\E\pgfplots@current@point@meta;}% + \E\expandafter\E\pgfplotsapplistXXpushback\E\expandafter{\E\pgfplots@loc@TMPa}% + % + \ifpgfplots@collect@firstplot@astick + \ifnum\pgfplots@numplots=0 + \E\ifx\E\pgfplots@firstplot@coords@x\E\pgfutil@empty + \E\t@pgfplots@tokc={}% + \E\else + \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@x,}% + \E\fi + \E\xdef\E\pgfplots@firstplot@coords@x{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@x}% + \E\ifx\E\pgfplots@firstplot@coords@y\E\pgfutil@empty + \E\t@pgfplots@tokc={}% + \E\else + \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@y,}% + \E\fi + \E\xdef\E\pgfplots@firstplot@coords@y{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@y}% + % + \ifpgfplots@curplot@threedim + \E\ifx\E\pgfplots@firstplot@coords@z\E\pgfutil@empty + \E\t@pgfplots@tokc={}% + \E\else + \E\t@pgfplots@tokc=\E\expandafter{\E\pgfplots@firstplot@coords@z,}% + \E\fi + \E\xdef\E\pgfplots@firstplot@coords@z{\E\the\E\t@pgfplots@tokc\E\pgfplots@current@point@z}% + \fi + \fi + \fi + }% + % The following code assembles the command which is executed for + % each coordinate. + % + % To eliminate all those case distinctions, it is created with + % 'edef' and a lot of '\noexpand' calls here: + % + % Arguments: + % \pgfplots@current@point@[xyz] + % \pgfplots@current@point@[xyz]@error (if in argument list) + \xdef\pgfplots@process@one@point{% + % These things are necessary for error bars: + \E\let\E\pgfplots@current@point@x@unfiltered=\E\pgfplots@current@point@x + \E\let\E\pgfplots@current@point@y@unfiltered=\E\pgfplots@current@point@y + \ifpgfplots@curplot@threedim + \E\let\E\pgfplots@current@point@z@unfiltered=\E\pgfplots@current@point@z + \fi + % + \E\pgfplots@prepare@xcoord{\E\pgfplots@current@point@x}% + \E\expandafter\E\pgfplots@invoke@filter\E\expandafter{\E\pgfmathresult}{x}% + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + % + \E\pgfplots@prepare@ycoord{\E\pgfplots@current@point@y}% + \E\expandafter\E\pgfplots@invoke@filter\E\expandafter{\E\pgfmathresult}{y}% + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + % + \ifpgfplots@xislinear + \E\ifx\E\pgfplots@current@point@x\E\pgfutil@empty + \E\else + \E\pgfmathfloatparsenumber{\E\pgfplots@current@point@x}% + \E\expandafter\E\pgfmathfloat@decompose@F\E\pgfmathresult\E\relax\E\c@pgf@counta + \E\ifnum\E\c@pgf@counta>2 + \E\let\E\pgfplots@current@point@x=\E\pgfutil@empty + \E\else + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + \E\fi + \E\fi + \fi + % + \ifpgfplots@yislinear + \E\ifx\E\pgfplots@current@point@y\E\pgfutil@empty + \E\else + \E\pgfmathfloatparsenumber{\E\pgfplots@current@point@y}% + \E\expandafter\E\pgfmathfloat@decompose@F\E\pgfmathresult\E\relax\E\c@pgf@counta + \E\ifnum\E\c@pgf@counta>2 + \E\let\E\pgfplots@current@point@y=\E\pgfutil@empty + \E\else + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + \E\fi + \E\fi + \fi + % + \ifpgfplots@curplot@threedim + \E\let\E\pgfplots@current@point@z@unfiltered=\E\pgfplots@current@point@z + \E\pgfplots@prepare@zcoord{\E\pgfplots@current@point@z}% + \E\expandafter\E\pgfplots@invoke@filter\E\expandafter{\E\pgfmathresult}{z}% + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + % + \ifpgfplots@zislinear + \E\ifx\E\pgfplots@current@point@z\E\pgfutil@empty + \E\else + \E\pgfmathfloatparsenumber{\E\pgfplots@current@point@z}% + \E\expandafter\E\pgfmathfloat@decompose@F\E\pgfmathresult\E\relax\E\c@pgf@counta + \E\ifnum\E\c@pgf@counta>2 + \E\let\E\pgfplots@current@point@z=\E\pgfutil@empty + \E\else + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + \E\fi + \E\fi + \fi + \fi + % + \E\ifx\E\pgfplots@current@point@x\E\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \E\pgfplots@message{NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered\ifpgfplots@curplot@threedim,\E\pgfplots@current@point@z@unfiltered\fi) has been dropped because of the x-coordinate filter.}% + \fi + \E\else + \E\ifx\E\pgfplots@current@point@y\E\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \E\pgfplots@message{NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered\ifpgfplots@curplot@threedim,\E\pgfplots@current@point@z@unfiltered\fi) has been dropped because of the y-coordinate filter.}% + \fi + \E\else + \ifpgfplots@curplot@threedim + \E\ifx\E\pgfplots@current@point@z\E\pgfutil@empty + \ifpgfplots@warn@for@filter@discards + \E\pgfplots@message{NOTE: coordinate (\E\pgfplots@current@point@x@unfiltered,\E\pgfplots@current@point@y@unfiltered,\E\pgfplots@current@point@z@unfiltered) has been dropped because of the z-coordinate filter.}% + \fi + \E\else + % insert the main 3d code here: + \pgfplots@loc@TMPa + \E\fi + \else + % insert the main 2d code here: + \pgfplots@loc@TMPa + \fi + \E\fi + \E\fi + % + % increase \pgfplots@current@point@coordindex: + \E\begingroup + \E\c@pgf@counta=\E\pgfplots@current@point@coordindex + \E\advance\E\c@pgf@counta by1\E\relax + \E\xdef\E\pgfplots@glob@TMPc{\E\the\E\c@pgf@counta}% + \E\endgroup + \E\let\E\pgfplots@current@point@coordindex=\E\pgfplots@glob@TMPc + }% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \endgroup +%\message{Prepared macro \string\pgfplots@update@limits@for@one@point: {\meaning\pgfplots@update@limits@for@one@point}}% +%\message{Prepared macro \string\pgfplots@process@one@point: {\meaning\pgfplots@process@one@point}}% + \let\pgfplots@coord@stream@coord@=\pgfplots@process@one@point + % + \def\pgfplots@coord@stream@end@{% + \ifpgfplots@autocompute@all@limits + \global\let\pgfplots@data@xmin=\pgfplots@xmin + \global\let\pgfplots@data@xmax=\pgfplots@xmax + \global\let\pgfplots@data@ymin=\pgfplots@ymin + \global\let\pgfplots@data@ymax=\pgfplots@ymax + \global\let\pgfplots@data@zmin=\pgfplots@zmin + \global\let\pgfplots@data@zmax=\pgfplots@zmax + \fi + \ifpgfplots@errorbars@enabled + \pgfplots@streamerrorbarend + \fi + \ifpgfplots@stackedmode + \pgfplots@stacked@endplot + \fi + \ifpgfplots@coord@stream@isfirst + \pgfplots@warning{the current plot has no coordinates (left?)}% + \fi +% \else + % Idea: use + % \scope[plot specification] + % <any paths for error bars> + % \endscope + % \draw plot coordinates {...}; + % to share plot specifications between error bars and plot + % coordinates. Unfortunately, it is NOT sufficient to use + % \tikzset{#1} + \ifpgfplots@curplot@isirrelevant + \edef\pgfplots@addplot@preoptionsTMP{/pgfplots/every axis plot,/pgfplots/every forget plot/.try}% + \else + \edef\pgfplots@addplot@preoptionsTMP{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% + \expandafter\pgfplots@rememberplotspec\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% + \fi + % warning: rememberplotspec calls list macros which + % overwrite \t@pgfplots@toka + \t@pgfplots@toka=\expandafter{\pgfplots@addplot@preoptionsTMP,#1,/pgfplots/every axis plot post}% + \xdef\pgfplots@last@plot@style{\the\t@pgfplots@toka}% store it for \label commands. + % ATTENTION: do NOT call list macros from here on! + % + \ifpgfplots@datascaletrafo@initialised + \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa + \t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}% + \else + \t@pgfplots@tokc={}% + \fi + % assembe a \pgfplots@addplot@enqueue@coords command ... + % BEGIN HERE ... + % vvvvvvvvvv + \xdef\pgfplots@glob@TMPa{% + \noexpand\pgfplots@addplot@enqueue@coords + {% precommand(s): + \expandafter\noexpand\csname pgfplots@curplot@threedim\ifpgfplots@curplot@threedim true\else false\fi\endcsname + \noexpand\def\noexpand\plotnum{\the\pgfplots@numplots}% + \noexpand\pgfplots@initzerolevelhandler + \the\t@pgfplots@tokc% named start/end points (if already available) + \noexpand\pgfkeysdef{/tikz/current plot style}{\noexpand\pgfkeysalso{\the\t@pgfplots@toka}}% + % per-point meta data ranges: + \noexpand\xdef\noexpand\pgfplots@metamin{\pgfplots@metamin}% + \noexpand\xdef\noexpand\pgfplots@metamax{\pgfplots@metamax}% + \ifpgfplots@perpointmeta@usesfloat + \noexpand\pgfplots@perpointmeta@usesfloattrue + \else + \noexpand\pgfplots@perpointmeta@usesfloatfalse + \fi + \noexpand\def\noexpand\pgfplots@perpointmeta@choice{\pgfplots@perpointmeta@choice}% + }% + {% draw command: + \noexpand\draw% + }% + }% + \pgfplotsapplistXXlet\pgfplots@coord@stream@recorded + \pgfplotsapplistXXclear + \t@pgfplots@tokc=\expandafter{\pgfplots@coord@stream@recorded}% + \t@pgfplots@tokb={#2;}% + \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% + \xdef\pgfplots@glob@TMPa{% + \the\t@pgfplots@toka + {% coordinates which need to be processed in \endaxis: + normalized coordinates {\the\t@pgfplots@tokc}\the\t@pgfplots@tokb + }% + }% + % + % Ok, now assemble the POST COMMANDS. Error bar + % commands will be append here (if any) + \ifx\pgfplots@recordederrorbar\pgfutil@empty + \pgfplots@glob@TMPa + {% + % Post commands are empty here. + }% + \else + \t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}% + \t@pgfplots@tokb=\expandafter{\pgfplots@recordederrorbar}% + \def\pgfplots@loc@TMPb{% + \noexpand\pgfplots@errorbars@finishwithstyleoptions[current plot style]{\the\t@pgfplots@tokb}% + }% + \xdef\pgfplots@glob@TMPa{ + \the\t@pgfplots@toka + { + % Post commands: append error bar commands. + \pgfplots@loc@TMPb + }% + }% + \pgfplots@glob@TMPa + \fi + %^^^^^^^^^^^^ ... END of \pgfplots@addplot@enqueue@coords HERE +% \fi + \pgfplots@end@plot + }% +}% + +% Defines the linear transformation macro \pgfplots@perpointmeta@trafo, +% +% phi : [meta_min,meta,max] -> [0,10^k] +% +% which operates on the per-point meta data (if any). +% The trafo will be skipped if there is no such data. +% +% The trafo is expected to prepare meta information before it is used +% as input to \pgfplotscolormapfind. Thus, the 10^k is chosen to be +% the same as \pgfplotscolormaprange (which is 1000 per default). +% +% If there is now data range (for example because meta information is +% not available or is not of numeric type), the trafo will simply +% copy the input argument symbolically. +\def\pgfplots@perpointmeta@preparetrafo{% + \ifx\pgfplots@metamax\pgfutil@empty + \def\pgfplots@perpointmeta@trafo##1{\def\pgfmathresult{##1}}% + \def\pgfplots@perpointmeta@traforange{0:0}% + \else + % The transformation is + % + % phi(m) = ( m- meta_min) * 1000/ (meta_max-meta_min). + % + % -> precompute the scaling factor! + \ifpgfplots@perpointmeta@usesfloat + \edef\pgfplots@loc@TMPa{\pgfplotscolormaprange}% + \ifnum\pgfplots@loc@TMPa=1000 + \else + \pgfplots@error{LOGIC ERROR: sorry, I have hard-coded the assumption \string\pgfplotscolormaprange = 1000, but now it is \pgfplots@loc@TMPa.}% + \fi + \pgfmathfloatsubtract@{\pgfplots@metamax}{\pgfplots@metamin}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfmathfloatcreate{1}{1.0}{3}% + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\pgfplots@loc@TMPa}% + \let\pgfplots@perpointmeta@trafo@factor=\pgfmathresult + % + % Now, setup the trafo as such. + % It assigns \pgfmathresult (in fixed point). + \def\pgfplots@perpointmeta@trafo##1{% + \pgfmathfloatsubtract@{##1}{\pgfplots@metamin}% + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfplots@perpointmeta@trafo@factor}% + \expandafter\pgfmathfloattofixed@\expandafter{\pgfmathresult}% + }% + % Expands to the transformation range as 'a:b': + \def\pgfplots@perpointmeta@traforange{0:1000}% + \else + \edef\pgfplots@loc@TMPa{\pgfplotscolormaprange}% + \ifnum\pgfplots@loc@TMPa=1000 + \else + \pgfplots@error{LOGIC ERROR: sorry, I have hard-coded the assumption \string\pgfplotscolormaprange = 1000, but now it is \pgfplots@loc@TMPa.}% + \fi + \pgfmathsubtract@{\pgfplots@metamax}{\pgfplots@metamin}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \expandafter\pgfmathdivide@\expandafter{\pgfplotscolormaprange}{\pgfplots@loc@TMPa}% + \let\pgfplots@perpointmeta@trafo@factor=\pgfmathresult + % + % Now, setup the trafo as such. + % It assigns \pgfmathresult (in fixed point). + \def\pgfplots@perpointmeta@trafo##1{% + \pgfmathsubtract@{##1}{\pgfplots@metamin}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplots@perpointmeta@trafo@factor}% + }% + % Expands to the transformation range as 'a:b': + \def\pgfplots@perpointmeta@traforange{0:1000}% + \fi + \fi +}% + +% A looping method which applies +% \pgfplots@coord@stream@start +% for each coordinate '(x,y)' or '(x,y) +- (ex,ey)', +% assign \pgfplots@current@point@[xyz] +% assign \pgfplots@current@point@[xyz]@error (if in argument list) +% assign \pgfplots@current@point@meta +% call \pgfplots@coord@stream@coord +% \pgfplots@coord@stream@end +% +% #1 a sequence of coordinates of the form +% '(x,y)' or '(x,y,z)' +% or +% '(x,y[,z]) +- (ex,ey)' +% or +% '(x,y) [meta]' +% or +% '(x,y) +- (ex,ey) [meta]' +% separated by white-space. +% +% The per-point meta is not implemented yet. +\long\def\pgfplots@coord@stream@foreach#1{% + \pgfplots@coord@stream@start + \pgfplots@foreach@plot@coord@ITERATE#1\pgfplots@EOI% + \pgfplots@coord@stream@end +}% + +% A looping command to loop through plot coordinates. +% For every point, #1{X}{Y} will be invoked. +% +% No scoping is used during this operation, so you can access outer +% variables. +\def\pgfplots@foreach@plot@coord@ITERATE{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfplots@foreach@plot@coord@FINISH% + }{% + \pgfutil@ifnextchar\par{% + \pgfplots@foreach@plot@coord@ITERATE@gobbleone + }{% + \pgfutil@ifnextchar({% + \pgfplots@foreach@plot@coord@NEXT% + }{% + \pgfplots@foreach@plot@coord@error + }% + }% + }% +} +\long\def\pgfplots@foreach@plot@coord@error#1\pgfplots@EOI{% + \pgfplots@error{Sorry, I could not read the plot coordinates near '#1'. Please check for format mistakes.}% +}% +\long\def\pgfplots@foreach@plot@coord@ITERATE@gobbleone#1{\pgfplots@foreach@plot@coord@ITERATE}% +\def\pgfplots@foreach@plot@coord@NEXT(#1,#2){% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \pgfutil@ifnextchar+{% + \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE% + }{% + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@ITERATE + }% + }% +} +\def\pgfplots@foreach@plot@coord@NEXT@meta[#1]{% + \def\pgfplots@current@point@meta{#1}% + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@ITERATE +}% +% processing something like '(x,y) +- (error_x,error_y)' +\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE+-#1({% + \pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@% +} +\def\pgfplots@foreach@plot@coord@NEXT@WITH@ERRORRANGE@#1,#2){% + \def\pgfplots@current@point@x@error{#1}% + \def\pgfplots@current@point@y@error{#2}% + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@ITERATE + }% +} +\def\pgfplots@foreach@plot@coord@FINISH\pgfplots@EOI{} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% The same for three dim coords: +\long\def\pgfplots@coord@stream@foreach@threedim#1{% + \pgfplots@coord@stream@start + \pgfplots@foreach@plot@coord@threedim@ITERATE#1\pgfplots@EOI% + \pgfplots@coord@stream@end +}% +\def\pgfplots@foreach@plot@coord@threedim@ITERATE{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfplots@foreach@plot@coord@FINISH% + }{% + \pgfutil@ifnextchar\par{% + \pgfplots@foreach@plot@coord@threedim@ITERATE@gobbleone + }{% + \pgfutil@ifnextchar({% + \pgfplots@foreach@plot@coord@threedim@NEXT% + }{% + \pgfplots@foreach@plot@coord@error + }% + }% + }% +} +\long\def\pgfplots@foreach@plot@coord@threedim@ITERATE@gobbleone#1{\pgfplots@foreach@plot@coord@threedim@ITERATE}% +\def\pgfplots@foreach@plot@coord@threedim@NEXT(#1,#2,#3){% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \pgfutil@ifnextchar+{% + \pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE% + }{% + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@threedim@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@threedim@ITERATE + }% + }% +} +\def\pgfplots@foreach@plot@coord@threedim@NEXT@meta[#1]{% + \def\pgfplots@current@point@meta{#1}% + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@threedim@ITERATE +}% +% processing something like '(x,y) +- (error_x,error_y)' +\def\pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE+-#1({% + \pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@% +} +\def\pgfplots@foreach@plot@coord@threedim@NEXT@WITH@ERRORRANGE@#1,#2,#3){% + \def\pgfplots@current@point@x@error{#1}% + \def\pgfplots@current@point@y@error{#2}% + \def\pgfplots@current@point@z@error{#3}% + \pgfutil@ifnextchar[{% + \pgfplots@foreach@plot@coord@threedim@NEXT@meta + }{% + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@threedim@ITERATE + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5 +% +% The same in normalized coordinates of the form +% x1,y1,z1,m1;x2,y2,z2,m2;...;xN,yN,zN,mN; +% if the plot is not threedim, zi is empty. +% +% The mi are Meta Values associated to point coordinates. They are +% usually empty, but can be used to realize per-point marker +% modifications (scatter plots, especially for colormaps). +\long\def\pgfplots@coord@stream@foreach@NORMALIZED#1{% + \pgfplots@coord@stream@start + \pgfplots@foreach@plot@coord@NORMALIZED@ITERATE#1\pgfplots@EOI + \pgfplots@coord@stream@end +}% + +% A looping command to loop through plot coordinates. +% For every point, #1{X}{Y} will be invoked. +% +% No scoping is used during this operation, so you can access outer +% variables. +\def\pgfplots@foreach@plot@coord@NORMALIZED@ITERATE{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfplots@foreach@plot@coord@FINISH% + }{% + \pgfplots@foreach@plot@coord@NORMALIZED@NEXT% + }% +} +\def\pgfplots@foreach@plot@coord@NORMALIZED@NEXT#1,#2,#3,#4;{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \def\pgfplots@current@point@meta{#4}% + \pgfplots@coord@stream@coord + \pgfplots@foreach@plot@coord@NORMALIZED@ITERATE +} + + +\newif\ifpgfplots@curplot@threedim + +% The main interface to draw a plot into an axis. +% +% Usage: +% \addplot +% plot coordinates { +% (0,0) +% (1,1) +% }; +% +% or +% +% \addplot[color=blue,mark=*] +% plot coordinates { +% (0,0) +% (1,1) +% }; +% +% or one of the other input types. +% +% The first syntax will use the next plot specification in the list +% \autoplotspeclist +% and the first will use blue color and * markers. +% +% \addplot [<style options>] plot[<behavior options>] <input type and args> <post plot path> ; +% \addplot3[<style options>] plot[<behavior options>] <input type and args> <post plot path> ; +% +% The complete accumulation is done GLOBALLY. It should be safe to put +% '\addplot' into local groups. +% +% +% The linespec. will be used in the legend. +% +% Low-level implementation: +% +% \pgfplots@addplot +% \pgfplots@addplotimpl +% \pgfplots@start@plot@with@behavioroptions <--- \begingroup +% ... +% ... remember options GLOBALLY +% ... update limits GLOBALLY +% ... \pgfplots@addplot@enqueue@coords GLOBALLY +% ... +% \pgfplots@end@plot <--- \endgroup +\def\pgfplots@addplot{% + \pgfutil@ifnextchar3{% + \pgfplots@curplot@threedimtrue + \pgfplots@addplot@three + }{% + \pgfplots@curplot@threedimfalse + \pgfplots@addplot@ + }% +} +\def\pgfplots@addplot@three3{\pgfplots@addplot@}% +\def\pgfplots@addplot@{% + \pgfutil@ifnextchar+{% + \pgfplots@getautoplotspec into\nextplotspec + \pgfplots@addplotimplAPPEND + }{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl% + }{% + \pgfplots@getautoplotspec into\nextplotspec + % the space after ']' is required here: + % FIXME: + % - \addplot[]plot coordinates is NOT allowed!? + \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec]% + }% + }% +} + +\long\def\pgfplots@addplotimplAPPEND+[{% + \expandafter\pgfplots@addplotimpl\expandafter[\nextplotspec, +} + +\long\def\pgfplots@addplotimpl[#1]{% + \pgfutil@ifnextchar p{% + \pgfplots@addplotimpl@plot{#1}% + }{% + \pgfplots@addplotimpl@plot{#1}plot + }% +} + +\def\pgfplots@addplotimpl@plot#1plot{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@plot@withoptions{#1}% + }{% + \pgfplots@addplotimpl@plot@withoptions{#1}[]% + }% +} + +\def\pgfplots@addplotimpl@plot@withoptions#1[#2]{ + \begingroup% <-- This groups ends in \pgfplots@end@plot + % + \pgfutil@ifnextchar c{% + \pgfplots@addplotimpl@coordinates{#1}{#2}plot + }{% + \pgfutil@ifnextchar f{% + \pgfplots@addplotimpl@f{#1}{#2}% + }{% + \pgfutil@ifnextchar t{% + \pgfplots@start@plot@with@behavioroptions{#2}% + \pgfplots@addplotimpl@table{#1}% + }{% + \pgfutil@ifnextchar ({% + \pgfplots@addplotimpl@expression{#1}{#2}% + }{% + \pgfutil@ifnextchar\bgroup{% + \pgfplots@addplotimpl@expression@curly{#1}{#2}% + }{% + \pgfutil@ifnextchar e{% + \pgfplots@addplotimpl@expression@e{#1}{#2}% + }{% + \pgfutil@ifnextchar g{% + \pgfplots@addplotimpl@gnuplot{#1}{#2}% + }{% + \pgfplots@error{Sorry, the supplied plot command is unknown or unsupported by pgfplots! Ignoring it.}% + \pgfplots@gobble@until@semicolon + }% + }% + }% + }% + }% + }% + }% +} +\def\pgfplots@addplotimpl@f#1#2f{% + \pgfutil@ifnextchar i{% + \pgfplots@addplotimpl@file{#1}{#2}% + }{% + \pgfplots@addplotimpl@function{#1}{#2}% + }% +}% + +\def\pgfplots@gobble@until@semicolon#1;{} + +% Plot expression. It invokes the pgf math parser and a customized +% pgfplots point sampling routine. Combined with the 'fixed point +% library' of pgf, it results in highly accurate plots. +% +% +\long\def\pgfplots@addplotimpl@expression#1#2(#3,#4)#5;{\pgfplots@addplotimpl@expression@{#1}{#2}{#3}{#4}{#5}}% +% \addplot[#1] [#2] (#3,#4) #5; +\long\def\pgfplots@addplotimpl@expression@#1#2#3#4#5{% + \ifpgfplots@usefpu + \def\pgfplots@loc@TMPa{/pgf/fpu=true}% + \else + \let\pgfplots@loc@TMPa=\pgfutil@empty + \fi + \expandafter\pgfplots@start@plot@with@behavioroptions\expandafter{\pgfplots@loc@TMPa,#2}% + \pgfplots@PREPARE@COORD@STREAM{#1}{#5}% + % + \pgfplots@validate@plot@domain@arguments + \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain + \pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at + \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}% + % + % Determine whether the x range is parameterized or uniform and + % prepare a macro which assigns \pgfplots@current@point@x: + \def\pgfplots@addplotimpl@expression@prepare@x{% + \pgfmathparse{#3}% + \let\pgfplots@current@point@x=\pgfmathresult + }% + \def\pgfplots@addplotimpl@expression@hasuniform@x{0}% + \def\pgfplots@loc@TMPa{#3}% + % do we have '\x' as x coordinate? + \expandafter\def\expandafter\pgfplots@loc@TMPb\expandafter{\tikz@plot@var}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@addplotimpl@expression@hasuniform@x{1}% + \else + \def\pgfplots@loc@TMPb{x}% + % do we have 'x' as x coordinate? + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \def\pgfplots@addplotimpl@expression@hasuniform@x{1}% + \fi + \fi + \if\pgfplots@addplotimpl@expression@hasuniform@x1% + % if '#3' is '\x' or 'x', we don't need the math parser - + % we can simply take \tikz@plot@var. + \def\pgfplots@addplotimpl@expression@prepare@x{% + \edef\pgfplots@current@point@x{\tikz@plot@var}% + }% + \fi + % + % Define a "function" x which sets \pgfmathresult := \x : + \pgfutil@ifundefined{pgfmathdeclarefunction}{% + % We have PGF 2.00 : + \def\pgfmath@parsefunction@x{\edef\pgfmathresult{\tikz@plot@var}\pgfmath@postfunction}% + \def\pgfmath@parsefunction@y{\let\pgfmathresult=\y\pgfmath@postfunction}% + }{% + % We have PGF > 2.00 : + \pgfmathdeclarefunction{x}{0}{\edef\pgfmathresult{\tikz@plot@var}}% + \pgfmathdeclarefunction{y}{0}{\let\pgfmathresult=\y}% + }% + % + % Now, prepare the loops. + % + % I am using \pgfplotsforeachungrouped in favor of + % \foreach because \foreach does NOT allow extended + % precision. Besided, \pgfplotsforeachungrouped avoids + % scoping problems. + % + \ifpgfplots@curplot@threedim + \pgfkeysgetvalue{/pgfplots/y domain}{\pgfplots@plot@ydomain}% + \def\pgfplots@addplotimpl@expression@split@yz##1,##3\pgfplots@EOI{% + \def\pgfplots@addplotimpl@expression@yEXPR{##1}% + \def\pgfplots@addplotimpl@expression@zEXPR{##3}% + }% + \pgfplots@addplotimpl@expression@split@yz#4\pgfplots@EOI% + \ifx\pgfplots@plot@ydomain\pgfutil@empty + \def\pgfplots@plot@ydomain{0:0}% + \fi + \ifx\pgfplots@plot@samples@at\pgfutil@empty + % we don't have 'samples at' -> use domain! + \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@domain\relax + \let\pgfplots@loc@TMPa=\pgfplotslocretval + \else + % use 'samples at': + \let\pgfplots@loc@TMPa=\pgfplots@plot@samples@at + \fi + \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@ydomain\relax + \let\pgfplots@loc@TMPb=\pgfplotslocretval + % Assemble a + % \pgfplots@plot@data##1 -> + % \foreach \x in {-5,-4.6,...,5} + % \foreach \y in {-5,-4.6,...,5} {##1}; + % macro: + \edef\pgfplots@plot@data##1{% + \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@loc@TMPa} + {\noexpand\pgfplotsforeachungrouped\noexpand\y in {\pgfplots@loc@TMPb} {##1}}}% + \else + % Assemble a + % \pgfplots@plot@data##1 -> \foreach \x in {-5,-4.6,...,5} {##1} macro: + % + % + % if( + % x is logarithmic && + % #3 == '\x' && + % the 'samples at' key has not been used ) + % -> sample logarithmically! + \def\pgfplots@samples@logarithmically{0}% + \ifpgfplots@xislinear + \else + \if\pgfplots@addplotimpl@expression@hasuniform@x1% + \ifx\pgfplots@plot@samples@at\pgfutil@empty + % we don't have 'samples at' -> use domain! + \def\pgfplots@samples@logarithmically{1}% + \fi + \fi + \fi + \if\pgfplots@samples@logarithmically1% + % sample logarithmically: + \edef\pgfplots@plot@data##1{% + \noexpand\pgfplotsforeachlogarithmicungrouped + \expandafter\noexpand\tikz@plot@var/\noexpand\pgfplots@current@point@x@log + in {\pgfplots@plot@domain} {##1}}% + % we have a logarithmic sampling sequence, + % \pgfplots@current@point@x@log is already available + % logarithmic! We can safe time and accuracy for the x + % coordinate by using that one instead of computing + % log(exp(\x)) numerically: + \pgfplots@disablelogfilter@xtrue + \def\pgfplots@addplotimpl@expression@prepare@x{% + \let\pgfplots@current@point@x=\pgfplots@current@point@x@log + }% + \pgflibraryfpuifactive + {\relax} + {% + % ok, if the FPU is NOT active, we should return + % results as fixed points. + % We need to configure that for + % \pgfplotsforeachlogarithmicungrouped manually: + \pgfplotsforeachlogarithmicformatresultwith{% + \pgfmathfloattofixed{\pgfmathresult}% + }% + }% + \else + \ifx\pgfplots@plot@samples@at\pgfutil@empty + % we don't have 'samples at' -> use domain! + \expandafter\pgfplots@domain@to@foreach\pgfplots@plot@domain\relax + \let\pgfplots@loc@TMPa=\pgfplotslocretval + \else + % use 'samples at': + \let\pgfplots@loc@TMPa=\pgfplots@plot@samples@at + \fi + \edef\pgfplots@plot@data##1{ + \noexpand\pgfplotsforeachungrouped\expandafter\noexpand\tikz@plot@var in {\pgfplots@loc@TMPa} {##1}}% + \fi + \def\y{0}% + \def\pgfplots@addplotimpl@expression@yEXPR{#4}% + \def\pgfplots@current@point@z{}% + \fi + \pgfplots@coord@stream@start + \pgfplots@plot@data{% + \pgfplots@addplotimpl@expression@prepare@x% + \pgfmathparse{\pgfplots@addplotimpl@expression@yEXPR}% + \let\pgfplots@current@point@y=\pgfmathresult + \ifpgfplots@curplot@threedim + \pgfmathparse{\pgfplots@addplotimpl@expression@zEXPR}% + \let\pgfplots@current@point@z=\pgfmathresult + \fi + \pgfplots@coord@stream@coord + }% + \pgfplots@coord@stream@end +}% +% \addplot[#1] [#2] {#3} #4; +\long\def\pgfplots@addplotimpl@expression@curly#1#2#3#4;{\pgfplots@addplotimpl@expression@curly@{#1}{#2}{#3}{#4}}% +\long\def\pgfplots@addplotimpl@expression@curly@#1#2#3#4{% + \pgfplots@gettikzinternal@keyval{variable}{tikz@plot@var}{\x}% + \def\pgfplots@loc@TMPa{\pgfplots@addplotimpl@expression@{#1}{#2}}% + \expandafter\pgfplots@loc@TMPa\expandafter{\tikz@plot@var}{#3}{#4}% +}% +% \addplot[#1] [#2] expression[#3] {#4} #5; +\def\pgfplots@addplotimpl@expression@e#1#2expression{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@expression@e@{#1}{#2}% + }{% + \pgfplots@addplotimpl@expression@e@{#1}{#2}[]% + }% +}% +\def\pgfplots@addplotimpl@expression@e@#1#2[#3]{% + \pgfplots@addplotimpl@expression@curly{#1}{#2,#3}% +}% + + +\let\pgfplots@backupof@pgfplotxyfile=\pgfplotxyfile + +% the following code +% results finally in +% +% set format "%.7e";; set samples <...>; plot ... +% +% The windows port of gnuplot doesn't run without the second semicolon +% - for whatever reason. +{ + \catcode`\%=12 + \catcode`\"=12 + \catcode`\;=12 + \xdef\pgfplots@gnuplot@format{set format "%.7e";} +} + +% |\addplot gnuplot| is an alias to |\addplot function| +\def\pgfplots@addplotimpl@gnuplot#1#2gnuplot{\pgfplots@addplotimpl@function{#1}{#2}unction}% + +% \addplot[<style options>] +% plot[<behavior opts>] +% function[<further behavior opts>] +% {gnuplot code} +% #3; +% #1: args of \addplot[...] +% #2: optional arguments after function[] +% #3: gnuplot code to generate coordinates +% #4: trailing path commands until ';' +\def\pgfplots@addplotimpl@function#1#2unction{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@function@opt{#1}{#2}% + }{% + \pgfplots@addplotimpl@function@opt{#1}{#2}[]% + }% +}% +\def\pgfplots@addplotimpl@function@opt#1#2[#3]#4#5;{\pgfplots@addplotimpl@function@opt@{#1}{#2}{#3}{#4}{#5}}% +% \addplot[#1] [#2] function[#3] {#4} #5; +\def\pgfplots@addplotimpl@function@opt@#1#2#3#4#5{% + \pgfplots@start@plot@with@behavioroptions{% + #2,#3}% + \pgfplots@gettikzinternal@keyval{prefix}{tikz@plot@prefix}{\jobname.}% + \pgfplots@gettikzinternal@keyval{id}{tikz@plot@id}{pgf-plot}% + \pgfplots@gettikzinternal@keyval{raw gnuplot}{iftikz@plot@raw@gnuplot}{\iffalse}% + \pgfplots@gettikzinternal@keyval{parametric}{iftikz@plot@parametric}{\iffalse}% + \pgfplots@validate@plot@domain@arguments + \pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain + \pgfkeysgetvalue{/pgfplots/y domain}{\pgfplots@plot@ydomain}% + \ifx\pgfplots@plot@domain\pgfutil@empty + % this is a potential problem: 'plot gnuplot' doesn't support + % the 'samples at' framework which should be in effect now. + % -> acquire the /tikz/domain value! + \pgfplots@gettikzinternal@keyval{domain}{tikz@plot@domain}{-5:5}% + \let\pgfplots@plot@domain=\tikz@plot@domain + \fi + % + \def\pgfplots@plot@filename{\tikz@plot@prefix\tikz@plot@id}% + \def\pgfplots@addplotimpl@gnuplotresult@isthreedim@withtwocoords{0}% + \iftikz@plot@raw@gnuplot% + \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{#4}}% + \else% + \def\pgfplots@gnuplot@logdirs{}% + \ifpgfplots@xislinear + \else + \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs x}% + \fi + \ifpgfplots@yislinear + \else + \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs y}% + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@zislinear + \else + \expandafter\def\expandafter\pgfplots@gnuplot@logdirs\expandafter{\pgfplots@gnuplot@logdirs z}% + \fi + \pgfplots@disablelogfilter@ztrue + \fi + \pgfplots@disablelogfilter@xtrue + \pgfplots@disablelogfilter@ytrue + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@ydomain\pgfutil@empty + \pgfplots@error{Sorry, '\string\addplot3 plot function{}' can't be processed correctly because 'y domain' is empty.}% + \def\pgfplots@plot@ydomain{0:1}% + \fi + \fi + \def\pgfplots@plot@data{\pgfplotgnuplot[\pgfplots@plot@filename]{% + \pgfplots@gnuplot@format; + set samples \pgfkeysvalueof{/pgfplots/samples}; + \ifx\pgfplots@gnuplot@logdirs\pgfutil@empty + \else + set logscale \pgfplots@gnuplot@logdirs\space 2.71828182845905; + \fi + \iftikz@plot@parametric set parametric;\fi + \ifpgfplots@curplot@threedim + splot [x=\pgfplots@plot@domain] [y=\pgfplots@plot@ydomain] #4;% + \else + plot [x=\pgfplots@plot@domain] #4;% + \fi + }}% + \fi% + \def\pgfplotxyfile{\pgfplots@addplotimpl@gnuplotresult{#1}{#5}}% + \pgfplots@plot@data + \let\pgfplotxyfile=\pgfplots@backupof@pgfplotxyfile +}% + +\def\pgfplots@addplotimpl@gnuplotresult#1#2#3{% + \begingroup + \openin1=#3 + \ifeof1 + \pgfplots@error{Sorry, the gnuplot-result file '#3' could not be found. Maybe you need to enable the shell-escape feature? For pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplot <file>.gnuplot' manually on the respective gnuplot file.}% + \aftergroup\pgfplots@loop@CONTINUEfalse + \else + \aftergroup\pgfplots@loop@CONTINUEtrue + \fi + \closein1 + \endgroup + \ifpgfplots@loop@CONTINUE + % Now, invoke 'plot file'. + % + % I invoke the private '@opt@' method because the semicolon ';' + % character may cause problems due to catcode mismatches. + % *sigh*. + \pgfplots@addplotimpl@file@opt@@{#1}{}{#3}{#2}% + \else + \expandafter\pgfplots@end@plot + \fi +} + +% \addplot[#1] [#2] file{#3} #4; +\def\pgfplots@addplotimpl@file#1#2ile{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@file@opt{#1}{#2}% + }{% + \pgfplots@addplotimpl@file@opt{#1}{#2}[]% + }% +} + +% \addplot[#1] [#2] file[#3] {#4} #5; +\def\pgfplots@addplotimpl@file@opt#1#2[#3]#4#5;{\pgfplots@addplotimpl@file@opt@{#1}{#2}{#3}{#4}{#5}}% +\def\pgfplots@addplotimpl@file@opt@#1#2#3#4#5{% + \pgfplots@start@plot@with@behavioroptions{#2}% + \pgfplots@addplotimpl@file@opt@@{#1}{#3}{#4}{#5}% +} +\def\pgfplots@addplotimpl@file@opt@@#1#2#3#4{% + \begingroup + \def\pgfplots@loc@TMPa{#2}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfqkeys{/pgfplots/plot file}{#2}% + \fi + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \pgfplots@coord@stream@start + \pgfplots@logfileopen{#3}% + \openin1=#3 + \ifeof1 + \pgfplots@warning{sorry, plot file{#3} could not be opened!?}% + \else + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \ifpgfplots@curplot@threedim + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim + \ifnum\pgfplots@perpointmeta@choice=4 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta + \else + \ifnum\pgfplots@perpointmeta@choice=5 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta + \fi + \fi + \else + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim + \ifnum\pgfplots@perpointmeta@choice=4 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta + \else + \ifnum\pgfplots@perpointmeta@choice=5 + \let\pgfplots@addplotimpl@file@parsesingle=\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta + \fi + \fi + \fi + \pgfplots@addplotimpl@file@readall + \fi + \pgfplots@coord@stream@end + \endgroup +}% +\def\pgfplots@addplotimpl@file@readall{% + \read1 to\pgfplots@file@LINE + \expandafter\pgfplotstableread@checkspecial@line\pgfplots@file@LINE\pgfplotstable@EOI + \ifpgfplotstableread@skipline + \else + \ifpgfplots@plot@file@skipfirst + % Silently skip first data row, assuming it is a header. + \pgfplots@plot@file@skipfirstfalse + \else + \expandafter\pgfplots@addplotimpl@file@parsesingle\pgfplots@file@LINE\pgfplots@EOI + \fi + \fi + \ifeof1 + \else + \expandafter + \pgfplots@addplotimpl@file@readall + \fi +}% + +\def\pgfplots@addplotimpl@file@parsesingle@threedim#1 #2 #3 #4\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \pgfplots@coord@stream@coord% +}% +\def\pgfplots@addplotimpl@file@parsesingle@twodim#1 #2 #3\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \pgfplots@coord@stream@coord% +}% +\def\pgfplots@addplotimpl@file@parsesingle@threedim@andmeta#1 #2 #3 #4 #5\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@z{#3}% + \def\pgfplots@current@point@meta{#4}% + \pgfplots@coord@stream@coord% +}% +\def\pgfplots@addplotimpl@file@parsesingle@twodim@andmeta#1 #2 #3 #4\pgfplots@EOI{% + \def\pgfplots@current@point@x{#1}% + \def\pgfplots@current@point@y{#2}% + \def\pgfplots@current@point@meta{#3}% + \pgfplots@coord@stream@coord% +}% + +\def\pgfplots@addplotimpl@table#1table{% + \pgfutil@ifnextchar[{% + \pgfplots@addplotimpl@table@getopts{#1}% + }{% + \pgfplots@addplotimpl@table@getopts{#1}[x index=0,y index=1]% + }% +}% + +\def\pgfplots@addplotimpl@table@getopts#1[#2]{% + \pgfutil@ifnextchar f{% + \pgfplots@addplotimpl@table@fromstructure{#1}{#2}% + }{% + \pgfplots@addplotimpl@table@fromfile{#1}{#2}% + }% +} + +% this macro simply invokes the "correct" table processing routine. +% The distinction between 'table from {<\macro>}' and 'table +% {<filename>}' is deprecated; it is done automatically now. +% +% \addplot[#1] table[#2] [from] {#3} #4; +\def\pgfplots@addplotimpl@table@startprocessing#1#2#3#4{% + \pgfplotstable@isloadedtable{#3}{% + \pgfplots@addplotimpl@table@fromstructure@{#1}{#2}{#3}{#4}% + }{% + \pgfplots@addplotimpl@table@fromfile@{#1}{#2}{#3}{#4}% + }% +}% + +% \addplot[#1] table[#2] from {#3} #4; +% +% #1: arguments to \addplot[...] +% #2: arguments to table[...] +% #3: the argument of plot table{...} +% #4: trailing path arguments after plot table{...}#4; +\long\def\pgfplots@addplotimpl@table@fromstructure#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% +% \addplot[#1] table[#2] from {#3} #4 ; +\long\def\pgfplots@addplotimpl@table@fromstructure@#1#2#3#4{% + % set options here. They may contain behavior options! + \pgfplots@addplotimpl@table@installkeypath + \pgfplotstableset{#2}% + \begingroup + % FIXME : this thing here has runtime O(N^2) ! + % I fear it is faster to simply reload the data .... !? + % + % well, for a lot of columns which are used in different contexts + % and few rows, this here IS more efficient. + \pgfplotstablecopy#3\to\pgfplots@table + \pgfkeysgetvalue{/pgfplots/table/x}{\pgfplots@plot@tbl@x}% + \pgfkeysgetvalue{/pgfplots/table/x index}{\pgfplots@plot@tbl@xindex}% + \pgfkeysgetvalue{/pgfplots/table/y}{\pgfplots@plot@tbl@y}% + \pgfkeysgetvalue{/pgfplots/table/y index}{\pgfplots@plot@tbl@yindex}% + \pgfkeysgetvalue{/pgfplots/table/z}{\pgfplots@plot@tbl@z}% + \pgfkeysgetvalue{/pgfplots/table/z index}{\pgfplots@plot@tbl@zindex}% + \pgfkeysgetvalue{/pgfplots/table/meta}{\pgfplots@plot@tbl@meta}% + \pgfkeysgetvalue{/pgfplots/table/meta index}{\pgfplots@plot@tbl@metaindex}% + \ifx\pgfplots@plot@tbl@x\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@xindex\of\pgfplots@table\to\addplot@tbl@x + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@x\of\pgfplots@table\to\addplot@tbl@x + \fi + \ifx\pgfplots@plot@tbl@y\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@yindex\of\pgfplots@table\to\addplot@tbl@y + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@y\of\pgfplots@table\to\addplot@tbl@y + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@z\pgfutil@empty + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@zindex\of\pgfplots@table\to\addplot@tbl@z + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@z\of\pgfplots@table\to\addplot@tbl@z + \fi + \fi + \let\addplot@tbl@meta=\pgfutil@empty + \ifx\pgfplots@plot@tbl@meta\pgfutil@empty + \ifx\pgfplots@plot@tbl@metaindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@metaindex\of\pgfplots@table\to\addplot@tbl@meta + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@meta\of\pgfplots@table\to\addplot@tbl@meta + \fi + % + \ifpgfplots@errorbars@enabled + \let\addplot@tbl@error@x=\pgfutil@empty + \let\addplot@tbl@error@z=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex + \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x + \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex + \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y + \pgfkeysgetvalue{/pgfplots/table/z error index}\pgfplots@plot@tbl@error@zindex + \pgfkeysgetvalue{/pgfplots/table/z error}\pgfplots@plot@tbl@error@z + \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@xindex\of\pgfplots@table\to\addplot@tbl@error@x + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@x\of\pgfplots@table\to\addplot@tbl@error@x + \fi + \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@yindex\of\pgfplots@table\to\addplot@tbl@error@y + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@y\of\pgfplots@table\to\addplot@tbl@error@y + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@zindex\pgfutil@empty + \else + \pgfplotstablegetcolumnbyindex\pgfplots@plot@tbl@error@zindex\of\pgfplots@table\to\addplot@tbl@error@z + \fi + \else + \pgfplotstablegetcolumnbyname\pgfplots@plot@tbl@error@z\of\pgfplots@table\to\addplot@tbl@error@z + \fi + \fi + \fi + % + \ifpgfplots@errorbars@enabled + \else + \let\pgfplots@current@point@x@error=\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \fi + \let\pgfplots@current@point@meta=\pgfutil@empty + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \pgfplots@coord@stream@start + \pgfutil@loop + \pgfplotslistcheckempty\addplot@tbl@x + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + % This here is just for sanity checking: if the 'y' column is + % - for whatever reasons - invalid; provide good error + % recovery. + \pgfplotslistcheckempty\addplot@tbl@y + \ifpgfplotslistempty + \pgfplots@loop@CONTINUEfalse + \else + \pgfplots@loop@CONTINUEtrue + \fi + \fi + \ifpgfplots@loop@CONTINUE + \pgfplotslistpopfront\addplot@tbl@x\to\pgfplots@current@point@x + \pgfplotslistpopfront\addplot@tbl@y\to\pgfplots@current@point@y + \ifpgfplots@curplot@threedim + \pgfplotslistpopfront\addplot@tbl@z\to\pgfplots@current@point@z + \fi + \ifx\addplot@tbl@meta\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@meta\to\pgfplots@current@point@meta + \fi + \ifpgfplots@errorbars@enabled + \ifx\addplot@tbl@error@x\pgfutil@empty + \let\pgfplots@current@point@x@error=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@x\to\pgfplots@current@point@x@error + \fi + \ifx\addplot@tbl@error@y\pgfutil@empty + \let\pgfplots@current@point@y@error=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@y\to\pgfplots@current@point@y@error + \fi + \ifpgfplots@errorbars@enabled + \ifx\addplot@tbl@error@z\pgfutil@empty + \let\pgfplots@current@point@z@error=\pgfutil@empty + \else + \pgfplotslistpopfront\addplot@tbl@error@z\to\pgfplots@current@point@z@error + \fi + \fi + \pgfplots@coord@stream@coord + \else + \pgfplots@coord@stream@coord + \fi + \pgfutil@repeat + \pgfplots@coord@stream@end + \endgroup +} + + +% \addplot[#1] table[#2] {#3} #4; +% +% This here is the (probably) faster input method from tables. +% +% It has linear complexity in the number of rows (as long as the +% number of rows is less than about 110000). +% +% #1: arguments to \addplot[...] +% #2: arguments to table[...] +% #3: the argument of plot table{...} +% #4: trailing path arguments after plot table{...}#4; +\long\def\pgfplots@addplotimpl@table@fromfile#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% +% \addplot[#1] table[#2] {#3} {#4}; +\long\def\pgfplots@addplotimpl@table@fromfile@#1#2#3#4{% + % set options outside of the following group. + % They may contain behavior options. + \pgfplots@addplotimpl@table@installkeypath + \pgfplotstableset{#2}% + %-------------------------------------------------- + % \begingroup + % \pgfplotstableset{#2}% + % \pgfplotstableread{#3}\pgfplots@table + % \pgfplots@addplotimpl@table@fromstructure{#1}{}from{\pgfplots@table}{#4};% + % \endgroup + %-------------------------------------------------- + \begingroup + \ifpgfplots@addplotimpl@readcompletely + \pgfplotstableread{#3}\pgfplots@table + \pgfplots@addplotimpl@table@fromstructure@{#1}{}{\pgfplots@table}{#4}% + \endgroup + \else + \pgfplotsapplistXXglobalnewempty + \pgfkeysgetvalue{/pgfplots/table/x}{\pgfplots@plot@tbl@x}% + \pgfkeysgetvalue{/pgfplots/table/x index}{\pgfplots@plot@tbl@xindex}% + \pgfkeysgetvalue{/pgfplots/table/y}{\pgfplots@plot@tbl@y}% + \pgfkeysgetvalue{/pgfplots/table/y index}{\pgfplots@plot@tbl@yindex}% + \pgfkeysgetvalue{/pgfplots/table/z}{\pgfplots@plot@tbl@z}% + \pgfkeysgetvalue{/pgfplots/table/z index}{\pgfplots@plot@tbl@zindex}% + \pgfkeysgetvalue{/pgfplots/table/meta}{\pgfplots@plot@tbl@meta}% + \pgfkeysgetvalue{/pgfplots/table/meta index}{\pgfplots@plot@tbl@metaindex}% + \let\pgfplots@table@PTR@x=\pgfutil@empty + \let\pgfplots@table@PTR@y=\pgfutil@empty + \let\pgfplots@table@PTR@z=\pgfutil@empty + \let\pgfplots@table@PTR@meta=\pgfutil@empty + \let\pgfplots@current@point@meta=\pgfutil@empty + \let\pgfplots@current@point@z=\pgfutil@empty + \ifpgfplots@errorbars@enabled + \let\pgfplots@table@ERRPTR@x=\pgfutil@empty + \let\pgfplots@table@ERRPTR@y=\pgfutil@empty + \let\pgfplots@table@ERRPTR@z=\pgfutil@empty + \pgfkeysgetvalue{/pgfplots/table/x error index}\pgfplots@plot@tbl@error@xindex + \pgfkeysgetvalue{/pgfplots/table/x error}\pgfplots@plot@tbl@error@x + \pgfkeysgetvalue{/pgfplots/table/y error index}\pgfplots@plot@tbl@error@yindex + \pgfkeysgetvalue{/pgfplots/table/y error}\pgfplots@plot@tbl@error@y + \pgfkeysgetvalue{/pgfplots/table/z error index}\pgfplots@plot@tbl@error@zindex + \pgfkeysgetvalue{/pgfplots/table/z error}\pgfplots@plot@tbl@error@z + \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL + \else + \pgfplotstableread{#3} to listener\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED + \fi + \endgroup + % + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \pgfplotsapplistXXgloballet\pgfplots@coordlist + \pgfplotsapplistXXglobalclear + \ifpgfplots@errorbars@enabled + \ifpgfplots@curplot@threedim + \expandafter\pgfplots@coord@stream@foreach@threedim\expandafter{\pgfplots@coordlist}%% + \else + \expandafter\pgfplots@coord@stream@foreach\expandafter{\pgfplots@coordlist}%% + \fi + \else + % this here is the usual case; it is faster than the error bar + % stuff. + \expandafter\pgfplots@coord@stream@foreach@NORMALIZED\expandafter{\pgfplots@coordlist}% + \fi + \fi +} +\def\pgfplots@addplotimpl@table@fromfile@listener@COLLECTNORMALIZED{% + \pgfplots@addplotimpl@table@fromfile@listener@ + \edef\pgfplots@current@point{% + \pgfplots@current@point@x,% + \pgfplots@current@point@y,% + \pgfplots@current@point@z,% + \pgfplots@current@point@meta% + ;% + }% + \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% +} +\def\pgfplots@addplotimpl@table@fromfile@listener@{% + \ifx\pgfplots@table@PTR@x\pgfutil@empty + % this here is only evaluated ONCE. + \ifx\pgfplots@plot@tbl@x\pgfutil@empty + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@xindex}{\pgfplots@table@PTR@x}% + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@x}{\pgfplots@table@PTR@x}% + \fi + \ifx\pgfplots@plot@tbl@y\pgfutil@empty + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@yindex}{\pgfplots@table@PTR@y}% + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@y}{\pgfplots@table@PTR@y}% + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@z\pgfutil@empty + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@zindex}{\pgfplots@table@PTR@z}% + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@z}{\pgfplots@table@PTR@z}% + \fi + \fi + \ifx\pgfplots@plot@tbl@meta\pgfutil@empty + \ifx\pgfplots@plot@tbl@metaindex\pgfutil@empty + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@metaindex}{\pgfplots@table@PTR@meta}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@meta}{\pgfplots@table@PTR@meta}% + \fi + \fi + \pgfplotstablereadevalptr\pgfplots@table@PTR@x\pgfplots@current@point@x + \pgfplotstablereadevalptr\pgfplots@table@PTR@y\pgfplots@current@point@y + \ifpgfplots@curplot@threedim + \pgfplotstablereadevalptr\pgfplots@table@PTR@z\pgfplots@current@point@z + \fi + \ifx\pgfplots@table@PTR@meta\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@PTR@meta\pgfplots@current@point@meta + \fi +}% +\def\pgfplots@addplotimpl@table@fromfile@listener@witherrors@COLLECTHIGHLEVEL{% + \pgfplots@addplotimpl@table@fromfile@listener@ + % + \ifx\pgfplots@table@ERRPTR@x\pgfutil@empty + % this here is only evaluated ONCE. + \ifx\pgfplots@plot@tbl@error@x\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@xindex\pgfutil@empty + \let\pgfplots@table@ERRPTR@x=\relax% + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@xindex}{\pgfplots@table@ERRPTR@x}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@x}{\pgfplots@table@ERRPTR@x}% + \fi + \ifx\pgfplots@plot@tbl@error@y\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@yindex\pgfutil@empty + \let\pgfplots@table@ERRPTR@y=\relax% + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@yindex}{\pgfplots@table@ERRPTR@y}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@y}{\pgfplots@table@ERRPTR@y}% + \fi + \ifpgfplots@curplot@threedim + \ifx\pgfplots@plot@tbl@error@z\pgfutil@empty + \ifx\pgfplots@plot@tbl@error@zindex\pgfutil@empty + \let\pgfplots@table@ERRPTR@z=\relax% + \else + \pgfplotstablereadgetptrtocolindex{\pgfplots@plot@tbl@error@zindex}{\pgfplots@table@ERRPTR@z}% + \fi + \else + \pgfplotstablereadgetptrtocolname{\pgfplots@plot@tbl@error@z}{\pgfplots@table@ERRPTR@z}% + \fi + \fi + \fi + \ifx\relax\pgfplots@table@ERRPTR@x + \let\pgfplots@current@point@x@error=\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@x\pgfplots@current@point@x@error + \fi + \ifx\relax\pgfplots@table@ERRPTR@y + \let\pgfplots@current@point@y@error=\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@y\pgfplots@current@point@y@error + \fi + \ifpgfplots@curplot@threedim + \ifx\relax\pgfplots@table@ERRPTR@z + \let\pgfplots@current@point@z@error=\pgfutil@empty + \else + \pgfplotstablereadevalptr\pgfplots@table@ERRPTR@z\pgfplots@current@point@z@error + \fi + \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z)+-(\pgfplots@current@point@x@error,\pgfplots@current@point@y@error,\pgfplots@current@point@z@error) [\pgfplots@current@point@meta]}% + \else + \edef\pgfplots@current@point{(\pgfplots@current@point@x,\pgfplots@current@point@y)+-(\pgfplots@current@point@x@error,\pgfplots@current@point@y@error) [\pgfplots@current@point@meta]}% + \fi + \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@current@point}% +}% +\def\pgfplots@addplotimpl@table@installkeypath{% + \pgfkeysdef{/pgfplots/table/.unknown}{% + \let\pgfplots@table@curkeyname=\pgfkeyscurrentname + \pgfqkeys{/pgfplots}{\pgfplots@table@curkeyname=##1}% + }% +}% + +% #1: arguments to \addplot plot[#1] +% -> these are called 'behavior' options in the manual; they are set +% immediately. +\def\pgfplots@start@plot@with@behavioroptions#1{% + %\begingroup%<-- has been moved to \pgfplots@addplotimpl@plot@withoptions + \def\pgfplots@current@point@coordindex{0}% can be used inside of coordinate filters. + \def\coordindex{\pgfplots@current@point@coordindex}% valid inside of \addplot + \ifx\pgfplots@execute@at@begin@plot\pgfutil@empty + \else + \pgfplots@execute@at@begin@plot + \fi + \let\pgfplots@addplot@nonlegend@options=\pgfutil@empty + \pgfplots@process@behavioroptions{#1}% + % these styles may contain behavior options (error bars, + % samples,... ) activate them! + \ifpgfplots@curplot@isirrelevant + \pgfplotsset{/pgfplots/every axis plot,/pgfplots/every forget plot/.try}% + \else + \pgfplotsset{/pgfplots/every axis plot,/pgfplots/every axis plot no \the\pgfplots@numplots/.try}% + \fi +} +\def\pgfplots@process@behavioroptions#1{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplots@addplot@nonlegend@options\expandafter{% + \pgfplots@addplot@nonlegend@options,#1}% + \pgfplotsset{#1}% + \fi +}% + +\def\pgfplots@end@plot{% + \ifpgfplots@curplot@isirrelevant + \else + \global\advance\pgfplots@numplots by1\relax% + \fi + \pgfplots@execute@at@end@plot + \endgroup%<-- close the \begingroup of \pgfplots@addplotimpl@plot@withoptions +} + +% \addplot[#1] [#2] {#3} #4; +\long\def\pgfplots@addplotimpl@coordinates#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% +% \addplot[#1] [#2] coordinates {#3} #4; +\long\def\pgfplots@addplotimpl@coordinates@#1#2#3#4{% +%\tracingmacros=2\tracingcommands=2 +%\pgfplots@message{processing plots coords with trailing path '#4'}% + \pgfplots@start@plot@with@behavioroptions{#2}% + \pgfplots@PREPARE@COORD@STREAM{#1}{#4}% + \ifpgfplots@curplot@threedim + \pgfplots@coord@stream@foreach@threedim{#3}% + \else + \pgfplots@coord@stream@foreach{#3}% + \fi +}% + +{ + % A block which handles active semicolons. + % + % ATTENTION: this block does only work if + % \pgfplots@addplotimpl.... changes are reflected here! + % + \catcode`\;=\active + \globaldefs=1 + % 'AS' == 'active semicolon' + % 'IS' == 'inactive semicolon' + \let\pgfplots@gobble@until@semicolon@IS=\pgfplots@gobble@until@semicolon + \let\pgfplots@addplotimpl@expression@IS=\pgfplots@addplotimpl@expression + \let\pgfplots@addplotimpl@expression@curly@IS=\pgfplots@addplotimpl@expression@curly + \let\pgfplots@addplotimpl@function@opt@IS=\pgfplots@addplotimpl@function@opt + \let\pgfplots@addplotimpl@file@opt@IS=\pgfplots@addplotimpl@file@opt + \let\pgfplots@addplotimpl@table@fromstructure@IS=\pgfplots@addplotimpl@table@fromstructure + \let\pgfplots@addplotimpl@table@fromfile@IS=\pgfplots@addplotimpl@table@fromfile + \let\pgfplots@addplotimpl@coordinates@IS=\pgfplots@addplotimpl@coordinates + % + \def\pgfplots@gobble@until@semicolon@AS#1;{} + \long\def\pgfplots@addplotimpl@expression@AS#1#2(#3,#4)#5;{\pgfplots@addplotimpl@expression@{#1}{#2}{#3}{#4}{#5}}% + \long\def\pgfplots@addplotimpl@expression@curly@AS#1#2#3#4;{\pgfplots@addplotimpl@expression@curly@{#1}{#2}{#3}{#4}}% + \def\pgfplots@addplotimpl@function@opt@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@function@opt@{#1}{#2}{#3}{#4}{#5}}% + \def\pgfplots@addplotimpl@file@opt@AS#1#2[#3]#4#5;{\pgfplots@addplotimpl@file@opt@{#1}{#2}{#3}{#4}{#5}}% + \long\def\pgfplots@addplotimpl@table@fromstructure@AS#1#2from#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% + \long\def\pgfplots@addplotimpl@table@fromfile@AS#1#2#3#4;{\pgfplots@addplotimpl@table@startprocessing{#1}{#2}{#3}{#4}}% + \long\def\pgfplots@addplotimpl@coordinates@AS#1#2plot coordinates#3#4;{\pgfplots@addplotimpl@coordinates@{#1}{#2}{#3}{#4}}% + % + % Checks whether ';' is an active character and, if that is the + % case, modifies all public macros for it. + \pgfplots@appendto@activesemicolon@switcher{% + \let\pgfplots@gobble@until@semicolon=\pgfplots@gobble@until@semicolon@AS + \let\pgfplots@addplotimpl@expression=\pgfplots@addplotimpl@expression@AS + \let\pgfplots@addplotimpl@expression@curly=\pgfplots@addplotimpl@expression@curly@AS + \let\pgfplots@addplotimpl@function@opt=\pgfplots@addplotimpl@function@opt@AS + \let\pgfplots@addplotimpl@file@opt=\pgfplots@addplotimpl@file@opt@AS + \let\pgfplots@addplotimpl@table@fromstructure=\pgfplots@addplotimpl@table@fromstructure@AS + \let\pgfplots@addplotimpl@table@fromfile=\pgfplots@addplotimpl@table@fromfile@AS + \let\pgfplots@addplotimpl@coordinates=\pgfplots@addplotimpl@coordinates@AS + }% +} + +\newif\ifpgfplots@update@limits@for@one@point@ISCLIPPED +\def\pgfplots@math@ONE{1.0}% + +\def\pgfplots@streamerrorbarstart{% +}% +\def\pgfplots@streamerrorbarend{% +}% +\def\pgfplots@streamerrorbarcoords#1#2{% +}% + +\def\pgfplots@streamerrorbar@recordto#1{% + \def\pgfplots@streamerrorbarstart{% + \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@ + }% + \def\pgfplots@streamerrorbarend{% + \pgfplotsapplistXlet#1=\pgfplots@streamerrorbar@recordto@@ + \pgfplotsapplistXnewempty\pgfplots@streamerrorbar@recordto@@% clear + }% + \def\pgfplots@streamerrorbarcoords##1##2{% + \pgfplotsapplistXpushback{\pgfplots@errorbar@draw{##1}{##2}}\to\pgfplots@streamerrorbar@recordto@@ + }% +} +\def\pgfplots@streamerrorbar@directdraw{% + \def\pgfplots@streamerrorbarstart{}% + \def\pgfplots@streamerrorbarend{}% + \def\pgfplots@streamerrorbarcoords##1##2{% + \pgfplots@errorbar@draw{##1}{##2}% + }% +} + +\def\pgfplots@invoke@filter#1#2{% + \pgfkeysvalueof{/pgfplots/#2 filter/.@cmd}#1\pgfeov% +}% + +% this is a convenience macro to save storage in the long coordinate +% lists. +\def\pgfplots@stream#1#2{\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} +\def\pgfplots@stream@withmeta#1#2#3{\def\pgfplots@current@point@meta{#3}\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} + +\newif\ifpgfplots@record@marker@stream +% Takes a sequence of PREPARED coordinates which are given in floating +% point representation and applies the data scaling trafo (if +% necessary). +% +% Any coordinate will be plotted with the selected PGF plot handler. +% +% This stream is designed to be done at the end of an axis. +% See \pgfplots@coord@stream@finalize@storedcoords@START +% +% #1 : a macro which will be filled with a pgf plot stream for the +% marker points. +\def\pgfplots@coord@stream@INIT@finalize@storedcoords#1{% + % + % Init the plot handlers: + \pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + \ifpgfplots@scatterplotenabled + \ifx\tikz@plot@mark\pgfutil@empty + \pgfplots@warning{I am confused: A scatter plot with 'mark=none'? This may need attention...?}% + \fi + \fi + % + \ifx\tikz@plot@mark\pgfutil@empty + % mark=none : no need to waste time collecting marker + % positions. + \pgfplots@record@marker@streamfalse + \else + \ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard + \ifpgfplots@clip@marker@paths + % only marks: draw markers directly; no need for the + % two-pass-approach. + \let\pgfplots@basiclevel@plothandler=\relax + \pgfplots@install@plotmark@handler + \pgfplots@record@marker@streamfalse + \else + % collect mark positions... they will be drawn after + % the clipped axis range. Clipping will only be + % applied to their *positions*, not their paths. + \pgfplots@record@marker@streamtrue + \fi + \else + % ok, mark!=none and we also have a plot handler. + % So, collect mark positions! + \pgfplots@record@marker@streamtrue + \fi + \fi + \gdef#1{}% + % + % Now, set up coordinate streams. + \def\pgfplots@coord@stream@start@{% + \ifpgfplots@apply@datatrafo + \ifpgfplots@stackedmode + \pgfplots@stacked@beginplot + \fi + \fi + \pgfplots@basiclevel@plothandler + \pgfplotstreamstart + \let\pgfplots@data@scaletrafo@result=\pgfutil@empty + \ifpgfplots@record@marker@stream + \pgfplotsapplistXXnewempty + \pgfplotsapplistXXpushback{\pgfplotstreamstart}% + %\gdef#1{\pgfplotstreamstart}% + \fi + % Define \pgfplots@process@perpointmeta properly: + \ifnum\pgfplots@perpointmeta@choice=0 + % disabled. + \def\pgfplots@process@perpointmeta{% + \let\pgfplots@current@point@meta=\pgfutil@empty + }% + \else + \fi + }% + \def\pgfplots@coord@stream@end@{% + \ifpgfplots@apply@datatrafo + \ifpgfplots@stackedmode + \pgfplots@stacked@endplot + \fi + \pgfplots@addplot@get@named@startendpoints@command\pgfplots@loc@TMPa + \pgfplots@loc@TMPa + \fi + \pgfplotstreamend + \ifpgfplots@record@marker@stream + \pgfplotsapplistXXpushback{\pgfplotstreamend}% + \pgfplotsapplistXXflushbuffers% + \global\let#1=\pgfplotsapplistXX + \pgfplotsapplistXXclear + %\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}% + \fi + }% + \begingroup + \let\E=\noexpand + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro + % + % Will be inserted in one of two possible places below: + \def\pgfplots@loc@TMPa{% + \ifnum\pgfplots@perpointmeta@choice=0 + % we don't have per-point meta data. Nothing special to + % do: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream{\E\the\E\pgf@x}{\E\the\E\pgf@y}}% + \E\expandafter\E\pgfplotsapplistXXpushback\E\expandafter{\E\pgfmathresult}% + \else + % Ok, then we need to process the meta data as well: + \E\edef\E\pgfmathresult{\E\noexpand\E\pgfplots@stream@withmeta{\E\the\E\pgf@x}{\E\the\E\pgf@y}{\E\pgfplots@current@point@meta}}% + \E\expandafter\E\pgfplotsapplistXXpushback\E\expandafter{\E\pgfmathresult}% + \fi + }% + % This finalize command maps the logical coordinate into PGF's + % point space. Furthermore, it collects marker coordinates + % (properly clipped by position) if markers are required (see + % above). + % + % It is prepared here to eliminate if's. + \xdef\pgfplots@coord@stream@finalize@currentpt{% + \ifpgfplots@curplot@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{\E\pgfplots@current@point@z}% + \else + \ifpgfplots@threedim + \E\pgfplotsqpointxyz{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}{0.0}% + \else + \E\pgfplotsqpointxy{\E\pgfplots@current@point@x}{\E\pgfplots@current@point@y}% + \fi + \fi + \ifpgfplots@record@marker@stream + \E\pgf@xa=\E\pgfplots@current@point@x pt % FIXME : SCOPE REGISTERS!? + \E\pgf@ya=\E\pgfplots@current@point@y pt % + \ifpgfplots@curplot@threedim + \E\pgf@yb=\E\pgfplots@current@point@z pt % + \fi + \E\ifdim\E\pgf@xa<\E\pgfplots@xmin@reg + \E\else + \E\ifdim\E\pgf@xa>\E\pgfplots@xmax@reg + \E\else + \E\ifdim\E\pgf@ya<\E\pgfplots@ymin@reg + \E\else + \E\ifdim\E\pgf@ya>\E\pgfplots@ymax@reg + \E\else + \ifpgfplots@curplot@threedim + \E\ifdim\E\pgf@yb<\E\pgfplots@zmin@reg + \E\else + \E\ifdim\E\pgf@yb>\E\pgfplots@zmax@reg + \E\else + \pgfplots@loc@TMPa + \E\fi + \E\fi + \else + \pgfplots@loc@TMPa + \fi + \E\fi + \E\fi + \E\fi + \E\fi + \fi + \E\pgfplotstreampoint{}% it will simply take \pgf@x and \pgf@y! + }% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + \endgroup +% +%\message{Prepared macro \string \pgfplots@apply@data@scaletrafo@to@one@point {\meaning\pgfplots@apply@data@scaletrafo@to@one@point}}% +%\message{Prepared macro \string \pgfplots@coord@stream@finalize@currentpt {\meaning\pgfplots@coord@stream@finalize@currentpt}}% + \ifpgfplots@apply@datatrafo + \def\pgfplots@coord@stream@coord@{% + \pgfplots@apply@data@scaletrafo@to@one@point% + \pgfplots@coord@stream@finalize@currentpt + }% + \else + \def\pgfplots@coord@stream@coord@{% + \pgfplots@coord@stream@finalize@currentpt + }% + \fi + % +} + +% Defines an optimized and matching \pgfplots@apply@data@scaletrafo@to@one@point +% during the coordinate finalization step in \end{axis}. +\def\pgfplots@coord@stream@INIT@finalize@storedcoords@prepare@scaletrafomacro{% + \begingroup + \let\E=\noexpand + % The command which is called for every non-yet-finished point. + % + % It is prepared here to eliminate if's. + % + % Arguments: + % \pgfplots@current@point@[xyz] + % \pgfplots@current@point@[xyz]@error (if in argument list) + \xdef\pgfplots@apply@data@scaletrafo@to@one@point{% + \ifpgfplots@apply@datatrafo@x + \E\pgfplots@datascaletrafo@x{\E\pgfplots@current@point@x}% + \E\let\E\pgfplots@current@point@x=\E\pgfmathresult + \fi + \ifpgfplots@apply@datatrafo@y + \E\pgfplots@datascaletrafo@y{\E\pgfplots@current@point@y}% + \E\let\E\pgfplots@current@point@y=\E\pgfmathresult + \fi + \ifpgfplots@curplot@threedim + \ifpgfplots@apply@datatrafo@z + \E\pgfplots@datascaletrafo@z{\E\pgfplots@current@point@z}% + \E\let\E\pgfplots@current@point@z=\E\pgfmathresult + \fi + \fi + \ifpgfplots@stackedmode + % all these calls work with pgfmath; no more floating point + % arithmetics are applied. + \E\pgfplots@stacked@getnextzerolevelpoint + \E\pgfplots@stacked@finishpoint% + \E\pgfplots@stacked@rememberzerolevelpoint@for@next@plot{(\E\pgfplots@current@point@x,\E\pgfplots@current@point@y)}% + \fi + % \t@pgfplots@tokc=\expandafter{\pgfplots@data@scaletrafo@result}% + % \edef\pgfplots@data@scaletrafo@result{\the\t@pgfplots@tokc(\pgfplots@current@point@x,\pgfplots@current@point@y)}% + }% + % + \endgroup +} + +\def\pgfplots@addplot@get@named@startendpoints@command#1{% + \ifpgfplots@coord@stream@isfirst + \edef#1{% + \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfqpoint{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}}% + \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfqpoint{\pgfplots@ZERO@x}{\pgfplots@ZERO@y}}% + }% + \else + \edef#1{% + \noexpand\pgfcoordinate{current plot begin}{\noexpand\pgfplotsqpointxy{\pgfplots@currentplot@firstcoord@x}{\pgfplots@currentplot@firstcoord@y}}% + \noexpand\pgfcoordinate{current plot end}{\noexpand\pgfplotsqpointxy{\pgfplots@currentplot@lastcoord@x}{\pgfplots@currentplot@lastcoord@y}}% + }% + \fi +}% + +% INPUT: +% either floating point or fixed point coordinates (depending on the +% state of the \ifpgfplots@apply@datatrafo boolean) +% +\long\def\pgfplots@coord@stream@finalize@storedcoords@START normalized coordinates #1#2;\pgfplots@EOI{% + \pgfplots@assert@tikzinternal@exists{tikz@make@last@position}% + \pgfplots@stored@current@cmd[current plot style] + \pgfextra + \tikzset{every plot/.try}% + \pgfplots@coord@stream@INIT@finalize@storedcoords\pgfplots@recorded@marker@stream% + \pgfplots@coord@stream@foreach@NORMALIZED{#1}% + \pgfutil@ifundefined{pgfplotlastpoint}{}{% + \tikz@make@last@position{\pgfplotlastpoint}% + }% + \endpgfextra + #2; + \ifx\pgfplots@recorded@marker@stream\pgfutil@empty + \else + \ifpgfplots@clip@marker@paths + % Draw markers on top of the plot lines: + % + % FIXME: inefficient! Use \scope to set variables of 'current plot style' !? + \pgfplots@stored@current@cmd[current plot style] + \pgfextra + \pgfplots@install@plotmark@handler + \pgfplots@recorded@marker@stream + \endpgfextra + ; + \else + % sigh... ok, store the marker list (once more again). + % They need to be drawn after the clipped area. + \pgfplots@stored@REMEMBER@MARK@COMMAND + \fi + \fi + \gdef\pgfplots@recorded@marker@stream{}% clear +}% + +% This method MUST be called while \pgfplots@stored@plotlist is +% evaluated, that means +% - \pgfplots@stored@* commands need to be valid, +% - the precommand has already been invoked. +% - pgfplots@recorded@marker@stream exists +% - current plot style is valid +\def\pgfplots@stored@REMEMBER@MARK@COMMAND{% + \pgfkeysgetvalue{/tikz/current plot style/.@cmd}{\pgfplots@loc@TMPa}% + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa\pgfeov}% + \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@cmd[current plot style]}% + \t@pgfplots@tokc=\expandafter{\pgfplots@recorded@marker@stream}% + \edef\pgfplots@loc@TMPa{% + \noexpand\pgfkeysdef{/tikz/current plot style}{\the\t@pgfplots@toka}% + % de-activate the FPU here if it was active! I fear its number + % format may cause errors when used in low-level + % routines. + \noexpand\pgfkeys{/pgf/fpu=false}% + % + \noexpand\xdef\noexpand\pgfplots@metamin{\pgfplots@metamin}% + \noexpand\xdef\noexpand\pgfplots@metamax{\pgfplots@metamax}% + \ifpgfplots@perpointmeta@usesfloat + \noexpand\pgfplots@perpointmeta@usesfloattrue + \else + \noexpand\pgfplots@perpointmeta@usesfloatfalse + \fi + \noexpand\def\noexpand\pgfplots@perpointmeta@choice{\pgfplots@perpointmeta@choice}% + % + \the\t@pgfplots@tokb + \noexpand\pgfextra + \noexpand\pgfplots@install@plotmark@handler + \the\t@pgfplots@tokc + \noexpand\endpgfextra + ;}% + \t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}% + \t@pgfplots@tokb=\expandafter{\pgfplots@stored@current@precmd}% + \edef\pgfplots@loc@TMPa{\the\t@pgfplots@tokb\the\t@pgfplots@toka}% + \expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}\to\pgfplots@stored@markerlist +}% + +\def\pgfplots@install@plotmark@handler{% + \pgfplots@assert@tikzinternal@exists{tikz@options}% + % note: I can't check on tikz@transform because it can be + % '\relax'. + \pgfplots@gettikzinternal@keyval{mark indices}{tikz@mark@list}{}% + \pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}% + % + % do not reset \tikz@options: draw color may be acquired + % from 'current plot style' + %\let\tikz@options=\pgfutil@empty% + \let\tikz@transform=\pgfutil@empty% + \tikzset{every plot/.try,every mark}% + \tikz@options + \pgfplots@perpointmeta@preparetrafo + % this here is the MAIN marker code. + % It may be modified if scatter plot is enabled, see below. + \def\pgfplots@loc@TMPa{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}} + \ifpgfplots@scatterplotenabled + % Scatter plots work like this: + % + % <compute per-point meta info> + % /pgfplots/scatter/@pre marker code + % <marker code, lowlevel> + % /pgfplots/scatter/@post marker code + % + % -> that's all. The Rest is configurable with style which + % (re)define '@pre marker code' and '@post marker code' (see + % the docs for details). + % + % Prepare arguments for '@pre/@post' macros: + \edef\pgfplotspointmetarange{\pgfplots@metamin:\pgfplots@metamax}% + \edef\pgfplotspointmetatransformedrange{\pgfplots@perpointmeta@traforange}% + \t@pgfplots@toka={% + \begingroup + \pgfutil@ifundefined{pgfplots@current@point@meta}{% + \pgfplots@error{'scatter' could not access its data source. Maybe you need to add '\string\addplot\space plot[scatter src=y]' or something like that?}% + \pgfmathfloatcreate{1}{1.0}{0}% + \def\pgfplotspointmetatransformed{1.0}% + }{% + % prepare arguments: + \let\pgfplotspointmeta=\pgfplots@current@point@meta + \pgfplots@perpointmeta@trafo{\pgfplotspointmeta}% + \let\pgfplotspointmetatransformed=\pgfmathresult + }% + \pgfkeysvalueof{/pgfplots/scatter/@pre marker code/.@cmd}\pgfeov + }% + \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}% + \t@pgfplots@tokc={% + \pgfkeysvalueof{/pgfplots/scatter/@post marker code/.@cmd}\pgfeov + \endgroup + }% + \edef\pgfplots@loc@TMPa{% + \the\t@pgfplots@toka + \the\t@pgfplots@tokb + \the\t@pgfplots@tokc + }% + \fi + \ifx\tikz@mark@list\pgfutil@empty% + \expandafter\pgfplothandlermark\expandafter{\pgfplots@loc@TMPa}% + \else + \expandafter\pgfplothandlermarklisted\expandafter{\pgfplots@loc@TMPa}{\tikz@mark@list}% + \fi +}% + + +% This thing here shall draw all error bar commands listed in '#2'. +% +% It will be invoked when any plotting commands take effect (that +% means all limits are computed; the axis has been drawn, +% transformations are set up...) +\def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{% + \scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it uses the /pgfplots/.unknown handler + #2% + \endscope +} + +\def\pgfplots@errorbar@draw@float(#1,#2)(#3,#4){% + \ifpgfplots@apply@datatrafo@x + \pgfplots@datascaletrafo@x{#1}% + \let\pgfplots@xarg=\pgfmathresult% + \pgfplots@datascaletrafo@x{#3}% + \let\pgfplots@error@xarg=\pgfmathresult% + \else + \def\pgfplots@xarg{#1}% + \def\pgfplots@error@xarg{#3}% + \fi + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@y{#2}% + \let\pgfplots@yarg=\pgfmathresult% + \pgfplots@datascaletrafo@y{#4}% + \let\pgfplots@error@yarg=\pgfmathresult% + \else + \def\pgfplots@yarg{#2}% + \def\pgfplots@error@yarg{#4}% + \fi + \edef\pgfplots@loc@TMPa{{(\pgfplots@xarg,\pgfplots@yarg)}{(\pgfplots@error@xarg,\pgfplots@error@yarg)}}% + \def\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}}% + \expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfeov +} + +\def\pgfplots@errorbar@draw#1#2{% + \begingroup + \ifpgfplots@apply@datatrafo + \pgfplots@errorbar@draw@float#1#2 + \else + \pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov% + \fi + \endgroup +}% + +% Arguments: +% \pgfplots@current@point@[xyz] +% \pgfplots@current@point@[xyz]@unfiltered +% \pgfplots@current@point@[xyz]@error (if in argument list) +% Also provides UNFILTERED arguments x and y . These are use +% in case of logplots, because we may need to compute log( x + e_x ) +% or log( y + e_y ). +\def\pgfplots@process@errorbar@for{% +% \begingroup + \edef\pgfplots@xarg{\pgfplots@current@point@x}% + \edef\pgfplots@yarg{\pgfplots@current@point@y}% + \let\pgfplots@xarg@unfiltered\pgfplots@current@point@x@unfiltered% + \let\pgfplots@yarg@unfiltered\pgfplots@current@point@y@unfiltered% + \edef\pgfplots@error@xarg{\pgfplots@current@point@x@error}% + \edef\pgfplots@error@yarg{\pgfplots@current@point@y@error}% + \def\pgfplots@loc@TMPa{0}% + \ifx\pgfplots@loc@TMPa\pgfplots@error@xarg + \let\pgfplots@error@xarg=\pgfutil@empty + \fi + \ifx\pgfplots@loc@TMPa\pgfplots@error@yarg + \let\pgfplots@error@yarg=\pgfutil@empty + \fi + % FIXME : INEFFICIENT! This code here does every computation + % multiple times! + \ifcase\pgfplots@errorbars@xdirection + \or + \pgfplots@process@errorbar@@for{x}{+}1% + \or + \pgfplots@process@errorbar@@for{x}{-}2% + \or + \pgfplots@process@errorbar@@for{x}{+}1% + \pgfplots@process@errorbar@@for{x}{-}2% + \fi + \ifcase\pgfplots@errorbars@ydirection + \or + \pgfplots@process@errorbar@@for{y}{+}1% + \or + \pgfplots@process@errorbar@@for{y}{-}2% + \or + \pgfplots@process@errorbar@@for{y}{+}1% + \pgfplots@process@errorbar@@for{y}{-}2% + \fi + % Restore macros which may have been overwritten: + \let\pgfplots@current@point@x=\pgfplots@xarg + \let\pgfplots@current@point@y=\pgfplots@yarg +% \endgroup +} + +% #1: either 'x' or 'y' +% #2: either '+' or '-' +% #3: an integer representing the argument #2. It is '1' if #2='+' +% and '2' is #2 = '-'. +\def\pgfplots@process@errorbar@@for#1#2#3{% + \csname ifpgfplots@#1islinear\endcsname + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \ifcase\csname pgfplots@errorbars@#1mode\endcsname + % fixed absolute error. + \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \let\pgfplots@error@coord=\pgfmathresult + \or% fixed relative error: + \pgfmathparse{(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \or% explicit absolute: + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \let\pgfplots@error@coord=\pgfmathresult + \fi + \or% explicit relative: + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathparse{(1#2\pgfplots@error@coord)}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatmultiplyfixed@{\pgfplots@error@src}{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \fi + \fi + \else + % LOGARITHMIC scaling. All errors are interpreted as + % log(x +- e_x) + % or + % log( x*(1+-e_x) ) + \ifcase\csname pgfplots@errorbars@#1mode\endcsname + % fixed absolute, log( x +- e_x ) + \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@errorbars@#1fixed\endcsname}% + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@error@src}% + \let\pgfplots@error@src=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \pgfmathlog@float{\pgfmathresult}% + \let\pgfplots@error@coord=\pgfmathresult + \or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x) + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \pgfmathparse{\pgfplots@error@src + ln(1#2\csname pgfplots@errorbars@#1rel\endcsname)}% + \let\pgfplots@error@coord=\pgfmathresult% + \or% explicit absolute + \edef\pgfplots@error@src{\csname pgfplots@#1arg@unfiltered\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathfloatparsenumber{\pgfplots@error@coord}% + \let\pgfplots@error@coord=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@error@src}% + \let\pgfplots@error@src=\pgfmathresult + \ifnum#3=1 + \pgfmathfloatadd@{\pgfplots@error@src}{\pgfplots@error@coord}% + \else + \pgfmathfloatsubtract@{\pgfplots@error@src}{\pgfplots@error@coord}% + \fi + \pgfmathlog@float{\pgfmathresult}% + \let\pgfplots@error@coord=\pgfmathresult + \fi + \or% explicit relative: + \edef\pgfplots@error@src{\csname pgfplots@#1arg\endcsname}% + \edef\pgfplots@error@coord{\csname pgfplots@error@#1arg\endcsname}% + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \pgfmathparse{\pgfplots@error@src + ln(1#2 \pgfplots@error@coord)}% + \let\pgfplots@error@coord=\pgfmathresult% + \fi + \fi + \fi + \ifx\pgfplots@error@coord\pgfutil@empty + \else + \def\pgfplots@loc@TMPa{#1}% + \def\pgfplots@loc@TMPb{x}% + \ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb + \let\pgfplots@current@point@x=\pgfplots@error@coord + \let\pgfplots@current@point@y=\pgfplots@yarg + \pgfplots@update@limits@for@one@point + \edef\pgfplots@loc@TMPa{% + {(\pgfplots@xarg,\pgfplots@yarg)}% + {(\pgfplots@error@coord,\pgfplots@yarg)}% + }% + \else + \let\pgfplots@current@point@x=\pgfplots@xarg + \let\pgfplots@current@point@y=\pgfplots@error@coord + \pgfplots@update@limits@for@one@point + \edef\pgfplots@loc@TMPa{% + {(\pgfplots@xarg,\pgfplots@yarg)}% + {(\pgfplots@xarg,\pgfplots@error@coord)}% + }% + \fi + \expandafter\pgfplots@streamerrorbarcoords\pgfplots@loc@TMPa + \fi +} +% This routine is called at the begin of every plot. +% It initialises a zero level stream. +% +% The default is to use '0' as zero level streams. +% +% This method is called as "precommand"; before any Tikz drawing +% commands have been started. +\def\pgfplots@initzerolevelhandler{% + \ifpgfplots@stackedmode + % ATTENTION: this thing here says: + % "draw zero level coordinates from list XYZ." + % But at the time of this initialisation, the list will be EMPTY! + % + % It will be filled later. That's ok, because + % \pgfplots@initzerolevelhandler will be + % used as 'precommand', that means before Tikz sees any + % coordinates. + \pgfplots@stacked@initzerolevelhandler + \else + \pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}% + \pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}% + \fi +} + +% This code is mainly interesting for bar plots. +% +% It precomputes x = 0 and y = 0 - which is not necessarily +% trivial in case of data scaling. Furthermore, it applies +% coordinate clipping to the resulting values and multiplies them +% with x- and y scale vectors. +\def\pgfplots@prepare@ZERO@coordinates{% + \ifpgfplots@xislinear + \ifpgfplots@apply@datatrafo@x + \pgfplots@datascaletrafo@fromfixed@x{0}% + \global\let\pgfplots@logical@ZERO@x=\pgfmathresult + \else + \gdef\pgfplots@logical@ZERO@x{0}% + \fi + \pgfplotsmathmax{\pgfplots@logical@ZERO@x}{\pgfplots@xmin}% + \global\let\pgfplots@logical@ZERO@x=\pgfmathresult + \else + \global\let\pgfplots@logical@ZERO@x=\pgfplots@xmin% + \fi + % + \ifpgfplots@yislinear + \ifpgfplots@apply@datatrafo@y + \pgfplots@datascaletrafo@fromfixed@y{0}% + \global\let\pgfplots@logical@ZERO@y=\pgfmathresult + \else + \gdef\pgfplots@logical@ZERO@y{0}% + \fi + \pgfplotsmathmax{\pgfplots@logical@ZERO@y}{\pgfplots@ymin}% + \global\let\pgfplots@logical@ZERO@y=\pgfmathresult + \else + \global\let\pgfplots@logical@ZERO@y=\pgfplots@ymin% + \fi + % + \ifpgfplots@threedim + \ifpgfplots@zislinear + \ifpgfplots@apply@datatrafo@z + \pgfplots@datascaletrafo@fromfixed@z{0}% + \global\let\pgfplots@logical@ZERO@z=\pgfmathresult + \else + \gdef\pgfplots@logical@ZERO@z{0}% + \fi + \pgfplotsmathmax{\pgfplots@logical@ZERO@z}{\pgfplots@zmin}% + \global\let\pgfplots@logical@ZERO@z=\pgfmathresult + \else + \global\let\pgfplots@logical@ZERO@z=\pgfplots@zmin% + \fi + \fi + % + % + \pgfinterruptboundingbox% + \ifpgfplots@threedim + \pgfplotsqpointxyz{\pgfplots@logical@ZERO@x}{\pgfplots@logical@ZERO@y}{\pgfplots@logical@ZERO@z}% + \else + \pgfplotsqpointxy{\pgfplots@logical@ZERO@x}{\pgfplots@logical@ZERO@y}% + \fi + \xdef\pgfplots@ZERO@x{\the\pgf@x}% + \xdef\pgfplots@ZERO@y{\the\pgf@y}% + \endpgfinterruptboundingbox% +}% + diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex new file mode 100644 index 00000000000..b5aaadc42dc --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotscore.code.tex @@ -0,0 +1,77 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + + +\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% +\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}% +\def\pgfplots@message#1{% + \immediate\write16{#1}% +}% + + +\pgfutil@ifundefined{pgfkeys}{% + \pgfplots@error{It seems your version of PGF/Tikz is older than 2.00. Unfortunately, pgfplots requires at least version 2.00 ... you may need to update your TeX-Distribution or install PGF manually, sorry}% +}{\relax} + +\def\pgfplots@EOI{\pgfplots@EOI}% + +\newif\ifpgfplots@loc@tmp +\newtoks\t@pgfplots@toka +\newtoks\t@pgfplots@tokb +\newtoks\t@pgfplots@tokc +\newdimen\pgfplots@tmpa + +% use these macros for GLOBAL temporary assignments. +% you can NEVER rely on their values unless you know exactly what you are doing. +\gdef\pgfplots@glob@TMPa{}% +\gdef\pgfplots@glob@TMPb{}% +\gdef\pgfplots@glob@TMPc{}% + +% use these macros for LOCAL temporary assigments. +% you can NEVER rely on their values unless you know exactly what you are doing. +\def\pgfplots@loc@TMPa{}% +\def\pgfplots@loc@TMPb{}% +\def\pgfplots@loc@TMPc{}% + + +% Invokes code #2 if file '#1' exists and #3 if not. +\def\pgfplots@iffileexists#1#2#3{% + \begingroup + \openin1=#1 + \ifeof1 + \xdef\pgfplots@glob@TMPa{0}% + \else + \closein1 + \xdef\pgfplots@glob@TMPa{1}% + \fi + \endgroup + \if1\pgfplots@glob@TMPa + #2% + \else + #3% + \fi +} +\endinput diff --git a/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex new file mode 100644 index 00000000000..cd0cc44dff3 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/pgfplotsticks.code.tex @@ -0,0 +1,1530 @@ +%-------------------------------------------- +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +\newif\ifpgfplots@log@tick@isminor@tick@pos +% Checks whether the tick position given as #1.#2=log10(T) belongs to +% T=i*10^j with an integer i>1. +% +% If T=i*10^j, \ifpgfplots@log@tick@isminor@tick@pos will be set to true and +% \pgfmathresult will contain T. +% +% Otherwise, \ifpgfplots@log@tick@isminor@tick@pos will be set to false and +% pgfmathresult to #1.#2 +% +% Arguments: +% #1.#2 the value log10(T) +% +% Implementation: +% if T = i*10^j, log10(T) = log10(i) + j. +% That means if log10(T) in \Z, we have T = 10^j. If not, we need to +% check wether i is an integer. Please note that log10(i) < 1. +% +% Further note: log(T) < 0 <=> j<0. +% In case j<0, we have +% #1.#2 = j + log(i) +% = - ( -j - log(i) ) +% = - ( -j - 1 + (1-log(i)) ) +% = #1 '.' #2 [ up to the '0.' +% that means #1 = j-1 and #2 = 1-log(i). +\def\pgfplots@is@log@tick@a@minor@tick@pos#1.#2\relax{% + \pgfmathapproxequalto@{#1.#2}{#1.0}% + \ifpgfmathcomparison + % in MOST cases, this here will be true: + \pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \else + % I guess this won't happen too often. In fact, it's a very + % special case. + \begingroup + \c@pgf@counta=#1\relax + \ifnum\c@pgf@counta<0 + \advance\c@pgf@counta by-1 + \pgfmathsubtract@{1}{0.#2}% + \expandafter\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi\pgfmathresult\relax + \ifpgfplots@log@tick@isminor@tick@pos + \aftergroup\pgfplots@log@tick@isminor@tick@postrue + \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% + \else + \aftergroup\pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \fi + \else + \pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#2\relax + \ifpgfplots@log@tick@isminor@tick@pos + \aftergroup\pgfplots@log@tick@isminor@tick@postrue + \edef\pgfmathresult{\pgfmathresult e\the\c@pgf@counta}% + \else + \aftergroup\pgfplots@log@tick@isminor@tick@posfalse + \def\pgfmathresult{#1.#2}% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup + \fi +} + +% expects a positive number. +\def\pgfplots@is@log@tick@a@minor@tick@pos@IDENTIFY@LOGi0.#1\relax{% + \pgfplots@log@tick@isminor@tick@postrue + \pgfmathapproxequalto@{0.#1}{0.3010299956639}% + \ifpgfmathcomparison + \def\pgfmathresult{2}% + \else + \pgfmathapproxequalto@{0.#1}{0.4771212547196}% + \ifpgfmathcomparison + \def\pgfmathresult{3}% + \else + \pgfmathapproxequalto@{0.#1}{0.6020599913279}% + \ifpgfmathcomparison + \def\pgfmathresult{4}% + \else + \pgfmathapproxequalto@{0.#1}{0.698970004}% + \ifpgfmathcomparison + \def\pgfmathresult{5}% + \else + \pgfmathapproxequalto@{0.#1}{0.7781512503}% + \ifpgfmathcomparison + \def\pgfmathresult{6}% + \else + \pgfmathapproxequalto@{0.#1}{0.8450980400}% + \ifpgfmathcomparison + \def\pgfmathresult{7}% + \else + \pgfmathapproxequalto@{0.#1}{0.9030899869}% + \ifpgfmathcomparison + \def\pgfmathresult{8}% + \else + \pgfmathapproxequalto@{0.#1}{0.954242509439}% + \ifpgfmathcomparison + \def\pgfmathresult{9}% + \else + \pgfplots@log@tick@isminor@tick@posfalse + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi +} + +% Checks whether we need to create a separate 'tick scale label', +% a node with ' * 10^3' on the side of the axis: +% +% PRECONDITION: +% Axis limits for #1 are given. I need their values before any data +% scale transformation has been applied. +% If +% \pgfplots@#1min@unscaled@as@float +% and +% \pgfplots@#1max@unscaled@as@float +% exist; I will use these macros. +% Otherwise, I will use \pgfplots@#1min and \pgfplots@#1max; +% assuming that no data scale transformation is active. +% FIXME : does that need further attention? +\def\pgfplots@init@scaled@tick@for#1{% + \global\def\pgfplots@glob@TMPa{0}% + \begingroup + \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname + % CASE 0 : scaled #1 ticks=false: do nothing here. + \or + % CASE 1 : scaled #1 ticks=true: + %-------------------------------- + % the \pgfplots@xmin@unscaled@as@float is set just before the data + % scale transformation is initialised. + % + % The variables are empty if there is no datascale transformation. + \expandafter\let\expandafter\pgfplots@cur@min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname + \expandafter\let\expandafter\pgfplots@cur@max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname + % + \ifx\pgfplots@cur@min@unscaled\pgfutil@empty + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1min\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \let\pgfplots@cur@min@unscaled=\pgfmathresult + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1max\endcsname}% + \expandafter\pgfmathfloatparsenumber\expandafter{\pgfplots@loc@TMPa}% + \let\pgfplots@cur@max@unscaled=\pgfmathresult + \fi + % + \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@min@unscaled\relax\pgfmathfloat@a@E + \expandafter\pgfmathfloat@decompose@E\pgfplots@cur@max@unscaled\relax\pgfmathfloat@b@E + \ifnum\pgfmathfloat@b@E<\pgfmathfloat@a@E + \pgfmathfloat@b@E=\pgfmathfloat@a@E + \fi + \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@above@exponent}% + \expandafter\ifnum\pgfplots@glob@TMPa<\pgfmathfloat@b@E + % ok, scale it: + \multiply\pgfmathfloat@b@E by-1 + \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% + \else + \xdef\pgfplots@glob@TMPa{\pgfplots@scale@ticks@below@exponent}% + \expandafter\ifnum\pgfplots@glob@TMPa>\pgfmathfloat@b@E + % ok, scale it: + \multiply\pgfmathfloat@b@E by-1 + \xdef\pgfplots@glob@TMPa{\the\pgfmathfloat@b@E}% + \else + % no scaling necessary: + \xdef\pgfplots@glob@TMPa{0}% + \fi + \fi + \or + % CASE 2 : scaled #1 ticks=base 10: + %-------------------------------- + \c@pgf@counta=\csname pgfplots@scaled@ticks@#1@arg\endcsname\relax + %\multiply\c@pgf@counta by-1 + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \or + % CASE 3 : scaled #1 ticks=real: + %-------------------------------- + \pgfmathfloatparsenumber{\csname pgfplots@scaled@ticks@#1@arg\endcsname}% + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \or + % CASE 4 : scaled #1 ticks=manual: + \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@scaled@ticks@#1@arg\endcsname + \fi + \endgroup + \expandafter\let\csname pgfplots@tick@scale@#1\endcsname=\pgfplots@glob@TMPa% +} + +% x-axis tick labels for #1th tick +% #1: the axis (x or y) +% #2: the value +% #3,#4: coordinates for \pgfplotspointonorientedsurfaceab +% #5: ticknumber +\def\pgfplots@show@ticklabel#1#2(#3,#4)#5{{% + \csname ifpgfplots@#1ticklabel@interval\endcsname + \pgfmathparse{#3}% + \edef\pgfplots@show@ticklabel@coord@x@new{\pgfmathresult}% + \pgfmathparse{#4}% + \edef\pgfplots@show@ticklabel@coord@y@new{\pgfmathresult}% + % + \pgfplots@show@ticklabel@{#1}{#2}% + \let\nexttick=\tick + \ifx\pgfplots@show@ticklabel@LASTTICK\pgfutil@empty + % its the first call. Simply remember arguments and wait + % for interval boundary before proceeding. + \else + % acquire options of first interval boundary: + \pgfplots@show@ticklabel@LASTTICK + % compute new node position: + \pgfmathparse{0.5*(\csname pgfplots@show@ticklabel@coord@#1\endcsname + \csname pgfplots@show@ticklabel@coord@#1@new\endcsname)}% + \expandafter\edef\csname pgfplots@show@ticklabel@coord@#1\endcsname{\pgfmathresult}% + \let\ticknum=\pgfplots@show@ticklabel@num\relax% + \let\tick=\pgfplots@show@ticklabel@tick% + \edef\pgfplots@loc@TMPa{at (\pgfplots@show@ticklabel@coord@x,\pgfplots@show@ticklabel@coord@y)}% + \begingroup + \pgftransformshift{\pgfplotspointonorientedsurfaceab{\pgfplots@show@ticklabel@coord@x}{\pgfplots@show@ticklabel@coord@y}}% + \node at (0pt,0pt) {\csname pgfplots@#1ticklabel\endcsname};% + \endgroup + \fi + \xdef\pgfplots@show@ticklabel@LASTTICK{% + \noexpand\def\noexpand\pgfplots@show@ticklabel@tick{\nexttick}% + \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@x{\pgfplots@show@ticklabel@coord@x@new}% + \noexpand\def\noexpand\pgfplots@show@ticklabel@coord@y{\pgfplots@show@ticklabel@coord@y@new}% + \noexpand\edef\noexpand\pgfplots@show@ticklabel@num{#5}% + }% + \else + \let\ticknum=#5\relax% + \pgfplots@show@ticklabel@{#1}{#2}% + \begingroup + \pgftransformshift{\pgfplotspointonorientedsurfaceab{#3}{#4}}% + \node at (0pt,0pt) {\csname pgfplots@#1ticklabel\endcsname};% + \endgroup + \fi +}} + +% Defines \tick by applying any necessary math to the (possibly +% transformed) tick value #2. +% +% #1: axis (x or y) +% #2: tick value. +\def\pgfplots@show@ticklabel@#1#2{% + \csname ifpgfplots@apply@datatrafo@#1\endcsname + \csname pgfplots@inverse@datascaletrafo@#1\endcsname{#2}% + \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname + \or + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \or + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \or + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \or + % scaled #1 ticks=manual. Invoke manual tick scaling code: + \expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@tick@scale@#1\endcsname + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfmathresult}% + \fi + % .. and this here provides \tick as fixed point repr: + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\tick=\pgfmathresult + \else + \edef\tick{#2}% + \pgfplots@if{pgfplots@#1islinear}{% + \ifnum\csname pgfplots@scaled@ticks@#1@choice\endcsname=0 + \else + \pgfmathfloatparsenumber{#2}% + \ifnum\csname pgfplots@scaled@ticks@#1@choice\endcsname=3 + \expandafter\pgfmathfloatdivide@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \else + \expandafter\pgfmathfloatshift@\expandafter{\pgfmathresult}{\csname pgfplots@tick@scale@#1\endcsname}% + \fi + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\tick=\pgfmathresult + \fi + }{}% + \fi + \pgfkeysgetvalue{/pgfplots/#1 coord inv trafo/.@cmd}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key + \else + \let\pgfmathresult=\tick% + \expandafter\pgfplots@loc@TMPa\expandafter{\tick}\pgfeov + \let\tick=\pgfmathresult + \fi +}% + +\def\pgfplots@user@ticklabel@list@x{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@xticklabels\to\tick + \tick +} +\def\pgfplots@user@ticklabel@list@y{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@yticklabels\to\tick + \tick +} +\def\pgfplots@user@ticklabel@list@z{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@zticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@x{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@xticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@y{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@yticklabels\to\tick + \tick +} +\def\pgfplots@user@extra@ticklabel@list@z{% + \pgfplotslistselectorempty\ticknum\of\pgfplots@extra@zticklabels\to\tick + \tick +} + +% Check if a label does not cross the x-axis +\def\pgfplots@ytick@check@tickshow{% + \pgfplots@tickshowtrue + \ifnum\pgfplots@yaxislinesnum=2 % + \ifcase\pgfplots@xaxislinesnum\relax + \ifdim\pgfplots@tmpa=\pgfplots@ymin@reg\relax + \pgfplots@tickshowfalse + \fi + \ifdim\pgfplots@tmpa=\pgfplots@ymax@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ymin@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@logical@ZERO@y pt + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@ymax@reg\relax + \pgfplots@tickshowfalse + \fi + \fi + \fi +} +\def\pgfplots@ztick@check@tickshow{% + \pgfplots@tickshowtrue + % FIXME +}% + +% Fills the macros +% \pgfplots@tick@beg@a \pgfplots@tick@end@a +% \pgfplots@tick@beg@b \pgfplots@tick@end@b +% with coordinates such that +% (\pgfplots@tick@beg@a,\pgfplots@tmpa) -- (\pgfplots@tick@end@a,\pgfplots@tmpa) +% produces a correct tick line. +% +% The '@b' variant is only used in case of \pgfplots@ytickposnum = 0 +% +% #1 : the current axis (x or y). +% #2 : the current tick width +% +\def\pgfplots@prepare@tick@offsets@for@#1#2{% + \ifcase\csname pgfplots@#1tickposnum\endcsname\relax + %(\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt) + \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}% + \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult + % + %(\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#2, 0pt) + \edef\pgfplots@tick@beg@b{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}% + \pgfmathadd@{\pgfplots@tick@beg@b}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@b=\pgfmathresult + \pgfmathsubtract@{\pgfplots@tick@beg@b}{#2}% + \let\pgfplots@tick@end@b=\pgfmathresult% + \or + % (\pgfplots@xcoordminTEX-\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt); + \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}% + \pgfmathsubtract@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult + \or + % (\pgfplots@ZERO@x -\pgfplots@tick@offset, \pgfplots@tmpa) -- ++( #2, 0pt); + \pgfmathsubtract@{\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB \endcsname}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathadd@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult% + \or + % (\pgfplots@xcoordmaxTEX+\pgfplots@tick@offset, \pgfplots@tmpa) -- ++(-#2, 0pt); + \edef\pgfplots@tick@beg@a{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}% + \pgfmathadd@{\pgfplots@tick@beg@a}{\pgfplots@tick@offset}% + \let\pgfplots@tick@beg@a=\pgfmathresult + \pgfmathsubtract@{\pgfplots@tick@beg@a}{#2}% + \let\pgfplots@tick@end@a=\pgfmathresult% + \fi +}% + + +\newif\ifpgfplots@needsminorloop + +\def\pgfplots@draw@tick@scale@label@for#1{% + \csname ifpgfplots@#1islinear\endcsname + \begingroup + \def\pgfplots@temp@isbaseten{0}% + \ifcase\csname pgfplots@scaled@ticks@#1@choice\endcsname + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \or + \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% + \def\pgfplots@temp@isbaseten{1}% + \or + \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% + \def\pgfplots@temp@isbaseten{1}% + \or + \xdef\pgfplots@glob@TMPa{\csname pgfplots@tick@scale@#1\endcsname}% + % real: + \or + % manual: + \global\def\pgfplots@glob@TMPa{dummyargument}% + \fi + \if1\pgfplots@temp@isbaseten + \expandafter\c@pgf@counta\pgfplots@glob@TMPa\relax + \multiply\c@pgf@counta by-1 + \ifnum\c@pgf@counta=0\relax + \global\let\pgfplots@glob@TMPa=\pgfutil@empty + \else + \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}% + \fi + \fi + \endgroup + \ifx\pgfplots@glob@TMPa\pgfutil@empty + \else + \begingroup + \pgfkeysgetvalue{/pgfplots/#1tick scale label code/.@cmd}\pgfplots@loc@TMPa + \ifx\pgfplots@loc@TMPa\pgfplots@empty@command@key + \else + \edef\pgfplots@tick@scale@labels{\noexpand\pgfplots@invoke@pgfkeyscode{/pgfplots/#1tick scale label code/.@cmd}{\pgfplots@glob@TMPa}}% + \pgftransformshift{\pgfplotspointsouthwest}% + \pgfsetxvec{\pgfplotspointxaxis}% + \pgfsetyvec{\pgfplotspointyaxis}% + % FIXME : do I need the fix for 'current axis.origin' + % here!? + \node[% + /pgfplots/every tick label,% + /pgfplots/every #1 tick label,% + /pgfplots/every #1 tick scale label] + {\pgfplots@tick@scale@labels}; + \fi + \endgroup + \fi + \fi +} + +% Check if the current tick position, stored in \pgfplots@tmpa, +% does not cross the y-axis. +% +% This is just a special case for centered axis lines. +\def\pgfplots@xtick@check@tickshow{% + \pgfplots@tickshowtrue + \ifnum\pgfplots@xaxislinesnum=2 % + \ifcase\pgfplots@yaxislinesnum\relax + \ifdim\pgfplots@tmpa=\pgfplots@xmin@reg\relax + \pgfplots@tickshowfalse + \fi + \ifdim\pgfplots@tmpa=\pgfplots@xmax@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@xmin@reg\relax + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@logical@ZERO@x pt % + \pgfplots@tickshowfalse + \fi + \or + \ifdim\pgfplots@tmpa=\pgfplots@xmax@reg\relax + \pgfplots@tickshowfalse + \fi + \fi + \fi +} + +% Draws extra ticks including grid lines, tick lines and tick labels +% along the current oriented surface. +% +% See \pgfplots@drawticklines@onorientedsurf@ for a description of the +% oriented surface. +% +% #1 : tick position list +\def\pgfplots@draw@extra@ticks@onorientedsurf{% + \expandafter\pgfplots@draw@extra@ticks@onorientedsurf@\pgfplotspointonorientedsurfaceA +}% +% #1: axis (x or y) +% #2: tick position list +\def\pgfplots@draw@extra@ticks@onorientedsurf@#1#2{% + \begingroup + \def\pgfplots@scaled@ticks@x@choice{0}% + \def\pgfplots@scaled@ticks@y@choice{0}% + \csname pgfplots@#1minorticksfalse\endcsname + \csname pgfplots@#1minorgridsfalse\endcsname + \expandafter\let\expandafter\axis@TMP\csname pgfplots@extra@#1ticklabel\endcsname + \expandafter\let\csname pgfplots@#1ticklabel\endcsname=\axis@TMP + \pgfplotsset{/pgfplots/every extra #1 tick}% + \expandafter\pgfplots@prepare@tick@coordlists@for\pgfplotspointonorientedsurfaceA{#2}% + \pgfplots@drawgridlines@onorientedsurf% + \pgfplots@drawticklines@onorientedsurf% + \pgfplots@drawticklabels@onorientedsurf% + \endgroup +} + +% Computes final major and minor tick positions into global lists +% \pgfplots@prepared@tick@positions@major@x +% and +% \pgfplots@prepared@tick@positions@minor@x. +% +% The major tick list contains tuples (canvas position,logical position) +% while the minor tick list contains just the canvas position. +% +% #1: the axis +% #2: the tick list. +% +% PRECONDITION: +% - \pgfplots@determinedefaultvalues has been executed. +% That means particularly that \pgfplots@[xy][min,max] are available in TeX point +% range (after datascaling and logs). +\def\pgfplots@prepare@tick@coordlists@for#1#2{% + \begingroup + \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname + \expandafter\let\expandafter\ifpgfplots@minorticks\csname ifpgfplots@#1minorticks\endcsname + \expandafter\let\expandafter\ifpgfplots@minorgrids\csname ifpgfplots@#1minorgrids\endcsname + % these lists need to be global such that I can fill them inside + % of \foreach statements. And, yes: I have also added a TeX group + % on my own (but that's not the problem). + \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@major + \global\pgfplotslistnewempty\pgfplots@prepared@tick@positions@minor + \edef\pgfplots@loc@TMPa{#2}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \ifpgfplots@minorticks + \pgfplots@needsminorlooptrue + \else + \ifpgfplots@minorgrids + \pgfplots@needsminorlooptrue + \else + \pgfplots@needsminorloopfalse + \fi + \fi + \ifpgfplots@needsminorloop + \ifpgfplots@islinear + \expandafter\let\expandafter\pgfplots@minor@tick@num\csname pgfplots@minor@#1tick@num\endcsname + \begingroup + \c@pgf@counta=\pgfplots@minor@tick@num\relax + \advance\c@pgf@counta by1\relax + \pgfplots@tmpa=\csname pgfplots@tick@distance@#1\endcsname pt % + \divide\pgfplots@tmpa by\c@pgf@counta + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpa}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgfplots@minor@tick@dist=\pgfmathresult + \else + \def\pgfplots@minor@tick@num{9}% + \fi + \fi + % + % Prepare the [xy]tick[min|max] key processing: + \let\pgfplots@checktickminmax=\pgfutil@empty + \expandafter\ifx\csname pgfplots@#1tickmin\endcsname\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplots@checktickminmax\expandafter{% + \pgfplots@checktickminmax + \ifdim\pgfplots@tmpa<\csname pgfplots@#1tickmin\endcsname pt + \pgfplots@tickshowfalse + \fi + }% + \fi + \expandafter\ifx\csname pgfplots@#1tickmax\endcsname\pgfutil@empty + \else + \expandafter\def\expandafter\pgfplots@checktickminmax\expandafter{% + \pgfplots@checktickminmax + \ifdim\pgfplots@tmpa>\csname pgfplots@#1tickmax\endcsname pt + \pgfplots@tickshowfalse + \fi + }% + \fi + % + % + \foreach \x in {#2} {% + \pgfplots@tmpa=\x pt % + \csname pgfplots@#1tick@check@tickshow\endcsname + \pgfplots@checktickminmax + % + \ifpgfplots@tickshow + \ifdim\pgfplots@tmpa<\csname pgfplots@#1min@reg\endcsname + \else + \ifdim\pgfplots@tmpa>\csname pgfplots@#1max@reg\endcsname + \else + \expandafter\pgfplotslistpushbackglobal\x\to\pgfplots@prepared@tick@positions@major + \fi + \fi + \fi + % X-Axis ticks bottom and top + % in log: + % log( i*10^k ) = log\pgfplots@i + k\log10 -> draw ticks for i=1..9 + \ifpgfplots@needsminorloop + \foreach \pgfplots@i in {1,...,\pgfplots@minor@tick@num} {% + \begingroup + \ifpgfplots@islinear + \pgfplots@tmpa=\pgfplots@minor@tick@dist pt % + \pgfplots@tmpa=\pgfplots@i\pgfplots@tmpa + \else + \pgfplots@tmpa=\logi\pgfplots@i pt % + \fi + \edef\pgfmathresult{\the\pgfplots@tmpa}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \advance\pgfplots@tmpa by\pgfmathresult\relax + \pgfplots@tickshowtrue + \pgfplots@checktickminmax + \ifpgfplots@tickshow + \ifdim\pgfplots@tmpa<\csname pgfplots@#1min@reg\endcsname + \else + \ifdim\pgfplots@tmpa>\csname pgfplots@#1max@reg\endcsname + \else + \edef\pgfmathresult{\pgf@sys@tonumber{\pgfplots@tmpa}}% + \expandafter\pgfplotslistpushbackglobal\pgfmathresult\to\pgfplots@prepared@tick@positions@minor + \fi + \fi + \fi + }% + \fi + }% + \fi + \endgroup + \expandafter\let\csname pgfplots@prepared@tick@positions@minor@#1\endcsname=\pgfplots@prepared@tick@positions@minor + \expandafter\let\csname pgfplots@prepared@tick@positions@major@#1\endcsname=\pgfplots@prepared@tick@positions@major + \global\let\pgfplots@prepared@tick@positions@major=\relax + \global\let\pgfplots@prepared@tick@positions@minor=\relax +}% + +% Draws grid lines at the a-positions of the currently set oriented +% surface. +% +% Tick positions are taken out of the already precomputed list +% \pgfplots@prepared@tick@positions@major@... +% +% See \pgfplots@drawticklines@onorientedsurf@ for a description of the +% oriented surface. +% +% #1 : the verbatim axis name (either 'x' or 'y') +% #2 : the index of the axis (either 0 or 1) +\def\pgfplots@drawgridlines@onorientedsurf{% + \expandafter\pgfplots@drawgridlines@onorientedsurf@\pgfplotspointonorientedsurfaceA +}% +\def\pgfplots@drawgridlines@onorientedsurf@#1{% + \begingroup + \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorgrids\endcsname + \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorgrids\endcsname + % grid lines shall be drawn + % if and only if BOTH adjacent axis lines shall be drawn: + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% + % remark: this is ALWAYS true for 2D plots. + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% + \def\pgfplots@drawgridlines@onorientedsurf@OK{1}% + }{% + \def\pgfplots@drawgridlines@onorientedsurf@OK{0}% + }% + }{% + \def\pgfplots@drawgridlines@onorientedsurf@OK{0}% + }% + \if1\pgfplots@drawgridlines@onorientedsurf@OK + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname + \pgfplots@loop@CONTINUEfalse + \ifpgfplots@major + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@minor + \pgfplots@loop@CONTINUEtrue + \fi + \ifpgfplots@loop@CONTINUE + \scope + \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 + \ifpgfplots@major + \draw[% + /pgfplots/every axis grid, + /pgfplots/every major grid, + /pgfplots/every axis #1 grid, + /pgfplots/every major #1 grid]% + \pgfextra + \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curgridpos{% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% + }% + \endpgfextra; + \fi + % + \ifpgfplots@minor + \draw[% + /pgfplots/every axis grid, + /pgfplots/every minor grid, + /pgfplots/every axis #1 grid, + /pgfplots/every minor #1 grid]% + \pgfextra + \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curgridpos{% + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\pgfplots@curgridpos}{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}}% + }% + \endpgfextra; + \fi + \endscope + \fi + \fi + \endgroup +} + +% Draws ticks on the currently active "oriented surface". +% +% The oriented surface is two dimensional and has been initialised +% with \pgfplotspointonorientedsurfaceabsetupfor*** somehow. +% +% The idea is now the following: +% - the tick positions change along the FIRST coordinate of this +% surface: +% +% x ---- x ---- x ---- x +% --> FIRST --> +% +% - the tick lines are drawn along the SECOND coordinate of this +% surface: +% +% | ---- | ---- | ---- | | SECOND +% | | | | v +% +% for example, +% \pgfplotspointonorientedsurfaceab@setupfor@xyZ{1} +% \pgfplots@drawticklines@onorientedsurf +% will draw ticks at x-positions designated by \pgfplots@xtick. The +% small tick lines will be drawn along the y axis. For each processed +% point, the z coordinate will be fixed to '1'. +% +% Another example: +% \pgfplotspointonorientedsurfaceab@setupfor@yxZ{-1} +% \pgfplots@drawticklines@onorientedsurf +% will draw ticks at y-positions designated by \pgfplots@ytick. The +% small tick lines will be drawn along the x axis. For each processed +% point, the z coordinate will be fixed to '-1'. +% +% Tick positions are taken out of the already precomputed list +% \pgfplots@prepared@tick@positions@major@... +\def\pgfplots@drawticklines@onorientedsurf{% + \expandafter\pgfplots@drawticklines@onorientedsurf@\pgfplotspointonorientedsurfaceA +}% + +% Avoids tick lines which are too thick by introducing a clipping +% region. Tick lines (and grid lines) won't extend to the left or +% right of axis #1. +\def\pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1{% + \pgfinterruptboundingbox% + \begingroup + \pgf@xa=5cm + \edef\pgfplots@loc@TMPc{\pgf@sys@tonumber{\pgf@xa}}% + \pgfmathmultiply@{\pgfplots@loc@TMPc}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@loc@LENGTH=\pgfmathresult + \pgfmathsubtract@{\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname}{\pgfplots@loc@LENGTH}% + \let\pgfplots@loc@MIN=\pgfmathresult + \pgfmathadd@{\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname}{\pgfplots@loc@LENGTH}% + \let\pgfplots@loc@MAX=\pgfmathresult + \pgfpathmoveto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\pgfplots@loc@MIN}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\pgfplots@loc@MIN}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1max\endcsname}{\pgfplots@loc@MAX}}% + \pgfpathlineto{\pgfplotspointonorientedsurfaceab{\csname pgfplots@#1min\endcsname}{\pgfplots@loc@MAX}}% + \pgfusepath{clip}% + \endgroup + \endpgfinterruptboundingbox% +}% + +\def\pgfplots@drawticklines@onorientedsurf@#1{% + \scope + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{% + \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{1}% + }{% + \def\pgfplots@drawticklines@for@placecomputedtick@LOWEROK{0}% + }% + \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{% + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{1}% + }{% + \def\pgfplots@drawticklines@for@placecomputedtick@UPPEROK{0}% + }% + \begingroup + % Assemble the \pgfplots@drawticklines@for@placecomputedtick + % command. + \let\E=\noexpand + \xdef\pgfplots@drawticklines@for@placecomputedtick{% + \if\pgfplots@drawticklines@for@placecomputedtick@LOWEROK1% + \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@a}}% + \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@a}}% + \fi + \if\pgfplots@drawticklines@for@placecomputedtick@UPPEROK1% + \ifnum\csname pgfplots@\pgfplotspointonorientedsurfaceA tickposnum\endcsname=0\relax + \E\pgfpathmoveto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@beg@b}}% + \E\pgfpathlineto{\E\pgfplotspointonorientedsurfaceab{\E\pgfplots@curtickpos}{\E\pgfplots@tick@end@b}}% + \fi + \fi + }% + \endgroup + \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname + \expandafter\let\expandafter\ifpgfplots@minor\csname ifpgfplots@#1minorticks\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@minor@\csname pgfplots@prepared@tick@positions@minor@#1\endcsname + \pgfplots@drawtickgridlines@INSTALLCLIP@onorientedsurf#1 + \ifpgfplots@major + \draw[% + /pgfplots/every tick, + /pgfplots/every major tick, + /pgfplots/every #1 tick, + /pgfplots/every major #1 tick]% + \pgfextra + \pgfmathparse{\pgfplots@tickwidth}% + \let\pgfplots@tickwidth@=\pgfmathresult + \pgfmathmultiply@{\pgfplots@tickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@tickwidth@=\pgfmathresult + \let\pgfplots@tickwidth=\pgfmathresult + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfplots@tick@offset{0}% + \or + \let\pgfplots@tick@offset=\pgfplots@tickwidth@% + \or + \pgfmathmultiply@{0.5}{\pgfplots@tickwidth@}% + \let\pgfplots@tick@offset=\pgfmathresult% + \fi + \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@tickwidth@}% + \pgfplotslistforeach\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% + \pgfplots@drawticklines@for@placecomputedtick + }% + \endpgfextra; + \fi + % + \ifpgfplots@minor + \draw[% + /pgfplots/every tick, + /pgfplots/every minor tick, + /pgfplots/every #1 tick, + /pgfplots/every minor #1 tick]% + \pgfextra + \pgfmathparse{\pgfplots@subtickwidth}% + \let\pgfplots@subtickwidth@=\pgfmathresult + \pgfmathmultiply@{\pgfplots@subtickwidth@}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@subtickwidth@=\pgfmathresult + \let\pgfplots@subtickwidth=\pgfmathresult + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfplots@tick@offset{0}% + \or + \let\pgfplots@tick@offset=\pgfplots@subtickwidth@% + \or + \pgfmathmultiply@{0.5}{\pgfplots@subtickwidth@}% + \let\pgfplots@tick@offset=\pgfmathresult% + \fi + \pgfplots@prepare@tick@offsets@for@{#1}{\pgfplots@subtickwidth@}% + \pgfplotslistforeach\pgfplots@prepared@tick@positions@minor@\as\pgfplots@curtickpos{% + \pgfplots@drawticklines@for@placecomputedtick + }% + \endpgfextra; + \fi + \endscope +} + +% Draws tick labels at the A positions of the currently set oriented +% surface. +% +% Tick positions are taken out of the already precomputed list +% \pgfplots@prepared@tick@positions@major@... +% +% See \pgfplots@drawticklines@onorientedsurf@ for a description of the +% oriented surface. +% +% #1 : the verbatim axis name (either 'x' or 'y') +\def\pgfplots@drawticklabels@onorientedsurf{% + \expandafter\pgfplots@drawticklabels@onorientedsurf@\pgfplotspointonorientedsurfaceA +} +\def\pgfplots@drawticklabels@onorientedsurf@#1{% + \begingroup + \expandafter\let\expandafter\ifpgfplots@major\csname ifpgfplots@#1majorticks\endcsname + \expandafter\let\expandafter\ifpgfplots@islinear\csname ifpgfplots@#1islinear\endcsname + \expandafter\let\expandafter\pgfplots@prepared@tick@positions@major@\csname pgfplots@prepared@tick@positions@major@#1\endcsname + \pgfplotspointonorientedsurfaceabmatchaxisline{\csname pgfplots@#1ticklabelaxisspec\endcsname}{\pgfplots@ticklabelside}% + \ifx\pgfplots@ticklabelside\pgfutil@empty + % SKIP. The current oriented surface shall not get tick labels + % for #1. + \else + \ifpgfplots@major + \ifpgfplots@islinear + \pgfplots@init@scaled@tick@for{#1}% + \fi + \begingroup + \if\pgfplotspointonorientedsurfaceB x + \def\pgfplots@tickposchoicea{\tikzset{right}}% + \def\pgfplots@tickposchoiceb{\tikzset{left}}% + \else + \if\pgfplotspointonorientedsurfaceB y + \def\pgfplots@tickposchoicea{\tikzset{above}}% + \def\pgfplots@tickposchoiceb{\tikzset{below}}% + \else + \def\pgfplots@tickposchoicea{\tikzset{anchor=north east}}% + \def\pgfplots@tickposchoiceb{\tikzset{anchor=south east}}% + \fi + \fi + % + \pgfkeys{/tikz/every node/.append style={/pgfplots/every tick label,/pgfplots/every #1 tick label}}% + \ifcase\csname pgfplots@#1tickalignnum\endcsname\relax + \def\pgfmathresult{0}% + \or + \pgfmathparse{\pgfplots@tickwidth}% + \or + \pgfmathmultiply{0.5}{\pgfplots@tickwidth}% + \fi + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\csname pgfplots@\pgfplotspointonorientedsurfaceB @inverseveclength\endcsname}% + \let\pgfplots@tick@offset=\pgfmathresult + %-------------------------------------------------- + % \ifnum\csname pgfplots@#1ticklabelaxisspec\endcsname=0 + % % the choice '[xy]ticklabel pos=default': + % \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1tickposnum\endcsname + % \else + % \expandafter\let\expandafter\pgfplots@tmpposnum\csname pgfplots@#1ticklabelaxisspec\endcsname + % \fi + % \ifcase\pgfplots@tmpposnum\relax + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + % \or + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + % \or + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname% + % \or + % \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname% + % \fi + %-------------------------------------------------- + \ifnum\csname pgfplots@#1axislinesnum\endcsname=2 % Centered axis lines? + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@logical@ZERO@\pgfplotspointonorientedsurfaceB\endcsname% + % FIXME : that stuff here does not respect + % '[xyz]tickpos num' keys! + \pgfplots@tickposchoiceb + \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \else + \if0\pgfplots@ticklabelside + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + \pgfplots@tickposchoiceb + \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \else + \if1\pgfplots@ticklabelside + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB max\endcsname% + \pgfplots@tickposchoicea + \pgfmathadd@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \else + \pgfplots@error{Internal logic error during tick label placement (got placement character '\pgfplots@ticklabelside'). + Please report this as a bug or verify your input arguments to #1ticklabel pos.}% + \expandafter\let\expandafter\pgfplots@tick@origin\csname pgfplots@\pgfplotspointonorientedsurfaceB min\endcsname% + \pgfplots@tickposchoiceb + \pgfmathsubtract@{\pgfplots@tick@origin}{\pgfplots@tick@offset}% + \fi + \fi + \fi + % + \let\pgfplots@tick@origin=\pgfmathresult% + \def\pgfplots@ticknum{0}% + \xdef\pgfplots@show@ticklabel@LASTTICK{}% + \pgfplotslistforeachungrouped\pgfplots@prepared@tick@positions@major@\as\pgfplots@curtickpos{% + \pgfplots@show@ticklabel + {#1}{\pgfplots@curtickpos}(\pgfplots@curtickpos,\pgfplots@tick@origin)% + {\pgfplots@ticknum}% + \begingroup + \c@pgf@counta=\pgfplots@ticknum\relax + \advance\c@pgf@counta by1 + \edef\pgfplots@ticknum{\the\c@pgf@counta}% + \pgfmath@smuggleone\pgfplots@ticknum + \endgroup + }% + \endgroup + \pgfplots@draw@tick@scale@label@for #1% + \fi + \fi + \endgroup +} + +\newif\ifpgfplots@checkuniform@isfirst +% Checks whether the argument to xtick or ytick is a UNIFORM tick +% sequence. +% +% A uniform tick sequence is 0,...,10 and 3,4,5 and -5,-4,-2 but +% NOT 0,2,4 or 4,10. +% +% Furthermore, any NON-integer tick arguments are also assumed to be +% NOT uniform. +% +% INPUT: +% #1: a tick argument (i.e. something which can be put to +% \foreach \x in {#1}) +% +% OUTPUT: +% \pgfplots@isuniformticktrue +% or +% \pgfplots@isuniformtickfalse +% depending on the check. +% This variable will be set globally. +\def\pgfplots@checkisuniformLOGtick#1{% + \begingroup + \global\pgfplots@isuniformticktrue + \pgfplots@checkuniform@isfirsttrue + \foreach \x in {#1}{% + \pgfmathmultiply@\x\reciproclogten + \let\cur=\pgfmathresult + % check whether + % \cur - last == 1 (last = \pgfplots@glob@TMPb) + \ifpgfplots@checkuniform@isfirst + \global\pgfplots@checkuniform@isfirstfalse + \else + \pgfmathsubtract@\cur\pgfplots@glob@TMPb% + \pgfmathapproxequalto@\pgfmathresult{1.0}% + \ifpgfmathcomparison + \else + \global\pgfplots@isuniformtickfalse + \breakforeach + \fi + \fi + \global\let\pgfplots@glob@TMPb=\cur + }% + \endgroup +} + +% Checks whether the linear tick sequence #1 is a uniform tick. +% +% It also assigns pgfplots@tick@distance@#1 as the distance. +% +% see \pgfplots@checkisuniformLOGtick for details. +% +% #1: a tick sequence (expanded) +% #2: a macro which will be filled with the tick distance. This is +% only valid if \pgfplots@isuniformticktrue. +\def\pgfplots@checkisuniformLINEARtick#1#2{% + \begingroup + \global\pgfplots@isuniformticktrue + \pgfplots@checkuniform@isfirsttrue + \global\let\pgfplots@glob@TMPb=\pgfutil@empty + \global\def\pgfplots@glob@TMPa{1}% + \foreach \x in {#1}{% + \ifx\pgfplots@glob@TMPb\pgfutil@empty + \else + \pgfmathsubtract@\x\pgfplots@glob@TMPb + \ifpgfplots@checkuniform@isfirst + % remember first distance h = x_1 - x_0 + \global\let\pgfplots@glob@TMPa=\pgfmathresult + \global\pgfplots@checkuniform@isfirstfalse + \else + % check whether x_i - x_{i-1} = h + \pgfmathapproxequalto@\pgfmathresult\pgfplots@glob@TMPa% + \ifpgfmathcomparison + \else + \global\pgfplots@isuniformtickfalse + \breakforeach + \fi + \fi + \fi + \global\let\pgfplots@glob@TMPb=\x% + }% + \endgroup + \let#2=\pgfplots@glob@TMPa +} + +% helper method which computes log10*\x foreach \x in {#1}. +% The result will be \xdef'ed into #2. +\def\pgfplots@compute@tick@times@logten#1\to#2{% + \global\let#2=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + \pgfmathmultiply@\pgfplots@loc@TMPb\logten% + \ifx#2\pgfutil@empty + \xdef#2{\pgfmathresult}% + \else + \xdef#2{#2,\pgfmathresult}% + \fi + }% +} + +% Computes tick positions using the current axis limits. +% +% Parameters: +% /pgfplots/max space between ticks +% Determines the maximum space which is not filled by at least one +% tick label (approximate, there is some rounding internally) +% /pgfplots/try min ticks +% see manual +% +% Idea: +% We want ticks at each +% { i*H, i in \Z }. +% Of course, there shouldn't be TOO MUCH ticks. +% +% Our heuristics is to set +% desirednumticks = round(ACTUAL WIDTH / (max space between ticks) ) +% and generate H = (axis range) / (desirednumticks). +% +% Since not all step sizes H look well, restrict H to a set of allowed +% step sizes such as +% { 1, 1/2, 1/5, 1/10 }, +% or, to be more precise: +% { 1*10^e, 2*10^e, 5*10^e } +% -> round to the nearest matching number! +% This yields H (for example as 2*10^e). Then, compute i*H, i \in \Z +% +% The data scaling transformation T(x) makes things more complicated. +% Now, T(x) = q * x - p and we need to check for problems with large +% numbers: +% - q* H = ( T(Max) - T(Min) ) / desirednumticks = q * (Max - Min) / desirednumticks. +% - Using floating point arithmetics, (Max-Min)/desirednumticks (unscaled!) +% is analysed to restrict H to {1*10^e, 2*10^e, 5*10^e}. +% - So, we get q * H (we can't use the 'p' shift of the affine trafo here). +% - The next problem is to compute { I*H, I in \Z } because +% I = trunc( Min / H ) = trunc( ( T(Min) + p ) / (q*H) ). +% This can be seen by Min = I*H + rest and thus T(Min) = I*q*H + q*rest -p. +% The Problem: (T(min)+p ) / (q*H) can be TOO BIG for pgfmath. +% -> for the data scaling case, I will use floating point +% arithmetics to compute that last step. +% I will acquire \pgfplots@[xy]min@unscaled@as@float here. +% +% +% +% +% +% For log-plots, +% H in { j*log(10), j=1,2,3,... } +% where the usual case should be j = 1. +% +% Then, the resulting tick is +% TICK={MIN,MIN+H,...,MAX} +% where +% MIN = I*H +% is chosen such that +% axis minimum limit = I*H + rest; |rest| < H. +% +% Again, log plots follow a slightly different approach: here, +% MIN = I * log(10) +% is chosen such that +% axis minimum limit = I*log(10) + rest; |rest| < log(10) +% while H = j*log(10), j>=1. +% +% +% PRECONDITION: +% - limits are correct +% - axis width/height is set correctly +% +% POSTCONDITION: +% - Tick for axis #1 is assigned +% - \ifpgfplots@determinedefaultvalues@needs@check@uniformtick is set +% +% REMARKS: +% - this algorithms works also if the data range has been transformed +% with a LINEAR transformation. +% ATTENTION: as of 2008-05-15, the scaling trafo is AFFINE LINEAR. +% That means we have to eliminate the 'affine' shifting before the +% algorithms works correctly. +\def\pgfplots@assign@default@tick@foraxis#1{% + \begingroup + % Shortcut-names: + \expandafter\let\expandafter\ifpgfplots@is@datascaled\csname ifpgfplots@apply@datatrafo@#1\endcsname + % Attention here: use UNSHIFTET scalings, see remark above + \expandafter\let\expandafter\pgfplots@data@scale@trafo\csname pgfplots@datascaletrafo@#1@noshift\endcsname + \expandafter\let\expandafter\pgfplots@data@scale@inverse@trafo\csname pgfplots@inverse@datascaletrafo@#1@noshift\endcsname + \expandafter\let\expandafter\ifpgfplots@cur@is@linear\csname ifpgfplots@#1islinear\endcsname + % + \let\desirednumticks=\c@pgf@countd + \let\Wr=\pgf@xc + \Wr=\csname pgfplotspoint#1axislength\endcsname + % r = max place without ticks in pt -> choose desirednumticks >= W/r + \expandafter\expandafter\divide\Wr\axisdefaulttickwidth + \pgfmathsetcount{\desirednumticks}{\Wr}% + \advance\desirednumticks by1 + \csname ifpgfplots@#1islinear\endcsname + \expandafter\ifnum\axisdefaulttryminticks>\desirednumticks + \desirednumticks=\axisdefaulttryminticks + \fi + \else + \expandafter\ifnum\pgfplots@default@try@minticks@log>\desirednumticks + \desirednumticks=\pgfplots@default@try@minticks@log\relax + \fi + \expandafter\ifx\csname pgfplots@#1tickten\endcsname\pgfutil@empty + \else + % log plot and tickten-option: provide special processing. + \edef\pgfplots@loc@TMPa{\csname pgfplots@#1tickten\endcsname}% + \expandafter\pgfplots@compute@tick@times@logten\pgfplots@loc@TMPa\to\pgfplots@glob@TMPa + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa + \fi + \fi + % + \expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty + % Ok, we have either log or linear axis and need default + % ticks MIN,MIN+H,...,MAX. + \let\MINH=\pgf@xa + \let\H=\pgf@xb + \let\MAX=\pgf@ya + \let\MIN=\pgf@yb + % compute step size 'H': + \expandafter\MAX\csname pgfplots@#1max\endcsname pt + \advance\MAX by0.001pt % avoid round errors + %\expandafter\MIN\the\c@pgf@counta pt + \expandafter\MIN\csname pgfplots@#1min\endcsname pt + \H=\MAX + \advance\H by-\MIN +%\message{Axis limit #1: [\the\MIN:\the\MAX], diff = \the\H.}% + \c@pgf@counta=\desirednumticks + \advance\c@pgf@counta by-1 + \divide\H by\c@pgf@counta +%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% + % + % SEARCH for the NEXT FEASABLE H. + \edef\Hmacro{\pgf@sys@tonumber\H}% + \ifpgfplots@cur@is@linear + % CASE LINEAR AXIS + \ifpgfplots@is@datascaled + % This here works if the scaling trafo is linear. + \expandafter\pgfplots@data@scale@inverse@trafo\expandafter{\Hmacro}% + \let\Hmacro=\pgfmathresult + \else + \pgfmathfloatparsenumber{\Hmacro}% + \let\Hmacro=\pgfmathresult + \fi + \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E +%\message{Got T^{-1}(H#1) = \Hmacro}% + % modify the mantisse: + \ifdim\H<2pt + \ifdim\H<1.5pt + \H=1.0pt + \else + \H=2.0pt + \fi + \else + \ifdim\H<4.9999pt + \ifdim\H<3.5pt + \H=2.0pt\relax + \else + \H=5.0pt\relax + \fi + \else + \ifdim\H<7.5pt + \H=5.0pt\relax + \else + \H=1.0pt\relax + \advance\pgfmathfloat@a@E by1 + \fi + \fi + \fi + \aftergroup\pgfplots@isuniformticktrue + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% + \let\Hmacro=\pgfmathresult + % The following code is carried out in floating point + % arithmetics because it requires large data ranges. + % + % I want to compute MIN@new := I*H where I is chosen + % such that MIN = I*H + rest with rest < H. + % The problem is the possibly large range of MIN. I + % can't work completely in the transformed datarange, + % so numbers get too large. + % + % So, compute I := int( MIN / H ) (integer truncation) + % in float arithmetics and then MIN@new := I*H + \pgfmathfloatdivide@{\csname pgfplots@#1min@unscaled@as@float\endcsname}{\Hmacro}% + \pgfmathfloatint@{\pgfmathresult}% + \pgfmathfloatmultiply@{\pgfmathresult}{\Hmacro}% + \let\MIN@new=\pgfmathresult + % Ok, we are ready. + % Now, convert everything into the fixed point data + % range: + \ifpgfplots@is@datascaled + \csname pgfplots@datascaletrafo@#1\endcsname{\MIN@new}% + \MIN=\pgfmathresult pt + \pgfplots@data@scale@trafo\Hmacro + \H=\pgfmathresult pt + \else + \pgfmathfloattofixed\MIN@new + \MIN=\pgfmathresult pt + \pgfmathfloattofixed\Hmacro + \H=\pgfmathresult pt + \fi + % + % And, since we have used finite precision, I is most + % likely to large. So: subtract one H. In the worst + % case, this produces one tick position too much (but + % it won't be printed). + \advance\MIN by-\H + \else + % CASE LOG AXIS + % + % search for the "best" H= j* log(10), j an integer. + % + % And prefer j=1 if that is possible (otherwise minor + % ticks are not useful). + \pgfmathmultiply@{\Hmacro}{\reciproclogten}% + \let\Hmacrobaseten=\pgfmathresult + \expandafter\H\pgfmathresult pt +%\message{ [ H / log(10) = \pgfmathresult ]}% + \ifdim\H<2pt + \H=1pt + \else + \ifnum\H<1pt + \H=1pt + \else + \expandafter\pgfmathfloor\expandafter{\pgfmathresult}% + \expandafter\H\pgfmathresult pt + \fi + \fi + \ifdim\H=1pt + \aftergroup\pgfplots@isuniformticktrue + \pgfplots@isuniformticktrue + \else + \aftergroup\pgfplots@isuniformtickfalse + \pgfplots@isuniformtickfalse + \fi +%\message{final H=\pgf@sys@tonumber{\H} * log(10)}% + \H=\logten\H\relax + % Now, we want to activate the Tick set + % {lowest, lowest+H, ..., highest} + % + % Where + % lowest = I * log(10) + rest, |rest| < log(10). + % this is conceptionally different from the approach for + % linear axes, because H = j*log(10). + % + % remember the original xmin in MINH: + \MINH=\MIN + % + % and compute I and I*log(10) here: + \expandafter\MIN\reciproclogten\MIN\relax + \edef\pgfmathresult{\pgf@sys@tonumber{\MIN}}% + \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% + \ifdim\MIN<0pt + % the truncation rounds TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \expandafter\MIN\logten pt + \multiply\MIN by\c@pgf@counta + \ifpgfplots@isuniformtick + \else + % This here is a special case to move the first tick + % near the lower axis limit. + % + % "Near" means either directly above or directly below ymin. + % + % My application example is as follows: + % Let H = 2*log(10). + % Furthermore, ymin = 3e-6, ymax= 8e-2. That means we can choose either + % 10^{-5}, 10^{-3}, 10^{-1} + % or + % 10^{-4}, 10^{-2} + % as ticks. Well, I prefer the first one. + % + % HEURISTICS: start as near to ymin as possible! + % + % We check here if we can come nearer to ymin if we + % shift the current tick by log(10): + % if( ymin - I * log(10) < 0.5*H -> use I+1, that means add log(10). + % + % that's equivalent to + % 2*(ymin - I * log(10)) - H < 0. + \advance\MINH by-\MIN + \multiply\MINH by2 + \advance\MINH by-\H + % + \ifdim\MINH<0pt + \expandafter\advance\expandafter\MIN\logten pt + \fi + \fi + \fi + \MINH=\MIN + \advance\MINH by\H + % Ok, now it can happen that only ONE tick label is placed in + % this range. + % That's useless, so check for it. + % + % That's the case if + % MIN < ORIGMIN && MAX < MIN+2 H + % MIN < ORIGMIN by construction (ok, MIN <= ORIGMIN by + % construction, but I don't care about this case). + % So: check only the second condition. + \pgfplots@tmpa=\MINH + \advance\pgfplots@tmpa by\H + \ifdim\MAX<\pgfplots@tmpa + \aftergroup\pgfplots@isuniformtickfalse + % ok, do something special. + % + % The idea is now to place ticks at + % 10^{i*h} with properly choosen 'h'. + % + % So: apply basically the SAME code as above for linear + % axis, just everything log 10! And keep in mind that all + % coordinates are actually given as natural logarithms. + \expandafter\MIN\csname pgfplots@#1min\endcsname pt + \H=\MAX + \advance\H by-\MIN + \H=\reciproclogten\H +%\message{Axis limit #1: [\the\MIN:\the\MAX], diff/log(10) = \the\H.}% + \c@pgf@counta=\desirednumticks\relax + \advance\c@pgf@counta by-1 + \ifnum\c@pgf@counta>2 + % subtract one more. This algorithm here produces more + % ticks than the normal one which is designed for 10^i + \advance\c@pgf@counta by-1 + \fi + \divide\H by\c@pgf@counta\relax +%\message{determining ticks for #1-axis: Wr := (width/max space between ticks) = \the\Wr, desirednumticks=max(\axisdefaulttryminticks, trunc(Wr)) = \the\desirednumticks, H#1=(axis range/(desirednumticks-1)) = \the\H}% + % + % SEARCH for the NEXT FEASABLE H. + \edef\Hmacro{\pgf@sys@tonumber\H}% + \pgfmathfloatparsenumber{\Hmacro}% + \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\H\pgfmathfloat@a@E + % Determine properly snapped mantisse... + \ifdim\H<2pt + \ifdim\H<1.5pt + \H=1.0pt + \else + \H=2.0pt + \fi + \else + \ifdim\H<4.9999pt + \ifdim\H<3.5pt + \H=2.0pt\relax + \else + \H=5.0pt\relax + \fi + \else + \ifdim\H<7.5pt + \H=5.0pt\relax + \else + \H=1.0pt\relax + \advance\pgfmathfloat@a@E by1 + \fi + \fi + \fi + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgf@sys@tonumber{\H}}{\the\pgfmathfloat@a@E}% + \expandafter\pgfmathfloattofixed\expandafter{\pgfmathresult}% + \let\Hmacro=\pgfmathresult + \H=\Hmacro pt % + % Ok, our step size h for 10^{i*h} is ready! +%\message{determined step size 10^{\Hmacro}}% + % Now, we want to activate the Tick set {10^{i*H}, i in \Z} + % compute I such that + % 10^{min} = 10^{I * H + rest}; |rest| < H + % -> I = round(xmin/H) + % -> MIN = I * H + % BUT EVERYTHING to log(10) basis! + \MIN=\reciproclogten\MIN\relax + \pgfmathlog@invoke@expanded\pgfmathdivide@{% + {\pgf@sys@tonumber\MIN}% + {\Hmacro}% + }% + \pgfmathsetcount{\c@pgf@counta}{\pgfmathresult}% + \ifdim\MIN<0pt + % the truncation rounds TOWARDS 0 which is not what I want. + \advance\c@pgf@counta by-1 + \fi + \MIN=\H\relax + \multiply\MIN by\c@pgf@counta\relax + % + % convert back to basis 'e': + \MIN=\logten\MIN\relax + \H=\logten\H\relax + \MINH=\MIN\relax + \advance\MINH by\H\relax + \fi +%\pgfplots@message{final H=\the\H.}% + \xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\MIN},\pgf@sys@tonumber{\MINH},...,\pgf@sys@tonumber{\MAX}}% + \xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\H}}% + \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformtickfalse + \else + \expandafter\global\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfplots@#1tick\endcsname + \gdef\pgfplots@glob@TMPb{}% will be computed later, in 'check uniform tick' + \aftergroup\pgfplots@determinedefaultvalues@needs@check@uniformticktrue + \fi + \endgroup + \expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplots@glob@TMPa + \expandafter\let\csname pgfplots@tick@distance@#1\endcsname=\pgfplots@glob@TMPb +%\pgfplots@message{pgfplots.sty: #1tick set to \csname pgfplots@#1tick\endcsname [#1min=\csname pgfplots@#1min\endcsname, #1max=\csname pgfplots@#1max\endcsname].}% +} + +% Helper method for +% \pgfplots@apply@data@scale@trafo@to@options@for +% #1: the ticks +% #2: the trafo macro name +% #3: the output macro name +\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks#1#2\to#3{% + \let#3=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + \pgfmathfloatparsenumber{\pgfplots@loc@TMPb}% + \expandafter#2\expandafter{\pgfmathresult}% + \ifx#3\pgfutil@empty + \xdef#3{\pgfmathresult}% + \else + \xdef#3{#3,\pgfmathresult}% + \fi + }% + % +}% + +% Helper method for +% \pgfplots@apply@data@scale@trafo@to@options@for +% #1: the ticks ALREADY IN FLOAT FORMAT +% #2: the trafo macro name +% #3: the output macro name +\long\def\pgfplots@apply@data@scale@trafo@to@user@ticks@isfloat#1#2\to#3{% + \let#3=\pgfutil@empty + \foreach \pgfplots@loc@TMPb in {#1} {% + #2{\pgfplots@loc@TMPb}% + \ifx#3\pgfutil@empty + \xdef#3{\pgfmathresult}% + \else + \xdef#3{#3,\pgfmathresult}% + \fi + }% + % +}% diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex new file mode 100644 index 00000000000..077ca23c946 --- /dev/null +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotscolormap.code.tex @@ -0,0 +1,326 @@ +%-------------------------------------------- +% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/util/pgfplotscolormap.code.tex,v 1.8 2008/11/30 22:59:31 ludewich Exp $ +% +% Package pgfplots +% +% Provides a user-friendly interface to create function plots (normal +% plots, semi-logplots and double-logplots). +% +% It is based on Till Tantau's PGF package. +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +% This package relies on pgfplots temporary registers and its array +% data structure. + + +% Creates a new colormap. +% +% #1 : the name of the color map as string (not as macro). +% #2 : a <color specification> as is expected for a colormap. +% +% Example: \pgfplots@createcolormap{my map}{rgb(0cm)=(1,0,0); rgb(1cm)=(0,1,0); rgb(2cm)=(0,0,1); gray(3cm)=(3); color(4cm)=(green); } +\def\pgfplotscreatecolormap#{% + \pgfplots@createcolormap +} +\def\pgfplots@createcolormap#1#2{% + \edef\pgfplots@createcolormap@name{pgfpl@cm@#1}% + \expandafter\pgfplotsarraynewempty\expandafter{\pgfplots@createcolormap@name}% + \def\pgfplots@createcolormap@MIN{0}% NORMALIZATION: assume that lower-end is 0pt. + \let\pgfplots@createcolormap@H=\pgfutil@empty + \def\pgfplots@createcolormap@MAX{0}% To be computed. + \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MIN + % PARSE IT: + \pgfplots@createcolormap@#2] + \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% + % sanity checking: + \expandafter\pgfplotsarraysizetomacro\expandafter{\pgfplots@createcolormap@name}\to\pgfplots@loc@TMPa + \ifcase\pgfplots@loc@TMPa\relax + \pgfplots@error{Sorry, you need to provide at least the two end points of a colormap.}% + \or + \pgfplots@error{Sorry, you need to provide at least the two end points of a colormap.}% + \fi + % Map the input range [0pt,MAX] linearly to [0,1000] + \pgfmathdivide@{\pgfplotscolormaprange}{\pgfplots@createcolormap@MAX}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfmathmultiply@{\pgfplots@loc@TMPb}{\pgfplots@createcolormap@H}% + \let\pgfplots@createcolormap@H=\pgfmathresult + \expandafter\let\csname\pgfplots@createcolormap@name @h\endcsname=\pgfplots@createcolormap@H + \pgfmathreciprocal@{\pgfplots@createcolormap@H}% + \expandafter\let\csname\pgfplots@createcolormap@name @invh\endcsname=\pgfmathresult +%\pgfplots@colormap@showdebuginfofor{#1}% +} +\def\pgfplots@createcolormap@{% + \pgfutil@ifnextchar]{\pgfutil@gobble}%done! + {% + \pgfutil@ifnextchar;{\pgfplots@createcolormap@grabsemicolon}% + {% + \pgfutil@ifnextchar r{\pgfplots@createcolormap@grabrgb}% + {% + \pgfutil@ifnextchar g{\pgfplots@createcolormap@grabgray}% + {% + \pgfutil@ifnextchar c{\pgfplots@createcolormap@grabcolor}% + { + \expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}% + {\pgfplots@error{Illformed colormap specification}}% + }% + }% + }% + }% + }% +} +\def\pgfplots@createcolormap@grabsemicolon;{\pgfplots@createcolormap@}% + +{ + \catcode`\;=\active + \gdef\pgfplots@createcolormap@grabsemicolon@active;{\pgfplots@createcolormap@}% +} + +\def\pgfplots@createcolormap@grabrgb rgb(#1)=(#2,#3,#4){% + \pgfplots@createcolormap@nextRGB{#1}{#2}{#3}{#4}% + \pgfplots@createcolormap@} +\def\pgfplots@createcolormap@grabgray gray(#1)=(#2){% + \pgfplots@createcolormap@nextRGB{#1}{#2}{#2}{#2}% + \pgfplots@createcolormap@} +\def\pgfplots@createcolormap@grabcolor color(#1)=(#2){% + \pgfutil@colorlet{pgf@tempcol}{#2}% + \pgfutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}% + \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \expandafter\pgfplots@createcolormap@grabcolor@\pgf@rgbcolor\relax{#1}}% +\def\pgfplots@createcolormap@grabcolor@#1,#2,#3\relax#4{% + \pgfplots@createcolormap@nextRGB{#4}{#1}{#2}{#3}% + \pgfplots@createcolormap@} +\def\pgfplots@createcolormap@rgbrangeexception#1#2#3{% + \pgfplots@error{Sorry, RGB[#1,#2,#3] is not supported. The allowed range is 0 <= r,g,b <= 1.}% +}% +% Ok, we parsed the next single spec. +% #1: the width +% #2,#3,#4 RGB values. +\def\pgfplots@createcolormap@nextRGB#1#2#3#4{% + \ifdim#2pt<0pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#3pt<0pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#4pt<0pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#2pt>1pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#3pt>1pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + \ifdim#4pt>1pt + \pgfplots@createcolormap@rgbrangeexception{#2}{#3}{#4}% + \fi + % Process 'h': + \pgfmathparse{#1}% + \let\pgfplots@createcolormap@MAX=\pgfmathresult + \expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@createcolormap@LAST}% + \let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MAX + \let\pgfplots@createcolormap@H@cur=\pgfmathresult +%\message{found current diff = \pgfplots@createcolormap@H@cur\ ( from #1 - \pgfplots@createcolormap@LAST pt)}% + \ifx\pgfplots@createcolormap@H\pgfutil@empty + \expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}% + \ifpgfplotsarrayempty + \ifdim\pgfplots@createcolormap@MAX pt=0pt + \else + \pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt.}% + \def\pgfplots@createcolormap@MAX{0}% + \fi + \else + \let\pgfplots@createcolormap@H=\pgfplots@createcolormap@H@cur +%\message{H := \pgfplots@createcolormap@H( from #1).}% + \fi + \else + \pgfmathapproxequalto@{\pgfplots@createcolormap@H}{\pgfplots@createcolormap@H@cur}% + \ifpgfmathcomparison + \else + \pgfplots@error{Sorry, non-uniform colormaps are not yet implemented. Please maintain a uniform distance before offset #1 (in this case, I expected h = \pgfplots@createcolormap@H pt).}% + \fi + \fi + % + % Append values: + \def\pgfplots@loc@TMPa{\pgfplotsarraypushback{#2,#3,#4}\to}% + \expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}% +}% + +% Shows debug info about colormap #1 into the console. +\def\pgfplots@colormap@showdebuginfofor#1{% + \message{Debug info for color map '#1':}% + \message{(Transformed) Range: [0:\pgfplotscolormaprange]; }% + \message{H: \csname pgfpl@cm@#1@h\endcsname; }% + \message{H:^{-1}: \csname pgfpl@cm@#1@invh\endcsname; }% + \pgfplotsarraysizetomacro{pgfpl@cm@#1}\to\pgfplots@loc@TMPa + \message{Size: \pgfplots@loc@TMPa; }% + \message{RGB Values: }% + \begingroup + \c@pgf@counta=0 + \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{% + \message{\#\the\c@pgf@counta: \elem; }% + \advance\c@pgf@counta by1 + }% + \endgroup +} + +% Convert a colormap into a PGF shading's color specification for use +% in \pgfdeclare*shading. +% +% #1: the colormap's name. +% #2: the PGF "size" of the shading. It is used to set the right end +% of the color specification. +% #3: a macro which will be filled with the result. +% +% Example: +% \pgfplotscolormaptoshadingspec{my colormap}{4cm}{\output} +% \def\tempb{\pgfdeclarehorizontalshading{myshadingA}{1cm}} +% \expandafter\tempb\expandafter{\temp} +% +% \pgfuseshading{myshadingA} +\def\pgfplotscolormaptoshadingspec#1#2#3{% + \begingroup + \pgfmathparse{#2}% + \expandafter\pgfmathdivide@\expandafter{\pgfmathresult}{\pgfplotscolormaprange}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfmathmultiply@{\csname pgfpl@cm@#1@h\endcsname}{\pgfplots@loc@TMPb}% + \pgf@ya=\pgfmathresult pt + \c@pgf@counta=0 + \let#3=\pgfutil@empty + \pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\pgfplots@loc@TMPa{% + \ifnum\c@pgf@counta=0 + \edef\pgfplots@loc@TMPc{rgb(0pt)=(\pgfplots@loc@TMPa)}% + \else + \pgf@yb=\c@pgf@counta\pgf@ya + \edef\pgfplots@loc@TMPc{rgb(\the\pgf@yb)=(\pgfplots@loc@TMPa)}% + \fi + \ifx#3\pgfutil@empty + \t@pgfplots@toka={}% + \else + \t@pgfplots@toka=\expandafter{#3; }% + \fi + \t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPc}% + \edef#3{\the\t@pgfplots@toka \the\t@pgfplots@tokb }% + \advance\c@pgf@counta by1 + }% + \pgfmath@smuggleone#3% + \endgroup +}% + + +% Expands to the transformed range's right end of every colormap. The left +% end is fixed to '0'. +\def\pgfplotscolormaprange{1000} + +% Linearly maps the number #4 into the colormap #5 and returns the interpolated RGB triple +% into \pgfmathresult. +% +% [#1:#2] the number range of the data source. This is required to +% map into the colormap. +% [#3] (optional) the quantity +% s := \pgfplotscolormaprange / (#2-#1). +% Precomputing this quantity may save a lot of time because +% divisions are expensive in TeX. You can omit [#3] or +% provide an empty string here. +% #4 the number to map. +% #5 the colormap's name. Must be defined with +% \pgfplotscreatecolormap before. +% +% Example: +% \pgfplotscolormapfind[-1:1]{0.2}{my colormap} +\def\pgfplotscolormapfind[#1:#2]{% + \pgfutil@ifnextchar[{% + \pgfplotscolormapfind@precomputed[#1:#2]% + }{% + \pgfplotscolormapfind@precomputed[#1:#2][]% + }% +}% +\def\pgfplotscolormapfind@precomputed[#1:#2][#3]#4#5{% + \begingroup + % Step 0: compute #3 if it is missing and write it into + % \pgfplots@loc@TMPa. + \def\pgfplots@loc@TMPa{#3}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \pgfmathsubtract@{#2}{#1}% + \let\pgfplots@loc@TMPb=\pgfmathresult + \pgfmathdivide@{\pgfplotscolormaprange}{\pgfplots@loc@TMPb}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \fi +%\message{mapping '#4' into colormap '#5' ... }% + % Step 1: perform lookup. Map #4 into the colormap's range + % using the linear trafo + % phi(#4) = ( #4 - #1 ) / (#2-#1) * colormaprange(#5). + % This, determine the INTERVAL number into which #4 falls. + \pgfmathsubtract@{#4}{#1}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplots@loc@TMPa}% + \let\pgfplotscolormapfind@transformedx=\pgfmathresult + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\csname pgfpl@cm@#5@invh\endcsname}% + \let\pgfplotscolormapfind@transformedx@divh=\pgfmathresult + \expandafter\pgfmathfloor@\expandafter{\pgfmathresult}% + % assign \pgfplotscolormapfind@intervalno := \pgfmathresult + % without '.0' suffix: + \def\pgfplots@discardperiod##1.##2\relax{\def\pgfplotscolormapfind@intervalno{##1}}% + \expandafter\pgfplots@discardperiod\pgfmathresult\relax +%\message{mapping [#1,#2] -> [0,\pgfplotscolormaprange] yielded phi(#4) = \pgfplotscolormapfind@transformedx, situated in interval no \pgfplotscolormapfind@intervalno.}% + % Step 2: interpolate the desired RGB value using vector valued + % interpolation on the identified interval. + \c@pgf@counta=\pgfplotscolormapfind@intervalno\relax + \pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#5}\to\pgfplotscolormapfind@rgb@LEFT + \advance\c@pgf@counta by1 + \pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#5}\to\pgfplotscolormapfind@rgb@RIGHT +%\message{After lookup: the corresponding RGB interval boundaries are [\pgfplotscolormapfind@rgb@LEFT: \pgfplotscolormapfind@rgb@RIGHT].}% + \edef\pgfplots@loc@TMPa{\pgfplotscolormapfind@rgb@LEFT:\pgfplotscolormapfind@rgb@RIGHT}% + \expandafter\pgfplotscolormapfind@interpolate\pgfplots@loc@TMPa\relax + \pgfmath@smuggleone\pgfmathresult + \endgroup +%\message{-> got finally mapping(#4, #5) = RGB'\pgfmathresult'.}% +}% + +% internal helper method which computes +% +% color^m(x) = ( x/h - i ) * ( c_{i+1}^m - c_{i}^m ) + c_i^m +% for each m in {red,green,blue} and defines \pgfmathresult to be +% 'R,G,B' , the single results. +\def\pgfplotscolormapfind@interpolate#1,#2,#3:#4,#5,#6\relax{% + % R: + \pgfmathsubtract@{#4}{#1}% + \let\pgfplotscolormapfind@Cdiff=\pgfmathresult + \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}% + \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#1}% + \let\RED=\pgfmathresult + % G: + \pgfmathsubtract@{#5}{#2}% + \let\pgfplotscolormapfind@Cdiff=\pgfmathresult + \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}% + \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#2}% + \let\GREEN=\pgfmathresult + % B: + \pgfmathsubtract@{#6}{#3}% + \let\pgfplotscolormapfind@Cdiff=\pgfmathresult + \pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}% + \expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplotscolormapfind@Cdiff}% + \expandafter\pgfmathadd@\expandafter{\pgfmathresult}{#3}% + \let\BLUE=\pgfmathresult + \edef\pgfmathresult{\RED,\GREEN,\BLUE}% +}% + + +\pgfplotscreatecolormap{hot}{color(0cm)=(blue); color(1cm)=(yellow); color(2cm)=(orange); color(3cm)=(red)} diff --git a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex index e3094554af6..781f5e4937d 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/util/pgfplotsutil.code.tex @@ -24,29 +24,11 @@ % %-------------------------------------------- -\def\pgfplots@EOI{\pgfplots@EOI}% - -\newtoks\t@pgfplots@toka -\newtoks\t@pgfplots@tokb -\newtoks\t@pgfplots@tokc -\newdimen\pgfplots@tmpa - -% use these macros for GLOBAL temporary assignments. -% you can NEVER rely on their values unless you know exactly what you are doing. -\gdef\pgfplots@glob@TMPa{}% -\gdef\pgfplots@glob@TMPb{}% -\gdef\pgfplots@glob@TMPc{}% - -% use these macros for LOCAL temporary assigments. -% you can NEVER rely on their values unless you know exactly what you are doing. -\def\pgfplots@loc@TMPa{}% -\def\pgfplots@loc@TMPb{}% -\def\pgfplots@loc@TMPc{}% - -\input pgfplotsliststructure.code.tex -\input pgfplotsliststructureext.code.tex -\input pgfplotsarray.code.tex -\input pgfplotstable.code.tex +\newif\ifpgfplots@usefpu +\pgfkeys{% + /pgfplots/use fpu/.is if=pgfplots@usefpu, + /pgfplots/use fpu=true, +} % Produces an \aftergroup statement for each single token in #1. % @@ -105,10 +87,18 @@ \fi }% -\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}% -\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning: #1}}% -\def\pgfplots@message#1{% - \immediate\write16{#1}% +% Issues an error message if the **LaTeX** package '#1' is not loaded +% (An error is also raised if the document is not a LaTeX document). +% #1: the required LaTeX package +% #2: the feature which requires this package +\def\pgfplots@assert@LaTeX@package@loaded#1#2{% + \pgfutil@ifundefined{@ifpackageloaded}{% + \pgfplots@error{Sorry, #2 only works with LaTeX (it relies on the LaTeX package #1)}% + }{% + \pgfutil@ifundefined{ver@#1.sty}% this here has been extracted from ltclass.dtx. \@ifpackageloaded is only usable in preamble. + {\pgfplots@error{Sorry, use need \string\usepackage{#1} in your preamble for '#2'}}% + {\relax}% + }% }% \def\pgfplots@assert@tikzinternal@exists#1{% \pgfutil@ifundefined{#1}{% @@ -192,6 +182,11 @@ \def#2{#1}% }% +{ +\catcode`\%=12 +\gdef\pgfplots@PERCENT@TEXT{%} +} + % Usage: % \pgfplots@if{pgfplots@scaled@ticks}{true-code}{false-code} % @@ -204,3 +199,446 @@ #3% \fi }% + +\def\pgfplotsmathmin#1#2{% + \ifdim#1 pt<#2 pt + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +}% +\def\pgfplotsmathmax#1#2{% + \ifdim#1 pt>#2 pt + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +}% +\def\pgfplotsmathlessthan#1#2{\ifdim#1 pt<#2 pt \pgfmathfloatcomparisontrue\else\pgfmathfloatcomparisonfalse\fi} + +% Re-define two-argument function for min and max. +% The pgfmath engine now uses a variable number of arguments. +\def\pgfplotsmathfloatmax#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#2}% + \else + \edef\pgfmathresult{#1}% + \fi +} +\def\pgfplotsmathfloatmin#1#2{% + \pgfmathfloatlessthan{#1}{#2}% + \ifpgfmathfloatcomparison + \edef\pgfmathresult{#1}% + \else + \edef\pgfmathresult{#2}% + \fi +} + +% Defines \pgfmathresult to be #1 * 10^{#2}. +% +% #1 a macro without unit suffix. +% #2 an integer number (may be a register) +\def\pgfplotsmathmultiplypowten@#1#2{% + \begingroup + \pgf@xa=#1pt + \ifnum#2<0 + \ifcase-#2 + \or\divide\pgf@xa by10 + \or\divide\pgf@xa by100 + \or\divide\pgf@xa by1000 + \or\divide\pgf@xa by10000 + \or\divide\pgf@xa by100000 + \fi + \else + \ifcase#2 + \or\multiply\pgf@xa by10 + \or\multiply\pgf@xa by100 + \or\multiply\pgf@xa by1000 + \or\multiply\pgf@xa by10000 + \or\multiply\pgf@xa by100000 + \fi + \fi + \edef\pgfmathresult{\pgf@sys@tonumber{\pgf@xa}}% + \pgfmath@smuggleone\pgfmathresult + \endgroup +}% + + +% converts a comma-separated list (PGF foreach) to my internal list +% structure. +\long\def\pgfplots@foreach@to@list#1\to#2{% + \global\pgfplotslistnewempty\pgfplots@glob@TMPa + \begingroup + \foreach \pgfplots@i in {#1} {% + \expandafter\pgfplotslistpushbackglobal\pgfplots@i\to\pgfplots@glob@TMPa + }% + \endgroup + \pgfplotslistcopy\pgfplots@glob@TMPa\to#2\relax +} + +% Simply invokes the code of PGF key #1 with value #2, that means +% #1#2\pgfeov +\def\pgfplots@invoke@pgfkeyscode#1#2{% + \pgfkeysgetvalue{#1}\pgfplots@invoke@pgfkeyscode@CODE + \pgfplots@invoke@pgfkeyscode@CODE#2\pgfeov +} + + +% Usage: +% \pgfplots@letcsname pgfplots@xtick={pgfplots@kram@x} +% -> invokes \csname ... \endcsname for both args. +\def\pgfplots@letcsname#1=#2{% + \expandafter\let\expandafter\pgfplots@loc@TMPc\csname #2\endcsname + \expandafter\let\csname #1\endcsname=\pgfplots@loc@TMPc +}% + +% I have introduced this macro to allow optimizations of (x,y) +% coordinate processing. Use it for everything which is directly plot +% related. +% +% @see \pgfplotsqpointxy@orthogonal +\let\pgfplotsqpointxy=\pgfqpointxy +\let\pgfplotsqpointxyz=\pgfqpointxyz + +% A "quick" quick variant of \pgfqpointxy which assumes that +% the X unit vector is ( e_xx,0 )^T and the Y unit vector is ( 0, +% e_yy)^T. +% +% In words, the unit vectors are orthogonal. This is the usual case +% for two-dimensional plots and shall be optimized. +\def\pgfplotsqpointxy@orthogonal#1#2{% + \pgf@x=#1\pgf@xx% + \pgf@y=#2\pgf@yy} + + +% Takes a domain as input and generates a foreach argument which +% samples from the domain. +% Writes the result to \pgfplotslocretval +% INPUT: +% #1:#2 the domain +% /pgfplots/samples the number of samples +% OUTPUT: +% \pgfplotslocretval a foreach specification. +\def\pgfplots@domain@to@foreach#1:#2\relax{% + \pgfmathparse{#1}% + \let\pgfplots@loc@TMPa=\pgfmathresult% + \pgfmathparse{#2}% + \let\pgfplots@loc@TMPb=\pgfmathresult% + \pgfmathparse{\pgfplots@loc@TMPa+(\pgfplots@loc@TMPb-\pgfplots@loc@TMPa)/(\pgfkeysvalueof{/pgfplots/samples}-1)}% + \edef\pgfplotslocretval{\pgfplots@loc@TMPa,\pgfmathresult,...,\pgfplots@loc@TMPb}% +} + +{ + \catcode`\;=\active + \catcode`\:=\active + \gdef\pgfplots@activesemicolon{;}% + \gdef\pgfplots@activecolon{:}% +} + +% checks whether ';' is active and replaces a sequence of commands +% accordingly. +% +% @see \pgfplots@appendto@activesemicolon@switcher +\def\pgfplots@checkandpreparefor@active@semicolon{% + \ifnum\the\catcode`\;=\active\relax + \pgfplots@checkandpreparefor@active@semicolon@ + \fi +}% +\def\pgfplots@checkandpreparefor@active@semicolon@{}% + +% Adds all commands '#1' to the sequence of commands which will be +% issued in case ';' is active. +\def\pgfplots@appendto@activesemicolon@switcher#1{% + \expandafter\def\expandafter\pgfplots@checkandpreparefor@active@semicolon@\expandafter{% + \pgfplots@checkandpreparefor@active@semicolon@ + #1% + }% +}% + + +% Usage: +% \pgfplotsforeachentryinCSV{\value}{1,2,3,4.5,6.7,10}{The value is \value\par} +% +% The loop is ungrouped. +\long\def\pgfplotsforeachentryinCSV#1#2#3{% + \def\pgfplotsforeachentryinCSV@{#1}% + \long\def\pgfplotsforeachentryinCSV@@{#3}% + \pgfplotsforeachentryinCSV@loop#2,\pgfplots@EOI +}% +% A variant of \pgfplotsforeachentryinCSV where a trailing comma +% indicates the end of input. +% Example: +% +% \pgfplotsforeachentryinCSV{\value}{1,2,3,4.5,6.7,10,}{The value is \value\par} +% ^ +% +% It is permissable to provide an empty list (without trailing comma) +\long\def\pgfplotsforeachentryinCSVisterminated#1#2#3{% + \def\pgfplotsforeachentryinCSV@{#1}% + \long\def\pgfplotsforeachentryinCSV@@{#3}% + \pgfplotsforeachentryinCSV@loop#2\pgfplots@EOI +}% +\def\pgfplotsforeachentryinCSV@loop{% + \pgfutil@ifnextchar\pgfplots@EOI{% + \pgfutil@gobble + }{% + \pgfplotsforeachentryinCSV@next + }% +}% +\def\pgfplotsforeachentryinCSV@next#1,{% + \expandafter\def\pgfplotsforeachentryinCSV@{#1}% + \pgfplotsforeachentryinCSV@@ + \pgfplotsforeachentryinCSV@loop +}% + + +% A (simple) replacement for \foreach which +% 1. does NOT scope the argument +% 2. allows to use PGF Math routines for loops ( '...' notation) +% instead of TeX registers. +% +% Usage: +% \pgfplotsforeachungrouped \x in {1,2,3,4,5} {<code>} +% +% Some details: +% - If #2 is a UNIFORM SAMPLING RANGE, the algorithm is supposed to be +% most effective. +% - If \pgfmathadd@ is the standard PGF math version of \pgfmathadd@, +% we use fast TeX dimensions for any loops. Otherwise, \pgfmathadd@ +% is used (assuming it has been replaced and should be used. +% +\def\pgfplotsforeachungrouped#1{\pgfplotsforeachungrouped@{#1}}% +\long\def\pgfplotsforeachungrouped@#1in #2#3{% + \pgfplotsforeachungrouped@isuniform{#2}% + \ifpgfplots@loc@tmp + \pgfplotsforeachungroupeduniform@#1{#2}{#3}% + \else + \pgfplotsforeachungroupednonuniform@#1{#2}{#3}% + \fi +} +\let\pgfplots@original@pgfmathadd@=\pgfmathadd@ + +\long\def\pgfplotsforeachungroupeduniform@#1#2#3{% + \pgfplotsforeachungroupeduniform@@{#1}#2\relax{#3}% +} +\long\def\pgfplotsforeachungroupeduniform@@#1#2,#3,...,#4\relax#5{% + % Compute mesh width! + \pgfmathparse{#2}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfmathparse{#3}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult + \pgfmathsubtract@{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}% + \ifx\pgfmathadd@\pgfplots@original@pgfmathadd@ + % perform manual restoration of local variables: + \edef\pgfplots@foreach@loc@TMPd{% + \noexpand\pgf@xa=\the\pgf@xa\noexpand\relax + \noexpand\pgf@xb=\the\pgf@xb\noexpand\relax + \noexpand\pgf@ya=\the\pgf@ya\noexpand\relax + }% + % mesh width: + \pgf@ya=\pgfmathresult pt + % the loop will run while ( NOT <cur> \pgfplots@foreach@loc@cmp <last> ) + \ifdim\pgf@ya<0pt + \def\pgfplots@foreach@loc@cmp{<}% + \else + \def\pgfplots@foreach@loc@cmp{>}% + \fi + % + \pgfmathparse{#4}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult + \pgf@xa=\pgfplots@foreach@loc@TMPa pt + \pgf@xb=\pgfplots@foreach@loc@TMPb pt + \long\def\pgfplots@foreach@loc@TMPc{#5}% + % + \pgfutil@loop + \ifdim\pgf@xa \pgfplots@foreach@loc@cmp \pgf@xb\relax + \pgfplots@loc@tmpfalse + \else + \pgfplots@loc@tmptrue + \fi + \ifpgfplots@loc@tmp + \edef#1{\pgf@sys@tonumber{\pgf@xa}}% + \pgfplots@foreach@loc@TMPc\relax + \advance\pgf@xa by\pgf@ya\relax + \pgfutil@repeat + % ok, restore them: + \pgfplots@foreach@loc@TMPd + \else + % Use \pgfmath engine for the loop: + \edef\pgfplots@foreach@loc@TMPd{% + \noexpand\pgf@xa=\the\pgf@xa\noexpand\relax + }% + % mesh width: + \let\pgfplots@foreach@loc@meshwidth=\pgfmathresult + \pgfmathparse{0}% invoke the parser - in case the fpu is active. + \pgfmathlessthan@{\pgfplots@foreach@loc@meshwidth}{\pgfmathresult}% + \pgf@xa=\pgfmathresult pt + % the loop will run while ( NOT \pgfplots@foreach@loc@cmp{<cur>}{<last>} ) + \ifdim\pgf@xa=1pt + \let\pgfplots@foreach@loc@cmp=\pgfmathlessthan@ + \else + \let\pgfplots@foreach@loc@cmp=\pgfmathgreaterthan@ + \fi + % + \pgfmathparse{#4}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult + \long\def\pgfplots@foreach@loc@TMPc{#5}% + % + \pgfutil@loop + \pgfplots@foreach@loc@cmp{\pgfplots@foreach@loc@TMPa}{\pgfplots@foreach@loc@TMPb}% + \pgf@xa=\pgfmathresult pt + \ifdim\pgf@xa=0pt + \let#1=\pgfplots@foreach@loc@TMPa% + \pgfplots@foreach@loc@TMPc\relax + \pgfmathadd@{\pgfplots@foreach@loc@TMPa}{\pgfplots@foreach@loc@meshwidth}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfutil@repeat + % ok, restore them: + \pgfplots@foreach@loc@TMPd + \fi +}% +\long\def\pgfplotsforeachungroupednonuniform@#1#2#3{% + \pgfplotsapplistXXglobalnewempty + \foreach\pgfplots@foreach@loc@TMPa in {#2} {% + \expandafter\pgfplotsapplistXXglobalpushback\expandafter{\pgfplots@foreach@loc@TMPa,}% + }% + \pgfplotsapplistXXgloballet\pgfplots@foreach@loc@TMPa + \pgfplotsapplistXXglobalclear + \expandafter\pgfplotsforeachentryinCSVisterminated\expandafter\pgfplots@foreach@loc@TMPa\expandafter{\pgfplots@foreach@loc@TMPa}{% + \let#1=\pgfplots@foreach@loc@TMPa + #3% + }% +} + +% Sets \ifpgfplots@loc@tmp to something true if and only if '#1' is of the form +% #1 = <number1>,<number2>,...,<number3>. +\def\pgfplotsforeachungrouped@isuniform#1{% + \edef\pgfplots@foreach@loc@TMPa{#1}% + \expandafter\pgfplotsforeachungrouped@isuniform@\pgfplots@foreach@loc@TMPa,,,,\relax +}% +\def\pgfplotsforeachungrouped@isuniform@#1,#2,#3,#4,#5\relax{% + \def\pgfplots@foreach@loc@TMPa{#5}% + \def\pgfplots@foreach@loc@TMPb{,,,}% + \pgfplots@loc@tmpfalse + \ifx\pgfplots@foreach@loc@TMPa\pgfplots@foreach@loc@TMPb + \def\pgfplots@foreach@loc@TMPa{#3}% + \def\pgfplots@foreach@loc@TMPb{...}% + \ifx\pgfplots@foreach@loc@TMPa\pgfplots@foreach@loc@TMPb + \pgfutil@in@,{#4}% + \ifpgfutil@in@ + \else + % ok, we REALLY have a uniform range! + \pgfplots@loc@tmptrue + \fi + \fi + \fi +}% + +% Allows to provide an output routine for +% \pgfplotsforeachlogarithmicungrouped which changes the number format +% of \pgfmathresult. +% +% Example: +% \pgfplotsforeachlogarithmicformatresultwith{\pgfmathfloattofixed{\pgfmathresult}} +% +% #1: is code which modifies \pgfmathresult. +\def\pgfplotsforeachlogarithmicformatresultwith#1{% + \def\pgfplotsforeachlogarithmicungrouped@finalizeresult{#1}% +} + +% \pgfplotsforeachlogarithmicungrouped \x/\logx in {a:b} {#3} +% +% samples \x between a and b using a logarithmic scale. +% +% During '#3', \x will contain the sample and \logx the logarithm of +% \x. +% +% Both, #1 and #2 will be provided as floating point numbers unless +% configured otherwise with \pgfplotsforeachlogarithmicsetoutput, +% see above. +% +\def\pgfplotsforeachlogarithmicungrouped#1/#2{\pgfplotsforeachlogarithmicungrouped@{#1}{#2}}% +\long\def\pgfplotsforeachlogarithmicungrouped@#1#2in #3#4{% + % define + % \pgfplots@foreach@loc@TMPd = N in fixed point + % \pgfplots@foreach@loc@TMPc = N-1 in float : + \pgfkeysgetvalue{/pgfplots/samples}{\pgfplots@plot@samples} + \pgfmathfloatcreate{1}{1.0}{0}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfmathfloatparsenumber{\pgfplots@plot@samples}% + \expandafter\pgfmathfloatsubtract@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}% + \let\pgfplots@foreach@loc@TMPc=\pgfmathresult + % + \edef\pgfplots@loc@TMPb{#3}% + \expandafter\pgfplotsforeachlogarithmicungrouped@readdomain\pgfplots@loc@TMPb\relax + % compute mesh width into \pgfplots@foreach@loc@TMPc: + % \pgfplots@foreach@loc@TMPc := h := ( log(xmax) - log(xmin) ) / (N-1) + \pgfmathfloatsubtract@{\pgfplots@foreach@loc@TMPb}{\pgfplots@foreach@loc@TMPa}% + \pgfmathfloatdivide@{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}% + \let\pgfplots@foreach@loc@TMPc=\pgfmathresult + % + % apply local scoping here: + \edef\pgfplots@foreach@loc@TMPd{% + \noexpand\c@pgf@counta=\the\c@pgf@counta\noexpand\relax + }% + \long\def\pgfplots@foreach@loc@TMPf{#4}% + \c@pgf@counta=0 + \pgfutil@loop + \ifnum\c@pgf@counta<\pgfplots@plot@samples + % compute exp(log(min) + i * h) + \expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgf@counta}% + \expandafter\pgfmathfloatmultiply@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPc}% + \expandafter\pgfmathfloatadd@\expandafter{\pgfmathresult}{\pgfplots@foreach@loc@TMPa}% + \let\pgfplots@loc@TMPa=\pgfmathresult + \pgfplotsforeachlogarithmicungrouped@finalizeresult% + \let#2=\pgfmathresult + \pgfmathfloatexp@{\pgfplots@loc@TMPa}% + \pgfplotsforeachlogarithmicungrouped@finalizeresult% + \let#1=\pgfmathresult + % + % ok, invoke it! + % -> store \c@pgf@counta before doing so. We need to scope + % manually here. + \edef\pgfplots@foreach@loc@TMPe{\the\c@pgf@counta}% + \pgfplots@foreach@loc@TMPf\relax + \c@pgf@counta=\pgfplots@foreach@loc@TMPe\relax + \advance\c@pgf@counta by 1 + \pgfutil@repeat + % restore scoped variables: + \pgfplots@foreach@loc@TMPd +} +% can be used to convert the number format from float to something +% else. +\def\pgfplotsforeachlogarithmicungrouped@finalizeresult{}% + + +% defines +% \pgfplots@foreach@loc@TMPa := log(firstintervalpt) +% and +% \pgfplots@foreach@loc@TMPb := log(secondintervalpt) +\def\pgfplotsforeachlogarithmicungrouped@readdomain#1:#2\relax{% + \pgfmathfloatparsenumber{#1}% + \pgfmathfloatln@{\pgfmathresult}% + \let\pgfplots@foreach@loc@TMPa=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \pgfmathfloatln@{\pgfmathresult}% + \let\pgfplots@foreach@loc@TMPb=\pgfmathresult +} + +% invokes '#2' if #1 expands (\edef) to the empty string or '#3' if not. +\def\pgfplots@ifempty#1#2#3{% + \edef\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty #2\else #3\fi +}% + +\def\pgfplots@logfileopen#1{% + \immediate\write-1{PGFPlots: reading {#1}}% +}% + +\input pgfplotsliststructure.code.tex +\input pgfplotsliststructureext.code.tex +\input pgfplotsarray.code.tex +\input pgfplotstable.code.tex + +\endinput diff --git a/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplotsclickable.code.tex b/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplotsclickable.code.tex new file mode 100644 index 00000000000..63b479c27e4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/pgfplots/libs/tikzlibrarypgfplotsclickable.code.tex @@ -0,0 +1,711 @@ +%-------------------------------------------- +% +% Package pgfplots, library for dynamic content in PDF files +% (clickable plots) +% +% Copyright 2007/2008 by Christian Feuersänger. +% +% This program is free software: you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation, either version 3 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program. If not, see <http://www.gnu.org/licenses/>. +% +%-------------------------------------------- + +\edef\pgfplotscatcodeDQ{\the\catcode`\"}% +\catcode`\"=12 + +% ATTENTION: +% The eforms package creates \begin{Form} and \end{Form} in \AtBeginDocument and \AtEndDocument! +\def\pgfplots@glob@TMPa{pgfsys-pdftex.def} +\ifx\pgfplots@glob@TMPa\pgfsysdriver + \RequirePackage[pdftex]{insdljs} + \RequirePackage[pdftex]{eforms} +\else +\def\pgfplots@glob@TMPa{pgfsys-dvipdfm.def} +\ifx\pgfplots@glob@TMPa\pgfsysdriver + \RequirePackage[dvipdfm]{insdljs} + \RequirePackage[dvipdfm]{eforms} +\else +\def\pgfplots@glob@TMPa{pgfsys-dvips.def} +\ifx\pgfplots@glob@TMPa\pgfsysdriver + \RequirePackage[dvips]{insdljs} + \RequirePackage[dvips]{eforms} +\else +\def\pgfplots@glob@TMPa{pgfsys-textures.def} +\ifx\pgfplots@glob@TMPa\pgfsysdriver + \RequirePackage[textures]{insdljs} + \RequirePackage[textures]{eforms} +\else + \RequirePackage{insdljs} + \RequirePackage{eforms} +\fi\fi\fi\fi + +% Work-around for a bug in \begindljs of acrotex: +% if " is active, \begindljs will be wrong. +\def\begindljs +{% + \iwvo{\string\begingroup} + {\uccode`c=`\%\uppercase{\iwvo{\string\obeyspaces\string\obeylines\string\global\string\let\string^\string^M=\string\jsR c}}} + {\escapechar=-1 \lccode`C=`\%\lowercase{\iwvo{\string\\catcode`\string\\"=12C}}} +} + +\def\pgfplots@clickable@no{0} + +% This catcode-hackery is too much for me, I don't get '|' to work in +% conjunction with ltxdoc document style. +% So, I simply use \pgfplotsVERTBAR instead... *sigh*. +{ +\catcode`\"=12 +\gdef\pgfplotsDQ{"}% +\catcode`\|=12 +\gdef\pgfplotsVERTBAR{|}% +\catcode`\#=12 +\gdef\pgfplotsHASH{#}% +\catcode`\%=12 \gdef\pgfplotsPERCENT{%}} + +% FIXME : write this stuff DIRECTLY into a pdf using \pdfobj! I don't +% need ANY TeX code inside of the methods. Maybe I can even use some +% sort of "include external .js file" command instead of /S /Javascript /JS +% +% FIXME : using '\jobname' here produces a bug in insdljs :-( +% The problem: insdljs creates a macro named 'dlsj\jobname' or +% something like that, but if fails to use '\csname' properly. So: +% only normal letters are allowed inside of the argument here. +\begin{insDLJS}[processAnnotatedPlot]{pgfplotsJS}{pgfplots Clickable Plot Code} +/********************************************************************************* + * function sprintf() - written by Kevin van Zonneveld as part of the php to javascript + * conversion project. + * + * More info at: http://kevin.vanzonneveld.net/techblog/article/phpjs_licensing/ + * + * This is version: 1.33 + * php.js is copyright 2008 Kevin van Zonneveld. + * + * Portions copyright Michael White (http://crestidg.com), _argos, Jonas + * Raoni Soares Silva (http://www.jsfromhell.com), Legaev Andrey, Ates Goral + * (http://magnetiq.com), Philip Peterson, Martijn Wieringa, Webtoolkit.info + * (http://www.webtoolkit.info/), Carlos R. L. Rodrigues + * (http://www.jsfromhell.com), Ash Searle (http://hexmen.com/blog/), + * Erkekjetter, GeekFG (http://geekfg.blogspot.com), Johnny Mast + * (http://www.phpvrouwen.nl), marrtins, Alfonso Jimenez + * (http://www.alfonsojimenez.com), Aman Gupta, Arpad Ray + * (mailto:arpad@php.net), Karol Kowalski, Mirek Slugen, Thunder.m, Tyler + * Akins (http://rumkin.com), d3x, mdsjack (http://www.mdsjack.bo.it), Alex, + * Alexander Ermolaev (http://snippets.dzone.com/user/AlexanderErmolaev), + * Allan Jensen (http://www.winternet.no), Andrea Giammarchi + * (http://webreflection.blogspot.com), Arno, Bayron Guevara, Ben Bryan, + * Benjamin Lupton, Brad Touesnard, Brett Zamir, Cagri Ekin, Cord, David, + * David James, DxGx, FGFEmperor, Felix Geisendoerfer + * (http://www.debuggable.com/felix), FremyCompany, Gabriel Paderni, Howard + * Yeend, J A R, Leslie Hoare, Lincoln Ramsay, Luke Godfrey, MeEtc + * (http://yass.meetcweb.com), Mick@el, Nathan, Nick Callen, Ozh, Pedro Tainha + * (http://www.pedrotainha.com), Peter-Paul Koch + * (http://www.quirksmode.org/js/beat.html), Philippe Baumann, Sakimori, + * Sanjoy Roy, Simon Willison (http://simonwillison.net), Steve Clay, Steve + * Hilder, Steven Levithan (http://blog.stevenlevithan.com), T0bsn, Thiago + * Mata (http://thiagomata.blog.com), Tim Wiel, XoraX (http://www.xorax.info), + * Yannoo, baris ozdil, booeyOH, djmix, dptr1988, duncan, echo is bad, gabriel + * paderni, ger, gorthaur, jakes, john (http://www.jd-tech.net), kenneth, + * loonquawl, penutbutterjelly, stensi + * + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL KEVIN VAN ZONNEVELD BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +// ATTENTION: this method has been masked such that special characters of TeX and javascript +// don't produce problems. +function sprintf( ) { + // Return a formatted string + // + // + discuss at: http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_sprintf/ + // + version: 804.1712 + // + original by: Ash Searle (http://hexmen.com/blog/) + // + namespaced by: Michael White (http://crestidg.com) + // * example 1: sprintf("\pgfplotsPERCENT01.2f", 123.1); + // * returns 1: 123.10 + + var regex = /\pgfplotsPERCENT\pgfplotsPERCENT\pgfplotsVERTBAR\pgfplotsPERCENT(\d+\$)?([-+\pgfplotsHASH0 ]*)(\*\d+\$\pgfplotsVERTBAR\*\pgfplotsVERTBAR\d+)?(\.(\*\d+\$\pgfplotsVERTBAR\*\pgfplotsVERTBAR\d+))?([scboxXuidfegEG])/g; + var a = arguments, i = 0, format = a[i++]; + + // pad() + var pad = function(str, len, chr, leftJustify) { + var padding = (str.length >= len) ? '' : Array(1 + len - str.length >>> 0).join(chr); + return leftJustify ? str + padding : padding + str; + }; + + // justify() + var justify = function(value, prefix, leftJustify, minWidth, zeroPad) { + var diff = minWidth - value.length; + if (diff > 0) { + if (leftJustify \pgfplotsVERTBAR\pgfplotsVERTBAR !zeroPad) { + value = pad(value, minWidth, ' ', leftJustify); + } else { + value = value.slice(0, prefix.length) + pad('', diff, '0', true) + value.slice(prefix.length); + } + } + return value; + }; + + // formatBaseX() + var formatBaseX = function(value, base, prefix, leftJustify, minWidth, precision, zeroPad) { + // Note: casts negative numbers to positive ones + var number = value >>> 0; + prefix = prefix && number && {'2': '0b', '8': '0', '16': '0x'}[base] \pgfplotsVERTBAR\pgfplotsVERTBAR ''; + value = prefix + pad(number.toString(base), precision \pgfplotsVERTBAR\pgfplotsVERTBAR 0, '0', false); + return justify(value, prefix, leftJustify, minWidth, zeroPad); + }; + + // formatString() + var formatString = function(value, leftJustify, minWidth, precision, zeroPad) { + if (precision != null) { + value = value.slice(0, precision); + } + return justify(value, '', leftJustify, minWidth, zeroPad); + }; + + // finalFormat() + var doFormat = function(substring, valueIndex, flags, minWidth, _, precision, type) { + if (substring == '\pgfplotsPERCENT\pgfplotsPERCENT') return '\pgfplotsPERCENT'; + + // parse flags + var leftJustify = false, positivePrefix = '', zeroPad = false, prefixBaseX = false; + for (var j = 0; flags && j < flags.length; j++) switch (flags.charAt(j)) { + case ' ': positivePrefix = ' '; break; + case '+': positivePrefix = '+'; break; + case '-': leftJustify = true; break; + case '0': zeroPad = true; break; + case '\pgfplotsHASH': prefixBaseX = true; break; + } + + // parameters may be null, undefined, empty-string or real valued + // we want to ignore null, undefined and empty-string values + if (!minWidth) { + minWidth = 0; + } else if (minWidth == '*') { + minWidth = +a[i++]; + } else if (minWidth.charAt(0) == '*') { + minWidth = +a[minWidth.slice(1, -1)]; + } else { + minWidth = +minWidth; + } + + // Note: undocumented perl feature: + if (minWidth < 0) { + minWidth = -minWidth; + leftJustify = true; + } + + if (!isFinite(minWidth)) { + throw new Error('sprintf: (minimum-)width must be finite'); + } + + if (!precision) { + precision = 'fFeE'.indexOf(type) > -1 ? 6 : (type == 'd') ? 0 : void(0); + } else if (precision == '*') { + precision = +a[i++]; + } else if (precision.charAt(0) == '*') { + precision = +a[precision.slice(1, -1)]; + } else { + precision = +precision; + } + + // grab value using valueIndex if required? + var value = valueIndex ? a[valueIndex.slice(0, -1)] : a[i++]; + + switch (type) { + case 's': return formatString(String(value), leftJustify, minWidth, precision, zeroPad); + case 'c': return formatString(String.fromCharCode(+value), leftJustify, minWidth, precision, zeroPad); + case 'b': return formatBaseX(value, 2, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'o': return formatBaseX(value, 8, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'x': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'X': return formatBaseX(value, 16, prefixBaseX, leftJustify, minWidth, precision, zeroPad).toUpperCase(); + case 'u': return formatBaseX(value, 10, prefixBaseX, leftJustify, minWidth, precision, zeroPad); + case 'i': + case 'd': { + var number = parseInt(+value); + var prefix = number < 0 ? '-' : positivePrefix; + value = prefix + pad(String(Math.abs(number)), precision, '0', false); + return justify(value, prefix, leftJustify, minWidth, zeroPad); + } + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': + { + var number = +value; + var prefix = number < 0 ? '-' : positivePrefix; + var method = ['toExponential', 'toFixed', 'toPrecision']['efg'.indexOf(type.toLowerCase())]; + var textTransform = ['toString', 'toUpperCase']['eEfFgG'.indexOf(type) \pgfplotsPERCENT 2]; + value = prefix + Math.abs(number)[method](precision); + return justify(value, prefix, leftJustify, minWidth, zeroPad)[textTransform](); + } + default: return substring; + } + }; + + return format.replace(regex, doFormat); +} +/*********************************************************************************/ + + +var lastMouseX = -1; +var lastMouseY = -1; +var posOnMouseDownX = -1; +var posOnMouseDownY = -1; + +// preallocation. +var tmpArray1 = new Array(2); +var tmpArray2 = new Array(2); + +/** + * Takes an already existing TextField, changes its value to \c value and places it at (x,y). + * Additional \c displayOpts will be used to format it. + */ +function initTextField( x,y, textField, displayOpts, value ) +{ + textField.value = ""+value; + var R = textField.rect; + R[0] = x; + R[1] = y; + R[2] = R[0] + displayOpts.textSize/2*Math.max( 5,value.length ); + R[3] = R[1] - 1.5*displayOpts.textSize; + textField.rect = R; + textField.textFont = displayOpts.textFont; + textField.textSize = displayOpts.textSize; + textField.fillColor = displayOpts.fillColor;//["RGB",1,1,.855]; + textField.doNotSpellCheck = true; + textField.readonly = true; + if( displayOpts.printable ) + textField.display = display.visible; + else + textField.display = display.noPrint; +} + +/** + * Changes all required Field values of \c plotRegionField, inserts the proper + * value and displays it at the pdf positions (x,y) . + * + * @param plotRegionField a reference to a Field object. + * @param x the x coordinate where the annotation shall be placed and which is used to determine + * the annotation text. + * @param y the corresponding y coord. + * @param axisAnnotObj An object containing axis references. + * @param displayOpts An object for display flags. + * @param[out] retCoords will be filled with the point in axis coordinates. + */ +function placeAnnot( plotRegionField, x,y, textField, axisAnnotObj, displayOpts, retCoords ) +{ + // Get and modify bounding box. The mouse movement is only accurate up to one point + // (mouseX and mouseY are integers), so the bounding box should be an integer as well. + var R = plotRegionField.rect; + R[0] = Math.round(R[0]); + R[1] = Math.round(R[1]); + R[2] = Math.round(R[2]); + R[3] = Math.round(R[3]); + plotRegionField.rect= R; + + var w = R[2] - R[0]; + var h = R[1] - R[3]; + + // compute position 0 <= mx <= 1, 0<= my <= 1 relative to lower(!) left corner. + var mx = x - R[0]; + var my = h - (R[1] - y); + + var unitx = mx / w; + var unity = my / h; + + var realx = axisAnnotObj.xmin + unitx * (axisAnnotObj.xmax - axisAnnotObj.xmin); + var realy = axisAnnotObj.ymin + unity * (axisAnnotObj.ymax - axisAnnotObj.ymin); + + if( retCoords ) { + retCoords[0] = realx; + retCoords[1] = realy; + } + + if( axisAnnotObj.xscale == "log" ) + realx = Math.exp(realx); + if( axisAnnotObj.yscale == "log" ) + realy = Math.exp(realy); + +// console.println( "w = " + w + "; h = " + h ); +// console.println( "mx = " + mx + "; my = " + my ); +// console.println( "unitx = " + unitx + "; unity " + unity ); + + initTextField( x,y, textField, displayOpts, + //util.printf( "(\pgfplotsPERCENT.2f,\pgfplotsPERCENT.2f)", realx,realy ) + sprintf( displayOpts.pointFormat, realx,realy) ); + +} + +/** + * @param formName the name of the clickable button. It is expected to be as large as the underlying plot. + * @param axisAnnotObj an object with the fields + * - xmin, xmax + * - ymin, ymax + * - xscale, yscale + * @param displayOpts an object with the fields + * - pointFormat an sprintf format string to format the final point coordinates. + * The default is "(\pgfplotsPERCENT.2f,\pgfplotsPERCENT.2f)" + * - fillColor the fill color for the annotation. Options are + * transparent, gray, RGB or CMYK color. Default is + * ["RGB",1,1,.855] + * - textFont / textSize + */ +function processAnnotatedPlot(formName, axisAnnotObj, displayOpts, bMouseUp ) +{ + if( !bMouseUp ) { + posOnMouseDownX = mouseX; + posOnMouseDownY = mouseY; + return; + } + var result = this.getField( formName + "-result"); + var result2 = this.getField( formName + "-result2"); + var slope = this.getField( formName + "-slope" ); + if( !result ) { + console.println( "WARNING: there is no TextField \"" + formName + "-result\" to display results for interactive element \"" + formName + "\""); + return; + } + result2.display = display.hidden; + slope.display = display.hidden; + + // clicking twice onto the same point hides it: + if( result.display != display.hidden && + Math.abs(lastMouseX - mouseX) < 5 && + Math.abs(lastMouseY - mouseY) < 5 ) + { + result.display = display.hidden; + return; + } + lastMouseX = mouseX; + lastMouseY = mouseY; + + var a = this.getField(formName); + if( ! a ) { + console.println( "Warning: there is no form named \"" + formName + "\"" ); + return; + } + if( Math.abs( lastMouseX - posOnMouseDownX ) > 6 \pgfplotsVERTBAR\pgfplotsVERTBAR + Math.abs( lastMouseY - posOnMouseDownY ) > 6 ) + { + // dragging the mouse results in slope computation: + placeAnnot( a, posOnMouseDownX, posOnMouseDownY, result, axisAnnotObj, displayOpts, tmpArray1 ); + placeAnnot( a, lastMouseX, lastMouseY, result2, axisAnnotObj, displayOpts, tmpArray2 ); + + var m = ( tmpArray2[1] - tmpArray1[1] ) / ( tmpArray2[0] - tmpArray1[0] ); + var n = tmpArray1[1] - m * tmpArray1[0]; + + initTextField( + 0.5 * ( lastMouseX + posOnMouseDownX ), + 0.5 * ( lastMouseY + posOnMouseDownY ), + slope, + displayOpts, + sprintf( displayOpts.slopeFormat, m, n ) ); + + %-------------------------------------------------- + % var lineobj = this.getAnnot( a.page, formName + '-line' ); + % console.println( 'lineobj = ' + lineobj ); + % lineobj.points = [[lastMouseX,lastMouseY],[posOnMouseDownX,posOnMouseDownY]]; + % lineobj.display = display.visible; + %-------------------------------------------------- + + } else { + placeAnnot( a, lastMouseX, lastMouseY, result, axisAnnotObj, displayOpts, null ); + } +} +\end{insDLJS} +%-------------------------------------------------- +% function hideClickableTextfields() { +% for (var i = 0; i < this.numFields; i++) { +% var fieldName = this.getNthFieldName(i); +% console.println("checking Field " + fieldName + " ... "); +% if( fieldName.substr( 0, 13 ) == "clickableplot" && fieldName.indexOf( "-result", 12 ) >= 0 ) { +% console.println("hiding Field " + fieldName + " ... "); +% this.getField( fieldName ).display = display.hidden; +% } +% } +% } +% hideClickableTextfields(); +%-------------------------------------------------- + + +\newif\ifpgfplots@clickable +\newif\ifpgfplots@annot@printable + +\pgfqkeys{/pgfplots}{ + @backgroundpath@hook/.add code={\pgfplots@create@clickable@plotarea@hook}, + clickable/.is if=pgfplots@clickable, + clickable/.default=true, + clickable=true, + annot/js fillColor/.initial={["RGB",1,1,.855]}, + annot/point format/.initial={(\%.1f,\%.1f)}, + annot/slope format/.initial={\%.1f*x \%+.1f}, + annot/printable/.is if=pgfplots@annot@printable, + annot/printable/.default=true, + % Available are: +% Times-Roman font.Times +% Times-Bold font.TimesB +% Times-Italic font.TimesI +% Times-BoldItalic font.TimesBI +% Helvetica font.Helv +% Helvetica-Bold font.HelvB +% Helvetica-Oblique font.HelvI +% Helvetica-BoldOblique font.HelvBI +% Courier font.Cour +% Courier-Bold font.CourB +% Courier-Oblique font.CourI +% Courier-BoldOblique font.CourBI +% Symbol font.Symbol +% ZapfDingbats font.ZapfD + annot/font/.initial={font.Times}, +% annot/font={"CMR10"}, + annot/textSize/.initial=11, + annot/width/.initial=, + annot/height/.initial=, + annot/jsname/.initial=, + annot/xmin/.initial=, + annot/xmax/.initial=, + annot/ymin/.initial=, + annot/ymax/.initial=, + annot/xscale/.initial=, % "log" or "linear" + annot/yscale/.initial=, + every semilogy axis/.append style={/pgfplots/annot/point format={(\%.1f,\%.1e)}}, + every semilogx axis/.append style={/pgfplots/annot/point format={(\%.1e,\%.1f)}}, + every loglog axis/.append style={/pgfplots/annot/point format={(\%.1e,\%.1e)}}, +} + +% Creates an area which is clickable. A click produces a popup which +% contains information about the point under the cursor. +% +% The complete (!) context needs to be provided using key-value-pairs, +% either in '#1' or set before invocation of \pgfplotsclickablecreate. +% +% This command actually creates an AcroForm which employs javascript +% whenever it is clicked. A javascript Object is created which +% represents the context (axis limits and options). This javascript +% object is available at runtime. +% +% @remark This method is public and it is NOT restricted to pgfplots. +% The pgfplots hook simply initialises the required key-value-pairs in +% '#1'. +% @remark This method does not draw anything. It initialises only a +% clickable area and javascript code. +% +% The required key-value-pairs are documented in the pdf-manual or can +% be seen above. +% +% @attention Complete key-value validation is NOT performed here. It +% can happen that invalid options will produce javascript bugs when +% opened with Acrobat Reader. Use the javascript console to find them. +\def\pgfplotsclickablecreate[#1]{% + \def\pgfplots@loc@TMPa{#1}% + \ifx\pgfplots@loc@TMPa\pgfutil@empty + \else + \pgfqkeys{/pgfplots/annot}{#1}% + \fi + \pgfkeysgetvalue{/pgfplots/annot/jsname}\pgfplots@clickable@uniquename + \ifx\pgfplots@clickable@uniquename\pgfutil@empty + \edef\pgfplots@clickable@uniquename{clickableplot\pgfplots@clickable@no}% + \begingroup + \c@pgf@counta=\pgfplots@clickable@no\relax + \advance\c@pgf@counta by1 + \xdef\pgfplots@clickable@no{\the\c@pgf@counta}% + \endgroup + \fi + \edef\pgfplots@clickable@expanded@args{% FIXME : is that a good idea to do!? Are user-args expandable? + {\pgfkeysvalueof{/pgfplots/annot/width}}% + {\pgfkeysvalueof{/pgfplots/annot/height}}% + {\pgfplots@clickable@uniquename}% + {{ + xmin:\pgfkeysvalueof{/pgfplots/annot/xmin}, + xmax:\pgfkeysvalueof{/pgfplots/annot/xmax}, + ymin:\pgfkeysvalueof{/pgfplots/annot/ymin}, + ymax:\pgfkeysvalueof{/pgfplots/annot/ymax}, + xscale:"\pgfkeysvalueof{/pgfplots/annot/xscale}", + yscale:"\pgfkeysvalueof{/pgfplots/annot/yscale}" + }}% + {{ + pointFormat: "\pgfkeysvalueof{/pgfplots/annot/point format}", + slopeFormat: "\pgfkeysvalueof{/pgfplots/annot/slope format}", + fillColor:\pgfkeysvalueof{/pgfplots/annot/js fillColor}, + textFont:\pgfkeysvalueof{/pgfplots/annot/font}, + textSize:\pgfkeysvalueof{/pgfplots/annot/textSize}, + printable: \ifpgfplots@annot@printable true\else false\fi + }}% + }% + \expandafter\pgfplots@create@clickable@plotarea\pgfplots@clickable@expanded@args +}% + + +% This thing is invoked from within pgfplots. It prepares and invokes +% \pgfplotsclickablecreate. +% +\def\pgfplots@create@clickable@plotarea@hook{% + \ifpgfplots@clickable + \begingroup + \ifpgfplots@apply@datatrafo@x + \pgfplots@inverse@datascaletrafo@x\pgfplots@xmin + \pgfmathfloattosci\pgfmathresult + \let\pgfplots@clickable@xmin=\pgfmathresult + \pgfplots@inverse@datascaletrafo@x\pgfplots@xmax + \pgfmathfloattosci\pgfmathresult + \let\pgfplots@clickable@xmax=\pgfmathresult + \else + \let\pgfplots@clickable@xmin=\pgfplots@xmin + \let\pgfplots@clickable@xmax=\pgfplots@xmax + \fi + % + \ifpgfplots@apply@datatrafo@y + \pgfplots@inverse@datascaletrafo@y\pgfplots@ymin + \pgfmathfloattosci\pgfmathresult + \let\pgfplots@clickable@ymin=\pgfmathresult + \pgfplots@inverse@datascaletrafo@y\pgfplots@ymax + \pgfmathfloattosci\pgfmathresult + \let\pgfplots@clickable@ymax=\pgfmathresult + \else + \let\pgfplots@clickable@ymin=\pgfplots@ymin + \let\pgfplots@clickable@ymax=\pgfplots@ymax + \fi + \pgfpointdiff + {\lowerleftinnercorner} + {\pgfpointadd + {\lowerleftinnercorner}% + {\pgfpointadd{\yaxisvec}{\xaxisvec}}}% + \edef\pgfplots@clickable@wd{\the\pgf@x}% + \edef\pgfplots@clickable@ht{\the\pgf@y}% + % + % Convert to user interface of clickable lib: + \pgfkeyslet{/pgfplots/annot/width}\pgfplots@clickable@wd + \pgfkeyslet{/pgfplots/annot/height}\pgfplots@clickable@ht + \pgfkeyslet{/pgfplots/annot/xmin}\pgfplots@clickable@xmin + \pgfkeyslet{/pgfplots/annot/xmax}\pgfplots@clickable@xmax + \pgfkeyslet{/pgfplots/annot/ymin}\pgfplots@clickable@ymin + \pgfkeyslet{/pgfplots/annot/ymax}\pgfplots@clickable@ymax + \ifpgfplots@xislinear + \pgfkeyssetvalue{/pgfplots/annot/xscale}{linear}% + \else + \pgfkeyssetvalue{/pgfplots/annot/xscale}{log}% + \fi + \ifpgfplots@yislinear + \pgfkeyssetvalue{/pgfplots/annot/yscale}{linear}% + \else + \pgfkeyssetvalue{/pgfplots/annot/yscale}{log}% + \fi + \pgfinterruptboundingbox% + \pgftext[left,bottom,at=\lowerleftinnercorner]{\pgfplotsclickablecreate[]}% + \endpgfinterruptboundingbox% + \endgroup + \fi +} + +% This is the low-level method which creates Acroforms and Javascript +% code. +% #1: width +% #2: height +% #3: name +% #4: the axisAnnotObj object (see javascript docs above) +% #5: the displayOpts object (see javascript docs above) +\def\pgfplots@create@clickable@plotarea#1#2#3#4#5{% +%\tracingmacros=2\tracingcommands=2 + %\leavevmode + %-------------------------------------------------- + % hyperref.sty implementation: + %-------------------------------------------------- + % \PushButton[name=#3,borderwidth=0,bordersep=0, + % onclick={processAnnotatedPlot("#3", #4, #5);}]{\vbox to #2{\hsize=#1\vfill\hfill}}% + % \TextField[name=#3-result,hidden=true]{}% + %-------------------------------------------------- + % + %-------------------------------------------------- + % eforms.sty implementation: + % it allows more customization. + %-------------------------------------------------- + % + % Hier kommen Annotation Directories zum Zuge! + % -> siehe Annotations in pdf reference + \def\pushButtonDefaults{ + \W{0}% border width + \Border{0 0 0}% + }% + \def\textFieldDefaults{% + \W{1}% border width + \S{B}% border style ( one of SDBIU ) + %\F{2}% "display" bitflag. 2^1= hidden (see "Annotation Flags" in pdf reference) + %ATTENTION: \F 2 (hidden) produces INCOMPATIBILITIES with figure environment!? + % Work-around: force zero-width fields; each + % read-only without border or appearance stuff. + % Hope that works without visible artefacts. + \Ff{1}% "Field characteristics" bitflag. 2^0 = "read-only" + }% + \pushButton[ + %\A{/S/JavaScript/JS(processAnnotatedPlot("#3", #4, #5);)}% + \AA{ + % /U = "mouse UP" + % /D = "mouse DOWN" + /U << /S/JavaScript/JS(processAnnotatedPlot("#3", #4, #5, 1);) >> + /D << /S/JavaScript/JS(processAnnotatedPlot("#3", #4, #5, 0);) >> + }% + ] + {#3} + {#1}{#2}% + \textField{#3-result}{0pt}{0pt}% + \textField{#3-result2}{0pt}{0pt}% + \textField{#3-slope}{0pt}{0pt}% + % Unfortunately, line annotations can't be created/changed in acrobat + % javascript due to right problems :-( + %-------------------------------------------------- + % \hbox to 0pt{\vsize=0pt\pdfannot{ + % /Subtype /Line + % /Open /false + % /NM (#3-line) + %-------------------------------------------------- +% /C +% /CA +% /Subj (\the\toks1) + %-------------------------------------------------- + % /Contents () + % /L [0 0 0 0] + % /LE [/None /OpenArrow] % PDF 1.4 + % /Ff 1 + % }}% + %-------------------------------------------------- + % + % + %\setLinkBbox[% + % \Border{}% + % \A{/S/JavaScript/JS(processme("#3");)}% + % \rawPDF{/C[1 0 0] /NM (#3)}% + % ]% + % {#1}{#2}{}% +} + +\catcode`\"=\pgfplotscatcodeDQ +\endinput diff --git a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty index 8f0f7deace3..58cef47cb1b 100644 --- a/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty +++ b/Master/texmf-dist/tex/latex/pgfplots/pgfplots.sty @@ -1,3 +1,4 @@ +% $Header: /cvsroot/pgfplots/pgfplots/latex/pgfplots/pgfplots.sty,v 1.9 2009/02/01 11:34:56 ludewich Exp $ %-------------------------------------------- % % Package pgfplots.sty @@ -23,8 +24,8 @@ % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- -\def\pgfplotsversion{1.1} -\ProvidesPackage{pgfplots}[2008/08/02 Version \pgfplotsversion] +\def\pgfplotsversion{1.2} +\ProvidesPackage{pgfplots}[2009/02/01 Version \pgfplotsversion] % ATTENTION: % you MAY need one of |