summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/numericplots/NumericPlots_labels.tex
blob: f581eaf7e65661e2bc16006ffdd949d3907b064a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156

\newlength{\origXLabelSep}\setlength{\origXLabelSep}{\baselineskip+1ex}
\newlength{\origYLabelSep}\setlength{\origYLabelSep}{7ex}
\newlength{\xLabelSep}\setlength{\xLabelSep}{\origXLabelSep}
\newlength{\yLabelSep}\setlength{\yLabelSep}{\origYLabelSep}

\newlength{\TempLengthA}
\setlength{\TempLengthA}{0pt}
\newlength{\TempLengthB}
\setlength{\TempLengthB}{0pt}

\newcommand{\NumDataPlotBaseline}{0}
\newcommand{\NumDataPlotDistance}{1}
% \newcommand{\xLabelRefPt}{t}
% \newcommand{\yLabelRefPt}{r}
% \newcommand{\xLabelRot}{0}
% \newcommand{\yLabelRot}{90}



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

\define@cmdkeys[NumericDataPlot]{putxLabel}[NumDataPlotx]{
	LabelPos, LabelOption, LabelOrientation, LabelRot, LabelRefPt
}
\define@cmdkeys[NumericDataPlot]{putyLabel}[NumDataPloty]{
	LabelPos, LabelOption, LabelOrientation, LabelRot, LabelRefPt
}

\define@key[NumericDataPlot]{putxLabel}{LabelSep}[\origXLabelSep]{\setlength{\xLabelSep}{#1}}
\define@key[NumericDataPlot]{putyLabel}{LabelSep}[\origYLabelSep]{\setlength{\yLabelSep}{#1}}

\define@choicekey+[NumericDataPlot]{putxLabel}{ax}[\val\nrPutAxis]
{lower,upper}{
	\ifcase\nrPutAxis\relax
		\setkeys[NumericDataPlot]{putxLabel}{LabelRot=0, LabelRefPt=t}%
	    \renewcommand{\NumDataPlotBaseline}{\NumDataPlotyCoordMin}
        \renewcommand{\NumDataPlotDistance}{-1}
    \or
    	\setkeys[NumericDataPlot]{putxLabel}{LabelRot=0, LabelRefPt=b}%
		\renewcommand{\NumDataPlotBaseline}{\NumDataPlotyCoordMax}
		\renewcommand{\NumDataPlotDistance}{1}
    \fi
}{
	\PackageWarning{NumericPlots}
		{Axis #1 not defined. Use left or right.}
}
\define@choicekey+[NumericDataPlot]{putyLabel}{ax}[\val\nrPutAxis]
{left,right}{
	\ifcase\nrPutAxis\relax
		\setkeys[NumericDataPlot]{putyLabel}{LabelRot=90, LabelRefPt=b}%
    	\renewcommand{\NumDataPlotBaseline}{\NumDataPlotxCoordMin}
		\renewcommand{\NumDataPlotDistance}{-1}
    \or
    	\setkeys[NumericDataPlot]{putyLabel}{LabelRot=270, LabelRefPt=b}%
    	\renewcommand{\NumDataPlotBaseline}{\NumDataPlotxCoordMax}
		\renewcommand{\NumDataPlotDistance}{1}
    \fi
}{
	\PackageWarning{NumericPlots}
		{Axis #1 not defined. Use left or right.}
}

\newcommand\CheckIfColumntypeDefined[1]{%
  \providebool{tpl@coltype@#1}
  \ifcsdef{NC@find@\string#1}%
    {\setbool{tpl@coltype@#1}{true}}%
    {\ifcsdef{columntype@\string#1}
      {\setbool{tpl@coltype@#1}{true}}%
      {\setbool{tpl@coltype@#1}{false}}%
    }%
}

% ------------------------------------------------------------------------------
% | standard values for the keys
% ------------------------------------------------------------------------------


\newcommand{\StdLabelOption}{{}}

\presetkeys[NumericDataPlot]{putxLabel}{
	LabelPos=0.5, LabelOption=\StdLabelOption{},LabelOrientation=c
}{}
\presetkeys[NumericDataPlot]{putyLabel}{
	LabelPos=0.5, LabelOption=\StdLabelOption{},LabelOrientation=c 
}{}




% ==============================================================================
% ||
% || axis labels
% ||
% ==============================================================================
\newcommand{\PutLabelXaxis}[2][]{
	\setkeys*[NumericDataPlot]{putxLabel}{#1}%
 	%
	\setcounter{BufferCounter}{10000*\ratio{\xLabelSep}{\CPicHeight}}%
	\FPsub{\NumDataPlotBuffer}{\NumDataPlotGyPicMax}{\NumDataPlotGyPicMin}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
	\FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotDistance}%
 	\FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotBaseline}%
	%
	\rput[\NumDataPlotxLabelRefPt]%
		{\NumDataPlotxLabelRot}%
		(!\NumDataPlotxCoordRange\space \NumDataPlotxLabelPos\space mul %
		\NumDataPlotxCoordMin\space add \NumDataPlotBuffer\space){%
			\makeXLabel{#2}%
		}%
}

\newcommand{\makeXLabel}[1]{%
	\NumDataPlotxLabelOption{}%
	\testframe{%
	\setlength{\tabcolsep}{0pt}%
	\expandafter\tabular\NumDataPlotxLabelOrientation{}%
		#1%
	\endtabular%
	}%
}


\newcommand{\PutLabelYaxis}[2][]{%
	\setkeys*[NumericDataPlot]{putyLabel}{#1}%
 	%
	\setcounter{BufferCounter}{10000*\ratio{\yLabelSep}{\CPicWidth}}%
	\FPsub{\NumDataPlotBuffer}{\NumDataPlotGxPicMax}{\NumDataPlotGxPicMin}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
	\FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
	\FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotDistance}%
 	\FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotBaseline}%
	%
	\rput[\NumDataPlotyLabelRefPt]%
		{\NumDataPlotyLabelRot}%
		(!\NumDataPlotBuffer\space %
		\NumDataPlotyCoordRange\space \NumDataPlotyLabelPos\space mul %
		\NumDataPlotyCoordMin\space add){%
			\makeYLabel{#2}%
		}%
}

\newcommand{\makeYLabel}[1]{%
	\NumDataPlotyLabelOption{}%
	\testframe{%
	\setlength{\tabcolsep}{0pt}%
	\expandafter\tabular\NumDataPlotyLabelOrientation{}%
		#1%
	\endtabular%
	}%
}