Re: Plot multiple axes with log and linear scales [message #89408 is a reply to message #89405] |
Thu, 09 October 2014 03:12   |
jens8472
Messages: 2 Registered: October 2014
|
Junior Member |
|
|
On Wednesday, October 8, 2014 10:37:10 PM UTC+2, Chris Torrence wrote:
> On Wednesday, October 8, 2014 7:21:57 AM UTC-6, jens...@gmail.com wrote:
>
>> Thank you guys! After spending hours trying to xtickv myself out of this; the xtickformat strategy really is an eye-opener.
>
>>
>
>>
>
>>
>
>> I would like to add to the complexity, though:
>
>>
>
>> Suppose the function in CONV_AXIS is not a mathematical function; but instead it's data-values corresponding to the other axis?
>
>>
>
>>
>
>>
>
>> Here's my problem:
>
>>
>
>> There are three data vectors: Atmospheric temperature (T), pressure (P) and altitude (A).
>
>>
>
>> I want to plot this data such that T is on the X-axis; and both P and A are on the y-axes; where the A-axis shows the altitude-values corresponding to P. So, I don't want to calculate the A-values using the P-values as input; rather, I have to look up the corresponding values in an array, since I don't know the functional form.
>
>>
>
>>
>
>>
>
>> Furthermore, P is logarithmic while A isn't.
>
>>
>
>>
>
>>
>
>> This suggests I have to interpolate either of the y-axes onto the other; but I don't see how to, exactly.
>
>>
>
>>
>
>>
>
>> The obviously dirty way to do this is to fit the relationship between A and P (approximately exponential) to obtain a functional form; but that's not too neat...
>
>>
>
>>
>
>>
>
>> Thanks so much for any help you could offer!
>
>>
>
>>
>
>>
>
>> Jens
>
>>
>
>>
>
>>
>
>>
>
>
>
> Hi Jens,
>
>
>
> I might be misunderstanding your problem, but that "conv_axis" is an IDL function that can contain *any* code that you want. It doesn't have to be a mathematical function - it could be a lookup table, it could go out to disk and read in a file for each tick value. It doesn't matter. The only requirement is that given a specific input tick value, it needs to output the corresponding string. How you determine that string is up to you.
>
>
>
> Does that help?
>
>
>
> -Chris
Dear Chris,
Thanks for your prompt response.
Yes, I figured the function in conv_axis could be a lookup-table as well as a mathematical function. The problem is the interpolation. In my example: IDL will force ticks at Pressure values which do not exactly occur in the look-up table. For example; it might want to put a Pressure tick at 1000mbar; but the data only has values at 982mbar and 1012mbar; with corresponding altitudes. Therefore I would need to interpolate manually.
This is especially cumbersome if I would want to have rounded altitude ticks; since now I can't do the inversion described by JD.
|
|
|