This method does not require a graphics window to be open, does not care
what graphics device is active, does not disturb the contents of the Z
buffer, and does not disturb the current plot settings.
I wonder if the IDLgrAxis object might be handy here. I
haven't thought about it before, but I would guess that
the axis range in Direct and Object graphics are determined in the same way by IDL (or at least the results will be similar.)
Assuming that your want to use direct graphics, you could temporarily create an axis specifying your data range. Then use the GetProperty method to retrieve
CRange. Finally, destroy the object.
Direction = 0 ; or 1 for the yaxis
oAxis = Obj_New('IDLgrAxis', Direction, Range = [YourDataMin,YourDataMax])
oAxis -> GetProperty, CRange = CRange
Here's what the help file on CRange states:
Set this keyword to a named variable that will contain the actual full range of the axis as a vector of the form [minval, maxval]. This range may not exactly match the requested range provided via the RANGE keyword in the Init and SetProperty methods. Adjustments may have been made to round to the nearest even tick interval or to accommodate the EXTEND keyword.
-- Ben Tupper Bigelow Laboratory for Ocean Science email@example.com firstname.lastname@example.org