Skip to content

FIX: DPI inconsistency of draggable legend #10469

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down