function PlotType2(PDC,COH,S,signif,freq,E,channels,col,tit)

% Colour plot of PDC minus the significance level. If the user doesnt want
% the significance to be subtracted then it is set to zero (outside the 
% function). The x-axis is epochs, the y-axis is frequencies and the colors
% correspond to PDC levels.

bands = [];
an = 0;
for r = 1:channels-1                                                        % For each UNIQUE combination...
    for c = r+1:channels                                                    % of data arrays
           Stemp1 = zeros(length(freq),E);                                  % Allocate memory for their...
           Stemp2 = zeros(length(freq),E);                                  % power spectra...
        PDCtemp12 = zeros(length(freq),E);                                  % and their PDC coefficients...
        PDCtemp21 = zeros(length(freq),E);                                  % in both directions...
          COHtemp = zeros(length(freq),E);                                  % and their coherence.

        for i=1:E                                                           % For each epoch...
            Stemp1(:,i) = log10(abs(S{i}(r,r,:)));                          % calculate the two...
            Stemp2(:,i) = log10(abs(S{i}(c,c,:)));                          % power spectra (logarithm)...
            PDCtemp12(:,i) = PDC{i}(r,c,:)-signif{i}(r,c,:);                % and the PDC-significance...
            PDCtemp21(:,i) = PDC{i}(c,r,:)-signif{i}(c,r,:);                % in both directions...
            COHtemp(:,i) = abs(COH{i}(r,c,:));                              % and the coherence
        end

        [bands, an] = freqbandaver(PDCtemp12, PDCtemp21, freq, E, r, c, bands, an); % Calculate freq. averages over given freq. domains

        figure
        colormap(col)
        
        % Plot the spectrum of the 1st array...........
        subplot(4,2,1)
        imagesc(Stemp1);
        colorbar
        set(gca,'YDir','normal','XTick',1:E,'Ytick',[1 length(freq)],'YTickLabel',{num2str(freq(1)), num2str(freq(end))})
        title([tit,'Power Spectral Density: Electrode ', num2str(r)])

        % Plot the spectrum of the 2nd array...........
        subplot(4,2,2)
        imagesc(Stemp2);
        colorbar
        set(gca,'YDir','normal','XTick',1:E,'Ytick',[1 length(freq)],'YTickLabel',{num2str(freq(1)), num2str(freq(end))})
        title([tit, 'Power Spectral Density: Electrode ', num2str(c)])

        %.....................................................
        
        % Plot the PDC of the 1st array to the 2nd.....
        subplot(4,2,3)
        imagesc(PDCtemp21, [0 1]);
        set(gca,'YDir','normal','XTick',1:E,'Ytick',[1 length(freq)],'YTickLabel',{num2str(freq(1)), num2str(freq(end))})
        title([tit, 'PDC: Electrode ', num2str(r), '  >  Electrode ', num2str(c)])

        % Plot the PDC of the 2nd array to the 1st.....
        subplot(4,2,4)
        imagesc(PDCtemp12, [0 1]);
        set(gca,'YDir','normal','XTick',1:E,'Ytick',[1 length(freq)],'YTickLabel',{num2str(freq(1)), num2str(freq(end))})
        title([tit, 'PDC: Electrode ', num2str(c), '  >  Electrode ', num2str(r)])

        %...................................................

        % Plot the frequency averaged PDC (1 -> 2)
        mPDC21 = mean(PDCtemp21);
        disp(['The frequency averaged PDC (', num2str(r), ' > ', num2str(c), ') over all periods, is:']);
        disp(num2str(mPDC21));
        disp(' ');
        subplot(4,2,5)
        plot(mPDC21,'* - k'),axis([1 E 0 1]),set(gca,'XTick',1:E,'Ytick',[0 0.5 1])
        title([tit, 'Averaged PDC: Electrode ', num2str(r), '  >  Electrode ', num2str(c)])

        % Plot the frequency averaged PDC (2 -> 1)
        mPDC12 = mean(PDCtemp12);
        disp(['The frequency averaged PDC (', num2str(c), ' > ', num2str(r), ') over all periods, is:']);
        disp(num2str(mPDC12));
        disp(' ');
        subplot(4,2,6)
        plot(mPDC12,'* - k'),axis([1 E 0 1]),set(gca,'XTick',1:E,'Ytick',[0 0.5 1])
        title([tit, 'Averaged PDC: Electrode ', num2str(c), '  >  Electrode ', num2str(r)])

        %....................................................

        % Plot the ordinary coherence
        subplot('Position', [0.35 0.11 0.459 0.146])
        imagesc(COHtemp, [0 1]);
        colorbar
        set(gca,'YDir','normal','XTick',1:E,'Ytick',[1 length(freq)],'YTickLabel',{num2str(freq(1)), num2str(freq(end))})
        xlabel('Epochs');
        ylabel('Frequency (Hz)');
        title([tit, 'Ordinary Coherence'])
    end
end