From 27f5d20b85cd1bbfd237ef8e7e0455d07a6efb4d Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 11 Dec 2020 09:59:50 +0000 Subject: [PATCH 01/22] Add cyl_transverse_mercator.py --- .../cyl/cyl_transverse_mercator.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/projections/cyl/cyl_transverse_mercator.py diff --git a/examples/projections/cyl/cyl_transverse_mercator.py b/examples/projections/cyl/cyl_transverse_mercator.py new file mode 100644 index 00000000000..fc8bb2198b9 --- /dev/null +++ b/examples/projections/cyl/cyl_transverse_mercator.py @@ -0,0 +1,19 @@ +""" +Transverse Mercator +=================== + +``T[lon0/][lat0/]width``: Give central meridian ``lon0``, the latitude of the +origin ``lat0`` (optional), and the figure width. +""" +import pygmt + +fig = pygmt.Figure() +fig.coast( + region=[20, 50, 30, 45], + projection="T35/12c", + land="lightbrown", + water="seashell", + shorelines="thinnest", + frame="afg", +) +fig.show() From d64983ff1ae3e046ba76697f8980e12c4600475c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 11 Dec 2020 10:40:06 +0000 Subject: [PATCH 02/22] Add cyl_universal_transverse_mercator.py --- .../cyl/cyl_universal_transverse_mercator.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/projections/cyl/cyl_universal_transverse_mercator.py diff --git a/examples/projections/cyl/cyl_universal_transverse_mercator.py b/examples/projections/cyl/cyl_universal_transverse_mercator.py new file mode 100644 index 00000000000..47259c5bd6c --- /dev/null +++ b/examples/projections/cyl/cyl_universal_transverse_mercator.py @@ -0,0 +1,19 @@ +""" +Universal Transverse Mercator +============================= + +``U[UTM Zone/][lat0/]width``: Give UTM Zone ``UTM Zone``, and the figure width. +""" +import pygmt + +fig = pygmt.Figure() +# UTM Zone is set to 52R +fig.coast( + region=[127.5, 128.5, 26, 27], + projection="U52R/12c", + land="lightgreen", + water="lightblue", + shorelines="thinnest", + frame="afg", +) +fig.show() From 6ba8185f68bc7dbc76a2787540083287204a7ea4 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 11 Dec 2020 10:48:29 +0000 Subject: [PATCH 03/22] Changing land color to red in cyl_mercator.py to match GMT docs example; changing units from US to SI --- examples/projections/cyl/cyl_mercator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/projections/cyl/cyl_mercator.py b/examples/projections/cyl/cyl_mercator.py index d2e54886e6f..bfe22ba87a9 100644 --- a/examples/projections/cyl/cyl_mercator.py +++ b/examples/projections/cyl/cyl_mercator.py @@ -8,5 +8,5 @@ import pygmt fig = pygmt.Figure() -fig.coast(region=[0, 360, -80, 80], frame="afg", land="gray", projection="M0/0/8i") +fig.coast(region=[0, 360, -80, 80], frame="afg", land="red", projection="M0/0/12c") fig.show() From 960d8ebb20f380a47fc0c1165fbbec46d8b50f2f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 22 Jan 2021 21:54:24 +0000 Subject: [PATCH 04/22] Add region-arguments.py tutorial --- examples/tutorials/region-arguments.py | 160 +++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 examples/tutorials/region-arguments.py diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py new file mode 100644 index 00000000000..1f8ee79e721 --- /dev/null +++ b/examples/tutorials/region-arguments.py @@ -0,0 +1,160 @@ +""" +Set the region argument +======================= + +Many of the plotting functions take an argument for the ``region`` argument, which sets +the area that will be shown in the figure. This tutorial covers the different types of +inputs that it can accept. +""" + +import pygmt + +######################################################################################## +# Coordinates +# ----------- +# +# A string of coordinates can be passed to ``region``, in the form of +# *xmin*\ /*xmax*\ /*ymin*\ /*ymax*\ . + +fig = pygmt.Figure() +fig.coast( + # Sets the x-range from 10E to 20E and the y-range to 35N to 45N + region="10/20/35/45", + # Set projection to Mercator, and the figure size to 15 centimeters + projection="M15c", + # Set the color of the land to light gray + land="lightgray", + # Set the color of the water to white + water="white", + # Display the national borders and set the pen-size to 0.5p + borders="1/0.5p", + # Display the shorelines and set the pen-size to 0.5p + shorelines="1/0.5p", + # Set the frame to automatic and display gridlines + frame="ag", +) +fig.show() + +######################################################################################## +# +# The coordinates coordinates can be passed to ``region`` as a list, in the form of +# [\ *xmin*\ ,*xmax*\ ,*ymin*\ ,*ymax*\ ]. + +fig = pygmt.Figure() +fig.coast( + # Sets the x-range from 10E to 20E and the y-range to 35N to 45N + region=[10, 20, 35, 45], + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() + +######################################################################################## +# +# GMT has the option for region coordinates to be passed in classic mode, which was the +# standard prior to GMT version 6. The string format takes the coordinates for the +# bottom-left and top-right coordinates. To specify classic mode, append **+r** at the +# end of the ``region`` string. + +fig = pygmt.Figure() +# Use region "d" to specify global region (-180/180/-90/90) +fig.coast( + region="10/35/20/45+r", + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() + +######################################################################################## +# +# Passing **g** to ``region`` sets the region to + +fig = pygmt.Figure() +fig.coast( + region="g", projection="Cyl_stere/12c", land="tomato1", water="skyblue", frame="ag" +) +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 +# annotated contour lines every 1,000 meters. + +fig = pygmt.Figure() +fig.grdcontour( + annotation=1000, + interval=250, + grid=grid, +) +fig.show() + +######################################################################################## +# Contour limits +# -------------- +# +# 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/-2000"``. + +fig = pygmt.Figure() +fig.grdcontour( + annotation=1000, + interval=250, + grid=grid, + limit=[-4000, -2000], +) +fig.show() + +######################################################################################## +# Map settings +# ------------ +# +# The :meth:`pygmt.Figure.grdcontour` method accepts additional arguments, +# including setting the projection and frame. + +fig = pygmt.Figure() +fig.grdcontour( + annotation=1000, + interval=250, + grid=grid, + limit=[-4000, -2000], + projection="M10c", + frame=True, +) +fig.show() + +######################################################################################## +# Adding a colormap +# ----------------- +# +# 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. +# 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="M10c", + frame=True, +) +fig.grdcontour( + annotation=1000, + interval=250, + grid=grid, + limit=[-4000, -2000], +) +fig.show() From e8925e113930eee72eed4e3f083979df19c7e5c7 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 22 Jan 2021 21:55:48 +0000 Subject: [PATCH 05/22] Add tutorial to index.rst --- doc/index.rst | 1 + examples/tutorials/region-arguments.py | 80 +------------------------- 2 files changed, 3 insertions(+), 78 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index 7943289c60d..747ead30892 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -32,6 +32,7 @@ projections/index.rst tutorials/coastlines.rst tutorials/plot.rst + tutorials/region-arguments.rst tutorials/plot-lines.rst tutorials/text.rst tutorials/contour-map.rst diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 1f8ee79e721..b9b7256baf5 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -61,8 +61,8 @@ # end of the ``region`` string. fig = pygmt.Figure() -# Use region "d" to specify global region (-180/180/-90/90) fig.coast( + # Sets the bottom-left corner as 10E, 35N and the top-right corner as 20E, 45N region="10/35/20/45+r", projection="M12c", land="lightgray", @@ -81,80 +81,4 @@ fig.coast( region="g", projection="Cyl_stere/12c", land="tomato1", water="skyblue", frame="ag" ) -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 -# annotated contour lines every 1,000 meters. - -fig = pygmt.Figure() -fig.grdcontour( - annotation=1000, - interval=250, - grid=grid, -) -fig.show() - -######################################################################################## -# Contour limits -# -------------- -# -# 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/-2000"``. - -fig = pygmt.Figure() -fig.grdcontour( - annotation=1000, - interval=250, - grid=grid, - limit=[-4000, -2000], -) -fig.show() - -######################################################################################## -# Map settings -# ------------ -# -# The :meth:`pygmt.Figure.grdcontour` method accepts additional arguments, -# including setting the projection and frame. - -fig = pygmt.Figure() -fig.grdcontour( - annotation=1000, - interval=250, - grid=grid, - limit=[-4000, -2000], - projection="M10c", - frame=True, -) -fig.show() - -######################################################################################## -# Adding a colormap -# ----------------- -# -# 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. -# 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="M10c", - frame=True, -) -fig.grdcontour( - annotation=1000, - interval=250, - grid=grid, - limit=[-4000, -2000], -) -fig.show() +fig.show() \ No newline at end of file From c0550ce26f64d491822a980d81a511cd6d2668a0 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 22 Jan 2021 22:11:28 +0000 Subject: [PATCH 06/22] Add global inputs to region --- examples/tutorials/region-arguments.py | 35 ++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index b9b7256baf5..f454feb8432 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -74,11 +74,42 @@ fig.show() ######################################################################################## +# Global regions +# -------------- # -# Passing **g** to ``region`` sets the region to +# In addition to passing coordinates, the argument **d** can be passed to set the +# region to the entire globe. The range is 180W to 180E (-180, 180) and 90S to +# 90N (-90 to 90). With no parameters set for the projection, the figure defaults to be +# centered at the mid-point of both x- and y-axes. Using **d**\ , the figure is +# centered at 0,0, or the intersection of the equator and prime meridian. fig = pygmt.Figure() fig.coast( - region="g", projection="Cyl_stere/12c", land="tomato1", water="skyblue", frame="ag" + region="d", + projection="Cyl_stere/12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() + +######################################################################################## +# +# The argument **g** can be passed, which encompasses the entire globe. The range is +# 0E to 360E (0, 360) and 90S to 90N (-90 to 90). With no parameters set for the +# projection, the figure is centered at 180,0, or the intersection of the equator and +# International Date Line. + +fig = pygmt.Figure() +fig.coast( + region="g", + projection="Cyl_stere/12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", ) fig.show() \ No newline at end of file From b66a66f09fd08dd63a798fd7a11733886a34f621 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 22 Jan 2021 22:12:31 +0000 Subject: [PATCH 07/22] Run make format --- examples/tutorials/region-arguments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index f454feb8432..f1f3f18f9cf 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -112,4 +112,4 @@ shorelines="1/0.5p", frame="ag", ) -fig.show() \ No newline at end of file +fig.show() From 7d42ae55f2fd9a6c7cfeb469cc0b9733b402ec5f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 22 Jan 2021 22:21:50 +0000 Subject: [PATCH 08/22] Add ISO code tutorial --- examples/tutorials/region-arguments.py | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index f1f3f18f9cf..bc14f6a9379 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -113,3 +113,43 @@ frame="ag", ) fig.show() + +######################################################################################## +# ISO code +# -------- +# +# The ``region`` can be set to include a specific area specified by the two-character +# `ISO 3166-1 alpha-2 convention `. + +fig = pygmt.Figure() +fig.coast( + # Sets the figure region to encompass Japan with the ISO code "JP" + region="JP", + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() + +######################################################################################## +# +# The area encompassed by the ISO code can be expanded by appending **+r**\ *increment* +# to the ISO code. The *increment* unit is in degrees and expands the range of the +# region in all directions. + +fig = pygmt.Figure() +fig.coast( + # Expands the region setting outside the range of Japan by 3 degrees in all + # directions + region="JP+r3", + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() From 193a958a419c58fbfcdbccd92a97b9876b4070f9 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 22 Jan 2021 22:23:53 +0000 Subject: [PATCH 09/22] Fix formatting typo --- examples/tutorials/region-arguments.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index bc14f6a9379..4c858c595b4 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -37,8 +37,8 @@ ######################################################################################## # -# The coordinates coordinates can be passed to ``region`` as a list, in the form of -# [\ *xmin*\ ,*xmax*\ ,*ymin*\ ,*ymax*\ ]. +# The coordinates coordinates can be passed to ``region`` as a list, in the form +# of [*xmin*\ ,*xmax*\ ,*ymin*\ ,*ymax*\ ]. fig = pygmt.Figure() fig.coast( From cda30f00976441a783790ad72dd0e6f8182ef1ee Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 22 Jan 2021 22:39:34 +0000 Subject: [PATCH 10/22] Fix formatting typos --- examples/tutorials/region-arguments.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 4c858c595b4..32e52f13ea3 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -38,7 +38,7 @@ ######################################################################################## # # The coordinates coordinates can be passed to ``region`` as a list, in the form -# of [*xmin*\ ,*xmax*\ ,*ymin*\ ,*ymax*\ ]. +# of [*xmin*\ ,\ *xmax*\ ,\ *ymin*\ ,\ *ymax*\ ]. fig = pygmt.Figure() fig.coast( @@ -119,7 +119,8 @@ # -------- # # The ``region`` can be set to include a specific area specified by the two-character -# `ISO 3166-1 alpha-2 convention `. +# `ISO 3166-1 alpha-2 convention +# (for futher information: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). fig = pygmt.Figure() fig.coast( From afe7e0088076a47591bf234fc3630c2b5dad535a Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:17:25 +0000 Subject: [PATCH 11/22] Update doc/index.rst 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 747ead30892..99253a4d2ad 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -31,8 +31,8 @@ tutorials/frames.rst projections/index.rst tutorials/coastlines.rst + tutorials/regions.rst tutorials/plot.rst - tutorials/region-arguments.rst tutorials/plot-lines.rst tutorials/text.rst tutorials/contour-map.rst From 852d5c6fea2828acfc786f573a0e5fdfc6b8d247 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:17:39 +0000 Subject: [PATCH 12/22] Update examples/tutorials/region-arguments.py Co-authored-by: Dongdong Tian --- examples/tutorials/region-arguments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 32e52f13ea3..1ac43bb822c 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -119,7 +119,7 @@ # -------- # # The ``region`` can be set to include a specific area specified by the two-character -# `ISO 3166-1 alpha-2 convention +# ISO 3166-1 alpha-2 convention # (for futher information: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). fig = pygmt.Figure() From df4e3c6741a6c5f2dfa5e4f19e3f91e7b1011dcf Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:20:24 +0000 Subject: [PATCH 13/22] Update examples/tutorials/region-arguments.py Co-authored-by: Dongdong Tian --- examples/tutorials/region-arguments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 1ac43bb822c..cfd353da093 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -2,7 +2,7 @@ Set the region argument ======================= -Many of the plotting functions take an argument for the ``region`` argument, which sets +Many of the plotting functions take the ``region`` argument, which sets the area that will be shown in the figure. This tutorial covers the different types of inputs that it can accept. """ From 9a48e784bea2f5f1ae9bf763c8ab2d9a44d07c31 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:22:51 +0000 Subject: [PATCH 14/22] Change description for corners-coordinates --- examples/tutorials/region-arguments.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index cfd353da093..69ee3111349 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -55,8 +55,8 @@ ######################################################################################## # -# GMT has the option for region coordinates to be passed in classic mode, which was the -# standard prior to GMT version 6. The string format takes the coordinates for the +# Instead of passing axes minima and maxima, the coordinates can be passed for the +# bottom-left and top-right corners/ The string format takes the coordinates for the # bottom-left and top-right coordinates. To specify classic mode, append **+r** at the # end of the ``region`` string. @@ -138,8 +138,8 @@ ######################################################################################## # # The area encompassed by the ISO code can be expanded by appending **+r**\ *increment* -# to the ISO code. The *increment* unit is in degrees and expands the range of the -# region in all directions. +# to the ISO code. The *increment* unit is in degrees, and if only value is added it +# expands the range of the region in all directions. fig = pygmt.Figure() fig.coast( From c1af030eeb085ad9324da14ffa060081baecf2ae Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:24:18 +0000 Subject: [PATCH 15/22] Fix typo --- examples/tutorials/region-arguments.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 69ee3111349..0daa721d56c 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -56,9 +56,9 @@ ######################################################################################## # # Instead of passing axes minima and maxima, the coordinates can be passed for the -# bottom-left and top-right corners/ The string format takes the coordinates for the -# bottom-left and top-right coordinates. To specify classic mode, append **+r** at the -# end of the ``region`` string. +# bottom-left and top-right corners. The string format takes the coordinates for the +# bottom-left and top-right coordinates. To specify corner coordinates, append **+r** +# at the end of the ``region`` string. fig = pygmt.Figure() fig.coast( From b0204f8a1cce87c228ffc2a05ed6495d83fddfb7 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:27:14 +0000 Subject: [PATCH 16/22] Add tutorial for 2-axis expansion --- examples/tutorials/region-arguments.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 0daa721d56c..fdc0e5dc7de 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -154,3 +154,22 @@ frame="ag", ) fig.show() + +######################################################################################## +# +# Instead of expanding the range of the plot uniformly in all directions, two values +# can be passed to expand differently on each axis. The format is *xinc*\ /\ *yinc*. + +fig = pygmt.Figure() +fig.coast( + # Expands the region setting outside the range of Japan by 3 degrees on the x-axis + # and 5 degrees on the y-axis. + region="JP+r3/5", + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() From 15c3ca8d3af436ca5c4feaef7f21652b71118379 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:36:23 +0000 Subject: [PATCH 17/22] Update +r tutorials --- examples/tutorials/region-arguments.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index fdc0e5dc7de..5f644b61253 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -139,7 +139,8 @@ # # The area encompassed by the ISO code can be expanded by appending **+r**\ *increment* # to the ISO code. The *increment* unit is in degrees, and if only value is added it -# expands the range of the region in all directions. +# expands the range of the region in all directions. Using **+r** rounds to the nearest +# increment. fig = pygmt.Figure() fig.coast( @@ -173,3 +174,24 @@ frame="ag", ) fig.show() + +######################################################################################## +# +# Instead of expanding the range of the plot uniformly in all directions, four values +# can be passed to expand differently in each direction. +# The format is *winc*\ /\ *einc*\ /\ *sinc*\ /\ *ninc*\ , which expands on the west, +# east, south, and north axes. + +fig = pygmt.Figure() +fig.coast( + # Expands the region setting outside the range of Japan by 3 degrees to the west, + # 5 degrees to the east, 7 degrees to the south, and 9 degrees to the north. + region="JP+r3/5/7/9", + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() From 465cc3b6084631e841884a1f299867efe3a44bec Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:41:51 +0000 Subject: [PATCH 18/22] Update +R tutorial --- examples/tutorials/region-arguments.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 5f644b61253..fabda6950fd 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -195,3 +195,22 @@ frame="ag", ) fig.show() + +######################################################################################## +# +# The ``region`` increment can be appended with **+R**, which adds the increment +# without rounding. + +fig = pygmt.Figure() +fig.coast( + # Expands the region setting outside the range of Japan by 3 degrees in all + # directions, without rounding to the nearest increment. + region="JP+r3", + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() From abda7db46b43ec62178c03eb4c5aec7c47cc4607 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:44:48 +0000 Subject: [PATCH 19/22] Update +e tutorial --- examples/tutorials/region-arguments.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index fabda6950fd..26770b7f8a0 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -205,7 +205,26 @@ fig.coast( # Expands the region setting outside the range of Japan by 3 degrees in all # directions, without rounding to the nearest increment. - region="JP+r3", + region="JP+R3", + projection="M12c", + land="lightgray", + water="white", + borders="1/0.5p", + shorelines="1/0.5p", + frame="ag", +) +fig.show() + +######################################################################################## +# +# The ``region`` increment can be appended with **+e**, which expand the bounding box +# by at least 25% beyond the increment. + +fig = pygmt.Figure() +fig.coast( + # Expands the region setting outside the range of Japan by 3 degrees in all + # directions, without rounding to the nearest increment. + region="JP+R3", projection="M12c", land="lightgray", water="white", From 388363801e423d7c0d4fa4755b53f1ce2f758d3c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 21:46:19 +0000 Subject: [PATCH 20/22] Fix typo --- examples/tutorials/region-arguments.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/region-arguments.py index 26770b7f8a0..3345c95a1ae 100644 --- a/examples/tutorials/region-arguments.py +++ b/examples/tutorials/region-arguments.py @@ -224,7 +224,7 @@ fig.coast( # Expands the region setting outside the range of Japan by 3 degrees in all # directions, without rounding to the nearest increment. - region="JP+R3", + region="JP+e3", projection="M12c", land="lightgray", water="white", From 78fc3d49cbe00cb88026415663d285b695ab12f3 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 23 Jan 2021 22:06:56 +0000 Subject: [PATCH 21/22] Rename region-arguments.py to regions.py --- examples/tutorials/{region-arguments.py => regions.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/tutorials/{region-arguments.py => regions.py} (100%) diff --git a/examples/tutorials/region-arguments.py b/examples/tutorials/regions.py similarity index 100% rename from examples/tutorials/region-arguments.py rename to examples/tutorials/regions.py From 8f0011ffb1fc1a3d074de9d47de5b2ac54a5ff2b Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 24 Jan 2021 09:47:40 +0000 Subject: [PATCH 22/22] Update examples/tutorials/regions.py Co-authored-by: Dongdong Tian --- examples/tutorials/regions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/regions.py b/examples/tutorials/regions.py index 3345c95a1ae..82542494749 100644 --- a/examples/tutorials/regions.py +++ b/examples/tutorials/regions.py @@ -1,6 +1,6 @@ """ -Set the region argument -======================= +Set the region +============== Many of the plotting functions take the ``region`` argument, which sets the area that will be shown in the figure. This tutorial covers the different types of