comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » time series plot, second x-axis
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
time series plot, second x-axis [message #75889] Mon, 18 April 2011 13:45
sh is currently offline  sh
Messages: 26
Registered: April 2010
Junior Member
Hi,

Can somebody tell me why 2009 and 2011 isn't visible? What is missing
in the code?

Cheers,
Sebastian

function myticks, axis, index, value, level

if n_elements(level) eq 0 then level = 0

case level of

0: begin ; months
return, string(value, FORMAT='(C(CMOA))')
end

1: begin ; years
return, string(value, FORMAT='(C(CYI))')
end

endcase

end

pro ts_plot

begin_date=julday(9,1,2009,0,0,0)
end_date=julday(4,1,2011,0,0,0)

min_y=0
max_y=100
symsize=0.1
charsize=1.4
ythick = 1
xthick = 1
linethick = 1
xmargin=[8,8]
ymargin=[8,8]

dummy = label_date(DATE_FORMAT=['%M','%Y'], $

MONTHS=['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP ','OCT','NOV','DEC'])

xtv = timegen(20, UNITS="Months", START=begin_date)

window, /FREE, xsize=1200, ysize=400, xpos=100, ypos=100


plot, [ begin_date, end_date], [0., 100.], $
/NODATA, YTICKLEN=1, YGRIDSTYLE=1, $
YTHICK=ythick, XTHICK=xthick, $
POSITION=[0.1,0.25,0.9,0.85], $
YSTYLE=1, XSTYLE=1, $
YTICKS=5, $
COLOR=cgColor('black'), $
XTICKLEN = 0.005, $
XTICKS = n_elements(xtv)-1, $
XTICKV = xtv, $
XTICKFORMAT = 'MYTICKS', $
XTITLE='', YTITLE='Soil Moisture (%)', $
TITLE=title, $
XTICKUNITS = ['Months','Years'], $
XTICKLAYOUT = 2, $
BACKGROUND = cgColor('white'), $
CHARSIZE=charsize

for i=0, n_elements(xtv)-1 do begin
oplot, [xtv[i], xtv[i]], [0.,100.], COLOR=cgColor('black'),
THICK=0.5, LINESTYLE=1
endfor


end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Tribulations with IDL 8.1 graphics legend function and log axes
Next Topic: Adding an image into Excel worksheet

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 09:13:24 PDT 2025

Total time taken to generate the page: 0.00483 seconds