Debian Codegraph @

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

raw
1
2 \newlength{\origXLabelSep}\setlength{\origXLabelSep}{\baselineskip+1ex}
3 \newlength{\origYLabelSep}\setlength{\origYLabelSep}{7ex}
4 \newlength{\xLabelSep}\setlength{\xLabelSep}{\origXLabelSep}
5 \newlength{\yLabelSep}\setlength{\yLabelSep}{\origYLabelSep}
6
7 \newlength{\TempLengthA}
8 \setlength{\TempLengthA}{0pt}
9 \newlength{\TempLengthB}
10 \setlength{\TempLengthB}{0pt}
11
12 \newcommand{\NumDataPlotBaseline}{0}
13 \newcommand{\NumDataPlotDistance}{1}
14 % \newcommand{\xLabelRefPt}{t}
15 % \newcommand{\yLabelRefPt}{r}
16 % \newcommand{\xLabelRot}{0}
17 % \newcommand{\yLabelRot}{90}
18
19
20
21 % ------------------------------------------------------------------------------
22 % | keys for the put label commands
23 % ------------------------------------------------------------------------------
24
25 \define@cmdkeys[NumericDataPlot]{putxLabel}[NumDataPlotx]{
26 LabelPos, LabelOption, LabelOrientation, LabelRot, LabelRefPt
27 }
28 \define@cmdkeys[NumericDataPlot]{putyLabel}[NumDataPloty]{
29 LabelPos, LabelOption, LabelOrientation, LabelRot, LabelRefPt
30 }
31
32 \define@key[NumericDataPlot]{putxLabel}{LabelSep}[\origXLabelSep]{\setlength{\xLabelSep}{#1}}
33 \define@key[NumericDataPlot]{putyLabel}{LabelSep}[\origYLabelSep]{\setlength{\yLabelSep}{#1}}
34
35 \define@choicekey+[NumericDataPlot]{putxLabel}{ax}[\val\nrPutAxis]
36 {lower,upper}{
37 \ifcase\nrPutAxis\relax
38 \setkeys[NumericDataPlot]{putxLabel}{LabelRot=0, LabelRefPt=t}%
39 \renewcommand{\NumDataPlotBaseline}{\NumDataPlotyCoordMin}
40 \renewcommand{\NumDataPlotDistance}{-1}
41 \or
42 \setkeys[NumericDataPlot]{putxLabel}{LabelRot=0, LabelRefPt=b}%
43 \renewcommand{\NumDataPlotBaseline}{\NumDataPlotyCoordMax}
44 \renewcommand{\NumDataPlotDistance}{1}
45 \fi
46 }{
47 \PackageWarning{NumericPlots}
48 {Axis #1 not defined. Use left or right.}
49 }
50 \define@choicekey+[NumericDataPlot]{putyLabel}{ax}[\val\nrPutAxis]
51 {left,right}{
52 \ifcase\nrPutAxis\relax
53 \setkeys[NumericDataPlot]{putyLabel}{LabelRot=90, LabelRefPt=b}%
54 \renewcommand{\NumDataPlotBaseline}{\NumDataPlotxCoordMin}
55 \renewcommand{\NumDataPlotDistance}{-1}
56 \or
57 \setkeys[NumericDataPlot]{putyLabel}{LabelRot=270, LabelRefPt=b}%
58 \renewcommand{\NumDataPlotBaseline}{\NumDataPlotxCoordMax}
59 \renewcommand{\NumDataPlotDistance}{1}
60 \fi
61 }{
62 \PackageWarning{NumericPlots}
63 {Axis #1 not defined. Use left or right.}
64 }
65
66 \newcommand\CheckIfColumntypeDefined[1]{%
67 \providebool{tpl@coltype@#1}
68 \ifcsdef{NC@find@\string#1}%
69 {\setbool{tpl@coltype@#1}{true}}%
70 {\ifcsdef{columntype@\string#1}
71 {\setbool{tpl@coltype@#1}{true}}%
72 {\setbool{tpl@coltype@#1}{false}}%
73 }%
74 }
75
76 % ------------------------------------------------------------------------------
77 % | standard values for the keys
78 % ------------------------------------------------------------------------------
79
80
81 \newcommand{\StdLabelOption}{{}}
82
83 \presetkeys[NumericDataPlot]{putxLabel}{
84 LabelPos=0.5, LabelOption=\StdLabelOption{},LabelOrientation=c
85 }{}
86 \presetkeys[NumericDataPlot]{putyLabel}{
87 LabelPos=0.5, LabelOption=\StdLabelOption{},LabelOrientation=c
88 }{}
89
90
91
92
93 % ==============================================================================
94 % ||
95 % || axis labels
96 % ||
97 % ==============================================================================
98 \newcommand{\PutLabelXaxis}[2][]{
99 \setkeys*[NumericDataPlot]{putxLabel}{#1}%
100 %
101 \setcounter{BufferCounter}{10000*\ratio{\xLabelSep}{\CPicHeight}}%
102 \FPsub{\NumDataPlotBuffer}{\NumDataPlotGyPicMax}{\NumDataPlotGyPicMin}%
103 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
104 \FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
105 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotDistance}%
106 \FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotBaseline}%
107 %
108 \rput[\NumDataPlotxLabelRefPt]%
109 {\NumDataPlotxLabelRot}%
110 (!\NumDataPlotxCoordRange\space \NumDataPlotxLabelPos\space mul %
111 \NumDataPlotxCoordMin\space add \NumDataPlotBuffer\space){%
112 \makeXLabel{#2}%
113 }%
114 }
115
116 \newcommand{\makeXLabel}[1]{%
117 \NumDataPlotxLabelOption{}%
118 \testframe{%
119 \setlength{\tabcolsep}{0pt}%
120 \expandafter\tabular\NumDataPlotxLabelOrientation{}%
121 #1%
122 \endtabular%
123 }%
124 }
125
126
127 \newcommand{\PutLabelYaxis}[2][]{%
128 \setkeys*[NumericDataPlot]{putyLabel}{#1}%
129 %
130 \setcounter{BufferCounter}{10000*\ratio{\yLabelSep}{\CPicWidth}}%
131 \FPsub{\NumDataPlotBuffer}{\NumDataPlotGxPicMax}{\NumDataPlotGxPicMin}%
132 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\theBufferCounter}%
133 \FPdiv{\NumDataPlotBuffer}{\NumDataPlotBuffer}{10000}%
134 \FPmul{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotDistance}%
135 \FPadd{\NumDataPlotBuffer}{\NumDataPlotBuffer}{\NumDataPlotBaseline}%
136 %
137 \rput[\NumDataPlotyLabelRefPt]%
138 {\NumDataPlotyLabelRot}%
139 (!\NumDataPlotBuffer\space %
140 \NumDataPlotyCoordRange\space \NumDataPlotyLabelPos\space mul %
141 \NumDataPlotyCoordMin\space add){%
142 \makeYLabel{#2}%
143 }%
144 }
145
146 \newcommand{\makeYLabel}[1]{%
147 \NumDataPlotyLabelOption{}%
148 \testframe{%
149 \setlength{\tabcolsep}{0pt}%
150 \expandafter\tabular\NumDataPlotyLabelOrientation{}%
151 #1%
152 \endtabular%
153 }%
154 }
155
156