Add support for AnchoredText conversion to TikZ#62
Open
krishna-ji wants to merge 1 commit intoErwindeGelder:mainfrom
Open
Add support for AnchoredText conversion to TikZ#62krishna-ji wants to merge 1 commit intoErwindeGelder:mainfrom
krishna-ji wants to merge 1 commit intoErwindeGelder:mainfrom
Conversation
AnchoredText objects from matplotlib.offsetbox were previously ignored during conversion, producing a 'Don't know how to handle' warning. Now they are converted to TikZ \draw nodes with correct positioning and styling: - Map matplotlib loc codes (1-10) to rel axis cs coordinates with pgfplots anchors (e.g., upper left -> rel axis cs:0.02,0.98, anchor=north west) - Handle bounding box patch (fill, border, line width) - Handle font properties (size scaling, bold, italic, color) - Handle invisible patches (no box drawn) - Handle multiline text Added test_anchored_text.py with reference file.
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.
Fixes #53
Problem
AnchoredTextobjects frommatplotlib.offsetboxwere silently ignored during conversion, producing a warning:Don't know how to handle artist AnchoredText(...)Solution
AnchoredTextto the dispatch loop in_save.py::_recurse()(placed beforeTextto ensure correct isinstance matching order).draw_anchored_text()in_text.pythat:Textchildren from theAnchoredText'sTextArealoccodes (1–10) to tikz(rel axis cs:x,y)positions with appropriate anchors via_LOC_TO_TIKZTest
Added
test_anchored_text.pywith a matching reference file. All existing tests continue to pass (114/114).Validation
tox -e lint(ruff format, ruff check, mypy): all passtox -e py314(pytest): 114/114 pass