%% 2022-04-12
% Plotting hole counts in summiting R19G10 > mcd8GFP flies

dataDir = 'D:\Harvard\Manuscripts\Summit paper\Figures\Figure 5\F\';
holeData = readtable(strcat(dataDir,'R19G10_mcd8GFP summiting hole counts.xlsx'),'Sheet',10);

figure;
hold on;

neuropils = holeData.Properties.VariableNames;

% Re-ordering neuropil for plot roughly from lateral to medial
reorder = [10,9,6,5,7,4,2,11,3,8];

for i = 2:numel(neuropils)
    counts = holeData{:,neuropils{reorder(i-1)}};
    scatter(repmat(i,1,length(counts)),counts,'MarkerEdgeColor','none','MarkerFaceColor','k','MarkerFaceAlpha',0.5,'jitter','on');
    
    scatter(i,nanmean(counts),'MarkerEdgeColor','none','MarkerFaceColor','k');
    errorbar(i,nanmean(counts),nanstd(counts),'k');
    
    %counts = holeData{:,neuropils{i}};
    %scatter(i,nanmean(counts),'MarkerEdgeColor','none','MarkerFaceColor','k');
    %errorbar(i,nanmean(counts),nanstd(counts),'k');
end

xlim([1.5 numel(neuropils)+0.5]);

xlabels = neuropils(2:numel(neuropils));
xlabels = xlabels(reorder-1);

set(gca,'xtick',2:numel(neuropils),'xticklabel',xlabels,'TickLength',[0 0],'FontSize',18);
%set(gca,'xtick',2:numel(neuropils),'xticklabel',neuropils(2:numel(neuropils)),'TickLength',[0 0],'FontSize',18);
ylabel('Fraction holes in neuropil');
xtickangle(45);

imgDir = "D:\Harvard\Manuscripts\Summit paper\Figures\Figure 5\";
%set(gcf,'PaperUnits','inches','PaperPosition',[0 0 5.6 4]);
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 6 4]);
print(strcat(imgDir,'R19G10 summiting hole count.pdf'),'-dpdf');
print(strcat(imgDir,'R19G10 summiting hole count.png'),'-dpng');
close;
