mwaskom / seaborn

Statistical data visualization in Python
https://seaborn.pydata.org
BSD 3-Clause "New" or "Revised" License
12.56k stars 1.92k forks source link

Several test failures due to matplotlib no longer auto-flattening inputs to pcolormesh #3245

Closed IAlibay closed 1 year ago

IAlibay commented 1 year ago

Context: We noticed some seaborn failures downstream when testing on the nightly matplotlib wheels.

It turns out that a recent change in matplotlib's dev branch (https://github.com/matplotlib/matplotlib/pull/24638) is causing matrix._HeatMapper._annotate_heatmap to fail because calls to pcolormesh are no longer flattened and by consequence changes the return value of get_facecolor.

There are also various test failures in test_matrix and test_distribution which fail due to comparisions between flattened & non-flatttened arrays.

mwaskom commented 1 year ago

If this is not something matplotlib has overtly deprecated can you please put together a (seaborn-less) reprex and flag to them?

mwaskom commented 1 year ago

Also not being familiar with your test suite do you think that you could link more specifically to the failing test or provide a reprex here? I don't really understand exactly what the issue is from your description what the implications of "auto-flattening" would be.

IAlibay commented 1 year ago

Also not being familiar with your test suite

@mwaskom I think there might be a misunderstanding here, the failures I'm outlining above are in the seaborn testsuite.

My understanding of https://github.com/matplotlib/matplotlib/pull/24638 is that matplotlib is fixing what they consider to be undesirable behaviour with the way matplotlib's pcolormesh worked. I don't have a particular disagreement with that change, unfortunately all I can do is advise that seaborn as-is appears to fail under the latest nightly build with matplotlib.

IAlibay commented 1 year ago

I don't really understand exactly what the issue is from your description what the implications of "auto-flattening" would be.

I would be happy to add a new set of CI tests to the seaborn repo that checks against nightly builds of numpy/pandas/matplotlib/scipy if this help?

mwaskom commented 1 year ago

That wasn't clear; I just clicked through to the PR on your repository ...

Maybe you could upload the test logs as a txt file?

IAlibay commented 1 year ago

seaborn-matplotlib-nightly.txt @mwaskom please see attached (apologies about the previous ping, I accidentally copied test results with the non-dev version of matplotlib).

mwaskom commented 1 year ago

Thanks!

mwaskom commented 1 year ago

Based on https://github.com/matplotlib/matplotlib/issues/25162, matplotlib is going to roll back this change and make quadmesh facecolor flattening an opt-in operation at access time. I think the implications are that this will unbreak heatmap, and seaborn won't need to do anything (but we can consider accessing the non-flattened array in the future if it will simplify our code).

mwaskom commented 1 year ago

This has been addressed upstream.