Reversing y-axis using label_date [message #89721] |
Wed, 19 November 2014 23:13  |
greer.katelynn
Messages: 5 Registered: December 2008
|
Junior Member |
|
|
I am attempting to create a Hovmoller plot of some atmospheric data. The problem is that I want time increasing downward. Usually to reverse the an axis, you just reverse the range in the plot call. Unfortunately, this is resulting in only one date to be plotted. The relevant code is as follows:
cgLoadCT,22,Ncolors=21,Bottom=1,/Brewer
dummy=label_date(DATE_FORMAT=['%D','%M'])
plot,[0,10],[juldates(1),juldates(2)],/nodata,$
xrange=[-180,180],yrange=[juldates(nt-1),juldates(0)],$
ytickunits=['Time','Time'],ytickinterval=2,$
ytickformat='Label_Date',xtitle='Longitude',$
xstyle=1,ystyle=1
contour,w,lon,juldates,$
levels=w_levels,c_colors=Indgen(21),/cell_fill,$
/overplot
Thanks,
Katelynn
|
|
|
Re: Reversing y-axis using label_date [message #89725 is a reply to message #89721] |
Thu, 20 November 2014 05:13  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
greer.katelynn writes:
>
> I am attempting to create a Hovmoller plot of some atmospheric data. The problem is that I want time increasing downward. Usually to reverse the an axis, you just reverse the range in the plot call. Unfortunately, this is resulting in only one date to be plotted. The relevant code is as follows:
>
> cgLoadCT,22,Ncolors=21,Bottom=1,/Brewer
> dummy=label_date(DATE_FORMAT=['%D','%M'])
> plot,[0,10],[juldates(1),juldates(2)],/nodata,$
> xrange=[-180,180],yrange=[juldates(nt-1),juldates(0)],$
> ytickunits=['Time','Time'],ytickinterval=2,$
> ytickformat='Label_Date',xtitle='Longitude',$
> xstyle=1,ystyle=1
> contour,w,lon,juldates,$
> levels=w_levels,c_colors=Indgen(21),/cell_fill,$
> /overplot
This has something to do with the YTICKUNITS keyword. When this is set
the way it is in your example, the wrong information (actually the SAME
information, over and over) is sent to LABEL_DATE. If you simply remove
the YTICKUNITS keyword, the time axis behaves the way you expect it to.
I have no idea what this is about, but expect it is a bug in IDL.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|