From 1652c57ff3987def230cfe9edb9bc2ded1e88b30 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 3 Mar 2023 09:32:43 +0100 Subject: [PATCH 01/15] Create timestamp.py --- examples/gallery/embellishments/timestamp.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 examples/gallery/embellishments/timestamp.py diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py new file mode 100644 index 00000000000..94bb2997b77 --- /dev/null +++ b/examples/gallery/embellishments/timestamp.py @@ -0,0 +1,10 @@ +import pygmt + +fig = pygmt.Figure() +fig.timestamp() +fig.show() + +# Plot the GMT timestamp logo with a custom label. +fig = pygmt.Figure() +fig.timestamp(label="Powered by PyGMT") +fig.show() From 9842c393209bdc6ffec02770ff57944793a0b6b2 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Fri, 3 Mar 2023 09:44:34 +0100 Subject: [PATCH 02/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 94bb2997b77..7b4ea902a4e 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -1,5 +1,8 @@ import pygmt +# define static format string +pygmt.config(FORMAT_TIME_STAMP="2023-03-01T20:45:15") + fig = pygmt.Figure() fig.timestamp() fig.show() From 6a6756c8ba9cb1578a1aca237934d52f255e7f4e Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:15:51 +0100 Subject: [PATCH 03/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 7b4ea902a4e..15c306196d0 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -1,6 +1,14 @@ +""" +Timestamp +--------- +The :meth:`pygmt.Figure.timestamp` method can draw the +GMT time stamp logo on the map/plot. A custom label +can be added via the ``label`` parameter. +""" + import pygmt -# define static format string +# Define static format string pygmt.config(FORMAT_TIME_STAMP="2023-03-01T20:45:15") fig = pygmt.Figure() From 118cf12df5e590b256f261372025ee6b47038359 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:18:18 +0100 Subject: [PATCH 04/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 15c306196d0..a0d588707ee 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -8,7 +8,7 @@ import pygmt -# Define static format string +# Define static format string. pygmt.config(FORMAT_TIME_STAMP="2023-03-01T20:45:15") fig = pygmt.Figure() From f7e1e3472cd4ab41316e1275adadf7c9d641ccbb Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:19:39 +0100 Subject: [PATCH 05/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index a0d588707ee..af8f428a0b9 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -2,7 +2,7 @@ Timestamp --------- The :meth:`pygmt.Figure.timestamp` method can draw the -GMT time stamp logo on the map/plot. A custom label +GMT timestamp logo on the map/plot. A custom label can be added via the ``label`` parameter. """ From 7befea70d7a6c30d49347df81ae36f59ca93e9c3 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 6 Mar 2023 09:38:19 +0100 Subject: [PATCH 06/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index af8f428a0b9..3f86842d2b7 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -2,7 +2,7 @@ Timestamp --------- The :meth:`pygmt.Figure.timestamp` method can draw the -GMT timestamp logo on the map/plot. A custom label +GMT timestamp logo on the map/plot. A custom label can be added via the ``label`` parameter. """ From a5c651bf0944bde0666ba917d4ac98140988b8f8 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 6 Mar 2023 10:10:35 +0100 Subject: [PATCH 07/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 3f86842d2b7..1e9a11de963 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -8,9 +8,6 @@ import pygmt -# Define static format string. -pygmt.config(FORMAT_TIME_STAMP="2023-03-01T20:45:15") - fig = pygmt.Figure() fig.timestamp() fig.show() From edb05d04bba136488855beb56b7283abd824020f Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 6 Mar 2023 12:08:21 +0100 Subject: [PATCH 08/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 1e9a11de963..7dcf9aa2ce3 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -2,17 +2,17 @@ Timestamp --------- The :meth:`pygmt.Figure.timestamp` method can draw the -GMT timestamp logo on the map/plot. A custom label -can be added via the ``label`` parameter. +GMT time stamp logo on the map/plot. A custom label +can be added via the ``label`` parameter. The timestamp +will always be shown in the bottom-left corner of the +figure. """ import pygmt fig = pygmt.Figure() +fig.basemap(region=[20, 30, -10, 10], projection="X10c/5c") fig.timestamp() -fig.show() - # Plot the GMT timestamp logo with a custom label. -fig = pygmt.Figure() -fig.timestamp(label="Powered by PyGMT") +fig.timestamp(label="Powered by PyGMT", justification="TL") fig.show() From 38fdb0370e0c93789db623f060012bbd7606af73 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Mon, 6 Mar 2023 13:53:43 +0100 Subject: [PATCH 09/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 7dcf9aa2ce3..337157001e8 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -2,9 +2,9 @@ Timestamp --------- The :meth:`pygmt.Figure.timestamp` method can draw the -GMT time stamp logo on the map/plot. A custom label -can be added via the ``label`` parameter. The timestamp -will always be shown in the bottom-left corner of the +GMT time stamp logo on the map/plot. A custom label +can be added via the ``label`` parameter. The timestamp +will always be shown in the bottom-left corner of the figure. """ From 1e1e4d91b9952a5a4d9d159b82bc466ed42a61d0 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 7 Mar 2023 09:02:07 +0100 Subject: [PATCH 10/15] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- examples/gallery/embellishments/timestamp.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 337157001e8..5411097d618 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -2,10 +2,13 @@ Timestamp --------- The :meth:`pygmt.Figure.timestamp` method can draw the -GMT time stamp logo on the map/plot. A custom label +GMT timestamp logo on the figure. A custom label can be added via the ``label`` parameter. The timestamp -will always be shown in the bottom-left corner of the -figure. +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. """ import pygmt From 5a1c3533723be9762e157ccfdbdd3307ad078426 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 7 Mar 2023 09:10:14 +0100 Subject: [PATCH 11/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 5411097d618..0dc01c4b4cd 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -16,6 +16,10 @@ fig = pygmt.Figure() fig.basemap(region=[20, 30, -10, 10], projection="X10c/5c") fig.timestamp() +fig.show() + +fig = pygmt.Figure() +fig.coast(region="d", projection="H10c", land="black", water="cornsilk", frame="afg") # Plot the GMT timestamp logo with a custom label. fig.timestamp(label="Powered by PyGMT", justification="TL") fig.show() From 4ac0b491a797edc79e2c7b6fc0a657ca151fd71f Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 7 Mar 2023 17:19:46 +0100 Subject: [PATCH 12/15] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com> --- examples/gallery/embellishments/timestamp.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 0dc01c4b4cd..95a6f913d61 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -11,6 +11,8 @@ (bottom-left), respectively. """ +# sphinx_gallery_thumbnail_number = 1 + import pygmt fig = pygmt.Figure() @@ -18,6 +20,9 @@ fig.timestamp() fig.show() +############################################################################### +# Maybe some short description of the ``font`` and ``timefmt`` parameters. + fig = pygmt.Figure() fig.coast(region="d", projection="H10c", land="black", water="cornsilk", frame="afg") # Plot the GMT timestamp logo with a custom label. From 668318ac1325bd81898c4df14cc2581d4dbe5938 Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Tue, 7 Mar 2023 17:29:07 +0100 Subject: [PATCH 13/15] Update timestamp.py --- examples/gallery/embellishments/timestamp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 95a6f913d61..f7c949f535d 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -2,8 +2,7 @@ Timestamp --------- The :meth:`pygmt.Figure.timestamp` method can draw the -GMT timestamp logo on the figure. A custom label -can be added via the ``label`` parameter. The timestamp +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 @@ -21,10 +20,11 @@ fig.show() ############################################################################### -# Maybe some short description of the ``font`` and ``timefmt`` parameters. +# 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") -# Plot the GMT timestamp logo with a custom label. -fig.timestamp(label="Powered by PyGMT", justification="TL") +fig.timestamp(label="Powered by PyGMT", justification="TL",font="Times-Bold", timefmt="%Y-%m-%dT%H:%M") fig.show() From c682b924b1dc2b6f2ca10f030052bd86b3c8745a Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Tue, 7 Mar 2023 16:32:24 +0000 Subject: [PATCH 14/15] [format-command] fixes --- examples/gallery/embellishments/timestamp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index f7c949f535d..15d517c5e1d 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -20,11 +20,16 @@ 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 +# 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.timestamp( + label="Powered by PyGMT", + justification="TL", + font="Times-Bold", + timefmt="%Y-%m-%dT%H:%M", +) fig.show() From d35650a5c0a35a620d59ec94da77c040682afe3f Mon Sep 17 00:00:00 2001 From: Michael Grund <23025878+michaelgrund@users.noreply.github.com> Date: Wed, 8 Mar 2023 07:23:52 +0100 Subject: [PATCH 15/15] Apply suggestions from code review Co-authored-by: Dongdong Tian --- examples/gallery/embellishments/timestamp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gallery/embellishments/timestamp.py b/examples/gallery/embellishments/timestamp.py index 15d517c5e1d..1c7bfdfab6f 100644 --- a/examples/gallery/embellishments/timestamp.py +++ b/examples/gallery/embellishments/timestamp.py @@ -7,7 +7,7 @@ of the figure. By default, the ``offset`` and ``justification`` parameters are set to ``("-54p", "-54p")`` (x, y directions) and ``"BL"`` -(bottom-left), respectively. +(bottom-left), respectively. """ # sphinx_gallery_thumbnail_number = 1