Re: Tick labels and dates [message #41820] |
Wed, 24 November 2004 16:18  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
Michael Wallace wrote:
> Now, there's the plotting part of my code. The previous examples showed
> this label_date stuff, but since I'm not using that, how do I go about
> creating the correct labels? If I use JD values for that axis, is there
> some magic option where I can give it the format code?
Use TICKFORMAT ([XYZ]TICKFORMAT for direct graphics commands)
TICKFORMAT
A string, or an array of strings, in which each string represents a
format string or the name of a function to be used to format the tick
mark labels. If an array is provided, each string corresponds to a
level of the axis. (The TICKUNITS property determines the number of
levels for an axis.) If the number of strings stored in this property
is one, GetProperty returns a scalar string, otherwise GetProperty
returns an array of strings.
If the string begins with an open parenthesis, it is treated as a
standard format string. (See Format Codes.)
If the string does not begin with an open parenthesis, it is
interpreted as the name of a callback function to be used to generate
tick mark labels. This function is defined with either three or four
parameters, depending on whether TICKUNITS is specified.
Don't worry about array values, as they're only relevant for multi-level
axes. (There are various problems with multi-level axes that make them
an intriguing toy, IMHO. Also, note that when it says above that the
TICKUNITS property determines the number of levels for an axis it means
the *number of elements* of TICKUNITS determines the number of levels.)
So the following (not tested) should give you a plot with an x-axis with
an interval of one month and with each tick mark labelled in "yyyy-mm"
format:
PLOT, ..., XMINOR=0, XTICKUNITS='month', XTICKINTERVAL=1, $
XTICKFORMAT='(C(CYI4.4,"-",CMOI2.2))'
--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
|
|
|