Ric Sherlock wrote:
> Use dates.ijs to convert dates to day numbers.
> 1st of the month of earliest date is base date - subtract from day
> numbers to get x values corresponding to y values you want to plot. 
> Subtract the base date daynumber from day number of the 1st of each
> month to get the Xticpos. 

Here's the code I came up with to implement your suggestions above (it 
is partially based on the "London Gold" example in "Studio | Demos | 
plot | Styles | Style 3 | Options | View Definition" and the associated 
data in "system\examples\graphics\plot\pldata.ijs"):

------------------------------------------------------------
load 'dates plot tables/csv'

Months=: _3 <\ 'JanFebMarAprMayJunJulAugSepOctNovDec'
datafile=. 'DJIA20072008.csv'
a1=. readcsv (jpath '~user\data\',datafile)
a3=. |. a1
a4=. |: a3
a5=. 0 { a4
a6=. 6 { a4
a5a=. todayno getdate every a5
a5b=. a5a - (0{a5a)
monthval=. 1 { |: getdate every a5
bool=. 1 , (2 ~:/\ monthval)
Xticpos=. ": bool # a5b
mn=. bool # monthval
Label=. (mn-1) { Months
dji=. > ". each a6
('xticpos ',Xticpos,';xlabel ',; ' ',each Label) plot dji
------------------------------------------------------------

Although this "works" in the sense that it does display a plot of the 
data with tics/labels, the data and tics/labels are NOT synchronized 
(as in the plot from your July 6 posted code).  I cannot figure out 
why.  Thanks in advance for any assistance!

Harvey

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to