|
7 | 7 |
|
8 | 8 | .. note::
|
9 | 9 |
|
10 |
| - This tutorial assumes the use of a Python notebook, such as IPython or Jupyter Notebook. |
| 10 | + This tutorial assumes the use of a Python notebook, such as `IPython <https://ipython.org/>`__ |
| 11 | + or `JupyterLab <https://jupyter.org/>`__. |
11 | 12 | To see the figures while using a Python script instead, use
|
12 | 13 | ``fig.show(method="external")`` to display the figure in the default PDF viewer.
|
13 | 14 |
|
|
34 | 35 | fig = pygmt.Figure()
|
35 | 36 |
|
36 | 37 | ########################################################################################
|
37 |
| -# Add elements to the figure using its methods. For example, let's start a map with an |
38 |
| -# automatic frame and ticks around a given longitude and latitude bound, set the |
39 |
| -# projection to Mercator (``M``), and the map width to 8 inches: |
| 38 | +# Add elements to the figure using its methods. For example, let's use |
| 39 | +# :meth:`pygmt.Figure.basemap` to start the creation of a map. We'll use the ``region`` parameter |
| 40 | +# to provide the longitude and latitude bounds, the ``projection`` parameter to set |
| 41 | +# the projection to Mercator (**M**) and the map width to 15 cm, and the ``frame`` |
| 42 | +# parameter to generate a frame with automatic tick and annotation spacings. |
40 | 43 |
|
41 |
| -fig.basemap(region=[-90, -70, 0, 20], projection="M8i", frame=True) |
| 44 | +fig.basemap(region=[-90, -70, 0, 20], projection="M15c", frame=True) |
42 | 45 |
|
43 | 46 | ########################################################################################
|
44 | 47 | # Now we can add coastlines using :meth:`pygmt.Figure.coast` to this map using the
|
|
56 | 59 | # without calling :meth:`gmt.Figure.basemap`:
|
57 | 60 |
|
58 | 61 | fig = pygmt.Figure()
|
59 |
| -fig.coast(shorelines=True, region=[-90, -70, 0, 20], projection="M8i", frame=True) |
| 62 | +fig.coast(shorelines=True, region=[-90, -70, 0, 20], projection="M15c", frame=True) |
60 | 63 | fig.show()
|
61 | 64 |
|
62 | 65 | ########################################################################################
|
|
73 | 76 | # Note for experienced GMT users
|
74 | 77 | # ------------------------------
|
75 | 78 | #
|
76 |
| -# You’ll probably have noticed several things that are different from classic |
77 |
| -# command-line GMT. Many of these changes reflect the new GMT modern execution mode that |
78 |
| -# are part of GMT 6. A few are PyGMT exclusive (like the ``savefig`` method). |
| 79 | +# You have probably noticed several things that are different from classic |
| 80 | +# command-line GMT. Many of these changes reflect the new GMT modern execution |
| 81 | +# mode that is part of GMT 6. |
79 | 82 | #
|
80 |
| -# 1. The name of method is ``coast`` instead of ``pscoast``. As a general rule, all |
81 |
| -# ``ps*`` modules had their ``ps`` prefix removed. The exceptions are: |
82 |
| -# ``psxy`` which is now ``plot``, ``psxyz`` which is now ``plot3d``, and ``psscale`` |
83 |
| -# which is now ``colorbar``. |
84 |
| -# 2. The parameters don't use the GMT 1-letter syntax (**R**, **J**, **B**, etc). We use longer |
| 83 | +# 1. As a general rule, the ``ps`` prefix has been removed from all ``ps*`` |
| 84 | +# modules (PyGMT methods). For example, the name of the GMT 5 module ``pscoast`` |
| 85 | +# is ``coast`` in GMT 6 and PyGMT. The exceptions are: ``psxy`` which is now |
| 86 | +# ``plot``, ``psxyz`` which is now ``plot3d``, and ``psscale`` which is now |
| 87 | +# ``colorbar``. |
| 88 | +# |
| 89 | +# 2. More details can be found in the :gmt-docs:`GMT cookbook introduction to |
| 90 | +# modern mode </cookbook/introduction.html#modern-and-classic-mode>`. |
| 91 | +# |
| 92 | +# A few are PyGMT exclusive (like the ``savefig`` method). |
| 93 | +# |
| 94 | +# 1. The PyGMT parameters (called options or arguments in GMT) don't use the GMT |
| 95 | +# 1-letter syntax (**R**, **J**, **B**, etc). We use longer |
85 | 96 | # aliases for these parameters and have some Python exclusive names. The mapping
|
86 |
| -# between the GMT parameters and their Python counterparts should be straight |
87 |
| -# forward. |
88 |
| -# 3. Parameters like ``region`` can take lists as well as strings like ``1/2/3/4``. |
89 |
| -# 4. If a GMT parameter has no options (like ``-B`` instead of ``-Baf``), use a ``True`` |
| 97 | +# between the GMT parameters and their PyGMT aliases should be straightforward. |
| 98 | +# For some modules, these aliases are still being developed. |
| 99 | +# 2. Parameters like ``region`` can take :class:`lists <list>` as well as strings like ``1/2/3/4``. |
| 100 | +# 3. If a GMT option has no arguments (like ``-B`` instead of ``-Baf``), use a ``True`` |
90 | 101 | # in Python. An empty string would also be acceptable. For repeated parameters, such
|
91 |
| -# as ``-B+Loleron -Bxaf -By+lm``, provide a list: ``frame=["+Loleron", "xaf", "y+lm"]``. |
92 |
| -# 5. There is no output redirecting to a PostScript file. The figure is generated in the |
| 102 | +# as ``-B+Loleron -Bxaf -By+lm``, provide a :class:`list`: ``frame=["+Loleron", "xaf", "y+lm"]``. |
| 103 | +# 4. There is no output redirecting to a PostScript file. The figure is generated in the |
93 | 104 | # background and will only be shown or saved when you ask for it.
|
0 commit comments