Setting the Region

In this tutorial we are going to explain how to define the geographical region of maps. This is done trough the -R parameter . To do so, we will use the simplest way which is when the boundaries are defined by meridians and parallels.

This tutorial covers the following methods:

String of Coordinates

A string of coordinates can be passed to -R, in the form of xmin/xmax/ymin/ymax. This is the standard and most customizable way to specify geographic regions. For example, to make a map that x-range from 85W to 74W and the y-range to 19N to 24N we should use -R-85/-74/19/24

gmt begin region png
   gmt basemap -JM12c -Bxafg -Byafg -R-85/-74/19/24
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/5ab8ab860d0be4c77d481962e422bd37.png

Global Domain keys

If you want to make a global map, then you can use one of the following codes to quickly specify the global domain:

-Rd

  • -Rd: Centered at the Prime meridian (0º). It sets the region to -180/180/-90/90.

    gmt begin region png
       gmt basemap -JN12c -Baf -Rd
       gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
    gmt end show
    
    ../../_images/c3018db8132410e7582610b4ced975f2.png

-Rg

  • -Rg: Centered at the antimeridian (180º). It sets the region to 0/360/-90/90.

    gmt begin region png
       gmt basemap -JN12c -Baf -Rg
       gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
    gmt end show
    
    ../../_images/8d5c170e8a066463205f50a5c130cb9f.png

Codes

ISO Codes

If you want to make a map of a country, then you select its region with the two-character ISO-Code. This indirectly supplies the region by consulting the DCW (Digital Chart of the World) database and derives the bounding region given by the code. For example, to make a map of Cuba we should use -RCU. Note that in this case, the map will have the exact region of the country.

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RCU
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/e3eb556d66e09fdd2c498b1768cbc965.png

DCW Collection

Alternative, to make a map of another named region (continents, oceans, seas, islands, etc.) NOT include in the ISO codes you can use the the three-to-five-character codes of DCW-Collection. For example, to make a map of the Mediterranean Sea we should use -RIHO28:

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RIHO28
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/32afc593882fe8278213c58b6c838da7.png

Many codes

We could use more than one code to get the region that includes all of them. For example, if we wish to see all Italy and the Mediterranean Sea, then we should use -RIHO28,IT

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RIHO28,IT
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/b8698360bbb10f6f08fc07b3c8fbf1ac.png

Modifiers

There are 3 modifiers to sligthy change the region encompassed by the codes that can be used. In the following examples will be used them to modify the exact region of the Mediterranean Sea (-6.0319/36.2093/30.2662/45.7946).

Modifier +R

If you want to extend 1 degree the region in all directions, then add +R1 to the code. This will extend the region to -7.0319/37.2093/29.2662/46.7946.

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RIHO28+R1
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/9cd527d7de54dc59dc281715ab1cfadc.png

Modifier +r

You can use the +r modifier if you instead want the region will be rounded to nearest integer degree. In the following example the region will be extend to -7/37/30/46.

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RIHO28+r1
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/1db761511fa1371a3fa3f01cc3bdc199.png

Modifier +e

Finally, the +e modifier is like +r and expands the final region boundaries to be multiples of increment. However, it ensures that the bounding box extends by at least 0.25 times the increment. In the following example the region will be extend to -7/37/30/47.

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RIHO28+e1
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/ccb60b0756948bd2a4770d91bd2846d0.png

Custom expansion

In the previous examples, the expansion was uniformly in all directions. If you want to expand the region differently in each direction, then you could passed four values (to expands to the west, east, south and north repectively), For example use the modifier +R1/2/3/4 to expand the Mediterranean Sea map.

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RIHO28+R1/2/3/4
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/32471ccabf1ff6170dc5064d911c326e.png

Shrink region

All the above modifiers can be also use to shrink the area. Just use a negative number. For example use the modifier +R-2 to shrink the Mediterranean Sea map by two degrees.

gmt begin region png
   gmt basemap -JM12c -Bxaf -Byaf -RIHO28+R-3
   gmt coast -Glightgray -Swhite -W1/0.5p -N1/0.5p -Clightgray
gmt end show
../../_images/44a989feb7eef11e3362a7bc89d2bac0.png