In many situations we need to annotate plots or maps with text strings; in GMT this is done using pstext. Apart from the common switches, there are 7 options that are particularly useful (Table 2.4).
The input data to pstext is expected to contain the following
x y size angle fontno justify text
The size argument is the font size in points, the angle is the angle (measured counterclockwise) between the text's baseline and the horizontal, justify indicates which point on the text-string should correspond to the given x, y location, and text is the text string or sentence to plot. Figure 2.2 illustrates these concepts and shows the relevant two-character codes used for justification.
The text string can be one or several words and may include octal codes for special characters and escape-sequences used to select subscripts or symbol fonts. The escape sequences that are recognized by GMT are given in Table 2.5.
Note that these escape sequences (as well as octal codes) can be used anywhere in GMT including in arguments to the -B option. A chart of octal codes can be found in Appendix F in the GMT technical reference book. For accented European characters you must set CHAR_ENCODING to ISOLatin1 in your .gmtdefaults4 file.
We will demonstrate pstext with the following script:
cat << EOF | pstext -R0/7/0/5 -Jx1i -P -B1g1 -G255/128/0 | ghostview - 1 1 30 0 4 BL It's P@al, not Pal! 1 2 30 0 4 BL Try @%33%ZapfChancery@%% today 1 3 30 0 4 BL @~D@~g@-b@- = 2@~pr@~G@~D@~h. 1 4 30 0 4 BL University of Hawaii at M@!a\225noa EOF
Here we have used the ``here document'' notation in UNIX: The EOF will treat the following lines as the input file until it detects the word EOF. We pipe the PostScript directly through ghostview (the - tells ghostview that piping is happening).