how to limit matplotlib range code example Example 1: plot bounds python plt.xlim([25, 50]) Example 2: plot bounds python ax.set_ylim([-1, 0])