%% plot amplitudes
close all;
load('tommy1_celldata.mat')

figure(1)
% subplot(2,1,1);
% hold off;
% plot(tommy1_cell05(:,2)/3600,tommy1_cell05(:,3),'k.'); hold on;
% plot(tommy1_cell06(:,2)/3600,tommy1_cell06(:,3),'k.');
% plot(tommy1_cell07(:,2)/3600,tommy1_cell07(:,3),'k.');
% plot(tommy1_cell09(:,2)/3600,tommy1_cell09(:,3),'k.');
% plot(tommy1_cell10_pre(:,2)/3600,tommy1_cell10_pre(:,3),'k.');
% plot(tommy1_cell10_post(:,2)/3600,tommy1_cell10_post(:,3),'k.');
% plot(tommy1_cell11(:,2)/3600,tommy1_cell11(:,3),'k.');
% plot(tommy1_cell12(:,2)/3600,tommy1_cell12(:,3),'k.');
% plot(tommy1_cell13(:,2)/3600,tommy1_cell13(:,3),'k.');
% plot(tommy1_cell14(:,2)/3600,tommy1_cell14(:,3),'k.');
% plot(tommy1_cell15(:,2)/3600,tommy1_cell15(:,3),'k.');
% plot(tommy1_cell16(:,2)/3600,tommy1_cell16(:,3),'k.');
% plot(tommy1_cell17(:,2)/3600,tommy1_cell17(:,3),'k.');
% plot(tommy1_cell18(:,2)/3600,tommy1_cell18(:,3),'k.');
% plot(tommy1_cell19(:,2)/3600,tommy1_cell19(:,3),'k.');
% plot(tommy1_cell20(:,2)/3600,tommy1_cell20(:,3),'k.');
% plot(tommy1_cell21(:,2)/3600,tommy1_cell21(:,3),'k.');
% axis([-1.75 10.9 0 70]);
% set(gca,'FontSize',16,'XTick',[-2:1:11]);
% ylabel('mEPSC Amplitude (pA)');
% 
% 
% plot(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,3)),'ro'); hold on; 
% plot(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,3)),'ro'); 
% plot(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,3)),'ro'); 
% plot(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,3)),'ro'); 
% plot(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,3)),'ro'); 
% plot(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,3)),'ro'); 
% plot(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,3)),'ro'); 
% plot(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,3)),'ro'); 
% plot(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,3)),'ro'); 
% plot(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,3)),'ro'); 
% plot(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,3)),'ro'); 
% plot(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,3)),'ro'); 
% plot(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,3)),'ro'); 
% plot(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,3)),'ro'); 
% plot(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,3)),'ro'); 
% plot(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,3)),'ro'); 
% plot(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,3)),'ro'); 
% yL = get(gca,'YLim');
% plot([0 0],yL,':k');
% text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
% set(gca,'TickLength',[0.0035 0.025],'TickDir','out');

% subplot(2,1,2)
% plot(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,3)),'ro'); hold on; 
% plot(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,3)),'ro'); 
% plot(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,3)),'ro'); 
% plot(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,3)),'ro'); 
% plot(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,3)),'ro'); 
% plot(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,3)),'ro'); 
% plot(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,3)),'ro'); 
% plot(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,3)),'ro'); 
% plot(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,3)),'ro'); 
% plot(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,3)),'ro'); 
% plot(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,3)),'ro'); 
% plot(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,3)),'ro'); 
% plot(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,3)),'ro'); 
% plot(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,3)),'ro'); 
% plot(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,3)),'ro'); 
% plot(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,3)),'ro'); 
% plot(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,3)),'ro'); 

