-
Notifications
You must be signed in to change notification settings - Fork 1
Pull erikhuizinga/legtools/master into StackOverflowMATLABchat/legtools/master #7
Conversation
Pull latest release from StackOverflowMATLABchat/legtools
help legtools.append now is easier to read, easier to understand and less technical.
MATLAB R2016b introduces a new character data type: string. This commit adds support for this class while retaining compatibility with older MATLAB versions.
The append and adddummy methods both implement identical validation of the newStrings input argument. This commit moves this validation to the strcheck method.
Pull rc into master
Pull rc into master
General remarks
Marginally More Detailed RemarksMATLAB's default indentation on line continuation is unclear and the choice of aligning openings and closures for statements spanning multiple is intentional. This is consistent with other languages. No:
Yes:
Appending Prepending inline comments with 2 spaces rather than 1 is an intentional deference to PEP 8. The use of Bringing implicit input support to Path forwardThere are many good bug fixes here, both ones that have been on my plate to take care of and also ones I hadn't anticipated. Unfortunately, with the scope of this PR being so broad they are intermingled with changes I have no intention of making that I doubt it will be possible to merge without significant cleanup. I will be splitting the major bugs off into issues and incorporating fixes to them individually, with appropriate attribution. |
Thanks for your elaborate reply. This helps me learn to use Git and GitHub, as well as look beyond some of the quirks MATLAB uses/has. Sorry for the time it must have taken you to go over my large PR. Luckily for me, you took the time yourself to provide me with feedback. Next time I'll open issues. By the way: when is it better to leave in-line comments, when to create an issue? An issue can mention a specific point in some code, but a comment in the code on the specific location can pinpoint a problem. And are issues to be opened about anything, for example the minor stuff many of my commits ‘fix’? |
And in this case, would it have been possible for me to fix each bug separately? Like so: I create issues for the bugs I intend to fix, we communicate about the issues, we decide I am fixing them. Then, could the following happen (assuming one bug's code isn't dependent of another)? Example
I then fix one bug and squash all necessary commits into one:
Then I create a PR just for that bug, referencing the corresponding issue. If it's accepted, were at:
I then fix another bug, but this could happen in two moments of time: either when
|
No worries, it's great to get additional eyes on my code! While I do catch many bugs, I'm also looking at it as the primary author so it's easy to make assumptions that aren't necessarily correct and lead to issues elsewhere.
Issues are preferred, as inline comments unnecessarily clutter the repository's history. GitHub allows you to link directly to a commit, and even directly to a line number. For example, this link goes directly to line 53 of
Yep! Issues aren't just for reporting bugs, they're great ways to communicate with the developers. Some projects may have different contribution guidlines, but right now this project is completely open. |
For the most part, yes. The issue of diverging branches is an important one, and it's mainly accounted for during review/merging of the PR. If the PRs are structured so that you're addressing specific portions of the code, merge conflicts should be minimal and the review process should be straightforward. |
Summary
This is a large pull request fixing some bugs and adding a few new features, while remaining fully compatible with the previous release.
Bugs fixed
1.
remidx
inremove
method exceeds number of legend entriesExample
This commit fixes the bug.
2.
handlecheck
method improperly handles an empty legend objecthandlecheck
improperly throws an error when an empty legend object is passed to it. Thiscommit implements detection of an empty legend.
3.
objtodelete
is never set inremove
methodExample
Results in error:
This commit fixes the bug.
4.
append
method improperly rearrangesLegend
propertyPlotChildren
The
append
method contains a bug when it appends to a legend that has been permuted previously or if the parent axes children have been sorted differently after the legend has been modified.append
assumes the parent axes children are in the same order as the current legendPlotChildren
, which may not be the case. For example, after permuting the legend entries, this order may have changed.Example
Which results in (notice the incorrect colouring of the legend entries):

Note that the 3rd bug happens before this bug occurs, so you won't see this result on release v2.2. If you branch off 354a35e you can see the bug in action.
This commit fixes the bug.
Improvements
remove
method that was given when deleting the legend, because this is the expected behaviour (as explained in the help) and thus should not throw a warningNew functionality
plotParams
input argument ofadddummy
methodplotParams
optional