Skip to content
Merged
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
35 changes: 35 additions & 0 deletions examples/gallery/embellishments/timestamp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""
Timestamp
---------
The :meth:`pygmt.Figure.timestamp` method can draw the
GMT timestamp logo on the figure. The timestamp
will always be shown relative to the bottom-left corner
of the figure. By default, the ``offset`` and
``justification`` parameters are set to
``("-54p", "-54p")`` (x, y directions) and ``"BL"``
(bottom-left), respectively.
"""

# sphinx_gallery_thumbnail_number = 1

import pygmt

fig = pygmt.Figure()
fig.basemap(region=[20, 30, -10, 10], projection="X10c/5c")
fig.timestamp()
fig.show()

###############################################################################
# Additionally, a custom label can be added via the ``label`` parameter. The
# label font can be defined via the ``font`` parameter and the timestamp string
# format via ``timefmt``.

fig = pygmt.Figure()
fig.coast(region="d", projection="H10c", land="black", water="cornsilk", frame="afg")
fig.timestamp(
label="Powered by PyGMT",
justification="TL",
font="Times-Bold",
timefmt="%Y-%m-%dT%H:%M",
)
fig.show()