function histogram_breakdown_dwn(plain_extractedmatrix,conjoined_filename,hy,epoch_dividers,parameter_colors,stsd_parameters,number_of_IPIs,fit_array)
%i'm just designing this for the hy=[2 1;50 50;100 1], e.g., type of stimulus (stim_philosophy==1)
%this bare-bones form (april 3, 2006) should be fairly useful, but the capacity for different epochs needs to be added

figure(60),colormap(gray)
trials_this_epoch=[1:size(plain_extractedmatrix,2)]
rowz=2;colz=4;

h1=subplot(rowz,colz,1)
smoot=plain_extractedmatrix(number_of_IPIs+1,trials_this_epoch,1)';
fiit=-1*fit_array(7,trials_this_epoch)';
hist([smoot fiit])
ylabel('Count','fontsize',30,'fontweight','bold','fontname','book antiqua')
xlabel('PSC_o','fontsize',30,'fontweight','bold','fontname','book antiqua')
%set(h1,'xTickLabel',get(h1,'xticklabel'),'fontsize',12,'fontname','book antiqua','fontweight','bold')
% set(gca,'yTickLabel',get(gca,'yticklabel'),'fontsize',22,'fontname','book antiqua','fontweight','bold')

h2=subplot(rowz,colz,2)
smoot=plain_extractedmatrix(number_of_IPIs+2,trials_this_epoch,1)';
fiit=-1*fit_array(16,trials_this_epoch)';
hist([smoot fiit])
xlabel('PSC_a','fontsize',30,'fontweight','bold','fontname','book antiqua')
title(conjoined_filename,'fontsize',30,'fontweight','bold','fontname','book antiqua')

h3=subplot(rowz,colz,3)
smoot=plain_extractedmatrix(number_of_IPIs+3,trials_this_epoch,1)';
fiit=-1*fit_array(25,trials_this_epoch)';
hist([smoot fiit])
xlabel('PSC_b','fontsize',30,'fontweight','bold','fontname','book antiqua')

h4=subplot(rowz,colz,4)
smoot=plain_extractedmatrix(number_of_IPIs+1:end,trials_this_epoch,1);
fiit=-1*fit_array([7 16 25],trials_this_epoch);
hist([smoot(:) fiit(:)])
xlabel('All PSCs','fontsize',30,'fontweight','bold','fontname','book antiqua')

h5=subplot(rowz,colz,5)
smoot=plain_extractedmatrix(number_of_IPIs+1,trials_this_epoch,2)';
fiit=-1*fit_array(8,trials_this_epoch)';
hist([smoot fiit])
ylabel('Count','fontsize',30,'fontweight','bold','fontname','book antiqua')
xlabel('Q_o','fontsize',30,'fontweight','bold','fontname','book antiqua')

h6=subplot(rowz,colz,6)
smoot=plain_extractedmatrix(number_of_IPIs+2,trials_this_epoch,2)';
fiit=-1*fit_array(17,trials_this_epoch)';
hist([smoot fiit])
xlabel('Q_a','fontsize',30,'fontweight','bold','fontname','book antiqua')

h7=subplot(rowz,colz,7)
smoot=plain_extractedmatrix(number_of_IPIs+3,trials_this_epoch,2)';
fiit=-1*fit_array(26,trials_this_epoch)';
hist([smoot fiit])
xlabel('Q_b','fontsize',30,'fontweight','bold','fontname','book antiqua')

