-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: pcolormesh properties and getter shapes changed w/o notice #25162
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
Comments
@greglucas says:
|
Agree something needs to be done. However, I assume that keeping the 2D input structure is preferable to the flattening for downstream libraries (@mwaskom?), and it's just the type instability that is the problem? Or is flattening preferred for some reason? |
That's right, the logic of having the artist data match the input seems totally reasonable to me, it's just the change that's going to cause problems. |
I think we usually try and do the dance as follows: add a flatten kwarg to pcolormesh: 3.8: default flatten=True, but warn explicit flatten=False/True would not warn. If we want, It's kind of a pain for everybody over 3_ years, but I expect this is mostly for downstream libraries who would eventually benefit? |
Discussed on the call this week. We decided that methods like If there are any bare properties that folks are accessing we should make sure there are set_/get_ methods that have @mwaskom will this work for seaborn? |
Yeah, this sounds like a reasonable stability-prioritizing approach to me. Thanks! |
This is not fully backward compatible, unfortunately :( import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
x = np.arange(5)
X, Y = np.meshgrid(x, x)
mesh = plt.pcolormesh(X, Y, X*Y)
fig.draw_without_rendering()
print("Before set_array()")
print(mesh.get_array().shape)
print(mesh.get_facecolors().shape)
mesh.set_array(X*Y)
fig.draw_without_rendering()
print("After set_array()")
print(mesh.get_array().shape)
print(mesh.get_facecolors().shape) MPL v3.6
MPL main
|
That is .... special? I guess we can maintain backcompat by carrying a private property around as to whether the values were set by a setter or not, but thats not pretty... As a general rule, this is why its good for the init classes to use the public setters if at all possible ;-)... |
I thought a bit more about this and I think downstream libraries are all failing on the
I have that implementation in a commit in PR #25027 which seems like a reasonable alignment to me. Thoughts from others on that? |
Since nobody said "no" to this, we could probably link the PR? |
I'm going to close this as completed because I think we are back to the previous edgecolor and facecolor behavior. @mwaskom are you able to confirm that the regression you pointed out in #24638 (comment) is back to what you expect in seaborn? |
Bug summary
In #24638 we stopped flattening input to pcolormesh. However that also changed the internal representation of the internal data and color arrays, breaking downstream libraries that are expecting flattened arrays.
The text was updated successfully, but these errors were encountered: