[Matplotlib-users] confused with name of certain events

Benjamin Root ben.v.root at gmail.com
Tue Nov 7 17:33:46 EST 2017


Jose,

First, bonus points for your excellent use of f-strings!

You are right. It is an odd inconsistency that I sort of noticed when I
wrote my book. The 'figure_enter_event' is of type "Event", so its name
falls back to the default of itself. Meanwhile, all of the other
enter/leave events are of type LocationEvent, which have different default
names.

Not sure if this is something that warrants fixing or not. We don't have
really good documentation for the event system anyway, but this has been
this way for a very long time.

What do you think? How is it impacting your use-case?

Cheers!
Ben Root


On Tue, Nov 7, 2017 at 5:19 PM, Jose Borreguero <borreguero at gmail.com>
wrote:

> Dear Matplotlib gurus,
>
> The following example prints the event.name
> for two events: ​
> 'figure_enter_event' and 'axes_enter_event':
>
> from __future__ import print_function
> import matplotlib.pyplot as plt
> fig, ax = plt.subplots()
> fig.canvas.mpl_connect('figure_enter_event',
>                        lambda event: print(f'enter figure: {event.name}'))
> fig.canvas.mpl_connect('axes_enter_event',
>                        lambda event: print(f'enter axes: {event.name}'))
> plt.show()
>
> This is what I get
> ​when ​
> hovering the mouse
> ​ over the canvas:​
>
> enter figure: figure_enter_event
> enter axes: motion_notify_event
> enter figure: figure_enter_event
> enter axes: motion_notify_event
>
> What is the reason for 'motion_notify_event' being the assigned name to
> axes_enter_event but not figure_enter_event
> ​ ?
>
> Best,
> .Jose​
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20171107/77d447ee/attachment.html>


More information about the Matplotlib-users mailing list