Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 0 additions & 113 deletions lib/matplotlib/tests/test_backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,34 +587,6 @@ def test_scatter_offaxis_colored_pdf_size():
)


@check_figures_equal(extensions=["pdf"])
def test_scatter_offaxis_colored_visual(fig_test, fig_ref):
"""
Test that on-axis scatter with per-point colors still renders correctly.

Ensures the optimization for off-axis markers doesn't break normal
scatter rendering.
"""
rng = np.random.default_rng(19680801)

n_points = 100
x = rng.random(n_points) * 5
y = rng.random(n_points) * 5
c = rng.random(n_points)

# Test figure: scatter with clipping optimization
ax_test = fig_test.subplots()
ax_test.scatter(x, y, c=c, s=50)
ax_test.set_xlim(0, 10)
ax_test.set_ylim(0, 10)

# Reference figure: should look identical
ax_ref = fig_ref.subplots()
ax_ref.scatter(x, y, c=c, s=50)
ax_ref.set_xlim(0, 10)
ax_ref.set_ylim(0, 10)


@check_figures_equal(extensions=["pdf"])
def test_scatter_mixed_onoff_axis(fig_test, fig_ref):
"""
Expand Down Expand Up @@ -647,88 +619,3 @@ def test_scatter_mixed_onoff_axis(fig_test, fig_ref):
ax_ref.scatter(x_on, y_on, c=c[:n_points], s=50)
ax_ref.set_xlim(0, 10)
ax_ref.set_ylim(0, 10)


@check_figures_equal(extensions=["pdf"])
def test_scatter_large_markers_partial_clip(fig_test, fig_ref):
"""
Test that large markers are rendered when partially visible.

Addresses reviewer concern: markers with centers outside the canvas but
with edges extending into the visible area should still be rendered.
"""
# Create markers just outside the visible area
# Canvas is 0-10, markers at x=-0.5 and x=10.5
x = np.array([-0.5, 10.5, 5]) # left edge, right edge, center
y = np.array([5, 5, -0.5]) # center, center, bottom edge
c = np.array([0.2, 0.5, 0.8])

# Test figure: large markers (s=500 ≈ 11 points radius)
# Centers are outside, but marker edges extend into visible area
ax_test = fig_test.subplots()
ax_test.scatter(x, y, c=c, s=500)
ax_test.set_xlim(0, 10)
ax_test.set_ylim(0, 10)

# Reference figure: same plot (should render identically)
ax_ref = fig_ref.subplots()
ax_ref.scatter(x, y, c=c, s=500)
ax_ref.set_xlim(0, 10)
ax_ref.set_ylim(0, 10)


@check_figures_equal(extensions=["pdf"])
def test_scatter_logscale(fig_test, fig_ref):
"""
Test scatter optimization with logarithmic scales.

Ensures bounds checking works correctly in log-transformed coordinates.
"""
rng = np.random.default_rng(19680801)

# Create points across several orders of magnitude
n_points = 50
x = 10 ** (rng.random(n_points) * 4) # 1 to 10000
y = 10 ** (rng.random(n_points) * 4)
c = rng.random(n_points)

# Test figure: log scale with points mostly outside view
ax_test = fig_test.subplots()
ax_test.scatter(x, y, c=c, s=50)
ax_test.set_xscale('log')
ax_test.set_yscale('log')
ax_test.set_xlim(100, 1000) # Only show middle range
ax_test.set_ylim(100, 1000)

# Reference figure: should render identically
ax_ref = fig_ref.subplots()
ax_ref.scatter(x, y, c=c, s=50)
ax_ref.set_xscale('log')
ax_ref.set_yscale('log')
ax_ref.set_xlim(100, 1000)
ax_ref.set_ylim(100, 1000)


@check_figures_equal(extensions=["pdf"])
def test_scatter_polar(fig_test, fig_ref):
"""
Test scatter optimization with polar coordinates.

Ensures bounds checking works correctly in polar projections.
"""
rng = np.random.default_rng(19680801)

n_points = 50
theta = rng.random(n_points) * 2 * np.pi
r = rng.random(n_points) * 3
c = rng.random(n_points)

# Test figure: polar projection
ax_test = fig_test.subplots(subplot_kw={'projection': 'polar'})
ax_test.scatter(theta, r, c=c, s=50)
ax_test.set_ylim(0, 2) # Limit radial range

# Reference figure: should render identically
ax_ref = fig_ref.subplots(subplot_kw={'projection': 'polar'})
ax_ref.scatter(theta, r, c=c, s=50)
ax_ref.set_ylim(0, 2)
Loading