-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
improve legend docstring #9999
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
improve legend docstring #9999
Conversation
Just saw the failing test, which compares if the parameter sections are identical for I assume the intent is to keep the long parameter lists at sync. However since the signatures are actually different, this does not work easily. Either one has to break with the documenting rules and exclude parent, handles and labels from the parameter sections (probably why the docstring was in the peculiar state before I changed it), or one has to refine the test. How should I proceed? |
Without looking too closely, can you keep "Parameters" as the arguments that change, and "Other Paramters" as the parameters that are shared and move the test to look at the "Other Parameters" section? The problem before was that the very very very long list of kwargs was not consistent between the legend docstrings. I fixed that, and then introduced the test (#9324). If it had been up to me, we'd have used a doc interp, but the consensus seemed to be that we don't like doc interps. I'm not particularly happy w/ the existing solution, so other creative ideas more than welcome. I'm not going to be terribly upset if we get rid of the test for consistency, but there should be a way to keep the kwarg documentation consistent between the three |
The workaround with "Other Parameters" should be ok in this case. Will look into it. As of syncing docstrings, you just have the two options:
I currently do not oversee the subtleties of the latter, and therefore, cannot comment here. |
Docstring / test adapted. |
Test passed; you've got |
lib/matplotlib/axes/_axes.py
Outdated
ax.legend() | ||
|
||
Specific lines can be excluded from the automatic legend element | ||
selection by defining a label starting with an underscore. | ||
This is default for all artists, so calling :meth:`legend` without | ||
This is default for all artists, so calling :meth:`.legend` without |
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 needs to me .Axes.legend
I think
PR Summary
This improves the legend docstrings:
Axes.legend()
Axes.legend()
so that the most common use case is at the top.also fixes #8668