WANtaroHP (GMT Simple use)

 












極座標グラフ

GMT command GMT command
fig_polar0.png fig_polar1.png
r の範囲は 0 から 100 まで. r の範囲は 0 から 10 まで.
r 方向グリッド間隔は 20. r 方向グリッド間隔は 1.

半径座標 r が 5 よりも小さい範囲では,r 方向のグリッド線が描かれないことに注意.



扇形の描画 (-Sw および -SW の利用)

'GMT manpages'では,psxyの扇形を描くオプションである-Sw および -SW について,以下のように説明しています.

  • -Sw pie wedge. Start and stop directions (in degrees counter-clockwise from horizontal) for pie slice must be found in columns 3 and 4.
  • -SW Same as -Sw, except azimuths (in degrees east of north) should be given instead of the two directions. The azimuths will be mapped into angles based on the chosen map projection (-Sw leaves the directions unchanged.)

Manpage では「始点方向と終点方向(角度)をデータファイルの3番目と4番目の列に記載する」となっていますが, 始点方向と終点方向は,4番目と5番目の列に置かれるべきです. なぜならば,扇の中心座標と半径が,始点・終点方向の前に定義されるべきだからです. 実際の有効な入力データ並びを以下に示します.

x y Radius StartAngle EndAngle

x , y および Radius は,扇の中心座標および半径を示します. StartAngle および EndAngle は始点と終点の方向を角度で表したものです.

psxyのオプションとして-SWを用いた作図事例を以下に示します.

GMT command
fig_LN_fmt1.png

この記事は,以下のサイトの情報を基に作成しました.

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

有用な情報を提供してくれた上記サイトの作者に,謝意を表します.



minmax の利用

GMT は minmax という機能を有しています. この機能は,各データ列のデータ数,最小値および最大値を検索するものです. 以下に minmax の使用例を,いくつかの awk スクリプトの使用を含めて示します.

入力データ

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

バッチファイル

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

出力

minmax の出力

_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'

中間処理出力

_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'

指定列のデータ数,最小値および最大値

_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'


pic
inserted by FC2 system