[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDL plot is inconsistent, where is subtle error?

Hi Lawrence--

Wow, there's no complaints about not enough information here! :-)

> Hello, IDLers.  I'm having a very subtle problem with plotting from IDL.
> Either that or IDL is screwed up, which I doubt is the case.  First, my
> configuration:
> ...

After all this I think the problem is still a single vs. double
precision issue.  As you noted you are starting to lose even
integer-level precision in some of your plots.

> My first version of XTICK3 did not act in this manner.  I found, by
> experimentation, that the value passed to XTICK3 was a *single* precision
> floating value, even through all the X-values to be plotted, as well as the
> vector passed to XTICKV, were *double* precision.  ...

Here is the story.  Direct graphics in IDL 5.3 and earlier is single
precision *only*.  This means that any plot commands, etc. which
involve double precision numbers are converted internally to single
precision.  However, in IDL 5.4 I understand that direct graphics now
supports both floating point precisions.  If you can, you may consider
an upgrade (if 5.4 even exists for VMS).

But you can still find some salvation without IDL 5.4.  First, I
strongly strongly urge you to subtract a constant baseline epoch from
your data, at least when plotting.  From my description above it is
clear that you are stuck with floating point single precision, so you
will always have problems plotting data with huge dynamic range.  But
you don't have a large dynamic range!

By simply changing the plot command to "PLOT, (EPOCH-E0), VALUES..."
where E0 is a nearby time, you can eliminate the precision problems
you are having.  If this really is SOHO data then you can probably set
E0 to the launch date without too much trouble.  Please realize that
this suggestion is only intended for the *plotting* of the data.  You
obviously still keep the science data in the full double precision
representation.  [ You may have to modify your "tick label" function
to account for this offset, but that's probably a trivial mod. ]

> My current problem arises in that some of the time the last (5th) major
> tick mark does not get drawn or labelled.  

Your real question is about the wierd disappearing last tick mark.  I
honestly believe that this problem is caused by the single precision
problems described above.  Once you start subtracting a constant time,
I will wager that things go back to normal!

If this doesn't solve the problem then you may have to set your own
major tick points using the XTICKV keyword.  It's not hard but of
course you need to develop the logic to compute them.

All that being said, I have never found it easy to customize the axis
labels on a plot.  Good luck!


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response