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.
Manipulate[
 SphericalPlot3D[{1, 2 - n}, {θ, 0, Pi}, {ϕ, 0, 1.5 Pi}, 
  Mesh -> None, PlotPoints -> 15, PlotRange -> {-2.2, 2.2}], {n, 0, 
  1}]

I cant' seem to be able to make a filling between two spheres. I've already tried the obvious Filling -> {1 -> {2}} but Mathematica doesn't seem to like that option. Is there any easy way around this or ...

share|improve this question
    
Possible duplicate: mathematica.stackexchange.com/q/14954/121 -- actually that one doesn't specifically relate to SphericalPlot3D and I can see that the solution may be a bit involved. –  Mr.Wizard Feb 9 at 17:59
add comment

2 Answers

up vote 7 down vote accepted

There is no built-in filling in SphericalPlot3D. One option is to use ParametricPlot3D to draw the surfaces between the two shells:

Manipulate[
 Show[SphericalPlot3D[{1, 2 - n}, {θ, 0, Pi}, {ϕ, 0, 1.5 Pi}, 
  PlotPoints -> 15, PlotRange -> {-2.2, 2.2}],
  ParametricPlot3D[{
    r {Sin[t] Cos[1.5 Pi], Sin[t] Sin[1.5 Pi], Cos[t]},
    r {Sin[t] Cos[0 Pi], Sin[t] Sin[0 Pi], Cos[t]}},
   {r, 1, 2 - n}, {t, 0, Pi}, PlotStyle -> Yellow, Mesh -> {2, 15}]],
  {n, 0, 1}]

enter image description here

share|improve this answer
    
It's a real bumer that there is no built in function, but thanks to kind and skillful people like you there is always a solution! :) –  user 3 50 Feb 9 at 20:21
add comment

Using RegionPlot3D is the easiest way to do it.

Manipulate[
Show[RegionPlot3D[1 <= x^2 + y^2 + z^2 <= (2 - n)^2 && (y >= 0 || x <= 0), {x, -2.2, 
2.2}, {y, -2.2, 2.2}, {z, -2.2, 2.2}, Mesh -> None, 
PlotPoints -> 50]], {n, 0, 1}];

enter image description here

You may want to render it before manipulating to avoid the recalculation, specially if you want better resolution.

share|improve this answer
    
Thank you very much for your answer! :) –  user 3 50 Feb 9 at 20:20
add comment

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.