Text may be written to a sphere using the routine sphtext.
For the examples below:
The background is set to some value by a statement like:
erase, 60
The sphere is initialized by a statement like:
sphinit, long=-30, lat=40, rad=1, fill=40, pa=30
At some point you may want to better understand how the sph* routines handle clipping and hidden lines.
Write text on a sphere. sphtext, text, rad, lng1, lng2, lat1, lat2 text = text string to write. in rad = radius of sphere. in lng1, lng2 = longitude range of text. in lat1, lat2 = latitude range of text. in Keywords: ANG=A text angle (deg CCW). COLOR=c text color. LINESTYLE=s text linestyle. /BACK plot text on back of sphere.There are several important points to note when using sphtext:
window, xs=300, ys=300
!p.position=[0,0,1,1]
set_isoxy, -1.1, 1.1, -1.1, 1.1
erase, 80
sphinit, long=-30, lat=40, rad=1, fill=140, pa=30
for lat=-80,80,10 do $
sphtext,'This is a text string',1,-90,20,lat,lat+8
window, xs=300, ys=300
!p.position=[0,0,1,1]
set_isoxy, -1.1, 1.1, -1.1, 1.1
erase, 80
sphinit, long=-30, lat=40, rad=1, fill=140, pa=30
for lng=-80,80,10 do $
sphtext,'This is a text string',1,lng,lng+8,-20,80,ang=90
sphinit, long=-30, lat=20, rad=1, fill=140, pa=30 sphlat,0,1 & sphlat,0,1,/hidd sphtext,'The front of the sphere',1,-90,0,0,10 sphtext,'The back of the sphere',1,-90+180,0+180,0,10,/back
Window setup:
window, xs=300, ys=300 !p.position=[0,0,1,1] set_isoxy, -1.1, 1.1, -1.1, 1.1 loadct, 4 erase, 80Define radial point:
azr = angle of radial point from line of sight. par = position angle of radial point. step = text angle step size. azr = 30 ; All these angles are in degrees here. par = 60 ; Some may be converted to radians below. step = 20Text angles:
s = makex(0,360-step,step) ; Radial angles. n = n_elements(s) ; Count. polrec, 1, s, x, y, /deg ; Correct for recpol, x, y*cos(azr/!radeg), r, sf, /deg ; foreshortening.Find sphere center points:
rb2ll, 0, 0, azr/!radeg, 90-s, lng, latErase inside sphere:
sphinit, fill=140, rad=1Write text string:
for i=0, n-1 do begin &$ sphinit, long=-lng(i), lat=lat(i), pa=sf(i)+90+par &$ sphtext, 'Text angle = '+string(s(i),form='(I3.3)'), $ 1,20,70,-3,3 &$ endfor
sphinit, fill=140, rad=1, lat=30, long=-30, pa=-30
da = 360./79
n = 0
for lat= -80, 80, 5 do $
for lng= 0., 359, da do begin $
sphtext, strtrim(n,2), 1, lng,lng+3, lat, lat+3 &$
n = (n+1) mod 10 &$
endfor