
%% Fig 3A - inset
bar(CNQX.bins,CNQX.bins.*CNQX.hist);
hold on;
plot(CNQX.bins,CNQX.smooth,'-r','LineWidth',2);
axis([-0.002 0.2 0 400])
axis square
grid on
axis([0 0.1 0 400])
plot([CNQX.bins(13) CNQX.bins(13)],[0 1500],'k--','LineWidth',2)


%% Fig 3B

% subplot(2,1,1);
hold off;
plot(CNQX.time(CNQX.ISI<=CNQX.bins(CNQX.ISIcut)),...
    CNQX.channel(CNQX.ISI<=CNQX.bins(CNQX.ISIcut))+0.15*randn(size(CNQX.time(CNQX.ISI<=CNQX.bins(CNQX.ISIcut)))),...
    '.r','Markersize',2);
hold on;
plot(CNQX.time(CNQX.ISI>CNQX.bins(CNQX.ISIcut)),...
    CNQX.channel(CNQX.ISI>CNQX.bins(CNQX.ISIcut))+0.15*randn(size(CNQX.time(CNQX.ISI>CNQX.bins(CNQX.ISIcut)))),...
    '.k','Markersize',2);
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);
% asdr.burst = histc(CNQX.time(CNQX.ISI<=CNQX.bins(CNQX.ISIcut)),asdr.bins);
% asdr.IBI = histc(CNQX.time(CNQX.ISI>CNQX.bins(CNQX.ISIcut)),asdr.bins);
% %plot(asdr.bins,asdr.all,'-k');
% plot(asdr.bins,asdr.burst,'-r','LineWidth',1.5);
% % plot(asdr.bins,asdr.IBI,'-r');
% %plotyy(asdr.bins,asdr.burst,asdr.bins,smooth(asdr.IBI,30));
% hold on;
% plot(asdr.bins,asdr.IBI*10,'-k','LineWidth',3);
% set(gca,'XTick',min(CNQX.time):60*2:max(CNQX.time));
% ylim([0 4500]);
% %xlim([xstart xstart+1800]);

%% Fig 3 all

subplot(2,1,1)
hold off
bar(CNQX.bins,CNQX.bins.*CNQX.hist);
hold on;
%plot(CNQX.bins,CNQX.smooth,'-r','LineWidth',2);
%axis([-0.002 0.2 0 400])
%axis square
grid on
% axis([0 0.1 0 400])
% plot([CNQX.bins(13) CNQX.bins(13)],[0 1500],'k--','LineWidth',2)

subplot(2,1,2);
hold off;
plot(CNQX.time(CNQX.ISI<=CNQX.bins(CNQX.ISIcut)),...
    CNQX.channel(CNQX.ISI<=CNQX.bins(CNQX.ISIcut))+0.15*randn(size(CNQX.time(CNQX.ISI<=CNQX.bins(CNQX.ISIcut)))),...
    '.r','Markersize',2);
hold on;
plot(CNQX.time(CNQX.ISI>CNQX.bins(CNQX.ISIcut)),...
    CNQX.channel(CNQX.ISI>CNQX.bins(CNQX.ISIcut))+0.15*randn(size(CNQX.time(CNQX.ISI>CNQX.bins(CNQX.ISIcut)))),...
    '.k','Markersize',2);
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]);
