Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Handle single color for multiple datasets inhist#30867
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
timhoffm commentedDec 16, 2025
The code itself is fine. Please update the docstring and ad a release note. Seehttps://matplotlib.org/devdocs/devel/api_changes.html#announce-new-and-deprecated-api. |
gapplef commentedDec 17, 2025
Done.@timhoffm |
timhoffm left a comment
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.
Sorry, I forgot to mention: Could you please also add a test?
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
gapplef commentedDec 18, 2025
I have add a new test for hist and update the what's news. |
| # Test a single color for multiple datasets | ||
| # https://github.com/matplotlib/matplotlib/issues/30857 | ||
| data= [[0,1,2], [3,4,5]] | ||
| plt.hist(data,color='k') |
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 only tests that the call does not blow up. It does not verify whether the right thing happens. Please refine:
| plt.hist(data,color='k') | |
| _,_,bar_containers=plt.hist(data,color='k') | |
| forpinbar_containers[0].patches: | |
| assertmcolor.same_color(p.get_facecolor(),'k') | |
| forpinbar_containers[1].patches: | |
| assertmcolor.same_color(p.get_facecolor(),'k') |
| # Test a single color for multiple datasets | ||
| # https://github.com/matplotlib/matplotlib/issues/30857 |
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.
| # Test a single color for multiple datasets | |
| # https://github.com/matplotlib/matplotlib/issues/30857 |
The content of the first line is already expressed through the function name.
We typically do not reference github issues. For future readers, it does not matter whether the test was added as part of the original implementation or through a later issue. If somebody really want to know this they can reconstruct the PR from the commit and the issue from the PR.
Uh oh!
There was an error while loading.Please reload this page.
PR summary
Close#30857 with minimal change
If a single validcolor is provided, duplicate it to match the size of the dataset.
PR checklist