Skip to content
Merged
Changes from 2 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
32 changes: 29 additions & 3 deletions examples/get-started/first_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@
# annotate the latitude and longitude of the region.
#
# The ``frame`` parameter is used to add a frame to the figure. For now, it
# will be set to ``True`` to use default settings, but later tutorials will
# show how ``frame`` can be used to customize the axes, gridlines, and titles.
# will be set to ``"a"`` to use automatic annotation settings.

fig = pygmt.Figure()
fig.coast(
Expand All @@ -131,7 +130,34 @@
land="lightgreen",
water="lightblue",
projection="M10c",
frame=True,
frame="a",
)
fig.show()

###############################################################################
# Add a title
# -----------
#
# The ``frame`` parameter can be used to add a title to the figure. The title
# is set with by passing ``"+t"`` followed by the title (e.g. setting the map
# title to "Title" would be ``"+tTitle"``).
#
# To pass multiple arguments to ``frame``, a list can be used, as shown in the
# example below. This format uses ``frame`` to set both the axes gridlines and
# the figure title.
#
# If the figure title has multiple words, the string to set the title needs to
# use single-quotes, with the actual title set in double quotes (e.g. setting
# the title to "Coastal Maine" would use the syntax ``'+t"Coastal Maine"'``.

fig = pygmt.Figure()
fig.coast(
region=[-69, -68, 43.75, 44.75],
shorelines=True,
land="lightgreen",
water="lightblue",
projection="M10c",
frame=["a", "+tMaine"],
)
fig.show()

Expand Down