[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Double tickmark annotations

"Shawn L. Young" wrote:
> Hello,
>         I would like to know how to give more than one name to a each
> tickmark along the x axis.  For instance, I want to list both a satellite's
> latitude and radial distance from the center of the Earth along the x axis.
> However, I don't know ahead of time how these two quantities correlate so I
> can't hardwire tick names using xtickname.  Is there a way to give the plot
> routine both arrays and have it determine the ticknames?  If not, the help
> file is very brief on the use of xtickname.  If I knew how IDL chose where
> to put the ticknames I might be able to write code to do the correlating on
> the fly.  But when I am using a > 500 element array for the x axis and want
> to be sure that I am doing the best correlation I can between array
> elements and xtickname elements.
> Thanks

You can use XTICKFORMAT, which is a named function to which idl passes
each of it's desired tick values, along with which axis, and the index
of the tickmark.  You can then calculate any string you like based on
this information, and return it for display.  If, however, you don't
like how IDL is choosing its tick locations, you can certainly calculate
your own, along with labels, and use XTICKV and XTICKNAME.  Presumably
this calculation would be based on the data itself, similar to the
calculation IDL does if you let it (or not).  Here's an example such

   n=float(range)/divs    ;approximate number of these intervals
   tmp=min(abs(n-8),wh)   ;nearest to 8 tick intervals

This finds ticks at a certain preset list of intervals, ensuring that
not too many and not too few ticks are chosen.  Obviously, it can't
accomodate any data range (actually in this case it's seconds less than
one day, so it can), so you might have to have more elaborate coding. 
But it gives you an idea.  

Also, you must know the correlation between your two independent
variables beforehand, since otherwise you wouldn't be able to relate
them during plotting at all.  Perhaps I've misinterpreted you.

By the way, it sounds like yours is an excellent candidate for two axes
(top and bottom), for each of latitude and distance.  


 J.D. Smith                  |   WORK: (607) 255-6263
 Cornell Dept. of Astronomy  |         (607) 255-5842
 304 Space Sciences Bldg.    |    FAX: (607) 255-5875  
 Ithaca, NY 14853            |