6

I'm trying to make a iso surface plot from some data using ContourPlot3d. My data is a 3 dimension data with form like {{x,y,f[x,y]},...}. I first make this data into 4d by rotating it along the x axis, so that {x,y,f[x,y]} becomes {x,y,z,f[x,y,z]}. Then interpolate them and plot the interpolated function. But sometimes I get a broken surface.

Here is the detail:

Get["https://dl.dropboxusercontent.com/u/24667921/data.dat"];
f = Interpolation[data];
f3d[x_, y_, z_] := f[x, Sqrt[y^2 + z^2]];

ContourPlot3D[
 Abs[f3d[x, y, z]]^2, {x, -15, 15}, {y, -15, 15}, {z, -15, 15}, 
 Mesh -> None, PlotPoints -> 20, Contours -> {1*^-6}, 
 ViewPoint -> {1.3, -1.3, 2.9}, ViewVertical -> {0.2, -1, 0.2}, 
 Axes -> False, Boxed -> False, ImageSize -> 300]

enter image description here

We can see two dark spot on the surface. If I remove the PlotPoints->20, the holes are gone. And this seems not caused by the same reason from this post, because I still see the broken surface as I exported to pov file and rendered in povray.

For my problem I can't just remove the PlotPoints->20 option, because I have to generate the same kind of plots from a serial of data. And I have to set a PlotPoints to a number to make sure the contour can be found.

enter image description here

xslittlegrass
  • 27,549
  • 9
  • 97
  • 186
  • In Mathematica 8.0.4 InterpolatingFunction just does not work with your data: calling for example f[data[[1, {1, 2}]]] returns whole InterpolatingFunction unevaluated. – Alexey Popkov May 16 '14 at 17:27
  • @AlexeyPopkov I'm using version 9. It's quiet strange that it doesn't work in version 8. – xslittlegrass May 16 '14 at 20:58
  • Setting MaxRecursion -> 1 (along with PlotPoints -> 20) gives me an artifact-less graphic in 32-bit 9.0.1 (on Lubuntu 14.04, fwiw). I don't have an answer to your actual question (why it otherwise breaks), though. Possibly a bug in the adaptive sampling algorithm controlled by MaxRecursion... maybe worth a report to WRI Support? – William May 28 '14 at 02:06
  • I don't know why this happens, but maybe it's worth reminding you that RegionPlot3D works much faster and also doesn't show the artifacts (using e.g., PlotPoints->90), as I mentioned in this answer. – Jens Jun 20 '15 at 21:46

1 Answers1

5

I had a similar problem, try MaxRecursion-> 0 and increase PlotPoints. Hope it helps.

ContourPlot3D[
 Abs[f3d[x, y, z]]^2, {x, -15, 15}, {y, -15, 15}, {z, -15, 15}, 
 Mesh -> None, PlotPoints -> 50, Contours -> {1*^-6}, 
 ViewPoint -> {1.3, -1.3, 2.9}, ViewVertical -> {0.2, -1, 0.2}, 
 Axes -> False, Boxed -> False, ImageSize -> 300, MaxRecursion -> 0]

enter image description here

Karsten7
  • 27,448
  • 5
  • 73
  • 134
user91411
  • 400
  • 3
  • 11