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

Home » Public Forums » archive » Time axis labelling (1 major label every 7 days with 6 minor ticks)
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 axis labelling (1 major label every 7 days with 6 minor ticks) [message #60349] Mon, 19 May 2008 02:33 Go to next message
Patrique is currently offline  Patrique
Messages: 3
Registered: May 2007
Junior Member
Dear all,

I'm currently trying to figure out how to make IDL to draw a time axis
reaching from 14 Jan to 18 Feb 2008 (exactly 5 weeks) with major ticks
each 7 days and 6 minor ticks in between so that there is a tick label
each full week. I already tried a lot of different things, but nothing
really worked. In my IDL Version (6.4) even the spacing of the tick
marks varies along the x axis when running the example below.

Can someone of you give me any hint on how to manage this issue ?

pro test
;xaxis: start on 14 Jan, end on 18 Feb
time = FINDGEN(36)+JULDAY(01,14,2008,00,00)
;yaxis values
Values = RANDOMN(seed,36)

;axis formatting
!X.TICKFORMAT = ['LABEL_DATE']
!X.TICKUNITS =['Time']
dummy=LABEL_DATE(DATE_FORMAT = '%D.%N.%Y!C%H:%I')

;plotting
PLOT,time,values, XSTYLE=1, YSTYLE=1, XTICKS=5
end

Best regards and thanks for your help,
Patric.
Re: time axis labelling [message #79739 is a reply to message #60349] Mon, 26 March 2012 12:40 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
anil writes:

> the xticks command does not allow me to have 100 ticks in an axis. but
> i need to have a tick mark at each data point/date. Then i need to
> add the dates as labels. but the problem is that i can not arrange the
> tickmarks. any solution to this?

Yes, don't put any tick marks on your contour plot. Rather,
put the ticks and the labels on with cgPlotS and cgText,
respectively, as outlined in my first response. An example is in
cgDCBar. :-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: time axis labelling [message #79741 is a reply to message #60349] Mon, 26 March 2012 11:42 Go to previous message
anil is currently offline  anil
Messages: 34
Registered: August 2009
Member
On Mar 26, 6:19 pm, David Fanning <n...@idlcoyote.com> wrote:
> anil writes:
>> I have a contour plot (y axis is ocean depth, x axis is time and
>> temperature of the water column is contoured)   in which i have 123
>> irregular time(data) points. I want to read in column data (which is
>> no problem) from a file :
>> 09 09 2002
>> 09 17 2002
>> ... ... ......
>> ... ... ......
>> 12  23  2005 etc...  I want to read these columns as month, day ,year
>> seperately and then generate time labels for the x axis of my plot
>> such as : 09/09/2002 .
>
>> There is no regular spacing in between the dates, which is what i
>> could not figure out.
>> I  want to have tickmarks on each date(data point), so my plot will be
>> easy to follow.
>
> I don't know if you have noticed, but that's a fairly
> long string you want to put on there for the date.
> If you have more than 5 dates on your plot, it's going
> to be hard to follow no matter what you do. :-)
>
> I'd recommend you suppress the tick annotations on your
> contour plot entirely, and then put the labels on with cgText,
> in a rotated fashion, so you have a chance of fitting them
> onto the plot in a way that is readable. You can see an
> example of how this is done with the labels in the
> discrete color bar program cgDCBar.
>
> You could even put small tick marks in the right
> locations with cgPlotS.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

the xticks command does not allow me to have 100 ticks in an axis. but
i need to have a tick mark at each data point/date. Then i need to
add the dates as labels. but the problem is that i can not arrange the
tickmarks. any solution to this?
Re: time axis labelling [message #79743 is a reply to message #60349] Mon, 26 March 2012 11:25 Go to previous message
anil is currently offline  anil
Messages: 34
Registered: August 2009
Member
On Mar 26, 6:19 pm, David Fanning <n...@idlcoyote.com> wrote:
> anil writes:
>> I have a contour plot (y axis is ocean depth, x axis is time and
>> temperature of the water column is contoured)   in which i have 123
>> irregular time(data) points. I want to read in column data (which is
>> no problem) from a file :
>> 09 09 2002
>> 09 17 2002
>> ... ... ......
>> ... ... ......
>> 12  23  2005 etc...  I want to read these columns as month, day ,year
>> seperately and then generate time labels for the x axis of my plot
>> such as : 09/09/2002 .
>
>> There is no regular spacing in between the dates, which is what i
>> could not figure out.
>> I  want to have tickmarks on each date(data point), so my plot will be
>> easy to follow.
>
> I don't know if you have noticed, but that's a fairly
> long string you want to put on there for the date.
> If you have more than 5 dates on your plot, it's going
> to be hard to follow no matter what you do. :-)
>
> I'd recommend you suppress the tick annotations on your
> contour plot entirely, and then put the labels on with cgText,
> in a rotated fashion, so you have a chance of fitting them
> onto the plot in a way that is readable. You can see an
> example of how this is done with the labels in the
> discrete color bar program cgDCBar.
>
> You could even put small tick marks in the right
> locations with cgPlotS.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")

Maybe I told the story missing or wrong. I understand your point which
seems it will solve the problem. But I have to show all the
tickmarks( one tick per each time/data) because later on i will put
vertical dashed lines, so i can see my exact data/time points in the
contour plot.I have to have all the ticks. Then have the dates as
labels.
Re: time axis labelling [message #79746 is a reply to message #60349] Mon, 26 March 2012 08:19 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
anil writes:

> I have a contour plot (y axis is ocean depth, x axis is time and
> temperature of the water column is contoured) in which i have 123
> irregular time(data) points. I want to read in column data (which is
> no problem) from a file :
> 09 09 2002
> 09 17 2002
> ... ... ......
> ... ... ......
> 12 23 2005 etc... I want to read these columns as month, day ,year
> seperately and then generate time labels for the x axis of my plot
> such as : 09/09/2002 .
>
> There is no regular spacing in between the dates, which is what i
> could not figure out.
> I want to have tickmarks on each date(data point), so my plot will be
> easy to follow.

I don't know if you have noticed, but that's a fairly
long string you want to put on there for the date.
If you have more than 5 dates on your plot, it's going
to be hard to follow no matter what you do. :-)

I'd recommend you suppress the tick annotations on your
contour plot entirely, and then put the labels on with cgText,
in a rotated fashion, so you have a chance of fitting them
onto the plot in a way that is readable. You can see an
example of how this is done with the labels in the
discrete color bar program cgDCBar.

You could even put small tick marks in the right
locations with cgPlotS.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Regrid / Interpolation Question
Next Topic: An optimisation question

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

Current Time: Wed Oct 08 15:47:11 PDT 2025

Total time taken to generate the page: 0.00641 seconds