Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ENH: allow changing the Axes sort order for event handling#2986

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

Closed
efiring wants to merge2 commits intomatplotlib:masterfromefiring:swap_active_axes

Conversation

efiring
Copy link
Member

Previously, when a second axes is created using twinx, for example,
that axes catches all events; cursor position is shown based on
that axes, etc. The Figure.swap_axes_order() method allows one to
exchange the sorting indices of the two axes, so that the first
axes can process events instead of the second one.

@efiring
Copy link
MemberAuthor

I realize this will need a whats_new entry etc., but I want to first find out whether anyone sees any problem with this approach.
If not, a possible addition would be to add a kwarg to twinx and twiny to control whether this swapping occurs automatically.

@cimarronm
Copy link
Contributor

LGTM 👍

@tacaswell
Copy link
Member

I think this looks like a fine way to do this.

@tacaswelltacaswell added this to thev1.4.0 milestoneApr 19, 2014
Previously, when a second axes is created using twinx, for example,that axes catches all events; cursor position is shown based onthat axes, etc. The Figure.swap_axes_order() method allows one toexchange the sorting indices of the two axes, so that the firstaxes can process events instead of the second one.
This changeset also handles swapping patch visibility.
@efiring
Copy link
MemberAuthor

This is getting close to being ready, based on the present approach, but it raises some questions. The main problem is that the Axes stack order determines which Axes gets the mouse events, and it also determines the order in which Axes are drawn--unless one overrides this with Axes zorder. Typically this is not done, so swapping Axes requires swapping their positions in the stack,and swapping the visibility attribute of their patches. In the second changeset, I added that functionality to swap_axes_order. This will not be the desired result, however, if zorder is being used to determine the Axes drawing order; in that case, for shared axes, only the one with the lowest zorder should have a visible patch.
This fragile coupling between drawing order and mouse event order is awkward and confusing.

@tacaswell
Copy link
Member

This may be a dumb question (I have not dug around in this section of the code recently), but why don't we just raise mouse events for all axes that the mouse is in and let the event handlers sort out if they want to handle the event?

@efiring
Copy link
MemberAuthor

I think that would be even harder to manage; for example, how would you determine what gets displayed in the cursor position readout?
(Travis failures look odd, but unrelated.)

@tacaswell
Copy link
Member

I would want display the location inall of the axes that the cursor is in.

I think that could be done tacking an extra dict on to the canvas object and makingmouse_move a bit smarter.

martinbuc reacted with thumbs up emoji

@efiring
Copy link
MemberAuthor

On 2014/05/04 11:14 AM, Thomas A Caswell wrote:

I would want display the location in /all/ of the axes that the cursor
is in.

That would require a different scheme for fitting them into the window,
and for labeling them. The readout region would have to expand
vertically to make room; one would want them in a stack. All doable,
but it would mean changing all interactive backends. I agree that it
might be a nice improvement.

@tacaswell
Copy link
Member

My thought was much lazier, either ask the axes object their gid or just label them sequentially and keep them all on one line:

ax1: format_coord(...) | ax2: format_coord(...)

I don't think this would require touching anything outside of backend_bases.py

@efiring
Copy link
MemberAuthor

I'm reluctant to include this in 1.4 because it sounds like you might have a better approach,@tacaswell . I don't want to introduce an API change unless we are confident that it is what we want for the long term.

@tacaswelltacaswell modified the milestones:v1.5.x,v1.4.0Jun 1, 2014
@tacaswell
Copy link
Member

Fair enough. I re-tagged this issue.

@blink1073
Copy link
Member

It looks like you could useax._shared_x_axes.get_siblings(ax) andax._shared_y_axes.get_siblings(ax) inmouse_move and add messages for all siblings.

@tacaswelltacaswell modified the milestones:proposed next point release,next point releaseFeb 19, 2015
@efiring
Copy link
MemberAuthor

Looks like it's time to abandon this one.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v1.5.0
Development

Successfully merging this pull request may close these issues.

4 participants
@efiring@cimarronm@tacaswell@blink1073

[8]ページ先頭

©2009-2025 Movatter.jp