clear all;

dat = [-0.3777	0.552639728922247; ...
    -0.4084	0.556781462217691; ...
    -0.3056	0.250803982856959; ...
    -0.6056	0.269953539511528; ...
    -1	0.645286426636303; ...
    -1	0.845609337813244; ...
    -1	0.435713858663159; ...
    -1	0.068150470219436; ...
    -1	0.113218232044199];

hold off;
% c = jet(size(dat,1));
c = [1 0 0;1 0 0;1 0 0;1 0 0; ...
    0 0.3 0.7;0 0.3 0.7;0 0.3 0.7;0 0.3 0.7;0 0.3 0.7];
for i = 1:size(dat,1)
    handlevector(:,i) = plot(dat(i,1)*100,dat(i,2)*100,'.','MarkerSize',25,'Color',c(i,:));
    hold on;
%     hold all;
end
%legend('trouble22467','usain22493','wingnut22468','xinhai22493','stimpy3','stimpy6','anchovy4','anchovy3','xeko3');
legend(handlevector([1 5]),{'CNQX','TTX'}, 'Location','NorthEast');
axis([-105 105 -105 105]);
%plot([-105 105],[0 0],'--k','LineWidth',2);
%plot([0 0],[-105 105],'--k','LineWidth',2);
axis square;

set(gca,'FontSize',14,'XTick',-100:20:100,'YTick',-100:20:100,'LineWidth',2);
ylabel('Percent Change in mEPSC Amplitude','FontSize',16);
xlabel('Percent Change in Network Spiking after Drug','FontSize',16);

stats = regstats(dat(:,2),dat(:,1),'linear');
text(-103,101,['R^2=',num2str(stats.rsquare) ' for linear fit'],'FontSize',16);
box off;

% axis([-105 0 0 105]);
% set(gca,'YAxisLocation','right','TickDir','out');

axis([-105 5 -5 105]);
set(gca,'YAxisLocation','right','TickDir','out');
set(gcf,'Position',[1541         215         619         563]);

%% with CNQX+stim
clear all;

dat = [-0.3777	0.552639728922247; ... %CNQX
    -0.4084	0.556781462217691; ...
    -0.3056	0.250803982856959; ...
    -0.6056	0.269953539511528; ...
    -1	0.645286426636303; ... %TTX
    -1	0.845609337813244; ...
    -1	0.435713858663159; ...
    -1	0.068150470219436; ...
    -1	0.113218232044199; ...
    0 18.0356/14.9159-1; ... %CNQX+stim
    0 22.321/15.5165-1; ...
    0 17.1166/11.5742-1; ...
    0 16.817/10.9784-1; ...
    0 12.1222/10.5481-1];

hold off;
% c = jet(size(dat,1));
c = [1 0 0;1 0 0;1 0 0;1 0 0; ...
    0 0.3 0.7;0 0.3 0.7;0 0.3 0.7;0 0.3 0.7;0 0.3 0.7; ...
    0.6 0.2 0.7;0.6 0.2 0.7;0.6 0.2 0.7;0.6 0.2 0.7;0.6 0.2 0.7;];
for i = 1:size(dat,1)
    handlevector(:,i) = plot(dat(i,1)*100,dat(i,2)*100,'.','MarkerSize',25,'Color',c(i,:));
    hold on;
%     hold all;
end
%legend('trouble22467','usain22493','wingnut22468','xinhai22493','stimpy3','stimpy6','anchovy4','anchovy3','xeko3');
legend(handlevector([1 5 10]),{'CNQX','TTX','CNQX+stim'}, 'Location','NorthEast');
axis([-105 105 -105 105]);
%plot([-105 105],[0 0],'--k','LineWidth',2);
%plot([0 0],[-105 105],'--k','LineWidth',2);
axis square;

set(gca,'FontSize',14,'XTick',-100:20:100,'YTick',-100:20:100,'LineWidth',2);
ylabel('Percent Change in mEPSC Amplitude','FontSize',16);
xlabel('Percent Change in Network Spiking after Drug','FontSize',16);

stats = regstats(dat(:,2),dat(:,1),'linear');
text(-103,101,['R^2=',num2str(stats.rsquare) ' for linear fit'],'FontSize',16);
box off;

axis([-105 5 -5 105]);
set(gca,'YAxisLocation','right','TickDir','out');
set(gcf,'Position',[1541         215         619         563]);

%% with CNQX+stim and CTZ+TTX
clear all;

dat = [-0.3777	0.552639728922247; ... %CNQX
    -0.4084	0.556781462217691; ...
    -0.3056	0.250803982856959; ...
    -0.6056	0.269953539511528; ...
    -1	0.645286426636303; ... %TTX
    -1	0.845609337813244; ...
    -1	0.435713858663159; ...
    -1	0.068150470219436; ...
    -1	0.113218232044199; ...
    0 18.0356/14.9159-1; ... %CNQX+stim
    0 22.321/15.5165-1; ...
    0 17.1166/11.5742-1; ...
    0 16.817/10.9784-1; ...
    0 12.1222/10.5481-1; ... %TTX+CTZ
    -1 17.6331/12.7345-1; ...
    -1 13.8384/11.4288-1; ...
    -1 16.9926/13.3808-1; ...
    -1 15.2014/14.355-1; ...
    -1 16.5625/11.1427-1];

hold off;
% c = jet(size(dat,1));
c = [1 0 0;1 0 0;1 0 0;1 0 0; ...
    0 0.3 0.7;0 0.3 0.7;0 0.3 0.7;0 0.3 0.7;0 0.3 0.7; ...
    0.6 0.2 0.7;0.6 0.2 0.7;0.6 0.2 0.7;0.6 0.2 0.7;0.6 0.2 0.7; ...
    0.1 0.6 0.2;0.1 0.6 0.2;0.1 0.6 0.2;0.1 0.6 0.2;0.1 0.6 0.2;0.1 0.6 0.2;];
for i = 1:size(dat,1)
    handlevector(:,i) = plot(dat(i,1)*100,dat(i,2)*100,'.','MarkerSize',25,'Color',c(i,:));
    hold on;
%     hold all;
end
%legend('trouble22467','usain22493','wingnut22468','xinhai22493','stimpy3','stimpy6','anchovy4','anchovy3','xeko3');
legend(handlevector([1 5 10 15]),{'CNQX','TTX','CNQX+stim','TTX+CTZ'}, 'Location','NorthEast');
axis([-105 105 -105 105]);
%plot([-105 105],[0 0],'--k','LineWidth',2);
%plot([0 0],[-105 105],'--k','LineWidth',2);
axis square;

set(gca,'FontSize',14,'XTick',-100:20:100,'YTick',-100:20:100,'LineWidth',2);
ylabel('Percent Change in mEPSC Amplitude','FontSize',16);
xlabel('Percent Change in Network Spiking after Drug','FontSize',16);

stats = regstats(dat(:,2),dat(:,1),'linear');
text(-103,101,['R^2=',num2str(stats.rsquare) ' for linear fit'],'FontSize',16);
box off;

axis([-105 5 -5 105]);
set(gca,'YAxisLocation','right','TickDir','out');
set(gcf,'Position',[1541         215         619         563]);