Retrieving labels of tick marks [message #89355] |
Tue, 26 August 2014 14:10  |
elias
Messages: 13 Registered: April 2005
|
Junior Member |
|
|
Hi,
I was wondering if it is possible to retrieve the string array of the tick labels that IDL generates for a plot? As far as I know, one may retrieve the tick values with tick_get.
What I want to do is to modify the output of label_date. For the day number, LABEL_DATE outputs only the day of month, but sometimes I prefer to have the day of year (e.g. 184/2014 instead of 01-Jul-2014). My idea is to retrieve the output of LABEL_DATE and replace the month/day-of-month with DOY, using one of the JHUAPL routines.
Do you suggest a different method otherwise?
Thanks.
|
|
|
Re: Retrieving labels of tick marks [message #89366 is a reply to message #89355] |
Wed, 27 August 2014 17:19  |
Matthew Argall
Messages: 286 Registered: October 2011
|
Senior Member |
|
|
You can write your own tick-label formatting function.
Say your time axis is given in julian day numbers:
MyDates = TIMEGEN(366, START=JULDAY(1,1,2000))
You can create you own function to convert axis labels to dates:
function xtick_time_labels, axis, index, value, level
caldat, value, month, day, year
year_day = Convert2YearDay(month, day, year)
tick = strtrim(year_day, 2) + '-' + strtrim(year, 2)
return, tick
end
then use the XTICKFORMAT keyword in the plot command.
plot, MyDates, MyData, XTICKFORMAT='xtick_time_labels'
http://exelisvis.com/docs/graphkeyw.html#graphkeyw_328877816 6_370350
|
|
|