Debian Codegraph @

texmf-dist/tex/latex/numericplots/NumericPlots_TickLabels.tex

raw
1
2 \newlength{\origXTickLabelSep}\setlength{\origXTickLabelSep}{1ex}
3 \newlength{\origYTickLabelSep}\setlength{\origYTickLabelSep}{1ex}
4 \newlength{\xTickLabelSep}\setlength{\xTickLabelSep}{\origXTickLabelSep}
5 \newlength{\yTickLabelSep}\setlength{\yTickLabelSep}{\origYTickLabelSep}
6
7 \newcommand{\xTickLabelRefPt}{t}
8 \newcommand{\yTickLabelRefPt}{r}
9
10 \newcommand{\NumDataPlotxTickBaseline}{0}
11 \newcommand{\NumDataPlotxTickDistance}{0}
12 \newcommand{\NumDataPlotyTickBaseline}{0}
13 \newcommand{\NumDataPlotyTickDistance}{0}
14
15 % ------------------------------------------------------------------------------
16 % | keys for the put TickLabel commands
17 % ------------------------------------------------------------------------------
18
19 \define@key[NumericDataPlot]{putxTickLabel}{x}{
20 \FPsub{\NumDataPlotBuffer}{#1}{\NumDataPlotxMin}
21 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxDataCoordRatio}
22 \FPadd{\NDPputXcoord}{\NumDataPlotBuffer}{\NumDataPlotxCoordMin}
23 }
24
25
26 \define@key[NumericDataPlot]{putyTickLabel}{y}{
27 \FPsub{\NumDataPlotBuffer}{#1}{\NumDataPlotyMin}
28 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotyDataCoordRatio}
29 \FPadd{\NDPputYcoord}{\NumDataPlotBuffer}{\NumDataPlotyCoordMin}
30 }
31
32 \define@key[NumericDataPlot]{putxTickLabel}{TickLabelRefPt}{
33 \renewcommand{\xTickLabelRefPt}{#1}
34 }
35
36 \define@key[NumericDataPlot]{putyTickLabel}{TickLabelRefPt}{
37 \renewcommand{\yTickLabelRefPt}{#1}
38 }
39
40 \define@cmdkeys[NumericDataPlot]{putxTickLabel}[NumDataPlotx]{
41 TickLabelOption, TickLabelRot
42 }
43 \define@cmdkeys[NumericDataPlot]{putyTickLabel}[NumDataPloty]{
44 TickLabelOption, TickLabelRot
45 }
46 \define@key[NumericDataPlot]{putxTickLabel}{TickLabelSep}[\origXTickLabelSep]{\setlength{\xTickLabelSep}{#1}}
47 \define@key[NumericDataPlot]{putyTickLabel}{TickLabelSep}[\origYTickLabelSep]{\setlength{\yTickLabelSep}{#1}}
48
49 \define@choicekey+[NumericDataPlot]{putxTickLabel}{ax}[\val\nrPutAxis]
50 {lower,upper}{
51 \ifcase\nrPutAxis\relax
52 \renewcommand{\xTickLabelRefPt}{t}
53 \renewcommand{\NumDataPlotxTickBaseline}{\NumDataPlotyCoordMin}
54 \renewcommand{\NumDataPlotxTickDistance}{-1}
55 \or
56 \renewcommand{\xTickLabelRefPt}{b}
57 \renewcommand{\NumDataPlotxTickBaseline}{\NumDataPlotyCoordMax}
58 \renewcommand{\NumDataPlotxTickDistance}{1}
59 \fi
60 }{
61 \PackageWarning{NumericPlots}
62 {Axis #1 not defined. Use lower or upper.}
63 }
64
65 \define@choicekey+[NumericDataPlot]{putyTickLabel}{ax}[\val\nrPutAxis]
66 {left,right}{
67 \ifcase\nrPutAxis\relax
68 \renewcommand{\yTickLabelRefPt}{r}
69 \renewcommand{\NumDataPlotyTickBaseline}{\NumDataPlotxCoordMin}
70 \renewcommand{\NumDataPlotyTickDistance}{-1}
71 \or
72 \renewcommand{\yTickLabelRefPt}{l}
73 \renewcommand{\NumDataPlotyTickBaseline}{\NumDataPlotxCoordMax}
74 \renewcommand{\NumDataPlotyTickDistance}{1}
75 \fi
76 }{
77 \PackageWarning{NumericPlots}
78 {Axis #1 not defined. Use left or right.}
79 }
80
81
82 % ------------------------------------------------------------------------------
83 % | standard values for the keys for the put TickLabel commands
84 % ------------------------------------------------------------------------------
85
86 \newcommand{\StdTickLabelOption}{{}}
87
88 \presetkeys[NumericDataPlot]{putxTickLabel}{
89 TickLabelOption=\StdTickLabelOption{}, TickLabelRot=0
90 }{}
91 \presetkeys[NumericDataPlot]{putyTickLabel}{
92 TickLabelOption=\StdTickLabelOption{}, TickLabelRot=0
93 }{}
94
95
96
97 % ==============================================================================
98 % ||
99 % || tick labels
100 % ||
101 % ==============================================================================
102
103
104 \newcommand{\PutTickLabelXaxis}[2][]{%
105 \setkeys*[NumericDataPlot]{putxTickLabel}{#1}%
106 %
107 \setcounter{BufferCounter}{10000*\ratio{\xTickLabelSep}{\CPicHeight}}%
108 \FPsub{\NumDataPlotBuffer}{\NumDataPlotGyPicMax}{\NumDataPlotGyPicMin}%
109 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
110 \FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
111 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxTickDistance}%
112 \FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotxTickBaseline}%
113 %
114 \rput[\xTickLabelRefPt]{\NumDataPlotxTickLabelRot}%
115 (!\NDPputXcoord\space \NumDataPlotBuffer)%
116 {\makeXTickLabel{#2}}%
117 }
118
119
120 \newcommand{\makeXTickLabel}[1]{%
121 \testframe{\NumDataPlotxTickLabelOption{}#1}%
122 }
123
124 \newcommand{\PutTickLabelYaxis}[2][]{%
125 \setkeys*[NumericDataPlot]{putyTickLabel}{#1}%
126 %
127 % \FPdiv{\NumDataPlotBufferI}{\getlengthwounit{\yTickLabelSep}}{\getlengthwounit{\CPicWidth}}
128 \setcounter{BufferCounter}{10000*\ratio{\yTickLabelSep}{\CPicWidth}}%
129 \FPsub{\NumDataPlotBuffer}{\NumDataPlotGxPicMax}{\NumDataPlotGxPicMin}%
130 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
131 \FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
132 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotyTickDistance}%
133 \FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotyTickBaseline}%
134 %
135 \rput[\yTickLabelRefPt]{\NumDataPlotyTickLabelRot}%
136 (!\NumDataPlotBuffer\space \NDPputYcoord)%
137 {\makeYTickLabel{#2}}%
138 }
139
140 \newcommand{\makeYTickLabel}[1]{%
141 \testframe{\NumDataPlotyTickLabelOption{}#1}%
142 }
143
144