function plot_extracted_grid(current_path,permutations_of_IPIs,azaz_record,epoch_dividers,number_of_trials,stsd_parameters,indiv_grid_plots,width_,APs_in_the_train,parameter_colors,...
            conjoined_filename,synapse_in_question,age_and_types,plain_extractedmatrix,number_of_IPIs,maxes_and_mins_naught,maxes_and_mins_nonnaught,show_rectangular,epochal_colormaps)
         
floor_of_plot=0;
for k=1:length(current_path)
    floor_of_plot=floor_of_plot+((permutations_of_IPIs(k)-current_path(k))/(prod(permutations_of_IPIs(1:k))));
end
if ~isempty(current_path),matches=matchmaker(azaz_record,current_path),else matches=[1:size(azaz_record,1)],end
if ~isempty(epoch_dividers),trials_that_were_during_this_epoch=[1:epoch_dividers(1)-.5];else trials_that_were_during_this_epoch=1:number_of_trials;end
for epoch=1:length(epoch_dividers)+1
    for parameter=1:length(stsd_parameters)
        figure(50+parameter)
        if isempty(current_path)            %handling the response after the *first* pulse (for which history all trials are a 'match')
            subplot('position',[.1 .25 width_-.1 .5])
            set(gcf,'PaperOrientation','landscape'),set(gcf,'PaperPosition',[0.5 0.5 10 7.5])
            %title(strcat(conjoined_filename,'__',synapse_in_question,'__',stsd_parameters{parameter},'__',age_and_types),'fontweight','bold'),hold on
            %set(gca,'ylim',[440 540])%[maxes_and_mins_naught(2,parameter) maxes_and_mins_naught(1,parameter)])
            ylabel(stsd_parameters{parameter},'fontsize',24)
            xlabel('Epoch','fontsize',24)
            if epoch==1
                for j=1:length(epoch_dividers)
                    plot([j+.5 j+.5],[maxes_and_mins_naught(2,parameter) maxes_and_mins_naught(1,parameter)],'color',[.7 .7 .7],'LineWidth',5), hold on
				end
            end
        else
            subplot('position',[length(current_path)*width_ floor_of_plot width_ 1/prod(permutations_of_IPIs(1:length(current_path)))])
            %set(gca,'ylim',[100 400])%[maxes_and_mins_nonnaught(2,parameter) maxes_and_mins_nonnaught(1,parameter)])
            %if length(current_path)==length(permutations_of_IPIs),end
            %    set(gca,'yticklabel',[]),
            set(gca,'xticklabel',[])
            if epoch==1
                for j=1:length(epoch_dividers)
                    plot([j+.5 j+.5],[maxes_and_mins_nonnaught(2,parameter) maxes_and_mins_nonnaught(1,parameter)],'color',[.7 .7 .7],'LineWidth',5), hold on
				end
            end
        end
        if epoch==1
%             for j=1:length(epoch_dividers)
%                 plot([j+.5 j+.5],[maxes_and_mins(2,parameter) maxes_and_mins(1,parameter)],'color',[.7 .7 .7],'LineWidth',5), hold on
% 			end
%             set(gca,'ylim',[0 10],'xlim',[0 3])
            set(gca,'xlim',[0 (length(epoch_dividers)+2)])%*length(stsd_parameters)+1])
%             set(gca,'color','none','ytick',[],'yticklabel',[],'ylim',[maxes_and_mins(2,parameter) maxes_and_mins(1,parameter)],'xtick',[],'xticklabel',...
% [],'xlim',[0 (length(epoch_dividers)+1)*length(stsd_parameters)+1])
        end
        matches_this_epoch=matches(find(matches>trials_that_were_during_this_epoch(1)-.5&matches<trials_that_were_during_this_epoch(end)+.5));
        if isempty(matches_this_epoch),break,end   %don't waste time going through all 6 parameters if no match
        hot_spots=plain_extractedmatrix(number_of_IPIs+1+length(current_path),matches_this_epoch,parameter);
        if find(isnan(hot_spots))
            hot_spots(isnan(hot_spots))=[];
        end
        points_of_light=hot_spots;
        plot(epoch,mean(points_of_light),'s','markerfacecolor',parameter_colors{parameter},'markeredgecolor',parameter_colors{parameter},...
            'markersize',30),hold on
        if strcmp(parameter_colors{parameter},'r'),databarcolor='k';else databarcolor='r';end
        plot([epoch epoch],[mean(points_of_light)-(std(points_of_light)/sqrt(length(points_of_light))) mean(points_of_light)+...
                (std(points_of_light)/sqrt(length(points_of_light)))],databarcolor,'LineWidth',3),hold on
        text(epoch,.85*(mean(points_of_light)),num2str(mean(points_of_light)),'fontsize',30,'fontweight','bold'), hold on
        %----------------------
        %the rectangular part
        if length(current_path)==length(permutations_of_IPIs) &show_rectangular     
            clrmp=eval(['colormap(' epochal_colormaps{epoch} '(' num2str(length(permutations_of_IPIs)+1) '))']);  %always be careful w/ eval -- watch for 'try/catch' behavior
            epoch_box_height=1/((length(epoch_dividers)+1)*prod(permutations_of_IPIs));
            subplot('position',[(length(current_path)+1)*width_ floor_of_plot+((epoch-1)*epoch_box_height) width_ epoch_box_height])
            set(gca,'xlim',[min(plain_extractedmatrix(number_of_IPIs+1,:,parameter)) max(sum(plain_extractedmatrix(number_of_IPIs+1:end,:,parameter)))])
            bottomm=0;heightt=epoch_box_height*(1/length(matches_this_epoch));
            for matching_trial=1:length(matches_this_epoch)
                leftt=0;
                for rectangle_number=1:length(permutations_of_IPIs)+1 %one rectangle corresponding to the response to each AP
                    widthh=plain_extractedmatrix(number_of_IPIs+rectangle_number,matches_this_epoch(matching_trial),parameter);%find match values
                    if ~isnan(widthh) &widthh
                        rectangle('position',[leftt bottomm widthh heightt],'facecolor',clrmp(rectangle_number,:))    
                        leftt=leftt+widthh;
                    end
                end
                bottomm=bottomm+heightt;
            end            
        end
        %----------------
    end
    if length(epoch_dividers)>epoch,trials_that_were_during_this_epoch=[epoch_dividers(epoch)+.5 :epoch_dividers(epoch+1)-.5];
    elseif length(epoch_dividers)==epoch,trials_that_were_during_this_epoch=[epoch_dividers(epoch)+.5:number_of_trials];
    end
end