This thread: Changing the "tick frequency" on x or y axis in matplotlib? answers how to set the tick spacing to a particular value. I do not want to specify what this spacing should be, but I would like the same spacing to be used on both axis without manually telling matplotlib what these ticks should be.
What I am doing now:
Data:
x = np.linspace(0,5,100)
y = np.sin(x)+np.random.normal(size = len(x))*0.1
Plot:
plt.figure(figsize=(10,10))
plt.plot(x,y)
plt.xticks(np.arange(min(x), max(x)+1, 1.0)); # I don't want to be doing this
plt.yticks(np.arange(min(y), max(y)+1, 1.0)); # I don't want to be doing this
plt.gca().set_aspect('equal')
This solution is rather inconvinient, because it requires me to manually set the spacing.
How can I tell matplotlib to select equal tick spacing for both axes?