Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Change cursor when hovering over draggable artists#25412
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
greglucas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is nice to know that you can interact with the component 👍
Uh oh!
There was an error while loading.Please reload this page.
greglucas commentedMar 11, 2023
I was using the code from#25428 (comment) to test this. importmatplotlib.pyplotaspltplt.plot(range(5),label='bob')leg=plt.legend()leg.set_draggable(True,update='bbox')plt.show() |
QuLogic commentedMar 14, 2023
Maybe this should get a |
daniilS commentedMar 22, 2023
@greglucas , I had a look at the macosx issue, and this is what's going on:
I think the solution might be for the macosx backend's On a related note,@QuLogic, should |
greglucas commentedJun 2, 2023
@daniilS lets keep the macosx issues discussed in the linked PR for that. I think this is a useful addition still and just needs a rebase at this point. |
QuLogic commentedJun 24, 2023
I think you might need to rebase, as there seems to be some extra commits here. We have some instructions for that here:https://matplotlib.org/devdocs/devel/development_workflow.html#rewriting-commit-history |
80b0af1 to8ce6c89ComparedaniilS commentedJul 7, 2023
Fixed the rebase. However, I found that this PR reveals a different issue with importmatplotlib.pyplotaspltline=plt.plot(range(3),label="line")[0]leg=plt.legend(draggable=True,loc="upper center",fontsize="xx-large",mode="expand")plt.show(block=False)plt.pause(1)plt.clf()plt.show()# cursor still changes when hovering over the top of the figure I think a hook should be added somewhere to call draggable_bug.webm |
anntzer commentedJul 24, 2023
Perhaps _Axes._remove_legend? (via _legend._remove_method) |
d76c7d9 to0bcfe16ComparedaniilS commentedJul 25, 2023
@anntzer thanks, that pointed me towards what I think is the right place! It looks to me like the best solution is to deparent the legend together with other artists in |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Co-Authored-By: Elliott Sales de Andrade <quantum.analyst@gmail.com>
| ifnot ( | ||
| self._check_still_parented() | ||
| andself.canvas.widgetlock.available(self) | ||
| andself.ref_artist.pickable() | ||
| ): | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is the logic correct? Ifself.ref_artist.pickable() is False, we return. That means we never reach the originalif self.got_artist: branch.
PR Summary
Currently, there's no visual indication that an artist is draggable. This sets the cursor to
Cursors.MOVEwhen the mouse is hovering over aDraggableBaseinstance which can be picked.A possible addition would be to set the widget lock in
on_pick()untilon_release(), which would prevent other draggables/widgets/toolbar modes from being active at the same time, but I wasn't sure if there is a reason thatwidgetlockisn't already being used.draggable.legend.webm