Is there a function or method in Matplotlib that will tell you which events have been connected, and perhaps what code is being called by that listener? I've looked all over, no joy. I'm looking preferably for a generic solution, not one that is backend specific, but I will take what I can get.
How to determine which events are connected in Matplotlib?
558 Views Asked by Phyzx1 At
1
There are 1 best solutions below
Related Questions in PYTHON-3.X
- Update a text file with ( new words+ \n ) after the words is appended into a list
- Kivy - Create new widget and set its position and size
- TypeError: encoding or errors without a string argument
- How to print varible name in python
- PyQt, Python 3: Lambda slot assigning signal argument to a variable?
- How to write data to stdin of the first process in a Python shell pipeline?
- pygame.draw.circle, still draws a square
- Duplicate Frames Created When Calling a Function in a Tkinter Application
- Python TypeError: can only concatenate tuple (not "int") to tuple
- recursively editing member variable: All instances have same value
- missing 1 required positional argument: 'key'
- How do I fix this sorting error?
- Dictionary values missing
- Why does opening a file in two different encodings work as expected?
- Binary bit flip generator in python
Related Questions in MATPLOTLIB
- How to use meshgrid with large arrays in Matplotlib?
- how to change matplotlib default figure location on screen
- Matplotlib does not display interactive graph in Ipython
- term frequency over time: how to plot +200 graphs in one plot with Python/pandas/matplotlib?
- how to use Pyplot module of matplotlib to plot two arrays of data
- Matplotlib 3d: surface does not cover a line
- Trying to get matplotlib/numpy to work. Have tried different solutions and out of ideas
- Using matplotlib.pyplot in iPython Notebook
- Matplotlib Table's Font Size
- Python3 embedding Matplotlib Plot inside GTK3 using Glade
- How can I draw a scatter plot with contour density lines in polar coordinates using Matplotlib?
- Pandas plot dataframe as scatter complains of unknown item
- A right way to represent 4 dimension points using colors in a matplotlib scatter
- Matplotlib disappearing plots multiple axis
- Direct chart plotting Pandas DataFrame columns to Xlsxwriter in a loop
Related Questions in EVENTS
- OpenLayer 3: Map pointer up event can not be triggered when the map created on overlay
- Angular scroll directive
- Setting multiple events in one ext.net button
- Detect if Application was suspended in OnNavigatedFrom for Windows Phone 8
- When in click a radio button, it scroll to the top. How to prenvent that?
- Event subscribed but null in child class (after threads initialize)
- How to get results each sec from "perf stat -d sleep 1000"
- How to register event for TextBox end editing
- Stop the installshield installation if a file is not found in vb.net
- How to capture the next event based on a condition
- Flask server to notify webclient when changes occur
- Google analytics event tracking, retrieve results
- What is the correct way to code event handlers for serializable model objects?
- Android version of NSNotificationCenter (event binding)
- Center JoptionPaneMessageDialog in parent element of the source element that generated the event
Related Questions in LISTENER
- Wait until Firebase retrieves data
- Add hyperlink onclick listener to JEditorPane
- Making JQuery function Plain JS
- Broadcast intent vs multicast listener implementation on Android
- JavaFX ScrollPane - Check which components are displayed
- How to use non-Part as - or similar to - ISelectionProvider?
- Create custom Dialog Listeners in Android
- How to Update JFrame Components?
- Why does listener activate twice?
- How to update a JLabel when a JLabel in another class updates?
- ORA-12505 :TNS listener does not currently know of SID given in connect descriptor
- GWT TextArea Event Listener
- The requested address is not valid in its context when I try to listen a port
- Symfony setting a cookie in a listener
- Only one usage of each socket address (protocol/network address/port) is normally permitted in c#
Related Questions in MATPLOTLIB-WIDGET
- 3d interactive graph won't update
- Save multiple supblots at once using tkinter/FigureCanvasTkAgg
- Making multiple multi-line plots from one matrix
- How to make class for onclick(event) functions for Interactive plot in matplotlib?
- How to set Matplotlib RadioButton radius using set_radius?
- How to update an imshow inside a ipywidgets layout?
- Interactive matplotlib plot in PySimpleGUI
- Struggling to get widgets working in python
- Using tKinter to read serial data - Python
- How to use a dropdown widget to highlight selected categorical variable in stacked bar chart?
- matplotlib slider not working when embedded in pyqt6 application
- How to use slider.on_changed() within a class in Tkinter in Python
- Matplotlib: mouse outside of slider axes continues to change plot
- Matplotlib not clearing old plots when updating figure
- Matplotlib button doesn't respond until moving cursor
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
In these situations, don't be afraid of the matplotlib codebase - it is quite reasonably pythonic and legible for the most part (with perhaps one or two skeletons here and there).
I'm going to talk you through the steps I'm going to take to understand what is going on and what you can get access to.
First off, start at a tagged version of matplotlib on GitHub - it will make all the links consistent (and not rot as code moves around). https://github.com/matplotlib/matplotlib/tree/v3.0.2
Our entry point is that we attach events through the
mpl_connectmethod. A quick search for this (using"def mpl_connect", including the quotes) in the matplotlib codebase turns up https://github.com/matplotlib/matplotlib/blob/v3.0.2/lib/matplotlib/backend_bases.py#L2134-L2180.So now we need to figure out what
self.callbacksactually is on this object. I did actrl+fto find the textself.callbacks =in this file. https://github.com/matplotlib/matplotlib/blob/v3.0.2/lib/matplotlib/backend_bases.py#L1621We are making progress now, and getting a little deeper each time :) Following the imports logically, we now need to find out what
matplotlib.cbook.CallbackRegistrylooks like. https://github.com/matplotlib/matplotlib/blob/v3.0.2/lib/matplotlib/cbook/init.py#L88.Specifically, we were calling the
CallbackRegistry.connectmethod: https://github.com/matplotlib/matplotlib/blob/v3.0.2/lib/matplotlib/cbook/init.py#L162-L177. Implementation at time of writing:Rather than trying to read all of that, I'm looking for public data structures (those that don't start with a
_) to see if there is anything I can query. It is starting to look likeCallbackRegistry.callbacksis a dictionary that maps event names to some form of collection containing those event functions.Indeed, this is supported by trying it out:
What is interesting is that in this particular case, I've personally only added one event handler (
button_press_event), but I've clearly got more events than that. What were seeing here is actually all of the events that are running in your backend too. Ever wondered how to disable some of those (like the keyboard shortcuts)? It is just a dictionary of events, and there is nothing stopping from just trashing them:If you want to get a reference to the underlying function, a little bit of introspection suggests you can do something like: