From 62d3f3fd6d144bb432e4717ae7c446b39f95c080 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 5 Nov 2021 07:07:20 +0000 Subject: [PATCH 01/50] add starter-tutorial.rst as intro for tutorial --- doc/index.rst | 2 +- examples/tutorials/starter-tutorial.rst | 21 +++++++++++++++++++ .../{ => starter-tutorials}/first_figure.py | 3 +-- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 examples/tutorials/starter-tutorial.rst rename examples/tutorials/{ => starter-tutorials}/first_figure.py (97%) diff --git a/doc/index.rst b/doc/index.rst index 88ffce2a705..a2427554747 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -20,7 +20,7 @@ overview.rst install.rst - tutorials/first_figure.rst + tutorials/starter-tutorial.rst .. toctree:: :maxdepth: 2 diff --git a/examples/tutorials/starter-tutorial.rst b/examples/tutorials/starter-tutorial.rst new file mode 100644 index 00000000000..1211e49291c --- /dev/null +++ b/examples/tutorials/starter-tutorial.rst @@ -0,0 +1,21 @@ +Starter Tutorial +================ + +Welcome to PyGMT! This tutorial is designed to teach the basic concepts to +make a map in PyGMT. + +About this tutorial +------------------- + +This tutorial assumes that PyGMT has been successfully installed. A quick +way to test this is to type ``import pygmt`` in a Python IDE or Jupyter +Notebook. + +This tutorial will progressively cover PyGMT plotting concepts, and later +examples will use concepts explained in previous examples. It will not +cover all PyGMT modules. + +.. toctree:: + :maxdepth: 1 + + starter-tutorials/first_figure.rst \ No newline at end of file diff --git a/examples/tutorials/first_figure.py b/examples/tutorials/starter-tutorials/first_figure.py similarity index 97% rename from examples/tutorials/first_figure.py rename to examples/tutorials/starter-tutorials/first_figure.py index 66ff736020f..d2c5d107caf 100644 --- a/examples/tutorials/first_figure.py +++ b/examples/tutorials/starter-tutorials/first_figure.py @@ -2,8 +2,7 @@ Making your first figure ======================== -Welcome to PyGMT! Here we'll cover some of basic concepts, like creating simple -figures and naming conventions. +Here is how to plot your first figure. """ ############################################################################### From ef4d98719e6cc8419baa1759e0baddd424078e67 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 15 Nov 2021 09:26:40 +0000 Subject: [PATCH 02/50] update doc/conf.py to fix merge conflicts --- doc/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/conf.py b/doc/conf.py index 39ba1db6cda..1ce78b421f0 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -87,6 +87,8 @@ "../examples/projections/misc", "../examples/projections/nongeo", "../examples/projections/table", + "../examples/tutorials/basics", + "../examples/tutorials/advanced", ] ), # Patter to search for example files From 41814f393615014d87a6bec8117235d0daf25476 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 15 Nov 2021 09:38:46 +0000 Subject: [PATCH 03/50] update conf.py for starer tutorials folder --- doc/conf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/conf.py b/doc/conf.py index 1ce78b421f0..86879042134 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -89,6 +89,7 @@ "../examples/projections/table", "../examples/tutorials/basics", "../examples/tutorials/advanced", + "../examples/tutorials/starter-tutorials", ] ), # Patter to search for example files From 3661ada591f67bf217738373f58e44b6da7a6a63 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 16 Nov 2021 08:22:39 +0000 Subject: [PATCH 04/50] Apply suggestions from code review Co-authored-by: Meghan Jones --- doc/conf.py | 2 +- doc/index.rst | 2 +- examples/tutorials/starter-tutorial.rst | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 86879042134..b72d56755a5 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -89,7 +89,7 @@ "../examples/projections/table", "../examples/tutorials/basics", "../examples/tutorials/advanced", - "../examples/tutorials/starter-tutorials", + "../examples/starter-tutorial", ] ), # Patter to search for example files diff --git a/doc/index.rst b/doc/index.rst index 48ace0fdfd6..1f66f37a3d0 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -20,7 +20,7 @@ overview.rst install.rst - tutorials/starter-tutorial.rst + starter-tutorial/index.rst .. toctree:: :maxdepth: 2 diff --git a/examples/tutorials/starter-tutorial.rst b/examples/tutorials/starter-tutorial.rst index 1211e49291c..ad32a66ff7a 100644 --- a/examples/tutorials/starter-tutorial.rst +++ b/examples/tutorials/starter-tutorial.rst @@ -14,8 +14,3 @@ Notebook. This tutorial will progressively cover PyGMT plotting concepts, and later examples will use concepts explained in previous examples. It will not cover all PyGMT modules. - -.. toctree:: - :maxdepth: 1 - - starter-tutorials/first_figure.rst \ No newline at end of file From 5605b9df4e61c6a756bcdcc2864369ac4b5d2480 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 16 Nov 2021 08:28:29 +0000 Subject: [PATCH 05/50] moving tutorial files --- .../starter-tutorial.rst => starter-tutorial/README.txt} | 0 .../starter-tutorials => starter-tutorial}/first_figure.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename examples/{tutorials/starter-tutorial.rst => starter-tutorial/README.txt} (100%) rename examples/{tutorials/starter-tutorials => starter-tutorial}/first_figure.py (100%) diff --git a/examples/tutorials/starter-tutorial.rst b/examples/starter-tutorial/README.txt similarity index 100% rename from examples/tutorials/starter-tutorial.rst rename to examples/starter-tutorial/README.txt diff --git a/examples/tutorials/starter-tutorials/first_figure.py b/examples/starter-tutorial/first_figure.py similarity index 100% rename from examples/tutorials/starter-tutorials/first_figure.py rename to examples/starter-tutorial/first_figure.py From 793b555fea986979b0f712aa5df16653e50544b7 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 16 Nov 2021 08:28:39 +0000 Subject: [PATCH 06/50] update conf.py --- doc/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index b72d56755a5..1f538ee348c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -66,10 +66,11 @@ "examples_dirs": [ "../examples/gallery", "../examples/tutorials", + "../examples/starter-tutorial", "../examples/projections", ], # path where to save gallery generated examples - "gallery_dirs": ["gallery", "tutorials", "projections"], + "gallery_dirs": ["gallery", "tutorials", "starter-tutorial", "projections"], "subsection_order": ExplicitOrder( [ "../examples/gallery/maps", From 77799f0e39dc89395be1530e798178e5c77c61ee Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 16 Nov 2021 08:28:49 +0000 Subject: [PATCH 07/50] add starter tutorial files to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c5d41027a5f..27b4caa04fd 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ doc/_build/ doc/gallery/ doc/projections/ doc/tutorials/ +doc/starter-tutorial/ # Jupyter Notebook .ipynb_checkpoints/ From 1ab117cbc767ce6a8bd4d4ced12297c9c949e307 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 16 Nov 2021 08:28:59 +0000 Subject: [PATCH 08/50] add starter tutorials to Makefile --- doc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/Makefile b/doc/Makefile index 6c4d7ab31ff..800e9d99b13 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -48,4 +48,5 @@ clean: rm -rf api/generated rm -rf gallery rm -rf tutorials + rm -rf starter-tutorial rm -rf projections From 962d05d38bf7abea7a0741117ca3649cb73f665c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 16 Nov 2021 08:29:51 +0000 Subject: [PATCH 09/50] run make fomrat --- doc/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conf.py b/doc/conf.py index 1f538ee348c..2e16cd620ae 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -66,7 +66,7 @@ "examples_dirs": [ "../examples/gallery", "../examples/tutorials", - "../examples/starter-tutorial", + "../examples/starter-tutorial", "../examples/projections", ], # path where to save gallery generated examples From a9441a22d04764ea61ae7a0dd838d951f6ccc74e Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 09:17:07 +0000 Subject: [PATCH 10/50] add into to README.txt --- examples/starter-tutorial/README.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/starter-tutorial/README.txt b/examples/starter-tutorial/README.txt index ad32a66ff7a..18d1a1583da 100644 --- a/examples/starter-tutorial/README.txt +++ b/examples/starter-tutorial/README.txt @@ -4,6 +4,15 @@ Starter Tutorial Welcome to PyGMT! This tutorial is designed to teach the basic concepts to make a map in PyGMT. +About PyGMT +----------- + +PyGMT is a Python wrapper for the Generic Mapping Tools (GMT) software package. +GMT can be used for all types of plotting, but has a focus on scientific +mapping in the geoscience field. PyGMT adds to the mapping capabilities of GMT +by adding in the functionality of Python-specific packages, such as numpy, +pandas, and xarray, as well as includes the use of Jupyter notebooks. + About this tutorial ------------------- From d6e7c1e9333f5c677a6e29fd398ae4c7a335ae0f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 09:43:27 +0000 Subject: [PATCH 11/50] remove sub-sections in intro --- examples/starter-tutorial/README.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/starter-tutorial/README.txt b/examples/starter-tutorial/README.txt index 18d1a1583da..15d1008ae21 100644 --- a/examples/starter-tutorial/README.txt +++ b/examples/starter-tutorial/README.txt @@ -4,8 +4,7 @@ Starter Tutorial Welcome to PyGMT! This tutorial is designed to teach the basic concepts to make a map in PyGMT. -About PyGMT ------------ +**About PyGMT** PyGMT is a Python wrapper for the Generic Mapping Tools (GMT) software package. GMT can be used for all types of plotting, but has a focus on scientific @@ -13,8 +12,7 @@ mapping in the geoscience field. PyGMT adds to the mapping capabilities of GMT by adding in the functionality of Python-specific packages, such as numpy, pandas, and xarray, as well as includes the use of Jupyter notebooks. -About this tutorial -------------------- +**About this tutorial** This tutorial assumes that PyGMT has been successfully installed. A quick way to test this is to type ``import pygmt`` in a Python IDE or Jupyter @@ -23,3 +21,4 @@ Notebook. This tutorial will progressively cover PyGMT plotting concepts, and later examples will use concepts explained in previous examples. It will not cover all PyGMT modules. + From 943c51f4d28a3d5b757a230ae0ce6094b926424f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 09:59:37 +0000 Subject: [PATCH 12/50] update docstrings --- examples/starter-tutorial/first_figure.py | 27 +++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index d2c5d107caf..b349b5ce939 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -1,22 +1,35 @@ """ -Making your first figure -======================== +1. Making your first figure +=========================== -Here is how to plot your first figure. +This tutorial page covers the basics of creating a figure. It will only use +the ``coast`` module for plotting. Later examples will address other PyGMT +modules. """ +############################################################################### +# Setting up the development environment +# -------------------------------------- +# +# PyGMT can be used in both a Python script and a notebook environment, such +# as Jupyter. The tutorial's recommended method is to use a notebook, and the +# code will be for a notebook environment. If you use a Python script instead, +# there will be a difference in how the figure is shown that is explained in +# the first example. + + ############################################################################### # Loading the library # ------------------- # -# All modules and figure generation is accessible from the :mod:`pygmt` top -# level package: +# The first step is to import ``pygmt``. All modules and figure generation is +# accessible from the :mod:`pygmt` top level package. import pygmt ############################################################################### -# Creating figures -# ---------------- +# Creating a figure +# ----------------- # # All figure generation in PyGMT is handled by the :class:`pygmt.Figure` class. # Start a new figure by creating an instance of this class: From 016b7f771646930b76d8b824d08150b657082615 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 10:23:58 +0000 Subject: [PATCH 13/50] update the first figure plotted --- examples/starter-tutorial/first_figure.py | 32 ++++++++++++++--------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index b349b5ce939..3ed4d9abe3c 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -37,20 +37,26 @@ fig = pygmt.Figure() ############################################################################### -# Add elements to the figure using its methods. For example, let's use -# :meth:`pygmt.Figure.basemap` to start the creation of a map. We'll use the -# ``region`` parameter to provide the longitude and latitude bounds, the -# ``projection`` parameter to set the projection to Mercator (**M**) and the -# map width to 15 cm, and the ``frame`` parameter to generate a frame with -# automatic tick and annotation spacings. - -fig.basemap(region=[-90, -70, 0, 20], projection="M15c", frame=True) - -############################################################################### -# Now we can add coastlines using :meth:`pygmt.Figure.coast` to this map using -# the default resolution, line width, and color: +# To add to a plot object (``fig`` in this example), the PyGMT module is used +# as a method on the class. This example will use the module ``coast``, which +# can be used to create a map without any other modules or external data. The +# ``coast`` module plots the coastlines, borders, and bodies of water using a +# database that is included in GMT. +# +# First, a region for the figure must be selected. This example will plot some +# of the coast of Maine in the northeastern US. A Python list can be passed to +# the ``region`` argument with the minimum and maximum X-values (longitude) +# and the minimum and maximum Y-values (latitude). For this example, the +# minimum (bottom left) coordinates are N43 W69 and the maximum (top right) +# coordinates are N44 W68. Negative values can be passed for latitudes in the +# southern hemisphere or longitudes in the western hemisphere. +# +# In addition to the region, a value needs to be passed to ``coast`` to tell +# it what to plot. In this example, ``coast`` will be told to plot the +# shorelines by passing the Boolean value ``True`` to the ``shorelines`` +# parameter. -fig.coast(shorelines=True) +fig.coast(region=[-69, -68, 44, 45], shorelines=True) ############################################################################### # To see the figure, call :meth:`pygmt.Figure.show`: From 33fb3602c58ccb4b78433f7f1630627d00f33454 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 10:27:01 +0000 Subject: [PATCH 14/50] update coordinates in first figure example --- examples/starter-tutorial/first_figure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 3ed4d9abe3c..9d6258ad406 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -47,8 +47,8 @@ # of the coast of Maine in the northeastern US. A Python list can be passed to # the ``region`` argument with the minimum and maximum X-values (longitude) # and the minimum and maximum Y-values (latitude). For this example, the -# minimum (bottom left) coordinates are N43 W69 and the maximum (top right) -# coordinates are N44 W68. Negative values can be passed for latitudes in the +# minimum (bottom left) coordinates are N43.75 W69 and the maximum (top right) +# coordinates are N44.75 W68. Negative values can be passed for latitudes in the # southern hemisphere or longitudes in the western hemisphere. # # In addition to the region, a value needs to be passed to ``coast`` to tell @@ -56,7 +56,7 @@ # shorelines by passing the Boolean value ``True`` to the ``shorelines`` # parameter. -fig.coast(region=[-69, -68, 44, 45], shorelines=True) +fig.coast(region=[-69, -68, 43.75, 44.75], shorelines=True) ############################################################################### # To see the figure, call :meth:`pygmt.Figure.show`: From 473a63b211e35f3fef2341e2c08e9db9d8929b0a Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 10:41:24 +0000 Subject: [PATCH 15/50] add external display parameter explanation --- examples/starter-tutorial/first_figure.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 9d6258ad406..84e7e3235bd 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -59,16 +59,30 @@ fig.coast(region=[-69, -68, 43.75, 44.75], shorelines=True) ############################################################################### -# To see the figure, call :meth:`pygmt.Figure.show`: +# To see the figure, call :meth:`pygmt.Figure.show`. If you are using a Python +# script instead of a notebook, use ``fig.show(method="external)`` to display +# the figure. fig.show() ############################################################################### -# You can also set the map region, projection, and frame type directly in other -# methods without calling :meth:`gmt.Figure.basemap`: +# This figure plots all of the coastlines in the given region, but it does not +# indicate where the land and water are. Color values can be passed to ``land`` +# and ``water`` to set the colors on the figure. + +# When plotting colors in PyGMT, there are multiple +# :gmt-docs:`color codes `, that can be used. This includes +# standard GMT color names (like ``skyblue``), R/G/B levels (like ``0/0/255``), +# a hex value (like ``#333333``), and a graylevel (like ``50``). For this +# example, GMT color names are used. fig = pygmt.Figure() -fig.coast(shorelines=True, region=[-90, -70, 0, 20], projection="M15c", frame=True) +fig.coast( + region=[-69, -68, 43.75, 44.75], + shorelines=True, + land="lightgreen", + water="lightblue", +) fig.show() ############################################################################### From bd99bcf447f99934c1a6a2c80b93d1d9502f8cbc Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 10:54:05 +0000 Subject: [PATCH 16/50] style fix --- examples/starter-tutorial/first_figure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 84e7e3235bd..7526b51257f 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -48,8 +48,8 @@ # the ``region`` argument with the minimum and maximum X-values (longitude) # and the minimum and maximum Y-values (latitude). For this example, the # minimum (bottom left) coordinates are N43.75 W69 and the maximum (top right) -# coordinates are N44.75 W68. Negative values can be passed for latitudes in the -# southern hemisphere or longitudes in the western hemisphere. +# coordinates are N44.75 W68. Negative values can be passed for latitudes in +# the southern hemisphere or longitudes in the western hemisphere. # # In addition to the region, a value needs to be passed to ``coast`` to tell # it what to plot. In this example, ``coast`` will be told to plot the From cf9863865b8b3b35a42a87f1e38f9b3fa707bff2 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 10:54:55 +0000 Subject: [PATCH 17/50] format fix --- examples/starter-tutorial/first_figure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 7526b51257f..0fec70ed9a8 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -69,7 +69,7 @@ # This figure plots all of the coastlines in the given region, but it does not # indicate where the land and water are. Color values can be passed to ``land`` # and ``water`` to set the colors on the figure. - +# # When plotting colors in PyGMT, there are multiple # :gmt-docs:`color codes `, that can be used. This includes # standard GMT color names (like ``skyblue``), R/G/B levels (like ``0/0/255``), From 913116369184b90df564141988ae28979a578638 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 11:09:38 +0000 Subject: [PATCH 18/50] add projection settings --- examples/starter-tutorial/first_figure.py | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 0fec70ed9a8..015495566e2 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -66,6 +66,9 @@ fig.show() ############################################################################### +# Color the land and water +# ------------------------ +# # This figure plots all of the coastlines in the given region, but it does not # indicate where the land and water are. Color values can be passed to ``land`` # and ``water`` to set the colors on the figure. @@ -85,6 +88,29 @@ ) fig.show() +############################################################################### +# Set the projection +# ------------------ +# +# This figure now has its colors set, but there is not projection or size is +# not set for the map. Both of these values are set using the ``projection`` +# parameter. +# +# The appropriate projection varies for the type of map. The available +# projections are explained in the "Projections" gallery. For this example, +# the Mercator projection is set using "M". The width of the figure will be +# 15 centimeters, as set by "15c" + +fig = pygmt.Figure() +fig.coast( + region=[-69, -68, 43.75, 44.75], + shorelines=True, + land="lightgreen", + water="lightblue", + projection="M15c", +) +fig.show() + ############################################################################### # Saving figures # -------------- From b9aa8d6a454f29597a71e68cc39c6b3cb2159a2c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 17 Nov 2021 11:10:19 +0000 Subject: [PATCH 19/50] removing figure saving from tutorial --- examples/starter-tutorial/first_figure.py | 44 ----------------------- 1 file changed, 44 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 015495566e2..a3777a37119 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -110,47 +110,3 @@ projection="M15c", ) fig.show() - -############################################################################### -# Saving figures -# -------------- -# -# Use the method :meth:`pygmt.Figure.savefig` to save your figure to a file. -# The figure format is inferred from the extension. -# -# .. code:: python -# -# fig.savefig("central-america-shorelines.png") -# -# Note for experienced GMT users -# ------------------------------ -# -# You have probably noticed several things that are different from classic -# command-line GMT. Many of these changes reflect the new GMT modern execution -# mode that is part of GMT 6. -# -# 1. As a general rule, the ``ps`` prefix has been removed from all ``ps*`` -# modules (PyGMT methods). For example, the name of the GMT 5 module -# ``pscoast`` is ``coast`` in GMT 6 and PyGMT. The exceptions are: ``psxy`` -# which is now ``plot``, ``psxyz`` which is now ``plot3d``, and ``psscale`` -# which is now ``colorbar``. -# -# 2. More details can be found in the :gmt-docs:`GMT cookbook introduction to -# modern mode `. -# -# A few are PyGMT exclusive (like the ``savefig`` method). -# -# 1. The PyGMT parameters (called options or arguments in GMT) don't use the -# GMT 1-letter syntax (**R**, **J**, **B**, etc). We use longer aliases for -# these parameters and have some Python exclusive names. The mapping between -# the GMT parameters and their PyGMT aliases should be straightforward. -# For some modules, these aliases are still being developed. -# 2. Parameters like ``region`` can take :class:`lists ` as well as -# strings like ``1/2/3/4``. -# 3. If a GMT option has no arguments (like ``-B`` instead of ``-Baf``), use a -# ``True`` in Python. An empty string would also be acceptable. For repeated -# parameters, such as ``-B+Loleron -Bxaf -By+lm``, provide a -# :class:`list`: ``frame=["+Loleron", "xaf", "y+lm"]``. -# 4. There is no output redirecting to a PostScript file. The figure is -# generated in the background and will only be shown or saved when you ask -# for it. From 03bc80a427a4396a7b9351b2e4ac436143f4ab00 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 18 Nov 2021 07:13:05 +0000 Subject: [PATCH 20/50] wording update --- examples/starter-tutorial/first_figure.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index a3777a37119..0e554ddd943 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -92,14 +92,15 @@ # Set the projection # ------------------ # -# This figure now has its colors set, but there is not projection or size is -# not set for the map. Both of these values are set using the ``projection`` +# This figure now has its colors set, but there is not projection or size +# set for the map. Both of these values are set using the ``projection`` # parameter. # # The appropriate projection varies for the type of map. The available # projections are explained in the "Projections" gallery. For this example, # the Mercator projection is set using "M". The width of the figure will be -# 15 centimeters, as set by "15c" +# 15 centimeters, as set by "15c". The map size can also be set in inches +# using "i" (e.g. a 5 inch wide Mercator projection would use "M5i"). fig = pygmt.Figure() fig.coast( From 3c53e55f7fa0491ffc6b6697d9bcb24071889e87 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 18 Nov 2021 07:25:53 +0000 Subject: [PATCH 21/50] add frame section --- examples/starter-tutorial/first_figure.py | 30 ++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 0e554ddd943..19c45af3b59 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -54,7 +54,8 @@ # In addition to the region, a value needs to be passed to ``coast`` to tell # it what to plot. In this example, ``coast`` will be told to plot the # shorelines by passing the Boolean value ``True`` to the ``shorelines`` -# parameter. +# parameter. The ``shorelines`` parameter has other options for finer control, +# but setting it to ``True`` uses its default values. fig.coast(region=[-69, -68, 43.75, 44.75], shorelines=True) @@ -99,7 +100,7 @@ # The appropriate projection varies for the type of map. The available # projections are explained in the "Projections" gallery. For this example, # the Mercator projection is set using "M". The width of the figure will be -# 15 centimeters, as set by "15c". The map size can also be set in inches +# 10 centimeters, as set by "10c". The map size can also be set in inches # using "i" (e.g. a 5 inch wide Mercator projection would use "M5i"). fig = pygmt.Figure() @@ -108,6 +109,29 @@ shorelines=True, land="lightgreen", water="lightblue", - projection="M15c", + projection="M10c", +) +fig.show() + +############################################################################### +# Add a frame +# ----------- +# +# Now that the map's colors, projection, and size have been set, the region +# that is being displayed is not apparent. A frame can be added to the +# latitude and longitude of the region. +# +# The ``frame`` parameter is used to add a frame to the figure. For now, it +# will be set to ``True`` to use default settings, but later tutorials will +# show how ``frame`` can be used to customize the axes, gridlines, and titles. + +fig = pygmt.Figure() +fig.coast( + region=[-69, -68, 43.75, 44.75], + shorelines=True, + land="lightgreen", + water="lightblue", + projection="M10c", + frame=True, ) fig.show() From c880bd761014750e720c54f2a5920f7ae451caae Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 18 Nov 2021 07:46:42 +0000 Subject: [PATCH 22/50] add additional exercises --- examples/starter-tutorial/first_figure.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 19c45af3b59..6b3758c406b 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -135,3 +135,18 @@ frame=True, ) fig.show() + +############################################################################### +# Additional exercises +# -------------------- +# +# This is the end of the first tutorial. Here are some additional exercises +# for the concepts that were discussed: +# 1. Make a map of the Canary Islands. Use a tool like Google Maps to +# determine the coordinates for the ``region`` argument. +# 2. Change the color of the land to "khaki" and the water to "azure". +# 3. Create a global map. Set the region to "d" to center the map at the Prime +# Meridian or "g" to center the map at the International Date Line. When the +# region is set without using a list full of integers or floating numbers, +# the argument needs to be passed as a Python string. Create a 15 centimeter +# map using the Mollwide ("W") projection. From b89e708721272dddd8985ddc43b1b61c68e4545e Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 18 Nov 2021 08:01:19 +0000 Subject: [PATCH 23/50] format fix --- examples/starter-tutorial/first_figure.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 6b3758c406b..421a28d2415 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -142,9 +142,12 @@ # # This is the end of the first tutorial. Here are some additional exercises # for the concepts that were discussed: +# # 1. Make a map of the Canary Islands. Use a tool like Google Maps to # determine the coordinates for the ``region`` argument. +# # 2. Change the color of the land to "khaki" and the water to "azure". +# # 3. Create a global map. Set the region to "d" to center the map at the Prime # Meridian or "g" to center the map at the International Date Line. When the # region is set without using a list full of integers or floating numbers, From ae030ba4e752dc35af0fc9a12a78ca783921e870 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 18 Nov 2021 08:49:40 +0000 Subject: [PATCH 24/50] specify sphinx gallery image --- examples/starter-tutorial/first_figure.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/starter-tutorial/first_figure.py b/examples/starter-tutorial/first_figure.py index 421a28d2415..5e12c22f192 100644 --- a/examples/starter-tutorial/first_figure.py +++ b/examples/starter-tutorial/first_figure.py @@ -6,6 +6,7 @@ the ``coast`` module for plotting. Later examples will address other PyGMT modules. """ +# sphinx_gallery_thumbnail_number = 4 ############################################################################### # Setting up the development environment From 0e8efcb3199b581209512871a8ff10fee87a6394 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 19 Nov 2021 15:29:19 +0000 Subject: [PATCH 25/50] Apply suggestions from code review Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- examples/starter-tutorial/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/starter-tutorial/README.txt b/examples/starter-tutorial/README.txt index 15d1008ae21..93eb39040ee 100644 --- a/examples/starter-tutorial/README.txt +++ b/examples/starter-tutorial/README.txt @@ -14,7 +14,7 @@ pandas, and xarray, as well as includes the use of Jupyter notebooks. **About this tutorial** -This tutorial assumes that PyGMT has been successfully installed. A quick +This tutorial assumes that PyGMT has been successfully [installed](https://www.pygmt.org/latest/install.html). A quick way to test this is to type ``import pygmt`` in a Python IDE or Jupyter Notebook. From af1312407fce6b3b7d0befa2674dffe69adc034a Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 4 Dec 2021 07:45:03 +0000 Subject: [PATCH 26/50] remove "About PyGMT" section from starter tutorial --- examples/starter-tutorial/README.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/examples/starter-tutorial/README.txt b/examples/starter-tutorial/README.txt index 93eb39040ee..69a5d2789de 100644 --- a/examples/starter-tutorial/README.txt +++ b/examples/starter-tutorial/README.txt @@ -4,14 +4,6 @@ Starter Tutorial Welcome to PyGMT! This tutorial is designed to teach the basic concepts to make a map in PyGMT. -**About PyGMT** - -PyGMT is a Python wrapper for the Generic Mapping Tools (GMT) software package. -GMT can be used for all types of plotting, but has a focus on scientific -mapping in the geoscience field. PyGMT adds to the mapping capabilities of GMT -by adding in the functionality of Python-specific packages, such as numpy, -pandas, and xarray, as well as includes the use of Jupyter notebooks. - **About this tutorial** This tutorial assumes that PyGMT has been successfully [installed](https://www.pygmt.org/latest/install.html). A quick From 416175bfb02f5724d89c8c3d8133811faa427366 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 6 Dec 2021 19:58:38 +0000 Subject: [PATCH 27/50] rename starter tutorial --- examples/starter-tutorial/README.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/starter-tutorial/README.txt b/examples/starter-tutorial/README.txt index 69a5d2789de..e2bfd3dde9e 100644 --- a/examples/starter-tutorial/README.txt +++ b/examples/starter-tutorial/README.txt @@ -1,5 +1,5 @@ -Starter Tutorial -================ +Intro to PyGMT +============== Welcome to PyGMT! This tutorial is designed to teach the basic concepts to make a map in PyGMT. From 3be0dca01529350d7a784def2a1840ce0d728057 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 6 Dec 2021 20:01:16 +0000 Subject: [PATCH 28/50] rename starter tutorial folder --- doc/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 2e16cd620ae..07ab69bde94 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -66,11 +66,11 @@ "examples_dirs": [ "../examples/gallery", "../examples/tutorials", - "../examples/starter-tutorial", + "../examples/get-started", "../examples/projections", ], # path where to save gallery generated examples - "gallery_dirs": ["gallery", "tutorials", "starter-tutorial", "projections"], + "gallery_dirs": ["gallery", "tutorials", "get-started", "projections"], "subsection_order": ExplicitOrder( [ "../examples/gallery/maps", @@ -90,7 +90,7 @@ "../examples/projections/table", "../examples/tutorials/basics", "../examples/tutorials/advanced", - "../examples/starter-tutorial", + "../examples/get-started", ] ), # Patter to search for example files From 3479d32c25e89be8df568d11bfc349be00a215ca Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 6 Dec 2021 20:01:53 +0000 Subject: [PATCH 29/50] update Makefile with new tutorial folder name --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 800e9d99b13..00493f3a683 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -48,5 +48,5 @@ clean: rm -rf api/generated rm -rf gallery rm -rf tutorials - rm -rf starter-tutorial + rm -rf get-started rm -rf projections From 94b99767fc84001ff52dad6a19418d18d9a61817 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 6 Dec 2021 20:02:24 +0000 Subject: [PATCH 30/50] update gitignore with new tutorial folder name --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 27b4caa04fd..74dc9ec2767 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ doc/_build/ doc/gallery/ doc/projections/ doc/tutorials/ -doc/starter-tutorial/ +doc/get-started/ # Jupyter Notebook .ipynb_checkpoints/ From cd7f278ab457764e9f2ce669ed9195ff2cb02fbd Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 6 Dec 2021 20:03:10 +0000 Subject: [PATCH 31/50] update index with new tutorial folder name --- doc/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/index.rst b/doc/index.rst index 1f66f37a3d0..092eda4bbb0 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -20,7 +20,7 @@ overview.rst install.rst - starter-tutorial/index.rst + get-started/index.rst .. toctree:: :maxdepth: 2 From 748c12bb1f35176e98224e49c64d85eca9538b1c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 6 Dec 2021 20:04:26 +0000 Subject: [PATCH 32/50] update folder name --- examples/{starter-tutorial => get-started}/README.txt | 0 examples/{starter-tutorial => get-started}/first_figure.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename examples/{starter-tutorial => get-started}/README.txt (100%) rename examples/{starter-tutorial => get-started}/first_figure.py (100%) diff --git a/examples/starter-tutorial/README.txt b/examples/get-started/README.txt similarity index 100% rename from examples/starter-tutorial/README.txt rename to examples/get-started/README.txt diff --git a/examples/starter-tutorial/first_figure.py b/examples/get-started/first_figure.py similarity index 100% rename from examples/starter-tutorial/first_figure.py rename to examples/get-started/first_figure.py From c02cdaf91a81cde35ce207cc938a0929176469cb Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Mon, 6 Dec 2021 20:32:00 +0000 Subject: [PATCH 33/50] fix link --- examples/get-started/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/get-started/README.txt b/examples/get-started/README.txt index e2bfd3dde9e..458bb6902ea 100644 --- a/examples/get-started/README.txt +++ b/examples/get-started/README.txt @@ -6,7 +6,7 @@ make a map in PyGMT. **About this tutorial** -This tutorial assumes that PyGMT has been successfully [installed](https://www.pygmt.org/latest/install.html). A quick +This tutorial assumes that PyGMT has been successfully installed. A quick way to test this is to type ``import pygmt`` in a Python IDE or Jupyter Notebook. From b792c6c23652d7e8d2870d647bc56696224772c2 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Wed, 8 Dec 2021 19:54:23 +0000 Subject: [PATCH 34/50] Apply suggestions from code review Co-authored-by: Meghan Jones --- examples/get-started/first_figure.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 5e12c22f192..0bdcfa2e910 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -52,7 +52,7 @@ # coordinates are N44.75 W68. Negative values can be passed for latitudes in # the southern hemisphere or longitudes in the western hemisphere. # -# In addition to the region, a value needs to be passed to ``coast`` to tell +# In addition to the region, an argument needs to be passed to ``coast`` to tell # it what to plot. In this example, ``coast`` will be told to plot the # shorelines by passing the Boolean value ``True`` to the ``shorelines`` # parameter. The ``shorelines`` parameter has other options for finer control, @@ -118,9 +118,9 @@ # Add a frame # ----------- # -# Now that the map's colors, projection, and size have been set, the region -# that is being displayed is not apparent. A frame can be added to the -# latitude and longitude of the region. +# While that the map's colors, projection, and size have been set, the region +# that is being displayed is not apparent. A frame can be added to +# annotate the latitude and longitude of the region. # # The ``frame`` parameter is used to add a frame to the figure. For now, it # will be set to ``True`` to use default settings, but later tutorials will From 9604d7f31c1f30594749e159e106f12d1b0e8f4b Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 11 Dec 2021 10:06:31 +0000 Subject: [PATCH 35/50] Apply suggestions from code review Co-authored-by: Meghan Jones --- examples/get-started/first_figure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 0bdcfa2e910..7287fff1567 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -6,7 +6,6 @@ the ``coast`` module for plotting. Later examples will address other PyGMT modules. """ -# sphinx_gallery_thumbnail_number = 4 ############################################################################### # Setting up the development environment @@ -26,6 +25,7 @@ # The first step is to import ``pygmt``. All modules and figure generation is # accessible from the :mod:`pygmt` top level package. +# sphinx_gallery_thumbnail_number = 4 import pygmt ############################################################################### From b1e3b5e02bca6fd17fb1cd688a49d88437e48e5d Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 11 Dec 2021 10:32:34 +0000 Subject: [PATCH 36/50] update additional exercises --- examples/get-started/first_figure.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 7287fff1567..1cd22eb0044 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -144,12 +144,14 @@ # This is the end of the first tutorial. Here are some additional exercises # for the concepts that were discussed: # -# 1. Make a map of the Canary Islands. Use a tool like Google Maps to -# determine the coordinates for the ``region`` argument. +# 1. Make a map of Germany using its DCW ISO code ("DE"). Pass the ISO code +# as a Python string to the "region" parameter. # # 2. Change the color of the land to "khaki" and the water to "azure". # -# 3. Create a global map. Set the region to "d" to center the map at the Prime +# 3. Change the color of the lakes (using the "lakes" parameter) to "red." +# +# 4. Create a global map. Set the region to "d" to center the map at the Prime # Meridian or "g" to center the map at the International Date Line. When the # region is set without using a list full of integers or floating numbers, # the argument needs to be passed as a Python string. Create a 15 centimeter From 7fe3ee1d057cae550f4a4ae05e1b191fc143af4f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sat, 11 Dec 2021 10:35:00 +0000 Subject: [PATCH 37/50] style fix --- examples/get-started/first_figure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 1cd22eb0044..9094e2fdeea 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -52,8 +52,8 @@ # coordinates are N44.75 W68. Negative values can be passed for latitudes in # the southern hemisphere or longitudes in the western hemisphere. # -# In addition to the region, an argument needs to be passed to ``coast`` to tell -# it what to plot. In this example, ``coast`` will be told to plot the +# In addition to the region, an argument needs to be passed to ``coast`` to +# tell it what to plot. In this example, ``coast`` will be told to plot the # shorelines by passing the Boolean value ``True`` to the ``shorelines`` # parameter. The ``shorelines`` parameter has other options for finer control, # but setting it to ``True`` uses its default values. From e90bc276c09c202cde0e6aed5b24b12e95b84605 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 14 Dec 2021 16:01:55 +0000 Subject: [PATCH 38/50] Apply suggestions from code review Co-authored-by: Meghan Jones --- examples/get-started/first_figure.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 9094e2fdeea..3ea4f7e1c9f 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -99,10 +99,10 @@ # parameter. # # The appropriate projection varies for the type of map. The available -# projections are explained in the "Projections" gallery. For this example, -# the Mercator projection is set using "M". The width of the figure will be -# 10 centimeters, as set by "10c". The map size can also be set in inches -# using "i" (e.g. a 5 inch wide Mercator projection would use "M5i"). +# projections are explained in the :doc:`projection ` gallery. For this example, +# the Mercator projection is set using ``"M"``. The width of the figure will be +# 10 centimeters, as set by ``"10c"``. The map size can also be set in inches +# using "i" (e.g. a 5 inch wide Mercator projection would use ``"M5i"``). fig = pygmt.Figure() fig.coast( @@ -145,11 +145,11 @@ # for the concepts that were discussed: # # 1. Make a map of Germany using its DCW ISO code ("DE"). Pass the ISO code -# as a Python string to the "region" parameter. +# as a Python string to the ``"region"`` parameter. # # 2. Change the color of the land to "khaki" and the water to "azure". # -# 3. Change the color of the lakes (using the "lakes" parameter) to "red." +# 3. Change the color of the lakes (using the ``"lakes"`` parameter) to "red." # # 4. Create a global map. Set the region to "d" to center the map at the Prime # Meridian or "g" to center the map at the International Date Line. When the From 64dfe0ae37e6d517bdd011c38be14f134998ef28 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 14 Dec 2021 16:50:22 +0000 Subject: [PATCH 39/50] change frame argument --- examples/get-started/first_figure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 3ea4f7e1c9f..c8eba3aff94 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -123,7 +123,7 @@ # annotate the latitude and longitude of the region. # # The ``frame`` parameter is used to add a frame to the figure. For now, it -# will be set to ``True`` to use default settings, but later tutorials will +# will be set to ``a`` to use default settings, but later tutorials will # show how ``frame`` can be used to customize the axes, gridlines, and titles. fig = pygmt.Figure() @@ -133,7 +133,7 @@ land="lightgreen", water="lightblue", projection="M10c", - frame=True, + frame="a", ) fig.show() From 3ae1a1e427b2ce739ee691c8a880eb70c990a41c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 14 Dec 2021 16:51:52 +0000 Subject: [PATCH 40/50] run make format --- examples/get-started/first_figure.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index c8eba3aff94..211fc65988d 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -99,10 +99,11 @@ # parameter. # # The appropriate projection varies for the type of map. The available -# projections are explained in the :doc:`projection ` gallery. For this example, -# the Mercator projection is set using ``"M"``. The width of the figure will be -# 10 centimeters, as set by ``"10c"``. The map size can also be set in inches -# using "i" (e.g. a 5 inch wide Mercator projection would use ``"M5i"``). +# projections are explained in the :doc:`projection ` +# gallery. For this example, the Mercator projection is set using ``"M"``. +# The width of the figure will be 10 centimeters, as set by ``"10c"``. The map +# size can also be set in inches using "i" (e.g. a 5 inch wide Mercator +# projection would use ``"M5i"``). fig = pygmt.Figure() fig.coast( From 75fb36cd18cf23657a90bc75510016a343f31a65 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Tue, 14 Dec 2021 16:53:18 +0000 Subject: [PATCH 41/50] format lines --- examples/get-started/first_figure.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 211fc65988d..b7e41113c61 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -153,7 +153,7 @@ # 3. Change the color of the lakes (using the ``"lakes"`` parameter) to "red." # # 4. Create a global map. Set the region to "d" to center the map at the Prime -# Meridian or "g" to center the map at the International Date Line. When the -# region is set without using a list full of integers or floating numbers, -# the argument needs to be passed as a Python string. Create a 15 centimeter -# map using the Mollwide ("W") projection. +# Meridian or "g" to center the map at the International Date Line. When the +# region is set without using a list full of integers or floating numbers, +# the argument needs to be passed as a Python string. Create a 15 centimeter +# map using the Mollwide ("W") projection. From 7c1ffec877c26d609b31a12f3697ac7763b9879f Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 16 Dec 2021 15:26:02 +0000 Subject: [PATCH 42/50] Apply suggestions from code review Co-authored-by: TIAN Dongdong Co-authored-by: Michael Grund <23025878+michaelgrund@users.noreply.github.com> --- examples/get-started/first_figure.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index b7e41113c61..c6ae94666c2 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -48,8 +48,8 @@ # of the coast of Maine in the northeastern US. A Python list can be passed to # the ``region`` argument with the minimum and maximum X-values (longitude) # and the minimum and maximum Y-values (latitude). For this example, the -# minimum (bottom left) coordinates are N43.75 W69 and the maximum (top right) -# coordinates are N44.75 W68. Negative values can be passed for latitudes in +# minimum (bottom left) coordinates are (N43.75, W69) and the maximum (top right) +# coordinates are (N44.75, W68). Negative values can be passed for latitudes in # the southern hemisphere or longitudes in the western hemisphere. # # In addition to the region, an argument needs to be passed to ``coast`` to @@ -94,7 +94,7 @@ # Set the projection # ------------------ # -# This figure now has its colors set, but there is not projection or size +# This figure now has its colors set, but there is no projection or size # set for the map. Both of these values are set using the ``projection`` # parameter. # @@ -146,11 +146,11 @@ # for the concepts that were discussed: # # 1. Make a map of Germany using its DCW ISO code ("DE"). Pass the ISO code -# as a Python string to the ``"region"`` parameter. +# as a Python string to the ``region`` parameter. # # 2. Change the color of the land to "khaki" and the water to "azure". # -# 3. Change the color of the lakes (using the ``"lakes"`` parameter) to "red." +# 3. Change the color of the lakes (using the ``lakes`` parameter) to "red". # # 4. Create a global map. Set the region to "d" to center the map at the Prime # Meridian or "g" to center the map at the International Date Line. When the From 2024b6cf039df0d6a234868ab11a8979c59544d3 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 16 Dec 2021 15:32:17 +0000 Subject: [PATCH 43/50] remove mention of using external method for show --- examples/get-started/first_figure.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index c6ae94666c2..ec15e16cb09 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -13,9 +13,7 @@ # # PyGMT can be used in both a Python script and a notebook environment, such # as Jupyter. The tutorial's recommended method is to use a notebook, and the -# code will be for a notebook environment. If you use a Python script instead, -# there will be a difference in how the figure is shown that is explained in -# the first example. +# code will be for a notebook environment. ############################################################################### @@ -61,9 +59,7 @@ fig.coast(region=[-69, -68, 43.75, 44.75], shorelines=True) ############################################################################### -# To see the figure, call :meth:`pygmt.Figure.show`. If you are using a Python -# script instead of a notebook, use ``fig.show(method="external)`` to display -# the figure. +# To see the figure, call :meth:`pygmt.Figure.show`. fig.show() From f912e75a95e9d58ba8929c2afc55fd9521090f24 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 16 Dec 2021 15:34:30 +0000 Subject: [PATCH 44/50] changing frame settings --- examples/get-started/first_figure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index ec15e16cb09..5057637c3e9 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -120,7 +120,7 @@ # annotate the latitude and longitude of the region. # # The ``frame`` parameter is used to add a frame to the figure. For now, it -# will be set to ``a`` to use default settings, but later tutorials will +# will be set to ``True`` to use default settings, but later tutorials will # show how ``frame`` can be used to customize the axes, gridlines, and titles. fig = pygmt.Figure() @@ -130,7 +130,7 @@ land="lightgreen", water="lightblue", projection="M10c", - frame="a", + frame=True, ) fig.show() From dfc996db33da965de224caef0fa7399b1c64636d Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 16 Dec 2021 15:35:03 +0000 Subject: [PATCH 45/50] change ISO code description --- examples/get-started/first_figure.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 5057637c3e9..b89a6796d4b 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -141,8 +141,8 @@ # This is the end of the first tutorial. Here are some additional exercises # for the concepts that were discussed: # -# 1. Make a map of Germany using its DCW ISO code ("DE"). Pass the ISO code -# as a Python string to the ``region`` parameter. +# 1. Make a map of Germany using its ISO country code ("DE"). Pass the ISO +# code as a Python string to the ``region`` parameter. # # 2. Change the color of the land to "khaki" and the water to "azure". # From 892a14c094fc5e6032f90235da38a00a162fb9c6 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Thu, 16 Dec 2021 15:40:10 +0000 Subject: [PATCH 46/50] format fix --- examples/get-started/first_figure.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index b89a6796d4b..037efffd298 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -46,9 +46,9 @@ # of the coast of Maine in the northeastern US. A Python list can be passed to # the ``region`` argument with the minimum and maximum X-values (longitude) # and the minimum and maximum Y-values (latitude). For this example, the -# minimum (bottom left) coordinates are (N43.75, W69) and the maximum (top right) -# coordinates are (N44.75, W68). Negative values can be passed for latitudes in -# the southern hemisphere or longitudes in the western hemisphere. +# minimum (bottom left) coordinates are (N43.75, W69) and the maximum (top +# right) coordinates are (N44.75, W68). Negative values can be passed for +# latitudes in the southern hemisphere or longitudes in the western hemisphere. # # In addition to the region, an argument needs to be passed to ``coast`` to # tell it what to plot. In this example, ``coast`` will be told to plot the From 3ce6a7166966209971acfa57aca6751952ca1177 Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 17 Dec 2021 07:44:22 +0000 Subject: [PATCH 47/50] Apply suggestions from code review Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- examples/get-started/first_figure.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/get-started/first_figure.py b/examples/get-started/first_figure.py index 037efffd298..86346dc6f34 100644 --- a/examples/get-started/first_figure.py +++ b/examples/get-started/first_figure.py @@ -2,7 +2,8 @@ 1. Making your first figure =========================== -This tutorial page covers the basics of creating a figure. It will only use +This tutorial page covers the basics of creating a figure using PyGMT - a +Python wrapper for the Generic Mapping Tools (GMT). It will only use the ``coast`` module for plotting. Later examples will address other PyGMT modules. """ @@ -54,7 +55,7 @@ # tell it what to plot. In this example, ``coast`` will be told to plot the # shorelines by passing the Boolean value ``True`` to the ``shorelines`` # parameter. The ``shorelines`` parameter has other options for finer control, -# but setting it to ``True`` uses its default values. +# but setting it to ``True`` uses the default values. fig.coast(region=[-69, -68, 43.75, 44.75], shorelines=True) @@ -74,7 +75,7 @@ # When plotting colors in PyGMT, there are multiple # :gmt-docs:`color codes `, that can be used. This includes # standard GMT color names (like ``skyblue``), R/G/B levels (like ``0/0/255``), -# a hex value (like ``#333333``), and a graylevel (like ``50``). For this +# a hex value (like ``#333333``), or a graylevel (like ``50``). For this # example, GMT color names are used. fig = pygmt.Figure() From 237e141dc6a2acf651cd91e99a2168893dd4684c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 17 Dec 2021 17:48:13 +0000 Subject: [PATCH 48/50] update README --- examples/get-started/README.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/get-started/README.txt b/examples/get-started/README.txt index 458bb6902ea..d0c6e1bd7e8 100644 --- a/examples/get-started/README.txt +++ b/examples/get-started/README.txt @@ -6,9 +6,10 @@ make a map in PyGMT. **About this tutorial** -This tutorial assumes that PyGMT has been successfully installed. A quick -way to test this is to type ``import pygmt`` in a Python IDE or Jupyter -Notebook. +This tutorial assumes that PyGMT has been successfully +[installed](:doc:`install`). A quick way to test this is to type +``import pygmt`` in a Python IDE or +`Jupyter `__ Notebook. This tutorial will progressively cover PyGMT plotting concepts, and later examples will use concepts explained in previous examples. It will not From 9f5568ff4327b22e4fc219c0352dd7d18156df9c Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Fri, 17 Dec 2021 18:32:19 +0000 Subject: [PATCH 49/50] add link to Jupyter notebook --- examples/get-started/README.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/get-started/README.txt b/examples/get-started/README.txt index d0c6e1bd7e8..e6f65ac91e5 100644 --- a/examples/get-started/README.txt +++ b/examples/get-started/README.txt @@ -6,9 +6,8 @@ make a map in PyGMT. **About this tutorial** -This tutorial assumes that PyGMT has been successfully -[installed](:doc:`install`). A quick way to test this is to type -``import pygmt`` in a Python IDE or +This tutorial assumes that PyGMT has been successfully installed. +A quick way to test this is to type ``import pygmt`` in a Python IDE or `Jupyter `__ Notebook. This tutorial will progressively cover PyGMT plotting concepts, and later From 5910c38938e0423a257641d5dc4ecef7c7e4228e Mon Sep 17 00:00:00 2001 From: Will Schlitzer Date: Sun, 19 Dec 2021 17:36:58 +0000 Subject: [PATCH 50/50] update install link --- examples/get-started/README.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/get-started/README.txt b/examples/get-started/README.txt index e6f65ac91e5..a8fac64a7f7 100644 --- a/examples/get-started/README.txt +++ b/examples/get-started/README.txt @@ -6,8 +6,9 @@ make a map in PyGMT. **About this tutorial** -This tutorial assumes that PyGMT has been successfully installed. -A quick way to test this is to type ``import pygmt`` in a Python IDE or +This tutorial assumes that PyGMT has been successfully +:doc:`installed `. A quick way to test this is to type +``import pygmt`` in a Python IDE or `Jupyter `__ Notebook. This tutorial will progressively cover PyGMT plotting concepts, and later