def update2Dlines(iline, x, y):
    """
    provide a common interface to update objects on the plot to a new position (x,y) depending
    on whether they are hlines, vlines, dots etc

    Parameters
    ----------

    iline: :obj:`matplotlib.lines.Line2D` object

    x : float with new position

    y : float with new position

    """
    if not hasattr(iline, 'whatisthis'):
        raise AttributeError(
            "This method will only work if iline has the attribute 'whatsthis'"
            )
    elif iline.whatisthis in ['dot']:
        iline.set_xdata(x)
        iline.set_ydata(y)
    elif iline.whatisthis in ['lineh']:
        iline.set_ydata((y, y))
    elif iline.whatisthis in ['linev']:
        iline.set_xdata((x, x))
    else:
        raise TypeError('what is this type of 2Dline?')
