return the average (x,y) for a set of multiple x,y arrays
    which can have a different length and resolution

    data = ((xvals,yvals),(),,,)
    assumes that x values are sorted

def avgMultiplePlots(data, calc_mean=True, calc_std=False,
                     calc_density=False, nsample=None):
    """
    return the average (x,y) for a set of multiple x,y arrays
    which can have a different length and resolution

    data = ((xvals,yvals),(),,,)
    assumes that x values are sorted
    """
    xArr, yArr = bringPlotOverSameX(data, nsample)
    out = [xArr]
    if calc_mean:
        out.append(np.nanmean(yArr, axis=0))
    if calc_std:
        out.append(np.nanstd(yArr, axis=0))
    if calc_density:
        out.append(len(yArr) - np.isnan(yArr).sum(axis=0))
    return tuple(out)