Hi,
I’ve recently noticed that setting the y-tick locations on an image plot changes the y-axis limits, while changing the x-tick locations does not change the x-axis limits. I wouldn’t have expected either to change the axis limits, but it seems quite inconsistent that the y-axis and x-axis behave differently in this situation.
The axis limits are easily restored by a call to “ax.axis(‘image’)”, but this seems unnecessary.
A very quick search of the bug tracker doesn’t reveal anything matching this description…
Is this expected behavior or a bug?
As an example, setting the y-tick locations changes the y-axis limits:
import numpy as np
import matplotlib.pyplot as plt
num = 10
data = np.arange(num**2).reshape((num,num))
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.imshow(data)
ax.set_yticks(range(num//2))
fig.show()
However, setting the x-tick locations does not change the axis limits…
import numpy as np
import matplotlib.pyplot as plt
num = 10
data = np.arange(num**2).reshape((num,num))
fig = plt.figure()
ax = fig.add_subplot(111)
cax = ax.imshow(data)
ax.set_xticks(range(num//2))
fig.show()
As a reference, I’m running matplotlib 1.0.0 with python 2.7.0 on a 64-bit Linux (kernel 2.6.31) machine. I can confirm this on python 2.6 and matplotlib 0.99 as well, though.
If this isn’t expected behavior, I’ll be glad to open a bug report.
Thanks!
-Joe