Re: Tick formatting [message #29144] |
Sun, 03 February 2002 12:53 |
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  |
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  |
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  |
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
|
|
|