fix: PDF pie chart legend box overlaps slice label (fixes #1680)#1825
Merged
krystophny merged 1 commit intomainfrom Apr 26, 2026
Merged
fix: PDF pie chart legend box overlaps slice label (fixes #1680)#1825krystophny merged 1 commit intomainfrom
krystophny merged 1 commit intomainfrom
Conversation
…p in PDF (fixes #1680) Add LEGEND_EAST position constant that places the legend outside the plot area to the right, centered vertically. The 'east' location string was previously unrecognized and fell through to LEGEND_UPPER_RIGHT, causing the legend box to overlap pie slice labels in PDF output. Files changed: - src/ui/fortplot_legend.f90: add LEGEND_EAST constant and 'east' case - src/ui/fortplot_legend_layout.f90: handle LEGEND_EAST positioning - src/backends/ascii/fortplot_ascii.f90: handle LEGEND_EAST in ASCII - src/backends/ascii/fortplot_ascii_legend.f90: handle LEGEND_EAST - test/test_pie_legend_east_pdf.f90: regression test for PDF output
Collaborator
Author
Review: Issue-Resolution VerificationIssue #1680: PDF pie chart legend box overlaps slice label, first entry label truncated ("OnlineNorth")
Code Review
Deferred (polish, tracked separately)
Verdict: PR fully resolves issue #1680. All requirements addressed with evidence. No blocking issues. Ready for merge after CI completes. |
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
The
'east'legend location string was unrecognized bylegend_set_positionand fell through toLEGEND_UPPER_RIGHT, placing the legend inside the plot area where it overlapped pie slice labels in PDF output. The merged text appeared as "OnlineNorth" instead of two separate entries.Added
LEGEND_EASTposition constant that places the legend outside the plot area to the right, centered vertically — matching matplotlib semantics.Changes
src/ui/fortplot_legend.f90: newLEGEND_EASTconstant (5);'east'case inlegend_set_position; ASCII layout casesrc/ui/fortplot_legend_layout.f90:LEGEND_EASThandling incalculate_legend_positionsrc/backends/ascii/fortplot_ascii.f90:LEGEND_EASTcase inascii_calculate_legend_positionsrc/backends/ascii/fortplot_ascii_legend.f90:LEGEND_EASTcase incalculate_ascii_legend_positiontest/test_pie_legend_east_pdf.f90: regression test — creates pie chart with'east'legend, saves PDF, verifies no merged textVerification
Test passes after fix
CI test suite passes
Artifact verification passes
PDF text extraction confirms fix
Before: legend text and slice label merged into single string in PDF.
After:
pdftotextshows "Online" and "North" as separate text entries: