summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgfplots/libs
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/libs')
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex231
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/pgfplotslibrary.code.tex56
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarydateplot.code.tex75
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex163
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex98
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex330
-rw-r--r--Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex224
7 files changed, 1102 insertions, 75 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex
new file mode 100644
index 00000000000..616c0730726
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/pgflibrarypgfplots.surfshading.code.tex
@@ -0,0 +1,231 @@
+%--------------------------------------------
+% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/libs/pgflibrarysurfshading.code.tex,v 1.18 2009/06/26 17:56:58 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/>.
+%
+%--------------------------------------------
+
+%--------------------------------------------------
+% \pgfqkeys{/pgfplots/surf shading}{
+% cols=3,
+% % test colormap 1,
+% }
+% \pgfplotslibrarysurfstreamstart
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{0pt}{10pt}}{0}
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{100pt}{10pt}}{100}
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{180pt}{10pt}}{30}
+% %
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{0pt}{100pt}}{300}
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{110pt}{90pt}}{1000}
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{190pt}{110pt}}{600}
+% %
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{0pt}{200pt}}{0}
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{110pt}{200pt}}{100}
+% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{190pt}{200pt}}{60}
+% \pgfplotslibrarysurfstreamend
+% \fbox{%
+% \pgfplotslibrarysurfdraw
+% }%
+%--------------------------------------------------
+
+
+\pgfkeys{%
+ % the extends need to provided as \pgfpoint... The boundary box
+ % won't be computed manually!
+ /pgfplots/surf shading/south west corner/.initial={\pgfpointorigin},%
+ /pgfplots/surf shading/north east corner/.initial={\pgfqpoint{6cm}{6cm}},%
+ /pgfplots/surf shading/anchor/.initial=\pgfpointorigin,%
+ /pgfplots/surf shading/precision/.is choice,
+ /pgfplots/surf shading/precision/pdf/.code={%
+ % Lossless coordinate output.
+ \def\pgfplotslibrarysurf@bitspercoordinate{32}%
+ \def\pgfplotslibrarysurf@bytespercoordinate{4}%
+ \def\pgfplotslibrarysurf@filter@encode{}% raw binary.
+ \def\pgfplotslibrarysurf@filter@decode{}%
+ },%
+ /pgfplots/surf shading/precision/ps/.code={%
+ % quantized coordinate output (introduces quantization error).
+ \def\pgfplotslibrarysurf@bitspercoordinate{24}%
+ \def\pgfplotslibrarysurf@bytespercoordinate{3}%
+ % doesn't improve behavior of pdf2ps:
+ %\def\pgfplotslibrarysurf@filter@encode{ASCIIHexEncode}%
+ %\def\pgfplotslibrarysurf@filter@decode{ASCIIHexDecode}%
+ \def\pgfplotslibrarysurf@filter@encode{}% raw binary.
+ \def\pgfplotslibrarysurf@filter@decode{}%
+ },%
+ /pgfplots/surf shading/precision/postscript/.style={%
+ /pgfplots/surf shading/precision/ps},%
+ /pgfplots/surf shading/precision/ps,%
+ /pgfplots/surf shading/cols/.initial=,%
+ /pgfplots/surf shading/colormap/.initial={%
+ <<
+ /FunctionType 2
+ /Domain [0 1]
+ /C0 [0 0 1] /C1 [1 0 0] /N 1
+ >>
+ },%
+ /pgfplots/surf shading/test colormap 1/.style={%
+ /pgfplots/surf shading/colormap={
+ <<
+ /FunctionType 3
+ /Domain [0 1]
+ /Functions [
+ <<
+ /FunctionType 2
+ /Domain [0 1]
+ /C0 [0 0 1] /C1 [1 1 0] /N 1
+ >>
+ <<
+ /FunctionType 2
+ /Domain [0 1]
+ /C0 [1 1 0] /C1 [1 0.5 0] /N 1
+ >>
+ <<
+ /FunctionType 2
+ /Domain [0 1]
+ /C0 [1 0.5 0] /C1 [1 0 0] /N 1
+ >>
+ ]
+ /Bounds [ 0.3 0.6 ]
+ /Encode [0 1 0 1 0 1]
+ %/Range [0 1 0 1 0 1] INCOMPATIBLE WITH ACROBAT 6.0
+ >>
+ }%
+ },%
+}%
+
+\def\pgfplotslibrarysurf@corner@sw{\pgfkeysvalueof{/pgfplots/surf shading/south west corner}}
+\def\pgfplotslibrarysurf@corner@ne{\pgfkeysvalueof{/pgfplots/surf shading/north east corner}}%
+
+
+\def\pgfplotslibrarysurf@decode{%
+ -16383.999992 16384 % see the docs of \pgfplotsbinaryencodedimenmaplinearly
+ -16383.999992 16384 %
+ 0 \pgfplotscolormappdfmax % map [0,2^BitsPerComponent-1] linearly to [0 1] for parametric color data
+}%
+\def\pgfplotslibrarysurf@count{0}%
+
+% driver specific:
+\def\pgfplotslibrarysurf@initstream{}
+\def\pgfplotslibrarysurf@advancestreamlen#1{}%
+
+\def\pgfplotslibrarysurfstreamstart{%
+ \pgfplotsapplistXnewempty\pgfplotslibrarysurf@binarystream@accum
+ \pgfplotslibrarysurf@initstream
+ \ifx\pgfplotslibrarysurf@filter@encode\pgfutil@empty
+ \else
+ \pgfkeysalso{/pgfplots/bin/\pgfplotslibrarysurf@filter@encode}%
+ \fi
+}%
+\def\pgfplotslibrarysurfstreamend{%
+ \pgfplotsapplistXlet\pgfplotslibrarysurf@binarystream=\pgfplotslibrarysurf@binarystream@accum
+}%
+
+% #1: a pgf point.
+% #2: a color coordinate in the range [0,1000]
+\def\pgfplotslibrarysurfstreamcoord#1#2{%
+ \pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercoordinate%
+ \pgf@process{#1}%
+ % The idea is to map
+ % the low-level point coordinates LINEARLY into [0,2^{8*<bytes>}].
+ %
+ % This is what the pdf standard expects for surface shadings.
+ %
+ % To do that, we simply map
+ % [-16384,16384] linearly into [0,2^{32}]
+ % and write the resulting integer in big endian binary format to
+ % the pdf low level stream.
+ %
+ % The decode procedure tells the pdf viewer how to invert that
+ % stuff.
+ %
+ \pgf@sys@bp@correct\pgf@x%
+ \pgfplotsbinaryencodedimenmaplinearly\pgf@x
+%\message{POINT \the\c@pgfplots@scanlineindex: ENCODING(x=\the\pgf@x)=\pgfplotsbinaryresult.}\advance\c@pgfplots@scanlineindex by1
+ \t@pgfplots@toka=\expandafter{\pgfplotsbinaryresult}%
+ \pgf@sys@bp@correct\pgf@y%
+ \pgfplotsbinaryencodedimenmaplinearly\pgf@y
+%\message{ENCODING(y=\the\pgf@y)=\pgfplotsbinaryresult.}%
+ \t@pgfplots@tokb=\expandafter{\pgfplotsbinaryresult}%
+ {%
+ % read fixed point input (in the range [0,1000]).
+ \pgf@xa=#2pt
+ % convert to integer (= *65536):
+ \c@pgf@counta=\pgf@xa
+ % provide map [0,1000] -> [0,2^16-1]
+ \divide\c@pgf@counta by1000
+ % now, we have \c@pgf@counta in [0,2^16]. Simply strip it into
+ % the required range, that's ok.
+ \ifnum\c@pgf@counta<0
+ \c@pgf@counta=0
+ \else
+ \ifnum\c@pgf@counta>65535
+ \c@pgf@counta=65535
+ \fi
+ \fi
+ % Now, we have CDATA in the range [0,65535]
+ \xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
+%\message{ENCODING(C=\pgfplots@glob@TMPa\space for \the\pgf@xa)=}%
+ }%
+ \pgfplotsbinarysetbytes2%
+ \pgfplotsbinaryencodeunsigned\pgfplots@glob@TMPa
+%\message{\pgfplotsbinaryresult.}%
+ \t@pgfplots@tokc=\expandafter{\pgfplotsbinaryresult}%
+ \edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
+ \expandafter\pgfplotsapplistXpushback\pgfplots@loc@TMPa\to\pgfplotslibrarysurf@binarystream@accum
+ \pgfplotslibrarysurf@advancestreamlen{10}%
+}
+
+\def\pgfplotslibrarysurfactivateshadefill{%
+ \pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa%
+ \expandafter\pgfutil@addpdfresource@patterns\expandafter{\pgfplots@loc@TMPa}%%
+}
+
+%--------------------------------------------------
+% \def\pgfplotslibrarysurfdraw{%
+% % \pgftext[at=\pgfqpoint{0pt}{0pt}]%
+% {\pgfplotssys@do@surfshading}%
+% }%
+%--------------------------------------------------
+
+\def\pgfplotslibrarysurfdrawinpicture{%
+ \begingroup
+ \pgftransformshift{\pgfplotslibrarysurf@corner@sw}%
+ \pgftext[at=\pgfqpoint{0pt}{0pt},left,bottom] {%
+ \pgfplotslibrarysurfdraw
+% this does NOT work because I can't undo the box' shift:
+%\pgfplotssys@do@surfshading
+ }%
+ \endgroup
+}
+
+\pgfplotsiffileexists{pgflibrarypgfplots.surfshading.\pgfsysdriver}{%
+ \input pgflibrarypgfplots.surfshading.\pgfsysdriver\relax
+ \def\pgflibrarysurfshadingifactive#1#2{#1}%
+}{%
+ \def\pgfplotslibrarysurfdraw{%
+ \pgfplots@error{Sorry, surfshading (shader=interp) is NOT available for the selected driver `\pgfsysdriver'.}%
+ }%
+ \def\pgflibrarysurfshadingifactive#1#2{#2}%
+}
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/pgfplotslibrary.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/pgfplotslibrary.code.tex
new file mode 100644
index 00000000000..06bade77b9e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/pgfplotslibrary.code.tex
@@ -0,0 +1,56 @@
+% Copyright 2006 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+% Comment: This file has been modified to utilize libraries in the pgfplots package.
+% Edited by Nick Papior Andersen
+
+
+
+% Loading further libraries
+
+% Include a library file.
+%
+% #1 = List of names of library file.
+%
+% Description:
+%
+% This command includes a list of pgfplots library files. For each file X in the
+% list, the file tikzlibrarypgfplots.X.code.tex is included, provided this has
+% not been done earlier.
+%
+% For the convenience of Context users, both round and square brackets
+% are possible for the argument.
+%
+% Example:
+%
+% \usepgfplotslibrary{units}
+% \usepgfplotslibrary[units,dateplot]
+
+\def\usepgfplotslibrary{\pgfutil@ifnextchar[{\use@pgfplotslibrary}{\use@@pgfplotslibrary}}%}
+\def\use@pgfplotslibrary[#1]{\use@@pgfplotslibrary{#1}}
+\def\use@@pgfplotslibrary#1{%
+ \edef\pgf@list{#1}%
+ \pgfutil@for\pgf@temp:=\pgf@list\do{%
+ \expandafter\ifx\csname pgfp@library@\pgf@temp @loaded\endcsname\relax%
+ \expandafter\global\expandafter\let\csname pgfp@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
+ \expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
+ \expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
+ \catcode`\@=11
+ \catcode`\|=12
+ \pgfplots@iffileexists{tikzlibrarypgfplots.\pgf@temp.code.tex}{%
+ \input tikzlibrarypgfplots.\pgf@temp.code.tex}{%
+ \input pgflibrarypgfplots.\pgf@temp.code.tex}%
+ \catcode`\@=\csname tikz@library@#1@atcode\endcsname
+ \catcode`\|=\csname tikz@library@#1@barcode\endcsname
+ \fi%
+ }%
+}
+
+
+% Default loaded libraries:
+% Currently none
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarydateplot.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarydateplot.code.tex
deleted file mode 100644
index 161943d6c28..00000000000
--- a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarydateplot.code.tex
+++ /dev/null
@@ -1,75 +0,0 @@
-%--------------------------------------------
-%
-% Package pgfplots, library for high-level coordinates.
-%
-% Copyright 2007/2008 by Christian Feuersänger.
-%
-% This program is free software: you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation, either version 3 of the License, or
-% (at your option) any later version.
-%
-% This program is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License
-% along with this program. If not, see <http://www.gnu.org/licenses/>.
-%
-%--------------------------------------------
-
-\pgfutil@usemodule{pgfcalendar}
-
-% Idea: allow
-%--------------------------------------------------
-% \begin{tikzpicture}
-% \begin{axis}[
-% date coordinates in=x,
-% xticklabel={\day.\month.},
-% ]
-% \addplot coordinates {
-% (2008-01-5, 5)
-% (2008-01-12, 10)
-% (2008-01-16, 20)
-% };
-% \end{axis}
-% \end{tikzpicture}
-%--------------------------------------------------
-
-\def\pgfplots@truncate@to@julian#1.#2\pgfplots@EOI#3{#3=#1\relax}%
-
-\pgfplotsset{
- /pgfplots/date ZERO/.code={%
- \begingroup
- \pgfcalendardatetojulian{#1}\c@pgf@counta
- \edef\pgfmathresult{\the\c@pgf@counta}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
- \let\pgfplots@calender@ZEROSHIFT=\pgfmathresult
- },
- date ZERO=2006-01-01,
- /pgfplots/date coordinates in/.style={
- /pgfplots/#1 coord trafo/.code={%
- \begingroup
- \pgfcalendardatetojulian{##1}\c@pgf@counta
- \advance\c@pgf@counta by-\pgfplots@calender@ZEROSHIFT\relax
- \edef\pgfmathresult{\the\c@pgf@counta}%
- \pgfmath@smuggleone\pgfmathresult
- \endgroup
- },
- /pgfplots/#1 coord inv trafo/.code={%
- \begingroup
- \pgfplots@truncate@to@julian##1\pgfplots@EOI{\c@pgf@counta}%
- \advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax
- \expandafter
- \endgroup
- \expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day
- \edef\pgfmathresult{\year-\month-\day}%
- },
- /pgfplots/#1ticklabel={\tick},%
- /pgfplots/scaled #1 ticks=false,
- },
- /pgfplots/date coordinates in/.value required,
-}
-
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex
new file mode 100644
index 00000000000..8ac9a7631c0
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.dateplot.code.tex
@@ -0,0 +1,163 @@
+%--------------------------------------------
+%
+% Package pgfplots, library for high-level coordinates.
+%
+% Copyright 2007/2008/2009 by Christian Feuersänger.
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%--------------------------------------------
+
+\pgfutil@usemodule{pgfcalendar}
+
+% Idea: allow
+%--------------------------------------------------
+% \begin{tikzpicture}
+% \begin{axis}[
+% date coordinates in=x,
+% xticklabel={\day.\month.},
+% ]
+% \addplot coordinates {
+% (2008-01-5, 5)
+% (2008-01-12, 10)
+% (2008-01-16, 20)
+% };
+% \end{axis}
+% \end{tikzpicture}
+%--------------------------------------------------
+
+\def\pgfplotslibdateplot@number@to@julian@and@time#1.#2\julianto#3\hourto#4\minuteto#5{%
+ #3=#1
+ \pgf@xa=0.#2pt
+ \multiply\pgf@xa by24
+ \afterassignment\pgfplots@gobble@until@relax
+ \c@pgf@countb=\the\pgf@xa\relax
+ \edef#4{\the\c@pgf@countb}%
+ \advance\pgf@xa by-#4pt
+ \multiply\pgf@xa by60
+ \afterassignment\pgfplots@gobble@until@relax
+ \c@pgf@countb=\the\pgf@xa\relax
+ % round minutes (we may loose precision here)
+ \advance\pgf@xa by-\the\c@pgf@countb pt
+ \ifdim\pgf@xa>0.5pt
+ \advance\c@pgf@countb by1
+ \fi
+ \edef#5{\the\c@pgf@countb}%
+}
+
+% #1 the date
+% #2 the hours
+% #3 the minutes
+% #4 is either empty or is the seconds.
+% #5 a macro which will be filled with the date part.
+% #6 the macro which will contain a number in the range [0,1]
+% representing hours and minutes.
+%
+% If you don't have seconds, you have to provide the second ':' sign
+% as dummy! In that case #4 will be empty.
+\def\pgfplotslibdateplot@map@time#1 #2:#3:#4\dateto#5\timeto#6{%
+ \pgf@xa=#2pt
+ \divide\pgf@xa by24
+ \pgf@xb=#3pt
+ \divide\pgf@xb by1440
+ \advance\pgf@xa by\pgf@xb
+ \ifdim\pgf@xa<0pt
+ \pgf@xa=0pt
+ \else
+ \ifdim\pgf@xa>1pt
+ \pgf@xa=1pt
+ \fi
+ \fi
+ \def#5{#1}%
+ \edef#6{\pgf@sys@tonumber\pgf@xa}%
+}%
+\def\pgfplotslibdateplot@discard@zero@dot 0.#1\to#2{\def#2{#1}}%
+
+\pgfplotsset{
+ /pgfplots/date ZERO/.code={%
+ \begingroup
+ \pgfcalendardatetojulian{#1}\c@pgf@counta
+ \edef\pgfmathresult{\the\c@pgf@counta}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+ \let\pgfplots@calender@ZEROSHIFT=\pgfmathresult
+ },
+ date ZERO=2006-01-01,
+ /pgfplots/date coordinates in/.style={
+ /pgfplots/#1 coord trafo/.code={%
+ \begingroup
+ \edef\pgfplotstempjuliandate{##1}%
+ % check if we also have a TIME like '2006-01-01 11:21'
+ \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}%
+ \ifpgfutil@in@
+ % we have a TIME!
+ \expandafter\pgfplotslibdateplot@map@time\pgfplotstempjuliandate:\dateto\pgfplotstempjuliandate\timeto\pgfplotstemptime
+ \else
+ \let\pgfplotstemptime=\pgfutil@empty
+ \fi
+ \expandafter\pgfcalendardatetojulian\expandafter{\pgfplotstempjuliandate}\c@pgf@counta
+ \advance\c@pgf@counta by-\pgfplots@calender@ZEROSHIFT\relax
+ \ifx\pgfplotstemptime\pgfutil@empty
+ % no time:
+ \edef\pgfmathresult{\the\c@pgf@counta}%
+ \else
+ % add time fraction (which should be in the range
+ % [0,1]).
+ \ifdim\pgfplotstemptime pt<1pt
+ % discard prefix '0.':
+ \expandafter\pgfplotslibdateplot@discard@zero@dot\pgfplotstemptime\to\pgfplotstemptime
+ \edef\pgfmathresult{\the\c@pgf@counta.\pgfplotstemptime}%
+ \else
+ % assume \pgfplotstemptime=1pt :
+ \advance\c@pgf@counta by1
+ \edef\pgfmathresult{\the\c@pgf@counta}%
+ \fi
+ \fi
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+ },
+ /pgfplots/#1 coord inv trafo/.code={%
+ \begingroup
+ \pgfplotslibdateplot@number@to@julian@and@time##1\julianto{\c@pgf@counta}\hourto\Hour\minuteto\Minute%
+ \advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax
+ \expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day
+ \xdef\pgfplotslibdateplot@TMP{%
+ \noexpand\def\noexpand\year{\year}%
+ \noexpand\def\noexpand\month{\month}%
+ \noexpand\def\noexpand\day{\day}%
+ \noexpand\def\noexpand\Hour{\Hour}%
+ \noexpand\def\noexpand\Minute{\Minute}%
+ }%
+ \endgroup
+ \pgfplotslibdateplot@TMP
+ \let\hour=\Hour
+ \let\minute=\Minute
+ \ifnum\hour<10
+ \edef\hour{0\hour}%
+ \fi
+ \ifnum\minute<10
+ \edef\minute{0\minute}%
+ \fi
+ \def\Second{0}%
+ \def\second{00}%
+ \edef\lowlevel{##1}%
+ \edef\pgfmathresult{\year-\month-\day}%
+ },
+ /pgfplots/#1ticklabel={\tick},%
+ /pgfplots/scaled #1 ticks=false,
+ /pgfplots/plot coordinates/math parser=false,%
+ },
+ /pgfplots/date coordinates in/.value required,
+}
+
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex
new file mode 100644
index 00000000000..2df18861a1e
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex
@@ -0,0 +1,98 @@
+%--------------------------------------------
+%
+% Package pgfplots, library for high-level coordinates.
+%
+% Copyright 2007/2008/2009 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 is a wrapper which loads the external library.
+%
+% If we have a recent pgf version, use its external lib. If not: load
+% the copy shipped with pgfplots.
+%
+% NOTE:
+% the external library has been written by Christian Feuersänger as
+% part of his work on pgfplots -- since it is general purpose, it is
+% part of tikz. A copy comes with pgfplots.
+%
+%
+
+\def\pgfplots@orig@pgfincludeexternalgraphics#1{%
+ \begingroup
+ \openin\r@pgfplots@reada=#1.dpth
+ \setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}%
+ \ifeof\r@pgfplots@reada
+ \box1
+ \else
+ \read\r@pgfplots@reada to\pgfincludeexternalgraphics@dp
+ \closein\r@pgfplots@reada
+ \dimen0=\pgfincludeexternalgraphics@dp\relax
+ \hbox{\lower\dimen0 \box1 }%
+ \fi
+ \endgroup
+}
+\def\pgfplots@orig@pgf@external@grab#1{%
+ \def\pgf@filename{#1}%
+ \setbox\pgfpic=\hbox\bgroup\bgroup%
+ \let\endpgfgraphicnamed=\pgf@externalend%
+}
+\def\pgfplots@orig@pgf@externalend{%
+ \unskip\egroup\egroup%
+ {%
+ \parindent0pt%
+% \leftmargin0pt%
+% \rightmargin0pt%
+ \dimen0\ht\pgfpic%
+ \advance\dimen0\dp\pgfpic%
+ \ifdim\dp\pgfpic=0pt\relax
+ \else% store the picture's depth. Otherwise, it would be lost.
+ \immediate\openout\pgf@plotwrite=\pgf@filename.dpth
+ \immediate\write\pgf@plotwrite{\the\dp\pgfpic}%
+ \immediate\closeout\pgf@plotwrite
+ \fi
+ \pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}%
+ \setbox0=\vbox{%
+ \kern -1truein%
+ \hbox{%
+ \kern -1truein%
+ \hbox to0pt{%
+ \wd\pgfexternal@startupbox=0pt%
+ \ht\pgfexternal@startupbox=0pt%
+ \dp\pgfexternal@startupbox=0pt%
+ \box\pgfexternal@startupbox%
+ \pgfsys@atbegindocument\hss}%
+ \box\pgfpic%
+ \kern 1truein}%
+ \kern1truein}%
+ \pgfexternal@originalshipout\box0%
+ }%
+}
+
+\pgfplotsiffileexists{tikzlibraryexternal.code.tex}{%
+ \usetikzlibrary{external}%
+}{%
+ % Backwards compatibility:
+ \input pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
+ \pgfkeys{
+ /pgf/images/include external/.code={\pgfimage{#1}},
+ }%
+ \let\pgfincludeexternalgraphics=\pgfplots@orig@pgfincludeexternalgraphics
+ \let\pgf@external@grab=\pgfplots@orig@pgf@external@grab
+ \let\pgf@externalend=\pgfplots@orig@pgf@externalend
+}%
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex
new file mode 100644
index 00000000000..ac81e8f5491
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.groupplots.code.tex
@@ -0,0 +1,330 @@
+%--------------------------------------------
+%
+% 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 2009 by Nick Papior Andersen.
+%
+% 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@group@sharedlabels
+
+\def\pgfplots@group@xticklabels{}
+\def\pgfplots@group@yticklabels{}
+\def\pgfplots@group@totalplots{1}
+\def\pgfplots@group@columns{1}
+\def\pgfplots@group@rows{1}
+\def\pgfplots@group@name{group}
+\def\pgfplots@group@style{}
+\gdef\pgfplots@group@rmopts{}
+\newcount\pgfplots@group@current@plot
+\newcount\pgfplots@group@current@row
+\newcount\pgfplots@group@current@column
+
+\usetikzlibrary{calc}
+
+\pgfkeys{
+ /pgfplots/group/.is family,
+ /pgfplots/group style/.store in=\pgfplots@group@style,
+ /pgfplots/group/horizontal sep/.initial=1cm,
+ /pgfplots/group/vertical sep/.initial=1cm,
+ /pgfplots/group/group size/.style args={#1 by #2}{/pgfplots/group/columns=#1,/pgfplots/group/rows=#2},
+ /pgfplots/group/group size/.default={1 by 1},
+ /pgfplots/group/columns/.store in=\pgfplots@group@columns,
+ /pgfplots/group/rows/.store in=\pgfplots@group@rows,
+ /pgfplots/group/every plot/.style=,
+ /pgfplots/group/shared labels/.is if=pgfplots@group@sharedlabels,
+ /pgfplots/group/shared labels=false,
+ /pgfplots/group/xticklabels at/.is choice,
+ /pgfplots/group/xticklabels at/all/.code=\def\pgfplots@group@xticklabels{all},
+ /pgfplots/group/xticklabels at/edge top/.code=\def\pgfplots@group@xticklabels{edgeT},
+ /pgfplots/group/xticklabels at/edge bottom/.code=\def\pgfplots@group@xticklabels{edgeB},
+ /pgfplots/group/xticklabels at=all,
+ /pgfplots/group/yticklabels at/.is choice,
+ /pgfplots/group/yticklabels at/all/.code=\def\pgfplots@group@yticklabels{all},
+ /pgfplots/group/yticklabels at/edge left/.code=\def\pgfplots@group@yticklabels{edgeL},
+ /pgfplots/group/yticklabels at/edge right/.code=\def\pgfplots@group@yticklabels{edgeR},
+ /pgfplots/group/yticklabels at=all,
+ /pgfplots/group/group name/.store in=\pgfplots@group@name,
+ /pgfplots/group/empty plot/.style={/pgfplots/hide axis=true},
+}
+
+\def\nextgroupplot{%
+ \pgfutil@ifnextchar[{\pgfplots@group@nextplot}{\pgfplots@group@nextplot[]}%}
+}
+
+%
+% The actual addition of the new plots
+%
+\def\pgfplots@group@nextplot[#1]{%
+ % Check if it legal to produce another plot
+ \ifnum\pgfplots@group@current@plot=\pgfplots@group@totalplots\relax
+ \pgfplots@warning{You are adding more plots than you specified, current plots=\the\pgfplots@group@current@plot\space vs. total allowed
+ plots=\pgfplots@group@totalplots.}
+ \else
+ %
+ % If there has been other plots before then end the plot
+ %
+ \ifnum0<\pgfplots@group@current@plot\relax
+ \endpgfplots@environment@opt
+ \fi
+ % Prepare for next plot, increment plot, row and column
+ \pgfplots@group@increment@numbers
+ % DEBUG: \message{DEBUG: Cur. Plot: \the\pgfplots@group@current@plot. Current Row: \the\pgfplots@group@current@row. Current Column: \the\pgfplots@group@current@column.}
+ % Creation of the new axis environment
+ \pgfplots@group@environment@create{#1}
+ \fi
+}
+%
+% This creates an environment according to which plots that have been typeset.
+% The code utilizes previous plots anchor points to position themselves, unless it's the
+% first plot.
+% Using the figure below to describe the code implementation:
+% ____ ____ ____
+%| | | | | |
+%| 1 | | 2 | | 3 |
+%|___| |___| |___|
+% ____ ____ ____
+%| | | | | |
+%| 4 | | 5 | | 6 |
+%|___| |___| |___|
+% ____ ____ ____
+%| | | | | |
+%| 7 | | 8 | | 9 |
+%|___| |___| |___|
+%
+% The plots anchors are as follows:
+% 1: plot is typeset normally
+% 2: the "1" plot anchor "east" is anchored to "west"
+% 3: the "2" plot anchor "east" is anchored to "west"
+% 4: the "1" plot anchor "south" is anchored to "north"
+% 5: the "2" plot anchor "south" is anchored to "north"
+% 6: the "3" plot anchor "south" is anchored to "north"
+% 7: the "4" plot anchor "south" is anchored to "north"
+% 8: the "5" plot anchor "south" is anchored to "north"
+% 9: the "6" plot anchor "south" is anchored to "north"
+%
+\def\pgfplots@group@environment@create#1{%
+ \ifnum1=\pgfplots@group@current@row\relax
+ \ifnum1=\pgfplots@group@current@column\relax
+ \pgfplots@environment@opt[name={\pgfplots@group@name\space c\the\pgfplots@group@current@column r\the\pgfplots@group@current@row},%
+ /pgfplots/group/every plot,%
+ /pgfplots/group/plot c\the\pgfplots@group@current@column r\the\pgfplots@group@current@row,%
+ #1]
+ \else
+ \pgfplotsgroupplotsmath@decrease\pgfplots@group@current@column
+ \xdef\pgfplots@glob@TMPb{\pgfplots@group@name\space c\pgfmathresult r\the\pgfplots@group@current@row}
+ \pgfplots@environment@opt[name={\pgfplots@group@name\space c\the\pgfplots@group@current@column r\the\pgfplots@group@current@row},%
+ /pgfplots/group/every plot,%
+ /pgfplots/group/plot c\the\pgfplots@group@current@column r\the\pgfplots@group@current@row,%
+ at={($(\pgfplots@glob@TMPb.east)+(\pgfkeysvalueof{/pgfplots/group/horizontal sep},0)$)},anchor=west,%
+ #1]
+ \fi
+ \else
+ \pgfplotsgroupplotsmath@decrease\pgfplots@group@current@row
+ \xdef\pgfplots@glob@TMPb{\pgfplots@group@name\space c\the\pgfplots@group@current@column r\pgfmathresult}
+ \pgfplots@environment@opt[name={\pgfplots@group@name\space c\the\pgfplots@group@current@column r\the\pgfplots@group@current@row},%
+ /pgfplots/group/every plot,%
+ /pgfplots/group/plot c\the\pgfplots@group@current@column r\the\pgfplots@group@current@row,%
+ at={($(\pgfplots@glob@TMPb.south)-(0,\pgfkeysvalueof{/pgfplots/group/vertical sep})$)},anchor=north,%
+ #1]%
+ \fi%
+}
+
+\def\pgfplots@group@determine@ticklabels{%
+ \def\pgfplots@loc@TMPa{all}
+ \def\pgfplots@loc@TMPb{edgeT}
+ \def\pgfplots@loc@TMPc{edgeB}
+ \ifx\pgfplots@loc@TMPa\pgfplots@group@xticklabels%
+ % Do nothing as all should have xticklabels
+ \fi
+ \gdef\pgfplots@glob@TMPa{}
+ \ifx\pgfplots@loc@TMPb\pgfplots@group@xticklabels%
+ \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r1/.append style={xticklabel pos=upper}}%
+ \ifnum1<\pgfplots@group@rows\relax
+ \foreach \pgfplots@row in {2,...,\pgfplots@group@rows} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xticklabels={}}}%
+ }%
+ \fi%
+ }%
+ \fi
+ \ifx\pgfplots@loc@TMPc\pgfplots@group@xticklabels%
+ \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@group@rows/.append style={xticklabel pos=lower}}%
+ \ifnum1<\pgfplots@group@rows\relax
+ \pgfplotsgroupplotsmath@decrease\pgfplots@group@rows
+ \foreach \pgfplots@row in {1,...,\pgfmathresult} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/xticklabels={}}}%
+ }%
+ \fi%
+ }%
+ \fi%
+ %
+ % Defining styles for the ytick's
+ %
+ \def\pgfplots@loc@TMPb{edgeL}
+ \def\pgfplots@loc@TMPc{edgeR}
+ \ifx\pgfplots@loc@TMPa\pgfplots@group@yticklabels%
+ % Do nothing as all should have yticklabels
+ \fi
+ \ifx\pgfplots@loc@TMPb\pgfplots@group@yticklabels%
+ \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c1r\pgfplots@row/.append style={yticklabel pos=left}}%
+ \ifnum1<\pgfplots@group@columns\relax
+ \foreach \pgfplots@column in {2,...,\pgfplots@group@columns} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/yticklabels={}}}%
+ }%
+ \fi%
+ }%
+ \fi
+ \ifx\pgfplots@loc@TMPc\pgfplots@group@yticklabels%
+ \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@group@columns r\pgfplots@row/.append style={yticklabel pos=right}}%
+ \ifnum1<\pgfplots@group@columns\relax
+ \pgfplotsgroupplotsmath@decrease\pgfplots@group@columns
+ \foreach \pgfplots@column in {1,...,\pgfmathresult} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.append style={/pgfplots/yticklabels={}}}%
+ }%
+ \fi%
+ }%
+ \fi%
+ \expandafter\pgfkeys\expandafter{\pgfplots@glob@TMPa}
+}
+
+%
+% The counters which are used to determine the current plot:
+% \pgfplots@group@current@plot
+% \pgfplots@group@current@column
+% \pgfplots@group@current@row
+% gets incremented according to the scheme below:
+% ____ ____ ____
+%| | | | | |
+%| 1 | | 2 | | 3 |
+%|___| |___| |___|
+% ____ ____ ____
+%| | | | | |
+%| 4 | | 5 | | 6 |
+%|___| |___| |___|
+% ____ ____ ____
+%| | | | | |
+%| 7 | | 8 | | 9 |
+%|___| |___| |___|
+% where the number matches the plot number.
+%
+\def\pgfplots@group@increment@numbers{%
+ \advance\pgfplots@group@current@plot by1
+ \ifnum\pgfplots@group@current@column=\pgfplots@group@columns\relax
+ \ifnum1=\pgfplots@group@current@plot\relax
+ \else
+ \advance\pgfplots@group@current@row by1
+ \fi
+ \pgfplots@group@current@column=1
+ \else
+ \advance\pgfplots@group@current@column by1
+ \fi
+}
+
+\def\pgfplots@group@get@plot@name#1,#2\in#3{%
+ \edef#3{c#1r#2}%
+}
+
+
+%
+% Setting up all possible styles in current plot
+% I.e. Setting:
+% /pgfplots/group/plot c1r1/.style=
+% /pgfplots/group/plot c2r1/.style=
+% ...
+% /pgfplots/group/plot c<columns>r<rows>/.style=
+%
+\def\pgfplots@group@individual@setup{%
+ \gdef\pgfplots@glob@TMPa{}
+ \foreach \pgfplots@column in {1,...,\pgfplots@group@columns} {%
+ \foreach \pgfplots@row in {1,...,\pgfplots@group@rows} {%
+ \expandafter\xdef\expandafter\pgfplots@glob@TMPa\expandafter{%
+ \pgfplots@glob@TMPa,/pgfplots/group/plot c\pgfplots@column r\pgfplots@row/.style=}%
+ }%
+ }%
+ \expandafter\pgfkeys\expandafter{\pgfplots@glob@TMPa}%
+}
+
+
+
+%
+% Implementation of the environment {groupplots}
+\def\pgfplots@environment@groupplot{%
+ \pgfutil@ifnextchar[{\pgfplots@@environment@groupplot}{\pgfplots@@environment@groupplot[\pgfutil@empty]}%
+}
+
+\def\endpgfplots@environment@groupplot{\endpgfplots@environment@opt\endgroup}
+
+\def\pgfplots@@environment@groupplot[#1]{%
+ \begingroup%
+ % Only find the keys column and row
+ % the following things appear to be complete... ?
+ \pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@group@rmopts}%
+ \let\pgfplots@group@rmopts=\pgfutil@empty
+ \pgfkeysinstallkeyfilter{/pgf/key filters/equals}{/pgfplots/group style}
+ \pgfkeysinstallkeyfilter{/pgf/key filters/is descendant of}{/pgfplots/group}
+ \pgfqkeysfiltered{/pgfplots}{#1}
+ \edef\pgfplots@loc@TMPa{%
+ \noexpand\pgfkeys{/pgfplots/group/.cd,\pgfplots@group@style}
+ }\pgfplots@loc@TMPa
+ \expandafter\pgfplots@set@options\expandafter{\pgfplots@group@rmopts}
+ \pgfplots@group@individual@setup
+ \pgfplots@group@determine@ticklabels
+ \pgfplots@group@current@plot=0%
+ \pgfplots@group@current@row=1%
+ \pgfplots@group@current@column=0%
+ \begingroup
+ \c@pgf@counta=\pgfplots@group@rows\relax
+ \multiply \c@pgf@counta by\pgfplots@group@columns\relax
+ \edef\pgfmathresult{\the\c@pgf@counta}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+ \edef\pgfplots@group@totalplots{\pgfmathresult}%
+ %DEBUG: \message{TEST: \pgfplots@group@totalplots, rows=\pgfplots@group@rows, columns=\pgfplots@group@columns}%
+}
+
+% Assigns \pgfmathresult as #1-1 (in integer arithmetics)
+%
+% #1 an integer (a register or something which expands to an integer).
+\def\pgfplotsgroupplotsmath@decrease#1{%
+ \begingroup
+ \c@pgf@counta=#1\relax
+ \advance\c@pgf@counta by-1
+ \edef\pgfmathresult{\the\c@pgf@counta}%
+ \pgfmath@smuggleone\pgfmathresult
+ \endgroup
+}
+
+\tikzaddtikzonlycommandshortcutlet\groupplot\pgfplots@environment@groupplot
+\tikzaddtikzonlycommandshortcutlet\endgroupplot\endpgfplots@environment@groupplot
+
+\endinput
diff --git a/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex
new file mode 100644
index 00000000000..5326db78aba
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.units.code.tex
@@ -0,0 +1,224 @@
+%--------------------------------------------
+%
+% 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 2009 by Nick Papior Andersen.
+%
+% This program is free software: you can redistribute it and/or modify
+% it under the terms of the GNU General Public License as published by
+% the Free Software Foundation, either version 3 of the License, or
+% (at your option) any later version.
+%
+% This program is distributed in the hope that it will be useful,
+% but WITHOUT ANY WARRANTY; without even the implied warranty of
+% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+% GNU General Public License for more details.
+%
+% You should have received a copy of the GNU General Public License
+% along with this program. If not, see <http://www.gnu.org/licenses/>.
+%
+%--------------------------------------------
+
+%
+% This file contains the implementation for using units in labels.
+%
+% Default the unit setting system isn't used, It is thus required to use the key "use units".
+%
+% Programming Structure:
+%
+% 1. All associated keys are first set. This includes some prefix values of the unit system.
+% In example one can redefine prefix and postfix such that units are shown on a per-user setting.
+%
+% 2. The other main thing is scaling of the dimension. If one uses units one might not
+% have scaled the data. For this the keys "scaled <axis> ticks" are used at a base 10.
+% Currently it is not provided to scale in other bases.
+% FIXME Adding of other bases.
+%
+% 3. Some predefined SI prefixes are specified which should minimize mistakes.
+% For example the key "change <axis> base,<axis> SI prefix=kilo" allows the
+% <axis> to be rescaled according to the above at base 10 with a factor of -3 and sets the
+% unit prefix to "k".
+% FIXME Adding other basis systems than SI. For example the addition of CGS units.
+
+\newif\ifpgfplots@units@change@x@base
+\newif\ifpgfplots@units@change@y@base
+\newif\ifpgfplots@units@change@z@base
+
+%
+% Constants for writing the unit marking
+%
+\def\pgfplots@units@marking@pre{}
+\def\pgfplots@units@marking@post{}
+
+\pgfkeys{%
+ /pgfplots/use units/.is if=pgfplots@units@use,%
+ /pgfplots/use units=true,% So when called from \usepgfplotslibrary{units} it's automatically 'on'
+ %
+ % Setup basic x settings
+ %
+ /pgfplots/x unit/.initial={},%
+ /pgfplots/x unit prefix/.initial={},%
+ /pgfplots/change x base/.is if=pgfplots@units@change@x@base,%
+ /pgfplots/change x base/.initial=false,%
+ %
+ % Setup basic y settings
+ %
+ /pgfplots/y unit/.initial={},%
+ /pgfplots/y unit prefix/.initial={},%
+ /pgfplots/change y base/.is if=pgfplots@units@change@y@base,%
+ /pgfplots/change y base/.initial=false,%
+ %
+ % Setup basic z settings
+ %
+ /pgfplots/z unit/.initial={},%
+ /pgfplots/z unit prefix/.initial={},%
+ /pgfplots/change z base/.is if=pgfplots@units@change@z@base,%
+ /pgfplots/change z base/.initial=false,%
+ %
+ % default markings of units. I.e. the surroundings of the unit:
+ % [unit markings=curly braces] yields {<unit>}
+ %
+ /pgfplots/unit marking pre/.store in={\pgfplots@units@marking@pre},%
+ /pgfplots/unit marking post/.store in={\pgfplots@units@marking@post},%
+ /pgfplots/unit markings/.is choice,%
+ /pgfplots/unit markings/parenthesis/.style={/pgfplots/unit marking pre={\left(},/pgfplots/unit marking post={\right)}},%
+ /pgfplots/unit markings/square braces/.style={/pgfplots/unit marking pre={\left[},/pgfplots/unit marking post={\right]}},%
+ /pgfplots/unit markings/curly braces/.style={/pgfplots/unit marking pre={\left\{},/pgfplots/unit marking post={\right\}}},%
+ /pgfplots/unit markings/slash space/.style={/pgfplots/unit marking pre={/$\space$},/pgfplots/unit marking post={\relax}},%
+ /pgfplots/unit markings=square braces,%
+ %
+ % The code used to type units, and the base change code.
+ %
+ /pgfplots/unit code/.code 2 args={\mathrm{#1#2}},%
+ /pgfplots/axis base prefix/.code args={axis #1 base #2 prefix #3}{%
+ \csname ifpgfplots@units@change@#1@base\endcsname%
+ \pgfkeys{/pgfplots/#1\space unit prefix={#3},%
+ /pgfplots/scaled #1\space ticks={base 10:#2},%
+ /pgfplots/#1tick scale label code/.code={\relax}%
+ }%
+ \else%
+ \pgfkeys{/pgfplots/#1\space unit prefix={#3}}%
+ \fi%
+ },%
+ %
+ % x SI prefixes
+ %
+ /pgfplots/x SI prefix/.is choice,%
+ /pgfplots/x SI prefix/yocto/.style={/pgfplots/axis base prefix={axis x base 24 prefix y}},%
+ /pgfplots/x SI prefix/zepto/.style={/pgfplots/axis base prefix={axis x base 21 prefix z}},%
+ /pgfplots/x SI prefix/atto/.style={/pgfplots/axis base prefix={axis x base 18 prefix a}},%
+ /pgfplots/x SI prefix/femto/.style={/pgfplots/axis base prefix={axis x base 15 prefix f}},%
+ /pgfplots/x SI prefix/pico/.style={/pgfplots/axis base prefix={axis x base 12 prefix p}},%
+ /pgfplots/x SI prefix/nano/.style={/pgfplots/axis base prefix={axis x base 9 prefix n}},%
+ /pgfplots/x SI prefix/micro/.style={/pgfplots/axis base prefix={axis x base 6 prefix \mu}},%
+ /pgfplots/x SI prefix/milli/.style={/pgfplots/axis base prefix={axis x base 3 prefix m}},%
+ /pgfplots/x SI prefix/centi/.style={/pgfplots/axis base prefix={axis x base 2 prefix c}},%
+ /pgfplots/x SI prefix/deci/.style={/pgfplots/axis base prefix={axis x base 1 prefix d}},%
+ /pgfplots/x SI prefix/deca/.style={/pgfplots/axis base prefix={axis x base -1 prefix da}},%
+ /pgfplots/x SI prefix/hecto/.style={/pgfplots/axis base prefix={axis x base -2 prefix h}},%
+ /pgfplots/x SI prefix/kilo/.style={/pgfplots/axis base prefix={axis x base -3 prefix k}},%
+ /pgfplots/x SI prefix/mega/.style={/pgfplots/axis base prefix={axis x base -6 prefix M}},%
+ /pgfplots/x SI prefix/giga/.style={/pgfplots/axis base prefix={axis x base -9 prefix G}},%
+ /pgfplots/x SI prefix/tera/.style={/pgfplots/axis base prefix={axis x base -12 prefix T}},%
+ /pgfplots/x SI prefix/peta/.style={/pgfplots/axis base prefix={axis x base -15 prefix P}},%
+ /pgfplots/x SI prefix/exa/.style={/pgfplots/axis base prefix={axis x base -18 prefix E}},%
+ /pgfplots/x SI prefix/zetta/.style={/pgfplots/axis base prefix={axis x base -21 prefix Z}},%
+ /pgfplots/x SI prefix/yotta/.style={/pgfplots/axis base prefix={axis x base -24 prefix Y}},%
+ %
+ % y SI prefixes
+ %
+ /pgfplots/y SI prefix/.is choice,%
+ /pgfplots/y SI prefix/yocto/.style={/pgfplots/axis base prefix={axis y base 24 prefix y}},%
+ /pgfplots/y SI prefix/zepto/.style={/pgfplots/axis base prefix={axis y base 21 prefix z}},%
+ /pgfplots/y SI prefix/atto/.style={/pgfplots/axis base prefix={axis y base 18 prefix a}},%
+ /pgfplots/y SI prefix/femto/.style={/pgfplots/axis base prefix={axis y base 15 prefix f}},%
+ /pgfplots/y SI prefix/pico/.style={/pgfplots/axis base prefix={axis y base 12 prefix p}},%
+ /pgfplots/y SI prefix/nano/.style={/pgfplots/axis base prefix={axis y base 9 prefix n}},%
+ /pgfplots/y SI prefix/micro/.style={/pgfplots/axis base prefix={axis y base 6 prefix \mu}},%
+ /pgfplots/y SI prefix/milli/.style={/pgfplots/axis base prefix={axis y base 3 prefix m}},%
+ /pgfplots/y SI prefix/centi/.style={/pgfplots/axis base prefix={axis y base 2 prefix c}},%
+ /pgfplots/y SI prefix/deci/.style={/pgfplots/axis base prefix={axis y base 1 prefix d}},%
+ /pgfplots/y SI prefix/deca/.style={/pgfplots/axis base prefix={axis y base -1 prefix da}},%
+ /pgfplots/y SI prefix/hecto/.style={/pgfplots/axis base prefix={axis y base -2 prefix h}},%
+ /pgfplots/y SI prefix/kilo/.style={/pgfplots/axis base prefix={axis y base -3 prefix k}},%
+ /pgfplots/y SI prefix/mega/.style={/pgfplots/axis base prefix={axis y base -6 prefix M}},%
+ /pgfplots/y SI prefix/giga/.style={/pgfplots/axis base prefix={axis y base -9 prefix G}},%
+ /pgfplots/y SI prefix/tera/.style={/pgfplots/axis base prefix={axis y base -12 prefix T}},%
+ /pgfplots/y SI prefix/peta/.style={/pgfplots/axis base prefix={axis y base -15 prefix P}},%
+ /pgfplots/y SI prefix/exa/.style={/pgfplots/axis base prefix={axis y base -18 prefix E}},%
+ /pgfplots/y SI prefix/zetta/.style={/pgfplots/axis base prefix={axis y base -21 prefix Z}},%
+ /pgfplots/y SI prefix/yotta/.style={/pgfplots/axis base prefix={axis y base -24 prefix Y}},%
+ %
+ % z SI prefixes
+ %
+ /pgfplots/z SI prefix/.is choice,%
+ /pgfplots/z SI prefix/yocto/.style={/pgfplots/axis base prefix={axis z base 24 prefix y}},%
+ /pgfplots/z SI prefix/zepto/.style={/pgfplots/axis base prefix={axis z base 21 prefix z}},%
+ /pgfplots/z SI prefix/atto/.style={/pgfplots/axis base prefix={axis z base 18 prefix a}},%
+ /pgfplots/z SI prefix/femto/.style={/pgfplots/axis base prefix={axis z base 15 prefix f}},%
+ /pgfplots/z SI prefix/pico/.style={/pgfplots/axis base prefix={axis z base 12 prefix p}},%
+ /pgfplots/z SI prefix/nano/.style={/pgfplots/axis base prefix={axis z base 9 prefix n}},%
+ /pgfplots/z SI prefix/micro/.style={/pgfplots/axis base prefix={axis z base 6 prefix \mu}},%
+ /pgfplots/z SI prefix/milli/.style={/pgfplots/axis base prefix={axis z base 3 prefix m}},%
+ /pgfplots/z SI prefix/centi/.style={/pgfplots/axis base prefix={axis z base 2 prefix c}},%
+ /pgfplots/z SI prefix/deci/.style={/pgfplots/axis base prefix={axis z base 1 prefix d}},%
+ /pgfplots/z SI prefix/deca/.style={/pgfplots/axis base prefix={axis z base -1 prefix da}},%
+ /pgfplots/z SI prefix/hecto/.style={/pgfplots/axis base prefix={axis z base -2 prefix h}},%
+ /pgfplots/z SI prefix/kilo/.style={/pgfplots/axis base prefix={axis z base -3 prefix k}},%
+ /pgfplots/z SI prefix/mega/.style={/pgfplots/axis base prefix={axis z base -6 prefix M}},%
+ /pgfplots/z SI prefix/giga/.style={/pgfplots/axis base prefix={axis z base -9 prefix G}},%
+ /pgfplots/z SI prefix/tera/.style={/pgfplots/axis base prefix={axis z base -12 prefix T}},%
+ /pgfplots/z SI prefix/peta/.style={/pgfplots/axis base prefix={axis z base -15 prefix P}},%
+ /pgfplots/z SI prefix/exa/.style={/pgfplots/axis base prefix={axis z base -18 prefix E}},%
+ /pgfplots/z SI prefix/zetta/.style={/pgfplots/axis base prefix={axis z base -21 prefix Z}},%
+ /pgfplots/z SI prefix/yotta/.style={/pgfplots/axis base prefix={axis z base -24 prefix Y}}%
+}
+%
+% The initial insert of labels. It utilizes the same method of implementation as
+% the default label typesetting.
+%
+\def\pgfplots@label@units#1{%
+ \pgfkeysgetvalue{/pgfplots/#1label}{\pgfplots@loc@TMPa}%
+ \pgfplots@loc@TMPa\space\pgfplots@label@units@@{#1}%
+}
+
+%
+% The main macro for typesetting the units. In steps:
+%
+% 1. Save the unit prefix, unit and the unit code in macros.
+%
+% 2. If the unit isn't present then don't utilize any of the things.
+% FIXME, should this also happen if the prefix is given? Currently it is not!
+%
+% 3. Defines \pgfplots@loc@TMPa as the real typeset label.
+% It inserts the <marking pre><unit prefix><unit><marking post>.
+% It is encapsulated within a $$ notation. Currently this is enough.
+% FIXME, maybe this should be changed to \ensuremath?
+%
+\def\pgfplots@label@units@@#1{%
+ \pgfkeysgetvalue{/pgfplots/#1\space unit prefix}{\pgfplots@loc@TMPb}%
+ \pgfkeysgetvalue{/pgfplots/#1\space unit}{\pgfplots@loc@TMPc}%
+ \ifx\pgfplots@loc@TMPc\pgfutil@empty%
+ \pgfutil@empty%
+ \else%
+ \ifx\pgfplots@loc@TMPb\pgfutil@empty%
+ $
+ \pgfplots@units@marking@pre
+ \pgfplots@invoke@pgfkeyscode{/pgfplots/unit code/.@cmd}{{}{\pgfkeysvalueof{/pgfplots/#1\space unit}}}
+ \pgfplots@units@marking@post
+ $%
+ \else%
+ $
+ \pgfplots@units@marking@pre
+ \pgfplots@invoke@pgfkeyscode{/pgfplots/unit code/.@cmd}{{\pgfkeysvalueof{/pgfplots/#1\space unit prefix}}{\pgfkeysvalueof{/pgfplots/#1\space unit}}}
+ \pgfplots@units@marking@post
+ $%
+ \fi%
+ \fi%
+}
+\endinput \ No newline at end of file