import matplotlib.pyplot as plt

ax = plt.axes()
line1, = ax.plot([0, 1, 2, 1.5], [3, 1, 2, 4])
ax.set_xlim(0.5, 2)
ax.set_ylim(1, 5)
plt.show()

"""
Explanation: Previous example:
ax = plt.axes()
line1, = ax.plot([0, 1, 2, 1.5], [3, 1, 2, 4])
plt.show()

Exercise 2: Modify the previous example to produce three different figures that control the limits of the axes by:
1. Manually setting the x and y limits to $[0.5, 2]$ and $[1, 5]$ respectively.
End of explanation
"""


ax = plt.axes()
line1, = ax.plot([0, 1, 2, 1.5], [3, 1, 2, 4])
ax.margins(0.1)
plt.show()

"""
Explanation: 2. Defining a margin such that there is 10% whitespace inside the axes around the drawn line. (Hint: numbers to margins are normalised such that 0% is 0.0 and 100% is 1.0.)
End of explanation
"""


ax = plt.axes()
line1, = ax.plot([0, 1, 2, 1.5], [3, 1, 2, 4])
ax.margins(0.1)
ax.set_ylim(bottom=0)
plt.show()

"""
Explanation: 3. Setting a 10% margin on the axes with the lower y limit set to 0. (Note: order is important here.)
End of explanation
"""


