Debian Codegraph @

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

raw
1 \section{The points}
2
3 I made a distinction between the point used in Euclidean geometry and the point used to represent an element of a statistical cloud. In the first case, I use as object a \tkzname{node}, which means that the representation of the point cannot be modified by a \tkzname{scale}; in the second case, I use as object a \tkzname{plot mark}. The latter can be scaled and have more varied forms than the node.
4
5 The new macro is \tkzNameMacro{tkzDefPoint}, it allows to use \TIKZ-specific options as a shift and the values are processed with tkz-base. Moreover, if calculations are needed then the \tkzNamePack{xfp} package takes care of them. You can use Cartesian or polar coordinates.
6
7 \subsection{Defining a point in Cartesian coordinates: \tkzcname{tkzDefPoint}} \hypertarget{tdp}{}
8
9 \begin{NewMacroBox}{tkzDefPoint}{\oarg{local options}\parg{x,y}\var{name} or \parg{a:r}\var{name}}%
10 \begin{tabular}{lll}%
11 arguments & default & definition \\
12 \midrule
13 \TAline{x,y}{no default}{$x$ and $y$ are two dimensions, by default in cm.}
14 \TAline{a:r}{no default}{$a$ is an angle in degrees, $r$ is a dimension}
15 \bottomrule
16 \end{tabular}
17
18 \medskip
19 \noindent{The mandatory arguments of this macro are two dimensions expressed with decimals, in the first case they are two measures of length, in the second case they are a measure of length and the measure of an angle in degrees}.
20
21 \medskip
22 \begin{tabular}{lll}%
23 \toprule
24 options & default & definition \\
25 \midrule
26 \TOline{shift} {(0,0)} {value spacing}
27 \bottomrule
28 \end{tabular}
29
30 \medskip
31 \noindent{All the options of \TIKZ\ that we can apply to \tkzname{coordinate}, are applicable (well I hope!) as for example the option \tkzname{label} defined with the library \tkzname{quotes}.}
32 \end{NewMacroBox}
33
34 \subsubsection{Use of \tkzname{shift}}
35 \tkzname{shift} allows the points to be placed in relation to each other.
36
37 \begin{tkzexample}[latex=7cm,small]
38 \begin{tikzpicture}[trim left=-1cm]
39 \tkzDefPoint(2,3){A}
40 \tkzDefPoint[shift={(2,3)}](31:3){B}
41 \tkzDefPoint[shift={(2,3)}](158:3){C}
42 \tkzDrawSegments[color=red,line width=1pt](A,B A,C)
43 \tkzDrawPoints[color=red](A,B,C)
44 \end{tikzpicture}
45 \end{tkzexample}
46
47 \subsection{Placing a label with the library \tkzname{quotes}}
48 I prefer not to mix operations and use \tkzcname{tkzLabelPoint} to place labels. See the section "The Quotes Syntax" in the \TIKZ\ manual.
49
50 \begin{tkzexample}[latex=7cm,small]
51 \begin{tikzpicture}[trim left=-1cm]
52 \tkzDefPoint["-60:$A_n$" ](2,3){A}
53 \tkzDefPoint[shift={(2,3)},%
54 "$B_n$" above left](31:3){B}
55 \tkzDefPoint[shift={(2,3)},%
56 "$C_n$" above right](158:3){C}
57 \tkzDrawSegments[color=red,%
58 line width=1pt](A,B A,C)
59 \tkzDrawPoints[color=red](A,B,C)
60 \end{tikzpicture}
61 \end{tkzexample}
62
63
64 \subsubsection{Rotation with \tkzname{shift} and \tkzname{scope}}
65 Preferable to rotate is to use a \tkzNameEnv{scope} environment.
66
67 \begin{tkzexample}[latex=7cm,small]
68 \begin{tikzpicture}[scale=.75,rotate=90]
69 \tkzDefPoint[label=right:$A_n$](2,3){A}
70 \begin{scope}[shift={(A)}]
71 \tkzDefPoint[label= right:$B_n$](31:3){B}
72 \tkzDefPoint[label= right:$C_n$](158:3){C}
73 \end{scope}
74 \tkzDrawSegments[color=red,%
75 line width=1pt](A,B A,C)
76 \tkzDrawPoints[color=red](A,B,C)
77 \end{tikzpicture}
78 \end{tkzexample}
79
80 \subsubsection{Forms and coordinates}
81 Here we must follow the syntax of \tkzNamePack{xfp}. It is always possible to go through \tkzNamePack{pgfmath} but in this case, the coordinates must be calculated before using the macro \tkzcname{tkzDefPoint}.
82
83 \begin{tkzexample}[latex=6cm,small]
84 \begin{tikzpicture}[scale=.75]
85 \tkzInit[xmax=6,ymax=6]
86 \tkzGrid
87 \tkzSetUpPoint[shape = circle,color = red,%
88 size = 4,fill = red!30]
89 \tkzDefPoint(-1+1,-1+4){O}
90 \tkzDefPoint({3*ln(exp(1))},{exp(1)}){A}
91 \tkzDefPoint({4*sin(pi/6)},{4*cos(pi/6)}){B}
92 \tkzDefPoint({4*sin(pi/3)},{4*cos(pi/3)}){B'}
93 \tkzDefPoint[shift={(1,3)}](30:3){A'}
94 \tkzDrawPoints(O,A,B)
95 \tkzDrawPoints[color=red,shape=cross out](B',A')
96 \tkzLabelPoints(A,O,B,B',A')
97 \end{tikzpicture}
98 \end{tkzexample}
99
100 \subsubsection{Scope and \tkzcname{tkzDefPoint}}
101 First, we can use the \tkzNameEnv{scope} of \TIKZ.
102 In the following example, we have a way to define an isosceles triangle.
103
104 \begin{tkzexample}[latex=7cm,small]
105 \begin{tikzpicture}[scale=1]
106 \begin{scope}[rotate=30]
107 \tkzDefPoint(2,3){A}
108 \begin{scope}[shift=(A)]
109 \tkzDefPoint(90:5){B}
110 \tkzDefPoint(30:5){C}
111 \end{scope}
112 \end{scope}
113 \tkzDrawSegments[color=blue](A,B B,C C,A)
114 \tkzDrawPoints(A,B,C)
115 \tkzLabelPoints[above](B,C)
116 \tkzLabelPoints[below](A)
117 \end{tikzpicture}
118 \end{tkzexample}
119 %<--------------------------------------------------------------------------->
120 \subsection{Definition of points in Cartesian coordinates: \tkzcname{tkzDefPoints}} \hypertarget{tdps}{}
121
122 \begin{NewMacroBox}{tkzDefPoints}{\oarg{local options}\var{$x_1/y_1/n_1,x_2/y_2/n_2$, ...}}%
123 $x_1$ and $y_1$ are the coordinates of a referenced point $n_1$
124
125 \begin{tabular}{lll}%
126 \toprule
127 arguments & example & \\
128 \midrule
129 \TAline{$x_i/y_i/n_i$}{\tkzcname{tkzDefPoints\{0/0/O,2/2/A\}}}{}
130 \end{tabular}
131 \end{NewMacroBox}
132
133 \subsubsection{Definition of points}
134 \begin{tkzexample}[latex=6cm,small]
135 \begin{tikzpicture}[scale=1]
136 \tkzDefPoints{0/0/A,2/0/B,2/2/C,0/2/D}
137 \tkzDrawSegments(D,A A,B B,C C,D)
138 %with tkz-euclide \tkzDrawPolygon(A,...,D)
139 \tkzDrawPoints(A,B,C,D)
140 \end{tikzpicture}
141 \end{tkzexample}
142
143 %<--------------------------------------------------------------------------->
144 \subsection{Point relative to another: \tkzcname{tkzDefShiftPoint}}
145 \hypertarget{tdsp}{}
146 \begin{NewMacroBox}{tkzDefShiftPoint}{\oarg{Point}\parg{x,y}\var{name} ou \parg{a:r}\var{name}}%
147 \begin{tabular}{lll}%
148 arguments & default & definition \\
149 \midrule
150 \TAline{(x,y)}{no default}{$x$ and $y$ are two dimensions, by default in cm.}
151 \TAline{(a:r)}{no default}{$a$ is an angle in degrees, $r$ is a dimension}
152 \TAline{point} {no default} {\tkzcname{tkzDefShiftPoint}[A](0:4)\{B\}}
153 \bottomrule
154 \end{tabular}
155
156 No options. The name of the point is mandatory.
157 \end{NewMacroBox}
158
159 \subsubsection{Example with \tkzcname{tkzDefShiftPoint}}
160 This macro allows you to place one point relative to another. This is equivalent to a translation. Here is how to construct an isosceles triangle with main vertex $A$ and angle at vertex of $30^\circ$.
161
162 \begin{tkzexample}[latex=7cm,small]
163 \begin{tikzpicture}[rotate=-30]
164 \tkzDefPoint(2,3){A}
165 \tkzDefShiftPoint[A](0:4){B}
166 \tkzDefShiftPoint[A](30:4){C}
167 \tkzDrawSegments(A,B B,C C,A)
168 \tkzMarkSegments[mark=|,color=red](A,B A,C)
169 \tkzDrawPoints(A,B,C)
170 \tkzLabelPoints[above](A,C)
171 \tkzLabelPoints(B)
172 \end{tikzpicture}
173 \end{tkzexample}
174
175 \subsection{Point relative to another: \tkzcname{tkzDefShiftPointCoord}}
176 \begin{NewMacroBox}{tkzDefShiftPointCoord}{\oarg{a,b}\parg{x,y}\var{name} or \parg{a:r}\var{name}}%
177 {This involves performing a $(a,b)$ vector translation at the defined point relative to the origin.}
178
179 \medskip
180 \begin{tabular}{lll}%
181 \toprule
182 arguments & default & definition \\
183 \midrule
184 \TAline{(x,y)}{no default}{$x$ and $y$ are two dimensions, by default in cm.}
185 \TAline{(a:r)}{no default}{$a$ is an angle in degrees, $r$ is a dimension}
186 \bottomrule
187 \end{tabular}
188
189 \medskip
190 \begin{tabular}{lll}%
191 options & default & example \\
192 \midrule
193 \TOline{a,b} {no default} {\tkzcname{tkzDefShiftPointCoord}[2,3](0:4)\{B\}}
194 \bottomrule
195 \end{tabular}
196
197 The option is mandatory
198 \end{NewMacroBox}
199
200
201 \subsubsection{Equilateral triangle with \tkzcname{tkzDefShiftPointCoord}}
202 Let's see how to get an equilateral triangle (there is much simpler)
203
204 \begin{tkzexample}[latex=7cm,small]
205 \begin{tikzpicture}[scale=1]
206 \tkzDefPoint(2,3){A}
207 \tkzDefShiftPointCoord[2,3](30:4){B}
208 \tkzDefShiftPointCoord[2,3](-30:4){C}
209 \tkzDrawSegments(A,B B,C C,A)
210 % or \tkzDrawPolygon
211 \tkzDrawPoints(A,B,C)
212 \tkzLabelPoints(B,C)
213 \tkzLabelPoint[left](A){$A$}
214 \end{tikzpicture}
215 \end{tkzexample}
216
217 \subsubsection{Isosceles triangle with \tkzcname{tkzDefShiftPointCoord}}
218 Let's see how to obtain an isosceles triangle with a principal angle of 30 degrees. Rotation is possible. $AB=AC=5$ and $\widehat{BAC}$
219
220 \begin{tkzexample}[latex=7cm,small]
221 \begin{tikzpicture}[rotate=15]
222 \tkzDefPoint(2,3){A}
223 \tkzDefShiftPointCoord[2,3](15:5){B}
224 \tkzDefShiftPointCoord[2,3](-15:5){C}
225 \tkzDrawSegments(A,B B,C C,A)
226 \tkzDrawPoints(A,B,C)
227 \tkzLabelPoints(B,C)
228 \tkzLabelPoint[left](A){$A$}
229 \end{tikzpicture}
230 \end{tkzexample}
231
232 %<--------------------------------------------------------------------------->
233 \subsection{Drawing a point \tkzcname{tkzDrawPoint}}
234 \begin{NewMacroBox}{tkzDrawPoint}{\oarg{local options}\parg{point}}%
235 \begin{tabular}{lll}%
236 arguments & default & definition \\
237 \midrule
238 \TAline{point} {no default} {a name or reference is requested}
239 \bottomrule
240 \end{tabular}
241
242 \medskip
243 \noindent{The argument is mandatory, but it is not necessary (although recommended) to use a reference; a pair of coordinates placed between braces is accepted. The disk takes the color of the circle, but 50\% lighter. It is possible to modify everything. The point is a node and is therefore invariant if the drawing is modified by scaling..}
244
245 \medskip
246 \begin{tabular}{lll}%
247 \toprule
248 options & default & definition \\
249 \midrule
250 \TOline{shape} {circle}{Possible \tkzname{cross} or \tkzname{cross out}}
251 \TOline{size} {2 pt} {disk size}
252 \TOline{color} {black}{the default color can be changed}
253 \bottomrule
254 \end{tabular}
255
256 \medskip
257 \noindent{We can create other forms such as \tkzname{cross}}
258 \end{NewMacroBox}
259
260 \subsubsection{Default stitch style}
261 \begin{tkzexample}[latex=5cm,small]
262 \begin{tikzpicture}
263 \tkzDefPoint(1,3){A}
264 \tkzDrawPoint(A)
265 \end{tikzpicture}
266 \end{tkzexample}
267
268 \subsubsection{Changing the style}
269 The default definition is in the file \tkzname{tkz-base.cfg}
270
271 \begin{tkzltxexample}[small]
272 \tikzset{point style/.style={draw = \tkz@euc@pointcolor,
273 inner sep = 0pt,
274 shape = \tkz@euc@pointshape,
275 minimum size = \tkz@euc@pointsize,
276 fill = \tkz@euc@pointcolor!50}}
277 \end{tkzltxexample}
278
279 \begin{tkzexample}[latex=5cm,small]
280 \begin{tikzpicture}
281 \tikzset{point style/.style={%
282 draw = blue,
283 inner sep = 0pt,
284 shape = circle,
285 minimum size = 6pt,
286 fill = red!20}}
287 \tkzDefPoint(1,3){A}
288 \tkzDefPoint(4,1){B}
289 \tkzDefPoint(0,0){O}
290 \tkzDrawPoint(A)
291 \tkzDrawPoint(B)
292 \tkzDrawPoint(O)
293 \end{tikzpicture}
294 \end{tkzexample}
295
296 \subsubsection{Example of point plots}
297 Note that \tkzname{scale} does not affect the shape of the dots. Which is normal. Most of the time, we are satisfied with a single point shape that we can define from the beginning, either with a macro or by modifying a configuration file.
298
299 \begin{tkzexample}[latex=5cm,small]
300 \begin{tikzpicture}[scale=.5]
301 \tkzDefPoint(1,3){A}
302 \tkzDefPoint(4,1){B}
303 \tkzDefPoint(0,0){O}
304 \tkzDrawPoint[shape=cross out,size=12,color=red](A)
305 \tkzDrawPoint[shape=cross,size=12,color=blue](B)
306 \tkzDrawPoint[size=12,color=green](O)
307 \tkzDrawPoint[size=12,color=blue,fill=yellow]({2,2})
308 \end{tikzpicture}
309 \end{tkzexample}
310
311 It is possible to draw several points at once, but this macro is a little slower than the previous one. Moreover, we have to make do with the same options for all the points.
312
313 \subsection{Drawing points \tkzcname{tkzDrawPoints}}
314 \hypertarget{tdrps}{}
315 \begin{NewMacroBox}{tkzDrawPoints}{\oarg{local options}\parg{liste}}%
316 \begin{tabular}{lll}%
317 arguments & default & definition \\
318 \midrule
319 \TAline{points list}{no default}{example \tkzcname{tkzDrawPoints(A,B,C)}}
320 \bottomrule
321 \end{tabular}
322
323 \medskip
324 Warning at the final "s", an oversight leads to cascading errors if you attempt to plot multiple points. The options are the same as for the previous macro.
325 \end{NewMacroBox}
326
327 \subsubsection{Example with \tkzcname{tkzDefPoint} and \tkzcname{tkzDrawPoints} }
328 \begin{tkzexample}[latex=7cm,small]
329 \begin{tikzpicture}[scale=.5]
330 \tkzDefPoint(1,3){A}
331 \tkzDefPoint(4,1){B}
332 \tkzDefPoint(0,0){O}
333 \tkzDrawPoints[size=8,color=red](A,B,O)
334 \end{tikzpicture}
335 \end{tkzexample}
336
337 \subsubsection{More complex example }
338 \begin{tkzexample}[latex=7cm]
339 \begin{tikzpicture}[scale=.5]
340 \tkzDefPoint(2,3){A} \tkzDefPoint(5,-1){B}
341 \tkzDefPoint[label=below:$\mathcal{C}$,
342 shift={(2,3)}](-30:5.5){E}
343 \begin{scope}[shift=(A)]
344 \tkzDefPoint(30:5){C}
345 \end{scope}
346 \tkzDrawCircle(A,B)
347 \tkzDrawSegment(A,B)
348 \tkzDrawPoints(A,B,C)
349 \tkzLabelPoints(B,C)
350 \tkzLabelPoints[above](A)
351 \end{tikzpicture}
352 \end{tkzexample}
353
354 %<--------------------------------------------------------------------------->
355 \subsection{Add a label to a point \tkzcname{tkzLabelPoint}}
356 \hypertarget{tlp}{}
357 It is possible to add several labels at the same point by using this macro several times.
358
359 \begin{NewMacroBox}{tkzLabelPoint}{\oarg{local options}\parg{point}\var{label}}%
360 \begin{tabular}{lll}%
361 arguments & example & \\
362 \midrule
363 \TAline{point}{\tkzcname{tkzLabelPoint(A)\{\$A\_1\$\}}}{}
364 options & default & definition\\
365 \midrule
366 \TOline{TikZ options}{}{colour, position etc.}
367 \bottomrule
368 \end{tabular}
369
370 \medskip
371 Optionally, we can use any style of \TIKZ, especially placement with above, right, dots...
372 \end{NewMacroBox}
373
374 \subsubsection{Example with \tkzcname{tkzLabelPoint}}
375 \begin{tkzexample}[latex=7cm,small]
376 \begin{tikzpicture}
377 \tkzDefPoint(0,0){A}
378 \tkzDefPoint(4,0){B}
379 \tkzDefPoint(0,3){C}
380 \tkzDrawSegments(A,B B,C C,A)
381 \tkzDrawPoints(A,B,C)
382 \tkzLabelPoint[left,red](A){$A$}
383 \tkzLabelPoint[right,blue](B){$B$}
384 \tkzLabelPoint[above,purple](C){$C$}
385 \end{tikzpicture}
386 \end{tkzexample}
387
388 \subsubsection{Label and reference}
389 The reference of a point is the object that allows to use the point, the label is the name of the point that will be displayed.
390
391 \begin{tkzexample}[latex=8cm,small]
392 \begin{tikzpicture}
393 \tkzInit[xmax=1,xstep=0.15,ymax=.5]
394 \tkzAxeX \tkzDrawY[noticks]
395 \tkzDefPoint(0.22,0.25){A}
396 \tkzDrawPoint(A)
397 \tkzLabelPoint[above](A){$A_1$}
398 \end{tikzpicture}
399 \end{tkzexample}
400 %<--------------------------------------------------------------------------->
401 \subsection{Add labels to points \tkzcname{tkzLabelPoints}}
402 It is possible to place several labels quickly when the point references are identical to the labels and when the labels are placed in the same way in relation to the points. By default, \tkzname{below right} is chosen.
403 \hypertarget{tlps}{}
404
405 \begin{NewMacroBox}{tkzLabelPoints}{\oarg{local options}\parg{$A_1,A_2,...$}}%
406 \begin{tabular}{lll}
407 arguments & example & result \\
408 \midrule
409 \TAline{list of points}{\tkzcname{tkzLabelPoints(A,B,C)}}{Display of $A$, $B$ and $C$}
410 \bottomrule
411 \end{tabular}
412
413 \medskip
414 This macro reduces the number of lines of code, but it is not obvious that all points need the same label positioning.
415 \end{NewMacroBox}
416
417 \subsubsection{Example with \tkzcname{tkzLabelPoints}}
418 \begin{tkzexample}[latex = 7cm,small]
419 \begin{tikzpicture}
420 \tkzDefPoint(2,3){A}
421 \tkzDefShiftPoint[A](30:2){B}
422 \tkzDefShiftPoint[A](30:5){C}
423 \tkzDrawPoints(A,B,C)
424 \tkzLabelPoints(A,B,C)
425 \end{tikzpicture}
426 \end{tkzexample}
427 %<--------------------------------------------------------------------------->
428 % tkzAutoLabelPoints
429 %<--------------------------------------------------------------------------->
430 \subsection{Automatic position of labels \tkzcname{tkzAutoLabelPoints}}
431 The label of a point is placed in a direction defined by a \tkzname{center} and a point . The distance to the point is determined by a percentage of the distance between the center and the point. This percentage is given by \tkzname{dist}.
432 \begin{NewMacroBox}{tkzLabelPoints}{\oarg{local options}\parg{$A_1,A_2,...$}}%
433 \begin{tabular}{lll}
434 arguments & example & result \\
435 \midrule
436 \TAline{list of points}{\tkzcname{tkzLabelPoint(A,B,C)}}{Display of $A$, $B$ and $C$}
437 \end{tabular}
438
439 \medskip
440 \begin{tabular}{lll}
441 options & default & definition \\
442 \midrule
443 \TOline{center}{no default}{you need to deisgn a center}
444 \TOline{dist}{0.15}{percentage change in the distance between the center and the points}
445 \end{tabular}
446 \end{NewMacroBox}
447
448 \subsubsection{Example 1 with \tkzcname{tkzAutoLabelPoints}}
449 Here the points are positioned relative to the center of gravity of $A,B,C \ \text{et}\ O$.
450 \begin{tkzexample}[latex=5cm,small]
451 \begin{tikzpicture}[scale=1.25]
452 \tkzDefPoint(2,1){O}
453 \tkzDefRandPointOn[circle=center O radius 1.5]
454 \tkzGetPoint{A}
455 \tkzDrawCircle(O,A)
456 \tkzDefPointBy[rotation=center O angle 100](A)
457 \tkzGetPoint{C}
458 \tkzDefPointBy[rotation=center O angle 78](A)
459 \tkzGetPoint{B}
460 \tkzDrawPoints(O,A,B,C)
461 \tkzDrawSegments(C,B B,A A,O O,C)
462 \tkzDefBarycentricPoint(A=1,B=1,C=1,O=1)
463 \tkzDrawPoint(tkzPointResult)
464 \tkzAutoLabelPoints[center=tkzPointResult,
465 dist=.3,red](O,A,B,C)
466 \end{tikzpicture}
467 \end{tkzexample}
468
469 \subsubsection{Example 2 with \tkzcname{tkzAutoLabelPoints}}
470 This time the reference is $O$ and the distance is by default $0.15$.
471 \begin{tkzexample}[latex=5cm,small]
472 \begin{tikzpicture}[scale=1.25]
473 \tkzDefPoint(2,1){O}
474 \tkzDefRandPointOn[circle=center O radius 1.5]
475 \tkzGetPoint{A}
476 \tkzDrawCircle(O,A)
477 \tkzDefPointBy[rotation=center O angle 100](A)
478 \tkzGetPoint{C}
479 \tkzDefPointBy[rotation=center O angle 78](A)
480 \tkzGetPoint{B}
481 \tkzDrawPoints(O,A,B,C)
482 \tkzDrawSegments(C,B B,A A,O O,C)
483 \tkzAutoLabelPoints[center=O,red](A,B,C)
484 \end{tikzpicture}
485 \end{tkzexample}
486 %<--------------------------------------------------------------------------->
487
488 \subsection{Point style with \tkzcname{tkzSetUpPoint}}
489 It is important to understand that the size of a dot depends on the size of a line.
490 \begin{NewMacroBox}{tkzSetUpPoint}{\oarg{local options}}%
491 \begin{tabular}{lll}
492 options & default & definition \\
493 \midrule
494 \TOline{shape}{circle}{possible: circle, cross, cross out}
495 \TOline{size}{current }{the size of the point is size * line width }
496 \TOline{color}{current}{}
497 \TOline{fill}{current!50}{}
498 \end{tabular}
499 \end{NewMacroBox}
500
501 This is a macro for choosing a \hypertarget{setupoint}{style} for points.
502 \subsubsection{Simple example with \tkzcname{tkzSetUpPoint}}
503 \begin{tkzexample}[latex=6cm,small]
504 \begin{tikzpicture}
505 \tkzSetUpPoint[shape = cross out,
506 color=blue]
507 \tkzInit[xmax=100,xstep=20,ymax=.5]
508 \tkzDefPoint(20,1){A}
509 \tkzDefPoint(80,0){B}
510 \tkzDrawLine(A,B)
511 \tkzDrawPoints(A,B)
512 \end{tikzpicture}
513 \end{tkzexample}
514
515 \subsubsection{Second example with \tkzcname{tkzSetUpPoint}}
516 \begin{tkzexample}[latex=7cm,small]
517 \begin{tikzpicture}
518 \tkzInit[ymin=-0.5,ymax=3,xmin=-0.5,xmax=7]
519 \tkzDefPoint(0,0){A}
520 \tkzDefPoint(02.25,04.25){B}
521 \tkzDefPoint(4,0){C}
522 \tkzDefPoint(3,2){D}
523 \tkzDrawSegments(A,B A,C A,D)
524 \tkzSetUpPoint[shape=cross out,size=4,]
525 \tkzDrawPoints(A,B,C,D)
526 \tkzLabelPoints(A,B,C,D)
527 \end{tikzpicture}
528 \end{tkzexample}
529
530 \subsubsection{Using \tkzcname{tkzSetUpPoint} in a group}
531 Only the points in the group are affected by the changes.
532
533 \begin{tkzexample}[latex=7cm,small]
534 \begin{tikzpicture}
535 \tkzInit[ymin=-0.5,ymax=3,xmin=-0.5,xmax=7]
536 \tkzDefPoint(0,0){A}
537 \tkzDefPoint(02.25,04.25){B}
538 \tkzDefPoint(4,0){C}
539 \tkzDefPoint(3,2){D}
540 \tkzDrawSegments(A,B A,C A,D)
541 {\tkzSetUpPoint[shape=cross out,
542 fill= blue!70!black!!50,
543 size=4,color=blue!70!black!30]
544 \tkzDrawPoints(A,B)}
545 \tkzSetUpPoint[fill= blue!70!black!!50,size=4,
546 color=blue!70!black!30]
547 \tkzDrawPoints(C,D)
548 \tkzLabelPoints(A,B,C,D)
549 \end{tikzpicture}
550 \end{tkzexample}
551 %<--------------------------------------------------------------------------->
552 \subsection{Show point coordinates}
553 This macro allows you to display the coordinates of a point and to draw arrows to specify the abscissa and ordinate. The point is given by its reference (its name). It is possible to give a couple of coordinates.
554 \hypertarget{tpsc}{}
555 \begin{NewMacroBox}{tkzPointShowCoord}{\oarg{local options}\parg{point}}%
556 \begin{tabular}{lll}%
557 argument & example & explanation \\
558 \midrule
559 \TAline{\parg{ref}}{\tkzcname{tkzPointShowCoord}(A)}{shows the coordinates of point $A$}
560 \bottomrule
561 \end{tabular}
562
563 \medskip
564 \begin{tabular}{lll}%
565 option & default & explication \\
566 \midrule
567 \TOline{xlabel}{empty}{label abscissa}
568 \TOline{xstyle}{empty}{style for the abscissa label node example |text=red|}
569 \TOline{noxdraw}{false}{boolean for not draw an arrow to the X-axis $(x'x)$}
570 \TOline{ylabel}{empty}{idem}
571 \TOline{ystyle}{empty}{idem}
572 \TOline{noydraw}{false}{idem}
573 \end{tabular}
574 \end{NewMacroBox}
575
576 \subsubsection{Default styles}
577 Here are some of the main styles:
578 \begin{tkzltxexample}[small]
579 \tikzset{arrow coord style/.style={dashed,
580 \tkz@euc@linecolor,
581 >=latex',
582 ->}}
583 \tikzset{xcoord style/.style={\tkz@euc@labelcolor,
584 font=\normalsize,text height=1ex,
585 inner sep = 0pt,
586 outer sep = 0pt,
587 fill=\tkz@fillcolor,
588 below=3pt}}
589 \tikzset{ycoord style/.style={\tkz@euc@labelcolor,
590 font=\normalsize,text height=1ex,
591 inner sep = 0pt,
592 outer sep = 0pt,
593 fill=\tkz@fillcolor,
594 left=3pt}}
595 \end{tkzltxexample}
596
597 \subsubsection{Example with \tkzcname{tkzPointShowCoord}}
598
599 \begin{tkzexample}[latex=7cm,small]
600 \begin{tikzpicture}[scale=1.5]
601 \tkzInit[xmax=3,ymax=2]
602 \tkzAxeXY
603 \tkzDefPoint(2,1){a}
604 \tkzPointShowCoord(a)
605 \tkzDrawPoint(a)
606 \tkzLabelPoint(a){$A_1$}
607 \tkzPointShowCoord({1,2})
608 \tkzDrawPoint({1,2})
609 \tkzLabelPoint({1,2}){$A_2$}
610 \end{tikzpicture}
611 \end{tkzexample}
612
613 \subsubsection{Example with \tkzcname{tkzPointShowCoord} and \tkzname{xstep}}
614
615 \begin{tkzexample}[latex=7cm,small]
616 \begin{tikzpicture}[xscale=3,yscale=2]
617 \tkzInit[xmax=15,ymax=15,
618 xstep=10,ystep=10]
619 \tkzAxeXY
620 \tkzDefPoint(10,10){a} \tkzDrawPoint(a)
621 \tkzPointShowCoord(a)
622 \tkzLabelPoint(a){$A_1$}
623 \end{tikzpicture}
624 \end{tkzexample}
625
626
627 \subsection{\tkzcname{tkzDefSetOfPoints}} % (fold)
628 It was already possible to create a scatter plot with the macro \tkzcname{tkzDefPoints}, but this requires making a reference (a name) to each point, which is sometimes tedious. The macro \tkzcname{tkzSetOfPoints} allows to define points \tkzname{tkzPt1}, \tkzname{tkzPt2}, etc.
629
630 This is frequently referred to as \hypertarget{label_tkzDefSetOfPoints}{ "scatter plot"}. The difference from the macro \tkzcname{tkzDefPoints} is that the reference to the points is given by a prefix (default \tkzname{tkzPt}) and the point number.
631 The points are not drawn.
632
633 \begin{NewMacroBox}{tkzDefSetOfPoints}{\oarg{local options}\var{$x_1/y_1,x_2/y_2,\ldots,x_n/y_n$}}%
634 \begin{tabular}{lll}%
635 arguments & default & definition \\
636 \midrule
637 \TAline{$x_n/y_n$}{no default}{List of couples $x_n/y_n$ separated by commas}
638 \bottomrule
639 \end{tabular}
640
641 \medskip
642 \begin{tabular}{lll}%
643 options & default & definition \\
644 \midrule
645 \TOline{prefix} {tkzPt} {prefix for point names}
646 \end{tabular}
647 \end{NewMacroBox}
648
649 \subsubsection{Creating a scatter plot with \tkzcname{tkzDefSetOfPoints}}
650 \begin{tkzexample}[latex=7cm,small]
651 \begin{tikzpicture}
652 \tkzInit[ymax=4,xmax=5]
653 \tkzAxeXY
654 \tkzDefSetOfPoints[prefix=P]%
655 {1/2,4/3,2/2.5}
656 \tkzDrawPoints(P1,P2,P3)
657 \tkzLabelPoints(P1,P2,P3)
658 \end{tikzpicture}
659 \end{tkzexample}
660
661 \endinput
662
663