From: Joe K. <jki...@wi...> - 2010-08-20 22:18:22
|
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 |
From: Eric F. <ef...@ha...> - 2010-08-21 08:13:53
|
On 08/20/2010 12:18 PM, Joe Kington wrote: > 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. It's a bug. I think I have it fixed, but I need to do some more testing, so I won't commit anything tonight. Eric > > Thanks! > -Joe > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Eric F. <ef...@ha...> - 2010-08-21 18:35:10
|
On 08/20/2010 12:18 PM, Joe Kington wrote: > 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. Joe, Thanks for the report. The fix is in svn 8652 and 8653. Eric > > Thanks! > -Joe |
From: Joe K. <jki...@wi...> - 2010-08-21 19:32:18
|
Thanks for the amazingly quick turnaround! -Joe On Sat, Aug 21, 2010 at 1:34 PM, Eric Firing <ef...@ha...> wrote: > On 08/20/2010 12:18 PM, Joe Kington wrote: > > 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. > > Joe, > > Thanks for the report. The fix is in svn 8652 and 8653. > > Eric > > > > > Thanks! > > -Joe > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by > > Make an app they can't live without > Enter the BlackBerry Developer Challenge > http://p.sf.net/sfu/RIM-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |