set x range in matplotlib code example Example: set axis plt python from matplotlib import pyplot as plt plt.axis([0, 10, 0, 20])