summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-marks.tex
blob: b54b04c69b9c649624d097ff6264975b6812c071 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
\section{Marks or symbols}

I distinguished between the points used in Euclidean geometry and the "marks or symbols" that can be found in statistics.

To position the symbol, we use the macro \tkzcname{tkzDefPoint} to correctly define a point, then the macro \tkzcname{tkzDrawMark} to draw the symbol.

It is common to have to draw a scatter plot, so I created a macro that allows you to define several points quickly.

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.

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.

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. 

The points are not drawn.

\subsection{\tkzcname{tkzDrawSetOfPoints}} 

\begin{NewMacroBox}{tkzDrawSetOfPoints}{\oarg{local options}}%
Allows you to place symbols on the points defined by \tkzcname{tkzDefSetOfPoints}.

\medskip
\begin{tabular}{lll}%
options             & default & definition   \\ 
\midrule
\TOline{prefix} {tkzPt} {point name prefix}
\end{tabular}
\end{NewMacroBox}

\subsubsection{Drawing of a scatter plot with \tkzcname{tkzDrawSetOfPoints}} 
\begin{tkzexample}[latex=6cm,small] 
\begin{tikzpicture}[scale=0.75]
\tkzInit[xmax=6,ymin=1000,ymax=5000,ystep=1000]
\tkzDrawX[label=$m$,below=10pt]
\tkzDrawY[label=$R(m)$,above=10pt] 
\tkzLabelX[font=\scriptsize]
\tkzLabelY[font=\scriptsize]
\tkzDefSetOfPoints[show]{1/2000,2/3000,4/2500,5/4200}
\tkzDrawSetOfPoints[mark=ball,mark size=3pt]  
\end{tikzpicture}
\end{tkzexample}

\subsection{\tkzcname{tkzJoinSetOfPoints}} 
\begin{NewMacroBox}{tkzJoinSetOfPoints}{\oarg{local options}}%
Allows the symbols to be joined by line segments. Of course, it is possible to use all the options of \TIKZ.

\medskip
\begin{tabular}{lll}%
options             & default & definition   \\ 
\midrule
\TOline{prefix} {tkzPt} {point name prefix}
\end{tabular}
\end{NewMacroBox} 

\subsubsection{Link the points of a scatter plot with \tkzcname{tkzJoinSetOfPoints}} 
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=1]
\tkzInit[xmax=5,ymin=1000,ymax=6000,ystep=1000]
\tkzDrawX[label=$m$,below=13pt]
\tkzDrawY[label=$R(m)$] 
\tkzLabelX[font=\scriptsize]
\tkzLabelY[font=\scriptsize]
\tkzDefSetOfPoints{%
   1/2000,2/3000,4/2500,5/4200}
\tkzJoinSetOfPoints[%
      thick, color=brown]
\tkzDrawSetOfPoints[%
      mark=ball, mark size=3pt]  
\end{tikzpicture} 
\end{tkzexample}

\subsubsection{Using the points of a scatter plot} 
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.5]
\tkzInit[xmax=5,ymin=1000,
         ymax=6000,ystep=1000]
\tkzGrid[color=orange!30]
\tkzDrawX[label=$m$,below=13pt]
\tkzDrawY[label=$R(m)$] 
\tkzLabelX[font=\scriptsize]
\tkzLabelY[font=\scriptsize] 
\tkzDefSetOfPoints[prefix=P]{%
   1/2000,2/3000,3/2000,4/2500,5/4200} 
\tkzDrawPolySeg[%
     color=brown!50,
     line width=2pt](P1,P2,P3,P4,P5) 
\end{tikzpicture} 
\end{tkzexample}
 
% \subsection{Mark option \tkzname{mark} et \tkzname{size}}   
\subsection{\tkzcname{tkzSetUpMark}}
\begin{NewMacroBox}{tkzSetUpMark}{\oarg{local options}}%
\begin{tabular}{lll}%
options &  default & example                 \\ 
\midrule
\TOline{mark}{no default}{\tkzcname{tkzSetUpMark[mark=heart]}}
\end{tabular}
\end{NewMacroBox} 

\subsubsection{Two scatter plots} 
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
\tkzInit[xmax=5.5,ymin=1000,%
         ymax=6000,ystep=2000]
\tkzGrid[color=orange!30]
\tkzDrawX[label=$m$,below=13pt]
\tkzDrawY[above left,label=$R(m)$] 
\tkzLabelX[below right,font=\scriptsize]
\tkzLabelY[font=\scriptsize]
\tkzDefSetOfPoints{1/2000,2/3000,3/2000,
    4/2500,5/4200} 
\tkzDefSetOfPoints[prefix=P]{1/3200,2/4100,
    3/3300,4/3300,5/5000}  
\tkzSetUpMark[mark=heart,color=black,
   fill=red!30,size=4pt]
\tkzJoinSetOfPoints[thick,color=blue,double]
\tkzDrawSetOfPoints
\tkzJoinSetOfPoints[prefix=P,thick,color=orange]
\tkzDrawSetOfPoints[prefix=P,mark=square*,
     mark size=4pt,
     mark options={color=blue,fill=blue!40}]  
\tkzText[draw,color = red,
        fill  = orange!20](3,5800)%
        {Revenue by month}
  \end{tikzpicture}  
\end{tkzexample}

\subsection{\tkzcname{tkzDrawMark}} 
\begin{NewMacroBox}{tkzDrawMark}{\oarg{local options}\parg{point}}%
Place a symbol. More efficient than the next to place a single symbol.

\medskip
\begin{tabular}{lll}%
options             & default & definition   \\ 
\midrule
\TOline{prefix} {tkzPt} {point name prefix}
\end{tabular}
\end{NewMacroBox} 

\subsubsection{Ball; use of \tkzcname{tkzDrawMarks}}
\begin{tkzexample}[latex=7cm,small]
  \begin{tikzpicture}
  \tkzInit[xmax=3,ymax=1]
  \tkzAxeXY 
  \tkzDrawMark[mark=ball](1,.5)
  \end{tikzpicture}
\end{tkzexample}

\subsection{\tkzcname{tkzDrawMarks}} 
\begin{NewMacroBox}{tkzDrawMarks}{\oarg{local options}\parg{list of points}}%
Allows you to place a series of marks.

\medskip
\begin{tabular}{lll}%
options             & default & definition   \\ 
\midrule
\TOline{prefix} {tkzPt} {point name prefix}
\end{tabular}
\end{NewMacroBox}   

\subsubsection{Mark and plot; use of \tkzcname{tkzDrawMarks}}
\begin{tkzexample}[latex=7cm,small]
  \begin{tikzpicture}
  \tkzInit[xmax=6,ymin=1000,
          ymax=5000,ystep=1000]
  \tkzAxeXY 
  \tkzDefSetOfPoints[prefix=P]{%
        1/2000, 
        2/3000,
        4/2500, 
        5/4200} 
  \tkzDrawSegments[color=brown!50]%
(P1,P2 P2,P3 P3,P4)  
  \tkzDrawMarks[mark=ball](P1,P2,P3,P4)
  \end{tikzpicture}
\end{tkzexample}
 
 
\endinput