-
Notifications
You must be signed in to change notification settings - Fork 16
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes for matplotlib3.8
#339
Conversation
…re also different (remember to attach screenshot to PR
tests/test_samples.py
Outdated
@@ -1245,7 +1245,7 @@ def test_samples_dot_plot(): | |||
assert len(axes) == 2 | |||
|
|||
axes = samples.plot.kde_2d('x0', 'x1') | |||
assert len(axes.collections) == 5 | |||
assert len(axes.collections) == 2 |
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 test will fail on mpl<3.8. Is this a test we really need to do? The number of collections feels like matplotlib just doing matplotlib things
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.
I agree (although 2 makes more sense here than 5...). Is there anything explicit we can test to confirm that it has plotted something?
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.
Check it's more than 0?
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.
That would do
@@ -131,6 +131,8 @@ def __init__(self, data, x, y, C=None, **kwargs) -> None: | |||
C = '__weights' | |||
data[C] = data.get_weights() | |||
kwargs['reduce_C_function'] = np.sum | |||
if 'mincnt' not in kwargs: | |||
kwargs['mincnt'] = np.finfo(np.float64).tiny |
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.
alias for smallest_normal
but I like tiny
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #339 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 34 34
Lines 2868 2868
=========================================
Hits 2868 2868
☔ View full report in Codecov by Sentry. |
An extra level of The plots at least look identical to the previous matplotlib |
Still stumped 😢 using the old api will be deprecated in a couple of minor versions so I'd prefer not to rely on it. I just can't work out what the five colours from |
Agreed, how about we add a matplotlib version check to the tests and test both old and new API. In the actual code I'd find that really annoying, but if we limit it to the tests that should be ok, right? |
But what do we do in two matplotlib's time? My concern is I don't understand the |
Keep adding to the tests and we could say anything older than 2 or 3 minor matplotlib versions get's scratched.
|
got it, thanks Lukas 😄 hopefully that's this PR done |
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.
Thanks a bunch @AdamOrmondroyd! Please squash and merge.
Whoops! Left that in from while I was remembering how to check the version |
Description
matplotlib3.8
released yesterday morning.Axes._get_lines.prop_cycler
has been removed, instead useAxes._get_lines.get_next_color()
(inevitable with private member usage)plt.hexbin
now plots bins ≥mincnt
, not >mincnt
, which changes the behaviour with the default of 0 (corresponding to None in the signature). I have usednp.finfo.tiny
to correct this.tcolors
is deprecated, I have lifted the code used to simulate it inmatplotlib
to restore the test intest_contour_plot_2d()
.samples.plot.[fast]kde_2d()
now only adds two collections to the axesThe last three are all symptoms of
plt.contour
returningQuadContourSet
(one per level, so usually two for a contour plot) rather thanPathCollection
.I'm completely stumped by the last one.
Fixes # (issue)
Checklist:
flake8 anesthetic tests
)pydocstyle --convention=numpy anesthetic
)python -m pytest
)