| 1 |
%-------------------------------------------- |
| 2 |
% |
| 3 |
% Package pgfplots, library for statistical plots (boxplots in the first version) |
| 4 |
% |
| 5 |
% Copyright 2007-2012 by Christian Feuersänger. |
| 6 |
% |
| 7 |
% This program is free software: you can redistribute it and/or modify |
| 8 |
% it under the terms of the GNU General Public License as published by |
| 9 |
% the Free Software Foundation, either version 3 of the License, or |
| 10 |
% (at your option) any later version. |
| 11 |
% |
| 12 |
% This program is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
% GNU General Public License for more details. |
| 16 |
% |
| 17 |
% You should have received a copy of the GNU General Public License |
| 18 |
% along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
% |
| 20 |
%-------------------------------------------- |
| 21 |
|
| 22 |
\catcode`\;=12 |
| 23 |
\catcode`\"=12 |
| 24 |
\newif\ifpgfplotsplothandlerboxplot@variable@width |
| 25 |
|
| 26 |
\ifpgfplots@LUA@supported |
| 27 |
\pgfplotsutil@directlua{require("pgfplots.statistics")}% |
| 28 |
\fi |
| 29 |
|
| 30 |
\newif\ifpgfplots@boxplot@ensure@plot@mark |
| 31 |
\def\pgfplots@boxplot@ensure@plot@mark{% |
| 32 |
\ifpgfplots@boxplot@ensure@plot@mark |
| 33 |
\pgfplots@if@has@plot@marks{}{% |
| 34 |
\tikzset{mark=*}% |
| 35 |
}% |
| 36 |
\fi |
| 37 |
}% |
| 38 |
|
| 39 |
\pgfplotsset{ |
| 40 |
boxplot/.code={% |
| 41 |
\def\tikz@plot@handler{\pgfplotsplothandlerboxplot}% |
| 42 |
\pgfplotsset{% |
| 43 |
/pgfplots/every boxplot, |
| 44 |
/pgfplots/boxplot/.cd,% |
| 45 |
#1% |
| 46 |
}% |
| 47 |
\pgfplots@boxplot@ensure@plot@mark |
| 48 |
}, |
| 49 |
boxplot prepared/.code={% |
| 50 |
\def\tikz@plot@handler{\pgfplotsplothandlerboxplotprepared}% |
| 51 |
\pgfplotsset{% |
| 52 |
/pgfplots/every boxplot, |
| 53 |
/pgfplots/boxplot/.cd,% |
| 54 |
#1% |
| 55 |
}% |
| 56 |
\pgfplots@boxplot@ensure@plot@mark |
| 57 |
}, |
| 58 |
boxplot/data value/.code =\pgfplots@set@source@for{boxplot/data}{#1}{0},% |
| 59 |
boxplot/data/.code =\pgfplots@set@source@for{boxplot/data}{#1}{1},% |
| 60 |
boxplot/data filter/.code=, |
| 61 |
boxplot/data value=\pgfkeysvalueof{/data point/y}, |
| 62 |
% |
| 63 |
every boxplot/.style={% |
| 64 |
}, |
| 65 |
% |
| 66 |
% 'auto' means "if possible". |
| 67 |
% For boxplot prepared, this is equivalent to "disabled" (empty value). |
| 68 |
% For boxplot, it means "compute it". |
| 69 |
% Empty value means disabled. |
| 70 |
boxplot/median/.initial=auto, |
| 71 |
boxplot/lower quartile/.initial=auto, |
| 72 |
boxplot/upper quartile/.initial=auto, |
| 73 |
boxplot/lower whisker/.initial=auto, |
| 74 |
boxplot/upper whisker/.initial=auto, |
| 75 |
boxplot/average/.initial=, |
| 76 |
% |
| 77 |
% mainly used for compatibility. |
| 78 |
boxplot/ensure mark/.is if=pgfplots@boxplot@ensure@plot@mark, |
| 79 |
% |
| 80 |
boxplot/estimator/.is choice, |
| 81 |
boxplot/estimator/legacy/.code={\def\pgfplots@boxplot@estimator{legacy}}, |
| 82 |
% |
| 83 |
boxplot/estimator/legacy*/.code={\def\pgfplots@boxplot@estimator{legacy*}}, |
| 84 |
boxplot/estimator/R1/.code={\def\pgfplots@boxplot@estimator{R1}}, |
| 85 |
boxplot/estimator/SAS3/.code={\def\pgfplots@boxplot@estimator{R1}}, |
| 86 |
boxplot/estimator/Maple1/.code={\def\pgfplots@boxplot@estimator{R1}}, |
| 87 |
% |
| 88 |
boxplot/estimator/R2/.code={\def\pgfplots@boxplot@estimator{R2}}, |
| 89 |
boxplot/estimator/SAS5/.code={\def\pgfplots@boxplot@estimator{R2}}, |
| 90 |
boxplot/estimator/Maple2/.code={\def\pgfplots@boxplot@estimator{R2}}, |
| 91 |
% |
| 92 |
boxplot/estimator/R3/.code={\def\pgfplots@boxplot@estimator{R3}}, |
| 93 |
boxplot/estimator/SAS2/.code={\def\pgfplots@boxplot@estimator{R3}}, |
| 94 |
% |
| 95 |
boxplot/estimator/R4/.code={\def\pgfplots@boxplot@estimator{R4}}, |
| 96 |
boxplot/estimator/SAS1/.code={\def\pgfplots@boxplot@estimator{R4}}, |
| 97 |
boxplot/estimator/SciPy0-1/.code={\def\pgfplots@boxplot@estimator{R4}}, |
| 98 |
boxplot/estimator/Maple3/.code={\def\pgfplots@boxplot@estimator{R4}}, |
| 99 |
% |
| 100 |
boxplot/estimator/R5/.code={\def\pgfplots@boxplot@estimator{R5}}, |
| 101 |
boxplot/estimator/SciPy12-12/.code={\def\pgfplots@boxplot@estimator{R5}}, |
| 102 |
boxplot/estimator/Maple4/.code={\def\pgfplots@boxplot@estimator{R5}}, |
| 103 |
% |
| 104 |
boxplot/estimator/R6/.code={\def\pgfplots@boxplot@estimator{R6}}, |
| 105 |
boxplot/estimator/SAS4/.code={\def\pgfplots@boxplot@estimator{R6}}, |
| 106 |
boxplot/estimator/SciPy0-0/.code={\def\pgfplots@boxplot@estimator{R6}}, |
| 107 |
boxplot/estimator/Maple5/.code={\def\pgfplots@boxplot@estimator{R6}}, |
| 108 |
% |
| 109 |
boxplot/estimator/R7/.code={\def\pgfplots@boxplot@estimator{R7}}, |
| 110 |
boxplot/estimator/Excel/.code={\def\pgfplots@boxplot@estimator{R7}}, |
| 111 |
boxplot/estimator/SciPy1-1/.code={\def\pgfplots@boxplot@estimator{R7}}, |
| 112 |
boxplot/estimator/Maple6/.code={\def\pgfplots@boxplot@estimator{R7}}, |
| 113 |
% |
| 114 |
boxplot/estimator/R8/.code={\def\pgfplots@boxplot@estimator{R8}}, |
| 115 |
boxplot/estimator/SciPy13-13/.code={\def\pgfplots@boxplot@estimator{R8}}, |
| 116 |
boxplot/estimator/Maple7/.code={\def\pgfplots@boxplot@estimator{R8}}, |
| 117 |
% |
| 118 |
boxplot/estimator/R9/.code={\def\pgfplots@boxplot@estimator{R9}}, |
| 119 |
boxplot/estimator/SciPy38-38/.code={\def\pgfplots@boxplot@estimator{R9}}, |
| 120 |
boxplot/estimator/Maple8/.code={\def\pgfplots@boxplot@estimator{R9}}, |
| 121 |
% |
| 122 |
boxplot/estimator=legacy, |
| 123 |
% |
| 124 |
boxplot/lower quartile off/.initial=0.25, |
| 125 |
boxplot/upper quartile off/.initial=0.75, |
| 126 |
boxplot/whisker range/.initial=1.5, |
| 127 |
% |
| 128 |
% |
| 129 |
% the size of whisker lines in axis units. |
| 130 |
% The default is to make it relative to 'box extend' |
| 131 |
boxplot/whisker extend/.initial=\pgfkeysvalueof{/pgfplots/boxplot/box extend}*0.8, |
| 132 |
% |
| 133 |
% the size of the box in axis units. Note that this has been |
| 134 |
% chosen to fit the initial 'draw position': |
| 135 |
boxplot/box extend/.initial=0.8, |
| 136 |
% draw direction=x|y |
| 137 |
boxplot/draw direction/.initial=x, |
| 138 |
% |
| 139 |
% Activates "dynamic size" feature |
| 140 |
boxplot/variable width/.is if=pgfplotsplothandlerboxplot@variable@width, |
| 141 |
boxplot/variable width/.default=true, |
| 142 |
% |
| 143 |
boxplot/sample size/.initial=auto, |
| 144 |
% |
| 145 |
% a transformation which is applied to anything related to |
| 146 |
% sample size. |
| 147 |
boxplot/variable width expr/.code=\pgfmathparse{sqrt(#1)}, |
| 148 |
% |
| 149 |
% will be computed automatically if needed. If it is present, it |
| 150 |
% will not contribute to the axis-wide limit unless it has been |
| 151 |
% given axis-wide. |
| 152 |
boxplot/sample size min/.initial=, |
| 153 |
boxplot/sample size max/.initial=, |
| 154 |
% |
| 155 |
% this factor times 'box extend' is the size for |
| 156 |
% 'sample size min'. The max value gets 'box extend'. |
| 157 |
boxplot/variable width min target/.initial=0.2, |
| 158 |
% |
| 159 |
% |
| 160 |
% defines where how the "free" position is chosen. The idea is to |
| 161 |
% place one box at each "y" position and to number these |
| 162 |
% 1,2,3,4,... . This should probably simplify tick (label) generation. |
| 163 |
boxplot/draw position/.initial=1+\plotnumofactualtype, |
| 164 |
% |
| 165 |
% draw relative anchor=0: |
| 166 |
% | |---| | |
| 167 |
% | | | | |
| 168 |
% |----|---|--| |
| 169 |
% |
| 170 |
% draw relative anchor=0.5: |
| 171 |
% | |---| | |
| 172 |
% |----| |--| |
| 173 |
% | |---| | |
| 174 |
% |
| 175 |
% draw relative anchor=1: |
| 176 |
% |----|---|--| |
| 177 |
% | | | | |
| 178 |
% | |---| | |
| 179 |
boxplot/draw relative anchor/.initial=0.5, |
| 180 |
% |
| 181 |
boxplot/every whisker/.style={% |
| 182 |
}, |
| 183 |
boxplot/every box/.style={% |
| 184 |
}, |
| 185 |
boxplot/every median/.style={% |
| 186 |
}, |
| 187 |
boxplot/every average/.style={% |
| 188 |
/tikz/mark=diamond*, |
| 189 |
}, |
| 190 |
boxplot/draw/lower whisker/.style={% |
| 191 |
/pgfplots/boxplot/draw/whisker=% |
| 192 |
{\pgfplotsboxplotvalue{lower quartile}} |
| 193 |
{\pgfplotsboxplotvalue{lower whisker}} |
| 194 |
}, |
| 195 |
boxplot/draw/upper whisker/.style={% |
| 196 |
/pgfplots/boxplot/draw/whisker=% |
| 197 |
{\pgfplotsboxplotvalue{upper quartile}} |
| 198 |
{\pgfplotsboxplotvalue{upper whisker}}% |
| 199 |
}, |
| 200 |
boxplot/draw/whisker/.code 2 args={% |
| 201 |
\draw[/pgfplots/boxplot/every whisker/.try] |
| 202 |
(boxplot cs:#1) -- (boxplot cs:#2) |
| 203 |
(boxplot whisker cs:#2,0) |
| 204 |
-- |
| 205 |
(boxplot whisker cs:#2,1) |
| 206 |
; |
| 207 |
},% |
| 208 |
% |
| 209 |
boxplot/draw/box/.code={% |
| 210 |
\draw[/pgfplots/boxplot/every box/.try] |
| 211 |
(boxplot box cs:\pgfplotsboxplotvalue{lower quartile},0) |
| 212 |
rectangle |
| 213 |
(boxplot box cs:\pgfplotsboxplotvalue{upper quartile},1) |
| 214 |
; |
| 215 |
},% |
| 216 |
% |
| 217 |
boxplot/draw/average/.code={% |
| 218 |
\draw[/pgfplots/boxplot/every average/.try] |
| 219 |
\pgfextra |
| 220 |
% do NOT use \draw[mark=*] plot coordinates because |
| 221 |
% boxplots uses the same plot handler to draw its |
| 222 |
% outliers. |
| 223 |
\pgftransformshift{% |
| 224 |
\pgfplotsboxplotpointabbox |
| 225 |
{\pgfplotsboxplotvalue{average}} |
| 226 |
{0.5}% |
| 227 |
}% |
| 228 |
\pgfuseplotmark{\tikz@plot@mark}% |
| 229 |
\endpgfextra |
| 230 |
; |
| 231 |
}, |
| 232 |
% |
| 233 |
boxplot/draw/median/.code={% |
| 234 |
\draw[/pgfplots/boxplot/every median/.try] |
| 235 |
(boxplot box cs:\pgfplotsboxplotvalue{median},0) |
| 236 |
-- |
| 237 |
(boxplot box cs:\pgfplotsboxplotvalue{median},1) |
| 238 |
; |
| 239 |
},% |
| 240 |
} |
| 241 |
|
| 242 |
|
| 243 |
\def\pgfplotsplothandlerboxplot{% |
| 244 |
\pgfplotsresetplothandler |
| 245 |
\def\pgf@plotstreamstart{% |
| 246 |
\pgfplotsset{/pgfplots/boxplot prepared}% |
| 247 |
\pgfplotsresetplothandler |
| 248 |
\tikz@plot@handler |
| 249 |
\pgf@plotstreamstart |
| 250 |
}% |
| 251 |
\def\pgfplotsplothandlername{boxplot}% |
| 252 |
\let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@boxplot |
| 253 |
\let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@boxplot |
| 254 |
\let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@boxplot |
| 255 |
\def\pgfplotsplothandlerLUAfactory{% |
| 256 |
function(axis, pointmetainputhandler) |
| 257 |
return pgfplots.BoxPlotPlothandler.new( |
| 258 |
pgfplots.BoxPlotRequest.new( |
| 259 |
"\pgfkeysvalueof{/pgfplots/boxplot/lower quartile off}", |
| 260 |
"\pgfkeysvalueof{/pgfplots/boxplot/upper quartile off}", |
| 261 |
"\pgfkeysvalueof{/pgfplots/boxplot/whisker range}", |
| 262 |
pgfplots.getPercentileEstimator("\pgfplots@boxplot@estimator")), |
| 263 |
"\pgfkeysvalueof{/pgfplots/boxplot/draw direction}", |
| 264 |
"\pgfkeysvalueof{/pgfplots/boxplot/draw position}", |
| 265 |
axis, pointmetainputhandler) |
| 266 |
end |
| 267 |
}% |
| 268 |
} |
| 269 |
|
| 270 |
|
| 271 |
\def\pgfplotsplothandlersurveystart@boxplot{% |
| 272 |
\pgfplots@prepare@source@parser@for{boxplot/}{data}{\pgfplotsplothandlerboxplot@parse}% |
| 273 |
% |
| 274 |
\pgfplotscoordmath{float}{zero}% |
| 275 |
\let\pgfplotsplothandlerboxplot@sum=\pgfmathresult |
| 276 |
% |
| 277 |
\pgfplotscoordmath{float}{min limit}% |
| 278 |
\let\pgfplotsplothandlerboxplot@last=\pgfmathresult |
| 279 |
% |
| 280 |
\def\b@pgfplotsplothandlerboxplot@issorted{1}% |
| 281 |
% |
| 282 |
\pgfplotsarraynewempty\pgfp@boxplot@@ |
| 283 |
\def\c@pgfplotsplothandlerboxplot@num{0}% |
| 284 |
\c@pgfplots@coordindex=0 |
| 285 |
}% |
| 286 |
|
| 287 |
\def\pgfplotsplothandlersurveyend@boxplot{% |
| 288 |
\pgfplots@curplot@threedimfalse |
| 289 |
% |
| 290 |
\ifpgfplots@LUA@backend@supported |
| 291 |
\else |
| 292 |
\if0\b@pgfplotsplothandlerboxplot@issorted |
| 293 |
\pgfplotsplothandlersurveyend@boxplot@sort |
| 294 |
\fi |
| 295 |
\fi |
| 296 |
% |
| 297 |
% |
| 298 |
\edef\numcoords{\pgfplots@current@point@coordindex}% |
| 299 |
% |
| 300 |
%% |
| 301 |
\pgfplotsset{% |
| 302 |
/pgfplots/boxplot prepared={% |
| 303 |
data value=\pgfplots@current@point@data, |
| 304 |
},% |
| 305 |
}% |
| 306 |
\pgfplotsresetplothandler |
| 307 |
% |
| 308 |
\let\pgfplotsplothandlerboxplotprepared@normalize@values@@=\pgfplotsplothandlerboxplotprepared@normalize@values |
| 309 |
\def\pgfplotsplothandlerboxplotprepared@normalize@values{\relax}% |
| 310 |
% |
| 311 |
\tikz@plot@handler |
| 312 |
% |
| 313 |
\pgfplotsplothandlersurveystart |
| 314 |
% |
| 315 |
\ifpgfplots@LUA@backend@supported |
| 316 |
\else |
| 317 |
% this will report outliers as point stream: |
| 318 |
\pgfplotsplothandlersurveyend@boxplot@computestats |
| 319 |
\fi |
| 320 |
% |
| 321 |
\let\pgfplotsplothandlerboxplotprepared@normalize@values=\pgfplotsplothandlerboxplotprepared@normalize@values@@ |
| 322 |
\pgfplotsplothandlerboxplotprepared@normalize@values |
| 323 |
% |
| 324 |
% |
| 325 |
\pgfplotsplothandlersurveyend |
| 326 |
}% |
| 327 |
|
| 328 |
\def\pgfplotsplothandlersurveyend@boxplot@sort{% |
| 329 |
\pgfkeys{/pgfplots/float <}% |
| 330 |
\pgfplotsarraysort{\pgfp@boxplot@@}% |
| 331 |
}% |
| 332 |
|
| 333 |
\def\pgfplots@boxplot@fillarray{% |
| 334 |
\def\pgfplots@loc@TMPa{\pgfplotsarrayset\c@pgfplots@coordindex\of{P}\to}% |
| 335 |
\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@current@point@data}% |
| 336 |
} |
| 337 |
|
| 338 |
%%%% |
| 339 |
|
| 340 |
\def\pgfplotsplothandler@boxplot@init@percentile@estimator{% |
| 341 |
\def\pgfplots@loc@TMPb{legacy}% |
| 342 |
\ifx\pgfplots@loc@TMPb\pgfplots@boxplot@estimator |
| 343 |
\let\pgfplotsplothandler@boxplot@percentile@estimator@=\pgfplotsplothandler@boxplot@percentile@estimator@legacy |
| 344 |
\else |
| 345 |
\def\pgfplots@loc@TMPb{legacy*}% |
| 346 |
\ifx\pgfplots@loc@TMPb\pgfplots@boxplot@estimator |
| 347 |
\let\pgfplotsplothandler@boxplot@percentile@estimator@=\pgfplotsplothandler@boxplot@percentile@estimator@legacy@bad |
| 348 |
\else |
| 349 |
% first, strip 'R' and store the integer number into \pgfplotsretval: |
| 350 |
\def\pgfplots@loc@TMPb##1##2{% |
| 351 |
\def\pgfplotsretval{##2}% |
| 352 |
}% |
| 353 |
\expandafter\pgfplots@loc@TMPb\pgfplots@boxplot@estimator |
| 354 |
\ifcase\pgfplotsretval\relax |
| 355 |
% 0: |
| 356 |
\pgfplots@error{illegal argument 'estimator=\pgfplots@boxplot@estimator' encountered.}% |
| 357 |
\or |
| 358 |
% R1: |
| 359 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 360 |
\pgfmathparse{##1*##2}% |
| 361 |
\let\h=\pgfmathresult |
| 362 |
\pgfmathparse{ceil(\h)}% |
| 363 |
\pgfmathfloattoint\pgfmathresult |
| 364 |
\let\offset@low=\pgfmathresult |
| 365 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@low}{##2}% |
| 366 |
} |
| 367 |
% FIXME : implement 'ceil' in the FPU! |
| 368 |
\pgfplots@error{The argument 'estimator=\pgfplots@boxplot@estimator' is only available in conjunction with 'lua backend' and lualatex.}% |
| 369 |
\or |
| 370 |
% R2: |
| 371 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 372 |
\pgfmathparse{##1*##2 + 0.5}% |
| 373 |
\let\h=\pgfmathresult |
| 374 |
% |
| 375 |
\pgfmathparse{ceil(\h-0.5)}% |
| 376 |
\pgfmathfloattoint\pgfmathresult |
| 377 |
\let\offset@low=\pgfmathresult |
| 378 |
% |
| 379 |
\pgfmathparse{floor(\h+0.5)}% |
| 380 |
\pgfmathfloattoint\pgfmathresult |
| 381 |
\let\offset@high=\pgfmathresult |
| 382 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@low}{##2}% |
| 383 |
\let\x@low=\pgfmathresult |
| 384 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@high}{##2}% |
| 385 |
\let\x@high=\pgfmathresult |
| 386 |
\pgfmathparse{0.5*(\x@low + \x@high)}% |
| 387 |
} |
| 388 |
% FIXME : implement 'ceil' in the FPU! |
| 389 |
\pgfplots@error{The argument 'estimator=\pgfplots@boxplot@estimator' is only available in conjunction with 'lua backend' and lualatex.}% |
| 390 |
\or |
| 391 |
% R3: |
| 392 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 393 |
\pgfmathparse{##1*##2}% |
| 394 |
\let\h=\pgfmathresult |
| 395 |
\pgfmathparse{round(\h)}% |
| 396 |
\pgfmathfloattoint\pgfmathresult |
| 397 |
\let\offset@low=\pgfmathresult |
| 398 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@low}{##2}% |
| 399 |
} |
| 400 |
\or |
| 401 |
% R4: |
| 402 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 403 |
\pgfmathparse{##1*##2}% |
| 404 |
\let\h=\pgfmathresult |
| 405 |
\pgfplotsplothandler@boxplot@percentile@estimator@std@lookup{##2}% |
| 406 |
} |
| 407 |
\or |
| 408 |
% R5: |
| 409 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 410 |
\pgfmathparse{##1*##2 + 0.5}% |
| 411 |
\let\h=\pgfmathresult |
| 412 |
\pgfplotsplothandler@boxplot@percentile@estimator@std@lookup{##2}% |
| 413 |
} |
| 414 |
\or |
| 415 |
% R6: |
| 416 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 417 |
\pgfmathparse{##1*(##2+1)}% |
| 418 |
\let\h=\pgfmathresult |
| 419 |
\pgfplotsplothandler@boxplot@percentile@estimator@std@lookup{##2}% |
| 420 |
} |
| 421 |
\or |
| 422 |
% R7: |
| 423 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 424 |
\pgfmathparse{(##2-1) * ##1 + 1}% |
| 425 |
\let\h=\pgfmathresult |
| 426 |
\pgfplotsplothandler@boxplot@percentile@estimator@std@lookup{##2}% |
| 427 |
} |
| 428 |
\or |
| 429 |
% R8: |
| 430 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 431 |
\pgfmathparse{(##2 + 1/3) * ##1 + 1/3}% |
| 432 |
\let\h=\pgfmathresult |
| 433 |
\pgfplotsplothandler@boxplot@percentile@estimator@std@lookup{##2}% |
| 434 |
} |
| 435 |
\or |
| 436 |
% R9: |
| 437 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@##1##2{% |
| 438 |
\pgfmathparse{(##2 + 1/4) * ##1 + 3/8}% |
| 439 |
\let\h=\pgfmathresult |
| 440 |
\pgfplotsplothandler@boxplot@percentile@estimator@std@lookup{##2}% |
| 441 |
} |
| 442 |
\else |
| 443 |
\pgfplots@error{illegal argument 'estimator=\pgfplots@boxplot@estimator' encountered.}% |
| 444 |
\fi |
| 445 |
\fi |
| 446 |
\fi |
| 447 |
}% |
| 448 |
|
| 449 |
% #1: the percentile in question (like 0.5 for the median) |
| 450 |
% #2: the number of data points in the array \pgfp@boxplot@@ |
| 451 |
% POSTCONDITION: \pgfmathresult contains the result. |
| 452 |
\def\pgfplotsplothandler@boxplot@percentile@estimator#1#2{% |
| 453 |
\begingroup |
| 454 |
\pgfkeys{/pgf/fpu}% |
| 455 |
\pgfplotsplothandler@boxplot@percentile@estimator@{#1}{#2}% |
| 456 |
\pgfmath@smuggleone\pgfmathresult |
| 457 |
\endgroup |
| 458 |
}% |
| 459 |
|
| 460 |
% #1: the index |
| 461 |
% #2: the number of data points in the array \pgfp@boxplot@@ |
| 462 |
% |
| 463 |
% POSTCONDITION: \pgfmathresult contains the result. |
| 464 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@getIndex#1#2{% |
| 465 |
\c@pgf@countd=#1\relax |
| 466 |
\advance\c@pgf@countd by-1 % we have 0-based indices |
| 467 |
\ifnum\c@pgf@countd<0 \c@pgf@countd=0 \fi |
| 468 |
\ifnum\c@pgf@countd<#2\relax \else \c@pgf@countd=#2\relax \advance\c@pgf@countd by-1 \fi |
| 469 |
\pgfplotsarrayselect\c@pgf@countd\of\pgfp@boxplot@@\to\pgfmathresult |
| 470 |
}% |
| 471 |
|
| 472 |
% #1: the index |
| 473 |
% #2: the number of data points in the array \pgfp@boxplot@@ |
| 474 |
% |
| 475 |
% POSTCONDITION: \pgfmathresult contains the result. |
| 476 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@getIndex@legacy@bad#1#2{% |
| 477 |
\c@pgf@countd=#1\relax |
| 478 |
%\advance\c@pgf@countd by-1 % we have 0-based indices |
| 479 |
\ifnum\c@pgf@countd<0 \c@pgf@countd=0 \fi |
| 480 |
\ifnum\c@pgf@countd<#2\relax \else \c@pgf@countd=#2\relax \advance\c@pgf@countd by-1 \fi |
| 481 |
\pgfplotsarrayselect\c@pgf@countd\of\pgfp@boxplot@@\to\pgfmathresult |
| 482 |
}% |
| 483 |
|
| 484 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@#1#2{% |
| 485 |
\pgfplots@error{The estimator is uninitialized in this context. Call \string\pgfplotsplothandler@boxplot@init@percentile@estimator\space first.}% |
| 486 |
} |
| 487 |
|
| 488 |
% computes x_low + (h - h_low) * (x_up - x_low) |
| 489 |
% #1: the number of data points in the array \pgfp@boxplot@@ |
| 490 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@std@lookup#1{% |
| 491 |
\pgfmathparse{floor(\h)}% |
| 492 |
\let\h@low=\pgfmathresult |
| 493 |
\pgfmathfloattoint\pgfmathresult |
| 494 |
\let\offset@low=\pgfmathresult |
| 495 |
\c@pgf@countd=\offset@low\relax |
| 496 |
\advance\c@pgf@countd by1 % |
| 497 |
\edef\offset@high{\the\c@pgf@countd}% |
| 498 |
% |
| 499 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@low}{#1}% |
| 500 |
\let\x@low=\pgfmathresult |
| 501 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@high}{#1}% |
| 502 |
\let\x@high=\pgfmathresult |
| 503 |
\pgfmathparse{\x@low + (\h - \h@low) * (\x@high - \x@low)}% |
| 504 |
}% |
| 505 |
|
| 506 |
% implements 'estimator=legacy' |
| 507 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@legacy#1#2{% |
| 508 |
\pgfmathparse{#1*#2}% |
| 509 |
\let\h=\pgfmathresult |
| 510 |
\pgfmathparse{floor(\h)}% |
| 511 |
\pgfmathfloattoint\pgfmathresult |
| 512 |
\let\offset@low=\pgfmathresult |
| 513 |
% |
| 514 |
\pgfmathparse{\h > \offset@low}% |
| 515 |
\ifpgfmathfloatcomparison |
| 516 |
\def\b@is@int{0}% |
| 517 |
\else |
| 518 |
\def\b@is@int{1}% |
| 519 |
\fi |
| 520 |
% |
| 521 |
\c@pgf@countd=\offset@low\relax |
| 522 |
\advance\c@pgf@countd by1 % |
| 523 |
\edef\offset@high{\the\c@pgf@countd}% |
| 524 |
% |
| 525 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@low}{#2}% |
| 526 |
\if0\b@is@int |
| 527 |
\let\temp=\pgfmathresult |
| 528 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex{\offset@high}{#2}% |
| 529 |
\pgfmathparse{0.5*(\temp + \pgfmathresult)}% |
| 530 |
\fi |
| 531 |
} |
| 532 |
\def\pgfplotsplothandler@boxplot@percentile@estimator@legacy@bad#1#2{% |
| 533 |
\pgfmathparse{#1*(#2-1)}% |
| 534 |
\let\h=\pgfmathresult |
| 535 |
\pgfmathparse{floor(\h)}% |
| 536 |
\pgfmathfloattoint\pgfmathresult |
| 537 |
\let\offset@low=\pgfmathresult |
| 538 |
% |
| 539 |
\pgfmathparse{\h > \offset@low}% |
| 540 |
\ifpgfmathfloatcomparison |
| 541 |
\def\b@is@int{0}% |
| 542 |
\else |
| 543 |
\def\b@is@int{1}% |
| 544 |
\fi |
| 545 |
% |
| 546 |
\c@pgf@countd=\offset@low\relax |
| 547 |
\advance\c@pgf@countd by1 % |
| 548 |
\edef\offset@high{\the\c@pgf@countd}% |
| 549 |
% |
| 550 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex@legacy@bad{\offset@low}{#2}% |
| 551 |
\if0\b@is@int |
| 552 |
\let\temp=\pgfmathresult |
| 553 |
\pgfplotsplothandler@boxplot@percentile@estimator@getIndex@legacy@bad{\offset@high}{#2}% |
| 554 |
\pgfmathparse{0.5*(\temp + \pgfmathresult)}% |
| 555 |
\fi |
| 556 |
} |
| 557 |
|
| 558 |
|
| 559 |
\def\pgfplotsplothandlersurveyend@boxplot@computestats{ |
| 560 |
% |
| 561 |
\pgfplotsplothandler@boxplot@init@percentile@estimator |
| 562 |
% |
| 563 |
% hm. I once had the idea to support quartile-based whisker |
| 564 |
% definitions... but I did not implement them. |
| 565 |
\let\c@pgfplotsplothandlerboxplot@lowerwhisker=\pgfutil@empty |
| 566 |
\let\c@pgfplotsplothandlerboxplot@upperwhisker=\pgfutil@empty |
| 567 |
% |
| 568 |
% |
| 569 |
% These here are the VALUES that will be communicated to 'boxplot prepared' |
| 570 |
% They need to be computed below. |
| 571 |
\let\pgfplotsplothandlerboxplot@lowerwhisker=\pgfutil@empty |
| 572 |
\let\pgfplotsplothandlerboxplot@lowerquartile=\pgfutil@empty |
| 573 |
\let\pgfplotsplothandlerboxplot@median=\pgfutil@empty |
| 574 |
\let\pgfplotsplothandlerboxplot@upperquartile=\pgfutil@empty |
| 575 |
\let\pgfplotsplothandlerboxplot@upperwhisker=\pgfutil@empty |
| 576 |
% |
| 577 |
\pgfplotsplothandler@boxplot@percentile@estimator{\pgfkeysvalueof{/pgfplots/boxplot/lower quartile off}}{\numcoords}% |
| 578 |
\let\pgfplotsplothandlerboxplot@lowerquartile=\pgfmathresult |
| 579 |
\pgfplotsplothandler@boxplot@percentile@estimator{\pgfkeysvalueof{/pgfplots/boxplot/upper quartile off}}{\numcoords}% |
| 580 |
\let\pgfplotsplothandlerboxplot@upperquartile=\pgfmathresult |
| 581 |
\pgfplotsplothandler@boxplot@percentile@estimator{0.5}{\numcoords}% |
| 582 |
\let\pgfplotsplothandlerboxplot@median=\pgfmathresult |
| 583 |
% |
| 584 |
% |
| 585 |
\pgfplotscoordmath{float}{parsenumber}{\numcoords}% |
| 586 |
\let\pgfplots@boxplot@numcoords=\pgfmathresult |
| 587 |
\pgfplotscoordmath{float}{op}{divide}{{\pgfplotsplothandlerboxplot@sum}{\pgfplots@boxplot@numcoords}}% |
| 588 |
\let\pgfplotsplothandlerboxplot@average=\pgfmathresult |
| 589 |
% |
| 590 |
% communicate and set results to pgfkeys - and to the plot |
| 591 |
% specification option list: |
| 592 |
\pgfplotsplothandlersurveyend@boxplot@set{lower whisker}{\pgfplotsplothandlerboxplot@lowerwhisker}% |
| 593 |
\pgfplotsplothandlersurveyend@boxplot@set{lower quartile}{\pgfplotsplothandlerboxplot@lowerquartile}% |
| 594 |
\pgfplotsplothandlersurveyend@boxplot@set{median}{\pgfplotsplothandlerboxplot@median}% |
| 595 |
\pgfplotsplothandlersurveyend@boxplot@set{average}{\pgfplotsplothandlerboxplot@average}% |
| 596 |
\pgfplotsplothandlersurveyend@boxplot@set{upper quartile}{\pgfplotsplothandlerboxplot@upperquartile}% |
| 597 |
\pgfplotsplothandlersurveyend@boxplot@set{upper whisker}{\pgfplotsplothandlerboxplot@upperwhisker}% |
| 598 |
\pgfplotsplothandlersurveyend@boxplot@set{sample size}{\pgfplots@boxplot@numcoords}% |
| 599 |
% |
| 600 |
% Ok, now make sure that we use the FINAL variables from the user, |
| 601 |
% i.e. that we respect manual overrides. This is only necessary |
| 602 |
% for quartiles from what I see here. |
| 603 |
\pgfplotsplothandlersurveyend@boxplot@get{\pgfplotsplothandlerboxplot@lowerquartile}{lower quartile}% |
| 604 |
\pgfplotsplothandlersurveyend@boxplot@get{\pgfplotsplothandlerboxplot@upperquartile}{upper quartile}% |
| 605 |
% |
| 606 |
\pgfplotscoordmath{float}{parsenumber}{\pgfplotsboxplotvalue{whisker range}}% |
| 607 |
\let\pgfplots@loc@TMPa=\pgfmathresult |
| 608 |
\pgfplotscoordmath{float}{op}{subtract}{{\pgfplotsplothandlerboxplot@upperquartile}{\pgfplotsplothandlerboxplot@lowerquartile}}% |
| 609 |
\pgfplotscoordmath{float}{op}{multiply}{{\pgfmathresult}{\pgfplots@loc@TMPa}}% |
| 610 |
\let\pgfplots@boxplot@whisker@width=\pgfmathresult |
| 611 |
\pgfplotscoordmath{float}{op}{add}{{\pgfplotsplothandlerboxplot@upperquartile}{\pgfplots@boxplot@whisker@width}}% |
| 612 |
\let\pgfplotsplothandlerboxplot@upperwhisker@value=\pgfmathresult |
| 613 |
\pgfplotscoordmath{float}{op}{subtract}{{\pgfplotsplothandlerboxplot@lowerquartile}{\pgfplots@boxplot@whisker@width}}% |
| 614 |
\let\pgfplotsplothandlerboxplot@lowerwhisker@value=\pgfmathresult |
| 615 |
% |
| 616 |
\pgfplotsarrayforeachungrouped\pgfp@boxplot@@\as\pgfplots@current@point@data{% |
| 617 |
\pgfplotsplothandlersurveyend@boxplot@computestats@valuebased |
| 618 |
}% |
| 619 |
% |
| 620 |
\pgfplotsplothandlersurveyend@boxplot@set{lower whisker}{\pgfplotsplothandlerboxplot@lowerwhisker}% |
| 621 |
\pgfplotsplothandlersurveyend@boxplot@set{upper whisker}{\pgfplotsplothandlerboxplot@upperwhisker}% |
| 622 |
% |
| 623 |
}% |
| 624 |
|
| 625 |
% takes a key #1 which is expected in /pgfplots/boxplot/#1, |
| 626 |
% and overwrites its value with #2 if that is allowed. |
| 627 |
% |
| 628 |
% More specifically, if the current value of '#1' is 'auto', it is |
| 629 |
% replaced by #2. In all other cases, it will not be modified. |
| 630 |
% |
| 631 |
% The "replaced by #2" means to set the value right away and to modify |
| 632 |
% the plot's option list to reflect the new value. |
| 633 |
% |
| 634 |
% ---- NOTE: this routine is also invoked from the LUA BACKEND. |
| 635 |
\def\pgfplotsplothandlersurveyend@boxplot@set#1#2{% |
| 636 |
\pgfkeysgetvalue{/pgfplots/boxplot/#1}\pgfplots@loc@TMPa |
| 637 |
\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% |
| 638 |
\def\pgfplots@loc@TMPc{auto}% |
| 639 |
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPc |
| 640 |
\edef\pgfmathresult{#2}% |
| 641 |
\ifx\pgfmathresult\pgfutil@empty |
| 642 |
\else |
| 643 |
\pgfplotscoordmath{float}{tostring}{#2}% |
| 644 |
\edef\pgfplots@loc@TMPb{\noexpand\pgfplotsplothandlersurveyaddoptions{/pgfplots/boxplot/#1={\pgfmathresult}}}% |
| 645 |
\pgfplots@loc@TMPb |
| 646 |
\pgfplotsplothandlersurveyend@boxplot@log{#1}{\pgfmathresult}% |
| 647 |
\fi |
| 648 |
\fi |
| 649 |
}% |
| 650 |
|
| 651 |
\def\pgfplotsplothandlersurveyend@boxplot@log#1#2{% |
| 652 |
\pgfplots@log3{boxplot: got #1=#2}% |
| 653 |
}% |
| 654 |
|
| 655 |
\def\pgfplotsplothandlersurveyend@boxplot@get#1#2{% |
| 656 |
\pgfkeysgetvalue{/pgfplots/boxplot/#2}\pgfplots@loc@TMPa |
| 657 |
\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}% |
| 658 |
\def\pgfplots@loc@TMPc{auto}% |
| 659 |
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPc |
| 660 |
\else |
| 661 |
\ifx\pgfplots@loc@TMPa\pgfutil@empty |
| 662 |
\else |
| 663 |
\pgfmathparse{\pgfplots@loc@TMPa}% |
| 664 |
\let#1=\pgfmathresult |
| 665 |
\fi |
| 666 |
\fi |
| 667 |
} |
| 668 |
|
| 669 |
\def\pgfplotsplothandlersurveyend@boxplot@computestats@valuebased{% |
| 670 |
\ifx\pgfplotsplothandlerboxplot@lowerwhisker\pgfutil@empty |
| 671 |
\pgfplotscoordmath{float}{if less than}{\pgfplots@current@point@data}{\pgfplotsplothandlerboxplot@lowerwhisker@value}{% |
| 672 |
% Ah. an outlier. |
| 673 |
\pgfplotsplothandlerboxplot@outlier |
| 674 |
}{% |
| 675 |
\let\pgfplotsplothandlerboxplot@lowerwhisker=\pgfplots@current@point@data |
| 676 |
}% |
| 677 |
\fi |
| 678 |
% |
| 679 |
% FIXME : optimize this! We have an array so we COULD check it in |
| 680 |
% reverse order! |
| 681 |
% it would be so cool if we could simply check the list in reverse |
| 682 |
% order. but not if it really is a singly-linked list... |
| 683 |
\pgfplotscoordmath{float}{if less than}{\pgfplotsplothandlerboxplot@upperwhisker@value}{\pgfplots@current@point@data}{% |
| 684 |
% Ah. an outlier. |
| 685 |
\pgfplotsplothandlerboxplot@outlier |
| 686 |
}{% |
| 687 |
\ifx\pgfplotsplothandlerboxplot@upperwhisker\pgfutil@empty |
| 688 |
\let\pgfplotsplothandlerboxplot@upperwhisker=\pgfplots@current@point@data |
| 689 |
\else |
| 690 |
\pgfplotscoordmath{float}{max}{\pgfplotsplothandlerboxplot@upperwhisker}{\pgfplots@current@point@data}% |
| 691 |
\let\pgfplotsplothandlerboxplot@upperwhisker=\pgfmathresult |
| 692 |
\fi |
| 693 |
}% |
| 694 |
} |
| 695 |
|
| 696 |
\def\pgfplotsplothandlerboxplot@outlier{% |
| 697 |
\def\pgfplots@current@point@x{0}% |
| 698 |
\def\pgfplots@current@point@y{0}% |
| 699 |
\def\pgfplots@current@point@z{0}% |
| 700 |
\pgfplotsplothandlersurveypoint |
| 701 |
}% |
| 702 |
|
| 703 |
%%% |
| 704 |
|
| 705 |
\def\pgfplotsplothandlersurveypoint@boxplot{% |
| 706 |
\pgfplotsplothandlerboxplot@parse |
| 707 |
\let\pgfplots@current@point@data=\pgfmathresult |
| 708 |
% |
| 709 |
\ifx\pgfplots@current@point@data\pgfutil@empty |
| 710 |
\else |
| 711 |
\pgfplotscoordmath{float}{if is bounded}{\pgfplots@current@point@data}{% |
| 712 |
% |
| 713 |
\ifpgfplots@LUA@backend@supported |
| 714 |
\pgfplotsplothandlerboxplot@LUA@survey@point |
| 715 |
\else |
| 716 |
\pgfplotsplothandlersurveypoint@boxplot@ |
| 717 |
\fi |
| 718 |
}{% |
| 719 |
}% |
| 720 |
\fi |
| 721 |
}% |
| 722 |
|
| 723 |
\def\pgfplotsplothandlerboxplot@LUA@survey@point{% |
| 724 |
\pgfplotsutil@directlua{pgfplots.texBoxPlotSurveyPoint("\pgfplots@current@point@data")}% |
| 725 |
}% |
| 726 |
\def\pgfplotsplothandlersurveypoint@boxplot@{% |
| 727 |
\pgfplotsutil@advancestringcounter\c@pgfplotsplothandlerboxplot@num |
| 728 |
% |
| 729 |
\if1\b@pgfplotsplothandlerboxplot@issorted |
| 730 |
\pgfplotscoordmath{float}{if less than}{\pgfplots@current@point@data}{\pgfplotsplothandlerboxplot@last}{% |
| 731 |
\def\b@pgfplotsplothandlerboxplot@issorted{0}% |
| 732 |
}{% |
| 733 |
}% |
| 734 |
\fi |
| 735 |
% |
| 736 |
% |
| 737 |
\pgfplotscoordmath{float}{op}{add}{{\pgfplots@current@point@data}{\pgfplotsplothandlerboxplot@sum}}% |
| 738 |
\let\pgfplotsplothandlerboxplot@sum=\pgfmathresult |
| 739 |
% |
| 740 |
% store parsed result. |
| 741 |
\edef\pgfmathresult{\pgfplots@current@point@data}% |
| 742 |
\expandafter\pgfplotsarraypushback\expandafter{\pgfmathresult}\to\pgfp@boxplot@@ |
| 743 |
% |
| 744 |
\let\pgfplotsplothandlerboxplot@last=\pgfplots@current@point@data |
| 745 |
% |
| 746 |
\advance\c@pgfplots@coordindex by1 |
| 747 |
} |
| 748 |
% ============================================================= |
| 749 |
|
| 750 |
\def\pgfplotsplothandlerboxplotprepared{% |
| 751 |
\ifpgfplots@stackedmode |
| 752 |
\pgfplotsthrow{unsupported operation}{Sorry, 'stacked plots' are currently unsupported for box plots. See the manual for 'boxplot/draw position' for how to achieve the effect (using \string\plotnumofactualtype)}\pgfeov |
| 753 |
\else |
| 754 |
\pgfplotsplothandlerboxplotprepared@ |
| 755 |
\fi |
| 756 |
} |
| 757 |
\def\pgfplotsplothandlerboxplotprepared@{% |
| 758 |
\pgfplotsresetplothandler |
| 759 |
% |
| 760 |
\def\pgfplotsplothandlername{boxplot prepared}% |
| 761 |
% |
| 762 |
\let\pgf@plotstreamstart=\pgfplotsplothandlervisstart@boxplot@prepared |
| 763 |
\let\pgfplotsplothandlersurveystart=\pgfplotsplothandlersurveystart@boxplot@prepared |
| 764 |
\let\pgfplotsplothandlersurveypoint=\pgfplotsplothandlersurveypoint@boxplot@prepared |
| 765 |
\let\pgfplotsplothandlersurveyend=\pgfplotsplothandlersurveyend@boxplot@prepared |
| 766 |
% |
| 767 |
\pgfplotsplothandlerboxplotprepared@normalize@values |
| 768 |
% |
| 769 |
\pgfkeysgetvalue{/pgfplots/boxplot/draw direction}\pgfplots@loc@TMPa |
| 770 |
\if x\pgfplotsboxplotvalue{draw direction}% |
| 771 |
\else |
| 772 |
\if y\pgfplotsboxplotvalue{draw direction}% |
| 773 |
\else |
| 774 |
\pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Invalid choice boxplot/draw direction=\pgfplots@loc@TMPa}\pgfeov% |
| 775 |
\def\pgfplots@loc@TMPa{x}% |
| 776 |
\fi |
| 777 |
\fi |
| 778 |
\csname pgfplotsplothandlerboxplotprepared@setxy@\pgfplots@loc@TMPa\endcsname |
| 779 |
% |
| 780 |
\def\pgfplotsboxplotpointab##1##2{% |
| 781 |
\begingroup |
| 782 |
\pgfkeys{/pgf/fpu}% |
| 783 |
\pgfmathparse{##1}% |
| 784 |
\let\pgfplotsplothandlerboxplot@@=\pgfmathresult |
| 785 |
\pgfmathparse{\pgfplotsboxplotvalue{draw position} + ##2}% |
| 786 |
\xdef\pgfplots@glob@TMPa{{\pgfplotsplothandlerboxplot@@}{\pgfmathresult}}% |
| 787 |
\expandafter\pgfplotsboxplotpointab@\pgfplots@glob@TMPa{\pgfplotspointaxisxy}% |
| 788 |
\pgf@process{}% |
| 789 |
\endgroup |
| 790 |
}% |
| 791 |
\def\pgfplotsboxplotpointab@survey##1##2{% |
| 792 |
\edef\pgfmathresult{##1}% |
| 793 |
\ifx\pgfmathresult\pgfutil@empty |
| 794 |
\else |
| 795 |
\pgfmathparse{\pgfmathresult}% |
| 796 |
\fi |
| 797 |
\let\pgfplotsplothandlerboxplot@@=\pgfmathresult |
| 798 |
\pgfmathparse{\pgfplotsboxplotvalue{draw position} + ##2}% |
| 799 |
\xdef\pgfplots@glob@TMPa{{\pgfplotsplothandlerboxplot@@}{\pgfmathresult}}% |
| 800 |
\let\pgfplotsplothandlerboxplot@modified@draw@position=\pgfmathresult% |
| 801 |
\expandafter\pgfplotsboxplotpointab@\pgfplots@glob@TMPa{\pgfplotsboxplotpointab@@define@current@xy}% |
| 802 |
}% |
| 803 |
}% |
| 804 |
|
| 805 |
\def\pgfplotsplothandlerboxplotprepared@normalize@values{% |
| 806 |
\def\pgfplots@loc@TMPa{auto}% |
| 807 |
\pgfplotsforeachentryinCSV{\value}{% |
| 808 |
lower whisker,% |
| 809 |
lower quartile,% |
| 810 |
median,% |
| 811 |
average,% |
| 812 |
upper quartile,% |
| 813 |
upper whisker,% |
| 814 |
sample size% |
| 815 |
}{% |
| 816 |
\pgfkeysgetvalue{/pgfplots/boxplot/\value}\pgfplots@loc@TMPb |
| 817 |
\edef\pgfplots@loc@TMPb{\pgfplots@loc@TMPb}% |
| 818 |
\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa |
| 819 |
\pgfkeyslet{/pgfplots/boxplot/\value}\pgfutil@empty |
| 820 |
\fi |
| 821 |
}% |
| 822 |
}% |
| 823 |
|
| 824 |
\def\pgfplotsboxplotpointab@@define@current@xy#1#2{% |
| 825 |
\edef\pgfplots@current@point@x{#1}% |
| 826 |
\edef\pgfplots@current@point@y{#2}% |
| 827 |
}% |
| 828 |
|
| 829 |
\def\pgfplotsplothandlerboxplotprepared@setxy@x{% |
| 830 |
\def\pgfplotsboxplotpointab@##1##2##3{% |
| 831 |
##3{##1}{##2}% |
| 832 |
}% |
| 833 |
}% |
| 834 |
\def\pgfplotsplothandlerboxplotprepared@setxy@y{% |
| 835 |
\def\pgfplotsboxplotpointab@##1##2##3{% |
| 836 |
##3{##2}{##1}% |
| 837 |
}% |
| 838 |
}% |
| 839 |
|
| 840 |
\def\pgfplotsplothandlersurveypoint@boxplot@collect@limits{% |
| 841 |
\pgfplotsaxisparsecoordinate |
| 842 |
\pgfplotsaxispreparecoordinate |
| 843 |
\ifpgfplotsaxisparsecoordinateok |
| 844 |
\pgfplotsaxisupdatelimitsforcoordinate\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@z |
| 845 |
\fi |
| 846 |
% |
| 847 |
% do NOT store the processed coordinate! the coordinate stream |
| 848 |
% is ONLY for outliers. |
| 849 |
% |
| 850 |
% ... but update this stuff to avoid a "plot without coordinates" |
| 851 |
% case |
| 852 |
\pgfplotscoordstream@firstlast@update |
| 853 |
} |
| 854 |
|
| 855 |
\def\pgfplotsplothandlersurveystart@boxplot@prepared{% |
| 856 |
\pgfplots@prepare@source@parser@for{boxplot/}{data}{\pgfplotsplothandlerboxplot@parse}% |
| 857 |
% |
| 858 |
\let\pgfplotsboxplotpointab=\pgfplotsboxplotpointab@survey |
| 859 |
% |
| 860 |
\pgfplotsplothandlersurveystart@default |
| 861 |
} |
| 862 |
|
| 863 |
\def\pgfplotsplothandlersurveypoint@boxplot@prepared{% |
| 864 |
% seems the "parse" routine is stupid ... the /data point/ stuff |
| 865 |
% is redefined although it should not. Strange... |
| 866 |
\pgfkeyslet{/data point/x}\pgfplots@current@point@x |
| 867 |
\pgfkeyslet{/data point/y}\pgfplots@current@point@y |
| 868 |
\pgfkeyslet{/data point/z}\pgfplots@current@point@z |
| 869 |
\pgfplotsplothandlerboxplot@parse |
| 870 |
% |
| 871 |
\pgfplotsboxplotpointab{\pgfmathresult}{0}% |
| 872 |
% |
| 873 |
\pgfplotsplothandlersurveypoint@default |
| 874 |
} |
| 875 |
|
| 876 |
\def\pgfplotsplothandlersurveyend@boxplot@prepared{% |
| 877 |
\let\pgfplots@invoke@filter@xyz@old=\pgfplots@invoke@filter@xyz |
| 878 |
\let\pgfplots@invoke@filter@xyz=\relax |
| 879 |
\let\pgfplots@invoke@filter@old=\pgfplots@invoke@filter |
| 880 |
\def\pgfplots@invoke@filter##1##2{}% |
| 881 |
\let\pgfplots@invoke@prefilter@old=\pgfplots@invoke@prefilter |
| 882 |
\let\pgfplots@invoke@prefilter=\relax |
| 883 |
% |
| 884 |
\pgfmathparse{\pgfplotsboxplotvalue{draw position}}% |
| 885 |
\let\pgfplots@loc@TMPa=\pgfmathresult |
| 886 |
\ifpgfplots@usefpu |
| 887 |
\pgfmathfloattofixed\pgfmathresult |
| 888 |
\fi |
| 889 |
% remember it for later - it might have been retrieved from some |
| 890 |
% table column! If you used something like |
| 891 |
% 'draw position=\thisrow{position}, the position of the LAST data point |
| 892 |
% will be used (because we are in end survey here). |
| 893 |
\edef\pgfplots@loc@TMPb{\noexpand\pgfplotsplothandlersurveyaddoptions{/pgfplots/boxplot/draw position=\pgfmathresult}}% |
| 894 |
\pgfplots@loc@TMPb |
| 895 |
% |
| 896 |
% ... this here will make things faster if the FPU is active. |
| 897 |
\pgfkeyslet{/pgfplots/boxplot/draw position}\pgfplots@loc@TMPa |
| 898 |
% |
| 899 |
% |
| 900 |
% |
| 901 |
% |
| 902 |
\pgfplotsboxplotpointabwhisker |
| 903 |
{\pgfplotsboxplotvalue{lower whisker}} |
| 904 |
{0}% |
| 905 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 906 |
% |
| 907 |
\pgfplotsboxplotpointabwhisker |
| 908 |
{\pgfplotsboxplotvalue{lower whisker}} |
| 909 |
{1}% |
| 910 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 911 |
% |
| 912 |
% |
| 913 |
\pgfplotsboxplotpointabbox |
| 914 |
{\pgfplotsboxplotvalue{lower quartile}}% |
| 915 |
{0}% |
| 916 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 917 |
% |
| 918 |
\pgfplotsboxplotpointabbox |
| 919 |
{\pgfplotsboxplotvalue{lower quartile}}% |
| 920 |
{1}% |
| 921 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 922 |
% |
| 923 |
% |
| 924 |
\pgfplotsboxplotpointabbox |
| 925 |
{\pgfplotsboxplotvalue{median}} |
| 926 |
{0}% |
| 927 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 928 |
% |
| 929 |
\pgfplotsboxplotpointabbox |
| 930 |
{\pgfplotsboxplotvalue{median}} |
| 931 |
{1}% |
| 932 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 933 |
% |
| 934 |
% |
| 935 |
\pgfplotsboxplotpointabbox |
| 936 |
{\pgfplotsboxplotvalue{average}} |
| 937 |
{0}% |
| 938 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 939 |
% |
| 940 |
\pgfplotsboxplotpointabbox |
| 941 |
{\pgfplotsboxplotvalue{average}} |
| 942 |
{1}% |
| 943 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 944 |
% |
| 945 |
% |
| 946 |
\pgfplotsboxplotpointabbox |
| 947 |
{\pgfplotsboxplotvalue{upper quartile}}% |
| 948 |
{0}% |
| 949 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 950 |
% |
| 951 |
\pgfplotsboxplotpointabbox |
| 952 |
{\pgfplotsboxplotvalue{upper quartile}}% |
| 953 |
{1}% |
| 954 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 955 |
% |
| 956 |
% |
| 957 |
% |
| 958 |
\pgfplotsboxplotpointabwhisker |
| 959 |
{\pgfplotsboxplotvalue{upper whisker}}% |
| 960 |
{1}% |
| 961 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 962 |
% |
| 963 |
\pgfplotsboxplotpointabwhisker |
| 964 |
{\pgfplotsboxplotvalue{upper whisker}}% |
| 965 |
{0}% |
| 966 |
\pgfplotsplothandlersurveypoint@boxplot@collect@limits |
| 967 |
% |
| 968 |
\let\pgfplots@invoke@prefilter=\pgfplots@invoke@prefilter@old |
| 969 |
\let\pgfplots@invoke@filter=\pgfplots@invoke@filter@old |
| 970 |
\let\pgfplots@invoke@filter@xyz=\pgfplots@invoke@filter@xyz@old |
| 971 |
% |
| 972 |
\pgfplotsplothandlerboxplotsurvey@variable@width% |
| 973 |
% |
| 974 |
\pgfplotsplothandlersurveyend@default |
| 975 |
}% |
| 976 |
|
| 977 |
\def\pgfplotsplothandlerboxplotsurvey@variable@width{% |
| 978 |
\ifnum\plotnumofactualtype=0 % |
| 979 |
% Ah - the first boxplot in this axis. Init the global |
| 980 |
% counter: |
| 981 |
\pgfplotscoordmath{default}{max limit}% |
| 982 |
\global\let\g@pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult |
| 983 |
\pgfplotscoordmath{default}{min limit}% |
| 984 |
\global\let\g@pgfplotsplothandlerboxplot@widthkey@max=\pgfmathresult |
| 985 |
\fi |
| 986 |
% |
| 987 |
% |
| 988 |
\ifpgfplotsplothandlerboxplot@variable@width |
| 989 |
\pgfkeysgetvalue{/pgfplots/boxplot/sample size}\pgfmathresult |
| 990 |
\edef\pgfmathresult{\pgfmathresult}% |
| 991 |
\ifx\pgfmathresult\pgfutil@empty |
| 992 |
\else |
| 993 |
\pgfplotsplothandlerboxplot@variable@width@expr{\pgfmathresult}% |
| 994 |
% |
| 995 |
\let\pgfplots@widthkey@=\pgfmathresult |
| 996 |
% |
| 997 |
\pgfkeysgetvalue{/pgfplots/boxplot/sample size min}\pgfmathresult |
| 998 |
\edef\pgfplotsplothandlerboxplot@widthkey@min{\pgfmathresult}% |
| 999 |
% |
| 1000 |
\pgfkeysgetvalue{/pgfplots/boxplot/sample size max}\pgfmathresult |
| 1001 |
\edef\pgfplotsplothandlerboxplot@widthkey@max{\pgfmathresult}% |
| 1002 |
% |
| 1003 |
% |
| 1004 |
\ifx\pgfplotsplothandlerboxplot@widthkey@min\pgfutil@empty |
| 1005 |
\let\pgfplotsplothandlerboxplot@widthkey@min=\g@pgfplotsplothandlerboxplot@widthkey@min |
| 1006 |
\def\pgfplotsplothandlerboxplot@widthkey@min@autocompute{1}% |
| 1007 |
\else |
| 1008 |
\pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@min}% |
| 1009 |
\let\pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult |
| 1010 |
\def\pgfplotsplothandlerboxplot@widthkey@min@autocompute{0}% |
| 1011 |
\fi |
| 1012 |
\ifx\pgfplotsplothandlerboxplot@widthkey@max\pgfutil@empty |
| 1013 |
\let\pgfplotsplothandlerboxplot@widthkey@max=\g@pgfplotsplothandlerboxplot@widthkey@max |
| 1014 |
\def\pgfplotsplothandlerboxplot@widthkey@max@autocompute{1}% |
| 1015 |
\else |
| 1016 |
\pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@max}% |
| 1017 |
\def\pgfplotsplothandlerboxplot@widthkey@max@autocompute{0}% |
| 1018 |
\fi |
| 1019 |
% |
| 1020 |
\if1\pgfplotsplothandlerboxplot@widthkey@max@autocompute |
| 1021 |
\pgfmathparse{max(\pgfplotsplothandlerboxplot@widthkey@max,\pgfplots@widthkey@)}% |
| 1022 |
\global\let\g@pgfplotsplothandlerboxplot@widthkey@max=\pgfmathresult |
| 1023 |
\let\pgfplotsplothandlerboxplot@widthkey@max=\pgfmathresult |
| 1024 |
% |
| 1025 |
\pgfmathparse{min(\pgfplotsplothandlerboxplot@widthkey@min,\pgfplots@widthkey@)}% |
| 1026 |
\global\let\g@pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult |
| 1027 |
\let\pgfplotsplothandlerboxplot@widthkey@min=\pgfmathresult |
| 1028 |
\fi |
| 1029 |
% |
| 1030 |
% |
| 1031 |
\fi |
| 1032 |
\fi |
| 1033 |
% |
| 1034 |
%\message{sample size=\pgfplots@widthkey@. interval = \pgfplotsplothandlerboxplot@widthkey@min:\pgfplotsplothandlerboxplot@widthkey@max^^J}% |
| 1035 |
}% |
| 1036 |
|
| 1037 |
\def\pgfplotsplothandlerboxplot@variable@width@expr#1{% |
| 1038 |
\begingroup |
| 1039 |
\pgfkeys{/pgf/fpu}% |
| 1040 |
\let\pgfmathresult=#1% |
| 1041 |
\pgfplotsboxplotvalue{variable width expr/.@cmd}#1\pgfeov |
| 1042 |
\pgfmath@smuggleone\pgfmathresult |
| 1043 |
\endgroup |
| 1044 |
\let#1=\pgfmathresult |
| 1045 |
}% |
| 1046 |
|
| 1047 |
\def\pgfplotsplothandlerboxplotvisualization@variable@width{% |
| 1048 |
\ifpgfplotsplothandlerboxplot@variable@width |
| 1049 |
\pgfkeysgetvalue{/pgfplots/boxplot/sample size}\pgfmathresult |
| 1050 |
\edef\pgfmathresult{\pgfmathresult}% |
| 1051 |
\ifx\pgfmathresult\pgfutil@empty |
| 1052 |
\else |
| 1053 |
\pgfplotsplothandlerboxplot@variable@width@expr{\pgfmathresult}% |
| 1054 |
\let\pgfplots@widthkey@=\pgfmathresult |
| 1055 |
% |
| 1056 |
\pgfkeysgetvalue{/pgfplots/boxplot/sample size min}\pgfmathresult |
| 1057 |
\edef\pgfplotsplothandlerboxplot@widthkey@min{\pgfmathresult}% |
| 1058 |
% |
| 1059 |
\pgfkeysgetvalue{/pgfplots/boxplot/sample size max}\pgfmathresult |
| 1060 |
\edef\pgfplotsplothandlerboxplot@widthkey@max{\pgfmathresult}% |
| 1061 |
% |
| 1062 |
% |
| 1063 |
\ifx\pgfplotsplothandlerboxplot@widthkey@min\pgfutil@empty |
| 1064 |
\let\pgfplotsplothandlerboxplot@widthkey@min=\g@pgfplotsplothandlerboxplot@widthkey@min |
| 1065 |
\else |
| 1066 |
\pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@min}% |
| 1067 |
\fi |
| 1068 |
\ifx\pgfplotsplothandlerboxplot@widthkey@max\pgfutil@empty |
| 1069 |
\let\pgfplotsplothandlerboxplot@widthkey@max=\g@pgfplotsplothandlerboxplot@widthkey@max |
| 1070 |
\else |
| 1071 |
\pgfplotsplothandlerboxplot@variable@width@expr{\pgfplotsplothandlerboxplot@widthkey@max}% |
| 1072 |
\fi |
| 1073 |
% |
| 1074 |
\pgfkeysgetvalue{/pgfplots/boxplot/variable width min target}\pgfplots@widthkey@mintrg |
| 1075 |
\pgfkeysgetvalue{/pgfplots/boxplot/box extend}\pgfplots@loc@TMPa |
| 1076 |
%\message{sample size=\pgfplots@widthkey@. interval = \pgfplotsplothandlerboxplot@widthkey@min:\pgfplotsplothandlerboxplot@widthkey@max. Target = [\pgfplots@widthkey@mintrg:1]^^J}% |
| 1077 |
\begingroup |
| 1078 |
\pgfkeys{/pgf/fpu}% |
| 1079 |
\pgfmathparse{ |
| 1080 |
(\pgfplots@widthkey@mintrg + |
| 1081 |
max(0,min(1,(\pgfplots@widthkey@ - \pgfplotsplothandlerboxplot@widthkey@min) / |
| 1082 |
(\pgfplotsplothandlerboxplot@widthkey@max - \pgfplotsplothandlerboxplot@widthkey@min))) |
| 1083 |
* (1-\pgfplots@widthkey@mintrg)) * \pgfplots@loc@TMPa}% |
| 1084 |
\pgfmathfloattofixed\pgfmathresult |
| 1085 |
\pgfmath@smuggleone\pgfmathresult |
| 1086 |
\endgroup |
| 1087 |
\pgfkeyslet{/pgfplots/boxplot/box extend}\pgfmathresult |
| 1088 |
\fi |
| 1089 |
\fi |
| 1090 |
}% |
| 1091 |
|
| 1092 |
\def\pgfplotsplothandlervisstart@boxplot@prepared{% |
| 1093 |
% |
| 1094 |
\pgfplotsplothandlerboxplotvisualization@variable@width |
| 1095 |
% |
| 1096 |
\global\let\pgf@plotstreampoint=\pgfutil@gobble |
| 1097 |
\global\let\pgf@plotstreamspecial=\pgfutil@gobble% |
| 1098 |
\global\let\pgf@plotstreamend=\relax |
| 1099 |
% |
| 1100 |
\pgfplotsplothandlervisstart@boxplot@prepared@draw |
| 1101 |
}% |
| 1102 |
|
| 1103 |
\def\pgfplotsplothandlervisstart@boxplot@prepared@draw{% |
| 1104 |
\def\b@pgfplots@boxplot@hasbox{1}% |
| 1105 |
\edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{lower quartile}}% |
| 1106 |
\ifx\pgfplots@loc@TMPa\pgfutil@empty |
| 1107 |
\def\b@pgfplots@boxplot@hasbox{0}% |
| 1108 |
\fi |
| 1109 |
\edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{upper quartile}}% |
| 1110 |
\ifx\pgfplots@loc@TMPa\pgfutil@empty |
| 1111 |
\def\b@pgfplots@boxplot@hasbox{0}% |
| 1112 |
\fi |
| 1113 |
% |
| 1114 |
\if0\b@pgfplots@boxplot@hasbox |
| 1115 |
% hm. we have no box. Very strange boxplot, I'd say. |
| 1116 |
% |
| 1117 |
% But anyway: if someone has whiskers without box, |
| 1118 |
% short-circuit the whiskers: |
| 1119 |
\edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{lower whisker}}% |
| 1120 |
\edef\pgfplots@loc@TMPb{\pgfplotsboxplotvalue{upper whisker}}% |
| 1121 |
\pgfkeyslet{/pgfplots/boxplot/lower quartile}\pgfplots@loc@TMPb |
| 1122 |
\pgfkeyslet{/pgfplots/boxplot/upper quartile}\pgfplots@loc@TMPa |
| 1123 |
\fi |
| 1124 |
% |
| 1125 |
% |
| 1126 |
\edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{lower whisker}}% |
| 1127 |
\ifx\pgfplots@loc@TMPa\pgfutil@empty |
| 1128 |
\else |
| 1129 |
\pgfplotsboxplotvalue{draw/lower whisker/.@cmd}\pgfeov |
| 1130 |
\fi |
| 1131 |
% |
| 1132 |
\edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{upper whisker}}% |
| 1133 |
\ifx\pgfplots@loc@TMPa\pgfutil@empty |
| 1134 |
\else |
| 1135 |
\pgfplotsboxplotvalue{draw/upper whisker/.@cmd}\pgfeov |
| 1136 |
\fi |
| 1137 |
% |
| 1138 |
\if1\b@pgfplots@boxplot@hasbox |
| 1139 |
\pgfplotsboxplotvalue{draw/box/.@cmd}\pgfeov |
| 1140 |
\fi |
| 1141 |
% |
| 1142 |
\edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{median}}% |
| 1143 |
\ifx\pgfplots@loc@TMPa\pgfutil@empty |
| 1144 |
\else |
| 1145 |
\pgfplotsboxplotvalue{draw/median/.@cmd}\pgfeov |
| 1146 |
\fi |
| 1147 |
% |
| 1148 |
\edef\pgfplots@loc@TMPa{\pgfplotsboxplotvalue{average}}% |
| 1149 |
\ifx\pgfplots@loc@TMPa\pgfutil@empty |
| 1150 |
\else |
| 1151 |
\pgfplotsboxplotvalue{draw/average/.@cmd}\pgfeov |
| 1152 |
\fi |
| 1153 |
}% |
| 1154 |
|
| 1155 |
\def\pgfplots@boxplot@cs@decompose#1{% |
| 1156 |
\edef\pgfplots@loc@TMPa{#1}% |
| 1157 |
\expandafter\pgfutil@in@\expandafter,\expandafter{\pgfplots@loc@TMPa}% |
| 1158 |
\ifpgfutil@in@ |
| 1159 |
\def\pgfplots@loc@TMPb##1,##2\pgfplots@EOI{% |
| 1160 |
\def\pgfplots@boxplotcs@a{##1}% |
| 1161 |
\def\pgfplots@boxplotcs@b{##2}% |
| 1162 |
}% |
| 1163 |
\expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\pgfplots@EOI |
| 1164 |
\else |
| 1165 |
\let\pgfplots@boxplotcs@a=\pgfplots@loc@TMPa% |
| 1166 |
\def\pgfplots@boxplotcs@b{0}% |
| 1167 |
\fi |
| 1168 |
}% |
| 1169 |
|
| 1170 |
\def\pgfplotsboxplotvalue#1{\pgfkeysvalueof{/pgfplots/boxplot/#1}}% |
| 1171 |
|
| 1172 |
\tikzaddtikzonlycommandshortcutlet\boxplotvalue\pgfplotsboxplotvalue |
| 1173 |
|
| 1174 |
% A helper which implements 'draw relative anchor'. It expands to a |
| 1175 |
% math expression which is suitable as second argument for 'boxplot cs'; |
| 1176 |
% i.e. it needs to be added to 'boxplot/draw position'. |
| 1177 |
% |
| 1178 |
% More precisely, this macro is to be used in a context where lines of |
| 1179 |
% 'box extend' length have to be drawn. |
| 1180 |
% |
| 1181 |
% The argument is shifted by 'draw relative anchor' and is scaled by |
| 1182 |
% 'box extend'. |
| 1183 |
% |
| 1184 |
% #1: the coordinate. 0 is the means "lower part of the construct |
| 1185 |
% which is to be drawn". 1 means the "upper part of that construct" |
| 1186 |
% and 0.5 is in the middle. |
| 1187 |
\def\pgfplots@boxplot@anchor@value#1{% |
| 1188 |
(#1-\pgfplotsboxplotvalue{draw relative anchor})*\pgfplotsboxplotvalue{box extend}% |
| 1189 |
} |
| 1190 |
|
| 1191 |
% same as \pgfplots@boxplot@anchor@value, but for drawing constructs |
| 1192 |
% which are at most 'whisker extend' long. |
| 1193 |
\def\pgfplots@boxplot@anchor@value@whisker#1{% |
| 1194 |
(#1-\pgfplotsboxplotvalue{draw relative anchor})*\pgfplotsboxplotvalue{whisker extend}% |
| 1195 |
} |
| 1196 |
|
| 1197 |
\def\pgfplotsboxplotpointabbox#1#2{% |
| 1198 |
\pgfplotsboxplotpointab{#1}{\pgfplots@boxplot@anchor@value{#2}}% |
| 1199 |
}% |
| 1200 |
\def\pgfplotsboxplotpointabwhisker#1#2{% |
| 1201 |
\pgfplotsboxplotpointab{#1}{\pgfplots@boxplot@anchor@value@whisker{#2}}% |
| 1202 |
}% |
| 1203 |
|
| 1204 |
\tikzdeclarecoordinatesystem{boxplot}{% |
| 1205 |
\pgfplots@boxplot@cs@decompose{#1}% |
| 1206 |
\pgfplotsboxplotpointab{\pgfplots@boxplotcs@a}{\pgfplots@boxplotcs@b}% |
| 1207 |
}% |
| 1208 |
|
| 1209 |
\tikzdeclarecoordinatesystem{boxplot box}{% |
| 1210 |
\pgfplots@boxplot@cs@decompose{#1}% |
| 1211 |
\pgfplotsboxplotpointabbox{\pgfplots@boxplotcs@a}{\pgfplots@boxplotcs@b}% |
| 1212 |
}% |
| 1213 |
|
| 1214 |
\tikzdeclarecoordinatesystem{boxplot whisker}{% |
| 1215 |
\pgfplots@boxplot@cs@decompose{#1}% |
| 1216 |
\pgfplotsboxplotpointabwhisker{\pgfplots@boxplotcs@a}{\pgfplots@boxplotcs@b}% |
| 1217 |
}% |
| 1218 |
|
| 1219 |
\catcode`\;=\pgfplots@oldcatcodesemicolon |
| 1220 |
\catcode`\"=\pgfplots@oldcatcodedoublequote |
| 1221 |
\endinput |