```! Preliminary setups.

alias black setrgb 0 0 0
alias white setrgb 1 1 1
com /usr/local/lib/plotl/72colortable.plot

! Load up an array.  This is typically done
! with ARRAY, ARRAYX, and ARRAYY, but I'll
! just generate an array internally

arrayxscale 73 0 5
arrayyscale 37 0 5
z={ x dtr 1 mul cos y dtr 1 mul sin mul }
doarraymath

! Move origin, set dimensions (note that zdim is zero and that
! xdim controls the radius of the sphere), and define rotation.

origin 3 3
zdim 0
xdim 3
ydim 3
3drot -45 0 -30

! Choose spherical projection.  In the spherical projection, X becomes
! theta, and Y becomes phi, in the usual sense.  Hence, X is expected
! to range from 0 to 360 (or -180 to 180) or some part thereof.  And
! Y is expected from 0 to 180 (North colatitude) or some part thereof.

spherical

! Turn off grid lines, we'll do them manually later.

noylines
noxlines

! Draw the colored surface.

solid

! Draw the cooridinate grid.

white
xscale
yscale
zscale

! First the longitude lines every 30 degrees.

\$loops=12
loop \$loops
3dmove {\$loop 1 sub 360 \$loops div mul} 0 0
3ddraw {\$loop 1 sub 360 \$loops div mul} 180 0 60
endloop

! Now the longitude lines every 15 degrees, but stop short
! of the poles to avoid clutter.

\$loops=24
loop \$loops
3dmove {\$loop 1 sub 360 \$loops div mul} 15 0
3ddraw {\$loop 1 sub 360 \$loops div mul} 165 0 60
endloop

! Now the latitude grid, every 15 degrees.

\$loops=12
loop \$loops
3dmove 0   {\$loop 1 sub 180 \$loops div mul} 0
3ddraw 120 {\$loop 1 sub 180 \$loops div mul} 0 60
3ddraw 240 {\$loop 1 sub 180 \$loops div mul} 0 60
3ddraw 360 {\$loop 1 sub 180 \$loops div mul} 0 60
endloop

! Draw the world map using the now-defined projection.

black
data /usr/local/lib/plotl/world1.dat
skip 2
xcol 1
ycol 2
pencolumn 3
c3={1 c3 sub}
z={0}
y={90 y sub}