0
当您使用imshow绘制窗口右下角的图像时,会出现光标坐标。然而,当我尝试设置蜱和蜱轴的标签窗口停止显示坐标和仅显示“X = Y =”Matplotlib imshow:指定刻度时光标坐标失败
最少例如:
import matplotlib.pyplot as plt
import numpy as np
d = np.random.rand(100, 100)
fig = plt.figure()
ax = plt.gca()
plt.imshow(d)
# If I comment this I get coordinates in the bottom right,
# but after setting the ticks I only get "x= y="
ax.set_xticks([0, 25, 50, 75, 100])
ax.set_xticklabels([0, 0.25, 0.5, 0.75, 1])
ax.set_yticks([0, 25, 50, 75, 100])
ax.set_yticklabels([0, 0.25, 0.5, 0.75, 1])
fig.show()
raw_input()
这将显示数据的随机地图和将刻度标签设置为从0到1,但右下角的光标坐标仅显示“x = y =”。
是否有任何方法让坐标显示在由滴答定义的新单位中?我认为这与设置坐标轴的变换有关,但我无法弄清楚。