summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/numericplots/NumericPlots_legend.tex
blob: 5e3aaeb393bc0cb54354dc68fb9076cdebfe9fae (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

% ----------------------------------------------------------------------------
% | keys for the legend
% ----------------------------------------------------------------------------

\define@key[NumericDataPlot]{Legend}{nrCols}[1]{\renewcommand{\nrLegendCols}{#1}}%
\define@key[NumericDataPlot]{Legend}{LegLineWidth}[20pt]{\setlength{\LegLineWidth}{#1}}%

\define@choicekey+[NumericDataPlot]{Legend}{LabelOrientation}[\val\nrLegOrient]
{r,l,c}{%
	\ifcase\nrLegOrient\relax%
		\setboolean{LegendOrientationLeft}{false}%
		\setboolean{LegendOrientationRight}{true}%
		\setboolean{LegendOrientationCenter}{false}%
    \or%
        \setboolean{LegendOrientationLeft}{true}%
		\setboolean{LegendOrientationRight}{false}%
		\setboolean{LegendOrientationCenter}{false}%
    \or%
    	\setboolean{LegendOrientationLeft}{false}%
		\setboolean{LegendOrientationRight}{false}%
		\setboolean{LegendOrientationCenter}{true}%
    \fi%
}{
	\PackageWarning{NumericPlots}{LabelOrientation #1 not defined. Use r, l or c}%
}


% ==============================================================================
% ||
% || legend
% ||
% ==============================================================================


\newcommand{\LegLineOld}[2][]{%
	\setkeys[NumericDataPlot]{Legend}{#1}
	%
	\centering\Rnode{lab#2}{}%
	\psline[style=#2,showpoints=false]([nodesep=0.5\LegLineWidth]lab#2)([nodesep=-0.5\LegLineWidth]lab#2)%
	\psline[style=#2](lab#2)(lab#2)%
}

% \newcommand{\LegLine}[2][]{%
% 	\setkeys[NumericDataPlot]{Legend}{#1}
% 	%
% 	\centering\Rnode{LegLineNode}{}%
% 	\psline[#2,showpoints=false]([nodesep=0.5\LegLineWidth]LegLineNode)([nodesep=-0.5\LegLineWidth]LegLineNode)%
% 	\psline[#2, linestyle=none](LegLineNode)(LegLineNode)
% }
% 
% 
% \newcommand{\LegendDefinition}[2][nrCols]{%
% 	\setkeys[NumericDataPlot]{Legend}{#1}%
% 	%
% 	\psframebox[style=LegendBoxStyle]{%
% 		\ifLegendOrientationLeft
% 			\begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}l}}%
% 				#2%
% 			\end{tabular}%
% 		\fi
% 		\ifLegendOrientationCenter
% 			\begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}c}}
% 				#2
% 			\end{tabular}
% 		\fi
% 		\ifLegendOrientationRight
% 			\begin{tabular}{*{\nrLegendCols}{p{\LegLineWidth}r}}
% 				#2
% 			\end{tabular}
% 		\fi
% 	}%psframebox
% }

\newcommand{\LegLine}[2][]{%
	\setkeys[NumericDataPlot]{Legend}{#1}%
	\parbox[t]{\LegLineWidth}{%	
	\centering\Rnode{LegLineNode}{}%
	\psline[#2,showpoints=false]([nodesep=0.5\LegLineWidth]LegLineNode)([nodesep=-0.5\LegLineWidth]LegLineNode)%	
	\psline[#2,linestyle=none](LegLineNode)(LegLineNode)%
	}
}

\newcommand{\LegDot}[2][]{%
	\setkeys[NumericDataPlot]{Legend}{#1}%
	\parbox[t]{\LegLineWidth}{%	
	\centering\Rnode{LegLineNode}{}%
	\psdots[#2](LegLineNode)%
	}
}

\newcommand{\LegendDefinition}[2][nrCols]{%
	\setkeys[NumericDataPlot]{Legend}{#1}%
	%
	\psframebox[style=LegendBoxStyle]{%
		\ifLegendOrientationLeft%
			\begin{tabular}{*{\nrLegendCols}{ll}}%
				#2%
			\end{tabular}%
		\fi
		\ifLegendOrientationCenter
			\begin{tabular}{*{\nrLegendCols}{cc}}
				#2
			\end{tabular}
		\fi
		\ifLegendOrientationRight
			\begin{tabular}{*{\nrLegendCols}{cr}}
				#2
			\end{tabular}
		\fi
	}%psframebox
}