Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
I think you need to make a yeararray of the same size as timearray where the first element is 1973.78 (or what ever fraction of a year your first date is) and increments by hour/(365.24*24), i.e., yeararray = lindgen(55924)/(365.24 * 24) + startyear. That way your year ticks will end up in the right places. Anil Kochhar wrote: > Hi, > > I have a graph of measurements vs time. Both my MeasurementArray and > TimeArray have 55924 elememts > with measurements taken on the hour for 8 years (1973-1980). I would > also like to > indicate on the xaxis the years as they correspond to the time (i.e. After > the first > year's of data have 1973 on the x axis and so on) > However I am having some trouble > figuring out how to do this. I have tried using the axis prodeure and > graphing: > > YearsArray = [1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980] > Plot, TimeArray, MeasurementAray > axis, xaxis = 0,xticks = 7,xtickn = YearsArray, xtitle = > 'Yr',xcharsize = 0.9 > > However, since measurents were only first collected in October 1973, > dividing the xaxis > into 8 even parts would not accurately relate the years to the > Measurments. > > I also tried creating another array TimeArrayNew which has the year > markers (i.e. 1973, 1974 etc) > placed in the corresponding time slots: > > YearsArray = [1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980] > YearIndex = where(TimeArray GT 365.86 and TimeArray LT 365.9, > count) > print, 'Count: ', count > NumElem = n_elements(Final_Time) > TimeArrayNew = intarr(NumElem) ; Initialize Array of size NUmElem > to ZERO > TimeArrayNew(YearIndex) = YearsArray > Plot, TimeArray, MeasurementAray > axis, xaxis = 0, xticks = NumElem-1 ,xtickn = TimeArrayNew, xtitle > = 'Yr',xcharsize = 0.9 > > Note: NumElem equals 55924 > However this yields as an error b/c XTICKN can only have 60 elements: > ERROR: %Keyword array parameter XTICKNAME must have from 1 to 60 elements. > > I'm looking for suggestions on can plot the measurements vs time while > also indicating the > corresponding Years along the X Axis: > > Thanks > (please reply to my email address) > > p.s. Also could someone suggest a good IDL website for beginners > > anilk@mtolympus.ari.net > > "Internet or BUST !!"