How to set xlim and ylim for a subplot in matplotlib [duplicate]

I would like to limit the X and Y axis in matplotlib for a specific subplot.
The subplot figure itself doesn’t have any axis property. I want for example to change only the limits for the second plot:

import matplotlib.pyplot as plt
fig=plt.subplot(131)
plt.scatter([1,2],[3,4])
fig=plt.subplot(132)
plt.scatter([10,20],[30,40])
fig=plt.subplot(133)
plt.scatter([15,23],[35,43])
plt.show()

1 Answer
1

Leave a Comment