Le samedi 8 juin 2013 09:15:24 UTC+2, Xin Tao a écrit :
> Hi Chris,
>
>
>
> Thanks for your reply. The main purpose here is to set the YRANGE and make all plots obey the YRANGe set by a. I tried your second method, but I need to use the following three lines to get a "normal" plot
>
>
>
> IDL> a=plot([0,1,3])
>
> IDL> b = plot([-1,1,2],/overplot)
>
> IDL> c=plot([-1,1,3],/overplot, yrange=[0,3])
>
>
>
> If I put yrange keyword in b, it doesn't help at all. Part of the line of b is still outside the box. I have to use the third plot c to set the yrange to a value I want. This of course solved my issue, but it's very strange that I have to use three lines to achieve this.
>
>
>
> Xin
>
>
>
> On Saturday, June 8, 2013 12:03:26 PM UTC+8, Chris Torrence wrote:
>
>> On Friday, June 7, 2013 8:39:57 PM UTC-6, Xin Tao wrote:
>
>>
>
>>> I don't know whether this is a bug or not, but the behaviour of the following two lines is not what I expected
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> IDL> a=plot([0,1,3],yrange=[0,3])
>
>>
>
>>>
>
>>
>
>>> IDL> b = plot([-1,1,2],/overplot, 'g')
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> The line of b will go outside the plotting box, because it tried to get to -1, but the yrange is limited to be [0,3] by a.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Here is my IDL version:
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> { x86_64 darwin unix Mac OS X 8.2.3 May 2 2013 64 64}
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Please let me know whether there is anything I can do about it.
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Thanks,
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> Xin
>
>>
>
>>
>
>>
>
>> Hi Xin,
>
>>
>
>> I would recommend either not setting the YRANGE, or, just setting the Yrange after you add the second plot. Either way should get you what you want.
>
>>
>
>> Cheers,
>
>>
>
>> Chris
>
>>
>
>> ExelisVIS
My understanding is that OVERPLOT keyword in NG *does not* work like the OPLOT of DG. Indeed, by using OVERPLOT=gr (or 1), you will mix the added plot with the 'gr' (or current) one, but without necessarily retaining the initial plot axes.
To get what you want, you must do a true overlay as follows:
IDL> a = plot([0,1,3],yrange=[0,3])
IDL> b = plot([-1,1,2], POSITION=a.POSITION, YRANGE=a.YRANGE, /CURRENT, 'g')
alx.
|