h8=subplot(rowz,colz,8)
smoot=plain_extractedmatrix(number_of_IPIs+1:end,trials_this_epoch,1);
fiit=-1*fit_array([8 17 26],trials_this_epoch);
hist([smoot(:) fiit(:)])
xlabel('All Q','fontsize',30,'fontweight','bold','fontname','book antiqua')
% figure %need to take care of epochs, etc.   %this is all part of the attempt to make histograms more informative:  use stacked bars where the color of the segment tells the interval and a) the order in the stacking matches the order of experiments or b) (probably better) the order of the stacking is by the possible IPIs, eg. 25 ms first, then 50 ms, 100ms, etc.
% vals_of_IPIs=[7 1]  
% for ii=1:number_of_IPIs
%     for jj=vals_of_IPIs(ii)
%     livetrials=find(plain_extractedmatrix(
%         holder=find(plain_extractedmatrix(number_of_IPIs+ii+1))
% end

% D_based_defintion_of_failure=1; %to be meaningful, requires that Q_between_thresholds was active during call to create_storage_matrices
% simple_threshold_based_definition_of_failure=bitcmp(SD_based_defintion_of_failure,1);
% f_s=15;     %font_size
% f_w='bold'; %font_weight
% text_interval=1;    %if 1, will put the interval on the data points when plotting, otherwise will put epoch
% psc_yesno_thresh=0;
% 
% %identifying failures
% if ~isempty(epoch_dividers),trials_this_epoch=[1:epoch_dividers(1)-.5];else trials_this_epoch=1:size(plain_extractedmatrix,2);end
% for epoch=1:length(epoch_dividers)+1
%     parameter=epoch;    %used a) to fill the parameter expectation of innerportion.m, below, and b) to assign the symbols different colors for each epoch
%     if SD_based_defintion_of_failure
%         trials_this_epoch_where_first_pulse_succeeded=trials_this_epoch(find(~isnan(plain_extractedmatrix(number_of_IPIs+1,trials_this_epoch,2))));    %# of SDs from baseline was set in create_storage_matrices
%         trials_this_epoch_where_second_pulse_succeeded=trials_this_epoch(find(~isnan(plain_extractedmatrix(number_of_IPIs+2,trials_this_epoch,2))));
%         trials_this_epoch_where_third_pulse_succeeded=trials_this_epoch(find(~isnan(plain_extractedmatrix(number_of_IPIs+3,trials_this_epoch,2))));
% 	elseif simple_threshold_based_definition_of_failure
%         trials_this_epoch_where_first_pulse_succeeded=trials_this_epoch(find(plain_extractedmatrix(number_of_IPIs+1,trials_this_epoch,1)>psc_yesno_thresh));  %if selecting by threshold, need to determine the threshold
%         trials_this_epoch_where_second_pulse_succeeded=trials_this_epoch(find(plain_extractedmatrix(number_of_IPIs+2,trials_this_epoch,1)>psc_yesno_thresh)); 
%         trials_this_epoch_where_third_pulse_succeeded=trials_this_epoch(find(plain_extractedmatrix(number_of_IPIs+3,trials_this_epoch,1)>psc_yesno_thresh));
%     end
%     trials_this_epoch_where_first_pulse_failed=trials_this_epoch;trials_this_epoch_where_first_pulse_failed(trials_this_epoch_where_first_pulse_succeeded-(trials_this_epoch(1)-1))=[];
%     trials_this_epoch_where_second_pulse_failed=trials_this_epoch;trials_this_epoch_where_second_pulse_failed(trials_this_epoch_where_second_pulse_succeeded-(trials_this_epoch(1)-1))=[];
%     trials_this_epoch_where_third_pulse_failed=trials_this_epoch;trials_this_epoch_where_third_pulse_failed(trials_this_epoch_where_third_pulse_succeeded-(trials_this_epoch(1)-1))=[];
% 
%     for parameter=1:length(stsd_parameters)
%         figure(60+parameter)
%         
%         holder=live_ranges(1,:);
% 		n=num_params;
% 		
%         
%         
%         for ipi=1:perms       %it's worth noting that this little set of loops does everything that is done with recursive calls in stsd_grid_plotter_raw2 and its callees
%             for j=1:num_params, eval([values{live_values(j)} '=' num2str(holder(j)) ';']), end
%             eval(tfs), new_fit_distance=fit_comparison_lsq(real_data(1:length(template)), template);
%             if new_fit_distance<fit_distance,
%                 fit_distance=new_fit_distance;
%                 for k=1:num_params; optimal_value_holder(k)=eval(values{live_values(k)}); end
%             end
%             if (holder(1)==live_ranges(2,1)) & (holder(end)==live_ranges(2,end)), break,break
%             elseif holder(end)<live_ranges(2,end), holder(end)=holder(end)+1;
%             else
%                 for m=1:num_params
%                     n=n-1;
%                     if holder(n)<live_ranges(2,n)
%                         holder(n)=holder(n)+1; holder(n+1:end)=live_ranges(1,n+1:end); n=num_params; break,break,break
%                     end
%                 end
%             end
% 		end