% ==============================================================================
% ||
% || commands...
% ||
% ==============================================================================

\newcommand{\NDPput}[2][]{
	\setkeys[NumericDataPlot]{put}{RefPoint=c}
	\setkeys[NumericDataPlot]{put}{Rot=0}
	\setkeys[NumericDataPlot]{put}{#1}
	\rput[\NDPRefPoint]{\NDPputRotation}(\NDPputXcoord, \NDPputYcoord){#2}
}


\newcommand{\NDPhline}[2][]{
%
	\FPsub{\NumDataPlotBuffer}{#2}{\NumDataPlotyMin}
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotyDataCoordRatio}
	\FPadd{\NDPputYcoord}{\NumDataPlotBuffer}{\NumDataPlotyCoordMin}

	\psline[#1](\NumDataPlotxCoordMin, \NDPputYcoord)
		(\NumDataPlotxCoordMax,	\NDPputYcoord)
}

\newcommand{\NDPvline}[2][]{
%
	\FPsub{\NumDataPlotBuffer}{#2}{\NumDataPlotxMin}
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxDataCoordRatio}
	\FPadd{\NDPputXcoord}{\NumDataPlotBuffer}{\NumDataPlotxCoordMin}
%
	\psline[#1](\NDPputXcoord, \NumDataPlotyCoordMin)
		(\NDPputXcoord, \NumDataPlotyCoordMax)
}

\newcommand{\NDPline}[5][]{
%
	\FPsub{\NumDataPlotBuffer}{#2}{\NumDataPlotxMin}
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxDataCoordRatio}
	\FPadd{\NDPputXcoordOne}{\NumDataPlotBuffer}{\NumDataPlotxCoordMin}
	
	\FPsub{\NumDataPlotBuffer}{#2}{\NumDataPlotxMin}
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxDataCoordRatio}
	\FPadd{\NDPputXcoordOne}{\NumDataPlotBuffer}{\NumDataPlotxCoordMin}
	
	
	\psline[#1]
		(!#2 \NumDataPlotxMin\space sub	\NumDataPlotxDataCoordRatio\space mul
		\NumDataPlotxCoordMin\space	add
		#3 \NumDataPlotyMin\space sub	\NumDataPlotyDataCoordRatio\space mul
		\NumDataPlotyCoordMin\space	add)
		(!#4 \NumDataPlotxMin\space sub	\NumDataPlotxDataCoordRatio\space mul
		\NumDataPlotxCoordMin\space	add
		#5 \NumDataPlotyMin\space sub	\NumDataPlotyDataCoordRatio\space mul
		\NumDataPlotyCoordMin\space	add)
}

\newcommand{\NDPvbox}[3][]{

	\psframe[#1]
		(!#2 \NumDataPlotxMin\space sub	\NumDataPlotxDataCoordRatio\space mul \NumDataPlotxCoordMin\space	add
		\NumDataPlotyCoordMin)
		(!#3 \NumDataPlotxMin\space sub	\NumDataPlotxDataCoordRatio\space mul \NumDataPlotxCoordMin\space	add
		\NumDataPlotyCoordMax)
}

\newcommand{\NDPhbox}[3][]{
	
    \psframe[#1]
		(!\NumDataPlotxCoordMin \space
		#2 \NumDataPlotyMin\space sub \NumDataPlotyDataCoordRatio\space mul \NumDataPlotyCoordMin\space	add)
		(!\NumDataPlotxCoordMax \space
		#3 \NumDataPlotyMin\space sub \NumDataPlotyDataCoordRatio\space mul \NumDataPlotyCoordMin\space	add)
}

\newcommand{\NDPbox}[5][]{
%	\FPsub{\NumDataPlotBuffer}{#2}{\NumDataPlotxMin}
%	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxDataCoordRatio}
%	\FPadd{\NDPputXcoordOne}{\NumDataPlotBuffer}{\NumDataPlotxCoordMin}
%	
%	\FPsub{\NumDataPlotBuffer}{#2}{\NumDataPlotxMin}
%	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxDataCoordRatio}
%	\FPadd{\NDPputXcoordOne}{\NumDataPlotBuffer}{\NumDataPlotxCoordMin}
%	
%	
	\psframe[#1]
		(!#2 \NumDataPlotxMin\space sub	\NumDataPlotxDataCoordRatio\space mul
		\NumDataPlotxCoordMin\space	add
		#3 \NumDataPlotyMin\space sub	\NumDataPlotyDataCoordRatio\space mul
		\NumDataPlotyCoordMin\space	add)
		(!#4 \NumDataPlotxMin\space sub	\NumDataPlotxDataCoordRatio\space mul
		\NumDataPlotxCoordMin\space	add
		#5 \NumDataPlotyMin\space sub	\NumDataPlotyDataCoordRatio\space mul
		\NumDataPlotyCoordMin\space	add)
}

% ============================================================================
% ||
% ||  plotting commands
% ||
% ============================================================================

% if data is exported with options.NaNsplit=true it may be plotted with
% \multilistplot{style=xx}{DataIDENT}
% First argument of the function is passed to listplot.
% Second argument must be the Identifier of the Data that should be plotted.
\newcommand{\multilistplot}[2]{
	\multido{\iA=1+1}{\csname #2NrRanges\endcsname}{
		\listplot[#1]{\csname #2\iA\endcsname}%
	}
}


% ===========================================================================
% ||
% || commands to put something at a location of the plot
% ||
% ===========================================================================

% put in the NorthWest corner of the plot
\newcommand{\putNW}[1]{
\rput[lt]{0}(\NumDataPlotxCoordMin, \NumDataPlotyCoordMax){#1}}
% put in the SouthWest corner of the plot
\newcommand{\putSW}[1]{
\rput[lb]{0}(\NumDataPlotxCoordMin, \NumDataPlotyCoordMin){#1}}
% put in the NorthEast corner of the plot
\newcommand{\putNE}[1]{
\rput[rt]{0}(\NumDataPlotxCoordMax, \NumDataPlotyCoordMax){#1}}
% put in the SouthEast corner of the plot
\newcommand{\putSE}[1]{
\rput[rb]{0}(\NumDataPlotxCoordMax, \NumDataPlotyCoordMin){#1}}
% put in the South of the plot
\newcommand{\putS}[1]{
\rput[b]{0}(!\NumDataPlotxCoordMax\space\NumDataPlotxCoordMin\space sub 2 div
\NumDataPlotxCoordMin\space add \NumDataPlotyCoordMin){#1}}
% put in the North of the plot
\newcommand{\putN}[1]{
\rput[t]{0}(!\NumDataPlotxCoordMax\space\NumDataPlotxCoordMin\space sub 2 div
\NumDataPlotxCoordMin\space add \NumDataPlotyCoordMax){#1}}
% put in the West of the plot
\newcommand{\putW}[1]{
\rput[l]{0}(!\NumDataPlotxCoordMin\space
\NumDataPlotyCoordMax\space\NumDataPlotyCoordMin\space sub 2 div \NumDataPlotyCoordMin\space add){#1}}
% put in the East of the plot
\newcommand{\putE}[1]{
\rput[r]{0}(!\NumDataPlotxCoordMax\space
\NumDataPlotyCoordMax\space\NumDataPlotyCoordMin\space sub 2 div \NumDataPlotyCoordMin\space add){#1}}
% put exponent at y-axis
\newcommand{\putExpY}[1]{
\rput[lb]{0}(\NumDataPlotxCoordMin, \NumDataPlotyCoordMax){#1}
}
% put exponent at x-axis
\newcommand{\putExpX}[1]{
\rput[lb]{0}(\NumDataPlotxCoordMax, \NumDataPlotyCoordMin){#1}
}

