
\newlength{\origXTickLabelSep}\setlength{\origXTickLabelSep}{1ex}
\newlength{\origYTickLabelSep}\setlength{\origYTickLabelSep}{1ex}
\newlength{\xTickLabelSep}\setlength{\xTickLabelSep}{\origXTickLabelSep}
\newlength{\yTickLabelSep}\setlength{\yTickLabelSep}{\origYTickLabelSep}

\newcommand{\xTickLabelRefPt}{t}
\newcommand{\yTickLabelRefPt}{r}

\newcommand{\NumDataPlotxTickBaseline}{0}
\newcommand{\NumDataPlotxTickDistance}{0}
\newcommand{\NumDataPlotyTickBaseline}{0}
\newcommand{\NumDataPlotyTickDistance}{0}

% ------------------------------------------------------------------------------
% | keys for the put TickLabel commands
% ------------------------------------------------------------------------------

\define@key[NumericDataPlot]{putxTickLabel}{x}{
	\FPsub{\NumDataPlotBuffer}{#1}{\NumDataPlotxMin}
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxDataCoordRatio}
	\FPadd{\NDPputXcoord}{\NumDataPlotBuffer}{\NumDataPlotxCoordMin}
}


\define@key[NumericDataPlot]{putyTickLabel}{y}{
	\FPsub{\NumDataPlotBuffer}{#1}{\NumDataPlotyMin}
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotyDataCoordRatio}
	\FPadd{\NDPputYcoord}{\NumDataPlotBuffer}{\NumDataPlotyCoordMin}
}

\define@key[NumericDataPlot]{putxTickLabel}{TickLabelRefPt}{
	\renewcommand{\xTickLabelRefPt}{#1}
}

\define@key[NumericDataPlot]{putyTickLabel}{TickLabelRefPt}{
	\renewcommand{\yTickLabelRefPt}{#1}
}

\define@cmdkeys[NumericDataPlot]{putxTickLabel}[NumDataPlotx]{
	TickLabelOption, TickLabelRot
}
\define@cmdkeys[NumericDataPlot]{putyTickLabel}[NumDataPloty]{
	TickLabelOption, TickLabelRot
}
\define@key[NumericDataPlot]{putxTickLabel}{TickLabelSep}[\origXTickLabelSep]{\setlength{\xTickLabelSep}{#1}}
\define@key[NumericDataPlot]{putyTickLabel}{TickLabelSep}[\origYTickLabelSep]{\setlength{\yTickLabelSep}{#1}}

\define@choicekey+[NumericDataPlot]{putxTickLabel}{ax}[\val\nrPutAxis]
{lower,upper}{
	\ifcase\nrPutAxis\relax
	    \renewcommand{\xTickLabelRefPt}{t}
        \renewcommand{\NumDataPlotxTickBaseline}{\NumDataPlotyCoordMin}
        \renewcommand{\NumDataPlotxTickDistance}{-1}
    \or
    	\renewcommand{\xTickLabelRefPt}{b}
    	\renewcommand{\NumDataPlotxTickBaseline}{\NumDataPlotyCoordMax}
		\renewcommand{\NumDataPlotxTickDistance}{1}
    \fi
}{
	\PackageWarning{NumericPlots}
		{Axis #1 not defined. Use lower or upper.}
}

\define@choicekey+[NumericDataPlot]{putyTickLabel}{ax}[\val\nrPutAxis]
{left,right}{
	\ifcase\nrPutAxis\relax
    	\renewcommand{\yTickLabelRefPt}{r}
    	\renewcommand{\NumDataPlotyTickBaseline}{\NumDataPlotxCoordMin}
		\renewcommand{\NumDataPlotyTickDistance}{-1}
    \or
    	\renewcommand{\yTickLabelRefPt}{l}
    	\renewcommand{\NumDataPlotyTickBaseline}{\NumDataPlotxCoordMax}
		\renewcommand{\NumDataPlotyTickDistance}{1}
    \fi
}{
	\PackageWarning{NumericPlots}
		{Axis #1 not defined. Use left or right.}
}


% ------------------------------------------------------------------------------
% | standard values for the keys for the put TickLabel commands
% ------------------------------------------------------------------------------

\newcommand{\StdTickLabelOption}{{}}

\presetkeys[NumericDataPlot]{putxTickLabel}{
	TickLabelOption=\StdTickLabelOption{}, TickLabelRot=0
}{}
\presetkeys[NumericDataPlot]{putyTickLabel}{
	TickLabelOption=\StdTickLabelOption{}, TickLabelRot=0
}{}



% ==============================================================================
% ||
% || tick labels
% ||
% ==============================================================================


\newcommand{\PutTickLabelXaxis}[2][]{%
 	\setkeys*[NumericDataPlot]{putxTickLabel}{#1}%
 	%
	\setcounter{BufferCounter}{10000*\ratio{\xTickLabelSep}{\CPicHeight}}%
	\FPsub{\NumDataPlotBuffer}{\NumDataPlotGyPicMax}{\NumDataPlotGyPicMin}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
	\FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxTickDistance}%
	\FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxTickBaseline}%
	%
	\rput[\xTickLabelRefPt]{\NumDataPlotxTickLabelRot}%
		(!\NDPputXcoord\space \NumDataPlotBuffer)%
		{\makeXTickLabel{#2}}%
}


\newcommand{\makeXTickLabel}[1]{%
	\testframe{\NumDataPlotxTickLabelOption{}#1}%
}

\newcommand{\PutTickLabelYaxis}[2][]{%
 	\setkeys*[NumericDataPlot]{putyTickLabel}{#1}%
 	%
% 	\FPdiv{\NumDataPlotBufferI}{\getlengthwounit{\yTickLabelSep}}{\getlengthwounit{\CPicWidth}}
	\setcounter{BufferCounter}{10000*\ratio{\yTickLabelSep}{\CPicWidth}}%
	\FPsub{\NumDataPlotBuffer}{\NumDataPlotGxPicMax}{\NumDataPlotGxPicMin}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
	\FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotyTickDistance}%
 	\FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotyTickBaseline}%
	%
	\rput[\yTickLabelRefPt]{\NumDataPlotyTickLabelRot}%
		(!\NumDataPlotBuffer\space \NDPputYcoord)%
		{\makeYTickLabel{#2}}%
}

\newcommand{\makeYTickLabel}[1]{%
	\testframe{\NumDataPlotyTickLabelOption{}#1}%
}


