Skip to content
Draft
Changes from 8 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
85e411c
Add code example for formating text as paragraph
yvonnefroehlich Apr 16, 2026
9839b8b
Remove execution permission
yvonnefroehlich Apr 16, 2026
a9efead
Fix typos
yvonnefroehlich Apr 16, 2026
8f7d1f5
Add link to gallery example
yvonnefroehlich Apr 20, 2026
d44dd9e
Merge branch 'main' into add-gallery-paragraph
yvonnefroehlich Apr 20, 2026
e0081b0
Add seperator at code beginning
yvonnefroehlich Apr 20, 2026
e71117c
Fix method highlighting
yvonnefroehlich Apr 21, 2026
ecc9232
Improve and extend intro text
yvonnefroehlich Apr 21, 2026
ecdba41
Improve title
yvonnefroehlich Apr 23, 2026
9e17927
Improve formulations
yvonnefroehlich Apr 23, 2026
025baeb
Add draft of PyGMT version of GMT example
yvonnefroehlich Apr 26, 2026
6f73c9c
Merge branch 'main' into add-gallery-paragraph
yvonnefroehlich Apr 26, 2026
fd044df
Add note regarding white space at end of strings for paragraph recogn…
yvonnefroehlich Apr 26, 2026
19eb614
Merge remote-tracking branch 'origin/add-gallery-paragraph' into add-…
yvonnefroehlich Apr 26, 2026
c8ee6f2
Merge branch 'main' into add-gallery-paragraph
yvonnefroehlich Apr 28, 2026
4280487
Merge branch 'main' into add-gallery-paragraph
yvonnefroehlich May 1, 2026
06e8147
Merge branch 'main' into add-gallery-paragraph
yvonnefroehlich Jul 3, 2026
8a01b35
Merge branch 'main' into add-gallery-paragraph
yvonnefroehlich Jul 4, 2026
df8ecd1
Typeset spaces and tabs
yvonnefroehlich Jul 7, 2026
2b62f3e
Add comment
yvonnefroehlich Jul 7, 2026
c999cbd
Merge branch 'main' into add-gallery-paragraph
yvonnefroehlich Jul 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions examples/gallery/embellishments/paragraph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Paragraph
=========
Comment thread
yvonnefroehlich marked this conversation as resolved.
Outdated

To plot longer text as one or several paragraphs the :meth:`pygmt.Figure.paragraph`
Comment thread
yvonnefroehlich marked this conversation as resolved.
Outdated
method can be used. The ``parwidth`` and ``linespacing`` parameters allow to set
the line length and spacing of the paragraph, respectively.` The desired text can
Comment thread
yvonnefroehlich marked this conversation as resolved.
Outdated
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 </gallery/embellishments/text_formatting>`.
"""

# %%
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()
Loading