I was wondering if its possible to make the following type of plot in Mathematica:

I would like to take a 3D object, such as an ellipsoid, and cut out a wedge. I know this can be done using SphericalPlot3D and only plotting through an azimuthal angle phi. But here's the tricky part. Usually, whats left is a hollow shell, but I want to make it seem as if its a solid object with the inside colored according to some function. So what you would see when you cut out the wedge is a flat surface colored according to some function.

If this is not possible with Mathematica, can anyone recommend a program where this may be done?

  • $\begingroup$ It can be done using RegionPlot3D. $\endgroup$
    – Jens
    Jul 3, 2013 at 4:02
  • $\begingroup$ What does the title have to do with the question? $\endgroup$
    – user484
    Jul 3, 2013 at 4:07
  • $\begingroup$ @RahulNarain: I agree, the title is misleading. $\endgroup$
    – Jens
    Jul 3, 2013 at 4:08
  • $\begingroup$ I'm sorry, I don't see what is misleading about the title. I want to make an isometric object with a plot inside of a cutout of it. I think the title us summarizes the question quite well. $\endgroup$ Jul 3, 2013 at 10:58
  • 3
    $\begingroup$ An "isometric" 3D drawing usually refers to a parallel projection with all three axes at 120º, as seen in old video games. Also, the title indicates nothing about cutting a wedge from a solid object and putting a plot inside the cut-out part. $\endgroup$
    – user484
    Jul 4, 2013 at 6:39

2 Answers 2


Here's a way using SphericalPlot3D.

The segment of the surface is closed by two polygons that are formed from vertices of the boundary of the surface plot. You have to repeat the PlotStyle explicitly for the Polygons. A similar approach works for ParametricPlot3D, too, provided the wedge of the surface is cut by planes (i.e. can be represented by planar polygons).

The idea is to sow the sample theta, phi values, recover them, and extract the boundaries. These can be remapped onto the surface and become the vertices of the polygons that form the angle of the wedge. The order of the vertices of the first polygon is reversed to get the right orientation (in case FaceForm is used, for example).

sph[r_, theta_, phi_] := r {Sin[theta] Cos[phi], Sin[theta] Sin[phi], Cos[theta]};

wedge = With[{r = 1 + Sin[5 phi]/5},
 Module[{plot, pts},
  {plot, {pts}} = Reap @ SphericalPlot3D[r, {theta, 0, Pi}, {phi, 0.5, 1.8}, 
       Mesh -> None, PlotStyle -> Yellow, EvaluationMonitor :> Sow[{theta, phi}]];
   Graphics3D[{Yellow, Polygon[
      Apply[Function @@ {{theta, phi}, sph[r, theta, phi]},
       {Reverse @ Sort @ Cases[pts, {_, Min[Last /@ pts]}], 
        Sort @ Cases[pts, {_, Max[Last /@ pts]}]},

Mathematica graphics

To get an isometric projection of the graphics, you can play with ViewMatrix. The key is to rotate a vector of the form $(\pm 1, \pm 1, \pm 1)$ to $(0,0,1)$ and project onto the first two coordinates. Translating and scaling will depend on the particular graphics, but perhaps the example below is sufficiently generalizable.

 ViewMatrix ->
       1.02 EuclideanDistance @@ Transpose[PlotRange /.
            AbsoluteOptions[wedge, PlotRange]] {{-1/2, 1/2}, {-1/2, 1/2}, {-1/2, 1/2}}] .
     RotationTransform[{{1, 1, 1}, {0, 0, 1}}] .
     TranslationTransform[-Mean /@ (PlotRange /. AbsoluteOptions[wedge, PlotRange])]

Mathematica graphics


Here is a possible approach for the filled inside of a spherical wedge. The rest of the work consists in choosing the elliptical shape with the desired eccentricities, and possibly drawing a solid shell on top of it:

RegionPlot3D[(EuclideanDistance[{x, y, z}, {0, 0, 0}] < 1 && 
   0 < ArcTan[x, y] < Pi/4), {x, -1, 1}, {y, -1, 1}, {z, -1, 1}, 
 Mesh -> False, PlotStyle -> Opacity[.5], PlotPoints -> 100]


To make the plot look isometric, just choose the ViewPoint far away, e.g., add ViewPoint -> {0, 1, 1000} to the options of RegionPlot3D.


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.