GMT5
GMT4 and GMT5
http://gmt.soest.hawaii.edu/doc/5.4.3/gmt.conf.html
为了 保证script可以运行,可以通过设置gmt.conf文件中的GMT_COMPATIBILITY的值等于4,可以允许GMT容忍和处理过时的程序语法错误syntax,如果不是运行兼容模式,任何过时的语法将被认为是error。通过注意过时语法的提醒heed the warnings of obsolete syntax来correct脚本。改完之后可以把GMT兼容模式关闭。
ANOT_FONT tick mark annotations fonts #35 fonts
#ANOT_FONT_SIZE fonts size in points for map annotations
ANOT_FONT: Font used for tick mark annotations etc [Helvetica]. Specify
either the font number or the font name. The 35 available fonts
are:
0 Helvetica
1 Helvetica-Bold
2 Helvetica-Oblique
3 Helvetica-BoldOblique
4 Times-Roman
5 Times-Bold
6 Times-Italic
7 Times-BoldItalic
8 Courier
9 Courier-Bold
10 Courier-Oblique
11 Courier-BoldOblique
12 Symbol
13 AvantGarde-Book
14 AvantGarde-BookOblique
15 AvantGarde-Demi
16 AvantGarde-DemiOblique
17 Bookman-Demi
18 Bookman-DemiItalic
19 Bookman-Light
20 Bookman-LightItalic
21 Helvetica-Narrow
22 Helvetica-Narrow-Bold
23 Helvetica-Narrow-Oblique
24 Helvetica-Narrow-BoldOblique
25 NewCenturySchlbk-Roman
26 NewCenturySchlbk-Italic
27 NewCenturySchlbk-Bold
28 NewCenturySchlbk-BoldItalic
29 Palatino-Roman
30 Palatino-Italic
31 Palatino-Bold
32 Palatino-BoldItalic
33 ZapfChancery-MediumItalic
34 ZapfDingbats
GMT5中没有这两个,都被FONT_ANNOT_PRIMARY,FONT_ANNOT_SECONDARY,FONT_ANNOT代替了。
example:
system("gmtset BASEMAP_TYPE plain PLOT_DEGREE_FORMAT DF MEASURE_UNIT inch
LABEL_FONT_SIZE $fsize2 ANOT_FONT_SIZE $fsize2 HEADER_FONT $ftype ANOT_FONT $ftype
LABEL_FONT $ftype HEADER_FONT_SIZE $fsize1"); #gmt4
#convert to gmt5,BASEMAP_TYPE was replaced by "MAP_FRAME_TYPE",PLOT_DEGREE_FORMAT by
#"FORMAT_GEO_MAP" MEASURE_UNIT by "PROJ_LENGTH_UNIT", LABEL_FONT_SIZE and LABEL_FONT repalce by
#"FONT_LABEL",[16p,0,black], the same as FONT_TITLE
system("gmt set MAP_FRAME_TYPE plain FORMAT_GEO_MAP DF PROJ_LENGTH_UNIT inch
FONT_ANNOT $fsize2,$ftype,black FONT_LABEL $fsize2,$ftype,black
FONT_TITLE $fsize1,$ftype,black");
#gmt4
$bscale ="-B$tstep:\"Time (s)\":/$astep:\"Moment rate (dyne.cm/sec):\"WS";
`psxy $bounds $proj $bscale $cinfo $origin -U$title -P $data>$psfile`;
#gmt5
$bscale ="-Bxa$tstep+l'Time (s)' -Bya$astep+l'Moment rate (dyne.cm/sec)' -BWS";#-B可以多次使用
`gmt psxy $bounds $proj $bscale $cinfo $origin -U$title -P $data>$psfile`;
the new PSTEXT textfile format.
Here is a working example for your reference:
In GMT4+, the format of textfile is
(X-long Y-Lat fontsize angle fontno justify TEXT)
e.g 110.00 12.00 12 0 1 BR South China Sea (separated by a TAB space)
In GMT5, the format of the textfile has been changed to
X-Long Y-Lat font(size,font,color) angle Justify TEXT
e.g 110.00 12.00 12,1,red 0 BR South China Sea (separated by a TAB space)
or 110.00 12.00 12,Helvetica,red 0 BR South China Sea
106.000 10.200 20,1,red -30 TL Mekong (u can use the standard 39 font number, OR, the full font name, e.g. Courier=8; Times-Bold=5; etc)
... (You can put multiple lines here)
BUT, in order to use these attributes from the textfile, and make it works, you HAVE TO put the -F+f+a+j Arguments in your PSTEXT command.
For example: gmt pstext FigLabels.txt -F+f+a+j -R%range% -V -J%proj%%scale% -K -O >>ps (windows)
OR gmt pstext FigLabels.txt -F+f+a+j -R$range -V -J$proj$scale -K -O >>$ps (UNIX/MAC)
Without any value to "+f" means no font info is given, it will get the data from the textfile 3rd column (after X and Y), the 3rd column is actually has 3 information (fontsize,font,color), separated by ",", for example "12,Time-Bold,red" or "12,5,red". This is NEW for GMT5. same thing to the "+a" (angle) and "+j", if you do not assign any value, it will read it from the textfile table. The sequence of +f, +a, +j must be the same order in the textfile table.
PSTEXT
open(GMT,"|pstext -N $Jscale -R0/$axis_x/0/$y_delay -X$xshift -O -K>>$output");GMT4
print GMT "$x $y 11 0 0 6 $sta\n";
open(GMT,"|gmt pstext -N -F+f+a+j $Jscale -R0/$axis_x/0/$y_delay -X$xshift -O -K>>$output");GMT5
print GMT "$x $y 11,0,black 0 6 $sta\n";一定要有-F+f+a+j,f fonts,[size,fontno,color],a angle,j justify
PSXY
open(GMT,"|psxy $Rscale $Jscale -W2t10:10 -N -K -O>>$output");Gmt4
open(GMT,"|gmt psxy $Rscale $Jscale -W0.5,black,- -N -K -O>>$output");gmt5,-W的区别,gmt涉及到字体都是
#改成,[size,color,type],size后面可以有单位,p是points,c是cm,i是inch