Skip to content

Commit

Permalink
Add an "add a title" to starter tutorial (GenericMappingTools#1688)
Browse files Browse the repository at this point in the history
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Wei Ji <[email protected]>
  • Loading branch information
3 people authored and Josh Sixsmith committed Dec 21, 2022
1 parent e8000a2 commit b44a917
Showing 1 changed file with 29 additions and 3 deletions.
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 **a**\ nnotate the axes automatically.

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 any spaces, the string to set the title needs to
# be wrapped in single-quotes, while the actual title is set in double quotes
# (e.g. setting the title to "A Title" would use the syntax ``'+t"A Title"'``.

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

0 comments on commit b44a917

Please sign in to comment.