summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/numericplots/NumericPlots_TickLabels.tex
blob: 8a0d32ab0a834b70785f84b168190ab0ce0b0493 (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

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