function change_point_data_plotter(cpdata,mpt,array_of_charges_cell_array,critz_cell_array,rawmat_cell_array,trialcountsmat) %plots times of change in reliability and change in potency and related confidences by a variety of methods %expects matrix with casenumber in the first row then cp occur conf then cp then cp temp conf interval lower lim then cp temp conf interval upper lim in the next four rows for rel and repeated below for pot, %with all 15 cases, one per col %called from command line, calls rectangles with error bars confidence_thresh=90; makebars=0; makeconfidencebars=0; plot_each_value=1; cumulative_confidence=1; linewidth=5; makescatterplot=0; markersize=15; plot_marginals=1; makebargraphsrel=1; makebargraphspot=0; makecumuhistspot=1; makebargraphscrit_o=0; makebargraphs_basedonothercp=0; othercp_postinduconly=0; successes=[1 3 5 7 8 9 10 11 12 15]; failures=[2 4 6 13 14]; succs_and_fails=[1 2 5 7 8 9 10 12 14 15 25 26 27 28 30]; %numbered here according to the original numbers from analyze_across_sd_stdp_expts clr=colors_for_stdp_expts(length(cpdata)); labbl={'rel' 'pot'}; close all if makebars for expt=1:15 figure(expt+100),hold on,xlim([0 3]) plot([1 1],[cpdata(4,expt)*mpt(expt) cpdata(5,expt)*mpt(expt)],'color',clr(expt,:),'linewidth',linewidth) plot([2 2],[cpdata(8,expt)*mpt(expt) cpdata(9,expt)*mpt(expt)],'color',clr(expt,:),'linewidth',linewidth) plot([1 2],[cpdata(4,expt)*mpt(expt) cpdata(8,expt)*mpt(expt)],'color',clr(expt,:),'linewidth',.1) plot([1 2],[cpdata(5,expt)*mpt(expt) cpdata(9,expt)*mpt(expt)],'color',clr(expt,:),'linewidth',.1) plot([1 2],[cpdata(3,expt)*mpt(expt) cpdata(7,expt)*mpt(expt)],'color',clr(expt,:),'linewidth',1) plot([0 3],[0 0],'k:') text(1,cpdata(4,expt)*mpt(expt),num2str(cpdata(2,expt))) text(2,cpdata(8,expt)*mpt(expt),num2str(cpdata(6,expt))) set(gca,'xtick',[1 2]) set(gca,'xticklabel',labbl) ylabel('Time (min)') title(strcat('The',num2str(expt),'th case')) end end if makeconfidencebars %mean_confs=[mean(cpdata(2,successes)) mean(cpdata(2,failures));mean(cpdata(6,successes)) mean(cpdata(6,failures))]; %semz=[std(cpdata(2,successes))/sqrt(length(successes)) std(cpdata(2,failures))/sqrt(length(failures));std(cpdata(6,successes))/sqrt(length(successes)) std(cpdata(6,failures))/sqrt(length(failures))]; %upper_error_bars=mean_confs+semz; %lower_error_bars=mean_confs-semz; %if plot_each_value, each_value_cell={cpdata(2,successes) cpdata(2,failures);cpdata(6,successes) cpdata(6,failures)};else each_value_cell={};end succ_reloccur=cpdata(2,successes);succ_reloccur_above_thresh=succ_reloccur(find(succ_reloccur>=confidence_thresh));succ_reloccur_below_thresh=succ_reloccur(find(succ_reloccur=confidence_thresh));succ_potoccur_below_thresh=succ_potoccur(find(succ_potoccur=confidence_thresh));succ_reltime_belowthresh=succ_reltime(find(succ_reloccur=confidence_thresh));succ_pottime_belowthresh=succ_pottime(find(succ_potoccurconfidence_thresh && cpdata(6,expt)>confidence_thresh figure(10),subplot('position',[.25 .25 .5 .5]),hold on plot(cpdata(3,expt)*mpt(expt),cpdata(7,expt)*mpt(expt),'o','markerfacecolor',clr(expt,:),'markeredgecolor',clr(expt,:),'markersize',markersize) xlabel('Reliability change time min'),ylabel('Potency change time min'),axis([-1 25 -1 25]),set(gca,'xtick',[0 5 10 15 20 25]),set(gca,'ytick',[0 5 10 15 20 25]) end if plot_marginals && cpdata(2,expt)>confidence_thresh figure(10),subplot('position',[.25 .05 .5 .1]),hold on plot(cpdata(3,expt)*mpt(expt),1+rand*.05,'o','markerfacecolor',clr(expt,:),'markeredgecolor',clr(expt,:),'markersize',markersize) xlim([-1 25]),set(gca,'xtick',[0 5 10 15 20 25]),set(gca,'ytick',[]),ylim([.95 1.1]) end if plot_marginals && cpdata(6,expt)>confidence_thresh figure(10),subplot('position',[.05 .25 .1 .5]),hold on plot(1+rand*.05,cpdata(7,expt)*mpt(expt),'o','markerfacecolor',clr(expt,:),'markeredgecolor',clr(expt,:),'markersize',markersize) ylim([-1 25]),set(gca,'ytick',[0 5 10 15 20 25]),set(gca,'xtick',[]),xlim([.95 1.1]) end figure(20) if cpdata(2,expt)>confidence_thresh subplot(5,5,1:5),hold on,plot(cpdata(3,expt)*mpt(expt),1+rand*.05,'o','markerfacecolor',clr(expt,:),'markeredgecolor',clr(expt,:),'markersize',markersize) set(gca,'ytick',[],'xlim',[-1 25]) end if cpdata(6,expt)>confidence_thresh subplot(5,5,21:25),hold on,plot(cpdata(7,expt)*mpt(expt),1+rand*.05,'o','markerfacecolor',clr(expt,:),'markeredgecolor',clr(expt,:),'markersize',markersize) set(gca,'ytick',[],'xlim',[-1 25]) end end end for expt=1:size(cpdata,2) lastpreinductrial=trialcountsmat(1,expt); cp_rel=cpdata(3,expt)+lastpreinductrial; %translating the cp to the overall number of trials cp_pot=cpdata(7,expt)+lastpreinductrial; %translating the cp to the overall number of trials crit=critz_cell_array{succs_and_fails(expt)};num_APs=size(crit,1); %the cell arrays are numbered by 'presentcase' in analyze_across... (i.e., up to 30), so a reorientation is needed sumcrit=sum(crit); reliability=sumcrit/num_APs; array_of_charges=array_of_charges_cell_array{succs_and_fails(expt)}; array_of_charges(find(~crit))=0; potency_numerator=sum(array_of_charges); warning off matlab:dividebyzero,potency=potency_numerator./sumcrit;warning on matlab:dividebyzero potency(isnan(potency))=0; if lastpreinductrial+trialcountsmat(2,expt) ~= size(crit,2), error('Problem with trial counts'),end if makebargraphsrel && cpdata(2,expt)>confidence_thresh figure(expt+100), hold on beforeinduc_rel=reliability(1:lastpreinductrial); if lastpreinductrialconfidence_thresh figure(200+expt),hold on %----redefining potency temporarily so as not to have to rewrite the following to get plots -- oct 7 2007 % potency=array_of_charges_cell_array{succs_and_fails(expt)}(1,:); % potency(find(~crit(1,:)))=nan; %potency=sum(array_of_charges_cell_array{succs_and_fails(expt)}); %potency=max(array_of_charges_cell_array{succs_and_fails(expt)}); %----- beforeinduc_pot=potency(1:lastpreinductrial); if lastpreinductrialconfidence_thresh figure(expt+400),hold on crit_o=crit(1,:); beforeinduc_crit_o=crit_o(1:lastpreinductrial); if lastpreinductrialconfidence_thresh && cpdata(6,expt)>confidence_thresh if cp_relconfidence_thresh % % end end