Figure.text: Migrate the fill/pen parameters to the new alias system#4489
Figure.text: Migrate the fill/pen parameters to the new alias system#4489
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates Figure.text/text_ handling of the GMT -G (fill) and -W (pen) options from the legacy @use_alias mechanism to the newer AliasSystem-based alias handling.
Changes:
- Removed
G="fill"andW="pen"from the@use_aliasdecorator and introduced explicitfill/penkeyword parameters. - Added
fill/peninto theAliasSystemconstruction so they are emitted as-G/-W. - Tightened type annotations for
angleandfont, and added an inlinetype: ignorefor a mixed-type list used in validation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| angle=None, | ||
| font=None, | ||
| angle: float | Sequence[float] | bool = False, | ||
| font: str | StringArrayTypes | bool = False, |
There was a problem hiding this comment.
I am wondering about the context of the type bool for angle and font. Why was there a change from None to False? And I am wondering if this causes the newly occuring warning by the Figure.text method, e.g., https://www.pygmt.org/dev/tutorials/basics/text.html:
text [WARNING]: Length <unit> e not supported - revert to default unit [point]
text [WARNING]: Fals not a valid number and may not be decoded properly.
text [WARNING]: Representation of font size not recognized. Using default.There was a problem hiding this comment.
I am wondering about the context of the type
boolforangleandfont. Why was there a change fromNonetoFalse?
In Figure.text, angle=True, font=True means the input file contains columns for angle and font, so angle/font can accept bools.
The issue is that when changing the default from None to False, I didn't update the checking of these parameters. #4577 should fix it.
There was a problem hiding this comment.
In Figure.text, angle=True, font=True means the input file contains columns for angle and font, so angle/font can accept bools.
Ah, OK. Thanks!
Just regular migration.