Add polar-aware rlabel and thetalabel support#714
Open
kinyatoride wants to merge 2 commits intoUltraplot:mainfrom
Open
Add polar-aware rlabel and thetalabel support#714kinyatoride wants to merge 2 commits intoUltraplot:mainfrom
kinyatoride wants to merge 2 commits intoUltraplot:mainfrom
Conversation
Co-authored-by: Copilot <copilot@github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Add polar-aware rlabel and thetalabel support
Hi! I think having
rlabelandthetalabelfor polar plots is useful for manycases — Taylor diagrams being one example. I've added this support along with
tests. Let me know what you think!
Summary
This PR adds polar-aware axis label support to
PolarAxes.format()with newthetalabelandrlabelarguments rendered viaCurvedText.Key Features
thetalabelfor labels that follow the outer polar arc.rlabelfor labels that follow a radial spoke.thetalabellocto control the center angle of the theta label.rlabellocto control which side or spoke the radial label uses.rlabelposplacement for radial labels.thetalabel_kwandrlabel_kw.theta0,thetadir)Implementation
ultraplot/axes/polar.pyCurvedTextinultraplot/text.pyso transformed and styled curved labelsbehave correctly on polar axes
ultraplot/internals/labels.pyso border and bboxstyling can be applied safely to curved labels
Validation
Focused polar regression tests pass:
python -m pytest ultraplot/tests/test_projections.py -k "polar and not mpl_image_compare"This also adds regression coverage for:
thetalabeloutward placementExamples
Examples of full-circle, sector, annular, and rotated-axis polar labels: