From 5960b77ff3d61167bc6b194014959954c2d81332 Mon Sep 17 00:00:00 2001 From: "Adrien F. Vincent" Date: Wed, 14 Feb 2018 16:26:01 -0800 Subject: [PATCH 1/2] typos --- lib/matplotlib/offsetbox.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 7340fb8c6d4e..96fe8dc73df8 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -1611,14 +1611,14 @@ class DraggableBase(object): helper code for a draggable artist (legend, offsetbox) The derived class must override following two method. - def saveoffset(self): + def save_offset(self): pass def update_offset(self, dx, dy): pass - *saveoffset* is called when the object is picked for dragging and it is - meant to save reference position of the artist. + *save_offset* is called when the object is picked for dragging and it + is meant to save reference position of the artist. *update_offset* is called during the dragging. dx and dy is the pixel offset from the point where the mouse drag started. From 8b73cb2270192cd7ed5b2a35b14e9de2aca43fd7 Mon Sep 17 00:00:00 2001 From: "Adrien F. Vincent" Date: Wed, 14 Feb 2018 17:06:02 -0800 Subject: [PATCH 2/2] fix draggable legend offset changes with dpi value --- lib/matplotlib/legend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index 08b5c45de1cf..7ab78c76a1bc 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -731,6 +731,7 @@ def _set_loc(self, loc): # value of the find_offset. self._loc_real = loc self.stale = True + self._legend_box.set_offset(self._findoffset) def _get_loc(self): return self._loc_real @@ -1002,7 +1003,6 @@ def _init_legend_box(self, handles, labels, markerfirst=True): children=[self._legend_title_box, self._legend_handle_box]) self._legend_box.set_figure(self.figure) - self._legend_box.set_offset(self._findoffset) self.texts = text_list self.legendHandles = handle_list