function show_interactions_new(hObject, eventdata)
global var h



xpos=var.xpos;
ypos=var.ypos;
Hstep=var.Hstep;
nBR = var.nBR;
nBL = var.nBL;
nTL = var.nTL;
Vpoints = var.Vpoints;
Hpoints = var.Hpoints;


 
subplot(1,14,1:12)
h.plot = pcolor(var.newimage);
set(h.plot,'edgecolor','none')
colormap gray

hold on
plot([nBL(1) nTL(1) nBR(1)], [nBL(2) nTL(2) nBR(2)],'oy')

hold on
colors = 'krg';


var.confirmed = {'Interactions'};

var.nc=0;
var.conf_pos={''};
var.conf_type=zeros(1,0);
for i2=1:length(var.inte)
    i = var.inte(i2,1);
    j = var.inte(i2,2);
    
    % in the new threshold and the standard one (type 1)
    if (var.intensity(i,j)>=var.New_InteConvThres1 && var.PointSum(i,j)>=var.New_IntePSThres2) && ...
            (var.intensity(i,j)>=var.InteConvThres1 && var.PointSum(i,j)>=var.IntePSThres2)
        
        var.confirmed{end+1} = [var.abb{i,j}];
        if var.species ~= 3
            var.conf_pos{end+1} = var.pos{i,j};
        end
        var.nc=var.nc+1;
        var.confposx(var.nc) = var.xpos(i,j);
        var.confposy(var.nc) = var.ypos(i,j);
        var.combined(i,j) = 1;
        var.conf_type(var.nc) = 1;
    end
    
    % in the new threshold but not the standard one (type 2)
    if (var.intensity(i,j)>=var.New_InteConvThres1 && var.PointSum(i,j)>=var.New_IntePSThres2) && ...
            ~(var.intensity(i,j)>=var.InteConvThres1 && var.PointSum(i,j)>=var.IntePSThres2)
        
        var.confirmed{end+1} = ['+' var.abb{i,j} '+'];
        if var.species ~= 3
            var.conf_pos{end+1} = var.pos{i,j};
        end
        var.nc=var.nc+1;
        var.confposx(var.nc) = var.xpos(i,j);
        var.confposy(var.nc) = var.ypos(i,j);
        var.combined(i,j) = 1;
        var.conf_type(var.nc) = 2;
    end
    
    % in the standard threshold but not in the new one (type 3)
    if (var.intensity(i,j)>=var.InteConvThres1 && var.PointSum(i,j)>=var.IntePSThres2) && ...
            ~(var.intensity(i,j)>=var.New_InteConvThres1 && var.PointSum(i,j)>=var.New_IntePSThres2)
        
        var.confirmed{end+1} = ['-' var.abb{i,j} '-'];
        if var.species ~= 3
            var.conf_pos{end+1} = var.pos{i,j};
        end
        var.nc=var.nc+1;
        var.confposx(var.nc) = var.xpos(i,j);
        var.confposy(var.nc) = var.ypos(i,j);
        var.combined(i,j) = 1;
        var.conf_type(var.nc) = 3;
    end
end


% for the corrected case
if var.correction==2
    
    var.confirmed{end+1} = '------';
    var.conf_pos{end+1} = '------';
    var.nc=var.nc+1;
    var.conf_type(var.nc) = 0;
    
    for i2=1:length(var.ext)
        i = var.ext(i2,1);
        j = var.ext(i2,2);
        
        % in the new threshold and the standard one (type 1)
        if (var.intensity(i,j) >= var.New_ExtConvThres1 && var.PointSum(i,j)>=var.New_ExtPSThres2) ...
                && (var.intensity(i,j) >= var.ExtConvThres1 && var.PointSum(i,j)>= var.ExtPSThres2)
            
            var.confirmed{end+1} = [var.abb{i,j}];
            if var.species ~= 3
                var.conf_pos{end+1} = var.pos{i,j};
            end
            var.nc=var.nc+1;
            var.confposx(var.nc) = var.xpos(i,j);
            var.confposy(var.nc) = var.ypos(i,j);
            var.combined(i,j) = 1;
            var.conf_type(var.nc) = 1;
            
        end
        
        % in the new threshold but not the standard one (type 2)
        if (var.intensity(i,j)>=var.New_ExtConvThres1 && var.PointSum(i,j)>=var.New_ExtPSThres2) ...
                && ~(var.intensity(i,j) >= var.ExtConvThres1 && var.PointSum(i,j)>=var.ExtPSThres2)
            var.confirmed{end+1} = ['+ ' var.abb{i,j} ' +'];
            if var.species ~= 3
                var.conf_pos{end+1} = var.pos{i,j};
            end
            var.nc=var.nc+1;
            var.confposx(var.nc) = var.xpos(i,j);
            var.confposy(var.nc) = var.ypos(i,j);
            var.combined(i,j) = 1;
            var.conf_type(var.nc) = 2;
        end
        
        % in the new threshold but not the standard one (type 3)
        if  (var.intensity(i,j) >= var.ExtConvThres1 && var.PointSum(i,j)>=var.ExtPSThres2) ...
                && ~(var.intensity(i,j)>=var.New_ExtConvThres1 && var.PointSum(i,j)>=var.New_ExtPSThres2)
            var.confirmed{end+1} = ['- ' var.abb{i,j} ' -'];
            if var.species ~= 3
                var.conf_pos{end+1} = var.pos{i,j};
            end
            var.nc=var.nc+1;
            var.confposx(var.nc) = var.xpos(i,j);
            var.confposy(var.nc) = var.ypos(i,j);
            var.combined(i,j) = 1;
            var.conf_type(var.nc) = 3;
        end
    end
