| 1 |
% tkz-grapheur-altversion.tex |
| 2 |
% Copyright 2026 Cédric Pierquet |
| 3 |
% Environnement avec grandes valeurs, ou version alternative |
| 4 |
% Principe : normalisation interne, TikZ travaille dans [0,Largeur]x[0,Hauteur] |
| 5 |
% En phase(s) de test(s) |
| 6 |
|
| 7 |
%====LIB |
| 8 |
\usetikzlibrary{spath3} |
| 9 |
|
| 10 |
%====LENGTHS |
| 11 |
\newlength\tmptkzgstwidth |
| 12 |
\newlength\tmptkzgstheight |
| 13 |
|
| 14 |
\defKV[GraphiqueTikzStats]{% |
| 15 |
% axes |
| 16 |
Xmin=\def\pflstxmintmp{#1},% |
| 17 |
xmin=\def\pflstxmintmp{#1},% |
| 18 |
Xmax=\def\pflstxmaxtmp{#1},% |
| 19 |
xmax=\def\pflstxmaxtmp{#1},% |
| 20 |
Ymin=\def\pflstymintmp{#1},% |
| 21 |
ymin=\def\pflstymintmp{#1},% |
| 22 |
Ymax=\def\pflstymaxtmp{#1},% |
| 23 |
ymax=\def\pflstymaxtmp{#1},% |
| 24 |
% dimensions pures |
| 25 |
Largeur=\setlength\tmptkzgstwidth{#1},% |
| 26 |
width=\setlength\tmptkzgstwidth{#1},% |
| 27 |
Hauteur=\setlength\tmptkzgstheight{#1},% |
| 28 |
height=\setlength\tmptkzgstheight{#1},% |
| 29 |
% origine |
| 30 |
Origx=\def\pflstOxtmp{#1},% |
| 31 |
origx=\def\pflstOxtmp{#1},% |
| 32 |
Origy=\def\pflstOytmp{#1},% |
| 33 |
origy=\def\pflstOytmp{#1},% |
| 34 |
% grille principale |
| 35 |
Xgrille=\def\pflstgrillextmp{#1},% |
| 36 |
xgrid=\def\pflstgrillextmp{#1},% |
| 37 |
Ygrille=\def\pflstgrilleytmp{#1},% |
| 38 |
ygrid=\def\pflstgrilleytmp{#1},% |
| 39 |
% grille secondaire |
| 40 |
Xgrilles=\def\pflstgrillexstmp{#1},% |
| 41 |
xgrids=\def\pflstgrillexstmp{#1},% |
| 42 |
Ygrilles=\def\pflstgrilleystmp{#1},% |
| 43 |
ygrids=\def\pflstgrilleystmp{#1},% |
| 44 |
% grille intermédiaire |
| 45 |
Xgrillei=\def\pflstgrillexitmp{#1},% |
| 46 |
xgridi=\def\pflstgrillexitmp{#1},% |
| 47 |
Ygrillei=\def\pflstgrilleyitmp{#1},% |
| 48 |
ygridi=\def\pflstgrilleyitmp{#1},% |
| 49 |
% divers |
| 50 |
Theme=\def\pflstgraphthem{#1},% |
| 51 |
theme=\def\pflstgraphthem{#1},% |
| 52 |
NomFigure=\def\pflstgraphnom{#1},% |
| 53 |
figurename=\def\pflstgraphnom{#1},% |
| 54 |
TailleGrad=\def\pfltmpthickgrad{#1},%\setlength\pflthickgrad{#1},% |
| 55 |
gradsize=\def\pfltmpthickgrad{#1}%\setlength\pflthickgrad{#1}% |
| 56 |
} |
| 57 |
\setKVdefault[GraphiqueTikzStats]{% |
| 58 |
AffCadre=false,% |
| 59 |
showframe=false,% |
| 60 |
TailleGrad=3pt,% |
| 61 |
gradsize=3pt,% |
| 62 |
Xmin=0,% |
| 63 |
xmin=0,% |
| 64 |
Xmax=10,% |
| 65 |
xmax=10,% |
| 66 |
Ymin=0,% |
| 67 |
ymin=0,% |
| 68 |
Ymax=10,% |
| 69 |
ymax=10,% |
| 70 |
Largeur=8cm,% |
| 71 |
width=8cm,% |
| 72 |
Hauteur=6cm,% |
| 73 |
height=6cm,% |
| 74 |
Origx={0},% |
| 75 |
origx={0},% |
| 76 |
Origy={0},% |
| 77 |
origy={0},% |
| 78 |
Theme={},% |
| 79 |
theme={},% |
| 80 |
Milli=false,% |
| 81 |
milli=false,% |
| 82 |
NomFigure={},% |
| 83 |
figurename={},% |
| 84 |
Xgrille={1},% |
| 85 |
xgrid=1,% |
| 86 |
Xgrillei={1},% |
| 87 |
xgridi=1,% |
| 88 |
Xgrilles={0.5},% |
| 89 |
xgrids=0.5,% |
| 90 |
Ygrille={1},% |
| 91 |
ygrid=1,% |
| 92 |
Ygrillei={1},% |
| 93 |
ygridi=1,% |
| 94 |
Ygrilles={0.5},% |
| 95 |
ygrids=0.5,% |
| 96 |
} |
| 97 |
|
| 98 |
%====ENVIRONNEMENT |
| 99 |
\NewDocumentEnvironment{tkzGrph}{ O{} D<>{} }{% |
| 100 |
\restoreKV[GraphiqueTikzStats]% |
| 101 |
\setKV[GraphiqueTikzStats]{#2}% |
| 102 |
%thick grads |
| 103 |
\IfSubStr{\pfltmpthickgrad}{/}% |
| 104 |
{% |
| 105 |
\StrCut{\pfltmpthickgrad}{/}{\pfltmpthickgradu}{\pfltmpthickgradd}% |
| 106 |
\setlength\pflthickgradu{\pfltmpthickgradu}% |
| 107 |
\setlength\pflthickgradd{\pfltmpthickgradd}% |
| 108 |
}% |
| 109 |
{% |
| 110 |
\setlength\pflthickgradu{\pfltmpthickgrad}% |
| 111 |
\setlength\pflthickgradd{\pfltmpthickgrad}% |
| 112 |
}% |
| 113 |
%sync KV boolean |
| 114 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStats]{showframe}{AffCadre}% |
| 115 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStats]{milli}{Milli}% |
| 116 |
%---- valeurs réelles stockées |
| 117 |
\xdef\pflstxmin{\xintfloateval{\pflstxmintmp}}% |
| 118 |
\xdef\pflstxmax{\xintfloateval{\pflstxmaxtmp}}% |
| 119 |
\xdef\pflstymin{\xintfloateval{\pflstymintmp}}% |
| 120 |
\xdef\pflstymax{\xintfloateval{\pflstymaxtmp}}% |
| 121 |
\xdef\pflstgrillex{\xintfloateval{\pflstgrillextmp}}% |
| 122 |
\xdef\pflstgrillexi{\xintfloateval{\pflstgrillexitmp}}% |
| 123 |
\xdef\pflstgrillexs{\xintfloateval{\pflstgrillexstmp}}% |
| 124 |
\xdef\pflstgrilley{\xintfloateval{\pflstgrilleytmp}}% |
| 125 |
\xdef\pflstgrilleyi{\xintfloateval{\pflstgrilleyitmp}}% |
| 126 |
\xdef\pflstgrilleys{\xintfloateval{\pflstgrilleystmp}}% |
| 127 |
%---- amplitude réelle |
| 128 |
\xdef\pflstampx{\xintfloateval{\pflstxmax-\pflstxmin}}% |
| 129 |
\xdef\pflstampy{\xintfloateval{\pflstymax-\pflstymin}}% |
| 130 |
%---- dimensions en cm (Largeur et Hauteur sont des dimensions pures : 8cm, 120mm...) |
| 131 |
\xdef\pflstlargeur{\xintfloateval{\fpeval{\the\tmptkzgstwidth/1cm}}}% |
| 132 |
\xdef\pflsthauteur{\xintfloateval{\fpeval{\the\tmptkzgstheight/1cm}}}% |
| 133 |
%---- pas de grille normalisés (en cm dans [0,Largeur]x[0,Hauteur]) |
| 134 |
\xdef\pflstngrillex{\xintfloateval{\pflstgrillex/\pflstampx*\pflstlargeur}}% |
| 135 |
\xdef\pflstngrillexs{\xintfloateval{\pflstgrillexs/\pflstampx*\pflstlargeur}}% |
| 136 |
\xdef\pflstngrillexj{\xintfloateval{\pflstgrillexi/\pflstampx*\pflstlargeur}}% |
| 137 |
\xdef\pflstngrillery{\xintfloateval{\pflstgrilley/\pflstampy*\pflsthauteur}}% |
| 138 |
\xdef\pflstngrilleys{\xintfloateval{\pflstgrilleys/\pflstampy*\pflsthauteur}}% |
| 139 |
\xdef\pflstngrilleys{\xintfloateval{\pflstgrilleys/\pflstampy*\pflsthauteur}}% |
| 140 |
\xdef\pflstngrilleyj{\xintfloateval{\pflstgrilleyi/\pflstampy*\pflsthauteur}}% |
| 141 |
%---- origine normalisée |
| 142 |
\IfStrEq{\pflstOxtmp}{}% |
| 143 |
{\xdef\pflstox{0}}% |
| 144 |
{\xdef\pflstox{\xintfloateval{(\pflstOxtmp-\pflstxmin)/\pflstampx*\pflstlargeur}}}% |
| 145 |
\IfStrEq{\pflstOytmp}{}% |
| 146 |
{\xdef\pflstoy{0}}% |
| 147 |
{\xdef\pflstoy{\xintfloateval{(\pflstOytmp-\pflstymin)/\pflstampy*\pflsthauteur}}}% |
| 148 |
%---- ouverture tikzpicture (x=1cm, y=1cm : coordonnées en cm purs) |
| 149 |
\begin{tikzpicture}[x=1cm,y=1cm,#1]% |
| 150 |
%---- thèmes (identiques à GraphiqueTikz) |
| 151 |
\IfStrEqCase{\pflstgraphthem}{% |
| 152 |
{standard}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepdefault!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesdefault}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleidefault}}}% |
| 153 |
{gris}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepgray!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesgray}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleigray}}}% |
| 154 |
{gray}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepgray!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesgray}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleigray}}}% |
| 155 |
{bleu}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepblue!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesblue}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleiblue}}}% |
| 156 |
{blue}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepblue!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesblue}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleiblue}}}% |
| 157 |
{vert}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepgreen!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesgreen}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleigreen}}}% |
| 158 |
{nature}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepgreen!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesgreen}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleigreen}}}% |
| 159 |
{chaud}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepwarm!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrilleswarm}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleiwarm}}}% |
| 160 |
{warm}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepwarm!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrilleswarm}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleiwarm}}}% |
| 161 |
{contraste}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepcontrast!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillescontrast}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleicontrast}}}% |
| 162 |
{contrast}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepcontrast!75}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillescontrast}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleicontrast}}}% |
| 163 |
{seyes}{\tikzset{pflgrillep/.style={line width=\pflthickgridp,pflgrillepseyes}}\tikzset{pflgrilles/.style={line width=\pflthickgrids,pflgrillesseyes}}\tikzset{pflgrillei/.style={line width=\pflthickgridi,pflgrilleiseyes}}}% |
| 164 |
}% |
| 165 |
%---- nœuds fenêtre (coordonnées normalisées) |
| 166 |
\IfStrEq{\pflstgraphnom}{}% |
| 167 |
{% |
| 168 |
\coordinate (grph-ne) at (\pflstlargeur,\pflsthauteur) ;% |
| 169 |
\coordinate (grph-nw) at (0,\pflsthauteur) ;% |
| 170 |
\coordinate (grph-se) at (\pflstlargeur,0) ;% |
| 171 |
\coordinate (grph-sw) at (0,0) ;% |
| 172 |
\coordinate (grph-n) at ($(grph-ne)!0.5!(grph-nw)$) ;% |
| 173 |
\coordinate (grph-e) at ($(grph-ne)!0.5!(grph-se)$) ;% |
| 174 |
\coordinate (grph-s) at ($(grph-se)!0.5!(grph-sw)$) ;% |
| 175 |
\coordinate (grph-w) at ($(grph-sw)!0.5!(grph-nw)$) ;% |
| 176 |
\coordinate (grph-c) at ($(grph-sw)!0.5!(grph-ne)$) ;% |
| 177 |
\coordinate (grph-axox-w) at ({0},{\pflstoy}) ; |
| 178 |
\coordinate (grph-axox-e) at ({\pflstlargeur},{\pflstoy}) ; |
| 179 |
\coordinate (grph-axoy-s) at ({\pflstox},{0}) ; |
| 180 |
\coordinate (grph-axoy-n) at ({\pflstox},{\pflsthauteur}) ; |
| 181 |
\coordinate (grph-orig) at (\pflstox,\pflstoy) ;% |
| 182 |
}% |
| 183 |
{% |
| 184 |
\coordinate (\pflstgraphnom-grph-ne) at (\pflstlargeur,\pflsthauteur) ;% |
| 185 |
\coordinate (\pflstgraphnom-grph-nw) at (0,\pflsthauteur) ;% |
| 186 |
\coordinate (\pflstgraphnom-grph-se) at (\pflstlargeur,0) ;% |
| 187 |
\coordinate (\pflstgraphnom-grph-sw) at (0,0) ;% |
| 188 |
\coordinate (\pflstgraphnom-grph-n) at ($(\pflstgraphnom-grph-ne)!0.5!(\pflstgraphnom-grph-nw)$) ;% |
| 189 |
\coordinate (\pflstgraphnom-grph-e) at ($(\pflstgraphnom-grph-ne)!0.5!(\pflstgraphnom-grph-se)$) ;% |
| 190 |
\coordinate (\pflstgraphnom-grph-s) at ($(\pflstgraphnom-grph-se)!0.5!(\pflstgraphnom-grph-sw)$) ;% |
| 191 |
\coordinate (\pflstgraphnom-grph-w) at ($(\pflstgraphnom-grph-sw)!0.5!(\pflstgraphnom-grph-nw)$) ;% |
| 192 |
\coordinate (\pflstgraphnom-grph-c) at ($(\pflstgraphnom-grph-sw)!0.5!(\pflstgraphnom-grph-ne)$) ;% |
| 193 |
\coordinate (\pflstgraphnom-grph-axox-w) at ({0},{\pflstoy}) ; |
| 194 |
\coordinate (\pflstgraphnom-grph-axox-e) at ({\pflstlargeur},{\pflstoy}) ; |
| 195 |
\coordinate (\pflstgraphnom-grph-axoy-s) at ({\pflstox},{0}) ; |
| 196 |
\coordinate (\pflstgraphnom-grph-axoy-n) at ({\pflstox},{\pflsthauteur}) ; |
| 197 |
\coordinate (\pflstgraphnom-grph-orig) at (\pflstox,\pflstoy) ;% |
| 198 |
}% |
| 199 |
\ifboolKV[GraphiqueTikzStats]{AffCadre}% |
| 200 |
{\draw[pflcadre] (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;}{}% |
| 201 |
}{% |
| 202 |
\end{tikzpicture}% |
| 203 |
} |
| 204 |
|
| 205 |
%====AXES ET GRILLES STATS — même structure que TracerAxesGrilles |
| 206 |
\defKV[GraphiqueTikzStatsAxes]{% |
| 207 |
Format=\def\pflstformataxes{#1},format=\def\pflstformataxes{#1},% |
| 208 |
Elargir=\def\pflstaxeselarg{#1},enlarge=\def\pflstaxeselarg{#1},% |
| 209 |
Police=\def\pflstaxespol{#1},font=\def\pflstaxespol{#1},% |
| 210 |
Rotation=\def\pfllanglelabel{#1},rotate=\def\pfllanglelabel{#1}% |
| 211 |
} |
| 212 |
\setKVdefault[GraphiqueTikzStatsAxes]{% |
| 213 |
Grille=true,grid=true,% |
| 214 |
GrilleIntermediaire=false,intermediategrid=false,% |
| 215 |
Elargir=0,enlarge=0,% |
| 216 |
Grads=true,labels=true,% |
| 217 |
Origine=false,origin=false,% |
| 218 |
Police={},font={},% |
| 219 |
Format=num,format=num,% |
| 220 |
Dernier=false,last=false,% |
| 221 |
Derriere=false,behind=false,% |
| 222 |
Devant=false,front=false,% |
| 223 |
Fleches=true,arrows=true,% |
| 224 |
AxeOy=true,yaxis=true,% |
| 225 |
Rotation=0,rotate=0,% |
| 226 |
Traits=true,thicks=true% |
| 227 |
} |
| 228 |
|
| 229 |
\NewDocumentCommand\tkzGrphDrawGridAxis{ s O{} m m }{% |
| 230 |
% #1=étoile (saute origine) #2=clés #3=liste valeurs X (vraies) #4=liste valeurs Y (vraies) |
| 231 |
\restoreKV[GraphiqueTikzStatsAxes]% |
| 232 |
\setKV[GraphiqueTikzStatsAxes]{#2}% |
| 233 |
% sync KV |
| 234 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsAxes]{grid}{Grille}% |
| 235 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsAxes]{labels}{Grads}% |
| 236 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsAxes]{arrows}{Fleches}% |
| 237 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsAxes]{yaxis}{AxeOy}% |
| 238 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsAxes]{behind}{Derriere}% |
| 239 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsAxes]{front}{Devant}% |
| 240 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsAxes]{last}{Dernier}% |
| 241 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsAxes]{origin}{Origine}% |
| 242 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsAxes]{intermediategrid}{GrilleIntermediaire}% |
| 243 |
% format axes |
| 244 |
\IfSubStr{\pflstformataxes}{/}% |
| 245 |
{\StrCut{\pflstformataxes}{/}{\pflstformataxex}{\pflstformataxey}}% |
| 246 |
{\xdef\pflstformataxex{\pflstformataxes}\xdef\pflstformataxey{\pflstformataxes}}% |
| 247 |
\IfEq{\pflstgraphnom}{}% |
| 248 |
{% |
| 249 |
\coordinate (grph-axox-ee) at ([xshift=\pflstaxeselarg]\pflstlargeur,\pflstoy) ; |
| 250 |
\coordinate (grph-axoy-nn) at ([yshift=\pflstaxeselarg]\pflstox,\pflsthauteur) ; |
| 251 |
}% |
| 252 |
{% |
| 253 |
\coordinate (\pflstgraphnom-grph-axox-ee) at ([xshift=\pflstaxeselarg]\pflstlargeur,\pflstoy) ; |
| 254 |
\coordinate (\pflstgraphnom-grph-axoy-nn) at ([yshift=\pflstaxeselarg]\pflstox,\pflsthauteur) ; |
| 255 |
}% |
| 256 |
% cas Derriere/Devant |
| 257 |
\ifboolKV[GraphiqueTikzStatsAxes]{Derriere}{\setKV[GraphiqueTikzStatsAxes]{Grads=false}}{}% |
| 258 |
\ifboolKV[GraphiqueTikzStatsAxes]{Devant}{\setKV[GraphiqueTikzStatsAxes]{Grille=false}}{}% |
| 259 |
% grille (pas normalisés) |
| 260 |
\ifboolKV[GraphiqueTikzStatsAxes]{Grille}% |
| 261 |
{% |
| 262 |
\ifboolKV[GraphiqueTikzStats]{Milli}% |
| 263 |
{% |
| 264 |
\draw[pflgrilles,xstep=\xintfloateval{0.1*\pflstngrillex},ystep=\xintfloateval{0.1*\pflstngrillery}] |
| 265 |
(0,0) grid (\pflstlargeur,\pflsthauteur) ;% |
| 266 |
\draw[pflgrillei,xstep=\xintfloateval{0.5*\pflstngrillex},ystep=\xintfloateval{0.5*\pflstngrillery}] |
| 267 |
(0,0) grid (\pflstlargeur,\pflsthauteur) ;% |
| 268 |
}% |
| 269 |
{% |
| 270 |
\draw[pflgrilles,xstep=\pflstngrillexs,ystep=\pflstngrilleys] |
| 271 |
(0,0) grid (\pflstlargeur,\pflsthauteur) ;% |
| 272 |
}% |
| 273 |
\ifboolKV[GraphiqueTikzStatsAxes]{GrilleIntermediaire}% |
| 274 |
{\draw[pflgrillei,xstep=\pflstngrillexj,ystep=\pflstngrilleyj] |
| 275 |
(0,0) grid (\pflstlargeur,\pflsthauteur) ;}% |
| 276 |
{}% |
| 277 |
\draw[pflgrillep,xstep=\pflstngrillex,ystep=\pflstngrillery] |
| 278 |
(0,0) grid (\pflstlargeur,\pflsthauteur) ;% |
| 279 |
\ifboolKV[GraphiqueTikzStatsAxes]{Dernier}% |
| 280 |
{% |
| 281 |
\draw[pflgrillep] (0,\pflsthauteur)--(\pflstlargeur,\pflsthauteur) ;% |
| 282 |
\draw[pflgrillep] (\pflstlargeur,0)--(\pflstlargeur,\pflsthauteur) ;% |
| 283 |
}{}% |
| 284 |
}{}% |
| 285 |
% axes |
| 286 |
\ifboolKV[GraphiqueTikzStatsAxes]{Fleches}% |
| 287 |
{% |
| 288 |
\draw[pflaxes] (0,\pflstoy) -- ([xshift=\pflstaxeselarg]\pflstlargeur,\pflstoy) ;% |
| 289 |
\ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}% |
| 290 |
{\draw[pflaxes] (\pflstox,0) -- ([yshift=\pflstaxeselarg]\pflstox,\pflsthauteur) ;}{}% |
| 291 |
}% |
| 292 |
{% |
| 293 |
\draw[pflaxessansfleche] (0,\pflstoy) -- ([xshift=\pflstaxeselarg]\pflstlargeur,\pflstoy) ;% |
| 294 |
\ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}% |
| 295 |
{\draw[pflaxessansfleche] (\pflstox,0) -- ([yshift=\pflstaxeselarg]\pflstox,\pflsthauteur) ;}{}% |
| 296 |
}% |
| 297 |
% graduations X |
| 298 |
\foreach \tmpstx in {#3}{% |
| 299 |
\xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 300 |
\draw[pfltrait] ([yshift=\pflthickgradu]\tmpstnx,{\pflstoy}) -- ([yshift=-\pflthickgradd]\tmpstnx,{\pflstoy}) ;% |
| 301 |
}% |
| 302 |
% graduations Y |
| 303 |
\ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}% |
| 304 |
{% |
| 305 |
\foreach \tmpsty in {#4}{% |
| 306 |
\xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 307 |
\draw[pfltrait] ([xshift=\pflthickgradu]{\pflstox},\tmpstny) -- ([xshift=-\pflthickgradd]{\pflstox},\tmpstny) ;% |
| 308 |
}% |
| 309 |
}{}% |
| 310 |
% labels |
| 311 |
\ifboolKV[GraphiqueTikzStatsAxes]{Grads}% |
| 312 |
{% |
| 313 |
\ifboolKV[GraphiqueTikzStatsAxes]{Origine}% |
| 314 |
{\node[pflnoeud,below left,font=\pflstaxespol] at (\pflstox,\pflstoy) |
| 315 |
{\FormatterValeurAxex{\pflstformataxex}{\pflstxmin}} ;}{}% |
| 316 |
\foreach \tmpstx in {#3}{% |
| 317 |
\xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 318 |
\IfBooleanTF{#1}% |
| 319 |
{\xdef\tmpisorigx{\xintfloateval{\tmpstnx == \pflstox}}% |
| 320 |
\xintifboolexpr{\tmpisorigx == 1}{}% |
| 321 |
{\node[pflnoeud,below,font=\pflstaxespol] at ([yshift=-\pflthickgradd]\tmpstnx,{\pflstoy}) |
| 322 |
{\FormatterValeurAxex{\pflstformataxex}{\tmpstx}} ;}}% |
| 323 |
{\node[pflnoeud,below,font=\pflstaxespol] at ([yshift=-\pflthickgradd]\tmpstnx,{\pflstoy}) |
| 324 |
{\FormatterValeurAxex{\pflstformataxex}{\tmpstx}} ;}% |
| 325 |
}% |
| 326 |
\ifboolKV[GraphiqueTikzStatsAxes]{AxeOy}% |
| 327 |
{% |
| 328 |
\foreach \tmpsty in {#4}{% |
| 329 |
\xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 330 |
\IfBooleanTF{#1}% |
| 331 |
{\xdef\tmpisorigy{\xintfloateval{\tmpstny == \pflstoy}}% |
| 332 |
\xintifboolexpr{\tmpisorigy == 1}{}% |
| 333 |
{\node[pflnoeud,left,font=\pflstaxespol] at ([xshift=-\pflthickgradd]{\pflstox},\tmpstny) |
| 334 |
{\FormatterValeurAxey{\pflstformataxey}{\tmpsty}} ;}}% |
| 335 |
{\node[pflnoeud,left,font=\pflstaxespol] at ([xshift=-\pflthickgradd]{\pflstox},\tmpstny) |
| 336 |
{\FormatterValeurAxey{\pflstformataxey}{\tmpsty}} ;}% |
| 337 |
}% |
| 338 |
}{}% |
| 339 |
}{}% |
| 340 |
} |
| 341 |
\NewCommandCopy\tkzGrphTracerAxesGrille\tkzGrphDrawGridAxis |
| 342 |
\NewCommandCopy\tkzgaxisgrid\tkzGrphDrawGridAxis |
| 343 |
|
| 344 |
%====AJOUTER DES VALEURS/LABELS MANUELLEMENT (version normalisée) |
| 345 |
\NewDocumentCommand\tkzGrphAddValX{ O{} m m }{% |
| 346 |
% #1=clés #2=liste valeurs X réelles #3=liste labels formatés |
| 347 |
\restoreKV[GraphiqueTikzStatsAxes]% |
| 348 |
\setKV[GraphiqueTikzStatsAxes]{#1}% |
| 349 |
%sync |
| 350 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsAxes]{thicks}{Traits}% |
| 351 |
% tirets |
| 352 |
\ifboolKV[GraphiqueTikzStatsAxes]{Traits}% |
| 353 |
{% |
| 354 |
\foreach \tmpstx in {#2}{% |
| 355 |
\xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 356 |
\draw[pfltrait] ([yshift=\pflthickgradu]\tmpstnx,\pflstoy) --++(0,{-\pflthickgradu-\pflthickgradd}) ;% |
| 357 |
}% |
| 358 |
}{}% |
| 359 |
% labels |
| 360 |
\setsepchar{,}% |
| 361 |
\readlist*\LstValX{#2}% |
| 362 |
\readlist*\LstValFmtX{#3}% |
| 363 |
\foreach \i in {1,...,\LstValXlen}{% |
| 364 |
\itemtomacro\LstValX[\i]\mavalx% |
| 365 |
\itemtomacro\LstValFmtX[\i]\mavalfmtx% |
| 366 |
\xdef\tmpstnx{\xintfloateval{(\mavalx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 367 |
\draw ([yshift={-\pflthickgradd}]\tmpstnx,\pflstoy) node[pflnoeud,below,font=\pflstaxespol] {\mavalfmtx} ;% |
| 368 |
}% |
| 369 |
} |
| 370 |
\NewCommandCopy\tkzGrphAjouterValeursX\tkzGrphAddValX |
| 371 |
\NewCommandCopy\tkzgaddx\tkzGrphAddValX |
| 372 |
|
| 373 |
\NewDocumentCommand\tkzGrphAddValY{ O{} m m }{% |
| 374 |
% #1=clés #2=liste valeurs Y réelles #3=liste labels formatés |
| 375 |
\restoreKV[GraphiqueTikzAxes]% |
| 376 |
\setKV[GraphiqueTikzAxes]{#1}% |
| 377 |
%sync |
| 378 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsAxes]{thicks}{Traits}% |
| 379 |
% tirets |
| 380 |
\ifboolKV[GraphiqueTikzStatsAxes]{Traits}% |
| 381 |
{% |
| 382 |
\foreach \tmpsty in {#2}{% |
| 383 |
\xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 384 |
\draw[pfltrait] ([xshift=\pflthickgradu]\pflstox,\tmpstny) --++({-\pflthickgradu-\pflthickgradd},0) ;% |
| 385 |
}% |
| 386 |
}{}% |
| 387 |
% labels |
| 388 |
\setsepchar{,}% |
| 389 |
\readlist*\LstValY{#2}% |
| 390 |
\readlist*\LstValFmtY{#3}% |
| 391 |
\foreach \i in {1,...,\LstValYlen}{% |
| 392 |
\itemtomacro\LstValY[\i]\mavaly% |
| 393 |
\itemtomacro\LstValFmtY[\i]\mavalfmty% |
| 394 |
\xdef\tmpstny{\xintfloateval{(\mavaly-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 395 |
\draw ([xshift={-\pflthickgradd}]\pflstox,\tmpstny) node[pflnoeud,left,font=\pflstaxespol] {\mavalfmty} ;% |
| 396 |
}% |
| 397 |
} |
| 398 |
\NewCommandCopy\tkzGrphAjouterValeursY\tkzGrphAddValY |
| 399 |
\NewCommandCopy\tkzgaddy\tkzGrphAddValY |
| 400 |
|
| 401 |
\NewDocumentCommand\tkzGrphAddLabelsX{ O{} m m }{% |
| 402 |
% #1=clés #2=liste valeurs X réelles #3=liste labels qualitatifs |
| 403 |
\restoreKV[GraphiqueTikzStatsAxes]% |
| 404 |
\setKV[GraphiqueTikzStatsAxes]{#1}% |
| 405 |
% tirets |
| 406 |
\ifboolKV[GraphiqueTikzStatsAxes]{Traits}% |
| 407 |
{% |
| 408 |
\foreach \tmpstx in {#2}{% |
| 409 |
\xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 410 |
\draw[pfltrait] ([yshift=\pflthickgradu]\tmpstnx,\pflstoy) --++(0,{-\pflthickgradu-\pflthickgradd}) ;% |
| 411 |
}% |
| 412 |
}{}% |
| 413 |
% style rotation |
| 414 |
\IfEq{\pfllanglelabel}{0}% |
| 415 |
{\tikzset{pfllegendelabelsqualix/.style={font=\pflstaxespol,below}}}% |
| 416 |
{% |
| 417 |
\xintifboolexpr{\pfllanglelabel > 0}% |
| 418 |
{\tikzset{pfllegendelabelsqualix/.style={font=\pflstaxespol,rotate=\pfllanglelabel,anchor=east}}}% |
| 419 |
{\tikzset{pfllegendelabelsqualix/.style={font=\pflstaxespol,rotate=\pfllanglelabel,anchor=west}}}% |
| 420 |
}% |
| 421 |
% labels |
| 422 |
\setsepchar{,}% |
| 423 |
\readlist*\LstValX{#2}% |
| 424 |
\readlist*\LstValFmtX{#3}% |
| 425 |
\foreach \i in {1,...,\LstValXlen}{% |
| 426 |
\itemtomacro\LstValX[\i]\mavalx% |
| 427 |
\itemtomacro\LstValFmtX[\i]\mavalfmtx% |
| 428 |
\xdef\tmpstnx{\xintfloateval{(\mavalx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 429 |
\draw ([yshift={-\pflthickgradd}]\tmpstnx,\pflstoy) node[pfllegendelabelsqualix,font=\pflstaxespol] {\mavalfmtx} ;% |
| 430 |
}% |
| 431 |
} |
| 432 |
\NewCommandCopy\tkzGrphAjouterLabelsX\tkzGrphAddLabelsX |
| 433 |
\NewCommandCopy\tkzgaddqualix\tkzGrphAddLabelsX |
| 434 |
|
| 435 |
\NewDocumentCommand\tkzGrphAddLabelsY{ O{} m m }{% |
| 436 |
% #1=clés #2=liste valeurs Y réelles #3=liste labels qualitatifs |
| 437 |
\restoreKV[GraphiqueTikzStatsAxes]% |
| 438 |
\setKV[GraphiqueTikzStatsAxes]{#1}% |
| 439 |
% tirets |
| 440 |
\ifboolKV[GraphiqueTikzStatsAxes]{Traits}% |
| 441 |
{% |
| 442 |
\foreach \tmpsty in {#2}{% |
| 443 |
\xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 444 |
\draw[pfltrait] ([xshift=\pflthickgradu]\pflstox,\tmpstny) --++({-\pflthickgradu-\pflthickgradd},0) ;% |
| 445 |
}% |
| 446 |
}{}% |
| 447 |
% style rotation |
| 448 |
\IfEq{\pfllanglelabel}{0}% |
| 449 |
{\tikzset{pfllegendelabelsqualiy/.style={font=\pflstaxespol,left}}}% |
| 450 |
{\tikzset{pfllegendelabelsqualiy/.style={font=\pflstaxespol,left,rotate=\pfllanglelabel,anchor=east}}}% |
| 451 |
% labels |
| 452 |
\setsepchar{,}% |
| 453 |
\readlist*\LstValY{#2}% |
| 454 |
\readlist*\LstValFmtY{#3}% |
| 455 |
\foreach \i in {1,...,\LstValYlen}{% |
| 456 |
\itemtomacro\LstValY[\i]\mavaly% |
| 457 |
\itemtomacro\LstValFmtY[\i]\mavalfmty% |
| 458 |
\xdef\tmpstny{\xintfloateval{(\mavaly-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 459 |
\draw ([xshift={-\pflthickgradd}]\pflstox,\tmpstny) node[pfllegendelabelsqualiy,font=\pflstaxespol] {\mavalfmty} ;% |
| 460 |
}% |
| 461 |
} |
| 462 |
\NewCommandCopy\tkzGrphAjouterLabelsY\tkzGrphAddLabelsY |
| 463 |
\NewCommandCopy\tkzgaddqualiy\tkzGrphAddLabelsY |
| 464 |
|
| 465 |
%====DRAW EXISTING PATH |
| 466 |
\NewDocumentCommand\tkzGrphDrawExistingCurve{ O{} m }{% |
| 467 |
\begin{scope}% |
| 468 |
\clip (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;% |
| 469 |
\draw[spath/restore=#2,pflcourbe,#1] {} ; |
| 470 |
\end{scope} |
| 471 |
} |
| 472 |
\NewCommandCopy\tkzGrphTracerCourbe\tkzGrphDrawExistingCurve |
| 473 |
\NewCommandCopy\tkzgdrawcurve\tkzGrphDrawExistingCurve |
| 474 |
|
| 475 |
\NewDocumentCommand\tkzGrphDrawExistingCurves{ O{} m }{% |
| 476 |
\begin{scope}% |
| 477 |
\clip (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;% |
| 478 |
\foreach \tmpname/\tmpcolor in {#2}{% |
| 479 |
\draw[spath/restore=\tmpname,pflcourbe,#1,\tmpcolor] {} ; |
| 480 |
} |
| 481 |
\end{scope} |
| 482 |
} |
| 483 |
\NewCommandCopy\tkzGrphTracerCourbes\tkzGrphDrawExistingCurves |
| 484 |
\NewCommandCopy\tkzgdrawcurves\tkzGrphDrawExistingCurves |
| 485 |
|
| 486 |
%====COURBE DE FONCTION (via normalisation xintthecoords) |
| 487 |
\defKV[GraphiqueTikzStatsCourbe]{% |
| 488 |
Pas=\def\pflststepcurve{#1},step=\def\pflststepcurve{#1},% |
| 489 |
Nom=\def\pflstnamecurve{#1},name=\def\pflstnamecurve{#1},% |
| 490 |
Couleur=\def\pflstcoulcurve{#1},color=\def\pflstcoulcurve{#1},% |
| 491 |
StyleTrace=\def\pflststylecurve{#1},curvestyle=\def\pflststylecurve{#1},% |
| 492 |
Debut=\def\pflststdebut{#1},start=\def\pflststdebut{#1},% |
| 493 |
Fin=\def\pflststfin{#1},end=\def\pflststfin{#1},% |
| 494 |
Tension=\def\pflststtension{#1},tension=\def\pflststtension{#1},% |
| 495 |
Coeffs=\def\pflsplinecoeffs{#1},coeffs=\def\pflsplinecoeffs{#1},% |
| 496 |
ValeursInterdites=\def\pflstvalinter{#1},forbiddenvalues=\def\pflstvalinter{#1},% |
| 497 |
DeltaVI=\def\pfldeltavi{#1},deltafv=\def\pfldeltavi{#1}% |
| 498 |
} |
| 499 |
\setKVdefault[GraphiqueTikzStatsCourbe]{% |
| 500 |
Couleur=black,color=black,% |
| 501 |
Debut={},start={},% |
| 502 |
Fin={},end={},% |
| 503 |
Pas={},step={},% |
| 504 |
Nom={cf},name={cf},% |
| 505 |
Trace=false,trace=false,% |
| 506 |
StyleTrace={},curvestyle={},% |
| 507 |
Tension=0.5,tension=0.5,% |
| 508 |
Alt=false,alt=false,% |
| 509 |
Coeffs=3,coeffs=3,% |
| 510 |
ValeursInterdites={},forbiddenvalues={},% |
| 511 |
DeltaVI={auto},deltafv={auto}% |
| 512 |
} |
| 513 |
|
| 514 |
\NewDocumentCommand\tkzGrphDefineCurve{ O{} D<>{f} m }{% |
| 515 |
% #1=clés #2=nom fct #3=expression xint en x (vraies valeurs) |
| 516 |
\restoreKV[GraphiqueTikzStatsCourbe]% |
| 517 |
\setKV[GraphiqueTikzStatsCourbe]{#1}% |
| 518 |
% sync KV |
| 519 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsCourbe]{trace}{Trace}% |
| 520 |
% définition de la vraie fonction |
| 521 |
\xintdeffloatfunc #2(x) := #3 ;% |
| 522 |
% définition de la fonction normalisée : |
| 523 |
% t ∈ [0,Largeur] → x_reel = t/Largeur*ampx+xmin → f(x_reel) → y_norm |
| 524 |
\xintdeffloatfunc #2norm(t) := |
| 525 |
(#2(t/\pflstlargeur*\pflstampx+\pflstxmin)-\pflstymin) |
| 526 |
/\pflstampy*\pflsthauteur ;% |
| 527 |
% bornes normalisées (défaut : toute la fenêtre) |
| 528 |
\IfStrEq{\pflststdebut}{}% |
| 529 |
{\xdef\pflststdebutn{0}}% |
| 530 |
{\xdef\pflststdebutn{\xintfloateval{(\pflststdebut-\pflstxmin)/\pflstampx*\pflstlargeur}}}% |
| 531 |
\IfStrEq{\pflststfin}{}% |
| 532 |
{\xdef\pflststfinn{\pflstlargeur}}% |
| 533 |
{\xdef\pflststfinn{\xintfloateval{(\pflststfin-\pflstxmin)/\pflstampx*\pflstlargeur}}}% |
| 534 |
% pas normalisé (100 points par défaut) |
| 535 |
\IfStrEq{\pflststepcurve}{}% |
| 536 |
{\xdef\pflststep{\xintfloateval{(\pflststfinn-\pflststdebutn)/100}}}% |
| 537 |
{\xdef\pflststep{\xintfloateval{\pflststepcurve/\pflstampx*\pflstlargeur}}}% |
| 538 |
% tracé avec clip dans la fenêtre normalisée |
| 539 |
%bifurcation BI/noVI |
| 540 |
\IfStrEq{\pflstvalinter}{}% |
| 541 |
{% |
| 542 |
\begin{scope}% |
| 543 |
\clip (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;% |
| 544 |
\ifboolKV[GraphiqueTikzStatsCourbe]{Trace}% |
| 545 |
{% |
| 546 |
\path[draw,pflcourbe,\pflstcoulcurve,\pflststylecurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve] |
| 547 |
plot[smooth] coordinates {% |
| 548 |
\xintthecoords\xintfloatexpr |
| 549 |
seq((t,#2norm(t)), |
| 550 |
t=\pflststdebutn..[\pflststep]..\pflststfinn,\pflststfinn) |
| 551 |
\relax} ;% |
| 552 |
}% |
| 553 |
{% |
| 554 |
\path[draw=none,pflcourbe,\pflstcoulcurve,\pflststylecurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve] |
| 555 |
plot[smooth] coordinates {% |
| 556 |
\xintthecoords\xintfloatexpr |
| 557 |
seq((t,#2norm(t)), |
| 558 |
t=\pflststdebutn..[\pflststep]..\pflststfinn,\pflststfinn) |
| 559 |
\relax} ;% |
| 560 |
}% |
| 561 |
\end{scope}% |
| 562 |
}% |
| 563 |
{% |
| 564 |
\xdef\pflststyfinn{\xintfloateval{(\pflstymax-\pflstymin)/\pflstampy*\pflsthauteur}} |
| 565 |
\xdef\pfloffsetV{\xintfloateval{(\pflststyfinn)/20}}% |
| 566 |
\xdef\pflMinoffsetV{\xintfloateval{(0)-(\pfloffsetV)}}% |
| 567 |
\xdef\pflMaxoffsetV{\xintfloateval{(\pflststyfinn)+(\pfloffsetV)}}% |
| 568 |
\IfStrEq{\pfldeltavi}{auto}% |
| 569 |
{% |
| 570 |
\xdef\pfldeltavi{\xintfloateval{((\pflststfinn)-(\pflststdebutn))/250}}% |
| 571 |
}% |
| 572 |
{}% |
| 573 |
\xdef\pflststep{\xintfloateval{(\pflststfinn-\pflststdebutn)/250}}% |
| 574 |
%génération des branches, si VI |
| 575 |
\xdef\pfllistebornes{\pflststdebutn}% |
| 576 |
\foreach \i in \pflstvalinter {% |
| 577 |
\xdef\pfllistebornes{\pfllistebornes,\xintfloateval{(\i-\pflstxmin)/\pflstampx*\pflstlargeur-(\pfldeltavi)},\xintfloateval{(\i-\pflstxmin)/\pflstampx*\pflstlargeur+(\pfldeltavi)}}% |
| 578 |
}% |
| 579 |
\xdef\pfllistebornes{\pfllistebornes,\pflststfinn}% |
| 580 |
\setsepchar{,}% |
| 581 |
\readlist*\tkzintlistebornes{\pfllistebornes}% |
| 582 |
\xdef\tkzgrphnbbranches{\fpeval{\tkzintlisteborneslen/2}}% |
| 583 |
\begin{scope}% |
| 584 |
\clip (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;% |
| 585 |
\ifboolKV[GraphiqueTikzStatsCourbe]{Trace}% |
| 586 |
{% |
| 587 |
\path[draw,pflcourbe,\pflstcoulcurve,\pflststylecurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve] |
| 588 |
\foreach \ib [evaluate=\ib as \ibdeb using {int(2*\ib-1)},evaluate=\ib as \ibfin using {int(2*\ib)}] in {1,...,\tkzgrphnbbranches}{% |
| 589 |
plot[smooth] coordinates {% |
| 590 |
\xintthecoords\xintfloatexpr seq((t,min(max(#2norm(t),\pflMinoffsetV),\pflMaxoffsetV)), t={\tkzintlistebornes[\ibdeb]}..[\pflststep]..{\tkzintlistebornes[\ibfin]},{\tkzintlistebornes[\ibfin]}) \relax} |
| 591 |
} ;% |
| 592 |
}% |
| 593 |
{% |
| 594 |
\path[draw=none,pflcourbe,\pflstcoulcurve,\pflststylecurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve] |
| 595 |
\foreach \ib [evaluate=\ib as \ibdeb using {int(2*\ib-1)},evaluate=\ib as \ibfin using {int(2*\ib)}] in {1,...,\tkzgrphnbbranches}{% |
| 596 |
plot[smooth] coordinates {% |
| 597 |
\xintthecoords\xintfloatexpr seq((t,min(max(#2norm(t),\pflMinoffsetV),\pflMaxoffsetV)), t={\tkzintlistebornes[\ibdeb]}..[\pflststep]..{\tkzintlistebornes[\ibfin]},{\tkzintlistebornes[\ibfin]}) \relax} |
| 598 |
} ;% |
| 599 |
}% |
| 600 |
\end{scope} |
| 601 |
}% |
| 602 |
} |
| 603 |
\NewCommandCopy\tkzGrphDefinirCourbe\tkzGrphDefineCurve |
| 604 |
\NewCommandCopy\tkzgdefcurve\tkzGrphDefineCurve |
| 605 |
|
| 606 |
%====RÉCUPÉRATION DE COORDONNÉES (dénormalisation) |
| 607 |
\NewDocumentCommand\tkzGrphGetX{ m O{\monabs} }{% |
| 608 |
% #1 = nœud TikZ #2 = macro de stockage (défaut \monabs) |
| 609 |
% récupère la coordonnée x normalisée puis dénormalise |
| 610 |
\path #1 ;% |
| 611 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 612 |
\xdef#2{\xintfloateval{% |
| 613 |
(\ConvertirPtToCm{\macrox})/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 614 |
} |
| 615 |
\NewCommandCopy\tkzGrphRecupX\tkzGrphGetX |
| 616 |
\NewCommandCopy\tkzggetx\tkzGrphGetX |
| 617 |
|
| 618 |
\NewDocumentCommand\tkzGrphGetY{ m O{\monordo} }{% |
| 619 |
% #1 = nœud TikZ #2 = macro de stockage (défaut \monordo) |
| 620 |
\path #1 ;% |
| 621 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 622 |
\xdef#2{\xintfloateval{% |
| 623 |
(\ConvertirPtToCm{\macroy})/\pflsthauteur*\pflstampy+\pflstymin}}% |
| 624 |
} |
| 625 |
\NewCommandCopy\tkzGrphRecupY\tkzGrphGetY |
| 626 |
\NewCommandCopy\tkzggety\tkzGrphGetY |
| 627 |
|
| 628 |
\NewDocumentCommand\tkzGrphGetXY{ m O{\monabs} O{\monordo} }{% |
| 629 |
\tkzGrphGetX{#1}[#2]% |
| 630 |
\tkzGrphGetY{#1}[#3]% |
| 631 |
} |
| 632 |
\NewCommandCopy\tkzGrphRecupXY\tkzGrphGetXY |
| 633 |
\NewCommandCopy\tkzggetxy\tkzGrphGetXY |
| 634 |
|
| 635 |
%====INTERPOLATION SIMPLE (spline smooth TikZ) |
| 636 |
\NewDocumentCommand\tkzGrphDefineInterpoCurve{ O{} m }{% |
| 637 |
% #1 = clés (mêmes que GraphiqueTikzCourbe) |
| 638 |
% #2 = liste x/y § x/y § ... (vraies valeurs) |
| 639 |
\restoreKV[GraphiqueTikzStatsCourbe]% |
| 640 |
\setKV[GraphiqueTikzStatsCourbe]{#1}% |
| 641 |
% sync KV |
| 642 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsCourbe]{trace}{Trace}% |
| 643 |
% parsing à deux niveaux : § entre points, / entre x et y |
| 644 |
\setsepchar[.]{§./}% |
| 645 |
\readlist*\pflstinterpolist{#2}% |
| 646 |
% construction de la liste normalisée (x_norm, y_norm) |
| 647 |
\xdef\pflstinterponorm{}% |
| 648 |
\xintFor* ##1 in {\xintSeq{1}{\pflstinterpolistlen}} \do{% |
| 649 |
\itemtomacro\pflstinterpolist[##1,1]\tmpstx% |
| 650 |
\itemtomacro\pflstinterpolist[##1,2]\tmpsty% |
| 651 |
\xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 652 |
\xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 653 |
\xdef\pflstinterponorm{\pflstinterponorm(\tmpstnx,\tmpstny)}% |
| 654 |
}% |
| 655 |
% tracé avec clip |
| 656 |
\begin{scope}% |
| 657 |
\clip (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;% |
| 658 |
\ifboolKV[GraphiqueTikzCourbe]{Trace}% |
| 659 |
{% |
| 660 |
\path[draw,pflcourbe,\pflststylecurve,\pflstcoulcurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve]% |
| 661 |
plot[smooth,tension=\pflststtension]% |
| 662 |
coordinates {\pflstinterponorm} ;% |
| 663 |
}% |
| 664 |
{% |
| 665 |
\path[draw=none,pflcourbe,\pflstcoulcurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve]% |
| 666 |
plot[smooth,tension=\pflststtension]% |
| 667 |
coordinates {\pflstinterponorm} ;% |
| 668 |
}% |
| 669 |
\end{scope}% |
| 670 |
} |
| 671 |
\NewCommandCopy\tkzGrphDefinirCourbeInterpo\tkzGrphDefineInterpoCurve |
| 672 |
\NewCommandCopy\tkzgdefinterpo\tkzGrphDefineInterpoCurve |
| 673 |
|
| 674 |
%===INTERSECTION & ANTÉCÉDENTS |
| 675 |
\defKV[GraphiqueTikzStatsIntersect]{% |
| 676 |
Nom=\def\pflstintercurves{#1},name=\def\pflstintercurves{#1},% |
| 677 |
ListeRes=\def\pflstinterlistres{#1},reslist=\def\pflstinterlistres{#1},% |
| 678 |
Couleur=\def\pflstintercol{#1},color=\def\pflstintercol{#1},% |
| 679 |
Style=\def\pflstinterstyle{#1},style=\def\pflstinterstyle{#1}% |
| 680 |
} |
| 681 |
\setKVdefault[GraphiqueTikzStatsIntersect]{% |
| 682 |
Nom=S,name=S,% |
| 683 |
Aff=true,show=true,% |
| 684 |
Couleur=black,color=black,% |
| 685 |
AffDroite=false,showline=false,% |
| 686 |
Traits=false,lines=false,% |
| 687 |
Style=o,style=o,% |
| 688 |
ListeRes={},reslist={}% |
| 689 |
} |
| 690 |
|
| 691 |
%===ANTECEDENTS |
| 692 |
\NewDocumentCommand\tkzGrphFindX{ O{} m m D<>{\myantec} }{% |
| 693 |
\restoreKV[GraphiqueTikzStatsIntersect]% |
| 694 |
\setKV[GraphiqueTikzStatsIntersect]{#1}% |
| 695 |
% sync KV |
| 696 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsIntersect]{show}{Aff}% |
| 697 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsIntersect]{showline}{AffDroite}% |
| 698 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsIntersect]{lines}{Traits}% |
| 699 |
%droite normalisée |
| 700 |
\xdef\tmpstny{\xintfloateval{((#3)-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 701 |
\begin{scope} |
| 702 |
\clip ({0},{0}) rectangle (\pflstlargeur,\pflsthauteur) ; |
| 703 |
\ifboolKV[GraphiqueTikzStatsIntersect]{AffDroite}% |
| 704 |
{% |
| 705 |
\path[draw,\pflstintercol,pfltraitantec,name path=tmpanteced] ({0},{\tmpstny})--({\pflstlargeur},{\tmpstny}) ; |
| 706 |
}% |
| 707 |
{% |
| 708 |
\path[draw=none,pfltraitantec,name path=tmpanteced] ({0},{\tmpstny})--({\pflstlargeur},{\tmpstny}) ; |
| 709 |
}% |
| 710 |
\path[name intersections={of=#2 and tmpanteced,name=\pflstintercurves,total=\t}] \pgfextra{\xdef#4{\t}}; |
| 711 |
\IfStrEq{\pflstinterlistres}{}% |
| 712 |
{}% |
| 713 |
{% |
| 714 |
\xdef\tkzgtmplistabsc{}% |
| 715 |
\xintifboolexpr{#4 == 0}{}% |
| 716 |
{% |
| 717 |
\foreach \i in {1,...,#4}{% |
| 718 |
\tkzGrphGetX{(\pflstintercurves-\i)}[\tmpabsi]% |
| 719 |
\xintifboolexpr{\i == 1}% |
| 720 |
{\xdef\tkzgtmplistabsc{\tmpabsi}}% |
| 721 |
{\xdef\tkzgtmplistabsc{\tkzgtmplistabsc,\tmpabsi}}% |
| 722 |
}% |
| 723 |
}% |
| 724 |
\expandafter\xdef\csname\pflstinterlistres\endcsname{\tkzgtmplistabsc}% |
| 725 |
}% |
| 726 |
\ifboolKV[GraphiqueTikzStatsIntersect]{Aff}% |
| 727 |
{% |
| 728 |
\xintifboolexpr{#4 == 0}{}% |
| 729 |
{% |
| 730 |
\foreach \i in {1,...,#4}{% |
| 731 |
\ifboolKV[GraphiqueTikzStatsIntersect]{Traits}% |
| 732 |
{% |
| 733 |
\draw[pfltraitimg,\pflstintercol]let \p1 = (\pflstintercurves-\i) in (\pflstintercurves-\i) -- ({\x1},{\pflstoy}) ; |
| 734 |
}% |
| 735 |
{}% |
| 736 |
\tkzGrphMarkPts*[Style=\pflstinterstyle,Couleur=\pflstintercol]{(\pflstintercurves-\i)} |
| 737 |
} |
| 738 |
}% |
| 739 |
}% |
| 740 |
{}% |
| 741 |
\end{scope} |
| 742 |
} |
| 743 |
\NewCommandCopy\tkzGrphTrouverX\tkzGrphFindX |
| 744 |
\NewCommandCopy\tkzgfindx\tkzGrphFindX |
| 745 |
|
| 746 |
\NewDocumentCommand\tkzGrphFindItsc{ O{} m m D<>{\myt} }{% |
| 747 |
\restoreKV[GraphiqueTikzStatsIntersect]% |
| 748 |
\setKV[GraphiqueTikzStatsIntersect]{#1}% |
| 749 |
% sync KV |
| 750 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsIntersect]{show}{Aff}% |
| 751 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsIntersect]{showline}{AffDroite}% |
| 752 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsIntersect]{lines}{Traits}% |
| 753 |
\path[name intersections={of=#2 and #3,name=\pflstintercurves,total=\t}] \pgfextra{\xdef#4{\t}}; |
| 754 |
\ifboolKV[GraphiqueTikzStatsIntersect]{Aff}% |
| 755 |
{% |
| 756 |
\xintifboolexpr{#4 == 0}{}% |
| 757 |
{% |
| 758 |
\foreach \i in {1,...,#4}{% |
| 759 |
\ifboolKV[GraphiqueTikzStatsIntersect]{Traits}% |
| 760 |
{% |
| 761 |
\draw[pfltraitimg,\pflstintercol]let \p1 = (\pflstintercurves-\i) in (\pflstintercurves-\i) -- ({\x1},{\pflstoy}) ; |
| 762 |
}% |
| 763 |
{}% |
| 764 |
\tkzGrphMarkPts*[Style=\pflstinterstyle,Couleur=\pflstintercol]{(\pflstintercurves-\i)} |
| 765 |
%\filldraw[{\useKV[GraphiqueTikzIntersect]{Couleur}}] (\pflintercurves-\i) circle[pflpointc] ; |
| 766 |
} |
| 767 |
}% |
| 768 |
}% |
| 769 |
{}% |
| 770 |
\IfStrEq{\pflstinterlistres}{}% |
| 771 |
{}% |
| 772 |
{% |
| 773 |
\xdef\tkzgtmplistabsc{}% |
| 774 |
\xintifboolexpr{#4 == 0}{}% |
| 775 |
{% |
| 776 |
\foreach \i in {1,...,#4}{% |
| 777 |
\tkzGrphGetX{(\pflstintercurves-\i)}[\tmpabsi]% |
| 778 |
\xintifboolexpr{\i == 1}% |
| 779 |
{\xdef\tkzgtmplistabsc{\tmpabsi}}% |
| 780 |
{\xdef\tkzgtmplistabsc{\tkzgtmplistabsc,\tmpabsi}}% |
| 781 |
}% |
| 782 |
}% |
| 783 |
\expandafter\xdef\csname\pflstinterlistres\endcsname{\tkzgtmplistabsc}% |
| 784 |
}% |
| 785 |
} |
| 786 |
\NewCommandCopy\tkzGrphIntersections\tkzGrphFindItsc |
| 787 |
\NewCommandCopy\tkzgfinditsc\tkzGrphFindItsc |
| 788 |
|
| 789 |
%====IMAGES |
| 790 |
\defKV[tkzGrphFindY]{% |
| 791 |
Nom=\def\pflstfindyname{#1},name=\def\pflstfindyname{#1},% |
| 792 |
Couleur=\def\pflstfindycol{#1},color=\def\pflstfindycol{#1},% |
| 793 |
Style=\def\pflstfindystyle{#1},style=\def\pflstfindystyle{#1}% |
| 794 |
} |
| 795 |
\setKVdefault[tkzGrphFindY]{% |
| 796 |
Nom={},name={},% |
| 797 |
Couleur=black,color=black,% |
| 798 |
Style=o,style=o,% |
| 799 |
Aff=true,show=true,% |
| 800 |
Traits=false,lines=false% |
| 801 |
} |
| 802 |
|
| 803 |
\NewDocumentCommand\tkzGrphFindY{ O{} m m D<>{\myimg} }{% |
| 804 |
\restoreKV[tkzGrphFindY]% |
| 805 |
\setKV[tkzGrphFindY]{#1}% |
| 806 |
% sync KV |
| 807 |
\tkzgrphSetKVboolTrue[tkzGrphFindY]{show}{Aff}% |
| 808 |
\tkzgrphSetKVboolFalse[tkzGrphFindY]{lines}{Traits}% |
| 809 |
% droite verticale normalisée |
| 810 |
\xdef\tmpstnx{\xintfloateval{((#3)-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 811 |
\begin{scope} |
| 812 |
\clip (0,0) rectangle (\pflstlargeur,\pflsthauteur) ; |
| 813 |
\path[draw=none,pflcourbe,name path=tmpimage] ({\tmpstnx},{0}) -- ({\tmpstnx},{\pflsthauteur}) ;% |
| 814 |
\path[name intersections={of=#2 and tmpimage,name=ZZZZ}] ; |
| 815 |
\tkzGrphGetY{(ZZZZ-1)}[#4]% |
| 816 |
\IfStrEq{\pflstfindyname}{}% |
| 817 |
{}% |
| 818 |
{% |
| 819 |
\coordinate (\pflstintercurves) at (ZZZZ-1) ; |
| 820 |
}% |
| 821 |
%traits |
| 822 |
\ifboolKV[tkzGrphFindY]{Traits}% |
| 823 |
{% |
| 824 |
\draw[\pflstfindycol,pfltraitimg] let \p1=(ZZZZ-1) in (\x1,\pflstoy) -- (ZZZZ-1) -- (\pflstox,\y1) ;% |
| 825 |
}% |
| 826 |
{}% |
| 827 |
% affichage du point |
| 828 |
\ifboolKV[tkzGrphFindY]{Aff}% |
| 829 |
{% |
| 830 |
\tkzGrphMarkPts*[Style=\pflstfindystyle,Couleur=\pflstfindycol] {(ZZZZ-1)}% |
| 831 |
}{}% |
| 832 |
\end{scope}% |
| 833 |
} |
| 834 |
\NewCommandCopy\tkzGrphTrouverY\tkzGrphFindY |
| 835 |
\NewCommandCopy\tkzgfindy\tkzGrphFindY |
| 836 |
|
| 837 |
\NewDocumentCommand\tkzGrphFindListY{ O{} m m }{% |
| 838 |
% #1=clés #2=nom path #3=liste x réels (CSV) |
| 839 |
\foreach \tmpstx in {#3}{% |
| 840 |
\tkzGrphFindY[#1]{#2}{\tmpstx}% |
| 841 |
}% |
| 842 |
} |
| 843 |
\NewCommandCopy\tkzGrphTrouverListeY\tkzGrphFindListY |
| 844 |
\NewCommandCopy\tkzgfindlisty\tkzGrphFindListY |
| 845 |
|
| 846 |
%====SPLINES CUBIQUES (Hermite normalisées) |
| 847 |
% facteur de normalisation des dérivées : |
| 848 |
% f'_norm = f'_reel * (Hauteur/ampy) / (Largeur/ampx) |
| 849 |
% = f'_reel * Hauteur * ampx / (ampy * Largeur) |
| 850 |
|
| 851 |
%====TEXTES |
| 852 |
\defKV[GraphiqueTikzNodeAlt]{% |
| 853 |
Couleur=\def\pflnodecol{#1},color=\def\pflnodecol{#1},% |
| 854 |
Police=\def\pflnodefonte{#1},font=\def\pflnodefonte{#1},% |
| 855 |
Position=\def\pfnodepos{#1},pos=\def\pfnodepos{#1},% |
| 856 |
xshift=\def\pfnodeposxshift{#1},% |
| 857 |
yshift=\def\pfnodeposyshift{#1}% |
| 858 |
} |
| 859 |
\setKVdefault[GraphiqueTikzNodeAlt]{% |
| 860 |
Couleur=black,color=black,% |
| 861 |
Police={\normalfont\normalsize},font={\normalfont\normalsize},% |
| 862 |
Position={},pos={},% |
| 863 |
xshift=0pt,yshift=0pt |
| 864 |
} |
| 865 |
|
| 866 |
\NewDocumentCommand\tkzGrphPlaceText{ O{} m m }{% |
| 867 |
\restoreKV[GraphiqueTikzNodeAlt]% |
| 868 |
\setKV[GraphiqueTikzNodeAlt]{#1}% |
| 869 |
% test : si #2 contient une virgule → coordonnées réelles à normaliser, attention cependant :-/ |
| 870 |
% sinon → nœud TikZ existant, on l'utilise directement |
| 871 |
\IfSubStr{#2}{,}% |
| 872 |
{% |
| 873 |
\StrBetween{#2}{(}{,}[\tmpstx]% |
| 874 |
\StrBetween{#2}{,}{)}[\tmpsty]% |
| 875 |
\xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 876 |
\xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 877 |
\typeout{tmpstnx = \tmpstnx === tmpstny = \tmpstny} |
| 878 |
\draw (\tmpstnx,\tmpstny) |
| 879 |
node[xshift=\pfnodeposxshift,yshift=\pfnodeposyshift,pflnoeud,font=\pflnodefonte,text=\pflnodecol,\pfnodepos] {#3} ;% |
| 880 |
}% |
| 881 |
{% |
| 882 |
% nœud existant → passage direct |
| 883 |
\draw #2 |
| 884 |
node[xshift=\pfnodeposxshift,yshift=\pfnodeposyshift,pflnoeud,font=\pflnodefonte,text=\pflnodecol,\pfnodepos] {#3} ;% |
| 885 |
}% |
| 886 |
} |
| 887 |
\NewCommandCopy\tkzGrphPlaceTexte\tkzGrphPlaceText |
| 888 |
\NewCommandCopy\tkzgtxt\tkzGrphPlaceText |
| 889 |
|
| 890 |
\NewDocumentCommand\tkzGrphGenSpline{ s m m O{\monspline} }{% |
| 891 |
% #1=étoile (mode Alt) #2=liste x/y/f'§... #3=coeffs #4=macro chemin |
| 892 |
% Clé : normalisation dans la boucle uniquement, via \xan/\yan/\xbn/\ybn |
| 893 |
\setsepchar[.]{§./}% |
| 894 |
\readlist*\SPLlistepoints{#2}% |
| 895 |
\def\tmpsplinenumdeb{1}% |
| 896 |
\def\tmpsplinenumfin{\SPLlistepointslen}% |
| 897 |
\def\SPLnbsplines{\inteval{\tmpsplinenumfin-1}}% |
| 898 |
% facteur de normalisation des dérivées (calculé une fois) |
| 899 |
\xdef\pflstnormpente{\xintfloateval{\pflsthauteur*\pflstampx/(\pflstampy*\pflstlargeur)}}% |
| 900 |
% initialisation de #4 (vide) |
| 901 |
\xdef#4{}% |
| 902 |
\foreach \i in {\tmpsplinenumdeb,...,\SPLnbsplines}{% |
| 903 |
\pflextractcoeff{#3}{\i}% |
| 904 |
\def\j{\inteval{\i+1}}% |
| 905 |
% lecture des vraies valeurs |
| 906 |
\itemtomacro\SPLlistepoints[\i,1]\xa% |
| 907 |
\itemtomacro\SPLlistepoints[\i,2]\ya% |
| 908 |
\itemtomacro\SPLlistepoints[\i,3]\fprimea% |
| 909 |
\itemtomacro\SPLlistepoints[\j,1]\xb% |
| 910 |
\itemtomacro\SPLlistepoints[\j,2]\yb% |
| 911 |
\itemtomacro\SPLlistepoints[\j,3]\fprimeb% |
| 912 |
% normalisation dans des macros séparées |
| 913 |
\xdef\xan{\xintfloateval{(\xa-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 914 |
\xdef\yan{\xintfloateval{(\ya-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 915 |
\xdef\xbn{\xintfloateval{(\xb-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 916 |
\xdef\ybn{\xintfloateval{(\yb-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 917 |
\xdef\fpriman{\xintfloateval{(\fprimea)*\pflstnormpente}}% |
| 918 |
\xdef\fprimbn{\xintfloateval{(\fprimeb)*\pflstnormpente}}% |
| 919 |
% construction du chemin normalisé |
| 920 |
\IfBooleanTF{#1}% |
| 921 |
{% |
| 922 |
% mode Alt |
| 923 |
\ifnum\i=1 |
| 924 |
\xdef#4{(\xan,\yan) ..controls +({((\xbn)-(\xan))/\COEFFA},{(\fpriman)*((\xbn)-(\xan))/\COEFFA}) and +({-((\xbn)-(\xan))/\COEFFA},{-(\fprimbn)*((\xbn)-(\xan))/\COEFFA}).. (\xbn,\ybn)}% |
| 925 |
\else |
| 926 |
\xdef#4{#4 ..controls +({((\xbn)-(\xan))/\COEFFA},{(\fpriman)*((\xbn)-(\xan))/\COEFFA}) and +({-((\xbn)-(\xan))/\COEFFA},{-(\fprimbn)*((\xbn)-(\xan))/\COEFFA}).. (\xbn,\ybn)}% |
| 927 |
\fi |
| 928 |
}% |
| 929 |
{% |
| 930 |
% mode polaire |
| 931 |
\ifnum\i=1 |
| 932 |
\xdef#4{(\xan,\yan) ..controls +({atan (\fpriman)}:{((\xbn)-(\xan))/\COEFFA}) and +({-180 + atan (\fprimbn)}:{((\xbn)-(\xan))/\COEFFA}).. (\xbn,\ybn)}% |
| 933 |
\else |
| 934 |
\xdef#4{#4 ..controls +({atan (\fpriman)}:{((\xbn)-(\xan))/\COEFFA}) and +({-180 + atan (\fprimbn)}:{((\xbn)-(\xan))/\COEFFB}).. (\xbn,\ybn)}% |
| 935 |
\fi |
| 936 |
}% |
| 937 |
}% |
| 938 |
} |
| 939 |
|
| 940 |
\NewDocumentCommand\tkzGrphDefineSpline{ O{} m D<>{\monspline} }{% |
| 941 |
\restoreKV[GraphiqueTikzStatsCourbe]% |
| 942 |
\setKV[GraphiqueTikzStatsCourbe]{#1}% |
| 943 |
% sync KV |
| 944 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsCourbe]{alt}{Alt}% |
| 945 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsCourbe]{trace}{Trace}% |
| 946 |
\ifboolKV[GraphiqueTikzStatsCourbe]{Alt}% |
| 947 |
{\tkzGrphGenSpline*{#2}{\pflsplinecoeffs}[#3]}% |
| 948 |
{\tkzGrphGenSpline{#2}{\pflsplinecoeffs}[#3]}% |
| 949 |
\begin{scope}% |
| 950 |
\clip (0,0) rectangle (\pflstlargeur,\pflsthauteur) ;% |
| 951 |
\ifboolKV[GraphiqueTikzStatsCourbe]{Trace}% |
| 952 |
{% |
| 953 |
\path[draw,pflcourbe,\pflststylecurve,\pflstcoulcurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve] #3 ; |
| 954 |
}% |
| 955 |
{% |
| 956 |
\path[draw=none,pflcourbe,\pflststylecurve,\pflstcoulcurve,name path global=\pflstnamecurve,spath/save global=\pflstnamecurve] #3 ; |
| 957 |
}% |
| 958 |
\end{scope}% |
| 959 |
} |
| 960 |
\NewCommandCopy\tkzGrphDefinirCourbeSpline\tkzGrphDefineSpline |
| 961 |
\NewCommandCopy\tkzgdefspline\tkzGrphDefineSpline |
| 962 |
|
| 963 |
%====MARQUAGE DE POINTS |
| 964 |
\defKV[GraphiqueTikzStatsMarkPoints]{% |
| 965 |
Couleur=\def\pflstcouleurpoints{#1},color=\def\pflstcouleurpoints{#1},% |
| 966 |
Style=\def\pflstylepoints{#1},style=\def\pflstylepoints{#1},% |
| 967 |
Taillex=\def\pflststylesizex{#1},sizex=\def\pflststylesizex{#1},% |
| 968 |
Taillec=\def\pflststylesizec{#1},sizec=\def\pflststylesizec{#1},% |
| 969 |
Tailleo=\def\pflststylesizeo{#1},sizex=\def\pflststylesizeo{#1}% |
| 970 |
} |
| 971 |
\setKVdefault[GraphiqueTikzStatsMarkPoints]{% |
| 972 |
Couleur=black,color=black,% |
| 973 |
Taillec=2pt,sizec=2pt,% |
| 974 |
Taillex=2pt,sizex=2pt,% |
| 975 |
Tailleo=1.75pt,sizeo=1.75pt,% |
| 976 |
Style=o,style=o,% |
| 977 |
Traits=false,lines=false,% |
| 978 |
ModeTransfo={} |
| 979 |
} |
| 980 |
\NewDocumentCommand\tkzGrphMarkPts{ s O{} D<>{\normalfont\normalsize} m }{% |
| 981 |
%étoilée = sans label |
| 982 |
%2=clés |
| 983 |
%3=points |
| 984 |
\restoreKV[GraphiqueTikzStatsMarkPoints]% |
| 985 |
\setKV[GraphiqueTikzStatsMarkPoints]{#2}% |
| 986 |
% sync KV |
| 987 |
\tkzgrphSetKVboolFalse[GraphiqueTikzStatsMarkPoints]{lines}{Traits}% |
| 988 |
\IfBooleanTF{#1}% |
| 989 |
{% |
| 990 |
\IfStrEq{\pflstylepoints}{x}% |
| 991 |
{% |
| 992 |
\foreach \Point in {#4} {% |
| 993 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 994 |
{% |
| 995 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 996 |
}% |
| 997 |
{}% |
| 998 |
\draw[\pflstcouleurpoints] \Point pic{pflptcroix=\pflststylesizex/45} ; |
| 999 |
}% |
| 1000 |
}% |
| 1001 |
{}% |
| 1002 |
\IfStrEq{\pflstylepoints}{+}% |
| 1003 |
{% |
| 1004 |
\foreach \Point in {#4} {% |
| 1005 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1006 |
{% |
| 1007 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1008 |
}% |
| 1009 |
{}% |
| 1010 |
\draw[\pflstcouleurpoints] \Point pic{pflptcroix=\pflststylesizex/90} ; |
| 1011 |
}% |
| 1012 |
}% |
| 1013 |
{}% |
| 1014 |
\IfStrEq{\pflstylepoints}{c}% |
| 1015 |
{% |
| 1016 |
\foreach \Point in {#4} {% |
| 1017 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1018 |
{% |
| 1019 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1020 |
}% |
| 1021 |
{}% |
| 1022 |
\filldraw[draw=none,fill=\pflstcouleurpoints] \Point pic{pflptcarre=\pflststylesizec/0} ; |
| 1023 |
}% |
| 1024 |
}% |
| 1025 |
{}% |
| 1026 |
\IfStrEq{\pflstylepoints}{s}% |
| 1027 |
{% |
| 1028 |
\foreach \Point in {#4} {% |
| 1029 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1030 |
{% |
| 1031 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1032 |
}% |
| 1033 |
{}% |
| 1034 |
\filldraw[draw=none,fill=\pflstcouleurpoints] \Point pic{pflptcarre=\pflststylesizec/0} ; |
| 1035 |
}% |
| 1036 |
}% |
| 1037 |
{}% |
| 1038 |
\IfStrEq{\pflstylepoints}{d}% |
| 1039 |
{% |
| 1040 |
\foreach \Point in {#4} {% |
| 1041 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1042 |
{% |
| 1043 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1044 |
}% |
| 1045 |
{}% |
| 1046 |
\filldraw[draw=none,fill=\pflstcouleurpoints] \Point pic{pflptcarre=\pflststylesizeo/45} ; |
| 1047 |
}% |
| 1048 |
}% |
| 1049 |
{}% |
| 1050 |
\IfStrEq{\pflstylepoints}{o}% |
| 1051 |
{% |
| 1052 |
\IfSubStr{\pflstcouleurpoints}{/}% |
| 1053 |
{% |
| 1054 |
\StrCut{\pflstcouleurpoints}{/}{\pflstcouleurpointsA}{\pflstcouleurpointsB}% |
| 1055 |
\foreach \Point in {#4} {% |
| 1056 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1057 |
{% |
| 1058 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1059 |
}% |
| 1060 |
{}% |
| 1061 |
\filldraw[pfltrait,fill=\pflstcouleurpointsB,draw=\pflstcouleurpointsA] \Point circle[radius=\pflststylesizeo] ; |
| 1062 |
}% |
| 1063 |
}% |
| 1064 |
{% |
| 1065 |
\foreach \Point in {#4} {% |
| 1066 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1067 |
{% |
| 1068 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1069 |
}% |
| 1070 |
{}% |
| 1071 |
\filldraw[\pflstcouleurpoints] \Point circle[radius=\pflststylesizeo] ; |
| 1072 |
}% |
| 1073 |
}% |
| 1074 |
}% |
| 1075 |
{}% |
| 1076 |
\IfStrEq{\pflstylepoints}{ggb}% |
| 1077 |
{% |
| 1078 |
\IfSubStr{\pflstcouleurpoints}{/}% |
| 1079 |
{% |
| 1080 |
\StrCut{\pflstcouleurpoints}{/}{\pflstcouleurpointsA}{\pflstcouleurpointsB}% |
| 1081 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1082 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1083 |
{% |
| 1084 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1085 |
}% |
| 1086 |
{}% |
| 1087 |
\draw[pflpointggb,\pflstcouleurpointsA,fill=\pflstcouleurpointsB] \Point circle[radius=\pflststylesizeo] ; |
| 1088 |
}% |
| 1089 |
}% |
| 1090 |
{% |
| 1091 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1092 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1093 |
{% |
| 1094 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1095 |
}% |
| 1096 |
{}% |
| 1097 |
\filldraw[\pflstcouleurpoints] \Point circle[radius=\pflststylesizeo] ; |
| 1098 |
}% |
| 1099 |
}% |
| 1100 |
}% |
| 1101 |
{}% |
| 1102 |
}% |
| 1103 |
{%avec label |
| 1104 |
\IfStrEq{\pflstylepoints}{x}% |
| 1105 |
{% |
| 1106 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1107 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1108 |
{% |
| 1109 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1110 |
}% |
| 1111 |
{}% |
| 1112 |
\draw[\pflstcouleurpoints] \Point pic{pflptcroix=\pflststylesizex/45} node[pflnoeud,\Pos,font=#3] {\Label} ; |
| 1113 |
}% |
| 1114 |
}% |
| 1115 |
{}% |
| 1116 |
\IfStrEq{\pflstylepoints}{+}% |
| 1117 |
{% |
| 1118 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1119 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1120 |
{% |
| 1121 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1122 |
}% |
| 1123 |
{}% |
| 1124 |
\draw[\pflstcouleurpoints] \Point pic{pflptcroix=\pflststylesizex/90} node[pflnoeud,\Pos,font=#3] {\Label} ; |
| 1125 |
}% |
| 1126 |
}% |
| 1127 |
{}% |
| 1128 |
\IfStrEq{\pflstylepoints}{c}% |
| 1129 |
{% |
| 1130 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1131 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1132 |
{% |
| 1133 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1134 |
}% |
| 1135 |
{}% |
| 1136 |
\filldraw[draw=none,fill=\pflstcouleurpoints] \Point pic{pflptcarre=\pflststylesizec/0} node[pflnoeud,\Pos,\pflstcouleurpoints,font=#3] {\Label} ; |
| 1137 |
}% |
| 1138 |
}% |
| 1139 |
{}% |
| 1140 |
\IfStrEq{\pflstylepoints}{s}% |
| 1141 |
{% |
| 1142 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1143 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1144 |
{% |
| 1145 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1146 |
}% |
| 1147 |
{}% |
| 1148 |
\filldraw[draw=none,fill=\pflstcouleurpoints] \Point pic{pflptcarre=\pflststylesizec/0} node[pflnoeud,\Pos,\pflstcouleurpoints,font=#3] {\Label} ; |
| 1149 |
}% |
| 1150 |
}% |
| 1151 |
{}% |
| 1152 |
\IfStrEq{\pflstylepoints}{d}% |
| 1153 |
{% |
| 1154 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1155 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1156 |
{% |
| 1157 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1158 |
}% |
| 1159 |
{}% |
| 1160 |
\filldraw[draw=none,fill=\pflstcouleurpoints] \Point pic{pflptcarre=\pflststylesizeo/45} node[pflnoeud,\Pos,\pflstcouleurpoints,font=#3] {\Label} ; |
| 1161 |
}% |
| 1162 |
}% |
| 1163 |
{}% |
| 1164 |
\IfStrEq{\pflstylepoints}{o}% |
| 1165 |
{% |
| 1166 |
\IfSubStr{\pflstcouleurpoints}{/}% |
| 1167 |
{% |
| 1168 |
\StrCut{\pflstcouleurpoints}{/}{\pflstcouleurpointsA}{\pflstcouleurpointsB}% |
| 1169 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1170 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1171 |
{% |
| 1172 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1173 |
}% |
| 1174 |
{}% |
| 1175 |
\draw[pfltrait,\pflstcouleurpointsA,fill=\pflstcouleurpointsB] \Point circle[radius=\pflststylesizeo] node[pflnoeud,\Pos,font=#3] {\Label} ; |
| 1176 |
}% |
| 1177 |
}% |
| 1178 |
{% |
| 1179 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1180 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1181 |
{% |
| 1182 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1183 |
}% |
| 1184 |
{}% |
| 1185 |
\filldraw[\pflstcouleurpoints] \Point circle[radius=\pflststylesizeo] node[pflnoeud,\Pos,font=#3] {\Label} ; |
| 1186 |
}% |
| 1187 |
}% |
| 1188 |
}% |
| 1189 |
{}% |
| 1190 |
\IfStrEq{\pflstylepoints}{ggb}% |
| 1191 |
{% |
| 1192 |
\IfSubStr{\pflstcouleurpoints}{/}% |
| 1193 |
{% |
| 1194 |
\StrCut{\pflstcouleurpoints}{/}{\pflstcouleurpointsA}{\pflstcouleurpointsB}% |
| 1195 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1196 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1197 |
{% |
| 1198 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1199 |
}% |
| 1200 |
{}% |
| 1201 |
\draw[pflpointggb,\pflstcouleurpointsA,fill=\pflstcouleurpointsB] \Point circle[radius=\pflststylesizeo] node[pflnoeud,\Pos,font=#3] {\Label} ; |
| 1202 |
}% |
| 1203 |
}% |
| 1204 |
{% |
| 1205 |
\foreach \Point/\Label/\Pos in {#4} {% |
| 1206 |
\ifboolKV[GraphiqueTikzStatsMarkPoints]{Traits}% |
| 1207 |
{% |
| 1208 |
\draw[\pflstcouleurpoints,pfltraitantec] let \p1 = \Point in ({\x1},{\pflstoy}) |- ({\pflstox},{\y1}) ; |
| 1209 |
}% |
| 1210 |
{}% |
| 1211 |
\filldraw[\pflstcouleurpoints] \Point circle[radius=\pflststylesizeo] node[pflnoeud,\Pos,font=#3] {\Label} ; |
| 1212 |
}% |
| 1213 |
}% |
| 1214 |
}% |
| 1215 |
{}% |
| 1216 |
}% |
| 1217 |
} |
| 1218 |
\NewCommandCopy\tkzGrphMarquerPts\tkzGrphMarkPts |
| 1219 |
\NewCommandCopy\tkzgmarkpts\tkzGrphMarkPts |
| 1220 |
|
| 1221 |
%====INTÉGRALES |
| 1222 |
\defKV[GraphiqueTikzIntegrStats]{% |
| 1223 |
Couleurs=\def\pfldomtikzcolors{#1},colors=\def\pfldomtikzcolors{#1},% |
| 1224 |
Style=\def\pfldomtikzstyle{#1},style=\def\pfldomtikzstyle{#1},% |
| 1225 |
Opacite=\def\pfldomtikzopac{#1},opacity=\def\pfldomtikzopac{#1},% |
| 1226 |
Hachures=\def\pfldomtikzhatch{#1},hatch=\def\pfldomtikzhatch{#1},% |
| 1227 |
Bornes=\def\pflintbornes{#1},bound=\def\pflintbornes{#1},% |
| 1228 |
Jonction=\def\pfldomtikzjoin{#1},junction=\def\pfldomtikzjoin{#1},% |
| 1229 |
Tension=\def\pfldomtikztension{#1},tension=\def\pfldomtikztension{#1},% |
| 1230 |
TensionB=\def\pfldomtikztensionB{#1},tensionb=\def\pfldomtikztensionB{#1}% |
| 1231 |
} |
| 1232 |
\setKVdefault[GraphiqueTikzIntegrStats]{% |
| 1233 |
Couleurs=gray,colors=gray,% |
| 1234 |
Style=fill,style=fill,% |
| 1235 |
Opacite=0.5,opacity=0.5,% |
| 1236 |
Hachures={north west lines},hatch={north west lines},% |
| 1237 |
Jonction=bevel,junction=bevel,% |
| 1238 |
Bornes=abs,bound=abs,% |
| 1239 |
Bord=true,border=true,% |
| 1240 |
Tension=0.5,tension=0.5,% |
| 1241 |
TensionB=0.5,tensionb=0.5% |
| 1242 |
} |
| 1243 |
|
| 1244 |
\NewDocumentCommand\tkzGrphDrawIntg{ O{} D<>{} m O{0} m m }{% |
| 1245 |
%1 = clés |
| 1246 |
%2 = options particulières tikz |
| 1247 |
%3 = fonction, en tikz |
| 1248 |
%4 = fonction n°2 éventuelle |
| 1249 |
%de #5 à #6 |
| 1250 |
\restoreKV[GraphiqueTikzIntegrStats]% revenir au valeurs par défaut |
| 1251 |
\setKV[GraphiqueTikzIntegrStats]{#1}% lit les arguments optionnels |
| 1252 |
% sync KV |
| 1253 |
\tkzgrphSetKVboolTrue[GraphiqueTikzIntegrStats]{border}{Bord}% |
| 1254 |
%les couleurs |
| 1255 |
\IfSubStr{\pfldomtikzcolors}{/}% |
| 1256 |
{% |
| 1257 |
\StrCut{\pfldomtikzcolors}{/}{\pfldomtikzcolorbord}{\pfldomtikzcolorfond} |
| 1258 |
}% |
| 1259 |
{% |
| 1260 |
\xdef\pfldomtikzcolorbord{\pfldomtikzcolors}\xdef\pfldomtikzcolorfond{\pfldomtikzcolors} |
| 1261 |
}% |
| 1262 |
\ifboolKV[GraphiqueTikzIntegr]{Bord}% |
| 1263 |
{% |
| 1264 |
\tikzset{integralebordtikzstyle/.style={draw=\pfldomtikzcolorbord}} |
| 1265 |
}% |
| 1266 |
{% |
| 1267 |
\tikzset{integralebordtikzstyle/.style={draw=none}} |
| 1268 |
}% |
| 1269 |
\IfSubStr{,hatch,hachures,}{,\pfldomtikzstyle,}% |
| 1270 |
{% |
| 1271 |
\tikzset{integraletikzstyle/.style={pfltrait,pattern=\pfldomtikzhatch,pattern color=\pfldomtikzcolorfond,line join=\pfldomtikzjoin}} |
| 1272 |
}% |
| 1273 |
{}% |
| 1274 |
\IfSubStr{,fill,remplir,}{,\pfldomtikzstyle,}% |
| 1275 |
{% |
| 1276 |
\tikzset{integraletikzstyle/.style={pfltrait,fill=\pfldomtikzcolorfond,fill opacity=\pfldomtikzopac,line join=\pfldomtikzjoin}} |
| 1277 |
}% |
| 1278 |
{}% |
| 1279 |
%extraction des infos x/y |
| 1280 |
\IfStrEqCase{\pflintbornes}{% |
| 1281 |
{abs}% |
| 1282 |
{% |
| 1283 |
\xdef\absnoeudA{#5}% |
| 1284 |
\xdef\absnoeudB{#6}% |
| 1285 |
% normalisation |
| 1286 |
\xdef\absnoeudAn{\xintfloateval{(\absnoeudA-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1287 |
\xdef\absnoeudBn{\xintfloateval{(\absnoeudB-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1288 |
}% |
| 1289 |
{noeuds}% |
| 1290 |
{% |
| 1291 |
\path #5; |
| 1292 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1293 |
\xdef\tmpstnxA{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1294 |
\xdef\absnoeudA{\xintfloateval{\tmpstnxA/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1295 |
\xdef\absnoeudAn{\tmpstnxA}% |
| 1296 |
\path #6; |
| 1297 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1298 |
\xdef\tmpstnxB{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1299 |
\xdef\absnoeudB{\xintfloateval{\tmpstnxB/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1300 |
\xdef\absnoeudBn{\tmpstnxB}% |
| 1301 |
}% |
| 1302 |
{nodes}% |
| 1303 |
{% |
| 1304 |
\path #5; |
| 1305 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1306 |
\xdef\tmpstnxA{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1307 |
\xdef\absnoeudA{\xintfloateval{\tmpstnxA/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1308 |
\xdef\absnoeudAn{\tmpstnxA}% |
| 1309 |
\path #6; |
| 1310 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1311 |
\xdef\tmpstnxB{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1312 |
\xdef\absnoeudB{\xintfloateval{\tmpstnxB/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1313 |
\xdef\absnoeudBn{\tmpstnxB}% |
| 1314 |
}% |
| 1315 |
{abs/noeud}% |
| 1316 |
{% |
| 1317 |
\xdef\absnoeudA{#5}% |
| 1318 |
\xdef\absnoeudAn{\xintfloateval{(\absnoeudA-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1319 |
\path #6; |
| 1320 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1321 |
\xdef\tmpstnxB{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1322 |
\xdef\absnoeudB{\xintfloateval{\tmpstnxB/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1323 |
\xdef\absnoeudBn{\tmpstnxB}% |
| 1324 |
}% |
| 1325 |
{abs/node}% |
| 1326 |
{% |
| 1327 |
\xdef\absnoeudA{#5}% |
| 1328 |
\xdef\absnoeudAn{\xintfloateval{(\absnoeudA-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1329 |
\path #6; |
| 1330 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1331 |
\xdef\tmpstnxB{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1332 |
\xdef\absnoeudB{\xintfloateval{\tmpstnxB/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1333 |
\xdef\absnoeudBn{\tmpstnxB}% |
| 1334 |
}% |
| 1335 |
{noeud/abs}% |
| 1336 |
{% |
| 1337 |
\path #5; |
| 1338 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1339 |
\xdef\tmpstnxA{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1340 |
\xdef\absnoeudA{\xintfloateval{\tmpstnxA/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1341 |
\xdef\absnoeudAn{\tmpstnxA}% |
| 1342 |
\xdef\absnoeudB{#6}% |
| 1343 |
\xdef\absnoeudBn{\xintfloateval{(\absnoeudB-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1344 |
}% |
| 1345 |
{node/abs}% |
| 1346 |
{% |
| 1347 |
\path #5; |
| 1348 |
\pgfgetlastxy{\macrox}{\macroy}% |
| 1349 |
\xdef\tmpstnxA{\xintfloateval{\ConvertirPtToCm{\macrox}}}% |
| 1350 |
\xdef\absnoeudA{\xintfloateval{\tmpstnxA/\pflstlargeur*\pflstampx+\pflstxmin}}% |
| 1351 |
\xdef\absnoeudAn{\tmpstnxA}% |
| 1352 |
\xdef\absnoeudB{#6}% |
| 1353 |
\xdef\absnoeudBn{\xintfloateval{(\absnoeudB-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1354 |
}% |
| 1355 |
}% |
| 1356 |
\IfEq{#4}{0}%aire sous courbe |
| 1357 |
{% |
| 1358 |
\path[draw=none,pflcourbe,name path=tmpintbornea] ({\absnoeudAn},{0})--({\absnoeudAn},{\pflsthauteur}) ; |
| 1359 |
\path[name intersections={of=#3 and tmpintbornea,name=YYY}] ; |
| 1360 |
\path[draw=none,pflcourbe,name path=tmpintborneb] ({\absnoeudBn},{0})--({\absnoeudBn},{\pflsthauteur}) ; |
| 1361 |
\path[name intersections={of=#3 and tmpintborneb,name=ZZZ}] ; |
| 1362 |
\begin{scope} |
| 1363 |
\clip ({\absnoeudAn},{0}) rectangle ({\absnoeudBn},{\pflsthauteur}) ; |
| 1364 |
\filldraw[integraletikzstyle,integralebordtikzstyle,#2] ({\absnoeudAn},{\pflstoy}) [spath/restore=#3] -- ({\absnoeudBn},{\pflstoy}) -- ({\absnoeudAn},{\pflstoy}) ; |
| 1365 |
\end{scope} |
| 1366 |
%traits |
| 1367 |
\draw[\pfldomtikzcolorbord,pfltrait] ({\absnoeudAn},{\pflstoy})-- (YYY-1) ; |
| 1368 |
\draw[\pfldomtikzcolorbord,pfltrait] ({\absnoeudBn},{\pflstoy})-- (ZZZ-1) ; |
| 1369 |
}% |
| 1370 |
{%aire entre deux courbes |
| 1371 |
\begin{scope} |
| 1372 |
\clip ({\absnoeudAn},0) rectangle ({\absnoeudBn},\pflsthauteur) ; |
| 1373 |
\clip ({\absnoeudAn},0) [spath/restore=#3] -- ({\absnoeudBn},{\pflstoy}) -- ({\absnoeudAn},{0}) ; |
| 1374 |
\clip ({\absnoeudAn},\pflsthauteur) [spath/restore=#4] -- (\pflstlargeur,\pflsthauteur) -- ({\absnoeudAn},\pflsthauteur) ; |
| 1375 |
\filldraw[integraletikzstyle,integralebordtikzstyle] ({\absnoeudAn},0) rectangle ({\absnoeudBn},\pflsthauteur) ; |
| 1376 |
\end{scope} |
| 1377 |
\begin{scope} |
| 1378 |
\clip ({\absnoeudAn},0) rectangle ({\absnoeudBn},\pflsthauteur) ; |
| 1379 |
\clip ({\absnoeudAn},\pflsthauteur) [spath/restore=#3] -- ({\absnoeudBn},{\pflsthauteur}) -- ({\absnoeudAn},{\pflsthauteur}) ; |
| 1380 |
\clip ({\absnoeudAn},0) [spath/restore=#4] -- (\pflstlargeur,0) -- ({\absnoeudAn},0) ; |
| 1381 |
\filldraw[integraletikzstyle,integralebordtikzstyle] ({\absnoeudAn},0) rectangle ({\absnoeudBn},\pflsthauteur) ; |
| 1382 |
\end{scope} |
| 1383 |
%traits |
| 1384 |
\path[draw=none,pflcourbe,name path=tmpintbornea] ({\absnoeudAn},{0})--({\absnoeudAn},{\pflsthauteur}) ; |
| 1385 |
\path[name intersections={of=#3 and tmpintbornea,name=YYYA}] ; |
| 1386 |
\path[name intersections={of=#4 and tmpintbornea,name=ZZZA}] ; |
| 1387 |
\path[draw=none,pflcourbe,name path=tmpintborneb] ({\absnoeudBn},{0})--({\absnoeudBn},{\pflsthauteur}) ; |
| 1388 |
\path[name intersections={of=#3 and tmpintborneb,name=YYYB}] ; |
| 1389 |
\path[name intersections={of=#4 and tmpintborneb,name=ZZZB}] ; |
| 1390 |
\draw[\pfldomtikzcolorbord,pfltrait] (YYYA-1)-- (ZZZA-1) ; |
| 1391 |
\draw[\pfldomtikzcolorbord,pfltrait] (YYYB-1)-- (ZZZB-1) ; |
| 1392 |
}% |
| 1393 |
} |
| 1394 |
\NewCommandCopy\tkzGrphIntegrale\tkzGrphDrawIntg |
| 1395 |
\NewCommandCopy\tkzgintg\tkzGrphDrawIntg |
| 1396 |
|
| 1397 |
%====NUAGE DE POINTS |
| 1398 |
\defKV[GraphiqueTikzStatsNuage]{% |
| 1399 |
Couleur=\def\pflstnuagecoul{#1},color=\def\pflstnuagecoul{#1},% |
| 1400 |
Taille=\def\pflstnuagetaille{#1},size=\def\pflstnuagetaille{#1},% |
| 1401 |
Style=\def\pflstnuagesize{#1},style=\def\pflstnuagesize{#1}% |
| 1402 |
} |
| 1403 |
\setKVdefault[GraphiqueTikzStatsNuage]{% |
| 1404 |
Couleur=black,color=black,% |
| 1405 |
Style=o,style=o,% |
| 1406 |
Taille=1.75pt,size=1.75pt% |
| 1407 |
} |
| 1408 |
|
| 1409 |
\NewDocumentCommand\tkzGrphScatterPlot{ O{} m m }{% |
| 1410 |
% #1=clés #2=liste X #3=liste Y |
| 1411 |
\restoreKV[GraphiqueTikzStatsNuage]% |
| 1412 |
\setKV[GraphiqueTikzStatsNuage]{#1}% |
| 1413 |
\setsepchar{,}% |
| 1414 |
\readlist*\pflstnuagex{#2}% |
| 1415 |
\readlist*\pflstnuagey{#3}% |
| 1416 |
\xintFor* ##1 in {\xintSeq{1}{\pflstnuagexlen}} \do{% |
| 1417 |
\itemtomacro\pflstnuagex[##1]\tmpstx% |
| 1418 |
\itemtomacro\pflstnuagey[##1]\tmpsty% |
| 1419 |
\xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1420 |
\xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 1421 |
\filldraw[\pflstnuagecoul] (\tmpstnx,\tmpstny) circle[radius=\pflstnuagetaille] ;% |
| 1422 |
}% |
| 1423 |
} |
| 1424 |
\NewCommandCopy\tkzGrphNuage\tkzGrphScatterPlot |
| 1425 |
\NewCommandCopy\tkzgscatterplt\tkzGrphScatterPlot |
| 1426 |
|
| 1427 |
% %====DIAGRAMME EN BÂTONS |
| 1428 |
% \NewDocumentCommand\TracerDiagBatonsStats{ O{} m }{% |
| 1429 |
% \restoreKV[tkzDiagBatons]% |
| 1430 |
% \setKV[tkzDiagBatons]{#1}% |
| 1431 |
% \setsepchar[.]{,./}% |
| 1432 |
% \readlist*\pflstbatdata{#2}% |
| 1433 |
% \setsepchar{,}% |
| 1434 |
% \readlist*\pflstbatlistcoul{\tkzDiagBatCouleurs}% |
| 1435 |
% \xintFor* ##1 in {\xintSeq{1}{\pflstbatdatalen}} \do{% |
| 1436 |
% \itemtomacro\pflstbatdata[##1,1]\tmpstx% |
| 1437 |
% \itemtomacro\pflstbatdata[##1,2]\tmpsty% |
| 1438 |
% \itemcycltomacro\pflstbatlistcoul[##1]\tkzDiagBatCoulCour% |
| 1439 |
% \xdef\tmpstnx{\xintfloateval{(\tmpstx-\pflstxmin)/\pflstampx*\pflstlargeur}}% |
| 1440 |
% \xdef\tmpstny{\xintfloateval{(\tmpsty-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 1441 |
% \IfStrEq{\tkzDiagBatStyle}{batons}% |
| 1442 |
% {\draw[pflbarresprobas,\tkzDiagBatCoulCour] (\tmpstnx,\pflstoy) -- (\tmpstnx,\tmpstny) ;}% |
| 1443 |
% {% |
| 1444 |
% \xdef\tmpstdemi{\xintfloateval{\tkzDiagBatLargeur/2*\pflstlargeur/\pflstampx}}% |
| 1445 |
% \draw[pfltrait,\tkzDiagBatCoulCour,fill=\tkzDiagBatCoulCour,fill opacity=0.5] |
| 1446 |
% ({\tmpstnx-\tmpstdemi},\pflstoy) rectangle++ ({2*\tmpstdemi},{\tmpstny-\pflstoy}) ;% |
| 1447 |
% }% |
| 1448 |
% \ifboolKV[tkzDiagBatons]{AffValeurs}% |
| 1449 |
% {\node[above,\tkzDiagBatColVal,font=\tkzDiagBatPolice] at (\tmpstnx,\tmpstny) |
| 1450 |
% {\ArrondirNum[\tkzDiagBatArrondi]{\tmpsty}} ;}% |
| 1451 |
% {}% |
| 1452 |
% }% |
| 1453 |
% } |
| 1454 |
|
| 1455 |
%====RÉGRESSION LINÉAIRE |
| 1456 |
\NewDocumentCommand\tkzGrphDrawRegLin{ O{} m m }{% |
| 1457 |
\setsepchar{,}% |
| 1458 |
\readlist*\pflstregx{#2}% |
| 1459 |
\readlist*\pflstregy{#3}% |
| 1460 |
\xdef\pflstnreg{\pflstregxlen}% |
| 1461 |
\xdef\pflstxsom{0}\xdef\pflstysom{0}% |
| 1462 |
\xintFor* ##1 in {\xintSeq{1}{\pflstnreg}} \do{% |
| 1463 |
\itemtomacro\pflstregx[##1]\tmpx% |
| 1464 |
\itemtomacro\pflstregy[##1]\tmpy% |
| 1465 |
\xdef\pflstxsom{\xintfloateval{\pflstxsom+\tmpx}}% |
| 1466 |
\xdef\pflstysom{\xintfloateval{\pflstysom+\tmpy}}% |
| 1467 |
}% |
| 1468 |
\xdef\pflstxmoy{\xintfloateval{\pflstxsom/\pflstnreg}}% |
| 1469 |
\xdef\pflstymoy{\xintfloateval{\pflstysom/\pflstnreg}}% |
| 1470 |
\xdef\pflstxvar{0}\xdef\pflstxyvar{0}% |
| 1471 |
\xintFor* ##1 in {\xintSeq{1}{\pflstnreg}} \do{% |
| 1472 |
\itemtomacro\pflstregx[##1]\tmpx% |
| 1473 |
\itemtomacro\pflstregy[##1]\tmpy% |
| 1474 |
\xdef\pflstxvar{\xintfloateval{\pflstxvar+(\tmpx-\pflstxmoy)^2}}% |
| 1475 |
\xdef\pflstxyvar{\xintfloateval{\pflstxyvar+(\tmpx-\pflstxmoy)*(\tmpy-\pflstymoy)}}% |
| 1476 |
}% |
| 1477 |
\xdef\pflstrega{\xintfloateval{\pflstxyvar/\pflstxvar}}% |
| 1478 |
\xdef\pflstregb{\xintfloateval{\pflstymoy-\pflstrega*\pflstxmoy}}% |
| 1479 |
% tracé normalisé |
| 1480 |
\xdef\tmpstnya{\xintfloateval{(\pflstrega*\pflstxmin+\pflstregb-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 1481 |
\xdef\tmpstnyb{\xintfloateval{(\pflstrega*\pflstxmax+\pflstregb-\pflstymin)/\pflstampy*\pflsthauteur}}% |
| 1482 |
\draw[pflcourbe,#1] (0,\tmpstnya) -- (\pflstlargeur,\tmpstnyb) ;% |
| 1483 |
} |
| 1484 |
\NewCommandCopy\tkzGrphRegLin\tkzGrphDrawRegLin |
| 1485 |
\NewCommandCopy\tkzgreglin\tkzGrphDrawRegLin |
| 1486 |
|
| 1487 |
%====TROUVER MAXIMUM / MINIMUM LOCAL OU GLOBAL |
| 1488 |
%====TROUVER MAXIMUM / MINIMUM via échantillonnage spath |
| 1489 |
\defKV[GraphiqueTikzStatsMinMax]{% |
| 1490 |
Debut=\def\pflstminmaxdebut{#1},start=\def\pflstminmaxdebut{#1},% |
| 1491 |
Fin=\def\pflstminmaxfin{#1},end=\def\pflstminmaxfin{#1},% |
| 1492 |
Pas=\def\pflstminmaxpas{#1},step=\def\pflstminmaxpas{#1},% |
| 1493 |
Couleur=\def\pflstminmaxcol{#1},color=\def\pflstminmaxcol{#1},% |
| 1494 |
Style=\def\pflstminmaxstyle{#1},style=\def\pflstminmaxstyle{#1}% |
| 1495 |
} |
| 1496 |
\setKVdefault[GraphiqueTikzStatsMinMax]{% |
| 1497 |
Debut={},start={},% |
| 1498 |
Fin={},end={},% |
| 1499 |
Pas=500,step=500,% |
| 1500 |
Aff=true,show=true,% |
| 1501 |
Couleur=black,color=black,% |
| 1502 |
Style=o,style=o |
| 1503 |
} |
| 1504 |
|
| 1505 |
\NewDocumentCommand\tkzGrphFindMin{ O{} m O{grph-min} }{% |
| 1506 |
% #1=clés #2=nom path #3=nœud résultat |
| 1507 |
\restoreKV[GraphiqueTikzStatsMinMax]% |
| 1508 |
\setKV[GraphiqueTikzStatsMinMax]{#1}% |
| 1509 |
% sync KV |
| 1510 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsMinMax]{show}{Aff}% |
| 1511 |
% bornes normalisées |
| 1512 |
\IfStrEq{\pflstminmaxdebut}{}% |
| 1513 |
{\xdef\tmpstnxa{0}}% |
| 1514 |
{\xdef\tmpstnxa{\xintfloateval{(\pflstminmaxdebut-\pflstxmin)/\pflstampx*\pflstlargeur}}}% |
| 1515 |
\IfStrEq{\pflstminmaxfin}{}% |
| 1516 |
{\xdef\tmpstnxb{\pflstlargeur}}% |
| 1517 |
{\xdef\tmpstnxb{\xintfloateval{(\pflstminmaxfin-\pflstxmin)/\pflstampx*\pflstlargeur}}}% |
| 1518 |
% pas d'échantillonnage t ∈ [0,1] |
| 1519 |
\xdef\pflstminmaxdt{\xintfloateval{1/\pflstminmaxpas}}% |
| 1520 |
% initialisation |
| 1521 |
\xdef\pflstminy{\pflsthauteur}% |
| 1522 |
\xdef\pflstminx{0}% |
| 1523 |
% échantillonnage via spath cs: |
| 1524 |
\xintFor* ##1 in {\xintSeq{0}{\pflstminmaxpas}} \do{% |
| 1525 |
\xdef\tmpt{\xintfloateval{##1*\pflstminmaxdt}}% |
| 1526 |
% coordonnée du point à t=\tmpt sur le path |
| 1527 |
\path (spath cs:#2 \tmpt) ;% |
| 1528 |
\pgfgetlastxy{\tmpspx}{\tmpspy}% |
| 1529 |
\xdef\tmpcurx{\xintfloateval{\ConvertirPtToCm{\tmpspx}}}% |
| 1530 |
\xdef\tmpcury{\xintfloateval{\ConvertirPtToCm{\tmpspy}}}% |
| 1531 |
% filtrer selon les bornes x |
| 1532 |
\xintifboolexpr{% |
| 1533 |
\tmpcurx >= \tmpstnxa 'and' |
| 1534 |
\tmpcurx <= \tmpstnxb 'and' |
| 1535 |
\tmpcury < \pflstminy}% |
| 1536 |
{% |
| 1537 |
\xdef\pflstminy{\tmpcury}% |
| 1538 |
\xdef\pflstminx{\tmpcurx}% |
| 1539 |
}{}% |
| 1540 |
}% |
| 1541 |
\coordinate (#3) at (\pflstminx,\pflstminy) ;% |
| 1542 |
\ifboolKV[GraphiqueTikzStatsMinMax]{Aff}% |
| 1543 |
{% |
| 1544 |
\tkzGrphMarkPts*[Style=\pflstminmaxstyle,Couleur=\pflstminmaxcol]{(#3)} |
| 1545 |
}% |
| 1546 |
{}% |
| 1547 |
} |
| 1548 |
\NewCommandCopy\tkzGrphTrouverMin\tkzGrphFindMin |
| 1549 |
|
| 1550 |
\NewDocumentCommand\tkzGrphFindMax{ O{} m O{grph-max} }{% |
| 1551 |
% #1=clés #2=nom path #3=nœud résultat |
| 1552 |
\restoreKV[GraphiqueTikzStatsMinMax]% |
| 1553 |
\setKV[GraphiqueTikzStatsMinMax]{#1}% |
| 1554 |
% sync KV |
| 1555 |
\tkzgrphSetKVboolTrue[GraphiqueTikzStatsMinMax]{show}{Aff}% |
| 1556 |
% bornes normalisées |
| 1557 |
\IfStrEq{\pflstminmaxdebut}{}% |
| 1558 |
{\xdef\tmpstnxa{0}}% |
| 1559 |
{\xdef\tmpstnxa{\xintfloateval{(\pflstminmaxdebut-\pflstxmin)/\pflstampx*\pflstlargeur}}}% |
| 1560 |
\IfStrEq{\pflstminmaxfin}{}% |
| 1561 |
{\xdef\tmpstnxb{\pflstlargeur}}% |
| 1562 |
{\xdef\tmpstnxb{\xintfloateval{(\pflstminmaxfin-\pflstxmin)/\pflstampx*\pflstlargeur}}}% |
| 1563 |
\xdef\pflstminmaxdt{\xintfloateval{1/\pflstminmaxpas}}% |
| 1564 |
% initialisation |
| 1565 |
\xdef\pflstmaxy{0}% |
| 1566 |
\xdef\pflstmaxx{0}% |
| 1567 |
\xintFor* ##1 in {\xintSeq{0}{\pflstminmaxpas}} \do{% |
| 1568 |
\xdef\tmpt{\xintfloateval{##1*\pflstminmaxdt}}% |
| 1569 |
\path (spath cs:#2 \tmpt) ;% |
| 1570 |
\pgfgetlastxy{\tmpspx}{\tmpspy}% |
| 1571 |
\xdef\tmpcurx{\xintfloateval{\ConvertirPtToCm{\tmpspx}}}% |
| 1572 |
\xdef\tmpcury{\xintfloateval{\ConvertirPtToCm{\tmpspy}}}% |
| 1573 |
\xintifboolexpr{% |
| 1574 |
\tmpcurx >= \tmpstnxa 'and' |
| 1575 |
\tmpcurx <= \tmpstnxb 'and' |
| 1576 |
\tmpcury > \pflstmaxy}% |
| 1577 |
{% |
| 1578 |
\xdef\pflstmaxy{\tmpcury}% |
| 1579 |
\xdef\pflstmaxx{\tmpcurx}% |
| 1580 |
}{}% |
| 1581 |
}% |
| 1582 |
\coordinate (#3) at (\pflstmaxx,\pflstmaxy) ;% |
| 1583 |
\ifboolKV[GraphiqueTikzStatsMinMax]{Aff}% |
| 1584 |
{% |
| 1585 |
\tkzGrphMarkPts*[Style=\pflstminmaxstyle,Couleur=\pflstminmaxcol]{(#3)} |
| 1586 |
}% |
| 1587 |
{}% |
| 1588 |
} |
| 1589 |
\NewCommandCopy\tkzGrphTrouverMax\tkzGrphFindMax |
| 1590 |
|
| 1591 |
\endinput |