-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Get the z coord in event #11309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Could you include the full traceback, please?
…On Fri, May 25, 2018 at 7:39 AM, mko010 ***@***.***> wrote:
Bug report
*Bug summary*
Matplotlib doesn´t allow get the z coord as event.zdata
*Code for reproduction*
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from tkinter import *
f = Figure()
sagital = f.add_subplot(111)
canvas = FigureCanvasTkAgg(f, master=root)
canvas.get_tk_widget().pack(side=Tk.RIGHT, fill=Tk.BOTH, expand=1)
toolbar = NavigationToolbar2TkAgg(canvas, root)
toolbar.update()
canvas._tkcanvas.pack(side=Tk.RIGHT, fill=Tk.BOTH, expand=1)
def _onclick(event):
coords.append((event.xdata, event.ydata, event.zdata))
return coords
canvas.mpl_connect('button_press_event', _onclick)
canvas.show()
Tk.mainloop()
*Actual outcome*
TypeError: () missing 1 required positional argument: 'z'
# If applicable, paste the console output here
#
#
*Expected outcome*
*Matplotlib version*
- Operating system: Windows 10
- Matplotlib version: 2.2.2
- Matplotlib backend (print(matplotlib.get_backend())):
- Python version: 3.5
- Jupyter version (if applicable):
- Other libraries:
I have installed matplotlib from pip and python from source.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11309>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AARy-MWNzOVjs0Ik-L00YqjpSFc3EvsMks5t1-2LgaJpZM4UN1Fj>
.
|
[timhoffm edited: use blockqoute for better readability] |
Ok, the traceback shows that the problem isn't with _onclick(), it is
mouse_move. Also, the code for reproduction is incomplete. The FIgure class
is never imported and it seems like you are dealing with axes3d objects,
but you never specify them. I think the problem lies somewhere in how you
are constructing your figure and event handling, but I can't tell without a
true minimal working example demonstrating the problem.
…On Sat, May 26, 2018 at 9:54 AM, mko010 ***@***.***> wrote:
Traceback (most recent call last):
File "C:\Users\migue\Documents\IM\TFG\venv\lib\site-packages\
matplotlib\cbook_*init*_.py", line 388, in process
proxy(*args, **kwargs)
File "C:\Users\migue\Documents\IM\TFG\venv\lib\site-packages\
matplotlib\cbook_*init*_.py", line 228, in *call*
return mtd(*args, **kwargs)
File "C:\Users\migue\Documents\IM\TFG\venv\lib\site-packages\matplotlib\backend_bases.py",
line 2888, in mouse_move
s = event.inaxes.format_coord(event.xdata, event.ydata)
TypeError: () missing 1 required positional argument: 'z'
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11309 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-GoMc7__5fJe9TJKd1IQzHOOD9hVks5t2V6hgaJpZM4UN1Fj>
.
|
there the complete code
|
I guess the question is why would you expect the MouseEvent to have an attribute In the limit this could be understood as a feature request to use the 3D projection and make such attribute available, similar to how the |
Well, I need the x, y and z data, from navigation toolbar for draw that points into the image, then How can I do that? |
One possible option is shown in this Stackoverflow question. A cleaner solution would of course simply replicate the code from |
But that solution use a fig.gca, and I need use subplots, because otherwise Orthoslicer doesn't work |
You can replace |
That |
|
Note that the matplotlib issue tracker is not a personal help desk. If you think that there is a bug in matplotlib, a minimal runnable example is required. As said, this issue can be kept open as a wishlist/feature request for a "projected" |
I know and I'm sorry |
The mailing list might be a better place to continue this discussion.
…On Wed, May 30, 2018 at 6:08 AM, mko010 ***@***.***> wrote:
I know and I'm sorry
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11309 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-AHZxbPguAr8G5PwWyr11kZ02aXMks5t3m-GgaJpZM4UN1Fj>
.
|
True and thanks |
Bug report
Bug summary
Matplotlib doesn´t allow get the z coord as event.zdata
Code for reproduction
Actual outcome
TypeError: () missing 1 required positional argument: 'z'
Expected outcome
Matplotlib version
print(matplotlib.get_backend())
):I have installed matplotlib from pip and python from source.
The text was updated successfully, but these errors were encountered: