Re: Rant about axis range defaults using overplot in object graphics [message #91719 is a reply to message #91702] |
Fri, 14 August 2015 08:14   |
laura.hike
Messages: 87 Registered: September 2013
|
Member |
|
|
Great, thanks! That's a big help.
On Thursday, August 13, 2015 at 2:10:01 PM UTC-7, Chris Torrence wrote:
> On Wednesday, August 12, 2015 at 1:16:38 PM UTC-6, laura...@gmail.com wrote:
>> On Tuesday, August 11, 2015 at 4:22:22 PM UTC-7, Chris Torrence wrote:
>>>
>>> One tweak to alx's code is to simply set the x/yrange after the first plot. Once you set the range it should keep it constant. For example:
>>>
>>> IDL> p = plot([0,1])
>>> IDL> p.xrange = p.xrange
>>> IDL> p.yrange = p.yrange
>>> IDL> p1 = plot([0,2],/overplot)
>>
>>
>> Hmmm, that does work. Why? Shouldn't the behavior of the overplot option be the same no matter what value you set the axis ranges to?
>>
>> Also, I see that you are able to plot a single point. I have never been able to do this (I always got an error message indicating that an array was required), but using your command, I can. I normally plot pairs of arrays, e.g., p = plot(x,y), but if I set x and y to individual values, I can't use this syntax. Is there an explanation for this beyond "That's the way it works"?
>
> Hi Laura,
>
> As soon as you set the x or yrange, then IDL assumes that you don't want it to change and so it "sticks" for subsequent overplot calls. If you never set the range, then it assumes that you want it to update automatically.
>
> Regarding the "single point", I'm actually plotting 2 points. plot([0,1]) is only giving the "y" coordinates, and IDL will simply plot those against the x index values, which will be 0 and 1. So the 2 points are [0,0] and [1,1].
>
> Cheers,
> Chris
|
|
|