Repository navigation
Conversation
|
Thank you for opening your first PR into Matplotlib! If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks. We also ask that you please finish addressing any review comments on this PR and wait for it to be merged (or closed) before opening a new one, as it can be a valuable learning experience to go through the review process. You can also join us on discourse chat for real-time discussion. For details on testing, writing docs, and our review process, please see the developer guide. We strive to be a welcoming and open project. Please follow our Code of Conduct. |
I'm wary of silent failures, especially when it's a mistake I could see myself making. Is it viable to error out instead? ETA: also thanks for catching this! |
Yes, I think we could raise a ValueError. I agree it would be confusing for an arrow to disappear without any indication that xytext contains NaN. Would a warning work in that case? It could point the user to xytext while still letting the rest of the figure render. so how about we keep the original polar example quiet. There, xytext=(0, 0) is finite and only becomes undefined in display coordinates when the radial lower limit is set to 0.25. I’d skip the annotation without a warning for that draw, so it can reappear when the limits include the origin again. |
PR summary
Drawing an arrow annotation can raise
StopIterationif its text position maps to nonfinite display coordinates. For example,(0, 0)is finite in polar coordinates, but its display position is undefined when the lower radial limit is 0.25.This change checks the text position in display coordinates and skips the annotation when that position is nonfinite. Moving the same annotation back to a valid position makes it visible again.
The regression tests cover an explicit NaN on Cartesian axes and a finite position on polar axes that becomes invalid after transformation. Both cases failed on
mainbefore the fix. The focused test run had 240 passes and 54 skips. PNG, SVG, and PDF exports were also checked locally.Closes #29516
AI Disclosure
OpenAI Codex helped to wrote the implementation and regression tests, ran the local checks, and helped translate this description.
PR quality check