def format_axes(ax, labelsize=20, linewidth=1.4, length=6, lengthratio=0.5):
    """
    Adjust axes lines and ticks for optimum visibility.

    Parameters
    ----------
    ax : matplotlib.axes.Axes
        An Axes object on which to apply the formatting.
    labelsize : float, optional
        Fontsize of the tick labels. The default is 20.
    linewidth : float, optional
        Width in pt of the axes lines and ticks. The default is 1.4.
    length : float, optional
        Length in pt of the major ticks. The default is 6.
    lengthratio : float, optional
        Ratio of minor to major tick lengths. The default is 0.5.

    Returns
    -------
    ax : matplotlib.axes.Axes
        The modified Axes object.

    """
    ax.tick_params(axis='both', which='major', labelsize=labelsize, width=linewidth, length=length)
    ax.tick_params(axis='both', which='minor', labelsize=labelsize, width=linewidth, length=length*lengthratio)
    for axis in ['top','bottom','left','right']:
      ax.spines[axis].set_linewidth(linewidth)
    return ax