|
4 | 4 |
|
5 | 5 | This tutorial page covers the basics of creating a figure using PyGMT - a
|
6 | 6 | Python wrapper for the Generic Mapping Tools (GMT). It will only use
|
7 |
| -the ``coast`` method for plotting. Later examples will address other PyGMT |
8 |
| -methods. |
| 7 | +the :meth:`pygmt.Figure.coast` method for plotting. Later examples will |
| 8 | +address other PyGMT methods. |
9 | 9 | """
|
10 | 10 |
|
11 | 11 | ###############################################################################
|
|
21 | 21 | # Loading the library
|
22 | 22 | # -------------------
|
23 | 23 | #
|
24 |
| -# The first step is to import ``pygmt``. All methods and figure generation is |
25 |
| -# accessible from the :mod:`pygmt` top level package. |
| 24 | +# The first step is to import :mod:`pygmt`. All methods and figure generation |
| 25 | +# are accessible from the :mod:`pygmt` top level package. |
26 | 26 |
|
27 | 27 | # sphinx_gallery_thumbnail_number = 4
|
28 | 28 | import pygmt
|
|
38 | 38 |
|
39 | 39 | ###############################################################################
|
40 | 40 | # To add to a plot object (``fig`` in this example), the PyGMT module is used
|
41 |
| -# as a method on the class. This example will use the ``coast`` method, which |
42 |
| -# can be used to create a map without any other methods, modules or external |
43 |
| -# data. The ``coast`` method plots the coastlines, borders, and bodies of water |
44 |
| -# using a database that is included in GMT. |
| 41 | +# as a method on the class. This example will use the |
| 42 | +# :meth:`pygmt.Figure.coast` method, which can be used to create a map without |
| 43 | +# any other methods, modules or external data. The :meth:`pygmt.Figure.coast` |
| 44 | +# method plots the coastlines, borders, and bodies of water using a database |
| 45 | +# that is included in GMT. |
45 | 46 | #
|
46 | 47 | # First, a region for the figure must be selected. This example will plot some
|
47 | 48 | # of the coast of Maine in the northeastern US. A Python list can be passed to
|
|
51 | 52 | # right) coordinates are (N44.75, W68). Negative values can be passed for
|
52 | 53 | # latitudes in the southern hemisphere or longitudes in the western hemisphere.
|
53 | 54 | #
|
54 |
| -# In addition to the region, an argument needs to be passed to ``coast`` to |
55 |
| -# tell it what to plot. In this example, ``coast`` will be told to plot the |
56 |
| -# shorelines by passing the Boolean value ``True`` to the ``shorelines`` |
57 |
| -# parameter. The ``shorelines`` parameter has other options for finer control, |
58 |
| -# but setting it to ``True`` uses the default values. |
| 55 | +# In addition to the region, an argument needs to be passed to |
| 56 | +# :meth:`pygmt.Figure.coast` to tell it what to plot. In this example, |
| 57 | +# :meth:`pygmt.Figure.coast` will be told to plot the shorelines by passing the |
| 58 | +# Boolean value ``True`` to the ``shorelines`` parameter. The ``shorelines`` |
| 59 | +# parameter has other options for finer control, but setting it to ``True`` |
| 60 | +# uses the default values. |
59 | 61 |
|
60 | 62 | fig.coast(region=[-69, -68, 43.75, 44.75], shorelines=True)
|
61 | 63 |
|
|
74 | 76 | #
|
75 | 77 | # When plotting colors in PyGMT, there are multiple
|
76 | 78 | # :gmt-docs:`color codes <gmtcolors.html>`, that can be used. This includes
|
77 |
| -# standard GMT color names (like ``skyblue``), R/G/B levels (like ``0/0/255``), |
78 |
| -# a hex value (like ``#333333``), or a graylevel (like ``50``). For this |
79 |
| -# example, GMT color names are used. |
| 79 | +# standard GMT color names (like ``"skyblue"``), R/G/B levels (like |
| 80 | +# ``"0/0/255"``), a hex value (like ``"#333333"``), or a gray level (like |
| 81 | +# ``"gray50"``). For this example, GMT color names are used. |
80 | 82 |
|
81 | 83 | fig = pygmt.Figure()
|
82 | 84 | fig.coast(
|
|
102 | 104 | # projections are explained in the :doc:`projection </projections/index>`
|
103 | 105 | # gallery. For this example, the Mercator projection is set using ``"M"``.
|
104 | 106 | # The width of the figure will be 10 centimeters, as set by ``"10c"``.
|
105 |
| -# The map size can also be set in inches using "i" (e.g. a 5 inch wide |
| 107 | +# The map size can also be set in inches using "i" (e.g. a 5-inch wide |
106 | 108 | # Mercator projection would use ``"M5i"``).
|
107 | 109 |
|
108 | 110 | fig = pygmt.Figure()
|
|
0 commit comments