- Notifications
You must be signed in to change notification settings - Fork 1
Many enhancements and some new functionality #4
Conversation
Some code enhancements were made. I've added some functionality to: - append: - The legend handle input argument is now optional. If not provided, the legend to be edited is chosen as the one in the current figure. - permute: - The legend handle input argument is now optional. If not provided, the legend to be edited is chosen as the one in the current figure. - The order input argument is now optional. If it is not provided, the order is permuted by shifting all legend entries down by one; the last entry is wrapped around to the first place. - remove: - The legend handle input argument is now optional. If not provided, the legend to be edited is chosen as the one in the current figure. Some additional input parsing, error handling and warning text improvements were made.
Enhanced: - select now finds the legend belonging to the current axes via the respective PlotChildren and Children properties having the most matches. - remove now accepts zero input arguments: if none are provided, the last legend entry is removed. I've updated the help sections accordingly.
Optional legend object inputsExplicit is better than implicit. There are too many scenarios in MATLAB where See #3, where I explain the decision. Optional permute order inputAgain, explicit is better than implicit. Along with that, the behavior of I will evaluate the remaining changes when I am able. |
I agree with your point that explicit is better than implicit. However, I've retained all explicit functionality, so there's no changes there. The value of not needing to specify the handle to the legend to be edited is its ease of use, e.g.: If you have to explicitly use the legend handle or specify Besides, when do |
Ideas for further enhancement of
|
The explicit equivalent to your example is the following:
This isn't cumbersome. As I already stated, removing the explicit order requirement from
MATLAB's documentation already explains this.
The user working with (read: clicking on) multiple figure windows, subplots, GUIs, etc. introduces uncertainty in the
That's silly. Relying on the user to ensure that
I don't disagree that it works fine for simple, linear cases like the above example. However, designing code around quick uses generally leads to less robust code and/or spaghetti code as you have to tweak things to correct for unexpected behavior. You're free to maintain your own fork of this project that is tailored to your specific wants and needs. That's the beauty of open source. |
To the further enhancements: Both good ideas but they're already achievable with MATLAB's built-ins. MATLAB's
Which returns:
You can use |
Thanks for your elaborate answer. I agree with you on many points. It's About And thanks for reminding me about
Thanks for your offer on continuing my own fork of legtools. What do you 2016-06-17 14:42 GMT+02:00 sco1 notifications@github.com:
|
For the 1D case rearranging the dimensions of the array is functionally equivalent to the dictionary definition of permute.
This isn't a bug, it's by design. Because Calling The first thing
It doesn't really matter to me as long as proper attribution is used. I also don't want to convey that I'm not open to including changes in the code I'm maintaining here. I am open to it and I encourage it. |
With the vast majority of the changes in this PR being tied to the |
I've added some functionality to:
If multiple Legend objects are found in the current figure, the one closest to the current axes is chosen.
Some additional input parsing, error handling and warning text improvements were made.