| 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
|
|
|
|