fix: PNG backend: markers at data range boundary clipped by plot border (fixes #1683)#1818
Merged
krystophny merged 2 commits intomainfrom Apr 25, 2026
Merged
Conversation
fixes #1683) Increase PDF_DATA_RANGE_MARGIN from 2% to 5% so that markers placed at the exact data-range boundary are pushed far enough inside the plot area to avoid visual overlap with the 1-pixel axes frame line. Add regression test that verifies corner markers render with sufficient pixel coverage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Increase the data-range margin expansion from 2% to 5% so markers placed at the exact data-range boundary are pushed far enough inside the plot area to avoid visual overlap with the axes frame.
Changes
src/figures/fortplot_figure_rendering_pipeline.f90: bumpPDF_DATA_RANGE_MARGINfrom0.02_wpto0.05_wptest/test_marker_boundary_clipping.f90: new regression test placing markers at all four data-range corners and verifying each has sufficient visible pixel coverageRoot Cause
The
expand_data_rangesubroutine inflates the coordinate system so boundary data points map inside the plot area rather than onto the axes frame. A 2 % inflation on a typical ~400 px plot height gives only ~8 px of clearance, which is barely enough for a 5–7 px marker radius. At that distance the 1 px axes frame line overlaps the outer edge of the marker, making it look "half-clipped".A 5 % inflation gives ~20 px clearance, which comfortably accommodates all built-in marker sizes.
Verification
Test passes after fix
Full test suite green
Affected examples regenerate cleanly
make example ARGS="scatter_demo"→ scatter_basic.png, scatter_multi.png, scatter_gaussian.pngmake example ARGS="disconnected_lines"→ disconnected_lines.png, disconnected_lines.pdfArtifact file sizes are consistent with pre-change renders (no regression in output volume).