Q:

Matplotlib: Curve touches axis boudary. How to solve this?

I drew this graph using matplotlib using the following code.
import matplotlib
import matplotlib.pyplot as plt

x = [450.0, 450.0, 438.0, 450.0, 420.0, 432.0, 416.0, 406.0, 432.0, 400.0]
y = [328.90000000000003, 327.60000000000031, 305.90000000000146, 285.2000000000013, 276.0, 264.0, 244.0, 236.0, 233.5, 236.0]
z = [2,4,6,8,10,12,14,16,18,20]

plt.plot(z,x,'-',lw=3)
plt.plot(z,y,'--',lw=3)
plt.show()

As you can see the graph of x touches the axis boundary and does not look good. How can I change this?

A:

Use axis:
plt.plot(z,x,'-',lw=3)
plt.plot(z,y,'--',lw=3)
plt.axis([2,20,100,500])
plt.show()

Or, use ylim:
plt.ylim([100,500])

