%--------------------------------------------
%
% 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-2013 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\pgfplots@oldcatcodesemicolon{\the\catcode`\;}%
\edef\pgfplots@oldcatcodedoublequote{\the\catcode`\"}%
\catcode`\;=12
\catcode`\"=12

\input pgfplotscore.code.tex
\input pgfplotslibrary.code.tex
\input pgfplotsoldpgfsupp_loader.code.tex
\input pgfplotsutil.code.tex
\input pgfplotscolormap.code.tex
\input pgfplotsstackedplots.code.tex
\input pgfplotsplothandlers.code.tex
\input pgfplots.scaling.code.tex
\input pgfplotscoordprocessing.code.tex
\input pgfplots.errorbars.code.tex
\input pgfplots.markers.code.tex
\input pgfplotsticks.code.tex
\input pgfplots.paths.code.tex


\usetikzlibrary{decorations,decorations.pathmorphing,decorations.pathreplacing}
\usepgfplotslibrary{contourlua}%

% FIXME: reduce number of variables!

\newif\ifpgfplots@bb@isactive
\newif\ifpgfplots@xislinear
\newif\ifpgfplots@has@label@information
\newif\ifpgfplots@yislinear
\newif\ifpgfplots@zislinear
\newif\ifpgfplots@reverse@legend
\newif\ifpgfplots@transpose@legend
\newif\ifpgfplots@allow@reversal@of@rel@axis@cs
\newif\ifpgfplots@scanline@verbose
\newif\ifpgfplots@plot@graphics@autoadjustaxis
\newif\ifpgfplots@scaleuniformly@warning
\newif\ifpgfplots@hide@obscured@xtick
\newif\ifpgfplots@hide@obscured@ytick
\newif\ifpgfplots@hide@obscured@ztick
\newif\ifpgfplots@enable@tick@line@clipping
\newcount\pgfplots@numplots
\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\ifpgfplotsplothandlermesh@patch@type@sampling
\newif\ifpgfplots@clip@limits@compatmode
\newif\ifpgfplots@clip@limits@x
\newif\ifpgfplots@clip@limits@y
\newif\ifpgfplots@clip@limits@z
\newif\ifpgfplots@clip
\newif\ifpgfplots@plot@coords@mathparser
\pgfplots@plot@coords@mathparsertrue
\newif\ifpgfplots@enlargelimits
\newif\ifpgfplots@enlargelimits@respect@figure@size
\pgfplots@enlargelimits@respect@figure@sizetrue
\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@identify@log@minor@tick@pos
\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@shownothingof@x
\newif\ifpgfplots@shownothingof@y
\newif\ifpgfplots@shownothingof@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@zticklabel@interval
\newif\ifpgfplots@stacked@reverse
\newif\ifpgfplots@stacked@plus
\newif\ifpgfplots@stacked@ignores@zero
\newif\ifpgfplots@plot@file@skipfirst
\newif\ifpgfplots@threedim
\newif\ifpgfplots@curplot@threedim
\newif\ifpgfplotsthreedim
\newif\ifpgfplots@curplot@isirrelevant
\newif\ifpgfplots@colorbar
\newif\ifpgfplots@deprecated@anchors
\newif\ifpgfplots@translategnuplot
\pgfplots@translategnuplottrue
\let\pgfnodepartimagebox=\pgfnodeparttextbox
\newif\ifpgfplotsplothandlermesh@internaldepth
\newif\ifpgfplotsplothandlermesh@hide@refined@edges
\newif\ifpgfplots@has@cell@picture
\newif\ifpgfplots@substitute@pgfpoint
\newif\ifpgfplots@LUA@backend@supported
\newif\ifpgfplots@threedim@log@sampling

\newif\ifpgfplots@collect@firstplot@astick
\newif\ifpgfplots@units@use

\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}

\def\pgfplotsifaxisthreedim#1#2{\ifpgfplots@threedim #1\else #2\fi}%
\def\pgfplotsifcurplotthreedim#1#2{\ifpgfplots@curplot@threedim #1\else #2\fi}%

% Invokes '#2' if a cycle list named '#1' exists and '#3' if not.
\long\def\pgfplotsifcyclelistexists#1#2#3{%
	\pgfutil@IfUndefined{pgfp@cyclist@\string#1@}{%
		\pgfkeysifdefined{/pgfplots/cycle list/\string#1/.@cmd}{%
			\pgfplotsthrow{cycle list instantiation needed}{#1}\pgfeov
			% note that we cannot instantiate it lazily at this point :-(
		}{}%
		#3%
	}{%
		#2%
	}%
}%

\def\pgfplots@label@upgrade@warning{%
	\ifpgfplots@threedim
		\pgfplotswarning{center lines upgrade required}\pgfeov%
		\global\let\pgfplots@label@upgrade@warning=\relax
	\fi
}%

% Creates a named plot cycle list.
%
% #1:  the name of the final list. Can be used in 'cycle list name'
% #2:  the list entries.
% 		It accepts the following formats:
% 		\pgfplotscreateplotcyclelist{name}{[of colormap]}%
% 		\pgfplotscreateplotcyclelist{name}{[of colormap=<colormap name>]}%
% 		\pgfplotscreateplotcyclelist{name}{[colors of colormap={<list> of <colormap name>}]}%
% 		\pgfplotscreateplotcyclelist{name}{[indices of colormap={<list> of <colormap name>}]}%
% 		\pgfplotscreateplotcyclelist{name}{[* of colormap as it is also available inside of colormap definitions]}
% 		\pgfplotscreateplotcyclelist{name}{comma-separated-list}
% 		\pgfplotscreateplotcyclelist{name}{'\\'-separated list(requires the last item to be terminated by '\\')}
\def\pgfplotscreateplotcyclelist#1#2{%
	\pgfplotscreateplotcyclelist@check@specials{#1}{#2}#2\pgfplots@EOI%
}%

\def\pgfplotscreateplotcyclelist@check@specials#1#2{%
	\pgfutil@ifnextchar[{%
		\pgfplotscreateplotcyclelist@check@specials@{#1}%
	}{%
		\pgfplotscreateplotcyclelist@check@specials@@{#1}{#2}%
	}%
}%
\def\pgfplotscreateplotcyclelist@check@specials@#1[#2]{%
	% the 'of colormap' feature uses the very same functionality as
	% the related functionality in colormap definitions.
	% We only replace two routines:
	%
	\begingroup
	\let\pgfplots@createcolormap@special@process@single@define=\pgfplots@createcolormap@special@process@single@define@CYCLE
	\let\pgfplots@createcolormap@special@process@list@separator=\pgfplots@createcolormap@special@process@list@separator@CYCLE
	\pgfplots@of@colormap@getresult{#2}%
	\global\let\pgfplots@glob@TMPa=\pgfplotsretval
	\endgroup
	%
	\t@pgfplots@tokb={#1}%
	\t@pgfplots@toka=\expandafter{\pgfplots@glob@TMPa}%
	\edef\pgfplots@loc@TMPa{\noexpand\pgfplotscreateplotcyclelist{\the\t@pgfplots@tokb}{\the\t@pgfplots@toka}}%
%\message{#2->^^J \meaning\pgfplots@loc@TMPa^^J}%
	\pgfplots@loc@TMPa
		%
		% FIXME implement:
		%--------------------------------------------------
		% \ifnum\pgfplots@glob@TMPb>\pgfkeysvalueof{/pgfplots/@cycle/max size} %
		% 	% cycle lists have quadratic runtime. Use small ones!
		% 	\pgfplotswarning{cycle list size limit reached}\pgfeov
		% 	\breakforeach
		% \fi
		%--------------------------------------------------
	%
	\pgfutil@ifnextchar\pgfplots@EOI{%
		\pgfplots@gobble@until@EOI
	}{%
		\pgfplotscreateplotcyclelist@check@specials@gobble@error{#2}%
	}%
}%

\def\pgfplotscreateplotcyclelist@check@specials@gobble@error#1#2\pgfplots@EOI{%
	\t@pgfplots@tokb={[#1]}%
	\t@pgfplots@toka={#2}%
	\pgfplots@error{Encountered unexpected characters '\the\t@pgfplots@toka' after option '\the\t@pgfplots@tokb' in cycle list definition}%
}%
\def\pgfplotscreateplotcyclelist@check@specials@@#1#2#3\pgfplots@EOI{%
	\expandafter\pgfplots@assign@list\csname pgfp@cyclist@\string#1@\endcsname{#2}%
}

\pgfqkeys{/pgfplots/@cycle}{%
	max size/.initial=80,
}

\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{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{linestyles}{solid,dashed,dotted}
\pgfplotscreateplotcyclelist{linestyles*}{solid,dashed,dotted,dashdotted,dashdotdotted}
\pgfplotscreateplotcyclelist{color list}{red,blue,black,yellow,brown,teal,orange,violet,cyan,green!70!black,magenta,gray}
\pgfplotscreateplotcyclelist{mark list}{%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=square*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=triangle*\\%
	every mark/.append style={solid},mark=star\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=diamond*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill!40},mark=otimes*\\%
	every mark/.append style={solid},mark=|\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=pentagon*\\%
	every mark/.append style={solid},mark=text,text mark=p\\%
	every mark/.append style={solid},mark=text,text mark=a\\%
}
\pgfplotscreateplotcyclelist{mark list*}{%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=square*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=triangle*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfsquare*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=pentagon*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfcircle*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill,rotate=180},mark=halfdiamond*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill!40},mark=otimes*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=diamond*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfsquare right*\\%
	every mark/.append style={solid,fill=\pgfplots@mark@list@fill},mark=halfsquare left*\\%
}
\def\pgfplots@mark@list@fill{\pgfkeysvalueof{/pgfplots/mark list fill}}
\let\pgfplotsmarklistfill=\pgfplots@mark@list@fill
\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\pgfplotsdeprecatedstylecheck#1{%
	\pgfkeysifdefined{#1/.@cmd}{%
		\begingroup
		\edef\pgfkeyscurrentkey{#1}%
		\pgfkeyssplitpath
		\pgfplots@warning{Loading deprecated style option
			\pgfkeyscurrentpath/\pgfkeyscurrentname.
			Please replace '\string\tikzstyle{\pgfkeyscurrentname}'
			with '\string\pgfplotsset{\pgfkeyscurrentname/.style={}}'
			(or '\string\pgfplotsset{\pgfkeyscurrentname/.append style={}}').}%
		\endgroup
		\pgfkeysvalueof{#1/.@cmd}\pgfeov
	}{}%
}%

\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}%
	}
}

\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@center\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south west\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@south east\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@east\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north east\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@north west\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@west\endcsname{1}
\expandafter\def\csname pgfplots@nodesnearcoordsalign@isanchor@baseline\endcsname{1}

% Sets the keys for /pgfplots/[xyz]ticklabel anchor.
% #1: one of [xyz]
% #2: the value
\def\pgfplots@setticklabel@anchor@for#1#2{%
	\def\pgfplots@loc@TMPa{#2}%
	\def\pgfplots@loc@TMPb{auto}%
	\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
		\expandafter\def\csname pgfplots@ticklabel@anchor@#1\endcsname{0}%
	\else
		\def\pgfplots@loc@TMPb{near ticklabel}%
		\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			\expandafter\def\csname pgfplots@ticklabel@anchor@#1\endcsname{1}%
		\else
			\def\pgfplots@loc@TMPb{tikz}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				\expandafter\def\csname pgfplots@ticklabel@anchor@#1\endcsname{2}%
			\else
				\pgfplots@error{Sorry, I got an unexpected value for '#1ticklabel anchor': '#2'. Expected one of 'auto', 'near ticklabel' or 'tikz'.}%
			\fi
		\fi
	\fi
}%

% Does the work for '[xyz]ticklabel pos'.
%
% #1: the axis (x,y or z).
% #2: the key argument. Accepts
% 	'lower',
% 	'upper',
% 	'default' -> depends on 'tick pos'
% 	'left' = 'lower',
% 	'bottom' = 'lower',
% 	'right' = 'upper'
% 	'top' = 'upper'.
%
\def\pgfplots@setkey@ticklabelpos#1#2{%
	\def\pgfplots@loc@TMPa{#2}%
	\def\pgfplots@loc@TMPb{lower}%
	\expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{l}%
	\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
		% =lower
	\else
		\def\pgfplots@loc@TMPb{upper}%
		\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			% = upper
			\expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{u}%
		\else
			\def\pgfplots@loc@TMPb{default}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				% = default
				\expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{}%
			\else
				\def\pgfplots@loc@TMPb{left}%
				\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
					% = left [ alias for 'lower' ]
				\else
					\def\pgfplots@loc@TMPb{right}%
					\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
						% = right [ alias for 'upper' ]
						\expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{u}%
					\else
						\def\pgfplots@loc@TMPb{bottom}%
						\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
							% = bottom [ alias for 'lower' ]
						\else
							\def\pgfplots@loc@TMPb{top}%
							\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
								% = top [ alias for 'upper' ]
								\expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{u}%
							\else
								\expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{}%
								\pgfplots@error{Sorry, the key '#1ticklabel pos' does not know what to do with '#2'... accepted values are 'default, 'lower', 'upper' and some aliases. Maybe you misspelled it?}%
							\fi
						\fi
					\fi
				\fi
			\fi
		\fi
	\fi
}%

% Sets 'x dir={normal,reverse}'
% #1: an axis
% #2: the key's value to apply
\def\pgfplots@setkey@axisdir@for#1#2{%
	\def\pgfplots@loc@TMPa{#2}%
	\def\pgfplots@loc@TMPb{normal}%
	\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
		\pgfkeyssetvalue{/pgfplots/#1 dir/value}{n}%
	\else
		\def\pgfplots@loc@TMPb{reverse}%
		\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			\pgfkeyssetvalue{/pgfplots/#1 dir/value}{r}%
		\else
			\pgfkeyssetvalue{/pgfplots/#1 dir/value}{n}%
			\pgfplots@error{Sorry, the key '#1 dir' does not know what to do with '#2'... accepted values are 'normal' or 'reverse'.}%
		\fi
	\fi
}%


\def\pgfplots@meshmode{n}% none
\def\pgfplotsplothandlermesh@flatmode{m}% mean

\def\pgfplots@cycle@multi@list@EOI{\pgfplots@cycle@multi@list@EOI}%
\def\pgfplots@cycle@multi@list#1{%
	\def\pgfplots@loc@TMPb{0}%
	\gdef\pgfplots@cycle@multi@list@finalize@{}%
	\pgfkeysinterruptkeyfilter
	\pgfplots@cycle@multi@list@#1\nextlist\pgfplots@cycle@multi@list@EOI
	\endpgfkeysinterruptkeyfilter
}%
\def\pgfplots@cycle@multi@list@#1\nextlist{%
	\pgfkeys@spdef\pgfplots@loc@TMPa{#1}%
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		% ignore it if someone provided too many \nextlist commands.
	\else
		% parse and store list:
		\begingroup
			% this deals with control sequences inside of #1:
			\pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@as@string
			\expandafter\pgfplots@cycle@multi@list@findnamed\pgfplots@as@string\pgfplots@EOI
			\global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa
		\endgroup
		\ifx\pgfplots@glob@TMPa\pgfutil@empty
			% create it:
			\pgfplotscreateplotcyclelist{/pgfplots/cycle multi list/@list\pgfplots@loc@TMPb}{#1}%
		\else
			% ok, take an existing one
			\expandafter\let\csname pgfp@cyclist@/pgfplots/cycle multi list/@list\pgfplots@loc@TMPb @\endcsname=\pgfplots@glob@TMPa
		\fi
		\begingroup
			\expandafter\pgfplotslistsize\csname pgfp@cyclist@/pgfplots/cycle multi list/@list\pgfplots@loc@TMPb @\endcsname\to\c@pgf@counta
			\edef\pgfmathresult{\the\c@pgf@counta}%
			\pgfmath@smuggleone\pgfmathresult
		\endgroup
		\pgfkeyslet{/pgfplots/cycle multi list/@totalN\pgfplots@loc@TMPb}\pgfmathresult
		\pgfkeyslet{/pgfplots/cycle multi list/@N\pgfplots@loc@TMPb}\pgfmathresult
%\def\temp{#1}\message{cycle multi list/@list={\meaning\temp}; /@N\pgfplots@loc@TMPb = \pgfkeysvalueof{/pgfplots/cycle multi list/@N\pgfplots@loc@TMPb}^^J}%
		\pgfplotsutil@advancestringcounter\pgfplots@loc@TMPb
	\fi
	%
	\pgfutil@ifnextchar{\pgfplots@cycle@multi@list@EOI}{%
		\pgfplots@cycle@multi@list@finalize
	}{%
		\pgfplots@cycle@multi@list@
	}%
}%

\def\pgfplots@colormap@catcodemagic{colormap}
\pgfplots@command@to@string\pgfplots@colormap@catcodemagic\pgfplots@colormap@catcodemagic

% checks for
% - <known list>
% - [<elements> of]<known list>
% POSTCONDITION:
% 	1. pgfplots@loc@TMPa will be \pgfutil@empty if there is no such
% 	list.
% 	2. \pgfplots@loc@TMPa will be \let to the list if there is one.
% 	3. \pgfplots@cycle@multi@list@finalize@ will contain any 'partial sublist'
% 	commands.
\def\pgfplots@cycle@multi@list@findnamed{\pgfutil@ifnextchar[{\pgfplots@cycle@multi@list@findnamed@}{\pgfplots@cycle@multi@list@findnamed@[]}}%
\def\pgfplots@cycle@multi@list@findnamed@[#1]#2\pgfplots@EOI{%
	\def\pgfplots@loc@TMPa{#1}%
	\pgfplots@loc@tmptrue
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
	\else
		\expandafter\pgfutil@in@\expandafter{\pgfplots@colormap@catcodemagic}{#1}%
		\ifpgfutil@in@
			% ups! This is actually one of
			% [of colormap]
			% [colors of colormap={...}]
			% [indices of colormap={...}]
			% which define a single cycle list! This is not what we aim
			% for. Abort
			\let\pgfplots@loc@TMPa=\pgfutil@empty
			\pgfplots@loc@tmpfalse
		\else
			\pgfplots@cycle@multi@list@findnamed@@#1 \pgfplots@EOI
		\fi
	\fi
	%
	\ifpgfplots@loc@tmp
		\pgfplotsifcyclelistexists{#2}{%
			\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@cyclist@\string#2@\endcsname%
		}{%
			\let\pgfplots@loc@TMPa=\pgfutil@empty
		}%
	\fi
}
% #1: <elements> (an integer)
\def\pgfplots@cycle@multi@list@findnamed@@#1 {%
	\pgfutil@ifnextchar o
		{\pgfplots@cycle@multi@list@findnamed@@@{#1}}%
		{\pgfplots@cycle@multi@list@findnamed@@@{#1}of}%
}%
\def\pgfplots@cycle@multi@list@findnamed@@@#1of#2\pgfplots@EOI{%
	\begingroup
		\t@pgfplots@toka=\expandafter{\pgfplots@cycle@multi@list@finalize@}%
		\t@pgfplots@tokb={#1}%
		\xdef\pgfplots@cycle@multi@list@finalize@{\the\t@pgfplots@toka
			\noexpand\pgfkeys{/pgfplots/cycle multi list/partial sublist={\pgfplots@loc@TMPb}{\the\t@pgfplots@tokb}}%
		}%
	\endgroup
}

\def\pgfplots@cycle@multi@list@finalize\pgfplots@cycle@multi@list@EOI{%
	\pgfkeyslet{/pgfplots/cycle multi list/@dim}\pgfplots@loc@TMPb
	\pgfplots@cycle@multi@list@finalize@
	\c@pgf@countd=0 %
	\c@pgf@counta=0 %
	\pgfplotsloop{%
		\ifnum\c@pgf@counta<\pgfplots@loc@TMPb\relax
			\pgfplotsloopcontinuetrue
		\else
			\pgfplotsloopcontinuefalse
		\fi
	}{%
		\pgfkeysgetvalue{/pgfplots/cycle multi list/@N\the\c@pgf@counta}\pgfplots@cycle@N
		\ifnum\c@pgf@countd<\pgfplots@cycle@N\relax
			\c@pgf@countd=\pgfplots@cycle@N\relax
		\fi
		\advance\c@pgf@counta by1
	}%
	\edef\pgfplots@loc@TMPd{\the\c@pgf@countd}%
	\pgfkeyslet{/pgfplots/cycle multi list/@maxlen}\pgfplots@loc@TMPd
%\message{cycle multi list/@maxlen=\pgfplots@loc@TMPd^^J}%
}%

\def\pgfplots@pgfkeys@set@point@meta@value#1{%
	%
	\pgfutil@in@{=}{#1}%
	\ifpgfutil@in@
		\def\pgfplots@loc@TMPa##1=##2\pgfplots@EOI{%
			% remove spaces from ##1 and ##2:
			\pgfkeys@spdef\pgfplots@loc@TMPa{##1}%
			\pgfkeys@spdef\pgfplots@loc@TMPb{##2}%
			%
			% check if the argument is known:
			\pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPa/.@cmd}{%
				\def\pgfplots@loc@TMPc{%
					\pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/\pgfplots@loc@TMPa/.@cmd}%
				}%
				\expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPb}%
			}{%
				% oh, then it will be a math expression.
				\pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/expr/.@cmd}{#1}%
			}%
		}%
		% disassemble key'='value:
		\pgfplots@loc@TMPa#1\pgfplots@EOI
	\else
		% the following code allows
		% 'point meta=\thisrow{xcol}' even though
		% \thisrow might be undefined in the context where keys are set.
		% I convert the argument to a string.
		\def\pgfplots@loc@TMPa{#1}%
		\pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPb
		%
		\pgfkeysifdefined{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{%
			% ok, use it!
			\pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/\pgfplots@loc@TMPb/.@cmd}{}%
		}{%
			% oh, then it will be a math expression.
			\pgfplots@invoke@pgfkeyscode{/pgfplots/point meta/expr/.@cmd}{#1}%
		}%
	\fi
	%
	%
}%

\def\pgfplots@color@of@colormap@parse#1{%
	\pgfutil@in@{of }{#1}%
	\ifpgfutil@in@
		\pgfplots@color@of@colormap@parse@in#1\pgfplots@EOI
	\else
		\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@color@of@colormap@name
		\edef\pgfplots@color@of@colormap@value{#1}%
	\fi
}%
\def\pgfplots@color@of@colormap@parse@in#1of #2\pgfplots@EOI{%
	\pgfkeys@spdef\pgfplots@color@of@colormap@value{#1}%
	\edef\pgfplots@color@of@colormap@value{\pgfplots@color@of@colormap@value}%
	\pgfkeys@spdef\pgfplots@color@of@colormap@name{#2}%
}
% defines
% - \pgfmathresult to be the resulting color.
% - \pgfplots@color@of@colormap@name the name of the colormap
\def\pgfplots@color@of@colormap@define#1{%
	\pgfplots@color@of@colormap@parse{#1}%
	%
	\pgfplotscolormapifdefined{\pgfplots@color@of@colormap@name}{}{%
		% hm... the colormap does not exist? Perhaps someone used '4 of colormap/cool'. Try to define it!
		\pgfkeysifdefined{/pgfplots/\pgfplots@color@of@colormap@name/.@cmd}{%
			\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@color@of@colormap@name@old
			\pgfplotsset{\pgfplots@color@of@colormap@name}%
			\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@color@of@colormap@name
			\pgfkeyslet{/pgfplots/colormap name}\pgfplots@color@of@colormap@name@old
		}{%
			% let it run into an error...
		}%
	}%
	%
	\if m\pgfplots@color@of@colormap@access
		% colormap access=map
		\expandafter\pgfplotscolormapfind\expandafter[\pgfplotspointmetatransformedrange]%
			{\pgfplots@color@of@colormap@value}%
			{\pgfplots@color@of@colormap@name}%
	\else
		\if c\pgfplots@color@of@colormap@access
			% colormap access=piecewise constant
			\expandafter\pgfplotscolormapfindpiecewiseconst\expandafter[\pgfplotspointmetatransformedrange]%
				{\pgfplots@color@of@colormap@value}%
				{\pgfplots@color@of@colormap@name}%
		\else
			% colormap access=direct
			\pgfplotscolormapgetindex{\pgfplots@color@of@colormap@value}{\pgfplots@color@of@colormap@name}%
		\fi
	\fi
}%

\def\pgfplots@createcolormap@special@process@list@separator@CYCLE{\\}%
\def\pgfplots@createcolormap@special@process@single@define@CYCLE{%
	\edef\pgfplotsretval{%
		/tikz/color/.define=%
				{.}%
				{\csname pgfpl@cm@\pgfkeysvalueof{/pgfplots/colormap name}@colspace\endcsname}%
				{\pgfmathresult},%
		/tikz/color=.,%
	}%
}%
\def\pgfplots@color@of@colormap#1{%
	\begingroup
	\def\pgfplots@createcolormap@special@process@single@define{%
		\edef\pgfplotsretval{%
			\noexpand\pgfutil@definecolor{.}{\csname pgfpl@cm@\pgfkeysvalueof{/pgfplots/colormap name}@colspace\endcsname}{\pgfmathresult}%
		}%
		\let\pgfplots@createcolormap@special@process@single@define=\relax
	}%
	\pgfplots@of@colormap@getresult{#1}%
	\global\let\pgfplots@glob@TMPa=\pgfplotsretval
	\endgroup
	\pgfplots@glob@TMPa
	\tikzset{color=.}%
	%\pgfplots@color@of@colormap@define{#1}%
	%\def\pgfplots@loc@TMPb{\pgfutil@definecolor{.}{\csname pgfpl@cm@\pgfplots@color@of@colormap@name @colspace\endcsname}}%
	%\expandafter\pgfplots@loc@TMPb\expandafter{\pgfmathresult}%
	%\tikzset{color=.}%
}

\newif\ifpgfplots@stackedmode

\newif\ifpgfplotsplothandlermesh@shownormals

\pgfkeys{%
	% <key name>/.define layer set={<layer list>}{<style definition>}
	/handlers/.define layer set/.code 2 args={%
		\pgfkeyssetvalue{\pgfkeyscurrentpath/list}{#1}%
		\pgfkeysdef{\pgfkeyscurrentpath}{\pgfkeysalso{#2}}%
	}%
}

\newif\ifpgfplots@LUA@fail@on@TeX@fallback
\def\pgfplots@LUA@loglevel@info{4}
\def\pgfplots@LUA@loglevel@debug{5}

\pgfkeys{%
	/pgfplots/search path for tikz/.search also={/tikz,/pgfplots},
	/pgfplots/.is family,
	/pgfplots/scale/.is family,
	/pgfplots/legend/.is family,
	/pgfplots/tick/.is family,
	/pgfplots/axis/.is family,
	/pgfplots/descriptions/.is family,
	/pgfplots/style commands/.is family,
	/pgfplots/naming commands/.is family,
	/pgfplots/shared with tikz/.is family,
	/pgfplots/error bars/.is family,
	%
	% pgfplots uses the following (implicit) layers:
	% context:			   & associated layer name: \\
	% background path      & axis background   \\
	% grid lines           & axis grid         \\
	% tick lines		   & axis ticks        \\
	% axis lines		   & axis lines        \\
	% tick labels		   & axis tick labels  \\
	% plots				   & main              \\
	% axis descriptions	   & axis descriptions \\
	% plot marks		   & (see 'mark layer')\\
	% the 'axis on top' key will change that order by moving all plot- and mark-related paths upwards (they are drawn earlier).
	% None of these layers is mandatory; each can be omitted.
	% The magic layer name 'discard' can be used as /dev/null layer.
	%
	% the <layer set name> must be defined
	% set layers={<layer set name>}
	/pgfplots/set layers/.code={%
		\def\pgfplots@loc@TMPa{#1}%
		\def\pgfplots@loc@TMPb{none}%
		\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			\pgfkeysalso{%
				/pgfplots/activate layers=false,
				/pgfplots/set layers*={},
			}%
		\else
			\pgfkeysalso{%
				/pgfplots/activate layers=true,
				/pgfplots/set layers*={#1},
			}%
			\pgfplotsifinaxis{%
				\pgfkeysalso{/pgfplots/cell picture=if necessary}%
			}{%
				% we wrote it outside of an axis. In this case, we can
				% assume that it prepares multiple axis - which
				% REQUIRES to disable cell pictures.
				\pgfkeysalso{/pgfplots/cell picture=false}%
			}%
		\fi
	},
	% 'activate layers=false' is the same as 'set layers=none'.
	% However, 'activate layers=true' does not work unless a 'set layers'
	% has been installed as well.
	/pgfplots/activate layers/.is if=pgfplots@layered@graphics,
	/pgfplots/activate layers/.default=true,
	/pgfplots/set layers*/.code=\pgfplots@key@set@layers{#1},
	/pgfplots/set layers*/.default={/pgfplots/layers/standard},
	/pgfplots/@set layers arg/.initial=,
	/pgfplots/layers/.search also=/pgfplots,
	/pgfplots/layers/standard/.define layer set={axis background,axis grid,axis ticks,axis lines,axis tick labels,pre main,main,axis descriptions,axis foreground}{
		grid style=			{/pgfplots/on layer=axis grid},
		tick style=			{/pgfplots/on layer=axis ticks},
		axis line style=	{/pgfplots/on layer=axis lines},
		label style=		{/pgfplots/on layer=axis descriptions},
		legend style=		{/pgfplots/on layer=axis descriptions},
		title style=		{/pgfplots/on layer=axis descriptions},
		colorbar style=		{/pgfplots/on layer=axis descriptions},
		ticklabel style=	{/pgfplots/on layer=axis tick labels},
		axis background@ style={/pgfplots/on layer=axis background},
		3d box foreground style={/pgfplots/on layer=axis foreground},
	},
	/pgfplots/layers/axis on top/.define layer set={axis background,pre main,main,axis grid,axis ticks,axis lines,axis tick labels,axis descriptions,axis foreground}{
		/pgfplots/layers/standard
	},
	/pgfplots/on layer/.initial=,
	% mark layer can be 'auto', 'like plot', or a layer name.
	/pgfplots/mark layer/.initial=,
	/pgfplots/lua backend/.is if=pgfplots@LUA@backend@supported,
	/pgfplots/lua backend/.default=true,
	%
	/pgfplots/lua debug/.code={%
		\pgfqkeys{/pgfplots/lua debug}{#1}%
	},
	/pgfplots/lua debug/false/.style={/pgfplots/lua debug/off},%
	/pgfplots/lua debug/off/.code={%
		\def\pgfplots@LUA@backend@debugmode{off}%
		\def\pgfplots@LUA@loglevel@debug{5}%
		\def\pgfplots@LUA@loglevel@info{4}%
		\pgfplots@LUA@fail@on@TeX@fallbackfalse
	},
	/pgfplots/lua debug/off and silent/.code={%
		\def\pgfplots@LUA@backend@debugmode{off and silent}%
		\def\pgfplots@LUA@loglevel@debug{5}%
		\def\pgfplots@LUA@loglevel@info{5}%
		\pgfplots@LUA@fail@on@TeX@fallbackfalse
	},
	%
	/pgfplots/lua debug/verbose/.code={%
		\def\pgfplots@LUA@backend@debugmode{verbose}%
		\def\pgfplots@LUA@loglevel@debug{4}%
		\def\pgfplots@LUA@loglevel@info{4}%
		\pgfplots@LUA@fail@on@TeX@fallbackfalse
	},
	/pgfplots/lua debug/trace/.code={%
		\let\pgfplotsutil@directlua=\pgfplotsutil@directlua@trace
	},%
	/pgfplots/lua debug/compileerror/.code={%
		\def\pgfplots@LUA@backend@debugmode{compileerror}%
		\def\pgfplots@LUA@loglevel@debug{4}%
		\def\pgfplots@LUA@loglevel@info{4}%
		\pgfplots@LUA@fail@on@TeX@fallbacktrue
	},
	/pgfplots/lua debug/.default=verbose,
	/pgfplots/lua debug=off,
	/pgfplots/every axis/.style={},
	/pgfplots/every axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis}},
	/pgfplots/every axis/.belongs to family=/pgfplots/style commands,
	/pgfplots/every axis post/.style={},
	/pgfplots/every axis post/.belongs to family=/pgfplots/scale,
	/pgfplots/every semilogx axis/.style={},
	/pgfplots/every semilogx axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every semilogx axis}},
	/pgfplots/every semilogx axis/.belongs to family=/pgfplots/style commands,
	/pgfplots/every semilogy axis/.style={},
	/pgfplots/every semilogy axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every semilogy axis}},
	/pgfplots/every semilogy axis/.belongs to family=/pgfplots/style commands,
	/pgfplots/every loglog axis/.style={},
	/pgfplots/every loglog axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every loglog axis}},
	/pgfplots/every loglog axis/.belongs to family=/pgfplots/style commands,
	/pgfplots/every linear axis/.style={},
	/pgfplots/every linear axis/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every linear axis}},
	/pgfplots/every linear axis/.belongs to family=/pgfplots/style commands,
	/pgfplots/every axis plot/.style={},
	/pgfplots/every axis plot/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis plot}},
	/pgfplots/every axis plot/.belongs to family=/pgfplots/style commands,
	/pgfplots/every axis plot except legend/.style={},
	/pgfplots/every axis plot except legend/.belongs to family=/pgfplots/style commands,
	/pgfplots/axis plot except legend style/.style={/pgfplots/every axis plot except legend/.append style={#1}},
	/pgfplots/every axis plot post/.style={},
	/pgfplots/every axis plot post/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis plot}},
	/pgfplots/trig format plots/.is choice,
	/pgfplots/trig format plots/deg/.code={\def\pgfplots@set@trig@format@plots{\pgfkeys{/pgf/trig format=deg}}},%
	/pgfplots/trig format plots/rad/.code={\def\pgfplots@set@trig@format@plots{\pgfkeys{/pgf/trig format=rad}}},%
	/pgfplots/trig format plots/default/.code={\let\pgfplots@set@trig@format@plots=\relax},%
	/pgfplots/trig format plots/default,
	/pgfplots/no marks/.style={/pgfplots/no markers},
	/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/descriptions,
	/pgfplots/xlabel near ticks/.style={%
		/pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},%
		/pgfplots/every x tick scale label/.style={at={(xticklabel cs:0.9,5pt)},anchor=near xticklabel,inner sep=0pt},
	},%
	/pgfplots/xlabel absolute/.style={%
		/pgfplots/every axis x label/.style={at={(0.5,0)},below,yshift=-15pt},%
		/pgfplots/every x tick scale label/.style={at={(1,0)},yshift=-2em,left,inner sep=0pt},
	},%
	/pgfplots/every axis x label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis x label}},
	/pgfplots/every axis x label/.belongs to family=/pgfplots/descriptions,
	%
	/pgfplots/ylabel near ticks/.style={%
		/pgfplots/every axis y label/.style={at={(ticklabel cs:0.5)},rotate=90,anchor=near ticklabel},%
		/pgfplots/every y tick scale label/.style={at={(yticklabel* cs:1.03,-0.3em)},/pgfplots/near ticklabel align=outside,anchor=near yticklabel opposite,inner sep=0pt},
	},%
	/pgfplots/ylabel absolute/.style={%
		/pgfplots/every axis y label/.style={at={(0,0.5)},xshift=-35pt,rotate=90},
		/pgfplots/every y tick scale label/.style={at={(0,1)},above right,inner sep=0pt,yshift=0.3em},
	},%
	/pgfplots/every axis y label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis y label}},
	/pgfplots/every axis y label/.belongs to family=/pgfplots/descriptions,
	/pgfplots/every axis z label/.style={at={(ticklabel cs:0.5)},rotate=90, anchor=near ticklabel},
	/pgfplots/every axis z label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis z label}},
	/pgfplots/every axis z label/.belongs to family=/pgfplots/descriptions,
	/pgfplots/every 3d description/.style={%
		/pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},%
		/pgfplots/every axis y label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},%
		/pgfplots/every x tick scale label/.style={at={(xticklabel cs:0.95,5pt)},anchor=near xticklabel,inner sep=0pt},
		/pgfplots/every y tick scale label/.style={at={(yticklabel cs:0.95,5pt)},anchor=near yticklabel,inner sep=0pt},
		/pgfplots/try min ticks=3,%
	},%
	/pgfplots/every 3d view {0}{90}/.style={%
		/pgfplots/xlabel near ticks,%
		/pgfplots/ylabel near ticks,%
		/pgfplots/axis on top=true,%
	},%
	% will be defined in \pgfplotspoint@initialisation:
	%/tikz/sloped like x axis/.code={...},%
	/pgfplots/title shift/.code={\pgfplots@error{Sorry, there is no 'title shift' option. Consider using 'title style={yshift=...}' (or the low level 'every axis title shift' which works only together with the initial 'every axis title' style)}},%
	/pgfplots/every axis title shift/.initial=6pt,
	/pgfplots/every axis title/.style={at={(0.5,1)},above,yshift=\pgfkeysvalueof{/pgfplots/every axis title shift}},
	/pgfplots/every axis title/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis title}},
	/pgfplots/every axis title/.belongs to family=/pgfplots/descriptions,
	/pgfplots/every tick/.style={very thin,gray},
	/pgfplots/every tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every tick}},
	/pgfplots/every tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every inner x axis line/.style={},
	/pgfplots/every inner y axis line/.style={},
	/pgfplots/every 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},
	},
	/pgfplots/y axis line style/.style={
		/pgfplots/every outer y axis line/.append style={#1},
		/pgfplots/every inner y axis line/.append style={#1},
	},
	/pgfplots/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},
		/pgfplots/outer axis line style={#1}%
	},
	/pgfplots/separate axis lines/.is if=pgfplots@separate@axis@lines,
	/pgfplots/separate axis lines/.default=true,
	/pgfplots/every minor tick/.style={},
	/pgfplots/every minor tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor tick}},
	/pgfplots/every minor tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every major tick/.style={},
	/pgfplots/every major tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major tick}},
	/pgfplots/every major tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every x tick/.style={},
	/pgfplots/every x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every x tick}},
	/pgfplots/every x tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every minor x tick/.style={},
	/pgfplots/every minor x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor x tick}},
	/pgfplots/every minor x tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every major x tick/.style={},
	/pgfplots/every major x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major x tick}},
	/pgfplots/every major x tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every y tick/.style={},
	/pgfplots/every y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick}},
	/pgfplots/every y tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every minor y tick/.style={},
	/pgfplots/every minor y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor y tick}},
	/pgfplots/every minor y tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every major y tick/.style={},
	/pgfplots/every major y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y tick}},
	/pgfplots/every major y tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/every 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}},
	/pgfplots/every axis grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every minor grid/.style={},
	/pgfplots/every minor grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor grid}},
	/pgfplots/every minor grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every major grid/.style={},
	/pgfplots/every major grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major grid}},
	/pgfplots/every major grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every axis x grid/.style={},
	/pgfplots/every axis x grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis x grid}},
	/pgfplots/every axis x grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every minor x grid/.style={},
	/pgfplots/every minor x grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor x grid}},
	/pgfplots/every minor x grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every major x grid/.style={},
	/pgfplots/every major x grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major x grid}},
	/pgfplots/every major x grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every axis y grid/.style={},
	/pgfplots/every axis y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis y grid}},
	/pgfplots/every axis y grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every minor y grid/.style={},
	/pgfplots/every minor y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every minor y grid}},
	/pgfplots/every minor y grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every major y grid/.style={},
	/pgfplots/every major y grid/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every major y grid}},
	/pgfplots/every major y grid/.belongs to family=/pgfplots/style commands,
	/pgfplots/every 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,
	/pgfplots/every x tick label/.style={},
	/pgfplots/every x tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every x tick label}},
	/pgfplots/every x tick label/.belongs to family=/pgfplots/style commands,
	/pgfplots/every extra x tick/.style={
		/pgfplots/log identify minor tick positions=true,
		/pgfplots/hide obscured x ticks=false,
	},
	/pgfplots/every extra x tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every extra x tick}},
	/pgfplots/every extra x tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/extra x tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/extra x tick style/.code={%
		\pgfkeysalso{/pgfplots/every extra x tick/.append style={#1}}%
	},
	/pgfplots/extra tick style/.code={%
		\pgfkeysalso{%
			/pgfplots/every extra x tick/.append style={#1},%
			/pgfplots/every extra y tick/.append style={#1},%
			/pgfplots/every extra z tick/.append style={#1}}%
	},
	/pgfplots/every x tick scale label/.initial=,% set by compat/labels=...
	/pgfplots/every x tick scale label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every x tick scale label}},
	/pgfplots/every x tick scale label/.belongs to family=/pgfplots/descriptions,
	/pgfplots/every y tick label/.style={},
	/pgfplots/every y tick label/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every y tick label}},
	/pgfplots/every y tick label/.belongs to family=/pgfplots/style commands,
	/pgfplots/every extra y tick/.style={
		/pgfplots/log identify minor tick positions=true,
		/pgfplots/hide obscured y ticks=false,
	},
	/pgfplots/every extra y tick/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every extra y tick}},
	/pgfplots/every extra y tick/.belongs to family=/pgfplots/style commands,
	/pgfplots/extra y tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/extra y tick style/.code={%
		\pgfkeysalso{/pgfplots/every extra y tick/.append style={#1}}%
	},
	/pgfplots/every y tick scale label/.initial=,% set by compat/labels=...
	/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/descriptions,
	/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/hide obscured z ticks=false,
	},
	/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}}%
	},
	% FIXME : this is replicated in 'axis z line=box'!
	/pgfplots/every z tick scale label/.style={at={(zticklabel* cs:1.2,-0.3em)},anchor=near zticklabel,inner sep=0pt},
	/pgfplots/every z tick scale label/.belongs to family=/pgfplots/descriptions,
	/pgfplots/every axis legend/.style={%
		cells={anchor=center},
		inner xsep=3pt,inner ysep=2pt,nodes={inner sep=2pt,text depth=0.15em},
		anchor=north east,%
		shape=rectangle,%
		fill=white,%
		draw=black,
		at={(0.98,0.98)},
	},
	/pgfplots/every axis legend/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every axis legend}},
	/pgfplots/every axis legend/.belongs to family=/pgfplots/style commands,
	%
	% axis type:
	/pgfplots/axis type/.initial=rectangle,
	/pgfplots/axis type/.belongs to family=/pgfplots/scale,
	/pgfplots/@expected axis cs/.initial=cart,
	/pgfplots/every rectangle axis/.style={},
	%
	% see \pgfplotsdefinecstransform{<from>}{<to>}{<code>}
	/pgfplots/data cs/.initial=cart,% the coordinate system of provided data. Will be transformed to the axis' internal coordinate system (@expected axis cs).
	%
	% Colorbar interface:
	/pgfplots/colorbar/.is if=pgfplots@colorbar,
	/pgfplots/colorbar/.default=true,
	/pgfplots/colorbar to label/.style={/pgfplots/colorbar to name={#1}},
	/pgfplots/colorbar to name/.initial=,
	/pgfplots/colorbar source/.code={\pgfplots@error{Sorry, you can only set `colorbar source' inside of \string\addplot\space (or a cycle list)}},
	/pgfplots/colorbar source/.default=true,
	/pgfplots/colorbar pos*/.initial=,% one of 'rltb' (right, left, top, bottom). for internal use, to handle checks.
	/pgfplots/every colorbar global/.style={
		data cs=cart,
		axis on top,
		title=,
		xlabel=,
		ylabel=,
		zlabel=,
		legend entries=,
		grid=none,
		enlargelimits=false,
		scale only axis,
		xtick=,
		xticklabel=,
		ytick=,
		yticklabel=,
		zmin=,
		zmax=,
	},
	/pgfplots/colorbar right/.style={%
		/pgfplots/colorbar=true,
		/pgfplots/colorbar pos*=r,
		/pgfplots/colorbar shift/.style={xshift=0.3cm},
		/pgfplots/every colorbar/.style={%
			/pgfplots/every colorbar global,
			at={(parent axis.right of north east)},
			anchor=north west,
			xmin=0,
			xmax=1,
			ymin=\pgfkeysvalueof{/pgfplots/point meta min},
			ymax=\pgfkeysvalueof{/pgfplots/point meta max},
			height=\pgfkeysvalueof{/pgfplots/parent axis height},%
			width=\pgfkeysvalueof{/pgfplots/colorbar/width},
			xtick=\empty,
			yticklabel pos=right,% ATTENTION: I check for this setting in 'colorbar sampled line', see below!
			colorbar vertical/lowlevel,
		}%
	},%
	/pgfplots/colorbar left/.style={%
		/pgfplots/colorbar right,
		/pgfplots/colorbar pos*=l,
		/pgfplots/colorbar shift/.style={xshift=-0.3cm},
		/pgfplots/every colorbar/.append style={%
			at={(parent axis.left of north west)},
			anchor=north east,
			yticklabel pos=left,% ATTENTION: I check for this setting in 'colorbar sampled line', see below!
		}%
	},%
	/pgfplots/colorbar horizontal/.style={%
		/pgfplots/colorbar=true,
		/pgfplots/colorbar pos*=b,
		/pgfplots/colorbar shift/.style={yshift=-0.3cm},
		/pgfplots/every colorbar/.style={%
			/pgfplots/every colorbar global,
			at={(parent axis.below south west)},
			anchor=north west,
			ymin=0,
			ymax=1,
			xmin=\pgfkeysvalueof{/pgfplots/point meta min},
			xmax=\pgfkeysvalueof{/pgfplots/point meta max},
			width=\pgfkeysvalueof{/pgfplots/parent axis width},%
			height=\pgfkeysvalueof{/pgfplots/colorbar/width},
			xticklabel pos=left,
			ytick=\empty,
			colorbar horizontal/lowlevel,
		}%
	},%
	%
	% this here used to be the default up to (and including) pgfplots 1.13.
	% But it does not support the following use cases:
	% * 'colormap access=const',
	% * 'colorbar style={ytick=data}}'
	% * CMYK shadings
	% -> deprecated.
	/pgfplots/colorbar pgfshading/.style={%
		/pgfplots/colorbar,
		/pgfplots/colorbar/draw/.code={%
			\axis[every colorbar,colorbar shift,colorbar=false]
			\pgfkeysvalueof{/pgfplots/colorbar addplot}%
			\endaxis
		},%
		% You might wonder why this special treatment with '/lowlevel'
		% keys is necessary. Well, It turned out that using '##' inside of
		% styles is incompatible with '.add code' -- and therefor also
		% with '.append style'. This here is a work-around which works.
		/pgfplots/colorbar vertical/lowlevel/.style={%
			/pgfplots/colorbar addplot=\addplot graphics {};,
			plot graphics/xmin=0,%
			plot graphics/xmax=1,
			plot graphics/ymin=\pgfkeysvalueof{/pgfplots/point meta min},
			plot graphics/ymax=\pgfkeysvalueof{/pgfplots/point meta max},
			plot graphics/lowlevel draw/.code 2 args={%
				\if\pgfkeysvalueof{/pgfplots/y dir/value}n%
					\pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{####2}\pgfplots@loc@TMPa
				\else
					\pgfplotscolormapreversedtoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{####2}\pgfplots@loc@TMPa
				\fi
				\def\pgfplots@loc@TMPb{\pgfdeclareverticalshading{tempshading}{\pgfkeysvalueof{/pgfplots/colorbar/width}}}%
				\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}%
				\pgfuseshading{tempshading}%
			},%
		},
		/pgfplots/colorbar horizontal/lowlevel/.style={%
			/pgfplots/colorbar addplot=\addplot graphics {};,
			plot graphics/ymin=0,%
			plot graphics/ymax=1,
			plot graphics/xmin=\pgfkeysvalueof{/pgfplots/point meta min},
			plot graphics/xmax=\pgfkeysvalueof{/pgfplots/point meta max},
			plot graphics/lowlevel draw/.code 2 args={%
				\if\pgfkeysvalueof{/pgfplots/x dir/value}n%
					\pgfplotscolormaptoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{####1}\pgfplots@loc@TMPa
				\else
					\pgfplotscolormapreversedtoshadingspec{\pgfkeysvalueof{/pgfplots/colormap name}}{####1}\pgfplots@loc@TMPa
				\fi
				\def\pgfplots@loc@TMPb{\pgfdeclarehorizontalshading{tempshading}{\pgfkeysvalueof{/pgfplots/colorbar/width}}}%
				\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}%
				\pgfuseshading{tempshading}%
			},%
		},%
	},
	/pgfplots/colorbar addplot/.initial=\pgfplots@error{COLORBAR SYSTEM UNDEFINED},
	/pgfplots/colorbar/draw/.code={\pgfplots@error{COLORBAR SYSTEM UNDEFINED}},
	% --> the default is now 'colorbar sampled', see below:
	%
	% instantiate SOME defaults:
	/pgfplots/colorbar right,
	/pgfplots/colorbar=false,
	%
	/pgfplots/colorbar style/.style={/pgfplots/every colorbar/.append style={#1}},
	/pgfplots/colorbar/width/.initial=0.5cm,
	% see \pgfplotscolorbardrawstandalone
	/pgfplots/colorbar/standalone draw/.code={%
		\pgfplots@colorbar@get@rid@of@at@parent@axis
		\pgfplots@colorbar@draw@
	},
	/pgfplots/every colorbar sampled line/.style={help lines},
	/pgfplots/colorbar sampled line style/.style={/pgfplots/every colorbar sampled line/.append style={#1}},
	/pgfplots/colorbar sampled line/.style={%
		colorbar,
		/pgfplots/colorbar/draw/.code={%
			\axis[
				cycle list={#1\\},
				domain=\pgfkeysvalueof{/pgfplots/point meta min}:\pgfkeysvalueof{/pgfplots/point meta max},
				every colorbar,colorbar shift,colorbar=false]
			\pgfkeysvalueof{/pgfplots/colorbar addplot}%
			\endaxis
		},%
		/pgfplots/colorbar horizontal/lowlevel/.code={%
			\pgfkeysgetvalue{/pgfplots/colorbar pos*}\pgfplots@loc@TMPa
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
				\def\pgfplots@loc@TMPa{b}%
			\fi
			\if b\pgfplots@loc@TMPa
				\pgfkeysalso{axis x line*=bottom}% DEFAULT.
			\else
				\pgfkeysalso{axis x line*=top}%
			\fi
			\pgfkeysalso{%
				y axis line style={/pgfplots/every colorbar sampled line},
				/pgfplots/colorbar addplot={\addplot {0.5};},
				point meta=x,
			}%
		},%
		/pgfplots/colorbar vertical/lowlevel/.code={%
			\pgfkeysgetvalue{/pgfplots/colorbar pos*}\pgfplots@loc@TMPa
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
				\def\pgfplots@loc@TMPa{r}%
			\fi
			\if l\pgfplots@loc@TMPa
				\pgfkeysalso{axis y line*=left}%
			\else
				\pgfkeysalso{axis y line*=right}% DEFAULT
			\fi
			\pgfkeysalso{%
				x axis line style={/pgfplots/every colorbar sampled line},
				/pgfplots/colorbar addplot={\addplot (0.5,x);},
				point meta=y,
			}%
		},%
	},%
	/pgfplots/colorbar sampled line/.default={scatter,only marks},
	%
	/pgfplots/colorbar as palette/.style={
		colorbar sampled={
			surf,
			colormap access=direct,
			shader=flat corner,
			samples=\pgfplotscolormapsizeof
			{\pgfkeysvalueof{/pgfplots/colormap name}}+1,
		},
		colorbar style={
			point meta min=0,
			point meta max=\pgfplotscolormapsizeof
			{\pgfkeysvalueof{/pgfplots/colormap name}},
		},
	},
	%
	% A style which display exactly 1 tick label for each distinct color. It is similar to 'colorbar as palette'.
	% It is useful for non-uniform colormaps
	/pgfplots/colorbar as legend/.style={
		/pgfplots/colorbar sampled={},%
		/pgfplots/colorbar style={%
			% FIXME:  these styles could make use of some tuning ...
			ticklabel style={/pgf/number format/precision=3,/pgf/number format/relative*=3},
		},
		/pgfplots/colorbar horizontal/lowlevel/.append code={%
			\def\pgfplots@colorbar@as@legend@orientation{x}%
		},
		/pgfplots/colorbar vertical/lowlevel/.append code={%
			\def\pgfplots@colorbar@as@legend@orientation{y}%
		},
		%
		% ensure that our values
		% \pgfplots@colorbar@as@legend@orientation are available while
		% pgfplots processes the key filtering - otherwise we get
		% "undefined keys" below
		/pgfplots/colorbar horizontal/lowlevel/.belongs to family=/pgfplots/scale,
		/pgfplots/colorbar vertical/lowlevel/.belongs to family=/pgfplots/scale,
		%
		/pgfplots/colorbar/draw/.add code={%
			\begingroup
			\pgfkeys{/pgf/fpu}%
			\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@CM
			\begingroup
				\pgfplotsset{every colorbar}%
				\pgfmath@smuggleone\pgfplots@colorbar@as@legend@orientation
			\endgroup
			\pgfplotscolormapgetpositions[{\pgfkeysvalueof{/pgfplots/point meta min}}:{\pgfkeysvalueof{/pgfplots/point meta max}}]{\pgfplots@CM}%
			\edef\pgfplots@loc@TMPa{%
				\noexpand\pgfplotsarraynew\noexpand\positions{\pgfplotsretval}%
			}%
			\pgfplots@loc@TMPa
			%
			\c@pgf@countd=\pgfplotscolormaplastindexof{\pgfplots@CM}\relax
			\edef\pgfplots@colorcount{\the\c@pgf@countd}%
			\advance\c@pgf@countd by-1 %
			% XXX : this here is tailored for use with
			% * 'colormap access=const' and
			% * 'sample for=const'
			% where the last color is redundant and must not be
			% displayed in 'colorbar as legend' --> make it more
			% general!
			\edef\pgfplots@colorcount@minus@one{\the\c@pgf@countd}%
			%
			% accumulate a list of formatted positions into this
			% variable:
			\def\pgfplots@loc@TMPc{}%
			\pgfplotsforeachungrouped \x in {0,...,\pgfplots@colorcount} {%
				\pgfplotsarrayselect{\x}\of\positions\to\pgfplotsretval
				\edef\pgfplots@loc@TMPa{\noexpand\pgfmathprintnumber{\pgfplotsretval}}
				\t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPc}%
				\t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}%
				\edef\pgfplots@loc@TMPc{\the\t@pgfplots@toka \the\t@pgfplots@tokb,}%
			}%
			\t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPc}%
			\xdef\pgfplots@glob@TMPa{%
				\noexpand\pgfplotsset{%
					% this FORGETS the colormap positions intentionally...
					colormap={@temp@CM}{indices of colormap={0,...,\pgfplots@colorcount@minus@one of \pgfplots@CM}},
					% ... and normalizes the number range.
					point meta min=0,point meta max=1000,
					colorbar style={
						surf,shader=interp,
						colormap access=const,
						\pgfplots@colorbar@as@legend@orientation tick=data,
						% here we add the positions back into the
						% tick label:
						\pgfplots@colorbar@as@legend@orientation ticklabels={\the\t@pgfplots@tokb},
					},
				}%
			}%
			\endgroup
			\pgfplots@glob@TMPa
		}{%
			% no 'append' section
		},%
	},
	%
	/pgfplots/colorbar sampled/.style={%
		/pgfplots/colorbar,
		/pgfplots/colorbar/draw/.code={%
			\axis[
				view={0}{90},
				cycle list={#1\\},
				domain=\pgfkeysvalueof{/pgfplots/point meta min}:\pgfkeysvalueof{/pgfplots/point meta max},
				samples y=2,
				domain y=0:1,
				every colorbar,
				zmin=0,zmax=1,
				colorbar shift,colorbar=false]
			\pgfkeysvalueof{/pgfplots/colorbar addplot}%
			\endaxis
		},%
		/pgfplots/colorbar horizontal/lowlevel/.style={%
			/pgfplots/colorbar addplot={\addplot3 {0};},
			point meta=x,
		},%
		/pgfplots/colorbar vertical/lowlevel/.style={%
			/pgfplots/colorbar addplot={\addplot3 (y,x,0);},
			point meta=y,
		},%
	},%
	/pgfplots/colorbar sampled/.default={surf,mark=none,shader=flat},
% tick options:
	/pgfplots/xticklabel/.store in=	\pgfplots@xticklabel,
	/pgfplots/xticklabel/.belongs to family=/pgfplots/tick,
	/pgfplots/xticklabel=,
	/pgfplots/xticklabels/.belongs to family=/pgfplots/tick,
	/pgfplots/xticklabels/.code={%
		\pgfplotslistnew\pgfplots@xticklabels{#1}%
		\let\pgfplots@xticklabel=\pgfplots@user@ticklabel@list@x
	},
	% #1 table name or macro
	% #2 column name (or alias or create on use)
	/pgfplots/xticklabels from table/.code 2 args={%
		\pgfplotstablegetcolumn{#2}\of{#1}\to\pgfplots@xticklabels
		\let\pgfplots@xticklabel=\pgfplots@user@ticklabel@list@x
	},
	/pgfplots/xticklabels from table/.belongs to family=/pgfplots/tick,
	/pgfplots/yticklabels/.belongs to family=/pgfplots/tick,
	/pgfplots/yticklabels/.code={%
		\pgfplotslistnew\pgfplots@yticklabels{#1}%
		\let\pgfplots@yticklabel=\pgfplots@user@ticklabel@list@y
	},
	% #1 table name or macro
	% #2 column name (or alias or create on use)
	/pgfplots/yticklabels from table/.code 2 args={%
		\pgfplotstablegetcolumn{#2}\of{#1}\to\pgfplots@yticklabels
		\let\pgfplots@yticklabel=\pgfplots@user@ticklabel@list@y
	},
	/pgfplots/yticklabels from table/.belongs to family=/pgfplots/tick,
	/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={%
		\pgfplotslistnew\pgfplots@zticklabels{#1}%
		\let\pgfplots@zticklabel=\pgfplots@user@ticklabel@list@z
	},
	% #1 table name or macro
	% #2 column name (or alias or create on use)
	/pgfplots/zticklabels from table/.code 2 args={%
		\pgfplotstablegetcolumn{#2}\of{#1}\to\pgfplots@zticklabels
		\let\pgfplots@zticklabel=\pgfplots@user@ticklabel@list@z
	},
	/pgfplots/zticklabels from table/.belongs to family=/pgfplots/tick,
	/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=,
	/pgfplots/extra x tick labels/.belongs to family=/pgfplots/tick,
	/pgfplots/extra x tick labels/.code={%
		\pgfplotslistnew\pgfplots@extra@xticklabels{#1}%
		\let\pgfplots@extra@xticklabel=\pgfplots@user@extra@ticklabel@list@x
	},
	/pgfplots/extra y tick labels/.code={%
		\pgfplotslistnew\pgfplots@extra@yticklabels{#1}%
		\let\pgfplots@extra@yticklabel=\pgfplots@user@extra@ticklabel@list@y
	},
	/pgfplots/extra z tick labels/.code={%
		\pgfplotslistnew\pgfplots@extra@zticklabels{#1}%
		\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=,
	/pgfplots/extra x ticks/.store in=\pgfplots@extra@xtick,
	/pgfplots/extra x ticks/.belongs to family=/pgfplots/tick,
	/pgfplots/extra x ticks=,
	/pgfplots/xtickten/.store in=		\pgfplots@xtickten,
	/pgfplots/xtickten/.belongs to family=/pgfplots/tick,
	/pgfplots/xtickten=,
	/pgfplots/extra y tick label/.store in=	\pgfplots@extra@yticklabel,
	/pgfplots/extra y tick label/.belongs to family=/pgfplots/tick,
	/pgfplots/extra y tick label=,
	/pgfplots/ytick/.store in=			\pgfplots@ytick,
	/pgfplots/ytick/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick=,
	/pgfplots/extra y ticks/.store in=\pgfplots@extra@ytick,
	/pgfplots/extra y ticks/.belongs to family=/pgfplots/tick,
	/pgfplots/extra y ticks=,
	/pgfplots/ytickten/.store in=		\pgfplots@ytickten,
	/pgfplots/ytickten/.belongs to family=/pgfplots/tick,
	/pgfplots/ytickten=,
	/pgfplots/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/tick scale binop/.initial=\cdot,
	/pgfplots/xtick scale label code/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} 10^{#1}$},
	/pgfplots/xtick scale label code/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick scale label code/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} 10^{#1}$},
	/pgfplots/ytick scale label code/.belongs to family=/pgfplots/tick,
	/pgfplots/ztick scale label code/.code={$\pgfkeysvalueof{/pgfplots/tick scale binop} 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={$\pgfkeysvalueof{/pgfplots/tick scale binop} \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/.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={$\pgfkeysvalueof{/pgfplots/tick scale binop} \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={$\pgfkeysvalueof{/pgfplots/tick scale binop} \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 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,
	/pgfplots/scale ticks below exponent/.store in=	\pgfplots@scale@ticks@below@exponent,
	/pgfplots/scale ticks below exponent/.belongs to family=/pgfplots/tick,
	/pgfplots/scale ticks below exponent=-1,
	/pgfplots/minor x tick num/.initial=0,
	/pgfplots/minor x tick num/.belongs to family=/pgfplots/tick,
	/pgfplots/minor y tick num/.initial=0,
	/pgfplots/minor y tick num/.belongs to family=/pgfplots/tick,
	/pgfplots/minor 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 xtick/.initial=,
	/pgfplots/minor xtick/.belongs to family=/pgfplots/tick,
	/pgfplots/minor ytick/.initial=,
	/pgfplots/minor ytick/.belongs to family=/pgfplots/tick,
	/pgfplots/minor ztick/.initial=,
	/pgfplots/minor ztick/.belongs to family=/pgfplots/tick,
	/pgfplots/minor tick/.style={
		/pgfplots/minor xtick={#1},
		/pgfplots/minor ytick={#1},
		/pgfplots/minor ztick={#1},
	},
	/pgfplots/minor tick/.belongs to family=/pgfplots/tick,
	%
	/pgfplots/subtickwidth/.style=	{/pgfplots/minor tick length={#1}},
	/pgfplots/tickwidth/.style=		{/pgfplots/major tick length={#1}},
	/pgfplots/minor tick length/.belongs to family=/pgfplots/tick,
	/pgfplots/minor tick length/.initial=0.1cm,
	/pgfplots/major tick length/.belongs to family=/pgfplots/tick,
	/pgfplots/major tick length/.initial=0.15cm,
	%
	/pgfplots/xtick distance/.initial=,
	/pgfplots/ytick distance/.initial=,
	/pgfplots/ztick distance/.initial=,
	/pgfplots/max space between ticks/.estore in=\axisdefaulttickwidth,
	/pgfplots/max space between ticks/.belongs to family=/pgfplots/tick,
	/pgfplots/max space between ticks=35,% the maximum space between adjacent ticks (in pt, but don't specify the unit 'pt')
	/pgfplots/try min ticks/.estore in=			\axisdefaulttryminticks,
	/pgfplots/try min ticks/.belongs to family=/pgfplots/tick,
	/pgfplots/try min ticks=4,
	/pgfplots/try min ticks log/.estore in=			\pgfplots@default@try@minticks@log,
	/pgfplots/try min ticks log/.belongs to family=/pgfplots/tick,
	/pgfplots/try min ticks log=3,
	/pgfplots/log basis x/.initial=,
	/pgfplots/log basis y/.initial=,
	/pgfplots/log basis z/.initial=,
	/pgfplots/log base x/.style={log basis x={#1}},%
	/pgfplots/log base y/.style={log basis y={#1}},%
	/pgfplots/log base z/.style={log basis z={#1}},%
	/pgfplots/log plot exponent style/.style={/pgf/number format/fixed,/pgf/number format/precision=2},
	/pgfplots/log plot exponent style/.belongs to family=/pgfplots/tick,
	/pgfplots/log identify minor tick positions/.is if=pgfplots@identify@log@minor@tick@pos,
	/pgfplots/log identify minor tick positions/.belongs to family=/pgfplots/tick,
	/pgfplots/log identify minor tick positions=false,
	/pgfplots/log number format code/.code={%
		\begingroup
		\pgfmathlogtologten@{#1}%
		\ifpgfplots@identify@log@minor@tick@pos
			\expandafter\pgfplots@is@log@tick@a@minor@tick@pos\pgfmathresult\relax%
		\else
			\pgfplots@log@tick@isminor@tick@posfalse
		\fi
		\ifpgfplots@log@tick@isminor@tick@pos
			\pgfmathprintnumber[sci]{\pgfmathresult}%
		\else
			\pgfkeysalso{/pgfplots/log plot exponent style,/pgfplots/log base 10 number format code=\pgfmathresult}%
		\fi
		\endgroup
	},
	/pgfplots/log number format code/.belongs to family=/pgfplots/tick,
	/pgfplots/log base 10 number format code/.code={{\pgfplots@invoke@pgfkeyscode{/pgfplots/log number format basis/.@cmd}{{10}{#1}}}},
	/pgfplots/log base 10 number format code/.belongs to family=/pgfplots/tick,
	% #1 = basis
	% #2 = exponent
	/pgfplots/log number format basis/.code 2 args={$#1^{\pgfmathprintnumber{#2}}$},
	%
	% #1= number formatting options
	/pgfplots/log ticks with fixed point/.style={
		/pgfplots/log number format basis/.code 2 args={
			\begingroup
			\edef\pgfplots@exponent{##2}%
			\pgfkeysalso{/pgf/fpu}%
			% configure the style to avoid crap like
			% 10,000.2  or 0.000999937 :
			\pgfqkeys{/pgf/number format}{%
				% it is rounded relative to its (individual!) order of
				% magnitude:
				fixed relative,
				% ... and with three digits relative to its order of
				% magnitude. This should avoid rounding problems
				% since it is applied to each tick number
				% individually.
				precision=3,
			}%
			\ifdim##1pt=10pt
				\def\pgfplots@baselog{2.30258509299405}%
			\else
				\pgfmathparse{ln(##1)}%
				\let\pgfplots@baselog=\pgfmathresult
			\fi
			\pgfmathparse{exp(\pgfplots@exponent*\pgfplots@baselog)}%
			\pgfmathprintnumber[#1]\pgfmathresult
			\endgroup
		},
	},
	% takes #1 = [xyz]:
	/pgfplots/log basis ticks/.style={%
		/pgfplots/every #1 tick label/.append style={%
			/pgfplots/log number format code/.code={%
				\begingroup
				\pgfkeysalso{/pgfplots/log plot exponent style}%
				\pgfplots@invoke@pgfkeyscode{/pgfplots/log number format basis/.@cmd}{{\pgfkeysvalueof{/pgfplots/log basis #1}}{####1}}%
				\endgroup
			}%
		}%
	},
% sets \pgfplots@[xy]tickposnum to
	/pgfplots/xtick pos/.is choice,
	/pgfplots/xtick pos/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick pos/left/.code	={\def\pgfplots@xtickposnum{1}},
	/pgfplots/xtick pos/left/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick pos/right/.code	={\def\pgfplots@xtickposnum{3}},
	/pgfplots/xtick pos/right/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick pos/both/.code	={\def\pgfplots@xtickposnum{0}},
	/pgfplots/xtick pos/both/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick pos=both,
	/pgfplots/ytick pos/.is choice,
	/pgfplots/ytick pos/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick pos/left/.code	={\def\pgfplots@ytickposnum{1}},
	/pgfplots/ytick pos/left/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick pos/right/.code	={\def\pgfplots@ytickposnum{3}},
	/pgfplots/ytick pos/right/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick pos/both/.code	={\def\pgfplots@ytickposnum{0}},
	/pgfplots/ytick pos/both/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick pos=both,
	/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=both,
	/pgfplots/tickpos/.style={
		/pgfplots/xtick pos={#1},
		/pgfplots/ytick pos={#1},
		/pgfplots/ztick pos={#1}
	},
	/pgfplots/tickpos/.belongs to family=/pgfplots/tick,
	/pgfplots/tick pos/.style={/pgfplots/tickpos={#1}},
% sets the tick LABEL position, \pgfplots@[xy]ticklabel@pos
% to one of
% lower (alias left alias bottom)    : l
% upper (alias right alias top)      : u
% default: uses one matches 'tick pos'
	/pgfplots/xticklabel pos/.code={\pgfplots@setkey@ticklabelpos{x}{#1}},
	/pgfplots/xticklabel pos/.belongs to family=/pgfplots/tick,
	/pgfplots/xticklabel pos=default,
	/pgfplots/yticklabel pos/.code={\pgfplots@setkey@ticklabelpos{y}{#1}},
	/pgfplots/yticklabel pos/.belongs to family=/pgfplots/tick,
	/pgfplots/yticklabel pos=default,
	/pgfplots/zticklabel pos/.code={\pgfplots@setkey@ticklabelpos{z}{#1}},
	/pgfplots/zticklabel pos/.belongs to family=/pgfplots/tick,
	/pgfplots/zticklabel pos=default,
	/pgfplots/ticklabelpos/.style={/pgfplots/ticklabel pos={#1}},
	/pgfplots/ticklabel pos/.style={
		/pgfplots/xticklabel pos={#1},
		/pgfplots/yticklabel pos={#1},
		/pgfplots/zticklabel pos={#1},
	},
	% This feature is more or less deprecated.
	% The choice 'auto' should always use 'near ticklabel'.
	%
	% Choices are
	% 	'auto' (value 0),
	% 	'near ticklabel' (value 1),
	% 	'tikz' (value 2)
	% with values stored in \pgfplots@ticklabel@anchor@[xyz]
	/pgfplots/xticklabel anchor/.code={\pgfplots@setticklabel@anchor@for x{#1}},
	/pgfplots/xticklabel anchor/.belongs to family=/pgfplots/tick,
	/pgfplots/yticklabel anchor/.code={\pgfplots@setticklabel@anchor@for y{#1}},
	/pgfplots/yticklabel anchor/.belongs to family=/pgfplots/tick,
	/pgfplots/zticklabel anchor/.code={\pgfplots@setticklabel@anchor@for z{#1}},
	/pgfplots/zticklabel anchor/.belongs to family=/pgfplots/tick,
	/pgfplots/ticklabel anchor/.style={
		/pgfplots/xticklabel anchor={#1},
		/pgfplots/yticklabel anchor={#1},
		/pgfplots/zticklabel anchor={#1}
	},
	/pgfplots/ticklabel anchor=auto,
	/pgfplots/xticklabel shift/.initial=,
	/pgfplots/yticklabel shift/.initial=,
	/pgfplots/zticklabel shift/.initial=,
	/pgfplots/ticklabel shift/.style={
		/pgfplots/xticklabel shift={#1},
		/pgfplots/yticklabel shift={#1},
		/pgfplots/zticklabel shift={#1}
	},%
% sets \pgfplots@{x,y}tickalignnum to
% inside=0
% outside=1
% center=2
	/pgfplots/xtick align/.is choice,
	/pgfplots/xtick align/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick align/inside/.code	={\def\pgfplots@xtickalignnum{0}},
	/pgfplots/xtick align/inside/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick align/outside/.code	={\def\pgfplots@xtickalignnum{1}},
	/pgfplots/xtick align/outside/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick align/center/.code	={\def\pgfplots@xtickalignnum{2}},
	/pgfplots/xtick align/center/.belongs to family=/pgfplots/tick,
	/pgfplots/xtick align=inside,
	/pgfplots/ytick align/.is choice,
	/pgfplots/ytick align/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick align/inside/.code	={\def\pgfplots@ytickalignnum{0}},
	/pgfplots/ytick align/inside/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick align/outside/.code	={\def\pgfplots@ytickalignnum{1}},
	/pgfplots/ytick align/outside/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick align/center/.code	={\def\pgfplots@ytickalignnum{2}},
	/pgfplots/ytick align/center/.belongs to family=/pgfplots/tick,
	/pgfplots/ytick align=inside,
	/pgfplots/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,
	/pgfplots/anchor/.store in=			\pgfplots@anchorname,
	/pgfplots/anchor=south west,
	%
	% will be evaluated for *every* 'near ticklabel' anchor:
	/pgfplots/near ticklabel align/.is choice,
	/pgfplots/near ticklabel align/inside/.code= \def\pgfplots@borderanchor@align{0},
	/pgfplots/near ticklabel align/center/.code= \def\pgfplots@borderanchor@align{1},
	/pgfplots/near ticklabel align/outside/.code=\def\pgfplots@borderanchor@align{2},
	/pgfplots/near ticklabel align/center,
	%
	/tikz/near ticklabel at/.style={/pgfplots/near ticklabel at=#1},
	/pgfplots/near ticklabel at/.initial=,
	%
	/pgfplots/cell picture/.is choice,
	/pgfplots/cell picture/false/.code=\def\pgfplots@cell@picture@mode{0},
	/pgfplots/cell picture/true/.code=\def\pgfplots@cell@picture@mode{1},
	/pgfplots/cell picture/if necessary/.code=\def\pgfplots@cell@picture@mode{2},
	/pgfplots/cell picture/true, % backwards compatibility
	/pgfplots/log origin x/.is choice,
	/pgfplots/log origin x/infty/.code={\def\pgfplots@log@origin@choice@x{0}},
	/pgfplots/log origin x/0/.code={\def\pgfplots@log@origin@choice@x{1}},
	/pgfplots/log origin y/.is choice,
	/pgfplots/log origin y/infty/.code={\def\pgfplots@log@origin@choice@y{0}},
	/pgfplots/log origin y/0/.code={\def\pgfplots@log@origin@choice@y{1}},
	/pgfplots/log origin z/.is choice,
	/pgfplots/log origin z/infty/.code={\def\pgfplots@log@origin@choice@z{0}},
	/pgfplots/log origin z/0/.code={\def\pgfplots@log@origin@choice@z{1}},
	/pgfplots/log origin/.style={%
		/pgfplots/log origin x={#1},
		/pgfplots/log origin y={#1},
		/pgfplots/log origin z={#1},
	},
	/pgfplots/log origin=0,
% tick options:
	/pgfplots/ticks/.is choice,
	/pgfplots/ticks/.belongs to family=/pgfplots/tick,
	/pgfplots/ticks/none/.belongs to family=/pgfplots/tick,
	/pgfplots/ticks/none/.code={%
		\pgfplots@xminorticksfalse
		\pgfplots@yminorticksfalse
		\pgfplots@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,
	/pgfplots/grid/.belongs to family=/pgfplots/tick,
	/pgfplots/grid/none/.belongs to family=/pgfplots/tick,
	/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,
	/pgfplots/xminorticks/.is if=pgfplots@xminorticks,
	/pgfplots/xminorticks/.default=true,
	/pgfplots/xminorticks/.belongs to family=/pgfplots/tick,
	/pgfplots/xmajorticks/.is if=pgfplots@xmajorticks,
	/pgfplots/xmajorticks/.default=true,
	/pgfplots/xmajorticks/.belongs to family=/pgfplots/tick,
	/pgfplots/yminorticks/.is if=pgfplots@yminorticks,
	/pgfplots/yminorticks/.default=true,
	/pgfplots/yminorticks/.belongs to family=/pgfplots/tick,
	/pgfplots/ymajorticks/.is if=pgfplots@ymajorticks,
	/pgfplots/ymajorticks/.default=true,
	/pgfplots/ymajorticks/.belongs to family=/pgfplots/tick,
	/pgfplots/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,
	/pgfplots/xmajorgrids/.is if=pgfplots@xmajorgrids,
	/pgfplots/xmajorgrids/.default=true,
	/pgfplots/xmajorgrids/.belongs to family=/pgfplots/tick,
	/pgfplots/yminorgrids/.is if=pgfplots@yminorgrids,
	/pgfplots/yminorgrids/.default=true,
	/pgfplots/yminorgrids/.belongs to family=/pgfplots/tick,
	/pgfplots/ymajorgrids/.is if=pgfplots@ymajorgrids,
	/pgfplots/ymajorgrids/.default=true,
	/pgfplots/ymajorgrids/.belongs to family=/pgfplots/tick,
	/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,
	/pgfplots/legend to label/.style={/pgfplots/legend to name={#1}},
	/pgfplots/legend to name/.initial=,%
	/pgfplots/legend pos/.is choice,
	/pgfplots/legend pos/south west/.style={/pgfplots/legend style={at={(0.03,0.03)},anchor=south west}},
	/pgfplots/legend pos/south east/.style={/pgfplots/legend style={at={(0.97,0.03)},anchor=south east}},
	/pgfplots/legend pos/north west/.style={/pgfplots/legend style={at={(0.03,0.97)},anchor=north west}},
	/pgfplots/legend pos/north east/.style={/pgfplots/legend style={at={(0.97,0.97)},anchor=north east}},
	/pgfplots/legend pos/outer north east/.style={/pgfplots/legend style={at={(1.03,1)},anchor=north west}},
	/pgfplots/legend cell align/.is choice,
	/pgfplots/legend cell align/left/.style=	{/pgfplots/legend style={cells={anchor=west}}},
	/pgfplots/legend cell align/right/.style=	{/pgfplots/legend style={cells={anchor=east}}},
	/pgfplots/legend cell align/center/.style=	{/pgfplots/legend style={cells={anchor=center}}},
	/pgfplots/legend columns/.store in=\pgfplots@legend@columns,
	/pgfplots/legend columns/.belongs to family=/pgfplots/legend,
	/pgfplots/legend columns=1,
	/pgfplots/legend plot pos/.is choice,
	/pgfplots/legend plot pos/.belongs to family=/pgfplots/legend,
	/pgfplots/legend plot pos/left/.code=	{\def\pgfplots@legend@plot@pos{0}},
	/pgfplots/legend plot pos/left/.belongs to family=/pgfplots/legend,
	/pgfplots/legend plot pos/right/.code=	{\def\pgfplots@legend@plot@pos{1}},
	/pgfplots/legend plot pos/right/.belongs to family=/pgfplots/legend,
	/pgfplots/legend plot pos/none/.code=	{\def\pgfplots@legend@plot@pos{2}},
	/pgfplots/legend plot pos/none/.belongs to family=/pgfplots/legend,
	/pgfplots/legend plot pos=left,
	/pgfplots/every legend image post/.code={},%
	/pgfplots/legend image post style/.style={/pgfplots/every legend image post/.append style={#1}},
	/pgfplots/empty legend/.style={/pgfplots/legend image code/.code=},
	/pgfplots/line legend/.style={%
		/pgfplots/legend image code/.code={%
			\draw[%
				/pgfplots/mesh=false,%
				% reset bar options. This is to address the strange
				% backwards compatibility handling implemented by
				% \pgfplots@install@local@bar@handlers (see its docs).
				% This should not hurt at all since 'line legend' is
				% unsuitable for bar plots anyway.
				bar width=3pt,%
				bar shift=0pt,%
				%
				mark repeat=2,%
				mark phase=2,##1]
				plot coordinates {
					(0cm,0cm)
					(0.3cm,0cm)
					(0.6cm,0cm)%
				};%
		}%
	},
	/pgfplots/line legend/.style/.code={\pgfplots@error{This style is supposed to be constant.}},%
	/pgfplots/line legend/.append style/.code={\pgfplots@error{This style is supposed to be constant.}},%
	/pgfplots/line legend,
	/pgfplots/legend image code/.belongs to family=/pgfplots/legend,
	/pgfplots/reverse legend/.is if=pgfplots@reverse@legend,
	/pgfplots/reverse legend/.default=true,
	/pgfplots/transpose legend/.is if=pgfplots@transpose@legend,
	/pgfplots/transpose legend/.default=true,
	/pgfplots/legend transposed/.style={transpose legend=#1},
	/pgfplots/legend reversed/.style={reverse legend=#1},
% axis description options:
	/pgfplots/title/.initial=,
	/pgfplots/xlabel/.initial=,
	/pgfplots/ylabel/.initial=,
	/pgfplots/zlabel/.initial=,
	/pgfplots/xlabel shift/.initial=0pt,
	/pgfplots/ylabel shift/.initial=0pt,
	/pgfplots/zlabel shift/.initial=0pt,
	/pgfplots/label shift/.style={%
		/pgfplots/xlabel shift={#1},
		/pgfplots/ylabel shift={#1},
		/pgfplots/zlabel shift={#1},
	},%
	/pgfplots/extra description/.code=,
% axis options:
	/pgfplots/at/.code={%
		\pgfplots@assert@tikzinternal@exists{tikz@scan@one@point}%
		\tikz@scan@one@point\pgfplots@set@at#1},
	/pgfplots/at/.belongs to family=/pgfplots,
	/pgfplots/trim axis left/.code={%
		\pgfutil@ifundefined{pgfsettrimleft}{%
			\pgfplots@error{Sorry, the 'trim axis left' requires a more recent PGF version.}%
		}{%
			\pgfkeysalso{/tikz/trim left=(current axis.south west)}%
		}%
	},%
	/tikz/trim axis left/.style={/pgfplots/trim axis left},
	/pgfplots/trim axis right/.code={%
		\pgfutil@ifundefined{pgfsettrimleft}{%
			\pgfplots@error{Sorry, the 'trim axis right' requires a more recent PGF version.}%
		}{%
			\pgfkeysalso{/tikz/trim right=(current axis.south east)}%
		}%
	},%
	/tikz/trim axis right/.style={/pgfplots/trim axis right},
	/pgfplots/clip limits compat/.is if=pgfplots@clip@limits@compatmode,
	/pgfplots/clip limits if compat/.code={
		\ifpgfplots@clip@limits@compatmode
		\else
			\pgfkeysalso{#1}%
		\fi
	},
	/pgfplots/clip xlimits/.is if=pgfplots@clip@limits@x,
	/pgfplots/clip xlimits/.default=true,
	/pgfplots/clip ylimits/.is if=pgfplots@clip@limits@y,
	/pgfplots/clip ylimits/.default=true,
	/pgfplots/clip zlimits/.is if=pgfplots@clip@limits@z,
	/pgfplots/clip zlimits/.default=true,
	/pgfplots/clip limits/.style={
		/pgfplots/clip xlimits={#1},%
		/pgfplots/clip ylimits={#1},%
		/pgfplots/clip zlimits={#1},%
	},
	/pgfplots/clip limits=true,
	%/pgfplots/clip limits/.belongs to family=/pgfplots,
	/pgfplots/clip/.is if=pgfplots@clip,
	/pgfplots/clip/.default=true,
	/pgfplots/clip=true,
	/pgfplots/clip mode/.is choice,
	/pgfplots/clip mode/global/.code=		\def\pgfplots@clipmode{1},
	% this choice is implemented partially only (only for plots, not for
	% graphical elements):
	/pgfplots/clip mode/individual/.code=	\def\pgfplots@clipmode{2},
	/pgfplots/clip mode=global,
	/pgfplots/clip bounding box/.is choice,
	/pgfplots/clip bounding box/default tikz/.code=\def\pgfplots@clip@BB@mode{0},
	/pgfplots/clip bounding box/upper bound/.code=\def\pgfplots@clip@BB@mode{1},
	/pgfplots/clip bounding box=default tikz, % the compat stuff. this is for backw. compat.
	% will be used if it exists:
	/pgfplots/axis background/.style={},
	/pgfplots/axis background style/.style={/pgfplots/axis background/.append style={#1}},
	%
	% the 'axis background@' style is an optimization: it will only be
	% used if 'axis background' is non-empty.
	% The motivation is that once 'axis background' is non-empty, a
	% background path will be generated whereas the 'axis background@'
	% style can be changed at will.
	/pgfplots/axis background@/.style={},
	/pgfplots/axis background@ style/.style={/pgfplots/axis background@/.append style={#1}},
	%
	% 2d: 'unit vector ratio=2 1   is relative to y axis (x is twice as large as y)
	% 3d: 'unit vector ratio=2 2 1 is relative to z axis (x and y are both twice as large as z)
	% missing values are assumed to be 1.
	/pgfplots/unit vector ratio/.initial=,% empty means 'disable rescale'.
	/pgfplots/unit vector ratio axis/.initial=,% DEBUG. This is the reference axis which won't be scaled down. This key might vanish.
	/pgfplots/unit vector ratio*/.style={%
		/pgfplots/unit vector ratio={#1},
		/pgfplots/unit rescale keep size=false,
	},
	/pgfplots/unit rescale keep size/.is choice,
	/pgfplots/unit rescale keep size/true/.code={\def\pgfplots@unit@vector@rescale@keep@size{1}},
	/pgfplots/unit rescale keep size/false/.code={\def\pgfplots@unit@vector@rescale@keep@size{0}},
	/pgfplots/unit rescale keep size/unless limits declared/.code={\def\pgfplots@unit@vector@rescale@keep@size{2}},
	/pgfplots/unit rescale keep size/.default=true,
	/pgfplots/unit rescale keep size=unless limits declared,
	/pgfplots/axis equal/.is choice,
	/pgfplots/axis equal/true/.style={
		/pgfplots/unit vector ratio=1 1 1,
		/pgfplots/unit rescale keep size=true
	},
	/pgfplots/axis equal/false/.style={
		/pgfplots/unit vector ratio=,
	},
	/pgfplots/axis equal/.default=true,
	/pgfplots/axis equal image/.is choice,
	/pgfplots/axis equal image/true/.style={%
		/pgfplots/unit vector ratio=1 1 1,
		/pgfplots/unit rescale keep size=false
	},
	/pgfplots/axis equal image/false/.style={%
		/pgfplots/unit vector ratio=,
	},
	/pgfplots/axis equal image/.default=true,
	/pgfplots/xmin/.initial=,
	/pgfplots/xmax/.initial=,
	/pgfplots/ymin/.initial=,
	/pgfplots/ymax/.initial=,
	/pgfplots/zmin/.initial=,
	/pgfplots/zmax/.initial=,
	/pgfplots/min/.style={xmin={#1},ymin={#1},zmin={#1}},
	/pgfplots/max/.style={xmax={#1},ymax={#1},zmax={#1}},
	/pgfplots/xtickmin/.initial=,
	/pgfplots/xtickmax/.initial=,
	/pgfplots/ytickmin/.initial=,
	/pgfplots/ytickmax/.initial=,
	/pgfplots/ztickmin/.initial=,
	/pgfplots/ztickmax/.initial=,
	/pgfplots/stack plots/.is choice,
	/pgfplots/stack plots/.belongs to family=/pgfplots,
	/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={\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,
	/pgfplots/stack negative/.is choice,
	/pgfplots/stack negative/on previous/.code={\def\pgfplots@stacked@negative@mode{P}},
	/pgfplots/stack negative/separate/.code={\def\pgfplots@stacked@negative@mode{S}},
	/pgfplots/stack negative/on previous,
	/pgfplots/reverse stacked plots/.is if=pgfplots@stacked@reverse,
	/pgfplots/reverse stacked plots/.belongs to family=/pgfplots,
	/pgfplots/reverse stacked plots/.default=true,
	/pgfplots/reverse stacked plots=true,
	/pgfplots/stack dir/.is choice,
	/pgfplots/stack dir/.belongs to family=/pgfplots,
	/pgfplots/stack dir/plus/.code={\pgfplots@stacked@plustrue},
	/pgfplots/stack dir/plus/.belongs to family=/pgfplots,
	/pgfplots/stack dir/minus/.code={\pgfplots@stacked@plusfalse},
	/pgfplots/stack dir/minus/.belongs to family=/pgfplots,
	/pgfplots/stack dir=plus,
	/pgfplots/stacked ignores zero/.is if=pgfplots@stacked@ignores@zero,
	/pgfplots/stacked ignores zero/.default=true,
	%
	% The purpose of the following key is to control the case 'stacked ignores zero=true'
	% (it has no effect if 'stacked ignores zero=false').
	% The feature "stacked ignores zero" is active *if and only if*
	% 1. stacked ignores zero=true and
	% 2. stacked ignores zero/<phasename>=true
	% Valid <phasename>s are 'default', 'markers', 'errorbars'.
	/pgfplots/stacked ignores zero/\pgfplotsaxis@visphase@name@default/.initial=true,
	/pgfplots/stacked ignores zero/\pgfplotsaxis@visphase@name@markers/.initial=true,
	/pgfplots/stacked ignores zero/\pgfplotsaxis@visphase@name@errorbars/.initial=false,
	/pgfplots/filter discard warning/.is if=pgfplots@warn@for@filter@discards,
	/pgfplots/filter discard warning=true,
	/pgfplots/pre filter/.code={},
	/pgfplots/x filter/.code={},
	/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/filter point/.code=,
	/pgfplots/x filter/.expression/.code=\pgfplots@install@filter@expression{x filter}{#1},
	/pgfplots/y filter/.expression/.code=\pgfplots@install@filter@expression{y filter}{#1},
	/pgfplots/z filter/.expression/.code=\pgfplots@install@filter@expression{z filter}{#1},
	/pgfplots/x filter/.append expression/.code=\pgfplots@install@filter@expression@append{x filter}{#1},
	/pgfplots/y filter/.append expression/.code=\pgfplots@install@filter@expression@append{y filter}{#1},
	/pgfplots/z filter/.append expression/.code=\pgfplots@install@filter@expression@append{z filter}{#1},
	/pgfplots/restrict x to domain/.style={/pgfplots/@restrict to domain={x}{}{#1}{0}},%
	/pgfplots/restrict y to domain/.style={/pgfplots/@restrict to domain={y}{}{#1}{0}},%
	/pgfplots/restrict z to domain/.style={/pgfplots/@restrict to domain={z}{}{#1}{0}},%
	/pgfplots/restrict expr to domain/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}{0}},%
	/pgfplots/restrict x to domain*/.style={/pgfplots/@restrict to domain={x}{}{#1}{1}},%
	/pgfplots/restrict y to domain*/.style={/pgfplots/@restrict to domain={y}{}{#1}{1}},%
	/pgfplots/restrict z to domain*/.style={/pgfplots/@restrict to domain={z}{}{#1}{1}},%
	/pgfplots/restrict expr to domain*/.style 2 args={/pgfplots/@restrict to domain={x}{#1}{#2}{1}},%
	% '#1': the filter to install (like 'x', 'y', or even 'hist/data')
	% '#2': a mathematical expression (or empty)
	% '#3': the interval. must be numeric currently, and of the form min:max
	% '#4': bAssignLimits=0|1. if #4=1, any coordinate outside of the
	% allowed domain will take the domain boundary as value. If #4=0,
	% any coordinate outside of the allowed domain will get 'inf' or
	% '-inf'.
	/pgfplots/@restrict to domain/.code args={#1#2#3#4}{%
		\if0#4%
			\pgfkeysalso{/pgfplots/unbounded coords=jump}%
		\fi
		% when invoked, ##1 and ##2 will be floats:
		\def\pgfplots@loc@TMPb##1:##2\relax{%
			\pgfkeysalso{%
				/pgfplots/#1 filter/.append code={%
					\pgfplots@warn@if@log@basis@unset{#1}{domain restriction}%
					\let\pgfplots@restrict@to@domain@orig=\pgfmathresult
					\ifx\pgfmathresult\pgfutil@empty
						% the input value is empty... skip it!
					\else
						\def\pgfplots@restrict@to@domain@tmp{#2}%
						\ifx\pgfplots@restrict@to@domain@tmp\pgfutil@empty
							% we don't have an expression.
						\else
							% evaluate the expression!
							\pgfmathparse{#2}%
						\fi
						\pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}%
						\let\pgfplots@restrict@to@domain@tmp=\pgfmathresult
						%
						\pgfplotscoordmath{default}{if less than}
							{\pgfplots@restrict@to@domain@tmp}{##1}% ##1 is the lower argument
							{%
								\edef\pgfmathresult{\if0#4inf\else ##1\fi}%
							}{%
								\pgfplotscoordmath{default}{if less than}
									{##2}{\pgfplots@restrict@to@domain@tmp}
									{\edef\pgfmathresult{\if0#4-inf\else ##2\fi}}
									{\let\pgfmathresult=\pgfplots@restrict@to@domain@orig}%
							}%
					\fi
				}%
			}%
		}%
		% when invoked, ##1 and ##2 will be the user-supplied args.
		\def\pgfplots@loc@TMPc##1:##2\relax{%
			\pgfplotscoordmath{default}{parsenumber}{##1}%
			\let\pgfplots@rangea=\pgfmathresult
			\pgfplotscoordmath{default}{parsenumber}{##2}%
			\edef\pgfplots@loc@TMPc{\pgfplots@rangea:\pgfmathresult}%
			\expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPc\relax
		}%
		\edef\pgfplots@loc@TMPa{#3}%
		\expandafter\pgfplots@loc@TMPc\pgfplots@loc@TMPa\relax
	},%
	% -> keeps only the nth point, all other ones will get ''.
	/pgfplots/each nth point/.style={/pgfplots/each nth point*={x}{#1}},%
	% #1: the filter name: x, y, z, or something exotic like hist/data
	% #2: the N of 'each nth'
	/pgfplots/each nth point*/.style 2 args={%
		/pgfplots/#1 filter/.append code={%
			\ifnum\coordindex=0
				\def\c@pgfplots@eachnthpoint@xfilter{0}%
				\edef\c@pgfplots@eachnthpoint@xfilter@cmp{#2}%
			\else
				\pgfplotsutil@advancestringcounter\c@pgfplots@eachnthpoint@xfilter
				\ifx\c@pgfplots@eachnthpoint@xfilter@cmp\c@pgfplots@eachnthpoint@xfilter
					\def\c@pgfplots@eachnthpoint@xfilter{0}%
				\else
					\let\pgfmathresult\pgfutil@empty
				\fi
			\fi
		}%
	},
	/pgfplots/skip coords between index/.style 2 args={/pgfplots/skip coords between index*={x}{#1}{#2}},%
	% #1: the filter name
	% #2,#3: from 'skip coords between index'
	/pgfplots/skip coords between index*/.style n args={3}{%
		/pgfplots/#1 filter/.append code={%
			\ifnum\coordindex<#2\relax
			\else
				\ifnum\coordindex<#3\relax
					\let\pgfmathresult=\pgfutil@empty
				\fi
			\fi}
	},
	/pgfplots/translate gnuplot/.is if=pgfplots@translategnuplot,
	/pgfplots/gnuplot writes logscale/.is choice,
	/pgfplots/gnuplot writes logscale/true/.code={\gdef\pgfplots@gnuplot@logscale@writes@log{1}},%
	/pgfplots/gnuplot writes logscale/false/.code={\gdef\pgfplots@gnuplot@logscale@writes@log{0}},%
	/pgfplots/parametric/var 2d/.initial={\u,\v},
	/pgfplots/parametric/var 1d/.initial=\t,
	/pgfplots/xfilter/.initial=,% DEPRECATED
	/pgfplots/yfilter/.initial=,% DEPRECATED
	/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/y domain/.initial=,% means: use the same as 'domain'
	/pgfplots/domain y/.style={/pgfplots/y domain={#1}},
	/pgfplots/samples at/.initial=,% empty -> use value of /tikz/samples at!
	/pgfplots/samples/.initial=,% empty -> use /tikz/samples!
	/pgfplots/samples y/.initial=,% empty -> use the same as 'samples'. For use in mesh plots.
	/pgfplots/samples at colormap pos/.code={%
		\pgfplots@colorbar@positions@to@samplesat
	},
	/pgfplots/variable/.code={\pgfkeysalso{/tikz/variable={#1}}},
	/pgfplots/variable y/.initial=\y,%
	/pgfplots/sample dim/.initial=auto,
	% and provide aliases in the '/pgfplots/' tree to avoid
	% search path problems just for the following options:
	/pgfplots/name/.code={\pgfkeysalso{/tikz/name={#1}}},
	/pgfplots/overlay/.code={\pgfkeysalso{/tikz/overlay={#1}}},
	/pgfplots/alias/.code={\pgfkeysalso{/tikz/alias={#1}}},
	/pgfplots/id/.code={\pgfkeysalso{/tikz/id={#1}}},
	/pgfplots/prefix/.code={\pgfkeysalso{/tikz/prefix={#1}}},
	/pgfplots/raw gnuplot/.code={\pgfkeysalso{/tikz/raw gnuplot={#1}}},
	/pgfplots/parametric/.code={\pgfkeysalso{/tikz/parametric={#1}}},%
	%
	/pgfplots/width/.initial=,%
	/pgfplots/width/.belongs to family=/pgfplots,
	/pgfplots/height/.initial=,%
	/pgfplots/height/.belongs to family=/pgfplots,
	/pgfplots/execute at begin plot/.initial=,
	/pgfplots/execute at begin plot visualization/.initial=,
	/pgfplots/execute at begin plot@@/.initial=,% an internal variant
	/pgfplots/execute at end plot/.initial=,
	/pgfplots/execute at end plot visualization/.initial=,
	/pgfplots/execute at end plot@@/.initial=,% an internal variant
	/pgfplots/execute at end survey/.initial=,%
	/pgfplots/execute at begin axis/.initial=,
	/pgfplots/execute at begin axis@@/.initial=,% an internal variant
	/pgfplots/execute at end axis/.initial=,
	/pgfplots/execute at end axis@@/.initial=,% an internal variant
	/pgfplots/execute for finished point/.initial=,
	/pgfplots/before end axis/.code=,
	/pgfplots/after end axis/.code=,
	/pgfplots/enlarge x limits/.initial=auto,
	/pgfplots/enlarge x limits/.default=true,
	/pgfplots/enlarge y limits/.initial=auto,
	/pgfplots/enlarge y limits/.default=true,
	/pgfplots/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/enlargelimits respects figure size/.is if=pgfplots@enlargelimits@respect@figure@size,
	/pgfplots/update limits/.is if=pgfplots@bb@isactive,
	/pgfplots/x/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth'
	/pgfplots/x/.belongs to family=/pgfplots,
	/pgfplots/y/.initial=,% is implicitly set by 'width' and/or '\axisdefaultwidth'
	/pgfplots/y/.belongs to family=/pgfplots,
	/pgfplots/z/.initial=,
	/pgfplots/z/.belongs to family=/pgfplots,
	/pgfplots/view dir/.initial=,% DEBUG
	/pgfplots/x dir/.code={\pgfplots@setkey@axisdir@for x{#1}},%
	/pgfplots/y dir/.code={\pgfplots@setkey@axisdir@for y{#1}},%
	/pgfplots/z dir/.code={\pgfplots@setkey@axisdir@for z{#1}},%
	/pgfplots/x dir=normal,%
	/pgfplots/y dir=normal,%
	/pgfplots/z dir=normal,%
	/pgfplots/x post scale/.initial=,
	/pgfplots/y post scale/.initial=,
	/pgfplots/z post scale/.initial=,
	/pgfplots/scale/.style={%
		/pgfplots/x post scale={#1},%
		/pgfplots/y post scale={#1},%
		/pgfplots/z post scale={#1},%
  	},
	/pgfplots/scale mode/.is choice,
	/pgfplots/scale mode/auto/.code={\def\pgfplots@scale@mode@choice{0}},
	/pgfplots/scale mode/none/.code={\def\pgfplots@scale@mode@choice{1}},
	/pgfplots/scale mode/stretch to fill/.code={\def\pgfplots@scale@mode@choice{2}},
	/pgfplots/scale mode/scale uniformly/.code={\def\pgfplots@scale@mode@choice{3}},
	/pgfplots/scale mode/auto,
	/pgfplots/scale uniformly strategy/.is choice,
	% chooses one of the other choices depending on the target
	% width/height:
	/pgfplots/scale uniformly strategy/auto/.code=						{\def\pgfplots@scaleuniformly@choice{0}},
	% scales units only, but does not compensate limits:
	/pgfplots/scale uniformly strategy/units only/.code=					{\def\pgfplots@scaleuniformly@choice{1}},
	% changes only vertical limits, no horizontal limits:
	/pgfplots/scale uniformly strategy/change vertical limits/.code=	{\def\pgfplots@scaleuniformly@choice{2}},
	% changes X and Y limits, but not Z limits - adjusts scale accordingly:
	/pgfplots/scale uniformly strategy/change horizontal limits/.code=	{\def\pgfplots@scaleuniformly@choice{3}},
	/pgfplots/scale uniformly strategy/auto,
	/pgfplots/scale uniformly warning/.is if=pgfplots@scaleuniformly@warning,
	/pgfplots/scale uniformly warning=false,
	% number of iterations for the nonlinear method involved
	/pgfplots/scale uniformly strategy iter/.initial=9,
	/pgfplots/allow reversal of rel axis cs/.is if=pgfplots@allow@reversal@of@rel@axis@cs,%
	/pgfplots/allow reversal of rel axis cs/.default=true,%
	/pgfplots/allow reversal of rel axis cs=true,%
	/pgfplots/plot box ratio/.initial=1 1 1,%
	/pgfplots/view/az/.initial=25,%
	/pgfplots/view/h/.code={\pgfkeyssetvalue{/pgfplots/view/az}{#1}},%
	/pgfplots/view/el/.initial=30,%
	/pgfplots/view/v/.code={\pgfkeyssetvalue{/pgfplots/view/el}{#1}},%
	/pgfplots/view/.style 2 args={%
		/pgfplots/view/az={#1},%
		/pgfplots/view/el={#2}%
	},%
	/pgfplots/cycle list/.define/.code 2 args={%
		\pgfplotscreateplotcyclelist{#1}{#2}%
	},
	/pgfplots/cycle list/.style={%
		/pgfplots/cycle list/.define={@internal@}{#1},%
		/pgfplots/cycle list name={@internal@}%
	},
	/pgfplots/cycle list/.belongs to family=/pgfplots,
	/pgfplots/cycle list name/.code={%
		\pgfplotsifcyclelistexists{#1}{%
			\expandafter\let\expandafter\autoplotspeclist\csname pgfp@cyclist@\string#1@\endcsname
			\expandafter\let\csname pgfp@cyclist@auto@\endcsname=\autoplotspeclist
			\pgfkeyssetvalue{/pgfplots/cycle multi list/@dim}{0}% de-activate.
		}{%
			\pgfplots@error{Sorry, there is no such cycle list named \string#1. Maybe you misspelled it?}%
		}%
	},
	/pgfplots/cycle list name/.belongs to family=/pgfplots,
	/pgfplots/cycle list name=color,
	/pgfplots/cycle list shift/.initial=,
	/pgfplots/mark list fill/.initial=.!80!black,
	% accepts arguments of the form
	% <first list spec>\nextlist <second list spec>\nextlist ....
	% where each list spec is EITHER a cycle list name OR a cycle list
	% argument.
	/pgfplots/cycle multi list/.code={%
		\def\pgfplots@cycle@multi@list@sequence{L}% [L]exicographical
		\pgfplots@cycle@multi@list{#1}%
	},
	/pgfplots/cycle multi list/.belongs to family=/pgfplots,
	/pgfplots/cycle multiindex list/.code={%
		\def\pgfplots@cycle@multi@list@sequence{M}% [M]ultiindex
		\def\pgfplots@cycle@multi@list@repeat{A}% [A]ll
		\pgfplots@cycle@multi@list{#1}%
	},
	/pgfplots/cycle multiindex list/.belongs to family=/pgfplots,
	/pgfplots/cycle multiindex* list/.code={%
		\def\pgfplots@cycle@multi@list@sequence{M}% [M]ultiindex
		\def\pgfplots@cycle@multi@list@repeat{S}% [S]ingle
		\pgfplots@cycle@multi@list{#1}%
	},
	/pgfplots/cycle multiindex* list/.belongs to family=/pgfplots,
	% #1: list index
	% #2: maximum number of elements to use
	/pgfplots/cycle multi list/partial sublist/.code 2 args={%
		\ifnum#1<\pgfkeysvalueof{/pgfplots/cycle multi list/@dim}
			\ifnum#2<\pgfkeysvalueof{/pgfplots/cycle multi list/@totalN#1}
				\pgfkeyssetvalue{/pgfplots/cycle multi list/@N#1}{#2}%
			\fi
		\else
			\pgfplots@error{Sorry, the first argument of `cycle multi list/partial sublist=<list index><num elems>' is no valid list index (should be less than \pgfkeysvalueof{/pgfplots/cycle multi list/@dim}).}%
		\fi
	},%
	/pgfplots/cycle multi list/@dim/.initial=0,
	%/pgfplots/cycle multi list/@maxlen/.initial=0,
	%/pgfplots/cycle multi list/@list0/.style={},
	%/pgfplots/cycle multi list/@N0/.initial=0,%
	%/pgfplots/cycle multi list/@totalN0/.initial=0,%
	/pgfplots/legend style/.belongs to family=/pgfplots/style commands,
	/pgfplots/legend style/.code={%
		\pgfkeysalso{/pgfplots/every axis legend/.append style={#1}}%
	},
	/pgfplots/every forget plot/.code={},%
	/pgfplots/forget plot style/.style={/pgfplots/every forget plot/.append style={#1}},
	/pgfplots/label style/.belongs to family=/pgfplots/style commands,
	/pgfplots/label style/.style={%
		/pgfplots/every axis x label/.append style={#1},%
		/pgfplots/every axis y label/.append style={#1},%
		/pgfplots/every axis z label/.append style={#1}%
	},%
	/pgfplots/x label style/.belongs to family=/pgfplots/style commands,
	/pgfplots/x label style/.code={%
		\pgfkeysalso{/pgfplots/every axis x label/.append style={#1}}%
	},
	/pgfplots/y label style/.belongs to family=/pgfplots/style commands,
	/pgfplots/y label style/.code={%
		\pgfkeysalso{/pgfplots/every axis y label/.append style={#1}}%
	},
	/pgfplots/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}}%
	},
	/pgfplots/tick label style/.belongs to family=/pgfplots/style commands,
	/pgfplots/tick label style/.code={%
		\pgfkeysalso{/pgfplots/every tick label/.append style={#1}}%
	},
	/pgfplots/x tick label style/.belongs to family=/pgfplots/style commands,
	/pgfplots/x tick label style/.code={%
		\pgfkeysalso{/pgfplots/every x tick label/.append style={#1}}%
	},
	/pgfplots/y tick label style/.belongs to family=/pgfplots/style commands,
	/pgfplots/y tick label style/.code={%
		\pgfkeysalso{/pgfplots/every y tick label/.append style={#1}}%
	},
	/pgfplots/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 tick scale label/.append style={#1}}%
	},
	/pgfplots/y tick scale label style/.belongs to family=/pgfplots/style commands,
	/pgfplots/y tick scale label style/.code={%
		\pgfkeysalso{/pgfplots/every y tick scale 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 tick scale label/.append style={#1}}%
	},
	/pgfplots/tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/tick style/.code={%
		\pgfkeysalso{/pgfplots/every tick/.append style={#1}}%
	},
	/pgfplots/minor tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/minor tick style/.code={%
		\pgfkeysalso{/pgfplots/every minor tick/.append style={#1}}%
	},
	/pgfplots/major tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/major tick style/.code={%
		\pgfkeysalso{/pgfplots/every major tick/.append style={#1}}%
	},
	/pgfplots/x tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/x tick style/.code={%
		\pgfkeysalso{/pgfplots/every x tick/.append style={#1}}%
	},
	/pgfplots/minor x tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/minor x tick style/.code={%
		\pgfkeysalso{/pgfplots/every minor x tick/.append style={#1}}%
	},
	/pgfplots/major x tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/major x tick style/.code={%
		\pgfkeysalso{/pgfplots/every major x tick/.append style={#1}}%
	},
	/pgfplots/y tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/y tick style/.code={%
		\pgfkeysalso{/pgfplots/every y tick/.append style={#1}}%
	},
	/pgfplots/minor y tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/minor y tick style/.code={%
		\pgfkeysalso{/pgfplots/every minor y tick/.append style={#1}}%
	},
	/pgfplots/major y tick style/.belongs to family=/pgfplots/style commands,
	/pgfplots/major y tick style/.code={%
		\pgfkeysalso{/pgfplots/every major y tick/.append style={#1}}%
	},
	/pgfplots/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}}%
	},
	/pgfplots/minor grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/minor grid style/.code={%
		\pgfkeysalso{/pgfplots/every minor grid/.append style={#1}}%
	},
	/pgfplots/major grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/major grid style/.code={%
		\pgfkeysalso{/pgfplots/every major grid/.append style={#1}}%
	},
	/pgfplots/x grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/x grid style/.code={%
		\pgfkeysalso{/pgfplots/every axis x grid/.append style={#1}}%
	},
	/pgfplots/minor x grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/minor x grid style/.code={%
		\pgfkeysalso{/pgfplots/every minor x grid/.append style={#1}}%
	},
	/pgfplots/major x grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/major x grid style/.code={%
		\pgfkeysalso{/pgfplots/every major x grid/.append style={#1}}%
	},
	/pgfplots/y grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/y grid style/.code={%
		\pgfkeysalso{/pgfplots/every axis y grid/.append style={#1}}%
	},
	/pgfplots/minor y grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/minor y grid style/.code={%
		\pgfkeysalso{/pgfplots/every minor y grid/.append style={#1}}%
	},
	/pgfplots/major y grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/major y grid style/.code={%
		\pgfkeysalso{/pgfplots/every major y grid/.append style={#1}}%
	},
	/pgfplots/z grid style/.belongs to family=/pgfplots/style commands,
	/pgfplots/z 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,
	/pgfplots/disabledatascaling=false,
	/pgfplots/hide x axis/.is if=pgfplots@hide@x,
	/pgfplots/hide x axis/.default=true,
	/pgfplots/hide x axis=false,
	/pgfplots/hide y axis/.is if=pgfplots@hide@y,
	/pgfplots/hide y axis/.default=true,
	/pgfplots/hide y axis=false,
	/pgfplots/hide z axis/.is if=pgfplots@hide@z,
	/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={%
		xtick align=center,
		enlarge x limits=false,
		x axis line style={-stealth}
	},
	/pgfplots/every non boxed y axis/.style={%
		ytick align=center,
		enlarge y limits=false,
		y axis line style={-stealth}
	},
	/pgfplots/every non boxed z axis/.style={%
		ztick align=center,
		enlarge z limits=false,
		z 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,
	%
	/pgfplots/axis x line shift/.initial=,
	/pgfplots/axis y line shift/.initial=,
	/pgfplots/axis z line shift/.initial=,
	/pgfplots/axis line shift/.style={%
		/pgfplots/axis x line shift={#1},%
		/pgfplots/axis y line shift={#1},%
		/pgfplots/axis z line shift={#1},%
	},%
	%
% sets \pgfplots@xaxislinesnum to
% box=0
% bottom=1
% middle=2 ( aliased with center )
% top=3
	/pgfplots/axis x line*/.is choice,
	/pgfplots/axis x line*/box/.code	={\def\pgfplots@xaxislinesnum{0}\def\pgfplots@xtickposnum{0}},
	/pgfplots/axis x line*/bottom/.code	={\def\pgfplots@xaxislinesnum{1}\def\pgfplots@xtickposnum{1}\let\pgfplots@xticklabel@pos\pgfutil@empty},
	/pgfplots/axis x line*/left/.style={/pgfplots/axis x line*/bottom},
	/pgfplots/axis x line*/middle/.code	={\def\pgfplots@xaxislinesnum{2}\def\pgfplots@xtickposnum{2}\let\pgfplots@xticklabel@pos\pgfutil@empty},
	/pgfplots/axis x line*/center/.style	={/pgfplots/axis x line*/middle},
	/pgfplots/axis x line*/top/.code	={\def\pgfplots@xaxislinesnum{3}\def\pgfplots@xtickposnum{3}\let\pgfplots@xticklabel@pos\pgfutil@empty},
	/pgfplots/axis x line*/right/.style={/pgfplots/axis x line*/top},
	/pgfplots/axis x line*/none/.code	={\def\pgfplots@xaxislinesnum{4}\def\pgfplots@xtickposnum{4}\let\pgfplots@xticklabel@pos\pgfutil@empty},
	/pgfplots/axis x line*=box,
	%
% sets \pgfplots@yaxislinesnum to
% box=0
% left=1
% center=2 ( aliased with middle )
% right=3
	/pgfplots/axis y line*/.is choice,
	/pgfplots/axis y line*/box/.code	={\def\pgfplots@yaxislinesnum{0}\def\pgfplots@ytickposnum{0}},
	/pgfplots/axis y line*/left/.code	={\def\pgfplots@yaxislinesnum{1}\def\pgfplots@ytickposnum{1}\let\pgfplots@yticklabel@pos\pgfutil@empty},
	/pgfplots/axis y line*/center/.code	={\def\pgfplots@yaxislinesnum{2}\def\pgfplots@ytickposnum{2}\let\pgfplots@yticklabel@pos\pgfutil@empty},
	/pgfplots/axis y line*/middle/.style	={/pgfplots/axis y line*/center},
	/pgfplots/axis y line*/right/.code	={\def\pgfplots@yaxislinesnum{3}\def\pgfplots@ytickposnum{3}\let\pgfplots@yticklabel@pos\pgfutil@empty},
	/pgfplots/axis y line*/none/.code	={\def\pgfplots@yaxislinesnum{4}\def\pgfplots@ytickposnum{4}\let\pgfplots@yticklabel@pos\pgfutil@empty},
	/pgfplots/axis y line*=box,
	%
%
% 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}\let\pgfplots@zticklabel@pos\pgfutil@empty},
	/pgfplots/axis z line*/center/.code	={\def\pgfplots@zaxislinesnum{2}\def\pgfplots@ztickposnum{2}\let\pgfplots@zticklabel@pos\pgfutil@empty},
	/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}\let\pgfplots@zticklabel@pos\pgfutil@empty},
	/pgfplots/axis z line*/none/.code	={\def\pgfplots@zaxislinesnum{4}\def\pgfplots@ztickposnum{4}\let\pgfplots@zticklabel@pos\pgfutil@empty},
	/pgfplots/axis z line*=box,
	%
	/pgfplots/axis x line/.is choice,
	/pgfplots/axis y line/.is choice,
	/pgfplots/axis z line/.is choice,
	/pgfplots/axis lines/.style={%
		axis x line=#1,%
		axis y line=#1,%
		axis z line=#1%
	},
	/pgfplots/axis lines*/.style={%
		axis x line*=#1,%
		axis y line*=#1,%
		axis z line*=#1%
	},
	/pgfplots/compat/axis line style pre 1.8/.style={%
		% ALL INSIDE OF THIS STYLE IS DEPRECATED.
		/pgfplots/axis x line/box/.style	={
			/pgfplots/axis x line*/box,
			/pgfplots/every boxed x axis
		},
		/pgfplots/axis x line/bottom/.style	={
			/pgfplots/axis x line*/bottom,
			/pgfplots/every non boxed x axis
		},
		/pgfplots/axis x line/left/.style={/pgfplots/axis x line/bottom},%
		/pgfplots/axis x line/middle/.code	={%
			\ifnum\pgfplots@yaxislinesnum=3 % if 'axis y line==right' then
				\pgfkeysalso{/pgfplots/every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}%
			\else
				\pgfkeysalso{/pgfplots/every axis x label/.style={at={(current axis.right of origin)},anchor=south east}}%
			\fi
			\pgfkeysalso{/pgfplots/every axis x label/.append code={\pgfplots@label@upgrade@warning}}%
			\pgfkeysalso{/pgfplots/axis x line*/middle,
				/pgfplots/every non boxed x axis}%
		},
		/pgfplots/axis x line/center/.style	={/pgfplots/axis x line/middle},
		/pgfplots/axis x line/right/.style={/pgfplots/axis x line/top},%
		/pgfplots/axis x line/top/.code	={
			\ifnum\pgfplots@yaxislinesnum=2 % if 'axis y line==center' then
				\pgfkeysalso{
					/pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}%
			\fi
			\pgfkeysalso{%
				/pgfplots/axis x line*/top,
				/pgfplots/every axis x label/.style={at={(0.5,1)},anchor=south,yshift=15pt},
				/pgfplots/every non boxed x axis}%
		},
		/pgfplots/axis x line/none/.style	={axis x line*/none,hide x axis},
		%
		% Y :
		/pgfplots/axis y line/box/.style	={
			/pgfplots/axis y line*/box,
			/pgfplots/every boxed y axis
		},
		/pgfplots/axis y line/left/.style	={
			/pgfplots/axis y line*/left,
			/pgfplots/every non boxed y axis
		},
		/pgfplots/axis y line/center/.code	={
			\ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then
				\pgfkeysalso{%
					/pgfplots/every axis y label/.style={at={(current axis.below origin)},anchor=south west}}%
			\else
				\pgfkeysalso{%
					/pgfplots/every axis y label/.style={at={(current axis.above origin)},anchor=north west}}%
			\fi
			\pgfkeysalso{/pgfplots/every axis y label/.append code={\pgfplots@label@upgrade@warning}}%
			\pgfkeysalso{%
				/pgfplots/axis y line*/center,
				/pgfplots/every non boxed y axis}%
		},
		/pgfplots/axis y line/middle/.style	={/pgfplots/axis y line/center},
		/pgfplots/axis y line/right/.code	={%
			\ifnum\pgfplots@xaxislinesnum=2
				\pgfkeysalso{every axis x label/.style={at={(current axis.left of origin)},anchor=south west}}%
			\fi
			\pgfkeysalso{
				axis y line*/right,
				%every axis y label/.style={at={(1,1)},anchor=north west,xshift=15pt},
				% FIXME : DEPRECATED !? USE 'near tick' things ....
				every axis y label/.style={at={(1,0.5)},xshift=33pt,rotate=90},
				/pgfplots/every non boxed y axis
			}%
		},%
		/pgfplots/axis y line/none/.style	={axis y line*/none,hide y axis},
		%
		%
		% Z :
		%
		/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/every axis z label/.append code={\pgfplots@label@upgrade@warning}}%
			\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},
	},
	/pgfplots/compat/axis line style post 1.8/.style={%
		/pgfplots/axis x line/box/.style	={
			/pgfplots/axis x line*/box,
			/pgfplots/xlabel near ticks,
			/pgfplots/every boxed x axis
		},
		/pgfplots/axis x line/bottom/.style	={
			/pgfplots/axis x line*/bottom,
			/pgfplots/every non boxed x axis
		},
		/pgfplots/axis x line/left/.style={/pgfplots/axis x line/bottom},%
		/pgfplots/axis x line/middle/.code	={%
			\ifnum\pgfplots@yaxislinesnum=3 % if 'axis y line==right' then
				\pgfkeysalso{/pgfplots/every axis x label/.style={
					/pgfplots/near ticklabel align=inside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}%
			\else
				\pgfkeysalso{/pgfplots/every axis x label/.style={
					/pgfplots/near ticklabel align=inside,at={(ticklabel* cs:1)},anchor=near ticklabel opposite}}%
			\fi
			\pgfkeysalso{/pgfplots/axis x line*/middle,
				/pgfplots/every x tick scale label/.code={%
					\ifpgfplotsthreedim
						\pgfkeysalso{at={(xticklabel* cs:1.03)},/pgfplots/near ticklabel align=outside,anchor=near xticklabel}%
					\else
						\pgfkeysalso{at={(xticklabel cs:0.9,5pt)},anchor=near xticklabel,inner sep=0pt}%
					\fi
				},%
				/pgfplots/every non boxed x axis}%
		},
		/pgfplots/axis x line/center/.style	={/pgfplots/axis x line/middle},
		/pgfplots/axis x line/right/.style={/pgfplots/axis x line/top},%
		/pgfplots/axis x line/top/.code	={
			\ifnum\pgfplots@yaxislinesnum=2 % if 'axis y line==center' then
				\pgfkeysalso{/pgfplots/every axis y label/.style={
					/pgfplots/near ticklabel align=inside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}%
			\fi
			\pgfkeysalso{%
				/pgfplots/axis x line*/top,
				/pgfplots/every axis x label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel},%
				/pgfplots/every y tick scale label/.style={at={(yticklabel cs:0)},anchor=near yticklabel},
				/pgfplots/every non boxed x axis}%
		},
		/pgfplots/axis x line/none/.style	={axis x line*/none,hide x axis},
		%
		% Y :
		/pgfplots/axis y line/box/.style	={
			/pgfplots/axis y line*/box,
			/pgfplots/ylabel near ticks,
			/pgfplots/every boxed y axis
		},
		/pgfplots/axis y line/left/.style	={
			/pgfplots/axis y line*/left,
			/pgfplots/every non boxed y axis
		},
		/pgfplots/axis y line/center/.code	={
			\ifnum\pgfplots@xaxislinesnum=3 % if 'axis x line==top' then
				\pgfkeysalso{%
					/pgfplots/every axis y label/.style={
						/pgfplots/near ticklabel align=outside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}%
			\else
				\pgfkeysalso{%
					/pgfplots/every axis y label/.style={
						/pgfplots/near ticklabel align=inside,at={(ticklabel* cs:1)},anchor=near ticklabel opposite}}%
			\fi
			\pgfkeysalso{%
				/pgfplots/axis y line*/center,
				/pgfplots/every y tick scale label/.code={%
					\ifpgfplotsthreedim
						\pgfkeysalso{at={(yticklabel* cs:1.03)},/pgfplots/near ticklabel align=outside,anchor=near yticklabel}%
					\else
						\pgfkeysalso{at={(yticklabel* cs:1.03,-0.3em)},/pgfplots/near ticklabel align=outside,anchor=near yticklabel opposite,inner sep=0pt}%
					\fi
				},%
				/pgfplots/every non boxed y axis}%
		},
		/pgfplots/axis y line/middle/.style	={/pgfplots/axis y line/center},
		/pgfplots/axis y line/right/.code	={%
			\ifnum\pgfplots@xaxislinesnum=2
				\pgfkeysalso{
					/pgfplots/every axis x label/.style={
						/pgfplots/near ticklabel align=outside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}%
			\fi
			\pgfkeysalso{
				axis y line*/right,
				/pgfplots/every axis y label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel,
					/utils/exec={%
						\ifpgfplotsthreedim\else \pgfkeysalso{rotate=90}\fi
					},%
				},
				/pgfplots/every y tick scale label/.code={
					\ifpgfplotsthreedim
						\pgfkeysalso{at={(yticklabel cs:0)},anchor=near yticklabel}%
					\else
						\pgfkeysalso{at={(yticklabel cs:1)},anchor=near yticklabel}%
					\fi
				},%
				/pgfplots/every non boxed y axis
			}%
		},%
		/pgfplots/axis y line/none/.style	={axis y line*/none,hide y axis},
		%
		%
		% Z :
		%
		/pgfplots/axis z line/box/.style	={
			/pgfplots/axis z line*/box,
			/pgfplots/every axis z label/.style={at={(ticklabel cs:0.5)},rotate=90, anchor=near ticklabel},
			/pgfplots/every z tick scale label/.style={at={(zticklabel* cs:1.2,-0.3em)},anchor=near zticklabel,inner sep=0pt},
			/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	={
			\pgfkeysalso{%
				/pgfplots/every axis z label/.style={
					/pgfplots/near ticklabel align=inside,at={(ticklabel* cs:1)},anchor=near ticklabel opposite}}%
			\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{
					/pgfplots/every axis z label/.style={
						/pgfplots/near ticklabel align=outside,at={(ticklabel* cs:0)},anchor=near ticklabel opposite}}%
			\fi
			\pgfkeysalso{
				axis z line*/right,
				every axis z label/.style={at={(ticklabel cs:0.5)},anchor=near ticklabel,rotate=90},
				/pgfplots/every z tick scale label/.style={at={(zticklabel cs:0)},anchor=near zticklabel},
				/pgfplots/every non boxed z axis
			}%
		},%
		/pgfplots/axis z line/none/.style	={axis z line*/none,hide z axis},
	},
	%
	/pgfplots/hide obscured x ticks/.is if=pgfplots@hide@obscured@xtick,
	/pgfplots/hide obscured y ticks/.is if=pgfplots@hide@obscured@ytick,
	/pgfplots/hide obscured z ticks/.is if=pgfplots@hide@obscured@ztick,
	/pgfplots/hide obscured x ticks=true,
	/pgfplots/hide obscured y ticks=true,
	/pgfplots/hide obscured z ticks=true,
	%
	/pgfplots/3d box/.is choice,
	/pgfplots/3d box/background/.code			={\def\pgfplots@threedimbox@choice{0}},%
	/pgfplots/3d box/complete/.code				={\def\pgfplots@threedimbox@choice{1}},%
	/pgfplots/3d box/complete*/.code				={\def\pgfplots@threedimbox@choice{2}},%
	/pgfplots/3d box/.default=complete,%
	/pgfplots/3d box/background,%
	/pgfplots/every 3d box foreground/.style={},
	/pgfplots/3d box foreground style/.style={%
		/pgfplots/every 3d box foreground/.append style={#1}%
	},
% set \pgfplots@xaxisdiscontnum
% none = 0
% crunch = 1
% open = 2
	/pgfplots/axis x discontinuity/.is choice,
	/pgfplots/axis x discontinuity/none/.code	={\def\pgfplots@xaxisdiscontnum{0}},
	/pgfplots/axis x discontinuity/crunch/.code	={\def\pgfplots@xaxisdiscontnum{1}},
	/pgfplots/axis x discontinuity/parallel/.code	={\def\pgfplots@xaxisdiscontnum{2}},
	/pgfplots/axis x discontinuity=none,
% set \pgfplots@yaxisdiscontnum
% none = 0
% crunch = 1
% open = 2
	/pgfplots/axis y discontinuity/.is choice,
	/pgfplots/axis y discontinuity/none/.code	={\def\pgfplots@yaxisdiscontnum{0}},
	/pgfplots/axis y discontinuity/crunch/.code	={\def\pgfplots@yaxisdiscontnum{1}},
	/pgfplots/axis y discontinuity/parallel/.code	={\def\pgfplots@yaxisdiscontnum{2}},
	/pgfplots/axis y discontinuity=none,
% set \pgfplots@yaxisdiscontnum
% none = 0
% crunch = 1
% open = 2
	/pgfplots/axis z discontinuity/.is choice,
	/pgfplots/axis z discontinuity/none/.code	={\def\pgfplots@zaxisdiscontnum{0}},
	/pgfplots/axis z discontinuity/crunch/.code	={\def\pgfplots@zaxisdiscontnum{1}},
	/pgfplots/axis z discontinuity/parallel/.code	={\def\pgfplots@zaxisdiscontnum{2}},
	/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=false,
% sets \pgfplots@xislinear to
% normal=true
% log=false
	/pgfplots/xmode/.is choice,
	/pgfplots/xmode/.belongs to family=/pgfplots/scale,
	/pgfplots/xmode/normal/.code={\pgfplots@xislineartrue},
	/pgfplots/xmode/normal/.belongs to family=/pgfplots/scale,
	/pgfplots/xmode/linear/.code={\pgfplots@xislineartrue},
	/pgfplots/xmode/linear/.belongs to family=/pgfplots/scale,
	/pgfplots/xmode/log/.code={\pgfplots@xislinearfalse},
	/pgfplots/xmode/log/.belongs to family=/pgfplots/scale,
	/pgfplots/xmode=linear,
	/pgfplots/ymode/.is choice,
	/pgfplots/ymode/.belongs to family=/pgfplots/scale,
	/pgfplots/ymode/normal/.code={\pgfplots@yislineartrue},
	/pgfplots/ymode/normal/.belongs to family=/pgfplots/scale,
	/pgfplots/ymode/linear/.code={\pgfplots@yislineartrue},
	/pgfplots/ymode/linear/.belongs to family=/pgfplots/scale,
	/pgfplots/ymode/log/.code={\pgfplots@yislinearfalse},
	/pgfplots/ymode/log/.belongs to family=/pgfplots/scale,
	/pgfplots/ymode=linear,
	/pgfplots/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},
	/pgfplots/error bars/x explicit relative/.code=	\def\pgfplots@errorbars@xmode{3},
	/pgfplots/error bars/x fixed relative=0,
	/pgfplots/error bars/x fixed=0,
	/pgfplots/error bars/y fixed/.code=				\def\pgfplots@errorbars@yfixed{#1}\def\pgfplots@errorbars@ymode{0},
	/pgfplots/error bars/y fixed relative/.code=		\def\pgfplots@errorbars@yrel{#1}\def\pgfplots@errorbars@ymode{1},
	/pgfplots/error bars/y explicit/.code=			\def\pgfplots@errorbars@ymode{2},
	/pgfplots/error bars/y explicit relative/.code=	\def\pgfplots@errorbars@ymode{3},
	/pgfplots/error bars/y fixed relative=0,
	/pgfplots/error bars/y fixed=0,
	/pgfplots/error bars/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
			\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,
	/pgfplots/error bars/x dir/minus/.code=				\def\pgfplots@errorbars@xdirection{2}\pgfplots@errorbars@enabledtrue,
	/pgfplots/error bars/x dir/both/.code=				\def\pgfplots@errorbars@xdirection{3}\pgfplots@errorbars@enabledtrue,
	/pgfplots/error bars/x dir=none,
	/pgfplots/error bars/y dir/.is choice,
	/pgfplots/error bars/y dir/none/.code={%
		\def\pgfplots@errorbars@ydirection{0}%
		\ifnum\pgfplots@errorbars@xdirection=0
			\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={%
		\pgfkeysalso{/pgfplots/every error bar/.append style={#1}}%
	},
	/pgfplots/every error bar/.style={thin},
	/pgfplots/every error bar/.append code={\pgfplotsdeprecatedstylecheck{/tikz/every error bar}},
	/pgfplots/error bars/allow name path/.is if=pgfplots@error@bars@allow@name@path,
	/pgfplots/error bars/draw error bar/.code 2 args={%
%\message{/pgfplots/error bars/draw error bar:  working with '#1' -- '#2'.}%
		\pgfkeysgetvalue{/pgfplots/error bars/error mark}{\pgfplotserrorbarsmark}%
		\pgfkeysgetvalue{/pgfplots/error bars/error mark options}{\pgfplotserrorbarsmarkopts}%
		\draw #1 -- #2 node[pos=1,sloped,allow upside down] {%
			\expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{%
				\expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}%
				\pgfusepath{stroke}}%
		};
	},
	/pgfplots/every node near coord/.style={},
	/pgfplots/nodes near coords style/.style={/pgfplots/every node near coord/.append style={#1}},
	/pgfplots/node near coords style/.style={/pgfplots/every node near coord/.append style={#1}},
	/pgfplots/node near coord style/.style={/pgfplots/every node near coord/.append style={#1}},
	%
	% Replaces the 'nodes near coords' CONFIGURATION by its default
	% settings. It does NOT activate 'nodes near coords'.
	/pgfplots/nodes near coords defaults/.style={
		% values: 'horizontal', 'vertical' or any tikz alignment command
		% like 'left' or 'anchor=south west' or so.
		/pgfplots/nodes near coords align/.initial=auto,%
		%
		% 'nodes near coords=<content of node>'.
		% The content is by default \pgfmathprintnumber\pgfplotspointmeta.
		%
		% Use 'point meta=y' after 'nodes near coords' to typeset the y coordinates
		% Use 'point meta=x' to typeset the x coordinates
		/pgfplots/nodes near coords/.style={%
			/pgfplots/scatter/@pre marker code/.code={},%
			/pgfplots/scatter/@post marker code/.code={},%
			/pgfplots/nodes near coords*={##1},%
		},%
		/pgfplots/nodes near coords*/.style={%
			/pgfplots/scatter/true*,%
			/pgfplots/set point meta if empty=f(x),%
			scatter/@post marker code/.append code={%
				% ok, place the node.
				\t@pgfplots@tokb=\expandafter{\pgfplots@current@point@coordinatestyle}% see 'coordinate style'%
				\edef\pgfplots@loc@TMPa{%
					/pgfplots/nodes near coords/@@eval alignment,%
					\the\t@pgfplots@tokb,%
					/pgfplots/every node near coord%
				}%
				\expandafter\node\expandafter[\pgfplots@loc@TMPa]%
				{%
					\if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname%
						% point meta=explicit symbolic
						% do not try to invoke \pgfmathprintnumber on
						% symbolic data... this check should keep the user
						% interface simpler.
						\def\pgfplots@loc@TMPa{\pgfmathprintnumber\pgfplotspointmeta}%
						\def\pgfplots@loc@TMPb{##1}%
						\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
							\pgfplotspointmeta
						\else
							##1%
						\fi
					\else
						##1%
					\fi
				};
			},%
		},%
		/pgfplots/nodes near coords*/.default={\pgfmathprintnumber\pgfplotspointmeta},
	},
	/pgfplots/nodes near coords defaults,
	%
	%
	/pgfplots/nodes near coords bar offset/.initial=0.5,
	%
	% Replaces the 'nodes near coords' CONFIGURATION by one suitable
	% for xbar stacked
	/pgfplots/nodes near coords xbar stacked configuration/.style={
		/pgfplots/nodes near coords defaults,
		/pgfplots/nodes near coords*/.add code={%
			\pgfkeysalso{
				/pgfplots/set point meta if empty=rawx,%
			}%
		}{%
			\pgfkeysalso{%
				/pgfplots/scatter/position/absolute,
				/pgfplots/scatter/@post marker code/.add code={
					\pgfplotspointgetnormalizedcoordinates
					\pgfplotspointgetnormalizedzerolevelcoordinates
					\pgfkeysgetvalue{/pgfplots/nodes near coords bar offset}\pgfplots@nodes@near@coords@bar@offset
					\tikzset{
						every node/.append style={%
							at={(normalized axis cs:%
								{ (\pgfplots@nodes@near@coords@bar@offset)  *\pgfkeysvalueof{/data point/x}
								 +(1-\pgfplots@nodes@near@coords@bar@offset)*\pgfkeysvalueof{/data point/zero/x}},%
								\pgfkeysvalueof{/data point/y})%
							}%
						}
					}%
				}{},%
			}%
		},
		/pgfplots/nodes near coords align={%
			anchor=center,
		},
		%
		% ... just in case someone uses xbar stacked together with
		% 'bar shift':
		/pgfplots/every node near coord/.append style={%
			/pgfplots/every node near coord bar shift=y,
			/pgfplots/every node near coord bar shift/.code=,
		},%
	},
	%
	/pgfplots/every node near coord bar shift/.style={#1shift={\pgfplotbarshift}},%
	%
	% Replaces the 'nodes near coords' CONFIGURATION by one suitable
	% for ybar stacked
	/pgfplots/nodes near coords ybar stacked configuration/.style={
		/pgfplots/nodes near coords defaults,
		/pgfplots/nodes near coords*/.add code={%
			\pgfkeysalso{
				/pgfplots/set point meta if empty=rawy,%
			}%
		}{%
			\pgfkeysalso{%
				/pgfplots/scatter/position/absolute,
				/pgfplots/scatter/@post marker code/.add code={
					\pgfplotspointgetnormalizedcoordinates
					\pgfplotspointgetnormalizedzerolevelcoordinates
					\pgfkeysgetvalue{/pgfplots/nodes near coords bar offset}\pgfplots@nodes@near@coords@bar@offset
					\tikzset{
						every node/.append style={%
							at={(normalized axis cs:%
								\pgfkeysvalueof{/data point/x},%
								{ (\pgfplots@nodes@near@coords@bar@offset)  *\pgfkeysvalueof{/data point/y}
								 +(1-\pgfplots@nodes@near@coords@bar@offset)*\pgfkeysvalueof{/data point/zero/y}})%
							}%
						}
					}%
				}{},%
			}%
		},
		/pgfplots/nodes near coords align={%
			anchor=center,
		},
		%
		% ... just in case someone uses ybar stacked together with
		% 'bar shift':
		/pgfplots/every node near coord/.append style={%
			/pgfplots/every node near coord bar shift=x,
			/pgfplots/every node near coord bar shift/.code=,
		},%
	},
	%
	%
	%
	/pgfplots/scatter explicit color/.style 2 args={%
		/pgfplots/scatter/@pre marker code/.code=,%
		/pgfplots/scatter/@post marker code/.code=,%
		/pgfplots/scatter explicit color*={#1}{#2},%
	},%
	/pgfplots/scatter explicit color*/.style 2 args={%
		/pgfplots/point meta=explicit symbolic,
		/pgfplots/scatter/true*,%
		/pgfplots/scatter/@pre marker code/.append code={%
			\edef\pgfplots@loc@TMPa{\noexpand\pgfutil@definecolor{mapped color}{#1}{\pgfplotspointmeta}}%
			\pgfplots@loc@TMPa
			\pgfplots@scope@with@coord@styles[#2]%
		},%
		/pgfplots/scatter/@post marker code/.prefix code={%
			\endscope
		},%
	},
	/pgfplots/scatter rgb/.style={%
		/pgfplots/scatter/@pre marker code/.code=,%
		/pgfplots/scatter/@post marker code/.code=,%
		/pgfplots/scatter rgb*={#1},%
	},
	/pgfplots/scatter rgb*/.style={/pgfplots/scatter explicit color*={rgb}{#1}},
	/pgfplots/scatter rgb*/.default={draw=mapped color!80!black,fill=mapped color},
	%
	/pgfplots/scatter cmyk/.style={%
		/pgfplots/scatter/@pre marker code/.code=,%
		/pgfplots/scatter/@post marker code/.code=,%
		/pgfplots/scatter cmyk*={#1},%
	},
	/pgfplots/scatter cmyk*/.style={/pgfplots/scatter explicit color*={cmyk}{#1}},
	/pgfplots/scatter cmyk*/.default={draw=mapped color!80!black,fill=mapped color},
	%
	%
	% allows to specify something like
	%    coordinate style/.condition={x==4}{color=red},
	%    coordinate style/.condition={x > 5}{color=black, mark=*},
	% it is only evaluated in specific plot handlers.
	% Each conditionession is added to the available list.
	/pgfplots/coordinate style/.condition/.code 2 args={%
		\pgfplotsapplistXpushback{E}{#1}{#2},\to\pgfplots@coordinate@style@list
		\def\b@has@pgfplots@colordinate@style{1}%
	},
	% example:
	% coordinate style/.from={\thisrow{row with styles}},
	/pgfplots/coordinate style/.from/.code={%
		\pgfplotsapplistXpushback{V}{#1}{},\to\pgfplots@coordinate@style@list
		\def\b@has@pgfplots@colordinate@style{1}%
	},
	% clears all such styles.
	/pgfplots/coordinate style/.clear/.code={%
		\pgfplotsapplistXnewempty{\pgfplots@coordinate@style@list}%
		\def\b@has@pgfplots@colordinate@style{0}%
	},
	/pgfplots/coordinate style/.clear,%
	%
	%
	%
	/pgfplots/visualization depends on/list/.initial=,%
	/pgfplots/visualization depends on/.style={%
		/pgfplots/visualization depends on/list/.add={}{,{#1}}%
	},
	/pgfplots/bar cycle list/.style={/pgfplots/cycle list={%
		{blue,fill=blue!30!white,mark=none},%
		{red,fill=red!30!white,mark=none},%
		{brown!60!black,fill=brown!30!white,mark=none},%
		{black,fill=gray,mark=none},%
		{violet!80!black,fill=violet,mark=none},%
		{green,fill=green!80!black,mark=none}%
		}
	},
	/pgfplots/area cycle list/.style={bar cycle list},
	/pgfplots/area legend/.style={%
		/pgfplots/legend image code/.code={%
			\draw[##1] (0cm,-0.1cm) rectangle (0.6cm,0.1cm);
		}%
	},
	/pgfplots/area style/.style={%
		area cycle list,
		area legend,
		axis on top,
	},
	/pgfplots/ybar legend/.style={
		/pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0cm,0.8em) (2*\pgfplotbarwidth,0.6em)};},
	},
	/pgfplots/single ybar legend/.style={
		/pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=6pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0pt,0.8em)};},
	},
	%
	% A style which shifts bars automatically such that they are
	% adjacent to each other. It applies to bars of the same type
	% only.
	% #1: the space between adjacent bars
	/pgfplots/bar shift auto/.style={%
		/pgf/bar shift={%
				% total width = n*w + (n-1)*skip
				% -> subtract half for centering
				-0.5*(\numplotsofactualtype*\pgfplotbarwidth + (\numplotsofactualtype-1)*(#1))  +
				% the '0.5*w' is for centering
				(.5+\plotnumofactualtype)*\pgfplotbarwidth + \plotnumofactualtype*(#1)},%
	},
	/pgfplots/bar shift auto/.default={2pt},%
	%
	%
	% FIXME : never tested so far
	% #1: width
	% #2: separation space
	/pgfplots/plot yshift auto/.style 2 args={/pgfplots/plot shift auto={y}{#1}{#2}},%
	/pgfplots/plot xshift auto/.style 2 args={/pgfplots/plot shift auto={x}{#1}{#2}},%
	/pgfplots/plot shift auto/.style args={#1#2#3}{%
		/pgfplots/axis plot except legend style={%
			#1shift={%
					% total width = n*w + (n-1)*skip
					% -> subtract half for centering
					-0.5*(\numplotsofactualtype*(#1) + (\numplotsofactualtype-1)*(#2))  +
					% the '0.5*w' is for centering
					(.5+\plotnumofactualtype)*(#1) + \plotnumofactualtype*(#2)%
			},%
		},
	},
	/pgfplots/ybar/.style={
		bar direction=y,
		bar cycle list,
		xtick align=outside,
		ybar legend,
		clip limits if compat={clip ylimits=false},
		/pgfplots/set point meta if empty=f(x),%
		/pgfplots/bar shift auto={#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={\pgfplotbarshift}]
				##1 -- ##2 node[pos=1,sloped,allow upside down] {%
				\expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{%
					\expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}%
					\pgfusepath{stroke}}%
			};
		},%
		/pgfplots/every node near coord/.append style={%
			/pgfplots/every node near coord bar shift=x,
			/pgfplots/every node near coord bar shift/.code=,
		},%
		/tikz/ybar,
	},
	/pgfplots/ybar/.default=2pt,
	/pgfplots/xbar legend/.style={
		/pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=3pt,yshift=-0.2em,bar shift=0pt] plot coordinates {(0.8em,0cm) (0.6em,2*\pgfplotbarwidth)};},
	},
	/pgfplots/single xbar legend/.style={
		/pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,bar width=6pt,yshift=0.2ex,bar shift=0pt] plot coordinates {(0.8em,0pt)};},
	},
	/pgfplots/bar direction/.is choice,
	/pgfplots/bar direction/auto/.code=\def\pgfplots@bar@direction@choice{a},%
	/pgfplots/bar direction/x/.code=\def\pgfplots@bar@direction@choice{x},%
	/pgfplots/bar direction/y/.code=\def\pgfplots@bar@direction@choice{y},%
	/pgfplots/bar direction=auto,
	%
	/pgfplots/xbar/.style={
		bar direction=x,
		bar cycle list,
		ytick align=outside,
		clip limits if compat={clip xlimits=false},
		/pgfplots/xbar legend,
		/pgfplots/set point meta if empty=x,%
		/pgfplots/bar shift auto={#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={\pgfplotbarshift}]
				##1 -- ##2 node[pos=1,sloped,allow upside down] {%
				\expandafter\tikz\expandafter[\pgfplotserrorbarsmarkopts]{%
					\expandafter\pgfuseplotmark\expandafter{\pgfplotserrorbarsmark}%
					\pgfusepath{stroke}}%
			};
		},%
		/pgfplots/every node near coord/.append style={%
			/pgfplots/every node near coord bar shift=y,
			/pgfplots/every node near coord bar shift/.code=,
		},%
		/tikz/xbar,
	},
	/pgfplots/xbar/.default=2pt,
	/pgfplots/ybar interval legend/.style={
		/pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};},
	},
	/pgfplots/ybar interval/.style={%
		bar direction=y,
		/pgfplots/set point meta if empty=f(x),%
		bar cycle list,
		x tick label as interval,
		xmajorgrids,
		clip limits if compat={clip ylimits=false},
		xtick align=outside,
		xtick=data,
		ybar interval legend,
		bar interval width={#1/\numplotsofactualtype},
		bar interval shift={(\plotnumofactualtype+0.5)/\numplotsofactualtype},
		/tikz/ybar interval,
	},
	/pgfplots/ybar interval/.default=1,
	/pgfplots/xbar interval legend/.style={%
		/pgfplots/legend image code/.code={\draw[##1,/tikz/.cd,yshift=-0.2em,bar interval width=0.7,bar interval shift=0.5] plot coordinates {(0cm,0.8em) (5pt,0.6em) (10pt,0.6em)};},
	},
	/pgfplots/xbar interval/.style={%
		bar direction=x,
		/pgfplots/set point meta if empty=x,%
		bar cycle list,
		y tick label as interval,
		ytick=data,
		ymajorgrids,
		ytick align=outside,
		xbar interval legend,
		clip limits if compat={clip xlimits=false},
		bar interval width={#1/\numplotsofactualtype},
		bar interval shift={(\plotnumofactualtype+0.5)/\numplotsofactualtype},
		/tikz/xbar interval,
	},
	/pgfplots/xbar interval/.default=1,
	/pgfplots/stacked since 1.9/.code={},
	/pgfplots/stacked since 1.13/.code=,
	/pgfplots/xbar stacked/.style={
		bar direction=x,
		bar cycle list,
		single xbar legend,
		clip limits if compat={clip xlimits=false},
		stack plots=x,
		stack dir=#1,
		/tikz/xbar,
		stacked since 1.9,
		activate nodes near coords xbar stacked,
		stacked since 1.13,
	},
	/pgfplots/xbar stacked/.default=plus,
	/pgfplots/ybar stacked/.style={
		bar direction=y,
		bar cycle list,
		single ybar legend,
		clip limits if compat={clip ylimits=false},
		stack plots=y,
		stack dir=#1,
		/tikz/ybar,
		stacked since 1.9,
		activate nodes near coords ybar stacked,
		stacked since 1.13,
	},
	/pgfplots/ybar stacked/.default=plus,
	/pgfplots/xbar interval stacked/.style={
		bar direction=x,
		/pgfplots/set point meta if empty=x,%
		bar cycle list,
		clip limits if compat={clip xlimits=false},
		single xbar legend,
		stack plots=x,
		stack dir=#1,
		/tikz/xbar interval,
		stacked since 1.13,
	},
	/pgfplots/xbar interval stacked/.default=plus,
	/pgfplots/ybar interval stacked/.style={
		bar direction=y,
		/pgfplots/set point meta if empty=f(x),%
		bar cycle list,
		single ybar legend,
		clip limits if compat={clip ylimits=false},
		stack plots=y,
		stack dir=#1,
		/tikz/ybar interval,
		stacked since 1.13,
	},
	/pgfplots/ybar interval stacked/.default=plus,
	/pgfplots/yticklabel interval boundaries/.style={%
		y tick label as interval,
		yticklabel={$\pgfmathprintnumber{\tick}$ -- $\pgfmathprintnumber{\nexttick}$}
	},
	/pgfplots/xticklabel interval boundaries/.style={%
		x tick label as interval,
		xticklabel={$\pgfmathprintnumber{\tick}$ -- $\pgfmathprintnumber{\nexttick}$}
	},
	/pgfplots/plot file/skip first/.is if=pgfplots@plot@file@skipfirst,
	/pgfplots/plot file/skip first/.default=true,
	/pgfplots/plot file/ignore first/.style={/pgfplots/plot file/skip first={#1}},
	/pgfplots/plot file/.search also=/pgfplots,%
	/pgfplots/plot coordinates/math parser/.is if=pgfplots@plot@coords@mathparser,
	/pgfplots/plot graphics/.code={\let\tikz@plot@handler=\pgfplotsplothandlergraphics},%
	/pgfplots/plot graphics/src/.initial=,
	/pgfplots/plot graphics/includegraphics/.initial=,
	/pgfplots/plot graphics/includegraphics cmd/.initial=\includegraphics,
	/pgfplots/plot graphics/xmin/.initial=,
	/pgfplots/plot graphics/xmax/.initial=,
	/pgfplots/plot graphics/ymin/.initial=,
	/pgfplots/plot graphics/ymax/.initial=,
	/pgfplots/plot graphics/zmin/.initial=,
	/pgfplots/plot graphics/zmax/.initial=,
	%
	% a) to provide a bounding box: points={(0,1) (0,2)}
	% or b) to squeeze the graphics into internal image coordinates:
	% points={(0,1,0) => (0,4)  (0,0,1) => (40,600)}
	% or c) both of them.
	/pgfplots/plot graphics/points/.initial=,
	/pgfplots/plot graphics/auto adjust axis/.is if=pgfplots@plot@graphics@autoadjustaxis,
	/pgfplots/plot graphics/auto adjust axis=true,
	/pgfplots/plot graphics/snap z/.initial=0.02,
	% possible values: debug=<empty>|false|true|visual
	/pgfplots/plot graphics/debug/.initial=,
	/pgfplots/plot graphics/debug/.default=true,
	/pgfplots/plot graphics/squeeze tol/.initial=2pt,
	%
	% this command key should defined \pgfmathresult to be
	% \pgfmathresult -> {{<wd>}{<ht>}}
	% where <wd> is the natural width of the input image and
	% <ht> is the natural height.
	% The input image file name is available as 'plot graphics/src'.
	% The default implementation invoked 'lowlevel draw={}{}' and
	% measures the resulting dimensions.
	/pgfplots/plot graphics/lowlevel get natural size/.code={%
		\pgfplots@plot@handler@graphics@getnaturalsize
	},
	/pgfplots/plot graphics/lowlevel draw/.code 2 args={%
		\pgfplots@plot@handler@graphics@DRAW{#1}{#2}%
	},%
	/pgfplots/plot graphics/node/.style={
		transform shape,
		inner sep=0pt,
		outer sep=0pt,
		every node/.style={},
		anchor=south west,
		at={(0pt,0pt)},
		rectangle
	},
	/tikz/pos segment/.initial=,
	% empty line=none|auto|scanline|nan|jump
	% nan and jump is the same.
	/pgfplots/empty line/.initial=auto,
	% 'mesh' plots.
	% The macro \pgfplots@meshmode is
	% n if meshmode == false,
	% m if meshmode == 'mesh',
	% s if meshmode == 'surf'.
	%
	% The type of surface plot can be configured with 'shader'.
	/pgfplots/mesh/.is choice,
	/pgfplots/mesh/true/.code={%
		\def\pgfplots@meshmode{m}%
		\let\tikz@plot@handler=\pgfplotsplothandlermesh
		\pgfplots@perpointmeta@expandtrue
		\pgfkeysalso{/pgfplots/set point meta if empty=f(x),/pgfplots/every mesh,/pgfplots/mesh legend,/tikz/color=mapped color}%
	},
	/pgfplots/mesh/false/.code={
		\def\pgfplots@meshmode{n}%
		\ifx\tikz@plot@handler\pgfplotsplothandlermesh
			\let\tikz@plot@handler=\pgfplothandlerlineto
		\fi},
	/pgfplots/mesh/.default=true,
	/pgfplots/surf/.code={%
		\pgfkeysalso{/pgfplots/mesh=#1}%
		\def\pgfplots@meshmode{s}%
	},%
	/pgfplots/patch/.code={%
		\pgfkeysalso{/pgfplots/surf=#1,/pgfplots/mesh input=patches,/pgfplots/every patch}%
	},%
	%
	/pgfplots/mesh/color input/.is choice,
	/pgfplots/mesh/color input/colormap/.code=\def\pgfplotsplothandlermesh@colorinput{0},%
	/pgfplots/mesh/color input/explicit/.code={%
		\def\pgfplotsplothandlermesh@colorinput{1}%
		\def\pgfplotsplothandlermesh@colorinput@mathparse{0}%
		%
		\pgfplotsaxisifhaspointmeta{%
			\if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname
				% ok.
			\else
				% oh. the point meta is numeric, i.e. it will be
				% mapped. Change to symbolic for explicit color input:
				\pgfkeysalso{/pgfplots/point meta/explicit symbolic}%
			\fi
		}{%
			% there is no point meta. Set it to "reasonable" defaults:
			\pgfkeysalso{/pgfplots/point meta/explicit symbolic}%
		}%
		\pgfplots@perpointmeta@expandtrue
	},%
	/pgfplots/mesh/color input/explicit mathparse/.code={%
		\pgfkeysalso{/pgfplots/mesh/color input/explicit}%
		\def\pgfplotsplothandlermesh@colorinput@mathparse{1}%
		\pgfplots@perpointmeta@expandtrue
	},%
	/pgfplots/mesh/color input=colormap,
	%
	/pgfplots/mesh/colorspace explicit color output/.initial=rgb,
	/pgfplots/mesh/colorspace explicit color input/.initial=rgb,
	%
	/pgfplots/every patch/.style={miter limit=1},
	/pgfplots/patch table/value/.initial=,
	/pgfplots/patch table/.code={
		\pgfkeyssetvalue{/pgfplots/patch table/value}{#1}%
		\pgfplotsplothandlermesh@patchtable@hascdatafalse
	},
	/pgfplots/patch table with point meta/.code={%
		\pgfkeyssetvalue{/pgfplots/patch table/value}{#1}%
		\pgfplotsplothandlermesh@patchtable@hascdatatrue
		\pgfplotsplothandlermesh@patchtable@cdata@individualfalse
		\pgfkeysalso{/pgfplots/point meta/explicit}%
	},
	/pgfplots/patch table with individual point meta/.code={%
		\pgfkeyssetvalue{/pgfplots/patch table/value}{#1}%
		\pgfplotsplothandlermesh@patchtable@hascdatatrue
		\pgfplotsplothandlermesh@patchtable@cdata@individualtrue
		\pgfkeysalso{/pgfplots/point meta/explicit}%
	},
	/pgfplots/patch type/.initial=,
	/pgfplots/patch type sampling/.is if=pgfplotsplothandlermesh@patch@type@sampling,
	/pgfplots/patch internal depth/.is if=pgfplotsplothandlermesh@internaldepth,
	/pgfplots/patch internal depth=true,
	/pgfplots/patch to triangles/.is choice,
	/pgfplots/patch to triangles/false/.code=			{\def\pgfplotsplothandlermesh@triangulate{0}},
	/pgfplots/patch to triangles/true/.code=			{\def\pgfplotsplothandlermesh@triangulate{1}},
	/pgfplots/patch to triangles/true with edges/.code=	{\def\pgfplotsplothandlermesh@triangulate{2}},
	/pgfplots/patch to triangles=false,
	/pgfplots/patch to triangles/.default=true,
	/pgfplots/mesh input/.is choice,
	/pgfplots/mesh input/lattice/.code=	{\def\pgfplotsplothandlermesh@matrixinput{1}},
	/pgfplots/mesh input/patches/.code=	{\def\pgfplotsplothandlermesh@matrixinput{0}},
	/pgfplots/mesh input/image/.code=	{\def\pgfplotsplothandlermesh@matrixinput{2}},
	/pgfplots/mesh input/lattice,
	/pgfplots/patch refines/.initial=0,
	/pgfplots/hide refined edges/.is if=pgfplotsplothandlermesh@hide@refined@edges,
	/pgfplots/hide refined edges/.default=true,
	/pgfplots/mesh/refines/.style={/pgfplots/patch refines={#1}},
	/pgfplots/mesh/rows/.initial=,
	/pgfplots/mesh/cols/.initial=,
	/pgfplots/mesh/scanline verbose/.is if=pgfplots@scanline@verbose,%
	/pgfplots/mesh/scanline verbose/.default=true,
	%
	% this is currently only a debug feature. Perhaps it will never
	% reach production state because of the lacking z buffering for
	% this technique.
	/pgfplots/mesh/show normals/.is if=pgfplotsplothandlermesh@shownormals,
	/pgfplots/mesh/show normals/.default=true,
	/pgfplots/mesh/show normals length factor/.initial=50,
	%
	/pgfplots/late options/.code={%
		\pgfplotssetlateoptions{#1}%
	},
	%
	/pgfplots/matrix plot/.style={%
		/pgfplots/late options={%
			/pgfplots/y dir=reverse,
			/pgfplots/axis on top,
		},
		%
		/pgfplots/matrix plot*,
	},
	/pgfplots/matrix plot*/.style={%
		/pgfplots/surf,
		/pgfplots/mesh input=image,
		/pgfplots/shader=flat corner,
		/pgfplots/z buffer=none,
	},
	/pgfplots/imagesc/.style={/pgfplots/matrix plot},%
	/pgfplots/imagesc*/.style={/pgfplots/matrix plot*},%
	%
	/pgfplots/every patch normal/.style={-stealth,red},
	%
	/pgfplots/mesh/interior colormap/.code 2 args={%
		\pgfplotscreatecolormap{#1}{#2}%
		\pgfkeysalso{/pgfplots/mesh/interior colormap name=#1}%
	},
	/pgfplots/mesh/interior colormap name/.initial=,
	/pgfplots/mesh/interior colormap thresh/.initial=0,
	/pgfplots/mesh/check/.code={%
		\pgfplotsutilifstringequal{#1}{false}{%
			\def\pgfplots@mesh@checkmode{0}%
		}{%
			\pgfplotsutilifstringequal{#1}{warning}{%
				\def\pgfplots@mesh@checkmode{1}%
			}{%
				\pgfplotsutilifstringequal{#1}{error}{%
					\def\pgfplots@mesh@checkmode{2}%
				}{%
					\pgfplots@error{Invalid value `#1' for /pgfplots/mesh/check. Please use one of false,warning,error}%
				}%
			}%
		}%
	},%
	/pgfplots/mesh/check=error,
	/pgfplots/mesh/ordering/.is choice,
	/pgfplots/mesh/ordering/x varies/.code={\def\pgfplots@plot@mesh@ordering{0}},
	/pgfplots/mesh/ordering/y varies/.code={\def\pgfplots@plot@mesh@ordering{1}},
	/pgfplots/mesh/ordering/rowwise/.style={/pgfplots/mesh/ordering/x varies},
	/pgfplots/mesh/ordering/colwise/.style={/pgfplots/mesh/ordering/y varies},
	/pgfplots/mesh/ordering/x varies,
	/pgfplots/every mesh/.code={%
		% is slower:
		%\pgfkeysalso{/pgfplots/unbounded coords=jump}% mesh plots need balanced cols!
	},%
	/pgfplots/mesh legend/.style={%
		/pgfplots/legend image code/.code={%
			\pgfplotsplothandlermesh@defaultlegend@img{##1}%
		}%
	},
	/pgfplots/mesh/num points/.initial=,%\numcoords,% this is NOT part of the public interface. Don't change it.
	/pgfplots/z buffer/.is choice,%
	/pgfplots/z buffer/none/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{0}},%
	/pgfplots/z buffer/reverse x seq/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{1}},%
	/pgfplots/z buffer/reverse y seq/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{2}},%
	/pgfplots/z buffer/reverse xy seq/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{3}},%
	/pgfplots/z buffer/sort/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{4}},%
	/pgfplots/z buffer/auto/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{5}},%
	/pgfplots/z buffer/default/.code={\def\pgfplotsplothandlermesh@zbuffer@choice{6}},%
	/pgfplots/z buffer/default,%
	%
	% Set the shader used for surface plots.
	% RULES:
	% 	1. meshmode == 'm' (mesh):
	% 		This means we use "shader/flat" to determine the colors
	% 		and ignore fill colors.
	% 	2. meshmode == 's' (surf):
	% 		the shader specifies how colors are used.
	% 	3. Onedimensional mesh/surf plots are treated like 'mesh'
	% 	plots.
	/pgfplots/shader/.is choice,
	/pgfplots/shader/flat corner/.code={\def\pgfplotsplothandlermesh@shader{0}\def\pgfplotsplothandlermesh@flatmode{c}},
	/pgfplots/shader/flat mean/.code={\def\pgfplotsplothandlermesh@shader{0}\def\pgfplotsplothandlermesh@flatmode{m}},
	/pgfplots/shader/flat/.style={/pgfplots/shader/flat mean},%
	/pgfplots/shader/faceted/.code={\def\pgfplotsplothandlermesh@shader{1}},
	/pgfplots/shader/interp/.code={\def\pgfplotsplothandlermesh@shader{2}},
	/pgfplots/shader/faceted interp/.code={\def\pgfplotsplothandlermesh@shader{3}},
	/pgfplots/shader/faceted,
	/pgfplots/faceted color/.initial=mapped color!80!black,
	/pgfplots/marker layer/.initial=auto,
	/pgfplots/clip marker paths/.is if=pgfplots@clip@marker@paths,
	/pgfplots/clip marker paths/.default=true,
	/pgfplots/axis on top/.is if=pgfplots@axis@on@top,
	/pgfplots/axis on top/.default=true,
	/pgfplots/invoke before crossref tikzpicture/.initial={%
		\expandafter\ifx\csname tikzappendtofigurename\endcsname\relax
		\else
			\begingroup
			\tikzappendtofigurename{_crossref}%
		\fi
	},
	/pgfplots/invoke after crossref tikzpicture/.initial={%
		\expandafter\ifx\csname tikzappendtofigurename\endcsname\relax
		\else
			\endgroup
		\fi
	},%
	/pgfplots/every crossref picture/.style={%
		baseline,yshift=0.3em
	},
	/pgfplots/unbounded coords/.code={%
		\edef\pgfplots@loc@TMPa{#1}%
		\def\pgfplots@loc@TMPb{discard}%
		\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			\def\pgfplots@unbounded@handler{d}%
		\else
			\def\pgfplots@loc@TMPb{jump}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				\def\pgfplots@unbounded@handler{j}%
			\else
				\pgfplots@error{Sorry, the choice `#1' is unknown for \pgfkeyscurrentkey. Please use either 'discard' or 'jump'.}%
			\fi
		\fi
	},%
	/pgfplots/unbounded coords=discard,
	/pgfplots/x coord trafo/.code={},
	/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={},
	%
	/pgfplots/symbolic coords/magic prefix/.initial={[normalized]},
	% #1 : the coordinate in question. Can be x,y,z, or even hist/data
	% or similar constructs.
 	% #2 : {<symbol1>,<symbol2>,....<symboln>}
	/pgfplots/symbolic coords/.code 2 args={%
		\expandafter\pgfplotsarraynew\csname pgfplots@symbolic@coords@#1@inverse\endcsname{#2}%
		\expandafter\pgfplotsarrayforeachungrouped\csname pgfplots@symbolic@coords@#1@inverse\endcsname\as\pgfplots@loc@TMPa{%
			\pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPa
%			\message{Defining symb coords \pgfplots@loc@TMPa^^J}%
			\expandafter\edef\csname pgfp@symb@coords@#1@\pgfplots@loc@TMPa\endcsname{\pgfplotsarrayforeachindex}%
		}%
		\pgfkeysgetvalue{/pgfplots/symbolic coords/magic prefix}\pgfplots@symb@magic@prefix
		\pgfkeysdef{/pgfplots/#1 coord trafo}{%
			\expandafter\pgfplotsutilifstartswith\expandafter{\pgfplots@symb@magic@prefix}{##1}{%
				% Ah - something like [normalized]1.5
				% we need to assign the suffix 1.5:
				\edef\pgfmathresult{\pgfplotsretval}%
			}{%
				% ensure that special (unexpandable) characters are
				% preserved:
				\def\pgfplots@loc@TMPa{##1}%
				\pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPa
				\pgfutil@ifundefined{pgfp@symb@coords@#1@\pgfplots@loc@TMPa}{%
					\t@pgfplots@toka={##1}%
					\t@pgfplots@tokb={#2}%
					\pgfplots@error{Sorry, the input coordinate `\the\t@pgfplots@toka' has not been defined with 'symbolic #1 coords={\the\t@pgfplots@tokb}... Maybe it has been misspelled? Or did you mean something like \pgfplots@symb@magic@prefix\the\t@pgfplots@toka?}%
					\def\pgfmathresult{0}%
				}{%
					\edef\pgfmathresult{\csname pgfp@symb@coords@#1@\pgfplots@loc@TMPa\endcsname}%
				}%
			}%
%\message{#1 coord trafo{\pgfplots@loc@TMPa} --> \pgfmathresult^^J}%
		}%
		\pgfkeysdef{/pgfplots/#1 coord inv trafo}{%
			\begingroup
			% discard everything up to the period:
			\pgfmath@basic@round@{##1}%
			\afterassignment\pgfplots@gobble@until@relax
			\count0=\pgfmathresult\relax
			\ifnum\count0<0
				\count0=0
			\else
				\edef\pgfplots@loc@TMPa{\expandafter\pgfplotsarraysizeof\csname pgfplots@symbolic@coords@#1@inverse\endcsname}%
				\count1=\pgfplots@loc@TMPa\relax
				\ifnum\count0<\count1
				\else
					\count0=\count1
					\advance\count0 by-1
				\fi
			\fi
			\expandafter\pgfplotsarrayselect\expandafter\count\expandafter0\expandafter\of\csname pgfplots@symbolic@coords@#1@inverse\endcsname\to\pgfmathresult
%\message{#1 coord inv trafo{##1} -->\the\count0 --> \meaning\pgfmathresult^^J}%
			\pgfmath@smuggleone\pgfmathresult
			\endgroup
		}%
		\pgfkeysifdefined{/pgfplots/#1ticklabel/.@cmd}{%
			\pgfkeysalso{%
				/pgfplots/#1ticklabel={\pgfplots@ticklabel@typeset@arg\tick},%
				/pgfplots/scaled #1 ticks=false,%
				/pgfplots/plot coordinates/math parser=false,%
			}%
		}{%
			% OK. The style can be used for other coordinates as well
			% (like hist/data)
		}%
		%
		\pgfkeysifdefined{/pgfplots/#1 is expr}{%
			\pgfkeyssetvalue{/pgfplots/#1 is expr}{0}%
		}{}%
		%
		% Allow a callback (optional)
		\pgfkeysifdefined{/pgfplots/#1/@execute on coord trafo changed/.@cmd}{%
			\pgfkeysalso {/pgfplots/#1/@execute on coord trafo changed}%
		}{}%
	},%
	/pgfplots/symbolic x coords/.style={symbolic coords={x}{#1}},%
	/pgfplots/symbolic y coords/.style={symbolic coords={y}{#1}},%
	/pgfplots/symbolic z coords/.style={symbolic coords={z}{#1}},%
% Defines the class name \pgfplotspointmetainputhandler:
	/pgfplots/point meta/.code={%
		\pgfplots@pgfkeys@set@point@meta@value{#1}%
	},%
	/pgfplots/point meta/none/.code	={\pgfplotssetpointmetainput{}{}},%
	/pgfplots/point meta/x/.code	={\pgfplotssetpointmetainput{x}{}},%
	/pgfplots/point meta/y/.code	={\pgfplotssetpointmetainput{y}{}},%
	/pgfplots/point meta/z/.code	={\pgfplotssetpointmetainput{z}{}},%
	/pgfplots/point meta/expr/.code={\pgfplotssetpointmetainput{expr}{#1}},%
	/pgfplots/point meta/explicit/.code={\pgfplotssetpointmetainput{explicit}{}},%
	/pgfplots/point meta/explicit symbolic/.code={\pgfplotssetpointmetainput{explicit symbolic}{}},%
	/pgfplots/point meta/f(x)/.code={\pgfplotssetpointmetainput{f(x)}{}},%
	/pgfplots/point meta/TeX code/.code={\pgfplotssetpointmetainput{TeX code}{#1}},%
	/pgfplots/point meta/TeX code/.value required,
	/pgfplots/point meta/TeX code symbolic/.code={\pgfplotssetpointmetainput{TeX code symbolic}{#1}},%
	/pgfplots/point meta/TeX code symbolic/.value required,
	/pgfplots/point meta/symbolic/.style={/pgfplots/point meta/TeX code symbolic={\edef\pgfplotspointmeta{#1}}},
	/pgfplots/set point meta if empty/.code={%
		\ifx\pgfplotspointmetainputhandler\pgfutil@empty
			\pgfkeysalso{/pgfplots/point meta=#1}%
		\fi
	},%
	/pgfplots/point meta/none,
	/pgfplots/point meta rel/.is choice,
	/pgfplots/point meta rel/axis wide/.code={\def\pgfplots@perpointmeta@rel@choice{0}},%
	/pgfplots/point meta rel/per plot/.code={\def\pgfplots@perpointmeta@rel@choice{1}},%
	/pgfplots/point meta rel/axis wide,%
	/pgfplots/point meta min/.initial=,%
	/pgfplots/point meta max/.initial=,%
	%
	/pgfplots/point meta/expand/.is if=pgfplots@perpointmeta@expand,
	/pgfplots/point meta/expand=false,
	%
	/pgfplots/colormap name/.initial=hot,
	/pgfplots/colormap access/.is choice,
	/pgfplots/colormap access/direct/.code={\def\pgfplots@colormap@access{d}},%
	/pgfplots/colormap access/map/.code={\def\pgfplots@colormap@access{m}},%
	/pgfplots/colormap access/piecewise constant/.code={\def\pgfplots@colormap@access{c}},%
	/pgfplots/colormap access/piecewise const/.code=   {\def\pgfplots@colormap@access{c}},%
	/pgfplots/colormap access/const/.code=             {\def\pgfplots@colormap@access{c}},%
	/pgfplots/colormap access/piecewise linear/.style={/pgfplots/colormap access/map},
	/pgfplots/colormap access/map,%
	%/pgfplots/colormap default colorspace/.initial=auto,% declared in pgfplotscolormap.code.tex
	/pgfplots/colormap/.code 2 args={%
		\pgfplotscreatecolormap{#1}{#2}%
		\pgfkeysalso{/pgfplots/colormap name=#1}%
	},
	%
	% #1: a style name like '/pgfplots/colormap/hot'
	/pgfplots/ensure colormap/.code={%
		\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@ensure@old@cm
		\pgfkeysalso{#1}%
		\pgfkeyslet{/pgfplots/colormap name}\pgfplots@ensure@old@cm
	},
	% a backwards compatibility switch:
	/pgfplots/colormap uniform/.is choice,
	/pgfplots/colormap uniform/always/.code={\def\pgfplots@colormap@uniform@choice{0}},
	/pgfplots/colormap uniform/if requested/.code={\def\pgfplots@colormap@uniform@choice{1}},
	/pgfplots/colormap uniform/always,
	%
	% #1: a number X with 0<= x <=0.9 which defines the relative size
	% of the extra interval used for 'colormap access=piecewise constant'
	% The value #1=0 disables the extra interval.
	/pgfplots/colormap access/extra interval width/.code={%
		\pgfplotscolormapsetadditionalintervalwidth{\pgfkeysvalueof{/pgfplots/colormap name}}{#1}%
	},
	%
	/pgfplots/colormap/hot/.style={
		% attention: copied from pgfplots.colormap.code.tex:
		/pgfplots/colormap={hot}{color(0cm)=(blue); color(1cm)=(yellow); color(2cm)=(orange); color(3cm)=(red)}
	},
	/pgfplots/colormap/viridis/.style={%
		/pgfplots/colormap={viridis}{%
			rgb=(0.267,0.00487,0.32942)
			rgb=(0.28192,0.08966,0.41241)
			rgb=(0.28026,0.1657,0.4765)
			rgb=(0.26366,0.23763,0.51877)
			rgb=(0.23744,0.3052,0.54192)
			rgb=(0.20862,0.36775,0.55267)
			rgb=(0.18225,0.42618,0.55711)
			rgb=(0.1592,0.48224,0.55807)
			rgb=(0.13777,0.53749,0.5549)
			rgb=(0.12115,0.59274,0.54465)
			rgb=(0.12808,0.64775,0.5235)
			rgb=(0.18065,0.7014,0.48819)
			rgb=(0.27415,0.75198,0.4366)
			rgb=(0.39517,0.79747,0.36775)
			rgb=(0.53561,0.83578,0.2819)
			rgb=(0.68895,0.86545,0.18272)
			rgb=(0.84557,0.88733,0.0997)
			rgb=(0.99324,0.90616,0.14394)
		}%
	},
	% instantiate viridis such that it is in memory by default:
	/pgfplots/colormap/viridis,
	% ... but reuse hot since it is used to be the default since the
	% beginning:
	/pgfplots/colormap name=hot,
	%
 	/pgfplots/colormap/hot2/.style={
 		/pgfplots/colormap={hot2}{[1cm]rgb255(0cm)=(0,0,0) rgb255(3cm)=(255,0,0) rgb255(6cm)=(255,255,0) rgb255(8cm)=(255,255,255)}
 	},
	/pgfplots/colormap/bluered/.style={
		/pgfplots/colormap={bluered}{rgb255(0cm)=(0,0,180); rgb255(1cm)=(0,255,255); rgb255(2cm)=(100,255,0); rgb255(3cm)=(255,255,0); rgb255(4cm)=(255,0,0); rgb255(5cm)=(128,0,0)}
	},
	/pgfplots/colormap/cool/.style={
		/pgfplots/colormap={cool}{rgb255(0cm)=(255,255,255); rgb255(1cm)=(0,128,255); rgb255(2cm)=(255,0,255)}
	},
	/pgfplots/colormap/greenyellow/.style={
		/pgfplots/colormap={greenyellow}{rgb255(0cm)=(0,128,0); rgb255(1cm)=(255,255,0)}
	},
	/pgfplots/colormap/redyellow/.style={
		/pgfplots/colormap={redyellow}{rgb255(0cm)=(255,0,0); rgb255(1cm)=(255,255,0)}
	},
	/pgfplots/colormap/blackwhite/.style={
		/pgfplots/colormap={blackwhite}{gray(0cm)=(0); gray(1cm)=(1)}
	},
	/pgfplots/colormap/violet/.style={
		/pgfplots/colormap={violet}{rgb255=(25,25,122) color=(white) rgb255=(238,140,238)}
	},
 	/pgfplots/colormap/jet/.style={
 		/pgfplots/colormap={jet}{rgb255(0cm)=(0,0,128) rgb255(1cm)=(0,0,255) rgb255(3cm)=(0,255,255) rgb255(5cm)=(255,255,0) rgb255(7cm)=(255,0,0) rgb255(8cm)=(128,0,0)}
 	},
	%
	% color of colormap={300}
	% color of colormap={300 of viridis}
	/pgfplots/color of colormap/.code={%
		\pgfplots@color@of@colormap{color of colormap={#1}}%
	},%
	/tikz/color of colormap/.style={/pgfplots/color of colormap={#1}},
	% const color of colormap={300}
	% const color of colormap={300 of viridis}
	/pgfplots/const color of colormap/.code={%
		\pgfplots@color@of@colormap{const color of colormap={#1}}%
	},%
	/tikz/const color of colormap/.style={/pgfplots/const color of colormap={#1}},
	% index of colormap={4}
	% index of colormap={4 of viridis}
	/pgfplots/index of colormap/.code={%
		\pgfplots@color@of@colormap{index of colormap={#1}}%
	},%
	/tikz/index of colormap/.style={/pgfplots/index of colormap={#1}},
	%
	% #1: the target color name
	% #2: the color space (like 'rgb')
	% #3: the color components
	/tikz/color/.define/.code args={#1#2#3}{%
		\pgfutil@definecolor{#1}{#2}{#3}%
	},
	%
	%%
	/pgfplots/scatter/.is choice,
	/pgfplots/scatter/false/.code={%
		\pgfplots@scatterplotenabledfalse
	},%
	/pgfplots/scatter/true*/.code={%
		\pgfplots@scatterplotenabledtrue
		\pgfkeysalso{/pgfplots/set point meta if empty=f(x)}%
	},%
	/pgfplots/scatter/true/.code={%
		\pgfplots@scatterplotenabledtrue
		\pgfkeysalso{/pgfplots/set point meta if empty=f(x)}%
		% 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/position/.is choice,
	/pgfplots/scatter/position/absolute/.code={\def\pgfplots@scatter@position{a}},
	/pgfplots/scatter/position/relative/.code={\def\pgfplots@scatter@position{r}},
	/pgfplots/scatter/position=relative,
	/pgfplots/scatter/use mapped color/.style={%
		/pgfplots/scatter/@pre marker code/.code=,%
		/pgfplots/scatter/@post marker code/.code=,%
		/pgfplots/scatter/use mapped color*={#1},%
	},%
	/pgfplots/scatter/use mapped color*/.style={
		/pgfplots/scatter/@pre marker code/.append code={
			\pgfplotscolormapdefinemappedcolor\pgfplotspointmetatransformed
			\pgfplots@scope@with@coord@styles[#1]%
		},
		/pgfplots/scatter/@post marker code/.prefix 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/.style={%
		/pgfplots/scatter/@pre marker code/.code=,%
		/pgfplots/scatter/@post marker code/.code=,%
		/pgfplots/scatter/classes*={#1},%
	},%
	/pgfplots/scatter/classes*/.code={%
		% Step 1: remember the per class-styles as
		% \csname pgfp@scatter@class@<class name>\endcsname
		% -> this is done locally!
		\def\pgfplots@loc@TMPa##1=##2\pgfplots@EEOI{%
			\expandafter\def\csname pgfp@scatter@class@##1\endcsname{##2}%
		}%
		\pgfplotsforeachentryinCSV{\pgfplots@loc@TMPb}{#1}{%
			\expandafter\pgfplots@loc@TMPa\pgfplots@loc@TMPb\pgfplots@EEOI
		}%
		%
		\pgfkeysalso{%
			/pgfplots/scatter/@pre marker code/.append code={\pgfplots@scatter@classes@pre@marker@code},%
			/pgfplots/scatter/@post marker code/.prefix code={\endscope}%
		}%
		% Now:remember the classes.
		\pgfkeyssetvalue{/pgfplots/scatter/classes/values}{#1}%
		%
		% and generate legend items for every single class,
		% But ONLY if we really *have* a plot which uses
		% scatter/classes!
		\pgfkeys{/pgfplots/execute at begin plot@@/.add={}{%
				\ifpgfplots@scatterplotenabled
					\pgfkeysgetvalue{/pgfplots/scatter/@pre marker code/.@cmd}\pgfplots@loc@TMPa
					\def\pgfplots@loc@TMPb{\pgfutil@in@{\pgfplots@scatter@classes@pre@marker@code}}%
					\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa\pgfeov}%
					\ifpgfutil@in@
						% modify '\pgfplots@rememberplotspec' such
						% that it generates entries for every class:
						\let\pgfplots@rememberplotspec@orig=\pgfplots@rememberplotspec
						\def\pgfplots@rememberplotspec##1{%
							\def\pgfplots@scatter@loc@TMPa####1=####2\pgfplots@EEOI{%
								\pgfplots@rememberplotspec@orig{##1,####2}%
								\pgfplots@rememberplotspec@for@label[####1]{##1,####2}%
							}%
							\pgfplotsforeachentryinCSV{\pgfplots@scatter@loc@TMPb}{#1}{%
								\expandafter\pgfplots@scatter@loc@TMPa\pgfplots@scatter@loc@TMPb\pgfplots@EEOI
							}%
						}%
					\fi
				\fi
			}%
		}%
	},
	/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,
	/pgfplots/normalsize/.style={
		/pgfplots/width=240pt,
		/pgfplots/height=207pt,
		/pgfplots/max space between ticks=35,
	},
	/pgfplots/small/.style={
		width=6.5cm,
		height=,
		tick label style={font=\footnotesize},
		label style={font=\small},
		max space between ticks=25,
	},
	/pgfplots/footnotesize/.style={
		width=5cm,
		height=,
		legend style={font=\footnotesize},
		tick label style={font=\footnotesize},
		label style={font=\small},
		title style={font=\small},
		every axis title shift=0pt,
		max space between ticks=15,
		every mark/.append style={mark size=8},
		major tick length=0.1cm,
		minor tick length=0.066cm,
	},
	/pgfplots/tiny/.style={
		width=4cm,
		height=,
		legend style={font=\tiny},
		tick label style={font=\tiny},
		label style={font=\tiny},
		title style={font=\footnotesize},
		every axis title shift=0pt,
		max space between ticks=12,
		every mark/.append style={mark size=6},
		major tick length=0.1cm,
		minor tick length=0.066cm,
		every legend image post/.append style={scale=0.8},
    },
	/pgfplots/cube/set size/.code 2 args={%
		\expandafter\def\csname pgfplots@cube@gethalf@#1\endcsname{%
			\afterassignment\pgfplots@gobble@until@relax
			\pgfplots@tmpa=#2pt\relax
			\pgfplotsconvertunittocoordinate #1{0.5\pgfplots@tmpa}%
		}%
	},%
	/pgfplots/cube/size x/.style={/pgfplots/cube/set size=x{#1}},
	/pgfplots/cube/size y/.style={/pgfplots/cube/set size=y{#1}},
	/pgfplots/cube/size z/.style={/pgfplots/cube/set size=z{#1}},
	/pgfplots/cube/size x=\pgfplotmarksize,
	/pgfplots/cube/size y=\pgfplotmarksize,
	/pgfplots/cube/size z=\pgfplotmarksize,
	%
	/pgfplots/3d log sampling/.is if=pgfplots@threedim@log@sampling,
	%
	/pgfplots/trig format/.style={/pgf/trig format={#1}},
	/pgfplots/xtick placement tolerance/.initial=0.05pt,
	/pgfplots/ytick placement tolerance/.initial=0.05pt,
	/pgfplots/ztick placement tolerance/.initial=0.05pt,
	%
	/pgfplots/correct polar positioning/.is choice,
	/pgfplots/correct polar positioning/true/.code={\def\b@pgfplots@polaraxis@fix@positioning{1}},
	/pgfplots/correct polar positioning/false/.code={\def\b@pgfplots@polaraxis@fix@positioning{0}},
	%
	/pgfplots/correct shader flat/.is choice,
	/pgfplots/correct shader flat/true/.code={\def\b@pgfplots@correct@shader@flat{1}},
	/pgfplots/correct shader flat/false/.code={\def\b@pgfplots@correct@shader@flat{0}},
	%
	/pgfplots/correct sampling/.is choice,
	/pgfplots/correct sampling/true/.code={\let\pgfplotsforeachungroupeduniform@loop@mathengine=\pgfplotsforeachungroupeduniform@loop@mathengine@precise},
	/pgfplots/correct sampling/false/.code={\let\pgfplotsforeachungroupeduniform@loop@mathengine=\pgfplotsforeachungroupeduniform@loop@mathengine@legacy},
	%
	/pgfplots/compat/anchors/.is choice,
	/pgfplots/compat/anchors/pre 1.3/.code={%
		\pgfplots@deprecated@anchorstrue
		\pgfkeysalso{/pgfplots/correct polar positioning=false}%
	},
	/pgfplots/compat/anchors/1.3/.code= {%
		\pgfplots@deprecated@anchorsfalse
		\pgfkeysalso{/pgfplots/correct polar positioning=false}%
	},%
	/pgfplots/compat/anchors/1.4/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.5/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.5.1/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.6/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.7/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.8/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.9/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.10/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.11/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.12/.style= 	{/pgfplots/compat/anchors/1.3},%
	/pgfplots/compat/anchors/1.13/.style= 	{/pgfplots/compat/anchors/1.3,/pgfplots/correct polar positioning=true},%
	/pgfplots/compat/anchors/1.14/.style= 	{/pgfplots/compat/anchors/1.13},%
	/pgfplots/compat/anchors/1.15/.style= 	{/pgfplots/compat/anchors/1.13},%
	/pgfplots/compat/anchors/1.16/.style= 	{/pgfplots/compat/anchors/1.13},%
	/pgfplots/compat/anchors/1.17/.style= 	{/pgfplots/compat/anchors/1.13},%
	/pgfplots/compat/anchors/1.18/.style= 	{/pgfplots/compat/anchors/1.13},%
	/pgfplots/compat/anchors/default/.style={/pgfplots/compat/anchors/1.3},%
	%
	%
	/pgfplots/compat/empty line/.is choice,
	/pgfplots/compat/empty line/pre 1.3/.code={\pgfplots@emptyline@compattrue},% FIXME: WAS \global
	/pgfplots/compat/empty line/1.3/.style= {/pgfplots/compat/empty line/pre 1.3},%
	/pgfplots/compat/empty line/1.4/.code= 	{\pgfplots@emptyline@compatfalse},%
	/pgfplots/compat/empty line/1.5/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.5.1/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.6/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.7/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.8/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.9/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.10/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.11/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.12/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.13/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.14/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.15/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.16/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.17/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/1.18/.style= 	{/pgfplots/compat/empty line/1.4},%
	/pgfplots/compat/empty line/default/.style=	{/pgfplots/compat/empty line/1.4},%
	%
	/pgfplots/compat/path replacement/.is choice,
	/pgfplots/compat/path replacement/pre 1.3/.code= {\pgfplots@path@replace@ellipsefalse},
	/pgfplots/compat/path replacement/1.3/.style=    {/pgfplots/compat/path replacement/pre 1.3},%
	/pgfplots/compat/path replacement/1.4/.style=  	 {/pgfplots/compat/path replacement/pre 1.3},
	/pgfplots/compat/path replacement/1.5/.style=    {/pgfplots/compat/path replacement/pre 1.3},%
	/pgfplots/compat/path replacement/1.5.1/.code=   {\pgfplots@path@replace@ellipsetrue},%
	/pgfplots/compat/path replacement/1.6/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.7/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.8/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.9/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.10/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.11/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.12/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.13/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.14/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.15/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.16/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.17/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/1.18/.style=   	{/pgfplots/compat/path replacement/1.5.1},
	/pgfplots/compat/path replacement/default/.style=	{/pgfplots/compat/path replacement/pre 1.3},%
	%
	/pgfplots/compat/pgfpoint substitution/.is choice,
	/pgfplots/compat/pgfpoint substitution/pre 1.3/.code= {\pgfplots@substitute@pgfpointfalse},
	/pgfplots/compat/pgfpoint substitution/1.3/.style=    {/pgfplots/compat/pgfpoint substitution/pre 1.3},%
	/pgfplots/compat/pgfpoint substitution/1.4/.style=  	 {/pgfplots/compat/pgfpoint substitution/pre 1.3},
	/pgfplots/compat/pgfpoint substitution/1.5/.style=    {/pgfplots/compat/pgfpoint substitution/pre 1.3},%
	/pgfplots/compat/pgfpoint substitution/1.5.1/.style=	{/pgfplots/compat/pgfpoint substitution/pre 1.3},%
	/pgfplots/compat/pgfpoint substitution/1.6/.style=   	{/pgfplots/compat/pgfpoint substitution/pre 1.3},
	/pgfplots/compat/pgfpoint substitution/1.7/.style=   	{/pgfplots/compat/pgfpoint substitution/pre 1.3},
	/pgfplots/compat/pgfpoint substitution/1.8/.style=   	{/pgfplots/compat/pgfpoint substitution/pre 1.3},
	/pgfplots/compat/pgfpoint substitution/1.9/.style=   	{/pgfplots/compat/pgfpoint substitution/pre 1.3},
	/pgfplots/compat/pgfpoint substitution/1.10/.style=   	{/pgfplots/compat/pgfpoint substitution/pre 1.3},
	/pgfplots/compat/pgfpoint substitution/1.11/.code=   	{\pgfplots@substitute@pgfpointtrue},
	/pgfplots/compat/pgfpoint substitution/1.12/.style=   	{/pgfplots/compat/pgfpoint substitution/1.11},
	/pgfplots/compat/pgfpoint substitution/1.13/.style=   	{/pgfplots/compat/pgfpoint substitution/1.11},
	/pgfplots/compat/pgfpoint substitution/1.14/.style=   	{/pgfplots/compat/pgfpoint substitution/1.11},
	/pgfplots/compat/pgfpoint substitution/1.15/.style=   	{/pgfplots/compat/pgfpoint substitution/1.11},
	/pgfplots/compat/pgfpoint substitution/1.16/.style=   	{/pgfplots/compat/pgfpoint substitution/1.11},
	/pgfplots/compat/pgfpoint substitution/1.17/.style=   	{/pgfplots/compat/pgfpoint substitution/1.11},
	/pgfplots/compat/pgfpoint substitution/1.18/.style=   	{/pgfplots/compat/pgfpoint substitution/1.11},
	/pgfplots/compat/pgfpoint substitution/default/.style=	{/pgfplots/compat/pgfpoint substitution/pre 1.3},%
	%ellipse/.is if=pgfplots@path@replace@ellipse,
	%
	/pgfplots/compat/labels/.is choice,
	/pgfplots/compat/labels/pre 1.3/.style={%
		/pgfplots/compat/axis line style pre 1.8,
		/pgfplots/xlabel absolute,
		/pgfplots/ylabel absolute},%
	/pgfplots/compat/labels/1.3/.style={%
		/pgfplots/compat/axis line style pre 1.8,
		/pgfplots/xlabel near ticks,
		/pgfplots/ylabel near ticks},%
	/pgfplots/compat/labels/1.4/.style=		{/pgfplots/compat/labels/1.3},%
	/pgfplots/compat/labels/1.5/.style=		{/pgfplots/compat/labels/1.3},%
	/pgfplots/compat/labels/1.5.1/.style=	{/pgfplots/compat/labels/1.3},%
	/pgfplots/compat/labels/1.6/.style=		{/pgfplots/compat/labels/1.3},%
	/pgfplots/compat/labels/1.7/.style=		{/pgfplots/compat/labels/1.3},%
	/pgfplots/compat/labels/1.8/.style=		{
		/pgfplots/compat/labels/1.3,
		/pgfplots/compat/axis line style post 1.8,
	},%
	/pgfplots/compat/labels/1.9/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.10/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.11/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.12/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.13/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.14/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.15/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.16/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.17/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/1.18/.style=		{/pgfplots/compat/labels/1.8},%
	/pgfplots/compat/labels/default/.style=	{/pgfplots/compat/labels/pre 1.3},% maintain backwards compatibility
	%
	/pgfplots/compat/bar nodes/.is choice,
	/pgfplots/compat/bar nodes/pre 1.3/.style={%
		/pgfplots/stacked since 1.9/.style={
			/pgfplots/stacked ignores zero=false,% backwards compatible.
		},%
		/pgfplots/stacked since 1.13/.style={
			/pgfplots/stack negative=on previous,% backwards compatible.
		},%
		%
		% empty - early versions did not know anything about them.
		% But people might have arrived at suitable work-arounds; do
		% not destroy their work.
		/pgfplots/activate nodes near coords xbar stacked/.style={%
			/pgfplots/set point meta if empty=f(x),%
		},%
		/pgfplots/activate nodes near coords ybar stacked/.code={%
			/pgfplots/set point meta if empty=f(x),%
		},%
	},%
	/pgfplots/compat/bar nodes/1.3/.style=		{/pgfplots/compat/bar nodes/pre 1.3},%
	/pgfplots/compat/bar nodes/1.4/.style=		{/pgfplots/compat/bar nodes/pre 1.3},%
	/pgfplots/compat/bar nodes/1.5/.style=		{/pgfplots/compat/bar nodes/pre 1.3},%
	/pgfplots/compat/bar nodes/1.5.1/.style=	{/pgfplots/compat/bar nodes/pre 1.3},%
	/pgfplots/compat/bar nodes/1.6/.style=		{/pgfplots/compat/bar nodes/pre 1.3},%
	/pgfplots/compat/bar nodes/1.7/.style=		{/pgfplots/compat/bar nodes/pre 1.3},%
	/pgfplots/compat/bar nodes/1.8/.style=		{/pgfplots/compat/bar nodes/pre 1.3},%
	/pgfplots/compat/bar nodes/1.9/.style=		{
		/pgfplots/stacked since 1.9/.style={
			/pgfplots/stacked ignores zero=true,%
		},
		/pgfplots/stacked since 1.13/.style={
			/pgfplots/stack negative=on previous,% backwards compatible.
		},%
		/pgfplots/activate nodes near coords xbar stacked/.style={
			/pgfplots/nodes near coords xbar stacked configuration,
		},
		/pgfplots/activate nodes near coords ybar stacked/.style={
			/pgfplots/nodes near coords ybar stacked configuration,
		},
	},%
	/pgfplots/compat/bar nodes/1.10/.style=		{/pgfplots/compat/bar nodes/1.9},%
	/pgfplots/compat/bar nodes/1.11/.style=		{/pgfplots/compat/bar nodes/1.9},%
	/pgfplots/compat/bar nodes/1.12/.style=		{/pgfplots/compat/bar nodes/1.9},%
	/pgfplots/compat/bar nodes/1.13/.style=		{
		/pgfplots/compat/bar nodes/1.9,
		/pgfplots/stacked since 1.13/.style={
			/pgfplots/stack negative=separate,
		},%
	},%
	/pgfplots/compat/bar nodes/1.14/.style=		{/pgfplots/compat/bar nodes/1.13},%
	/pgfplots/compat/bar nodes/1.15/.style=		{/pgfplots/compat/bar nodes/1.13},%
	/pgfplots/compat/bar nodes/1.16/.style=		{/pgfplots/compat/bar nodes/1.13},%
	/pgfplots/compat/bar nodes/1.17/.style=		{/pgfplots/compat/bar nodes/1.13},%
	/pgfplots/compat/bar nodes/1.18/.style=		{/pgfplots/compat/bar nodes/1.13},%
	/pgfplots/compat/bar nodes/default/.style=	{/pgfplots/compat/bar nodes/pre 1.3},% maintain backwards compatibility
	/pgfplots/compat/bar nodes/default,
	%
	% search for the \pgfplots@compat@scaling@coordmath -- using float
	% is much more accurate. But it changes the spacing slightly.
	/pgfplots/compat/scaling/.is choice,
	/pgfplots/compat/scaling/pre 1.3/.code={%
		\def\pgfplots@compat@scaling@zunitfix@enable{0}%
		\def\pgfplots@compat@scaling@coordmath{pgfbasic}%
		\def\pgfplots@compat@scaling@coordmath@final{pgfbasic}%
	},
	/pgfplots/compat/scaling/1.3/.style={/pgfplots/compat/scaling/pre 1.3},
	/pgfplots/compat/scaling/1.4/.code={%
		\def\pgfplots@compat@scaling@zunitfix@enable{1}%
		\def\pgfplots@compat@scaling@coordmath{float}%
		\def\pgfplots@compat@scaling@coordmath@final{pgfbasic}%
	},
	/pgfplots/compat/scaling/1.5/.style={/pgfplots/compat/scaling/1.4},
	/pgfplots/compat/scaling/1.5.1/.style={/pgfplots/compat/scaling/1.4},
	/pgfplots/compat/scaling/1.6/.code={%
		\def\pgfplots@compat@scaling@zunitfix@enable{1}%
		\def\pgfplots@compat@scaling@coordmath{float}%
		\def\pgfplots@compat@scaling@coordmath@final{float}%
	},
	/pgfplots/compat/scaling/1.7/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.8/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.9/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.10/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.11/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.12/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.13/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.14/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.15/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.16/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.17/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/1.18/.style={/pgfplots/compat/scaling/1.6},
	/pgfplots/compat/scaling/default/.style={/pgfplots/compat/scaling/1.4},
	%
	/pgfplots/compat/scale mode/.is choice,
	/pgfplots/compat/scale mode/pre 1.3/.code=\def\pgfplots@compat@scale@mode@compatible@mode{1},%
	/pgfplots/compat/scale mode/1.3/.style=		{/pgfplots/compat/scale mode/pre 1.3},
	/pgfplots/compat/scale mode/1.4/.style=		{/pgfplots/compat/scale mode/pre 1.3},
	/pgfplots/compat/scale mode/1.5/.style=	 	{/pgfplots/compat/scale mode/pre 1.3},
	/pgfplots/compat/scale mode/1.5.1/.style=	{/pgfplots/compat/scale mode/pre 1.3},
	/pgfplots/compat/scale mode/1.6/.code=\def\pgfplots@compat@scale@mode@compatible@mode{0},
	/pgfplots/compat/scale mode/1.7/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.8/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.9/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.10/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.11/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.12/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.13/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.14/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.15/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.16/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.17/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/1.18/.style={/pgfplots/compat/scale mode/1.6},
	/pgfplots/compat/scale mode/default/.style={/pgfplots/compat/scale mode/1.5},
	%
	%
	/pgfplots/compat/plot3graphics/.is choice,
	/pgfplots/compat/plot3graphics/pre 1.3/.style=	{/pgfplots/compat/plot3graphics/1.5},
	/pgfplots/compat/plot3graphics/1.3/.style=		{/pgfplots/compat/plot3graphics/1.5},
	/pgfplots/compat/plot3graphics/1.4/.style=		{/pgfplots/compat/plot3graphics/1.5},%
	/pgfplots/compat/plot3graphics/1.5/.code=		{\def\b@pgfplots@compat@plot@graphics@threedim{1}},%
	/pgfplots/compat/plot3graphics/1.5.1/.style=	{/pgfplots/compat/plot3graphics/1.5},%
	/pgfplots/compat/plot3graphics/1.6/.code=		{\def\b@pgfplots@compat@plot@graphics@threedim{2}},%
	/pgfplots/compat/plot3graphics/1.7/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.8/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.9/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.10/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.11/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.12/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.13/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.14/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.15/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.16/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.17/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/1.18/.style=	{/pgfplots/compat/plot3graphics/1.6},%
	/pgfplots/compat/plot3graphics/default/.style=	{/pgfplots/compat/plot3graphics/1.5},%
	%
	% ATTENTION: there is a compatibility issue which slipped through
	% the quality assurance: if tick labels where generated in scientific notation
	% (NOT log tick labels; these are special), and the numbers were
	% negative, the spacing changed as follows:
	% pre 1.3:  - 1*10^5  (binary minus sign)
	%     1.3:  - 1*10^5  (binary minus sign)
	%     1.4:  - 1*10^5  (binary minus sign)
	%     1.5:  -1*10^5   (unary minus sign - correct!)
	%     1.6:  -1*10^5   (unary minus sign - correct!)
	% This is (was) a bug in the PGF number printer which has been
	% fixed in the meantime; it occurred only if
	% $\pgfmathprintnumber{-1e5}$ was used (i.e. with the '$' signs).
	% Unfortunately, version 1.5 has been released without realizing
	% the changes; I detected them right before the release of 1.6.
	% Consequently, I cannot introduce compatibity switches without
	% loosing compatibility.
	%
	% I chose to keep the correct unary minus sign. If you ever want
	% to revert to the old version in order to keep spacing intact, use
	%
	% \pgfkeys{/pgf/compat/number printer=2.10}
	%
	% Risk: the size of such tick labels changed and the
	% figure has been moved somewhat.
	%
	% Sorry.
	%
	/pgfplots/compat/bar width by units/.is choice,
	/pgfplots/compat/bar width by units/pre 1.3/.code=	{\def\b@pgfplots@compat@bar@width@units{1}},%
	/pgfplots/compat/bar width by units/1.3/.style=	{/pgfplots/compat/bar width by units/pre 1.3},
	/pgfplots/compat/bar width by units/1.4/.style=	{/pgfplots/compat/bar width by units/pre 1.3},%
	/pgfplots/compat/bar width by units/1.5/.style=	{/pgfplots/compat/bar width by units/pre 1.3},%
	/pgfplots/compat/bar width by units/1.5.1/.style=	{/pgfplots/compat/bar width by units/pre 1.3},%
	/pgfplots/compat/bar width by units/1.6/.style=	{/pgfplots/compat/bar width by units/pre 1.3},%
	/pgfplots/compat/bar width by units/1.7/.code=		{\def\b@pgfplots@compat@bar@width@units{0}},%
	/pgfplots/compat/bar width by units/1.8/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.9/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.10/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.11/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.12/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.13/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.14/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.15/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.16/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.17/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/1.18/.style=		{/pgfplots/compat/bar width by units/1.7},
	/pgfplots/compat/bar width by units/default/.style={/pgfplots/compat/bar width by units/pre 1.3},
	%
	/pgfplots/compat/BB/.is choice,
	/pgfplots/compat/BB/pre 1.3/.style={/pgfplots/clip bounding box=default tikz},%
	/pgfplots/compat/BB/1.3/.style=	{/pgfplots/compat/BB/pre 1.3},
	/pgfplots/compat/BB/1.4/.style=	{/pgfplots/compat/BB/pre 1.3},%
	/pgfplots/compat/BB/1.5/.style=	{/pgfplots/compat/BB/pre 1.3},%
	/pgfplots/compat/BB/1.5.1/.style=	{/pgfplots/compat/BB/pre 1.3},%
	/pgfplots/compat/BB/1.6/.style=	{/pgfplots/compat/BB/pre 1.3},%
	/pgfplots/compat/BB/1.7/.style=	{/pgfplots/compat/BB/pre 1.3},%
	/pgfplots/compat/BB/1.8/.style=	{/pgfplots/clip bounding box=upper bound},%
	/pgfplots/compat/BB/1.9/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.10/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.11/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.12/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.13/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.14/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.15/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.16/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.17/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/1.18/.style=	{/pgfplots/compat/BB/1.8},%
	/pgfplots/compat/BB/default/.style={/pgfplots/compat/BB/pre 1.3},
	%
	/pgfplots/compat/general/.is choice,
	/pgfplots/compat/general/pre 1.3/.style={
		/pgfplots/log origin=infty,
		/pgfplots/enable tick line clipping=true,
		/pgfplots/correct shader flat=false,
		/pgfplots/correct sampling=false,
		/pgfplots/lua backend=false,
		/pgfplots/colormap uniform=always,
		/pgfplots/compat/library hook={statistics}{/pgfplots/boxplot/estimator=legacy,/pgfplots/boxplot/ensure mark=false},
		/pgfplots/colorbar pgfshading,
		/pgfplots/colorbar=false,
		/pgfplots/3d log sampling=false,
		/pgfplots/clip limits compat=true,
		/pgfplots/table/percent is letter=false,
	},%
	/pgfplots/compat/general/1.3/.style=	{/pgfplots/compat/general/pre 1.3},
	/pgfplots/compat/general/1.4/.style=	{/pgfplots/compat/general/pre 1.3},%
	/pgfplots/compat/general/1.5/.style=	{
		/pgfplots/compat/general/pre 1.3,
		/pgfplots/log origin=0,
		/pgfplots/enable tick line clipping=true,
	},%
	/pgfplots/compat/general/1.5.1/.style=	{/pgfplots/compat/general/1.5},%
	/pgfplots/compat/general/1.6/.style=	{/pgfplots/compat/general/1.5},%
	/pgfplots/compat/general/1.7/.style=	{/pgfplots/compat/general/1.5},%
	/pgfplots/compat/general/1.8/.style=	{/pgfplots/compat/general/1.5},%
	/pgfplots/compat/general/1.9/.style=	{/pgfplots/compat/general/1.5},%
	/pgfplots/compat/general/1.10/.style=	{/pgfplots/compat/general/1.5},%
	/pgfplots/compat/general/1.11/.style=	{
		/pgfplots/compat/general/1.5,
		/pgfplots/enable tick line clipping=false,
	},%
	/pgfplots/compat/general/1.12/.style=	{
		/pgfplots/compat/general/1.11,
		/pgfplots/lua backend,
		/pgfplots/compat/library hook={statistics}{/pgfplots/boxplot/estimator=Excel,/pgfplots/boxplot/ensure mark=true},
	},%
	/pgfplots/compat/general/1.13/.style=	{%
		/pgfplots/compat/general/1.12,
		/pgfplots/correct shader flat=true,
		/pgfplots/correct sampling=true,
		/pgfplots/colormap uniform=always,
	},%
	/pgfplots/compat/general/1.14/.style=	{%
		/pgfplots/compat/general/1.13,
		/pgfplots/colormap uniform=if requested,
		% no -- do _not_ activate that here: it is correct and
		% simplifies the code, but many viewers (pdf.js, evince,
		% sumatrapdf) are better off with pgfshadings:
		%/pgfplots/colorbar sampled={surf,shader=interp,samples=2},
		%/pgfplots/colorbar=false,
	},%
	/pgfplots/compat/general/1.15/.style=	{%
		/pgfplots/compat/general/1.14,
		/pgfplots/3d log sampling=true, % FIXME finish this feature: see unittest_log_sampling_3d
		/pgfplots/clip limits compat=false,
	},%
	/pgfplots/compat/general/1.16/.style=	{/pgfplots/compat/general/1.15},%
	/pgfplots/compat/general/1.17/.style=	{
		/pgfplots/compat/general/1.15,
		%/pgfplots/table/percent is letter=true,
	},%
	/pgfplots/compat/general/1.18/.style=	{/pgfplots/compat/general/1.17},%
	/pgfplots/compat/general/default/.style={/pgfplots/compat/general/1.11},
	%
	/pgfplots/enable tick line clipping/.is if=pgfplots@enable@tick@line@clipping,
	/pgfplots/enable tick line clipping/.default=true,
	%
	/pgfplots/default typeset ticklabel/.style={
		/pgfplots/typeset ticklabel/.code={##1},
	},
	/pgfplots/default typeset ticklabel,
	/pgfplots/typeset ticklabels with strut/.style={
		/pgfplots/typeset ticklabel/.code={\strut ##1},
	},
	%
	%
	/pgfplots/compat/show suggested version/.is if=pgfplots@show@suggested@version,
	/pgfplots/compat/show suggested version=true,
	/pgfplots/compat/current/.initial=,
	/pgfplots/compat/mostrecent/.initial=1.18,
	/utils/exec={%
		\pgfplotsutilforeachcommasep{%
			/pgfplots/compat/current,%
			/pgfplots/compat/anchors,%
			/pgfplots/compat/labels,%
			/pgfplots/compat/empty line,%
			/pgfplots/compat/scaling,%
			/pgfplots/compat/scale mode,%
			/pgfplots/compat/general,%
			/pgfplots/compat/BB,%
			/pgfplots/compat/path replacement,%
			/pgfplots/compat/plot3graphics,%
			/pgfplots/compat/bar width by units,%
			/pgfplots/compat/bar nodes,%
			/pgfplots/compat/pgfpoint substitution,%
		}\as\pgfplots@glob@TMPa{%
			\ifx\pgfplots@glob@TMPa\pgfutil@empty
			\else
				\edef\pgfplots@glob@TMPb{%
					\noexpand\pgfkeysdef{\pgfplots@glob@TMPa/newest}{%
						\noexpand\pgfkeysalso{%
							\pgfplots@glob@TMPa/\pgfkeysvalueof{/pgfplots/compat/mostrecent}%
						}%
					}%
				}%
				\pgfplots@glob@TMPb
			\fi
		}%
	},
	/pgfplots/compat/.code={%
		\def\pgfplots@glob@TMPa{newest}%
		\edef\pgfplots@glob@TMPb{#1}%
		\ifx\pgfplots@glob@TMPb\pgfplots@glob@TMPa
			\edef\pgfplots@glob@TMPa{\noexpand\pgfkeysalso{/pgfplots/compat=\pgfkeysvalueof{/pgfplots/compat/mostrecent}}}%
			\pgfplots@glob@TMPa
		\else
			\pgfkeysifdefined{/pgfplots/compat/general/#1/.@cmd}{%
				\pgfkeysalso{%
					% ATTENTION: *every* /pgfplots/compat/ setting needs to accept
					% the same choices due to this construction:
					/pgfplots/compat/current=#1,% remember the value
					/pgfplots/compat/anchors=#1,%
					/pgfplots/compat/labels=#1,%
					/pgfplots/compat/empty line=#1,%
					/pgfplots/compat/scaling=#1,%
					/pgfplots/compat/scale mode=#1,%
					/pgfplots/compat/general=#1,%
					/pgfplots/compat/BB=#1,%
					/pgfplots/compat/path replacement=#1,%
					/pgfplots/compat/plot3graphics=#1,%
					/pgfplots/compat/bar width by units=#1,%
					/pgfplots/compat/bar nodes=#1,%
					/pgfplots/compat/pgfpoint substitution=#1,%
				}%
			}{%
				\pgfplots@error{Sorry, 'compat=#1' is unknown in this context. Please use at most 'compat=\pgfkeysvalueof{/pgfplots/compat/mostrecent}'}%
			}%
		\fi
	},%
	/pgfplots/compat/.default=pre 1.3,% this is used if you type '\pgfplotsset{compat}' without value
	/pgfplots/compat=default,% this is the initial config.
	%
	/pgfplots/show outer normals/.style={%
		extra description/.append code={
			\def\length{15}
			\def\pgfplots@@draw@normal####1####2{%
				\pgfpathmoveto{####1}
				\pgfpathlineto{%
					\pgfpointadd
					{####1}
					{\pgfqpointscale{\length}{\pgfplotspointouternormalvectorofticklabelaxis{####2}}}%
				}%
			}%
			\draw[->,blue] \pgfextra{\pgfplots@@draw@normal{#1}{x}};
			\draw[->,blue] \pgfextra{\pgfplots@@draw@normal{\pgfplotsqpointoutsideofticklabelaxisrel{x}{1}{0}}{x}};
			\draw[->,red] \pgfextra{\pgfplots@@draw@normal{#1}{y}};
			\draw[->,red] \pgfextra{\pgfplots@@draw@normal{\pgfplotsqpointoutsideofticklabelaxisrel{y}{1}{0}}{y}};
			\ifpgfplots@threedim
			\draw[->,black] \pgfextra{\pgfplots@@draw@normal{#1}{z}};
			\draw[->,black] \pgfextra{\pgfplots@@draw@normal{\pgfplotsqpointoutsideofticklabelaxisrel{z}{1}{0}}{z}};
			\fi
		},
	},
	/pgfplots/show outer normals/.default={%
		\ifpgfplots@threedim
			\pgfplotspointrelaxisxy{-0.03}{-0.03}%
		\else
			\pgfplotspointrelaxisxyz{-0.03}{-0.03}{-0.03}%
		\fi
	},
	/pgfplots/profiler/.code={%
		\pgfutil@ifundefined{pgfprofilenew}{%
			\usepgflibrary{profiler}%
		}{}%
		\pgfprofilenewforenvironment[all axes]{pgfplots@environment@opt}%
		\pgfprofilesetrel{all axes}%
		\pgfprofilenewforcommand[pgfkeys variants]{\pgfkeys}{1}%
		\pgfprofilenewforcommand[pgfkeys variants]{\pgfqkeys}{2}%
		\pgfprofilenewforcommand[pgfkeys variants]{\pgfkeysalso}{1}%
		\pgfprofilenewforcommand[pgfkeys variants]{\pgfkeysfiltered}{1}%
		\pgfprofilenewforcommand[pgfkeys variants]{\pgfqkeysfiltered}{2}%
		\pgfprofilenewforcommand[pgfkeys variants]{\pgfkeysalsofiltered}{1}%
		\pgfprofilenewforcommand[pgfplotsapplistXX handling]{\pgfplotsapplistXXpushback}{1}%
		\pgfprofilenewforcommand[pgfplotsapplistXX handling]{\pgfplotsapplistXXflushbuffers}{0}%
		\pgfprofilenewforcommandpattern
				[pgfplots(app|prepend)listX handling]{\pgfplotsapplistXpushback}{##1\to##2}{{##1}\to{##2}}%
		\pgfprofilenewforcommand
				[pgfplots(app|prepend)listX handling]{\pgfplotsapplistXflushbuffers}{1}%
		\pgfprofilenewforcommandpattern
				[pgfplots(app|prepend)listX handling]{\pgfplotsprependlistXpushfront}{##1\to##2}{{##1}\to{##2}}%
		\pgfprofilenewforcommand
				[pgfplots(app|prepend)listX handling]{\pgfplotsprependlistXflushbuffers}{1}%
		\pgfprofilenewforcommand
				[pgfsys buffer]{\pgfsyssoftpath@addtocurrentpath}{1}%
		\pgfprofilenewforcommand
				[pgfsys buffer]{\pgfsyssoftpath@flushcurrentpath}{0}%
		\pgfprofilenewforcommand[math parser (basic)]{\pgfmathparse}{1}%
		\pgfprofilenewforcommand[math parser (fpu)]{\pgfmathfloatparse@}{1}%
		\pgfprofilenewforcommand[math: division (basic)]{\pgfmathdivide@}{2}%
		\pgfprofilenewforcommand[math: division (basic)]{\pgfmath@basic@divide@}{2}%
		\pgfprofilenewforcommand[near ticklabel anchors]{\pgfplots@borderanchor@for@axis}{3}%
		\pgfprofilenewforcommand[ticklabel cs]{\pgfplotspointticklabelcs}{2}%
	%	\pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodeunsigned}{1}%
	%	\pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodesignedmaplinearly}{1}%
	%	\pgfprofilenewforcommand[binary conversion]{\pgfplotsbinaryencodedimenmaplinearly}{1}%
	},%
}

\def\pgfplots@glob@TMPa#1{%
	\pgfkeys{%
		/pgfplots/#1tick pos/lower/.style={/pgfplots/#1tick pos=left},
		/pgfplots/#1tick pos/bottom/.style={/pgfplots/#1tick pos=left},
		/pgfplots/#1tick pos/upper/.style={/pgfplots/#1tick pos=right},
		/pgfplots/#1tick pos/top/.style={/pgfplots/#1tick pos=right},
	}%
}%
\pgfplots@glob@TMPa x%
\pgfplots@glob@TMPa y%
\pgfplots@glob@TMPa z%

\def\pgfplots@ticklabel@typeset@arg#1{\pgfkeysvalueof{/pgfplots/typeset ticklabel/.@cmd}{#1}\pgfeov}%

% backwards compatibility:
\def\pgfplots@tickwidth{\pgfkeysvalueof{/pgfplots/major tick length}}%
\def\pgfplots@subtickwidth{\pgfkeysvalueof{/pgfplots/minor tick length}}%

\pgfkeysdef{/pgfplots/nodes near coords/@@eval alignment}{%
	% determine default alignment:
	\pgfkeysgetvalue{/pgfplots/nodes near coords align}{\pgfplots@nodes@near@coords@align}%
	\edef\pgfplots@nodes@near@coords@align{\pgfplots@nodes@near@coords@align}%
	\def\pgfplots@loc@TMPa{auto}%
	\ifx\pgfplots@nodes@near@coords@align\pgfplots@loc@TMPa
		\def\pgfplots@loc@TMPa{x}%
		\ifx\pgfplotspointmetainputhandler\pgfplots@loc@TMPa%
			% point meta=x:
			\def\pgfplots@nodes@near@coords@align{horizontal}%
		\else
			\def\pgfplots@nodes@near@coords@align{vertical}%
		\fi
	\fi
	% check for sign-dependand alignment options:
	\def\pgfplots@loc@TMPa{horizontal}%
	\ifx\pgfplots@nodes@near@coords@align\pgfplots@loc@TMPa
		\if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname%
			\def\pgfplots@nodes@near@coords@align{above}%
		\else
			\pgfplotscoordmath{meta}{if is}{\pgfplotspointmeta}{-}{%
				% \pgfplotspointmeta < 0
				\def\pgfplots@nodes@near@coords@align{left}%
			}{%
				% \pgfplotspointmeta >= 0
				\def\pgfplots@nodes@near@coords@align{right}%
			}%
		\fi
	\else
		\def\pgfplots@loc@TMPa{vertical}%
		\ifx\pgfplots@nodes@near@coords@align\pgfplots@loc@TMPa
			\if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname%
				\def\pgfplots@nodes@near@coords@align{above}%
			\else
				\pgfplotscoordmath{meta}{if is}{\pgfplotspointmeta}{-}{%
					% \pgfplotspointmeta < 0
					\def\pgfplots@nodes@near@coords@align{below}%
				}{%
					% \pgfplotspointmeta >= 0
					\def\pgfplots@nodes@near@coords@align{above}%
				}%
			\fi
		\else
			\pgfutil@ifundefined{pgfplots@nodesnearcoordsalign@isanchor@\pgfplots@nodes@near@coords@align}
			{}%
			{%
				\t@pgfplots@toka=\expandafter{\pgfplots@nodes@near@coords@align}%
				\edef\pgfplots@nodes@near@coords@align{anchor=\the\t@pgfplots@toka}%
			}%
		\fi
	\fi
	\expandafter\pgfkeysalso\expandafter{\pgfplots@nodes@near@coords@align}%
}%

\begingroup
\pgfkeys{/pgfplots/colorbar pgfshading}
\pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@loc@TMPa
\global\let\pgfplots@colorbar@draw@legacyimpl=\pgfplots@loc@TMPa
\endgroup

% call
%   \pgfkeyslet{.../.@cmd}\pgfplots@cant@set@in@this@context
% to replace a key with a generic error message.
\def\pgfplots@cant@set@in@this@context#1\pgfeov{\pgfplots@cant@set@in@this@context@}
\def\pgfplots@cant@set@in@this@context@{%
	\pgfplotsthrow{unsupported operation}{Sorry, you can't change `\pgfkeyscurrentkeyRAW' in this context. Maybe you need to provide it as \string\begin{axis}[\pgfkeyscurrentkeyRAW=...] ?}\pgfeov
}


{
\pgfkeysdef{/empty}{}%
\pgfkeysgetvalue{/empty/.@cmd}\pgfplots@loc@TMPa
\global\let\pgfplots@empty@command@key=\pgfplots@loc@TMPa
%
\pgfkeys{/empty/.style={}}%
\pgfkeysgetvalue{/empty/.@cmd}\pgfplots@loc@TMPa
\global\let\pgfplots@empty@style@key=\pgfplots@loc@TMPa
}

% Only define if it is undefined. It may be possible that related libraries
% habe been loaded before pgfplots.
\pgfkeysifdefined{/pgfplots/@backgroundpath@hook/.@cmd}{\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 ticklabel style=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;


\def\pgfplots@scope@with@coord@styles[#1]{%
	\if1\b@has@pgfplots@colordinate@style
		\def\pgfplots@loc@TMPa{\scope[#1}%
		\t@pgfplots@toka=\expandafter{\pgfplots@loc@TMPa}%
		\t@pgfplots@tokb=\expandafter{\pgfplots@current@point@coordinatestyle}%
		\edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka,\the\t@pgfplots@tokb]}%
	\else
		\def\pgfplots@loc@TMPa{\scope[#1]}%
	\fi
	\pgfplots@loc@TMPa
}%

% 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.
%
% It these keys are empty, we switch to backwards compatibility mode
% and acquire the key settings from tikz.
%
% This allows something like
% \begin{tikzpicture}[samples=70,domain=1:5]
%   \begin{axis}
%		\addplot {x^2};
%   \end{axis}
% \end{tikzpicture}
%
%  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/samples}\pgfplots@plot@samples
	\ifx\pgfplots@plot@samples\pgfutil@empty
		\pgfplots@gettikzinternal@keyval{samples}{tikz@plot@samples}{25}%
		\let\pgfplots@plot@samples=\tikz@plot@samples
		\def\pgfplots@loc@TMPa{0}% <- whether the tikz backw. compatibility shall resample
	\else
		\def\pgfplots@loc@TMPa{1}%
	\fi
	%
	\pgfplotscoordmath{default}{parse int}{\pgfplots@plot@samples}%
	\let\pgfplots@plot@samples=\pgfmathresult
	\pgfkeyslet{/pgfplots/samples}{\pgfplots@plot@samples}%
	%
	\pgfkeysgetvalue{/pgfplots/domain}\pgfplots@plot@domain
	\pgfkeysgetvalue{/pgfplots/samples at}\pgfplots@plot@samples@at
	\ifx\pgfplots@plot@domain\pgfutil@empty
		% simply acquire /tikz/domain value:
		\pgfplots@gettikzinternal@keyval{domain}{tikz@plot@domain}{-5:5}%
		\pgfkeyslet{/pgfplots/domain}{\tikz@plot@domain}%
		\let\pgfplots@plot@domain=\tikz@plot@domain
		%
		\ifx\pgfplots@plot@samples@at\pgfutil@empty
			\if 1\pgfplots@loc@TMPa
				% Resample! See above.
				\tikzset{%
					/pgf/fpu/output format=fixed,% seems as if /tikz/samples calls register arithmetics.
					samples=\pgfplots@plot@samples,
					/pgf/fpu/output format=float,%
				}%
			\fi
			\pgfplots@gettikzinternal@keyval{samples at}{tikz@plot@samplesat}{-5,-4.6,...,5}%
			%
			% check if it was a domain. This simplifies LUA code:
			\pgfplotsforeachtodomain{\tikz@plot@samplesat}%
			\ifx\pgfplotsretval\pgfutil@empty
				\pgfkeyslet{/pgfplots/samples at}{\tikz@plot@samplesat}%
				\let\pgfplots@plot@samples@at=\tikz@plot@samplesat
			\else
				\let\pgfplots@plot@domain=\pgfplotsretval
				\let\pgfplots@plot@samples=\pgfplotsretvalb
				\pgfkeyslet{/pgfplots/samples}{\pgfplots@plot@samples}%
			\fi
		\else
			% routines should use \pgfplots@plot@samples@at.
		\fi
	\fi
	% do that such that any active ':' sign will be expanded - for
	% french babel support.
	\edef\pgfplots@plot@domain{\pgfplots@plot@domain}%
	\pgfkeyslet{/pgfplots/domain}\pgfplots@plot@domain
}%

\def\pgfplots@set@at#1{\def\pgfplots@at{#1}}%


% 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.}%
}

% #1: axis (x, y, or z)
% #2: display name of context information
\def\pgfplots@warn@if@log@basis@unset#1#2{%
	\pgfplots@if{pgfplots@#1islinear}{%
	}{%
		\pgfplots@warn@if@log@basis@unset@{#1}{#2}%
	}%
}%
\def\pgfplots@warn@if@log@basis@unset@#1#2{%
	\pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\pgfplotswarning{log basis required}{#1}{#2}\pgfeov
	\fi
	\gdef\pgfplots@warn@if@log@basis@unset##1##2{}%
}%


% #1 axis (x or y)
% #2 the label
\long\def\pgfplots@show@label#1#2{%
	\begingroup
	% Prepare special alignment features here.
	%
	% The idea is to:
	% 1. Declare a local COORDINATE SYSTEM to place labels,
	% the 'ticklabel cs' for the current axis.
	% It takes 1-2 arguments where the first is the coordinate on the
	% ticklabel axis (between 0 and 1). The second is an optional shift orthogonal to
	% the axis in direction of the outer normal. The minimum shift is
	% the largest' ticklabels dimension.
	%
	% 2. Declare a local ANCHOR to align labels, the 'near ticklabel'
	% anchor.
	%
	% Both things are not necessary - but they *can* be used.
	\tikzdeclarecoordinatesystem{ticklabel}{\pgfplotspointticklabelcs[\pgfkeysvalueof{/pgfplots/#1label shift}]{#1}{##1}}%
	\tikzdeclarecoordinatesystem{ticklabel*}{\pgfplotspointticklabelnoshiftcs{#1}{##1}}%
	\pgfplotsdeclareborderanchorforticklabelaxis{#1}{near ticklabel}%
	%
	\pgfkeysgetvalue{/tikz/sloped/.@cmd}\pgfplots@loc@TMPa
	\pgfkeyslet{/tikz/sloped/orig/.@cmd}\pgfplots@loc@TMPa
	\pgfkeysdef{/tikz/sloped}{\pgfkeysalso{/tikz/sloped like #1 axis={##1}}}%
	%
	\node
		[/pgfplots/every axis label,%
		/pgfplots/every axis #1 label]
	{#2};
	\endgroup
}


\long\def\pgfplots@show@title#1{%
	\node%
		[/pgfplots/every axis title]
		{#1};
}


% 'inner' means lines which pass through the origin (i.e. lines which
% are not on the outer bounding box). In other words: this has an
% effect if and only if 'axis #1 lines=center'
%
% #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{%
	\if2\csname pgfplots@#1axislinesnum\endcsname
		\pgfplotsgetlayerforstyle{%
			every inner #1 axis line,
		}%
		\pgfplotsonlayer{\pgfplotsretval}{inner #1 axis line}%
		%
		\draw[/pgfplots/every inner #1 axis line,%
			decorate,%
			#1discont,%
			decoration={%
				% these keys appears to be checked via an \ifx on
				% '0pt'. Make sure that this \ifx works by means of
				% the expand twice construction:
				pre length/.expand twice=\csname #1disstart\endcsname,%
				post length/.expand twice=\csname #1disend\endcsname%
			}]
		\pgfextra
		\csname pgfplotspointonorientedsurfaceabsetupforset#3\endcsname{\csname pgfplots@logical@ZERO@#3\endcsname}{2}%
		\pgfplots@transformshift@along@outer@normal@on@line@of@oriented@surf v2%
		\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
		;
		%
		\endpgfplotsonlayer
	\fi
}%

% Draws outer axis lines, i.e. those which are on the bounding box.
% This has an effect if and only if axis #1 lines!=center.
%
%
% 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.
%
% #1: the 'a' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceA)
% #2: the 'b' axis on the oriented surface (the same as \pgfplotspointonorientedsurfaceB)
\def\pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2{%
	\if2\csname pgfplots@#1axislinesnum\endcsname
		% centered axis lines handled elsewhere.
	\else
		\def\pgfplots@drawaxis@outerlines@separate@onorientedsurf@opts{%
			/pgfplots/every outer #1 axis line,
			#1discont,decoration={pre length/.expand twice=\csname #1disstart\endcsname, post length/.expand twice=\csname #1disend\endcsname}%
		}%
		\pgfplotsgetlayerforstyle{%
			every outer #1 axis line,
		}%
		\pgfplotsonlayer{\pgfplotsretval}{outer #1 axis line}%
		%
		\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{0}{%
			\expandafter\draw\expandafter[\pgfplots@drawaxis@outerlines@separate@onorientedsurf@opts] decorate {
				\pgfextra
				% exchange roles of A <-> B axes:
				\pgfplotspointonorientedsurfaceabsetupfor{#2}{#1}{\pgfplotspointonorientedsurfaceN}%
				\pgfplots@transformshift@along@outer@normal@on@line@of@oriented@surf 0v%
				\pgfplots@drawgridlines@onorientedsurf@fromto{\csname pgfplots@#2min\endcsname}%
				\endpgfextra
				};
		}{}%
		\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn{1}{%
			\expandafter\draw\expandafter[\pgfplots@drawaxis@outerlines@separate@onorientedsurf@opts] decorate {
				\pgfextra
				% exchange roles of A <-> B axes:
				\pgfplotspointonorientedsurfaceabsetupfor{#2}{#1}{\pgfplotspointonorientedsurfaceN}%
				\pgfplots@transformshift@along@outer@normal@on@line@of@oriented@surf 1v%
				\pgfplots@drawgridlines@onorientedsurf@fromto{\csname pgfplots@#2max\endcsname}%
				\endpgfextra
				};
		}{}%
		%
		\endpgfplotsonlayer
	\fi
}%

% This here is complicated: we try to create good edges and draw a
% SINGLE path for the partial or complete rectangle
%
%  -----
%  |   |
%  |   |
%  -----
%
%  ATTENTION: this thing is used IF AND ONLY IF  d=2 and the axis is
%  drawn as box.
\def\pgfplots@drawaxis@outerlines@cycledpath{%
	\pgfplots@loc@tmptrue
	\ifpgfplots@hide@x
		\ifpgfplots@hide@y
			\pgfplots@loc@tmpfalse
		\fi
	\fi
\ifpgfplots@loc@tmp
	\pgfplotsgetlayerforstyle{%
		every outer x axis line,
		every outer y axis line,
	}%
	\pgfplotsonlayer{\pgfplotsretval}{boxed axis line}%
	%
	\draw[
		/pgfplots/every outer x axis line, % using these outer styles is only useful in conjunction with 'separate axis lines=true'
		/pgfplots/every outer y axis line]
	\pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra
\ifpgfplots@hide@y
	{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra }
\else
	decorate [ydiscont,decoration={pre length=\ydisstart, post length=\ydisend}]
	% { -- (\pgfplots@xmin,	\pgfplots@ymax) }
	{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}}\endpgfextra }
\fi
\ifpgfplots@hide@x
	%{ (\pgfplots@xmax,	\pgfplots@ymax) }
	{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra }
\else
	decorate [xdiscont,decoration={pre length=\xdisstart, post length=\xdisend}]
	%{ -- (\pgfplots@xmax,	\pgfplots@ymax) }
	{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}}\endpgfextra }
\fi
\ifpgfplots@hide@y
	%{ (\pgfplots@xmax,	\pgfplots@ymin) }
	{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra }
\else
	decorate [ydiscont,decoration={pre length=\ydisend, post length=\ydisstart}]
	%{ -- (\pgfplots@xmax,	\pgfplots@ymin) }
	{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}}\endpgfextra }
\fi
\ifpgfplots@hide@x
	%{ (\pgfplots@xmin,	\pgfplots@ymin) }
	{ \pgfextra\pgfpathmoveto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra }
\else
	decorate [xdiscont,decoration={pre length=\xdisend, post length=\xdisstart}]
	%{ -- (\pgfplots@xmin,	\pgfplots@ymin) }
	{ \pgfextra\pgfpathlineto{\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}}\endpgfextra }
\fi
	% make sure that we do not have any of the axis discontinuities
	% here - they should not be closed.
	\if0\pgfplots@xaxisdiscontnum
		\if0\pgfplots@yaxisdiscontnum
			-- cycle
		\fi
	\fi
	;%
	%
	\endpgfplotsonlayer
\fi
}%

% Assigns the macros
% #1disstart
% #1disend
% and the key /tikz/#1discont  for use in the axis line routines.
%
% #1 : either x or y.
\def\pgfplots@drawaxis@lines@preparediscont@for#1{%
	\ifnum\csname pgfplots@#1axisdiscontnum\endcsname>0
		\begingroup
		% 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
			\def\discontstyle{decoration={zigzag,segment length=12pt, amplitude=4pt}}%
			\advance \disend by -16pt
		\or
			\def\discontstyle{decoration={ticks,segment length=4pt, amplitude=8pt}}%
			\advance \disend by -8pt
		\fi
		\pgfplotscoordmath{#1}{datascaletrafo get params}%
		% if #1max + shift < 0pt  (shift is 0 without the scaling trafo)
		\ifdim\csname pgfplots@#1max@reg\endcsname<-\pgfplotsretvalb pt
			% swap start and end
			\disstart=\disend
			\disend=4pt
		\else
			\disstart=4pt
		\fi
		% 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@glob@TMPa
	\else
		\expandafter\def\csname #1disstart\endcsname{0pt}%
		\expandafter\def\csname #1disend\endcsname{0pt}%
		\pgfkeyslet{/tikz/#1discont}=\pgfutil@empty
	\fi
}%

\def\pgfplots@rememberplotspec@for@label{\pgfplotsutil@ifnextchar[{\pgfplots@rememberplotspec@for@label@}{\pgfplots@rememberplotspec@for@label@[]}}%
\def\pgfplots@rememberplotspec@for@label@[#1]#2{%
	\t@pgfplots@tokc={#2}% this token register stuff allows '#' inside of '#2'
	\expandafter\xdef\csname pgfplots@last@plot@style@#1\endcsname{\the\t@pgfplots@tokc}%
	\global\pgfplots@has@label@informationtrue
}%
\def\pgfplots@rememberplotspec{\pgfplotsutil@ifnextchar[{\pgfplots@rememberplotspec@opt}{\pgfplots@rememberplotspec@opt[]}}%
\def\pgfplots@rememberplotspec@opt[#1]#2{%
	\pgfplots@rememberplotspec@for@label[#1]{#2}%
	\pgfplotslistpushbackglobal{#2}\to\pgfplots@plotspeclist
}

\def\pgfplots@getautoplotspec into#1{%
	\begingroup
	\let#1=\pgfutil@empty
	\pgfkeysgetvalue{/pgfplots/cycle multi list/@dim}\pgfplots@cycle@dim
	%
	\let\pgfplots@listindex=\pgfplots@numplots
	\pgfkeysgetvalue{/pgfplots/cycle list shift}\pgfplots@listindex@shift
	\ifx\pgfplots@listindex@shift\pgfutil@empty
	\else
		\c@pgf@counta=\pgfplots@listindex\relax
		\advance\c@pgf@counta by\pgfplots@listindex@shift\relax
		\ifnum\c@pgf@counta<0
			\c@pgf@counta=-\c@pgf@counta
		\fi
		\edef\pgfplots@listindex{\the\c@pgf@counta}%
	\fi
	\ifnum\pgfplots@cycle@dim>0
		\if L\pgfplots@cycle@multi@list@sequence
			% use the 'cycle multi list' feature.
			%
			% it employs a scalar -> multiindex map like
			% void fromScalar( size_t d, size_t scalar, size_t* Iout, const size_t* N )
			% {
			% 	size_t ret=scalar;
			% 	for( int i = d-1; i>=0; --i ) {
			% 		Iout[i] = ret % N[i];
			% 		ret /= N[i];
			% 	}
			% }
			% to get the different indices into the cycle lists.
			%--------------------------------------------------
			\c@pgf@counta=\pgfplots@cycle@dim\relax
			\c@pgf@countb=\pgfplots@listindex\relax
			\advance\c@pgf@counta by-1
			\pgfplotsloop{%
				\ifnum\c@pgf@counta<0
					\pgfplotsloopcontinuefalse
				\else
					\pgfplotsloopcontinuetrue
				\fi
			}{%
				\pgfkeysgetvalue{/pgfplots/cycle multi list/@N\the\c@pgf@counta}\pgfplots@cycle@N
				% compute list index:
				\pgfplotsmathmodint{\c@pgf@countb}{\pgfplots@cycle@N}%
				\divide\c@pgf@countb by \pgfplots@cycle@N\relax
				%
				\expandafter\pgfplots@getautoplotspec@
					\csname pgfp@cyclist@/pgfplots/cycle multi list/@list\the\c@pgf@counta @\endcsname
					{\pgfplots@cycle@N}%
					{\pgfmathresult}%
				\t@pgfplots@toka=\expandafter{#1,}%
				\t@pgfplots@tokb=\expandafter{\pgfplotsretval}%
				\edef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
				\advance\c@pgf@counta by-1
			}%
		\else
			\if M\pgfplots@cycle@multi@list@sequence
				%
				% take the i'th element of each sub-list where i
				% =\pgfplots@listindex
				\if A\pgfplots@cycle@multi@list@repeat
					% 'cycle multiindex list'
					%
					% ensure that we respect the maxlen of the list:
					\pgfplotsmathmodint{\pgfplots@listindex}{\pgfkeysvalueof{/pgfplots/cycle multi list/@maxlen}}%
					\let\pgfplots@listindex=\pgfmathresult
					\def\pgfplots@cycle@multi@list@cur##1{%
						\ifnum\pgfplots@listindex<\pgfplots@cycle@N\relax
							##1%
						\fi
					}%
					%
				\else
					% 'cycle multiindex* list':
					\def\pgfplots@cycle@multi@list@cur##1{%
						##1%
					}%
				\fi
				%
				\c@pgf@counta=0
				\pgfplotsloop{%
					\ifnum\c@pgf@counta<\pgfplots@cycle@dim\relax
						\pgfplotsloopcontinuetrue
					\else
						\pgfplotsloopcontinuefalse
					\fi
				}{%
					\pgfkeysgetvalue{/pgfplots/cycle multi list/@N\the\c@pgf@counta}\pgfplots@cycle@N
					\pgfplots@cycle@multi@list@cur{%
						\expandafter\pgfplots@getautoplotspec@
							\csname pgfp@cyclist@/pgfplots/cycle multi list/@list\the\c@pgf@counta @\endcsname
							{\pgfplots@cycle@N}%
							{\pgfplots@listindex}%
						\t@pgfplots@toka=\expandafter{#1,}%
						\t@pgfplots@tokb=\expandafter{\pgfplotsretval}%
						\edef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
					}%
					\advance\c@pgf@counta by1
				}%
			\else
				\pgfplots@error{Internal error: expected 'L' or 'M', not '\pgfplots@cycle@multi@list@sequence'}%
			\fi
		\fi
	\else
		% normal cycle list:
		\pgfplotslistsize\autoplotspeclist\to\c@pgf@countd
		\pgfplots@getautoplotspec@{\autoplotspeclist}{\c@pgf@countd}{\pgfplots@listindex}%
		\let#1=\pgfplotsretval
	\fi
%\message{[plot \the\pgfplots@numplots]: Returning options list \meaning#1^^J}%
	\pgfmath@smuggleone#1%
	\endgroup
}
% #1: list name (macro!)
% #2: list size (integer register or value)
% #3: list element index
%
% defines \pgfplotsretval
\def\pgfplots@getautoplotspec@#1#2#3{%
	\ifnum#2=0
		\let\pgfplotsretval=\pgfutil@empty
	\else
		\pgfplotsmathmodint{#3}{#2}%
		\pgfplotslistselect\pgfmathresult\of#1\to\pgfplotsretval
	\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;%
}
\def\pgfplots@replacement@for@scope{\pgfutil@ifnextchar[{\pgfplots@replacement@for@scope@}{\pgfplots@replacement@for@scope@[]}}%
\long\def\pgfplots@replacement@for@scope@[#1]{%
	\pgfplotsextra{\scope[#1]}%
	\begingroup
	% I need to apply anything which might be relevant for \addplot
	% here.
	% But I do NOT want \scope since this might already affect the low
	% level output.
	%
	% This here works:
	% 1. set them to activate plot handlers and parameters like
	% samples and domain:
	\tikzset{#1}%
	%
	% 2. we need to remember all these options inside of
	% 'current plot style' -- otherwise, they would not appear
	% inside of legend images and markers.
	\pgfplotssurveyphaseaddoptionsbeforesurveybegins{#1}%
}%
\def\pgfplots@replacement@for@endscope{%
	\endgroup
	\pgfplotsextra{\endscope}%
}%

\def\pgfplots@replacement@for@onlayer#1{%
	\edef\pgfplots@loc@TMPa{#1}%
	\expandafter\pgfplots@replacement@for@onlayer@{#1}%
}
\def\pgfplots@replacement@for@onlayer@#1{%
	\pgfplotsextra{\pgfonlayer{#1}}%
}%
\def\pgfplots@replacement@for@endonlayer{\pgfplotsextra{\endpgfonlayer}}%

{
	% 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'
	\def\pgfplots@path@AS#1;{\pgfplots@path@enqueue{#1;}}%
	\long\def\pgfplots@replacement@for@tikz@path@AS#1;{%
		\axispath\path#1;%
	}%
	\pgfplots@appendto@activesemicolon@switcher{%
		\let\pgfplots@path=\pgfplots@path@AS
		\let\pgfplots@replacement@for@tikz@path=\pgfplots@replacement@for@tikz@path@AS
	}%
}


% Will be available as \closedcycle command inside of an axis.
%
% It closes the current plot by drawing lines to the last "zero
% level".
%
% That means the current plot is connected orthogonally with the
% x-axis, allowing fill commands.
%
% For stacked plots, \closedcycle is special (it connects with the
% previous \addplot command).
%
% Example:
% \addplot coordinates {(3,0.5) (4,2) (5,1)} \closedcycle;
\def\pgfplots@path@closed@cycle{%
	\ifpgfplots@stackedmode
		\pgfplots@stacked@path@closed@cycle
	\else
		\pgfplots@path@closed@cycle@std
	\fi
}
\def\pgfplots@path@closed@cycle@std{%
	|- (perpendicular cs:
		vertical line through={(current plot begin)},
		horizontal line through={(\pgfplots@ZERO@x,\pgfplots@ZERO@y)})
	-- cycle
}%

% Remembers the plotting command #2 and '#3=plot coordinates {...} ...';
% for later postprocessing of the coordinates.
%
% #1: pre-commands which should be executed before issueing the plotting
%        command #2 #3.
% #2: the drawing-command.
%    - If #2 is NOT '\pgfutil@empty', we expect #3 to contain only
%      EXPANDABLE DATA.
%      That's important for postponed floating point arithmetics in #3.
%    - If #2='\pgfutil@empty', we don't make any assumption about #3
%      and process it as-is.
%
% #3: the plot data. If #2 is empty, this can be any command.
%
% #4: commands which should be executed after '#2 #3'.
%
\long\def\pgfplots@path@enqueue@coords#1#2#3#4{%
	\begingroup
	\def\pgfplots@loc@TMPa{#2}%
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\def\pgfplots@stored@current@precmd{#1}%
		\def\pgfplots@stored@current@cmd{#2}%
		\def\pgfplots@stored@current@data{#3}%
		\def\pgfplots@stored@current@postcmd{#4}%
		\ifx\pgfplots@stored@current@precmd\pgfutil@empty
		\else
			\pgfplots@wrong@plotlist@format@error
		\fi
		\ifx\pgfplots@stored@current@postcmd\pgfutil@empty
		\else
			\pgfplots@wrong@plotlist@format@error
		\fi
		\pgfplotslistpushbackglobal{#1}{#2}{#3}{#4}\to\pgfplots@stored@plotlist
	\else
		\pgfkeysgetvalue{/pgfplots/execute at begin plot visualization}\pgfplots@loc@TMPa
		\pgfkeysgetvalue{/pgfplots/execute at end plot visualization}\pgfplots@loc@TMPb
		\t@pgfplots@toka={#1}%
		\t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}%
		\t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPb}%
		\edef\pgfplots@loc@TMPa{%
			\noexpand\pgfkeyssetvalue{/pgfplots/execute at begin plot visualization}{\the\t@pgfplots@tokb}%
			\noexpand\pgfkeyssetvalue{/pgfplots/execute at end plot visualization}{\the\t@pgfplots@tokc}%
			\the\t@pgfplots@toka
		}%
		\expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@loc@TMPa}{#2}{#3}{#4}\to\pgfplots@stored@plotlist
	\fi
	\endgroup
}
\def\pgfplots@wrong@plotlist@format@error{%
	\pgfplots@error{Internal logic error: someone used \string \pgfplots@path@enqueue@coords\space in an unexpected way: if the second argument is empty, ONLY the third argument should be non-empty.^^J I found: pre command (1st arg): \meaning\pgfplots@stored@current@precmd;^^J  command (2nd arg): \meaning\pgfplots@stored@current@cmd;^^J  data (3rd arg): \meaning\pgfplots@stored@current@data^^J; post cmd (4th arg): \meaning\pgfplots@stored@current@postcmd^^J}%
}%

% this was formerly slightly different than
% \pgfplots@path@enqueue@coords, but it is now the same.
\let\pgfplots@addplot@enqueue@coords=\pgfplots@path@enqueue@coords


% Remembers the plotting command #1.
\long\def\pgfplots@path@enqueue#1{%
	\pgfplots@path@enqueue@coords{}{}{#1}{}%
}
% Use
%\begin{axis}
%	\pgfplotsextra{
%	... basic level commands or whatever...
%	}
%\end{axis}
% to process the special commands by pgfplots.
% This is the same treatment as for TikZ \path commands:
% the commands will be processed as soon as the axis is finished- not
% before.
%
% In contrast to \path, \pgfplotsextra can contain any command(s).
%
% Syntax: either
% \pgfplotsextra{<argument>}
% or
% \pgfplotsextra <argument> \endpgfplotsextra
\def\pgfplotsextra{%
	\pgfutil@ifnextchar\bgroup{\pgfplots@path@enqueue}{\pgfplotsextra@}%
}%
\long\def\pgfplotsextra@#1\endpgfplotsextra{\pgfplots@path@enqueue{#1}}%


% Assigns a legend.
% Syntax:
% \legend{entry 1\\entry2\\entry3}
\def\pgfplots@command@legend{
	\pgfutil@ifnextchar[{%
		\pgfplots@error{Sorry, legend options are now deprecated. Legends are now TikZ-matrizes which provide better alignment and can be placed horizontally. See the manual for details.}%
		\pgfplots@command@legend@impl
	}{%
		\pgfplots@command@legend@impl
	}%
}

\def\pgfplots@command@legend@impl#1{%
	\pgfplots@assign@list\pgfplots@loc@TMPc{#1}%
	\global\let\pgfplots@legend=\pgfplots@loc@TMPc
}

\def\pgfplots@reverselegend{%
	% Reverse \pgfplots@plotspeclist
	\begingroup
		\pgfplotslistnewempty\pgfplots@plotspeclist@reversed
		\pgfplotslistforeachungrouped\pgfplots@plotspeclist\as\pgfplots@plotspeclisttmp{%
			\expandafter\pgfplotslistpushfront\pgfplots@plotspeclisttmp\to\pgfplots@plotspeclist@reversed
		}%
		\global\let\pgfplots@plotspeclist=\pgfplots@plotspeclist@reversed
		\let\pgfplots@legend@reversed=\relax
		%
		% Reverse \pgfplots@legend
		\pgfplotslistnewempty\pgfplots@legend@reversed
		\pgfplotslistforeachungrouped\pgfplots@legend\as\pgfplots@legendtmp{%
			\expandafter\pgfplotslistpushfront\pgfplots@legendtmp\to\pgfplots@legend@reversed
		}%
		\global\let\pgfplots@legend=\pgfplots@legend@reversed
	\endgroup
}

\def\pgfplots@transposelegend{%
	\ifnum\pgfplots@legend@columns>1
		\begingroup
		\pgfplots@transposelegend@
		\let\pgfplots@legend@columns=\c@pgfplots@row@end
		\pgfmath@smuggleone\pgfplots@legend@columns
		\endgroup
	\fi
}
\def\pgfplots@transposelegend@{%
	\let\c@pgfplots@row=\c@pgf@countb
	\let\c@pgfplots@col=\c@pgf@countc
	\let\c@pgfplots@no=\c@pgf@countd
	\c@pgfplots@row=0
	\c@pgfplots@col=0
	\c@pgfplots@no=0
	\pgfplotslistforeachungrouped\pgfplots@legend\as\entry{%
		\expandafter\let\csname m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname=\entry
		\advance\c@pgfplots@col by1
		\ifnum\pgfplots@legend@columns=\c@pgfplots@col\relax
			\c@pgfplots@col=0
			\advance\c@pgfplots@row by1
		\fi
		\advance\c@pgfplots@no by1
	}%
	\ifnum\c@pgfplots@col=0
	\else
		\advance\c@pgfplots@row by1
	\fi
	\edef\c@pgfplots@row@end{\the\c@pgfplots@row}%
	\edef\c@pgfplots@no@leg{\the\c@pgfplots@no}%
	%
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\c@pgfplots@row=0
	\c@pgfplots@col=0
	\c@pgfplots@no=0
	\pgfplotslistforeachungrouped\pgfplots@plotspeclist\as\entry{%
		\expandafter\let\csname m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname=\entry
		\advance\c@pgfplots@col by1
		\ifnum\pgfplots@legend@columns=\c@pgfplots@col\relax
			\c@pgfplots@col=0
			\advance\c@pgfplots@row by1
		\fi
		\advance\c@pgfplots@no by1
	}%
	\ifnum\c@pgfplots@col=0
	\else
		\advance\c@pgfplots@row by1
	\fi
	\ifnum\c@pgfplots@row<\c@pgfplots@row@end
		\edef\c@pgfplots@row@end{\the\c@pgfplots@row}%
	\fi
	\ifnum\c@pgfplots@no<\c@pgfplots@no@leg
		\edef\c@pgfplots@no@leg{\the\c@pgfplots@no}%
	\fi
	%
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\c@pgfplots@col=0
	\global\pgfplotslistnewempty\pgfplots@legend%
	\global\pgfplotslistnewempty\pgfplots@plotspeclist%
	\pgfplotsloop{%
		\ifnum\pgfplots@legend@columns=\c@pgfplots@col
			\pgfplotsloopcontinuefalse
		\else
			\pgfplotsloopcontinuetrue
		\fi
	}{%
		\c@pgfplots@row=0
		\pgfplotsloop{%
			\ifnum\c@pgfplots@row@end=\c@pgfplots@row
				\pgfplotsloopcontinuefalse
			\else
				\pgfplotsloopcontinuetrue
			\fi
		}{%
			\pgfutil@ifundefined{m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col}{%
			}{%
				\pgfutil@ifundefined{m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col}{%
				}{%
					\expandafter\let\expandafter\pgfplots@legendtmp\csname m@pgfplots@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname
					\expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@legendtmp}\to\pgfplots@legend%
					%
					\expandafter\let\expandafter\pgfplots@legendtmp\csname m@pgfplots@img@\the\c@pgfplots@row,\the\c@pgfplots@col\endcsname
					\expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplots@legendtmp}\to\pgfplots@plotspeclist%
				}%
			}%
			\advance\c@pgfplots@row by1
		}%
		\advance\c@pgfplots@col by1
	}%
}%


\def\pgfplots@addlegendentryexpanded{%
	\pgfutil@ifnextchar[{%
		\pgfplots@addlegendentryexpanded@opts
	}{%
		\pgfplots@addlegendentryexpanded@opts[]%
	}%
}
\long\def\pgfplots@addlegendentryexpanded@opts[#1]#2{%
	\begingroup
		\let\protect=\noexpand
		\long\edef\pgfplots@loc@TMPa{#2}%
		\def\pgfplots@loc@TMPb{\pgfplots@addlegendentry@opts[#1]}%
		\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}%
	\endgroup
}%

\def\pgfplots@addlegendimage{\pgfutil@ifnextchar[{\pgfplots@addlegendimage@opt}{\pgfplots@addlegendimage@opt[]}}%
\def\pgfplots@addlegendimage@opt[#1]#2{%
	\pgfplots@rememberplotspec[#1]{/pgfplots/every axis plot,#2,/pgfplots/.cd,/pgfplots/every axis plot post}%
}%

% This implements \addlegendentry
\def\pgfplots@addlegendentry{%
	\pgfutil@ifnextchar[{%
		\pgfplots@addlegendentry@opts
	}{%
		\pgfplots@addlegendentry@opts[]%
	}%
}
\long\def\pgfplots@addlegendentry@opts[#1]#2{%
	\pgfplotslistpushbackglobal[#1]#2\to\pgfplots@legend
}

\def\pgfplots@pop@next@legend{{%
	\globaldefs=1
	\pgfplotslistcheckempty\pgfplots@plotspeclist
	\ifpgfplotslistempty
		\let\pgfplots@curplotlist=\relax
	\else
		\pgfplotslistpopfront\pgfplots@plotspeclist\to\pgfplots@curplotlist
		\pgfplotslistcheckempty\pgfplots@legend
		\ifpgfplotslistempty
			\let\pgfplots@curlegend=\pgfutil@empty
		\else
			\pgfplotslistpopfront\pgfplots@legend\to\pgfplots@curlegend
		\fi
	\fi
	%
}}

\def\pgfplots@try@mirror@plot@handler{%
	\pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler
	% this method assigns '\tikz@plot@handler'.
	% That's ok and does not introduce incompatibilities.
	\ifx\pgfplots@basiclevel@plothandler\pgfplothandlerconstantlineto
		\let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkright
	\else
		\ifx\pgfplots@basiclevel@plothandler\pgfplothandlerconstantlinetomarkright
			\let\tikz@plot@handler=\pgfplothandlerconstantlineto
		\fi
	\fi
}

% #1: DEPRECATED. Unused.
% #2: plot style
\long\def\pgfplots@show@small@legendplots#1#2{%
	\begingroup
	\pgfplots@define@currentplotstyle@as{#1,#2}%
	\pgfplots@restore@state@before@legend@style
	\scope[/tikz/current plot style,/pgfplots/every legend image post]% this scoping construction allows plot styles to change 'legend image code'.
		\pgfkeysvalueof{/pgfplots/legend image code/.@cmd}\pgfeov
	\endscope
	\endgroup
	%\pgfkeysvalueof{/pgfplots/legend image code/.@cmd}{/pgfplots/.cd,#1,#2}\pgfeov
}

% A work-around method to undo the 'every axis legend' style.
%
% It is called within legend's cell pictures in order to undo global
% settings like stroke colors or the-like.
\def\pgfplots@restore@state@before@legend@style{%
	\pgfsetfillcolor{black}%
	% disable the transformations of pgfplots. This is only used by
	% pgfplots-specific plot handlers which work only if used inside
	% of an axis... disable it.
	\def\pgfplotsaxisvisphasetransformcoordinate##1##2##3{}%
}%

\def\pgfplots@split@opts{%
	\pgfutil@ifnextchar[{%
		\pgfplots@split@opts@opts
	}{%
		\pgfplots@split@opts@opts[]%
	}%
}
\long\def\pgfplots@split@opts@opts[#1]#2\pgfplots@result@to#3#4{%
	\long\def#3{#2}%
	\long\def#4{#1}%
}

% Typesets a legend node.
%
% It will either typeset a previously computed legend (which needs to be
% stored in the macro \pgfplots@already@computed@legend@node)
%
% or it creates a legend, stores the commands into the macro named
% above and typesets it.
\def\pgfplots@createlegend{%
	\pgfkeysgetvalue{/pgfplots/legend to name}\pgfplots@createlegend@toname
	\ifx\pgfplots@already@computed@legend@node\pgfutil@empty
		\pgfplotslistcheckempty\pgfplots@legend
		\ifpgfplotslistempty
			% No legend commands appeared in the document. So,
			% consider the key:
			\pgfkeysgetvalue{/pgfplots/legend entries}\pgfplots@legend
			\expandafter\pgfplots@assign@list\expandafter\pgfplots@legend\expandafter{\pgfplots@legend}%
			\pgfplotslistcheckempty\pgfplots@legend
		\fi
%\message{Legend: \meaning\pgfplots@legend^^J}%
		\ifpgfplotslistempty
		\else
		\ifpgfplots@reverse@legend
			\pgfplots@reverselegend
		\fi
		\ifpgfplots@transpose@legend
			\pgfplots@transposelegend
		\fi
		%
		%
		\begingroup
			\ifx\pgfplots@createlegend@toname\pgfutil@empty
				% ok, draw legend.
				\def\pgfplots@createlegend@prepareimage@to##1{%
					\t@pgfplots@tokc=\expandafter{\pgfplots@curplotlist}%
					\edef##1{\noexpand\pgfplots@show@small@legendplots{}{\the\t@pgfplots@tokc}}%
				}%
			\else
				% export legend instead of drawing it.
				\def\pgfplots@createlegend@prepareimage@to##1{%
					\t@pgfplots@tokc=\expandafter{\pgfplots@curplotlist}%
					\edef\pgfplots@loc@TMPa{\noexpand\pgfplots@export@legend@image@to@macro{\the\t@pgfplots@tokc}{}}%
					\pgfplots@loc@TMPa
					\let##1=\pgfplotsretval
				}%
			\fi
			% assemble a
			% \matrix {
			% 	small plot  & legend1\\
			% 	small plot  & legend2\\
			% 	...
			% };
			% command [and using the 'legend columns' option]
			%
			% \t@pgfplots@toka={
			% 	small plot  & legend1\\
			% 	small plot  & legend2\\
			% 	...
			% }
			% ( I have allocated the token registers in my
			% liststructure.sty)
			%
			% \global\def\pgfplots@glob@TMPa{
			% 	\matrix {
			% 		\TOKL@TA
			% 	};
			% }
			% -> finally, \pgfplots@glob@TMPa will contain the complete command.
			\t@pgfplots@toka={}%
			\let\curcolumnNum=\c@pgf@counta
			\let\maxcolumnCount=\c@pgf@countb
			\let\legendplotpos=\c@pgf@countc
			\legendplotpos\expandafter=\pgfplots@legend@plot@pos
			\curcolumnNum=0
			\maxcolumnCount=\pgfplots@legend@columns\relax
			%
			\pgfplotsloop{%
				\pgfplots@pop@next@legend
				\ifpgfplotslistempty
					\pgfplotsloopcontinuefalse
				\else
					\pgfplotsloopcontinuetrue
				\fi
			}{%
				\ifx\pgfplots@curlegend\pgfutil@empty
				\else
					\advance\curcolumnNum by1
					\begingroup
					% \pgfplots@curlegend@opts are any options for
					% this single legend text, provided as
					% \addlegendentry[<options>]{<text>}
					% or
					% legend entries={...,[<options>]<text>, ....}
					\expandafter\pgfplots@split@opts\pgfplots@curlegend\pgfplots@result@to{\pgfplots@curlegend}{\pgfplots@curlegend@opts}%
					\pgfplots@createlegend@prepareimage@to{\pgfplotsretval}%
					%
					\t@pgfplots@tokb=\expandafter{\pgfplots@curlegend@opts}%
					\t@pgfplots@tokc=\expandafter{\pgfplots@curlegend}%
					%
					% prepare the \node[<options>] {<text>} into \t@pgfplots@tokc
					\edef\pgfplots@loc@TMPa{\noexpand\node[\the\t@pgfplots@tokb]{\the\t@pgfplots@tokc};}%
					\t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}%
					%
					% and the legend image into \t@pgfplots@tokb:
					\t@pgfplots@tokb=\expandafter{\pgfplotsretval}%
					% ok. Now, the
					% - 'b' register contains the IMAGE and
					% - 'c' register contains the TEXT
					\ifcase\legendplotpos
						% legend plot pos=left
						\edef\pgfplots@matrixentry{%
							\the\t@pgfplots@tokb
							\noexpand\pgfmatrixnextcell
							\the\t@pgfplots@tokc%
						}%
					\or
						% legend plot pos=right
						\edef\pgfplots@matrixentry{%
							\the\t@pgfplots@tokc%
							\noexpand\pgfmatrixnextcell
							\the\t@pgfplots@tokb
						}%
					\or
						% legend plot pos=none
						\edef\pgfplots@matrixentry{%
							\the\t@pgfplots@tokc%
						}%
					\fi
					% copy it back to 'b' register:
					\t@pgfplots@tokb=\expandafter{\pgfplots@matrixentry}%
					%
					\ifnum\curcolumnNum=\maxcolumnCount
						\t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}%
					\else
						\pgfplotslistcheckempty\pgfplots@legend
						\ifpgfplotslistempty
						\else
							\pgfplotslistcheckempty\pgfplots@plotspeclist
						\fi
						\ifpgfplotslistempty
							% Ok, either the legend list is empty or
							% there are no more plot specifications.
							%
							% Finalize matrix:
							\t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\\}%
						\else
							\t@pgfplots@tokb=\expandafter{\the\t@pgfplots@tokb\pgfmatrixnextcell}%
						\fi
					\fi
					\xdef\pgfplots@glob@TMPa{%
						\the\t@pgfplots@toka
						\the\t@pgfplots@tokb
					}%
					\endgroup
					\ifnum\curcolumnNum=\maxcolumnCount
						\curcolumnNum=0
					\fi
					\expandafter\t@pgfplots@toka\expandafter{\pgfplots@glob@TMPa}%
				\fi
			}%
			\t@pgfplots@tokb={\matrix[/pgfplots/every axis legend]}%
			\xdef\pgfplots@glob@TMPa{%
				\noexpand\def\noexpand\plotnum{0}%
				\noexpand\def\noexpand\plotnumofactualtype{0}%
				\the\t@pgfplots@tokb {%
					\the\t@pgfplots@toka
				};%
			}%
		\endgroup
		\let\pgfplots@already@computed@legend@node=\pgfplots@glob@TMPa
		\fi
	\fi
	\ifx\pgfplots@createlegend@toname\pgfutil@empty
		% DRAW:
		\pgfplotsgetlayerforstyle{every axis legend}%
		\pgfplotsonlayer\pgfplotsretval{legend style}%
		\pgfplots@already@computed@legend@node
		\endpgfplotsonlayer
	\else
		% apply the 'legend to name' feature:
		%
		% store legend contents:
		%
		\t@pgfplots@toka=\expandafter{\pgfplots@already@computed@legend@node}%
		\pgfkeysgetvalue{/pgfplots/every axis legend/.@cmd}\pgfplots@loc@TMPa
		\t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa\pgfeov}%
		%
		\pgfplots@assemble@ref@picture
			{\pgfplots@legend@to@name}
			{\tikz[/pgfplots/every legend to name picture/.try]{\pgfplots@legend@to@name}}%
		\t@pgfplots@tokc=\expandafter{\pgfplotsretval}%
		%
		\begingroup
		\pgfkeysgetvalue{/pgfplots/every legend image post/.@cmd}\pgfplots@loc@TMPa
		% steal \toks0 temporarily. Within this group, it won't be
		% used by any LaTeX code:
		\toks0=\expandafter{\pgfplots@loc@TMPa\pgfeov}%
		%
		\expandafter\xdef\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname{%
			\noexpand\begingroup
			\noexpand\def\noexpand\pgfplots@legend@to@name{%
				\noexpand\pgfkeysdef{/pgfplots/every axis legend}{\the\t@pgfplots@tokb}%
				\noexpand\pgfkeysdef{/pgfplots/every legend image post}{\the\toks0 }%
				\noexpand\def\noexpand\numplots{\numplots}%
				\the\t@pgfplots@toka
			}%
			\the\t@pgfplots@tokc
			\noexpand\endgroup
		}%
		\endgroup
		\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\endcsname}%
		\pgfplots@auxwrite{%
			\noexpand\expandafter
			\noexpand\gdef
				\noexpand\csname pgfplots@legend@to@name@\pgfplots@createlegend@toname\noexpand\endcsname%
					{\the\t@pgfplots@toka}%
		}%
		\begingroup
		%
		% make sure \ref{<legendname>} works:
		\pgfplots@label{\pgfplots@createlegend@toname}{pgfplots@legend@to@name@}%
		\endgroup
	\fi
}

\pgfutil@IfUndefined{AtBeginDocument}{}{%
	\AtBeginDocument{%
		\let\pgfplots@original@LaTeX@label@loadtime=\label
	}%
}

% Defines a new \label{#1}. When \ref{#1} is used, the code
% \csname #3#2\endcsname
% will be invoked.
% \pgfplots@label[<optional prefix>]{<label name>}{<command prefix>}
% invokes
% \label<optional prefix>{<label name>}
\def\pgfplots@label{\pgfutil@ifnextchar[{\pgfplots@label@@}{\pgfplots@label@@[]}}%
\def\pgfplots@label@@[#1]#2#3{%
	\begingroup
	\edef\@currentlabel{%
		\string\expandafter
		\string\protect
		\string\csname\space #3#2\string\endcsname
	}%
	\pgfutil@IfUndefined{hyper@makecurrent}{}{%
		\hyper@makecurrent{pgfplotslink}%
		\hyper@anchorstart{\@currentHref}{}\hyper@anchorend
		\pgfplotsutil@advancestringcounter@global\c@pgfplots@label
	}%
	%
	\pgfplots@label@configure@package@workarounds
	%
	\pgfutil@IfUndefined{label}{%
	}{%
		\def\pgfplots@loc@TMPa{\label #1}%
		\expandafter\pgfplots@loc@TMPa\expandafter{#2}% the \expandafter is a convenience method; the name should be expandable anyway
	}%
	\endgroup
}%
\gdef\c@pgfplots@label{0}%
\def\theHpgfplotslink{\theHsection.\c@pgfplots@label}%

\def\pgfplots@label@configure@package@workarounds{%
	% this is a work-around to support the memoir class (it overwrites
	% \label in sub
	\let\sf@@memsub@label=\pgfplots@original@LaTeX@label@loadtime
	%
	\ifx\label\mcaption@label
		% this is a work-around to support the mcaption class: it
		% simply remembers the label name and invokes \label later-on.
		% This appears to be wrong in this context: I want to generate
		% a pgfplots label.
		%
		% If someone writes \label{fig:one}, that label will be
		% redeclared in the margin - which appears to be correct. And
		% that will still work.
		%
		% This here will activate pgfplots' labels:
		\let\label=\pgfplots@original@LaTeX@label@loadtime
	\fi
}

% this is deprecated. Use \ref{#1} instead.
\def\pgfplotslegendfromname#1{%
	\pgfplots@texdist@protect\pgfplotslegendfromname@{#1}%
}%
\def\pgfplotslegendfromname@#1{%
	\pgfutil@IfUndefined{pgfplots@legend@to@name@#1}{%
		\pgfutil@IfUndefined{ref}{%
			\pgfplotswarning{no such legend to name}{#1}\pgfeov
			\string\pgfplotslegendfromname{#1}: ??%
		}{%
			\ref{\string\pgfplotslegendfromname{#1}}%
		}%
	}{%
		\csname pgfplots@legend@to@name@#1\endcsname
	}%
}%
% this is deprecated. Use \ref{#1} instead.
\def\pgfplotscolorbarfromname#1{%
	\pgfplots@texdist@protect\pgfplotscolorbarfromname@{#1}%
}%
\def\pgfplotscolorbarfromname@#1{%
	\pgfutil@IfUndefined{pgfplots@colorbar@to@name@#1}{%
		\pgfutil@IfUndefined{ref}{%
			\pgfplotswarning{no such colorbar to name}{#1}\pgfeov
			\string\pgfplotscolorbarfromname{#1}: ??%
		}{%
			\ref{\string\pgfplotscolorbarfromname{#1}}%
		}%
	}{%
		\csname pgfplots@colorbar@to@name@#1\endcsname
	}%
}%

\def\pgfplotsplotfromname#1{%
	\pgfplots@texdist@protect\pgfplotsplotfromname@{#1}%
}%
\def\pgfplotsplotfromname@#1{%
	\pgfutil@IfUndefined{pgfplots@show@ref@#1}{%
		\pgfutil@IfUndefined{ref}{%
			\pgfplotswarning{no such addplot label}{#1}\pgfeov
			\string\pgfplotsplotfromname{#1}: ??%
		}{%
			\ref{\string\pgfplotsplotfromname{#1}}%
		}%
	}{%
		\csname pgfplots@show@ref@#1\endcsname
	}%
}%

\def\pgfplots@ifintikzpicture#1#2{%
	\ifpgfpicture #1\else #2\fi
}%

% DEPRECATED.
\def\skipsuffixzero#1.#2|{
	{%
	\def\pgfplots@loc@TMPa{#2}%
	\def\pgfplots@loc@TMPb{0}%
	\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
		\global\def\pgfmathresult{#1}%
	\else
		\global\def\pgfmathresult{#1.#2}%
	\fi
	}%
}

\def\pgfmathlogtologten#1{%
	\pgfmathparse{#1}%
	\expandafter\pgfmathlogtologten@\expandafter{\pgfmathresult}%
}

% Simply divides #1 by log(10).
% ATTENTION: in order to implement per-axis log basis, this will be
% OVERWRITTEN in pgfplotsticks.code.tex !
\def\pgfmathlogtologten@#1{%
	\pgfmathmultiply@{#1}\reciproclogten%
}%

% DEPRECATED.
\def\logtologtentomacro#1#2{%
	\pgfmathlogtologten@{#1}%
	\expandafter\skipsuffixzero\pgfmathresult|%
	\let#2=\pgfmathresult
}

% DEPRECATED.
\def\logtologten#1{%
	\pgfmathlogtologten@{#1}%
	\expandafter\skipsuffixzero\pgfmathresult|%
	\pgfmathresult
}

\pgfkeysdef{/pgfplots/@enlargelimits/true}{%
	\def\bool@pgfplots@loc@enlargelimits@min{1}%
	\def\bool@pgfplots@loc@enlargelimits@max{1}%
}%
\pgfkeysdef{/pgfplots/@enlargelimits/false}{%
	\def\bool@pgfplots@loc@enlargelimits@min{0}%
	\def\bool@pgfplots@loc@enlargelimits@max{0}%
}%
\pgfkeysdef{/pgfplots/@enlargelimits/upper}{%
	\def\bool@pgfplots@loc@enlargelimits@min{0}%
	\def\bool@pgfplots@loc@enlargelimits@max{1}%
}%
\pgfkeysdef{/pgfplots/@enlargelimits/lower}{%
	\def\bool@pgfplots@loc@enlargelimits@min{1}%
	\def\bool@pgfplots@loc@enlargelimits@max{0}%
}%
\pgfkeysdef{/pgfplots/@enlargelimits/auto}{%
	\def\bool@pgfplots@loc@enlargelimits@min{0}%
	\def\bool@pgfplots@loc@enlargelimits@max{0}%
	\def\pgfplots@loc@TMPa{0}%
	\ifpgfplots@threedim
		\if\pgfplots@enlargelimits@curaxis z%
			\def\pgfplots@loc@TMPa{1}%
		\fi
	\else
		\def\pgfplots@loc@TMPa{1}%
	\fi
	\if1\pgfplots@loc@TMPa
		\pgfplots@if{pgfplots@autocompute@\pgfplots@enlargelimits@curaxis min}{%
			\def\bool@pgfplots@loc@enlargelimits@min{1}%
		}{}%
		\pgfplots@if{pgfplots@autocompute@\pgfplots@enlargelimits@curaxis max}{%
			\def\bool@pgfplots@loc@enlargelimits@max{1}%
		}{}%
	\fi
}%

\def\pgfplots@enlargelimits@rel@unitserror#1{%
	\pgfplots@error{enlarge limits only supports values with units for 'abs=#1' and/or 'abs value=#1'. Ignoring unit}%
}%
\pgfkeysdef{/pgfplots/@enlargelimits/value}{%
	\pgfmathparse{#1}%
	\ifpgfmathunitsdeclared
		\pgfplots@enlargelimits@rel@unitserror{#1}%
	\fi
	\let\pgfplots@enlargelimits@relthresh=\pgfmathresult
	\let\pgfplots@enlargelimits@absthresh=\pgfutil@empty
}%
\pgfkeysdef{/pgfplots/@enlargelimits/rel}{\pgfkeysalso{true,value={#1}}}%
\pgfkeysdef{/pgfplots/@enlargelimits/abs value}{%
	\begingroup
		\ifpgfplots@usefpu
			\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
		\fi
		\pgfmathparse{#1}%
		\xdef\pgfplots@glob@TMPa{%
			\ifpgfmathunitsdeclared
				\noexpand\pgfmathunitsdeclaredtrue
			\else
				\noexpand\pgfmathunitsdeclaredfalse
			\fi
			\noexpand\def\noexpand\pgfmathresult{\pgfmathresult}%
		}%
	\endgroup
	\pgfplots@glob@TMPa
	\ifpgfmathunitsdeclared
		\edef\pgfplots@enlargelimits@absdimension{\pgfmathresult pt}%
		\let\pgfplots@enlargelimits@absthresh=\pgfutil@empty
	\else
		\let\pgfplots@enlargelimits@absdimension=\pgfutil@empty
		\csname pgfplotstransformdirection\pgfplots@enlargelimits@curaxis\endcsname{\pgfmathresult}%
		\let\pgfplots@enlargelimits@absthresh=\pgfmathresult
	\fi
	\let\pgfplots@enlargelimits@relthresh=\pgfutil@empty
}%
\pgfkeysdef{/pgfplots/@enlargelimits/abs}{\pgfkeysalso{true,abs value={#1}}}%
\pgfkeysdef{/pgfplots/@enlargelimits/.unknown}{\pgfkeysalso{true,value={\pgfkeyscurrentname}}}%

\def\pgfplots@enlarge@limit@ifconfigured#1{%
	\begingroup
	% ATTENTION: this uses similar access patterns as
	% \pgfplots@enlarge@limit@by@dimension
	\def\bool@pgfplots@loc@enlargelimits@min{0}%
	\def\bool@pgfplots@loc@enlargelimits@max{0}%
	%
	% we can either enlarge
	% ... using a relative limit (like 0.1 -> 10%)
	\def\pgfplots@enlargelimits@relthresh{0.1}% the default
	% ...or an absolute limit ( like 4 units)
	\let\pgfplots@enlargelimits@absthresh=\pgfutil@empty
	% or an absolute dimension (like 1cm).
	%
	% Relative and absolute values are relatively simple: we only need to compute and
	% add the changes to the already existing limits. The value with
	% an absolute dimension is surprisingly complicated.
	%
	% The problem is: enlargelimits has to be computed before the
	% image has been scaled into its final size. This is not merely a
	% technical problem; this is how one wants it to be!
	%
	% The solution taken here is to communicate such an absolute
	% dimension to the scaling routines. The scaling routines will
	% handle the case; we don't change limits here.
	%
	\let\pgfplots@enlargelimits@absdimension=\pgfutil@empty
	\def\pgfplots@enlargelimits@curaxis{#1}%
	%
	\pgfkeysgetvalue{/pgfplots/enlarge #1 limits}{\pgfplots@loc@TMPa}%
	\def\pgfplots@loc@TMPb{\pgfqkeys{/pgfplots/@enlargelimits}}% set the argument keys
	\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}%
	%
	\def\bool@pgfplots@loc@enlargeany{0}%
	\if1\bool@pgfplots@loc@enlargelimits@min
		\def\bool@pgfplots@loc@enlargeany{1}%
	\else
		\if1\bool@pgfplots@loc@enlargelimits@max
			\def\bool@pgfplots@loc@enlargeany{1}%
		\fi
	\fi
	\if1\bool@pgfplots@loc@enlargeany
		\pgfplots@enlarge@limit@for{#1}%
	\fi
	\global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany
	% limits assignments are made globally.
	\xdef\pgfplots@glob@TMPb{%
		\noexpand\pgfplots@enlargelimits@remember@abs@dimension{#1}%
			{\bool@pgfplots@loc@enlargelimits@min}%
			{\bool@pgfplots@loc@enlargelimits@max}%
			{\pgfplots@enlargelimits@absdimension}%
	}%
	\endgroup
	\pgfplots@glob@TMPb
	\if1\pgfplots@glob@TMPa
		\pgfplots@visphase@notify@changeofcanvaslimits{#1}%
	\fi
}

% Reconfigures the scaling routines such that following calls to
% \pgfplots@scaleaxes@to@BB@ will enlarge the limit for a specific
% axis by an absolute dimension.
%
% This enlargement is different from standard limit enlargement:
% Standart limit enlargement is typically applied (and finished) long
% before the scaling routines start. In fact, the result of
% enlargelimits is typically the input argument for the scaling
% (compare the pgfplots manual (pdf)).
%
% This here needs a different treatment because "enlarge x limits={abs=1cm}"
% has to be applied AFTER the scaling is complete. To this end, it is
% applied as the very last scaling step. It is applied after any post
% scales, and it only modifies axis limits.
%
% #1: x,y, or z
% #2: 1 if the lower limit shall be enlarged, 0 if not
% #3: 1 if the upper limit shall be enlarged, 0 if not
% #4: some absolute dimension (like 1cm) by which we want to enlarge
% axis limits.
\def\pgfplots@enlargelimits@remember@abs@dimension#1#2#3#4{%
	\expandafter\edef\csname pgfplots@enlargelimits@absdimension@#1\endcsname{#4}%
	\expandafter\edef\csname pgfplots@enlargelimits@absdimension@#1@minmax\endcsname{{#2}{#3}}%
}%
\let\pgfplots@enlargelimits@absdimension@x=\pgfutil@empty
\let\pgfplots@enlargelimits@absdimension@y=\pgfutil@empty
\let\pgfplots@enlargelimits@absdimension@z=\pgfutil@empty

% Called as soon as the scaling is completely set up and any
% "enlarge #1 limits={abs=1cm}"
% enlargements shall be done, i.e. enlargement by unit.
%
% #1: x,y, or z
\def\pgfplots@scaling@apply@enlargelimits@by@dimension#1{%
	\expandafter\ifx\csname pgfplots@enlargelimits@absdimension@#1\endcsname\pgfutil@empty
	\else
		\pgfplotsconvertunittocoordinate{#1}{\csname pgfplots@enlargelimits@absdimension@#1\endcsname}%
		\edef\pgfplots@loc@TMPa{%
			\noexpand\pgfplots@enlarge@limit@by@dimension{#1}
				\csname pgfplots@enlargelimits@absdimension@#1@minmax\endcsname
				{\pgfmathresult}%
		}%
		\pgfplots@loc@TMPa
	\fi
}%


% PRECONDITION:
%   1. width/height are set
%   2. the unit vectors point indicate whether the axis is a standard
%   box or some skewed plot (their precise direction and magnitude is
%   irrelevant)
%   3. the enlargelimits code has already evaluated the case
%   "enlargelimits={abs=1cm}"
%
% POSTCONDITION:
% 	width and/or height might be modified
\def\pgfplots@scaling@changewidthheight@for@enlargelimits@by@dimension{%
	\ifpgfplots@enlargelimits@respect@figure@size
		%
		% decide if we need to do anything at all, i.e. if there IS
		% some option 'enlarge * limits={abs=1cm}' :
		\pgfplots@loc@tmpfalse
		\ifx\pgfplots@enlargelimits@absdimension@x\pgfutil@empty
		\else
			\pgfplots@loc@tmptrue
		\fi
		\ifx\pgfplots@enlargelimits@absdimension@y\pgfutil@empty
		\else
			\pgfplots@loc@tmptrue
		\fi
		\ifx\pgfplots@enlargelimits@absdimension@z\pgfutil@empty
		\else
			\pgfplots@loc@tmptrue
		\fi
		%
		\ifpgfplots@loc@tmp
			\def\pgfplotsretval{}%
			% ok. We encountered an option 'enlarge * limits={abs=1cm}' for at least one axis.
			% and we WANT to keep 'width', 'height'.
			%
			% This is not quite trivial because in order to compute
			% enlarge-by-dimension, we NEED the unit vectors. But the
			% unit vectors need the limits - a nonlinear problem.
			%
			% Since this here is not really a common use-case, I
			% decided to implement a heuristics which works in most
			% common cases: for standard 2d axes. It might fail for
			% skewed axes and it will probably fail for 3d axes.
			%
			% My idea is to change width and/or height BEFORE the unit
			% vectors have been computed.
			%
			% First: check if we HAVE a standard 2d axis.
			\pgfplots@loc@tmpfalse
			\ifpgfplots@threedim
			\else
				\ifdim\pgf@xx=0sp %
				\else
					\ifdim\pgf@xy=0sp %
						\ifdim\pgf@yx=0sp %
							\ifdim\pgf@yy=0sp %
							\else
								\pgfplots@loc@tmptrue
							\fi
						\fi
					\fi
				\fi
			\fi
			%
			\ifpgfplots@loc@tmp
				\def\pgfplots@loc@TMPc{{1}{1}}%
				%
				% ah - we really *have* a standard boxed axis.
				% Compute
				% newwidth  = width - enlargevalue
				% newheight = height - enlargevalue
				%
				% newwidth will be stored in \pgfplots@loc@TMPa
				% and newheight in \pgfplots@loc@TMPb
				\ifx\pgfplots@enlargelimits@absdimension@x\pgfutil@empty
					\let\pgfplots@loc@TMPa=\pgfplots@width
				\else
					\ifx\pgfplots@enlargelimits@absdimension@x@minmax\pgfplots@loc@TMPc
						\def\pgfmathresult{2}%
					\else
						\def\pgfmathresult{1}%
					\fi
					\pgfmathparse{\pgfplots@width - \pgfmathresult * \pgfplots@enlargelimits@absdimension@x}%
					\edef\pgfplots@loc@TMPa{\pgfmathresult pt}%
				\fi
				%
				\ifx\pgfplots@enlargelimits@absdimension@y\pgfutil@empty
					\let\pgfplots@loc@TMPb=\pgfplots@height
				\else
					\ifx\pgfplots@enlargelimits@absdimension@y@minmax\pgfplots@loc@TMPc
						\def\pgfmathresult{2}%
					\else
						\def\pgfmathresult{1}%
					\fi
					\pgfmathparse{\pgfplots@height - \pgfmathresult * \pgfplots@enlargelimits@absdimension@y}%
					\edef\pgfplots@loc@TMPb{\pgfmathresult pt}%
				\fi
				%
				% OK. if( newwidth>0 && newheight>0 ), we can proceed.
				\pgfplots@loc@tmpfalse
				\ifdim\pgfplots@loc@TMPa>10pt %
					\ifdim\pgfplots@loc@TMPb>10pt %
						\pgfplots@loc@tmptrue
					\fi
				\fi
				\ifpgfplots@loc@tmp
					% Ah: newheight>0 && newheight>0 . Good.
					\let\pgfplots@width=\pgfplots@loc@TMPa
					\let\pgfplots@height=\pgfplots@loc@TMPb
				\else
					\def\pgfplotsretval{enlarge value are bigger than old picture size}%
				\fi
			\else
				\def\pgfplotsretval{size adjust is unavailable for non-standard axes}%
			\fi
			\ifx\pgfplotsretval\pgfutil@empty
			\else
				\pgfplotswarning{enlargelimits respects figure size failed}\pgfeov%
			\fi
		\fi
	\fi
}

% this here applies changes required for 'enlarge #1 limits={abs=1cm}', i.e.
% for the case of numbers with units.
%
% The main difference is that it is applied AFTER the scaling of the
% axis is complete.
%
% #1: x,y,or z
% #2: 1 if lower limit shall be changed
% #3: 1 if upper limit shall be changed
% #4: the absolute value
\def\pgfplots@enlarge@limit@by@dimension#1#2#3#4{%
	\begingroup
	% ATTENTION: this uses similar access patterns as
	% \pgfplots@enlarge@limit@ifconfigured
	\def\bool@pgfplots@loc@enlargelimits@min{#2}%
	\def\bool@pgfplots@loc@enlargelimits@max{#3}%
	%
	\let\pgfplots@enlargelimits@relthresh=\pgfutil@empty
	\def\pgfplots@enlargelimits@absthresh{#4}
	\def\pgfplots@enlargelimits@curaxis{#1}%
	%
	\def\bool@pgfplots@loc@enlargeany{0}%
	\if1\bool@pgfplots@loc@enlargelimits@min
		\def\bool@pgfplots@loc@enlargeany{1}%
	\else
		\if1\bool@pgfplots@loc@enlargelimits@max
			\def\bool@pgfplots@loc@enlargeany{1}%
		\fi
	\fi
	\if1\bool@pgfplots@loc@enlargeany
		\pgfplots@enlarge@limit@for{#1}%
	\fi
	\global\let\pgfplots@glob@TMPa=\bool@pgfplots@loc@enlargeany
	% limits assignments are made globally.
	\endgroup
	\if1\pgfplots@glob@TMPa
		\pgfplots@visphase@notify@changeofcanvaslimits{#1}%
	\fi
}


% Helper method inside of \pgfplots@enlarge@limit@ifconfigured.
%
% It modifies '#1min' and '#1max' (globally!) according to the already prepared
% booleans.
\def\pgfplots@enlarge@limit@for#1{%
	\begingroup
	\expandafter\let\expandafter\pgfplots@@min\csname pgfplots@#1min\endcsname
	\expandafter\let\expandafter\pgfplots@@max\csname pgfplots@#1max\endcsname
	\ifx\pgfplots@enlargelimits@relthresh\pgfutil@empty
		\ifx\pgfplots@enlargelimits@absthresh\pgfutil@empty
			% ups. No enlargement!? OK, can happen for 'abs=1cm' ...
			% numbers with unit are processed later (after the scaling
			% is set up)
			\pgf@xb=0pt %
		\else
			% we have an absolute enlarge value:
			\let\enlargeabsolute=\pgfplots@enlargelimits@absthresh
			\pgf@xb=\pgfplots@enlargelimits@absthresh pt
		\fi
	\else
		% we have a relative enlarge value:
		\pgfmathsubtract@\pgfplots@@max\pgfplots@@min%
		\pgf@xa=\pgfmathresult pt
		\pgf@xb=\pgfplots@enlargelimits@relthresh\pgf@xa
		\edef\enlargeabsolute{\pgf@sys@tonumber{\pgf@xb}}%
	\fi
	\ifdim\pgf@xb>0.001pt
		% the case with
		%   enlargeabsolute ~= 0
		% means that \pgfplots@@min ~= \pgfplots@@max.
		% It is handled in another method.
		%
		\if1\bool@pgfplots@loc@enlargelimits@min
			\pgfmathsubtract@\pgfplots@@min\enlargeabsolute%
			\expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
		\fi
		\if1\bool@pgfplots@loc@enlargelimits@max
			\pgfmathadd@\pgfplots@@max\enlargeabsolute%
			\expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult
		\fi
	\fi
	\endgroup
}


% Initialises the data scale transformation and applies it to any
% user specified options.
%
% PRECONDITION:
%   - all axis limits are already transformed
%   - \pgfplots@set@default@size@options has been called before
%   - the scaling transformation for direction x is set up
%   (\pgfplots@set@optimal@datatrafo@for@),
% POSTCONDITION:
%   - any user input (like ticks and tick labels)
%     EXCEPT unit vectors will reflect the changes.
%
% Unit vectors will be scaled later.
% @see \pgfplots@apply@datatrafo@to@axis@limits
\def\pgfplots@check@and@apply@datatrafo@for#1{%
	\pgfplots@if{pgfplots@apply@datatrafo@#1}{%
		% Transform axis limits: ALREADY DONE.
		%
		% 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
			\pgfplotscoordmath{#1}{datascaletrafo}{\csname pgfplots@#1tickmin\endcsname}%
			\expandafter\global\expandafter\let\csname pgfplots@#1tickmin\endcsname=\pgfmathresult
		\fi
		%
		\expandafter\ifx\csname pgfplots@#1tickmax\endcsname\pgfutil@empty
		\else
			\pgfplotscoordmath{#1}{datascaletrafo}{\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=\empty', the "No tick" command.
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\def\pgfplots@loc@TMPb{data}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				% we have #1tick = data
				\edef\pgfplots@loc@TMPa{\csname pgfplots@firstplot@coords@#1\endcsname}%
				\expandafter\pgfplotsutil@unify@short@csv@list\expandafter{\pgfplots@loc@TMPa}%
				\let\pgfplots@loc@TMPa=\pgfplotsretval
			\fi
%\message{Converting #1tick='\csname pgfplots@#1tick\endcsname'}%
			\expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\expandafter{\pgfplots@loc@TMPa}%
				{\pgfplotscoordmath{#1}{datascaletrafo}}%
				\to\pgfplots@loc@TMPc
			\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
			\edef\pgfplots@loc@TMPa{{\csname pgfplots@extra@#1tick\endcsname}}%
			\expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\pgfplots@loc@TMPa
				{\pgfplotscoordmath{#1}{datascaletrafo}}%
				\to\pgfplots@loc@TMPc
			\expandafter\let\csname pgfplots@extra@#1tick\endcsname=\pgfplots@loc@TMPc
		\fi
		%
		% Convert any minor tick lists in the same way.
		\pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPa
		\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\def\pgfplots@loc@TMPb{data}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				% we have #1tick = data
				\edef\pgfplots@loc@TMPa{\csname pgfplots@firstplot@coords@#1\endcsname}%
				\expandafter\pgfplotsutil@unify@short@csv@list\expandafter{\pgfplots@loc@TMPa}%
				\let\pgfplots@loc@TMPa=\pgfplotsretval
			\fi
			\expandafter\pgfplots@apply@data@scale@trafo@to@user@ticks\expandafter{\pgfplots@loc@TMPa}%
				{\pgfplotscoordmath{#1}{datascaletrafo}}%
				\to\pgfplots@loc@TMPc
			\pgfkeyslet{/pgfplots/minor #1tick}\pgfplots@loc@TMPc
		\fi
		%
		% Transform any explicit axis unit scalings: ALREADY DONE
	}{%
		% case apply trafo == false:
		\def\pgfplots@loc@TMPb{data}%
		\expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfplots@loc@TMPb
			\edef\pgfplots@loc@TMPa{\csname pgfplots@firstplot@coords@#1\endcsname}%
			\expandafter\pgfplotsutil@unify@short@csv@list\expandafter{\pgfplots@loc@TMPa}%
			\expandafter\let\csname pgfplots@#1tick\endcsname=\pgfplotsretval%
		\fi
		\pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPa
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\def\pgfplots@loc@TMPb{data}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				\edef\pgfplots@loc@TMPa{\csname pgfplots@firstplot@coords@#1\endcsname}%
				\expandafter\pgfplotsutil@unify@short@csv@list\expandafter{\pgfplots@loc@TMPa}%
				\pgfkeyslet{/pgfplots/minor #1tick}\pgfplotsretval
			\fi
		\fi
	}%
}

\newif\ifpgfplots@determinedefaultvalues@isuniform
\newif\ifpgfplots@determinedefaultvalues@needs@check@uniformtick
\newif\ifpgfplots@limits@are@computed

\def\pgfplots@handle@invalid@range@defaultlimits{%
	\pgfplotscoordmath{x}{parsenumber}{0}%
	\global\let\pgfplots@xmin=\pgfmathresult
	\pgfplotscoordmath{x}{parsenumber}{1}%
	\global\let\pgfplots@xmax=\pgfmathresult
	\global\let\pgfplots@data@xmin=\pgfplots@xmin
	\global\let\pgfplots@data@xmax=\pgfplots@xmax
	%
	\pgfplotscoordmath{y}{parsenumber}{0}%
	\global\let\pgfplots@ymin=\pgfmathresult
	\pgfplotscoordmath{y}{parsenumber}{1}%
	\global\let\pgfplots@ymax=\pgfmathresult
	\global\let\pgfplots@data@ymin=\pgfplots@ymin
	\global\let\pgfplots@data@ymax=\pgfplots@ymax
}
\def\pgfplots@handle@invalid@range{%
	% COMPLETELY EMPTY AXIS:
	\pgfplotswarning{empty range cleared axis}\pgfplots@loc@TMPa\pgfeov
	\pgfplots@handle@invalid@range@defaultlimits
	%
	\pgfplots@threedimfalse
	\def\pgfplots@xtick{}%
	\def\pgfplots@ytick{}%
	\def\pgfplots@extra@xtick{}%
	\def\pgfplots@extra@ytick{}%
	\def\pgfplots@xtickten{}%
	\def\pgfplots@ytickten{}%
	% clear all plots!
	\pgfplots@init@cleared@structures
}
\def\pgfplots@check@invalid@range{%
	\pgfplots@limits@are@computedtrue
	\def\pgfplots@loc@TMPa{}%
	\ifx\pgfplots@xmin\pgfplots@invalidrange@xmin
		\pgfplots@limits@are@computedfalse
		\edef\pgfplots@loc@TMPa{x}%
	\fi
	\ifx\pgfplots@xmax\pgfplots@invalidrange@xmax
		\pgfplots@limits@are@computedfalse
		\edef\pgfplots@loc@TMPa{x}%
	\fi
	\ifx\pgfplots@ymin\pgfplots@invalidrange@ymin
		\pgfplots@limits@are@computedfalse
		\edef\pgfplots@loc@TMPa{y}%
	\fi
	\ifx\pgfplots@ymax\pgfplots@invalidrange@ymax
		\pgfplots@limits@are@computedfalse
		\edef\pgfplots@loc@TMPa{y}%
	\fi
	\ifpgfplots@threedim
		\ifx\pgfplots@zmin\pgfplots@invalidrange@zmin
			\pgfplots@limits@are@computedfalse
			\edef\pgfplots@loc@TMPa{z}%
		\fi
		\ifx\pgfplots@zmax\pgfplots@invalidrange@zmax
			\pgfplots@limits@are@computedfalse
			\edef\pgfplots@loc@TMPa{z}%
		\fi
	\fi
	\ifpgfplots@limits@are@computed
		\ifx\pgfplots@data@xmin\pgfplots@invalidrange@xmin
			\global\let\pgfplots@data@xmin=\pgfplots@xmin
		\fi
		\ifx\pgfplots@data@xmin\pgfplots@invalidrange@xmax
			\global\let\pgfplots@data@xmax=\pgfplots@xmax
		\fi
		\ifx\pgfplots@data@ymin\pgfplots@invalidrange@ymin
			\global\let\pgfplots@data@ymin=\pgfplots@ymin
		\fi
		\ifx\pgfplots@data@ymin\pgfplots@invalidrange@ymax
			\global\let\pgfplots@data@ymax=\pgfplots@ymax
		\fi
		\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@x
		\else
			% there is a rare change that min > max.
			% Handle that ...
			\pgfplotscoordmath{x}{min}{\pgfplots@xmin}{\pgfplots@xmax}%
			\global\let\pgfplots@xmin=\pgfmathresult
			\pgfplotscoordmath{x}{max}{\pgfplots@xmin}{\pgfplots@xmax}%
			\global\let\pgfplots@xmax=\pgfmathresult
		\fi
		\ifpgfplots@clip@limits@y
		\else
			%
			\pgfplotscoordmath{y}{min}{\pgfplots@ymin}{\pgfplots@ymax}%
			\global\let\pgfplots@ymin=\pgfmathresult
			\pgfplotscoordmath{y}{max}{\pgfplots@ymin}{\pgfplots@ymax}%
			\global\let\pgfplots@ymax=\pgfmathresult
		\fi
		\ifpgfplots@clip@limits@z
		\else
			%
			\ifpgfplots@threedim
				\pgfplotscoordmath{z}{min}{\pgfplots@zmin}{\pgfplots@zmax}%
				\global\let\pgfplots@zmin=\pgfmathresult
				\pgfplotscoordmath{z}{max}{\pgfplots@zmin}{\pgfplots@zmax}%
				\global\let\pgfplots@zmax=\pgfmathresult
			\fi
		\fi
	\else
		\pgfplots@handle@invalid@range
	\fi
}%


% 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
	%
%\message{untransformed: x = [\pgfplots@xmin:\pgfplots@xmax]  y = [\pgfplots@ymin:\pgfplots@ymax]. }%
	%
	%
	\pgfplots@set@default@size@options
	%
	\ifpgfplots@threedim
		\pgfplotsthreedimtrue
	\else
		\pgfplotsthreedimfalse
	\fi
	%
	\pgfplots@set@optimal@datatrafos@allaxes
	%
	% Now, the data scaling has been set up.
	% However, it may need to be changed if axis equal and/or unit
	% vector ratio changes the axis limits considerably. If so, it
	% will be done in \pgfplots@initsizes
	\pgfplots@apply@datatrafo@to@axis@limits x%
	\pgfplots@apply@datatrafo@to@axis@limits y%
	\ifpgfplots@threedim
		\pgfplots@apply@datatrafo@to@axis@limits z%
	\fi
	%
	\pgfplots@datascaletrafo@initialisedtrue
%\message{transformed: x = [\pgfplots@xmin:\pgfplots@xmax]  y = [\pgfplots@ymin:\pgfplots@ymax].}%
	%
	% From now on, we can always work with pgfmath.
	% We simply need to apply the data scaling trafo before doing so.
	\pgfplots@enlarge@limit@ifconfigured x
	\pgfplots@avoid@empty@axis@range@for x%
	%
	\pgfplots@enlarge@limit@ifconfigured y
	\pgfplots@avoid@empty@axis@range@for y%

	\ifpgfplots@threedim
		\pgfplots@enlarge@limit@ifconfigured z
		\pgfplots@avoid@empty@axis@range@for z%
	\fi
	%
	\pgfplots@initsizes
	%
	\pgfplots@check@and@apply@datatrafo@for x%
	\pgfplots@check@and@apply@datatrafo@for y%
	\ifpgfplots@threedim
		\pgfplots@check@and@apply@datatrafo@for z%
	\fi
	% clear structure:
	\global\let\pgfplots@firstplot@coords@x=\pgfutil@empty
	\global\let\pgfplots@firstplot@coords@y=\pgfutil@empty
	\global\let\pgfplots@firstplot@coords@z=\pgfutil@empty
	%
	\pgfplots@limits@ready
	%
	\pgfplots@set@options@after@survey1%
	%
	\pgfplotspoint@initialisation
	%
	%
	\pgfplots@BEGIN@prepare@description@styles
	%
	%
	\pgfplots@init@ticks@for x%
	\pgfplots@init@ticks@for y%
	\ifpgfplots@threedim
		\pgfplots@init@ticks@for z%
	\fi
	\pgfplots@init@ticks@ready
	%
	%
	\pgfplots@prepare@ZERO@coordinates
	%
	\pgfplots@decide@which@figure@surfaces@are@drawn
	\pgfplots@init@ticklabelaxisspec
	%
	\pgfplots@define@threedim@marks
	%
	\pgfplots@clippath@prepare
	%
	\pgfplots@ticklabel@maxtickdimen@reset x%
	\pgfplots@ticklabel@maxtickdimen@reset y%
	\pgfplots@ticklabel@maxtickdimen@reset z%
	%
	\pgfplots@init@axis@shift
}

% executes '#2' if 'axis #1 line shift' is set and '#3' if not.
\def\pgfplots@if@has@axis@shift#1#2#3{%
	\pgfkeysgetvalue{/pgfplots/axis #1 line shift}\pgfplots@loc@TMPb
	\ifx\pgfplots@loc@TMPb\pgfutil@empty
		#3%
	\else
		#2%
	\fi
}%

\def\pgfplots@init@axis@shift{%
	\pgfplotsforeachentryinCSV{\pgfplots@loc@TMPa}{x,y,z}{%
		% check if 'axis #1 line shift' is set and non-zero.
		\expandafter\pgfplots@if@has@axis@shift\pgfplots@loc@TMPa{%
			\pgfkeysgetvalue{/pgfplots/axis \pgfplots@loc@TMPa\space line shift}\pgfplots@loc@TMPb
			\pgfmathparse{\pgfplots@loc@TMPb}%
			\ifdim\pgfmathresult pt=0pt
				\def\pgfplots@loc@TMPb{}%
			\else
				\ifpgfmathunitsdeclared
				\else
					\ifpgfplots@threedim
						% ... I do not know which axis unit should be
						% used here.
						\pgfplots@error{Cannot process 'axis \pgfplots@loc@TMPa\space line shift=\pgfplots@loc@TMPb': please provide a dimension like 10pt. Shifting by axis units is only implemented for 2d axes}%
					\else
						% Ah - a shift by axis units.
						% Ok, then determine the correct axis and
						% compute the shift.
						%
						% This works because the outer normal is the
						% same as one of the axes.
						\let\pgfplots@loc@TMPb=\pgfmathresult
						\if x\pgfplots@loc@TMPa
							\pgfplotstransformdirectiony{\pgfplots@loc@TMPb}%
							\let\pgfplots@loc@TMPb=\pgfmathresult
							\pgfplotsqpointxy{0}{\pgfplots@loc@TMPb}%
						\else
							\pgfplotstransformdirectionx{\pgfplots@loc@TMPb}%
							\let\pgfplots@loc@TMPb=\pgfmathresult
							\pgfplotsqpointxy{\pgfplots@loc@TMPb}{0}%
						\fi
						\pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}%
						\ifdim\pgfplots@loc@TMPb pt<0sp
							% we have lost the sign... restore it.
							\edef\pgfmathresult{-\pgfmathresult}%
						\fi
					\fi
				\fi
				%
				\edef\pgfplots@loc@TMPb{\pgfmathresult}% NO unit here
				\if z\pgfplots@loc@TMPa
					\ifpgfplots@threedim
						\pgfplots@separate@axis@linestrue
					\fi
				\else
					\pgfplots@separate@axis@linestrue
				\fi
			\fi
			%
			% normalize the value - no need to parse it over and over again:
			\pgfkeyslet{/pgfplots/axis \pgfplots@loc@TMPa\space line shift}\pgfplots@loc@TMPb
		}{}%
	}%
}%

\def\pgfplots@init@ticks@ready{}%
\def\pgfplots@init@ticks@for#1{%
	\pgfplots@isuniformticktrue
	\pgfplots@determinedefaultvalues@needs@check@uniformticktrue
	\expandafter\ifx\csname pgfplots@#1tick\endcsname\pgfutil@empty
		\pgfplots@assign@default@tick@foraxis{#1}%
	\fi
	\ifpgfplots@determinedefaultvalues@needs@check@uniformtick
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname
		\edef\pgfplots@loc@TMPb{\pgfplots@loc@TMPa}%
		\ifx\pgfplots@loc@TMPb\pgfutil@empty
			% there are no ticks left.
			\pgfplots@isuniformtickfalse
		\else
			\pgfplots@if{pgfplots@#1islinear}{%
				\def\pgfplots@loc@TMPb{\expandafter\pgfplots@checkisuniformLINEARtick\expandafter{\pgfplots@loc@TMPa}}%
				\expandafter\pgfplots@loc@TMPb\csname pgfplots@tick@distance@#1\endcsname%
			}{%
				\expandafter\pgfplots@checkisuniformLOGtick\expandafter{\pgfplots@loc@TMPa}%
			}%
		\fi
	\fi
	\pgfplots@check@for@minor@ticks{#1}%
	\ifpgfplots@isuniformtick
	\else
		\pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPb
		\ifx\pgfplots@loc@TMPb\pgfutil@empty
			\csname pgfplots@#1minorticksfalse\endcsname
			\csname pgfplots@#1minorgridsfalse\endcsname
		\fi
	\fi
	%
	\expandafter\ifx\csname pgfplots@#1ticklabel\endcsname\pgfutil@empty
		\pgfplots@if{pgfplots@#1islinear}{%
			\expandafter\def\csname pgfplots@#1ticklabel\endcsname{\axisdefaultticklabel}%
		}{%
			\expandafter\def\csname pgfplots@#1ticklabel\endcsname{\axisdefaultticklabellog}%
		}%
	\fi
	\expandafter\ifx\csname pgfplots@extra@#1ticklabel\endcsname\pgfutil@empty
		\pgfutil@namelet{pgfplots@loc@TMPa}{pgfplots@#1ticklabel}%
		\pgfutil@namelet{pgfplots@loc@TMPb}{pgfplots@user@ticklabel@list@#1}%
		\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			% Ah - someone used '#1ticklabels' (or its friends).
			% these are bound to specific positions and make no sense in this context.
			\pgfplots@if{pgfplots@#1islinear}{%
				\expandafter\def\csname pgfplots@extra@#1ticklabel\endcsname{\axisdefaultticklabel}%
			}{%
				\expandafter\def\csname pgfplots@extra@#1ticklabel\endcsname{\axisdefaultticklabellog}%
			}%
		\else
			% inherit the global argument of '#1ticklabel' -- it will probably contain generic code to
			% typeset labels at any positions.
			% The "probably" is a buest-guess, though...
			\pgfutil@namelet{pgfplots@extra@#1ticklabel}{pgfplots@#1ticklabel}%
		\fi
	\fi
	%
	\if0\csname pgfplots@#1axislinesnum\endcsname\else
		% axis x line* != box
		\expandafter\let\csname pgfplots@#1ticklabel@pos\endcsname=\pgfutil@empty
	\fi
	\expandafter\ifx\csname pgfplots@#1ticklabel@pos\endcsname\pgfutil@empty
		\expandafter\def\csname pgfplots@#1ticklabel@pos\endcsname{%
			\if3\csname pgfplots@#1tickposnum\endcsname% right
				u%
			\else
				l%
			\fi
		}%
	\fi
}%

\def\pgfplots@check@for@minor@ticks#1{%
	\pgfkeysgetvalue{/pgfplots/minor #1 tick num}\pgfplots@loc@TMPa
	\pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPb
	\pgfplots@if{pgfplots@#1islinear}{%
		\ifnum\pgfplots@loc@TMPa=0\relax
			\ifx\pgfplots@loc@TMPb\pgfutil@empty
				\csname pgfplots@#1minorticksfalse\endcsname
				\csname pgfplots@#1minorgridsfalse\endcsname
			\fi
		\else
			\csname pgfplots@#1minortickstrue\endcsname
		\fi
	}{%
	}%
	\ifx\pgfplots@loc@TMPb\pgfutil@empty
	\else
		\csname pgfplots@#1minortickstrue\endcsname
	\fi
}

% Invoked as soon as all axis limits are ready and final (in TeX
% number range, all data scaling is applied at this point).
\def\pgfplots@limits@ready{%
	\pgfplots@limits@ready@tostring{x}{min}%
	\pgfplots@limits@ready@tostring{x}{max}%
	\pgfplots@limits@ready@tostring{y}{min}%
	\pgfplots@limits@ready@tostring{y}{max}%
	\ifpgfplots@threedim
		\pgfplots@limits@ready@tostring{z}{min}%
		\pgfplots@limits@ready@tostring{z}{max}%
	\fi
}%

% write a limit into /pgfplots/#1#2
% #1: either x,y or z
% #2: either 'min' or 'max'
%
% \pgfplots@limits@ready@tostring{x}{min}
\def\pgfplots@limits@ready@tostring#1#2{%
	\pgfplots@if{pgfplots@apply@datatrafo@#1}{%
		\pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1#2\endcsname}%
	}{%
		\edef\pgfmathresult{\csname pgfplots@#1#2\endcsname}%
	}%
	\pgfplotscoordmath{#1}{tostring}{\pgfmathresult}%
	\pgfkeyslet{/pgfplots/#1#2}\pgfmathresult
	% this runs \pgfkeyslet{/pgfplots/xmin}\pgfmathresult
}%


\newif\ifpgfplots@avoid@emptyrange@@range@is@approx@equal
% Checks whether axis limits in coordinate #1 are approximately equal.
%
% If that is the case, force a non-zero width of the range.
%
\def\pgfplots@avoid@empty@axis@range@for#1{%
	% Check if axis limits are empty:
	\begingroup
	\expandafter\let\expandafter\if@cur@is@scaled\csname ifpgfplots@apply@datatrafo@#1\endcsname
	\expandafter\let\expandafter\pgfplots@@min\csname pgfplots@#1min\endcsname
	\expandafter\let\expandafter\pgfplots@@max\csname pgfplots@#1max\endcsname
	\let\min@d=\pgf@xa
	\let\max@d=\pgf@xb
	\let\diff=\pgf@xc
	\expandafter\min@d\pgfplots@@min pt %
	\expandafter\max@d\pgfplots@@max pt %
	\diff=\max@d
	\advance\diff by-\min@d
	% FIXME : I need a RELATIVE check here!
	% but: real number point division is expensive
	\if@cur@is@scaled
		% this here should be sufficient because the axis
		% has absolute values of order O( 10^3 ) or so.
		\ifdim\diff<0.0001pt
			\pgfplots@avoid@emptyrange@@range@is@approx@equaltrue
		\fi
	\else
		% there is no data scaling, so I should be much more defensive
		% with absolute thresholds...
		\ifdim\diff<0.0001pt
			\pgfplots@avoid@emptyrange@@range@is@approx@equaltrue
		\fi
	\fi
	\ifpgfplots@avoid@emptyrange@@range@is@approx@equal
		\begingroup
		\pgfplotscoordmath{#1}{datascaletrafo inverse to fixed}{\csname pgfplots@#1min\endcsname}%
		\let\pgfplots@min=\pgfmathresult
		\pgfplotscoordmath{#1}{datascaletrafo inverse to fixed}{\csname pgfplots@#1max\endcsname}%
		\let\pgfplots@max=\pgfmathresult
		\pgfplotswarning{approx empty range enlarged}{#1}{\pgfplots@min}{\pgfplots@max}\pgfeov
		\endgroup
		% the case \pgfplots@@min ~= \pgfplots@@max
		%
		% enlarge \pgfplots@@max and shrink \min:
		\ifdim\max@d<0pt%
			\ifdim\max@d<-1pt%
				\max@d=0.8\max@d
				\min@d=1.2\min@d
			\else
				\advance\max@d by-1pt%
				\advance\min@d by1pt%
			\fi
		\else
			\ifdim\max@d>1pt%
				\max@d=1.2\max@d
				\min@d=0.8\min@d
			\else
				\ifdim\max@d=0pt%
					\if@cur@is@scaled
						\expandafter\let\expandafter\min@unscaled\csname pgfplots@#1min@unscaled@as@float\endcsname
						\expandafter\let\expandafter\max@unscaled\csname pgfplots@#1max@unscaled@as@float\endcsname
						% **sigh**. That's really work.
						%
						% This here happens ALWAYS if min == max for
						% linear axis because the scaling
						% transformation will result in T(min) = T(max) = 0
						%
						% -> we need to enlarge limits in floating
						%  point arithmetics.
						%
						\pgfplotscoordmath{#1}{parsenumber}{0}%
						\let\pgfplotsmath@zero=\pgfmathresult
						%
						\ifx\max@unscaled\pgfplotsmath@zero
							% max == 0
							\pgfplotscoordmath{#1}{parsenumber}{1}%
							\let\max@unscaled=\pgfmathresult
							\pgfplotscoordmath{#1}{parsenumber}{-1}%
							\let\min@unscaled=\pgfmathresult
						\else
							%
							\pgfplotscoordmath{#1}{parsenumber}{1.2}%
							\let\pgfplotsmath@scalea=\pgfmathresult
							\pgfplotscoordmath{#1}{parsenumber}{8e-1}%
							\let\pgfplotsmath@scaleb=\pgfmathresult
							%
							\pgfplotscoordmath{#1}{if less than}
								{\pgfplotsmath@zero}{\max@unscaled}%
								{%
									% 0 < max
									\pgfplotscoordmath{#1}{op}{multiply}
										{{\max@unscaled}{\pgfplotsmath@scalea}}%
									\let\max@unscaled=\pgfmathresult
									\pgfplotscoordmath{#1}{op}{multiply}
										{{\min@unscaled}{\pgfplotsmath@scaleb}}%
									\let\min@unscaled=\pgfmathresult
								}%
								{%
									\pgfplotscoordmath{#1}{op}{multiply}
										{{\max@unscaled}{\pgfplotsmath@scaleb}}%
									\let\max@unscaled=\pgfmathresult
									\pgfplotscoordmath{#1}{op}{multiply}
										{{\min@unscaled}{\pgfplotsmath@scalea}}%
									\let\min@unscaled=\pgfmathresult
								}%
						\fi
						\pgfplotscoordmath{#1}{datascaletrafo}{\min@unscaled}%
						\let\pgfplots@@min=\pgfmathresult
						\pgfplotscoordmath{#1}{datascaletrafo}{\max@unscaled}%
						\let\pgfplots@@max=\pgfmathresult
						\min@d=\pgfplots@@min pt
						\max@d=\pgfplots@@max pt
					\else
						\advance\max@d by1pt
						\advance\min@d by-1pt
					\fi
				\else
					\advance\max@d by1pt
					\advance\min@d by-1pt
				\fi
			\fi
		\fi
		\xdef\pgfplots@glob@TMPa{\pgf@sys@tonumber{\min@d}}%
		\xdef\pgfplots@glob@TMPb{\pgf@sys@tonumber{\max@d}}%
%\pgfplots@message{ -> #1 = \pgfplots@glob@TMPa : \pgfplots@glob@TMPb;}%
	\else
		\global\let\pgfplots@glob@TMPa=\pgfplots@@min%
		\global\let\pgfplots@glob@TMPb=\pgfplots@@max%
	\fi
	\endgroup
	\expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfplots@glob@TMPa
	\expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfplots@glob@TMPb
}


% should be invoked whenever \pgfplots@#1min or \pgfplots@#1max have
% been changed during the visualization phase (for example, axis equal
% or enlargelimits)
\def\pgfplots@visphase@notify@changeofcanvaslimits#1{%
	\csname pgfplots@#1min@reg\endcsname=\csname pgfplots@#1min\endcsname pt %
	\csname pgfplots@#1max@reg\endcsname=\csname pgfplots@#1max\endcsname pt %
	\pgfplots@if{pgfplots@apply@datatrafo@#1}{%
		\pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1min\endcsname}%
		\expandafter\let\csname pgfplots@#1min@unscaled@as@float\endcsname=\pgfmathresult
		\pgfplotscoordmath{#1}{datascaletrafo inverse}{\csname pgfplots@#1max\endcsname}%
		\expandafter\let\csname pgfplots@#1max@unscaled@as@float\endcsname=\pgfmathresult
	}{}%
}%

% Invokes #3 if ||D_#1||_CANVAS  < ||D_#2||_CANVAS  and #4 if that is not the case.
% Here D_x = (1,0,0) , D_y = (0,1,0) and D_z=(0,0,1).
%
% Due to the data scaling transformation,
% ||D_a|| = || T(1) * e_a||
% where e_x, e_y, e_z are the lowlevel, transformed unit vectors.
% We have
% ||D_a|| = T(1) * veclen_a.
% Note that the shift in T is not of interest, we only deal with
% T_a(x) = 10^{s_a} x.
%
% Thus, this routine invokes #3 if
% ( 10^{s1} * veclen1 < 10^{s2} * veclen2 )
%   <=>
% ( 10^{s1-s2} * veclen1 < veclen2 ).
%
% Here s1/s2 are the respective scales of the data scaling
% transformation.
%
% 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
%\message{[comparison: [#1] < [#2]: 10^\pgfplots@loc@TMPa\space * \csname pgfplots@#1@veclength\endcsname < 10^\pgfplots@loc@TMPb\space * \csname pgfplots@#2@veclength\endcsname]^^J}%
	\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
}%


\def\pgfplots@low@level@shape@INNER@define{%
	\anchor{image}{\pgfpointorigin}%
	%
	%
	\anchor{center}{\pgfplotsqpointdescriptionxy{0.5}{0.5}}%
	\anchor{north}{\pgfplotsqpointdescriptionxy{0.5}{1}}%
	\anchor{north east}{\pgfplotsqpointdescriptionxy{1}{1}}%
	\anchor{east}{\pgfplotsqpointdescriptionxy{1}{0.5}}
	\anchor{south east}{\pgfplotsqpointdescriptionxy{1}{0}}%
	\anchor{south}{\pgfplotsqpointdescriptionxy{0.5}{0}}%
	\anchor{south west}{\pgfplotsqpointdescriptionxy{0}{0}}%
	\anchor{west}{\pgfplotsqpointdescriptionxy{0}{0.5}}%
	\anchor{north west}{\pgfplotsqpointdescriptionxy{0}{1}}%
	%%
	\anchor{origin}{\pgfplotspointaxisorigin}%
	\anchor{above origin}{%
		\pgfpointintersectionoflines
			{\pgfplotspointaxisorigin}
			{\pgfpointadd
				{\pgfplotspointaxisorigin}%
				{\pgfplotspointyaxis
				 \pgfplots@assert@not@zero{\pgf@y}{y axis has eyy=0; cannot compute above origin anchor}%
			    }%
			}%
			{\pgfplotsqpointdescriptionxy{0}{1}}
			{\pgfplotsqpointdescriptionxy{1}{1}}%
	}%
	\anchor{left of origin}{%
		\pgfpointintersectionoflines
			{\pgfplotspointaxisorigin}
			{\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointxaxis}}
			{\pgfplotsqpointdescriptionxy{0}{0}}
			{\pgfplotsqpointdescriptionxy{0}{1}}%
	}%
	\anchor{right of origin}{%
		\pgfpointintersectionoflines
			{\pgfplotspointaxisorigin}
			{\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointxaxis}}
			{\pgfplotsqpointdescriptionxy{1}{0}}
			{\pgfplotsqpointdescriptionxy{1}{1}}%
	}%
	\anchor{below origin}{%
		\pgfpointintersectionoflines
			{\pgfplotspointaxisorigin}
			{\pgfpointadd{\pgfplotspointaxisorigin}{\pgfplotspointyaxis}}
			{\pgfplotsqpointdescriptionxy{0}{0}}
			{\pgfplotsqpointdescriptionxy{1}{0}}%
	}%
}

% This here is a low-weight node. It can ONLY be used during axis
% descriptions and is completely useless otherwise.
%
% See pgfplots@low@level@shape below.
\pgfdeclareshape{pgfplots@low@level@shape@INNER}{%
	\nodeparts{image}%
	%%
	%%
	\pgfplots@low@level@shape@INNER@define
	%%
	%%
	\anchorborder{}%
	\backgroundpath{}%
	\foregroundpath{}%
	\behindbackgroundpath{}%
	\beforebackgroundpath{}%
	\behindforegroundpath{}%
	\beforeforegroundpath{}%
}

% This is the main axis shape.
%
% It has one node part, which is the complete image. It provides a lot
% of anchors.
\pgfdeclareshape{pgfplots@low@level@shape}{%
	% The '(0,0)' point is the LOWER LEFT OUTER CORNER.
	\savedanchor\upperrightcorner{%
		\pgfplotspointupperrightcorner
	}%
	\savedanchor\lowerleftinnercorner{%
		\pgfplotspointlowerleftinnercorner%
	}%
	\savedanchor\innerdiagonal{\pgfplotspointbbdiagonal}%
	\savedanchor\origin{%
		\pgfplotspointaxisorigin
	}%
	%
	\nodeparts{image}%
	\anchor{image}{%
		\global\pgf@x=0pt %
		\global\pgf@y=0pt %
	}%
	%
	\anchor{center}{%
		\pgfpointadd
			{\lowerleftinnercorner}%
			{\pgfpointscale
				{0.5}
				{\innerdiagonal}}%
	}%
	\anchor{north}{%
		\pgfpointadd
			{\lowerleftinnercorner}
			{\innerdiagonal\global\divide\pgf@x by2 }%
	}%
	\anchor{north east}{%
		\pgfpointadd
			\lowerleftinnercorner
			\innerdiagonal
	}%
	\anchor{east}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\divide\pgf@y by2 }%
	}%
	\anchor{south east}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@y=0sp }%
	}%
	\anchor{south}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\divide\pgf@x by2 \global\pgf@y=0sp }%
	}%
	\anchor{south west}{\lowerleftinnercorner}%
	\anchor{west}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@x=0sp \global\divide\pgf@y by2 }%
	}
	\anchor{north west}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@x=0sp }%
	}%
	%%
	\anchor{origin}{%
		\origin
	}%
	\anchor{above origin}{%
		\pgfpointintersectionoflines
			{\origin}
			{\pgfpointadd{\origin}{%
					\innerdiagonal\global\pgf@x=0sp
					 \pgfplots@assert@not@zero{\pgf@y}{y axis has eyy=0; cannot compute above origin anchor}%
				}%
			}%
			{\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@x=0sp }}
			{\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}%
	}%
	\anchor{left of origin}{%
		\pgfpointintersectionoflines
			{\origin}
			{\pgfpointadd{\origin}{\innerdiagonal\global\multiply\pgf@x by-1 \global\pgf@y=0sp }}
			{\lowerleftinnercorner}
			{\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@x=0sp }}%
	}%
	\anchor{right of origin}{%
		\pgfpointintersectionoflines
			{\origin}
			{\pgfpointadd{\origin}{\innerdiagonal\global\pgf@y=0sp }}
			{\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@y=0sp }}
			{\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal}}%
	}%
	\anchor{below origin}{%
		\pgfpointintersectionoflines
			{\origin}
			{\pgfpointadd{\origin}{\innerdiagonal\global\pgf@x=0sp \global\multiply\pgf@y by-1 }}
			{\lowerleftinnercorner}
			{\pgfpointadd{\lowerleftinnercorner}{\innerdiagonal\global\pgf@y=0sp }}%
	}%
	%
	%%
	%
	\anchor{outer north}{%
		\upperrightcorner
		\global\pgf@x=.5\pgf@x
	}%
	\anchor{outer north east}{\upperrightcorner}%
	\anchor{outer east}{%
		\upperrightcorner
		\global\pgf@y=.5\pgf@y
	}%
	\anchor{outer south east}{%
		\upperrightcorner
		\global\pgf@y=0pt
	}%
	\anchor{outer south}{%
		\upperrightcorner
		\global\pgf@x=.5\pgf@x
		\global\pgf@y=0pt
	}%
	\anchor{outer south west}{%
		\global\pgf@x=0pt
		\global\pgf@y=0pt
	}%
	\anchor{outer west}{%
		\upperrightcorner
		\global\pgf@x=0pt
		\global\pgf@y=.5\pgf@y
	}%
	\anchor{outer north west}{%
		\upperrightcorner
		\global\pgf@x=0pt
	}%
	\anchor{outer center}{%
		\upperrightcorner
		\global\pgf@x=.5\pgf@x
		\global\pgf@y=.5\pgf@y
	}%
	%
	%
	%%
	%%
	\anchor{above north}{%
		\upperrightcorner
		\pgfutil@tempdima=\pgf@y
		\pgfpointadd
			{\lowerleftinnercorner}
			{\innerdiagonal\divide\pgf@x by2 }%
		\global\pgf@y=\pgfutil@tempdima
	}%
	\anchor{above north east}{%
		\upperrightcorner
		\pgfutil@tempdima=\pgf@y
		\pgfpointadd
			\lowerleftinnercorner
			\innerdiagonal
		\global\pgf@y=\pgfutil@tempdima
	}%
	\anchor{right of north east}{%
		\upperrightcorner
		\pgfutil@tempdima=\pgf@x
		\pgfpointadd
			\lowerleftinnercorner
			\innerdiagonal
		\global\pgf@x=\pgfutil@tempdima
	}%
	\anchor{right of east}{%
		\upperrightcorner
		\pgfutil@tempdima=\pgf@x
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\divide\pgf@y by2 }%
		\global\pgf@x=\pgfutil@tempdima
	}%
	\anchor{right of south east}{%
		\upperrightcorner
		\pgfutil@tempdima=\pgf@x
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@y=0sp }%
		\global\pgf@x=\pgfutil@tempdima
	}%
	\anchor{below south east}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@y=0sp }%
		\global\pgf@y=0pt
	}%
	\anchor{below south}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\divide\pgf@x by2 \global\pgf@y=0sp }%
		\pgf@y=0pt
	}%
	\anchor{below south west}{%
		\lowerleftinnercorner
		\global\pgf@y=0pt
	}%
	\anchor{left of south west}{%
		\lowerleftinnercorner
		\global\pgf@x=0pt
	}%
	\anchor{left of west}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@x=0sp \global\divide\pgf@y by2 }%
		\global\pgf@x=0pt
	}%
	\anchor{left of north west}{%
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@x=0sp }%
		\global\pgf@x=0pt
	}%
	\anchor{above north west}{%
		\upperrightcorner
		\pgfutil@tempdima=\pgf@y
		\pgfpointadd
			\lowerleftinnercorner
			{\innerdiagonal\global\pgf@x=0sp }%
		\global\pgf@y=\pgfutil@tempdima
	}%
	%%
	%%
	\anchorborder{%
		% remember the input coords:
		\edef\pgfplots@loc@TMPa{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
		%
		% I want to use \pgfpointborderrectangle which expects that
		% (0,0) is the CENTER.
		% Ok, then: shift it:
		\pgfpointadd
			{\lowerleftinnercorner}%
			{\pgfpointscale
				{0.5}
				{\innerdiagonal}}%
		\edef\pgfplots@loc@center{\pgf@x=\the\pgf@x\space\pgf@y=\the\pgf@y\space}%
		\pgfpointadd{%
			\pgfpointborderrectangle%
				{\pgfplots@loc@TMPa}%
				{\pgfpointscale
				{0.5}
				{\innerdiagonal}}%
		}{%
			% and add the center to undo the local shift:
			\pgfplots@loc@center
		}%
	}%
	\backgroundpath{%
		\pgfkeysvalueof{/pgfplots/@backgroundpath@hook/.@cmd}\pgfeov
		\pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}%
	}%
	\foregroundpath{}%
	\behindbackgroundpath{}%
	\beforebackgroundpath{}%
	\behindforegroundpath{}%
	\beforeforegroundpath{}%
}

\def\pgfplots@restore@deprecated@lowlevel@shape{%
	\pgfutil@ifundefined{pgfplots@low@level@shape@deprecated@isdefined}{%
	\gdef\pgfplots@low@level@shape@deprecated@isdefined{1}%
	%
	% all these assignments are global, so it is save to call this
	% macro inside of scopes:
	\pgfdeclareshape{pgfplots@low@level@shape@deprecated}{%
		% The '(0,0)' point is the LOWER LEFT OUTER CORNER.
		\savedanchor\upperrightcorner{
			% FIXME : is this correct?
			\pgfplotspointupperrightcorner
			%\global\pgf@x=\wd\pgfnodepartimagebox
			%\global\pgf@y=\ht\pgfnodepartimagebox
		}%
		\savedanchor\lowerleftinnercorner{%
			\pgfplotspointlowerleftinnercorner%
		}%
		\savedanchor\xaxisvec{\pgfplotspointxaxis}%
		\savedanchor\yaxisvec{\pgfplotspointyaxis}%
		\savedanchor\origin{%
			\pgfplotspointaxisorigin
		}%
		%
		\nodeparts{image}%
		\anchor{image}{%
			\global\pgf@x=0pt %
			\global\pgf@y=0pt %
		}%
		%
		%
		\anchor{center}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointscale{0.5}{\pgfpointadd{\xaxisvec}{\yaxisvec}}}%
		}%
		\anchor{north}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}%
		}%
		\anchor{north east}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointadd{\yaxisvec}{\xaxisvec}}%
		}%
		\anchor{east}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}%
		}%
		\anchor{south east}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\xaxisvec}%
		}%
		\anchor{south}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointscale{0.5}{\xaxisvec}}%
		}%
		\anchor{south west}{\lowerleftinnercorner}%
		\anchor{west}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointscale{0.5}{\yaxisvec}}%
		}%
		\anchor{north west}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\yaxisvec}%
		}%
		%%
		\anchor{origin}{%
			\origin
		}%
		\anchor{above origin}{%
			\pgfpointintersectionoflines
				{\origin}
				{\pgfpointadd{\origin}{\yaxisvec}}
				{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}
				{\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}{\xaxisvec}}%
		}%
		\anchor{left of origin}{%
			\pgfpointintersectionoflines
				{\origin}
				{\pgfpointadd{\origin}{\pgfpointscale{-1}{\xaxisvec}}}
				{\lowerleftinnercorner}
				{\pgfpointadd{\lowerleftinnercorner}{\yaxisvec}}%
		}%
		\anchor{right of origin}{%
			\pgfpointintersectionoflines
				{\origin}
				{\pgfpointadd{\origin}{\xaxisvec}}
				{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}
				{\pgfpointadd{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}{\yaxisvec}}%
		}%
		\anchor{below origin}{%
			\pgfpointintersectionoflines
				{\origin}
				{\pgfpointadd{\origin}{\pgfpointscale{-1}{\yaxisvec}}}
				{\lowerleftinnercorner}
				{\pgfpointadd{\lowerleftinnercorner}{\xaxisvec}}%
		}%
		%
		%%
		%
		\anchor{outer north}{%
			\upperrightcorner
			\global\pgf@x=.5\pgf@x
		}%
		\anchor{outer north east}{\upperrightcorner}%
		\anchor{outer east}{%
			\upperrightcorner
			\global\pgf@y=.5\pgf@y
		}%
		\anchor{outer south east}{%
			\upperrightcorner
			\global\pgf@y=0pt
		}%
		\anchor{outer south}{%
			\upperrightcorner
			\global\pgf@x=.5\pgf@x
			\global\pgf@y=0pt
		}%
		\anchor{outer south west}{%
			\global\pgf@x=0pt
			\global\pgf@y=0pt
		}%
		\anchor{outer west}{%
			\upperrightcorner
			\global\pgf@x=0pt
			\global\pgf@y=.5\pgf@y
		}%
		\anchor{outer north west}{%
			\upperrightcorner
			\global\pgf@x=0pt
		}%
		\anchor{outer center}{%
			\upperrightcorner
			\global\pgf@x=.5\pgf@x
			\global\pgf@y=.5\pgf@y
		}%
		%
		%
		%%
		%%
		\anchor{above north}{%
			\upperrightcorner
			\pgfutil@tempdima=\pgf@y
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointadd{\yaxisvec}{\pgfpointscale{0.5}{\xaxisvec}}}%
			\global\pgf@y=\pgfutil@tempdima
		}%
		\anchor{above north east}{%
			\upperrightcorner
			\pgfutil@tempdima=\pgf@y
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointadd{\yaxisvec}{\xaxisvec}}%
			\global\pgf@y=\pgfutil@tempdima
		}%
		\anchor{right of north east}{%
			\upperrightcorner
			\pgfutil@tempdima=\pgf@x
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointadd{\yaxisvec}{\xaxisvec}}%
			\global\pgf@x=\pgfutil@tempdima
		}%
		\anchor{right of east}{%
			\upperrightcorner
			\pgfutil@tempdima=\pgf@x
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointadd{\xaxisvec}{\pgfpointscale{0.5}{\yaxisvec}}}%
			\global\pgf@x=\pgfutil@tempdima
		}%
		\anchor{right of south east}{%
			\upperrightcorner
			\pgfutil@tempdima=\pgf@x
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\xaxisvec}%
			\global\pgf@x=\pgfutil@tempdima
		}%
		\anchor{below south east}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\xaxisvec}%
			\global\pgf@y=0pt
		}%
		\anchor{below south}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointscale{0.5}{\xaxisvec}}%
			\global\pgf@y=0pt
		}%
		\anchor{below south west}{%
			\lowerleftinnercorner
			\global\pgf@y=0pt
		}%
		\anchor{left of south west}{%
			\lowerleftinnercorner
			\global\pgf@x=0pt
		}%
		\anchor{left of west}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\pgfpointscale{0.5}{\yaxisvec}}%
			\global\pgf@x=0pt
		}%
		\anchor{left of north west}{%
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\yaxisvec}%
			\global\pgf@x=0pt
		}%
		\anchor{above north west}{%
			\upperrightcorner
			\pgfutil@tempdima=\pgf@y
			\pgfpointadd
				{\lowerleftinnercorner}%
				{\yaxisvec}%
			\global\pgf@y=\pgfutil@tempdima
		}%
		%%
		%%
		\anchorborder{%
			% Call a function that computes a border point. Since this
			% function will modify dimensions like \pgf@x, we must move them to
			% other dimensions.
			\pgfutil@tempdima=\pgf@x
			\pgfutil@tempdimb=\pgf@y
			\pgfpointborderrectangle%
				{\pgfpoint{\pgfutil@tempdima}{\pgfutil@tempdimb}}%
				{\upperrightcorner}%
		}%
		\backgroundpath{%
			\pgfkeysvalueof{/pgfplots/@backgroundpath@hook/.@cmd}\pgfeov
			\pgfpathrectangle{\pgfpointorigin}{\upperrightcorner}%
		}%
		\foregroundpath{}%
		\behindbackgroundpath{}%
		\beforebackgroundpath{}%
		\behindforegroundpath{}%
		\beforeforegroundpath{}%
	}%
	}{}%
}%


% Defines a new axis type `#1' with initialization code `#2'.
%
% The name #1 will be available as value for 'axis type=#1' and
% furthermore, an environment '\begin{#1axis}'  will be available.
%
% For ConTeXt, the \start#1axis and \stop#1axis commands will be
% available.
%
% #1: the axis type name
% #2: initialization TeX code.
%
% OPTIONAL: you can provide the expected axis coordinate system in
% square brackets.
%
% \pgfplotsdefineaxistype{rectangle}{...}
% \pgfplotsdefineaxistype[polar]{polar}{...}
\def\pgfplotsdefineaxistype{\pgfutil@ifnextchar[{\pgfplotsdefineaxistype@}{\pgfplotsdefineaxistype@[cart]}}%
\def\pgfplotsdefineaxistype@[#1]#2#3{%
	\expandafter\def\csname pgfplots@axistype@#2\endcsname{%
		\pgfkeyssetvalue{/pgfplots/@expected axis cs}{#1}%
		#3%
	}%
	\expandafter\def\csname pgfplots@environment@#2axis\endcsname{%
		\pgfutil@ifnextchar[%
			{\csname pgfplots@environment@#2axis@\endcsname}%
			{\csname pgfplots@environment@#2axis@\endcsname[]}%
	}%
	\expandafter\long\expandafter\def\csname pgfplots@environment@#2axis@\endcsname[##1]{%
		\axis[%
			##1,%
			data cs=#1,%  assume that coordinates provided by \addplot are in the correct coordsystem
			axis type=#2% active the correct axis type
		]%
	}%
	\expandafter\def\csname endpgfplots@environment@#2axis\endcsname{\endaxis}%
	\edef\pgfplots@glob@TMPc{\expandafter\noexpand\csname #2axis\endcsname\expandafter\noexpand\csname pgfplots@environment@#2axis\endcsname}%
	\expandafter
	\tikzaddtikzonlycommandshortcutlet\pgfplots@glob@TMPc
	%
	\edef\pgfplots@glob@TMPc{\expandafter\noexpand\csname end#2axis\endcsname\expandafter\noexpand\csname endpgfplots@environment@#2axis\endcsname}%
	\expandafter
	\tikzaddtikzonlycommandshortcutlet\pgfplots@glob@TMPc
	%
	% ConTeXt compatibility:
	\t@pgfplots@toka=\expandafter{\csname #2axis\endcsname}%
	\t@pgfplots@tokb=\expandafter{\csname end#2axis\endcsname}%
	\expandafter\edef\csname start#2axis\endcsname{\the\t@pgfplots@toka}%
	\expandafter\edef\csname stop#2axis\endcsname{\the\t@pgfplots@tokb}%
}%

\def\pgfplotssetaxistype#1{%
	\pgfutil@IfUndefined{pgfplots@axistype@#1}{%
		\pgfplots@error{Sorry, 'axis type=#1' is unknown. Maybe you need to load a proper library first or you misspelled the name? Ignoring it}%
	}{%
		\csname pgfplots@axistype@#1\endcsname
	}%
}%

% A command which has to be invoked BEFORE \pgfplots@draw@axis to
% prepare everything.
\def\pgfplots@draw@axis@pre{%
	% 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@threedim
		\pgfplots@separate@axis@linestrue
	\else
		\if\pgfplots@xaxislinesnum0\else
			\pgfplots@separate@axis@linestrue
		\fi
		\if\pgfplots@yaxislinesnum0\else
			\pgfplots@separate@axis@linestrue
		\fi
	\fi
	% compute tick position lists
	% 	\pgfplots@prepared@tick@positions@minor@x
	% and
	% 	\pgfplots@prepared@tick@positions@major@x
	\ifpgfplots@hide@x\else
		\expandafter\pgfplots@prepare@tick@coordlists@for\expandafter x\expandafter{\pgfplots@xtick}%
	\fi
	\ifpgfplots@hide@y\else
		\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
	\fi
}

\def\pgfplots@draw@axis@is@prepared{}%

% PRECONDITION:
% 	\pgfplots@draw@axis@pre has been called.
\def\pgfplots@draw@axis{%
	%
	%
	%
%\message{Ok, I am now in pgfplots@draw@axis; ready to do work. Hide flags: hide x = \ifpgfplots@hide@x true\else false\fi; hide y = \ifpgfplots@hide@y true\else false\fi hide z = \ifpgfplots@hide@z true \else false \fi. Vector length: x = \pgfplots@x@veclength (1/x = \pgfplots@x@inverseveclength). y = \pgfplots@y@veclength (1/y = \pgfplots@y@inverseveclength) z = \pgfplots@z@veclength (1/z = \pgfplots@z@inverseveclength)}%
	\ifpgfplots@threedim
%\if10
		\if2\pgfplots@zaxislinesnum
			% axis z line*=center
			\pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@logical@ZERO@z}{2}%
			\pgfplots@draw@axis@insurface@symmetric xyz
		\else
			% the other cases are handled in
			% \pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn
			\pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}%
			\pgfplots@draw@axis@insurface@symmetric xyz
			%
			\pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}%
			\pgfplots@draw@axis@insurface@symmetric xyz
		\fi
		%
%\fi\if10
		\if2\pgfplots@xaxislinesnum
			% axis x line*=center
			\pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@logical@ZERO@x}{2}%
			\pgfplots@draw@axis@insurface@onlyticksandgrid yzx
			\pgfplots@draw@axis@insurface zyx
		\else
			\pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}%
			\pgfplots@draw@axis@insurface@onlyticksandgrid yzx
			\pgfplots@draw@axis@insurface zyx
			%
			\pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}%
			\pgfplots@draw@axis@insurface@onlyticksandgrid yzx
			\pgfplots@draw@axis@insurface zyx
		\fi
%\fi\if10
		%
		\if2\pgfplots@yaxislinesnum
			\pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@logical@ZERO@y}{2}%
			\pgfplots@draw@axis@insurface@onlyticksandgrid xzy
			\pgfplots@draw@axis@insurface@onlyticksandgrid zxy
		\else
			\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
		\fi
%\fi
	\else
		% Just use the 2d-point commands (assuming Z=0)
		\let\pgfplotspointonorientedsurfaceabsetupfor@@xyz=\pgfplotspointonorientedsurfaceabsetupfor@@xy
		\let\pgfplotspointonorientedsurfaceabsetupfor@@yxz=\pgfplotspointonorientedsurfaceabsetupfor@@yx
		\pgfplots@draw@axis@insurface@symmetric xyz
	\fi
}%

% The complement of \pgfplots@draw@axis which will ALWAYS be drawn on
% top of every thing else; it complements the rest.
%
% This implements only the 3d box=complete feature.
%
% PRECONDITION:
% 	\pgfplots@draw@axis@pre has been called.
\def\pgfplots@draw@axis@post{%
	\ifpgfplots@threedim
		\if0\pgfplots@threedimbox@choice
			% 3d box=background
		\else
			\if0\pgfplots@xaxislinesnum
			\else
				\def\pgfplots@threedimbox@choice{0}%
			\fi
			\if0\pgfplots@yaxislinesnum
			\else
				\def\pgfplots@threedimbox@choice{0}%
			\fi
			\if0\pgfplots@zaxislinesnum
			\else
				\def\pgfplots@threedimbox@choice{0}%
			\fi
			\if\pgfplots@threedimbox@choice0%
				\pgfplots@error{Sorry, your choice for '3d box' and 'axis x line' is incompatible.}%
			\else
				% 3d box=complete or complete*
				\pgfplotsgetlayerforstyle{every 3d box foreground}%
				\pgfplotsonlayer{\pgfplotsretval}{every 3d box foreground}%
				\begingroup
				\pgfplots@layered@graphicsfalse% no distinction of layers here.
				\pgfplotsset{every 3d box foreground}%
				\let\pgfplots@drawticklabels@onorientedsurf=\relax
				\if2\pgfplots@threedimbox@choice
					\def\pgfplots@ifgridlines@onorientedsurf@should@be@drawn##1##2{%
						##1%
					}%
				\else
					\let\pgfplots@drawgridlines@onorientedsurf=\relax
				\fi
				%
				\let\pgfplots@drawticklabels@onorientedsurf=\relax
				%
				% negate the meaning of this if:
				\let\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@@ORIG=\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@%
				\def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@##1##2##3{%
					\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@@ORIG{##1}{##3}{##2}%
				}%
				%
				% the following code is *almost* the same as if we would
				% have called
				% \pgfplots@draw@axis again.
				% The difference is in the
				% \pgfplotsifaxissurfaceisforeground checks.
				% Furthermore, I have removed the case distinctions for
				% the different axis line combinations.
	%\if10
				% axis z line*=box
				%
				\pgfplotsifaxissurfaceisforeground{vv0}{%
					\pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmin}{0}%
					\pgfplots@draw@axis@insurface@symmetric xyz
				}{}%
				%
				\pgfplotsifaxissurfaceisforeground{vv1}{%
					\pgfplotspointonorientedsurfaceabsetupforsetz{\pgfplots@zmax}{1}%
					\pgfplots@draw@axis@insurface@symmetric xyz
				}{}%
				%
	%\fi\if10
				% axis x line*=box
				\pgfplotsifaxissurfaceisforeground{0vv}{%
					\pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmin}{0}%
					\pgfplots@draw@axis@insurface@onlyticksandgrid yzx
					\pgfplots@draw@axis@insurface zyx
				}{}
				%
				\pgfplotsifaxissurfaceisforeground{1vv}{%
					\pgfplotspointonorientedsurfaceabsetupforsetx{\pgfplots@xmax}{1}%
					\pgfplots@draw@axis@insurface@onlyticksandgrid yzx
					\pgfplots@draw@axis@insurface zyx
				}{}
	%\fi\if11
				%
				\pgfplotsifaxissurfaceisforeground{v0v}{%
					\pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymin}{0}%
					\pgfplots@draw@axis@insurface@onlyticksandgrid xzy
					\pgfplots@draw@axis@insurface@onlyticksandgrid zxy
				}{}%
				%
				\pgfplotsifaxissurfaceisforeground{v1v}{%
					\pgfplotspointonorientedsurfaceabsetupforsety{\pgfplots@ymax}{1}%
					\pgfplots@draw@axis@insurface@onlyticksandgrid xzy
					\pgfplots@draw@axis@insurface@onlyticksandgrid zxy
				}{}%
	%\fi
				\endgroup
				\endpgfplotsonlayer
				% end of 3d box=complete
			\fi
		\fi
	\fi
}%

\def\pgfplots@define@threedim@marks{%
	\ifpgfplots@threedim
		% FIXME : there is always the same arithmetics going on here. I could try to optimize it -- for fixed mark size.
		\pgfdeclareplotmark{cube}
		{%
			\pgfplots@cube@gethalf@x
			\let\pgfplots@cube@halfx=\pgfmathresult
			\pgfplots@cube@gethalf@y
			\let\pgfplots@cube@halfy=\pgfmathresult
			\pgfplots@cube@gethalf@z
			\let\pgfplots@cube@halfz=\pgfmathresult
			%
			\pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			\pgfpathclose
			%
			\pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			\pgfpathclose
			%
			\pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			%
			\pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			%
			\pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
			%
			\pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
			\pgfusepathqstroke
			%
		}%
		\pgfdeclareplotmark{cube*}
		{%
			\pgfplots@cube@gethalf@x
			\let\pgfplots@cube@halfx=\pgfmathresult
			\pgfplots@cube@gethalf@y
			\let\pgfplots@cube@halfy=\pgfmathresult
			\pgfplots@cube@gethalf@z
			\let\pgfplots@cube@halfz=\pgfmathresult
			%
			\pgfplotsifaxissurfaceisforeground{0vv}{%
				\pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathclose
				\pgfusepathqfillstroke
			}{%
				\pgfpathmoveto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathclose
				\pgfusepathqfillstroke
			}%
			\pgfplotsifaxissurfaceisforeground{v0v}{%
				\pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathclose
				\pgfusepathqfillstroke
			}{%
				\pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathclose
				\pgfusepathqfillstroke
			}%
			\pgfplotsifaxissurfaceisforeground{vv0}{%
				\pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{-\pgfplots@cube@halfz}}%
				\pgfpathclose
				\pgfusepathqfillstroke
			}{%
				\pgfpathmoveto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{-\pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{ \pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathlineto{\pgfplotsqpointxyz{ \pgfplots@cube@halfx}{-\pgfplots@cube@halfy}{ \pgfplots@cube@halfz}}%
				\pgfpathclose
				\pgfusepathqfillstroke
			}%
		}%
	\else
		\pgfdeclareplotmark{cube}{\pgfuseplotmark{square}}%
		\pgfdeclareplotmark{cube*}{\pgfuseplotmark{square*}}%
	\fi
}

% 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=varying; y=varying; 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@surfviewdepth@CCC'
%   is defined to be either 'f' (foreground) or 'b' (background).
%   Thus, we don't have real TeX booleans, "only" those one-character
%   strings.
%   There are high-level routines to check these flags.
%   - every tick label position will be initialised, i.e. the macros
%   	\pgfplots@[xyz]ticklabelaxisspec
%     will be initialised.
%
% ABOUT THE ALGORITHM:
% Given \pgfplots@view@dir@threedim, we know the view direction (in 3D!).
% Now, we compute the scalar products <n,(1,0,0)'>  <n,(0,1,0)'> and
% <n,(0,0,1)'> between the view direction n and the unit vectors in 3D
% space. Of course, these scalar products are just specific components
% of n. Using the sign of the scalar product, we know whether n points
% roughly into the same or the opposite direction of each unit vector
% and we can deduce foreground and background side surfaces of the
% unit cube. The idea is: foreground surfaces won't be drawn, only
% background surfaces.
%
% Given this knowledge, we can also deduce the default axes for tick
% labels.
%
% The operation is relatively fast.
\def\pgfplots@decide@which@figure@surfaces@are@drawn{%
	\expandafter\def\csname pgfplots@surfviewdepth@2vv\endcsname{f}%
	\expandafter\def\csname pgfplots@surfviewdepth@v2v\endcsname{f}%
	\expandafter\def\csname pgfplots@surfviewdepth@vv2\endcsname{f}%
	\ifpgfplots@threedim
		\pgfplotsmathvectortocomponents\pgfplots@view@dir@threedim{pgfplots@loc@}{default}%
		% respect reversed axes here. If I am not mistaken, it should
		% be completely sufficient to flip signs here:
		\pgfplotscoordmath{default}{if is}{\pgfplots@loc@x}{\if\pgfkeysvalueof{/pgfplots/x dir/value}n+\else-\fi}{%
			\expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{f}% foreground
			\expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{b}% background
		}{%
			\expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}%
			\expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}%
		}%
		\pgfplotscoordmath{default}{if is}{\pgfplots@loc@y}{\if\pgfkeysvalueof{/pgfplots/y dir/value}n+\else-\fi}{%
			\expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{f}% foreground
			\expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{b}% background
		}{%
			\expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}%
			\expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}%
		}%
		\pgfplotscoordmath{default}{if is}{\pgfplots@loc@z}{\if\pgfkeysvalueof{/pgfplots/z dir/value}n+\else-\fi}{%
			\expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{f}% foreground
			\expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{b}% background
		}{%
			\expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}%
			\expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}%
		}%
	\else
		% FIXME : it might be better to implement that stuff here
		% implicilty using the 3D algorithms.
		%
		% this here is the only important one:
		\expandafter\def\csname pgfplots@surfviewdepth@vv0\endcsname{b}%
		%
		\expandafter\def\csname pgfplots@surfviewdepth@0vv\endcsname{b}%
		\expandafter\def\csname pgfplots@surfviewdepth@1vv\endcsname{f}%
		\expandafter\def\csname pgfplots@surfviewdepth@v0v\endcsname{b}%
		\expandafter\def\csname pgfplots@surfviewdepth@v1v\endcsname{f}%
		\expandafter\def\csname pgfplots@surfviewdepth@vv1\endcsname{f}%
		\def\pgfplotsifaxislineisonconvexhull##1##2##3{##2}% ALWAYS TRUE
		\def\pgfplots@ifaxisline@B@onorientedsurf@should@be@drawn@##1##2##3{##2}% ALWAYS TRUE
		%
	\fi
}

% Initialises the 'pgfplots@[xyz]ticklabelaxisspecs' macro according to
% the foreground/background situation of the axis and the '[xyz]ticklabel pos'
% keys.
\def\pgfplots@init@ticklabelaxisspec{%
	\ifpgfplots@threedim
		%
		%
		% Now, determine which axis line shall get tick labels.
		% The strategy is as follows:
		% - only lines on the convex hull of the 2D projected axis
		%   rectangle can get tick labels,
		% - for each axis, there are two such choices in the general
		%   case,
		% - for X and Y: prefer the one on the lower side.
		% - for Z: prefer the one on the left hand side.
		%
		\pgfplotspointcenter
		\edef\pgfplots@tmp@centerx{\the\pgf@x}%
		\edef\pgfplots@tmp@centery{\the\pgf@y}%
		%
		\pgfplots@init@ticklabelaxisspecfor xy%
		%
		\pgfplots@init@ticklabelaxisspecfor yy%
		%
		\pgfplots@init@ticklabelaxisspecfor zx%
	\else
		\pgfplotspointcenter
		\edef\pgfplots@tmp@centerx{\the\pgf@x}%
		\edef\pgfplots@tmp@centery{\the\pgf@y}%
		%
		\pgfplots@init@ticklabelaxisspec@twodim@for xy%
		%
		\pgfplots@init@ticklabelaxisspec@twodim@for yx%
	\fi
}%

% A helper method which is to be invoked ONLY inside of
% \pgfplots@init@ticklabelaxisspec.
% It does NOT work outside of it.
%
% It initialises the 'pgfplots@#1ticklabelaxisspec' macro according to
% the foreground/background situation of the axis and the '#1ticklabel pos'
% key.
%
% #1: the axis: x,y or z
% #2: either x or y. It refers to the PROJECTED coordinate which
% should be used to compare the 'lower' and 'upper' arguments of the
% |[xyz]ticklabel pos| key.
%
% PRECONDITION:
% 	\pgfplots@tmp@center[xy] is set.
%
% POSTCONDITION:
% 	- pgfplots@#1ticklabelaxisspec is set,
%
% @see also \pgfplots@init@ticklabelaxisspec@twodim@for
\def\pgfplots@init@ticklabelaxisspecfor#1#2{%
	\if#1x%
		\def\pgfplots@loc@to@threedim##1##2{v##1##2}%
		\def\pgfplots@loc@axischar@for@first{y}%
	\else
		\if#1y%
			\def\pgfplots@loc@to@threedim##1##2{##1v##2}%
			\def\pgfplots@loc@axischar@for@first{x}%
		\else
			\def\pgfplots@loc@to@threedim##1##2{##1##2v}%
			\def\pgfplots@loc@axischar@for@first{x}%
		\fi
	\fi
	%
	% First, compute stuff as if we had a box. Ignore the "center"
	% styles with a single axis line for now.
	%
	\pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 00}{%
		% -> both, v00 or v11 are on CH.
		%
		% Decide whether the '{0.5}{0}{0}' point is above or below
		% the {0.5}{0.5}{0.5}
		% point. This '<' operation is based on the '#1ticklabel pos'
		% key, the 2D projection of the axis and the argument '#2'.
		\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 00}%
		\pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}%
		\ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax
			\if u\csname pgfplots@#1ticklabel@pos\endcsname
				\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}%
			\fi
		\else
			\if l\csname pgfplots@#1ticklabel@pos\endcsname
				\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 11}%
			\fi
		\fi
	}{%
		% -> both, v01 or v10 are on CH
		%--------------------------------------------------
		% \pgfplotsifaxislineisonconvexhull{\pgfplots@loc@to@threedim 01}{% FIXME : eliminate sanity assertion if possible
		% }{%
		% 	\pgfplots@error{INTERNAL ERROR}%
		% }%
		%--------------------------------------------------
		% Decide whether the '{0.5}{1}{0}' point is above or below
		% the {0.5}{0.5}{0.5} point. Again, the '<' operation is based
		% on the '#1ticklabel pos' key, the projection and #2.
		\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 10}%
		% compute the middle point on \pgfplots@loc@to@threedim 10
		\pgfpointadd
			{\csname pgfplotspoint\pgfplots@loc@axischar@for@first axis\endcsname}
			{\pgfpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}}%
		%
		\ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax
			\if u\csname pgfplots@#1ticklabel@pos\endcsname
				\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}%
			\fi
		\else
			\if l\csname pgfplots@#1ticklabel@pos\endcsname
				\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 01}%
			\fi
		\fi
	}%
	%
	% Now, adapt result to "center" styles:
	\if2\csname pgfplots@#1axislinesnum\endcsname
		% axis #1 lines=center .
		%
		\expandafter\edef\csname pgfplots@#1ticklabelaxisspec@box\endcsname{\csname pgfplots@#1ticklabelaxisspec\endcsname}%
		%
		% well, for 3d, this implies that all others also have
		% "center". And since "0" == lower, "1" == upper", "2" ==
		% center, we have to use center:
		\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 22}%
	\fi
}%
\def\pgfplots@init@ticklabelaxisspec@twodim@for#1#2{%
	% First, compute stuff as if we had a box. Ignore the "center"
	% styles with a single axis line for now.
	%
	\if#1x%
		\def\pgfplots@loc@to@threedim##1{v##10}%
		\def\pgfplots@loc@axischar@for@first{y}%
	\else
		\def\pgfplots@loc@to@threedim##1{##1v0}%
		\def\pgfplots@loc@axischar@for@first{x}%
	\fi
	% Decide whether the '{0.5}{0}' point is above or below
	% the {0.5}{0.5}
	% point. This '<' operation is based on the '#1ticklabel pos'
	% key, the 2D projection of the axis and the argument '#2'.
	\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 0}%
	\pgfqpointscale{0.5}{\csname pgfplotspoint#1axis\endcsname}%
	\ifdim\csname pgf@#2\endcsname<\csname pgfplots@tmp@center#2\endcsname\relax
		\if u\csname pgfplots@#1ticklabel@pos\endcsname
			\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 1}%
		\fi
	\else
		%--------------------------------------------------
		%FIXME : I have the impression that this here is DEPRECATED
		% \if3\csname pgfplots@#1tickposnum\endcsname % is 'right'
		% 	\expandafter\def\csname pgfplots@#1tickposnum\endcsname{1}% set to 'left'
		% \else
		% 	\if1\csname pgfplots@#1tickposnum\endcsname % is 'left'
		% 		\expandafter\def\csname pgfplots@#1tickposnum\endcsname{3}% set to 'right'
		% 	\fi
		% \fi
		%--------------------------------------------------
		\if l\csname pgfplots@#1ticklabel@pos\endcsname
			\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 1}%
		\fi
	\fi
	%
	% Now, adapt result to "center" styles:
	\if2\csname pgfplots@#1axislinesnum\endcsname
		% axis #1 lines=center .
		%
		\expandafter\edef\csname pgfplots@#1ticklabelaxisspec@box\endcsname{\csname pgfplots@#1ticklabelaxisspec\endcsname}%
		%
		% well, for 3d, this implies that all others also have
		% "center". And since "0" == lower, "1" == upper", "2" ==
		% center, we have to use center:
		\expandafter\edef\csname pgfplots@#1ticklabelaxisspec\endcsname{\pgfplots@loc@to@threedim 2}%
	\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.
\def\pgfplots@draw@axis@insurface#1#2#3{%
	\pgfplots@if{pgfplots@hide@#1}{\relax}{%
		\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
		\pgfplots@drawgridlines@onorientedsurf
		%
		\pgfplots@drawticklines@onorientedsurf
		%
		\pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2%
		\pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3%
		%
		\pgfplots@drawticklabels@onorientedsurf
		%
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
			\expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}%
		\fi
	}%
}%

% A variant of \pgfplots@draw@axis@insurface which is equivalent to
% \pgfplots@draw@axis@insurface #1#2#3
% \pgfplots@draw@axis@insurface #2#1#3
% with slightly optimized execution sequence.
\def\pgfplots@draw@axis@insurface@symmetric#1#2#3{%
	\pgfplots@if{pgfplots@hide@#1}{\relax}{%
		\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
		\pgfplots@drawgridlines@onorientedsurf
	}%
	\pgfplots@if{pgfplots@hide@#2}{\relax}{%
		\pgfplotspointonorientedsurfaceabsetupfor #2#1#3%
		\pgfplots@drawgridlines@onorientedsurf
	}%
	%
	\pgfplots@if{pgfplots@hide@#1}{\relax}{%
		\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
		\pgfplots@drawticklines@onorientedsurf
	}%
	\pgfplots@if{pgfplots@hide@#2}{\relax}{%
		\pgfplotspointonorientedsurfaceabsetupfor #2#1#3%
		\pgfplots@drawticklines@onorientedsurf
	}%
	%
	\ifpgfplots@separate@axis@lines
		\pgfplots@if{pgfplots@hide@#1}{\relax}{%
			\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
			\pgfplots@drawaxis@outerlines@separate@onorientedsurf#1#2%
			\pgfplots@drawaxis@innerlines@onorientedsurf#1#2#3%
		}%
		%
		\pgfplots@if{pgfplots@hide@#2}{\relax}{%
			\pgfplotspointonorientedsurfaceabsetupfor #2#1#3%
			\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}{%
		\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
		\pgfplots@drawticklabels@onorientedsurf
	}%
	\pgfplots@if{pgfplots@hide@#2}{\relax}{%
		\pgfplotspointonorientedsurfaceabsetupfor #2#1#3%
		\pgfplots@drawticklabels@onorientedsurf
	}%
	%
	\pgfplots@if{pgfplots@hide@#1}{\relax}{%
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
			\expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}%
		\fi
	}%
	\pgfplots@if{pgfplots@hide@#2}{\relax}{%
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#2tick\endcsname
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\pgfplotspointonorientedsurfaceabsetupfor #2#1#3%
			\expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}%
		\fi
	}%
}%

\def\pgfplots@draw@axis@insurface@onlyticksandgrid#1#2#3{%
	\pgfplots@if{pgfplots@hide@#1}{\relax}{%
		\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
		\pgfplots@drawgridlines@onorientedsurf
		\pgfplots@drawticklines@onorientedsurf
		%
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\begingroup
			\let\pgfplots@drawticklabels@onorientedsurf=\relax
			\pgfplotspointonorientedsurfaceabsetupfor #1#2#3%
			\expandafter\pgfplots@draw@extra@ticks@onorientedsurf\expandafter{\pgfplots@loc@TMPa}%
			\endgroup
		\fi
	}%
}%

% Handles the 'every 3d description' style.
%
% This requires a different type of attention than any other key --
% because all other keys are set in a context where the dimension of
% the axis is unknown (it might be 2 or 3 dimensional).
%
% The idea is:
% Call \pgfplots@BEGIN@prepare@description@styles as soon as the
% dimension is fixed, but before any style changes of the user
% interface are applied.
%
% Example:
% \begin{axis}[xlabel style={}]
% will be processed here. The reason: 'every 3d description' will
% certainly use a different style for axis labels than the default 2d
% style.
%
% Thus, all style changes which are relevant for 'every 3d description'
% have NOT YET been processed (they have been appended to 'every axis').
\def\pgfplots@BEGIN@prepare@description@styles{%
	\ifpgfplots@threedim
		\pgfplotsset{every 3d description,every 3d view {\pgfkeysvalueof{/pgfplots/view/az}}{\pgfkeysvalueof{/pgfplots/view/el}}/.try}%
	\fi
	\pgfkeysgetvalue{/pgfplots/.unknown/.@cmd}\pgfplots@BEGIN@prepare@description@styles@oldhandler
	\pgfkeysdef{/pgfplots/.unknown}{}% ignore unknown keys here.
	\pgfkeysactivatefamily{/pgfplots/style commands}%
	\pgfkeysactivatefamily{/pgfplots/descriptions}%
%\pgfkeys{/pgfplots/every axis/.show code}%
	\pgfplots@set@keys@from@tikz@style{every axis}%
	\pgfkeysdeactivatefamily{/pgfplots/descriptions}%
	\pgfkeysdeactivatefamily{/pgfplots/style commands}%
	\pgfkeyslet{/pgfplots/.unknown/.@cmd}\pgfplots@BEGIN@prepare@description@styles@oldhandler
}%

\newif\ifpgfplots@layered@graphics


% Shortcut for '\pgfplotsset{set layers={#1}}'.
%
% USAGE:
% 1. \pgfplotssetlayers{<layer config name>} (one declared with /.define layer set)
% 2. \pgfplotssetlayers (no braces)
% 3. \pgfplotssetlayers{<comma-separated-list-of-layers>}
%
% This command immediately installs a \pgfsetlayers command. It also prepares following axes.
% ATTENTION: this might affect tikzpictures as well.
%
\def\pgfplotssetlayers{%
	\pgfutil@ifnextchar\bgroup{\pgfplotssetlayers@}{\pgfplotsset{set layers}}%
}%
\def\pgfplotssetlayers@#1{%
	\pgfplotsset{set layers={#1}}%
}%

% This method checks if '#1' is a well-known layer set. If that is the case, the layer set is initialized.
% If there is no such layer set, #1 is assumed to be a comma-separated-list of layer names.
% These layers are defined if they do not exist already.
%
% POSTCONDITION:
%   - a \pgfsetlayers{<list>} is issued (immediately)
%   - '/pgfplots/@set layers arg' is defined such that any following axes can initialized their layers.
\def\pgfplots@key@set@layers#1{%
	%
	% auto detect if '#1' is a defined layer set:
	\pgfkeysifdefined{#1/list}{%
		\def\pgfkeyscurrentname{#1}%
	}{%
		\pgfkeysifdefined{/pgfplots/layers/#1/list}{%
			\edef\pgfkeyscurrentname{/pgfplots/layers/#1}%
		}{%
			\let\pgfkeyscurrentname\pgfutil@empty
		}%
	}%
	\ifx\pgfkeyscurrentname\pgfutil@empty
		% OK. The argument is NO layer set configuration.
		\pgfplots@key@set@layers@{#1}%
		\pgfkeyslet{/pgfplots/@set layers arg}\pgfutil@empty%
	\else
		% OK, The argument is the key name of some '/.define layer set' key.
		% Remember it for later and initialize the layers:
		\pgfkeyslet{/pgfplots/@set layers arg}\pgfkeyscurrentname%
		\pgfkeysgetvalue{\pgfkeyscurrentname/list}\pgfplots@loc@TMPa
		\expandafter\pgfplots@key@set@layers@\expandafter{\pgfplots@loc@TMPa}%
	\fi
}
% a simple method which (immediately) invokes \pgfsetlayers{#1}.
%
% The only difference is that it creates missing layers on-the-fly.
\def\pgfplots@key@set@layers@#1{%
	\edef\pgfplots@loc@TMPa{#1}%
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		% DEFAULT.
		\pgfsetlayers{main}%
	\else
		\def\pgfplots@loc@TMPb{false}%
		\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			% "use layers=false"
			\pgfsetlayers{main}%
		\else
			\def\pgfplots@loc@TMPb{main}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				% "use layers=main"
				\pgfsetlayers{main}%
			\else
				% declare all layers, and collect the normalised list
				% into \pgfplots@loc@TMPd
				\def\pgfplots@loc@TMPd{}%
				\expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplots@loc@TMPa}\as\pgfplots@loc@TMPa{%
					% normalize argument:
					\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
					\expandafter\pgfplotsutil@trim\expandafter{\pgfplots@loc@TMPa}%
					\let\pgfplots@loc@TMPa=\pgfplotsretval
					%
					\ifx\pgfplots@loc@TMPa\pgfutil@empty
					\else
						\def\pgfplots@loc@TMPb{main}%
						\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
						\else
							\expandafter\pgfdeclarelayer\expandafter{\pgfplots@loc@TMPa}%
						\fi
						\edef\pgfplots@loc@TMPd{\ifx\pgfplots@loc@TMPd\pgfutil@empty\else\pgfplots@loc@TMPd,\fi\pgfplots@loc@TMPa}%
					\fi
				}%
				% activate layers:
				\pgfplots@log3{Setting layers '\pgfplots@loc@TMPd'...}%
				\expandafter\pgfsetlayers\expandafter{\pgfplots@loc@TMPd}%
			\fi
		\fi
	\fi
}%

\def\pgfplots@prepare@layered@graphics{%
	% check if there are no layers at all.
	\ifpgfplots@layered@graphics
		\pgfutil@IfUndefined{pgf@layerlist}{%
		}{%
			\ifx\pgf@layerlist\pgfutil@empty
				\pgfplots@layered@graphicsfalse
			\else
				\def\pgfplots@loc@TMPa{main}%
				\ifx\pgf@layerlist\pgfplots@loc@TMPa
					\pgfplots@layered@graphicsfalse
				\fi
			\fi
		}%
	\fi
}%

% #2: context information (for improved error recovery), optional
\def\pgfplotsonlayer#1{%
	\pgfutil@ifnextchar\bgroup{\pgfplotsonlayer@{#1}}{\pgfplotsonlayer@{#1}{}}%
}
\def\pgfplotsonlayer@#1#2{%
	\begingroup
	\def\b@pgfplotsonlayer@started{0}%
	\ifpgfplots@layered@graphics
		\edef\pgfplots@loc@TMPa{#1}%
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\def\b@pgfplotsonlayer@started{1}%
			\pgfonlayer{#1}%
		\fi
	\fi
}%
\def\endpgfplotsonlayer{%
	\ifpgfplots@layered@graphics
		\if1\b@pgfplotsonlayer@started
			\endpgfonlayer
		\fi
	\fi
	\endgroup
}%


% Searches for the layers of a (set of) style name(s).
%
% #1 is a style name like 'every major grid'. It can also be a list of
% style names.
%
% The last "on layer" key found in these styles will be used here.
%
% Note that the "on layer" keys have already been extracted in during
% the key filtering procedure.
\def\pgfplotsgetlayerforstyle#1{%
	\let\pgfplotsretval=\pgfutil@empty
	\ifpgfplots@layered@graphics
		% this here is the return value:
		\let\pgfplots@loc@TMPc=\pgfutil@empty
		%
		% search list:
		\pgfplotsutilforeachcommasep{#1}\as\pgfplots@loc@TMPa{%
			\pgfkeysifdefined{/pgfplots/layers for styles/\pgfplots@loc@TMPa}{%
				% oh, good: I have already processed the requested
				% style, and I already know if it has a particular
				% layer.
				\pgfkeysgetvalue{/pgfplots/layers for styles/\pgfplots@loc@TMPa}\pgfplots@loc@TMPb
			}{%
				% hm. Ok, then process the style. Throw everything
				% away, keep only the layer.
				\begingroup
				\pgfkeyslet{/pgfplots/on layer}\pgfutil@empty
				\pgfkeysdef{/handlers/.unknown}{}% do nothing
				\pgfkeysdef{/tikz/.unknown}{}% also, do nothing.
				\pgfplotsset{#1}% let's hope this works with unknown keys...
				\pgfkeysgetvalue{/pgfplots/on layer}\pgfplots@loc@TMPb
				\pgfmath@smuggleone\pgfplots@loc@TMPb
				\endgroup
			}%
			\ifx\pgfplots@loc@TMPb\pgfutil@empty
			\else
				% update return value:
				\let\pgfplots@loc@TMPc=\pgfplots@loc@TMPb
			\fi
		}%
		\let\pgfplotsretval=\pgfplots@loc@TMPc
%\message{\string\pgfplotsgetlayerforstyle{#1} = '\pgfplotsretval'^^J}%
	\fi
}%

% The purpose of this method is to check for the cases where no cell picture is necessary.
% The idea behind this anchor is to insert the axis DIRECTLY into the embedding tikzpicture, without
% a posteriori shifting.
%
% A posteriori shifting == anchors whose dimensions are not fixed
% until the complete axis has been "typeset".
%
% Disabling the cell picture will still prepare ALL anchors correctly,
% but it disables many of the anchor choices when it comes to the
% alignment of the current axis (in other words: other node can align
% using the anchors of this axis, but this axis cannot be aligned based on its anchors).
%
% The motivation for this feature is to implement multi-axis support together with layered graphics.
%
% The 'cell picture=false' feature may be interesting for SVG export as
% well.
\def\pgfplots@prepare@cell@picture{%
	\pgfplots@ifcellpicture@required{%
		\pgfplots@has@cell@picturetrue
	}{%
		% cell picture=false or cell picture=if necessary
		%
		% anchor processing is special in this case! The standard
		% anchor processing uses a posteriori shifts. This feature
		% here REQUIRES a priori shifts.
		% Prepare special handling for these shifts:
		\pgfplots@has@cell@picturefalse
		\edef\pgfplots@anchorname@internal{\pgfplots@anchorname}%
		%
		% FIXME : do we need to renormalize this here? apparently
		% not...
		%\def\pgfplots@anchorname{image}%
		%
		\let\pgfplots@BEGIN@cell@picture=\pgfplots@BEGIN@cell@picture@DISABLED
		\let\pgfplots@END@cell@picture=\pgfplots@END@cell@picture@DISABLED
		\def\pgfplots@add@named@child@node##1{}% do nothing here
		\let\pgfplots@finally@correct@child@node@positions=\relax
		%
		% translate the coordinate system before the 'current axis'
		% node is generated.
		\expandafter\def\expandafter\pgfplots@beforenode\expandafter{\pgfplots@beforenode
			\setbox\pgfnodepartimagebox=\hbox{}%
		}%
	}%
}

\long\def\pgfplots@ifcellpicture@required#1#2{%
	\if1\pgfplots@cell@picture@mode
		% cell picture=true
		#1\relax
	\else
		% cell picture=false | cell picture=if necessary
		\edef\pgfplots@shapename{pgfplots@low@level@shape@INNER}%
		\pgfutil@IfUndefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{%
			% we need to compute the anchor a posteriorily.
			\if0\pgfplots@cell@picture@mode
				% cell picture=false is forbidden here...
				\pgfplots@error{Sorry, 'cell picture=false' is UNSUPPORTED for 'anchor=\pgfplots@anchorname'.}%
			\fi
			\if2\pgfplots@cell@picture@mode
				\pgfplots@log5{'cell picture=if necessary' resulted in 'cell picture=true'}%
			\fi
			#1\relax
		}{%
			\if2\pgfplots@cell@picture@mode
				\pgfplots@log5{'cell picture=if necessary' resulted in 'cell picture=false'}%
			\fi
			% OK, an a priori anchor is available - we do not really need
			% a cell picture and this is compatible with the input
			% options:
			#2\relax
		}%
	\fi
}%

\def\pgfplots@define@preliminary@current@axis@node{%
	\begingroup
	\pgfplots@sys@beforenode
	% create a leight-weight 'current axis' node for anchor references
	% (which may happen during both, the axis descriptions or any
	% path/plot commands).
	\pgfmultipartnode{pgfplots@low@level@shape@INNER}{image}{current axis}{\pgfusepath{discard}}%
	\endgroup
}%

\def\pgfplots@BEGIN@cell@picture[#1]{%
	%
	\pgfplots@define@preliminary@current@axis@node
	%
	\pgfplotsutil@BEGIN@cell@picture[#1]%
}%
\def\pgfplotsutil@BEGIN@cell@picture[#1]{%
	\setbox\pgfnodepartimagebox=\hbox\bgroup\bgroup
		\pgfinterruptpicture
		\tikzpicture[#1]%
		% set baseline for sub-picture to default value.
		% the baseline option will be applied to the OUTER picture.
		\pgfsetbaseline{\pgf@picminy}%
		\pgfutil@ifundefined{pgfsettrimleft}{}{%
			\pgfsettrimleft{\pgf@picminx}%
			\pgfsettrimright{\pgf@picmaxx}%
		}%
		\begingroup
			\pgfgettransformentries\aa\ab\ba\bb\pgfplots@loc@TMPa\pgfplots@loc@TMPb
			\xdef\pgfplots@savedtransformshift{%
				\global\pgf@x=\pgfplots@loc@TMPa\space
				\global\pgf@y=\pgfplots@loc@TMPb\space
			}%
			\xdef\pgfplots@glob@TMPa{{\aa}{\ab}{\ba}{\bb}}%
		\endgroup
		\expandafter\pgfsettransformentries\pgfplots@glob@TMPa{0pt}{0pt}%
}

\def\pgfplotsutil@END@cell@picture#1{%
		\xdef\pgfplots@cell@picture@remembered{%
			\ifpgfrememberpicturepositiononpage
				\noexpand\pgfrememberpicturepositiononpagetrue
			\else
				\noexpand\pgfrememberpicturepositiononpagefalse
			\fi
		}%
		\xdef\pgfplots@cell@pictureid{\pgfpictureid}%
		\endtikzpicture%
		\begingroup
			\ifdim\pgf@picmaxx=-16000pt\relax%
				\pgf@picmaxx=0pt\relax%
				\pgf@picminx=0pt\relax%
				\pgf@picmaxy=0pt\relax%
				\pgf@picminy=0pt\relax%
			\fi%
			#1%
		\endgroup
		\endpgfinterruptpicture
	\egroup\egroup% end of pgfnodepartimagebox
	%
	% restore any shift transformations provided to an axis.
	% These would be lost otherwise.
	\pgftransformshift{\pgfplots@savedtransformshift}%
	%
	% allow positioning of colorbars with this hook.
	% It is \relax unless this here is a color bar axis.
	% Its intention is to re-define `\pgfplots@at':
	\pgfplots@colorbar@position@hook%
	%
    \pgftransformshift{\pgfplots@at}%
	%
}%
\def\pgfplots@END@cell@picture{%
	\pgfplotsutil@END@cell@picture{\pgfplots@END@cell@picture@preparepoints}%
}%

\def\pgfplots@END@cell@picture@preparepoints{%
	% Protocol sizes for the axis-shape.
	% That needs to be done globally, do avoid all those
	% \endgroup's in and after \endpgfinterruptpicture ...
	%
	%
	% \pgfplotspointorigininternal:
	% used for anchor=<some node inside of the axis> and for
	% 'cell picture=true' in order to correct remembered node positions:
	\xdef\pgfplotspointorigininternal{\global\pgf@x=\the\pgf@picminx\space\global\pgf@y=\the\pgf@picminy\space}%
	%
	\ifpgfplots@deprecated@anchors
		\pgfplotspointminminmin
	\else
		\pgfplotspointbblowerleft
	\fi
	\pgf@xa=\pgf@x
	\pgf@ya=\pgf@y
	\pgf@pos@transform\pgf@xa\pgf@ya
	\advance\pgf@xa by-\pgf@picminx
	\advance\pgf@ya by-\pgf@picminy
	\xdef\pgfplotspointlowerleftinnercorner{%
		\global\pgf@x=\the\pgf@xa\space
		\global\pgf@y=\the\pgf@ya\space
	}%
	%
	\global\pgf@x=\pgf@picmaxx
	\global\pgf@y=\pgf@picmaxy
	\global\advance\pgf@x by-\pgf@picminx
	\global\advance\pgf@y by-\pgf@picminy
	\xdef\pgfplotspointupperrightcorner{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
	%
	\pgfplotspointaxisorigin
	\pgf@pos@transform\pgf@x\pgf@y
	\global\advance\pgf@x by-\pgf@picminx
	\global\advance\pgf@y by-\pgf@picminy
	\xdef\pgfplotspointaxisorigin{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
}

% this here is essentially the same as
%		\pgfpointanchor{current axis}{#1}
% but it does not need a node.
\def\pgfplotspointdescriptionbyanchor#1{%
	\begingroup
	\edef\pgfplotspointdescriptionbyanchor@{#1}%
	\gdef\pgfplots@glob@TMPa{0}%
	% do a linear search through all anchors of
	% shape pgfplots@low@level@shape@INNER :
	\def\anchor##1##2{%
		\def\pgfplots@loc@TMPa{##1}%
		\ifx\pgfplots@loc@TMPa\pgfplotspointdescriptionbyanchor@
			\pgf@process{##2}%
			\gdef\pgfplots@glob@TMPa{1}%
		\fi
	}%
	\pgfplots@low@level@shape@INNER@define
	\if0\pgfplots@glob@TMPa
		\pgfplots@error{The anchor '#1' is unsupported in this context.}%
	\fi
	\endgroup
}%

\def\pgfplots@BEGIN@cell@picture@DISABLED[#1]{%
	\begingroup
	\pgfinterruptboundingbox
		%
		%
		% allow positioning of colorbars with this hook.
		% It is \relax unless this here is a color bar axis.
		% Its intention is to re-define `\pgfplots@at':
		\pgfplots@colorbar@position@hook%
		%
		% prepare a priori anchor transformation (see
		% \pgfplots@prepare@cell@picture for details):
		% FIXME : \pgfplotspointdescriptionbyanchor invokes
		% \pgfplotsqpointdescriptionxy{<x>}{<y>} -- but it is not
		% merely a direction, it uses an offset. Is that correct!?
		\pgfqpointscale{-1}{\pgfplotspointdescriptionbyanchor{\pgfplots@anchorname@internal}}%
		\xdef\pgfplots@anchor@expanded{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
		%
		\scope[%
			/utils/exec={%
				% seems that \scope requires this complicated
				% formulation:
				\tikz@addtransform{%
					\pgftransformshift{\pgfplots@cell@picture@DISABLED@shifts}%
				}%
			},%
			#1,%
		]%
		\pgfplots@define@preliminary@current@axis@node
}%
\def\pgfplots@END@cell@picture@DISABLED{%
			\pgfplots@END@cell@picture@preparepoints%
		\endscope%
	\endpgfinterruptboundingbox
	\endgroup
	\global\let\pgfplots@cell@picture@remembered=\relax
	\global\let\pgfplots@cell@pictureid=\pgfutil@empty
	%
	% we need to re-add these trafos here since the \scope of the
	% "not-cell-picture" is closed. But not the anchor which has to be
	% handled by \pgfmultipartnode. See
	% \pgfplots@cell@picture@DISABLED@shifts
	\pgftransformshift{\pgfplots@at}%
}%

\def\pgfplots@cell@picture@DISABLED@shifts{%
	\pgfpointadd{\pgfplots@at}{\pgfplots@anchor@expanded}%
}%

\def\pgfplots@BEGIN@init@and@draw@axis{%
		%
		%
		\pgfplots@draw@axis@pre
		\pgfplots@draw@axis@is@prepared
		\scope
		%
		\pgfkeysgetvalue{/pgfplots/axis background/.@cmd}\pgfplots@loc@TMPa
		\ifx\pgfplots@loc@TMPa\pgfplots@empty@style@key
		\else
			\pgfplotsgetlayerforstyle{/pgfplots/axis background,/pgfplots/axis background@}%
			\pgfplotsonlayer{\pgfplotsretval}{axis background}%
			\path[/pgfplots/axis background,/pgfplots/axis background@] \pgfextra{\pgfplots@clippath@install{}};%
			\endpgfplotsonlayer
		\fi
		%
		\ifpgfplots@axis@on@top
		\else
			\pgfplots@draw@axis
		\fi
		% CLIPPING:
		\ifpgfplots@clip
			\if1\pgfplots@clipmode
				% 'clip=true' and 'clip/mode=global':
				\pgfplots@clippath@install{\pgfusepath{clip}}%
			\fi
		\fi
		\pgfplotspointbb@assertvaluesexist%
}

% something which is invoked after a clippath segment is complete.
% #1 should be something like \pgfusepath{clip}
\def\pgfplots@clippath@use@#1{%
	\ifx\pgfplotspoint@bb@@@\relax
		% remember the axis dimensions:
		\ifdim\pgf@pathmaxx=-16000pt
		\else
			\begingroup
			\pgf@xa=\pgf@pathmaxx
			\advance\pgf@xa by-\pgf@pathminx
			\pgf@ya=\pgf@pathmaxy
			\advance\pgf@ya by-\pgf@pathminy
			\xdef\pgfplots@glob@TMPa{{\the\pgf@pathminx}{\the\pgf@pathminy}{\the\pgf@xa}{\the\pgf@ya}}%
			\endgroup
			\global\let\pgfplotspoint@bb@@@=\pgfplots@glob@TMPa
		\fi
	\fi
	#1%
}%
\def\pgfplots@clippath@prepare@for@axistype{%
	\ifpgfplots@threedim
		% FIXME : this can't be done in three dimensions. :-(
		% -> for 3d, I need to clip at least the 2d projection.
		%
		% -> Identify the convex hull of the 2D projection:
		\pgfplotsifaxissurfaceisforeground{0vv}{%
			\pgfplotsifaxissurfaceisforeground{v0v}{%
				\pgfplotsifaxissurfaceisforeground{vv0}{%
					% ok. Do NOT use the intersection lines
					% - 00v
					% - 0v0
					% - v00
					% so, use
					%    010 (01v) 011
					%    011 (0v1) 001
					%    001 (v01) 101
					%    101 (10v) 100
					%    100 (1v0) 110
					%    110 (v10) 011 (cycle)
					\def\pgfplots@clippath@install##1{%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}{%
					% foreground surfs: 0vv, v0v, vv1
					%
					% ok. Do NOT use the intersection lines
					% - 00v
					% - 0v1
					% - v01
					% so, use
					%    010 (01v) 011
					%    011 (v11) 111
					%    111 (1v1) 101
					%    101 (10v) 100
					%    100 (v00) 000
					%    000 (0v0) 010 (cycle)
					\def\pgfplots@clippath@install##1{\relax%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}%
			}{%
				\pgfplotsifaxissurfaceisforeground{vv0}{%
					% foreground surfs: 0vv, v1v, vv0
					%
					% ok. Do NOT use the intersection lines
					% - 01v
					% - 0v0
					% - v10
					% so, use
					%   000  (00v) 001
					%   001  (0v1) 011
					%   011  (v11) 111
					%   111  (11v) 110
					%   110  (1v0) 100
					%   100  (v00) 000 (cycle)
					\def\pgfplots@clippath@install##1{%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}{%
					% foreground surfs: 0vv, v1v, vv1
					%
					% ok. Do NOT use the intersection lines
					% - 01v
					% - 0v1
					% - v11
					% so, use
					%   000  (00v) 001
					%   001  (v01) 101
					%   101  (1v1) 111
					%   111  (11v) 110
					%   110  (v10) 010
					%   010  (0v0) 000 (cycle)
					\def\pgfplots@clippath@install##1{%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}%
			}%
		}{%
			\pgfplotsifaxissurfaceisforeground{v0v}{%
				\pgfplotsifaxissurfaceisforeground{vv0}{%
					% foreground surfs: 1vv, v0v, vv0.
					%
					% Thus: DON'T use the intersection lines
					% - 10v
					% - 1v0
					% - v00
					% So, use
					%   110 (11v) 111
					%   111 (1v1) 101
					%   101 (v01) 001
					%   001 (00v) 000
					%   000 (0v0) 010
					%   010 (v10) 110 (cycle)
					\def\pgfplots@clippath@install##1{%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}{%
					% foreground surfs: 1vv, v0v, vv1
					% Thus: DON'T use the intersection lines
					% - 10v
					% - 1v1
					% - v01
					% So, use
					%   110 (11v) 111
					%   111 (v11) 011
					%   011 (0v1) 001
					%   001 (00v) 000
					%   000 (v00) 100
					%   100 (1v0) 110 (cycle)
					\def\pgfplots@clippath@install##1{%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}%
			}{%
				\pgfplotsifaxissurfaceisforeground{vv0}{%
					% foreground surfs: 1vv, v1v, vv0
					% Thus: DON'T use the intersection lines
					% - 11v
					% - 1v0
					% - v10
					% So, use
					%   100 (10v) 101
					%   101 (1v1) 111
					%   111 (v11) 011
					%   011 (01v) 010
					%   010 (0v0) 000
					%   000 (v00) 100 (cycle)
					\def\pgfplots@clippath@install##1{%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}{%
					% foreground surfs: 1vv, v1v, vv1
					% Thus: DON'T use the intersection lines
					% - 11v
					% - 1v1
					% - v11
					% So, use
					%   100 (10v) 101
					%   101 (v01) 001
					%   001 (0v1) 011
					%   011 (01v) 010
					%   010 (v10) 110
					%   110 (1v0) 100 (cycle)
					\def\pgfplots@clippath@install##1{%
						\pgfpathmoveto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymin}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmax}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmin}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathlineto{\pgfplotsqpointxyz{\pgfplots@xmax}{\pgfplots@ymax}{\pgfplots@zmin}}%
						\pgfpathclose
						\pgfplots@clippath@use@{##1}%
					}%
				}%
			}%
		}%

	\else
		\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymin}%
		\edef\pgfplots@loc@TMPa{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
		\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymin}%
		\edef\pgfplots@loc@TMPb{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
		\pgfplotsqpointxy{\pgfplots@xmax}{\pgfplots@ymax}%
		\edef\pgfplots@loc@TMPc{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
		\pgfplotsqpointxy{\pgfplots@xmin}{\pgfplots@ymax}%
		\edef\pgfplots@loc@TMPd{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
		\begingroup
		\toks0=\expandafter{\pgfplots@loc@TMPa}%
		\toks1=\expandafter{\pgfplots@loc@TMPb}%
		\toks2=\expandafter{\pgfplots@loc@TMPc}%
		\toks3=\expandafter{\pgfplots@loc@TMPd}%
		\xdef\pgfplots@glob@TMPa##1{%
			\noexpand\pgfpathmoveto{\the\toks0 }%
			\noexpand\pgfpathlineto{\the\toks1 }%
			\noexpand\pgfpathlineto{\the\toks2 }%
			\noexpand\pgfpathlineto{\the\toks3 }%
			\noexpand\pgfpathclose
			\noexpand\pgfplots@clippath@use@{##1}%
		}%
		\endgroup
		\let\pgfplots@clippath@install=\pgfplots@glob@TMPa
	\fi
}%
% Defines \pgfplots@clippath@install.
% @PRECONDITION  the axis limits must be ready.
\def\pgfplots@clippath@prepare{%
	\pgfplots@clippath@prepare@for@axistype
	% now, the \pgfplots@clippath@install routine should be ready.
	%
	% it is used to compute the bounding box. prepare that:
	\global\let\pgfplotspoint@bb@@@=\relax
	%
	% Now, I SET the clip path temporarily and record the low level
	% protocol.
	% This low level protocol is used to create a highly optimized
	% clip path routine; it will be used quite often.
	%
	\let\pgfplots@clippath@install@pathcmd=\pgfplots@clippath@install
	\iffalse
		% FIXME : this was an idea to optimize the installation of the
		% clip path (cache the protocolled version). FIX IT
		%
		\pgf@resetpathsizes% FIXME: this here should not be necessary!
		\pgfsysprotocol@getcurrentprotocol\pgfplots@loc@TMPa%
		\begingroup
			% when I do this work, I can as well compute the bounding
			% box (done in \pgfplots@clippath@use@)
			\pgfinterruptboundingbox
			\pgf@relevantforpicturesizetrue
			%
			\pgfsysprotocol@bufferedtrue%
			\pgfsysprotocol@setcurrentprotocol\pgfutil@empty%
		%	\pgfplots@clippath@install@pathcmd{\pgfusepath{clip}}%
			\pgfsysprotocol@getcurrentprotocol\pgfplots@loc@TMPa%
			\global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa
			\endpgfinterruptboundingbox
		\endgroup
		\let\pgfplots@clippath@install@clip@protocolled=\pgfplots@glob@TMPa
		\pgfsysprotocol@setcurrentprotocol\pgfplots@loc@TMPa%
	\fi
	%
	% Replace \pgfplots@clippath@install by one which makes use of the
	% optimized version (if ##1=\pgfusepath{clip})
	\def\pgfplots@clippath@install##1{%
		\def\pgfplots@loc@TMPa{##1}%
		\let\pgfplots@clippath@install@aftergroup=\pgfutil@empty
			% the 'clip' path has been precomputed because it is often
			% used: FIXME: unfinished, see above
			%\expandafter\pgfsys@invoke\expandafter{\pgfplots@clippath@install@clip@protocolled}%
		\ifx\pgfplots@loc@TMPa\pgfplots@clippath@install@test
			\if0\pgfplots@clip@BB@mode
				% clip bounding box=default tikz
			\else
				% clip bounding box=upper bound
				%
				% do NOT take the clip path into account for the bounding
				% box! That is very strange when you hide the axis.
				%
				% note that we do not need it: the path's BB will be
				% extracted anyway by this BB code.
				%
				% However, we will use the clip path's BB as
				% *upper bound* - but only after the paths in the
				% current scope have been completed.
				% The implementation of this upper bound is hooked
				% into '\endscope':
				\edef\pgfplots@clippath@install@aftergroup{%
					\ifpgf@relevantforpicturesize
						\noexpand\pgf@relevantforpicturesizetrue
					\else
						\noexpand\pgf@relevantforpicturesizefalse
					\fi
					\noexpand\pgfplots@clippath@install@BB@upper@bound
				}%
				\pgf@relevantforpicturesizefalse
				%
			\fi
		\fi
		\pgf@resetpathsizes% FIXME: this here should not be necessary!
		\pgfplots@clippath@install@pathcmd{##1}%
		\pgfplots@clippath@install@aftergroup
	}%
	%
}%
\def\pgfplots@clippath@install@test{\pgfusepath{clip}}%

% This is the main part of the implementation for
% 'clip bounding box=upper bound' : it collects the bounding box of everything inside of
% the clipped area. Then in the associated \endscope, it clips that bounding box to the expected
% clip path -- and protocols that size.
\def\pgfplots@clippath@install@BB@upper@bound{%
	\tikzset{
		execute at end scope=\pgfplots@clippath@install@BB@update,
		%
		% no special handling for nested scopes:
		% unnecessary; tikz handles that on its own:
		%execute at begin scope=\let\pgfplots@clippath@install@BB@update=\relax,
	}%
	\pgfinterruptboundingbox
	% count everything in the current scope into a separate bounding box
}%

\def\pgfplots@clippath@install@BB@update{%
	% we are inside of \endscope.
	%
	% this here is the BB of the current scope!
	% More precisely: in *the* scope in which we started the clip
	% path, not in nested scopes.
	%
	\ifdim\pgf@picminx=16000pt %
		\xdef\pgfplots@glob@TMPa{}%
	\else
		\xdef\pgfplots@glob@TMPa{%
			{\the\pgf@picminx}%
			{\the\pgf@picminy}%
			{\the\pgf@picmaxx}%
			{\the\pgf@picmaxy}%
		}%
	\fi
	\endpgfinterruptboundingbox
	\ifx\pgfplots@glob@TMPa\pgfutil@empty
	\else
		\expandafter\pgfplots@clippath@install@BB@update@\pgfplots@glob@TMPa
	\fi
}%

\def\pgfplots@clippath@install@BB@update@#1#2#3#4{%
	\pgfqpoint{#1}{#2}%
	\pgfplots@clip@to@clippath%
	\pgf@protocolsizes{\pgf@x}{\pgf@y}%
	%
	\pgfqpoint{#3}{#4}%
	\pgfplots@clip@to@clippath%
	\pgf@protocolsizes{\pgf@x}{\pgf@y}%
}%

\def\pgfplots@clip@to@clippath{%
	\pgf@xa=\pgf@x
	\pgf@ya=\pgf@y
	\begingroup\pgf@process{\pgfplotspointbblowerleft\pgf@pos@transform\pgf@x\pgf@y}\endgroup%
	\ifdim\pgf@xa<\pgf@x \pgf@xa=\pgf@x \fi
	\ifdim\pgf@ya<\pgf@y \pgf@ya=\pgf@y \fi
	%
	\begingroup\pgf@process{\pgfplotspointbbupperright\pgf@pos@transform\pgf@x\pgf@y}\endgroup
	\ifdim\pgf@xa>\pgf@x \pgf@xa=\pgf@x \fi
	\ifdim\pgf@ya>\pgf@y \pgf@ya=\pgf@y \fi
	%
	\pgfqpoint{\pgf@xa}{\pgf@ya}%
}%


\def\pgfplotspointbb@assertvaluesexist{%
	\ifx\pgfplotspoint@bb@@@\relax
		% (RE)COMPUTE:
		%
		% Determine tight 2D bounding box for the axis as such:
		\begingroup
		% hm. seems as if it is sufficient to set
		% \pgf@relevantforpicturesizefalse. but it does not hurt; I
		% will see to it eventually. Perhaps.
		\pgfinterruptboundingbox
			\pgf@relevantforpicturesizetrue
			\pgfplots@clippath@install{\pgfusepath{discard}}
		\endpgfinterruptboundingbox
		\endgroup
	\fi
}%

% Point commands which expand to the bounding box which contains at
% least the (projected) visible part of the axis
\def\pgfplotspointbblowerleft{%
	\pgfplotspointbb@assertvaluesexist
	\expandafter\pgfplotspointbblowerleft@\pgfplotspoint@bb@@@
}%
\def\pgfplotspointbbupperright{%
	\pgfpointadd{\pgfplotspointbblowerleft}{\pgfplotspointbbdiagonal}%
}%
\def\pgfplotspointbbdiagonal{%
	\pgfplotspointbb@assertvaluesexist
	\expandafter\pgfplotspointbbdiagonal@\pgfplotspoint@bb@@@
}%
\let\pgfplotspoint@bb@@@=\relax
\def\pgfplotspointbblowerleft@#1#2#3#4{\global\pgf@x=#1 \global\pgf@y=#2 }%
\def\pgfplotspointbbdiagonal@#1#2#3#4{\global\pgf@x=#3 \global\pgf@y=#4 }%

% #1: a complete \pgfusepath command what to do with the clip path.
\def\pgfplots@clippath@install#1{%
	\pgfplots@error{Can't install a clippath here - the command has not yet been prepared.}%
}%


% Generates a path representing the outline of the axis.
% Example:
%
% \pgfplotspathaxisoutline
% \pgfusepath{clip}
\def\pgfplotspathaxisoutline{%
	\pgfplots@clippath@install{}%
}%

% This is the counterpart for \pgfplots@BEGIN@init@and@draw@axis
\def\pgfplots@END@init@and@draw@axis{%
	\endscope%
	%
	\ifpgfplots@axis@on@top
		\pgfplots@draw@axis
	\fi
	\pgfplots@draw@axis@post
	%
	\pgfplots@markers@visphase@after@axis
	\global\pgfplotslistnewempty\pgfplots@stored@plotlist% delete contents.
	%
	\begingroup
	\pgfkeysvalueof{/pgfplots/after end axis/.@cmd}\pgfeov%
	\endgroup
	%
}

% Writes output to \pgfmathresult
% #1: the tick list (not a macro!)
% #2: the axis
\def\pgfplots@filter@input@ticks@with@log#1#2{%
	\let\pgfplots@glob@TMPa=\pgfutil@empty
	\foreach \pgfplots@loc@TMPb in {#1} {%
		\pgfplotscoordmath{float}{parse}{\pgfplots@loc@TMPb}%
		\pgfmathfloattofixed{\pgfmathresult}%
		\let\pgfplots@loc@TMPb=\pgfmathresult
		%
		\pgfplotscoordmath{#2}{log}{\pgfplots@loc@TMPb}%
		\ifx\pgfplots@glob@TMPa\pgfutil@empty
			\xdef\pgfplots@glob@TMPa{\pgfmathresult}%
		\else
			\xdef\pgfplots@glob@TMPa{\pgfplots@glob@TMPa,\pgfmathresult}%
		\fi
	}%
	\let\pgfmathresult=\pgfplots@glob@TMPa
}

% Writes output to \pgfmathresult
% #1: the input ticks
% #2: the transformation command key as macro
\def\pgfplots@filter@input@ticks@with@highleveltrafo#1#2{%
	\let\pgfplots@glob@TMPa=\pgfutil@empty
	\foreach \pgfplots@loc@TMPb in {#1} {%
		\expandafter#2\expandafter{\pgfplots@loc@TMPb}\pgfeov%
		\ifx\pgfplots@glob@TMPa\pgfutil@empty
			\xdef\pgfplots@glob@TMPa{\pgfmathresult}%
		\else
			\xdef\pgfplots@glob@TMPa{\pgfplots@glob@TMPa,\pgfmathresult}%
		\fi
	}%
	\let\pgfmathresult=\pgfplots@glob@TMPa
}

% definition of 'axis cs':
\tikzdeclarecoordinatesystem{axis}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface\pgfplots@loc@TMPa,\pgfplots@coord@end}
\def\pgfplotspointaxisxy#1#2{\pgfplots@evalute@tikz@coord@system@interface{#1},{#2},\pgfplots@coord@end}%
\def\pgfplotspointaxisxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface{#1},{#2},{#3},\pgfplots@coord@end}%
\def\pgfplotsqpointaxisxy#1#2{%
	\edef\pgfplotspointaxis@restore{%
		\ifpgfplots@plot@coords@mathparser
			\noexpand\pgfplots@plot@coords@mathparsertrue
		\else
			\noexpand\pgfplots@plot@coords@mathparserfalse
		\fi
	}%
	\pgfplots@plot@coords@mathparserfalse
	%
	\pgfplotspointaxisxy{#1}{#2}%
	%
	\pgfplotspointaxis@restore
}
\def\pgfplotsqpointaxisxyz#1#2#3{%
	\edef\pgfplotspointaxis@restore{%
		\ifpgfplots@plot@coords@mathparser
			\noexpand\pgfplots@plot@coords@mathparsertrue
		\else
			\noexpand\pgfplots@plot@coords@mathparserfalse
		\fi
	}%
	\pgfplots@plot@coords@mathparserfalse
	%
	\pgfplotspointaxisxyz{#1}{#2}{#3}%
	%
	\pgfplotspointaxis@restore
}

% definition of 'normalized axis cs':
\tikzdeclarecoordinatesystem{normalized axis}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface@normalized\pgfplots@loc@TMPa,\pgfplots@coord@end}
\def\pgfplotspointnormalizedaxisxy#1#2{\pgfplots@evalute@tikz@coord@system@interface@normalized{#1},{#2},\pgfplots@coord@end}%
\def\pgfplotspointnormalizedaxisxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface@normalized{#1},{#2},{#3},\pgfplots@coord@end}%

\tikzdeclarecoordinatesystem{axis direction}{%
	\edef\pgfplots@loc@TMPa{%
		\noexpand\pgfplots@evalute@tikz@coord@system@interface[ noshift]%
			#1,\noexpand\pgfplots@coord@end
	}%
	\pgfplots@loc@TMPa
}
\def\pgfplotspointaxisdirectionxy#1#2{\pgfplots@evalute@tikz@coord@system@interface[ noshift]{#1},{#2},\pgfplots@coord@end}%
\def\pgfplotspointaxisdirectionxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface[ noshift]{#1},{#2},{#3},\pgfplots@coord@end}%

% rel axis cs:
\tikzdeclarecoordinatesystem{rel axis}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface@rel\pgfplots@loc@TMPa,\pgfplots@coord@end}
\def\pgfplotspointrelaxisxy#1#2{\pgfplots@evalute@tikz@coord@system@interface@rel{#1},{#2},\pgfplots@coord@end}%
\def\pgfplotspointrelaxisxyz#1#2#3{\pgfplots@evalute@tikz@coord@system@interface@rel{#1},{#2},{#3},\pgfplots@coord@end}%

% axis description cs:
\tikzdeclarecoordinatesystem{axis description}{\edef\pgfplots@loc@TMPa{#1}\expandafter\pgfplots@evalute@tikz@coord@system@interface@axis@description\pgfplots@loc@TMPa\pgfplots@coord@end}
\def\pgfplots@evalute@tikz@coord@system@interface@axis@description#1,#2\pgfplots@coord@end{\pgfplotspointdescriptionxy{#1}{#2}}

\def\pgfplotstransformcoordinatex#1{\pgfplots@evalute@tikz@coord@system@interface@for[]{x}{#1}}%
\def\pgfplotstransformcoordinatey#1{\pgfplots@evalute@tikz@coord@system@interface@for[]{y}{#1}}%
\def\pgfplotstransformcoordinatez#1{\pgfplots@evalute@tikz@coord@system@interface@for[]{z}{#1}}%

\def\pgfplotstransformdirectionx#1{\pgfplots@evalute@tikz@coord@system@interface@for[ noshift]{x}{#1}}%
\def\pgfplotstransformdirectiony#1{\pgfplots@evalute@tikz@coord@system@interface@for[ noshift]{y}{#1}}%
\def\pgfplotstransformdirectionz#1{\pgfplots@evalute@tikz@coord@system@interface@for[ noshift]{z}{#1}}%

\def\pgfplots@declare@mathfunctions{%
	\pgfmathdeclarefunction{transformdirectionx}{1}{\pgfplotstransformdirectionx{##1}}%
	\pgfmathdeclarefunction{transformdirectiony}{1}{\pgfplotstransformdirectiony{##1}}%
	\pgfmathdeclarefunction{transformdirectionz}{1}{\pgfplotstransformdirectionz{##1}}%
	%
	\pgfmathdeclarefunction{transformcoordinatex}{1}{\pgfplotstransformcoordinatex{##1}}%
	\pgfmathdeclarefunction{transformcoordinatey}{1}{\pgfplotstransformcoordinatey{##1}}%
	\pgfmathdeclarefunction{transformcoordinatez}{1}{\pgfplotstransformcoordinatez{##1}}%
}%

% Assigns \pgfmathresult := canvas coordinate (#3) for axis #2.
%
% A "canvas coordinate" here means an argument for \pgfplotsqpointxyz.
%
% #1: a command suffix which will be handed over to the datascale
% #2: an axis (x,y, or z)
% #3: the high-level coordinate which should be transformed
% trafo (typically an empty string)
\long\def\pgfplots@evalute@tikz@coord@system@interface@for[#1]#2#3{%
	\pgfkeysgetvalue{/pgfplots/#2 coord trafo/.@cmd}\pgfplots@loc@TMPc
	\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key
		\edef\pgfmathresult{#3}% do not expand it - might contain unexpandable input for coord trafo.
	\else
		\pgfplots@loc@TMPc{#3}\pgfeov
	\fi
	\ifpgfplots@plot@coords@mathparser
		\pgfplotscoordmath{default}{parse}{\pgfmathresult}%
	\fi
	\let\pgfplots@loc@TMPc=\pgfmathresult% FIXME: is that necessary? I doubt it... but just to make sure...
	\csname ifpgfplots@#2islinear\endcsname
		\pgfplotscoordmath{#2}{parsenumber}{\pgfplots@loc@TMPc}%
		\pgfplots@if{pgfplots@apply@datatrafo@#2}{%
			\pgfplotscoordmath{#2}{datascaletrafo#1}{\pgfmathresult}%
		}{}%
	\else
		\pgfplotscoordmath{#2}{log}{\pgfplots@loc@TMPc}%
	\fi
}

\long\def\pgfplots@evalute@tikz@coord@system@interface@for@normalized[#1]#2#3{%
	\edef\pgfmathresult{#3}%
	\pgfplotscoordmath{default}{parse}{\pgfmathresult}%
	\let\pgfplots@loc@TMPc=\pgfmathresult% FIXME: is that necessary? I doubt it... but just to make sure...
	\pgfplotscoordmath{#2}{parsenumber}{\pgfplots@loc@TMPc}%
	\csname ifpgfplots@#2islinear\endcsname
		\pgfplots@if{pgfplots@apply@datatrafo@#2}{%
			\pgfplotscoordmath{#2}{datascaletrafo#1}{\pgfmathresult}%
		}{}%
	\else
		% OK, assume it *is* in the normalized format.
	\fi
}

\def\pgfplots@evalute@tikz@coord@system@interface{%
	\begingroup
	\pgfutil@ifnextchar[%
		{\pgfplots@evalute@tikz@coord@system@interface@x}%
		{\pgfplots@evalute@tikz@coord@system@interface@x[]}%
}
\def\pgfplots@evalute@tikz@coord@system@interface@x[#1]#2,{%
	\def\pgfplots@evaluate@tikz@coord@opts{#1}%
	\def\pgfplots@evaluate@tikz@coord@x{#2}%
	\pgfplots@evalute@tikz@coord@system@interface@xy%
}%

\def\pgfplots@evalute@tikz@coord@system@interface@xy#1,{%
	\def\pgfplots@evaluate@tikz@coord@y{#1}%
	\pgfutil@ifnextchar\pgfplots@coord@end{%
		% ah - we have no Z component. ok.
		\let\pgfplots@evaluate@tikz@coord@z\pgfutil@empty
		% jump to the end of the state machine:
		\pgfplots@evalute@tikz@coord@system@interface@@@@@
	}{%
		\pgfplots@evalute@tikz@coord@system@interface@xyz
	}%
}%

\def\pgfplots@evalute@tikz@coord@system@interface@xyz#1,{%
	\def\pgfplots@evaluate@tikz@coord@z{#1}%
	\pgfplots@evalute@tikz@coord@system@interface@@@@@
}%

% equals only itsself in \ifx:
\def\pgfplots@coord@end{\pgfplots@coord@end}

\long\def\pgfplots@evalute@tikz@coord@system@interface@@@@@#1\pgfplots@coord@end{%
	%\begingroup <--- has already been opened at the beginning of the state machine
	\pgfplots@evalute@tikz@coord@system@interface@tocoords[\pgfplots@evaluate@tikz@coord@opts]%
	\xdef\pgfplots@glob@TMPa{\pgfplots@evaluate@tikz@coord@x}%
	\xdef\pgfplots@glob@TMPb{\pgfplots@evaluate@tikz@coord@y}%
	\xdef\pgfplots@glob@TMPc{\pgfplots@evaluate@tikz@coord@z}%
	\endgroup
	\ifx\pgfplots@glob@TMPc\pgfutil@empty
		\pgfplotsqpointxy{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}%
	\else
		\pgfplotsqpointxyz{\pgfplots@glob@TMPa}{\pgfplots@glob@TMPb}{\pgfplots@glob@TMPc}%
	\fi
}

% Defines \pgfplots@evaluate@tikz@coord@[xyz]
\def\pgfplots@evalute@tikz@coord@system@interface@tocoords[#1]{%
	\def\pgfplots@evalute@tikz@coord@@##1##2{%
		\pgfplots@evalute@tikz@coord@system@interface@for[#1]{##2}{##1}%
	}%
	\expandafter\pgfplots@evalute@tikz@coord@@\expandafter{\pgfplots@evaluate@tikz@coord@x}{x}%
	\let\pgfplots@evaluate@tikz@coord@x=\pgfmathresult
	\expandafter\pgfplots@evalute@tikz@coord@@\expandafter{\pgfplots@evaluate@tikz@coord@y}{y}%
	\let\pgfplots@evaluate@tikz@coord@y=\pgfmathresult
	%
	\ifx\pgfplots@evaluate@tikz@coord@z\pgfutil@empty
	\else
		\expandafter\pgfplots@evalute@tikz@coord@@\expandafter{\pgfplots@evaluate@tikz@coord@z}{z}%
		\let\pgfplots@evaluate@tikz@coord@z=\pgfmathresult
	\fi
}%

\def\pgfplots@evalute@tikz@coord@system@interface@rel{%
	\begingroup
	\let\pgfplots@evalute@tikz@coord@system@interface@@@@@=\pgfplots@evalute@tikz@coord@system@interface@@@@@rel
	\pgfutil@ifnextchar[%
		{\pgfplots@evalute@tikz@coord@system@interface@x}%
		{\pgfplots@evalute@tikz@coord@system@interface@x[]}%
}

\long\def\pgfplots@evalute@tikz@coord@system@interface@@@@@rel#1\pgfplots@coord@end{%
	%\begingroup <--- has already been opened at the beginning of the state machine
	\pgfkeys{/pgf/fpu=false}%
	\pgfmathparse{\pgfplots@evaluate@tikz@coord@x}%
	\let\pgfplots@evaluate@tikz@coord@x=\pgfmathresult
	\pgfmathparse{\pgfplots@evaluate@tikz@coord@y}%
	\let\pgfplots@evaluate@tikz@coord@y=\pgfmathresult
	\ifx\pgfplots@evaluate@tikz@coord@z\pgfutil@empty
	\else
		\pgfmathparse{\pgfplots@evaluate@tikz@coord@z}%
		\let\pgfplots@evaluate@tikz@coord@z=\pgfmathresult
	\fi
	%
	\pgfplotspointxaxis
	\pgf@xx=\pgf@x
	\pgf@xy=\pgf@y
	%
	\pgfplotspointyaxis
	\pgf@yx=\pgf@x
	\pgf@yy=\pgf@y
	%
	\ifpgfplots@allow@reversal@of@rel@axis@cs
		\if\pgfkeysvalueof{/pgfplots/x dir/value}r%
			\pgf@xa=-\pgfplots@evaluate@tikz@coord@x pt
			\advance\pgf@xa by1pt
			\edef\pgfplots@evaluate@tikz@coord@x{\pgf@sys@tonumber\pgf@xa}%
		\fi
		\if\pgfkeysvalueof{/pgfplots/y dir/value}r%
			\pgf@xa=-\pgfplots@evaluate@tikz@coord@y pt
			\advance\pgf@xa by1pt
			\edef\pgfplots@evaluate@tikz@coord@y{\pgf@sys@tonumber\pgf@xa}%
		\fi
	\fi
	%
	\ifx\pgfplots@evaluate@tikz@coord@z\pgfutil@empty
		\pgfpointadd
			{\pgfplotspointminminmin}%
			{\pgfplotsqpointxy{\pgfplots@evaluate@tikz@coord@x}{\pgfplots@evaluate@tikz@coord@y}}%
	\else
		\ifpgfplots@allow@reversal@of@rel@axis@cs
			\if\pgfkeysvalueof{/pgfplots/z dir/value}r%
				\pgf@xa=-\pgfplots@evaluate@tikz@coord@z pt
				\advance\pgf@xa by1pt
				\edef\pgfplots@evaluate@tikz@coord@z{\pgf@sys@tonumber\pgf@xa}%
			\fi
		\fi
		\pgfplotspointzaxis
		\pgf@zx=\pgf@x
		\pgf@zy=\pgf@y
		\pgfpointadd
			{\pgfplotspointminminmin}%
			{\pgfplotsqpointxyz{\pgfplots@evaluate@tikz@coord@x}{\pgfplots@evaluate@tikz@coord@y}{\pgfplots@evaluate@tikz@coord@z}}%
	\fi
	\pgf@process{}%
	\endgroup
}

\def\pgfplots@evalute@tikz@coord@system@interface@normalized{%
	\begingroup
	\let\pgfplots@evalute@tikz@coord@system@interface@for=\pgfplots@evalute@tikz@coord@system@interface@for@normalized
	\pgfutil@ifnextchar[%
		{\pgfplots@evalute@tikz@coord@system@interface@x}%
		{\pgfplots@evalute@tikz@coord@system@interface@x[]}%
}

% In case of (semi-) logplots, this command will
% - assign a filter which invokes \pgfmathlog@{} for each coordinate
% - replace any user-specified coordinate by its log.
%
% All subsequent commands will then work with logarithmic coordinates.
%
% PRECONDITION:
% - The user input options have been set correctly,
% - the options have been set, but are not applied
%
% POSTCONDITION:
% - any user input has been parsed
% - any user input for log-axis has been replaced by its log if
%   necessary
% - coordinate filters are prepared
%
% See also:
%     \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
	\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key
		% no high-level external coord trafos.
		% Simply use identity:
		\expandafter\def\csname pgfplots@prepare@#1coord\endcsname##1{%
			\edef\pgfmathresult{##1}%
		}%
	\else
		% Apply external coordinate trafo to all input values:
		\expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{%
			% do not expand it here - might contain unexpandable
			% material which is processed by the #1 coord trafo:
			% FIXME : this might produce an endless loop if ##1 = \pgfmathresult!
			\noexpand\def\noexpand\pgfmathresult{##1}%
			% this becomes
			\expandafter\noexpand\csname pgfplots@highlevel@trafo@#1\endcsname{##1}\noexpand\pgfeov
			%
			% ensure that it is expanded.
			\noexpand\edef\noexpand\pgfmathresult{\noexpand\pgfmathresult}%
		}%
		%
		% The transformation is now \pgfplots@loc@TMPc
		%
		% any user-specified axis limits:
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov%
			\expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
		\fi
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\expandafter\pgfplots@loc@TMPc\expandafter{\pgfplots@loc@TMPa}\pgfeov%
			\expandafter\global\expandafter\let\csname pgfplots@#1max\endcsname=\pgfmathresult
		\fi
		%
		% any user-specified 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:
		\edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}%
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\def\pgfplots@loc@TMPb{data}%
			\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
				% #1tick=data is handled elsewhere...
			\else
				\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname
				\expandafter\pgfplots@filter@input@ticks@with@highleveltrafo\expandafter{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}%
				\expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfmathresult}%
			\fi
		\fi
		%
		\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\expandafter\pgfplots@filter@input@ticks@with@highleveltrafo\expandafter{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}%
			\expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfmathresult}%
		\fi
		%
		\pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPa
		\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\else
			\expandafter\pgfplots@filter@input@ticks@with@highleveltrafo\expandafter{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPc}%
			\pgfkeyslet{/pgfplots/minor #1tick}\pgfmathresult
		\fi
	\fi
	%
	\pgfkeysgetvalue{/pgfplots/#1filter}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
	\else
		\expandafter\let\csname pgfplots@#1filter@backwcompat\endcsname=\pgfplots@loc@TMPa
		\t@pgfplots@tokc={/pgfplots/#1filter is deprecated. Please use /pgfplots/#1 filter/.code={\def\pgfmathresult{\#1}}}%
		\pgfplots@warning{\the\t@pgfplots@tokc}%
		\pgfkeys{/pgfplots/#1 filter/.code={\csname pgfplots@#1filter@backwcompat\endcsname{##1}\to\pgfmathresult}}%
	\fi
	\csname ifpgfplots@#1islinear\endcsname
		\pgfplotssetcoordmathfor{#1}{float}%
		\csname pgfplots@apply@datatrafo@#1true\endcsname
		\pgfplots@apply@datatrafotrue
		\ifpgfplots@apply@datatrafo
			% Check for any existing axis limits:
			\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
			\else
				\pgfplotscoordmath{#1}{parse}{\pgfplots@loc@TMPa}%
				\expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
			\fi
			\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
			\else
				\pgfplotscoordmath{#1}{parse}{\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
				\pgfplotscoordmath{#1}{parse}{\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
				\pgfplotscoordmath{#1}{parse}{\pgfplots@loc@TMPa}%
				\expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult
			\fi
		\fi
	\else
		\pgfplotssetcoordmathfor{#1}{pgfbasic}%
		%
		% 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.
		\pgfplots@if{pgfplots@disablelogfilter@#1}{\relax}{%
			% Prepare the log to use for axis '#1'.
			%
			\pgfkeysgetvalue{/pgfplots/log basis #1}\pgfplots@loc@TMPa%
			\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
			\def\pgfplots@loc@TMPb{e}%
			\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
				% log basis x=e : same as empty value.
				\let\pgfplots@loc@TMPa=\pgfutil@empty
			\fi
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
				% log basis x={} (initial setting:)
			\else
				% use a different basis.
				\pgfplotscoordmath{#1}{set log basis}{\pgfplots@loc@TMPa}%
				%
				% generate default ticks in the 'log basis', not base 10:
				\pgfplotsset{/pgfplots/log basis ticks=#1}%
				%
				\ifdim\pgfkeysvalueof{/pgfplots/log basis #1}pt=10pt
				\else
					\pgfplots@identify@log@minor@tick@posfalse
					\csname pgfplots@#1minorticksfalse\endcsname
					\csname pgfplots@#1minorgridsfalse\endcsname
					\expandafter\def\csname pgfplots@#1minortickstrue\endcsname{\pgfplots@error{Sorry, minor ticks are not supported for this log basis.}}%
					\expandafter\def\csname pgfplots@#1minorgridstrue\endcsname{\pgfplots@error{Sorry, minor grid lines are not supported for this log basis.}}%
				\fi
				\pgfkeyslet{/pgfplots/log basis #1/.@cmd}\pgfplots@cant@set@in@this@context
				%%%
				% Ok, now, I have prepared everything for the new
				% log basis!
			\fi
			%
			% any user-specified axis limits:
			\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1min\endcsname
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
			\else
				\pgfplotscoordmath{default}{parse}{\pgfplots@loc@TMPa}%
				\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
				\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
				}{%
					\pgfplotswarning{illegal user argument in log axis}{#1min}{\csname pgfplots@#1min\endcsname}\pgfeov%
				}%
				\expandafter\global\expandafter\let\csname pgfplots@#1min\endcsname=\pgfmathresult
			\fi
			\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1max\endcsname
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
			\else
				\pgfplotscoordmath{default}{parse}{\pgfplots@loc@TMPa}%
				\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
				\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
				}{%
					\pgfplotswarning{illegal user argument in log axis}{#1max}{\csname pgfplots@#1max\endcsname}\pgfeov%
				}%
				\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
				\pgfplotscoordmath{#1}{log}{\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
				\pgfplotscoordmath{#1}{log}{\pgfplots@loc@TMPa}%
				\expandafter\global\expandafter\let\csname pgfplots@#1tickmax\endcsname=\pgfmathresult
			\fi
			%
			% any user specified axis ticks:
			\edef\pgfplots@loc@TMPa{\csname pgfplots@#1tick\endcsname}%
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
			\else
				\def\pgfplots@loc@TMPb{data}%
				\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
					% #1tick=data is handled elsewhere...
				\else
					\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@#1tick\endcsname
					\expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}{#1}%
					\expandafter\edef\csname pgfplots@#1tick\endcsname{\pgfmathresult}%
				\fi
			\fi
			\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfplots@extra@#1tick\endcsname
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
			\else
				\expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}{#1}%
				\expandafter\edef\csname pgfplots@extra@#1tick\endcsname{\pgfmathresult}%
			\fi
			%
			\pgfkeysgetvalue{/pgfplots/minor #1tick}\pgfplots@loc@TMPa
			\ifx\pgfplots@loc@TMPa\pgfutil@empty
			\else
				\expandafter\pgfplots@filter@input@ticks@with@log\expandafter{\pgfplots@loc@TMPa}{#1}%
				\pgfkeyslet{/pgfplots/minor #1tick}\pgfmathresult
			\fi
			%
			% append logarithm to prepare coord.
			%
			\t@pgfplots@toka={%
				\ifx\pgfmathresult\pgfutil@empty
				\else
					\pgfplots@if{pgfplots@disablelogfilter@#1}{%
						\pgfplotscoordmath{#1}{parsenumber}{\pgfmathresult}%
						% FIXME : check for unbounded arguments!
					}{%
						\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
						\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{}{%
							\def\pgfplots@unbounded@dir{#1}%
						}%
					}%
				\fi
			}%
			\pgfkeysgetvalue{/pgfplots/#1 coord trafo/.@cmd}\pgfplots@loc@TMPc
			\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key
				\expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{%
					\noexpand\edef\noexpand\pgfmathresult{##1}%
					\the\t@pgfplots@toka
				}%
			\else
				% This is a bit complicated... but it works: APPEND
				% the log stuff to the existing prepare method.
				\t@pgfplots@tokb=\expandafter\expandafter\expandafter{%
					\csname pgfplots@prepare@#1coord\endcsname{##1}%
				}%
				\expandafter\edef\csname pgfplots@prepare@#1coord\endcsname##1{%
					\the\t@pgfplots@tokb
					\the\t@pgfplots@toka
				}%
			\fi
		}%
	\fi
}

\def\pgfplots@create@axis@descriptions{%
	\begingroup
		%
		\pgfplots@change@pgfpoints@to@descriptioncs
		%
		\pgfplots@create@axis@descriptions@
	\endgroup
}

\def\pgfplots@create@axis@descriptions@{%
	\begingroup
	\ifpgfplots@hide@x
	\else
				  \ifpgfplots@units@use%
						\pgfplots@show@label{x}{\pgfplots@label@units{x}}%
				  \else%
						\pgfkeysgetvalue{/pgfplots/xlabel}{\pgfplots@label@}%
						\ifx\pgfplots@label@\pgfutil@empty
						\else
							  \pgfplots@show@label{x}{\pgfplots@label@}%
						\fi
				  \fi
	\fi
	\ifpgfplots@hide@y
	\else
				  \ifpgfplots@units@use%
						\pgfplots@show@label{y}{\pgfplots@label@units{y}}%
				  \else%
						\pgfkeysgetvalue{/pgfplots/ylabel}{\pgfplots@label@}%
						\ifx\pgfplots@label@\pgfutil@empty
						\else
							  \pgfplots@show@label{y}{\pgfplots@label@}%
						\fi
				  \fi
	\fi
	\ifpgfplots@threedim
		\ifpgfplots@hide@z
		\else
						  \ifpgfplots@units@use%
								\pgfplots@show@label{z}{\pgfplots@label@units{z}}%
						  \else%
								\pgfkeysgetvalue{/pgfplots/zlabel}{\pgfplots@label@}%
								\ifx\pgfplots@label@\pgfutil@empty
								\else
									  \pgfplots@show@label{z}{\pgfplots@label@}%
								\fi
						  \fi
		\fi
	\fi
	\endgroup
	%
	\pgfkeysgetvalue{/pgfplots/title}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
	\else
		\expandafter\pgfplots@show@title\expandafter{\pgfplots@loc@TMPa}%
	\fi
	\pgfplots@createlegend
	%
	\pgfkeysvalueof{/pgfplots/extra description/.@cmd}\pgfeov%
	%
}

% Invokes '#1' foreach key which should be saved by a color bar.
%
% The current key name is available as '##1', the macro under which
% the key is / should be saved as '##2'.
\def\pgfplots@colorbar@foreach@saved@key#1{%
	\def\pgfplots@colorbar@foreach@saved@key@body##1##2{#1}%
	\pgfplotsutilforeachcommasep{%
		{/pgfplots/colorbar/draw/.@cmd}\pgfplots@savedstyle@colorbar@draw,%
		{/pgfplots/every colorbar/.@cmd}\pgfplots@savedstyle@colorbar,%
		{/pgfplots/colorbar shift/.@cmd}\pgfplots@savedstyle@colorbarshift,%
		{/pgfplots/colorbar horizontal/lowlevel/.@cmd}\pgfplots@savedstyle@colorbar@horizontal,%
		{/pgfplots/colorbar vertical/lowlevel/.@cmd}\pgfplots@savedstyle@colorbar@vertical,%
		{/pgfplots/every tick/.@cmd}\pgfplots@savedstyle@tick,%
		{/pgfplots/every minor tick/.@cmd}\pgfplots@savedstyle@minortick,%
		{/pgfplots/every major tick/.@cmd}\pgfplots@savedstyle@majortick,%
		{/pgfplots/every axis grid/.@cmd}\pgfplots@savedstyle@grid,%
		{/pgfplots/every minor grid/.@cmd}\pgfplots@savedstyle@minorgrid,%
		{/pgfplots/every major grid/.@cmd}\pgfplots@savedstyle@majorgrid,%
		{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel,%
		{/pgfplots/every tick label/.@cmd}\pgfplots@savedstyle@ticklabel%
	}%
		\as\pgfplots@colorbar@foreach@saved@key@@
	{%
		\expandafter\pgfplots@colorbar@foreach@saved@key@body\pgfplots@colorbar@foreach@saved@key@@
	}%
}%
\def\pgfplots@colorbar@restore@saved@keys{%
	\pgfplots@colorbar@foreach@saved@key{%
		\pgfkeyslet{##1}##2%
	}%
}%

% Defines '#1' to be a macro which, upon execution, draws the color
% bar for the current axis. It also handles any required style
% inheritance and option preparation issues.
%
% The important thing is: the macro is expected to be invoked after
% the current TeX group (scope). Thus, the complete state is
% represented inside of '#1' (and maybe some global variables).
\def\pgfplots@colorbar@move@outside@scope@with@globalmacro#1{%
	\pgfplotspointbbdiagonal
	\edef\pgfplots@loc@TMPa{\the\pgf@x}%
	\edef\pgfplots@loc@TMPb{\the\pgf@y}%
	\pgfkeyslet{/pgfplots/parent axis width}{\pgfplots@loc@TMPa}%
	\pgfkeyslet{/pgfplots/parent axis height}{\pgfplots@loc@TMPb}%
	%
	\pgfkeysgetvalue{/pgfplots/colorbar to name}\pgfplots@colorbar@toname
	%
	\pgfnodealias{parent axis}{current axis}%
	%
	% FIXME :
	% I would really prefer to find a different way to move these
	% variables out of the current scope. But expansion leads to
	% mistakes with '#' characters ... :-(
	\pgfplots@colorbar@foreach@saved@key{%
		\pgfkeysgetvalue{##1}\pgfplots@loc@TMPa
		\global\let##2=\pgfplots@loc@TMPa
	}%
	%
	\toks1={}%
	\ifx\pgfplots@colorbar@toname\pgfutil@empty
	\else
		\toks1={%
			\pgfplots@colorbar@get@rid@of@at@parent@axis
		}%
		\pgfplots@colorbar@foreach@saved@key{%
			\pgfplots@command@with@args@to@string##2\pgfplots@loc@TMPa
			\pgfplots@auxwrite{%
				\noexpand\expandafter
				\noexpand\long
				\noexpand\expandafter
				\noexpand\gdef
				\noexpand\csname pgfplots@colorbar@\pgfplots@colorbar@toname @\noexpand\string\noexpand##2\noexpand\endcsname%
					\pgfplots@loc@TMPa
			}%
			\edef\pgfplots@loc@TMPa{%
				\the\toks1
				\noexpand\expandafter
				\noexpand\let
				\noexpand\expandafter
				\noexpand##2%
					\noexpand\csname pgfplots@colorbar@\pgfplots@colorbar@toname @\noexpand\string\noexpand##2\noexpand\endcsname%
			}%
			\toks1=\expandafter{\pgfplots@loc@TMPa}%
		}%
	\fi
	% %
	% we have to do a lot of work to move *some* of the current
	% settings out of the current TeX group:
	\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPa
	\expandafter\pgfplotscolormapserializetomacro\expandafter{\pgfplots@loc@TMPa}{\pgfplots@serializedcolormap}%
	\toks0=\expandafter{\pgfplots@serializedcolormap}%
	%
	\pgfkeysgetvalue{/pgfplots/colorbar addplot}\pgfplots@loc@TMPa
	\toks2=\expandafter{\pgfplots@loc@TMPa}%
	%
	\ifx\pgfplots@colorbar@src@metamin\pgfutil@empty
		\global\let\pgfplots@colorbar@src@metamin=\pgfplots@axiswide@metamin
		\global\let\pgfplots@colorbar@src@metamax=\pgfplots@axiswide@metamax
	\fi
	%
	\ifx\pgfplots@colorbar@src@metamax\pgfplots@invalidrange@metamax
		\pgfplotswarning{colorbar uninitialised}\pgfeov
		\pgfmathfloatparsenumber{0}%
		\global\let\pgfplots@colorbar@src@metamin=\pgfmathresult
		\pgfmathfloatparsenumber{1}%
		\global\let\pgfplots@colorbar@src@metamax=\pgfmathresult
	\fi
	%
	% normalize format:
	\pgfplotscoordmath{meta}{tostring}{\pgfplots@colorbar@src@metamin}%
	\global\let\pgfplots@colorbar@src@metamin=\pgfmathresult
	\pgfplotscoordmath{meta}{tostring}{\pgfplots@colorbar@src@metamax}%
	\global\let\pgfplots@colorbar@src@metamax=\pgfmathresult
	%
	\pgfplots@assemble@ref@picture
		{\pgfplots@colorbar@draw}
		{\tikz[/pgfplots/every colorbar to name picture/.try]{\pgfplots@colorbar@draw}}%
	\toks3=\expandafter{\pgfplotsretval}%
	%
	\xdef#1{%
		\noexpand\begingroup
		\noexpand\def\noexpand\pgfplots@colorbar@draw{%
			\the\toks0 % restore colormap definition
			\noexpand\def\noexpand\pgfplots@colorbar@toname{\pgfplots@colorbar@toname}%
			\the\toks1 % definitions for 'colorbar to name'
			%
			%  restore relevant styles and variables:
			\noexpand\pgfplots@colorbar@restore@saved@keys
			\noexpand\pgfkeyssetvalue{/pgfplots/point meta min}{\pgfplots@colorbar@src@metamin}%
			\noexpand\pgfkeyssetvalue{/pgfplots/point meta max}{\pgfplots@colorbar@src@metamax}%
			\noexpand\pgfkeyssetvalue{/pgfplots/colormap name}{\pgfkeysvalueof{/pgfplots/colormap name}}%
			\noexpand\pgfkeyssetvalue{/pgfplots/parent axis width}{\pgfkeysvalueof{/pgfplots/parent axis width}}%
			\noexpand\pgfkeyssetvalue{/pgfplots/parent axis height}{\pgfkeysvalueof{/pgfplots/parent axis height}}%
			\noexpand\pgfkeyssetvalue{/pgfplots/colorbar/width}{\pgfkeysvalueof{/pgfplots/colorbar/width}}%
			\noexpand\pgfkeyssetvalue{/pgfplots/colorbar addplot}{\the\toks2 }%
			\noexpand\def\noexpand\pgfplots@colormap@access{\pgfplots@colormap@access}%
			\noexpand\pgfkeyssetvalue{/pgfplots/colorbar pos*}{\pgfkeysvalueof{/pgfplots/colorbar pos*}}%
			% just to make sure that colorbar sampled respects it:
			\noexpand\pgfkeyssetvalue{/pgfplots/mark list fill}{\pgfkeysvalueof{/pgfplots/mark list fill}}%
			\noexpand\pgfplots@colorbar@define@hook%
			\noexpand\pgfplots@colorbar@draw@
			\ifx\pgfplots@colorbar@toname\pgfutil@empty
				\noexpand\pgfnodealias{current colorbar axis}{current axis}%
				\noexpand\pgfnodealias{current axis}{parent axis}%
			\fi
		}%
		\the\toks3
		\noexpand\endgroup
	}%
	\ifx\pgfplots@colorbar@toname\pgfutil@empty
	\else
		% finalize the 'colorbar to name' feature
		\toks0=\expandafter{#1}%
		\pgfplots@auxwrite{%
			\noexpand\expandafter
			\noexpand\gdef\noexpand\csname pgfplots@colorbar@to@name@\pgfplots@colorbar@toname\endcsname{\the\toks0}}%
		\xdef#1{}% NOP.
		%
		% make sure \ref{<colorbarname>} works:
		\pgfplots@label{\pgfplots@colorbar@toname}{pgfplots@colorbar@to@name@}%
	\fi
}%

\newif\ifpgfplotscolorbarCMYKworkaround
\pgfplotscolorbarCMYKworkaroundtrue

\def\pgfplots@colorbar@draw@reconfigure@if@needed@legacy{%
	\pgfkeysgetvalue{/pgfplots/colorbar/draw/.@cmd}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfplots@colorbar@draw@legacyimpl
		\begingroup
			\pgfkeysalso{/pgfplots/.search also=/tikz}%
			% we need to activate this style because the decision
			% below may depend on it (and will, for example for
			% contour filled)
			\pgfplotsset{every colorbar}%
			\pgfplots@init@collect@firstplotastick%
			%
			% Ah-- the default colorbar implementation is active! We may need to substitute it by a better one.
			% Check that:
			\def\b@pgfplots@colorbar@fallback@to@sampled{0}%
			%
			\ifpgfplots@collect@firstplot@astick
				% xtick={data} requires samples:
				% see also call hierarchy of \pgfplots@colorbar@positions@to@samplesat
				\def\b@pgfplots@colorbar@fallback@to@sampled{1}%
			\fi
			%
			\ifpgfplotscolorbarCMYKworkaround
				% the default implementation for colorbars is based on
				% \pgfplotscolormaptoshadingspec.
				% This, in turn, does NOT work for CMYK.
				%
				% This here detects that case and switches to the (visually)
				% equivalent 'colorbar sampled={surf,shader=interp}' style.
				\if1\pgfplotscolormaptoshadingspectorgb
					\pgfkeysgetvalue{/pgfplots/colormap name}\pgfplots@loc@TMPb
					\pgfplotscolormapgetcolorspace{\pgfplots@loc@TMPb}%
					\def\pgfplots@loc@TMPa{cmyk}%
					\ifx\pgfplots@loc@TMPa\pgfplotsretval
						\pgfutil@ifundefined{pgfplots@colorbar@CMYK@\pgfplots@loc@TMPb}{%
							\pgfplotswarning{colorbar CMYK unsupported}{\pgfplots@loc@TMPb}\pgfeov%
							\expandafter\gdef\csname pgfplots@colorbar@CMYK@\pgfplots@loc@TMPb\endcsname{1}%
						}{}%
						\def\b@pgfplots@colorbar@fallback@to@sampled{1}%
					\fi
				\fi
			\fi
			%
			\if c\pgfplots@colormap@access
				% colormap access=piecewise constant
				% In this case, we want a sampled colorbar.
				\def\b@pgfplots@colorbar@fallback@to@sampled{1}%
				%
			\fi
			\pgfmath@smuggleone\b@pgfplots@colorbar@fallback@to@sampled
		\endgroup
		%
		\if 1\b@pgfplots@colorbar@fallback@to@sampled
			\edef\pgfplots@loc@TMPa{%
				\noexpand\pgfplotsset{%
					colorbar sampled={%
						surf,%
						shader=interp,%
						% 2x2 samples are enough since "shader=interp"
						% automatically handles the correct interpolation scheme:
						samples=2,%
					}%
				}%
			}%
			\pgfplots@loc@TMPa
		\fi
	\fi
}%

\def\pgfplots@colorbar@draw@reconfigure@if@needed{%
	\pgfplots@colorbar@draw@reconfigure@if@needed@legacy
	\pgfplotsset{%
		/pgfplots/every axis plot post/.append code={%
			\ifpgfplots@collect@firstplot@astick
				% Oh! Someone wrote 'ytick=data. We want the precise positions.
				%
				% Note that this check needs to be done late: it must
				% be after \begin{axis} -- and since many colorbar
				% styles overwrite 'samples', we even have to run it
				% after cycle list options!
				%
				% That's why it is in 'every axis plot post':
				\pgfplots@colorbar@positions@to@samplesat
			\fi
		}%
	}%
}%

% Defines and sets 'samples at' such that it resembles the colormap
% positions.
\def\pgfplots@colorbar@positions@to@samplesat{%
	\pgfplots@colorbar@positions@to@samplesat@
	\edef\pgfplots@loc@TMPa{samples at={\pgfplotsretval}}%
	\expandafter\pgfplotsset\expandafter{\pgfplots@loc@TMPa}%
}
% Sets \pgfplotsretval such that it contains an argument for 'samples at'
\def\pgfplots@colorbar@positions@to@samplesat@{%
	\pgfkeysgetvalue{/pgfplots/point meta min}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\pgfplots@error{Please define 'point meta min' and 'point meta max' before using 'samples at colormap pos'}%
	\fi
	\pgfkeysgetvalue{/pgfplots/point meta max}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\pgfplots@error{Please define 'point meta min' and 'point meta max' before using 'samples at colormap pos'}%
	\fi
	%
	\edef\pgfplots@loc@TMPb{%
		\noexpand\pgfplotscolormapgetpositions
			[{\pgfkeysvalueof{/pgfplots/point meta min}}:{\pgfkeysvalueof{/pgfplots/point meta max}}]%
			{\pgfkeysvalueof{/pgfplots/colormap name}}%
	}%
	\pgfplots@loc@TMPb
}%

% A utility method which draws a standalone colorbar for visualization
% purposes.
%
% Example:
% \pgfplotscolorbardrawstandalone[colorbar horizontal,colormap access=const]
%
% \pgfplotscolorbardrawstandalone[colorbar horizontal,point meta max=1000]
%
\def\pgfplotscolorbardrawstandalone{%
	\pgfutil@ifnextchar[{\pgfplotscolorbardrawstandalone@opt}{\pgfplotscolorbardrawstandalone@opt[]}%
}%
\def\pgfplotscolorbardrawstandalone@opt[#1]{%
	\pgfplots@ifintikzpicture{%
		\pgfplotscolorbardrawstandalone@opt@[#1]%
	}{%
		\begin{tikzpicture}%
		\pgfplotscolorbardrawstandalone@opt@[#1]%
		\end{tikzpicture}%
	}%
}
\def\pgfplotscolorbardrawstandalone@opt@[#1]{%
	\coordinate (parent axis) at (0,0);
	\pgfplotsset{%
		point meta min=0,%
		point meta max=1000,%
		parent axis width/.initial=6cm,%
		parent axis height/.initial=6cm,%
		#1,%
		colorbar/standalone draw,%
	}%
}%


\def\pgfplots@colorbar@draw@{%
	\pgfplots@colorbar@draw@reconfigure@if@needed
	%
	% FIXME : the semicolon after ';' has a fixed catcode, namely
	% the one assigned while pgfplots.code.tex has been read.
	%
	% The \pgfplots@checkandpreparefor@active@semicolon gets
	% confused if the catcodes change... this here is a
	% work-around for babel support.
	\let\pgfplots@checkandpreparefor@active@semicolon\relax
	%
	% make sure that 'every colorbar' is checked by the key-filtering
	% stuff: we want to find 'ymode=log' inside of it.
	% Note that we have to change it here because only the colorbar
	% should expand 'every colorbar' that early in the processing:
	\pgfkeys{/pgfplots/every colorbar/.belongs to family=/pgfplots/scale}%
	%
	\pgfkeysvalueof{/pgfplots/colorbar/draw/.@cmd}\pgfeov
}

\def\pgfplotsifnodeexists#1#2#3{%
	\pgfutil@IfUndefined{pgf@sh@ns@#1}{#3}{#2}%
}%

\def\pgfplots@colorbar@get@rid@of@at@parent@axis{%
	\pgfkeysgetvalue{/pgfplots/at/.@cmd}\pgfplots@at@orig
	\pgfkeyslet{/pgfplots/at/orig/.@cmd}\pgfplots@at@orig
	%
	\pgfkeysgetvalue{/pgfplots/colorbar to name/at/.@cmd}\pgfplots@colorbar@toname@at
	\pgfkeyslet{/pgfplots/at/.@cmd}\pgfplots@colorbar@toname@at
	%
	\let\pgfplots@colorbar@get@rid@of@at@parent@axis=\relax% already applied in this scope.
}%
\pgfkeysdef{/pgfplots/colorbar to name/at}{%
	% automatically search-and-replace 'parent axis' which
	% is not defined for a detached colorbar:
	\pgfutil@in@{parent axis}{#1}%
	\ifpgfutil@in@
		\pgfplots@invoke@pgfkeyscode{/pgfplots/at/orig/.@cmd}{(0pt,0pt)}%
	\else
		\pgfplots@invoke@pgfkeyscode{/pgfplots/at/orig/.@cmd}{#1}%
	\fi
}%
\let\pgfplots@colorbar@position@hook\relax
\def\pgfplots@colorbar@define@hook{%
	\ifx\pgfplots@colorbar@toname\pgfutil@empty
		\def\pgfplots@colorbar@position@hook{%
			% I patch \pgfplots@at...
			\let\pgfplots@at@orig=\pgfplots@at
			%
			% ... and I patch \pgfplotspointdescriptionxy (but only INSIDE
			% of \pgfplots@at) ...
			\let\pgfplotspointdescriptionxy@orig=\pgfplotspointdescriptionxy
			\let\pgfplotsqpointdescriptionxy@orig=\pgfplotsqpointdescriptionxy
			\def\pgfplots@colorbar@position@prepare@CS{%
				% ... which needs to set up ONLY \pgfplotspoint@bb@@@,
				% nothing more.
				\pgfpointanchor{parent axis}{south west}%
				\edef\pgfplotspoint@bb@@@{%
					{\the\pgf@x}%
					{\the\pgf@y}%
					{\pgfkeysvalueof{/pgfplots/parent axis width}}%
					{\pgfkeysvalueof{/pgfplots/parent axis height}}%
				}%
			}%
			%
			% Install replacements:
			\def\pgfplots@at{%
				\begingroup
				\def\pgfplotspointdescriptionxy########1########2{%
					\pgfplots@colorbar@position@prepare@CS
					\pgfplotspointdescriptionxy@orig{########1}{########2}%
				}%
				\def\pgfplotsqpointdescriptionxy########1########2{%
					\pgfplots@colorbar@position@prepare@CS
					\pgfplotsqpointdescriptionxy@orig{########1}{########2}%
				}%
				\pgfplots@deprecated@anchorsfalse
				\pgfplots@change@pgfpoints@to@descriptioncs
				\pgf@process{\pgfplots@at@orig}%
				\endgroup
			}%
		}%
	\else
		% nothing to do for colorbar to name:
		\let\pgfplots@colorbar@position@hook=\relax
	\fi
}%

% Parses all options in #1 which are known in the currently active families.
%
% The result will be stored back into the TikZ-style named #1 without
% further processing.
%
% Example:
% \tikzstyle{every axis}=[xmin=0,xmax=1,line width=1pt
% \pgfplots@set@keys@from@tikz@style\tmpmacro{every axis}{/pgfplots}
%
% - sets axis options 'xmin' and 'xmax'
% - calls \tikzstyle{every axis}={line width=1pt}
%
% I assume that this method is called within local TeX groups so
% nothing will be destroyed outside.
%
% #1:  A style name.
\def\pgfplots@set@keys@from@tikz@style#1{%
	\let\pgfplots@rmopts=\pgfutil@empty
	\pgfqkeysfiltered{/pgfplots}{/pgfplots/#1}%
	\pgfplots@set@keymacro@to@style\pgfplots@rmopts{#1}%
}

% Invokes \pgfplots@set@keys@from@tikz@style and handles the "on
% layer" key.
%
% More precisely, it stores any "on layer" value found in style "#1"
% in
% /pgfplots/layers for styles/#1.
%
% If there is no such value, it will store the empty string (main
% layer)
\def\pgfplots@set@keys@from@tikz@style@and@handle@layer#1{%
	\pgfkeyslet{/pgfplots/on layer}\pgfutil@empty
	\pgfplots@set@keys@from@tikz@style{#1}%
	\pgfkeysgetvalue{/pgfplots/on layer}\pgfplots@loc@TMPa
	\pgfkeyslet{/pgfplots/layers for styles/#1}\pgfplots@loc@TMPa
}%

% The same as \pgfplots@set@keys@from@tikz@style  but this one appends
% unmatched options to style #2.
%
% #1:  A style name.
% #2:  A style name which will be filled with unprocessed options.
\def\pgfplots@set@keys@from@tikz@style@append@to#1#2{%
	\let\pgfplots@rmopts=\pgfutil@empty
	\pgfqkeysfiltered{/pgfplots}{/pgfplots/#1}%
	\pgfplots@append@keymacro@to@style\pgfplots@rmopts{#2}%
}

% #1:  A sequence of options.
% #2:  A style name which will be filled with unprocessed options.
\def\pgfplots@set@keys@and@append@remaining@to@style#1#2{%
	\let\pgfplots@rmopts=\pgfutil@empty
	\pgfqkeysfiltered{/pgfplots}{#1}%
	\pgfplots@append@keymacro@to@style\pgfplots@rmopts{#2}%
}%

% #1: input macro
\def\pgfplots@setkeys@from@macro#1{%
	\let\pgfplots@rmopts=\pgfutil@empty
	\def\pgfplots@loc@TMPa{\pgfqkeysfiltered{/pgfplots}}%
	\expandafter\pgfplots@loc@TMPa\expandafter{#1}%
}

% #1: macro
% #2: style name
\long\def\pgfplots@append@keymacro@to@style#1#2{%
	\ifx#1\pgfutil@empty
	\else
		\t@pgfplots@toka={#2/.append style=}%
		\t@pgfplots@tokb=\expandafter{#1}%
		\edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}%
		\expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}%
	\fi
%\pgfplots@message{tikzstyle{#2}+=[#1]}%
}

% #1: macro
% #2: style name
\long\def\pgfplots@set@keymacro@to@style#1#2{%
	\ifx#1\pgfutil@empty
		\pgfplotsset{#2/.code={{}}}%
	\else
		\t@pgfplots@toka={#2/.style=}%
		\t@pgfplots@tokb=\expandafter{#1}%
		\edef\pgfplots@setkeys@TMP{\the\t@pgfplots@toka{\the\t@pgfplots@tokb}}%
		\expandafter\pgfplotsset\expandafter{\pgfplots@setkeys@TMP}%
	\fi
%\pgfplots@message{tikzstyle{#2}=[#1]}%
}

% backwards compatibility:
\let\prettyprintnumber=\pgfmathprintnumber%


\def\pgfplots@set@options@sanitizemode{%
	\pgfkeyslet{/pgfplots/xmode/.@cmd}\pgfplots@cant@set@in@this@context@
	\pgfkeyslet{/pgfplots/ymode/.@cmd}\pgfplots@cant@set@in@this@context@
	\pgfkeyslet{/pgfplots/zmode/.@cmd}\pgfplots@cant@set@in@this@context@
}
\def\pgfplots@set@options@sanitize{%
	\pgfkeyslet{/pgfplots/xmin/.@cmd}\pgfplots@cant@set@in@this@context
	\pgfkeyslet{/pgfplots/ymin/.@cmd}\pgfplots@cant@set@in@this@context
	\pgfkeyslet{/pgfplots/zmin/.@cmd}\pgfplots@cant@set@in@this@context
	\pgfkeyslet{/pgfplots/xmax/.@cmd}\pgfplots@cant@set@in@this@context
	\pgfkeyslet{/pgfplots/ymax/.@cmd}\pgfplots@cant@set@in@this@context
	\pgfkeyslet{/pgfplots/zmax/.@cmd}\pgfplots@cant@set@in@this@context
}%

% This here is the main key filter for pgfplots.
%
% It sets keys if
% ( they have an active key family)
% OR
% ( they have /pgfplots/ key prefix )
% OR
% ( they are a command key which contains \tikz@plot@handler ).
%
% In all other cases, the key filter will postpone the key.
%
% Note that \tikz@plot@handler should be defined before the survey
% phase starts.
\pgfkeysdef{/pgfplots/@@key filter}{%
	\if\pgfkeyscasenumber0%
		\pgfkeysfiltercontinuefalse
	\else
		\if\pgfkeyscasenumber3%
			\pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP
		\else
			\pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP
		\fi
		\ifpgfkeyssuccess
			% it has a family. Check it!
			\pgfkeysisfamilyactive{\pgfkeyspred@TMP}%
		\else% Ok, it does not belong to any family.
			% Check if it has /pgfplots/ prefix:
			\expandafter\pgfplots@key@filter@isdescendantof\pgfkeyscurrentkey/pgfplots/\pgf@@eov
		\fi
	\fi
}
\def\pgfplots@key@filter@isdescendantof#1/pgfplots/#2\pgf@@eov{%
	\def\pgfkeyspred@TMP{#1}%
	\ifx\pgfkeyspred@TMP\pgfkeys@empty
		% Ah -- it *has* /pgfplots/ prefix. Use it!
		\pgfkeysfiltercontinuetrue
	\else
		% Hm. Probably a /tikz/ key, but who knows.
		\if1\pgfkeyscasenumber
			% It is a command key.
			% Check if the *body* of the command key contains
			% \tikz@plot@handler.
			\pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}\pgfkeyspred@TMP%
			\expandafter\pgfplots@key@filter@isplothandler\pgfkeyspred@TMP 123456789\pgfeov\tikz@plot@handler\pgfplots@EOI
		\else
			% Ok, it's no command key. Skip it directly.
			\pgfkeysfiltercontinuefalse
		\fi
	\fi
}%
\def\pgfplots@key@filter@isplothandler#1\tikz@plot@handler#2\pgfplots@EOI{%
	\def\pgfkeyspred@TMP{#2}%
	\ifx\pgfkeyspred@TMP\pgfkeys@empty
		% I didn't find '\tikz@plot@handler' in the key's body. Ok.
		% key won't be processed.
		\pgfkeysfiltercontinuefalse
	\else
		% Aaah -- it is something like /tikz/ybar! process it.
		\pgfkeysfiltercontinuetrue
	\fi
}%

\def\pgfplots@set@options#1{%
	\pgfplots@check@global@colorspace@overrides
	\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}%
	}{%
		\edef\pgfplots@at{\noexpand\pgfqpoint{\the\tikz@lastx}{\the\tikz@lasty}}%
	}%
	%
	% Temporarily assign families to 'name' and 'alias' options.
	% This allows to get the names - they should not be appended to
	% 'every axis'!
	\pgfkeyssetfamily{/tikz/name}{/pgfplots/naming commands}%
	\pgfkeyssetfamily{/tikz/alias}{/pgfplots/naming commands}%
	\pgfkeyssetfamily{/tikz/overlay}{/pgfplots/shared with tikz}%
	\pgfkeyssetfamily{/tikz/variable}{/pgfplots}%
	%
	\pgfkeysdef{/pgfplots/declare function}{\pgfkeysalso{/pgf/declare function={##1}}}%
	\pgfkeyssetfamily{/pgf/declare function}{/pgfplots}%
	%
	% ... we need to set these options during the survey phase
	% (because it might be interesting for enlarge limits to depend
	% upon their value):
	\pgfkeysdef{/pgfplots/bar width}{\pgfkeysalso{/pgf/bar width={##1}}}%
	\pgfkeysdef{/pgfplots/bar shift}{\pgfkeysalso{/pgf/bar shift={##1}}}%
	\pgfkeyssetfamily{/pgf/bar width}{/pgfplots}%
	\pgfkeyssetfamily{/pgf/bar shift}{/pgfplots}%
	%
	\pgfkeyssetfamily{/pgf/trig format}{/pgfplots}%
	\pgfkeyssetfamily{/pgf/trig format/deg}{/pgfplots}%
	\pgfkeyssetfamily{/pgf/trig format/rad}{/pgfplots}%
	%
	\pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@rmopts}%
	%
	\let\tikz@alias=\pgfutil@empty
	\let\tikz@fig@name=\pgfutil@empty
	%
	% Step 1: acquire ONLY 'xmode' and 'ymode' (necessary to decide
	% which axis style shall be loaded):
		\let\pgfplots@rmopts=\pgfutil@empty
		\pgfkeysinstallkeyfilter{/pgf/key filters/active families and known}{}%
		%
		\pgfqkeysactivatesinglefamilyandfilteroptions{/pgfplots/scale}%
			{/pgfplots}
			{#1,/pgfplots/every axis post}%
	\let\pgfplots@remaining@input=\pgfplots@rmopts
	%
	\pgfplotssetaxistype{\pgfkeysvalueof{/pgfplots/axis type}}%
	%
	% Step 2: parse any pgfplots options out of styles.
	\pgfkeysactivatefamily{/pgfplots/style commands}%
	%\pgfkeysinstallkeyfilter{/pgf/key filters/active families or descendants of}{/pgfplots}
	\pgfkeysinstallkeyfilter{/pgfplots/@@key filter}{}%
	%
	\pgfkeysactivatefamilies
		{/pgfplots,/pgfplots/naming commands,/pgfplots/tick,/pgfplots/legend,/pgfplots/scale}%/pgfplots/descriptions,}
		{\pgfplots@deactivefamiliescmd}%
		\pgfplots@set@keys@from@tikz@style{every axis}%
		\pgfkeysdeactivatefamily{/pgfplots/scale}%
		%
		\pgfplots@set@keys@from@tikz@style@append@to{every \pgfkeysvalueof{/pgfplots/axis type} axis}{every axis}%
		%
		\ifpgfplots@xislinear
			\ifpgfplots@yislinear
				\pgfplots@set@keys@from@tikz@style@append@to{every linear axis}{every axis}%
			\else
				\pgfplots@set@keys@from@tikz@style@append@to{every semilogy axis}{every axis}%
			\fi
		\else
			\ifpgfplots@yislinear
				\pgfplots@set@keys@from@tikz@style@append@to{every semilogx axis}{every axis}%
			\else
				\pgfplots@set@keys@from@tikz@style@append@to{every loglog axis}{every axis}%
			\fi
		\fi
	\pgfplots@deactivefamiliescmd
	\pgfplots@set@options@sanitizemode
	%
	% Acquire style commands and nameing commands from direct input
	% options '#1' BEFORE the 'every' styles are processed:
	\pgfkeysactivatefamily{/pgfplots/naming commands}%
	\pgfkeysactivatefamily{/pgfplots/shared with tikz}%
		\pgfplots@setkeys@from@macro\pgfplots@remaining@input%
		\let\pgfplots@remaining@input=\pgfplots@rmopts
	\pgfkeysdeactivatefamily{/pgfplots/naming commands}%
	\pgfkeysdeactivatefamily{/pgfplots/shared with tikz}%
	%
	\pgfplots@set@options@of@layered@graphics
	%
	% Now, any 'name' and 'alias' options have been processed.
	%
	% Remember their current meaning and reset the tikz options!
	\let\pgfplots@fig@name=\tikz@fig@name
	\let\pgfplots@fig@alias=\tikz@alias
	\let\tikz@alias=\pgfutil@empty
	\let\tikz@fig@name=\pgfutil@empty
	%
	% And protocol all named sub-nodes! Their positions need to be
	% updated later.
	\global\let\pgfplots@named@child@node@list=\pgfutil@empty
	\pgfutil@ifundefined{pgfplots@old@name@impl}{%
		\pgfkeysgetvalue{/tikz/name/.@cmd}\pgfplots@old@name@impl
		\pgfkeysgetvalue{/tikz/alias/.@cmd}\pgfplots@old@alias@impl
	}{}%
	\pgfkeysdef{/tikz/name}{%
		\pgfplots@add@named@child@node{##1}%
		\pgfplots@old@name@impl##1\pgfeov
	}%
	\pgfkeysdef{/tikz/alias}{%
		\pgfplots@add@named@child@node{##1}%
		\pgfplots@old@alias@impl##1\pgfeov
	}%
	%
	% Now, continue to process the 'every' styles. Please note that
	% options like 'legend style={}' have already been processed;
	% their values are already inside of the associated 'every'
	% styles.
	%
	% What I am doing here is: set every pgfplots-option directly, and
	% discard it from the every-style. Any non-pgfplots-option will
	% be set in its context.
	%
	\pgfkeysactivatefamily{/pgfplots/legend}%
		% this special treatmeant allows the (otherwise unsupported) construction
		% 'legend style={legend pos=outer north east}':
		\pgfkeysdef{/pgfplots/every axis legend/.append style}{\pgfkeysalso{##1}}%
		%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every axis legend}%
		%
		% restore:
		\pgfkeysdef{/pgfplots/every axis legend/.append style}{%
			\pgfkeysalso{/pgfplots/every axis legend/.add code={}{\pgfkeysalso{##1}}}%
		}%
	\pgfkeysdeactivatefamily{/pgfplots/legend}%
	%
	% FIXME : VERIFY!
	% If I am not mistaken, these statements are only useful to allow
	% 'xlabel style={xlabel=$x$}'  --- which is not intuitive anyway.
	%\pgfkeysactivatefamily{/pgfplots/descriptions}%
	%	\pgfplots@set@keys@from@tikz@style{every axis label}%
	%	\pgfplots@set@keys@from@tikz@style{every axis x label}%
	%	\pgfplots@set@keys@from@tikz@style{every axis y label}%
	%	\pgfplots@set@keys@from@tikz@style{every axis title}%
	%\pgfkeysdeactivatefamily{/pgfplots/descriptions}%
	%
	\pgfkeysactivatefamily{/pgfplots/tick}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every tick}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every minor tick}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every major tick}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every axis grid}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every minor grid}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every major grid}%
	\pgfkeysdeactivatefamily{/pgfplots/tick}%
	%
	%--------------------------------------------------
	% \pgfkeysactivatefamily{/pgfplots}%
	% 	\pgfplots@set@keys@from@tikz@style{every axis plot}%
	% \pgfkeysdeactivatefamily{/pgfplots}%
	%--------------------------------------------------
	%
	% Attention: do NOT set the description styles here! Setting them
	% must be postponed until |every 3d description| has been set (to
	% ensure that \axis[<options>] take higher precedence).
	%\pgfkeysactivatefamily{/pgfplots/descriptions}%
	\pgfkeysactivatefamily{/pgfplots/tick}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every x tick label}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every y tick label}%
		\pgfplots@set@keys@from@tikz@style@and@handle@layer{every tick label}%
	\pgfkeysdeactivatefamily{/pgfplots/tick}%
	%\pgfkeysdeactivatefamily{/pgfplots/descriptions}%
	%
	% Step 3: Set all remaining options of '#1'. They should have
	% highest precedence.
	\pgfkeysactivatefamilies
		{/pgfplots,/pgfplots/tick,/pgfplots/legend}%,/pgfplots/descriptions}%
		{\pgfplots@deactivefamiliescmd}%
		\expandafter
			\pgfplots@set@keys@and@append@remaining@to@style
		\expandafter
			{\pgfplots@remaining@input}%
			{every axis}%
	\pgfplots@deactivefamiliescmd
%\pgfkeysgetvalue{/pgfplots/every axis/.@cmd}\pgfplots@loc@TMPa
%\message{every axis is now '\meaning\pgfplots@loc@TMPa'}%
	%
	\pgfkeysdeactivatefamily{/pgfplots/style commands}%
	\global\pgfkeysgetvalue{/pgfplots/xmin}{\pgfplots@xmin}%
	\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}%
	%
	\pgfplots@init@collect@firstplotastick
	\global\let\pgfplots@firstplot@coords@x=\pgfutil@empty
	\global\let\pgfplots@firstplot@coords@y=\pgfutil@empty
	\global\let\pgfplots@firstplot@coords@z=\pgfutil@empty
	\pgfkeysalso{/pgfplots/.search also=/tikz}%
	%
	\pgfkeysifdefined{/tikz/on layer}{}{%
		% make sure assignments 'on layer' in the /tikz/ prefix
		% doesn't hurt.
		% this may happen, for example with
		% 'x grid style={on layer=...}'
		% because 'x grid style' is not processed by the key filtering
		% above (it is extracted later).
		\pgfkeyslet{/tikz/on layer}\pgfutil@empty%
	}%
	%
	\pgfplots@set@patched@options
	%
	\pgfplots@set@options@sanitize
	\pgfplots@notify@options@are@set
}

\def\pgfplots@init@collect@firstplotastick{%
	\def\pgfplots@loc@TMPa{data}%
	\pgfplots@collect@firstplot@astickfalse
	\ifx\pgfplots@xtick\pgfplots@loc@TMPa
		\pgfplots@collect@firstplot@asticktrue
	\fi
	\ifx\pgfplots@ytick\pgfplots@loc@TMPa
		\pgfplots@collect@firstplot@asticktrue
	\fi
	\ifx\pgfplots@ztick\pgfplots@loc@TMPa
		\pgfplots@collect@firstplot@asticktrue
	\fi
	\pgfkeysgetvalue{/pgfplots/minor xtick}\pgfplots@loc@TMPb
	\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
		\pgfplots@collect@firstplot@asticktrue
	\fi
	\pgfkeysgetvalue{/pgfplots/minor ytick}\pgfplots@loc@TMPb
	\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
		\pgfplots@collect@firstplot@asticktrue
	\fi
	\pgfkeysgetvalue{/pgfplots/minor ztick}\pgfplots@loc@TMPb
	\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
		\pgfplots@collect@firstplot@asticktrue
	\fi
}%

\def\pgfplots@set@options@of@layered@graphics{%
	\ifpgfplots@axis@on@top
		\ifpgfplots@layered@graphics
			\pgfplots@log3{the combination of 'axis on top' and 'activate layers' implies 'set layers=axis on top'. Deactivate 'axis on top' if you want other layers.}%
			\pgfplotsset{set layers=axis on top}%
		\fi
	\fi
	% retrieve layer configurations (the one set with 'set layers*').
	\pgfkeysgetvalue{/pgfplots/@set layers arg}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
	\else
		% ah, yes: then set its style:
		\pgfqkeys{/pgfplots/layers}{\pgfplots@loc@TMPa}% note that this here should not need key filtering; it adjusts only styles (hopefully ;) )
	\fi
}%

\def\pgfplots@set@patched@options{%
  	\pgfkeysdef{/pgfplots/@@@tmp}{%
		\let\tikz@intersect@def=\gdef
		\pgfkeys{/tikz/name path={##1}}%
	}%
	\pgfkeysgetvalue{/pgfplots/@@@tmp/.@cmd}\pgfplots@name@path@global@cmd@pgf@two@ten
	%
	\pgfkeysifdefined{/tikz/name path/.@cmd}{%
		% 'name path' does not work inside of a pgfplots axis because
		% pgfplots unnecessarily introduces extra \scopes around each path :-/
		% it needs to be 'name path global'.
		% PATCH IT:
		\pgfkeysgetvalue{/tikz/name path global/.@cmd}\pgfplots@loc@TMPa%
		\ifx\pgfplots@loc@TMPa\pgfplots@name@path@global@cmd@pgf@two@ten
			% ah - we operate against PGF 2.10 . In this case, we must
			% not indirect from 'name path' to 'name path global' - would lead to
			% an indefinite loop.
			% Patch absolutely:
			\pgfkeysgetvalue{/tikz/name path/.@cmd}\pgfplots@name@path@cmd@pgf@two@ten%
			\pgfkeysdef{/tikz/name path}{%
				% see the value of
				% \pgfplots@name@path@global@cmd@pgf@two@ten to verify
				% this patch:
				\let\tikz@intersect@def=\gdef
				\pgfplots@name@path@cmd@pgf@two@ten{##1}\pgfeov
			}%
		\else
			\pgfkeysdef{/tikz/name path}{\pgfkeysalso{/tikz/name path global={##1}}}%
		\fi
	}{%
		\pgfkeysdef{/tikz/name path}{\pgfplots@error{'name path' is undefined. Please load \string\usetikzlibrary{intersections} or \string\usepgfplotslibrary{fillbetween}}}%
	}%
}

% EMPTY. This will be overridden by tex-engine specific code.
% At the time of this writing, the latex driver will check for xcolor
% configuration options and will override
%   mesh/colorspace explicit color output
% and
%	colormap default colorspace
% if needed.
\def\pgfplots@check@global@colorspace@overrides{%
}%

\def\pgfplots@add@named@child@node#1{%
	\xdef\pgfplots@named@child@node@list{\pgfplots@named@child@node@list,{#1}}%
}%

\def\pgfplots@notify@options@are@set{}%

\def\pgfplots@install@abbrev@commands{
	\let\pgfplots@orig@path=\path
	\let\pgfplots@orig@plot=\plot
	%
	\let\axispath=\pgfplots@path
	\let\pgfplotsinterruptdatabb=\pgfplots@interruptdatabb
	\let\endpgfplotsinterruptdatabb=\endpgfplots@interruptdatabb
	%
	\let\addplot=\pgfplots@addplot
	\let\plot=\addplot
	%
	%
	\def\logten{2.3025851}%
	\def\reciproclogten{0.434294}%
	%
	\def\logi##1{%
		\ifcase##1
		\or0
		\or0.693147
		\or1.098612
		\or1.386294
		\or1.60943791
		\or1.7917594
		\or1.94591014
		\or2.07944154
		\or2.197224
		\fi
	}%
	\def\axisdefaultticklabel{\pgfplots@ticklabel@typeset@arg{\pgfmathprintnumber{\tick}}}%
	\def\axisdefaultticklabellog{%
		\pgfplots@ticklabel@typeset@arg{%
			\pgfkeysgetvalue{/pgfplots/log number format code/.@cmd}\pgfplots@log@label@style
			\expandafter\pgfplots@log@label@style\tick\pgfeov
		}%
	}%
	%
	\let\legend=\pgfplots@command@legend
	\let\addlegendimage=\pgfplots@addlegendimage
	\let\addlegendentry=\pgfplots@addlegendentry
	\let\addlegendentryexpanded=\pgfplots@addlegendentryexpanded
}

\let\pgfplots@late@options=\pgfutil@empty
\def\pgfplotssetlateoptions#1{%
	\pgfplotsset{#1}%
}%
\def\pgfplotssetlateoptions@late#1{%
	\t@pgfplots@toka=\expandafter{\pgfplots@late@options}%
	\t@pgfplots@tokb={#1}%
	\xdef\pgfplots@late@options{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}%
}%

\def\pgfplots@environment{%
	\pgfutil@ifnextchar[{%
		\pgfplots@environment@opt
	}{%
		\pgfplots@environment@opt[]%
	}%
}%

% temporary (local) variables inside of axis
\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

% Extracts single components of an entry of
% \pgfplots@stored@plotlist
%
% They are defined as
% \pgfplots@stored@current@precmd
% \pgfplots@stored@current@cmd
% \pgfplots@stored@current@data
% \pgfplots@stored@current@postcmd
\long\def\pgfplots@stored@plotlist@EXTRACTENTRY#1#2#3#4{%
	% the token register stuff allows '#' inside of arguments.
	\t@pgfplots@tokc={#1}%
	\edef\pgfplots@stored@current@precmd{\the\t@pgfplots@tokc}%
	%
	\t@pgfplots@tokc={#2}%
	\edef\pgfplots@stored@current@cmd{\the\t@pgfplots@tokc}%
	%
	\def\pgfplots@stored@current@data{#3}%
	%
	\t@pgfplots@tokc={#4}%
	\edef\pgfplots@stored@current@postcmd{\the\t@pgfplots@tokc}%
	%
}

\def\pgfplots@init@cleared@structures{%
	\global\pgfplotslistnewempty\pgfplots@plotspeclist
	\global\pgfplotslistnewempty\pgfplots@legend
	\global\pgfplotslistnewempty\pgfplots@stored@plotlist
	\global\pgfplots@numplots=0
	\let\pgfplots@already@computed@legend@node=\pgfutil@empty
}

% Takes a plot style and exports it to a self-contained drawing
% command which can be used outside of the current context.
%
% This macro is used inside for \label{} / \ref{}; it tries to be
% reasonable smart about restoring relevant flags stored in a pgfplots
% axis. If it forgets something... well, it is not too smart.
%
% #1: the style to export.
% #2: either empty or the fully qualified name of a code key. If #2 is not empty,
% the current value of the code key is remembered. It will be restored
% just before the exported \tikz statement is invoked, and \tikz[#2]
% will be called. The code key should not rely on any arguments (it
% won't be given any)
%
% The exported routine autodetects whether the result is used inside of
% a picture. In that case, the '#2' style will be set inside of a
% scope instead of \tikz[#2].
%
% Assembles a macro \pgfplotsretval which, upon execution, draws the
% plot style.
%
% As a side effect, it returns the resulting plot style (nothing else) into
% \pgfplotsretvalb
\def\pgfplots@export@legend@image@to@macro#1#2{%
	\begingroup
	% I'd like to get all options which are INDEPENDENT of
	% pgfplots. Idea: expand all /pgfplots-keys and collect
	% everything which belongs NOT to /pgfplots. This is the
	% completely expanded rest. At least, I hope so and it appears
	% to work.
	%
	% FIXME : this was a good approach before. Now, there ARE
	% /pgfplots keys which should be maintained. How shall I do that?
	% I can't handle every option separately... !?
	\pgfkeysinstallkeyfilter
		{/pgf/key filters/and}
			{{/pgf/key filters/is descendant of=/pgfplots}%
			 {/pgf/key filters/defined}}%
	\def\pgfplots@label@tikzopts{}%
	\pgfkeysinstallkeyfilterhandler{/pgf/key filter handlers/append filtered to}{\pgfplots@label@tikzopts}%
	% FIXME : this fails if 'error bars/.cd,/pgfplots/.cd' is used inside of #1 --
	% the second /pgfplots/.cd will be applied, but the error bars
	% command not
	\pgfqkeysfiltered{/tikz}{#1}%
	%
	\pgfkeysgetvalue{/pgfplots/legend image code/.@cmd}{\pgfplots@curlegendcode}%
	\pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler
	\toks0=\expandafter{\pgfplots@curlegendcode\pgfeov}%
	\toks1=\expandafter{\pgfplots@label@tikzopts}%
	\toks3=\expandafter{\pgfplots@basiclevel@plothandler}%
	\def\pgfplots@stylekey{#2}%
	\ifx\pgfplots@stylekey\pgfutil@empty
	\else
		\pgfkeysgetvalue{\pgfplots@stylekey/.@cmd}{\pgfplots@stylekey@}%
		\toks4=\expandafter{\pgfplots@stylekey@\pgfeov}%
	\fi
	\edef\pgfplots@loc@TMPa{%
		{%
			\ifx\pgfplots@stylekey\pgfutil@empty
			\else
				\noexpand\scope[#2]%
			\fi
			%
			\noexpand\pgfplots@draw@image
			%
			\ifx\pgfplots@stylekey\pgfutil@empty
			\else
				\noexpand\endscope%
			\fi
		}{%
			\noexpand\tikz[#2]{%
				\noexpand\pgfplots@draw@image
			}%
		}%
	}%
	\expandafter\pgfplots@assemble@ref@picture\pgfplots@loc@TMPa
	\toks5=\expandafter{\pgfplotsretval}%
	\pgfkeysgetvalue{/pgfplots/every legend image post/.@cmd}\pgfplots@legend@image@post
	\toks6=\expandafter{\pgfplots@legend@image@post\pgfeov}%
	%
	\edef\pgfplotsretval{%
		\noexpand\begingroup
		\noexpand\def\noexpand\pgfplots@draw@image{%
			\noexpand\def\noexpand\tikz@plot@handler{\the\toks3}%
			\noexpand\pgfkeysdef{/pgfplots/legend image code}{\the\toks0}%
			\noexpand\pgfkeysdef{/pgfplots/every legend image post}{\the\toks6 }%
			\noexpand\pgfkeyssetvalue{/pgfplots/mark list fill}{\pgfkeysvalueof{/pgfplots/mark list fill}}%
			\ifx\pgfplots@stylekey\pgfutil@empty
			\else
				\noexpand\pgfkeysdef{#2}{\the\toks4}%
			\fi
			\noexpand\pgfplots@show@small@legendplots{\the\toks1}{}%
		}%
		\the\toks5
		\noexpand\endgroup%
	}%
	\xdef\pgfplots@glob@TMPa{\the\toks1}%
	\pgfmath@smuggleone\pgfplotsretval
	\endgroup
	\let\pgfplotsretvalb=\pgfplots@glob@TMPa
}%

% The implementation for \label{foo} after \addplot. It allows to
% \ref{foo} (it inserts the 'legend image code').
%
% With
% \addplot[scatter/classes={a={}}] ... ;
% \label[a]{my label}
% you can reference scatter/classes labels.
%
% I only need to overwrite '\label'; the rest is done by LaTeX.
%
% THIS IS INCOMPATIBLE WITH plain TeX and ConTeXt! Don't use it, it
% doesn't hurt.
\def\pgfplots@plot@label{%
	\pgfutil@ifnextchar<{%
		\pgfplots@plot@label@beamer@mode
	}{%
		\pgfutil@ifnextchar[{\pgfplots@plot@label@{}}{\pgfplots@plot@label@{}[]}%
	}%
}%
\def\pgfplots@plot@label@beamer@mode<#1>{
		\pgfutil@ifnextchar[{\pgfplots@plot@label@{<#1>}}{\pgfplots@plot@label@{<#1>}[]}%
}
% #1: optional prefix options, used to support
% \label<...>{<name>} of beamer package
\def\pgfplots@plot@label@#1[#2]#3{%
	\ifpgfplots@has@label@information
		\begingroup
		\expandafter\let\expandafter\pgfplots@loc@TMPb\csname pgfplots@last@plot@style@#2\endcsname
		\expandafter\pgfplots@export@legend@image@to@macro\expandafter{\pgfplots@loc@TMPb}{/pgfplots/every crossref picture}%
		%
		\t@pgfplots@toka=\expandafter{\pgfplotsretval}%
		\t@pgfplots@tokb=\expandafter{\pgfplotsretvalb}%
		% 1. prepare /pgfplots/refstyle={#3}:
		\pgfplots@auxwrite{%
			\noexpand\expandafter\noexpand\gdef
			\noexpand\csname pgfplots@labelstyle@#3\noexpand\endcsname{\the\t@pgfplots@tokb}%
		}%
		% 2. prepare \ref{#3} and \pageref{#3}:
		%
		% There are several nasty things to consider:
		% a) macro expansion. Use \string to allow a safe \write
		% operation.
		%
		% b) \protect . If the resulting \ref{} command occurs within
		% a "moving argument" like \caption or so, we need to use
		% proper '\protect'ion.
		%
		% this here is the low-level implementation of \ref{#3}. Write it into
		% the .aux file:
		\pgfplots@auxwrite{%
			\noexpand\expandafter\noexpand\gdef
			\noexpand\csname pgfplots@show@ref@#3\noexpand\endcsname{%
				\the\t@pgfplots@toka
			}%
		}%
		% create the \label command:
		\let\label=\pgfplots@original@LaTeX@label
		\pgfplots@label[#1]{#3}{pgfplots@show@ref@}%
		\endgroup
	\else
		\pgfplots@error{Can't create \string\label{#3}: it needs to be called after \string\addplot.}%
	\fi
}%


\def\pgfplots@interruptdatabb{\pgfplots@bb@isactivefalse}
\def\endpgfplots@interruptdatabb{\pgfplots@bb@isactivetrue}

\def\pgfplots@search@also@tikz{%
	% make sure the search path is set.
	% Inside of an axis, this is already ok.
	\pgfkeysifdefined{/pgfplots/.unknown/.@cmd}%
		{\relax}% search path in /pgfplots is already set
		{%
%\message{DEBUG: re-initializing /pgfplots/.search also=/tikz  in current plot style!}%
			\pgfkeysalso{/pgfplots/.search also=/tikz}%
		}%
}%

% A helper method which defines
%  `/tikz/current plot style' to be {#1}  --- with properly set key
%  search paths.
\def\pgfplots@define@currentplotstyle@as#1{%
	\pgfkeysdef{/tikz/current plot style}{%
		\pgfplots@search@also@tikz
		%
		% Make sure that
		% \addplot[every mark/.append style={...}]
		% or something like that is interpreted as /tikz/ key:
		\pgfplots@invoke@pgfkeyscode{/handler config/full or existing/.@cmd}{}% restrict
		%
		\pgfkeysdef{/pgfplots/colorbar source}{}% make it NO-OP here. It has already been processed.
		%
		\pgfplots@install@local@bar@handlers% see its docs.
		%
		% set both, pgfplots and tikz keys:
		% the draw is important since \addplot visualizes its stuff
		% with \path coordinates ...
		% -> we need to activate draw mode here.
		\pgfplotsset{/tikz/draw,#1}%
		\pgfplots@invoke@pgfkeyscode{/handler config/all/.@cmd}{}% unrestrict
		%
		% the final plot processing uses
		% foreach stored \addplot command :
		%   \scope[current plot style]
		%   <finalize coord stream>
		%   \draw <finalized coord stream>
		%   \endscope
		% -> the problem: \draw reset the modes 'draw,fill' etc which
		%  have been set in \scope!
		% -> ad-hoc-solution:
		%    restore the modes manually.
		\pgfplots@every@addplot@path@prepare%
		%
		\pgfplots@markers@check@for@default@plot@mark%
		%
		%
		% This is done here. The \pgfplots@drawmodes is ONLY set
		% inside of this scope, so we can check for that particular
		% case:
		\pgfkeys{/tikz/every path/.append code={%
				% FIXME : is that portable!?
				\pgfplots@every@addplot@path
				\pgfplots@every@addplot@firstpath
				\let\pgfplots@every@addplot@firstpath=\pgfutil@empty
			}%
		}%
	}%
}%

\def\pgfplots@every@addplot@path{}
\def\pgfplots@every@addplot@firstpath{}

\def\pgfplots@every@addplot@path@prepare{%
	\let\pgfplots@every@addplot@path=\pgfutil@empty
	\let\pgfplots@every@addplot@firstpath=\pgfutil@empty
	%
	% remember these technical things: they will be
	% reset in \path (see below!), so we will need to re-activate
	% them.
	% The re-activation is done in 'every path'.
	\pgfplots@assert@tikzinternal@exists{tikz@options}%
	\pgfplots@assert@tikzinternal@exists{tikz@mode}%
	\let\pgfplots@drawoptions=\tikz@options
	\let\pgfplots@drawmodes=\tikz@mode
	\pgfplots@everypath@prepare@append{\pgfplots@every@addplot@path}{\pgfplots@restore@drawmodes}%
	%
	\iftikz@decoratepath
		\pgfplots@everypath@prepare@append{\pgfplots@every@addplot@firstpath}{\tikz@decoratepathtrue}%
	\fi
	\pgfplots@everypath@prepare@append@macrorestore{\pgfplots@every@addplot@firstpath}\tikz@preactions
	\pgfplots@everypath@prepare@append@macrorestore{\pgfplots@every@addplot@firstpath}\tikz@postactions
}%
\long\def\pgfplots@everypath@prepare@append#1#2{%
	\t@pgfplots@toka=\expandafter{#1}%
	\t@pgfplots@tokb={#2}%
	\edef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
}%
\long\def\pgfplots@everypath@prepare@append@macrorestore#1#2{%
	\t@pgfplots@toka=\expandafter{#1}%
	\t@pgfplots@tokb=\expandafter{#2}%
	\edef#1{%
		\the\t@pgfplots@toka
		\noexpand\def\noexpand#2{\the\t@pgfplots@tokb}%
	}%
}%


\newif\ifpgfplots@drawmodes@append

\def\pgfplots@restore@drawmodes{%
	\pgfutil@ifundefined{pgfplots@drawmodes}%
		{\relax}%
		{%
			\ifpgfplots@drawmodes@append
				\t@pgfplots@toka=\expandafter{\tikz@mode}%
				\t@pgfplots@tokb=\expandafter{\pgfplots@drawmodes}%
				\edef\tikz@mode{\the\t@pgfplots@tokb\the\t@pgfplots@toka}%
			\else
				\let\tikz@mode=\pgfplots@drawmodes
			\fi
%			\let\tikz@options=\pgfplots@drawoptions
		}%
}%

% Callback if the LUA backend does not support a sub-operation. The
% reason will be logged.
\def\pgfplots@LUA@backend@failed{%
	\ifpgfplots@LUA@fail@on@TeX@fallback
		\pgfplots@error{lua backend has been deactivated since some input option is unsupported and 'lua debug=compileerror' is active. Please see the most recent message in your .log file for details}%
	\fi
}%

\def\pgfplots@LUA@visualizationlog@deactivation#1{%
	\pgfplots@log{\pgfplots@LUA@loglevel@info}{Using 'lua backend=false' for axis: #1.}%
	\pgfplots@LUA@backend@failed
}%
\def\pgfplots@prepare@LUA@api{%
	\ifpgfplots@LUA@backend@supported
		\ifpgfplots@LUA@supported
		\else
			\pgfplots@LUA@backend@supportedfalse
		\fi
		%
		\ifpgfplots@stackedmode
			\pgfplots@LUA@visualizationlog@deactivation{stacked plots unsupported (yet)}%
			\pgfplots@LUA@backend@supportedfalse
		\fi
		%
		\ifpgfplots@xislinear\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@visualizationlog@deactivation{xmode=log unsupported (yet)}\fi
		\ifpgfplots@yislinear\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@visualizationlog@deactivation{ymode=log unsupported (yet)}\fi
		\ifpgfplots@zislinear\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@visualizationlog@deactivation{zmode=log unsupported (yet)}\fi
		%
		\pgfkeysgetvalue{/pgfplots/x coord trafo/.@cmd}\pgfplots@loc@TMPc\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@visualizationlog@deactivation{x coord trafo unsupported}\fi
		\pgfkeysgetvalue{/pgfplots/y coord trafo/.@cmd}\pgfplots@loc@TMPc\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@visualizationlog@deactivation{x coord trafo unsupported}\fi
		\pgfkeysgetvalue{/pgfplots/z coord trafo/.@cmd}\pgfplots@loc@TMPc\ifx\pgfplots@loc@TMPc\pgfplots@empty@command@key\else \pgfplots@LUA@backend@supportedfalse\pgfplots@LUA@visualizationlog@deactivation{x coord trafo unsupported}\fi
		%
		% FIXME: collect all remaining	items
		%
		\ifpgfplots@LUA@backend@supported
			\pgfplots@log{\pgfplots@LUA@loglevel@debug}{lua backend=true: Activating LUA backend for axis.}%
			\pgfplotsutil@directlua{%
				pgfplots.gca = pgfplots.Axis.new();
				pgfplots.gca.is3d = \pgfplots@boolval{pgfplots@threedim};
				pgfplots.gca.clipLimits = {
					\pgfplots@boolval{pgfplots@clip@limits@x},
					\pgfplots@boolval{pgfplots@clip@limits@y},
					\pgfplots@boolval{pgfplots@clip@limits@z} };
				pgfplots.gca.autocomputeAllLimits = \pgfplots@boolval{pgfplots@autocompute@all@limits};
				pgfplots.gca.autocomputeMin = {
					\pgfplots@boolval{pgfplots@autocompute@xmin},
					\pgfplots@boolval{pgfplots@autocompute@ymin},
					\pgfplots@boolval{pgfplots@autocompute@zmin} };
				pgfplots.gca.autocomputeMax = {
					\pgfplots@boolval{pgfplots@autocompute@xmax},
					\pgfplots@boolval{pgfplots@autocompute@ymax},
					\pgfplots@boolval{pgfplots@autocompute@zmax} };
				% attention: min/max is (also) handed over in \pgfplots@LUA@survey@start
			}%
		\fi
	\fi
}%

\long\def\pgfplotsifissurveyphase#1#2{%
	\if\pgfplots@phase@name s%
		#1\relax
	\else
		#2\relax
	\fi
}%
\long\def\pgfplotsifisvisualizationphase#1#2{\pgfplotsifissurveyphase{#2}{#1}}
\def\pgfplots@phase@name{X}

% Invokes #1 if the statement occurs within \begin{axis}...\end{axis}
% and #2 if not.
\long\def\pgfplotsifinaxis#1#2{%
	\pgfutil@ifundefined{pgfplots@is@in@axis}{#2}{#1}%
}%

%
% \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
%   \pgfplots@invalidrange@meta[max,min]
%   	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
%   \pgfplots@axiswide@metamin
%   \pgfplots@axiswide@metamax
%   	- if meta data is active, these macros will contain the upper
%   	and lower bound for meta data, the first two on a per-plot
%   	basis the latter to globally for the complete axis.
%   	- will be assigned globally.
%   	- meta data is ALWAYS collected in floating point.
% - \pgfplots@colorbar@src@metamin
% - \pgfplots@colorbar@src@metamax
%   	- these keys are usually empty, unless one provides the
%   	'colorbar source' key for an \addplot command. In that case,
%   	they will be filled (globally) with the point meta min/max
%   	ranges of that particular plot. The colorbar will use the
%   	result for its ranges.
% - \pgfplots@numplots
%   	- A count register indexing the current plot counter. Assigned
%   	globally.
% - \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.
% - \pgfplotssurveyphase@setactiveplothandlers
%   	A macro which is used to implement '\numplotsofactualtype'
%   	see \pgfplots@countplots@advance for details.
%
%
%
\def\pgfplots@environment@opt[#1]{%
	\begingroup
	\pgfplots@define@dummies@for@pseudoconstants
	\pgfplotsifinaxis{%
		\pgfplots@error{%
			Sorry, nested axis environments are not supported.
			Please move the inner axis environment below \string\end{axis} and
			use alignment options (for example named nodes, see manual) to place it at the desired
			position}%
	}{}%
	\def\pgfplots@is@in@axis{1}%
	\pgfplots@environment@opt@@setup@pgfpoint@restores
	%
	\pgfplots@checkandpreparefor@active@semicolon
	%
	\pgfplots@install@abbrev@commands
	\pgfplots@stacked@initialise
	\pgfplotsplothandlers@init
	%
	%
	% The explicit specification of 'x' and 'y' as 1pt is to avoid
	% numeric overflow/underflow during scale computations:
	%
	% The scaling (i.e. proper values for 'x' and 'y') will be
	% determined later-on, dependend on the axis limits.  Since axis
	% limits are implicitly in units of 1pt, it is reasonable to use
	% '1pt' here as well.
	\pgfsetxvec{\pgfqpoint{1pt}{0pt}}%
	\pgfsetyvec{\pgfqpoint{0pt}{1pt}}%
	\pgfsetzvec{\pgfqpoint{0pt}{0pt}}%
	%
	\pgfplots@set@options{#1}%
	\global\let\pgfplots@late@options=\pgfutil@empty
	\let\pgfplotssetlateoptions=\pgfplotssetlateoptions@late
	%
	%
	%
	% --------------------
	% Allocations:
	% --------------------
	\pgfplots@init@cleared@structures
	%
	% --------------------
	% Option preprocessing
	% --------------------
	\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
		\pgfplots@datascaletrafo@initialisedtrue% there is no trafo.
	\fi
	%
	\pgfplotsutilforeachcommasep{x,y,z}\as\pgfplots@loc@TMPa{%
		\pgfplotscoordmath \pgfplots@loc@TMPa{min limit}%
		\expandafter\let\csname pgfplots@invalidrange@\pgfplots@loc@TMPa max\endcsname=\pgfmathresult
		\pgfplotscoordmath \pgfplots@loc@TMPa{max limit}%
		\expandafter\let\csname pgfplots@invalidrange@\pgfplots@loc@TMPa min\endcsname=\pgfmathresult
	}%
	%
	\pgfplotscoordmath{meta}{max limit}%
	\let\pgfplots@invalidrange@metamin=\pgfmathresult
	\pgfplotscoordmath{meta}{min limit}%
	\let\pgfplots@invalidrange@metamax=\pgfmathresult
	%
	% 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
	\global\let\pgfplots@axiswide@metamin=\pgfplots@invalidrange@metamin
	\global\let\pgfplots@axiswide@metamax=\pgfplots@invalidrange@metamax
	\global\let\pgfplots@colorbar@src@metamin=\pgfutil@empty
	\global\let\pgfplots@colorbar@src@metamax=\pgfutil@empty
	%
	\pgfplots@autocompute@all@limitstrue
	\ifx\pgfplots@xmin\pgfutil@empty
		\pgfplots@autocompute@xmintrue
		\global\let\pgfplots@xmin=\pgfplots@invalidrange@xmin
	\else
		\pgfplots@autocompute@all@limitsfalse
	\fi
	\ifx\pgfplots@xmax\pgfutil@empty
		\pgfplots@autocompute@xmaxtrue
		\global\let\pgfplots@xmax=\pgfplots@invalidrange@xmax
	\else
		\pgfplots@autocompute@all@limitsfalse
	\fi
	\ifx\pgfplots@ymin\pgfutil@empty
		\pgfplots@autocompute@ymintrue
		\global\let\pgfplots@ymin=\pgfplots@invalidrange@ymin
	\else
		\pgfplots@autocompute@all@limitsfalse
	\fi
	\ifx\pgfplots@ymax\pgfutil@empty
		\pgfplots@autocompute@ymaxtrue
		\global\let\pgfplots@ymax=\pgfplots@invalidrange@ymax
	\else
		\pgfplots@autocompute@all@limitsfalse
	\fi
	\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
	%
	\pgfutil@IfUndefined{pgfmathdeclarefunction}{%
		% SKIP: \pgfmathdeclarefunction is unavailable in pgf 2.00 .
		% UPGRADE TO PGF 2.10 to use these math functions.
	}{%
		\pgfplots@declare@mathfunctions
	}%
	%
	% check for axis-wide 'point meta min' :
	\pgfkeysgetvalue{/pgfplots/point meta min}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\def\pgfplots@axiswide@metamin@autocompute{1}%
	\else
		\def\pgfplots@axiswide@metamin@autocompute{0}%
		\pgfplotscoordmath{meta}{parsenumber}{\pgfplots@loc@TMPa}%
		\global\let\pgfplots@axiswide@metamin=\pgfmathresult
	\fi
	\pgfkeysgetvalue{/pgfplots/point meta max}\pgfplots@loc@TMPa
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		\def\pgfplots@axiswide@metamax@autocompute{1}%
	\else
		\def\pgfplots@axiswide@metamax@autocompute{0}%
		\pgfplotscoordmath{meta}{parsenumber}{\pgfplots@loc@TMPa}%
		\global\let\pgfplots@axiswide@metamax=\pgfmathresult
	\fi
	%
	% --------------------
	% Start axis:
	% start survey phase!
	% --------------------
	%
	\ifpgfplots@stackedmode
	\else
		% we have no stacked plots and thus no reversing.
		\pgfplots@stacked@reversefalse
	\fi
	%
	\pgfutil@IfUndefined{label}{\relax}{%
		\let\pgfplots@original@LaTeX@label=\label
		\let\label=\pgfplots@plot@label
	}%
	%
	\global\pgfplots@has@label@informationfalse
	%
	\def\numplots{\the\pgfplots@numplots}%
	\global\let\pgfplotssurveyphase@setactiveplothandlers=\pgfutil@empty
	\let\numplotsofactualtype=\pgfplots@numplotsofactualtype
	%
	% any \path command is invalid inside of an axis.
	% Use \axispath instead:
	\let\path=\pgfplots@replacement@for@tikz@path
	\let\closedcycle=\pgfplots@path@closed@cycle
	%
	% defines \pgfplotsaxisupdatelimitsforcoordinate etc.
	\pgfplots@prepare@axis@API
	\pgfplots@prepare@LUA@api
	\pgfkeysvalueof{/pgfplots/execute at begin axis}%
	\pgfkeysvalueof{/pgfplots/execute at begin axis@@}%
	\def\pgfplots@phase@name{s}%
	%
	\pgfplots@replace@path@commands
	%
	% allow layer changes within the environment; reset:
	\pgfkeyslet{/pgfplots/on layer}\pgfutil@empty
}

% #1 if and only if the limits are already ready (sanitized to bounded
% values and transformed)
\def\pgfplots@set@options@after@survey#1{%
	\def\pgfplots@set@options@after@survey@@##1{%
		\edef\pgfmathresult{\csname pgfplots@##1min\endcsname}%
		\if1#1%
			\pgfplotscoordmath{##1}{datascaletrafo inverse}{\pgfmathresult}%
			\pgfplotscoordmath{##1}{tofixed}{\pgfmathresult}%
		\else
			% might be unbounded...
			\pgfplotscoordmath{##1}{tostring}{\pgfmathresult}%
		\fi
		\pgfkeyslet{/pgfplots/##1min}\pgfmathresult
		%
		\edef\pgfmathresult{\csname pgfplots@##1max\endcsname}%
		\if1#1%
			\pgfplotscoordmath{##1}{datascaletrafo inverse}{\pgfmathresult}%
			\pgfplotscoordmath{##1}{tofixed}{\pgfmathresult}%
		\else
			% might be unbounded...
			\pgfplotscoordmath{##1}{tostring}{\pgfmathresult}%
		\fi
		\pgfkeyslet{/pgfplots/##1max}\pgfmathresult
	}%
	\pgfplots@set@options@after@survey@@ x%
	\pgfplots@set@options@after@survey@@ y%
	\ifpgfplots@threedim
		\pgfplots@set@options@after@survey@@ z%
	\fi
	%
	\pgfkeyslet{/pgfplots/point meta min}{\pgfplots@axiswide@metamin}%
	\pgfkeyslet{/pgfplots/point meta max}{\pgfplots@axiswide@metamax}%
}%

% \end{axis} :
%
% This command actually takes all collected (global) variables,
% creates an axis and performs all postponed drawing operations.
\def\endpgfplots@environment@opt{%
	\def\pgfplots@phase@name{v}%
	\pgfutil@IfUndefined{label}{\relax}{%
		% restore.
		\let\label=\pgfplots@original@LaTeX@label
	}%
	\xdef\numplots{\the\pgfplots@numplots}%
	\pgfkeysvalueof{/pgfplots/before end axis/.@cmd}\pgfeov%
	\pgfkeysvalueof{/pgfplots/execute at end axis}%
	\pgfkeysvalueof{/pgfplots/execute at end axis@@}%
	%
	\pgfplots@restore@path@commands
	%
	\pgfplotssurveyphase@setactiveplothandlers
	%
	\pgfplots@set@options@after@survey0%
	\expandafter\pgfplotsset\expandafter{\pgfplots@late@options}%
	%
	\pgfplots@prepare@layered@graphics
	%
	\pgfplots@prepare@cell@picture
	%
	%\end{axis}:
	%
	% --------------------
	%  All plotting commands have been read.
	%  -> apply postponed drawing commands!
	% --------------------
	\pgfplots@determinedefaultvalues
	\pgfplots@BEGIN@cell@picture[/pgfplots/every axis]%
		\pgfplots@BEGIN@init@and@draw@axis
		%
		% replace some of tikz's paths (like ellipse and path): make them
		% aware of any transformations:
		\pgfplots@install@path@replacements
		%
		\pgfplots@stacked@initialise
		\pgfplots@markers@visphase@after@axis@prepare
		\ifpgfplots@stacked@reverse
			% This here applies any scaling trafos and assembles a
			% NEW \pgfplots@stored@plotlist!
			\pgfplots@stacked@finalize@stored@plots
		\fi
		%
		% ensure that (1,2) is automatically converted to (axis cs:1,2) :
		\pgfplots@change@pgfpoints@to@axiscs
		%
		\ifpgfplots@LUA@backend@supported
			\pgfplots@LUA@visualization@update@axis
		\fi
		%
		% make it ungrouped: we must not destroy group nesting of tikz
		% path instructions at this point.
		\pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{%
			\expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa
%\message{^^JProcessing stored plot with precommand '\meaning\pgfplots@stored@current@precmd';^^J  pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd'^^J postcommand '\meaning\pgfplots@stored@current@postcmd'^^J}%
%\message{DATA: '\meaning\pgfplots@stored@current@data';^^J}%
			% The precmd sets all required variables needed to
			% finalize a plot.
			% @see the stream preparation routines.
			\pgfplots@stored@current@precmd
			\ifx\pgfplots@stored@current@cmd\pgfutil@empty
				% Ah: some \pgfplotsextra command like \draw,\path,
				% \node or even \scope or \endscope.
				%
				% do NOT call \pgfplotsonlayer here! We MUST NOT
				% destroy grouping levels here.
				\pgfplots@stored@current@data%
			\else
				%
				% this code here means we REALLY have a plotting
				% command!
				% This is the heart component of the visualization
				% phase.
				\pgfplots@stored@plotlist@visualize@selected@phases{\pgfplots@visphase@names}%
			\fi
			\pgfplots@stored@current@postcmd
		}%
		\pgfplots@restorepgfpoint
		%
		%
		\pgfplots@END@init@and@draw@axis
		%
		\pgfplots@create@axis@descriptions
	%
	% this here does \endtikzpicture\endpgfinterruptpicture
	% (and stores sizes):
	\pgfplots@END@cell@picture
	%
	\let\tikz@fig@name=\pgfplots@fig@name
	\tikz@fig@mustbenamed
	%
	\edef\pgfplots@shapename{pgfplots@low@level@shape\ifpgfplots@deprecated@anchors @deprecated\fi}%
	\pgfutil@IfUndefined{pgf@anchor@\pgfplots@shapename @\pgfplots@anchorname}{%
		% Oh. Well, suppose \pgfplots@anchorname is associated to an
		% INNER node.
		\def\pgfplots@loc@TMPa##1{%
			\pgftransformshift{%
				% So far, the inner node's position has not been
				% corrected (that happens in
				% \pgfplots@finally@correct@child@node@positions).
				% Do that here with \pgfplots@saveddimen@picminx:
				\pgfpointdiff
					{\pgfplotspointorigininternal}
					{##1}%
				\global\pgf@x=-\pgf@x \global\pgf@y=-\pgf@y
			}%
		}%
		\expandafter\tikz@scan@one@point\expandafter\pgfplots@loc@TMPa\expandafter(\pgfplots@anchorname)%
		\def\pgfplots@anchorname{image}% that means: no shift!
	}{}%
	%
	\begingroup
	\pgfplots@beforenode
	%
	\ifpgfplots@has@cell@picture
	\else
		% the transformations have already been applied to the
		% coordinates which are used to setup the node. Reset them:
		\pgftransformresetnontranslations
	\fi
	%
	\ifpgfplots@deprecated@anchors
		\pgfplots@restore@deprecated@lowlevel@shape
		\pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}%
	\else
		\pgfmultipartnode{\pgfplots@shapename}{\pgfplots@anchorname}{\tikz@fig@name}{\pgfusepath{discard}}%
	\fi
	\endgroup
	\pgfplots@fig@alias
	\pgfnodealias{current axis}{\tikz@fig@name}%
	%
	\pgfplots@finally@correct@child@node@positions
	\pgfplots@stacked@finalize
	%
	\pgfplots@LUA@cleanup
	%
	\ifpgfplots@colorbar
		\pgfplots@colorbar@move@outside@scope@with@globalmacro{\pgfplots@glob@TMPa}%
	\else
		\global\let\pgfplots@glob@TMPa=\relax
	\fi
	%
	% transport the current layer config - but only if nessary!
	\def\pgfplots@loc@TMPa{0}%
	\ifpgfplots@has@cell@picture
		% layers are used for the cell picture only- no need to
		% communicate them.
	\else
		\ifpgfplots@layered@graphics
			\def\pgfplots@loc@TMPa{1}%
		\else
			% there are no layers.
		\fi
	\fi
	\if1\pgfplots@loc@TMPa
		% Ah - we need to transport the current layer config!
		\pgf@remember@layerlist@globally
		\aftergroup\pgf@restore@layerlist@from@global
	\else
		% Hm. No layers to transport. Make sure that the second
		% \aftergroup does not hurt:
		\aftergroup\pgf@remember@layerlist@globally
	\fi
	\endgroup
	\pgfplots@glob@TMPa
	%
	% once more again - just to be sure that it works with LaTeX which
	% introduces a further grouping level:
	\aftergroup\pgf@restore@layerlist@from@global
	%
	\pgfplots@cell@picture@remembered
	\aftergroup\pgfplots@cell@picture@remembered
}

\def\pgfplots@LUA@visualization@update@axis{%
	\ifpgfplots@threedim
		\pgfplotsmathvectortocomponents\pgfplots@view@dir@threedim{pgfplots@loc@}{default}%
	\fi
	%
	\let\pgfplots@loc@TMPa\pgfutil@empty%
	\pgfplotscoordmath{x}{datascaletrafo get params}%
	\edef\pgfplots@loc@TMPa{%
		\pgfplots@loc@TMPa
		local datascaleTrafoX = pgfplots.DatascaleTrafo.new(\pgfplotsretval,\pgfplotsretvalb);^^J
	}%
	\pgfplotscoordmath{y}{datascaletrafo get params}%
	\edef\pgfplots@loc@TMPa{%
		\pgfplots@loc@TMPa
		local datascaleTrafoY = pgfplots.DatascaleTrafo.new(\pgfplotsretval,\pgfplotsretvalb);^^J
	}%
	\pgfplotscoordmath{z}{datascaletrafo get params}%
	\edef\pgfplots@loc@TMPa{%
		\pgfplots@loc@TMPa
		local datascaleTrafoZ = pgfplots.DatascaleTrafo.new(\pgfplotsretval,\pgfplotsretvalb);^^J
	}%
	%
	\edef\pgfplots@loc@TMPa{%
		\pgfplots@loc@TMPa
		local axis = pgfplots.gca;^^J%
		% FIXME : what about datamin/max?
		axis.axiswidemetamin = pgfplots.pgftonumber("\pgfplots@axiswide@metamin"); ^^J%
		axis.axiswidemetamax = pgfplots.pgftonumber("\pgfplots@axiswide@metamax"); ^^J%
		axis.datascaleTrafo = { datascaleTrafoX, datascaleTrafoY, datascaleTrafoZ };^^J%
		axis:setunitvectors({ %
			{ \pgf@sys@tonumber\pgf@xx, \pgf@sys@tonumber\pgf@xy },
			{ \pgf@sys@tonumber\pgf@yx, \pgf@sys@tonumber\pgf@yy },
			{ \pgf@sys@tonumber\pgf@zx, \pgf@sys@tonumber\pgf@zy } });^^J%
		\ifpgfplots@threedim
		axis.viewdir = {
			pgfplots.pgftonumber("\pgfplots@loc@x"),
			pgfplots.pgftonumber("\pgfplots@loc@y"),
			pgfplots.pgftonumber("\pgfplots@loc@z") };^^J%
		\fi
	}%
%\message{Executing \pgfplots@loc@TMPa}%
	\pgfplotsutil@directlua{\pgfplots@loc@TMPa}
}%

\def\pgfplots@LUA@cleanup{%
	\ifpgfplots@LUA@backend@supported
		\pgfplotsutil@directlua{pgfplots.gca=nil}%
	\fi
}%

%
% This is part of \ifpgfplots@substitute@pgfpoint:
\def\pgfplots@environment@opt@@setup@pgfpoint@restores{%
	% There are places in pgfplots where the default coordinate system
	% (i.e. the one used whenever one writes (1,2)) needs to be
	% replaced:
	%  - during axis descriptions (see \pgfplots@change@pgfpoints@to@descriptioncs)
	%  - during the visualization phase (where it is substituted by
	%  (axis cs:1,2), compare XXXX)
	%
	% However, as soon as someone writes \pgfsetxvec (or its y/z
	% variants), we want to *restore* the original PGF functionality.
	%
	% Prepare that here:
	\let\pgfpointxy@orig=\pgfpointxy
	\let\pgfqpointxy@orig=\pgfqpointxy
	\let\pgfpointxyz@orig=\pgfpointxyz
	\let\pgfqpointxyz@orig=\pgfqpointxyz
	\let\pgfsetxvec@orig=\pgfsetxvec
	\let\pgfsetyvec@orig=\pgfsetyvec
	\let\pgfsetzvec@orig=\pgfsetzvec
	\let\tikz@checkunit@orig=\tikz@checkunit
	\let\pgfpatharcaxes@orig=\pgfpatharcaxes
	\let\pgfpointpolarxy@orig=\pgfpointpolarxy
	\let\tikz@do@arc@orig=\tikz@do@arc
	%
	\let\pgfsetxvec=\pgfplots@setxvec@restorepgfpoint
	\let\pgfsetyvec=\pgfplots@setyvec@restorepgfpoint
	\let\pgfsetzvec=\pgfplots@setzvec@restorepgfpoint
}%

\def\pgfplots@restorepgfpoint{%
	\let\pgfpointxy=\pgfpointxy@orig
	\let\pgfqpointxy=\pgfqpointxy@orig
	\let\pgfpointxyz=\pgfpointxyz@orig
	\let\pgfqpointxyz=\pgfqpointxyz@orig
	\let\tikz@checkunit=\tikz@checkunit@orig
	\let\pgfpointpolarxy=\pgfpointpolarxy@orig
	\let\pgfpatharcaxes=\pgfpatharcaxes@orig
	\let\tikz@do@arc=\tikz@do@arc@orig
}%

\def\pgfplots@setxvec@restorepgfpoint#1{%
	\pgfsetxvec@orig{#1}%
	\pgfplots@restorepgfpoint
}%
\def\pgfplots@setyvec@restorepgfpoint#1{%
	\pgfsetyvec@orig{#1}%
	\pgfplots@restorepgfpoint
}%
\def\pgfplots@setzvec@restorepgfpoint#1{%
	\pgfsetzvec@orig{#1}%
	\pgfplots@restorepgfpoint
}%


\def\pgfplots@replace@path@commands{%
	\let\pgfplots@orig@scope=\scope
	\let\pgfplots@orig@endscope=\endscope
	\let\scope=\pgfplots@replacement@for@scope
	\let\endscope=\pgfplots@replacement@for@endscope
	%
	\let\pgfplots@orig@pgfonlayer=\pgfonlayer
	\let\pgfplots@orig@endpgfonlayer=\endpgfonlayer
	\let\pgfonlayer=\pgfplots@replacement@for@onlayer
	\let\endpgfonlayer=\pgfplots@replacement@for@endonlayer
	%
	\let\pgfplots@orig@pgfplotsonlayer=\pgfplotsonlayer
	\let\pgfplots@orig@endpgfplotsonlayer=\endpgfplotsonlayer
	\let\pgfplotsonlayer=\pgfplots@replacement@for@onlayer
	\let\endpgfplotsonlayer=\pgfplots@replacement@for@endonlayer
}%

\def\pgfplots@restore@path@commands{%
	% restore old \path command:
	\let\path=\pgfplots@orig@path
	\let\plot=\pgfplots@orig@plot
	\let\scope=\pgfplots@orig@scope
	\let\endscope=\pgfplots@orig@endscope
	\let\pgfonlayer=\pgfplots@orig@pgfonlayer
	\let\endpgfonlayer=\pgfplots@orig@endpgfonlayer
	\let\pgfplotsonlayer=\pgfplots@orig@pgfplotsonlayer
	\let\endpgfplotsonlayer=\pgfplots@orig@endpgfplotsonlayer
}

% visualizes selected phases.
%
% #1 a comma-separated list of selected phases. May be empty.
%   This is typically \pgfplots@visphase@names. The content will be
%   expanded, i.e. it can be a macro.
\def\pgfplots@stored@plotlist@visualize@selected@phases#1{%
	\begingroup
	\def\pgfplotsaxisplotphase{V}%
	\pgfplotsonlayer{\pgfkeysvalueof{/pgfplots/on layer}}{a plot or graphical element (or inherited from the axis)}%
	\pgfkeysvalueof{/pgfplots/execute at begin plot visualization}%
	\ifpgfplots@threedim
	\else
		% axis = 2d and plot=3d is forbidden here.
		\pgfplots@curplot@threedimfalse
	\fi
	%
	%
	\pgfplots@LUA@visualization@init
	% SIDE-effect: \ifpgfplots@LUA@backend@supported might have
	% been switched to false here.
	%
	%
	\pgfplots@execute@at@begin@plot@visualization@internal
	%
	\pgfplots@markers@prepare@layered@graphics@marks
	%
	\edef\pgfplots@current@phases{#1}%
	%
	% "boolean shouldExecuteClippedPart = \ifpgfplots@loc@tmp"
	\pgfplots@loc@tmptrue
	\ifx\pgfplots@current@phases\pgfutil@empty
		\ifx\pgfplots@markers@visphase@name\pgfplots@markers@visphase@name@afterpath@clipped
			% some special handling.... ok; start phase.
		\else
			\pgfplots@loc@tmpfalse
		\fi
	\fi
	\ifpgfplots@loc@tmp
		\expandafter\pgfplots@stored@plotlist@visualize@clippedpart\expandafter{\pgfplots@current@phases}%
	\fi
	%
	\ifx\pgfplots@markers@visphase@name\pgfplots@markers@visphase@name@afterpath@unclipped
		\scope[current plot style]%
		\pgfplots@visphase@markers
		\endscope
	\fi
	\pgfplots@execute@at@end@plot@visualization@internal
	\pgfkeysvalueof{/pgfplots/execute at end plot visualization}%
	\endpgfplotsonlayer
	\endgroup
}

% #1: the list of phases to execute. This excludes marker phases.
\def\pgfplots@stored@plotlist@visualize@clippedpart#1{%
	\scope[current plot style] % this does set BOTH pgfplots and tikz options.
	%
	% do this here after options are set.
	\pgfplots@initzerolevelhandler
	%
	% FIXME : what, precisely, was the motivation to use a
	% scope here? It causes a lot of problems and
	% work-arounds. Is it worth the effort!?
	\ifpgfplots@clip
		\if2\pgfplots@clipmode
			% clip=true and 'clip mode=individual'
			\pgfplots@clippath@install{\pgfusepath{clip}}%
		\fi
	\fi
	%
	\def\pgfplots@loc@TMPa{#1}%
	\ifx\pgfplots@loc@TMPa\pgfutil@empty
		% skip. there is a case in which this can happen and makes
		% sense: if
		% \pgfplots@markers@visphase@name=\pgfplots@markers@visphase@name@afterpath@clipped
	\else
		% Standard visualization phases. See
		% \pgfplotssurveyphase@set@visphase@names for a discussion about
		% their intented use-case.
		\pgfplotsutilforeachcommasep{#1}\as\pgfplots@visphase@name{%
			\begingroup
			\pgfutil@ifundefined{pgfplots@visphase@\pgfplots@visphase@name}{%
				\pgfplots@error{Illegal state encountered: unknown visualization phase \pgfplots@visphase@name}%
			}{%
				\csname pgfplots@visphase@\pgfplots@visphase@name\endcsname
			}%
			\endgroup
		}%
	\fi
	%
	% marker visualization phase (one of the available ones):
	\ifx\pgfplots@markers@visphase@name\pgfplots@markers@visphase@name@afterpath@clipped
		\pgfplots@visphase@markers
	\fi
	%
	\endscope
}%

\def\pgfplots@visphase@markers{%
	\begingroup
	\pgfplots@change@pgfpoints@to@axiscs
	\pgfplots@markers@install@plotmark@handler
	\let\pgfplots@visphase@name=\pgfplotsaxis@visphase@name@markers
	\pgfplots@coord@stream@finalize@storedcoords@START
	\endgroup
}%

% Inside of an axis, the default coordinate system for any draw
% command should be (axis cs:1,2) instead of (1,2). Install that here:
%
% see \pgfplots@restorepgfpoint
\def\pgfplots@change@pgfpoints@to@axiscs{%
	%
	\ifpgfplots@substitute@pgfpoint
		\let\pgfpointxy=\pgfplotspointaxisxy
		\let\pgfpointxyz=\pgfplotspointaxisxyz
		\let\pgfqpointxy=\pgfplotsqpointaxisxy
		\let\pgfqpointxyz=\pgfplotsqpointaxisxyz
		\let\pgfpatharcaxes=\pgfplots@patharcaxes
		\let\pgfpointpolarxy=\pgfplots@pointpolarxy
		\let\tikz@do@arc=\pgfplots@tikz@do@arc
		%
		% tikz checks for units before it calls \pgfpointxy . This must
		% not suffer from TeX's math restrictions, so we have to use the
		% FPU for this task. Patch the command as well:
		\let\tikz@checkunit=\pgfplots@checkunit@fpu
	\fi
}%

\def\pgfplots@disable@directionmath{%
  	\def\pgfplotstransformdirectionx##1{\def\pgfmathresult{##1}}%
  	\let\pgfplotstransformdirectiony=\pgfplotstransformdirectionx
  	\let\pgfplotstransformdirectionz=\pgfplotstransformdirectionx
}%

% As of compat=1.11, pgfplots has to accept the following syntax elements:
%
% \draw[green,thick,->] (0,-1)	arc[radius=1, start angle= -90, end angle=-180];
% \draw[green,thick,->] (0,-1)	arc[radius=1cm, start angle= -90, end angle=-180];
% \draw[green,thick,->] (0,-1)	arc[radius={transformdirectionx(1)}, start angle= -90, end angle=-180];
%
% all of them should work. The last one (transformdirectionx) is due
% to legacy compatibility. Since the 1.11 code handles these syntaxes
% automatically, 'transformdirectionx' will be ignored silently.
\def\pgfplots@tikz@do@arc#1#2#3#4{%
	\begingroup
	% strip 'transformdirectionx' if it occurs in the angles:
	\pgfplots@disable@directionmath
	\pgfmathparse{#3}%
	\t@pgfplots@toka={\tikz@do@arc@orig{#1}{#2}}%
	\edef\pgfplots@arc@x{%
		\pgfmathresult
		\ifpgfmathunitsdeclared pt\fi
	}%
	\pgfmathparse{#4}%
	\xdef\pgfplots@arc@y{%
		\pgfmathresult
		\ifpgfmathunitsdeclared pt\fi
	}%
	% ok, invoke the TikZ command with the expanded args:
	\xdef\pgfplots@glob@TMPa{\the\t@pgfplots@toka{\pgfplots@arc@x}{\pgfplots@arc@y}}%
	\endgroup
	\pgfplots@glob@TMPa
}%

\def\pgfplots@polarxy@#1and #2\@@{%
	\edef\pgfplots@polarxy@X{#1}%
	\edef\pgfplots@polarxy@Y{#2}%
}
\def\pgfplots@pointpolarxy#1#2{%
	\pgfutil@in@{and }{#2}%
	\ifpgfutil@in@%
		\pgfplots@polarxy@#2\@@%
	\else%
		\pgfplots@polarxy@#2and #2\@@%
	\fi%
	\pgfmathparse{#1}%
	\let\pgfpoint@angle=\pgfmathresult%
	\pgfmathcos@{\pgfpoint@angle}%
	\let\pgfpoint@cos=\pgfmathresult
	\pgfmathsin@{\pgfpoint@angle}%
	\let\pgfpoint@sin=\pgfmathresult
	%
	\begingroup
	\pgfplots@plot@coords@mathparsertrue
	\pgf@process{%
		\pgfplotspointaxisxyz{\pgfplots@polarxy@X*\pgfpoint@cos}{\pgfplots@polarxy@Y*\pgfpoint@sin}{0}%
	}%
	\endgroup
}%

% #1 = angle of first point
% #2 = angle of second point
% #3 = first axis
% #4 = second axis
\def\pgfplots@patharcaxes#1#2#3#4{%
  {%
  	% see docs of \pgfplots@tikz@do@arc for a motivation:
	\pgfplots@disable@directionmath
	%
	% ok, now, evaluate the arcs. Since this implements
	% 'substitute pgfpoint', we have to evaluate the angles via
	% 'axis direction cs' ...
	\let\pgfpointxy=\pgfplotspointaxisdirectionxy
	\let\pgfpointxyz=\pgfplotspointaxisdirectionxyz
	%
    \pgftransformtriangle{\pgfpointorigin}{#3}{#4}%
	%
	% ... and the coordinates as such using 'axis cs':
	\let\pgfpointxy=\pgfplotspointaxisxy
	\let\pgfpointxyz=\pgfplotspointaxisxyz
	%
    \pgfpatharc{#1}{#2}{1pt}%
  }%
}%

\def\pgfplots@checkunit@fpu#1{%
	\ifpgfplots@usefpu
		\begingroup
		\pgfkeys{/pgf/fpu, /pgf/fpu/output format/float}%
		\tikz@checkunit@orig{#1}%
		\pgfmathfloattofixed{\pgfmathresult}%
		\xdef\pgfplots@glob@TMPd{%
			\iftikz@isdimension
				\noexpand\tikz@isdimensiontrue
			\else
				\noexpand\tikz@isdimensionfalse
			\fi
			\noexpand\def\noexpand\pgfmathresult{\pgfmathresult}%
		}%
		\endgroup
		\pgfplots@glob@TMPd
	\else
		\tikz@checkunit@orig{#1}%
	\fi
}%

\def\pgfplots@execute@at@end@plot@visualization@internal{%
}%

\def\pgfplots@beforenode{%
	\pgfplots@sys@beforenode
}%

% Now, we need to process all named nodes inside of our
% axis-image.
%
% The situation at this point is as follows:
% 1. the complete axis image has been "typeset" into a box. That
% means its coordinate system is LOST up to those variables
% which have been saved explicitly.
%
% 2. the \pgfmultipartnode above knows about all axis anchors and
% saved dimensions.
%
% 3. All sub-nodes don't know about their position any more. Any
% saved anchors are wrong.
%
% The approach:
% 1. we shift each named node's saved anchors such that it's
% coordinate is valid inside of the TeX box.
%
% 2. we also shift each named node's saved anchors to reflect the
% axis' anchor.
%
% Afterwards, everything should be fine.
\def\pgfplots@finally@correct@child@node@positions{%
   \ifx\pgfplots@named@child@node@list\pgfutil@empty%
   \else%
      	\begingroup
		\pgftransformreset% FIXME: what's that for!? Copied from matrix code...
		%
		% Use the 'image' anchor here - the internal anchor
		% transformation matrix already has the shift for
		% \pgfplots@anchorname.
		\pgfpointanchor{\tikz@fig@name}{image}%
		\pgf@xa=\pgf@x
		\pgf@xb=\pgf@y
		\pgf@process{\pgfplotspointorigininternal}%
		\advance\pgf@xa by-\pgf@x
		\advance\pgf@xb by-\pgf@y
		\global\pgf@x=\pgf@xa
		\global\pgf@y=\pgf@xb
		\edef\pgfplots@offset{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
		\pgfplots@finally@correct@remembered@picture@positions
		%
		\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 by \meaning\pgfplots@offset\space (the node is inside of an axis).}%
				\expandafter\ifx\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname\relax%
					\pgfutil@IfUndefined{pgf@sh@nt@\pgfplots@child@node@name}{%
						\pgfplots@warning{could not adjust coordinates of named node '\pgfplots@child@node@name' for reasons I do not understand! After finishing the image, it did no longer exist!? Sorry.}%
					}{%
						\pgf@shift@node{\pgfplots@child@node@name}{\pgfplots@offset}%
						\expandafter\let\csname pgfplots@child@node@visited@\pgfplots@child@node@name\endcsname=\pgfutil@empty%
					}%
				\fi
			\fi
		}%
		\endgroup
    \fi%
}%

% The feature 'remember picture' relies on the global position of
% pgfpictures.
%
% If we have 'remember picture=true' and 'cell picture=true', that
% global position has been shifted as well. We have to correct it.
%
% This, in turn, requires to patch the .aux file.
%
% PRECONDITION: takes the offset \pgf@x,\pgf@y.
\def\pgfplots@finally@correct@remembered@picture@positions{%
	% Note that the cell picture is already closed - but
	% fortunately, we have saved its picture id.
	\ifx\pgfplots@cell@pictureid\pgfutil@empty
		% ah - no cell picture. OK; nothing to do.
	\else
		% ah - there WAS a cell picture ...
		\pgfplots@cell@picture@remembered
		\ifpgfrememberpicturepositiononpage
			% ... AND it had its "remember picture" flag activated.
			%
			% It is task of
			% \pgfplots@finally@correct@child@node@positions to
			% express ALL node locations in terms of \pgfpictureid.
			%
			% So, we can simply replace the (already written) pdfmark
			% of \pgfplots@cell@pictureid by that of \pgfpictureid
			% (which, however, is NOT written because the picture is
			% not finished).
			%
			% It will be written eventually because the outer picture
			% will implicitly inherit
			% \pgfrememberpicturepositiononpagetrue
			% -> see all usages of \pgfplots@cell@picture@remembered
			\begingroup
			\edef\pgfplots@loc@TMPa{%
				\noexpand\noexpand
				\noexpand\pgfplotsreplacepdfmark
					{\pgfplots@cell@pictureid}{\pgfpictureid}%
			}%
			\expandafter\write\expandafter\pgfutil@auxout\expandafter{\pgfplots@loc@TMPa}%
			\endgroup
		\fi
	\fi
}%

% Replaces the pdfmark for #1 by that of #2.
%
% Note that when this macro is executed (it resides in the .aux file),
% the pdfmark for #2 is typically UNDEFINED.
%
% #1: the pgfpictureid to modify
% #2: the pgfpictureid which contains the correct values
\def\pgfplotsreplacepdfmark#1#2{%
	\pgfsys@getposition{#1}{\pgfplots@loc@TMPa}%
	\ifx\pgfplots@loc@TMPa\relax
		% hm. strange. Perhaps the driver does not support it?
	\else
		% Ok, make a "lazy replace":
		\expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgf@sys@pdf@mark@pos@#1\endcsname
		\expandafter\global\expandafter\let\csname pgf@sys@pdf@mark@pos@#1@old\endcsname=\pgfplots@loc@TMPa%
		%
		\expandafter\gdef\csname pgf@sys@pdf@mark@pos@#1\endcsname{%
			% this is the lazy replace, assuming knowledge about how
			% pgf calls its internal structures :-/
			%
			% If pgf changes its name, this macro will never be
			% called and we do not hurt someone.
			\pgfsys@getposition{#2}{\pgfplots@loc@TMPa}%
			\ifx\pgfplots@loc@TMPa\relax
				% oh - the picture if for #2 has no remembered name!?
				% Perhaps something failed?
				% try a fall-back. This will most fail (most
				% probably). Issue a warning?
				\csname pgf@sys@pdf@mark@pos@#1@old\endcsname
			\else
				% use #2:
				\pgfplots@loc@TMPa
			\fi
		}%
	\fi
}%

\def\pgfplots@environment@axis{%
	\pgfutil@ifnextchar[{\pgfplots@@environment@axis}{\pgfplots@@environment@axis[]}%
}
\def\endpgfplots@environment@axis{\endpgfplots@environment@opt}
\def\pgfplots@@environment@axis[#1]{%
	\pgfplots@environment@opt[/pgfplots/xmode=linear,/pgfplots/ymode=linear,#1]%
}

\def\pgfplots@environment@semilogxaxis{%
	\pgfutil@ifnextchar[{\pgfplots@@environment@semilogxaxis}{\pgfplots@@environment@semilogxaxis[]}%
}
\def\endpgfplots@environment@semilogxaxis{\endpgfplots@environment@opt}
\def\pgfplots@@environment@semilogxaxis[#1]{%
	\pgfplots@environment@opt[/pgfplots/xmode=log,/pgfplots/ymode=linear,#1]%
}

\def\pgfplots@environment@semilogyaxis{%
	\pgfutil@ifnextchar[{\pgfplots@@environment@semilogyaxis}{\pgfplots@@environment@semilogyaxis[]}%
}
\def\endpgfplots@environment@semilogyaxis{\endpgfplots@environment@opt}
\def\pgfplots@@environment@semilogyaxis[#1]{%
	\pgfplots@environment@opt[/pgfplots/xmode=linear,/pgfplots/ymode=log,#1]%
}

\def\pgfplots@environment@loglogaxis{%
	\pgfutil@ifnextchar[{\pgfplots@@environment@loglogaxis}{\pgfplots@@environment@loglogaxis[]}%
}
\def\endpgfplots@environment@loglogaxis{\endpgfplots@environment@opt}
\def\pgfplots@@environment@loglogaxis[#1]{%
	\pgfplots@environment@opt[/pgfplots/xmode=log,/pgfplots/ymode=log,#1]%
}


\pgfutil@IfUndefined{tikzaddtikzonlycommandshortcutlet}{%
	\def\tikzaddtikzonlycommandshortcutlet#1#2{%
		\expandafter\def\expandafter\tikz@installcommands\expandafter{\tikz@installcommands
			\let#1=#2%
		}%
	}%
}{}

\tikzaddtikzonlycommandshortcutlet\axis\pgfplots@environment@axis
\tikzaddtikzonlycommandshortcutlet\endaxis\endpgfplots@environment@axis

\tikzaddtikzonlycommandshortcutlet\semilogxaxis\pgfplots@environment@semilogxaxis
\tikzaddtikzonlycommandshortcutlet\endsemilogxaxis\endpgfplots@environment@semilogxaxis

\tikzaddtikzonlycommandshortcutlet\semilogyaxis\pgfplots@environment@semilogyaxis
\tikzaddtikzonlycommandshortcutlet\endsemilogyaxis\endpgfplots@environment@semilogyaxis

\tikzaddtikzonlycommandshortcutlet\loglogaxis\pgfplots@environment@loglogaxis
\tikzaddtikzonlycommandshortcutlet\endloglogaxis\endpgfplots@environment@loglogaxis

%\input pgfplots.multiaxis.code.tex

\pgfplotsdefineaxistype{rectangle}{%
	% do nothing, this is the default anyway.
}%

\catcode`\;=\pgfplots@oldcatcodesemicolon
\catcode`\"=\pgfplots@oldcatcodedoublequote
