Skip to main content
added 282 characters in body
Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

There's no clean way to do this without re-creating the box and axes yourself. So here is how far I managed to get by just abusing Inset:

Show[RegionPlot3D[
  x^2 + y^3 - z^2 > 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
  Boxed -> True, Axes -> True, BoxRatios -> Automatic], Graphics3D[
  Inset[
   Graphics[
    Inset[
     Graphics3D[Sphere[{0, 0, 0}], 
      PlotRange -> {{-1, 1}, {-1, 10}, {-1, 1}}, Boxed -> False, 
      Axes -> False], {0, 0}]], {0, -2, 0}]], PlotRange -> All]

sphere

The first Inset is inside the 3D view, positioned at the edge of the plot range. Inside of it is a 2D Graphics containing another 3D Inset that has the sphere in it, with a PlotRange specification that places the sphere off-center, shifted outside of the original PlotRange.

The sphere does rotate together with the main box as part of the 3D scene, but its alignment isn't very easy to control - I needed some trial and error. Also, the box lines are always shown in front of the Inset, and I don't think there's any option to turn that behavior off.

There's no clean way to do this without re-creating the box and axes yourself. So here is how far I managed to get by just abusing Inset:

Show[RegionPlot3D[
  x^2 + y^3 - z^2 > 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
  Boxed -> True, Axes -> True, BoxRatios -> Automatic], Graphics3D[
  Inset[
   Graphics[
    Inset[
     Graphics3D[Sphere[{0, 0, 0}], 
      PlotRange -> {{-1, 1}, {-1, 10}, {-1, 1}}, Boxed -> False, 
      Axes -> False], {0, 0}]], {0, -2, 0}]], PlotRange -> All]

sphere

The first Inset is inside the 3D view, positioned at the edge of the plot range. Inside of it is a 2D Graphics containing another 3D Inset that has the sphere in it, with a PlotRange specification that places the sphere off-center, shifted outside of the original PlotRange.

There's no clean way to do this without re-creating the box and axes yourself. So here is how far I managed to get by just abusing Inset:

Show[RegionPlot3D[
  x^2 + y^3 - z^2 > 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
  Boxed -> True, Axes -> True, BoxRatios -> Automatic], Graphics3D[
  Inset[
   Graphics[
    Inset[
     Graphics3D[Sphere[{0, 0, 0}], 
      PlotRange -> {{-1, 1}, {-1, 10}, {-1, 1}}, Boxed -> False, 
      Axes -> False], {0, 0}]], {0, -2, 0}]], PlotRange -> All]

sphere

The first Inset is inside the 3D view, positioned at the edge of the plot range. Inside of it is a 2D Graphics containing another 3D Inset that has the sphere in it, with a PlotRange specification that places the sphere off-center, shifted outside of the original PlotRange.

The sphere does rotate together with the main box as part of the 3D scene, but its alignment isn't very easy to control - I needed some trial and error. Also, the box lines are always shown in front of the Inset, and I don't think there's any option to turn that behavior off.

Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

There's no clean way to do this without re-creating the box and axes yourself. So here is how far I managed to get by just abusing Inset:

Show[RegionPlot3D[
  x^2 + y^3 - z^2 > 0, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
  Boxed -> True, Axes -> True, BoxRatios -> Automatic], Graphics3D[
  Inset[
   Graphics[
    Inset[
     Graphics3D[Sphere[{0, 0, 0}], 
      PlotRange -> {{-1, 1}, {-1, 10}, {-1, 1}}, Boxed -> False, 
      Axes -> False], {0, 0}]], {0, -2, 0}]], PlotRange -> All]

sphere

The first Inset is inside the 3D view, positioned at the edge of the plot range. Inside of it is a 2D Graphics containing another 3D Inset that has the sphere in it, with a PlotRange specification that places the sphere off-center, shifted outside of the original PlotRange.