Ken Mankoff wrote:
>
> On Wed, 1 May 2002, Paul Van Delst wrote:
>> FUNCTION wticks, axis, index, value
>> wavelength = 10000.0d / value
>> format = '( f5.2 )'
>> RETURN, STRING( wavelength, FORMAT = format )
>> END
>>
>> PLOT, x, y, XSTYLE = 8
>> AXIS, XAXIS = 1, $
>> XRANGE = !X.CRANGE ,$
>> XTICKV = 10000.0d/[ 10d, 11, 12, 13, 14, 15 ], $
>> XTICKS = 5, $
>> XSTYLE = 1, $
>> XTICKFORMAT = 'wticks'
>>
>> As you can see, the above AXIS command assumes something about the
>> XTICKV values. However, if I now decide to zoom into the plot such
>> that the x-range falls between, say, 11 and 12 microns -- no
>> wavelength scale is shown since XTICKV doesn't contain fractional
>> wavelength values. Is there any way to get IDL to set "nice"
>> wavelength values (via a dynamic XTICKV for e.g.) on the top scale
>> based on the wavenumber range on the bottom scale?
>
> Can't you make the inputs to XTICKV a function call (as you say, a
> "dynamic XTICKV"), and use !X.CRANGE in that function?
>
> This seems fairly straightforward, so if this is not the solution,
> please clarify a bit...
>
> The best analogy I can think of to your problem is "MAP_GRID", which
> picks nice gridlines for global views (30 degrees) and also nice
> gridlines for close-up views (every .001 degrees if the view small
> enough). Is this what you are trying to achieve?
Sort of, but I want the tickmarks on the upper axis to be, um, visually pleasing. So I
would like 10, 11, 12, 13, etc microns ( which will be irregularly spaced), rather than
the wavelength equivalent of the frequency ticks, which would be regularly spaced but
would be numbers like 8.3333.., 10, 12.5, 16.666.., and 25 microns for frequencies of
1200, 1000, 800, 600, and 400 cm^-1.
I spent about half-a-day on this yesterday and it is not an straightforward problem. What
one needs is some sort of algorithm that, given the *regularly spaced* wavelength ticks
[8.3333.., 10, 12.5, 16.666.., and 25] produces an array of "prettified" tick values such
as [10, 11, 12, 14, 16, 18, 20, 25]. Note that the tick interval changes to allow for the
1/x spacing otherwise the tick marks will all be smooshed together at the long wavelength
end of the axis. And to make it general, it also has to work when you have fractional
wavelengths (e.g. for plots between 4.0 and 4.5 um). I'm sure this sort of stuff/algorithm
exists (IDL has one for its plots), I just don't know where to find it and I don't want to
reinvent it (coz I'll more than likely do a crappy job).
It never ceases to amaze me how these apparently simple things are so difficult to do in a
general way.
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP/EMC purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|