GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add Figure.paragraph to typeset one or multiple paragraph of text strings by seisman · Pull Request #3709 · GenericMappingTools/pygmt

Conversation

@seisman

@seisman seisman commented Dec 24, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Initial implementation for the Figure.paragraph method, which wraps the text module's -M option.

Related to #3710.

Preview:

  • https://pygmt-dev--3709.org.readthedocs.build/en/3709/api/generated/pygmt.Figure.paragraph.html
  • https://pygmt-dev--3709.org.readthedocs.build/en/3709/api/generated/pygmt.Figure.text.html

Example

import pygmt

fig = pygmt.Figure()
fig.basemap(region=[0, 10, 0, 10], projection="X10c/10c", frame=True)
fig.paragraph(
    x=4,
    y=4,
    text="This is a long paragraph. " * 10,
    parwidth="5c",
    linespacing="12p",
    font="12p",
)
fig.show()

map

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman seisman mentioned this pull request Dec 24, 2024
Figure.paragraph: Typeset one or multiple paragraphs #3710
Closed
9 of 38 tasks
@seisman
seisman force-pushed the feature/paragraph branch from bbb0de1 to 43d49fb Compare January 6, 2025 04:17
@seisman seisman added the feature Brand new feature label Jan 6, 2025
@seisman
seisman force-pushed the feature/paragraph branch from 43d49fb to a617468 Compare January 6, 2025 04:42
@github-actions

github-actions Bot commented Jan 6, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary of changed images

This is an auto-generated report of images that have changed on the DVC remote

Status Path
added pygmt/tests/baseline/test_paragraph.png
added pygmt/tests/baseline/test_paragraph_multiple_paragraphs_blankline.png
added pygmt/tests/baseline/test_paragraph_multiple_paragraphs_list.png

Image diff(s)

Details

Added images

  • test_paragraph.png

  • test_paragraph_multiple_paragraphs_blankline.png

  • test_paragraph_multiple_paragraphs_list.png

Modified images

Path Old New

Report last updated at commit 23dad7b

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman
seisman force-pushed the feature/paragraph branch 2 times, most recently from e3f3640 to 618522a Compare January 6, 2025 06:12
@seisman
seisman force-pushed the feature/paragraph branch 2 times, most recently from a3a742d to 425e1b6 Compare May 2, 2025 12:23
@seisman seisman added this to PyGMT paper Jun 4, 2025
@seisman
seisman force-pushed the feature/paragraph branch from 5707c88 to 10795da Compare July 30, 2025 06:50
@seisman seisman added this to the 0.18.0 milestone Sep 18, 2025
@seisman
seisman force-pushed the feature/paragraph branch from 10795da to 1732fda Compare September 20, 2025 04:51
@seisman
seisman force-pushed the feature/paragraph branch from 1732fda to 8e31570 Compare October 20, 2025 11:03
This was referenced Nov 6, 2025
Figure 1: Comparison of GMT and PyGMT syntax GenericMappingTools/pygmt-paper-figures#4
Merged
Tracking the status of the examples included in the paper GenericMappingTools/pygmt-paper-figures#14
Closed
@seisman seisman modified the milestones: 0.18.0, 0.19.0 Dec 25, 2025
@seisman
Figure.paragraph: Initial implementation focusing on input data
961785d
@seisman
seisman force-pushed the feature/paragraph branch from 23dad7b to 961785d Compare April 2, 2026 10:09
@seisman
seisman requested a review from Copilot April 2, 2026 10:09
Copilot started reviewing on behalf of seisman April 2, 2026 10:10
View session
Copilot AI reviewed Apr 2, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (new pygmt/src/paragraph.py) using a virtualfile multi-segment input and text -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 text docs.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pygmt/src/paragraph.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/paragraph.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/paragraph.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/paragraph.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_paragraph.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_paragraph.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/text.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

