Skip to content

[Bug]: hist()'s doc for edgecolors/facecolors does not match behavior (which is itself not very consistent) #28873

Closed

Description

@anntzer

Bug summary

The docs for hist state

**kwargs
    `~matplotlib.patches.Patch` properties. The following properties
    additionally accept a sequence of values corresponding to the
    datasets in *x*:
    *edgecolors*, *facecolors*, *lines*, *linestyles*, *hatches*.

but this does not match actual behavior

Code for reproduction

from pylab import *
hist(randn(100), facecolor="red")  # works
hist(randn(100), fc="red")  # silently does nothing
hist(randn(100), facecolors="red")  # crashes (Rectangle.set() got an unexpected keyword argument 'facecolors')

# and likewise for edgecolor(s)

Actual outcome

See above.

Expected outcome

At least the documentation and the behavior should match. Bonus points if all three kwarg forms (facecolor/fc/facecolors) are supported.

Additional information

No response

Operating system

any

Matplotlib Version

3.10.0.dev645+gcb9cf3bbb1

Matplotlib Backend

any

Python version

3.12.2

Jupyter version

no

Installation

git checkout

Activity

  1. timhoffm commented on Sep 24, 2024

    @timhoffm
    Member

    The functionality was recently added in #28073.

    The relevant code is:

    https://github.com/matplotlib/matplotlib/blame/65878f3469da914e1399622ff5996c05ce0a4e73/lib/matplotlib/axes/_axes.py#L7212-L7234

    To follow implementation, the documentation should read:

    *edgecolor*, *facecolor*, *linewidth*, *linestyle*, *hatch*.
    

    instead of

    *edgecolors*, *facecolors*, *lines*, *linestyles*, *hatches*.
    

    I believe this is the minimal API we must provide for consistency within the function. Before this PR, color and label accepted list inputs. Therefore, we should support the singular names. Plurals and abbreviations may come later. I suspect we should write helper functions to consolidate/normalize the different parameter names.

  2. added this to the v3.10.0 milestone on Sep 24, 2024
  3. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Sep 24, 2024
  4. anntzer commented on Sep 24, 2024

    @anntzer
    ContributorAuthor

    At least the documentation issue should be release critical.

  5. timhoffm commented on Sep 24, 2024

    @timhoffm
    Member

    #28875 is a minimal fix for the documentation. That should solve the release-critical documentation aspect of this issue, but will not close it completely.

  6. timhoffm commented on Sep 25, 2024

    @timhoffm
    Member

    The documentation is fixed. To keep the remaining topic more focussed, I've created #28884, which covers the consistency aspect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: consistencyConsistency of the matplotlib API, including naming, behavior, defaults, …DocumentationRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions