WANtaroHP (GMT: Simple use)

toJA

Outline of this page

Following items are shown in this page.

Contents


Frame for Semi-Log graph and Log-Log graph

GMT command GMT command
fig_LN_fmt1.png fig_LN_fmt2.png


Plot on Semi-Log praph

GMT command
fig_LN_plot.png


Use of 2-axes

GMT command
fig_2axes.png


Error bar

GMT command GMT command
fig_ebar1.png fig_ebar2.png


Plot size and plot color

GMT command GMT command GMT command
fig_psize.png fig_Pcol.png fig_Pcolsize.png


Polar coordinates

GMT command GMT command
fig_polar0.png fig_polar1.png
Range of r is from 0 to 100. Range of r is from 0 to 10.
Grid interval in r-direction is 20. Grid interval in r-direction is 1.

It is necessary to note that thr grid in radius-direction is not drawn at the area of radius being less than 5.



Draw sectors (use of -Sw or -SW for psxy)

The explanations for -Sw and -SW option to draw sectors (pie wedge plots) for psxy in the 'GMT manpages' are shown below:

Although Manpage say that start and stop directions must be found in colomns 3 and 4, start and stop directions shall be put in columns 4 and 5. Because center coordinates and radius of the sector shall be defined before start and stop directions. Actual inputted data row is shown below:

x y Radius StartAngle EndAngle

x , y and Radius mean the center coordinates and radius of the sector. StartAngle and EndAngle mean the start and end directions in degrees.

Sample drawings using -SW option for psxy are shown below.

GMT command
fig_LN_fmt1.png

This article was written using information by following site.

http://xenocoder.wordpress.com/2008/08/01/creating-pie-wedge-plots-in-gmt/

I say thank you for the webmaster of above site.



Use of minmax

GMT has the function of minmax. This function can search number of data, minimum value and maximum value of each coloum in data set. A sample use of minmax is shown below including some awk scripts.

Input data

test1.txttest2.txttest3.txt
0.1
0.2
0.3
0.4
0.5
1 10
2 20
3 30
4 40
5 50
1 10 100 1000 10000
2 20 200 2000 20000
3 30 300 3000 30000
4 40 400 4000 40000
5 50 500 5000 50000

Batch file

Sample batch file for use of minmax
rem Use of minmax
minmax test1.txt > _temp0.txt
minmax test2.txt >> _temp0.txt
minmax test3.txt >> _temp0.txt

rem Temporary treatment
gawk "NR==1{str0=$0;sub(/(: N =)/,\"\",str0);gsub(/</,\"\",str0);gsub(/>/,\"\",str0);print str0}" _temp0.txt > _temp1.txt
gawk "NR==2{str0=$0;sub(/(: N =)/,\"\",str0);gsub(/</,\"\",str0);gsub(/>/,\"\",str0);print str0}" _temp0.txt >> _temp1.txt
gawk "NR==3{str0=$0;sub(/(: N =)/,\"\",str0);gsub(/</,\"\",str0);gsub(/>/,\"\",str0);print str0}" _temp0.txt >> _temp1.txt

rem Get number of data, min.value and max.value
gawk "NR==1{nd=$2;split($3,a,\"/\");print nd,a[1],a[2]}" _temp1.txt > _temp2.txt
gawk "NR==2{nd=$2;split($4,a,\"/\");print nd,a[1],a[2]}" _temp1.txt >> _temp2.txt
gawk "NR==3{nd=$2;split($7,a,\"/\");print nd,a[1],a[2]}" _temp1.txt >> _temp2.txt

Output

Ooutput by minmax of GMT

_temp0.txt
test1.txt: N = 5 <0.1/0.5>
test2.txt: N = 5 <1/5> <10/50>
test3.txt: N = 5 <1/5> <10/50> <100/500> <1000/5000> <10000/50000>

note) 'tab' is changed to blank (space) in above file '_temp0.txt'

Ooutput by temporary treatment

_temp1.txt
test1.txt 5 0.1/0.5
test2.txt 5 1/5 10/50
test3.txt 5 1/5 10/50 100/500 1000/5000 10000/50000

note) 'tab' is changed to blank (space) in above files '_temp1.txt'

Number of data, minimum value and maximum value for specified column

_temp2.txt
5 0.1 0.5      | for column 1 of file 'test1.txt'
5 10 50        | for column 2 of file 'test2.txt'
5 10000 50000  | for column 5 of file 'test3.txt'

toJA
inserted by FC2 system