seisman and others added 3 commits April 2, 2026 18:37
@seisman
Update pygmt/src/text.py
3d34663
Co-authored-by: Copilot <[email protected]>
@seisman
Merge two tests into one
4da6010
@seisman
Apply copilot suggestions
539fd0c
@seisman
seisman requested a review from Copilot April 2, 2026 10:41
Copilot started reviewing on behalf of seisman April 2, 2026 10:42
View session
seisman added 2 commits April 2, 2026 18:42
@seisman
Use a tuple instead of a set
4a0552c
@seisman
Need to set filename in tests
83218fd
@seisman
seisman marked this pull request as ready for review April 3, 2026 03:55
seisman added 3 commits April 3, 2026 12:01
@seisman
Support options -V, -c and -t
d15d5fa
@seisman
Merge branch 'main' into feature/paragraph
82f4811
@seisman
Merge branch 'main' into feature/paragraph
6092c21
@seisman
seisman had a problem deploying to pr-tests April 4, 2026 13:23 — with GitHub Actions Failure
@seisman
Merge branch 'main' into feature/paragraph
288ca34
@seisman
seisman had a problem deploying to pr-tests April 6, 2026 11:50 — with GitHub Actions Failure
@seisman
seisman requested a review from a team April 6, 2026 12:35
yvonnefroehlich
yvonnefroehlich reviewed Apr 8, 2026
View reviewed changes

@yvonnefroehlich yvonnefroehlich left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is probaly the first implemention of this new method, clearance (and other parameters) will be add in a later PR, or?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman

seisman commented Apr 8, 2026

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman
Merge branch 'main' into feature/paragraph
8adb6a4
@seisman
seisman had a problem deploying to pr-tests April 8, 2026 12:01 — with GitHub Actions Failure
@seisman
Merge branch 'main' into feature/paragraph
463fe85
@seisman
seisman had a problem deploying to pr-tests April 8, 2026 16:54 — with GitHub Actions Failure
@seisman
Merge branch 'main' into feature/paragraph
3aa2583
@seisman
seisman had a problem deploying to pr-tests April 9, 2026 10:00 — with GitHub Actions Failure
@seisman
seisman requested a review from a team April 9, 2026 17:00
@seisman
Merge branch 'main' into feature/paragraph
e77be5e
@seisman
seisman had a problem deploying to pr-tests April 9, 2026 17:02 — with GitHub Actions Failure
yvonnefroehlich
yvonnefroehlich reviewed Apr 10, 2026
View reviewed changes

@yvonnefroehlich yvonnefroehlich left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pygmt/src/paragraph.py
Comment on lines +76 to +78
pen
Set the pen used to draw a rectangle around the paragraph [Default is
``"0.25p,black,solid"``].

@yvonnefroehlich yvonnefroehlich Apr 10, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of multiple paragraphs, the entier text is surrounded by a box, or does each paragraph gets its own box?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seisman seisman Apr 10, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the entier text is surrounded by a box

This is the answer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman

seisman commented Apr 10, 2026

Copy link
Copy Markdown
Member Author

On side questions: Using text in line 1 \n text in line 2 to get a new line is still not supported.

Do you mean in Figure.text? Yes, it's not supported, and it's also difficult to support in GMT.

As far as I understand it, two paragraphs are automatically seperated by a blank line via \n\n.

Yes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Apr 10, 2026
yvonnefroehlich
yvonnefroehlich approved these changes Apr 10, 2026
View reviewed changes
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Apr 10, 2026
@seisman
seisman merged commit d4a006c into main Apr 10, 2026
20 of 24 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@seisman
seisman deleted the feature/paragraph branch April 10, 2026 17:15
@github-project-automation github-project-automation Bot moved this to Done in PyGMT paper Apr 10, 2026
@seisman
seisman restored the feature/paragraph branch April 10, 2026 17:15
@seisman
seisman deleted the feature/paragraph branch June 25, 2026 04:53

This branch had an error being deployed

1 failed deployment
pr-tests — e77be5e5 Deployed Apr 9, 2026 by seisman via DVC image diff #1272
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@yvonnefroehlich yvonnefroehlich yvonnefroehlich approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

feature Brand new feature

Projects

No open projects
PyGMT paper
Status: Done

Milestone

0.19.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@seisman @yvonnefroehlich
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.