def _lrbt(lrbt, w, h):
    """Calculate coordinate system limits"""
    n = len(lrbt)
    if n < 4:
        if not isinstance(lrbt, list):
            lrbt = list(lrbt)
        dy = h * (lrbt[1] - lrbt[0]) / w
        if n == 2:
            dy /= 2
            lrbt = lrbt + [-dy, dy]
        else:
            lrbt = lrbt + [lrbt[2] + dy]
    else:
        lrbt = lrbt[:4]
    return lrbt
