FIX: Disallow twinx/twiny on Axes3D#31524
Conversation
|
From the note in the |
|
I acknowledge the Python reference docs. However, setting to I've followed the pattern of the semilog errors right below, because I think that's decent. You may debate whether |
|
I tested both approaches and wanted to share a finding that might be useful for this discussion. ax.get_frame_on()
# TypeError: 'NoneType' object is not callableThis is essentially the same problem we're trying to fix just a different cryptic error. Setting The My suggestion: If we go with Either way, this PR is a clear improvement over the current behaviour. Just wanted to surface this so the decision is made intentionally. |
|
I also noticed |
|
Ah OK, I admit I didn’t actually try it 🐑, just assumed that the documented recommendation would give something useful. A more specific error might be good: something like |
bc26389 to
c29bc0c
Compare
| from . import axis3d | ||
|
|
||
|
|
||
| class UnsupportedError(RuntimeError): |
There was a problem hiding this comment.
In the issue, @buddy0452004 noted that Polar has a similar problem, so I’m wondering if the exception should be defined somewhere more general that both subclass modules can import from.
Or is toolkits considered sufficiently separate that it makes sense to have its own exceptions?
|
Since The natural shared home would be
I confirmed polar has the same issue If it's useful, I'm happy to look into adding |
c29bc0c to
b596d7e
Compare
|
Ok, since this is needed more often, it should live in twinx = _api.unsupported_method()Note: I've removed the explicit tests for the unsupported log functions, since the descriptor itself is tested and we therefore don't need to test every application. |
ec9cd6e to
0225841
Compare
Closes matplotlib#31522. The root cause is that Axes3D inherits a lot of functionality from Axes that does not work for 3D. This is a design flaw we cannot easily fix. With this PR we have at least a reasonable mechanism in place to flag not-supported methods. When we get aware of additional methods, we can easily add them.
0225841 to
f8a68b7
Compare
|
Great solution placing it in |
rcomer
left a comment
There was a problem hiding this comment.
Nice! I didn’t know about __set_name__ 👀
Closes #31523.
The root cause is that Axes3D inherits a lot of functionality from Axes that does not work for 3D. This is a design flaw we cannot easily fix.
With this PR we have at least a reasonable mechanism in place to flag not-supported methods. When we get aware of additional methods, we can easily add them.