From 8c6e785b54621c8bb423a076b24e5191374e8553 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 25 Nov 2020 06:54:16 +0000 Subject: [PATCH 01/27] Add contour_map.py to new branch --- examples/tutorials/contour_map.py | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 examples/tutorials/contour_map.py diff --git a/examples/tutorials/contour_map.py b/examples/tutorials/contour_map.py new file mode 100644 index 00000000000..eff8c512c90 --- /dev/null +++ b/examples/tutorials/contour_map.py @@ -0,0 +1,73 @@ +""" +Creating a map with contour lines +================================= + +Plotting a contour map is handled by :meth:`pygmt.Figure.grdcontour` +""" + +import pygmt + +######################################################################################## +# Create contour plot +# ------------------- +# +# The grdcontour method takes the grid input and the region region values. +# It plots annotated contour lines, which are darker and have the elevation/depth written on them, +# and unannotated contour lines. In the example blow, the default contour line intervals are 500 meters, +# with an annotated contour line every 1000 meters. +# By default, it plots the map with a Mercator projection and with no frame. + +fig = pygmt.Figure() +fig.grdcontour(grid="@earth_relief_15s", region=[-92, -90, -1.5, 0.5]) +fig.show() + +######################################################################################## +# Contour line settings +# --------------------- +# +# Use the "annotation" and "interval" arguments to adjust contour line intervals +# In the example below, there are contour intervals every 250 meters and an annotated contour line every 1,000 meters. + +fig = pygmt.Figure() +fig.grdcontour( + annotation=1000, + interval=250, + grid="@earth_relief_15s", + region=[-92, -90, -1.5, 0.5], +) +fig.show() + +######################################################################################## +# Contour limits +# -------------- +# +# The limit argument sets the minimum and maximum values for the contour lines, with the value. +# The argument takes the low and high values, and is either a list (as below) or a string limit="-4000/0" + +fig = pygmt.Figure() +fig.grdcontour( + annotation=1000, + interval=250, + grid="@earth_relief_15s", + region=[-92, -90, -1.5, 0.5], + limit=[-4000, 0], +) +fig.show() + +######################################################################################## +# Map settings +# ------------ +# +# The grdcontour method accepts additional arguments, including setting the projection and frame. + +fig = pygmt.Figure() +fig.grdcontour( + annotation=1000, + interval=250, + grid="@earth_relief_15s", + region=[-92, -90, -1.5, 0.5], + limit=[-4000, 0], + projection="M4i", + frame=True, +) +fig.show() From 26a019acce89725c7d7330b7fbb8ccc8e06a0129 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 25 Nov 2020 06:55:19 +0000 Subject: [PATCH 02/27] Rename file, add tutorial to index --- doc/index.rst | 1 + examples/tutorials/{contour_map.py => contour-map.py} | 0 2 files changed, 1 insertion(+) rename examples/tutorials/{contour_map.py => contour-map.py} (100%) diff --git a/doc/index.rst b/doc/index.rst index 6551a514429..1451bddf69c 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -34,6 +34,7 @@ tutorials/plot.rst tutorials/text.rst tutorials/configuration.rst + tutorials/contour-map.rst .. toctree:: :maxdepth: 2 diff --git a/examples/tutorials/contour_map.py b/examples/tutorials/contour-map.py similarity index 100% rename from examples/tutorials/contour_map.py rename to examples/tutorials/contour-map.py From f55f610e4f0d366cf6830ba18ac91ad316e8e89c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 25 Nov 2020 20:18:14 +0000 Subject: [PATCH 03/27] Update examples/tutorials/contour-map.py Remove duplicate word Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index eff8c512c90..1a7ce4818ba 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -11,7 +11,7 @@ # Create contour plot # ------------------- # -# The grdcontour method takes the grid input and the region region values. +# The grdcontour method takes the grid input and the region values. # It plots annotated contour lines, which are darker and have the elevation/depth written on them, # and unannotated contour lines. In the example blow, the default contour line intervals are 500 meters, # with an annotated contour line every 1000 meters. From ef61481aa7f75b94515ba26d359364a434869944 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 25 Nov 2020 20:18:30 +0000 Subject: [PATCH 04/27] Update doc/index.rst Update order on tutorials Co-authored-by: Dongdong Tian --- doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/index.rst b/doc/index.rst index 1451bddf69c..a634c2fdf2a 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -33,8 +33,8 @@ tutorials/coastlines.rst tutorials/plot.rst tutorials/text.rst - tutorials/configuration.rst tutorials/contour-map.rst + tutorials/configuration.rst .. toctree:: :maxdepth: 2 From b45a1af181cdbcb617b2daf12e8795adb8521b44 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 25 Nov 2020 20:20:55 +0000 Subject: [PATCH 05/27] Update contour-map.py Update default projection --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 1a7ce4818ba..22441465f80 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -15,7 +15,7 @@ # It plots annotated contour lines, which are darker and have the elevation/depth written on them, # and unannotated contour lines. In the example blow, the default contour line intervals are 500 meters, # with an annotated contour line every 1000 meters. -# By default, it plots the map with a Mercator projection and with no frame. +# By default, it plots the map with a Equidistant cylindrical projection and with no frame. fig = pygmt.Figure() fig.grdcontour(grid="@earth_relief_15s", region=[-92, -90, -1.5, 0.5]) From 82ac185015dc35ba2eb8c598d43fc90dbf54f259 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 25 Nov 2020 20:39:39 +0000 Subject: [PATCH 06/27] Update contour-map.py Fix typo; "blow" to "below" --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 22441465f80..eb4aedb0edc 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -13,7 +13,7 @@ # # The grdcontour method takes the grid input and the region values. # It plots annotated contour lines, which are darker and have the elevation/depth written on them, -# and unannotated contour lines. In the example blow, the default contour line intervals are 500 meters, +# and unannotated contour lines. In the example below, the default contour line intervals are 500 meters, # with an annotated contour line every 1000 meters. # By default, it plots the map with a Equidistant cylindrical projection and with no frame. From 42abe59b3c4ab270c34b26d2895f37d33254dc45 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 28 Nov 2020 09:39:23 +0000 Subject: [PATCH 07/27] Update examples/tutorials/contour-map.py Removed region from the method description because it is not a required arguement Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index eb4aedb0edc..047367b8788 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -11,7 +11,7 @@ # Create contour plot # ------------------- # -# The grdcontour method takes the grid input and the region values. +# The :meth:`pygmt.Figure.grdcontour` method takes the grid input. # It plots annotated contour lines, which are darker and have the elevation/depth written on them, # and unannotated contour lines. In the example below, the default contour line intervals are 500 meters, # with an annotated contour line every 1000 meters. From d6c7dd8436382411fb8135dd9a7f29cc4db4ccd7 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 28 Nov 2020 09:39:41 +0000 Subject: [PATCH 08/27] Update examples/tutorials/contour-map.py Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 047367b8788..238786ccf8d 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -18,7 +18,8 @@ # By default, it plots the map with a Equidistant cylindrical projection and with no frame. fig = pygmt.Figure() -fig.grdcontour(grid="@earth_relief_15s", region=[-92, -90, -1.5, 0.5]) +grid = pygmt.datasets.load_earth_relief(resolution="15s", region=[-92, -90, -1.5, 0.5]) +fig.grdcontour(grid=grid) fig.show() ######################################################################################## From 5c9b17c800d0b080f753b533bb05a6d525b0bfc9 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 28 Nov 2020 09:39:56 +0000 Subject: [PATCH 09/27] Update examples/tutorials/contour-map.py Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 238786ccf8d..53ceff1c48f 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -2,7 +2,7 @@ Creating a map with contour lines ================================= -Plotting a contour map is handled by :meth:`pygmt.Figure.grdcontour` +Plotting a contour map is handled by :meth:`pygmt.Figure.grdcontour`. """ import pygmt From faa07cf0ad97936711e171aecda2a9085422eecd Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 28 Nov 2020 10:06:43 +0000 Subject: [PATCH 10/27] Update all example figures to use the grid variable for the grdcontour grid argument --- examples/tutorials/contour-map.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 53ceff1c48f..4d06f96eb53 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -33,8 +33,7 @@ fig.grdcontour( annotation=1000, interval=250, - grid="@earth_relief_15s", - region=[-92, -90, -1.5, 0.5], + grid=grid, ) fig.show() @@ -49,8 +48,7 @@ fig.grdcontour( annotation=1000, interval=250, - grid="@earth_relief_15s", - region=[-92, -90, -1.5, 0.5], + grid=grid, limit=[-4000, 0], ) fig.show() @@ -65,8 +63,7 @@ fig.grdcontour( annotation=1000, interval=250, - grid="@earth_relief_15s", - region=[-92, -90, -1.5, 0.5], + grid=grid, limit=[-4000, 0], projection="M4i", frame=True, From e6e9b4b09efe7b0f2fcae79ce69475a36a625d1f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:07:50 +0000 Subject: [PATCH 11/27] Update examples/tutorials/contour-map.py Move grid variable assignment to top of script Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 4d06f96eb53..edf5e9e05b3 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -18,7 +18,6 @@ # By default, it plots the map with a Equidistant cylindrical projection and with no frame. fig = pygmt.Figure() -grid = pygmt.datasets.load_earth_relief(resolution="15s", region=[-92, -90, -1.5, 0.5]) fig.grdcontour(grid=grid) fig.show() From 0d33642036facdf0147eba1ee43aeb8a36e5fe93 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:08:39 +0000 Subject: [PATCH 12/27] Update examples/tutorials/contour-map.py Adding comment for grid variable Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index edf5e9e05b3..fe385fb9b88 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -7,6 +7,9 @@ import pygmt +# Load sample earth relief data +grid = pygmt.datasets.load_earth_relief(resolution="15s", region=[-92, -90, -1.5, 0.5]) + ######################################################################################## # Create contour plot # ------------------- From bc13ac871d63109e5bea407d29c0f651b01182ba Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:08:54 +0000 Subject: [PATCH 13/27] Update examples/tutorials/contour-map.py typo correction Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index fe385fb9b88..ce534ae35ff 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -18,7 +18,7 @@ # It plots annotated contour lines, which are darker and have the elevation/depth written on them, # and unannotated contour lines. In the example below, the default contour line intervals are 500 meters, # with an annotated contour line every 1000 meters. -# By default, it plots the map with a Equidistant cylindrical projection and with no frame. +# By default, it plots the map with the equidistant cylindrical projection and with no frame. fig = pygmt.Figure() fig.grdcontour(grid=grid) From eecd2620138e6279bb994aa37ddf61a5a2605e4a Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:09:08 +0000 Subject: [PATCH 14/27] Update examples/tutorials/contour-map.py formatting correction Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index ce534ae35ff..886086fb5cb 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -28,7 +28,7 @@ # Contour line settings # --------------------- # -# Use the "annotation" and "interval" arguments to adjust contour line intervals +# Use the ``annotation`` and ``interval`` arguments to adjust contour line intervals. # In the example below, there are contour intervals every 250 meters and an annotated contour line every 1,000 meters. fig = pygmt.Figure() From e741862901b56254d414b47824086434a9a3aa05 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:09:24 +0000 Subject: [PATCH 15/27] Update examples/tutorials/contour-map.py rephrasing comment Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 886086fb5cb..4ae0d1118a5 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -29,7 +29,7 @@ # --------------------- # # Use the ``annotation`` and ``interval`` arguments to adjust contour line intervals. -# In the example below, there are contour intervals every 250 meters and an annotated contour line every 1,000 meters. +# In the example below, there are contour intervals every 250 meters and annotated contour lines every 1,000 meters. fig = pygmt.Figure() fig.grdcontour( From 9b2db7d49474e8c8175d115bf9a2467f43720c86 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:09:35 +0000 Subject: [PATCH 16/27] Update examples/tutorials/contour-map.py format correction Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 4ae0d1118a5..580d0ef5517 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -44,7 +44,7 @@ # -------------- # # The limit argument sets the minimum and maximum values for the contour lines, with the value. -# The argument takes the low and high values, and is either a list (as below) or a string limit="-4000/0" +# The argument takes the low and high values, and is either a list (as below) or a string ``limit="-4000/0"``. fig = pygmt.Figure() fig.grdcontour( From 14aeb7b06fa001d2050d319ce80c0629206f658e Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:09:59 +0000 Subject: [PATCH 17/27] Update examples/tutorials/contour-map.py Rephrasing comment Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 580d0ef5517..632bd5e6b11 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -59,7 +59,7 @@ # Map settings # ------------ # -# The grdcontour method accepts additional arguments, including setting the projection and frame. +# The :meth:`pygmt.Figure.grdcontour` method accepts additional arguments, including setting the projection and frame. fig = pygmt.Figure() fig.grdcontour( From bab041e886ed4d1dcb8ed7add500a7e4ab1c5895 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:10:15 +0000 Subject: [PATCH 18/27] Update examples/tutorials/contour-map.py comment format correction Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 632bd5e6b11..38d258deee0 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -43,7 +43,7 @@ # Contour limits # -------------- # -# The limit argument sets the minimum and maximum values for the contour lines, with the value. +# The ``limit`` argument sets the minimum and maximum values for the contour lines, with the value. # The argument takes the low and high values, and is either a list (as below) or a string ``limit="-4000/0"``. fig = pygmt.Figure() From 92cfc0e18a44411b7e855fd25581c85032c562c8 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:17:30 +0000 Subject: [PATCH 19/27] Update comments to keep lines at or below 88 characters --- examples/tutorials/contour-map.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 38d258deee0..6abc55c127d 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -15,10 +15,12 @@ # ------------------- # # The :meth:`pygmt.Figure.grdcontour` method takes the grid input. -# It plots annotated contour lines, which are darker and have the elevation/depth written on them, -# and unannotated contour lines. In the example below, the default contour line intervals are 500 meters, +# It plots annotated contour lines, which are darker and have the +# elevation/depth written on them, and unannotated contour lines. +# In the example below, the default contour line intervals are 500 meters, # with an annotated contour line every 1000 meters. -# By default, it plots the map with the equidistant cylindrical projection and with no frame. +# By default, it plots the map with the +# equidistant cylindrical projection and with no frame. fig = pygmt.Figure() fig.grdcontour(grid=grid) @@ -29,7 +31,8 @@ # --------------------- # # Use the ``annotation`` and ``interval`` arguments to adjust contour line intervals. -# In the example below, there are contour intervals every 250 meters and annotated contour lines every 1,000 meters. +# In the example below, there are contour intervals every 250 meters and +# annotated contour lines every 1,000 meters. fig = pygmt.Figure() fig.grdcontour( @@ -43,8 +46,9 @@ # Contour limits # -------------- # -# The ``limit`` argument sets the minimum and maximum values for the contour lines, with the value. -# The argument takes the low and high values, and is either a list (as below) or a string ``limit="-4000/0"``. +# The ``limit`` argument sets the minimum and maximum values for the contour lines. +# The argument takes the low and high values, +# and is either a list (as below) or a string ``limit="-4000/0"``. fig = pygmt.Figure() fig.grdcontour( @@ -59,7 +63,8 @@ # Map settings # ------------ # -# The :meth:`pygmt.Figure.grdcontour` method accepts additional arguments, including setting the projection and frame. +# The :meth:`pygmt.Figure.grdcontour` method accepts additional arguments, +# including setting the projection and frame. fig = pygmt.Figure() fig.grdcontour( From 8def635448fa482678f2f7e394b96edb73d1d135 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 08:56:49 +0000 Subject: [PATCH 20/27] Add example code and explanation for creating a contour map with color --- examples/tutorials/contour-map.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 6abc55c127d..8e16b7bee7b 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -76,3 +76,28 @@ frame=True, ) fig.show() + +######################################################################################## +# Adding a colormap +# ----------------- +# +# The ``cmap`` argument of the :meth:`pygmt.Figure.grdimage` method can be used to add a +# colormap to the contour map. It must be called prior to +# :meth:`pygmt.Figure.grdcontour` to keep the contour lines visible on the final map. +# The ``projection`` argument must be the same for both :meth:`pygmt.Figure.grdimage` +# and :meth:`pygmt.Figure.grdcontour` for the images to be overlayed accurately. + +fig = pygmt.Figure() +fig.grdimage( + grid=grid, + cmap="haxby", + projection="M4i") +fig.grdcontour( + annotation=1000, + interval=250, + grid=grid, + limit=[-4000, 0], + projection="M4i", + frame=True, +) +fig.show() \ No newline at end of file From 317fd87617cd0fd36e6505f7865d4c35abffe0ae Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 16:51:25 +0000 Subject: [PATCH 21/27] Update examples/tutorials/contour-map.py Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 8e16b7bee7b..e37dc85cb7a 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -81,7 +81,7 @@ # Adding a colormap # ----------------- # -# The ``cmap`` argument of the :meth:`pygmt.Figure.grdimage` method can be used to add a +# The :meth:`pygmt.Figure.grdimage` method can be used to add a # colormap to the contour map. It must be called prior to # :meth:`pygmt.Figure.grdcontour` to keep the contour lines visible on the final map. # The ``projection`` argument must be the same for both :meth:`pygmt.Figure.grdimage` @@ -100,4 +100,4 @@ projection="M4i", frame=True, ) -fig.show() \ No newline at end of file +fig.show() From eca4c6a7463e14f4a5e2a1cd45ff2216b4a1c81e Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 16:51:37 +0000 Subject: [PATCH 22/27] Update examples/tutorials/contour-map.py Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index e37dc85cb7a..821d1cf1865 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -91,7 +91,9 @@ fig.grdimage( grid=grid, cmap="haxby", - projection="M4i") + projection="M4i", + frame=True, + ) fig.grdcontour( annotation=1000, interval=250, From d5f4e5267cad45f93d6e9c3378589b5c2a17dbe9 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 16:51:47 +0000 Subject: [PATCH 23/27] Update examples/tutorials/contour-map.py Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 821d1cf1865..b7954af9a18 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -15,7 +15,7 @@ # ------------------- # # The :meth:`pygmt.Figure.grdcontour` method takes the grid input. -# It plots annotated contour lines, which are darker and have the +# It plots annotated contour lines, which are thicker and have the # elevation/depth written on them, and unannotated contour lines. # In the example below, the default contour line intervals are 500 meters, # with an annotated contour line every 1000 meters. From e39dc7e1d34a6dbff413a23b1bd759df21b87a45 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 16:51:57 +0000 Subject: [PATCH 24/27] Update examples/tutorials/contour-map.py Co-authored-by: Dongdong Tian --- examples/tutorials/contour-map.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index b7954af9a18..fc889c07080 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -99,7 +99,5 @@ interval=250, grid=grid, limit=[-4000, 0], - projection="M4i", - frame=True, ) fig.show() From 020e30f7c9948950f76c0c77b162682465e4061f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 17:12:36 +0000 Subject: [PATCH 25/27] Rephrasing colormap comments when describing projection argument --- examples/tutorials/contour-map.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index fc889c07080..b6e3b859a81 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -84,16 +84,17 @@ # The :meth:`pygmt.Figure.grdimage` method can be used to add a # colormap to the contour map. It must be called prior to # :meth:`pygmt.Figure.grdcontour` to keep the contour lines visible on the final map. -# The ``projection`` argument must be the same for both :meth:`pygmt.Figure.grdimage` -# and :meth:`pygmt.Figure.grdcontour` for the images to be overlayed accurately. +# If the ``projection`` argument is specified in the :meth:`pygmt.Figure.grdimage` +# method, it does not need to be repeated in +# the :meth:`pygmt.Figure.grdcontour` method. fig = pygmt.Figure() fig.grdimage( grid=grid, cmap="haxby", projection="M4i", - frame=True, - ) + frame=True, +) fig.grdcontour( annotation=1000, interval=250, From ebdd34cbe240143d9a7f1aff68e0dc27150293b7 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 29 Nov 2020 17:17:02 +0000 Subject: [PATCH 26/27] Changing region and using 05m resolution vs. 15s --- examples/tutorials/contour-map.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index b6e3b859a81..199570368c1 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -8,7 +8,7 @@ import pygmt # Load sample earth relief data -grid = pygmt.datasets.load_earth_relief(resolution="15s", region=[-92, -90, -1.5, 0.5]) +grid = pygmt.datasets.load_earth_relief(resolution="05m", region=[-92.5, -82.5, -3, 7]) ######################################################################################## # Create contour plot From a3c25cd5f9e9a105cb5c4a96854a5b18e36a6eeb Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 30 Nov 2020 07:13:34 +0000 Subject: [PATCH 27/27] Update limit high value to -2000 m vs. 0 m --- examples/tutorials/contour-map.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/tutorials/contour-map.py b/examples/tutorials/contour-map.py index 199570368c1..fb998f58753 100644 --- a/examples/tutorials/contour-map.py +++ b/examples/tutorials/contour-map.py @@ -48,14 +48,14 @@ # # The ``limit`` argument sets the minimum and maximum values for the contour lines. # The argument takes the low and high values, -# and is either a list (as below) or a string ``limit="-4000/0"``. +# and is either a list (as below) or a string ``limit="-4000/-2000"``. fig = pygmt.Figure() fig.grdcontour( annotation=1000, interval=250, grid=grid, - limit=[-4000, 0], + limit=[-4000, -2000], ) fig.show() @@ -71,7 +71,7 @@ annotation=1000, interval=250, grid=grid, - limit=[-4000, 0], + limit=[-4000, -2000], projection="M4i", frame=True, ) @@ -99,6 +99,6 @@ annotation=1000, interval=250, grid=grid, - limit=[-4000, 0], + limit=[-4000, -2000], ) fig.show()