Commit 0a121c9
Test/update label sharing tests (#372)
* Refactor: Improve tick and label sharing logic
This commit introduces a major refactoring of the tick and label sharing mechanism in UltraPlot.
The previous implementation had complex and distributed logic for determining tick and label visibility, which was difficult to maintain and extend. This refactoring centralizes the logic within the `Figure` class, making it more robust and easier to understand.
Key changes:
- A new `_share_ticklabels` method in `Figure` now handles all tick label sharing.
- The `_get_border_axes` method has been improved to be more accurate.
- The `_Crawler` utility in `ultraplot/utils.py` has been rewritten to better handle complex layouts with panels and mixed axes types.
- Redundant and complex logic has been removed from `CartesianAxes`, `GeoAxes`, and other modules.
* Test: Update tests for new label sharing logic
This commit updates the test suite to align with the new tick and label sharing mechanism.
Key changes:
- Added `fig.canvas.draw()` calls in numerous tests to ensure that the new, deferred label sharing logic is triggered before assertions.
- Updated assertions in tests for `CartesianAxes`, `GeoAxes`, and subplots to match the expected behavior of the refactored implementation.
- Added new tests to cover more complex scenarios with panels and mixed axes types.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fix edge cases
* stash
* restore gridspec hidden parameter defaults
* revert explicit axis limit setting
* bump merge
* use new grid
* rm ticks for twin
* add scale override
* bump
* auto update limits
* propagate panels for geo properly
* propagate panels for geo properly
* init
* propagate grid type mismatch
* rm debug
* bump test
* default lim to auto
* make mpl compatible and refactor into smaller functions
* skip colorbars on crawl
* forgot this chunk
* restore test and remove debug
* make panel sharing symmetric
* add additional guards
* more tests to check if guards are working
* guard against non-rectilinear shares
* Ensure that colorbars and legend do no interfere with layout
* Check that colorbars do not interfere with layout
* more stress tests
* bump tests
* fix spelling
* bump tests
* bump test
* bump test
* remove show
* add simple share test
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent c297c43 commit 0a121c9
File tree
15 files changed
+1067
-315
lines changed- ultraplot
- axes
- tests
15 files changed
+1067
-315
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1545 | 1545 | | |
1546 | 1546 | | |
1547 | 1547 | | |
| 1548 | + | |
| 1549 | + | |
1548 | 1550 | | |
1549 | 1551 | | |
1550 | 1552 | | |
| |||
1559 | 1561 | | |
1560 | 1562 | | |
1561 | 1563 | | |
| 1564 | + | |
| 1565 | + | |
1562 | 1566 | | |
1563 | 1567 | | |
1564 | 1568 | | |
| |||
3261 | 3265 | | |
3262 | 3266 | | |
3263 | 3267 | | |
| 3268 | + | |
| 3269 | + | |
| 3270 | + | |
| 3271 | + | |
| 3272 | + | |
| 3273 | + | |
| 3274 | + | |
| 3275 | + | |
| 3276 | + | |
| 3277 | + | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
3264 | 3289 | | |
3265 | 3290 | | |
3266 | 3291 | | |
| |||
3274 | 3299 | | |
3275 | 3300 | | |
3276 | 3301 | | |
3277 | | - | |
3278 | | - | |
3279 | | - | |
3280 | | - | |
| 3302 | + | |
| 3303 | + | |
3281 | 3304 | | |
3282 | 3305 | | |
3283 | 3306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | 655 | | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
668 | 660 | | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
676 | 665 | | |
677 | 666 | | |
678 | 667 | | |
| |||
691 | 680 | | |
692 | 681 | | |
693 | 682 | | |
694 | | - | |
695 | | - | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
696 | 694 | | |
697 | 695 | | |
| 696 | + | |
698 | 697 | | |
699 | 698 | | |
700 | 699 | | |
701 | | - | |
702 | | - | |
703 | | - | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
704 | 709 | | |
705 | 710 | | |
706 | 711 | | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
| 712 | + | |
726 | 713 | | |
727 | 714 | | |
728 | 715 | | |
| |||
1441 | 1428 | | |
1442 | 1429 | | |
1443 | 1430 | | |
| 1431 | + | |
1444 | 1432 | | |
1445 | 1433 | | |
1446 | 1434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
216 | 215 | | |
217 | 216 | | |
218 | 217 | | |
| |||
227 | 226 | | |
228 | 227 | | |
229 | 228 | | |
230 | | - | |
| 229 | + | |
231 | 230 | | |
232 | | - | |
| 231 | + | |
233 | 232 | | |
0 commit comments