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

Home » Public Forums » archive » Re: Tick formatting
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
Re: Tick formatting [message #29144] Sun, 03 February 2002 12:53
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
<gary.hodgesREMOVE@cires.colorado.edu> wrote in message
news:a3esa9$eri$1@news.nems.noaa.gov...
> I've almost got what I'm after...
>
> I'm plotting data that runs from zero to 180 degrees. I'd like my
> ticks/labels to go zero -> 90 -> zero. The X axis will actually run
from -5
> to 185, but I would like the ticks and labels to start and end at the zero
> and 180 positions. What I want to end with should look like (ticks
centered
> on numbers of course):
>
> | | | | | | | | | | | | |
> 0 15 30 45 60 75 90 75 60 45 30 15 0
>
> I'm getting an extra zero, i.e., 0 0 15 30, and the values are right
> displaced under the tickmark. This is my best reproduction...
>
> | | | | | | | | | | | | |
> 0 0 15 30 45 60 75 90 75 60 45 30 15 0
>
> I've set the following:
>
> !X.TICKS=13
> !X.TICKV=[0,15,30,45,60,75,90,105,120,135,150,165,180]
> !X.TICKNAME=[0,15,30,45,60,75,90,75,60,45,30,15,0]

As a general rule, you can get more robust and simpler code if you avoid
specifying TICKNAME directly. Try to use TICKFORMAT instead. Define a
function something like this:

function myticks, direction, index, value, level
compile_opt IDL2
;; Warning: not tested!
return, strtrim(round(value < (180-value))
end

and specify !X.TICKFORMAT='myticks'. This doesn't avoid the need to also
specify !X.TICKS and/or !X.TICKV but it avoids the risk that your tick
labels will look right but actually be incorrect.

---
Mark Hadfield
m.hadfield@niwa.co.nz http://katipo.niwa.co.nz/~hadfield
National Institute for Water and Atmospheric Research
Re: Tick formatting [message #29152 is a reply to message #29144] Fri, 01 February 2002 14:54 Go to previous message
gary.hodgesREMOVE is currently offline  gary.hodgesREMOVE
Messages: 9
Registered: October 2001
Junior Member
David Fanning <david@dfanning.com> wrote:
: Gary Hodges(gary.hodgesREMOVE@cires.colorado.edu) writes:

:> I have tricked IDL into producing the tick labels in the format I want by
:> changing the !X.TICKNAME to:
:>
:> !X.TICKNAME=['0','15','30','45','60','75','90','75','60','45 ','30','15','0']
:>
:> I'd still like to know the correct way.

: I'm not sure that is much of a trick. More like what
: the documentation called for, it seems to me. :-)

I saw that info a bit ago. I guess since it was almost working the first
way, I assumed the array was correctly constructed.

: But shouldn't !X.Ticks be 12 and not 13? Then you
: wouldn't have to use the !X.TickV variable at all,
: I think.

I saw that n and n+1 stuff... OK, I'm looking at it again and it is tick
_intervals_. I think I still need TICKV since I want the first tick at 0,
not -5. How would it know to start there otherwise?

Gary
Re: Tick formatting [message #29153 is a reply to message #29152] Fri, 01 February 2002 14:06 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gary Hodges(gary.hodgesREMOVE@cires.colorado.edu) writes:

> I have tricked IDL into producing the tick labels in the format I want by
> changing the !X.TICKNAME to:
>
> !X.TICKNAME=['0','15','30','45','60','75','90','75','60','45 ','30','15','0']
>
> I'd still like to know the correct way.

I'm not sure that is much of a trick. More like what
the documentation called for, it seems to me. :-)

But shouldn't !X.Ticks be 12 and not 13? Then you
wouldn't have to use the !X.TickV variable at all,
I think.

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: Tick formatting [message #29154 is a reply to message #29153] Fri, 01 February 2002 13:33 Go to previous message
gary.hodgesREMOVE is currently offline  gary.hodgesREMOVE
Messages: 9
Registered: October 2001
Junior Member
gary.hodgesREMOVE@cires.colorado.edu wrote:

: I'm getting an extra zero, i.e., 0 0 15 30, and the values are right
: displaced under the tickmark. This is my best reproduction...

: | | | | | | | | | | | | |
: 0 0 15 30 45 60 75 90 75 60 45 30 15 0

: I've set the following:

: !X.TICKS=13
: !X.TICKV=[0,15,30,45,60,75,90,105,120,135,150,165,180]
: !X.TICKNAME=[0,15,30,45,60,75,90,75,60,45,30,15,0]

I have tricked IDL into producing the tick labels in the format I want by
changing the !X.TICKNAME to:

!X.TICKNAME=['0','15','30','45','60','75','90','75','60','45 ','30','15','0']

I'd still like to know the correct way.

Gary
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Color text within WIDGET_TEXT?
Next Topic: Double-precision plotting doesn't work in object graphics

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

Current Time: Sat Oct 11 00:55:22 PDT 2025

Total time taken to generate the page: 0.72242 seconds