Skip to content
Draft
Changes from 6 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
37 changes: 37 additions & 0 deletions examples/gallery/embellishments/paragraph.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""
Paragraph
=========
Comment thread
yvonnefroehlich marked this conversation as resolved.
Outdated

To plot longer text as one or several paragraphs the `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.` Two paragraphs are
automatically separated by a blank line.
Comment thread
yvonnefroehlich marked this conversation as resolved.
Outdated

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