Why do my contour lines not create circuits?

Hello everyone,

Below, you can see an image where I have used Mathematica to contour data generated from 100 data points (in green). Unfortunately, the contour lines seem to include a series of “random” line segments (obviously, not random in a literal sense).

Does anyone have any idea(s) about why the ListContourPlot function is behaving this way?


Here is the Mathematica code:

Show[ListContourPlot[ContourableValues], MouseOverPoints]

And ContourableValues is of the form:

{{-1.48492, -0.424264, 1}, {-1.48492, -0.353553, 

  1}, {-1.48492, -0.282843, 3}, {-1.48492, -0.212132, 

  2}, {-1.48492, -0.141421, 3}, {-1.48492, -0.0707107, 3}, {-1.48492, 

  0., 1}, {-1.48492, 0.0707107, 1}, {-1.48492, 0.141421, 

  0}, {-1.48492, 0.212132, 0}, {-1.48492, 0.282843, 0}, {-1.48492, 

  0.353553, 0}, {-1.48492, 0.424264, 0}, {-1.41421, -0.636396, 

  2}, {-1.41421, -0.565685, 2}, {-1.41421, -0.494975, 

  1}, {-1.41421, -0.424264, 1}, {-1.41421, -0.353553, 

  0}, {-1.41421, -0.282843, 2}, {-1.41421, -0.212132, 2},....etc.

I would appreciate any advice that anyone could give.

Thanks,

Matty

Could you please provide full data? And what is MouseOverPoints? To make things simple just attach your notebook with full code to the post.

OK, I’ve attached the relavent file.

I can go into more detail about how the contoured data are generated from the point data (MouseOverPoints), but I didn’t think that it was relavent to the contouring issue.

Thanks,

Matty

Is this better?

Show[ListContourPlot[ContourableValues, MaxPlotPoints -> 20, 
  Contours -> 10, ContourStyle -> Opacity[.3]], MouseOverPoints]

Thanks Sam. That works great. Would you mind explaining to me why exactly that works. I was playing with different value for the number of contour lines and the MaxPlotPoints and could quite figure out when it should “behave” vs. when it gives the “floating” line segments.

I am trying to write a program for general use, so it would be helpful if I could set some limits so that this never happens even as the user changes the number of contours he/she wishes to display.

Also, is there a way to use Tooltip with ListContourPlot? It seems like the function “ContourLabels → All” yield the mouseover labels, but I need to convert the actual value of the contours into percent area contour labels. I could do this wth Tooltip, but I haven’t figured out how to make that work with ListContourPlot.

Thank you very much for all of your help/advice.

Matty