Skip to content

Commit

Permalink
Remove reliance on the stats toolbox and simplify install procedure.
Browse files Browse the repository at this point in the history
  • Loading branch information
raacampbell committed Oct 11, 2016
1 parent 6122ba2 commit d7fcd27
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ A: Most modifications can be done using the function handles. See the function h

## Included functions
- notBoxPlot.m - generates plots as shown in screenshot
- SEM_calc.m - calculate standard error of the mean. Provided as a separate function file so that it can be used for other purposes.
- tInterval_calc.m - calculate a t-interval. For small sample sizes, the t-interval is larger than the SEM. Provided as a separate function file so that it can be used for other purposes.
- NBP.SEM_calc.m - calculate standard error of the mean. Provided as a separate function file so that it can be used for other purposes.
- NBP.tInterval_calc.m - calculate a t-interval. For small sample sizes, the t-interval is larger than the SEM. Provided as a separate function file so that it can be used for other purposes.
- NBP.example - makes a nice example plot

## Note
The MATLAB statistics toolbox is not required if you install the nantoolbox from here: http://pub.ist.ac.at/~schloegl/matlab/NaN/ Otherwise you will need the statistics toolbox for nan-handling.
## Installation
Add the ``code`` directory to your MATLAB path. Does not rely on any toolboxes.
File renamed without changes.
12 changes: 9 additions & 3 deletions code/plotting/NBP_example.m → code/+NBP/example.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
function NBP_example
function example
% Pretty example use of notBoxPlot

clf
set(gcf,'PaperPosition',[0,0,12,9]) %Just to make save to disk consistent
disp('Running example')

hFig=figure(1984);

set(hFig,...
'Name','notBoxPlot example',...
'PaperPosition',[0,0,12,9]) %Just to make save to disk consistent)
clf

W=0.45; %image width

Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions code/plotting/notBoxPlot.m → code/notBoxPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
%
% Rob Campbell - August 2016
%
% Also see: boxplot, NBP_example
% Also see: boxplot, NBP.example



Expand Down Expand Up @@ -188,7 +188,7 @@

%TODO: the following will be removed, along with other references to legacy calling, in the next release
varargin={'jitter',jitter,'style',style,'interval','SEM'}; %define varargin so we feed the new-form inputs to the recursive call, below.
intervalFun = @SEM_calc;
intervalFun = @NBP.SEM_calc;
interval= 'SEM';
markMedian = false;
end
Expand Down Expand Up @@ -219,9 +219,9 @@
%Set interval function
switch interval
case 'SEM'
intervalFun = @SEM_calc;
intervalFun = @NBP.SEM_calc;
case 'tInterval'
intervalFun = @tInterval_calc;
intervalFun = @NBP.tInterval_calc;
otherwise
error('Interval %s is unknown',interval)
end
Expand Down Expand Up @@ -325,10 +325,10 @@
function [h,statsOut]=myPlotter(X,Y)

SEM=intervalFun(Y); %Supplied external function
SD=nanstd(Y); %Requires the stats toolbox
mu=nanmean(Y); %Requires the stats toolbox
SD=std(Y,'omitnan'); %Requires the stats toolbox
mu=mean(Y,'omitnan'); %Requires the stats toolbox
if markMedian
med = nanmedian(Y);
med = median(Y,'omitnan');
end


Expand Down
4 changes: 2 additions & 2 deletions tests/core_tests.m
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function checkInputParameters(testCase)
h=notBoxPlot(y,x,'style','line','markMedian',true);
testCase.verifyTrue(isfield(h,'med'))

clf
NBP_example
%Check that the example runs
NBP.example

close(gcf)
end
Expand Down

0 comments on commit d7fcd27

Please sign in to comment.