You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Singular keyword arguments in contour don't raise exceptions #1963
I have confused myself several times (and have seen it happen many times with other people) by something like this not working, but also not raising a warning or exception:
The fact that the keywords are not plural in this case is quite pedantic, but the real issue is that there are not even any warnings or errors, so users are left having no idea why this doesn't work, and are left frustrated when they do find out.
So I would suggest either:
raise an exception for non-used keyword arguments (not ideal because it still makes it very pedantic)
emit a warning and fix the keyword to the plural version
simply accept the singular keywords and just pass them to the plural ones, raising an error if the plural one is defined too.
For linestyle: linestyles or linestyle or ls or linestyle or linestyles or dashes
For linewidth: linewidths or linewidth or lw or linewidth or linewidths or lw
For edgecolor: edgecolor or ec or edgecolor or edgecolors
For faceolor: facecolor or fc or facecolor or facecolors
and others, I'm sure
Will require deciding combinations to keep and applying consistently across all. The easiest would be to just take the union of all the currently valid variants across methods for a particular keyword (e.g., edgecolor or edgecolors or ec).
I recommend labeling with Difficulty: Medium and Documentation
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
Now that ContourSet has been modified to actually be an artist, we should just route most kwargs to Artist.set() and let that handle standard aliases and error out as usual on unknown properties.
Activity
dmcdougall commentedon Jun 16, 2013
Note that, whatever solution is implemented, we'd have to do this for all the plotting routines that take plural kwargs.
petehuang commentedon Dec 30, 2016
Consistency concern is valid for more than just contour, see the api doc for pyplot http://matplotlib.org/api/pyplot_api.html
colorandc,colorlinestylesorlinestyle or lsorlinestyle or linestyles or dasheslinewidthsorlinewidth or lworlinewidth or linewidths or lwedgecolor or ecoredgecolor or edgecolorsfacecolor or fcorfacecolor or facecolorsand others, I'm sure
Will require deciding combinations to keep and applying consistently across all. The easiest would be to just take the union of all the currently valid variants across methods for a particular keyword (e.g.,
edgecolor or edgecolors or ec).I recommend labeling with Difficulty: Medium and Documentation
QuLogic commentedon Apr 22, 2020
See also #2369 for thoughts on what to do with extra (though not typo'd) keyword arguments.
github-actions commentedon Sep 1, 2023
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help!
jklymak commentedon Sep 1, 2023
I think this is still a valid concern. Probably requires some discussion, however I'd be in favour of aliasing these
anntzer commentedon Sep 1, 2023
Now that ContourSet has been modified to actually be an artist, we should just route most kwargs to Artist.set() and let that handle standard aliases and error out as usual on unknown properties.