Wie begrenzte ich Matplotlib button_press_event auf eine einzelne Achse?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie begrenzte ich Matplotlib button_press_event auf eine einzelne Achse?

by Anonymous » 03 Jun 2025, 11:53

Dieses Skript: < /p>

Code: Select all

import matplotlib.pyplot as plt
from matplotlib.widgets import Button

def fAccept(_):
print(f'accepted')

def onclick(event):
print(f'click  {event.xdata, event.ydata}')

fig, ax = plt.subplots()
fig.subplots_adjust(bottom=0.2)
fig.canvas.mpl_connect('button_press_event', onclick)
axAccept = fig.add_axes([0.7, 0.05, 0.1, 0.075])
bAccept = Button(axAccept, 'Accept')
bAccept.on_clicked(fAccept)
plt.show()
Zeigt

Top