def remove_border(axes=None, keep=('left', 'bottom'), remove=('right', 'top'), labelcol=ALMOST_BLACK):
    """
    Minimize chart junk by stripping out unnecessary plot borders and axis ticks.
    The top/right/left/bottom keywords toggle whether the corresponding plot border is drawn
    """
    ax = axes or plt.gca()
    for spine in remove:
        ax.spines[spine].set_visible(False)
    for spine in keep:
        ax.spines[spine].set_linewidth(0.5)
        # ax.spines[spine].set_color('white')

    # remove all ticks, then add back the ones in keep
    # Does this also need to specify the ticks' colour, given the axes/labels are changed?
    ax.yaxis.set_ticks_position('none')
    ax.xaxis.set_ticks_position('none')
    # ax.xaxis.set_ticklabels("")
    # ax.yaxis.set_ticklabels("")

    for spine in keep:
        if spine == 'top':
            ax.xaxis.tick_top()
        if spine == 'bottom':
            ax.xaxis.tick_bottom()
            # match the label colour to that of the axes
            ax.xaxis.label.set_color(labelcol)
            ax.xaxis.set_tick_params(color=labelcol, labelcolor=labelcol)
        if spine == 'left':
            ax.yaxis.tick_left()
            ax.yaxis.label.set_color(labelcol)
            ax.yaxis.set_tick_params(color=labelcol, labelcolor=labelcol)
        if spine == 'right':
            ax.yaxis.tick_right()

    return
Minimize chart junk by stripping out unnecessary plot borders and axis ticks.
    The top/right/left/bottom keywords toggle whether the corresponding plot border is drawn