function PlotPDC(PDC,COH,S,signif,ep_times,freq,E,vars,flag)

% Plots PDC-results in 3 different ways 

disp('Choose type of PDC-plot required');                                   % User defines the desired type of plot.
disp('Matrix layout plot set -> 1');
disp('PDC-Epoch series colour plot -> 2');
disp('PDC-Epoch series grayscale plot -> 3');
plot_type = input('');

if plot_type == 2 || plot_type == 3                                         % Choose whether to include the PDC-significance level
    reply = input('Do you want to plot the "significant" part of PDC only? Y/N: ', 's');
    if reply == 'n' || reply == 'N'
        for i = 1:length(signif)
            signif{i} = zeros(size(signif{i}));
        end
    end
end

if plot_type == 1                                                           % If it is 2D plots...
    if flag == 1                                                            % and the data are pooled
        tit = ' ';
    elseif flag == 2
        tit = 'Pooled ';
    end
    PlotType1(PDC,COH,S,signif,ep_times,freq,E,vars,tit);                   % Curve-plots of PDC and COH
    
elseif plot_type == 2 || plot_type == 3                                     % If it is 2D color plots...    
    col = 'jet';
    if plot_type == 3                                                       % If it is 2D grayscale color plots...    
        %col = 'gray';
        graylevels = 10;                                                    % Change this number to change the # of gray levels
        col = zeros(graylevels+2,3);
        col(1,:) = 1;
        for i=1:graylevels
            col(i+1,:) = 1-i/graylevels;                                    % Create the grey levels.
        end
    end
    
    if flag == 1
        tit = ' ';
    elseif flag == 2
        tit = 'Pooled ';
    end
    PlotType2(PDC,COH,S,signif,freq,E,vars,col,tit);
else 
    error('You have to choose one of the three options')
end