FIX: better error message for shared axes and axis('equal') - #21318
Conversation
5b2ad5d to
5d37e45
Compare
5d37e45 to
400445a
Compare
400445a to
2ad34af
Compare
|
-- rebased |
| raise RuntimeError("'equal' is not allowed on shared " | ||
| "axes, try 'scaled' instead.") |
There was a problem hiding this comment.
Is the original exception important here, or should we do from None here?
There was a problem hiding this comment.
Is it a RunTimeError that we want to re-raise here, or should we change it to ValueError instead since you are saying that value isn't allowed?
There was a problem hiding this comment.
As above, I'm not sure I can even trigger this so lets try removing...
There was a problem hiding this comment.
We only want to catch the above exception, right? Technically, we should make sure not to catch other RuntimeErrors here, either by inspecting the message or by using a custom exception above.
But I'm not sure if we have to be that pedantic. Catching the wrong exception does not change control flow, it could only issue a non-instructive error message.
There was a problem hiding this comment.
OK, looking back at it now, I'm not sure what this is supposed to catch. set_aspect does not call apply_aspect, and apply_aspect is only called at draw time so far as I can tell. I couldn't figure out a test for this, so lets see if anything fails just removing it again.
There was a problem hiding this comment.
Confirmed, this doesn't fail any tests - so I'm not even sure this was reachable. Sorry I don't remember what prompted this int he first place!

PR Summary
Closes #11416
The error message was pretty mysterious if you called
ax.axis('equal')on a shared axes...Not clear that the functionality users are trying to get from this could not be provided, but at least clarifying the error message will help...
PR Checklist
pytestpasses).flake8on changed files to check).flake8-docstringsand runflake8 --docstring-convention=all).doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).