def hide_axis(plt=None, ax=None, x_or_y=None, remove_gridlines=False,
    remove_labels=False):
    """
    Removes axis of a Matplotlib plot.
    
    Parameters
    ----------
    plt : matplotlib figure
        The figure to modify. N.B. Either plt or ax can be specified,
        not both.
    ax : matplotlib axis
        The axis to modify. N.B. Either plt or ax can be specified,
        not both.
    x_or_y : str
        The x or y coordinates to modify.
    remove_gridlines : bool, optional, default = False
        Specify whether to fully hide the x or y axis. If set to False 
        then just the tick labels are hidden and not the ticks 
        themselves.
    
    References
    ----------
    Stackoverflow : Hiding axis text in matplotlib plots
    """
    if plt is None and ax is None:
        raise ValueError('[gu.hide_axis]: Must specify either plt or ax plots.'
            )
    if plt is not None and ax is not None:
        raise ValueError(
            '[gu.hide_axis]: Can only specify either plt or ax, not both.')
    if x_or_y is None:
        raise ValueError("[gu.hide_axis]: x_or_y only takes either 'x' or 'y'."
            )
    if plt is not None:
        ax = plt.gca()
    if x_or_y == 'x':
        if remove_gridlines:
            ax.axes.get_xaxis().set_ticks([])
        elif not remove_gridlines:
            ax.axes.get_xaxis().set_ticklabels([])
        else:
            raise ValueError(
                'remove_gridlines is a boolean parameter and accepts either True or False'
                )
        if remove_labels:
            ax.set_xlabel('')
    elif x_or_y == 'y':
        if remove_gridlines:
            ax.axes.get_yaxis().set_ticks([])
        elif not remove_gridlines:
            ax.axes.get_yaxis().set_ticklabels([])
        else:
            raise ValueError(
                'remove_gridlines is a boolean parameter and accepts either True or False'
                )
        if remove_labels:
            ax.set_ylabel('')
    else:
        raise ValueError("x_or_y only takes either 'x' or 'y'.")
    return
