Debian Codegraph @

texmf-dist/doc/latex/tkz-base/TKZdoc-base-marks.tex

raw
1 \section{Marks or symbols}
2
3 I distinguished between the points used in Euclidean geometry and the "marks or symbols" that can be found in statistics.
4
5 To position the symbol, we use the macro \tkzcname{tkzDefPoint} to correctly define a point, then the macro \tkzcname{tkzDrawMark} to draw the symbol.
6
7 It is common to have to draw a scatter plot, so I created a macro that allows you to define several points quickly.
8
9 A "mark" symbol can be scaled, which is sometimes useful, but, on the other hand, if you change the abscissa and ordinates differently then the "marks" are distorted.
10
11 Reminder: it was already possible to create a cloud of points with the macro \tkzcname{tkzDefPoints}, but this requires to give a reference (a name) to each point, which is sometimes tedious. The macro \tkzcname{tkzSetOfPoints} allows to define points \tkzname{tkzPt1}, \tkzname{tkzPt2}, etc.
12
13 This is frequently referred to as the "scatter plot". The difference from the macro \tkzcname{tkzDefPoints} is that the reference to the points is given by a prefix (default |tkzPt|) and the point number.
14
15 The points are not drawn.
16
17 \subsection{\tkzcname{tkzDrawSetOfPoints}}
18
19 \begin{NewMacroBox}{tkzDrawSetOfPoints}{\oarg{local options}}%
20 Allows you to place symbols on the points defined by \tkzcname{tkzDefSetOfPoints}.
21
22 \medskip
23 \begin{tabular}{lll}%
24 options & default & definition \\
25 \midrule
26 \TOline{prefix} {tkzPt} {point name prefix}
27 \end{tabular}
28 \end{NewMacroBox}
29
30 \subsubsection{Drawing of a scatter plot with \tkzcname{tkzDrawSetOfPoints}}
31 \begin{tkzexample}[latex=6cm,small]
32 \begin{tikzpicture}[scale=0.75]
33 \tkzInit[xmax=6,ymin=1000,ymax=5000,ystep=1000]
34 \tkzDrawX[label=$m$,below=10pt]
35 \tkzDrawY[label=$R(m)$,above=10pt]
36 \tkzLabelX[font=\scriptsize]
37 \tkzLabelY[font=\scriptsize]
38 \tkzDefSetOfPoints[show]{1/2000,2/3000,4/2500,5/4200}
39 \tkzDrawSetOfPoints[mark=ball,mark size=3pt]
40 \end{tikzpicture}
41 \end{tkzexample}
42
43 \subsection{\tkzcname{tkzJoinSetOfPoints}}
44 \begin{NewMacroBox}{tkzJoinSetOfPoints}{\oarg{local options}}%
45 Allows the symbols to be joined by line segments. Of course, it is possible to use all the options of \TIKZ.
46
47 \medskip
48 \begin{tabular}{lll}%
49 options & default & definition \\
50 \midrule
51 \TOline{prefix} {tkzPt} {point name prefix}
52 \end{tabular}
53 \end{NewMacroBox}
54
55 \subsubsection{Link the points of a scatter plot with \tkzcname{tkzJoinSetOfPoints}}
56 \begin{tkzexample}[latex=7cm,small]
57 \begin{tikzpicture}[scale=1]
58 \tkzInit[xmax=5,ymin=1000,ymax=6000,ystep=1000]
59 \tkzDrawX[label=$m$,below=13pt]
60 \tkzDrawY[label=$R(m)$]
61 \tkzLabelX[font=\scriptsize]
62 \tkzLabelY[font=\scriptsize]
63 \tkzDefSetOfPoints{%
64 1/2000,2/3000,4/2500,5/4200}
65 \tkzJoinSetOfPoints[%
66 thick, color=brown]
67 \tkzDrawSetOfPoints[%
68 mark=ball, mark size=3pt]
69 \end{tikzpicture}
70 \end{tkzexample}
71
72 \subsubsection{Using the points of a scatter plot}
73 \begin{tkzexample}[latex=7cm,small]
74 \begin{tikzpicture}[scale=.5]
75 \tkzInit[xmax=5,ymin=1000,
76 ymax=6000,ystep=1000]
77 \tkzGrid[color=orange!30]
78 \tkzDrawX[label=$m$,below=13pt]
79 \tkzDrawY[label=$R(m)$]
80 \tkzLabelX[font=\scriptsize]
81 \tkzLabelY[font=\scriptsize]
82 \tkzDefSetOfPoints[prefix=P]{%
83 1/2000,2/3000,3/2000,4/2500,5/4200}
84 \tkzDrawPolySeg[%
85 color=brown!50,
86 line width=2pt](P1,P2,P3,P4,P5)
87 \end{tikzpicture}
88 \end{tkzexample}
89
90 % \subsection{Mark option \tkzname{mark} et \tkzname{size}}
91 \subsection{\tkzcname{tkzSetUpMark}}
92 \begin{NewMacroBox}{tkzSetUpMark}{\oarg{local options}}%
93 \begin{tabular}{lll}%
94 options & default & example \\
95 \midrule
96 \TOline{mark}{no default}{\tkzcname{tkzSetUpMark[mark=heart]}}
97 \end{tabular}
98 \end{NewMacroBox}
99
100 \subsubsection{Two scatter plots}
101 \begin{tkzexample}[latex=7cm,small]
102 \begin{tikzpicture}
103 \tkzInit[xmax=5.5,ymin=1000,%
104 ymax=6000,ystep=2000]
105 \tkzGrid[color=orange!30]
106 \tkzDrawX[label=$m$,below=13pt]
107 \tkzDrawY[above left,label=$R(m)$]
108 \tkzLabelX[below right,font=\scriptsize]
109 \tkzLabelY[font=\scriptsize]
110 \tkzDefSetOfPoints{1/2000,2/3000,3/2000,
111 4/2500,5/4200}
112 \tkzDefSetOfPoints[prefix=P]{1/3200,2/4100,
113 3/3300,4/3300,5/5000}
114 \tkzSetUpMark[mark=heart,color=black,
115 fill=red!30,size=4pt]
116 \tkzJoinSetOfPoints[thick,color=blue,double]
117 \tkzDrawSetOfPoints
118 \tkzJoinSetOfPoints[prefix=P,thick,color=orange]
119 \tkzDrawSetOfPoints[prefix=P,mark=square*,
120 mark size=4pt,
121 mark options={color=blue,fill=blue!40}]
122 \tkzText[draw,color = red,
123 fill = orange!20](3,5800)%
124 {Revenue by month}
125 \end{tikzpicture}
126 \end{tkzexample}
127
128 \subsection{\tkzcname{tkzDrawMark}}
129 \begin{NewMacroBox}{tkzDrawMark}{\oarg{local options}\parg{point}}%
130 Place a symbol. More efficient than the next to place a single symbol.
131
132 \medskip
133 \begin{tabular}{lll}%
134 options & default & definition \\
135 \midrule
136 \TOline{prefix} {tkzPt} {point name prefix}
137 \end{tabular}
138 \end{NewMacroBox}
139
140 \subsubsection{Ball; use of \tkzcname{tkzDrawMarks}}
141 \begin{tkzexample}[latex=7cm,small]
142 \begin{tikzpicture}
143 \tkzInit[xmax=3,ymax=1]
144 \tkzAxeXY
145 \tkzDrawMark[mark=ball](1,.5)
146 \end{tikzpicture}
147 \end{tkzexample}
148
149 \subsection{\tkzcname{tkzDrawMarks}}
150 \begin{NewMacroBox}{tkzDrawMarks}{\oarg{local options}\parg{list of points}}%
151 Allows you to place a series of marks.
152
153 \medskip
154 \begin{tabular}{lll}%
155 options & default & definition \\
156 \midrule
157 \TOline{prefix} {tkzPt} {point name prefix}
158 \end{tabular}
159 \end{NewMacroBox}
160
161 \subsubsection{Mark and plot; use of \tkzcname{tkzDrawMarks}}
162 \begin{tkzexample}[latex=8cm,small]
163 \begin{tikzpicture}
164 \tkzInit[xmax=6,ymin=1000,
165 ymax=5000,ystep=1000]
166 \tkzAxeXY
167 \tkzDefSetOfPoints[prefix=P]{%
168 1/2000,
169 2/3000,
170 4/2500,
171 5/4200}
172 \tkzDrawSegments[color=brown!50]%
173 (P1,P2 P2,P3 P3,P4)
174 \tkzDrawMarks[mark=ball](P1,P2,P3,P4)
175 \end{tikzpicture}
176 \end{tkzexample}
177
178
179 \endinput