├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── Plotting ├── FscatJit2.m ├── FscatJit2_mergeGroups.m ├── dabest.m ├── scatJit.m └── scatjit_mergeGroups.m ├── README.md ├── SampleData ├── DataFormat.png ├── IndividualGroups │ ├── MultipleGroups_sample.csv │ ├── MultipleGroups_sample.png │ ├── SharedControl_sample.png │ ├── TwoGroupPaired_sample.png │ ├── TwoGroup_sample.png │ └── TwoGroups_sample.csv ├── MergedGroups │ ├── MergedGroups_sample.csv │ ├── MergedGroups_sample.png │ ├── MergedSharedControl_sample.png │ ├── MultipleMergedGroups_sample.csv │ └── MultipleMergedGroups_sample.png └── OutputTables │ ├── MergedGroups_table.png │ ├── MergedSharedControl_table.png │ ├── MultipleGroups_table.png │ ├── MultipleMergedGroups_table.png │ ├── SharedControl_table.png │ ├── TwoGroupsPaired_table.png │ └── TwoGroups_table.png └── utilities ├── TGP_Scatter_Plot_CombinedParentalControls.m ├── bootmoes.m ├── calcSeverity.m ├── contrastplot.asv ├── dsxy2figxy.m ├── mes.m ├── nanpadcat.m ├── panel_2.6 ├── .DS_Store ├── demo │ ├── demopanel1.m │ ├── demopanel2.m │ ├── demopanel3.m │ ├── demopanel4.m │ ├── demopanel5.m │ ├── demopanel6.m │ ├── demopanel7.m │ ├── demopanel8.m │ ├── demopanel9.m │ ├── demopanelA.m │ ├── demopanelB.m │ ├── demopanelC.m │ ├── demopanelD.m │ ├── demopanelE.m │ ├── demopanelF.m │ ├── demopanelG.m │ ├── demopanel_callback.m │ ├── demopanel_minihist.m │ ├── demotest.m │ ├── eps2pdf.m │ └── panel.m ├── docs │ ├── export.html │ ├── export.png │ ├── export_thumb.png │ ├── index.html │ ├── index.png │ ├── index_thumb.png │ ├── layout.html │ ├── layout.png │ ├── layout_thumb.png │ └── panel.css └── license.txt ├── pvpmod.m ├── re_sort_uidents.m ├── repackData.m ├── setThirdAxis.m └── tripleErrorBars.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows default autosave extension 2 | *.asv 3 | 4 | # OSX / *nix default autosave extension 5 | *.m~ 6 | 7 | # Compiled MEX binaries (all platforms) 8 | *.mex* 9 | 10 | # Packaged app and toolbox files 11 | *.mlappinstall 12 | *.mltbx 13 | 14 | # Generated helpsearch folders 15 | helpsearch*/ 16 | 17 | # Simulink code generation folders 18 | slprj/ 19 | sccprj/ 20 | 21 | # Matlab code generation folders 22 | codegen/ 23 | 24 | # Simulink autosave extension 25 | *.autosave 26 | 27 | # Octave session info 28 | octave-workspace -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at joseshowh@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to DABEST-Matlab 2 | 3 | ## Did you find a bug? 4 | - Ensure the bug was not already reported by searching in [Issues](https://github.com/ACCLAB/DABEST-Matlab/issues). Check that the bug hasn't been addressed in a closed issue. 5 | 6 | - If the bug isn't being addressed, open a new one. Be sure to include a title and clear description, and a [minimally reproducible code sample](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) demonstrating the expected behavior that is not occurring. 7 | 8 | ## Did you write a patch that fixes a bug? 9 | - Open a new GitHub pull request with the patch. 10 | 11 | - Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. 12 | 13 | ## Do you intend to add a new feature or change an existing one? 14 | - Suggest your change by opening an issue, and adding an Enhancement tag. 15 | - If the maintainers and the community are in favour, create a fork and start writing code. 16 | 17 | 18 | DABEST-Matlab is a community tool for estimation statistics and analysis. We look forward to more robust and more elegant data visualizations from you all! 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The Clear BSD License 2 | 3 | Copyright (c) 2017-2019 Tayfun Tumkaya 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted (subject to the limitations in the disclaimer 8 | below) provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | * Neither the name of the copyright holder nor the names of its 18 | contributors may be used to endorse or promote products derived from this 19 | software without specific prior written permission. 20 | 21 | NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY 22 | THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 23 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 24 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 30 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | 34 | -------------------------------------------------------------------------------- /Plotting/FscatJit2.m: -------------------------------------------------------------------------------- 1 | function ss=FscatJit2(identifiers, data, varargin) 2 | 3 | % Plots data as both jittered points and an error bar, in the 4 | % order the identifiers are passed to it. It preserves whatever order 5 | % was in the fbmm structure. Also includes the option to define the circle 6 | % size or use a default. Also allows someone to add bars to the plot. 7 | % 8 | % FscatJit(identifiers, data) 9 | % Uses the default circle size, no bars 10 | % 11 | % FscatJit(identifiers, data, circleSize) 12 | % Defines the circle size, no bars 13 | % 14 | % FscatJit(identifiers, data, circleSize, 'on') 15 | % Defines the circle size, adds bars 16 | 17 | % Adam Claridge-Chang 20120522 Takes numeric variables on the X-axis as 18 | % well as nominal. 19 | % Labels xaxis with the uidents instead of numbers Adam CC 20121113 20 | 21 | % Sameer Aryal Jan 22, 2013. Can now compute mean difference and plot it 22 | % next to the bar scatjits, along with a floating axis. 23 | 24 | %% For testing_______ 25 | % Mamma mia 26 | % % % % clear all 27 | % % % % clc 28 | % % % % close all 29 | % % % % load('FscatJit_data.mat') %for two genotypes 30 | % % load('FscatJit_data_five.mat') % for 5 genotypes 31 | % % load ageingfbmm.mat % for debugging reverse axis 32 | % % load NaLactaefbmm.mat 33 | % load lightcurvefbmm.mat 34 | % % for n-genotypes 35 | % % clearvars -except fbmm 36 | % % identifiers = fbmm.szGenotype; 37 | % % data = fbmm.AngVbyEpoch(:,2); 38 | % 39 | % % % This option to test numeric identifiers 40 | % % a=rand(length(identifiers),1); 41 | % % b=a*4; 42 | % % identifiers=ceil(b); 43 | % % identifiers(1:45)=7; 44 | 45 | % % Generate artificial data 46 | % reps=20; 47 | % id={'abrams', 'daddy'}';% , 'tank', 'blah', 'blech', 'cch', 'blargh', 't', 'y', 'fgh', 'sdgh', 'sryj', 'wetrh'}'; 48 | % % id={'abrams', 'daddy', 'tank', 'blah', 'blech', 'cch'}';%, 'blargh', 't', 'y', 'fgh', 'sdgh', 'sryj', 'wetrh'}'; 49 | % % id={'abrams', 'daddy', 'tank', 'blah', 'blech', 'cch', 'blargh', 't', 'y', 'fgh', 'sdgh', 'sryj', 'wetrh'}'; 50 | % identifiers=repmat(id, reps, 1); 51 | % data=rand(length(identifiers), 1); 52 | 53 | % Set circleSize 54 | 55 | 56 | 57 | %% Deal with the varargin options 58 | % fprintf('Total number of inputs = %d\n',nargin); 59 | nVarargs = length(varargin); 60 | % fprintf('Inputs in varargin(%d):\n',nVarargs); 61 | % If no circleSize is given, define a default 62 | if nVarargs == 0 63 | lims = []; 64 | isPaired = 'N'; 65 | circleSize=170; 66 | barstate='off'; 67 | elseif nVarargs == 1 && isfloat(varargin{1}); 68 | lims = varargin{1}; 69 | isPaired = 'N'; 70 | circleSize= 170; 71 | barstate='off'; 72 | elseif nVarargs == 1 && ~isfloat(varargin{1}); 73 | lims = []; 74 | isPaired = varargin{1}; 75 | circleSize=50; 76 | barstate='off'; 77 | elseif nVarargs == 2 78 | lims = varargin{1}; 79 | isPaired = varargin{2}; 80 | circleSize=170; 81 | barstate='off'; 82 | elseif nVarargs == 3 83 | lims = varargin{1}; 84 | isPaired = varargin{2}; 85 | circleSize=varargin{3}; 86 | barstate='off'; 87 | elseif nVarargs == 4 88 | lims = varargin{1}; 89 | isPaired = varargin{2}; 90 | circleSize=varargin{3}; 91 | barstate=varargin{4}; 92 | end 93 | 94 | switch barstate 95 | case 'on' 96 | middle_bar='off'; 97 | case 'off' 98 | middle_bar='on'; 99 | otherwise 100 | end 101 | 102 | 103 | 104 | %% Repack into nan-padded columns if they are in vector form 105 | if size(identifiers)==size(data) 106 | [celld, uidents] = repackData (identifiers, data); 107 | else 108 | uidents = identifiers; 109 | celld = data; 110 | end 111 | % Define nex 112 | nex=length(celld); 113 | 114 | 115 | if length(uidents) > 2 116 | p = panel(); 117 | p.pack([50,50], 1); 118 | end 119 | 120 | %% Define plotting 121 | if iscell(identifiers) 122 | X=1:length(uidents); 123 | else 124 | X=uidents; 125 | end 126 | 127 | 128 | if length(uidents) > 2 129 | p(1,1).select(); 130 | end 131 | %% Plot bars as option 132 | if strcmp(barstate, 'on') 133 | for idx=1:nex 134 | curDat=celld{idx}; 135 | av(idx)=nanmean(curDat); 136 | end 137 | [b] = bar(av); 138 | mydata=(1:length(av)); 139 | bar_child=get(b,'Children'); 140 | set(bar_child,'CData',mydata); 141 | % colormap(summer) 142 | % beta=0.5; 143 | % brighten(beta) 144 | end 145 | 146 | %% Plot scatjits 147 | jitFactor=0.2; 148 | circleSize=circleSize./max(X);% So circleSize scales with n-data columns 149 | 150 | if strcmp(barstate, 'off') && strcmp(isPaired, 'N') 151 | colors = lines(100); 152 | for idx=1:nex 153 | curDat=celld{idx}; 154 | hold on 155 | [s1] = scatJit(curDat, jitFactor, X(idx) ,circleSize,colors(idx,:)); 156 | 157 | end 158 | end 159 | 160 | set(gca,'XTick',X); 161 | hold on; 162 | 163 | barwidth=0.5; 164 | linewidth = 1; 165 | % Use 1.96X SEM (margin of error on z-distibution) as the error bars 166 | for idx=1:nex 167 | 168 | curDat=celld{idx}; 169 | [av(idx), moes, bci] = bootmoes(curDat); 170 | 171 | er(:, idx) = moes; 172 | CI(idx, :) = bci; 173 | Value(idx, :) = av(idx); 174 | N(idx, :) = length(curDat); 175 | % stdcd=nanstd(curDat); 176 | % er(idx)=1.96*(stdcd/sqrt(length(curDat)-1)); 177 | end 178 | hold on; 179 | stats = table(uidents, Value, CI, N, 'VariableNames',{'Group','Value','CIs','N'}); 180 | 181 | [e1] = tripleErrorBars(av, er, X, barwidth, linewidth, middle_bar); 182 | 183 | 184 | %% Set ticks, contigent on whether it is 2 or some other number of datasets 185 | if length(celld)==2; 186 | Xplus=horzcat(X, 3); 187 | disp(Xplus); 188 | set(gca,'XTick',Xplus) 189 | mdidents=vertcat(uidents,' '); 190 | set(gca, 'xtickLabel', mdidents); 191 | set(gca, 'XLim', [0 length(mdidents)+1]); 192 | ylabel('value','FontSize',18,'FontName','Arial'); 193 | else 194 | set(gca,'XTick',X); 195 | % set(gca, 'xtickLabel', uidents); 196 | set(gca, 'xtickLabel', []); 197 | set(gca, 'XLim', [0 length(uidents)+1]); 198 | ylabel('value','FontSize',18,'FontName','Arial'); 199 | end 200 | 201 | 202 | %% Insert mean difference and CIs on a different axis if there is a pair 203 | if length(celld)==2; 204 | if strcmpi(isPaired, 'Y') 205 | colors = lines(100); 206 | hold off 207 | if length(celld{1}) == length (celld{2}) 208 | curDat = [celld{1} celld{2}]; 209 | else 210 | disp ('Number of flies do not match. Aborting'); 211 | return 212 | end 213 | [rows, ~] = size(curDat); 214 | paired = plot(curDat(1, :)); 215 | set(paired, 'Color', [0 0 0]); 216 | hold on; 217 | for idx = 2:rows 218 | paired = plot(curDat(idx, :)); 219 | set(paired, 'Color', [0 0 0]); 220 | end 221 | set(gca,'XTick',Xplus) 222 | set(gca, 'xtickLabel', mdidents); 223 | set(gca, 'XLim', [0 length(mdidents)+1], 'box', 'off'); 224 | ylabel('value','FontSize',18,'FontName','Arial'); 225 | tripleErrorBars(av, er, [.5 2.5], barwidth, linewidth, middle_bar); 226 | end 227 | 228 | % Get the mean difference and CIs 229 | 230 | esm='md'; 231 | if strcmp(isPaired, 'Y') 232 | ss=mes(celld{2},celld{1},esm,'nBoot',10000, 'isDep', 1); 233 | else 234 | ss=mes(celld{2},celld{1},esm,'nBoot',10000); 235 | end 236 | avr=repmat(ss.md,2, 1); 237 | moes=abs(avr-ss.mdCi); 238 | delta_name = {[uidents{2}, ' minus ', uidents{1}]}; 239 | stats_delta = table(delta_name, ss.md, ss.mdCi', NaN, 'VariableNames', {'Group','Value','CIs','N'}); 240 | stats = [stats; stats_delta]; 241 | 242 | % Position of the reference axes (the axes that hold the scatjit) 243 | refAxes = gca; 244 | if isempty(lims) == 0 245 | set(refAxes, 'YLim', lims); 246 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 247 | if ss.md < 0 248 | while (num3*y2-(num3-1)*y) <= ax1Pos(2) 249 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 250 | end 251 | % elseif ss.md>0 252 | % while (num3*y2-(num3-1)*y) >= ax1Pos(2) + ax1Pos(4); 253 | % [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 254 | % end 255 | end 256 | else 257 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 258 | end 259 | 260 | 261 | if ss.md < 0 262 | 263 | while (num3*y2-(num3-1)*y) <= ax1Pos(2) 264 | refLims = get(refAxes, 'YLim'); 265 | refDiff = 0.1*(refLims(2) - refLims(1)); 266 | newRefLims = [refLims(1)-refDiff refLims(2)+refDiff]; 267 | set(refAxes, 'YLim', newRefLims); 268 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 269 | end 270 | 271 | 272 | 273 | % Errorbar axis 274 | errorBarAxis = axes('Position',[ax1Pos(1) num3*y2-(num3-1)*y ax1Pos(3) yNew-(num3*y2-(num3-1)*y)]); 275 | p3= errorbar(3 ,ss.md, moes(1),moes(2)); 276 | 277 | axis([0 4 num3*ss.md (num-1)*abs(ss.md)]); 278 | 279 | 280 | 281 | % Dummy axis that emuluates errorbar axis, but is placed next 282 | % to the mean difference 283 | dummyAxis = axes('Position',[ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2) num3*y2-(num3-1)*y .001 yNew-(num3*y2-(num3-1)*y)]); 284 | axis([0 4 num3*ss.md (num-1)*abs(ss.md)]); 285 | 286 | marker ='v'; 287 | elseif ss.md > 0 288 | 289 | while (num3*y2-(num3-1)*y) >= ax1Pos(2) + ax1Pos(4); 290 | refLims = get(refAxes, 'YLim'); 291 | refDiff = 0.1*(refLims(2) - refLims(1)); 292 | newRefLims = [refLims(1)-refDiff refLims(2)+refDiff]; 293 | set(refAxes, 'YLim', newRefLims); 294 | [num, num3, ax1Pos, x, y, x2, y2, ~, ~] = setThirdAxis(refAxes, av, ss.md); 295 | end 296 | 297 | 298 | % Errorbar axis 299 | errorBarAxis = axes('Position',[ax1Pos(1) num*y-(num-1)*y2 ax1Pos(3) ((num3*y2-(num3-1)*y) - (num*y-(num-1)*y2))]); 300 | p3= errorbar(3 ,ss.md, moes(1),moes(2)); 301 | 302 | axis([0 4 (num-1)*(-1)*ss.md num3*(ss.md)]); 303 | 304 | % Dummy axis that emuluates the y values of hte errorbar axis, but is placed next 305 | % to the mean difference 306 | dummyAxis = axes('Position',[ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2) num*y-(num-1)*y2 .001 ((num3*y2-(num3-1)*y) - (num*y-(num-1)*y2))]); 307 | axis([0 4 (num-1)*(-1)*ss.md num3*(ss.md)]); 308 | marker ='^'; 309 | 310 | else 311 | 312 | errorBarAxis = axes('Position',[ax1Pos(1) y-0.3 ax1Pos(3) 0.6]); 313 | 314 | p3= errorbar(3 ,ss.md, moes(1),moes(2)); 315 | axis([0 4 -.1 .1]); 316 | 317 | dummyAxis = axes('Position',[ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2) y-0.3 .001 0.6]); 318 | axis([0 4 -0.1 0.1]); 319 | 320 | marker ='o'; 321 | end 322 | 323 | if strcmp(isPaired, 'Y') 324 | colors = lines(100); 325 | [x,~] = dsxy2figxy(refAxes, .5, av(1)); 326 | [x2, ~] = dsxy2figxy(refAxes, 2.5, av(2)); 327 | line1= annotation('line', [x ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1)))], [y y]); 328 | line2=annotation('line', [x2 ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1)))], [y2 y2]); 329 | 330 | else 331 | % Plot the lines that join the means to the difference axis. 332 | line1= annotation('line', [x ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2)], [y y]); 333 | line2=annotation('line', [x2 ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2)], [y2 y2]); 334 | end 335 | 336 | set(line1, 'LineStyle', ':'); 337 | set(line2, 'LineStyle', ':'); 338 | 339 | %marker = 'v'; 340 | set(p3,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],... 341 | 'MarkerSize',5,... 342 | 'Marker',marker,... 343 | 'LineStyle','none'); 344 | 345 | set(errorBarAxis, 'Visible', 'Off'); 346 | set(dummyAxis, 'YAxisLocation', 'right'); 347 | % set(dummyAxis, 'FontSize', 7); 348 | 349 | else 350 | % To ensure consistency with the md plot so that each figure has 3 351 | % child axes 352 | refAxes = gca; 353 | errorBarAxis = axes('Position', get(refAxes, 'Position')); 354 | dummyAxis = axes('Position', get(refAxes, 'Position')); 355 | set(errorBarAxis,'Color','k', 'Visible', 'Off'); 356 | set(dummyAxis,'Color','k', 'Visible', 'Off'); 357 | marker = 'o'; 358 | ylabel('value','FontSize',18,'FontName','Arial'); 359 | if isempty(lims) == 0 360 | set(refAxes, 'YLim', lims); 361 | end 362 | 363 | % Get the mean difference and CIs 364 | esm='md'; 365 | clear moes; 366 | 367 | avr = zeros(2, length(celld)); 368 | moes = zeros(2, length(celld)); 369 | ci = zeros(2, length(celld)); 370 | N = NaN(length(celld)-1,1); 371 | 372 | for idx = 2:length(celld) 373 | ss=mes(celld{idx},celld{1},esm,'nBoot',10000); 374 | avr(:,idx)=repmat(ss.md,2, 1); 375 | moes(:,idx)=abs(avr(:,idx)-ss.mdCi); 376 | ci(:,idx) = ss.mdCi; 377 | delta_name(idx-1,:) = {[uidents{idx}, ' minus ', uidents{1}]}; 378 | end 379 | 380 | stats_delta = table(delta_name, avr(1,2:end)', ci(:,2:end)', N, 'VariableNames', {'Group','Value','CIs','N'}); 381 | stats = [stats; stats_delta]; 382 | 383 | [ciMin, ~] = min(ci(1,:)); 384 | [ciMax, ~] = max(ci(2,:)); 385 | 386 | axLo = ciMin - .1*abs(ciMax-ciMin); 387 | axHi = ciMax + .1*abs(ciMax-ciMin); 388 | 389 | p(2,1).select(); 390 | ylabel('delta value','FontSize',18,'FontName','Arial'); 391 | p4= errorbar(1:length(avr(1,:)), avr(1,:), moes(1,:), moes(2,:)); 392 | 393 | axis([0 length(avr(1,:))+1 axLo axHi]); 394 | 395 | marker ='o'; 396 | 397 | set(p4,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],'Color','k',... 398 | 'MarkerSize',5,... 399 | 'Marker',marker,... 400 | 'LineStyle','none'); 401 | set(gca, 'Xtick', X, 'xtickLabel', uidents); 402 | 403 | line1 = refline(0,0); 404 | set(line1, 'lineStyle', ':') 405 | 406 | %% Multiple pairwise comparisons 407 | clearvars avr moes ci delta_name N; 408 | if mod(length(celld),2)==0 409 | figure; 410 | pwmd = panel(); 411 | pwmd.pack([50,50], 1); 412 | 413 | marker = 'o'; 414 | 415 | % Pairwise mean differences 416 | idx = 1; 417 | jdx = 1; 418 | 419 | while jdx < length(celld) 420 | ss=mes(celld{jdx+1},celld{jdx},esm,'nBoot',10000); 421 | avr(:,idx)=repmat(ss.md,2, 1); 422 | moes(:,idx)=abs(avr(:,idx)-ss.mdCi); 423 | ci(:,idx) = ss.mdCi; 424 | delta_name(idx,:) = {[uidents{jdx+1}, ' minus ', uidents{jdx}]}; 425 | 426 | jdx = jdx+2; 427 | idx = idx + 1; 428 | end 429 | stats_delta = table(delta_name, avr(1,:)', ci', NaN(length(delta_name),1), 'VariableNames', {'Group','Value','CIs','N'}); 430 | stats = [stats; stats_delta]; 431 | 432 | count = 0; 433 | idx = 1; 434 | while idx <= length(X) 435 | for jdx = 1:2 436 | newX(idx) = X(idx)+(count); 437 | idx = idx + 1; 438 | end 439 | count = count + 1; 440 | end 441 | 442 | pwmd(1,1).select(); 443 | refAxes = gca; 444 | marker = 'o'; 445 | ylabel('value','FontSize',18,'FontName','Arial'); 446 | if isempty(lims) == 0 447 | set(refAxes, 'YLim', lims); 448 | end 449 | set(refAxes, 'XLim', [0 max(newX)+1]); 450 | 451 | if strcmp(barstate, 'on') 452 | for idx=1:nex 453 | curDat=celld{idx}; 454 | av(idx)=nanmean(curDat); 455 | end 456 | [b] = bar(newX, av); 457 | mydata=(1:length(av)); 458 | bar_child=get(b,'Children'); 459 | for idx = 1:nex 460 | if mod(idx, 2)==1 461 | mydata(idx) = 0; 462 | else 463 | mydata(idx) = 1; 464 | end 465 | end 466 | set(bar_child,'CData',mydata); 467 | cmap = [0 0 0; 0 0 0]; 468 | set(k, 'EdgeColor', [0 0 0], 'LineWidth', 1.25); 469 | set(gca, 'box', 'off'); 470 | colormap(cmap); 471 | 472 | end 473 | 474 | if strcmp(barstate, 'off') 475 | for idx = 1:nex 476 | curDat=celld{idx}; 477 | hold on 478 | scatJit(curDat, jitFactor, newX(idx), circleSize,colors(idx,:)); 479 | end 480 | end 481 | tripleErrorBars(av, er, newX,barwidth, linewidth, middle_bar); 482 | 483 | 484 | pwmd(2,1).select(); 485 | ylabel('delta value','FontSize',18,'FontName','Arial'); 486 | 487 | idx = 1; 488 | count = 1; 489 | esX = zeros(1, length(newX)/2); 490 | while count <= length(newX)/2 491 | esX(count) = (newX(idx) + newX(idx+1))/2; 492 | idx = idx + 2; 493 | count = count + 1; 494 | end 495 | 496 | p5= errorbar(esX, avr(1,:), moes(1,:), moes(2,:)); 497 | 498 | marker ='o'; 499 | set(p5,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],'Color','k',... 500 | 'MarkerSize',5,... 501 | 'Marker',marker,... 502 | 'LineStyle','none'... 503 | ); 504 | set(refAxes, 'Xtick', []); 505 | % set(refAxes,'XTick',newX, 'xtickLabel', uidents); 506 | set(gca, 'Xtick', newX, 'xtickLabel', uidents); 507 | set(gca, 'XLim', get(refAxes, 'Xlim')); 508 | 509 | line1 = refline(0,0); 510 | set(line1, 'lineStyle', ':') 511 | end 512 | 513 | end 514 | ss = stats; 515 | end 516 | -------------------------------------------------------------------------------- /Plotting/FscatJit2_mergeGroups.m: -------------------------------------------------------------------------------- 1 | function [ss] =FscatJit2_mergeGroups(identifiers, data, varargin) 2 | 3 | % Plots data as both jittered points and an error bar, in the 4 | % order the identifiers are passed to it. It preserves whatever order 5 | % was in the fbmm structure. Also includes the option to define the circle 6 | % size or use a default. Also allows someone to add bars to the plot. 7 | % 8 | % FscatJit(identifiers, data) 9 | % Uses the default circle size, no bars 10 | % 11 | % FscatJit(identifiers, data, circleSize) 12 | % Defines the circle size, no bars 13 | % 14 | % FscatJit(identifiers, data, circleSize, 'on') 15 | % Defines the circle size, adds bars 16 | 17 | % Adam Claridge-Chang 20120522 Takes numeric variables on the X-axis as 18 | % well as nominal. 19 | % Labels xaxis with the uidents instead of numbers Adam CC 20121113 20 | 21 | % Sameer Aryal Jan 22, 2013. Can now compute mean difference and plot it 22 | % next to the bar scatjits, along with a floating axis. 23 | 24 | %% For testing_______ 25 | % Mamma mia 26 | % % % % clear all 27 | % % % % clc 28 | % % % % close all 29 | % % % % load('FscatJit_data.mat') %for two genotypes 30 | % % load('FscatJit_data_five.mat') % for 5 genotypes 31 | % % load ageingfbmm.mat % for debugging reverse axis 32 | % % load NaLactaefbmm.mat 33 | % load lightcurvefbmm.mat 34 | % % for n-genotypes 35 | % % clearvars -except fbmm 36 | % % identifiers = fbmm.szGenotype; 37 | % % data = fbmm.AngVbyEpoch(:,2); 38 | % 39 | % % % This option to test numeric identifiers 40 | % % a=rand(length(identifiers),1); 41 | % % b=a*4; 42 | % % identifiers=ceil(b); 43 | % % identifiers(1:45)=7; 44 | 45 | % % Generate artificial data 46 | % reps=20; 47 | % id={'abrams', 'daddy'}';% , 'tank', 'blah', 'blech', 'cch', 'blargh', 't', 'y', 'fgh', 'sdgh', 'sryj', 'wetrh'}'; 48 | % % id={'abrams', 'daddy', 'tank', 'blah', 'blech', 'cch'}';%, 'blargh', 't', 'y', 'fgh', 'sdgh', 'sryj', 'wetrh'}'; 49 | % % id={'abrams', 'daddy', 'tank', 'blah', 'blech', 'cch', 'blargh', 't', 'y', 'fgh', 'sdgh', 'sryj', 'wetrh'}'; 50 | % identifiers=repmat(id, reps, 1); 51 | % data=rand(length(identifiers), 1); 52 | 53 | % Set circleSize 54 | 55 | 56 | 57 | %% Deal with the varargin options 58 | % fprintf('Total number of inputs = %d\n',nargin); 59 | nVarargs = length(varargin); 60 | % fprintf('Inputs in varargin(%d):\n',nVarargs); 61 | % If no circleSize is given, define a default 62 | if nVarargs == 0 63 | lims = []; 64 | isPaired = 'N'; 65 | circleSize=170; 66 | barstate='off'; 67 | elseif nVarargs == 1 && isfloat(varargin{1}); 68 | lims = varargin{1}; 69 | isPaired = 'N'; 70 | circleSize= 170; 71 | barstate='off'; 72 | elseif nVarargs == 1 && ~isfloat(varargin{1}); 73 | lims = []; 74 | isPaired = varargin{1}; 75 | circleSize=170; 76 | barstate='off'; 77 | elseif nVarargs == 2 78 | lims = varargin{1}; 79 | isPaired = varargin{2}; 80 | circleSize=170; 81 | barstate='off'; 82 | elseif nVarargs == 3 83 | lims = varargin{1}; 84 | isPaired = varargin{2}; 85 | circleSize=varargin{3}; 86 | barstate='off'; 87 | elseif nVarargs == 4 88 | lims = varargin{1}; 89 | isPaired = varargin{2}; 90 | circleSize=varargin{3}; 91 | barstate=varargin{4}; 92 | end 93 | 94 | switch barstate 95 | case 'on' 96 | middle_bar='off'; 97 | case 'off' 98 | middle_bar='on'; 99 | otherwise 100 | end 101 | 102 | 103 | 104 | %% Repack into nan-padded columns if they are in vector form 105 | if size(identifiers)==size(data) 106 | [celld, uidents] = repackData (identifiers, data); 107 | else 108 | uidents = identifiers; 109 | celld = data; 110 | end 111 | % Define nex 112 | nex=length(celld); 113 | 114 | %%Tayfun commented out 115 | if length(uidents) > 3 116 | p = panel(); 117 | p.pack([50,50], 1); 118 | end 119 | 120 | %% Define plotting 121 | if iscell(identifiers) 122 | X=1:length(uidents)-1; 123 | else 124 | X=uidents; 125 | end 126 | 127 | 128 | %%Tayfun commented out 129 | if length(uidents) > 3 130 | p(1,1).select(); 131 | end 132 | %% Plot bars as option 133 | if strcmp(barstate, 'on') 134 | for idx=1:nex 135 | curDat=celld{idx}; 136 | av(idx)=nanmean(curDat); 137 | end 138 | [b] = bar(av); 139 | mydata=(1:length(av)); 140 | bar_child=get(b,'Children'); 141 | set(bar_child,'CData',mydata); 142 | % colormap(summer) 143 | % beta=0.5; 144 | % brighten(beta) 145 | end 146 | 147 | %% Plot scatjits 148 | jitFactor=0.2; 149 | circleSize=circleSize./max(X);% So circleSize scales with n-data columns 150 | 151 | if strcmp(barstate, 'off') && strcmp(isPaired, 'N') 152 | 153 | if nex > 2 154 | colors = lines(100); 155 | %colors = {'blue','green','red'}; 156 | for idx=1:nex 157 | curDat=celld{idx}; 158 | hold on 159 | 160 | if idx == 1 161 | [s1] = scatjit_mergeGroups(curDat, jitFactor, 1 ,circleSize,colors(idx,:)); 162 | elseif idx ==2 163 | [s1] = scatjit_mergeGroups(curDat, jitFactor, 1 ,circleSize,colors(idx,:)); 164 | else 165 | [s1] = scatjit_mergeGroups(curDat, jitFactor, idx-1 ,circleSize,colors(idx,:)); 166 | end 167 | end 168 | else 169 | disp('Use the old version of this code(Tayfun)') 170 | 171 | end 172 | end 173 | 174 | 175 | 176 | % set(gca,'XTick',X); 177 | hold on 178 | 179 | barwidth=0.5; 180 | linewidth = 1; 181 | % Use 1.96X SEM (margin of error on z-distibution) as the error bars 182 | if nex > 2 183 | for idx=1:nex 184 | 185 | if idx == 1 186 | curDat=[celld{1};celld{2}]; 187 | [av(1), moes, bci] = bootmoes(curDat); 188 | er(:,1)=moes; 189 | N(:,1) = length(curDat); 190 | CI(:,1) = bci; 191 | elseif idx == 2 192 | 193 | else 194 | curDat=celld{idx}; 195 | [av(idx-1), moes, bci] = bootmoes(curDat); 196 | er(:, (idx-1))=moes; 197 | N(:,idx-1) = length(curDat); 198 | CI(:,idx-1) = bci; 199 | 200 | end 201 | 202 | end 203 | 204 | 205 | else 206 | disp('Use the old version of this code(Tayfun)') 207 | curDat=celld{idx}; 208 | [av(idx), moes, bci] = bootmoes(curDat); 209 | er(:, idx)=moes; 210 | end 211 | 212 | % stdcd=nanstd(curDat); 213 | % er(idx)=1.96*(stdcd/sqrt(length(curDat)-1)); 214 | 215 | hold on; 216 | [e1] = tripleErrorBars(av, er, X, barwidth, linewidth, middle_bar); 217 | 218 | %%%Tayfun: Combine cell{1} and cell{2} since they are driver and responder 219 | %%%controls. Get the MD against cell{3} which is the experiment. 220 | 221 | if nex == 3 222 | L = {[uidents{1},'(n=',num2str(length(celld{1})),')'],... 223 | [uidents{2},'(n=',num2str(length(celld{2})),')'],... 224 | [uidents{3},'(n=',num2str(length(celld{3})),')']... 225 | }; 226 | else 227 | L = {[uidents{1},'(n=',num2str(length(celld{1})),')'],... 228 | [uidents{2},'(n=',num2str(length(celld{2})),')'],... 229 | [uidents{3},'(n=',num2str(length(celld{3})),')']... 230 | % ['Experimental Genotypes'],... 231 | }; 232 | end 233 | 234 | ylabel('value','FontSize',18,'FontName','Arial'); 235 | 236 | 237 | %%%Tayfun: Combining the first two genotypes which are parental 238 | %%%controls 239 | if nex > 2 240 | celld_combined_ctls = cell(nex-1,1); 241 | celld_combined_ctls{1} = [celld{1};celld{2}]; 242 | 243 | for nex_id=1:(nex-2) 244 | celld_combined_ctls{nex_id+1} = celld{nex_id+2}; 245 | end 246 | 247 | end 248 | 249 | celld_backup = celld; 250 | %%%Keep original data to use in multiple pairwise comparison%%%% 251 | 252 | celld = celld_combined_ctls; 253 | 254 | %% Set ticks, contigent on whether it is 2 or some other number of datasets 255 | if length(celld)==2; 256 | uidents_combined = cell(length(uidents)-1,1); 257 | uidents_combined{1} = [uidents{1},uidents{2}]; 258 | uidents_combined{2} = uidents{3}; 259 | %uidents_combined{3} = ' '; 260 | 261 | Xplus=horzcat(X, 3); 262 | set(gca,'XTick',Xplus); 263 | set(gca, 'xtickLabel', uidents_combined); 264 | % set(gca,'YLim', [0 1000]); 265 | mdidents=vertcat(uidents); 266 | % set(gca, 'xtickLabel', mdidents); 267 | set(gca, 'XLim', [0 length(mdidents)+1]); 268 | 269 | else 270 | set(gca,'XTick',X); 271 | % set(gca, 'xtickLabel', uidents); 272 | set(gca, 'xtickLabel', []); 273 | set(gca, 'XLim', [0 length(uidents)]); 274 | 275 | uidents_combined = cell(length(uidents)-1,1); 276 | uidents_combined{1} = [uidents{1},uidents{2}]; 277 | uidents_combined(2:end) = uidents(3:end); 278 | 279 | end 280 | stats = table(uidents_combined(1:end,:), av', CI', N', 'VariableNames',{'Group','Value','CIs','N'}); 281 | 282 | %% Insert mean difference and CIs on a different axis if there is a pair 283 | if length(celld)==2; 284 | legend(L); 285 | if strcmpi(isPaired, 'Y') 286 | hold off 287 | if length(celld{1}) == length (celld{2}) 288 | curDat = [celld{1} celld{2}]; 289 | else 290 | disp ('No. of flies does not match. Aborting'); 291 | return 292 | end 293 | [rows, ~] = size(curDat); 294 | paired = plot(curDat(1, :)); 295 | set(paired, 'Color', [0 0 0]); 296 | hold on; 297 | for idx = 2:rows 298 | paired = plot(curDat(idx, :)); 299 | set(paired, 'Color', [0 0 0]); 300 | end 301 | set(gca,'XTick',Xplus) 302 | set(gca, 'xtickLabel', mdidents); 303 | set(gca, 'XLim', [0 length(mdidents)+1], 'box', 'off'); 304 | % ylabel('Percent Time Spent at Alcove','FontSize',18,'FontName','Arial'); 305 | 306 | tripleErrorBars(av, er, [.5 2.5], barwidth, linewidth, middle_bar); 307 | end 308 | 309 | % Get the mean difference and CIs 310 | 311 | esm='md'; 312 | if strcmp(isPaired, 'Y') 313 | ss=mes(celld{2},celld{1},esm,'nBoot',10000,'isDep', 1); 314 | else 315 | ss=mes(celld{2},celld{1},esm,'nBoot',10000); 316 | end 317 | 318 | avr=repmat(ss.md,2, 1); 319 | moes=abs(avr-ss.mdCi); 320 | 321 | delta_name = {[uidents_combined{2}, ' minus ', uidents_combined{1}]}; 322 | stats_delta = table(delta_name, ss.md, ss.mdCi', NaN, 'VariableNames', {'Group','Value','CIs','N'}); 323 | stats = [stats; stats_delta]; 324 | 325 | % Position of the reference axes (the axes that hold the scatjit_Tayfun) 326 | refAxes = gca; 327 | if isempty(lims) == 0 328 | set(refAxes, 'YLim', lims); 329 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 330 | if ss.md < 0 331 | while (num3*y2-(num3-1)*y) <= ax1Pos(2) 332 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 333 | end 334 | % elseif ss.md>0 335 | % while (num3*y2-(num3-1)*y) >= ax1Pos(2) + ax1Pos(4); 336 | % [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 337 | % end 338 | end 339 | else 340 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 341 | end 342 | 343 | 344 | if ss.md < 0 345 | 346 | while (num3*y2-(num3-1)*y) <= ax1Pos(2) 347 | refLims = get(refAxes, 'YLim'); 348 | refDiff = 0.1*(refLims(2) - refLims(1)); 349 | newRefLims = [refLims(1)-refDiff refLims(2)+refDiff]; 350 | set(refAxes, 'YLim', newRefLims); 351 | [num, num3, ax1Pos, x, y, x2, y2, yNew, ~] = setThirdAxis(refAxes, av, ss.md); 352 | end 353 | 354 | 355 | 356 | % Errorbar axis 357 | errorBarAxis = axes('Position',[ax1Pos(1) num3*y2-(num3-1)*y ax1Pos(3) yNew-(num3*y2-(num3-1)*y)]); 358 | p3= errorbar(3 ,ss.md, moes(1),moes(2)); 359 | 360 | axis([0 4 num3*ss.md (num-1)*abs(ss.md)]); 361 | 362 | 363 | 364 | % Dummy axis that emuluates errorbar axis, but is placed next 365 | % to the mean difference 366 | dummyAxis = axes('Position',[ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2) num3*y2-(num3-1)*y .001 yNew-(num3*y2-(num3-1)*y)]); 367 | axis([0 4 num3*ss.md (num-1)*abs(ss.md)]); 368 | 369 | marker = 'v'; 370 | elseif ss.md > 0 371 | 372 | while (num3*y2-(num3-1)*y) >= ax1Pos(2) + ax1Pos(4); 373 | refLims = get(refAxes, 'YLim'); 374 | refDiff = 0.1*(refLims(2) - refLims(1)); 375 | newRefLims = [refLims(1)-refDiff refLims(2)+refDiff]; 376 | set(refAxes, 'YLim', newRefLims); 377 | [num, num3, ax1Pos, x, y, x2, y2, ~, ~] = setThirdAxis(refAxes, av, ss.md); 378 | end 379 | 380 | 381 | % Errorbar axis 382 | errorBarAxis = axes('Position',[ax1Pos(1) num*y-(num-1)*y2 ax1Pos(3) ((num3*y2-(num3-1)*y) - (num*y-(num-1)*y2))]); 383 | p3= errorbar(3 ,ss.md, moes(1),moes(2)); 384 | 385 | axis([0 4 (num-1)*(-1)*ss.md num3*(ss.md)]); 386 | 387 | % Dummy axis that emuluates the y values of hte errorbar axis, but is placed next 388 | % to the mean difference 389 | dummyAxis = axes('Position',[ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2) num*y-(num-1)*y2 .001 ((num3*y2-(num3-1)*y) - (num*y-(num-1)*y2))]); 390 | axis([0 4 (num-1)*(-1)*ss.md num3*(ss.md)]); 391 | 392 | marker = '^'; 393 | else 394 | 395 | errorBarAxis = axes('Position',[ax1Pos(1) y-0.3 ax1Pos(3) 0.6]); 396 | 397 | p3= errorbar(3 ,ss.md, moes(1),moes(2)); 398 | axis([0 4 -.1 .1]); 399 | 400 | dummyAxis = axes('Position',[ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2) y-0.3 .001 0.6]); 401 | axis([0 4 -0.1 0.1]); 402 | 403 | marker ='o'; 404 | end 405 | 406 | if strcmp(isPaired, 'Y') 407 | [x,~] = dsxy2figxy(refAxes, .5, av(1)); 408 | [x2, ~] = dsxy2figxy(refAxes, 2.5, av(2)); 409 | line1= annotation('line', [x ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1)))], [y y]); 410 | line2=annotation('line', [x2 ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1)))], [y2 y2]); 411 | 412 | else 413 | % Plot the lines that join the means to the difference axis. 414 | 415 | line1= annotation('line', [x ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2)], [y y]); 416 | line2=annotation('line', [x2 ax1Pos(1) + ax1Pos(3)-((x-ax1Pos(1))/2)], [y2 y2]); 417 | 418 | 419 | end 420 | 421 | set(line1, 'LineStyle', ':'); 422 | set(line2, 'LineStyle', ':'); 423 | 424 | 425 | set(p3,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],... 426 | 'MarkerSize',5,... 427 | 'Marker',marker,... 428 | 'LineStyle','none'); 429 | 430 | set(errorBarAxis, 'Visible', 'Off'); 431 | set(dummyAxis, 'YAxisLocation', 'right'); 432 | % set(dummyAxis, 'FontSize', 7); 433 | 434 | elseif length(celld)>2 435 | % To ensure consistency with the md plot so that each figure has 3 436 | % child axes 437 | refAxes = gca; 438 | errorBarAxis = axes('Position', get(refAxes, 'Position')); 439 | dummyAxis = axes('Position', get(refAxes, 'Position')); 440 | set(errorBarAxis, 'Visible', 'Off'); 441 | set(dummyAxis, 'Visible', 'Off'); 442 | ylabel('value','FontSize',18,'FontName','Arial'); 443 | if isempty(lims) == 0 444 | set(refAxes, 'YLim', lims); 445 | end 446 | 447 | % Get the mean difference and CIs 448 | esm='md'; 449 | clear moes; 450 | 451 | avr = zeros(2, length(celld)); 452 | moes = zeros(2, length(celld)); 453 | ci = zeros(2, length(celld)); 454 | N = NaN(length(celld)-1,1); 455 | 456 | for idx = 2:length(celld) 457 | ss=mes(celld{idx},celld{1},esm,'nBoot',10000); 458 | avr(:,idx)=repmat(ss.md,2, 1); 459 | moes(:,idx)=abs(avr(:,idx)-ss.mdCi); 460 | ci(:,idx) = ss.mdCi; 461 | delta_name(idx-1,:) = {[uidents_combined{idx}, ' minus ', uidents_combined{1}]}; 462 | end 463 | 464 | stats_delta = table(delta_name, avr(1,2:end)', ci(:,2:end)',N, 'VariableNames', {'Group','Value','CIs','N'}); 465 | stats = [stats; stats_delta]; 466 | 467 | [ciMin, ~] = min(ci(1,:)); 468 | [ciMax, ~] = max(ci(2,:)); 469 | 470 | axLo = ciMin - .1*abs(ciMax-ciMin); 471 | axHi = ciMax + .1*abs(ciMax-ciMin); 472 | 473 | p(2,1).select(); 474 | ylabel('delta value','FontSize',18,'FontName','Arial'); 475 | 476 | p4= errorbar(1:length(avr(1,:)), avr(1,:), moes(1,:), moes(2,:)); 477 | 478 | axis([0 length(avr(1,:))+1 axLo axHi]); 479 | 480 | marker ='o'; 481 | 482 | set(p4,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],'Color','k',... 483 | 'MarkerSize',5,... 484 | 'Marker',marker,... 485 | 'LineStyle','none'); 486 | 487 | uidents_combined = cell(length(uidents),1); 488 | uidents_combined{1} = [uidents{1},uidents{2}]; 489 | for uident_id=2:(length(uidents)-1) 490 | uidents_combined{uident_id} = uidents{uident_id+1}; 491 | end 492 | 493 | set(gca, 'Xtick', X, 'xtickLabel', uidents_combined); 494 | 495 | line1 = refline(0,0); 496 | set(line1, 'lineStyle', ':') 497 | 498 | 499 | %% Multiple pairwise comparisons 500 | clearvars avr moes er av CIs cis N delta_name; 501 | if mod(length(celld)+1,3)==0 502 | figure; 503 | pwmd = panel(); 504 | pwmd.pack([50,50], 1); 505 | 506 | 507 | %%%Re arrange original celld into 508 | %%%[ctl1,ctl2],[exp1],[ctl3,ctl4],[expt2]...] format%%%%%%%%% 509 | celld_combined_multiplepairwise = cell(2*(length(celld_backup)/3),1); 510 | cidx = 1; 511 | for index=1:length(celld_backup) 512 | 513 | if mod(index,3)==0 514 | newIDX = index-2; 515 | celld_combined_multiplepairwise{cidx} = [celld_backup{newIDX};celld_backup{newIDX+1}]; 516 | celld_combined_multiplepairwise{cidx+1} = [celld_backup{newIDX+2}]; 517 | cidx = cidx +2; 518 | end 519 | 520 | end 521 | 522 | end 523 | 524 | %%%%Names of the groups 525 | uidents_multiple = cell(2*(length(uidents)/3),1); 526 | uix = 1; 527 | for index=1:length(uidents) 528 | 529 | if mod(index,3)==0 530 | newuix = index-2; 531 | uidents_multiple{uix} = [uidents{newuix},uidents{newuix+1}]; 532 | uidents_multiple{uix+1} = [uidents{newuix+2}]; 533 | uix = uix +2; 534 | end 535 | 536 | end 537 | 538 | %%%%Error bars for the re-arranged data%%%%%%%% 539 | for id = 1:length(celld_combined_multiplepairwise) 540 | 541 | curDat=[celld_combined_multiplepairwise{id}]; 542 | [av(id), moesx, bci] = bootmoes(curDat); 543 | er(:,id)=moesx; 544 | CIs(:,id) = bci; 545 | N(:,id) = length(curDat); 546 | end 547 | 548 | stats_2 = table(uidents_multiple, av', CIs', N', 'VariableNames',{'Group','Value','CIs','N'}); 549 | 550 | 551 | % Pairwise mean differences 552 | idx = 1; 553 | jdx = 1; 554 | while jdx < length(celld_combined_multiplepairwise) 555 | ss=mes(celld_combined_multiplepairwise{jdx+1},celld_combined_multiplepairwise{jdx},esm,'nBoot',10000); 556 | avr(:,idx)=repmat(ss.md,2, 1); 557 | moes(:,idx)=abs(avr(:,idx)-ss.mdCi); 558 | cis(idx,:) = ss.mdCi; 559 | delta_name(idx, :) = {[uidents_multiple{jdx+1}, ' minus ', uidents_multiple{jdx}]}; 560 | jdx = jdx+2; 561 | idx = idx + 1; 562 | end 563 | stats_2_delta = table(delta_name, avr(1,:)', cis', NaN(length(delta_name),1), 'VariableNames', {'Group','Value','CIs','N'}); 564 | stats_2 = [stats_2; stats_2_delta]; 565 | 566 | X = 1:length(celld_combined_multiplepairwise); 567 | newX = X; 568 | 569 | 570 | %% Unneccessary newX variable definition via while loop (Tayfun)%%%%%% 571 | % count = 0; 572 | % idx = 1; 573 | % while idx <= length(X) 574 | % for jdx = 1:2 575 | % newX(idx) = X(idx)+(count); 576 | % idx = idx + 1; 577 | % end 578 | % count = count + 1; 579 | % end 580 | 581 | pwmd(1,1).select(); 582 | refAxes = gca; 583 | 584 | ylabel('value','FontSize',18,'FontName','Arial'); 585 | if isempty(lims) == 0 586 | set(refAxes, 'YLim', lims); 587 | end 588 | set(refAxes, 'XLim', [0 max(newX)+1]); 589 | 590 | if strcmp(barstate, 'on') 591 | for idx=1:nex 592 | curDat=celld{idx}; 593 | av(idx)=nanmean(curDat); 594 | end 595 | [b] = bar(newX, av); 596 | mydata=(1:length(av)); 597 | bar_child=get(b,'Children'); 598 | for idx = 1:nex 599 | if mod(idx, 2)==1 600 | mydata(idx) = 0; 601 | else 602 | mydata(idx) = 1; 603 | end 604 | end 605 | set(bar_child,'CData',mydata); 606 | % cmap = [1 1 1; 0.4000 0.4000 0.4000]; 607 | set(b, 'EdgeColor', 'k', 'LineWidth', 1.25); 608 | set(gca, 'box', 'off'); 609 | % colormap(cmap); 610 | 611 | end 612 | 613 | if strcmp(barstate, 'off') 614 | location = 1; 615 | for idx = 1:length(celld_backup) 616 | curDat=celld_backup{idx}; 617 | hold on 618 | 619 | %%% TrpA1(first parental ctl is always blue), Gal4(second 620 | %%% order ctl) is always green%%%%%%%%%%%%%% 621 | 622 | %colors = {'blue','green','red'}; 623 | %color_id = mod(idx,3); 624 | 625 | if mod(idx,3)==0 626 | location = location+1; 627 | [s2] = scatjit_mergeGroups(curDat, jitFactor, location,circleSize,colors(idx,:)); 628 | location = location+1; 629 | else 630 | [s2] = scatjit_mergeGroups(curDat, jitFactor, location,circleSize,colors(idx,:)); 631 | end 632 | end 633 | 634 | tripleErrorBars(av, er, X, barwidth, linewidth, middle_bar); 635 | 636 | %%%%Re_arrange labels to put them under the plot%%%%%%%%%%%%%% 637 | 638 | 639 | 640 | % L = {[uidents{1},'(n=',num2str(length(celld_backup{1})),')'],... 641 | % [uidents{2},'(n=',num2str(length(celld_backup{2})),')'],... 642 | % ['Experimental Genotypes']... 643 | % }; 644 | 645 | pwmd(2,1).select(); 646 | ylabel('delta value','FontSize',18,'FontName','Arial'); 647 | idx = 1; 648 | count = 1; 649 | esX = zeros(1, length(newX)/2); 650 | while count <= length(newX)/2 651 | esX(count) = (newX(idx) + newX(idx+1))/2; 652 | idx = idx + 2; 653 | count = count + 1; 654 | end 655 | 656 | p5= errorbar(esX, avr(1,:), moes(1,:), moes(2,:)); 657 | 658 | marker ='o'; 659 | set(p5,'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],'Color','k',... 660 | 'MarkerSize',5,... 661 | 'Marker',marker,... 662 | 'LineStyle','none'... 663 | ); 664 | set(refAxes, 'Xtick', []); 665 | 666 | % uidents_multiple = cell(2*(length(uidents)/3),1); 667 | % uix = 1; 668 | % for index=1:length(uidents) 669 | % 670 | % if mod(index,3)==0 671 | % newuix = index-2; 672 | % uidents_multiple{uix} = [uidents{newuix},uidents{newuix+1}]; 673 | % uidents_multiple{uix+1} = [uidents{newuix+2}]; 674 | % uix = uix +2; 675 | % end 676 | % 677 | % end 678 | 679 | 680 | set(gca, 'Xtick', X, 'xtickLabel', uidents_multiple); 681 | 682 | set(gca, 'XLim', get(refAxes, 'Xlim')); 683 | 684 | line1 = refline(0,0); 685 | set(line1, 'lineStyle', ':') 686 | 687 | end 688 | end 689 | 690 | if exist('stats_2') 691 | ss = stats_2; 692 | stats 693 | else 694 | ss = stats; 695 | end -------------------------------------------------------------------------------- /Plotting/dabest.m: -------------------------------------------------------------------------------- 1 | function [ss] = dabest(csvFile, varargin) 2 | 3 | d = readtable(csvFile); 4 | identifiers = d(:,{'Identifiers'}); 5 | identifiers = table2cell(identifiers); 6 | data = d(:,{'Values'}); 7 | data = table2array(data); 8 | close(gcf); 9 | 10 | if length(varargin) > 0; 11 | if strcmp(varargin{1},'Paired'); 12 | [ss] = FscatJit2(identifiers, data,'Y'); 13 | 14 | else strcmp(varargin{1},'mergeGroups'); 15 | [ss] = FscatJit2_mergeGroups(identifiers, data); 16 | 17 | end 18 | else 19 | [ss] = FscatJit2(identifiers, data); 20 | end 21 | 22 | end -------------------------------------------------------------------------------- /Plotting/scatJit.m: -------------------------------------------------------------------------------- 1 | function [s1] = scatJit(vec, jitFactor, col, circleSize, color) 2 | 3 | % Takes a vector and plots it as a jittered scatter around value col 4 | % Adam Claridge-Chang 20120411. Improved to modify jitter based on the 5 | % histogram 6 | % Adam Claridge-Chang 20120413 Further edited to use the bin 7 | % information to spread out the data evenly 8 | 9 | % % for testing_____________________ 10 | % clear all 11 | % close all 12 | % clc 13 | % load scatdistTestData.mat 14 | % col=4; 15 | % vec=vecs{1}; 16 | % jitFactor=0.2 17 | % % _________________________________ 18 | 19 | 20 | % make jitter factors 21 | sv=size(vec); 22 | A=[-1,1]; 23 | jits = A(randi([1,2],sv(1),sv(2))); 24 | % jits= ones(sv(1),sv(2)); 25 | jits=jits'.*jitFactor; 26 | 27 | % multiply jit factors by a histogram-based bias 28 | [n,xout] = hist(vec, 10); %NOTE: I am using the default 10 bins! 29 | nnorm= n/max(n); 30 | 31 | %find bin half width 32 | bhw=(xout(2)-xout(1))./2; 33 | 34 | %find bin boundaries and multiply jitters by normalization factor 35 | %Note: addition of small value to the bottom end of the histogram to solve 36 | %a rounding error problem. 37 | for idx=1:length(xout) 38 | if idx==1 39 | inBins=find(vec >= (xout(idx) - (bhw+0.00001)) & vec < (xout(idx) + bhw)); 40 | else 41 | inBins=find(vec > (xout(idx) - bhw) & vec <= (xout(idx) + bhw+0.00001)); 42 | end 43 | % find how many data points there are in a bin 44 | jits(inBins)=jits(inBins).*nnorm(idx); 45 | binjits = jits(inBins); 46 | bjn=numel(binjits); 47 | % spread out the bin members along the x-axis 48 | if bjn >0; 49 | bjn=bjn-1; 50 | step= (binjits(1).*2/bjn); 51 | bjrange=[(binjits(1)*-1):step:binjits(1)]; 52 | jits(inBins)=bjrange; 53 | end 54 | 55 | 56 | end 57 | 58 | %make clones of vec 59 | clone=repmat(col, sv(1), sv(2)); 60 | clonejit=clone+jits; 61 | % s1 = scatter(clonejit, vec, 50, 'k', 'filled'); 62 | 63 | if isempty(circleSize) 64 | circleSize=30; 65 | end 66 | s1 = scatter(clonejit, vec, circleSize , color, 'filled'); 67 | 68 | -------------------------------------------------------------------------------- /Plotting/scatjit_mergeGroups.m: -------------------------------------------------------------------------------- 1 | function [s1] = scatJit(vec, jitFactor, col, circleSize,color) 2 | 3 | % Takes a vector and plots it as a jittered scatter around value col 4 | % Adam Claridge-Chang 20120411. Improved to modify jitter based on the 5 | % histogram 6 | % Adam Claridge-Chang 20120413 Further edited to use the bin 7 | % information to spread out the data evenly 8 | 9 | % % for testing_____________________ 10 | % clear all 11 | % close all 12 | % clc 13 | % load scatdistTestData.mat 14 | % col=4; 15 | % vec=vecs{1}; 16 | % jitFactor=0.2 17 | % % _________________________________ 18 | 19 | 20 | % make jitter factors 21 | sv=size(vec); 22 | A=[-1,1]; 23 | jits = A(randi([1,2],sv(1),sv(2))); 24 | % jits= ones(sv(1),sv(2)); 25 | jits=jits'.*jitFactor; 26 | 27 | % multiply jit factors by a histogram-based bias 28 | [n,xout] = hist(vec, 10); %NOTE: I am using the default 10 bins! 29 | nnorm= n/max(n); 30 | 31 | %find bin half width 32 | bhw=(xout(2)-xout(1))./2; 33 | 34 | %find bin boundaries and multiply jitters by normalization factor 35 | %Note: addition of small value to the bottom end of the histogram to solve 36 | %a rounding error problem. 37 | for idx=1:length(xout) 38 | if idx==1 39 | inBins=find(vec >= (xout(idx) - (bhw+0.00001)) & vec < (xout(idx) + bhw)); 40 | else 41 | inBins=find(vec > (xout(idx) - bhw) & vec <= (xout(idx) + bhw+0.00001)); 42 | end 43 | % find how many data points there are in a bin 44 | jits(inBins)=jits(inBins).*nnorm(idx); 45 | binjits = jits(inBins); 46 | bjn=numel(binjits); 47 | % spread out the bin members along the x-axis 48 | if bjn >0; 49 | bjn=bjn-1; 50 | step= (binjits(1).*2/bjn); 51 | bjrange=[(binjits(1)*-1):step:binjits(1)]; 52 | jits(inBins)=bjrange; 53 | end 54 | 55 | 56 | end 57 | 58 | %make clones of vec 59 | clone=repmat(col, sv(1), sv(2)); 60 | clonejit=clone+jits; 61 | % s1 = scatter(clonejit, vec, 50, 'k', 'filled'); 62 | 63 | if isempty(circleSize) 64 | circleSize=30; 65 | end 66 | s1 = scatter(clonejit, vec, circleSize, color, 'filled'); 67 | 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DABEST-Matlab 2 | 3 | ## About 4 | 5 | DABEST is a data analysis tool that is intended to make estimation statistics more accessible to scientific communities. Estimation statistics is a superior alternative to null hypothesis significance testing (NHST), in which effect size and confidence intervals are used to interpret results as opposed to dichotomous significance testing. 6 | 7 | This code allows the user to visualize the data as scatterplots; calculates the effect size and confidence intervals of the difference between multiple groups; and plots the results on the same figure. This figure design allows for a visual inspection of the observed values distribution, and displays the differences between multiple groups of data. 8 | 9 | ## Installation 10 | 11 | DABEST-Matlab can be installed via MATLAB Central (https://www.mathworks.com/matlabcentral/fileexchange/65260-dabest-matlab) or GitHub (how to clone a repo: https://help.github.com/articles/cloning-a-repository/). 12 | 13 | ## How to cite 14 | 15 | **Moving beyond P values: Everyday data analysis with estimation plots** 16 | 17 | *Joses Ho, Tayfun Tumkaya, Sameer Aryal, Hyungwon Choi, Adam Claridge-Chang* 18 | 19 | Nature Methods 2019, 1548-7105. [10.1038/s41592-019-0470-3](http://dx.doi.org/10.1038/s41592-019-0470-3) 20 | 21 | [Paywalled publisher site](https://www.nature.com/articles/s41592-019-0470-3); [Free-to-view PDF](https://rdcu.be/bHhJ4) 22 | 23 | 24 | ## Bugs 25 | 26 | Please report any bugs on the [Github issue tracker](https://github.com/ACCLAB/DABEST-Matlab/issues/new). 27 | 28 | 29 | ## Contributing 30 | 31 | All contributions are welcome; please read the [Guidelines for contributing](https://github.com/ACCLAB/DABEST-Matlab/blob/master/CONTRIBUTING.md) first. 32 | 33 | We also have a [Code of Conduct](https://github.com/ACCLAB/DABEST-Matlab/blob/master/CODE_OF_CONDUCT.md) to foster an inclusive and productive space. 34 | 35 | 36 | 37 | ## DABEST in other languages 38 | 39 | DABEST is also available in R ([dabestr](https://github.com/ACCLAB/dabestr)) and Python ([DABEST-Python](https://github.com/ACCLAB/DABEST-Python)). 40 | 41 | 42 | ## Tutorial 43 | 44 | ### Data format 45 | 46 | Data should be in *the csv file format* and contain two columns with the headers: *Identifiers* and *Values*. 47 | 48 | *Identifiers* are the labels of each data point, and *Values* are the data points (see the example below). 49 | 50 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/DataFormat.png) 51 | 52 | *Note: All the sample data used in this tutorial are taken from S. Champely's [anscombe2](https://www.rdocumentation.org/packages/PairedData/versions/0.9.9/topics/anscombe2) dataset, and can be found in DABEST-Matlab/SampleData/*. 53 | 54 | Depending on the number of groups the data contain, the main function *dabest* produces various plots, and returns the key 55 | information as a table object. 56 | 57 | ### 1. Two groups 58 | 59 | If the data have two different groups, `dabest('TwoGroups_sample.csv')` generates a *two groups* plot. 60 | 61 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/IndividualGroups/TwoGroup_sample.png) 62 | 63 | ### 2. Paired 64 | 65 | Running `dabest('TwoGroups_sample.csv','Paired')` generates a *paired* plot with the two groups data. 66 | 67 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/IndividualGroups/TwoGroupPaired_sample.png) 68 | 69 | ### 3. Multiple groups 70 | 71 | If the number of groups is an **even number**, a *multiple groups* plot will be automatically generated by `dabest('MultipleGroups_sample.csv')` command. 72 | 73 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/IndividualGroups/MultipleGroups_sample.png) 74 | 75 | ### 4. Shared control 76 | 77 | If there are more than two groups in the data, `dabest('MultipleGroups_sample.csv')` generates a *shared control* plot. 78 | 79 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/IndividualGroups/SharedControl_sample.png) 80 | 81 | ### 5. Merged groups 82 | 83 | To combine two groups of data and compare to a third group, run `dabest('MergedGroups_sample.csv','mergeGroups')`. 84 | 85 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/MergedGroups/MergedGroups_sample.png) 86 | 87 | ### 6. Multiple merged groups 88 | 89 | For the data that contain more than three groups -and a number that is divisible by 3, `dabest('MultipleMergedGroups_sample.csv','mergeGroups')` generates a *multiple merged groups* plot. 90 | 91 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/MergedGroups/MultipleMergedGroups_sample.png) 92 | 93 | ### 7. Merged shared control 94 | 95 | If the data contain more than three groups, `dabest('MultipleMergedGroups_sample.csv','mergeGroups')` automatically generates a second plot in which all the groups are compared to the *merged shared control*. 96 | 97 | ![](https://github.com/ACCLAB/DABEST-Matlab/blob/master/SampleData/MergedGroups/MergedSharedControl_sample.png) 98 | -------------------------------------------------------------------------------- /SampleData/DataFormat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/DataFormat.png -------------------------------------------------------------------------------- /SampleData/IndividualGroups/MultipleGroups_sample.csv: -------------------------------------------------------------------------------- 1 | Identifiers,Values 2 | A1,8.885 3 | A1,14.38 4 | A1,8.015 5 | A1,5.835 6 | A1,5.47 7 | A1,12.06 8 | A1,11.72 9 | A1,10.315 10 | A1,5.065 11 | A1,8.235 12 | A1,15.08 13 | A1,13.485 14 | A1,11.3 15 | A1,9.82 16 | A2,10.135 17 | A2,11.94 18 | A2,6.025 19 | A2,3.045 20 | A2,1.87 21 | A2,12.64 22 | A2,9.66 23 | A2,9.265 24 | A2,6.155 25 | A2,10.785 26 | A2,12.36 27 | A2,10.175 28 | A2,12.38 29 | A2,9.66 30 | B1,8 31 | B1,7 32 | B1,17 33 | B1,15 34 | B1,12 35 | B1,5 36 | B1,6 37 | B1,19 38 | B1,16 39 | B1,11 40 | B1,18 41 | B1,9 42 | B1,14 43 | B1,13 44 | B2,-35 45 | B2,-30 46 | B2,-25 47 | B2,-20 48 | B2,-15 49 | B2,-10 50 | B2,-5 51 | B2,0 52 | B2,5 53 | B2,10 54 | B2,15 55 | B2,20 56 | B2,25 57 | B2,30 58 | C1,3.375 59 | C1,-0.3 60 | C1,10.025 61 | C1,2.35 62 | C1,7.675 63 | C1,9 64 | C1,7.325 65 | C1,6.65 66 | C1,4.975 67 | C1,3.3 68 | C1,11.625 69 | C1,17.765 70 | C1,17.09 71 | C1,19.41 72 | C2,6.625 73 | C2,2.3 74 | C2,11.975 75 | C2,3.65 76 | C2,8.325 77 | C2,9 78 | C2,6.675 79 | C2,5.35 80 | C2,3.025 81 | C2,0.7 82 | C2,8.375 83 | C2,8.235 84 | C2,6.91 85 | C2,8.59 86 | D1,0.54 87 | D1,1.98 88 | D1,1.1 89 | D1,3.42 90 | D1,2.54 91 | D1,1.655 92 | D1,4.865 93 | D1,3.98 94 | D1,3.1 95 | D1,2.215 96 | D1,6.305 97 | D1,5.42 98 | D1,4.54 99 | D1,3.655 100 | D2,-0.54 101 | D2,0.02 102 | D2,0.9 103 | D2,0.58 104 | D2,1.46 105 | D2,2.345 106 | D2,1.135 107 | D2,2.02 108 | D2,2.9 109 | D2,3.785 110 | D2,1.695 111 | D2,2.58 112 | D2,3.46 113 | D2,4.345 114 | -------------------------------------------------------------------------------- /SampleData/IndividualGroups/MultipleGroups_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/IndividualGroups/MultipleGroups_sample.png -------------------------------------------------------------------------------- /SampleData/IndividualGroups/SharedControl_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/IndividualGroups/SharedControl_sample.png -------------------------------------------------------------------------------- /SampleData/IndividualGroups/TwoGroupPaired_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/IndividualGroups/TwoGroupPaired_sample.png -------------------------------------------------------------------------------- /SampleData/IndividualGroups/TwoGroup_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/IndividualGroups/TwoGroup_sample.png -------------------------------------------------------------------------------- /SampleData/IndividualGroups/TwoGroups_sample.csv: -------------------------------------------------------------------------------- 1 | Identifiers,Values 2 | A1,8.885 3 | A1,14.38 4 | A1,8.015 5 | A1,5.835 6 | A1,5.47 7 | A1,12.06 8 | A1,11.72 9 | A1,10.315 10 | A1,5.065 11 | A1,8.235 12 | A1,15.08 13 | A1,13.485 14 | A1,11.3 15 | A1,9.82 16 | A1,9.565 17 | A2,10.135 18 | A2,11.94 19 | A2,6.025 20 | A2,3.045 21 | A2,1.87 22 | A2,12.64 23 | A2,9.66 24 | A2,9.265 25 | A2,6.155 26 | A2,10.785 27 | A2,12.36 28 | A2,10.175 29 | A2,12.38 30 | A2,9.66 31 | A2,6.955 32 | -------------------------------------------------------------------------------- /SampleData/MergedGroups/MergedGroups_sample.csv: -------------------------------------------------------------------------------- 1 | Identifiers,Values 2 | A1,8.885 3 | A1,14.38 4 | A1,8.015 5 | A1,5.835 6 | A1,5.47 7 | A1,12.06 8 | A1,11.72 9 | A1,10.315 10 | A1,5.065 11 | A1,8.235 12 | A1,15.08 13 | A1,13.485 14 | A1,11.3 15 | A1,9.82 16 | A2,10.135 17 | A2,11.94 18 | A2,6.025 19 | A2,3.045 20 | A2,1.87 21 | A2,12.64 22 | A2,9.66 23 | A2,9.265 24 | A2,6.155 25 | A2,10.785 26 | A2,12.36 27 | A2,10.175 28 | A2,12.38 29 | A2,9.66 30 | B1,8 31 | B1,7 32 | B1,17 33 | B1,15 34 | B1,12 35 | B1,5 36 | B1,6 37 | B1,19 38 | B1,16 39 | B1,11 40 | B1,18 41 | B1,9 42 | B1,14 43 | B1,13 44 | -------------------------------------------------------------------------------- /SampleData/MergedGroups/MergedGroups_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/MergedGroups/MergedGroups_sample.png -------------------------------------------------------------------------------- /SampleData/MergedGroups/MergedSharedControl_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/MergedGroups/MergedSharedControl_sample.png -------------------------------------------------------------------------------- /SampleData/MergedGroups/MultipleMergedGroups_sample.csv: -------------------------------------------------------------------------------- 1 | Identifiers,Values 2 | A1,8.885 3 | A1,14.38 4 | A1,8.015 5 | A1,5.835 6 | A1,5.47 7 | A1,12.06 8 | A1,11.72 9 | A1,10.315 10 | A1,5.065 11 | A1,8.235 12 | A1,15.08 13 | A1,13.485 14 | A1,11.3 15 | A1,9.82 16 | A2,10.135 17 | A2,11.94 18 | A2,6.025 19 | A2,3.045 20 | A2,1.87 21 | A2,12.64 22 | A2,9.66 23 | A2,9.265 24 | A2,6.155 25 | A2,10.785 26 | A2,12.36 27 | A2,10.175 28 | A2,12.38 29 | A2,9.66 30 | B1,8 31 | B1,7 32 | B1,17 33 | B1,15 34 | B1,12 35 | B1,5 36 | B1,6 37 | B1,19 38 | B1,16 39 | B1,11 40 | B1,18 41 | B1,9 42 | B1,14 43 | B1,13 44 | B2,-35 45 | B2,-30 46 | B2,-25 47 | B2,-20 48 | B2,-15 49 | B2,-10 50 | B2,-5 51 | B2,0 52 | B2,5 53 | B2,10 54 | B2,15 55 | B2,20 56 | B2,25 57 | B2,30 58 | C1,3.375 59 | C1,-0.3 60 | C1,10.025 61 | C1,2.35 62 | C1,7.675 63 | C1,9 64 | C1,7.325 65 | C1,6.65 66 | C1,4.975 67 | C1,3.3 68 | C1,11.625 69 | C1,17.765 70 | C1,17.09 71 | C1,19.41 72 | C2,6.625 73 | C2,2.3 74 | C2,11.975 75 | C2,3.65 76 | C2,8.325 77 | C2,9 78 | C2,6.675 79 | C2,5.35 80 | C2,3.025 81 | C2,0.7 82 | C2,8.375 83 | C2,8.235 84 | C2,6.91 85 | C2,8.59 86 | -------------------------------------------------------------------------------- /SampleData/MergedGroups/MultipleMergedGroups_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/MergedGroups/MultipleMergedGroups_sample.png -------------------------------------------------------------------------------- /SampleData/OutputTables/MergedGroups_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/OutputTables/MergedGroups_table.png -------------------------------------------------------------------------------- /SampleData/OutputTables/MergedSharedControl_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/OutputTables/MergedSharedControl_table.png -------------------------------------------------------------------------------- /SampleData/OutputTables/MultipleGroups_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/OutputTables/MultipleGroups_table.png -------------------------------------------------------------------------------- /SampleData/OutputTables/MultipleMergedGroups_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/OutputTables/MultipleMergedGroups_table.png -------------------------------------------------------------------------------- /SampleData/OutputTables/SharedControl_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/OutputTables/SharedControl_table.png -------------------------------------------------------------------------------- /SampleData/OutputTables/TwoGroupsPaired_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/OutputTables/TwoGroupsPaired_table.png -------------------------------------------------------------------------------- /SampleData/OutputTables/TwoGroups_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/SampleData/OutputTables/TwoGroups_table.png -------------------------------------------------------------------------------- /utilities/TGP_Scatter_Plot_CombinedParentalControls.m: -------------------------------------------------------------------------------- 1 | 2 | % Author: Tayfun Tumkaya 3 | % Display the Temperature Preference of Fly in Multiple Experiemnt. 4 | % 5 | clc 6 | close all; 7 | clear all; 8 | 9 | 10 | % Last_Data=42000; 11 | 12 | % Basket for Experiments. 13 | 14 | 15 | % file_list = { 16 | % 17 | % 18 | % {'w1118-UAS-TrpA1(Or65c)_I-n.mat' 19 | % 'w1118-Or65c-Gal4_III-n.mat' 20 | % 'w1118-Or65c-Gal4_II-n.mat' 21 | % 'w1118-Or65c-Gal4_I-n.mat' 22 | % 'Or65c-Gal4-UAS-TrpA1_III-n.mat' 23 | % 'Or65c-Gal4-UAS-TrpA1_II-n.mat' 24 | % 'Or65c-Gal4-UAS-TrpA1_I-n.mat' 25 | % 26 | % 'w1118-UAS-TrpA1(Or85d)-n.mat' 27 | % 'w1118-Or85d-Gal4_I-n.mat' 28 | % 'w1118-Or85d-Gal4_II-n.mat' 29 | % 'w1118-Or85d-Gal4_III-n.mat' 30 | % 'Or85d-Gal4-UAS-TrpA1_I-n.mat' 31 | % 'Or85d-Gal4-UAS-TrpA1_II-n.mat' 32 | % 'Or85d-Gal4-UAS-TrpA1_III-n.mat' 33 | % 34 | % 35 | % 'w1118-UAS-TrpA1(Or30a)-n.mat' 36 | % 'w1118-Or30a-Gal4_I-n.mat' 37 | % 'w1118-Or30a-Gal4_II-n.mat' 38 | % 'w1118-Or30a-Gal4_III-n.mat' 39 | % 'Or30a-Gal4-UAS-TrpA1_I-n.mat' 40 | % 'Or30a-Gal4-UAS-TrpA1_II-n.mat' 41 | % 'Or30a-Gal4-UAS-TrpA1_III-n.mat' 42 | % 43 | % 44 | % 'w1118-UAS-TrpA1(Orco)-n.mat' 45 | % 'w1118-Orco-Gal4_III-n.mat' 46 | % 'w1118-Orco-Gal4_II-n.mat' 47 | % 'w1118-Orco-Gal4_I-n.mat' 48 | % 'Orco-Gal4-UAS-TrpA1_III-n.mat' 49 | % 'Orco-Gal4-UAS-TrpA1_II-n.mat' 50 | % 'Orco-Gal4-UAS-TrpA1_I-n.mat' 51 | % 52 | % 'w1118-UAS-TrpA1(Or65b)-n.mat' 53 | % 'w1118-Or65b-Gal4_I-n.mat' 54 | % 'w1118-Or65b-Gal4_II-n.mat' 55 | % 'w1118-Or65b-Gal4_III-n.mat' 56 | % 'Or65b-Gal4-UAS-TrpA1_I-n.mat' 57 | % 'Or65b-Gal4-UAS-TrpA1_II-n.mat' 58 | % 'Or65b-Gal4-UAS-TrpA1_III-n.mat' 59 | % 60 | % 61 | % 'w1118-UAS-TrpA1(Or98a)-n.mat' 62 | % 'w1118-Or98a-Gal4_I-n.mat' 63 | % 'w1118-Or98a-Gal4_II-n.mat' 64 | % 'w1118-Or98a-Gal4_III-n.mat' 65 | % 'Or98a-Gal4-UAS-TrpA1_I-n.mat' 66 | % 'Or98a-Gal4-UAS-TrpA1_II-n.mat' 67 | % 'Or98a-Gal4-UAS-TrpA1_III-n.mat' 68 | % 69 | % 70 | % 'w1118-UAS-TrpA1(Or74a)-n.mat' 71 | % 'w1118-Or74a-Gal4_I-n.mat' 72 | % 'w1118-Or74a-Gal4_II-n.mat' 73 | % 'w1118-Or74a-Gal4_III-n.mat' 74 | % 'Or74a-Gal4-UAS-TrpA1_III-n.mat' 75 | % 'Or74a-Gal4-UAS-TrpA1_I-n.mat' 76 | % 'Or74a-Gal4-UAS-TrpA1_II-n.mat' 77 | % 78 | % 79 | % 'w1118-UAS-TrpA1(Or83a)-n.mat' 80 | % 'w1118-Or83a-Gal4_I-n.mat' 81 | % 'w1118-Or83a-Gal4_II-n.mat' 82 | % 'w1118-Or83a-Gal4_III-n.mat' 83 | % 'Or83a-Gal4-UASTrpA1_I-n.mat' 84 | % 'Or83a-Gal4-UASTrpA1_II-n.mat' 85 | % 'Or83a-Gal4-UASTrpA1_III-n.mat' 86 | % 87 | % 88 | % 'w1118-UAS-TrpA1(Or59a)-n.mat' 89 | % 'w1118-Or59a-Gal4_I-n.mat' 90 | % 'w1118-Or59a-Gal4_II-n.mat' 91 | % 'w1118-Or59a-Gal4_III-n.mat' 92 | % 'Or59a-Gal4-UAS-TrpA1_I-n.mat' 93 | % 'Or59a-Gal4-UAS-TrpA1_II-n.mat' 94 | % 'Or59a-Gal4-UAS-TrpA1_III-n.mat' 95 | % 96 | % 'w1118-UAS-TrpA1(Or83c)-n.mat' 97 | % 'w1118-Or83c-Gal4_I-n.mat' 98 | % 'w1118-Or83c-Gal4_II-n.mat' 99 | % 'w1118-Or83c-Gal4_III-n.mat' 100 | % 'Or83c-Gal4-UAS-TrpA1_I-n.mat' 101 | % 'Or83c-Gal4-UAS-TrpA1_II-n.mat' 102 | % 'Or83c-Gal4-UAS-TrpA1_III-n.mat' 103 | % 104 | % 105 | % 106 | % 'w1118-UAS-TrpA1(Or71a)-n.mat' 107 | % 'w1118-Or71a-Gal4_I-n.mat' 108 | % 'w1118-Or71a-Gal4_II-n.mat' 109 | % 'w1118-Or71a-Gal4_III-n.mat' 110 | % 'Or71a-Gal4-UAS-TrpA1_I-n.mat' 111 | % 'Or71a-Gal4-UAS-TrpA1_II-n.mat' 112 | % 'Or71a-Gal4-UAS-TrpA1_III-n.mat' 113 | % 114 | % 'w1118-UAS-TrpA1(Or69a)-n.mat' 115 | % 'w1118-Or69a-Gal4_I-n.mat' 116 | % 'w1118-Or69a-Gal4_II-n.mat' 117 | % 'w1118-Or69a-Gal4_III-n.mat' 118 | % 'Or69a-Gal4-UAS-TrpA1_I-n.mat' 119 | % 'Or69a-Gal4-UAS-TrpA1_II-n.mat' 120 | % 'Or69a-Gal4-UAS-TrpA1_III-n.mat' 121 | % 122 | % 'w1118-UAS-TrpA1(Or45b)-n.mat' 123 | % 'w1118-Or45b-Gal4_I-n.mat' 124 | % 'w1118-Or45b-Gal4_II-n.mat' 125 | % 'w1118-Or45b-Gal4_III-n.mat' 126 | % 'Or45b-Gal4-UAS-TrpA1_I-n.mat' 127 | % 'Or45b-Gal4-UAS-TrpA1_II-n.mat' 128 | % 'Or45b-Gal4-UAS-TrpA1_III-n.mat' 129 | % 130 | % 'w1118-UAS-TrpA1(Or45a)-n.mat' 131 | % 'w1118-Or45a-Gal4_I-n.mat' 132 | % 'w1118-Or45a-Gal4_II-n.mat' 133 | % 'w1118-Or45a-Gal4_III-n.mat' 134 | % 'Or45a-Gal4-UAS-TrpA1_I-n.mat' 135 | % 'Or45a-Gal4-UAS-TrpA1_II-n.mat' 136 | % 'Or45a-Gal4-UAS-TrpA1_III-n.mat' 137 | % 138 | % 139 | % 'w1118-UAS-TrpA1(Or22c)-n.mat' 140 | % 'w1118-Or22c-Gal4_I-n.mat' 141 | % 'w1118-Or22c-Gal4_II-n.mat' 142 | % 'w1118-Or22c-Gal4_III-n.mat' 143 | % 'Or22c-Gal4-UAS-TrpA1_I-n.mat' 144 | % 'Or22c-Gal4-UAS-TrpA1_II-n.mat' 145 | % 'Or22c-Gal4-UAS-TrpA1_III-n.mat' 146 | % 147 | % 148 | % 149 | % 'w1118-UAS-TrpA1(Or82a)-n.mat' 150 | % 'w1118-Or82a-Gal4_I-n.mat' 151 | % 'w1118-Or82a-Gal4_II-n.mat' 152 | % 'w1118-Or82a-Gal4_III-n.mat' 153 | % 'Or82a-Gal4-UAS-TrpA1_I-n.mat' 154 | % 'Or82a-Gal4-UAS-TrpA1_II-n.mat' 155 | % 'Or82a-Gal4-UAS-TrpA1_III-n.mat' 156 | % 157 | % 158 | % 'w1118-UAS-TrpA1(Or9a)-n.mat' 159 | % 'w1118-Or9a-Gal4_I-n.mat' 160 | % 'w1118-Or9a-Gal4_II-n.mat' 161 | % 'w1118-Or9a-Gal4_III-n.mat' 162 | % 'Or9a-Gal4-UAS-TrpA1_I-n.mat' 163 | % 'Or9a-Gal4-UAS-TrpA1_II-n.mat' 164 | % 'Or9a-Gal4-UAS-TrpA1_III-n.mat' 165 | % 166 | % 167 | % 'w1118-UAS-TrpA1(Or67d)(f)-n.mat' 168 | % 'w1118-Or67d-Gal4_I(f)-n.mat' 169 | % 'w1118-Or67d-Gal4_II(f)-n.mat' 170 | % 'w1118-Or67d-Gal4_III(f)-n.mat' 171 | % 'Or67d-Gal4-UAS-TrpA1_I(f)-n.mat' 172 | % 'Or67d-Gal4-UAS-TrpA1_II(f)-n.mat' 173 | % 'Or67d-Gal4-UAS-TrpA1_III(f)-n.mat' 174 | % 175 | % 'w1118-UAS-TrpA1(Or47b)-n.mat' 176 | % 'w1118-Or47b-Gal4_I-n.mat' 177 | % 'w1118-Or47b-Gal4_II-n.mat' 178 | % 'w1118-Or47b-Gal4_III-n.mat' 179 | % 'Or47b-Gal4-UAS-TrpA1_I-n.mat' 180 | % 'Or47b-Gal4-UAS-TrpA1_II-n.mat' 181 | % 'Or47b-Gal4-UAS-TrpA1_III-n.mat' 182 | % 183 | % 184 | % 185 | % 'w1118-UAS-TrpA1(Or59c)-n.mat' 186 | % 'w1118-Or59c-Gal4_I-n.mat' 187 | % 'w1118-Or59c-Gal4_II-n.mat' 188 | % 'w1118-Or59c-Gal4_III-n.mat' 189 | % 'Or59c-Gal4-UAS-TrpA1_I-n.mat' 190 | % 'Or59c-Gal4-UAS-TrpA1_II-n.mat' 191 | % 'Or59c-Gal4-UAS-TrpA1_III-n.mat' 192 | % 193 | % 'w1118-UAS-TrpA1(Or23a)-n.mat' 194 | % 'w1118-Or23a-Gal4_I-n.mat' 195 | % 'w1118-Or23a-Gal4_II-n.mat' 196 | % 'w1118-Or23a-Gal4_III-n.mat' 197 | % 'Or23a-Gal4-UAS-TrpA1_I-n.mat' 198 | % 'Or23a-Gal4-UAS-TrpA1_II-n.mat' 199 | % 'Or23a-Gal4-UAS-TrpA1_III-n.mat' 200 | % 201 | % 202 | % 'w1118-UAS-TrpA1(Or49a)-n.mat' 203 | % 'w1118-Or49a-Gal4_I-n.mat' 204 | % 'w1118-Or49a-Gal4_III-n.mat' 205 | % 'w1118-Or49a-Gal4_II-n.mat' 206 | % 'Or49a-Gal4-UAS-TrpA1_III-n.mat' 207 | % 'Or49a-Gal4-UAS-TrpA1_II-n.mat' 208 | % 'Or49a-Gal4-UAS-TrpA1_I-n.mat' 209 | % 210 | % 'w1118-UAS-TrpA1(Or56a)-n.mat' 211 | % 'w1118-Or56a-Gal4_I-n.mat' 212 | % 'w1118-Or56a-Gal4_II-n.mat' 213 | % 'w1118-Or56a-Gal4_III-n.mat' 214 | % 'Or56a-Gal4-UAS-TrpA1_I-n.mat' 215 | % 'Or56a-Gal4-UAS-TrpA1_II-n.mat' 216 | % 'Or56a-Gal4-UAS-TrpA1_III-n.mat' 217 | % 218 | % 219 | % 'w1118-UAS-TrpA1(Or94b)-n.mat' 220 | % 'w1118-Or94b-Gal4_I-n.mat' 221 | % 'w1118-Or94b-Gal4_II-n.mat' 222 | % 'w1118-Or94b-Gal4_III-n.mat' 223 | % 'Or94b-Gal4-UAS-TrpA1_I-n.mat' 224 | % 'Or94b-Gal4-UAS-TrpA1_II-n.mat' 225 | % 'Or94b-Gal4-UAS-TrpA1_III-n.mat' 226 | % 227 | % 'w1118-UAS-TrpA1(Or65a)_male-n.mat' 228 | % 'w1118-Or65a-Gal4(m)_I-n.mat' 229 | % 'w1118-Or65a-Gal4(m)_II-n.mat' 230 | % 'w1118-Or65a-Gal4(m)_III-n.mat' 231 | % 'Or65a-Gal4-UAS-TrpA1(m)_I-n.mat' 232 | % 'Or65a-Gal4-UAS-TrpA1(m)_II-n.mat' 233 | % 'Or65a-Gal4-UAS-TrpA1(m)_III-n.mat' 234 | % 235 | % 'w1118-UAS-TrpA1(Or1a)-n.mat' 236 | % 'w1118-Or1a-Gal4_I-n.mat' 237 | % 'w1118-Or1a-Gal4_II-n.mat' 238 | % 'w1118-Or1a-Gal4_III-n.mat' 239 | % 'w1118-Or1a-Gal4_IV-n.mat' 240 | % 'Or1a-Gal4-UAS-TrpA1_I-n.mat' 241 | % 'Or1a-Gal4-UAS-TrpA1_II-n.mat' 242 | % 'Or1a-Gal4-UAS-TrpA1_III-n.mat' 243 | % 244 | % 'w1118-UAS-TrpA1(Or67a)-n.mat' 245 | % 'w1118-Or67a-Gal4_I-n.mat' 246 | % 'w1118-Or67a-Gal4_II-n.mat' 247 | % 'w1118-Or67a-Gal4_III-n.mat' 248 | % 'Or67a-Gal4-UAS-TrpA1_I-n.mat' 249 | % 'Or67a-Gal4-UAS-TrpA1_II-n.mat' 250 | % 'Or67a-Gal4-UAS-TrpA1_III-n.mat' 251 | % 252 | % 'w1118-UAS-TrpA1(Or33a)-n.mat' 253 | % 'w1118-Or33a-Gal4_I-n.mat' 254 | % 'w1118-Or33a-Gal4_II-n.mat' 255 | % 'w1118-Or33a-Gal4_III-n.mat' 256 | % 'Or33a-Gal4-UAS-TrpA1_I-n.mat' 257 | % 'Or33a-Gal4-UAS-TrpA1_II-n.mat' 258 | % 'Or33a-Gal4-UAS-TrpA1_III-n.mat' 259 | % 260 | % 'w1118-UAS-TrpA1(Or35a)_I-n.mat' 261 | % 'w1118-UAS-TrpA1(Or35a)_II-n.mat' 262 | % 'W1118-OR35a-Gal4_I-n.mat' 263 | % 'W1118-OR35a-Gal4_II-n.mat' 264 | % 'OR35a-Gal4-UASTrpA1_I-n.mat' 265 | % 'OR35a-Gal4-UASTrpA1_II-n.mat' 266 | % 'OR35a-Gal4-UASTrpA1_III-n.mat' 267 | % 268 | % 269 | % 'w1118-UAS-TrpA1(Or13a)-n.mat' 270 | % 'w1118-Or13a-Gal4_I-n.mat' 271 | % 'w1118-Or13a-Gal4_II-n.mat' 272 | % 'w1118-Or13a-Gal4_III-n.mat' 273 | % 'Or13a-Gal4-UAS-TrpA1_I-n.mat' 274 | % 'Or13a-Gal4-UAS-TrpA1_II-n.mat' 275 | % 'Or13a-Gal4-UAS-TrpA1_III-n.mat' 276 | % 277 | % 'w1118-UAS-TrpA1(Or85c)-n.mat' 278 | % 'w1118-Or85c-Gal4_I-n.mat' 279 | % 'w1118-Or85c-Gal4_II-n.mat' 280 | % 'w1118-Or85c-Gal4_III-n.mat' 281 | % 'Or85c-Gal4-UAS-TrpA1_I-n.mat' 282 | % 'Or85c-Gal4-UAS-TrpA1_II-n.mat' 283 | % 'Or85c-Gal4-UAS-TrpA1_III-n.mat' 284 | % 285 | % 'w1118-UAS-TrpA1(Or19b)-n.mat' 286 | % 'w1118-Or19b-Gal4_I-n.mat' 287 | % 'w1118-Or19b-Gal4_II-n.mat' 288 | % 'Or19b-Gal4-UAS-TrpA1_I-n.mat' 289 | % 'Or19b-Gal4-UAS-TrpA1_III-n.mat' 290 | % 'Or19b-Gal4-UAS-TrpA1_II-n.mat' 291 | % 292 | % 293 | % 'w1118-UAS-TrpA1(Or43b)_I-n.mat' 294 | % 295 | % 'w1118-Or43b-Gal4_I-n.mat' 296 | % 'w1118-Or43b-Gal4_II-n.mat' 297 | % 'w1118-Or43b-Gal4_III-n.mat' 298 | % 'Or43b-Gal4-UAS-TrpA1_I-n.mat' 299 | % 'Or43b-Gal4-UAS-TrpA1_II-n.mat' 300 | % 'Or43b-Gal4-UAS-TrpA1_III-n.mat' 301 | % 302 | % 'w1118-UAS-TrpA1(Or88a)(m)-n.mat' 303 | % 'w1118-Or88a-Gal4_I(m)-n.mat' 304 | % 'w1118-Or88a-Gal4_II(m)-n.mat' 305 | % 'w1118-Or88a-Gal4_III(m)-n.mat' 306 | % 'w1118-Or88a-Gal4_IV(m)-n.mat' 307 | % 'Or88a-Gal4-UAS-TrpA1_I(m)-n.mat' 308 | % 'Or88a-Gal4-UAS-TrpA1_II(m)-n.mat' 309 | % 'Or88a-Gal4-UAS-TrpA1_III(m)-n.mat' 310 | % 'Or88a-Gal4-UAS-TrpA1_IV(m)-n.mat' 311 | % 'Or88a-Gal4-UAS-TrpA1_V(m)-n.mat' 312 | % 313 | % 314 | % 'w1118-UAS-TrpA1(Or43a)-n.mat' 315 | % 'w1118-Or43a-Gal4_I-n.mat' 316 | % 'w1118-Or43a-Gal4_II-n.mat' 317 | % 'w1118-Or43a-Gal4_III-n.mat' 318 | % 'Or43a-Gal4-UAS-TrpA1_I-n.mat' 319 | % 'Or43a-Gal4-UAS-TrpA1_II-n.mat' 320 | % 'Or43a-Gal4-UAS-TrpA1_III-n.mat' 321 | % 322 | % 'w1118-UAS-TrpA1(Or85e)-n.mat' 323 | % 'w1118-Or85e-Gal4_I-n.mat' 324 | % 'w1118-Or85e-Gal4_II-n.mat' 325 | % 'w1118-Or85e-Gal4_III-n.mat' 326 | % 'Or85e-Gal4-UAS-TrpA1_I-n.mat' 327 | % 'Or85e-Gal4-UAS-TrpA1_II-n.mat' 328 | % 'Or85e-Gal4-UAS-TrpA1_III-n.mat' 329 | % 330 | % 331 | % 332 | % 'w1118-UAS-TrpA1(Or22a)-n.mat' 333 | % 'w1118-Or22a-Gal4_I-n.mat' 334 | % 'w1118-Or22a-Gal4_II-n.mat' 335 | % 'w1118-Or22a-Gal4_III-n.mat' 336 | % 'Or22a-Gal4-UAS-TrpA1_I-n.mat' 337 | % 'Or22a-Gal4-UAS-TrpA1_II-n.mat' 338 | % 'Or22a-Gal4-UAS-TrpA1_III-n.mat' 339 | % 340 | % 'w1118-UAS-TrpA1(Or92a)-n.mat' 341 | % 'w1118-Or92a-Gal4_I-n.mat' 342 | % 'w1118-Or92a-Gal4_II-n.mat' 343 | % 'Or92a-Gal4-UAS-TrpA1_I-n.mat' 344 | % 'Or92a-Gal4-UAS-TrpA1_II-n.mat' 345 | % 'Or92a-Gal4-UAS-TrpA1_III-n.mat' 346 | % 347 | % 348 | % 'w1118-UAS-TrpA1(Or85b)-n.mat' 349 | % 'w1118-Or85b-Gal4_III-n.mat' 350 | % 'w1118-Or85b-Gal4_II-n.mat' 351 | % 'w1118-Or85b-Gal4_I-n.mat' 352 | % 'Or85b-Gal4-UAS-TrpA1_I-n.mat' 353 | % 'Or85b-Gal4-UAS-TrpA1_II-n.mat' 354 | % 'Or85b-Gal4-UAS-TrpA1_III-n.mat' 355 | % 356 | % 357 | % 'w1118-UAS-TrpA1(Or67c)-n.mat' 358 | % 'w1118-Or67c-Gal4_I-n.mat' 359 | % 'w1118-Or67c-Gal4_II-n.mat' 360 | % 'w1118-Or67c-Gal4_III-n.mat' 361 | % 'Or67c-Gal4-UAS-TrpA1_I-n.mat' 362 | % 'Or67c-Gal4-UAS-TrpA1_II-n.mat' 363 | % 'Or67c-Gal4-UAS-TrpA1_III-n.mat' 364 | % 365 | % 'w1118-UAS-TrpA1(Or85a)-n.mat' 366 | % 'w1118-Or85a-Gal4_I-n.mat' 367 | % 'w1118-Or85a-Gal4_II-n.mat' 368 | % 'w1118-Or85a-Gal4_III-n.mat' 369 | % 'Or85a-Gal4-UAS-TrpA1_I-n.mat' 370 | % 'Or85a-Gal4-UAS-TrpA1_II-n.mat' 371 | % 'Or85a-Gal4-UAS-TrpA1_III-n.mat' 372 | % 373 | % 374 | % 'w1118-UAS-TrpA1(Or7a)-n.mat' 375 | % 'w1118-Or7a-Gal4_II-n.mat' 376 | % 'w1118-Or7a-Gal4_I-n.mat' 377 | % 'w1118-Or7a-Gal4_III-n.mat' 378 | % 'Or7a-Gal4-UAS-TrpA1_III-n.mat' 379 | % 'Or7a-Gal4-UAS-TrpA1_I-n.mat' 380 | % 'Or7a-Gal4-UAS-TrpA1_II-n.mat' 381 | % 382 | % 383 | % 'w1118-UAS-TrpA1(Or88a)_f_R-n.mat' 384 | % 'w1118-Or88a-Gal4_I_f_R-n.mat' 385 | % 'w1118-Or88a-Gal4_II_f_R-n.mat' 386 | % 'w1118-Or88a-Gal4_III_f_R-n.mat' 387 | % 'Or88a-Gal4-UAS-TrpA1_I_f_R-n.mat' 388 | % 'Or88a-Gal4-UAS-TrpA1_II_f_R-n.mat' 389 | % 'Or88a-Gal4-UAS-TrpA1_III_f_R-n.mat' 390 | % 391 | % 392 | % 'w1118-UAS-TrpA1(Or24a)R-n.mat' 393 | % 'w1118-Or24a-Gal4_I_R-n.mat' 394 | % 'w1118-Or24a-Gal4_II_R-n.mat' 395 | % 'w1118-Or24a-Gal4_III_R-n.mat' 396 | % 'Or24a-Gal4-UAS-TrpA1_I_R-n.mat' 397 | % 'Or24a-Gal4-UAS-TrpA1_II_R-n.mat' 398 | % 'Or24a-Gal4-UAS-TrpA1_III_R-n.mat' 399 | % 400 | % 'w1118-UAS-TrpA1(Or19a)-n.mat' 401 | % 'w1118-Or19a-Gal4_I-n.mat' 402 | % 'w1118-Or19a-Gal4_II-n.mat' 403 | % 'w1118-Or19a-Gal4_III-n.mat' 404 | % 'Or19a-Gal4-UAS-TrpA1_I-n.mat' 405 | % 'Or19a-Gal4-UAS-TrpA1_II-n.mat' 406 | % 'Or19a-Gal4-UAS-TrpA1_III-n.mat' 407 | % 408 | % 409 | % 'w1118-UAS-TrpA1(Or67b)-n.mat' 410 | % 'w1118-Or67b-Gal4_I-n.mat' 411 | % 'w1118-Or67b-Gal4_II-n.mat' 412 | % 'w1118-Or67b-Gal4_III-n.mat' 413 | % 'Or67b-Gal4-UAS-TrpA1_I-n.mat' 414 | % 'Or67b-Gal4-UAS-TrpA1_II-n.mat' 415 | % 'Or67b-Gal4-UAS-TrpA1_III-n.mat' 416 | % 417 | % 418 | % 419 | % 'w1118-UAS-TrpA1(Gr21a)-n.mat' 420 | % 'w1118-Gr21a-Gal4_I-n.mat' 421 | % 'w1118-Gr21a-Gal4_II-n.mat' 422 | % 'w1118-Gr21a-Gal4_III-n.mat' 423 | % 'Gr21a-Gal4-UAS-TrpA1_I-n.mat' 424 | % 'Gr21a-Gal4-UAS-TrpA1_II-n.mat' 425 | % 'Gr21a-Gal4-UAS-TrpA1_III-n.mat' 426 | % 427 | % 'w1118-UAS-TrpA1(Or46a)-n.mat' 428 | % 'w1118-Or46a-Gal4_I-n.mat' 429 | % 'w1118-Or46a-Gal4_II-n.mat' 430 | % 'w1118-Or46a-Gal4_III-n.mat' 431 | % 'Or46a-Gal4-UAS-TrpA1_I-n.mat' 432 | % 'Or46a-Gal4-UAS-TrpA1_II-n.mat' 433 | % 'Or46a-Gal4-UAS-TrpA1_III-n.mat' 434 | % 435 | % 436 | % 'w1118-UAS-TrpA1(Or33c)-n.mat' 437 | % 'w1118-Or33c-Gal4_I-n.mat' 438 | % 'w1118-Or33c-Gal4_II-n.mat' 439 | % 'w1118-Or33c-Gal4_III-n.mat' 440 | % 'Or33c-Gal4-UAS-TrpA1_I-n.mat' 441 | % 'Or33c-Gal4-UAS-TrpA1_II-n.mat' 442 | % 'Or33c-Gal4-UAS-TrpA1_III-n.mat' 443 | % 444 | % 'w1118-UAS-TrpA1(Or22b)-n.mat' 445 | % 'w1118-Or22b-Gal4_I-n.mat' 446 | % 'w1118-Or22b-Gal4_II-n.mat' 447 | % 'w1118-Or22b-Gal4_III-n.mat' 448 | % 'Or22b-Gal4-UAS-TrpA1_I-n.mat' 449 | % 'Or22b-Gal4-UAS-TrpA1_II-n.mat' 450 | % 'Or22b-Gal4-UAS-TrpA1_III-n.mat' 451 | % 452 | % 453 | % 'w1118-UAS-TrpA1(Or10a)-n.mat' 454 | % 'w1118-Or10a-Gal4_I-n.mat' 455 | % 'w1118-Or10a-Gal4_II-n.mat' 456 | % 'w1118-Or10a-Gal4_III-n.mat' 457 | % 'Or10a-Gal4-UAS-TrpA1_I-n.mat' 458 | % 'Or10a-Gal4-UAS-TrpA1_II-n.mat' 459 | % 'Or10a-Gal4-UAS-TrpA1_III-n.mat' 460 | % 461 | % 'w1118-UAS-TrpA1(Or42a)-n.mat' 462 | % 'w1118-Or42a-Gal4_I-n.mat' 463 | % 'w1118-Or42a-Gal4_II-n.mat' 464 | % 'w1118-Or42a-Gal4_III-n.mat' 465 | % 'Or42a-Gal4-UAS-TrpA1_I-n.mat' 466 | % 'Or42a-Gal4-UAS-TrpA1_II-n.mat' 467 | % 'Or42a-Gal4-UAS-TrpA1_III-n.mat' 468 | % 469 | % 'w1118-UAS-TrpA1(Or67d)(m)-n.mat' 470 | % 'w1118-Or67d-Gal4_I(m)-n.mat' 471 | % 'w1118-Or67d-Gal4_II(m)-n.mat' 472 | % 'w1118-Or67d-Gal4_III(m)-n.mat' 473 | % 'Or67d-Ga4-UAS-TrpA1_I(m)-n.mat' 474 | % 'Or67d-Ga4-UAS-TrpA1_II(m)-n.mat' 475 | % 'Or67d-Ga4-UAS-TrpA1_III(m)-n.mat' 476 | % 477 | % 478 | % 'w1118-UAS-TrpA1(Gr63a)-n.mat' 479 | % 'w1118-Gr63a-Gal4_I-n.mat' 480 | % 'w1118-Gr63a-Gal4_II-n.mat' 481 | % 'w1118-Gr63a-Gal4_III-n.mat' 482 | % 'Gr63a-Gal4-UAS-TrpA1_I-n.mat' 483 | % 'Gr63a-Gal4-UAS-TrpA1_II-n.mat' 484 | % 'Gr63a-Gal4-UAS-TrpA1_III-n.mat' 485 | % 486 | % 487 | % 'w1118-UAS-TrpA1(Or65a)(f)-n.mat' 488 | % 'w1118-Or65a-Gal4(f)_I-n.mat' 489 | % 'w1118-Or65a-Gal4(f)_II-n.mat' 490 | % 'w1118-Or65a-Gal4(f)_III-n.mat' 491 | % 'w1118-Or65a-Gal4(f)_IV-n.mat' 492 | % 'w1118-Or65a-Gal4(f)_V-n.mat' 493 | % 'Or65a-Gal4-UAS-TrpA1(f)_I-n.mat' 494 | % 'Or65a-Gal4-UAS-TrpA1(f)_II-n.mat' 495 | % 'Or65a-Gal4-UAS-TrpA1(f)_III-n.mat' 496 | % 'Or65a-Gal4-UAS-TrpA1(f)_IV-n.mat' 497 | % 498 | % 499 | % 'w1118-UAS-TrpA1(Or85f)-n.mat' 500 | % 'w1118-Or85f-Gal4_I-n.mat' 501 | % 'w1118-Or85f-Gal4_II-n.mat' 502 | % 'w1118-Or85f-Gal4_III-n.mat' 503 | % 'Or85f-Gal4-UAS-TrpA1_I-n.mat' 504 | % 'Or85f-Gal4-UAS-TrpA1_II-n.mat' 505 | % 'Or85f-Gal4-UAS-TrpA1_III-n.mat' 506 | % 507 | % 508 | % 'w1118-UAS-TrpA1(Or33b)-n.mat' 509 | % 'w1118-Or33b-Gal4_I-n.mat' 510 | % 'w1118-Or33b-Gal4_II-n.mat' 511 | % 'Or33b-Gal4-UAS-TrpA1_I-n.mat' 512 | % 'Or33b-Gal4-UAS-TrpA1_II-n.mat' 513 | % 514 | % 515 | % 'w1118-UAS-TrpA1(Or47a)-n.mat' 516 | % 'w1118-Or47a-Gal4_I-n.mat' 517 | % 'w1118-Or47a-Gal4_II-n.mat' 518 | % 'w1118-Or47a-Gal4_III-n.mat' 519 | % 'Or47a-Gal4-UAS-TrpA1_I-n.mat' 520 | % 'Or47a-Gal4-UAS-TrpA1_II-n.mat' 521 | % 'Or47a-Gal4-UAS-TrpA1_III-n.mat' 522 | % 523 | % 'w1118-UAS-TrpA1(Or49b)-n.mat' 524 | % 'w1118-Or49b-Gal4_I-n.mat' 525 | % 'w1118-Or49b-Gal4_II-n.mat' 526 | % 'w1118-Or49b-Gal4_III-n.mat' 527 | % 'Or49b-Gal4-UAS-TrpA1_I-n.mat' 528 | % 'Or49b-Gal4-UAS-TrpA1_II-n.mat' 529 | % 'Or49b-Gal4-UAS-TrpA1_III-n.mat' 530 | % 531 | % 'w1118-UAS-TrpA1(Or47b)(f)_II-n.mat' 532 | % 'w1118-Or47b-Gal4(f)_I-n.mat' 533 | % 'w1118-Or47b-Gal4(f)_II-n.mat' 534 | % 'Or47b-Gal4-UAS-TrpA1(f)_I-n.mat' 535 | % 'Or47b-Gal4-UAS-TrpA1(f)_II-n.mat' 536 | % 537 | % 'w1118-UAS-TrpA1(Or42b)-n.mat' 538 | % 'w1118-Or42b-Gal4_I-n.mat' 539 | % 'w1118-Or42b-Gal4_II-n.mat' 540 | % 'w1118-Or42b-Gal4_III-n.mat' 541 | % 'Or42b-Gal4-UAS-TrpA1_I-n.mat' 542 | % 'Or42b-Gal4-UAS-TrpA1_II-n.mat' 543 | % % 544 | % % 'w1118-UAS-TrpA1(Or59b)-n.mat' 545 | % % 'w1118-Or59b-Gal4_II-n.mat' 546 | % % 'w1118-Or59b-Gal4_I-n.mat' 547 | % % 'w1118-Or59b-Gal4_III-n.mat' 548 | % % 'Or59b-Gal4-UAS-TrpA1_I-n.mat' 549 | % % 'Or59b-Gal4-UAS-TrpA1_II-n.mat' 550 | % % 'Or59b-Gal4-UAS-TrpA1_III-n.mat' 551 | % % 552 | % % } 553 | % % 554 | % % {'w1118-UAS-TrpA1(Or65cII)-n.mat' 555 | % % 'w1118-Or65cII-Gal4_I-n.mat' 556 | % % 'w1118-Or65cII-Gal4_II-n.mat' 557 | % % 'Or65cII-Gal4-UAS-TrpA1_I-n.mat' 558 | % % 'Or65cII-Gal4-UAS-TrpA1_II-n.mat'}, 559 | % 560 | % 561 | % % {'w1118-UAS-TrpA1(Or88a)_female-n.mat' 562 | % % 'w1118-Or88a-Gal4(f)_I-n.mat' 563 | % % 'w1118-Or88a-Gal4(f)_II-n.mat' 564 | % % 'w1118-Or88a-Gal4(f)_III-n.mat' 565 | % % 'w1118-Or88a-Gal4(f)_IV-n.mat' 566 | % % 'Or88a-Gal4-UAS-TrpA1(f)_I-n.mat' 567 | % % 'Or88a-Gal4-UAS-TrpA1(f)_II-n.mat' 568 | % % 'Or88a-Gal4-UAS-TrpA1(f)_III-n.mat' 569 | % % 'Or88a-Gal4-UAS-TrpA1(f)_IV-n.mat' 570 | % % 571 | % % } 572 | % % 573 | % 574 | % % % {'w1118-UAS-TrpA1(Gr66a)-n.mat' 575 | % % % 'Gr66a-Gal4-UAS-TrpA1_I-n.mat' 576 | % % % 'Gr66a-Gal4-UAS-TrpA1_II-n.mat' 577 | % % % 'Gr66a-Gal4-UAS-TrpA1_III-n.mat' 578 | % % % } 579 | % % 580 | % % {'w1118-UAS-TrpA1(Or24a)-n.mat' 581 | % % 'w1118-Or24a-Gal4_I-n.mat' 582 | % % 'Or24a-Gal4-UAS-TrpA1_I-n.mat' 583 | % % 'Or24a-Gal4-UAS-TrpA1_II-n.mat' 584 | % % 585 | % % 586 | % % } 587 | % % 588 | % 589 | % % 590 | % % { 591 | % % 'w1118-UAS-TrpA1(Or47b)_m_R-n.mat' 592 | % % 'w1118-Or47b-Gal4_I_m_R-n.mat' 593 | % % 'w1118-Or47b-Gal4_II_m_R-n.mat' 594 | % % 'w1118-Or47b-Gal4_III_m_R-n.mat' 595 | % % 'Or47b-Gal4-UAS-TrpA1-I_m_R-n.mat' 596 | % % 'Or47b-Gal4-UAS-TrpA1-II_m_R-n.mat' 597 | % % 'Or47b-Gal4-UAS-TrpA1-III_m_R-n.mat' 598 | % % } 599 | % 600 | % 601 | % % {'w1118-UAS-TrpA1(Or47b)_f_R-n.mat' 602 | % % 'w1118-Or47b-Gal4_I_f_R-n.mat' 603 | % % 'w1118-Or47b-Gal4_II_f_R-n.mat' 604 | % % 'w1118-Or47b-Gal4_III_f_R-n.mat' 605 | % % 'Or47b-Gal4-UAS-TrpA1_I_f_R-n.mat' 606 | % % 'Or47b-Gal4-UAS-TrpA1_II_f_R-n.mat' 607 | % % 'Or47b-Gal4-UAS-TrpA1_III_f_R-n.mat' 608 | % % 609 | % % } 610 | % 611 | % }; 612 | 613 | 614 | % for batch_id=1:length(file_list) 615 | 616 | 617 | % e{1} = file_list{batch_id}; 618 | 619 | 620 | 621 | e{1} = { 622 | % 'w1118-UAS-TrpA1(Or88a)_female-n.mat' 623 | 'w1118-Or88a-Gal4(f)_I-n.mat' 624 | % 'w1118-Or88a-Gal4(f)_II-n.mat' 625 | % 'w1118-Or88a-Gal4(f)_III-n.mat' 626 | 'Or88a-Gal4-UAS-TrpA1(f)_I-n.mat' 627 | % 'Or88a-Gal4-UAS-TrpA1(f)_II-n.mat' 628 | % 'Or88a-Gal4-UAS-TrpA1(f)_III-n.mat' 629 | 630 | }; 631 | 632 | % Create FBMM from basket. 633 | fbmm = TGP_plots2(e); 634 | %% Doing some manual things 635 | load(e{1,1}{1,1}); % load a fb file 636 | e{1,1}{1,1} 637 | % load(e{1,1}); 638 | % Store Time info in the fbmm file. 639 | 640 | fb=TGP_Fix_Max_Frame_No_of_FB(fb); 641 | fbmm.Time=fb.data.Time(:,1); 642 | 643 | 644 | Mean_Temp=nanmean(fbmm.Temp,2); 645 | % histfit(Mean_Temp) 646 | % Mean_Temp; 647 | % filename = sprintf('%s.csv',e{1 ,1}{1,1}) 648 | % fname = fbmm.szGenotype; 649 | % wtocsv = cell([Mean_Temp;fbmm.szGenotype]) 650 | % e{1,1} 651 | % [s,av,moe] = FscatJit2_Tayfun(fbmm.szGenotype, Mean_Temp); 652 | s = FscatJit2(fbmm.szGenotype, Mean_Temp); 653 | % csvwrite(filename,[av,moe]) 654 | 655 | % ylim([-4.0 2.2]); 656 | %ylabel('Mean Difference(Celcius Degrees)') 657 | 658 | % drawnow; 659 | % print(gcf, '-dpdf', '-r400', sprintf('%s.pdf', e{1,1}{1,1})) 660 | %print(gcf, '-dpdf', '-r400', 'afteradj.pdf') 661 | 662 | % clearvars -except file_list 663 | % close(gcf); 664 | % end -------------------------------------------------------------------------------- /utilities/bootmoes.m: -------------------------------------------------------------------------------- 1 | function [av, moes, bci] = bootmoes(vec) 2 | 3 | % Takes in a vector (that can be NaN-contaminated), calculates mean, moes, 4 | % and Cis by bootstrap 5 | 6 | %% For testing 7 | % clear all; close all; clc 8 | % vec=[0.455973541079959;0.607332882904319;0.504551752988633;0.590645277791557;0.541899635550893;0.482477113888613;NaN]; 9 | 10 | %% Calculate mean 11 | av=nanmean(vec); 12 | 13 | %% Calculate CIs 14 | hm=@(x) nanmean(x); 15 | bci=bootci(10000, hm, vec)'; 16 | 17 | 18 | %% MOEs 19 | moes(1)=abs(av-bci(1)); 20 | moes(2)=abs(av-bci(2)); 21 | 22 | 23 | -------------------------------------------------------------------------------- /utilities/calcSeverity.m: -------------------------------------------------------------------------------- 1 | function severity = calcSeverity(normDiff) 2 | 3 | if abs(normDiff) >=0.30 4 | severity=0; 5 | elseif abs(normDiff) >= 0.10 && abs(normDiff) <0.30 6 | severity = 1; 7 | elseif abs(normDiff) > 0.05 && abs(normDiff) <= 0.10 8 | severity = 2; 9 | elseif abs(normDiff) > 0.035 && abs(normDiff)<= 0.05 10 | severity = 4; 11 | elseif abs(normDiff) >0.02 && abs(normDiff)<= 0.035 12 | severity = 8; 13 | elseif abs(normDiff) >0.01 && abs(normDiff)<=0.02 14 | severity = 16; 15 | elseif abs(normDiff) > 0.005 && abs(normDiff) <= 0.01 16 | severity =32; 17 | elseif abs(normDiff) > 0.001 && abs(normDiff)<=0.005 18 | severity = 64; 19 | elseif abs(normDiff)<=0.001 20 | severity = 128; 21 | end -------------------------------------------------------------------------------- /utilities/contrastplot.asv: -------------------------------------------------------------------------------- 1 | function contrastplot(csvFile, varargin) 2 | d = readtable(csvFile); 3 | identifiers = d(:,{'Identifiers'}); 4 | identifiers = 5 | data = d(:,{'Values'}) 6 | close(gcf); 7 | if length(varargin) > 0 8 | [ss,avr,moes] = FscatJit2_CombinedControls(identifiers, data) 9 | else 10 | [ss] = FscatJit2(identifiers, data) 11 | end 12 | 13 | end -------------------------------------------------------------------------------- /utilities/dsxy2figxy.m: -------------------------------------------------------------------------------- 1 | function varargout = dsxy2figxy(varargin) 2 | % dsxy2figxy -- Transform point or position from data space 3 | % coordinates into normalized figure coordinates 4 | % Transforms [x y] or [x y width height] vectors from data space 5 | % coordinates to normalized figure coordinates in order to locate 6 | % annotation objects within a figure. These objects are: arrow, 7 | % doublearrow, textarrow, ellipse line, rectangle, textbox 8 | % 9 | % Syntax: 10 | % [figx figy] = dsxy2figxy([x1 y1],[x2 y2]) % GCA is used 11 | % figpos = dsxy2figxy([x1 y1 width height]) 12 | % [figx figy] = dsxy2figxy(axes_handle, [x1 y1],[x2 y2]) 13 | % figpos = dsxy2figxy(axes_handle, [x1 y1 width height]) 14 | % 15 | % Usage: Obtain a position on a plot in data space and 16 | % apply this function to locate an annotation there, e.g., 17 | % [axx axy] = ginput(2); (input is in data space) 18 | % [figx figy] = dsxy2figxy(gca, axx, axy); (now in figure space) 19 | % har = annotation('textarrow',figx,figy); 20 | % set(har,'String',['(' num2str(axx(2)) ',' num2str(axy(2)) ')']) 21 | % 22 | % Copyright 2006-2009 The MathWorks, Inc. 23 | 24 | % Obtain arguments (limited argument checking is done) 25 | % Determine if axes handle is specified 26 | if length(varargin{1}) == 1 && ishandle(varargin{1}) ... 27 | && strcmp(get(varargin{1},'type'),'axes') 28 | hAx = varargin{1}; 29 | varargin = varargin(2:end); % Remove arg 1 (axes handle) 30 | else 31 | hAx = gca; 32 | end; 33 | 34 | % Remaining args are either two point locations or a position vector 35 | if length(varargin) == 1 % Assume a 4-element position vector 36 | pos = varargin{1}; 37 | else 38 | [x,y] = deal(varargin{:}); % Assume two pairs (start, end points) 39 | end 40 | 41 | % Get limits 42 | axun = get(hAx,'Units'); 43 | set(hAx,'Units','normalized'); % Make axes units normalized 44 | axpos = get(hAx,'Position'); % Get axes position 45 | axlim = axis(hAx); % Get the axis limits [xlim ylim (zlim)] 46 | axwidth = diff(axlim(1:2)); 47 | axheight = diff(axlim(3:4)); 48 | 49 | % Transform from data space coordinates to normalized figure coordinates 50 | if exist('x','var') % Transform a and return pair of points 51 | varargout{1} = (x - axlim(1)) * axpos(3) / axwidth + axpos(1); 52 | varargout{2} = (y - axlim(3)) * axpos(4) / axheight + axpos(2); 53 | else % Transform and return a position rectangle 54 | pos(1) = (pos(1) - axlim(1)) / axwidth * axpos(3) + axpos(1); 55 | pos(2) = (pos(2) - axlim(3)) / axheight * axpos(4) + axpos(2); 56 | pos(3) = pos(3) * axpos(3) / axwidth; 57 | pos(4) = pos(4) * axpos(4 )/ axheight; 58 | varargout{1} = pos; 59 | end 60 | 61 | % Restore axes units 62 | set(hAx,'Units',axun) -------------------------------------------------------------------------------- /utilities/mes.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/mes.m -------------------------------------------------------------------------------- /utilities/nanpadcat.m: -------------------------------------------------------------------------------- 1 | function c=nanpadcat(a,b,d) 2 | 3 | %Performs horzcat on matrices that might have different lengths by filling 4 | %the empty places with NaNs. 5 | % 20120313 adjusted to do either horz- and vertcat, using a third variable 6 | % the dimension. Dimension can be 'v' or 'h'. 7 | 8 | 9 | % % for testing-------------------- 10 | % clear 11 | % clc 12 | % b=magic(7)' 13 | % a=zeros(3,5) 14 | % d='h'; 15 | % % end testing-------------------- 16 | 17 | 18 | sa=size(a); 19 | sb=size(b); 20 | 21 | ds1=sa(1)-sb(1); 22 | ds2=sa(2)-sb(2); 23 | 24 | 25 | if d=='h' 26 | pad=nan(abs(ds1), 1); 27 | 28 | if ds1<0 29 | pad=repmat(pad, 1, sa(2)); 30 | a=vertcat(a, pad); 31 | elseif ds1>0 32 | pad=repmat(pad, 1, sb(2)); 33 | b=vertcat(b, pad); 34 | else 35 | end 36 | 37 | c=horzcat(a, b); 38 | 39 | elseif d=='v' 40 | pad=nan( 1, abs(ds2)); 41 | 42 | if ds2<0 43 | pad=repmat(pad, sa(1), 1); 44 | a=horzcat(a, pad); 45 | elseif ds2>0 46 | pad=repmat(pad, sb(1), 1); 47 | b=horzcat(b, pad); 48 | else 49 | end 50 | c=vertcat(a, b); 51 | 52 | end -------------------------------------------------------------------------------- /utilities/panel_2.6/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/panel_2.6/.DS_Store -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel1.m: -------------------------------------------------------------------------------- 1 | 2 | % What can Panel do? 3 | % 4 | % This demo just shows off what Panel can do. It is not 5 | % intended as part of the tutorial - this begins in 6 | % demopanel2. 7 | % 8 | % (a) It's easy to create a complex layout 9 | % (b) You can populate it as you would a subplot layout 10 | % (c) You can export it to a "camera-ready" image file 11 | % 12 | % Now, move on to demopanel2 to learn how to use panel. 13 | 14 | 15 | 16 | %% (a) 17 | 18 | % clf 19 | figure(1) 20 | clf 21 | 22 | % create panel 23 | p = panel('defer'); 24 | 25 | % layout a variety of sub-panels 26 | p.pack('h', [1/3 -1]) 27 | p(1).pack([2/3 -1]); 28 | p(1,1).pack(3, 2); 29 | p(2).pack(6, 2); 30 | 31 | % set margins 32 | p.de.margin = 2; 33 | p(1,1).marginbottom = 12; 34 | p(2).marginleft = 20; 35 | p.margin = [13 10 2 2]; 36 | 37 | % and some properties 38 | p.fontsize = 8; 39 | 40 | 41 | 42 | %% (b) 43 | 44 | % data set 1 45 | for m = 1:3 46 | for n = 1:2 47 | 48 | % prepare sample data 49 | t = (0:99) / 100; 50 | s1 = sin(t * 2 * pi * m); 51 | s2 = sin(t * 2 * pi * n * 2); 52 | 53 | % select axis - see data set 2 for an alternative way to 54 | % access sub-panels 55 | p(1,1,m,n).select(); 56 | 57 | % plot 58 | plot(t, s1, 'r', 'linewidth', 1); 59 | hold on 60 | plot(t, s2, 'b', 'linewidth', 1); 61 | plot(t, s1+s2, 'k', 'linewidth', 1); 62 | 63 | % finalise axis 64 | axis([0 1 -2.2 2.2]); 65 | set(gca, 'xtick', [], 'ytick', []); 66 | 67 | end 68 | end 69 | 70 | % label axis group 71 | p(1,1).xlabel('time (unitless)'); 72 | p(1,1).ylabel('example data series'); 73 | 74 | % data set 2 75 | source = 'XYZXYZ'; 76 | 77 | % an alternative way to access sub-panels is to first get a 78 | % reference to the parent... 79 | q = p(2); 80 | 81 | % loop 82 | for m = 1:6 83 | for n = 1:2 84 | 85 | % select axis - these two lines do the same thing (see 86 | % above) 87 | % p(2,m,n).select(); 88 | q(m, n).select(); 89 | 90 | % prepare sample data 91 | data = randn(100, 1) * 0.4; 92 | 93 | % do stats 94 | stats = []; 95 | stats.source = source(m); 96 | stats.binrange = [-1 1]; 97 | stats.xtick = [-0.8:0.4:0.8]; 98 | stats.ytick = [0 20]; 99 | stats.bincens = -0.9:0.2:0.9; 100 | stats.values = data; 101 | stats.freq = hist(data, stats.bincens); 102 | stats.percfreq = stats.freq / length(data) * 100; 103 | stats.percpeak = 30; 104 | 105 | % plot 106 | demopanel_minihist(stats, m == 6, n == 1); 107 | 108 | end 109 | end 110 | 111 | % label axis group 112 | p(2).xlabel('data value (furlongs per fortnight)'); 113 | p(2).ylabel('normalised frequency (%)'); 114 | 115 | % data set 3 116 | p(1, 2).select(); 117 | 118 | % prepare sample data 119 | r1 = rand(100, 1); 120 | r2 = randn(100, 1); 121 | 122 | % plot 123 | plot(r1, r1+0.2*r2, 'k.') 124 | hold on 125 | plot([0 1], [0 1], 'r-') 126 | 127 | % finalise axis 128 | xlabel('our predictions'); 129 | ylabel('actual measurements') 130 | 131 | 132 | 133 | %% (c) 134 | 135 | % because we 'defer'red, we have to refresh. 136 | p.refresh(); 137 | 138 | 139 | 140 | 141 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel2.m: -------------------------------------------------------------------------------- 1 | 2 | % Basic use. Panel is just like subplot. 3 | % 4 | % (a) Create a grid of panels. 5 | % (b) Plot into each sub-panel. 6 | 7 | 8 | 9 | %% (a) 10 | 11 | % create a NxN grid in gcf (this will create a figure, if 12 | % none is open). 13 | % 14 | % you can pass the figure handle to the constructor if you 15 | % need to attach the panel to a particular figure, as p = 16 | % panel(h_figure). 17 | 18 | N = 2; 19 | use_panel = 1; 20 | clf 21 | 22 | % PREPARE 23 | if use_panel 24 | p = panel(); 25 | p.pack(N, N); 26 | end 27 | 28 | 29 | 30 | %% (b) 31 | 32 | % plot into each panel in turn 33 | 34 | for m = 1:N 35 | for n = 1:N 36 | 37 | % select one of the NxN grid of sub-panels 38 | if use_panel 39 | p(m, n).select(); 40 | else 41 | subplot(N, N, m + (n-1) * N); 42 | end 43 | 44 | % plot some data 45 | plot(randn(100,1)); 46 | 47 | % you can use all the usual calls 48 | xlabel('sample number'); 49 | ylabel('data'); 50 | 51 | % and so on - generally, you can treat the axis panel 52 | % like any other axis 53 | axis([0 100 -3 3]); 54 | 55 | end 56 | end 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel3.m: -------------------------------------------------------------------------------- 1 | 2 | % You can nest Panels as much as you like. 3 | % 4 | % (a) Create a grid of panels. 5 | % (b) Plot into three of the sub-panels. 6 | % (c) Create another grid in the fourth. 7 | % (d) Plot into each of these. 8 | 9 | 10 | 11 | %% (a) 12 | 13 | % create a panel in gcf. 14 | % 15 | % "p" is called the "root panel", which is the special panel 16 | % whose parent is the figure window, rather than another 17 | % panel. 18 | p = panel(); 19 | 20 | % pack a 2x2 grid of panels into it. 21 | p.pack(2, 2); 22 | 23 | 24 | 25 | %% (b) 26 | 27 | % plot into the first three panels 28 | for m = 1:2 29 | for n = 1:2 30 | 31 | % skip the 2,2 panel 32 | if m == 2 && n == 2 33 | break 34 | end 35 | if m == 1 && n == 1 36 | break 37 | end 38 | % select the panel (create an axis, and make that axis 39 | % current) 40 | p(m, n).select(); 41 | 42 | % plot some stuff 43 | plot(randn(100,1)); 44 | xlabel('sample number'); 45 | ylabel('data'); 46 | axis([0 100 -3 3]); 47 | 48 | end 49 | end 50 | 51 | 52 | 53 | %% (c) 54 | 55 | % pack a further grid into p(2, 2) 56 | % 57 | % all panels start as "uncommitted panels" (even the root 58 | % panel). the first time we "select()" one, we commit it as 59 | % an "axis panel". the first time we "pack()" one, we commit 60 | % it as a "parent panel". once committed, it can't change 61 | % into the other sort. 62 | % 63 | % this call commits p(2,2) as a parent panel - the six 64 | % children it creates all start as uncommitted panels. 65 | p(2, 2).pack(2, 3); 66 | 67 | 68 | 69 | %% (d) 70 | 71 | % plot into the six new sub-sub-panels 72 | for m = 1:2 73 | for n = 1:3 74 | 75 | % select the panel - this commits it as an axis panel 76 | p(2, 2, m, n).select(); 77 | 78 | % plot some stuff 79 | plot(randn(100,1)); 80 | xlabel('sample number'); 81 | ylabel('data'); 82 | axis([0 100 -3 3]); 83 | 84 | end 85 | end 86 | 87 | % note this alternative, equivalent, way to reference a 88 | % sub-panel 89 | p_22 = p(2, 2); 90 | 91 | % plot another bit of data into the six sub-sub-panels 92 | for m = 1:2 93 | for n = 1:3 94 | 95 | % select the panel 96 | p_22(m, n).select(); 97 | 98 | % plot more stuff 99 | hold on 100 | plot(randn(100,1)*0.3, 'r'); 101 | 102 | end 103 | end 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel4.m: -------------------------------------------------------------------------------- 1 | 2 | % Panels can be any size. 3 | % 4 | % (a) Create an asymmetrical grid of panels. 5 | % (b) Create another. 6 | % (c) Use select('all') to load them all with axes 7 | % (d) Get handles to all the axes and modify them. 8 | 9 | 10 | 11 | %% (a) 12 | 13 | % create a 2x2 grid in gcf with different fractionally-sized 14 | % rows and columns. a row or column sized as "-1" will 15 | % stretch to fill the remaining unassigned space. 16 | p = panel(); 17 | p.pack([1/3 2/3], [1/3 -1]); 18 | 19 | 20 | 21 | %% (b) 22 | 23 | % pack a 2x3 grid into p(2, 2). note that we can pack by 24 | % percentage as well as by fraction. 25 | p(2, 2).pack([30 70], [20 20 -1]); 26 | 27 | 28 | 29 | %% (c) 30 | 31 | % use select('all') to quickly show the layout you've achieved. 32 | % this commits all uncommitted panels as axis panels, so 33 | % they can't be parents anymore (i.e. they can't have more 34 | % children pack()ed into them). 35 | % 36 | % this is no use at all once you've got organised - look at 37 | % the first three demos, which don't use it - but it may help 38 | % you to see what you're doing as you're starting out. 39 | p.select('all'); 40 | 41 | 42 | 43 | %% (d) 44 | 45 | % whilst we're here, we can get all the axes within a 46 | % particular panel like this. see "help panel/descendants". 47 | h_axes = p.de.axis; 48 | 49 | % so then we might want to set something on them. 50 | set(h_axes, 'color', [0 0 0]); 51 | 52 | % yeah, real gothic. 53 | 54 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel5.m: -------------------------------------------------------------------------------- 1 | 2 | % Tools for finding your way around a layout. 3 | % 4 | % (a) Recreate the complex layout from demopanel1 5 | % (b) Show three tools that help to navigate a layout 6 | 7 | 8 | 9 | %% (a) 10 | 11 | % create panel 12 | p = panel('defer'); 13 | 14 | % layout a variety of sub-panels 15 | p.pack('h', [1/3 -1]) 16 | p(1).pack([2/3 -1]); 17 | p(1,1).pack(3, 2); 18 | p(2).pack(6, 2); 19 | 20 | pause(3) 21 | % set margins 22 | p.de.margin = 10; 23 | p(1,1).marginbottom = 20; 24 | p(2).marginleft = 20; 25 | p.margin = [13 10 2 2]; 26 | 27 | % and some properties 28 | p.fontsize = 8; 29 | 30 | 31 | 32 | %% (b) 33 | 34 | % if a layout gets complex, it can be tricky to find your 35 | % way around it. it's quite natural once you get the hang, 36 | % but there are three tools that will help you if you get 37 | % lost. they are display(), identify() and show(). 38 | 39 | % identify() only works on axis panels. we haven't bothered 40 | % plotting any data, this time, so we'll use select('all') 41 | % to commit all remaining uncommitted panels as axis panels. 42 | p.select('all'); 43 | 44 | % and because we 'defer'ed the rendering of this complex 45 | % layout, we have to refresh() to let rendering happen. 46 | p.refresh(); 47 | 48 | % display() the panel object at the prompt 49 | % 50 | % notice that most of the panels are called "Object" - this 51 | % is because they are "object panels", which is the general 52 | % name for axis panels (and that's because panels can contain 53 | % other graphics objects as well as axes). 54 | p 55 | 56 | % use identify() 57 | % 58 | % every panel that is an axis panel has its axis wiped and 59 | % replaced with the panel's reference. the one in the bottom 60 | % right, for instance, is labelled "(2,6,2)", which means we 61 | % can access it with p(2,6,2). 62 | p.identify(); 63 | 64 | % use show() 65 | % 66 | % we can demonstrate this by using this tool. the selected 67 | % panel is highlighted in red. show works on parent panels 68 | % as well - try "p(2).show()", for instance. 69 | p(2,6,2).show(); 70 | 71 | % then, of course, we can select a panel of our choice and 72 | % plot something in it 73 | p(2,4,1).select(); 74 | plot(randn(100, 1)) 75 | axis auto 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel6.m: -------------------------------------------------------------------------------- 1 | 2 | % Packing is very flexible - it doesn't just do grids. 3 | % 4 | % (a) Pack a pair of columns. 5 | % (b) Pack a bit into one of them, and then pack some more. 6 | % (c) Pack into the other using absolute packing mode. 7 | % (d) Call select('all'), to show off the result. 8 | % (e) What you can't (currently) do. 9 | 10 | 11 | 12 | %% (a) 13 | 14 | % create the root panel, and pack two columns. to pack 15 | % columns instead of rows, we just pass "h" (horizontal) to 16 | % pack(). 17 | p = panel(); 18 | p.pack('h', 2); 19 | 20 | 21 | 22 | %% (b) 23 | 24 | % pack some stuff into the left column. 25 | p(1).pack([1/6 1/6 1/6]); 26 | 27 | % oops, we didn't fill the thing. let's finish that off with 28 | % a couple of panels that are streeeeeeeee-tchy... we could 29 | % have also called p(1).pack(2) to do both at once, or one 30 | % call could have done all five if we'd passed enough 31 | % arguments above (remember we can pass -1 to leave a panel 32 | % stretchy). 33 | p(1).pack(); 34 | p(1).pack(); 35 | 36 | % see help panel/pack or doc panel for more information on 37 | % the packing possibilities. 38 | 39 | 40 | 41 | %% (c) 42 | 43 | % in the other column, we'll show how to do absolute 44 | % positioning. perhaps you're unlikely to need this, but 45 | % it's there if you do. with absolute positioning, you can 46 | % even place the child panel outside of its parent's area. 47 | p(2).pack('abs', [-0.3 0.05 1 0.4]); 48 | 49 | % and you can pack more than one of these... 50 | p(2).pack('abs', [0.2 0.6 0.6 0.4]); 51 | 52 | % see help panel/pack or doc panel for more information on 53 | % the packing possibilities. 54 | 55 | 56 | 57 | %% (d) 58 | 59 | % use selectAll to quickly show the layout you've achieved. 60 | % this commits all uncommitted panels as axis panels, so 61 | % they can't be parents anymore (i.e. they can't have more 62 | % children pack()ed into them). 63 | p.select('all'); 64 | 65 | 66 | 67 | 68 | %% (e) 69 | 70 | % what you can't do is do fit packing and absolute packing 71 | % into the same parent panel - the line below would generate 72 | % an error. you could do this, in principle, but i'm not 73 | % sure it would be useful. 74 | % p(2).pack(); 75 | 76 | % neither, currently, can you pack into an abs panel. this 77 | % might be supported in future, it's just a bit of a chore 78 | % to work out the code. let me know if you find a need for 79 | % it. 80 | % p(2,2).pack(2, 2); 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel7.m: -------------------------------------------------------------------------------- 1 | 2 | % Panel gives you figure-wide control over text properties. 3 | % 4 | % (a) Create a grid of panels. 5 | % (b) Change some text properties. 6 | 7 | 8 | 9 | %% (a) 10 | 11 | % create a grid 12 | p = panel(); 13 | p.pack(2, 2); 14 | 15 | % select all 16 | p.select('all'); 17 | 18 | 19 | 20 | 21 | 22 | %% (b) 23 | 24 | % if we set the properties on the root panel, they affect 25 | % all its children and grandchildren. 26 | p.fontname = 'Courier New'; 27 | p.fontsize = 10; 28 | p.fontweight = 'normal'; % this is the default, anyway 29 | 30 | % however, any child can override them, and the changes 31 | % affect just that child (and its descendants). 32 | p(2,2).fontsize = 14; 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel8.m: -------------------------------------------------------------------------------- 1 | 2 | % You can repack Panels from the command line. 3 | % 4 | % (a) Create a grid of panels, and show something in them. 5 | % (b) Repack some of them, as if at the command line. 6 | 7 | 8 | 9 | %% (a) 10 | 11 | % create a 2x2 grid in gcf. 12 | p = panel(); 13 | p.pack(2, 2); 14 | 15 | % have a look at p - all the child panels are currently 16 | % uncommitted 17 | p 18 | 19 | % commit all the uncommitted panels as axis panels 20 | p.select('all'); 21 | 22 | 23 | 24 | %% (b) 25 | 26 | % during development of a layout, you might find repack() 27 | % useful. 28 | 29 | % repack one of the rows in the root panel 30 | p(1).repack(0.3); 31 | 32 | % repack one of the columns in one of the rows 33 | p(1, 1).repack(0.3); 34 | 35 | % remember, you can always get a summary of the layout by 36 | % looking at the root panel in the command window 37 | p 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel9.m: -------------------------------------------------------------------------------- 1 | 2 | % Panel can build complex layouts rapidly (reprise of demo 1). 3 | % 4 | % (a) Build the layout from demopanel1, with annotation 5 | % (b) Add the content, so we can see what we're aiming for 6 | % (c) Show labelling of axis groups 7 | % (d) Add appropriate margins for this layout 8 | 9 | 10 | 11 | %% (a) 12 | 13 | % create panel 14 | % 15 | % we're going to build a big ol' layout, so we'll defer 16 | % rendering until we're finished 17 | p = panel('defer'); 18 | 19 | % let's start with two columns, one third and two thirds 20 | p.pack('h', [1/3 2/3]) 21 | 22 | % then let's pack two rows into the first column, with the 23 | % top row pretty big so we've room for some sub-panels 24 | p(1).pack([2/3 -1]); 25 | 26 | % now let's pack in those sub-panels 27 | p(1,1).pack(3, 2); 28 | 29 | % finally, let's pack a grid of sub-panels into the right 30 | % hand side too 31 | p(2).pack(6, 2); 32 | 33 | 34 | 35 | %% (b) 36 | 37 | % data set 1 38 | for m = 1:3 39 | for n = 1:2 40 | 41 | % prepare sample data 42 | t = (0:99) / 100; 43 | s1 = sin(t * 2 * pi * m); 44 | s2 = sin(t * 2 * pi * n * 2);h 45 | 46 | % select axis 47 | p(1,1,m,n).select(); 48 | 49 | % NB: an alternative way of accessing 50 | % q = p(1, 1); 51 | % q(m, n).select(); 52 | 53 | % plot 54 | plot(t, s1, 'r', 'linewidth', 1); 55 | hold on 56 | plot(t, s2, 'b', 'linewidth', 1); 57 | plot(t, s1+s2, 'k', 'linewidth', 1); 58 | 59 | % finalise axis 60 | axis([0 1 -2.2 2.2]); 61 | set(gca, 'xtick', [], 'ytick', []); 62 | 63 | end 64 | end 65 | 66 | % data set 2 67 | source = 'XYZXYZ'; 68 | 69 | for m = 1:6 70 | for n = 1:2 71 | 72 | % select axis 73 | p(2,m,n).select(); 74 | 75 | % prepare sample data 76 | data = randn(100, 1) * 0.4; 77 | 78 | % do stats 79 | stats = []; 80 | stats.source = source(m); 81 | stats.binrange = [-1 1]; 82 | stats.xtick = [-0.8:0.4:0.8]; 83 | stats.ytick = [0 20 40]; 84 | stats.bincens = -0.9:0.2:0.9; 85 | stats.values = data; 86 | stats.freq = hist(data, stats.bincens); 87 | stats.percfreq = stats.freq / length(data) * 100; 88 | stats.percpeak = 30; 89 | 90 | % plot 91 | demopanel_minihist(stats, m == 6, n == 1); 92 | 93 | end 94 | end 95 | 96 | % data set 3 97 | p(1, 2).select(); 98 | 99 | % prepare sample data 100 | r1 = rand(100, 1); 101 | r2 = randn(100, 1); 102 | 103 | % plot 104 | plot(r1, r1+0.2*r2, 'k.') 105 | hold on 106 | plot([0 1], [0 1], 'r-') 107 | 108 | % finalise axis 109 | xlabel('our predictions'); 110 | ylabel('actual measurements') 111 | 112 | 113 | 114 | %% (c) 115 | 116 | % we can label parent panels (or, "axis groups") just like 117 | % labelling axis panels, except we have to use the method 118 | % from panel, rather than the matlab call xlabel(). 119 | 120 | % label axis group 121 | p(1,1).xlabel('time (unitless)'); 122 | p(1,1).ylabel('example data series'); 123 | 124 | % label axis group 125 | p(2).xlabel('data value (furlongs per fortnight)'); 126 | p(2).ylabel('normalised frequency (%)'); 127 | 128 | 129 | 130 | 131 | 132 | %% (d) 133 | 134 | % because we 'defer'red, we have to refresh. 135 | p.refresh(); 136 | 137 | 138 | 139 | %%%% ATTEMPT 1 : DEFAULT MARGINS 140 | 141 | % see how the default margins are kind of crap for this 142 | % rather complex layout. we'll sort that out next. 143 | disp('Default margins are inappropriate.'); 144 | 145 | % pause 146 | disp('Press any key to tighten all internal margins...'); 147 | pause 148 | 149 | 150 | 151 | %%%% ATTEMPT 2 : TIGHTEN MARGINS BETWEEN AXES 152 | 153 | % tighten up all margins so that they're appropriate for the 154 | % sub-grids. 155 | p.de.margin = 2; 156 | 157 | % notice that we set the margin of all descendants of p, but 158 | % the margin of p is not changed (p.de does not include p 159 | % itself), so there is still a margin from the root panel, 160 | % p, to the figure edge. we can display this value: 161 | disp(sprintf('p.margin is [ %i %i %i %i ]', p.margin)); 162 | 163 | % pause 164 | disp('Press any key to widen two internal margins...'); 165 | pause 166 | 167 | 168 | 169 | %%%% ATTEMPT 3 : ADD SOME BIGGER MARGINS WHERE APPROPRIATE 170 | 171 | % now, let's space out the places we want spaced out 172 | p(1,1).marginbottom = 12; 173 | p(2).marginleft = 20; 174 | 175 | % pause 176 | disp('Press any key to tighten external (figure edge) margins...'); 177 | pause 178 | 179 | 180 | 181 | %%%% ATTEMPT 4 : TIGHTEN THE MARGINS WITH THE FIGURE EDGE 182 | 183 | % finally, let's sail as close to the wind as we dare for 184 | % the final product, by trimming the root margin to the bone 185 | p.margin = [13 10 2 2]; 186 | 187 | % and let's set the global font properties 188 | p.fontsize = 8; 189 | 190 | 191 | 192 | 193 | 194 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanelA.m: -------------------------------------------------------------------------------- 1 | 2 | % Panel builds image files, not just on-screen figures. 3 | % 4 | % (a) Use demopanel1 to create a layout. 5 | % (b) Export the result to file. 6 | % (c) Export to different physical sizes. 7 | % (d) Export at high quality. 8 | % (e) Adjust margins. 9 | % (f) Export using smoothing. 10 | % (g) Export to EPS, rather than PNG. 11 | 12 | 13 | 14 | %% (a) 15 | 16 | % delegate 17 | demopanel1 18 | 19 | % see "help panel/export" for the full range of options. 20 | 21 | 22 | 23 | %% (b) 24 | 25 | % the default sizing model for export targets a piece of 26 | % paper. the default paper model is A4, single column, with 27 | % 20mm margins. the default aspect ratio is the golden ratio 28 | % (landscape). therefore, if you provide only a filename, 29 | % you get this... 30 | 31 | % do a default export 32 | p.export('export_b'); 33 | 34 | % the default export resolution is 150DPI, so the resulting 35 | % file will look a bit scraggy, but it's a nice small file 36 | % that is probably fine for laying out your document. 37 | 38 | 39 | 40 | %% (c) 41 | 42 | % one thing you might want to vary from figure to 43 | % figure is the aspect ratio. the default (golden ratio) is 44 | % a little short, here, so let's make it a touch taller. 45 | p.export('export_c', '-a1.4'); 46 | 47 | % the other thing is the column layout. we've exported to a 48 | % single column, above - let's target a single column of a 49 | % two-column layout. 50 | p.export('export_c_c2', '-a1.4', '-c2'); 51 | 52 | % ach... that's never going to work, it doesn't fit. this 53 | % figure will have to span two columns, let's leave it how 54 | % it was. 55 | 56 | % NB: here, we have used the "paper sizing model". if you 57 | % prefer, you can use the "explicit sizing model" and just 58 | % specify width and height directly. see "help 59 | % panel/export". 60 | 61 | 62 | 63 | %% (d) 64 | 65 | % when you're done drafting your document, you can bring up 66 | % the export resolution to get a nice looking figure. "-rp" 67 | % means "publication resolution" (600DPI). 68 | p.export('export_d', '-a1.4', '-rp'); 69 | 70 | 71 | 72 | %% (e) 73 | 74 | % once exported at final resolution, i can't help 75 | % noticing the margins are a little generous. let's pull 76 | % them in as tight as we dare to reduce the whitespace. 77 | p.de.margin = 1; 78 | p(1,1).marginbottom = 9; 79 | p(2).marginleft = 12; 80 | p.margin = [10 8 0.5 0.5]; 81 | p.export('export_e', '-a1.4', '-rp'); 82 | 83 | % NB: when the margins are this tight, you may notice 84 | % small differences in layout between the on-screen 85 | % renderer, the PNG renderer, the EPS renderer. 86 | 87 | 88 | 89 | %% (f) 90 | 91 | % that's now exported at 600DPI, which is fine for most 92 | % purposes. however, the matlab renderer you are using may 93 | % not do nice anti-aliasing like some renderers. one way to 94 | % mitigate this is to export at 1200 (or higher) DPI, but 95 | % that makes for a very large figure file. an alternative is 96 | % to ask panel to render at a higher resolution, then smooth 97 | % back down to the specfied resolution. you'll have to wait a 98 | % few seconds for the result. here, we'll smooth by factor 99 | % 2. since this takes a little while, i don't usually do 100 | % this until i'm preparing a manuscript for submission. 101 | p.export('export_f', '-a1.4', '-rp/2'); 102 | 103 | % NB: this is brute force smoothing, and is not the same as 104 | % anti-aliasing. nonetheless, i find the results can be 105 | % useful. 106 | 107 | 108 | 109 | %% (g) 110 | 111 | % export by default is to PNG format - you may prefer EPS, 112 | % in which case just indicate this to export (other formats 113 | % are supported, too). in EPS format, smoothing won't be 114 | % applied, so we can drop that option. 115 | p.export('export_g', '-a1.4', '-rp', '-oeps'); 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanelB.m: -------------------------------------------------------------------------------- 1 | 2 | % Panel can incorporate an existing axis. 3 | % 4 | % (a) Create the root panel. 5 | % (b) Create an axis yourself. 6 | % (c) Pack an automatically created axis, and your own axis, 7 | % into the root panel. 8 | 9 | 10 | 11 | %% (a) 12 | 13 | % create a column-pair layout, with 95% of the space given 14 | % to the left hand panel 15 | p = panel(); 16 | p.pack('h', [95 -1]); 17 | 18 | % and put an axis in the left panel 19 | h_axis = p(1).select(); 20 | 21 | % and, hell, an image too 22 | [X,Y,Z] = peaks(50); 23 | surfc(X,Y,Z); 24 | 25 | 26 | 27 | %% (b) 28 | 29 | % sometimes you'll want to use some other function than 30 | % Panel to create one or more axes. for instance, 31 | % colorbar... 32 | h_colorbar_axis = colorbar('peer', h_axis); 33 | 34 | 35 | 36 | %% (c) 37 | 38 | % panel can manage the layout of these too 39 | p(2).select(h_colorbar_axis); 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanelC.m: -------------------------------------------------------------------------------- 1 | 2 | % Recovering a Panel from a Figure. 3 | % 4 | % (a) Create a grid of panels, and show something in them. 5 | % (b) Recover the root panel from the Figure. 6 | 7 | 8 | 9 | %% (a) 10 | 11 | % create a 2x2 grid in gcf. 12 | p = panel(); 13 | p.pack(2, 2); 14 | 15 | % show dummy content 16 | p.select('data'); 17 | 18 | 19 | 20 | %% (b) 21 | 22 | % say we returned from a function and didn't have a handle 23 | % to panel - during development, it might be nice to be able 24 | % to recover the panel from the Figure handle. we can, like 25 | % this. if we don't pass an argument, gcf is assumed. 26 | q = panel.recover(); 27 | 28 | % note that "p" and "q" now refer to the same thing - it's 29 | % not two root panels, it's two references to the same one. 30 | if p == q 31 | disp('panels are identical') 32 | end 33 | 34 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanelD.m: -------------------------------------------------------------------------------- 1 | 2 | % Panel interacts with other graphics objects apart from figures and axes. 3 | % 4 | % (a) Create a figure a uipanel. 5 | % (b) Attach a panel to it. 6 | % (c) Select another uipanel into one of the sub-panels. 7 | % (d) Attach a callback. 8 | 9 | 10 | 11 | %% (a) 12 | 13 | % create the figure 14 | clf 15 | 16 | % create a uipanel 17 | set(gcf, 'units', 'normalized'); 18 | u1 = uipanel('units', 'normalized', 'position', [0.1 0.1 0.8 0.8]); 19 | 20 | 21 | 22 | %% (b) 23 | 24 | % create a 2x3 grid in one of the uipanels 25 | p = panel(u1); 26 | p.pack(2, 3); 27 | 28 | 29 | 30 | 31 | %% (c) 32 | 33 | % create another uipanel 34 | u2 = uipanel(); 35 | 36 | % but let panel manage its size 37 | p(2, 2).select(u2); 38 | 39 | % select all other panels in the grid as axes 40 | p.select('data') 41 | 42 | 43 | 44 | 45 | %% (d) 46 | 47 | % if you need a notification when u2 is resized, you can 48 | % hook in to the resize event of u2. a demo callback 49 | % function is used here, but of course you can supply any 50 | % function handle. 51 | p(2, 2).setCallback(@demopanel_callback); 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanelE.m: -------------------------------------------------------------------------------- 1 | 2 | % You can have as many Panels as you like in one Figure. 3 | % 4 | % (a) Create a figure with two uipanel objects. 5 | % (b) Attach a panel to one of these. 6 | % (c) Attach another - oh, wait! 7 | 8 | 9 | 10 | %% (a) 11 | 12 | % create the figure 13 | clf 14 | 15 | % create a couple of uipanels 16 | set(gcf, 'units', 'normalized'); 17 | u1 = uipanel('units', 'normalized', 'position', [0.1 0.1 0.35 0.8]); 18 | u2 = uipanel('units', 'normalized', 'position', [0.55 0.1 0.35 0.8]); 19 | 20 | 21 | 22 | %% (b) 23 | 24 | % create a 2x2 grid in one of the uipanels 25 | p = panel(u1); 26 | p.pack(2, 2); 27 | p.select('all'); 28 | 29 | % see? 30 | pause(3) 31 | 32 | 33 | 34 | %% (c) 35 | 36 | % and, what the hell, another in the other 37 | q = panel(u2); 38 | q.pack(2, 2); 39 | q.select('all'); 40 | 41 | % oh, wait, the first one's disappeared. why? 42 | pause(3) 43 | 44 | % by default, only one panel can be attached to any one 45 | % figure. this makes for ease of use, usually. if you want 46 | % to attach more than one, you have to pass the 'add' 47 | % argument to the constructor when you create additional 48 | % panels. 49 | p = panel(u1, 'add'); 50 | p.pack(2, 2); 51 | p.select('all'); 52 | 53 | % see? 54 | pause(3) 55 | 56 | % and, of course, if we try to create a new one again, once 57 | % again without 'add', we'll delete all existing panels, as 58 | % before... 59 | p = panel(u1); 60 | p.pack(2, 2); 61 | p.select('all'); 62 | 63 | % see? 64 | pause(3) 65 | 66 | % finally, let's delete the first one, just for the craic. 67 | delete(p); 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanelF.m: -------------------------------------------------------------------------------- 1 | 2 | % You can manage fonts yourself, if you prefer. 3 | % 4 | % Panel, by default, manages fonts for all managed objects, 5 | % and any associated axis labels and titles. If you want to 6 | % manage these individually, you can turn this off by 7 | % passing the flag "no-manage-font" to the panel 8 | % constructor. 9 | % 10 | % (a) Manage fonts globally (default). 11 | % (b) Do not manage fonts. 12 | 13 | 14 | 15 | %% (a) 16 | 17 | % create 18 | figure(1) 19 | p = panel(); 20 | p.pack(2, 2); 21 | hh = p.select('all'); 22 | 23 | % create xlabels 24 | for h = hh 25 | xlabel(h, 'this will render as Arial', 'fontname', 'times'); 26 | end 27 | 28 | % manage fonts globally 29 | p.fontname = 'Arial'; 30 | 31 | 32 | 33 | %% (b) 34 | 35 | % create 36 | figure(2) 37 | p = panel('no-manage-font'); 38 | p.pack(2, 2); 39 | hh = p.select('all'); 40 | 41 | % create xlabels 42 | for h = hh 43 | xlabel(h, 'this will render as Times', 'fontname', 'times'); 44 | end 45 | 46 | % attempt to manage fonts globally (no effect) 47 | p.fontname = 'Arial'; 48 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanelG.m: -------------------------------------------------------------------------------- 1 | 2 | % One panel can manage multiple axes/graphics objects. 3 | % 4 | % 19/07/12 This example, and the multi-object functionality, 5 | % was added with release 2.5, and was suggested by user 6 | % "Brendan" on Matlab Central. 7 | % 8 | % (a) Create a layout. 9 | % (b) Create two user axes. 10 | % (c) Have them both managed by a panel. 11 | 12 | 13 | 14 | %% (a) 15 | 16 | % create 17 | clf 18 | p = panel(); 19 | p.pack(2, 2); 20 | 21 | % select sample data into some of them 22 | p(1,1).select('data'); 23 | p(1,2).select('data'); 24 | p(2,1).select('data'); 25 | 26 | 27 | 28 | %% (b) 29 | 30 | % create two axes, one overlaying the other to provide 31 | % separate tick labelling at top and right. 32 | 33 | % main axis 34 | ax1 = axes(); 35 | 36 | % transparent axis for extra axis labelling 37 | ax2 = axes('Color', 'none', 'XAxisLocation', 'top','YAxisLocation', 'Right'); 38 | 39 | % set up the fancy labelling (due to Brendan) 40 | OppTickLabels = {'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k'}; 41 | set(ax2, 'XLim', get(ax1, 'XLim'), 'YLim', get(ax1, 'YLim')); 42 | set(ax2, 'XTick', get(ax1, 'XTick'), 'YTick', get(ax1, 'YTick')); 43 | set(ax2, 'XTickLabel', OppTickLabels, 'YTickLabel', OppTickLabels); 44 | 45 | 46 | 47 | %% (c) 48 | 49 | % hand both axes to panel for position management 50 | p(2,2).select([ax1 ax2]); 51 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel_callback.m: -------------------------------------------------------------------------------- 1 | 2 | % this callback is attached by demopanelD 3 | 4 | function demopanel_callback(data) 5 | 6 | p = data.panel; 7 | p 8 | p.object 9 | disp(['callback fired: object type was "' get(p.object, 'type') '"']) 10 | disp(['panel position was "' num2str(p.position) '"']) 11 | 12 | 13 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demopanel_minihist.m: -------------------------------------------------------------------------------- 1 | 2 | % this function is used by some of the demos to display data 3 | 4 | function demopanel_minihist(stats, show_xtick, show_ytick) 5 | 6 | % color 7 | col = histcol(stats.source); 8 | 9 | % plot 10 | b = bar(stats.bincens, stats.percfreq, 0.9); 11 | set(b, 'facecolor', palecol(col), 'edgecolor', col, 'showbaseline', 'off'); 12 | hold on 13 | 14 | % mean 15 | x = mean(stats.values) * [1 1]; 16 | y = [0 100]; 17 | plot(x, y, 'k-', 'linewidth', 1); 18 | 19 | % label 20 | set(gca, 'ytick', stats.ytick); 21 | if ~show_ytick 22 | set(gca, 'yticklabel', {}); 23 | end 24 | 25 | % label 26 | set(gca, 'xtick', stats.xtick); 27 | if ~show_xtick 28 | set(gca, 'xticklabel', {}); 29 | end 30 | 31 | % finalise axis 32 | axis([stats.binrange 0 stats.percpeak]); 33 | grid on 34 | 35 | % overflows 36 | N = sum(stats.values > max(stats.binrange)); 37 | if N 38 | y = stats.percpeak * 0.8; 39 | x = stats.binrange(1) + [0.98] * diff(stats.binrange); 40 | text(x, y, [int2str(N) '>'], 'hori', 'right', 'fontsize', 8); 41 | end 42 | 43 | % overflows 44 | N = sum(stats.values < min(stats.binrange)); 45 | if N 46 | y = stats.percpeak * 0.8; 47 | x = stats.binrange(1) + [0.02] * diff(stats.binrange); 48 | text(x, y, ['<' int2str(N)], 'hori', 'left', 'fontsize', 8); 49 | end 50 | 51 | 52 | 53 | 54 | 55 | function col = histcol(source) 56 | 57 | switch source 58 | 59 | case 'X' 60 | col = [1 0 0]; 61 | 62 | case 'Y' 63 | col = [0 0.5 0]; 64 | 65 | case 'Z' 66 | col = [0 0 1]; 67 | 68 | end 69 | 70 | 71 | 72 | 73 | 74 | function c = palecol(c) 75 | 76 | t = [1 1 1]; 77 | d = t - c; 78 | c = c + (d * 0.5); 79 | 80 | 81 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/demotest.m: -------------------------------------------------------------------------------- 1 | %% (a) 2 | 3 | % create a panel in gcf. 4 | % 5 | % "p" is called the "root panel", which is the special panel 6 | % whose parent is the figure window, rather than another 7 | % panel. 8 | clc 9 | close all 10 | clear all 11 | load 'c305a.mat' 12 | 13 | p = panel(); 14 | 15 | % pack a 2x2 grid of panels into it. 16 | p.pack(2, 2); 17 | %% (b) 18 | 19 | % plot into the first three panels 20 | for m = 1:2 21 | for n = 1:2 22 | 23 | % skip the 2,2 panel 24 | if m == 2 && n == 2 25 | break 26 | end 27 | 28 | % select the panel (create an axis, and make that axis 29 | % current) 30 | p(m, n).select(); 31 | 32 | % plot some stuff 33 | plot(fbmm.timePC,fbmm.mdist); 34 | % plot(randn(100,1)); 35 | xlabel('iSpeed'); 36 | ylabel('TimePC'); 37 | axis([0 100 0 1.1]); 38 | 39 | end 40 | end 41 | 42 | -------------------------------------------------------------------------------- /utilities/panel_2.6/demo/eps2pdf.m: -------------------------------------------------------------------------------- 1 | function [result,msg] = eps2pdf(epsFile,fullGsPath,orientation) 2 | %EPS2PDF Converts an eps file to a pdf file using GhostScript (GS) 3 | % 4 | % [result,msg] = eps2pdf(epsFile,fullGsPath,orientation) 5 | % 6 | % - epsFile: eps file name to be converted to pdf file 7 | % - fullGsPath: (optional) FULL GS path, including the file name, to 8 | % the GS executable (on win32 it could be c:\program 9 | % files\gs\gs8.14\bin\gswin32c.exe). The existence for 10 | % fullGsPath will be checked for if given. On the other 11 | % hand, if fullGsPath is not given or empty it defaults 12 | % to 'gswin32c' for pcs and 'gs' for unix and the 13 | % existence will not be checked for. But in this, latter 14 | % case, GS's path must be in the system's path variable. 15 | % - orientation: (optional) a flag that tells how the orientation tag in eps file should be treated 16 | % just before the conversion (orientation tag is changed or even removed): 17 | % 0 -> no change (default) 18 | % 1 -> flip orientation 19 | % 2 -> remove orientation 20 | % 21 | % - result: 0 if ok, anything else otherwise 22 | % - msg: resulting status on file being processed 23 | % 24 | % NOTES: GhostScript is needed for this function to work. Orientation can 25 | % also be changed - use this only if you have problems with the orientation - in 26 | % such a case try with orientation=1 first and then orientation=2 if the first option is 27 | % not the right one. 28 | % 29 | % EPS2PDF converts an existing EPS file to a PDF file using Ghostscript. EPS2PDF 30 | % reads an eps file, modifies the bounding box and creates a pdf file whose size 31 | % is determined by the bounding box and not by the paper size. This can not be 32 | % accomplished by using Ghostscript only. So, all that one needs is of course 33 | % Matlab and Ghostscript drivers. 34 | % 35 | % This tool is especially suited for LaTeX (TeX) users who want to create pdf 36 | % documents on the fly (by including pdf graphics and using either pdftex or 37 | % pdflatex). An example would be, if you are using LaTeX (TeX) to typeset 38 | % documents then the usual (simple) way to include graphics is to include eps 39 | % graphics using for example (if there exists myfigure.eps) 40 | % \begin{figure} 41 | % \centering 42 | % \includegraphics[scale=0.8]{myfigure}\\ 43 | % \caption{some caption.} 44 | % \end{figure} 45 | % To use pdflatex (pdftex) you do not need to change anything but provide another 46 | % file myfigure.pdf in the same directory along with myfigure.eps. And this file, 47 | % of course, can be generated by EPS2PDF. 48 | % 49 | % This function was tested on win32 system running Matlab R13sp1. It should work 50 | % on all platforms, if not, contact the author. 51 | % 52 | % SOURCE: The original idea came from the "eps-to-pdf" converter written in perl by Sebastian Rahtz 53 | % 54 | % Primoz Cermelj, 24.08.2004 55 | % (c) Primoz Cermelj, primoz.cermelj@email.si 56 | % 57 | % Version: 0.9.3 58 | % Last revision: 04.10.2004 59 | %-------------------------------------------------------------------------- 60 | global epsFileContent 61 | 62 | if ispc 63 | DEF_GS_PATH = 'gswin32c.exe'; 64 | else 65 | DEF_GS_PATH = 'gs'; 66 | end 67 | GS_PARAMETERS = '-q -dNOPAUSE -dBATCH -dDOINTERPOLATE -dUseFlateCompression=true -sDEVICE=pdfwrite -r1200'; 68 | 69 | error(nargchk(1,3,nargin)); 70 | if nargin < 2 || isempty(fullGsPath) 71 | fullGsPath = DEF_GS_PATH; 72 | else 73 | if ~exist(fullGsPath) 74 | status = ['Ghostscript executable could not be found: ' fullGsPath]; 75 | if nargout, result = 1; end; 76 | if nargout > 1, msg = status; else, disp(status); end; 77 | return 78 | end 79 | end 80 | if nargin < 3 || isempty(orientation) 81 | orientation = 0; 82 | end 83 | orientation = abs(round(orientation)); 84 | orientation = orientation(1); 85 | if orientation < 0 | orientation > 2 86 | orientation = 0; 87 | end 88 | 89 | epsFileContent = []; 90 | 91 | %--------- 92 | % Get file name, path 93 | %--------- 94 | source = epsFile; 95 | [pathstr,sourceName,ext] = fileparts(source); 96 | if isempty(pathstr) 97 | pathstr = cd; 98 | source = fullfile(pathstr,source); 99 | end 100 | 101 | targetName = [sourceName '.pdf']; 102 | target = fullfile(pathstr,targetName); % target - pdf file 103 | 104 | tmpFileName = sourceName; 105 | tmpFile = fullfile(pathstr,[tmpFileName ext '.eps2pdf~']); 106 | 107 | 108 | % Create tmp file,... 109 | [ok,errStr] = create_tmpepsfile(source,tmpFile,orientation); 110 | if ~ok 111 | status = ['Error while creating temporary eps file: ' epsFile ' - ' errStr]; 112 | if nargout, result = 1; end; 113 | if nargout > 1, msg = status; else, disp(status); end; 114 | else 115 | % Run Ghostscript 116 | comandLine = ['"' fullGsPath '"' ' ' GS_PARAMETERS ' -sOutputFile=' '"' target '"' ' -f ' '"' tmpFile '"']; 117 | [stat, result] = system(comandLine); 118 | if stat 119 | status = ['pdf file not created - error running Ghostscript - check GS path: ' result]; 120 | if nargout, result = 1; end; 121 | if nargout > 1, msg = status; else, disp(status); end; 122 | else 123 | status = 'pdf successfully created'; 124 | if nargout, result = 0; end; 125 | if nargout > 1, msg = status; else, disp(status); end; 126 | end 127 | end 128 | 129 | % Delete tmp file 130 | if exist(tmpFile) 131 | delete(tmpFile); 132 | end 133 | 134 | 135 | 136 | 137 | 138 | 139 | %///////////////////////////////////////////////////////////////////// 140 | % SUBFUNCTIONS SECTION 141 | %///////////////////////////////////////////////////////////////////// 142 | 143 | %-------------------------------------------------------------------- 144 | function [ok,errStr] = create_tmpepsfile(epsFile,tmpFile,orientation) 145 | % Creates tmp eps file - file with refined content 146 | global epsFileContent 147 | 148 | ok = 0; 149 | errStr = []; 150 | [ok,errStr] = read_epsfilecontent( epsFile ); 151 | if ~ok 152 | return 153 | end 154 | [ok,errStr] = update_epsfilecontent( epsFile,orientation ); 155 | if ~ok 156 | return 157 | end 158 | fh = fopen(tmpFile,'w'); 159 | if fh == -1 160 | errStr = ['Temporary file cannot be created. Check write permissions.']; 161 | return 162 | end 163 | try 164 | fwrite(fh,epsFileContent,'char'); % fwrite is faster than fprintf 165 | ok = 1; 166 | catch 167 | errStr = ['Error writing temporary file. Check write permissions.']; 168 | end 169 | fclose(fh); 170 | %-------------------------------------------------------------------- 171 | 172 | 173 | %-------------------------------------------------------------------- 174 | function [ok,errStr] = read_epsfilecontent( epsFile ) 175 | % Reads the content of the eps file into epsFileContent 176 | global epsFileContent 177 | 178 | ok = 0; 179 | errStr = []; 180 | fh = fopen(epsFile,'r'); 181 | if fh == -1 182 | errStr = ['File: ' epsFile ' cannot be accessed or does not exist']; 183 | return 184 | end 185 | try 186 | epsFileContent = fread(fh,'char=>char')'; % fread is faster than fscanf 187 | ok = 1; 188 | catch 189 | errStr = lasterror; 190 | end 191 | fclose(fh); 192 | %-------------------------------------------------------------------- 193 | 194 | 195 | %-------------------------------------------------------------------- 196 | function [ok,errStr] = update_epsfilecontent(epsFile,orientation) 197 | % Updates eps file by adding some additional information into the header 198 | % section concerning the bounding box (BB) 199 | global epsFileContent 200 | 201 | ok = 0; 202 | errStr = []; 203 | 204 | % Read current BB coordinates 205 | ind = strfind( lower(epsFileContent), lower('%%BoundingBox:')); 206 | if isempty(ind) 207 | errStr = ['Cannot find Bounding Box in file: ' epsFile]; 208 | return 209 | end 210 | ii = ind(1) + 14; 211 | fromBB = ii; 212 | while ~((epsFileContent(ii) == sprintf('\n')) | (epsFileContent(ii) == sprintf('\r')) | (epsFileContent(ii) == '%')) 213 | ii = ii + 1; 214 | end 215 | toBB = ii - 1; 216 | coordsStr = epsFileContent(fromBB:toBB); 217 | coords = str2num( coordsStr ); 218 | if isempty(coords) 219 | errStr = ['Error reading BB coordinates from file: ' epsFile]; 220 | return 221 | end 222 | NL = getnl; 223 | w = abs(coords(3)-coords(1)); 224 | h = abs(coords(4)-coords(2)); 225 | 226 | % Change the orientation if requested 227 | changeOrientation = 0; 228 | if orientation ~= 0 229 | ind = strfind( lower(epsFileContent), lower('%%Orientation:')); 230 | if ~isempty(ind) 231 | ii = ind(1) + 14; 232 | fromOR = ii; 233 | while ~((epsFileContent(ii) == sprintf('\n')) | (epsFileContent(ii) == sprintf('\r')) | (epsFileContent(ii) == '%')) 234 | ii = ii + 1; 235 | end 236 | toOR = ii - 1; 237 | orientStr = strim(epsFileContent(fromOR:toOR)); 238 | if ~isempty(orientStr) & orientation == 1 % flip 239 | if strfind(lower(orientStr),'landscape') 240 | changeOrientation = 1; 241 | orientStr = 'Portrait'; 242 | elseif strfind(lower(orientStr),'portrait') 243 | changeOrientation = 1; 244 | orientStr = 'Landscape'; 245 | end 246 | elseif ~isempty(orientStr) & orientation == 2 % remove 247 | if strfind(lower(orientStr),'landscape') | strfind(lower(orientStr),'portrait') 248 | changeOrientation = 1; 249 | orientStr = ' '; 250 | end 251 | end 252 | end 253 | end 254 | 255 | % Refine the content - add additional information and even change the 256 | % orientation 257 | addBBContent = [' 0 0 ' int2str(w) ' ' int2str(h) ' ' NL... 258 | '<< /PageSize [' int2str(w) ' ' int2str(h) '] >> setpagedevice' NL... 259 | 'gsave ' int2str(-coords(1)) ' ' int2str(-coords(2)) ' translate']; 260 | if changeOrientation 261 | if fromOR > fromBB 262 | epsFileContent = [epsFileContent(1:fromBB-1) addBBContent epsFileContent(toBB+1:fromOR-1) orientStr epsFileContent(toOR+1:end)]; 263 | else 264 | epsFileContent = [epsFileContent(1:fromOR-1) orientStr epsFileContent(toOR+1:fromBB-1) addBBContent epsFileContent(toBB+1:end)]; 265 | end 266 | else 267 | epsFileContent = [epsFileContent(1:fromBB-1) addBBContent epsFileContent(toBB+1:end)]; 268 | end 269 | 270 | ok = 1; 271 | %-------------------------------------------------------------------- 272 | 273 | %-------------------------------------------------------------------- 274 | function NL = getnl 275 | % Returns new-line string as found from first occurance from epsFileContent 276 | global epsFileContent 277 | 278 | NL = '\r\n'; % default (for Windows systems) 279 | ii = 1; 280 | len = length(epsFileContent); 281 | while ~(epsFileContent(ii)==sprintf('\n') | epsFileContent(ii)==sprintf('\r') | ii 2 | 3 | 4 | 5 | Panel Documentation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 |
20 | Overview | Layout | Export 21 |
22 | 23 | 24 |

