| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 
 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>2.2 Plotting text strings</TITLE>
<META NAME="description" CONTENT="2.2 Plotting text strings">
<META NAME="keywords" CONTENT="tutorial">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="tutorial.css">
<LINK REL="next" HREF="node57.html">
<LINK REL="previous" HREF="node50.html">
<LINK REL="up" HREF="node49.html">
<LINK REL="next" HREF="node57.html">
</HEAD>
<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html1211"
  HREF="node57.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A> 
<A NAME="tex2html1205"
  HREF="node49.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A> 
<A NAME="tex2html1199"
  HREF="node55.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A> 
<A NAME="tex2html1207"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A> 
<A NAME="tex2html1209"
  HREF="node79.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1212"
  HREF="node57.html">2.3 Exercises</A>
<B> Up:</B> <A NAME="tex2html1206"
  HREF="node49.html">2. SESSION TWO</A>
<B> Previous:</B> <A NAME="tex2html1200"
  HREF="node55.html">2.1.5 More exercises</A>
   <B>  <A NAME="tex2html1208"
  HREF="node1.html">Contents</A></B> 
   <B>  <A NAME="tex2html1210"
  HREF="node79.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00420000000000000000">
2.2 Plotting text strings</A>
</H1>
<P>
In many situations we need to annotate plots or maps with text strings;
in <A NAME="tex2html187"
  HREF="http://www.soest.hawaii.edu/gmt"><B>GMT</B></A> this is done using <A NAME="tex2html188"
  HREF="../pstext.html"><I><B>pstext</B></I></A><A NAME="2772"></A>.  Apart from the common
switches, there are 7 options that are particularly useful (Table <A HREF="node56.html#tbl:pstext">2.4</A>).
<P>
<BR><P></P>
<DIV ALIGN="CENTER"><A NAME="1731"></A>
<TABLE>
<CAPTION><STRONG>Table 2.4:</STRONG>
Some of the most frequently used options in <A NAME="tex2html178"
  HREF="../pstext.html"><I><B>pstext</B></I></A><A NAME="2790"></A></CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1">
<TR><TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1">
<I>Option</I></FONT></TD>
<TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1"> <I>Purpose</I></FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
</FONT><FONT SIZE="-1"><B>-C</B></FONT><FONT SIZE="-1"><I>dx</I>/</FONT><FONT SIZE="-1"><I>dy</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Spacing between text and the text box (see </FONT><FONT SIZE="-1"><B>-W</B>) </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-D</B></FONT><FONT SIZE="-1"><I>dx</I>/</FONT><FONT SIZE="-1"><I>dy</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Offsets the projected location of the strings </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-G</B></FONT><FONT SIZE="-1"><I>fill</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Sets the color of the text </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-L</B> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Lists the font ids and exits </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-N</B> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Deactivates clipping at the borders </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-S</B></FONT><FONT SIZE="-1"><I>pen</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Selects outline font and sets pen attributes </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
</FONT><FONT SIZE="-1"><B>-W</B>[</FONT><FONT SIZE="-1"><I>fill</I>][</FONT><FONT SIZE="-1"><B>o</B>[</FONT><FONT SIZE="-1"><I>pen</I>]] </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Paint the text box; draw the outline if </FONT><FONT SIZE="-1"><B>o</B> is appended (also see </FONT><FONT SIZE="-1"><B>-C</B>) </FONT></TD>
</TR>
</TABLE><FONT SIZE="-1">
<A NAME="tbl:pstext"></A></FONT></DIV></TD></TR>
</TABLE>
</DIV><P></P>
<BR> 
<P>
<P></P>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_pstext_clearance"></A><A NAME="2799"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 2.1:</STRONG>
Relationship between the text box and the extra clearance</CAPTION>
<TR><TD><IMG
 WIDTH="204" HEIGHT="82" BORDER="0"
 SRC="img49.gif"
 ALT="\begin{figure}\centering\epsfig{figure=eps/GMT_pstext_clearance.eps}\end{figure}"></TD></TR>
</TABLE>
</DIV><P></P>
<P>
The input data to <A NAME="tex2html189"
  HREF="../pstext.html"><I><B>pstext</B></I></A><A NAME="2804"></A> is expected to contain the following
