Skip to content

Commit

Permalink
Log pixel coordinates in event_handling coords_demo example
Browse files Browse the repository at this point in the history
  • Loading branch information
jatin837 committed Oct 20, 2021
1 parent df12d8c commit 8955d02
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/event_handling/coords_demo.py
Expand Up @@ -18,11 +18,12 @@


def on_move(event):
# get the x and y pixel coords
x, y = event.x, event.y
if event.inaxes:
# get the x and y pixel coords
x, y = event.x, event.y
ax = event.inaxes # the axes instance
print('data coords %f %f' % (event.xdata, event.ydata))
print('data coords %f %f, pixel coords %f %f'
% (event.xdata, event.ydata, x, y))


def on_click(event):
Expand Down

0 comments on commit 8955d02

Please sign in to comment.