From 8955d02c56b3ae502b5b48e2b4bde818701dfe92 Mon Sep 17 00:00:00 2001 From: dj4t9n Date: Wed, 20 Oct 2021 13:12:50 +0530 Subject: [PATCH] Log pixel coordinates in event_handling coords_demo example --- examples/event_handling/coords_demo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/event_handling/coords_demo.py b/examples/event_handling/coords_demo.py index 4bfb49518ef5..171ec6317d2c 100644 --- a/examples/event_handling/coords_demo.py +++ b/examples/event_handling/coords_demo.py @@ -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):