Double-precision plotting doesn't work in object graphics [message #29075] |
Thu, 31 January 2002 20:22  |
Mark Hadfield
Messages: 783 Registered: May 1995
|
Senior Member |
|
|
In IDL version 5.4 RSI introduced double precision support in its graphics
routines and objects to allow (amongst other things) plotting of times
expressed in Julian Days. I have just noticed that it doesn't work as
advertised in Object Graphics.
The routine below demonstrates this. It generates & plots two day's worth of
data at 15-minute intervals. Option 0 gives you a Direct Graphics plot: it
shows a nice clean ramp. Option 1 gives an Object graphics plot: it shows
steps at ~0.3 days spacing.
Here is a calculation of the granularity expected in single- and
double-precision representations of Julian dates:
IDL> m = machar() & feps = m.eps
IDL> m = machar(/DOUBLE) & deps = m.eps
IDL> print, 2452301*feps, 2452301*deps
0.292337 5.4452021e-010
The step spacing in the Object Graphics plot is suspiciously similar to the
single-precision granularity. Obviously some single-precision numbers are
creeping into the Object Graphics calculations.
Version tested: { x86 Win32 Windows Microsoft Windows 5.5 Aug 28 2001 32 64}
Oh well, it looks like I'll have to translate the data and fudge the labels
a little longer.
---
Mark Hadfield
m.hadfield@niwa.co.nz http://katipo.niwa.co.nz/~hadfield
National Institute for Water and Atmospheric Research
***** mgh_test_double_plot.pro *****
pro mgh_test_double_plot, option
compile_opt IDL2
if n_elements(option) eq 0 then option = 0
;; Create two days data at 15-minute intervals
;; Origin is 27 Jan 2002
time = 2452301.5D0 + dindgen(193)/96
data = dindgen(193)/96
case option of
0: begin
;; Direct Graphics
plot, time, data, XTICKUNITS='days', XTICKFORMAT='(C(CDI2,X,CMoA))'
end
1: begin
;; Object Graphics
model = obj_new('IDLgrModel')
;; NORM_COORD function is in
;; <IDL_DIR>/examples/visual/utility/norm_coord.pro
xcoord = norm_coord([min(time),max(time)])
ycoord = norm_coord([min(data),max(data)])
xaxis = obj_new('IDLgrAxis', 0, RANGE=[min(time),max(time)], $
TICKUNITS='days', TICKFORMAT='(C(CDI2,X,CMoA))', $
TICKLEN=0.05, $
LOCATION=[-0.2,-0.2], XCOORD_CONV=xcoord)
model->Add, xaxis
yaxis = obj_new('IDLgrAxis', 1, RANGE=[min(data),max(data)], $
TICKLEN=0.05, $
LOCATION=[-0.2,-0.2], YCOORD_CONV=ycoord)
model->Add, yaxis
dplot = obj_new('IDLgrPlot', time, data, $
XCOORD_CONV=xcoord, YCOORD_CONV=ycoord)
model->Add, dplot
xobjview, model
end
endcase
end
|
|
|