#!/bin/csh ######## Example B2 ### Step 1: Remove the exiting file named tmp.ps, if any. Don't # be alarmed by the warning message "tmp.ps: No such file or directory" /bin/rm tmp.ps ### Step 2: make the plot using blue triangles awk '{print $2, $3}' neq.data | \ psxy -R1960/2000/0/30 -JX5/3 -St0.1 -G0/0/255 \ -Ba10f5/a5f1 -P -K -X1.5 -Y5 >tmp.ps ### Step 3: Plot the data again using a red line awk '{print $2, $3}' neq.data | \ psxy -R -JX -W3/255/0/0 -O -K >>tmp.ps ### Step 4: Add some texts pstext -R -JX -O -N <>tmp.ps 1980 32 15 0 5 MC Number of Large Earthquakes per Year 1980 -5 15 0 5 MC Time (year) 1955 15 15 90 5 MC Number of events 1965 25 13 0 0 ML Minimum Magnitude: 7.0 END ##################### End of useful codes. ############################## #~~~~~~~~~~~~~~~~~~~~~~~~~~ Detailed Explanations ~~~~~~~~~~~~~~~~~~~~~~~ ############################# Step 1: # rm tmp.ps # Your output will be tmp.ps. This step removes existing file # with the same name in the working directory. # If you are asked "rm tmp.ps", answer "y". ############################# Step 2: ### make the plot using blue triangles #awk '{print $2, $3}' neq.data | \ #psxy -R1960/2000/0/30 -JX5/3 -St0.1 -G0/0/255 \ #-Ba10f5/a5f1 -P -K -X1.5 -Y5 >tmp.ps ### Important: the paramters (e.g. -R, -J, -P, -K, -S, -X, -Y above) # of all GMT commands have no order, meaning that you can # put them wherever you want, as long as they are after # the GMT command (psxy in this case) and before # the ">" sign. ### psxy is a GMT command to make x-y plots ### -R is a parameter of psxy, defining the region to be ploted. # The format for -R is X_min/X_max/Y_min/Y_max ### -J is a parameter for psxy # X after -J means you want to use linear projection which # is the most commonly used projection for x-y plotting. # The "5" after -JX means you want the width of the # map be 5 inches; and the "3" after -JX5/ means that the # height of the plot will be 3 inches. ### -B defines the frame (Boundary) of your plot. a10 means you want # an annotation every 10 units at the horizontal direction; # The "f5" after -Ba10 means you want a "tick" every 5 units. # "a5f1" after -Ba10f5/ is for the vertical axis. ### -P means you want to use Portrait mode instead of landscape mode. # If you want to use landscape mode, remove the -P. ### -S is for selecting symbols. -St means you want to plot triangles # (-Ss is for squares, -Sc for circles, -Sa for star, .... # Type man psxy for more symbols). # The "0.1" after -St defines the size of the triangles in inch. ### -G is a paramter for psxy used to fill the symbols with # colors. The 3 numbers following -G give the red/green/blue level # in the mixing. Each of the 3 colors range from 0 to 255. ### -K means that you will have more output below. ### -X1.5 means that you want your plot shifted by 1.5 inch to the right # from the lowerleft corner of the paper ### -Y5 means that you want your plot shifted up by 5 inches # from the lowerleft corner of the paper ### > is a 're-direction' sign. It means that you want the output # file be written to the file tmp.ps. Without ">", the # output will be on the screen (and rolling forever...) ### tmp.ps is your output graphic file (in Postscript format). ##################################### Step 3: #Plot the data again using a red line #awk '{print $2, $3}' neq.data | \ #psxy -R -JX -W3/255/0/0 -O -K >>tmp.ps ### awk, psxy, -R, -JX, and -K have the same meaning as in Step 2. # You don't have to add numbers after -R, -JX etc, because this # time psxy remembers the numbers entered in Step 2. ### -O means you want the output created by this step to be # Overplotted on top of the output from the previous Steps. ### -W3/255/0/0 means you want the thickness of the pen be 3, # and the color be full red (255), no green (0) and no blue (0) ### >> tmp.ps means you want to write the output file to tmp.ps, which # was first created in Step 2. ################################# Step 4: #pstext -R -JX -O -N <>tmp.ps #1980 32 15 0 5 MC Number of Large Earthquakes per Year #1980 -5 15 0 5 MC Time (year) #1955 15 15 90 5 MC Number of events #1965 25 13 0 0 ML Minimum Magnitude: 7.0 #END ### pstext is a common GMT command to write texts. ### -R, -JX, have the same meaning as in Step 2. # Note that you should not put a "-K" here because Step 3 will # be the last GMT command and no future graphic file to add. ### -O means you want the output created by this step to be # Overplotted on top of the output from the previous Steps. ### -N means that you want the texts be plotted even if they are # outside the region given by -R ### <> tmp.ps means you want to write the output file to tmp.ps ### There are 6 numbers for pstext. # The first one (e.g., 1980 in the first line), gives the x-coordinate of # the texts; # The 2nd one (32), gives the y-coordinates of the plot. # The 3rd one (15) gives the size of the texts (15 is normal). # The 4th one (0) gives the angle of the texts (90 will be vertical) # The 5th one (5) gives the font number (there are 22 or so fonts). # The 6th one (MC) means you want the texts be plotted at the Mid-Center # of the location given by the first 2 numbers. ps2jpeg150 tmp.ps