Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an "add a title" to starter tutorial #1688

Merged
merged 7 commits into from
Jan 3, 2022
Merged
Changes from 5 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 **a**nnotate the axes automatically.
Copy link
Member

Choose a reason for hiding this comment

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

Oops, forgot that this is RST and not markdown. How do you set bold text again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed in 606ee98.

willschlitzer marked this conversation as resolved.
Show resolved Hide resolved

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