information: 
<BR><A NAME="1732"></A>
<P>
<I>x   y   size   angle   fontno   justify   text</I> 
<BR>
<P>
The <I>size</I> argument is the font size in points, the <I>angle</I> is the
angle (measured counterclockwise) between the text's baseline and the
horizontal, <I>justify</I> indicates which point on the text-string should
correspond to the given <I>x, y</I> location, and <I>text</I> is the text
string or sentence to plot.  Figure <A HREF="node56.html#fig:GMT_pstext_justify">2.2</A> illustrates these concepts and shows
the relevant two-character codes used for justification.
<A NAME="1098"></A>
<A NAME="1099"></A>
<P>
<P></P>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_pstext_justify"></A><A NAME="2822"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 2.2:</STRONG>
Justification (and corresponding character codes) for text strings</CAPTION>
<TR><TD><IMG
 WIDTH="241" HEIGHT="80" BORDER="0"
 SRC="img50.gif"
 ALT="\begin{figure}\centering\epsfig{figure=eps/GMT_pstext_justify.eps}\end{figure}"></TD></TR>
</TABLE>
</DIV><P></P>
<P>
The text string can be one or several words and may include octal codes for
special characters and escape-sequences used to select subscripts or symbol
fonts.  The following escape sequences are recognized:
<A NAME="1102"></A>
<A NAME="1103"></A>
<A NAME="1104"></A>
<A NAME="1105"></A>
<A NAME="1106"></A>
<A NAME="1107"></A>
<A NAME="1108"></A>
<P>
<BR><P></P>
<DIV ALIGN="CENTER"><A NAME="1120"></A>
<TABLE>
<CAPTION><STRONG>Table 2.5:</STRONG>
<A NAME="tex2html184"
  HREF="http://www.soest.hawaii.edu/gmt"><B>GMT</B></A> text escape sequences</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1">
<TR><TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1">
<I>Code</I></FONT></TD>
<TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1">	<I>Effect</I></FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">  
@~</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">	Turns symbol font on or off </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@%</FONT><FONT SIZE="-1"><I>fontno</I>%	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">	Switches to another font; @%% resets to previous font </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@+	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">	Turns superscript on or off </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@-	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">	Turns subscript on or off </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@#	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">	Turns small caps on or off </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@!	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">	Creates one composite character of the next two characters </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@@	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">	Prints the @ sign itself </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@E @e	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">  Æ æ</FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@O @o	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">  Ø ø</FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">   
@A @a	</FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1">  Å å</FONT></TD>
</TR>
</TABLE><FONT SIZE="-1">
<A NAME="tbl:escape"></A></FONT></DIV></TD></TR>
</TABLE>
</DIV><P></P>
<BR>
<P>
Note that these escape sequences (as well as octal codes) can be
used anywhere in <A NAME="tex2html190"
  HREF="http://www.soest.hawaii.edu/gmt"><B>GMT</B></A> including as arguments to the <B>-B</B> option.
A chart of octal codes can be found in Appendix F in the <A NAME="tex2html191"
  HREF="http://www.soest.hawaii.edu/gmt"><B>GMT</B></A> technical reference book.  For accented European characters you must
set WANT_EURO_FONT to TRUE in your <U>.gmtdefaults</U> file.
<P>
We will demonstrate pstext with the following script:
<P>
<PRE> 
cat << EOF | pstext -R0/7/0/7 -JX7i -P -B1g1 -G255/128/0 | ghostview -
1	1	30	0	4	BL	Its P@al, not Pal!
1	2	30	0	4	BL	Try @%33%ZapfChancery@%% today
1	3	30	0	4	BL	@~D@~g@-b@- = 2@~pr@~G@~D@~h.
1	4	30	0	4	BL	University of Hawaii at M@!a\305noa
EOF
</PRE> 
<P>
<A NAME="1127"></A>
<P>
Here we have used the ``here document'' notation in <I>UNIX</I>: The <IMG
 WIDTH="16" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
 SRC="img8.gif"
 ALT="$<$"><IMG
 WIDTH="16" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
 SRC="img8.gif"
 ALT="$<$"> EOF
will treat the following lines as the input file until it detects the
word EOF.  We pipe the <I>PostScript</I> directly through <I>ghostview</I><A NAME="2839"></A> (the - tells
<I>ghostview</I><A NAME="2844"></A> that piping is happening).
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1211"
  HREF="node57.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A> 
<A NAME="tex2html1205"
  HREF="node49.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A> 
<A NAME="tex2html1199"
  HREF="node55.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A> 
<A NAME="tex2html1207"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A> 
<A NAME="tex2html1209"
  HREF="node79.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html1212"
  HREF="node57.html">2.3 Exercises</A>
<B> Up:</B> <A NAME="tex2html1206"
  HREF="node49.html">2. SESSION TWO</A>
<B> Previous:</B> <A NAME="tex2html1200"
  HREF="node55.html">2.1.5 More exercises</A>
   <B>  <A NAME="tex2html1208"
  HREF="node1.html">Contents</A></B> 
   <B>  <A NAME="tex2html1210"
  HREF="node79.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2001-04-18
</ADDRESS>
</BODY>
</HTML>
 |