FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Reorder kwonly kwargs in Colorbar & related docs. by anntzer · Pull Request #29652 · matplotlib/matplotlib · GitHub

Repository navigation

Reorder kwonly kwargs in Colorbar & related docs. - #29652

Merged
timhoffm merged 1 commit into
matplotlib:mainfrom
anntzer:cbd
Feb 22, 2025
Merged

timhoffm merged 1 commit into
matplotlib:mainfrom
anntzer:cbd

Conversation

anntzer commented Feb 21, 2025

Copy link
Copy Markdown
Contributor

Move "redundant" kwargs (cmap/norm can be specified via mappable; orientation/ticklocation can be specified via location) to the end of the kwarg list and under an "Other Parameters" section.

Also remove mention of Normalize(clip=False);

imshow(rand(10, 10),
       cmap=mpl.colormaps["viridis"].with_extremes(under="w", over="k"))
colorbar(extend="both")

seems enough to have over/under colors show up, i.e. no need to fiddle with the clip parameter.

PR summary

PR checklist

Move "redundant" kwargs (cmap/norm can be specified via mappable;
orientation/ticklocation can be specified via location) to the end of
the kwarg list and under an "Other Parameters" section.

Also remove mention of Normalize(clip=False);

    imshow(rand(10, 10),
           cmap=mpl.colormaps["viridis"].with_extremes(under="w", over="k"))
    colorbar(extend="both")

seems enough to have over/under colors show up, i.e. no need to fiddle
with the clip parameter.
Comment on lines +247 to +248
Other Parameters
----------------

timhoffm Feb 21, 2025 •
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It seems like numpydoc is placing the Attributes section between Parameters and Other Parameters, which I find quite confusing.

I propose not use Other Parameters then here.

Edit: This is an intentional change in numpydoc 1.8 (numpy/numpydoc#571), though I'm not clear whether this effect was considered.

We can work around this by moving the parameters to the __init__ docstring, because that seems to be appended below the class docstring, see e.g. https://matplotlib.org/devdocs/api/widgets_api.html#matplotlib.widgets.Button. In a quick check, this seems to be a pattern we generally use.

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'll merge this as is and do a follow-up to move the parameters to the init docstring. That's logically simpler than reordering and moving at the same time.

timhoffm added this to the v3.10.1 milestone Feb 22, 2025
timhoffm merged commit efde717 into matplotlib:main Feb 22, 2025
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Feb 22, 2025
timhoffm added a commit to timhoffm/matplotlib that referenced this pull request Feb 22, 2025
This prevents numpydoc from inserting Attributes between Parameters and
Other Parameters see https://github
.com/matplotlib/pull/29652#pullrequestreview-2634087106.
It's also a pattern we generally use.
anntzer deleted the cbd branch February 22, 2025 09:20
timhoffm added a commit that referenced this pull request Feb 22, 2025
…652-on-v3.10.x

Backport PR #29652 on branch v3.10.x (Reorder kwonly kwargs in Colorbar & related docs.)
ksunden mentioned this pull request Mar 3, 2025
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL