Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
I have run across a strange problem when I'm working with object graphics and have large values on the X axis. It appears that my X axis is losing precision when doing the plot. I have some example code that has been stripped down to the core IDL. The only non-IDL library function I'm using is norm_coord, which is found in under the examples directory. When you run the code as it is, you get an object graphics window with a nice looking sine wave. However, if you uncomment the indicated line below that adds a really huge number to the x values, you'll no longer see the same sine wave. You'll see a vertical line! It appears that the sine wave is getting compressed into a single bin and I believe the problem is coming from the normalization I'm doing. Because the value of the min and max X values are so much larger than the difference, everything is collapsing in on itself because of the lost precision. I haven't checked this yet, but it sounds like a good guess. So, here's the question. Assuming the normalization is the problem, is there some other way to handle this type of case to make sure that the graphic is preserved? I also need to take into consideration the X axis (not included in sample code). It too was getting out of whack, probably for the same reason. I realize that I could take my x vector and just do a x - x[0] which would have the effect of shifting the min and max numbers down to something reasonable and so wouldn't be affected by precision problems. In this case, the plot looks nice, except the X axis labels will be incorrect. What can I do to change the labels back to the giant numbers they should be? -Mike PRO Weirdness ; Make a nice sine wave x = dindgen(360) * !dtor y = sin(x) ; Uncomment to see a vertical line instead of a sine wave ; Add a really big number to X ;x += 123456789 ; Set up the objects view = Obj_New('IDLgrView') model = Obj_New('IDLgrModel') plot = Obj_New('IDLgrPlot', x, y) view -> add, model model -> add, plot ; Set plot scaling factors and viewplane plot -> getProperty, XRANGE = xrange, YRANGE = yrange plot -> setProperty, XCOORD_CONV = norm_coord(xrange) plot -> setProperty, YCOORD_CONV = norm_coord(yrange) view -> setProperty, VIEWPLANE_RECT = [-0.1, -0.1, 1.2, 1.2] ; Display the plot window = Obj_New('IDLgrWindow') window -> draw, view END