
%% Fig 2A

subplot(2,1,1);
hold off;
plot(CNQX.time,...
    CNQX.channel+0.15*randn(size(CNQX.time)),...
    '.','Markersize',2,'Color',[0.4 0.4 0.4]);
ylim([1 64]);
set(gca,'XTick',min(CNQX.time):60*5:max(CNQX.time),'YTick',0:10:70);
xstart = 1.9776e5;
xlim([xstart xstart+1800]);

subplot(2,1,2);
hold off;
asdr.bins = min(CNQX.time):1:max(CNQX.time);
asdr.all = histc(CNQX.time,asdr.bins);
plot(asdr.bins,asdr.all,'-','Color',[0.4 0.4 0.4]);
set(gca,'XTick',min(CNQX.time):60*5:max(CNQX.time));
ylim([0 4500]);
xlim([xstart xstart+1800]);

%% Fig 2B
%figure;
subplot(2,1,1);
hold off;
plot(CNQX.time,...
    CNQX.channel+0.15*randn(size(CNQX.time)),...
    '.','Markersize',2,'Color',[0.4 0.4 0.4]);
ylim([1 64]);
set(gca,'XTick',min(CNQX.time):3600*2:max(CNQX.time),'YTick',0:10:70);
xstart = 1.5036e5;
xlim([xstart xstart+3600*10]);

subplot(2,1,2);
hold off;
plot(asdr.bins,asdr.all/100,'-','Color',[0.7 0.7 0.7]);
hold on;
asdr.bins2 = min(CNQX.time):3600:max(CNQX.time);
asdr.all2 = histc(CNQX.time,asdr.bins2);
plot(asdr.bins2,asdr.all2/3600,'-k','LineWidth',2);
hold on;
set(gca,'XTick',min(CNQX.time):3600*2:max(CNQX.time));
ylim([0 45]);
xlim([xstart xstart+3600*10]);


%% Fig 2C

subplot(2,1,1);
hold off;
plot(CNQX.time,...
    CNQX.channel+0.15*randn(size(CNQX.time)),...
    '.','Markersize',2,'Color',[0.4 0.4 0.4]);
ylim([1 64]);
set(gca,'XTick',min(CNQX.time):30:max(CNQX.time),'YTick',0:10:70);
xstart = 1.9778e5;
xlim([xstart xstart+60]);

subplot(2,1,2);
hold off;
asdr.bins = min(CNQX.time):0.1:max(CNQX.time);
asdr.all = histc(CNQX.time,asdr.bins);
plot(asdr.bins,asdr.all/0.1,'-','Color',[0.4 0.4 0.4]);
set(gca,'XTick',min(CNQX.time):30:max(CNQX.time));
%ylim([0 4500]);
xlim([xstart xstart+60]);