On Tue, 30 Jan 2007 16:01:31 +0100, Paolo Grigis wrote:
>
>
> Reimar Bauer wrote:
>> Hi all
>>
>> here is another example which is very funny if you see it the first time
>>
>> a=indgen(10)*1D-7
>> b=a
>> plot,a,b,psym=1
>> oplot,[0,10],[0,10]
>>
>> because the coordination system is defined by plot it could be a bug too
>> and not only a question about precisions
>>
>>
>> Any idea what is happen here?
>
> I think that maybe plot tries to find out the pixel coordinates
> corresponding to the far end of the line. If it uses long, signed
> integers for that, then it will overflow around pixel 2^31, which
> seems roughly where the line is supposed to be with your settings
> (which should be something like 500 pixel times 10 divided by 1d-6).
In fact this has to be the right explanation. If instead of a wide
window, you create a tall one:
window,xsize=600,YSIZE=800
Then the line falls below the points. And if you make an exactly square
plotting window:
window,xsize=800,ysize=800
a=indgen(10)*1D-7
b=a
plot,a,b, psym=1,xstyle=3,ystyle=3,POSITION=[.1,.1,.9,.9],/NORMAL
oplot,[0,10],[0,10]
Then it all lines up well. The direction with the largest pixel count per
unit data value ends up "truncating" first: i.e. the longer dimension of
the plotting window. You can see where it truncates by gradually altering
the values until the line just starts deviating:
for k=2.,5.,.1 do begin & print,k & oplot,[0,k],[0,k] & wait,1 & endfor
At some point, both clip, and you get a min and max angle (the size of
which is related to the aspect angle of your plotting window). The first
deviation for me was near k=2.3. What's close to that number?
IDL> print,!X.CRANGE[0]+((!X.CRANGE[1]-!X.CRANGE[0])/ $
((!X.WINDOW[1]-!X.WINDOW[0])*!D.X_SIZE)) * 2.^31
2.2700673
Aha. This is precisely the data coordinate where the implied device
pixel coordinate with this plotting range hits 2.^31, the limit for a
signed long integer. At that point, it clips to this value, while the
Y-axis, not having clipped yet, continues to move up, until it too
clips. Your number may differ depending on your window size.
JD
|