Skip to content
Draft
Changes from all commits
Commits
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 on lines +2 to +3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Paragraph
=========
Paragraphs of long text
=======================


To plot longer text as one or several paragraphs the :meth:`pygmt.Figure.paragraph`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
To plot longer text as one or several paragraphs the :meth:`pygmt.Figure.paragraph`
To typeset long 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.` The desired text can
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
the line length and spacing of the paragraph, respectively.` The desired text can
the width of the paragraph and line spacing, 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 </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