function plotFracWalking(sumWalk, nonSumWalk, siRunning, nsiRunning, numHours, expDir, var, expName)
    figure;
    hold on;
    window = 15; % sliding window size, in minutes
    colors = matlabColors;

    sPlot = smoothdata(nansum(sumWalk)./siRunning,'movmean',3600*3*(window/60));
    nsPlot = smoothdata(nansum(nonSumWalk)./nsiRunning,'movmean',3600*3*(window/60));
    sPlot(isnan(sPlot)) = 0;
    nsPlot(isnan(nsPlot)) = 0;

    sE = smoothdata(nanstd(sumWalk)./sqrt(siRunning),'movmean',3600*3*(window/60));
    nsE = smoothdata(nanstd(nonSumWalk)./sqrt(nsiRunning),'movmean',3600*3*(window/60));
    sE(isnan(sE)) = 0;
    nsE(isnan(nsE)) = 0;

    % Plot mean/median +/- SE for each group
    areaBar(1:length(sPlot),sPlot,sE,colors{3},colors{3},'-',0.1);
    areaBar(1:length(nsPlot),nsPlot,nsE,colors{2},colors{2},'-',0.1);

    set(gca,'xtick',0:3600*3:length(sumWalk),'xticklabel',0:1:length(sumWalk)/(3600*3));
    xlim([1 numHours*3600*3]);
    xlabel("Time since first movement (hours)");
    ylabel('Fraction of flies walking');
    
    if strcmp(var,'Speed')
        %ylim([0 0.4]);
    else
        ylim([0 1]);
    end

    yyaxis right;
    plot(siRunning,'Color',colors{3},'LineStyle','--');
    plot(nsiRunning,'Color',colors{2},'LineStyle','--');
    ylabel('Number of flies tracked','Color',[0 0 0]);
    set(gca,'YColor',[0 0 0]);
    ylim([0 max(horzcat(nsiRunning,siRunning))+1]);

    legend({strcat('Summit, N = ',num2str(max(siRunning))),strcat('Non-summit, N = ',num2str(max(nsiRunning))),"Tracked S","Tracked NS"},'Location','Best');

    title([expName,"Fraction Walking"]);
    set(gcf,'PaperUnits','inches','PaperPosition',[0 0 7.5 6]);
    outName = strcat(expDir,var,'-fraction flies walking (',num2str(window),' min window)','-',num2str(numHours));
    print(outName,'-dpng');  
    close;
end