Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
    
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? –  billisphere May 28 '14 at 2: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 at 21:46

1 Answer 1

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

share|improve this answer
1  
@bbgodfrey At least I think it's a clue as to why... the recursive subdivisions seem to create an incorrect mesh. –  Jens Jun 20 at 21:50
    
@bb, it's a workaround, so an admissible answer in my book, even if it (was) terse. –  Guess who it is. Jun 21 at 0:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.