% subplot(2,1,2);
hold off;
errorbar(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,3)),nanstd(tommy1_cell05(:,3)),'ro'); hold on; 
errorbar(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,3)),nanstd(tommy1_cell06(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,3)),nanstd(tommy1_cell07(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,3)),nanstd(tommy1_cell09(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,3)),nanstd(tommy1_cell10_pre(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,3)),nanstd(tommy1_cell10_post(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,3)),nanstd(tommy1_cell11(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,3)),nanstd(tommy1_cell12(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,3)),nanstd(tommy1_cell13(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,3)),nanstd(tommy1_cell14(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,3)),nanstd(tommy1_cell15(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,3)),nanstd(tommy1_cell16(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,3)),nanstd(tommy1_cell17(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,3)),nanstd(tommy1_cell18(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,3)),nanstd(tommy1_cell19(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,3)),nanstd(tommy1_cell20(:,3)),'ro'); 
errorbar(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,3)),nanstd(tommy1_cell21(:,3)),'ro'); 
axis([-1.75 10.9 0 25]);
set(gca,'FontSize',16,'XTick',[-2:1:11]);
ylabel('mEPSC Amplitude (pA)');
xlabel('Time (hours)');
yL = get(gca,'YLim');
plot([0 0],yL,':k');
text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
set(gca,'TickLength',[0.0035 0.025],'TickDir','out');

% errorbar(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,3)),nanstd(tommy1_cell05(:,3)),'ro'); hold on; 
% errorbar(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,3)),nanstd(tommy1_cell06(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,3)),nanstd(tommy1_cell07(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,3)),nanstd(tommy1_cell09(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,3)),nanstd(tommy1_cell10_pre(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,3)),nanstd(tommy1_cell10_post(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,3)),nanstd(tommy1_cell11(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,3)),nanstd(tommy1_cell12(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,3)),nanstd(tommy1_cell13(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,3)),nanstd(tommy1_cell14(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,3)),nanstd(tommy1_cell15(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,3)),nanstd(tommy1_cell16(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,3)),nanstd(tommy1_cell17(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,3)),nanstd(tommy1_cell18(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,3)),nanstd(tommy1_cell19(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,3)),nanstd(tommy1_cell20(:,3)),'ro'); 
% errorbar(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,3)),nanstd(tommy1_cell21(:,3)),'ro'); 


%% plot frequencies

figure(2);
% subplot(2,1,1);
% hold off;
% plot(tommy1_cell05(:,2)/3600,tommy1_cell05(:,19),'k.'); hold on;
% plot(tommy1_cell06(:,2)/3600,tommy1_cell06(:,19),'k.');
% plot(tommy1_cell07(:,2)/3600,tommy1_cell07(:,19),'k.');
% plot(tommy1_cell09(:,2)/3600,tommy1_cell09(:,19),'k.');
% plot(tommy1_cell10_pre(:,2)/3600,tommy1_cell10_pre(:,19),'k.');
% plot(tommy1_cell10_post(:,2)/3600,tommy1_cell10_post(:,19),'k.');
% plot(tommy1_cell11(:,2)/3600,tommy1_cell11(:,19),'k.');
% plot(tommy1_cell12(:,2)/3600,tommy1_cell12(:,19),'k.');
% plot(tommy1_cell13(:,2)/3600,tommy1_cell13(:,19),'k.');
% plot(tommy1_cell14(:,2)/3600,tommy1_cell14(:,19),'k.');
% plot(tommy1_cell15(:,2)/3600,tommy1_cell15(:,19),'k.');
% plot(tommy1_cell16(:,2)/3600,tommy1_cell16(:,19),'k.');
% plot(tommy1_cell17(:,2)/3600,tommy1_cell17(:,19),'k.');
% plot(tommy1_cell18(:,2)/3600,tommy1_cell18(:,19),'k.');
% plot(tommy1_cell19(:,2)/3600,tommy1_cell19(:,19),'k.');
% plot(tommy1_cell20(:,2)/3600,tommy1_cell20(:,19),'k.');
% plot(tommy1_cell21(:,2)/3600,tommy1_cell21(:,19),'k.');
% axis([-1.75 10.9 0 200]);
% set(gca,'FontSize',16,'XTick',[-2:1:11]);
% ylabel('mEPSC Frequency (Hz)');
% yL = get(gca,'YLim');
% plot([0 0],yL,':k');
% text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
% set(gca,'TickLength',[0.0035 0.025],'TickDir','out');
% 
% x = tommy1_cell05(:,2); y = tommy1_cell05(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell06(:,2); y = tommy1_cell06(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro'); hold on;
% x = tommy1_cell07(:,2); y = tommy1_cell07(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell09(:,2); y = tommy1_cell09(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell10_pre(:,2); y = tommy1_cell10_pre(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell10_post(:,2); y = tommy1_cell10_post(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell11(:,2); y = tommy1_cell11(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell12(:,2); y = tommy1_cell12(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell13(:,2); y = tommy1_cell13(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell14(:,2); y = tommy1_cell14(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell15(:,2); y = tommy1_cell15(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell16(:,2); y = tommy1_cell16(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell17(:,2); y = tommy1_cell17(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell18(:,2); y = tommy1_cell18(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell19(:,2); y = tommy1_cell19(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell20(:,2); y = tommy1_cell20(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');
% x = tommy1_cell21(:,2); y = tommy1_cell21(:,19); x = x(isfinite(y)); y = y(isfinite(y));
% plot(nanmean(x)/3600,nanmean(y),'ro');


% subplot(2,1,2)
x = tommy1_cell05(:,2); y = tommy1_cell05(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell06(:,2); y = tommy1_cell06(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro'); hold on;
x = tommy1_cell07(:,2); y = tommy1_cell07(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell09(:,2); y = tommy1_cell09(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell10_pre(:,2); y = tommy1_cell10_pre(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell10_post(:,2); y = tommy1_cell10_post(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell11(:,2); y = tommy1_cell11(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell12(:,2); y = tommy1_cell12(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell13(:,2); y = tommy1_cell13(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell14(:,2); y = tommy1_cell14(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell15(:,2); y = tommy1_cell15(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell16(:,2); y = tommy1_cell16(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell17(:,2); y = tommy1_cell17(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell18(:,2); y = tommy1_cell18(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell19(:,2); y = tommy1_cell19(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell20(:,2); y = tommy1_cell20(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');
x = tommy1_cell21(:,2); y = tommy1_cell21(:,19); x = x(isfinite(y)); y = y(isfinite(y));
errorbar(nanmean(x)/3600,nanmean(y),nanstd(y),'ro');

axis([-1.75 10.9 0 17]);
set(gca,'FontSize',16,'XTick',[-2:1:11]);
ylabel('mEPSC Frequency (Hz)');
xlabel('Time (hours)');
yL = get(gca,'YLim');
plot([0 0],yL,':k');
text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
set(gca,'TickLength',[0.0035 0.025],'TickDir','out');


%% plot decays
figure(3)
% subplot(2,1,1);
% hold off;
% plot(tommy1_cell05(:,2)/3600,tommy1_cell05(:,5),'k.'); hold on;
% plot(tommy1_cell06(:,2)/3600,tommy1_cell06(:,5),'k.');
% plot(tommy1_cell07(:,2)/3600,tommy1_cell07(:,5),'k.');
% plot(tommy1_cell09(:,2)/3600,tommy1_cell09(:,5),'k.');
% plot(tommy1_cell10_pre(:,2)/3600,tommy1_cell10_pre(:,5),'k.');
% plot(tommy1_cell10_post(:,2)/3600,tommy1_cell10_post(:,5),'k.');
% plot(tommy1_cell11(:,2)/3600,tommy1_cell11(:,5),'k.');
% plot(tommy1_cell12(:,2)/3600,tommy1_cell12(:,5),'k.');
% plot(tommy1_cell13(:,2)/3600,tommy1_cell13(:,5),'k.');
% plot(tommy1_cell14(:,2)/3600,tommy1_cell14(:,5),'k.');
% plot(tommy1_cell15(:,2)/3600,tommy1_cell15(:,5),'k.');
% plot(tommy1_cell16(:,2)/3600,tommy1_cell16(:,5),'k.');
% plot(tommy1_cell17(:,2)/3600,tommy1_cell17(:,5),'k.');
% plot(tommy1_cell18(:,2)/3600,tommy1_cell18(:,5),'k.');
% plot(tommy1_cell19(:,2)/3600,tommy1_cell19(:,5),'k.');
% plot(tommy1_cell20(:,2)/3600,tommy1_cell20(:,5),'k.');
% plot(tommy1_cell21(:,2)/3600,tommy1_cell21(:,5),'k.');
% axis([-1.75 10.9 0 39]);
% set(gca,'FontSize',16,'XTick',[-2:1:11]);
% ylabel('Decay Time (ms)');
% 
% 
% plot(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,5)),'ro'); hold on; 
% plot(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,5)),'ro'); 
% plot(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,5)),'ro'); 
% plot(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,5)),'ro'); 
% plot(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,5)),'ro'); 
% plot(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,5)),'ro'); 
% plot(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,5)),'ro'); 
% plot(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,5)),'ro'); 
% plot(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,5)),'ro'); 
% plot(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,5)),'ro'); 
% plot(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,5)),'ro'); 
% plot(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,5)),'ro'); 
% plot(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,5)),'ro'); 
% plot(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,5)),'ro'); 
% plot(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,5)),'ro'); 
% plot(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,5)),'ro'); 
% plot(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,5)),'ro'); 
% yL = get(gca,'YLim');
% plot([0 0],yL,':k');
% text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
% set(gca,'TickLength',[0.0035 0.025],'TickDir','out');

