Setting tick labels for matshow

Hello,

I am trying to set tick labels for a matshow plot. This works just fine
if I only work on the X axis:

    res = np.diag(np.arange(10)) # dummy data
    modes = [ (x+1, 0) for x in range(5) ] # dummy data
    
    fig = plt.figure()
    ax = fig.add_subplot(111)
    cs = ax.matshow(res)
    fig.colorbar(cs, ticks=np.arange(0,-10,-1), shrink=0.8)
    ax.set_xticklabels(['%d/%d' % (x[1], x[0]) for x in modes])
    ax.set_xticks(2*np.arange(len(modes))+0.5)

but if I try to do the same think with the Y axis, everything looks
messed up (e.g. the matrix is no longer square):

    ax.set_yticklabels(['%d/%d' % (x[1], x[0]) for x in modes])
    ax.set_yticks(2*np.arange(len(modes))+0.5)

What am I doing wrong?

Thanks,

   -Nikolaus

···

--
»Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C

From: Nikolaus Rath [mailto:Nikolaus@…3072…]
Sent: Saturday, October 30, 2010 16:17

but if I try to do the same think with the Y axis, everything looks
messed up (e.g. the matrix is no longer square):

The matrix remains square for me using a build from Subversion. What's your
matplotlib.__version__?