From: Nikolaus R. <Nik...@ra...> - 2010-10-30 20:16:10
|
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 |