Panel 2

25 | 26 | 27 | 28 |

Export

29 | 30 |

The page on Layout describes how panels are packed into a rectangular space. On-screen, this space is the figure window. This page briefly describes exporting (see panel/export) whereby the panels are packed into an image file.

31 | 32 |

Hint When laying out, Panel respects the physical sizes of figures and margins and fonts. Thus, if you want the figure window on screen to work as a preview of what will end up in the image file, resize the window to the physical size you are exporting to (i.e. use a ruler!).

33 | 34 | 35 | 36 |

Paper Sizing Model

37 | 38 |

If you are targeting a paper publication, you might find the paper sizing model easiest. Usually, just indicate the number of columns and the aspect ratio, and Panel will work out the required image file size for you. Other options include paper type (default A4), paper orientation (default portrait), paper margin size and inter-column space. The illustration shows a figure placed into one column of an A4 page at the default aspect ratio (the golden ratio).

39 | 40 |

Hint The paper type, margin size and inter-column space do vary slightly across publications, but for the vast majority the default values (A4, 20mm, 5mm) are close enough that making them more precise has a negligible impact on the resulting image file. I never bother changing them.

41 | 42 | 43 | 44 |

Explicit Sizing Model

45 | 46 |

If, for whatever reason, you don't want to use the Paper Sizing Model, you can specify the width and height of the target image file directly (w and h, see illustration). Or, specify width and aspect ratio.

