function  plot_by_ring_3( gap, data1,data2, info)
figure('name',info,'numbertitle','off');
index = 8:0.2:11.8;
freq = [1, 5, 6, 13, 14];
for q = 1:length(freq)
    temp = squeeze(mean(data1,3));
    %tempSTD = std(temp);
    tempMAX = squeeze(max(data1,[],3));
    tempMIN = squeeze(min(data1,[],3));
    subplot(6,6,mfSSVEP_ring_plot(index(freq(q))));
    plot(1:gap:size(data1,2),temp(freq(q),1:gap:size(data1,2)),'r','LineWidth',1.5);
    hold on;
    plot(1:gap:size(data1,2),tempMAX(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    plot(1:gap:size(data1,2),tempMIN(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    
    temp2 = squeeze(mean(data2,3));
    tempSTD = std(temp2);
    tempMAX = squeeze(max(data2,[],3));
    tempMIN = squeeze(min(data2,[],3));
    plot(1:gap:size(data2,2),temp2(freq(q),1:gap:size(data2,2)),'k','LineWidth',2);
    plot(1:gap:size(data2,2),tempMAX(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    plot(1:gap:size(data2,2),tempMIN(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    %title([num2str(index(freq(q))) ' hz, ' 'r= ' num2str(corr2(temp(freq(q),1:gap:size(data1,2)),temp2(freq(q),1:gap:size(data2,2))))]);
    title([num2str(index(freq(q))) ' hz, ' 'd= ' num2str(sum(abs(temp(freq(q),1:gap:size(data1,2))-temp2(freq(q),1:gap:size(data2,2)))))]);
%     temp3 = squeeze(mean(data3,3));
%     tempSTD = std(temp3);
%     tempMAX = squeeze(max(data3,[],3));
%     tempMIN = squeeze(min(data3,[],3));
%     plot(1:gap:size(data3,2),temp3(freq(q),1:gap:size(data3,2)),'b','LineWidth',2);
%     plot(1:gap:size(data3,2),tempMAX(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     plot(1:gap:size(data3,2),tempMIN(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     %legend('Normal', 'Block9Hz');
%     hold off
%     title(index(freq(q)));
%     %ylim([0.2 0.5]);
end

freq = [4, 11, 12, 19,20];
for q = 1:length(freq)
    temp = squeeze(mean(data1,3));
    tempSTD = std(temp);
    tempMAX = squeeze(max(data1,[],3));
    tempMIN = squeeze(min(data1,[],3));
    subplot(6,6,mfSSVEP_ring_plot(index(freq(q))));%subplot(length(freq),1,q);
    plot(1:gap:size(data1,2),temp(freq(q),1:gap:size(data1,2)),'r','LineWidth',2);
    hold on;
    plot(1:gap:size(data1,2),tempMAX(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    plot(1:gap:size(data1,2),tempMIN(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    
    temp2 = squeeze(mean(data2,3));
    tempSTD = std(temp2);
    tempMAX = squeeze(max(data2,[],3));
    tempMIN = squeeze(min(data2,[],3));
    plot(1:gap:size(data2,2),temp2(freq(q),1:gap:size(data2,2)),'k','LineWidth',2);
    plot(1:gap:size(data2,2),tempMAX(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    plot(1:gap:size(data2,2),tempMIN(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    %title([num2str(index(freq(q))) ' hz, ' 'r= ' num2str(corr2(temp(freq(q),1:gap:size(data1,2)),temp2(freq(q),1:gap:size(data2,2))))]);
    title([num2str(index(freq(q))) ' hz, ' 'd= ' num2str(sum(abs(temp(freq(q),1:gap:size(data1,2))-temp2(freq(q),1:gap:size(data2,2)))))]);
%     temp3 = squeeze(mean(data3,3));
%     tempSTD = std(temp3);
%     tempMAX = squeeze(max(data3,[],3));
%     tempMIN = squeeze(min(data3,[],3));
%     plot(1:gap:size(data3,2),temp3(freq(q),1:gap:size(data3,2)),'b','LineWidth',2);
%     plot(1:gap:size(data3,2),tempMAX(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     plot(1:gap:size(data3,2),tempMIN(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     %legend('Normal', 'Block9Hz');
%     hold off
%     title(index(freq(q)));
%     %ylim([0.2 0.5]);
end
freq = [3, 9, 10, 17, 18];
for q = 1:length(freq)
    temp = squeeze(mean(data1,3));
    tempSTD = std(temp);
    tempMAX = squeeze(max(data1,[],3));
    tempMIN = squeeze(min(data1,[],3));
    subplot(6,6,mfSSVEP_ring_plot(index(freq(q))));%subplot(length(freq),1,q);
    plot(1:gap:size(data1,2),temp(freq(q),1:gap:size(data1,2)),'r','LineWidth',2);
    hold on;
    plot(1:gap:size(data1,2),tempMAX(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    plot(1:gap:size(data1,2),tempMIN(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    
    temp2 = squeeze(mean(data2,3));
    tempSTD = std(temp2);
    tempMAX = squeeze(max(data2,[],3));
    tempMIN = squeeze(min(data2,[],3));
    plot(1:gap:size(data2,2),temp2(freq(q),1:gap:size(data2,2)),'k','LineWidth',2);
    plot(1:gap:size(data2,2),tempMAX(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    plot(1:gap:size(data2,2),tempMIN(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    %title([num2str(index(freq(q))) ' hz, ' 'r= ' num2str(corr2(temp(freq(q),1:gap:size(data1,2)),temp2(freq(q),1:gap:size(data2,2))))]);
    title([num2str(index(freq(q))) ' hz, ' 'd= ' num2str(sum(abs(temp(freq(q),1:gap:size(data1,2))-temp2(freq(q),1:gap:size(data2,2)))))]);
%     temp3 = squeeze(mean(data3,3));
%     tempSTD = std(temp3);
%     tempMAX = squeeze(max(data3,[],3));
%     tempMIN = squeeze(min(data3,[],3));
%     plot(1:gap:size(data3,2),temp3(freq(q),1:gap:size(data3,2)),'b','LineWidth',2);
%     plot(1:gap:size(data3,2),tempMAX(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     plot(1:gap:size(data3,2),tempMIN(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     %legend('Normal', 'Block9Hz');
%     hold off
%     title(index(freq(q)));
end

freq = [2, 7, 8, 15, 16];
for q = 1:length(freq)
    temp = squeeze(mean(data1,3));
    tempSTD = std(temp);
    tempMAX = squeeze(max(data1,[],3));
    tempMIN = squeeze(min(data1,[],3));
    subplot(6,6,mfSSVEP_ring_plot(index(freq(q))));%subplot(length(freq),1,q);
    plot(1:gap:size(data1,2),temp(freq(q),1:gap:size(data1,2)),'r','LineWidth',2);
    hold on;
    plot(1:gap:size(data1,2),tempMAX(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    plot(1:gap:size(data1,2),tempMIN(freq(q),1:gap:size(data1,2)),'--r','LineWidth',1);
    
    temp2 = squeeze(mean(data2,3));
    tempSTD = std(temp2);
    tempMAX = squeeze(max(data2,[],3));
    tempMIN = squeeze(min(data2,[],3));
    plot(1:gap:size(data2,2),temp2(freq(q),1:gap:size(data2,2)),'k','LineWidth',2);
    plot(1:gap:size(data2,2),tempMAX(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    plot(1:gap:size(data2,2),tempMIN(freq(q),1:gap:size(data2,2)),'--k','LineWidth',1);
    %title([num2str(index(freq(q))) ' hz, ' 'r= ' num2str(corr2(temp(freq(q),1:gap:size(data1,2)),temp2(freq(q),1:gap:size(data2,2))))]);
    title([num2str(index(freq(q))) ' hz, ' 'd= ' num2str(sum(abs(temp(freq(q),1:gap:size(data1,2))-temp2(freq(q),1:gap:size(data2,2)))))]);
%     temp3 = squeeze(mean(data3,3));
%     tempSTD = std(temp3);
%     tempMAX = squeeze(max(data3,[],3));
%     tempMIN = squeeze(min(data3,[],3));
%     plot(1:gap:size(data3,2),temp3(freq(q),1:gap:size(data3,2)),'b','LineWidth',2);
%     plot(1:gap:size(data3,2),tempMAX(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     plot(1:gap:size(data3,2),tempMIN(freq(q),1:gap:size(data3,2)),'--b','LineWidth',1);
%     %legend('Normal', 'Block9Hz');
%     hold off
%     title(index(freq(q)));
end
tightfig
end

function qqq = getPlotIndex(freq)
if(freq ==8)
    qqq = 16;
elseif(freq ==8.2)
    qqq = 22;
elseif(freq == 8.4)
    qqq = 21;
elseif(freq == 8.6)
    qqq = 15;
elseif(freq ==8.8)
    qqq = 10;
elseif(freq ==9)
    qqq = 17;
elseif(freq ==9.2)
    qqq = 23;
elseif(freq ==9.4)
    qqq = 28;
elseif(freq ==9.6)
    qqq = 27;
elseif(freq ==9.8)
    qqq = 20;
elseif(freq ==10)
    qqq = 14;
elseif(freq ==10.2)
    qqq = 9;
elseif(freq ==10.4)
    qqq = 5;
elseif(freq ==10.6)
    qqq = 12;
elseif(freq ==10.8)
    qqq = 30;
elseif(freq ==11)
    qqq = 35;
elseif(freq ==11.2)
    qqq = 32;
elseif(freq ==11.4)
    qqq = 25;
elseif(freq ==11.6)
    qqq = 7;
elseif(freq ==11.8)
    qqq = 2;
    
end
end
