Setting y-tick locations on an image plot changes y-axis limits, Bug or expected behavior?

Thanks for the amazingly quick turnaround!
-Joe

···

On Sat, Aug 21, 2010 at 1:34 PM, Eric Firing <efiring@…202…> 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

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users