ax.spines['bottom'].set_bounds(20, 80)
for i in [0, -1]:
    ax.get_yticklabels()[i].set_visible(False)
ax.get_xticklabels()[i].set_visible(False)
for i in [0, -2]:
    ax.get_yticklines()[i].set_visible(False)
ax.get_xticklines()[i].set_visible(False)
Changing the length of axis lines in matplotlib