import numpy as np import matplotlib.pyplot as plt fig, ax = plt.subplots() x = np.linspace(0, np.pi*4, 100) y = np.cos(x) + np.sin(x) ax.plot(x, y) ax.spines.right.set_visible(False) ax.spines.top.set_visible(False) ax.spines.bottom.set_bounds(0, np.pi*4)