From 5307f910565394a670b3983c0dea6920bcdfb331 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 8 Dec 2020 07:32:45 +0000 Subject: [PATCH 01/11] Change projection to SI units from US units. --- examples/tutorials/frames.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index 87ac7072391..9e6ad94f135 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -16,7 +16,7 @@ # coastlines of the world with a Mercator projection: fig = pygmt.Figure() -fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M10i") +fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c") fig.show() ######################################################################################## @@ -24,7 +24,7 @@ # :meth:`pygmt.Figure.basemap` or any other plotting module: fig = pygmt.Figure() -fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M10i") +fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c") fig.basemap(frame="f") fig.show() @@ -36,7 +36,7 @@ # and automatically determines tick labels from the plot region. fig = pygmt.Figure() -fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M10i") +fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c") fig.basemap(frame="a") fig.show() @@ -44,6 +44,6 @@ # Add automatic grid lines to the plot by adding a ``g`` to ``frame``: fig = pygmt.Figure() -fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M10i") +fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c") fig.basemap(frame="ag") fig.show() From d23bde3a9823b9c420e3c4e78b1c2b720b3e03cb Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 8 Dec 2020 08:05:59 +0000 Subject: [PATCH 02/11] Add title example --- examples/tutorials/frames.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index 9e6ad94f135..c62410a7701 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -47,3 +47,26 @@ fig.coast(shorelines="1/0.5p", region=[-180, 180, -60, 60], projection="M25c") fig.basemap(frame="ag") fig.show() + +######################################################################################## +# Title +# ----- +# +# The figure title can be set by passing ``"+t"`` to the ``frame`` parameter of +# :meth:`pygmt.Figure.basemap`. Passing multiple arguments to ``frame`` can be done by +# using a list, as show in the example below. + +fig = pygmt.Figure() +fig.coast(shorelines="1/0.5p", region="IS", projection="M25c") +fig.basemap(frame=["a", "+tIceland"]) +fig.show() + +######################################################################################## +# To use a title with multiple words, the title must be placed inside another set of +# quotation marks. To prevent the quotation marks from appearing in the figure title, +# the ``"\""`` escape character notation can be used to cancel out the quotation marks. + +fig = pygmt.Figure() +fig.coast(shorelines="1/0.5p", region="TT", projection="M25c") +fig.basemap(frame=["a", "+t\"Trinidad and Tobago\""]) +fig.show() From 7146cd18edb6e87d74898d88f7db90231d01a677 Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Wed, 9 Dec 2020 06:42:00 +0000 Subject: [PATCH 03/11] Update examples/tutorials/frames.py Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- examples/tutorials/frames.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index c62410a7701..94fd9e64def 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -68,5 +68,5 @@ fig = pygmt.Figure() fig.coast(shorelines="1/0.5p", region="TT", projection="M25c") -fig.basemap(frame=["a", "+t\"Trinidad and Tobago\""]) +fig.basemap(frame=["a", '+t"Trinidad and Tobago"']) fig.show() From a46cacf081057b71c438b9bfc737ddb16ae01906 Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Wed, 9 Dec 2020 06:43:32 +0000 Subject: [PATCH 04/11] Rephrase comment for how to use title with spaces --- examples/tutorials/frames.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index 94fd9e64def..d28af1cfe0a 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -64,7 +64,8 @@ ######################################################################################## # To use a title with multiple words, the title must be placed inside another set of # quotation marks. To prevent the quotation marks from appearing in the figure title, -# the ``"\""`` escape character notation can be used to cancel out the quotation marks. +# the frame argument can be passed in single quotation marks and the title can be +# passed in double quotation marks. fig = pygmt.Figure() fig.coast(shorelines="1/0.5p", region="TT", projection="M25c") From 917cdbdd4eb66833fef9e21d9fedc168bec6c71b Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Wed, 9 Dec 2020 07:23:11 +0000 Subject: [PATCH 05/11] Add axis labels example --- examples/tutorials/frames.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index d28af1cfe0a..f61a74364de 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -71,3 +71,22 @@ fig.coast(shorelines="1/0.5p", region="TT", projection="M25c") fig.basemap(frame=["a", '+t"Trinidad and Tobago"']) fig.show() + +######################################################################################## +# Axis labels +# ----------- +# +# Axis labels can be set by passing ``"<axis (either x or y)>+l<label>"`` to the +# ``frame`` parameter of :meth:`pygmt.Figure.basemap`. Axis labels will be displayed on +# all primary axes, which the default is all sides of the figure. To designate only +# some of the axes as primary, an argument that capitlizes only the primary axes can be +# passed, which is ``"WSne"`` in the example below. The letters correspond with +# west (left), south (bottom), north (top), and east (right) sides of a figure. +# +# The example below used a Cartesian projection, as GMT does not allow axis labels to +# be set for geographic maps. + +fig = pygmt.Figure() +fig.basemap(region=[0, 10, 0, 20], projection="X4i/3i", + frame=["WSne", "x+lx-axis", "y+ly-axis"]) +fig.show() From 3401fddad5ba2d6c823ea87786e69032c01c9457 Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Thu, 10 Dec 2020 07:45:44 +0000 Subject: [PATCH 06/11] Change units to SI units --- examples/tutorials/frames.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index f61a74364de..cbb8002ee6b 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -87,6 +87,6 @@ # be set for geographic maps. fig = pygmt.Figure() -fig.basemap(region=[0, 10, 0, 20], projection="X4i/3i", +fig.basemap(region=[0, 10, 0, 20], projection="X10c/8c", frame=["WSne", "x+lx-axis", "y+ly-axis"]) fig.show() From ad2391922bff7074f04d52dda4796daf8fd9ec44 Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Thu, 10 Dec 2020 07:46:55 +0000 Subject: [PATCH 07/11] Explain region arguments using ISO code --- examples/tutorials/frames.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index cbb8002ee6b..fae1ec5123d 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -57,6 +57,7 @@ # using a list, as show in the example below. fig = pygmt.Figure() +# region="IS" specifies Iceland using the ISO country code fig.coast(shorelines="1/0.5p", region="IS", projection="M25c") fig.basemap(frame=["a", "+tIceland"]) fig.show() @@ -68,6 +69,7 @@ # passed in double quotation marks. fig = pygmt.Figure() +# region="TT" specifies Trinidad and Tobago fig.coast(shorelines="1/0.5p", region="TT", projection="M25c") fig.basemap(frame=["a", '+t"Trinidad and Tobago"']) fig.show() From e9c2143f71066924a6278299bf2e9e9a9dbf45ce Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Thu, 10 Dec 2020 07:50:28 +0000 Subject: [PATCH 08/11] Changing argument code to reST syntax --- examples/tutorials/frames.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index fae1ec5123d..8b9f6abe517 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -52,7 +52,7 @@ # Title # ----- # -# The figure title can be set by passing ``"+t<title>"`` to the ``frame`` parameter of +# The figure title can be set by passing ``**+t**\ *title*`` to the ``frame`` parameter of # :meth:`pygmt.Figure.basemap`. Passing multiple arguments to ``frame`` can be done by # using a list, as show in the example below. @@ -78,12 +78,13 @@ # Axis labels # ----------- # -# Axis labels can be set by passing ``"<axis (either x or y)>+l<label>"`` to the -# ``frame`` parameter of :meth:`pygmt.Figure.basemap`. Axis labels will be displayed on -# all primary axes, which the default is all sides of the figure. To designate only -# some of the axes as primary, an argument that capitlizes only the primary axes can be -# passed, which is ``"WSne"`` in the example below. The letters correspond with -# west (left), south (bottom), north (top), and east (right) sides of a figure. +# Axis labels can be set by passing ``**x+l**\ *label*`` (or starting with y if +# labeling the y-axis) if to the ``frame`` parameter of :meth:`pygmt.Figure.basemap`. +# Axis labels will be displayed on all primary axes, which the default is all sides of +# the figure. To designate only some of the axes as primary, an argument that +# capitlizes only the primary axes can be passed, which is ``"WSne"`` in the example +# below. The letters correspond with west (left), south (bottom), north (top), and +# east (right) sides of a figure. # # The example below used a Cartesian projection, as GMT does not allow axis labels to # be set for geographic maps. From db1b02217e17441282125c0bfd574fac1570be77 Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Thu, 10 Dec 2020 17:16:14 +0000 Subject: [PATCH 09/11] Update examples/tutorials/frames.py Co-authored-by: Dongdong Tian <seisman.info@gmail.com> --- examples/tutorials/frames.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index 8b9f6abe517..a0074755232 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -52,7 +52,7 @@ # Title # ----- # -# The figure title can be set by passing ``**+t**\ *title*`` to the ``frame`` parameter of +# The figure title can be set by passing **+t**\ *title* to the ``frame`` parameter of # :meth:`pygmt.Figure.basemap`. Passing multiple arguments to ``frame`` can be done by # using a list, as show in the example below. From b591edd1b66d5b974a8247881e284432ac1c3499 Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Thu, 10 Dec 2020 22:42:04 +0000 Subject: [PATCH 10/11] Update examples/tutorials/frames.py Co-authored-by: Dongdong Tian <seisman.info@gmail.com> --- examples/tutorials/frames.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index a0074755232..eecca162db0 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -78,7 +78,7 @@ # Axis labels # ----------- # -# Axis labels can be set by passing ``**x+l**\ *label*`` (or starting with y if +# Axis labels can be set by passing **x+l**\ *label* (or starting with y if # labeling the y-axis) if to the ``frame`` parameter of :meth:`pygmt.Figure.basemap`. # Axis labels will be displayed on all primary axes, which the default is all sides of # the figure. To designate only some of the axes as primary, an argument that From 5617001197d536341d4de1b297b84ac8cf25679f Mon Sep 17 00:00:00 2001 From: Will Schlitzer <schlitzer90@gmail.com> Date: Fri, 11 Dec 2020 09:09:39 +0000 Subject: [PATCH 11/11] Run black on frames.py --- examples/tutorials/frames.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/tutorials/frames.py b/examples/tutorials/frames.py index eecca162db0..8bc40801a20 100644 --- a/examples/tutorials/frames.py +++ b/examples/tutorials/frames.py @@ -90,6 +90,9 @@ # be set for geographic maps. fig = pygmt.Figure() -fig.basemap(region=[0, 10, 0, 20], projection="X10c/8c", - frame=["WSne", "x+lx-axis", "y+ly-axis"]) +fig.basemap( + region=[0, 10, 0, 20], + projection="X10c/8c", + frame=["WSne", "x+lx-axis", "y+ly-axis"], +) fig.show()