end

colors = 'gmc';
for i=1:3
    plot(var.confposx(var.conf_type==i),var.confposy(var.conf_type==i),[colors(i) 'o'],'markersize',Hstep*.90);
    for c=1:var.nc
        if var.conf_type(c)==i
            text(var.confposx(c),var.confposy(c),[var.confirmed{c+1}],...
                'HorizontalAlignment','center','color',colors(i),'FontSize',Hstep*.26)
        end
    end
end
hold off


maxPS = max(max(var.PointSum));
minPS = min([min(min(var.PointSum)) var.New_IntePSThres2  var.New_ExtPSThres2]);
maxPS = maxPS + .05*(maxPS-minPS);
maxint = max(max(var.intensity));
minint = min([min(min(var.intensity)) var.New_InteConvThres1  var.New_ExtConvThres1 ]);
maxint = maxint + .05*(maxint-minint);


subplot(2,16,15:16)

intinte = zeros(length(var.inte),2);
PSinte = zeros(length(var.inte),2);
for i=1:length(var.inte)
    intinte(i) = var.intensity(var.inte(i,1),var.inte(i,2));
    PSinte(i) = var.PointSum(var.inte(i,1),var.inte(i,2));
end
plot(intinte,PSinte,'.')
hold on
plot([var.New_InteConvThres1 var.New_InteConvThres1 maxint maxint var.New_InteConvThres1], ...
    [maxPS var.New_IntePSThres2 var.New_IntePSThres2 maxPS maxPS], ...
    'r-', 'linewidth',2);

plot([var.InteConvThres1 var.InteConvThres1 maxint maxint var.InteConvThres1], ...
    [maxPS var.IntePSThres2 var.IntePSThres2 maxPS maxPS], ...
    'g-', 'linewidth',2);

hold off
xlim([minint maxint])
ylim([minPS maxPS])

New_fact_inte=num2str((var.New_InteConvThres1/var.InteConvThres1)*var.thres_frac,'%.2f');
New_th_inte=num2str(var.New_InteConvThres1,'%.2f');
title({['Thresholds: ' num2str(var.thres_frac) ' (' num2str(var.InteConvThres1,'%.2f') ...
    ');']; ['  new: ' New_fact_inte ' (' New_th_inte ')']});


if var.correction == 2
    subplot(2,16,31:32)
    intext = zeros(length(var.ext),2);
    PSext = zeros(length(var.ext),2);
    for i=1:length(var.ext)
        intext(i) = var.intensity(var.ext(i,1),var.ext(i,2));
        PSext(i) = var.PointSum(var.ext(i,1),var.ext(i,2));
    end
    plot(intext,PSext,'.')
    hold on
    
    %plotting the default thresholds
    
    plot([var.New_ExtConvThres1 var.New_ExtConvThres1 maxint maxint var.New_ExtConvThres1], ...
        [maxPS var.New_ExtPSThres2 var.New_ExtPSThres2 maxPS maxPS], ...
        'r-', 'linewidth',2);
    
    %plotting newly difined threshold in green
    
    plot([var.ExtConvThres1 var.ExtConvThres1 maxint maxint var.ExtConvThres1], ...
        [maxPS var.ExtPSThres2 var.ExtPSThres2 maxPS maxPS], ...
        'g-', 'linewidth',2);
    
    hold off
    xlim([minint maxint])
    ylim([minPS maxPS])
    
    New_fact_ext=num2str((var.New_ExtConvThres1/var.ExtConvThres1)*1.2,'%.2f');
    New_th_ext=num2str(var.New_ExtConvThres1,'%.2f');
    title({['Thresholds: ' num2str(var.thres_frac) ' (' num2str(var.ExtConvThres1,'%.2f') ...
        ');']; ['   new: ' New_fact_ext ' (' New_th_ext ')']});
end



set(h.buttons.show_interactions,'backgroundcolor','w','visible','off')

% Displaying names of interactions

for j=2:length(var.confirmed(:))
    string(j,1)= [var.confirmed(j)];
    S(j)=string(j,1);
    
    if var.species ~= 3
        string(j,2)= [var.conf_pos(j)];
         S(j) = strcat(string(j,1),' - ', string(j,2));

    end
end


S(1)=var.confirmed(1);
var.S=S;
[outstring,newpos] = textwrap(h.text.results,S);
disp(string)
set(h.text.results,'string',outstring,'visible','on','Position',[.915 0.9-newpos(4) .06 newpos(4)])

end







