| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I'd suggest showing what this does with an example either in the GitHub pr description, or ideally in the gallery |
Sorry, something went wrong.
|
I'm not really sure if I need to add a new test or just modify an exisiting one(test_hist_stacked_bar) in test_axes.py |
Sorry, something went wrong.
|
I guess there are two things here:
|
Sorry, something went wrong.
|
pinging @story645 for review. The failing tests are unrelated |
Sorry, something went wrong.
What should we be concerned about? We already have vectorized label and color. It's only fair to vectorize these inside hist() as well. This should be documented with **kwargs (can't immediately suggest, because that part has not been touched in the PR). Something like: **kwargs
`~matplotlib.patches.Patch` properties. The following properties additionally
accept lists of property values, one element for each dataset:
*edgecolors*, *linewidths*, *linestyles*, *hatches*.
This should also get a what's new entry. |
Sorry, something went wrong.
My bias is vectorize everything so I don't have concerns, but in the past for some vectorization discussions there have been concerns about the tradeoffs. But if there isn't opposition, awesome! |
Sorry, something went wrong.
|
I don't see any drawbacks for hist() |
Sorry, something went wrong.
|
So we are planning to vectorize all parameters of Patches? Like joinstyle, capstyle etc. |
Sorry, something went wrong.
Not at this time w/ the current architecture, especially because nobody has asked for those. |
Sorry, something went wrong.
|
Codecov is acting fishy, it passed once and failed again after squashing. Anything else to add/change? |
Sorry, something went wrong.
|
As of the last commit, this behavior is consistent for all histtypes unless mentioned otherwise:
|
Sorry, something went wrong.
|
@Impaler343 I started trying to flow chart that and then realized it's probably clearer as a table. Let me know if this jives with what you're saying:
|
Sorry, something went wrong.
Have bolded the corrected ones |
Sorry, something went wrong.
|
I'm unable to fix CircleCI errors for docs. Could someone help me out? |
Sorry, something went wrong.
|
Hi, so the error is in your what's new: /home/circleci/project/doc/users/next_whats_new/histogram_vectorized_parameters.rst:47: WARNING: Explicit markup ends without a blank line; unexpected unindent. error: https://app.circleci.com/pipelines/github/matplotlib/matplotlib/31532/workflows/2533c013-7833-4d0c-ae72-dead7c7fbc76/jobs/83481?invite=true#step-113-207133_109 |
Sorry, something went wrong.
|
Ok it turns out the vectorization of colors is somewhat incomplete:
|
Sorry, something went wrong.
I think this input is ambiguous cause it can mean either:
So I think it's ok to error out (unless/until someone comes around expecting 1 or 2) but we should maybe special case and have a better error message, like if not all(colors) (if any are NaN) "Ambiguous color specification: colors in the list may not be None" Or something like that. |
Sorry, something went wrong.
|
The added lines have all been covered, codecov seems to still fail |
Sorry, something went wrong.
|
Cause I think this maybe got lost, I was suggesting that this construction makes the skip case clearer: for patch, lbl in itertools.zip_longest(patches, labels):
if not patch: continue
p = patch[0]
kwargs.update({
'hatch': next(hatches),
'linewidth': next(linewidths),
'linestyle': next(linestyles),
'edgecolor': next(edgecolors),
'facecolor': next(facecolors),
})
p._internal_update(kwargs)
if lbl is not None:
p.set_label(lbl)
for p in patch[1:]:
p._internal_update(kwargs)
p.set_label('_nolegend_') |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for all your patience and extra thanks for tracing through and figuring out and testing our histogram color semantics/precedence 😅
I think the plot tests are now at a state where it's easy to see which parameter failed but there's also now only six image tests.
I'm pretty sure that the color semantics test doesn't try to draw anything but there might be a "build only artist tree" function that I'm missing.
Sorry, something went wrong.
| def test_hist_none_patch(): | ||
| # To cover None patches when excess labels are provided | ||
| labels = ["First", "Second"] | ||
| patches = [[1, 2]] | ||
| fig, ax = plt.subplots() | ||
| ax.hist(patches, label=labels) | ||
| _, lbls = ax.get_legend_handles_labels() | ||
| assert (len(lbls) < len(labels) and len(patches) < len(labels)) |
There was a problem hiding this comment.
Can you please elaborate what this tests? What are None patches? Does this express what you want to test?
| def test_hist_none_patch(): | |
| # To cover None patches when excess labels are provided | |
| labels = ["First", "Second"] | |
| patches = [[1, 2]] | |
| fig, ax = plt.subplots() | |
| ax.hist(patches, label=labels) | |
| _, lbls = ax.get_legend_handles_labels() | |
| assert (len(lbls) < len(labels) and len(patches) < len(labels)) | |
| def test_hist_unused_labels(): | |
| # When a list with one dataset and N elements is provided and N labels, ensure | |
| # hat the first label is used for the dataset and all other labels are ignored | |
| fig, ax = plt.subplots() | |
| ax.hist([[1, 2, 3]], label=["values", "unused", "also unused"]) | |
| _, labels = ax.get_legend_handles_labels() | |
| assert labels == ["values"] |
Sorry, something went wrong.
There was a problem hiding this comment.
None patches are the ones generated when the number of labels specified are more than the number of patches(Filled in by zip_longest). The suggested test also covers the line and has clearer labels, ill change it up
Sorry, something went wrong.
|
#28533 reminded me that this should get a versionadded directive https://matplotlib.org/devdocs/devel/api_changes.html#announce-new-and-deprecated-api |
Sorry, something went wrong.
|
The doc build failure could be fixed by rebasing on main to get fixed CircleCI, but I built it locally and confirmed it builds, so I'm not going to wait for that, and just merge. |
Sorry, something went wrong.
|
I'm so glad that this finally got merged! Thank you for the timely reviews |
Sorry, something went wrong.
|
Thanks for keeping up with all the reviews! |
Sorry, something went wrong.
- [Hatch filled histogram](https://matplotlib.org/stable/gallery/lines_bars_and_markers/filled_step.html) Hatching in histograms is fully supported through matplotlib#28073. This is [now simple](https://matplotlib.org/devdocs/gallery/statistics/histogram_multihist.html#hatch) and does warrant a dedicated example. - [Percentiles in horizontal bar charts](https://matplotlib.org/stable/gallery/statistics/barchart_demo.html) This is a very complex example. But in the end, it's just a bar plot with annotations. While it is statistics-themed through the use of perecntiles, the plot itself has no statistics-related characteristics.
- [Hatch filled histogram](https://matplotlib.org/stable/gallery/lines_bars_and_markers/filled_step.html) Hatching in histograms is fully supported through matplotlib#28073. This is [now simple](https://matplotlib.org/devdocs/gallery/statistics/histogram_multihist.html#hatch) and does warrant a dedicated example. - [Percentiles in horizontal bar charts](https://matplotlib.org/stable/gallery/statistics/barchart_demo.html) This is a very complex example. But in the end, it's just a bar plot with annotations. While it is statistics-themed through the use of perecntiles, the plot itself has no statistics-related characteristics.
| Back | FazBrowse Home | New Git URL |
PR summary
Closes #26718 Distributes keyword args passed to each Patch using a cycler. Probably not the best way to do this?
PR checklist