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
Re-Generate legend, through apply_callback/Apply #2947
Changes from 4 commits
0bc4c52
63894f9
80beedf
07930c0
af30544
9ede5be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,8 @@ def figure_edit(axes, parent=None): | |
('Min', ymin), ('Max', ymax), | ||
('Label', axes.get_ylabel()), | ||
('Scale', [axes.get_yscale(), 'linear', 'log']) | ||
sep, | ||
('(Re-)Generate automatic legend', False) #defaults to False, as it clobbers carefully hand crafted legends /2014-04-22 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is apparently not tested for pep8 compliance, but could you wrap the long line and in-line comments should be of the form
It seems petty and dumb, but maintaining a consistent style really does help with the readablity of the code (which it turn helps out the devs who spend lots of time reading said code). There is no need to put dates/name in-line, git keeps track of that for us. |
||
] | ||
|
||
if has_curve: | ||
|
@@ -98,7 +100,7 @@ def apply_callback(data): | |
general, = data | ||
|
||
# Set / General | ||
title, xmin, xmax, xlabel, xscale, ymin, ymax, ylabel, yscale = general | ||
title, xmin, xmax, xlabel, xscale, ymin, ymax, ylabel, yscale, generate_legend = general #/2014-04-22 | ||
axes.set_xscale(xscale) | ||
axes.set_yscale(yscale) | ||
axes.set_title(title) | ||
|
@@ -122,6 +124,16 @@ def apply_callback(data): | |
line.set_markersize(markersize) | ||
line.set_markerfacecolor(markerfacecolor) | ||
line.set_markeredgecolor(markeredgecolor) | ||
|
||
# re-generate legend, if checkbox is checked. Stefan Kraus/tacaswell 2014-04-22 | ||
if generate_legend: | ||
if axes.legend_ is not None: | ||
old_legend = axes.get_legend() | ||
new_legend = axes.legend(ncol = old_legend._ncol) | ||
new_legend.draggable(old_legend._draggable is not None) | ||
else: | ||
new_legend = axes.legend() | ||
new_legend.draggable(True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure we want to default to draggable legends |
||
|
||
# Redraw | ||
figure = axes.get_figure() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are missing a
,
here