Commit 7ebaad8
authored
Fix axis3d to include offset text in tight bounding box calculation (matplotlib#30760)
* Fix axis3d to include offset text in tight bounding box calculation
* Fix test tolerance for platform compatibility
The previous test used an overly strict tolerance (rtol=1e-10) which could
fail due to floating-point precision differences across platforms and
backends. Simplified the test to directly check that the tight bbox
contains the offset text bbox with a reasonable tolerance (1e-6).
* Make offset_text test conditional on visibility
The test now only checks that offset_text is included in the tight
bbox when it's actually visible and has content. This handles cases
where different backends or configurations may not show offset text.
Added helpful error messages to aid debugging if assertions fail.
* Add check for offset text content before including in bbox
Match the pattern used for label (line 716) by checking that offsetText
has actual content before including it in the bounding box calculation.
This prevents including empty offset text in the bbox.
* Add figure cleanup to offset text test
Explicitly close the figure after the test completes to ensure
proper cleanup and avoid potential interference with other tests.
* Revert figure cleanup in test
Remove explicit plt.close(fig) call as matplotlib's test framework
handles cleanup automatically. The explicit close was causing test
failures across multiple platforms.1 parent 3323161 commit 7ebaad8
2 files changed
+49
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
708 | 708 | | |
709 | 709 | | |
710 | 710 | | |
| 711 | + | |
| 712 | + | |
711 | 713 | | |
712 | 714 | | |
713 | 715 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2733 | 2733 | | |
2734 | 2734 | | |
2735 | 2735 | | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
| 2745 | + | |
| 2746 | + | |
| 2747 | + | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
0 commit comments