function out=hedgeLineagePlot2(data,N,colorMap) %hedgeLineagePlot2 makes a pretty plot of fly lineages and fates based on %the fly data matrix produced by hedgeSim4.m. Used to make Figure 2 of the %paper. Only works with seasons of length 214, the paper standard. %========================================================================= % Usage: % out=hedgeLineagePlot2(data,N,colorMap) % Inputs: % * data = .data object from the output of hedgeSim4.m % * N = max number of flies to be shown in figure % * colorMap = color scheme for lineage branches (from kbcy.mat) - % works with 64 color colormaps % Output, out = plotting data for the lineage processed last (isn't used for % anything, honestly) %establish some indices N0=9; N1=11; N2=12; NhowDeath=10; %size of Markers for death events marSize=6; % clean up some of the orignal fly data matrix encoding data(1:100,6)=0; % all seed flies have an effective birth date of 0 for these purposes data(1:100,N0)=1:100; % seed flies should have a 1...100 index number (this line seems redundant) data=[data data(:,N0)]; % tack the index column onto data as a new column data(isnan(data))=214; % replace all remaining NaNs (which should only be in the death date slot of flies that didn't die) with 214 for these purposes. data=[data (1:size(data,1))']; % tack on an index column for the entire matrix % replace the parental ID # of each fly with its grand parental ID#, etc, % until all flies have their lineage marked back to one of the seed % population flies. column N1 contains this back-calculated lineage tag. while max(data(:,N1))>100 for i=1:size(data,1) if data(i,N1) > 100 data(i,N1)=data(data(i,N1),N0); end end end %calculate the number of progeny derived from each seed fly progCounts=zeros(100,1); for i=1:100 progCounts(i)=sum(data(:,N1)==i); end %open figure figure; hold on; %plotting parameter allocating space to each lineage offSet=0; %start adding flies, one lineage at a time until target number of lineages %to plot (N) is surpassed. i=1; while offSet