0
저는 Python과 Tkinter로 프로젝트를하고 있습니다. 데이터 배열을 플롯 할 수 있고 마우스로 클릭하면 플롯에 주석을 추가하는 기능을 구현했지만 지금은 내가 추가 한 모든 주석 목록이 필요합니다. 그걸 가질 수있는 방법이 있습니까? 이 추가 내 기능입니다 주석 :MatplotLib 축별 모든 주석 얻기
def onclick(self, event):
clicked = []
key = event.key
x = event.xdata
y = event.ydata
x_d = min(range(len(self.x_data)), key=lambda i: abs(self.x_data[i] - x))
local_coord = self.x_data[x_d - 6:x_d + 6]
x_1 = max(local_coord)
indx = np.where(self.x_data == x_1)[0][0]
y_1 = self.y_data[indx]
if key == "v":
self.ax.annotate("{0}nm".format(int(x_1)), size=25,
bbox=dict(boxstyle="round",fc="0.8"),
xy=(x_1, y_1), xycoords='data',
xytext=(x_1, y_1+50), textcoords='data',
arrowprops=dict(arrowstyle="-|>",
connectionstyle="bar,fraction=0",
))
self.canvas.draw()
대단히 감사합니다. 내가 찾던 것이 었습니다. –