labeling dates along a trackline
How can I label the dates along a track plot?
Use the TAX_datestring function to get date strings for a subset of the time steps.
! Define a dummy track line, position as a function of time. DEFINE AXIS/T=1-JAN-1980:31-JAN-1985:30/UNIT=days tax LET ypos = 40 *COS(L[GT=tax]/32) LET xpos = 220 - 50 *SIN(L[GT=tax]/22) ! Make the basic track plot GO basemap X=110E:40W Y=20S:50N 20 PLOT/VS/NOLAB/OVER XPOS,YPOS ! Label every 5th date. The labels could be positioned differently, using ! the 3rd argument of the LABEL command to control centering. Or, to put the ! labels a bit above the corresponding point location, add a small amount to ! the y positions, for instance `ypos + 0.04` in the second argument to LABEL. LET tt = t[gt=tax] ! Loop over L; at each L we evaluate TAX_DATESTRING for the time step, ! and compute the location for the label REPEAT/L=5:60:5 (DEFINE SYMBOL tlab = "`TAX_DATESTRING(tt,tt,"day")`"; \ LABEL `xpos` `ypos` 1 0 0.1 ($tlab) )
A further example:
Here is an alternative way to get the time labels. This does not give as much control over the date string, however. We can use the timeaxis and the `RETURN=tstart` syntax:
!... Set up the variables as in the above example REPEAT/L=5:60:5 (DEFINE SYMBOL tlab = "`T[GT=tax],RETURN=tstart`"; \ LABEL `xpos` `ypos` 1 0 0.1 ($tlab) )