draw title options
Jennifer Adams
jma at COLA.IGES.ORG
Mon Oct 15 14:54:11 EDT 2007
I use this script instead of 'draw title'.
* title.gs
*
* This is an alternative to the 'draw title' command in GrADS.
* Font characteristics are controlled by five script variables:
* height, width, color, thickness, and font number.
* The sole argument is a string of any length which may
* contain backslashes ("\") to indicate carriage returns.
* Written by Jennifer M. Adams, January 2007
*
function title (arg)
* Set the text characteristics
height=0.20
width=0.18
color=1
thickness=1
fnum=0
* Check for backslashes
nbreaks=0
len=math_strlen(arg)
i=1
while (i<=len)
char=substr(arg,i,1)
if (char = '\')
nbreaks=nbreaks+1
break.nbreaks = i
endif
i=i+1
endwhile
* Figure out where the title will go
'q gxinfo'
xlims=sublin(result,3)
ylims=sublin(result,4)
ytop=subwrd(ylims,6)
xleft=subwrd(xlims,4)
xright=subwrd(xlims,6)
xmid=xleft+(xright-xleft)/2
* Set up the string characteristics
'set string 'color' bc 'thickness
'set strsiz 'width' 'height
* Draw the title
if (nbreaks)
arg.1 = substr(arg,1,break.1-1)
if (nbreaks=1)
arg.2 = substr(arg,break.1+1,len-break.1);* two lines
nargs=2
else
i=2
while (i<=nbreaks)
s=i-1
start = break.s
start = start+1
e=i
end = break.e
length = end-start
arg.i = substr(arg,start,length)
i=i+1
endwhile
start = break.nbreaks
start = start+1
length = len-start+1
nargs=nbreaks+1
arg.nargs = substr(arg,start,length)
endif
i=1
while (i<=nargs)
'draw string 'xmid' 'ytop+(height)+((nargs-i)*(1.5*height))'
`'fnum''arg.i
i=i+1
endwhile
else
'draw string 'xmid' 'ytop+height' `'fnum''arg
endif
More information about the gradsusr
mailing list