Debian Codegraph @

texmf-dist/tex/latex/tkz-grapheur/tkz-grapheur-stats.tex

raw
1 % tkz-grapheur-stats.tex
2 % Copyright 2026 Cédric Pierquet
3 % Environnement GraphiqueTikzStats : graphiques statistiques avec grandes valeurs
4 % Principe : normalisation interne, TikZ travaille dans [0,Largeur]x[0,Hauteur]
5 % Structure calquée sur GraphiqueTikz pour cohérence maximale
6
7 %====LENGTHS
8 \newlength\tmptkzgstwidth
9 \newlength\tmptkzgstheight
10
11 %====CLÉS — même structure que GraphiqueTikz + clés stats
12 \defKV[GraphiqueTikzStats]{%
13 TailleGrad=\setlength\pflthickgrad{#1},%
14 Xmin=\def\pflstxmintmp{#1},%
15 Xmax=\def\pflstxmaxtmp{#1},%
16 Ymin=\def\pflstymintmp{#1},%
17 Ymax=\def\pflstymaxtmp{#1},%
18 Largeur=\setlength\tmptkzgstwidth{#1},%
19 Hauteur=\setlength\tmptkzgstheight{#1},%
20 Origx=\def\pflstOxtmp{#1},%
21 Origy=\def\pflstOytmp{#1},%
22 Theme=\def\pflstgraphthem{#1},%
23 NomFigure=\def\pflstgraphnom{#1},%
24 Xgrille=\def\pflstgrillextmp{#1},%
25 Xgrillei=\def\pflstgrillexitmp{#1},%
26 Xgrilles=\def\pflstgrillexstmp{#1},%
27 Ygrille=\def\pflstgrilleytmp{#1},%
28 Ygrillei=\def\pflstgrilleyitmp{#1},%
29 Ygrilles=\def\pflstgrilleystmp{#1}%
30 }
31 \setKVdefault[GraphiqueTikzStats]{%
32 AffCadre=false,%
33 TailleGrad=3pt,%
34 Xmin=0,%
35 Xmax=10,%
36 Ymin=0,%
37 Ymax=10,%
38 Largeur=8cm,%
39 Hauteur=6cm,%
40 Origx={},%
41 Origy={},%
42 Theme={},%
43 Milli=false,%
44 NomFigure={},%
45 Xgrille={1},%
46 Xgrillei={1},%
47 Xgrilles={0.5},%
48 Ygrille={1},%
49 Ygrillei={1},%
50 Ygrilles={0.5}%
51 }
52
53
54 %====ENVIRONNEMENT
55 \NewDocumentEnvironment{GraphiqueTikzStats}{ O{} D<>{} }{%
56 \restoreKV[GraphiqueTikzStats]%
57 \setKV[GraphiqueTikzStats]{#2}%
58 %---- valeurs réelles stockées
59 \xdef\pflstxmin{\xintfloateval{\pflstxmintmp}}%
60 \xdef\pflstxmax{\xintfloateval{\pflstxmaxtmp}}%
61 \xdef\pflstymin{\xintfloateval{\pflstymintmp}}%
62 \xdef\pflstymax{\xintfloateval{\pflstymaxtmp}}%
63 \xdef\pflstgrillex{\xintfloateval{\pflstgrillextmp}}%
64 \xdef\pflstgrillexi{\xintfloateval{\pflstgrillexitmp}}%
65 \xdef\pflstgrillexs{\xintfloateval{\pflstgrillexstmp}}%
66 \xdef\pflstgrilley{\xintfloateval{\pflstgrilleytmp}}%
67 \xdef\pflstgrilleyi{\xintfloateval{\pflstgrilleyitmp}}%
68 \xdef\pflstgrilleys{\xintfloateval{\pflstgrilleystmp}}%
69 %---- amplitude réelle
70 \xdef\pflstampx{\xintfloateval{\pflstxmax-\pflstxmin}}%
71 \xdef\pflstampy{\xintfloateval{\pflstymax-\pflstymin}}%
72 %---- dimensions en cm (Largeur et Hauteur sont des dimensions pures : 8cm, 120mm...)
73 \xdef\pflstlargeur{\xintfloateval{\fpeval{\the\tmptkzgstwidth/1cm}}}%
74 \xdef\pflsthauteur{\xintfloateval{\fpeval{\the\tmptkzgstheight/1cm}}}%
75 %---- pas de grille normalisés (en cm dans [0,Largeur]x[0,Hauteur])
76 \xdef\pflstngrillex{\xintfloateval{\pflstgrillex/\pflstampx*\pflstlargeur}}%
77 \xdef\pflstngrillexs{\xintfloateval{\pflstgrillexs/\pflstampx*\pflstlargeur}}%
78 \xdef\pflstngrillexj{\xintfloateval{\pflstgrillexi/\pflstampx*\pflstlargeur}}%
79 \xdef\pflstngrillery{\xintfloateval{\pflstgrilley/\pflstampy*\pflsthauteur}}%
80 \xdef\pflstngrilleys{\xintfloateval{\pflstgrilleys/\pflstampy*\pflsthauteur}}%
81 \xdef\pflstngrilleys{\xintfloateval{\pflstgrilleys/\pflstampy*\pflsthauteur}}%
82 \xdef\pflstngrilleyj{\xintfloateval{\pflstgrilleyi/\pflstampy*\pflsthauteur}}%
83 %---- origine normalisée
84 \IfStrEq{\pflstOxtmp}{}%
85 {\xdef\pflstox{0}}%
86 {\xdef\pflstox{\xintfloateval{(\pflstOxtmp-\pflstxmin)/\pflstampx*\pflstlargeur}}}%
87 \IfStrEq{\pflstOytmp}{}%
88 {\xdef\pflstoy{0}}%
89 {\xdef\pflstoy{\xintfloateval{(\pflstOytmp-\pflstymin)/\pflstampy*\pflsthauteur}}}%
90 %---- ouverture tikzpicture (x=1cm, y=1cm : coordonnées en cm purs)
91 \begin{tikzpicture}[x=1cm,y=1cm,#1]%
92 %---- thèmes (identiques à GraphiqueTikz)
93 \IfStrEqCase{\pflstgraphthem}{%
94 {standard}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepdefault!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesdefault}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleidefault}}}%
95 {gris}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepgray!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesgray}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleigray}}}%
96 {bleu}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepblue!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesblue}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleiblue}}}%
97 {vert}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepgreen!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesgreen}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleigreen}}}%
98 {chaud}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepwarm!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrilleswarm}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleiwarm}}}%
99 {contraste}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepcontrast!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillescontrast}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleicontrast}}}%
100 }%
101 %---- nœuds fenêtre (coordonnées normalisées)
102 \IfStrEq{\pflstgraphnom}{}%
103 {%
104 \coordinate (st-ne) at (\pflstlargeur,\pflsthauteur) ;%
105 \coordinate (st-nw) at (0,\pflsthauteur) ;%
106 \coordinate (st-se) at (\pflstlargeur,0) ;%
107 \coordinate (st-sw) at (0,0) ;%
108 \coordinate (st-n) at ($(st-ne)!0.5!(st-nw)$) ;%
109 \coordinate (st-e) at ($(st-ne)!0.5!(st-se)$) ;%
110 \coordinate (st-s) at ($(st-se)!0.5!(st-sw)$) ;%
111 \coordinate (st-w) at ($(st-sw)!0.5!(st-nw)$) ;%
112 \coordinate (st-c) at ($(st-sw)!0.5!(st-ne)$) ;%
113 \coordinate (st-orig) at (\pflstox,\pflstoy) ;%
114 }%
115 {%
116 \coordinate (\pflstgraphnom-st-ne) at (\pflstlargeur,\pflsthauteur) ;%
117 \coordinate (\pflstgraphnom-st-nw) at (0,\pflsthauteur) ;%
118 \coordinate (\pflstgraphnom-st-se) at (\pflstlargeur,0) ;%
119 \coordinate (\pflstgraphnom-st-sw) at (0,0) ;%
120 \coordinate (\pflstgraphnom-st-orig) at (\pflstox,\pflstoy) ;%
121 }%
122 \ifboolKV[GraphiqueTikzStats]{AffCadre}%
123 {\draw[pflcadre] (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;}{}%
124 }{%
125 \end{tikzpicture}%
126 }
127
128 %====AXES ET GRILLES STATS — même structure que TracerAxesGrilles
129 \defKV[GraphiqueTikzStatsAxes]{%
130 Format=\def\pflstformataxes{#1},%
131 Elargir=\def\pflstaxeselarg{#1},%
132 Police=\def\pflstaxespol{#1}%
133 }
134 \setKVdefault[GraphiqueTikzStatsAxes]{%
135 Grille=true,%
136 GrilleIntermediaire=false,%
137 Elargir=0,%
138 Grads=true,%
139 Origine=false,%
140 Police={},%
141 Format=num,%
142 Dernier=false,%
143 Derriere=false,%
144 Devant=false,%
145 Fleches=true,%
146 AxeOy=true%
147 }
148
149 \NewDocumentCommand\TracerAxesGrillesStats{ s O{} m m }{%
150 % #1=étoile (saute origine) #2=clés #3=liste valeurs X (vraies) #4=liste valeurs Y (vraies)
151 \restoreKV[GraphiqueTikzStatsAxes]%
152 \setKV[GraphiqueTikzStatsAxes]{#2}%
153 % format axes
154 \IfSubStr{\pflstformataxes}{/}%
155 {\StrCut{\pflstformataxes}{/}{\pflstformataxex}{\pflstformataxey}}%
156 {\xdef\pflstformataxex{\pflstformataxes}\xdef\pflstformataxey{\pflstformataxes}}%
157 % cas Derriere/Devant
158 \ifboolKV[GraphiqueTikzStatsAxes]{Derriere}{\setKV[GraphiqueTikzStatsAxes]{Grads=false}}{}%
159 \ifboolKV[GraphiqueTikzStatsAxes]{Devant}{\setKV[GraphiqueTikzStatsAxes]{Grille=false}}{}%
160 % grille (pas normalisés)
161 \ifboolKV[GraphiqueTikzStatsAxes]{Grille}%
162 {%
163 \ifboolKV[GraphiqueTikzStats]{Milli}%
164 {%
165 \draw[pflgrilles,xstep=\xintfloateval{0.1*\pflstngrillex},ystep=\xintfloateval{0.1*\pflstngrillery}]
166 (0,0) grid (\pflstlargeur,\pflsthauteur) ;%
167 \draw[pflgrillei,xstep=\xintfloateval{0.5*\pflstngrillex},ystep=\xintfloateval{0.5*\pflstngrillery}]
168 (0,0) grid (\pflstlargeur,\pflsthauteur) ;%
169 }%
170 {%
171 \draw[pflgrilles,xstep=\pflstngrillexs,ystep=\pflstngrilleys]
172 (0,0) grid (\pflstlargeur,\pflsthauteur) ;%
173 }%
174 \ifboolKV[GraphiqueTikzStatsAxes]{GrilleIntermediaire}%
175 {\draw[pflgrillei,xstep=\pflstngrillexj,ystep=\pflstngrilleyj]
176 (0,0) grid (\pflstlargeur,\pflsthauteur) ;}%
177 {}%
178 \draw[pflgrillep,xstep=\pflstngrillex,ystep=\pflstngrillery]
179 (0,0) grid (\pflstlargeur,\pflsthauteur) ;%
180 \ifboolKV[GraphiqueTikzStatsAxes]{Dernier}%
181 {%
182 \draw[pflgrillep] (0,\pflsthauteur)--(\pflstlargeur,\pflsthauteur) ;%
183 \draw[pflgrillep] (\pflstlargeur,0)--(\pflstlargeur,\pflsthauteur) ;%
184 }{}%
185 }{}%
186 % axes
187 \ifboolKV[GraphiqueTikzStatsAxes]{Fleches}%
188 {%
189 \draw[pflaxes] (0,\pflstoy)
190 -- ([xshift=\pflstaxeselarg]\pflstlargeur,\pflstoy) ;%
191 \ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}%
192 {\draw[pflaxes] (\pflstox,0)
193 -- ([yshift=\pflstaxeselarg]\pflstox,\pflsthauteur) ;}{}%
194 }%
195 {%
196 \draw[pflaxessansfleche] (0,\pflstoy)
197 -- ([xshift=\pflstaxeselarg]\pflstlargeur,\pflstoy) ;%
198 \ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}%
199 {\draw[pflaxessansfleche] (\pflstox,0)
200 -- ([yshift=\pflstaxeselarg]\pflstox,\pflsthauteur) ;}{}%
201 }%
202 % graduations X
203 \foreach \tmpstx in {#3}{%
204 \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}%
205 \draw[pfltrait] (\tmpstnx,{\pflstoy+\pflthickgrad}) -- (\tmpstnx,{\pflstoy-\pflthickgrad}) ;%
206 }%
207 % graduations Y
208 \ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}%
209 {%
210 \foreach \tmpsty in {#4}{%
211 \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}%
212 \draw[pfltrait] ({\pflstox+\pflthickgrad},\tmpstny) -- ({\pflstox-\pflthickgrad},\tmpstny) ;%
213 }%
214 }{}%
215 % labels
216 \ifboolKV[GraphiqueTikzStatsAxes]{Grads}%
217 {%
218 \ifboolKV[GraphiqueTikzStatsAxes]{Origine}%
219 {\node[pflnoeud,below left,font=\pflstaxespol] at (\pflstox,\pflstoy)
220 {\FormatterValeurAxex{\pflstformataxex}{\pflstxmin}} ;}{}%
221 \foreach \tmpstx in {#3}{%
222 \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}%
223 \IfBooleanTF{#1}%
224 {\xdef\tmpisorigx{\xintfloateval{\tmpstnx == \pflstox}}%
225 \xintifboolexpr{\tmpisorigx == 1}{}%
226 {\node[pflnoeud,below,font=\pflstaxespol] at (\tmpstnx,{\pflstoy-\pflthickgrad})
227 {\FormatterValeurAxex{\pflstformataxex}{\tmpstx}} ;}}%
228 {\node[pflnoeud,below,font=\pflstaxespol] at (\tmpstnx,{\pflstoy-\pflthickgrad})
229 {\FormatterValeurAxex{\pflstformataxex}{\tmpstx}} ;}%
230 }%
231 \ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}%
232 {%
233 \foreach \tmpsty in {#4}{%
234 \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}%
235 \IfBooleanTF{#1}%
236 {\xdef\tmpisorigy{\xintfloateval{\tmpstny == \pflstoy}}%
237 \xintifboolexpr{\tmpisorigy == 1}{}%
238 {\node[pflnoeud,left,font=\pflstaxespol] at ({\pflstox-\pflthickgrad},\tmpstny)
239 {\FormatterValeurAxey{\pflstformataxey}{\tmpsty}} ;}}%
240 {\node[pflnoeud,left,font=\pflstaxespol] at ({\pflstox-\pflthickgrad},\tmpstny)
241 {\FormatterValeurAxey{\pflstformataxey}{\tmpsty}} ;}%
242 }%
243 }{}%
244 }{}%
245 }
246
247 %====NUAGE DE POINTS
248 \defKV[GraphiqueTikzStatsNuage]{%
249 Couleur=\def\pflstnuagecoul{#1},%
250 Taille=\def\pflstnuagetaille{#1}%
251 }
252 \setKVdefault[GraphiqueTikzStatsNuage]{%
253 Couleur=black,%
254 Style=o,%
255 Taille=1.75pt%
256 }
257
258 \NewDocumentCommand\TracerNuageStats{ O{} m m }{%
259 % #1=clés #2=liste X #3=liste Y
260 \restoreKV[GraphiqueTikzStatsNuage]%
261 \setKV[GraphiqueTikzStatsNuage]{#1}%
262 \setsepchar{,}%
263 \readlist*\pflstnuagex{#2}%
264 \readlist*\pflstnuagey{#3}%
265 \xintFor* ##1 in {\xintSeq{1}{\pflstnuagexlen}} \do{%
266 \itemtomacro\pflstnuagex[##1]\tmpstx%
267 \itemtomacro\pflstnuagey[##1]\tmpsty%
268 \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}%
269 \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}%
270 \filldraw[\pflstnuagecoul] (\tmpstnx,\tmpstny) circle[radius=\pflstnuagetaille] ;%
271 }%
272 }
273
274 %====DIAGRAMME EN BÂTONS
275 \NewDocumentCommand\TracerDiagBatonsStats{ O{} m }{%
276 \restoreKV[tkzDiagBatons]%
277 \setKV[tkzDiagBatons]{#1}%
278 \setsepchar[.]{,./}%
279 \readlist*\pflstbatdata{#2}%
280 \setsepchar{,}%
281 \readlist*\pflstbatlistcoul{\tkzDiagBatCouleurs}%
282 \xintFor* ##1 in {\xintSeq{1}{\pflstbatdatalen}} \do{%
283 \itemtomacro\pflstbatdata[##1,1]\tmpstx%
284 \itemtomacro\pflstbatdata[##1,2]\tmpsty%
285 \itemcycltomacro\pflstbatlistcoul[##1]\tkzDiagBatCoulCour%
286 \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}%
287 \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}%
288 \IfStrEq{\tkzDiagBatStyle}{batons}%
289 {\draw[pflbarresprobas,\tkzDiagBatCoulCour] (\tmpstnx,\pflstoy) -- (\tmpstnx,\tmpstny) ;}%
290 {%
291 \xdef\tmpstdemi{\xintfloateval{\tkzDiagBatLargeur/2*\pflstlargeur/\pflstampx}}%
292 \draw[pfltrait,\tkzDiagBatCoulCour,fill=\tkzDiagBatCoulCour,fill opacity=0.5]
293 ({\tmpstnx-\tmpstdemi},\pflstoy) rectangle++ ({2*\tmpstdemi},{\tmpstny-\pflstoy}) ;%
294 }%
295 \ifboolKV[tkzDiagBatons]{AffValeurs}%
296 {\node[above,\tkzDiagBatColVal,font=\tkzDiagBatPolice] at (\tmpstnx,\tmpstny)
297 {\ArrondirNum[\tkzDiagBatArrondi]{\tmpsty}} ;}%
298 {}%
299 }%
300 }
301
302 %====RÉGRESSION LINÉAIRE
303 \NewDocumentCommand\TracerRegressionStats{ O{} m m }{%
304 \setsepchar{,}%
305 \readlist*\pflstregx{#2}%
306 \readlist*\pflstregy{#3}%
307 \xdef\pflstnreg{\pflstregxlen}%
308 \xdef\pflstxsom{0}\xdef\pflstysom{0}%
309 \xintFor* ##1 in {\xintSeq{1}{\pflstnreg}} \do{%
310 \itemtomacro\pflstregx[##1]\tmpx%
311 \itemtomacro\pflstregy[##1]\tmpy%
312 \xdef\pflstxsom{\xintfloateval{\pflstxsom+\tmpx}}%
313 \xdef\pflstysom{\xintfloateval{\pflstysom+\tmpy}}%
314 }%
315 \xdef\pflstxmoy{\xintfloateval{\pflstxsom/\pflstnreg}}%
316 \xdef\pflstymoy{\xintfloateval{\pflstysom/\pflstnreg}}%
317 \xdef\pflstxvar{0}\xdef\pflstxyvar{0}%
318 \xintFor* ##1 in {\xintSeq{1}{\pflstnreg}} \do{%
319 \itemtomacro\pflstregx[##1]\tmpx%
320 \itemtomacro\pflstregy[##1]\tmpy%
321 \xdef\pflstxvar{\xintfloateval{\pflstxvar+(\tmpx-\pflstxmoy)^2}}%
322 \xdef\pflstxyvar{\xintfloateval{\pflstxyvar+(\tmpx-\pflstxmoy)*(\tmpy-\pflstymoy)}}%
323 }%
324 \xdef\pflstrega{\xintfloateval{\pflstxyvar/\pflstxvar}}%
325 \xdef\pflstregb{\xintfloateval{\pflstymoy-\pflstrega*\pflstxmoy}}%
326 % tracé normalisé
327 \xdef\tmpstnya{\xintfloateval{(\pflstrega*\pflstxmin+\pflstregb-\pflstymin)/\pflstampy*\pflsthauteur}}%
328 \xdef\tmpstnyb{\xintfloateval{(\pflstrega*\pflstxmax+\pflstregb-\pflstymin)/\pflstampy*\pflsthauteur}}%
329 \draw[pflcourbe,#1] (0,\tmpstnya) -- (\pflstlargeur,\tmpstnyb) ;%
330 }
331
332 %====COURBE ECC
333 \NewDocumentCommand\TracerECCStats{ O{} m m }{%
334 \restoreKV[tkzgECC]%
335 \setKV[tkzgECC]{#1}%
336 \IfSubStr{\tkzecc@coul@params}{/}%
337 {\StrCut{\tkzecc@coul@params}{/}{\tkzecc@coul@quart}{\tkzecc@coul@med}}%
338 {\def\tkzecc@coul@quart{\tkzecc@coul@params}\def\tkzecc@coul@med{\tkzecc@coul@params}}%
339 \setsepchar{,}%
340 \readlist*\DataClass{#2}%
341 \readlist*\DataEff{#3}%
342 \xdef\DonneesECC{0}%
343 \xintFor* ##1 in {\xintSeq{1}{\DataEfflen}} \do{%
344 \xdef\DonneesTmp{0}%
345 \xintFor* ##2 in {\xintSeq{1}{##1}} \do{%
346 \xdef\DonneesTmp{\xintfloateval{\DonneesTmp+\DataEff[##2]}}%
347 }%
348 \xdef\DonneesECC{\DonneesECC,\DonneesTmp}%
349 }%
350 \readlist*\DataECC\DonneesECC%
351 \itemtomacro\DataECC[-1]\DonneesEffMax%
352 % Q1/med/Q3
353 \xintFor* ##1 in {\xintSeq{1}{\DataEfflen}} \do{%
354 \xdef\isuiv{\xinteval{##1+1}}%
355 \xintifboolexpr{\DataECC[##1] < (0.25*\DonneesEffMax) 'and' \DataECC[\isuiv] >= (0.25*\DonneesEffMax)}%
356 {\xdef\pentetmpECC{(\DataECC[\isuiv]-\DataECC[##1])/(\DataClass[\isuiv]-\DataClass[##1])}%
357 \xdef\ValPremQuartile{\xintfloateval{(0.25*\DonneesEffMax+\pentetmpECC*\DataClass[##1]-\DataECC[##1])/(\pentetmpECC)}}}{}%
358 \xintifboolexpr{\DataECC[##1] < (0.50*\DonneesEffMax) 'and' \DataECC[\isuiv] >= (0.50*\DonneesEffMax)}%
359 {\xdef\pentetmpECC{(\DataECC[\isuiv]-\DataECC[##1])/(\DataClass[\isuiv]-\DataClass[##1])}%
360 \xdef\ValMed{\xintfloateval{(0.50*\DonneesEffMax+\pentetmpECC*\DataClass[##1]-\DataECC[##1])/(\pentetmpECC)}}}{}%
361 \xintifboolexpr{\DataECC[##1] < (0.75*\DonneesEffMax) 'and' \DataECC[\isuiv] >= (0.75*\DonneesEffMax)}%
362 {\xdef\pentetmpECC{(\DataECC[\isuiv]-\DataECC[##1])/(\DataClass[\isuiv]-\DataClass[##1])}%
363 \xdef\ValTroisQuartile{\xintfloateval{(0.75*\DonneesEffMax+\pentetmpECC*\DataClass[##1]-\DataECC[##1])/(\pentetmpECC)}}}{}%
364 }%
365 % courbe normalisée
366 \itemtomacro\DataClass[1]\tmpstx%
367 \itemtomacro\DataECC[1]\tmpsty%
368 \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}%
369 \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}%
370 \xdef\DonneesListeECCST{(\tmpstnx,\tmpstny)}%
371 \xintFor* ##1 in {\xintSeq{2}{\DataECClen}} \do{%
372 \itemtomacro\DataClass[##1]\tmpstx%
373 \itemtomacro\DataECC[##1]\tmpsty%
374 \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}%
375 \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}%
376 \xdef\DonneesListeECCST{\DonneesListeECCST--(\tmpstnx,\tmpstny)}%
377 }%
378 \draw[pflcourbeecc,\tkzecc@coul@graph] \DonneesListeECCST ;%
379 \xintFor* ##1 in {\xintSeq{1}{\DataECClen}} \do{%
380 \itemtomacro\DataClass[##1]\tmpstx%
381 \itemtomacro\DataECC[##1]\tmpsty%
382 \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}%
383 \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}%
384 \filldraw[\tkzecc@coul@graph] (\tmpstnx,\tmpstny) circle[pflpointnuage] ;%
385 }%
386 % traits paramètres
387 \ifboolKV[tkzgECC]{AffParams}%
388 {%
389 \xdef\pflstxmed{\xintfloateval{(\ValMed-\pflstxmin)/\pflstampx*\pflstlargeur}}%
390 \xdef\pflstxqu{\xintfloateval{(\ValPremQuartile-\pflstxmin)/\pflstampx*\pflstlargeur}}%
391 \xdef\pflstxqt{\xintfloateval{(\ValTroisQuartile-\pflstxmin)/\pflstampx*\pflstlargeur}}%
392 \xdef\pflstymed{\xintfloateval{(0.50*\DonneesEffMax-\pflstymin)/\pflstampy*\pflsthauteur}}%
393 \xdef\pflstyqu{\xintfloateval{(0.25*\DonneesEffMax-\pflstymin)/\pflstampy*\pflsthauteur}}%
394 \xdef\pflstyqt{\xintfloateval{(0.75*\DonneesEffMax-\pflstymin)/\pflstampy*\pflsthauteur}}%
395 \ifboolKV[tkzgECC]{TraitsComplets}%
396 {%
397 \draw[pfltraitsparamecc,\tkzecc@coul@med] (0,\pflstymed) -- (\pflstlargeur,\pflstymed) ;%
398 \draw[pfltraitsparamecc,\tkzecc@coul@quart] (0,\pflstyqu) -- (\pflstlargeur,\pflstyqu) ;%
399 \draw[pfltraitsparamecc,\tkzecc@coul@quart] (0,\pflstyqt) -- (\pflstlargeur,\pflstyqt) ;%
400 }%
401 {%
402 \draw[pfltraitsparamecc,\tkzecc@coul@med] (0,\pflstymed) -- (\pflstxmed,\pflstymed) ;%
403 \draw[pfltraitsparamecc,\tkzecc@coul@quart] (0,\pflstyqu) -- (\pflstxqu,\pflstyqu) ;%
404 \draw[pfltraitsparamecc,\tkzecc@coul@quart] (0,\pflstyqt) -- (\pflstxqt,\pflstyqt) ;%
405 }%
406 \draw[pfltraitsparamecc,\tkzecc@coul@med] (\pflstxmed,\pflstymed) -- (\pflstxmed,\pflstoy) ;%
407 \draw[\tkzecc@coul@med,thick,fill=white] (\pflstxmed,\pflstymed) circle[pflpointnuage] ;%
408 \draw[pfltraitsparamecc,\tkzecc@coul@quart] (\pflstxqu,\pflstyqu) -- (\pflstxqu,\pflstoy) ;%
409 \draw[\tkzecc@coul@quart,thick,fill=white] (\pflstxqu,\pflstyqu) circle[pflpointnuage] ;%
410 \draw[pfltraitsparamecc,\tkzecc@coul@quart] (\pflstxqt,\pflstyqt) -- (\pflstxqt,\pflstoy) ;%
411 \draw[\tkzecc@coul@quart,thick,fill=white] (\pflstxqt,\pflstyqt) circle[pflpointnuage] ;%
412 }{}%
413 }
414
415 %====BOÎTE À MOUSTACHES
416 \NewDocumentCommand\TracerBoiteMoustachesStats{ s O{} m }{%
417 \restoreKV[tkzBoiteMoustaches]%
418 \setKV[tkzBoiteMoustaches]{#2}%
419 \IfBooleanTF{#1}%
420 {%
421 \ifboolKV[tkzBoiteMoustaches]{Groupees}%
422 {\tkzgCalcParamStats*{#3}[\tkzBaMautomin][\tkzBaMautoquun][\tkzBaMautomed][\tkzBaMautoqutr][\tkzBaMautomax]}%
423 {\tkzgCalcParamStats{#3}[\tkzBaMautomin][\tkzBaMautoquun][\tkzBaMautomed][\tkzBaMautoqutr][\tkzBaMautomax]}%
424 \tkzg@bam@drawST{\tkzBaMautomin}{\tkzBaMautoquun}{\tkzBaMautomed}{\tkzBaMautoqutr}{\tkzBaMautomax}%
425 }%
426 {%
427 \setsepchar[.]{/}%
428 \readlist*\tkzBaMParams{#3}%
429 \itemtomacro\tkzBaMParams[1]\tkzBaMp@min%
430 \itemtomacro\tkzBaMParams[2]\tkzBaMp@qu%
431 \itemtomacro\tkzBaMParams[3]\tkzBaMp@med%
432 \itemtomacro\tkzBaMParams[4]\tkzBaMp@qt%
433 \itemtomacro\tkzBaMParams[5]\tkzBaMp@max%
434 \tkzg@bam@drawST{\tkzBaMp@min}{\tkzBaMp@qu}{\tkzBaMp@med}{\tkzBaMp@qt}{\tkzBaMp@max}%
435 }%
436 }
437
438 \NewDocumentCommand\tkzg@bam@drawST{ m m m m m }{%
439 \xdef\pflbamnxa{\xintfloateval{(#1-\pflstxmin)/\pflstampx*\pflstlargeur}}%
440 \xdef\pflbamnxb{\xintfloateval{(#2-\pflstxmin)/\pflstampx*\pflstlargeur}}%
441 \xdef\pflbamnxc{\xintfloateval{(#3-\pflstxmin)/\pflstampx*\pflstlargeur}}%
442 \xdef\pflbamnxd{\xintfloateval{(#4-\pflstxmin)/\pflstampx*\pflstlargeur}}%
443 \xdef\pflbamnxe{\xintfloateval{(#5-\pflstxmin)/\pflstampx*\pflstlargeur}}%
444 \xdef\tkzBaMbas{\xintfloateval{\tkzBaMElevation-\tkzBaMHauteur/2}}%
445 \xdef\tkzBaMhaut{\xintfloateval{\tkzBaMElevation+\tkzBaMHauteur/2}}%
446 \draw[pfltrait,\tkzBaMCouleur,fill=\tkzBaMRemplissage]%
447 (\pflbamnxb,\tkzBaMbas) rectangle (\pflbamnxd,\tkzBaMhaut) ;%
448 \draw[pfltrait,\tkzBaMCouleur]%
449 (\pflbamnxa,\tkzBaMElevation) -- (\pflbamnxb,\tkzBaMElevation)%
450 (\pflbamnxd,\tkzBaMElevation) -- (\pflbamnxe,\tkzBaMElevation) ;%
451 \draw[pfltrait,\tkzBaMCouleur]%
452 (\pflbamnxa,\tkzBaMbas) -- (\pflbamnxa,\tkzBaMhaut)%
453 (\pflbamnxe,\tkzBaMbas) -- (\pflbamnxe,\tkzBaMhaut)%
454 (\pflbamnxc,\tkzBaMbas) -- (\pflbamnxc,\tkzBaMhaut) ;%
455 \ifboolKV[tkzBoiteMoustaches]{AffMoyenne}%
456 {%
457 \xdef\pflbamnxmoy{\xintfloateval{(\tkzBaMMoyenne-\pflstxmin)/\pflstampx*\pflstlargeur}}%
458 \filldraw[\tkzBaMCouleur] (\pflbamnxmoy,\tkzBaMElevation) circle[pflpointmc] ;%
459 }{}%
460 \ifboolKV[tkzBoiteMoustaches]{Pointilles}%
461 {%
462 \draw[pfltraitantec,\tkzBaMCouleur]%
463 (\pflbamnxa,\tkzBaMbas)--(\pflbamnxa,\pflstoy)%
464 (\pflbamnxb,\tkzBaMbas)--(\pflbamnxb,\pflstoy)%
465 (\pflbamnxc,\tkzBaMbas)--(\pflbamnxc,\pflstoy)%
466 (\pflbamnxd,\tkzBaMbas)--(\pflbamnxd,\pflstoy)%
467 (\pflbamnxe,\tkzBaMbas)--(\pflbamnxe,\pflstoy) ;%
468 }{}%
469 \ifboolKV[tkzBoiteMoustaches]{Valeurs}%
470 {%
471 \foreach \tmpbamval/\tmpbamx in {#1/\pflbamnxa,#2/\pflbamnxb,#3/\pflbamnxc,#4/\pflbamnxd,#5/\pflbamnxe}{%
472 \node[below,font=\small] at (\tmpbamx,\pflstoy)
473 {\ArrondirNum[\tkzBaMArrondi]{\tmpbamval}} ;%
474 }%
475 }{}%
476 }
477
478 \endinput