Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 656ef67

Browse files
authored
Merge pull request #10469 from afvincent/draggable_offset
FIX: DPI inconsistency of draggable legend
2 parents 5d30d6a + 8b73cb2 commit 656ef67

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ def _set_loc(self, loc):
731731
# value of the find_offset.
732732
self._loc_real = loc
733733
self.stale = True
734+
self._legend_box.set_offset(self._findoffset)
734735

735736
def _get_loc(self):
736737
return self._loc_real
@@ -1002,7 +1003,6 @@ def _init_legend_box(self, handles, labels, markerfirst=True):
10021003
children=[self._legend_title_box,
10031004
self._legend_handle_box])
10041005
self._legend_box.set_figure(self.figure)
1005-
self._legend_box.set_offset(self._findoffset)
10061006
self.texts = text_list
10071007
self.legendHandles = handle_list
10081008

lib/matplotlib/offsetbox.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,14 +1611,14 @@ class DraggableBase(object):
16111611
helper code for a draggable artist (legend, offsetbox)
16121612
The derived class must override following two method.
16131613
1614-
def saveoffset(self):
1614+
def save_offset(self):
16151615
pass
16161616
16171617
def update_offset(self, dx, dy):
16181618
pass
16191619
1620-
*saveoffset* is called when the object is picked for dragging and it is
1621-
meant to save reference position of the artist.
1620+
*save_offset* is called when the object is picked for dragging and it
1621+
is meant to save reference position of the artist.
16221622
16231623
*update_offset* is called during the dragging. dx and dy is the pixel
16241624
offset from the point where the mouse drag started.

0 commit comments

Comments
 (0)