matplotlib — interactively select points or locations?

前端 未结 3 1629
误落风尘
误落风尘 2020-12-24 02:40

In R, there is a function locator which is like Matlab\'s ginput where you can click on the figure with a mouse and select any x,y coordinate. In a

3条回答
  •  自闭症患者
    2020-12-24 03:07

    Wow many years have passed! Now matplotlib also support the ginput function which has almost the same API as Matlab. So there is no need to hack by the mpl-connect and so on any more! (https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.ginput.html) For instance,

    plt.ginput(4)
    

    will let the user to select 4 points.

提交回复
热议问题