开发者

pyplot.ginput() causes axes to change?

I am encountering some strange behavior with using the matplotlib.pyplot ginput() function to store clicked points. On the first click, the ranges of the axes of the clicked image change to add 200 on each side. The image remains with this border of whitespace until something new is plotted.

Example code:

import matplotlib.pyplot as plt
plt.imshow(im1)
x = plt.ginput(4)

On the first click of the mouse, the axes change from (0, imageWidth) and (0, imageHeight) to (-200, imageWidth+200) and (-200, imageHeight开发者_JAVA技巧+200).

The image itself is not affected in any way.

The same behavior occurs when ginput is called on the current figure.

Has anyone else encountered this? Any explanations? Fixes?


Try

plt.imshow(im1)
plt.axis('image')
x = plt.ginput(4)

I learned this here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