Skip to content

Commit

Permalink
fix(boxPlot): Wide scatter for constant y
Browse files Browse the repository at this point in the history
When kernelDensity interpolation fails, it is because all values in y are the same. In such cases, it is desired to have maximum possible horizontal spread of samples in the scatter (as it would have if all but one value in y are the same, or values in y are close together). Thus, maxDisplacement should be 1, not 0, in the catch clause.

Fixes IoSR-Surrey#14
  • Loading branch information
PauluzzS authored Jan 3, 2020
1 parent 4bff1bb commit b5c5510
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions +iosr/+statistics/boxPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
% IOSR.STATISTICS.QUANTILE.
% notch - Logical value indicating whether the box
% should have a notch. The notch is centred on
% the median and extends to ±1.58*IQR/sqrt(N),
% the median and extends to ±1.58*IQR/sqrt(N),
% where N is the sample size (number of non-NaN
% rows in Y). Generally if the notches of two
% boxes do not overlap, this is evidence of a
Expand Down Expand Up @@ -2349,7 +2349,7 @@ function eventHandler(obj,hProp,eventData)
try
maxDisplacement = interp1(xd, d, y);
catch
maxDisplacement = zeros(size(y));
maxDisplacement = ones(size(y));
end
randOffset = rand(size(y));%randperm(numel(y))-1;
randOffset = (2*randOffset) - 1;
Expand Down

0 comments on commit b5c5510

Please sign in to comment.