X Tutup
Skip to content

Don't force anncoords to fig coords upon dragging.#6892

Merged
tacaswell merged 1 commit intomatplotlib:masterfrom
anntzer:keep-draggable-annotation-anncoords
Aug 4, 2016
Merged

Don't force anncoords to fig coords upon dragging.#6892
tacaswell merged 1 commit intomatplotlib:masterfrom
anntzer:keep-draggable-annotation-anncoords

Conversation

@anntzer
Copy link
Copy Markdown
Contributor

@anntzer anntzer commented Aug 3, 2016

See #6783.

Minimal example:

from matplotlib import pyplot as plt

plt.annotate("foo", (.5, .5),
            (15, 15), textcoords="offset points",
            arrowprops={"arrowstyle": "->"},
            bbox={"ec": "k"}).draggable()
plt.show()

Panning the axes shows that the annotation uses offset coordinates: it moves
"with" the point it points to. However, (before this patch is applied,) after
dragging the annotation somewhere else, it switches to figure coordinates: when
panning the axes, the text box stops physically moving; instead it's the arrow
that moves to follow the point.

The fix actually makes the code simpler...

Minimal example:

    from matplotlib import pyplot as plt

    plt.annotate("foo", (.5, .5),
                (15, 15), textcoords="offset points",
                arrowprops={"arrowstyle": "->"},
                bbox={"ec": "k"}).draggable()
    plt.show()

Panning the axes shows that the annotation uses offset coordinates: it moves
"with" the point it points to.  However, (before this patch is applied,) after
dragging the annotation somewhere else, it switches to figure coordinates: when
panning the axes, the text box stops physically moving; instead it's the arrow
that moves to follow the point.

The fix actually makes the code simpler...
ann.xyann = self.ox + dx, self.oy + dy
x, y = ann.xyann

def finalize_offset(self):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this just not used?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐑 I should read before commenting more often, this makes it fall back to the no-op baseclass implementation.

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Aug 4, 2016
@tacaswell
Copy link
Copy Markdown
Member

👍 Awesome when bug fixes remove code!

@tacaswell tacaswell modified the milestones: 2.0.1 (next bug fix release), 2.1 (next point release) Aug 4, 2016
@tacaswell tacaswell merged commit 0e1c687 into matplotlib:master Aug 4, 2016
@tacaswell tacaswell modified the milestones: 2.1 (next point release), 2.0.1 (next bug fix release) Aug 4, 2016
tacaswell added a commit that referenced this pull request Aug 4, 2016
…ords

FIX: Don't force anncoords to fig coords upon dragging.
@tacaswell
Copy link
Copy Markdown
Member

backported to v2.x as 06feaf6 (you can tell I was on the fence about this my the re-re-re-(..) milestoning.

@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Aug 4, 2016

the re-re-re-(..) milestoning

Then why is it 2.0.1 and not 2.0 when it's already backported?

@tacaswell
Copy link
Copy Markdown
Member

Without really discussing it with anyone I have been using 2.0 -> blocking 2.0.1 -> can be backported, but not blocking.

@anntzer anntzer deleted the keep-draggable-annotation-anncoords branch August 4, 2016 03:52
@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Aug 4, 2016

OK, but that makes things confusing when 2.0.0 is released and stuff on the 2.0.1 milestone needs to be backported. Unless nothing is really supposed to be on the 2.0.1 milestone without a backport?

Also, I've been moving this to 2.0 anyway, so maybe that distinction has been lost a bit already...

@jenshnielsen
Copy link
Copy Markdown
Member

Everything on the 2.0.1 milestone needs to land on the 2.x branch either via direct merge to 2.x or backport otherwise it can't go into 2.0.1 The only difference as I see it is that 2.0.1 stuff does not need to land before we release 2.0.0

@QuLogic
Copy link
Copy Markdown
Member

QuLogic commented Aug 4, 2016

Yes, of course, but the question is, when it's already on 2.x, should it be tagged 2.0.1?

@QuLogic QuLogic modified the milestones: 2.0 (style change major release), 2.0.1 (next bug fix release) Aug 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

X Tutup