% subplot(2,1,2);
hold off;
errorbar(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,5)),nanstd(tommy1_cell05(:,5)),'ro'); hold on; 
errorbar(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,5)),nanstd(tommy1_cell06(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,5)),nanstd(tommy1_cell07(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,5)),nanstd(tommy1_cell09(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,5)),nanstd(tommy1_cell10_pre(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,5)),nanstd(tommy1_cell10_post(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,5)),nanstd(tommy1_cell11(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,5)),nanstd(tommy1_cell12(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,5)),nanstd(tommy1_cell13(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,5)),nanstd(tommy1_cell14(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,5)),nanstd(tommy1_cell15(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,5)),nanstd(tommy1_cell16(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,5)),nanstd(tommy1_cell17(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,5)),nanstd(tommy1_cell18(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,5)),nanstd(tommy1_cell19(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,5)),nanstd(tommy1_cell20(:,5)),'ro'); 
errorbar(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,5)),nanstd(tommy1_cell21(:,5)),'ro'); 
axis([-1.75 10.9 0 10.5]);
set(gca,'FontSize',16,'XTick',[-2:1:11]);
ylabel('Decay Time (ms)');
xlabel('Time (hours)');
yL = get(gca,'YLim');
plot([0 0],yL,':k');
text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
set(gca,'TickLength',[0.0035 0.025],'TickDir','out');


%% plot areas
figure(4)
% subplot(2,1,1);
% hold off;
% plot(tommy1_cell05(:,2)/3600,tommy1_cell05(:,6),'k.'); hold on;
% plot(tommy1_cell06(:,2)/3600,tommy1_cell06(:,6),'k.');
% plot(tommy1_cell07(:,2)/3600,tommy1_cell07(:,6),'k.');
% plot(tommy1_cell09(:,2)/3600,tommy1_cell09(:,6),'k.');
% plot(tommy1_cell10_pre(:,2)/3600,tommy1_cell10_pre(:,6),'k.');
% plot(tommy1_cell10_post(:,2)/3600,tommy1_cell10_post(:,6),'k.');
% plot(tommy1_cell11(:,2)/3600,tommy1_cell11(:,6),'k.');
% plot(tommy1_cell12(:,2)/3600,tommy1_cell12(:,6),'k.');
% plot(tommy1_cell13(:,2)/3600,tommy1_cell13(:,6),'k.');
% plot(tommy1_cell14(:,2)/3600,tommy1_cell14(:,6),'k.');
% plot(tommy1_cell15(:,2)/3600,tommy1_cell15(:,6),'k.');
% plot(tommy1_cell16(:,2)/3600,tommy1_cell16(:,6),'k.');
% plot(tommy1_cell17(:,2)/3600,tommy1_cell17(:,6),'k.');
% plot(tommy1_cell18(:,2)/3600,tommy1_cell18(:,6),'k.');
% plot(tommy1_cell19(:,2)/3600,tommy1_cell19(:,6),'k.');
% plot(tommy1_cell20(:,2)/3600,tommy1_cell20(:,6),'k.');
% plot(tommy1_cell21(:,2)/3600,tommy1_cell21(:,6),'k.');
% axis([-1.75 10.9 0 1000]);
% set(gca,'FontSize',16,'XTick',[-2:1:11]);
% ylabel('Charge Transfer (fC)');
% 
% 
% plot(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,6)),'ro'); hold on; 
% plot(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,6)),'ro'); 
% plot(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,6)),'ro'); 
% plot(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,6)),'ro'); 
% plot(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,6)),'ro'); 
% plot(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,6)),'ro'); 
% plot(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,6)),'ro'); 
% plot(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,6)),'ro'); 
% plot(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,6)),'ro'); 
% plot(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,6)),'ro'); 
% plot(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,6)),'ro'); 
% plot(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,6)),'ro'); 
% plot(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,6)),'ro'); 
% plot(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,6)),'ro'); 
% plot(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,6)),'ro'); 
% plot(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,6)),'ro'); 
% plot(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,6)),'ro'); 
% 
% yL = get(gca,'YLim');
% plot([0 0],yL,':k');
% text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
% set(gca,'TickLength',[0.0035 0.025],'TickDir','out');

