def axisRange(staPhaList,plotPhase,xOffsets,yOffsetRatios):
    """
    Get the axis range for tele waveform plot
    """
    minP = staPhaList[0][1]
    maxP = staPhaList[-1][1]
    minS = staPhaList[0][2]
    maxS = staPhaList[-1][2]
    minDist = staPhaList[0][3]
    maxDist = staPhaList[-1][3]

    ystart = minDist-yOffsetRatios[0]*(maxDist-minDist+0.1)                        
    yend = maxDist+yOffsetRatios[1]*(maxDist-minDist+0.1)

    if plotPhase == "P":
        xstart = minP+xOffsets[0]
        xend = maxP+xOffsets[1]

    elif plotPhase == "S":
        xstart = minS+xOffsets[0]
        xend = maxS+xOffsets[1]

    elif plotPhase == "PS":
        xstart = minP+xOffsets[0]
        xend = maxS+xOffsets[1]
    else:
        raise Exception(f"'plotPhase' parameter {plotPhase} not in ['P','S','PS']")
        
    return xstart,xend,ystart,yend