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
Conversation
If there is a legend, it is re-generated when "Apply" is clicked. See Issue #2934: Might have side effects. #2934 tacaswell: "However this will clobber any legend that is not the auto-magically generated one so it should probably also get a tick box to enable/disable the updating of the legend." Tick box not included.
Could you add the tick box? Clobbering people's carefully laid out legends is bad form. |
Maybe I can. This would be the opportunity to learn GUI programming. Beside the check box for generally enabling/disabling legend re-generation there is something else to improve: b) # store restorelegend.draggable(legend_is_draggable) I guess I can test again matplotlib/examples/pylab_examples/legend_demo3.py or something similar. |
@anykraus Have you had a chance to work on this at all? |
Checkbox added that controls if an automatic legend is re-generated, or generated for the first time. This checkbox defaults to False, as it generates a simple legend when set to True, see matplotlib.pyplot.legend(), which clobbers any carefully handcrafted legend.
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.
Fixed crash if there was no previous legend. Fixed ncol inheritance.
I added a checkbox (to the "Axes" tab of the "Figure Options" window 63894f9) and included using two important properties from the old legend in the new legend (ncol and draggable in 80beedf). Anything else to do? (A new pull request?) P.S.: I started copying other properties in |
@@ -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 comment
The 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
stuff # comment
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.
Left a few minor style comments. No need for a new PR, github will just keep adding commits to this on (so long as you push them to the correct branch). This will need an entry in CHANGELOG and if you think it should be advertised a few lines in whats_new.rst. Adding a new tab does sound useful, however that should go on it's own branch (and probably should wait for 1.5). |
@@ -54,6 +54,8 @@ def figure_edit(axes, parent=None): | |||
('Min', ymin), ('Max', ymax), | |||
('Label', axes.get_ylabel()), | |||
('Scale', [axes.get_yscale(), 'linear', 'log']) |
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
Ran pep8.py 1.5.6 (https://github.com/jcrocholl/pep8) over the code. Fixed all complaints.
Interesting: Travis CI build fails with |
Definitely A. The exclude list of there so that we did not have to pep8 the entire library in one shot, but one we get a file compliment the tests make sure it won't revert. (edit stupid phone) |
*/matplotlib/backends/qt4_editor/figureoptions.py now passes pep8 checks.
"duke compliment"? Google doesn't return anything useful. On Wed, Apr 23, 2014 at 7:30 AM, Thomas A Caswell
|
Re-Generate legend, through apply_callback/Apply
in Qt4Agg backend. As requested in matplotlib#2947 (comment) (Fix of Issue matplotlib#2934)
If there is a legend, it is re-generated when "Apply" is clicked.
See Issue #2934:
Might have side effects.
#2934
tacaswell: "However this will clobber any legend that is not the auto-magically generated one so it should probably also get a tick box to enable/disable the updating of the legend."
Tick box not included.