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>
yvonnefroehlich
left a comment
There was a problem hiding this comment.
As this is probaly the first implemention of this new method, clearance (and other parameters) will be add in a later PR, or?
Yes, this PR focuses on the required and frequently used parameters only. |
yvonnefroehlich
left a comment
There was a problem hiding this comment.
Looks good to me!
On side questions: Using text in line 1 \n text in line 2 to get a new line is still not supported. As far as I understand it, two paragraphs are automatically seperated by a blank line via \n\n.
| pen | ||
| Set the pen used to draw a rectangle around the paragraph [Default is | ||
| ``"0.25p,black,solid"``]. |
There was a problem hiding this comment.
In case of multiple paragraphs, the entier text is surrounded by a box, or does each paragraph gets its own box?
There was a problem hiding this comment.
the entier text is surrounded by a box
This is the answer.
Do you mean in
Yes. |

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