Add Figure.paragraph to typeset one or multiple paragraph of text strings#3709
Add Figure.paragraph to typeset one or multiple paragraph of text strings#3709
Conversation
bbb0de1 to
43d49fb
Compare
43d49fb to
a617468
Compare
Summary of changed imagesThis is an auto-generated report of images that have changed on the DVC remote
Image diff(s)DetailsAdded images
Modified images
Report last updated at commit 23dad7b |
e3f3640 to
618522a
Compare
a3a742d to
425e1b6
Compare
5707c88 to
10795da
Compare
10795da to
1732fda
Compare
1732fda to
8e31570
Compare
23dad7b to
961785d
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new high-level Figure.paragraph method to typeset one or multiple paragraphs by wrapping GMT text module paragraph mode (-M), plus associated tests, baselines, and documentation wiring.
Changes:
- Implement
pygmt.Figure.paragraph(newpygmt/src/paragraph.py) using a virtualfile multi-segment input andtext -M. - Add mpl image comparison tests and baseline artifacts for single- and multi-paragraph inputs.
- Expose the new method in the Figure API and documentation index, and cross-link from
textdocs.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
pygmt/src/paragraph.py |
New Figure.paragraph implementation (builds text -M input via StringIO + virtual file). |
pygmt/src/__init__.py |
Exports paragraph so it can be attached to Figure. |
pygmt/figure.py |
Adds paragraph to the methods imported onto Figure. |
pygmt/src/text.py |
Adds a doc cross-reference from text to Figure.paragraph. |
doc/api/index.rst |
Adds Figure.paragraph to the API listing. |
pygmt/tests/test_paragraph.py |
Adds image tests covering single paragraph and two multi-paragraph input styles. |
pygmt/tests/baseline/*.png.dvc |
Adds DVC pointers for new image baselines. |
💡 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 8 out of 8 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| font: float | str | None = None, | ||
| angle: float | None = None, | ||
| justify: AnchorCode | None = None, | ||
| alignment: Literal["left", "center", "right", "justified"] = "left", |
There was a problem hiding this comment.
Figure.paragraph currently doesn’t accept **kwargs (nor merge them into AliasSystem), which prevents users from passing through other valid text options in paragraph mode (e.g., -G, -W, -N, -Q, -t, -c, -V). Consider adding a **kwargs parameter and calling aliasdict.merge(kwargs) so unsupported/advanced flags can still be used without waiting for first-class wrapper parameters (and without a future breaking API change).
| alignment: Literal["left", "center", "right", "justified"] = "left", | |
| alignment: Literal["left", "center", "right", "justified"] = "left", | |
| **kwargs, |

Initial implementation for the
Figure.paragraphmethod, which wraps thetextmodule's-Moption.Related to #3710.
Preview:
Example