47 | 48 | 49 | 50 |

Export Formats

51 | 52 |

Panel exports using Matlab's print() function, and most of the formats supported there are also supported by Panel (see help panel/export for details). As of Release 2.6, Panel will also export to SVG, if the tool plot2svg() is found on the Matlab path (find this tool here).

53 | 54 | 55 | 56 |

57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/panel_2.6/docs/export.png -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/export_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/panel_2.6/docs/export_thumb.png -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Panel Documentation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 |
20 | Overview | Layout | Export 21 |
22 | 23 | 24 |

Panel 2

25 | 26 | 27 | 28 |

Overview

29 | 30 |

At its simplest, Panel is a Matlab utility that simplifies the layout of multi-axis figures, for which you might otherwise use subplot(). An example layout is shown in the illustration (click to enlarge).

31 | 32 | 33 | 34 |

Resources

35 | 36 | 41 | 42 |

If you are new to Panel, start with demopanel1, and work your way through until you grow bored. If you want to know how to do something in particular, try help panel/demo and look through the headings.

43 | 44 | 45 | 46 |

Features

47 | 48 | 59 | 60 | 61 | 62 |

Changes since Panel 1

63 | 64 | Upgrading users of Panel 1 will notice the following changes. 65 | 66 | 75 | 76 | 77 | 78 |

Gotchas

79 | 80 | 84 | 85 | 86 | 87 |

Acknowledgements

88 | 89 |

Several Matlab Central users have made helpful suggestions which have led to Panel being improved. These are Arthur Ward, Niko, LP Pakula, Ian, Daniel, Mukhtar Ullah and Brendan Sullivan. The incorporated LP solver is due to Jeff Stuart, formerly of USM. Export to SVG (Scalable Vector Graphics) requires plot2svg() by Juerg Schwizer (this does not ship with Panel, but is free to download here).

90 | 91 | 92 | 93 |
94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/index.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/panel_2.6/docs/index.png -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/index_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/panel_2.6/docs/index_thumb.png -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Panel Documentation 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 |
20 | Overview | Layout | Export 21 |
22 | 23 | 24 |

Panel 2

25 | 26 | 27 | 28 |

Layout

29 | 30 |

The panels within a figure are arranged in a hierarchy (or tree). The "root panel" is attached to a Matlab graphics object (usually a figure, though see demopanelD). Each panel, including the root panel, may have one or more "child panels". This is recursive, so that the entire layout forms a hierarchical "family" of panels, including the root panel and all its descendants. This is shown in the illustration (click to enlarge).

31 | 32 |

Newly-created panels are "uncommitted", and do nothing but take up space. If you call select() on an uncommitted panel, it is committed as an "object panel" - that is, it now looks after a graphics object (if you don't pass it a graphics object, it will create an axis automatically and look after that). If you call pack() on an uncommitted panel, it is committed as a "parent panel" - that is, it now contains child panels and looks after their positioning.

33 | 34 | 35 | 36 |

Packing

37 | 38 |

Layout in Panel is governed primarily by "packing". Most panels will be packed in "relative" mode. This means that the space offered by their parent is distributed amongst them according to their packed sizes (fractions of the parent space). "Absolute" packing is also available - see pack(). Panels can be packed along either the horizontal or vertical dimension, so that arbitrarily complex layouts can be built.

39 | 40 |

Hint You can develop "grid" layouts very succinctly by using the syntax pack(M, N). For an example, see demopanel2.

41 | 42 | 43 | 44 |

Margins

45 | 46 |

The other lever you have for controlling layout is "margins". Every panel has a margin on each of its four edges. This margin is respected within the panel's parent. For most panels, the parent is the parent panel; for the root panel, the parent is the figure window (or the image file, if exporting).

47 | 48 |

Note that margins are respected only within the immediate parent. For example, the margin setting of the root panel affects the layout of the whole figure with respect to the figure edge, whilst the margin settings of any child panels, grandchild panels, etc., have no impact on the relationship with the figure edge.

49 | 50 |

Most likely, you will set margins using p(...).margin to set an individual relationship between an individual panel and a sibling, and p(...).de.margin to control the relationships amongst all the descendants of p.

51 | 52 |

Hint I often find it easiest to start with a small or zero margin everywhere, and then increase margins individually as necessary. For an example, see demopanel9.

53 | 54 | 55 | 56 |

Other aspects of layout

57 | 58 |

One other factor affecting layout that is rarely needed is the align property - see doc panel. Note, also, that you can get/set margins in a variety of physical units - see the property units.

59 | 60 | 61 | 62 | 63 |
64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/panel_2.6/docs/layout.png -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/layout_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ACCLAB/DABEST-Matlab/7825f7657f1c4142d2dfdcb2d2ce2175fe9cc9b9/utilities/panel_2.6/docs/layout_thumb.png -------------------------------------------------------------------------------- /utilities/panel_2.6/docs/panel.css: -------------------------------------------------------------------------------- 1 | 2 | body 3 | { 4 | font-family:segoe ui, verdana; 5 | font-size:medium; 6 | color:#335; 7 | max-width:1000px; 8 | margin:auto; 9 | background-color:gray; 10 | } 11 | 12 | #main 13 | { 14 | background-color:white; 15 | padding:32px; 16 | } 17 | 18 | .note 19 | { 20 | background-color:#d96; 21 | color:white; 22 | padding:16px; 23 | font-size:small; 24 | } 25 | 26 | h1, h2, h3, h4, h5 27 | { 28 | font-family:Segoe UI, Times; 29 | color:black; 30 | } 31 | 32 | a:link, a:visited 33 | { 34 | color:blue; 35 | text-decoration:none; 36 | } 37 | 38 | a:hover 39 | { 40 | text-decoration:underline; 41 | } 42 | 43 | tt, pre, dh.ref 44 | { 45 | font-family:"andale mono", "courier new"; 46 | color:#930; 47 | font-weight:bold; 48 | } 49 | 50 | dd 51 | { 52 | margin-bottom:8px; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /utilities/panel_2.6/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Ben Mitch 2 | Copyright (c) 2011, Jeff Stuart 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are 7 | met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in 13 | the documentation and/or other materials provided with the distribution 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 | POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /utilities/pvpmod.m: -------------------------------------------------------------------------------- 1 | function pvpmod(x) 2 | % PVPMOD - evaluate parameter/value pairs 3 | % pvpmod(x) assigns the value x(i+1) to the parameter defined by the 4 | % string x(i) in the calling workspace. This is useful to evaluate 5 | % contents in an mfile, e.g. to change default settings 6 | % of any variable initialized before pvpmod(x) is called. 7 | % 8 | % (c) U. Egert 1998 9 | 10 | %############################################ 11 | % this loop is assigns the parameter/value pairs in x to the calling 12 | % workspace. 13 | 14 | if ~isempty(x) 15 | for i = 1:2:size(x,2) 16 | assignin('caller', x{i}, x{i+1}); 17 | end; 18 | end; 19 | 20 | %############################################ 21 | 22 | -------------------------------------------------------------------------------- /utilities/re_sort_uidents.m: -------------------------------------------------------------------------------- 1 | function uidents = re_sort_uidents(uidents, identifiers) 2 | 3 | 4 | % %for testing_______________ 5 | % clear all 6 | % close all 7 | % clc 8 | % %this fbmm file was generated from the data in CPH_003_datalist 9 | % load repackData_testfile 10 | % % load lightcurvefbmm.mat 11 | % identifiers=fbmm.szGenotype; 12 | % uidents = unique(identifiers) 13 | % %end testing_______________ 14 | 15 | 16 | lu=length(uidents); 17 | 18 | firstThere=zeros(1,lu); 19 | for idx=1:lu 20 | there=strcmp(uidents{idx}, identifiers); 21 | theres=find(there==1); 22 | firstThere(idx)=theres(1); 23 | end 24 | 25 | [~, indices] = sort(firstThere); 26 | 27 | uidents=uidents(indices); -------------------------------------------------------------------------------- /utilities/repackData.m: -------------------------------------------------------------------------------- 1 | function [cellofMats, uIdents] = repackData (identifiers, data) 2 | 3 | %cellofMats = repackData (identifiers, dataCel) 4 | %e.g. repackData (fbmm.szGenotype, fbmm.hist) 5 | %takes a datastructure like fbmm, and repackages a data cell from one field 6 | %into a nan-padded matrix held inside a cell, one for each identifier type. 7 | % Reworked 20120522 Adam Claridge-Chang to accommodate numeric identifiers 8 | 9 | 10 | % %for testing_______________ 11 | % clear all 12 | % close all 13 | % clc 14 | % %this fbmm file was generated from the data in CPH_003_datalist 15 | % load repackData_testfile 16 | % identifiers=fbmm.szGenotype; 17 | % %used cX to test this, but is intended for fbmm.hist 18 | % data=fbmm.cX; 19 | % %this option to test vector-type data 20 | % % data=fbmm.mdist; 21 | % 22 | % % This option to test numeric identifiers 23 | % a=rand(length(identifiers),1); 24 | % b=a*4; 25 | % identifiers=ceil(b); 26 | % %end testing_______________ 27 | 28 | % Extract data into a cell for each genotype, 29 | uIdents = unique(identifiers); 30 | 31 | % making sure to sort unique indentifier list (AdamCC 20111024) recoded for 32 | % sorting based on file order 20120521 Adam Claridge-Chang 33 | if iscell(uIdents) 34 | uIdents = re_sort_uidents(uIdents, identifiers); 35 | else 36 | uIdents =sort(uIdents); 37 | end 38 | lu=length(uIdents); 39 | cellofMats=cell(1,lu); 40 | 41 | if iscell(data)== 4 42 | for idx=1:lu 43 | if iscell(uIdents) 44 | curEG=strcmp(uIdents{idx}, identifiers); %find the current szGenotype 45 | else 46 | curEG=find(identifiers==uIdents(idx)); 47 | end 48 | 49 | % curEG= curEG==1; 50 | clear curCels 51 | curCels=(data(curEG));%extract the location data 52 | for cidx=1:length(curCels) 53 | clear curVec 54 | curVec(:, 1)=curCels{cidx}; 55 | if cidx==1 56 | curMat=curVec; 57 | elseif cidx>=2 58 | curMat=nanpadcat(curMat, curVec, 'h'); 59 | end 60 | end 61 | cellofMats{idx}=curMat; 62 | end 63 | 64 | elseif isvector(data)==1 65 | for idx=1:lu 66 | if iscell(uIdents) 67 | curEG=strcmp(uIdents{idx}, identifiers); %find the current szGenotype 68 | else 69 | curEG=find(identifiers==uIdents(idx)); 70 | end 71 | % curEG= curEG==1; 72 | clear curCels 73 | curCels=(data(curEG));%extract the location data 74 | for cidx=1:length(curCels) 75 | clear curVec 76 | curVec(:, 1)=curCels(cidx); 77 | if cidx==1 78 | curMat=curVec; 79 | elseif cidx>=2 80 | curMat=nanpadcat(curMat, curVec, 'v'); 81 | end 82 | end 83 | cellofMats{idx}=curMat; 84 | end 85 | 86 | 87 | else 88 | fprintf('\nerror in repackData function: Input data is neither cells nor vector -ACC \n') 89 | 90 | end 91 | 92 | 93 | -------------------------------------------------------------------------------- /utilities/setThirdAxis.m: -------------------------------------------------------------------------------- 1 | function [num, num3, ax1Pos, x, y, x2, y2, yNew, y2New] = setThirdAxis(refAxes, av, md) 2 | 3 | 4 | ax1Pos = get(refAxes,'position'); 5 | set(gcf, 'currentAxes', refAxes); 6 | 7 | % Get the normalized x-y coordinates of the means 8 | [x,y] = dsxy2figxy(gca, 1, av(1)); 9 | [x2, y2] = dsxy2figxy(gca, 2, av(2)); 10 | 11 | refLims = get(refAxes, 'YLim'); 12 | normDiff = md/(refLims(2) - refLims(1)); 13 | 14 | num = 1; 15 | num3 =2; 16 | yNew = y; 17 | y2New = y2; 18 | yDiff = yNew - y2New; 19 | 20 | severity = calcSeverity(normDiff); 21 | 22 | 23 | if md <0 24 | 25 | while num <= severity 26 | num3 = num3 + 1; 27 | yNew = yNew + yDiff; 28 | num= num+1; 29 | end 30 | 31 | elseif md > 0 32 | 33 | while num <= severity 34 | yNew = yNew + yDiff; 35 | num3 = num3 + 1; 36 | num = num + 1; 37 | end 38 | 39 | else 40 | return 41 | end 42 | 43 | end -------------------------------------------------------------------------------- /utilities/tripleErrorBars.m: -------------------------------------------------------------------------------- 1 | function [e1] = tripleErrorBars(av, er, col, barwidth, linewidth, middle_bar) 2 | 3 | % Takes a mean, its error(s) and plot error bars with a particular style 4 | 5 | % % % for testing___________________ 6 | % clear all 7 | % close all 8 | % clc 9 | % load 'scatdistTestData.mat' 10 | % col=4; 11 | % vec=vecs{col}; 12 | % av=mean(vec); 13 | % stdvec=std(vec); 14 | % er=stdvec/sqrt(((length(vec))-1)) 15 | % % er=[ 1 2; 12 7] 16 | % linewidth=1; 17 | % barwidth=10; 18 | % middle_bar='on'; 19 | % % %_________________________________ 20 | 21 | %% Accommodate asymmetric error bars 22 | if numel(er)==1 23 | er(1)=er; 24 | er(2)=er; 25 | end 26 | 27 | %% Draw the error bars 28 | hold on; 29 | e1=errorbar(col, av, er(1,:), er(2,:), 'Color',[0 0 0],'LineWidth', linewidth, 'MarkerSize', 10, 'LineStyle','none'); 30 | 31 | % errorbar_tick(e1, barwidth, 'units') 32 | 33 | %errorbar_tick(e1, barwidth, 'units') 34 | 35 | 36 | %% Insert a marker for the mean 37 | hold on 38 | switch middle_bar 39 | case 'on' 40 | zeroh=zeros(1 , length(av)); 41 | e2=scatter(col, av,1,'MarkerEdgeColor','k', 'MarkerFaceColor', 'w'); 42 | % e2=errorbar(col, av, zeroh, zeroh, 'Color',[0 0 0],'LineWidth', linewidth, 'LineStyle','none'); 43 | % errorbar_tick(e2, barwidth, 'units') 44 | otherwise 45 | end 46 | 47 | 48 | 49 | 50 | --------------------------------------------------------------------------------