How to change the range of the x-axis and y-axis in matlibplot?
Use first xticks and yticks before xlim and ylim. This will create an array before it sets the limit
To change the axes range, you can use
plt.xlim([-3, 3])
plt.ylim([-3, 3])
You will then have to remove the line plt.axis('scaled')
for this to work.
import numpy as np
import matplotlib.pyplot as plt
import scipy, pylab
plt.axes()
circle=plt.Circle((0, 0), radius=1, fc='w')
plt.gca().add_patch(circle)
plt.xlim([-3, 3])
plt.ylim([-3, 3])
plt.yticks(np.arange(-3, 3, 0.25))
plt.xticks(np.arange(-3, 3, 0.25))
plt.show()