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

Interesting IDLgrContour Bug

Hi Folks,

I ran into an interesting little IDLgrContour bug today
that gave me a few hours of fun. Apparently, the
contour algorithm cannot see positive data that is less
than 1. As a result, it reports the contour range incorrectly.
Here is a very short example:

      ; Create test data.
   data = Dist(40)

      ; Normalize the Y values from 20 to 39 to be less than 0.
   data[*,20:39] = data[*,20:39]/Max(data)

      ; Create contour plot.
   x = findgen(40)
   y = findgen(40)
   theContour = Obj_New('IDLgrContour', data, Geomx=x, Geomy=y)

      ; Get the Y range of the data.
   theContour->GetProperty, YRange=theBadRange

      ; Print it. Expect 0 to 39.

   Print, theBadRange
      0.000000      19.8495

Whoops! Of course, this will cause the scaling to be
completely off when you go to put the plot into your

The work around is to get the contour range from
the X and Y vectors. I don't think too many people
will run into this, but it can be distracting. :-)

I've tested this in IDL 5.3.1 and IDL 5.4 beta on
Windows NT 4.0.


David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155