function plotDistTraveled(summit, nonsummit, siRunning, nsiRunning, metric, numHours, drop_NS_XI, expDir, expName, mvMean)
    figure;
    hold on; 

    var = 'Distance traveled';
    
%     % Convert speed to distance traveled
%     sumDist = cumtrapz(summit)*(1/3); 
%     nonsumDist = cumtrapz(nonsummit)*(1/3);
    
    % Convert speed to distance traveled
    sumDist = cumsum(summit,2)*(1/3)/10;
    nonsumDist = cumsum(nonsummit,2)*(1/3)/10;
    
    % Calculate mean/median and SE for summiting group
    if strcmp(metric,'mean')
        sPlot = transpose(nanmean(sumDist));
    elseif strcmp(metric,'median')
        sPlot = transpose(nanmedian(sumDist));
    end
    if find(isnan(sPlot))
        sPlot = sPlot(1:find(isnan(sPlot),1)-1); % plot all values until last non-Nan
    end
    
    sE = transpose(nanstd(sumDist)./sqrt(siRunning));
    sE = sE(1:length(sPlot)); % plot all values until last non-Nan
    %sE = sE(1:find(isnan(sE),1)); % plot all values until last non-Nan
    
    % Calculate mean/median and SE for non-summiting group
    if strcmp(metric,'mean')
        nsPlot = transpose(nanmean(nonsumDist));
    elseif strcmp(metric,'median')
        nsPlot = transpose(nanmedian(nonsumDist));
    end
    if find(isnan(nsPlot))
        nsPlot = nsPlot(1:find(isnan(nsPlot),1)-1); % plot all values until last non-Nan
    end        
    
    nsE = transpose(nanstd(nonsumDist)./sqrt(nsiRunning));
    nsE = nsE(1:length(nsPlot)); % plot all values until last non-Nan
    %nsE = nsE(1:find(isnan(nsE),1)); % plot all values until last non-Nan
    
    % Plot mean/median +/- SE for each group
    downF = 10; % factor by which to downsample data
    
    plotColor = [1 0 0];
    
    % % cumsum method
    areaBar(downsample(1:length(sPlot),downF),downsample(sPlot,downF),downsample(sE,downF),plotColor,plotColor,'-',0.1);
    
    % % cumtrapz method
    %areaBar(downsample(1:length(sE),downF),downsample(sPlot(1:length(sE)),downF),downsample(sE,downF),plotColor,plotColor,'-',0.1);
    
    plotColor = [0 0 0];
    
    % % cumsum method
    areaBar(downsample(1:length(nsPlot),downF),downsample(nsPlot,downF),downsample(nsE,downF),plotColor,plotColor,'-',0.1);
    
    % % cumtrapz method
    %areaBar(downsample(1:length(nsE),downF),downsample(nsPlot(1:length(nsE)),downF),downsample(nsE,downF),plotColor,plotColor,'-',0.1);
    
    ylabel(strcat(metric,'-',var));
    
    set(gca,'xtick',0:3600*1.5:length(sumDist),'xticklabel',0:0.5:length(sumDist)/(3600*3),'TickLength',[0 0]); %,'Clipping','off');
    xlim([1 numHours*3600*3]);
    xlabel("Time since first movement (hours)");
    titleText = [expName,var];
    if drop_NS_XI
        titleText = [titleText,"Omitting non-summiting donors that died of infection"];
    end
    title(titleText);
    
    ylim([0 450]);  
   
    legend({strcat('Summit, N = ',num2str(max(siRunning))),strcat('Non-summit, N = ',num2str(max(nsiRunning))),"Tracked S","Tracked NS"},'Location','Best');

    % Save figure
    set(gcf,'PaperUnits','inches','PaperPosition',[0 0 7.5 6]);
    outName = strcat(expDir,var,'-All ROIS','-',num2str(numHours));
    if strcmp(metric,'mean')
        outName = strcat(outName,"_mean");
    elseif strcmp(metric,'median')
        outName = strcat(outName,"_median");
    end
    if drop_NS_XI
        outName = strcat(outName,"_drop_NS_XI");
    end

    print(strcat(outName,'.pdf'),'-dpdf'); 
    print(outName,'-dpng');

    disp(outName);
    close;
end