| 1 |
\section{Texts and Legends} |
| 2 |
|
| 3 |
\subsection{Placing a title} |
| 4 |
Of course you can use \TIKZ, but the macro I propose to allow you to place the text using the units chosen for the drawing. |
| 5 |
|
| 6 |
The options are always those of \TIKZ, in particular the following ones: |
| 7 |
\begin{NewMacroBox}{tkzText}{\oarg{local options}\parg{dot}\var{text}}% |
| 8 |
The point can either be given by its coordinates or by its name. |
| 9 |
|
| 10 |
\begin{tabular}{lll}% |
| 11 |
\toprule |
| 12 |
options & default & definition\\ |
| 13 |
\midrule |
| 14 |
\TOline{color }{|black|}{current colour} |
| 15 |
\TOline{text }{|black|}{text colour} |
| 16 |
\TOline{fill }{|white|}{background colour} |
| 17 |
\TOline{opacity }{|1| }{opacity} |
| 18 |
\end{tabular} |
| 19 |
\end{NewMacroBox} |
| 20 |
|
| 21 |
\subsubsection{A title} |
| 22 |
|
| 23 |
\begin{tkzexample}[latex=8cm] |
| 24 |
\begin{tikzpicture} |
| 25 |
\tkzInit[xmax = 6, ymin = 1000,% |
| 26 |
ymax = 4000,ystep = 1000] |
| 27 |
\tkzAxeXY |
| 28 |
\tkzText[draw, |
| 29 |
line width = 1pt,% |
| 30 |
color = red,% |
| 31 |
fill = orange!20](3,4000)% |
| 32 |
{Revenue by month} |
| 33 |
\end{tikzpicture} |
| 34 |
\end{tkzexample} |
| 35 |
|
| 36 |
\subsubsection{Draft} |
| 37 |
|
| 38 |
\begin{tkzexample}[latex=8cm] |
| 39 |
\begin{tikzpicture} |
| 40 |
\tkzInit[xmax = 6, ymin = 1000,% |
| 41 |
ymax = 4000,ystep = 1000] |
| 42 |
\tkzGrid \tkzAxeXY |
| 43 |
\tkzText[draw,opacity=.2, |
| 44 |
rotate=45,inner sep=.6 cm, |
| 45 |
line width = 1pt, |
| 46 |
color = black, |
| 47 |
fill = purple!20](3,2500) |
| 48 |
{\Huge DRAFT} |
| 49 |
\end{tikzpicture} |
| 50 |
\end{tkzexample} |
| 51 |
|
| 52 |
\subsubsection{Text with a point} |
| 53 |
It is possible to give the reference of a point instead of its coordinates. |
| 54 |
|
| 55 |
\begin{tkzexample}[latex=8cm] |
| 56 |
\begin{tikzpicture} |
| 57 |
\tkzInit[ymax=5,xmax=6] |
| 58 |
\tkzAxeXY |
| 59 |
\tkzDefPoint(3,3){A} |
| 60 |
\tkzText[draw,opacity=.6, |
| 61 |
inner sep=.6 cm, |
| 62 |
line width = 1pt, |
| 63 |
color = black, |
| 64 |
fill = purple!20](A) |
| 65 |
{My text} |
| 66 |
\end{tikzpicture} |
| 67 |
\end{tkzexample} |
| 68 |
|
| 69 |
\subsubsection{Text format} |
| 70 |
The option \tkzname{text width} is interesting, see the pgfmanual for more information. |
| 71 |
\begin{tkzexample}[latex=8cm,small] |
| 72 |
\begin{tikzpicture} |
| 73 |
\tkzInit[ymax=5,xmax=6] |
| 74 |
\tkzAxeXY |
| 75 |
\tkzText[draw,opacity=.6, |
| 76 |
inner sep=.6 cm, |
| 77 |
line width = 1pt, |
| 78 |
color = black, |
| 79 |
fill = purple!20, |
| 80 |
text width=3cm](3,3) |
| 81 |
{My text\\\ Reference} |
| 82 |
\end{tikzpicture} |
| 83 |
\end{tkzexample} |
| 84 |
|
| 85 |
\subsection{Placing legends} |
| 86 |
There are two ways to use this macro. Either you can place legends for curves. Then you can represent lines with their own style, or you can differentiate symbols (mark). |
| 87 |
\hypertarget{legend}{} |
| 88 |
\begin{NewMacroBox}{tkzLegend}{\oarg{local options}\var{mark/color/size/text}}% |
| 89 |
The arguments differ according to the boolean \tkzname{line}. |
| 90 |
|
| 91 |
\medskip |
| 92 |
\begin{tabular}{lll}% |
| 93 |
\toprule |
| 94 |
options & default & definition\\ |
| 95 |
\midrule |
| 96 |
\TOline{line}{false}{Boolean: line or symbol} |
| 97 |
\end{tabular} |
| 98 |
|
| 99 |
With |line=true| |
| 100 |
|
| 101 |
\begin{tabular}{lll} |
| 102 |
\toprule |
| 103 |
arguments & default & example\\ |
| 104 |
\midrule |
| 105 |
\TAline{style/line width/color/text}{no default}{dashed/1pt/red/Product Recipe B} |
| 106 |
\end{tabular} |
| 107 |
|
| 108 |
\medskip |
| 109 |
With |line=false| |
| 110 |
|
| 111 |
\begin{tabular}{lll} |
| 112 |
\toprule |
| 113 |
arguments & default & example\\ |
| 114 |
\midrule |
| 115 |
\TAline{mark/mark size/color/text}{no default}{heart/1ex/red!30/Product Recipe A} |
| 116 |
\end{tabular} |
| 117 |
\end{NewMacroBox} |
| 118 |
|
| 119 |
\subsubsection{Legends with symbols} |
| 120 |
\begin{tkzexample}[vbox] |
| 121 |
\begin{tikzpicture} |
| 122 |
\tkzInit[xmax=12,ymin=1000,ymax=11000,ystep=2000] |
| 123 |
\tkzGrid[color=orange!30] |
| 124 |
\tkzDrawX[below right,label=Mois] |
| 125 |
\tkzDrawY[above left,label=Recette] |
| 126 |
\tkzLabelX |
| 127 |
\tkzLabelY |
| 128 |
\tkzDefSetOfPoints{1/2000,2/3000,3/2000,4/2500,5/4200,6/4800,7/4600, |
| 129 |
8/5200,9/6200,10/7000,11/7400,12/10000} |
| 130 |
\tkzDefSetOfPoints[prefix=P]{1/3200,2/4100,3/3300,4/3300,5/5000,6/5500,7/5200,8/4000, |
| 131 |
9/3000,10/6000,11/8400,12/9000} |
| 132 |
\tkzSetUpMark[mark=heart,color=black,fill=red!30,size=4pt] |
| 133 |
\tkzJoinSetOfPoints[thick,color=brown,double] |
| 134 |
\tkzDrawSetOfPoints |
| 135 |
\tkzJoinSetOfPoints[prefix=P,thick,color=orange,double] |
| 136 |
\tkzDrawSetOfPoints[prefix=P,mark=square*,mark size=4pt, |
| 137 |
mark options={color=blue,fill=blue!40}] |
| 138 |
\tkzLegend[draw,rounded corners,fill=orange!20,text=brown, |
| 139 |
line width=2pt](5,10000){heart/1ex/red!30/Product Recipe A,% |
| 140 |
square*/0.75ex/blue!40/Product Recipe B} |
| 141 |
\end{tikzpicture} |
| 142 |
\end{tkzexample} |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
\endinput |