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

Skip to content

Commit 80beedf

Browse files
author
anykraus
committed
re-generate legend: re-use: ncol and draggable
Copy some properties from the old legend to the new (re-)generated legend. If the old legend was draggable, the new one is now also. The number of columns in the legend is passed on from to old legend to the new legend.
1 parent 63894f9 commit 80beedf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/matplotlib/backends/qt4_editor/figureoptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ def apply_callback(data):
127127

128128
# re-generate legend, if checkbox is checked. Stefan Kraus/tacaswell 2014-04-22
129129
if generate_legend:
130+
old_legend = axes.get_legend()
130131
new_legend = axes.legend()
132+
new_legend._ncol = old_legend._ncol
133+
new_legend.draggable(old_legend._draggable is not None)
131134

132135
# Redraw
133136
figure = axes.get_figure()

0 commit comments

Comments
 (0)