Suppose I am using SliceContourPlot3D to plot the contours of $x^2$ a sphere of radius $R$:

Module[{R, sphere},

 R = 1;
 sphere = x^2 + y^2 + z^2 == R^2;

 SliceContourPlot3D[x^2, sphere, {x, -1, 1}, {y, -1, 1}, {z, -1, 1}]


If $R=1$ this looks like:

Plot for R=1

If I set $R=0.1$ however the contour lines disappear: Plot for R=0.1

I can't find a way to get the contours to appear. Rescaling the function $x^2\rightarrow\frac{x^2}{R^2}$ doesn't do anything, neither does increasing the PerformanceGoal, number of Contours, or PlotPoints. How can I make the contours show up even for a small object?

  • 2
    $\begingroup$ Moreover, even the sphere becomes invisible if you will set R=0.001. The step of contours by default is big enough for your case. Try to add the Contours->{0.001} $\endgroup$
    – Rom38
    Jun 4 '18 at 6:34
  • 2
    $\begingroup$ add the options Contours->Range[-.01,.01,.0005], PlotPoints->100, and PlotRange->All? $\endgroup$
    – kglr
    Jun 4 '18 at 6:37
  • $\begingroup$ Thanks a lot Rom38 and kglr, manually setting the step size of the contours fixed it. $\endgroup$ Jun 4 '18 at 6:48
  • $\begingroup$ @chris, posted an answer. $\endgroup$
    – kglr
    Jun 4 '18 at 8:26

Adding the options PlotRange->All, PlotPoints->100, and Contours-> Range[-.1,.1,.01]^2 gives

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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