% subplot(2,1,2);
hold off;
errorbar(nanmean(tommy1_cell05(:,2)/3600),nanmean(tommy1_cell05(:,6)),nanstd(tommy1_cell05(:,6)),'ro'); hold on; 
errorbar(nanmean(tommy1_cell06(:,2)/3600),nanmean(tommy1_cell06(:,6)),nanstd(tommy1_cell06(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell07(:,2)/3600),nanmean(tommy1_cell07(:,6)),nanstd(tommy1_cell07(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell09(:,2)/3600),nanmean(tommy1_cell09(:,6)),nanstd(tommy1_cell09(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell10_pre(:,2)/3600),nanmean(tommy1_cell10_pre(:,6)),nanstd(tommy1_cell10_pre(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell10_post(:,2)/3600),nanmean(tommy1_cell10_post(:,6)),nanstd(tommy1_cell10_post(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell11(:,2)/3600),nanmean(tommy1_cell11(:,6)),nanstd(tommy1_cell11(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell12(:,2)/3600),nanmean(tommy1_cell12(:,6)),nanstd(tommy1_cell12(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell13(:,2)/3600),nanmean(tommy1_cell13(:,6)),nanstd(tommy1_cell13(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell14(:,2)/3600),nanmean(tommy1_cell14(:,6)),nanstd(tommy1_cell14(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell15(:,2)/3600),nanmean(tommy1_cell15(:,6)),nanstd(tommy1_cell15(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell16(:,2)/3600),nanmean(tommy1_cell16(:,6)),nanstd(tommy1_cell16(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell17(:,2)/3600),nanmean(tommy1_cell17(:,6)),nanstd(tommy1_cell17(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell18(:,2)/3600),nanmean(tommy1_cell18(:,6)),nanstd(tommy1_cell18(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell19(:,2)/3600),nanmean(tommy1_cell19(:,6)),nanstd(tommy1_cell19(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell20(:,2)/3600),nanmean(tommy1_cell20(:,6)),nanstd(tommy1_cell20(:,6)),'ro'); 
errorbar(nanmean(tommy1_cell21(:,2)/3600),nanmean(tommy1_cell21(:,6)),nanstd(tommy1_cell21(:,6)),'ro'); 
axis([-1.75 10.9 0 160]);
set(gca,'FontSize',16,'XTick',[-2:1:11]);
ylabel('Charge Transfer (fC)');
xlabel('Time (hours)');
yL = get(gca,'YLim');
plot([0 0],yL,':k');
text(0,yL(2),'cyclothiazide added','FontSize',10,'HorizontalAlignment','right','VerticalAlignment','top')
set(gca,'TickLength',[0.0035 0.025],'TickDir','out');
