Re: plot axis problem? [message #55102] |
Wed, 01 August 2007 08:14 |
rkombiyil
Messages: 59 Registered: March 2006
|
Member |
|
|
On Aug 1, 9:03 pm, Wox <nom...@hotmail.com> wrote:
> On Wed, 01 Aug 2007 10:18:06 +0200, Wox <nom...@hotmail.com> wrote:
>> Well, you could change the tick names
>
> By accident I also stumbled on this:http://star.pst.qub.ac.uk/idl/Displaying_DateTime_Data_ on_Axis_Object...
Well, thanks for taking time off to help and the link! Two things, if
I may.
#1. The above code needs a minor modification to plot correctly, since
n_elements(time) = 10, I would need to add:
<code>
plot,time2,field,xticks=9,XTICKN=strtrim(fix(time),2)+'hrs'
</code>
to plot correctly.
#2. My time arrays are rather large. I actually did a reverse when I
ran into this problem, as in setting:
<code>
time_array[where(time_array ge 24.)]=time_array[where(time_array ge
24.)]-24.
</code>
Anyway, I should admit that it was clever of you to think of changing
the ticknames, reminds me that I should RTFM more.. I haven't thought
of that at all. Since the whole point was to make it more "human
readable" as in resetting time to be 000hrs at midnight and then
increase, I guess for plot purposes, your method would suffice!
Because all I need is to display as above, nothing changes, except the
format of the time displayed :-)
Thanks,
/rk
|
|
|
|
Re: plot axis problem? [message #55121 is a reply to message #55114] |
Wed, 01 August 2007 01:18  |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
On Wed, 01 Aug 2007 05:40:26 -0000, metachronist <rkombiyil@gmail.com>
wrote:
> IDL Gurus,
> I think this is too trivial.. but anyways I can't get it right :(
>
> IDL> time=[22.,23.,0.,1.,2.,3.,4.,5.,6.,7.]
> IDL> field=[4.2,56.7,89.34,22.,0.,43.5,10.,2.,33.,-10.5]
>
> So the time values start at 2200hrs and then go past midnight and then
> to 0700hrs in the morning. How would I "force" the 'x' axis (time) to
> start at 22hrs goto (midnight) 0hrs and then increase to 7hrs? I
> found out that setting xrange wouldn't help either since the decrease
> (increase in terms of time) from 2200hrs --> 2400hrs(0hrs) is IDL way?
> Like (22,20,18,....0,2,...8) , as a result, nothing gets plotted :(
> Thanks for any suggestions,
> /rk
Well, you could change the thick names:
time=[22.,23.,0.,1.,2.,3.,4.,5.,6.,7.]
field=[4.2,56.7,89.34,22.,0.,43.5,10.,2.,33.,-10.5]
n=n_elements(time)
ind=where(time[1:*] lt time[0:n-2],ct)
time2=time
for i=0,ct-1 do time2[ind[i]+1:*]+=24
plot,time2,field,XTICKN=strtrim(fix(time),2)+'hrs'
|
|
|