One is often required to make special maps that shows the distribution of certain features but one would prefer to use a custom symbol instead of the built-in circles, squares, triangles, etc. in the GMT plotting programs psxy and psxyz . Here we demonstrate one approach that allows for a fair bit of flexibility in designing one’s own symbols. The following recipe is used when designing a new symbol. (1) Use psbasemap (or engineering paper!) to set up an empty grid that goes from -0.5 to +0.5 in both x and y. Use ruler and compass to draw your new symbol using straight lines and arcs of circles. This is how your symbol will look when a size of 1 inch is chosen. Figure 6.20 illustrates a new symbol we will call volcano.
(2) After designing the symbol we will encode it using a simple set of rules. In our case we describe our volcano using no more than 4 possible constructs:
x0 y0 r
C [ -Gfill ] [ -W
x0y0 M [ -Gfill ] [ -Wpen ] Startnew element at x0, y0
x1y1 D Draw straight line from current point to x1, y1
x0y0r
C [ -Gfill ] [ -Wpen ] Drawsingle circle of radius r around x0, y0 in steps of
o
x0y0r
A Drawarc segment of radius r from angle
to
every
o
The optional -G and -–W can be used to hardwire the color fill and pen for segments. By default the segments are painted based on the values of the command line settings.
Manually applying these rules to our symbol results in a definition file volcano.def:
# @(#)volcano.def 1.1 12/28/98 # # Segment info file for volcano symbol # These instructions are intended for make_symbol # which will generate an awk-script that creates # multiple-segment output describing the desired # symbol at the chosen size. The symbol will be # painted drawn given the -G -L -W options on the # psxy command line. # -0.5 -0.5 M -0.2 0 D -0.1 0.173205081 0.2 240 300 2 A 0 0 D 0.3 -0.5 D -0.05 0.15 0.1 5 C 0.15 0.3 0.075 5 C 0.325 0.4 0.05 10 C 0.45 0.45 0.025 10 C
The values refer to positions and dimensions illustrated in Figure 6.20 above. (3) Given a proper definition file we use the supplied $AWK -script make_symbol to create a custom $AWK -script that will read locations and sizes of the desired symbols and replace them with line-drawings like the one in the figure but translated and scaled accordingly. The output is a multi-segment file (see Appendix B) which may be plotted with psxy or psxyz .
We are now ready to give it a try. Based on the hotspot locations in the file hotspots.d (with a 3rd column giving the desired symbol sizes in inches) we lay down a world map and overlay red volcano symbols using our custom-built $AWK -script volcano.awk and psxy . Note that you must first transform the coordinates using mapproject prior to running the $AWK -script. Without further discussion we also make a definition for a multi- colored bulls-eye symbol:
# @(#)bullseye.def 1.2 02/01/99 # # Segment info file for bullseye symbol # These instructions are intended for make_symbol # which will generate an awk-script that creates # multiple-segment output describing the desired # symbol at the chosen size. The symbol will be # painted drawn given the -G -W options for each # segment. # 0 -0.7 M -W0.25p/255/0/0p 0 0.7 D -0.7 0 M -W0.25p/255/0/0p 0.7 0 D 0 0 0.45 5 C -Gp0/12 0 0 0.45 5 C -W0.25p 0 0 0.35 5 C -G255/255/0 -W0.25p 0 0 0.25 5 C -Gp0/9 0 0 0.25 5 C -W0.25p 0 0 0.15 5 C -G255/255/0 -W0.25p 0 0 0.05 5 C -G255 -W0.25p EOF
Here is our final map script:
#!/bin/csh # GMT EXAMPLE 20 # # @(#)job20.csh 1.15 02/05/99 # # Purpose: Extend GMT to plot custom symbols # GMT progs: pscoast, psxy, mapproject # Unix progs: rm, $AWK # # Make volcano- and bullseye-symbol $AWK-scripts using # make_symbol on the definition files volcano.def and # bullseye.def $AWK -f make_symbol < volcano.def >! volcano.awk $AWK -f make_symbol < bullseye.def >! bullseye.awk # Plot a world-map with volcano symbols of different sizes # on top given locations and sizes in hotspots.d cat << EOF >! hotspots.d 55.5 -21.0 0.25 63.0 -49.0 0.25 -12.0 -37.0 0.25 -28.5 29.34 0.25 48.4 -53.4 0.25 155.5 -40.4 0.25 -155.5 19.6 0.5 -138.1 -50.9 0.25 -153.5 -21.0 0.25 -116.7 -26.3 0.25 -16.5 64.4 0.25 EOF pscoast -R0/360/-90/90 -JR180/9i -B60/30:."HotSpot Islands and Cities": -G0/150/0 -S200/200/255 \ -Dc -A5000 -K -U"Example 20 in Cookbook" >! example_20.ps mapproject -R0/360/-90/90 -JR -Di hotspots.d | $AWK -f volcano.awk | psxy -R0/9/0/9 -Jx1i -O -K \ -M -W0.25p -G255/0/0 -L >> example_20.ps # Overlay a few bullseyes at NY, Cairo, and Perth cat << EOF >! cities.d 286 40.45 0.8 31.15 30.03 0.8 115.49 -31.58 0.8 EOF mapproject -R0/360/-90/90 -JR -Di cities.d | $AWK -f bullseye.awk | psxy -R0/9/0/9 -Jx -O \ -M >> example_20.ps \rm -f volcano.awk bullseye.awk hotspots.d cities.d
which produces the plot in Figure 6.21.
Given these guidelines you can easily make your own symbols. Symbols with more than one color can be obtained by making several symbol components. E.g., to have yellow smoke coming out of red volcanoes we would make two symbols: one with just the cone and caldera and the other with the bubbles. These would be plotted consecutively using the desired colors. Alternatively, like in bullseye.def, we may specify colors directly for the various segments. Note that the custom symbols, unlike the built-in symbols in GMT, can be used with the built-in patterns (Appendix E). Other approaches are also possible, of course.