Test scatter optimization with logarithmic scales. Ensures bounds checking works correctly in log-transformed coordinates.
(fig_test, fig_ref)
| 675 | |
| 676 | @check_figures_equal(extensions=["pdf"]) |
| 677 | def test_scatter_logscale(fig_test, fig_ref): |
| 678 | """ |
| 679 | Test scatter optimization with logarithmic scales. |
| 680 | |
| 681 | Ensures bounds checking works correctly in log-transformed coordinates. |
| 682 | """ |
| 683 | rng = np.random.default_rng(19680801) |
| 684 | |
| 685 | # Create points across several orders of magnitude |
| 686 | n_points = 50 |
| 687 | x = 10 ** (rng.random(n_points) * 4) # 1 to 10000 |
| 688 | y = 10 ** (rng.random(n_points) * 4) |
| 689 | c = rng.random(n_points) |
| 690 | |
| 691 | # Test figure: log scale with points mostly outside view |
| 692 | ax_test = fig_test.subplots() |
| 693 | ax_test.scatter(x, y, c=c, s=50) |
| 694 | ax_test.set_xscale('log') |
| 695 | ax_test.set_yscale('log') |
| 696 | ax_test.set_xlim(100, 1000) # Only show middle range |
| 697 | ax_test.set_ylim(100, 1000) |
| 698 | |
| 699 | # Reference figure: should render identically |
| 700 | ax_ref = fig_ref.subplots() |
| 701 | ax_ref.scatter(x, y, c=c, s=50) |
| 702 | ax_ref.set_xscale('log') |
| 703 | ax_ref.set_yscale('log') |
| 704 | ax_ref.set_xlim(100, 1000) |
| 705 | ax_ref.set_ylim(100, 1000) |
| 706 | |
| 707 | |
| 708 | @check_figures_equal(extensions=["pdf"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…