One of the most important things that I have picked up over the years is learning how to read and understand the man pages of the GMT commands. This is something that I wish all GMT tutorial would start with, but always seem to be left out. So I will start off with the first couple lines of the GMT command psxy. To pull up the man page in GMT5 type:
man gmt psxy
The first catagory of the file, NAME, describes what the command does:
psxy - Plot lines, polygons, and symbols on maps
The second category of the file, SYNOPSIS, describes the required and optional flags required for the command to function properly:
psxy files -Jparameters -Rwest/east/south/north[r] [-A[m|p]] [-B[p|s]parameters] [-Ccptfile] [-Ddx/dy] …
The description for all of these flags are found in the DESCRIPTION section of the man page. Something that most people, myself included, don’t realize is that if the flag is surrounded in square brackets ( [ ] ) it is not required. For example, the only thing actually required for the psxy function to function properly is the input file, -J, and -R flags. All of the other flags are optional and will be chosen as default values. This means that the -A flag can be used without adding an m or a p because they are enclosed in brackets. For example, if you read the description of the -A flag, usually one or the other is chosen as default, but the psxy command will run with -Am, -Ap, or just -A.
To scroll up and down the man page you can use u to page up and d to page down. The arrow keys will move you up down one line at a time. To exit the man page menu just press q. Once you get all the way to the bottom of the man page there are usually some examples:
To plot the xyz values in the file quakes.xyzm as circles with size given by the magnitude in the 4th column and color based on the depth in the third using the color palette cpt on a linear map, use
psxy quakes.xyzm -R0/1000/0/1000 -JX6i -Sc -Ccpt -B200 > map.p
Special Commands: pstext
Some parts of the man file are not quite descriptive enough. One command that took me a long time to figure out was the pstext command. The man page is not super helpful on the description of the text file. I use a nifty trick to input the text file. Below is an example of a command I would use to print text on to a x-y file:
gmt pstext -R0/10/0/10 -JX6i -O -K -G255/255/255 -: << EOF >> outFile.ps
0.00 1.00 12 0 1 BC TEST
EOF
Where 0.00 is the x location and 1.00 is the y location. The 12 is the size of the text in points, i.e. 12pt font. The 0 is the angle at which the text is going to show up on the plot. For example if this number is 30 degrees the font will be tilted at 30 degrees from north. The 1 is the font code, to learn more check the gmtdefaults man page by typing "man gmt gmtdefaults”. The BC is a code that tells GMT what location of the text that will be located at the x and y location. If you imagine a rectangle is drawn around the text, the codes place the box in the following locations for the given codes:
BC = Bottom Center
BR = Bottom Right
BL = Bottom Left
TC = Top Center
TR = Top Right
TL = Top Left
MC = Middle Center
MR = Middle Right
ML = Middle Left