Here is my code:
x = np.arange(-10, 10, 0.1) y = np.cos(x) f = plt.figure() ax = f.add_subplot(1, 1, 1) ax.spines[\'left\'].set_position(\'center\') ax.spines[\'