matplotlib-draggable-plot | An example of draggable plot for matplotlib | Data Visualization library
kandi X-RAY | matplotlib-draggable-plot Summary
kandi X-RAY | matplotlib-draggable-plot Summary
An example of draggable plot for matplotlib
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handle mouse click
- Find the nearest point to the point
- Update the plot
- Add a mouse point
- Remove a point
- Handles motion event
- Event handler for release events
matplotlib-draggable-plot Key Features
matplotlib-draggable-plot Examples and Code Snippets
Community Discussions
Trending Discussions on matplotlib-draggable-plot
QUESTION
I am building an interactive Tkinter GUI wherein a blank pyplot figure and axes are drawn in the GUI along with some buttons, where the user can click, drag, and delete points to form a custom point plot. The coordinates of these points can then be printed in a particular format used as Input in a much more complex Fortran code. I have gotten almost everything to work, except for the initial interactivity of the figure/axes space. I am heavily relying on a wonderful Draggable-Plot object code I found on GitHub by user yuma-m, link below:
https://github.com/yuma-m/matplotlib-draggable-plot/blob/master/draggable_plot.py
After much tweaking of the original Draggable-Plot object I was able to get the interactive plot integrated into my GUI; HOWEVER the bug comes in when I generate the plot for the first time. After setting the correct axes bounds, and clicking 'Update Axes' for the FIRST time, the figure and plot are drawn but do NOT register any MouseEvents. My guess is that when the event.inaxes in [self._axes]
condition is checked in the _on_click
function, the existence/placement of self._axes
is being blocked in some way.
The best part happens when you click the 'Update Axes' button a second time, and a new axes object is plotted directly below the first. When this occurs, the script will begin to register MouseEvents in the INITIAL plot, but will draw all corresponding points in the new SECOND plot. When I restrict the placement of the second plot in the same grid position as the first, no interactivity is registered, as I'm guessing the new axes overlaps the first.
I'm simply looking for a solution to this bizarre problem; obviously the ideal functionality of this GUI would be initial interactivity of the first generated plot, with any subsequently generated axes behaving the same. Thank you!
...ANSWER
Answered 2018-Jul-31 at 15:44Try changing your _init_plot() function to the following, seems to update a little better...
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install matplotlib-draggable-plot
You can use matplotlib-draggable-plot like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page