From 85e411c48a4260978345d867b6fb1590eab6611d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Thu, 16 Apr 2026 18:47:15 +0200 Subject: [PATCH 1/7] Add code example for formating text as paragraph --- examples/gallery/embellishments/paragraph.py | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 examples/gallery/embellishments/paragraph.py diff --git a/examples/gallery/embellishments/paragraph.py b/examples/gallery/embellishments/paragraph.py new file mode 100755 index 00000000000..1c1074bf44a --- /dev/null +++ b/examples/gallery/embellishments/paragraph.py @@ -0,0 +1,37 @@ +""" +Paragraph +========= + +To plot longer text as one or several paragraphs the `pygmt.Figure.paragraph` +method can be used. The ``parwidth`` and ``linespacing`` parameters allow to +set the line length and line spacing of the paragraph, respectively.` Two +paragraphs are automatically seperated by a blank line. + +For specificy text formating see the gallery example +https://www.pygmt.org/latest/gallery/embellishments/text_formatting.html + +""" + +import pygmt + +fig = pygmt.Figure() +fig.basemap(region=[-5, 5, -5, 5], projection="X10c/10c", frame=True) + +fig.paragraph( + x=0, + y=0, + text=[ + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ", + "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", + ], + parwidth="4.5c", + linespacing="12p", + font="10p,Helvetica-Bold,steelblue", + angle=45, + justify="MC", + alignment="center", + fill="lightgray", # font color ignored + pen="1p,gray10", # font color ignored +) + +fig.show() From 9839b8b8387cfcd82bbc1b1490866270ea944d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Thu, 16 Apr 2026 19:07:25 +0200 Subject: [PATCH 2/7] Remove execution permission --- examples/gallery/embellishments/paragraph.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 examples/gallery/embellishments/paragraph.py diff --git a/examples/gallery/embellishments/paragraph.py b/examples/gallery/embellishments/paragraph.py old mode 100755 new mode 100644 From a9efead6b623f189be2b638c0b96d8314bb667fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Thu, 16 Apr 2026 23:56:31 +0200 Subject: [PATCH 3/7] Fix typos --- examples/gallery/embellishments/paragraph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/embellishments/paragraph.py b/examples/gallery/embellishments/paragraph.py index 1c1074bf44a..3894cd5b609 100644 --- a/examples/gallery/embellishments/paragraph.py +++ b/examples/gallery/embellishments/paragraph.py @@ -5,9 +5,9 @@ To plot longer text as one or several paragraphs the `pygmt.Figure.paragraph` method can be used. The ``parwidth`` and ``linespacing`` parameters allow to set the line length and line spacing of the paragraph, respectively.` Two -paragraphs are automatically seperated by a blank line. +paragraphs are automatically separated by a blank line. -For specificy text formating see the gallery example +For detailed text formatting see the gallery example https://www.pygmt.org/latest/gallery/embellishments/text_formatting.html """ From 8f7d1f57136d1aa6014bb6828c91421616450f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 20 Apr 2026 21:52:42 +0200 Subject: [PATCH 4/7] Add link to gallery example --- examples/gallery/embellishments/paragraph.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/gallery/embellishments/paragraph.py b/examples/gallery/embellishments/paragraph.py index 3894cd5b609..d9f7daece0f 100644 --- a/examples/gallery/embellishments/paragraph.py +++ b/examples/gallery/embellishments/paragraph.py @@ -3,13 +3,12 @@ ========= To plot longer text as one or several paragraphs the `pygmt.Figure.paragraph` -method can be used. The ``parwidth`` and ``linespacing`` parameters allow to -set the line length and line spacing of the paragraph, respectively.` Two -paragraphs are automatically separated by a blank line. - -For detailed text formatting see the gallery example -https://www.pygmt.org/latest/gallery/embellishments/text_formatting.html +method can be used. The ``parwidth`` and ``linespacing`` parameters allow to set +the line length and spacing of the paragraph, respectively.` Two paragraphs are +automatically separated by a blank line. +For details on text formatting see the gallery example +:doc:`Text formatting `. """ import pygmt From e0081b00243e10dfd96243d2901f614db9ba3c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Mon, 20 Apr 2026 22:00:13 +0200 Subject: [PATCH 5/7] Add seperator at code beginning --- examples/gallery/embellishments/paragraph.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/gallery/embellishments/paragraph.py b/examples/gallery/embellishments/paragraph.py index d9f7daece0f..5f104272ecd 100644 --- a/examples/gallery/embellishments/paragraph.py +++ b/examples/gallery/embellishments/paragraph.py @@ -11,6 +11,7 @@ :doc:`Text formatting `. """ +# %% import pygmt fig = pygmt.Figure() From e71117c333db1069f6bfa2973ac10fb4bcebe2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= <94163266+yvonnefroehlich@users.noreply.github.com> Date: Tue, 21 Apr 2026 23:03:31 +0200 Subject: [PATCH 6/7] Fix method highlighting Co-authored-by: Dongdong Tian --- examples/gallery/embellishments/paragraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/paragraph.py b/examples/gallery/embellishments/paragraph.py index 5f104272ecd..469e06844f3 100644 --- a/examples/gallery/embellishments/paragraph.py +++ b/examples/gallery/embellishments/paragraph.py @@ -2,7 +2,7 @@ Paragraph ========= -To plot longer text as one or several paragraphs the `pygmt.Figure.paragraph` +To plot longer text as one or several paragraphs the :meth:`pygmt.Figure.paragraph` method can be used. The ``parwidth`` and ``linespacing`` parameters allow to set the line length and spacing of the paragraph, respectively.` Two paragraphs are automatically separated by a blank line. From ecc9232e0443c6bb68e037c8dcb543c10fcd1604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yvonne=20Fr=C3=B6hlich?= Date: Tue, 21 Apr 2026 23:12:00 +0200 Subject: [PATCH 7/7] Improve and extend intro text --- examples/gallery/embellishments/paragraph.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/gallery/embellishments/paragraph.py b/examples/gallery/embellishments/paragraph.py index 469e06844f3..24b37d97ce9 100644 --- a/examples/gallery/embellishments/paragraph.py +++ b/examples/gallery/embellishments/paragraph.py @@ -4,8 +4,13 @@ To plot longer text as one or several paragraphs the :meth:`pygmt.Figure.paragraph` method can be used. The ``parwidth`` and ``linespacing`` parameters allow to set -the line length and spacing of the paragraph, respectively.` Two paragraphs are -automatically separated by a blank line. +the line length and spacing of the paragraph, respectively.` The desired text can +be provided using two ways to indicate a new paragraph: + +(1) a single string separated by a blank line +(2) a list of strings + +During plotting the paragraphs are automatically separated by a blank line. For details on text formatting see the gallery example :doc:`Text formatting `.