Python Matplotlib MouseEvent xy vs. xydata -
i working on project make mouse click interactive pixel map (created pyplot) using python 3.4 , matplotlib 1.4.3. using matplotlib.backend_bases.mouseevent class make figure interactive. i'm getting started, , far have:
# define on_click() function print event data upon mouseclick def on_click(event): """print event data on mouseclick""" print(event)
when click on figure, here's kind of output get:
mpl mouseevent: xy=(289,265) xydata=(24.5956632653,21.9489795918) button=1 dblclick=false inaxes=axes(0.141923,0.1;0.603077x0.8)
can tell me xy part means? it's 50x50 pixel map, xydata pixel position of mouse click.
it position left , bottom of canvas
, respectively.
here documentation:
the following attributes
x
- x position - pixels left of canvas
y
- y position - pixels bottom of canvas
canvas
-figurecanvas
instance generating event
Comments
Post a Comment