1
$\begingroup$

I have the following image:

enter image description here

Where I use Show to plot the Sun, created with BubbleChart3D, and the two concentric spheres with axes, generated using SphericalPlot3D.

I've tried using Method -> {"AxesInFront" -> False} as suggested here but this did not work.

My other option is to try and make the axis transparent just in the region where the Sun is plotted, but I haven't found a way to do this yet.

Is there any known way to ensure that the sun object gets plotted above the axis?

Code: Shell and axis

shells = SphericalPlot3D[{6, 10}, {\[Theta], 0, Pi}, {\[Phi], 0, 
   2 Pi},  Mesh -> None, PlotPoints -> 50, ImageSize -> Large, 
  Boxed -> False, AxesOrigin -> {0, 0, 0},
  PlotStyle -> {Directive[Gray, Opacity[0.1]], 
    Directive[Gray, Opacity[0.05]]},
  PlotRange -> {{-14, 14}, {-14, 14}, {-14, 14}},
  AxesLabel -> {"\!\(\*SubscriptBox[\(x\), \(g\)]\) [kpc]", 
    "\!\(\*SubscriptBox[\(y\), \(g\)]\) [kpc]", 
    "\!\(\*SubscriptBox[\(z\), \(g\)]\) [kpc]"},
  AxesStyle -> Directive[Black, Bold, 15],
  LabelStyle -> Directive[Black, Bold, 15],
  Ticks -> {{{-0.75, "\[Pi]/4", 0}, 6, {-8, "Sun", 0}, 
     10}, {}, {}, {}},
  TicksStyle -> Directive[{Opacity[1]}]
  ]

Sun

sun = BubbleChart3D[{{-8, 0, 0, 4}}, 
  PlotRange -> {{-11, 11}, {-11, 11}, {-11, 11}}, 
  BoxRatios -> {1, 1, 1}, 
  ChartElementFunction -> (Ellipsoid[#2[[;; 3]], 
      0.1 #2[[4]] {1, 1, 1/0.6/GoldenRatio}] &),
  Boxed -> False,
  Axes -> False,
  FaceGrids -> None
  ]

Show

Show[{shells, sun}, Method -> {"AxesInFront" -> False}]

Note: Show[{sun, shells}] removes the axes altogether.

$\endgroup$

2 Answers 2

4
$\begingroup$

I think it is easier to adapt the graphics to your needs if you use basic commands instead of high level constructs:

Graphics3D[{
  {Gray, Opacity[0.05], Ball[{0, 0, 0}, 10]},
  {Gray, Opacity[0.1], Ball[{0, 0, 0}, 6]},
  Thickness[0.005], 
  Line[{{{-14, 0, 0}, {14, 0, 0}}, {{0, -14, 0}, {0, 14, 0}}, {{0, 
      0, -14}, {0, 0, 14}}}],
  Line[{{{6, 0, 0}, {6, 0, -0.5}}, {{10, 0, 0}, {10, 0, -0.5}}}],
  Style[Text["\!\(\*SubscriptBox[\(x\), \(g\)]\) [kpc]", {15, 0, 1}], 
   12, Bold], 
  Style[Text["\!\(\*SubscriptBox[\(y\), \(g\)]\) [kpc]", {0, 15, 1}], 
   12, Bold], 
  Style[Text["\!\(\*SubscriptBox[\(y\), \(g\)]\) [kpc]", {0, 0, 15}], 
   12, Bold],
  Style[Text["\[Pi]/4", {-1, 0, 1}], 12, Bold],
  Style[Text["Sun", {-10, 0, -2}], 12, Bold],
  {RGBColor[1, 0.8, 0], Ball[{-8, 0, 0}, 0.6]}
  }, Boxed -> False]

enter image description here

$\endgroup$
3
  • $\begingroup$ I only shared a part of the graphic. The full one has some more complicated 3D elements, although this does give me some new ideas to try and solve the issue, and does solve the problem as stated, so thank you very much! $\endgroup$
    – asorlik
    Sep 22 at 19:53
  • $\begingroup$ Also, when I copy this exactly to my notebook it plots the sphere behind the line element... $\endgroup$
    – asorlik
    Sep 22 at 20:01
  • $\begingroup$ MAking the ball larger should help. Try: Ball[{-8, 0, 0}, 0.8] $\endgroup$ Sep 22 at 20:25
0
$\begingroup$

Thanks to Daniel Huber for the inspiration. I ended up making separate lines on either side of my Sun object as follows

newroi = Graphics3D[{
   {Gray, Opacity[0.05], Ball[{0, 0, 0}, 10]}, {Gray, Opacity[0.1], 
    Ball[{0, 0, 0}, 6]}, Thickness[0.0009], 
   Line[{{{-12, 0, 0}, {-8.25, 0, 0}}, {{0, -12, 0}, {0, 12, 0}}, {{0,
        0, -12}, {0, 0, 12}}}],
   Line[{{{-7.7, 0, 0}, {12, 0, 0}}, {{0, 0, 0}, {0, 0, 0}}, {{0, 0, 
       0}, {0, 0, 0}}}], 
   Line[{{{6, 0, 0}, {6, 0, -0.5}}, {{10, 0, 0}, {10, 0, -0.5}}}], 
   Style[Text[
     "\!\(\*SubscriptBox[\(x\), \(g\)]\) [kpc]", {13, 0, -0.5}], 25], 
   Style[Text[
     "\!\(\*SubscriptBox[\(y\), \(g\)]\) [kpc]", {0, 13, 0.5}], 25], 
   Style[Text[
     "\!\(\*SubscriptBox[\(z\), \(g\)]\) [kpc]", {0, -1, 13.2}], 25], 
   Style[Text["\[Pi]/4", {-1, 0, 0.7}], 20], 
   Style[Text["6", {6, 0, 0.5}], 20], 
   Style[Text["10", {10, 0, 0.5}], 20],
   Style[Text["Sun", {-8, 0, -1.3}], 20],
   {Opacity[0.2], EdgeForm[None], 
    Cone[{{-11, 0, 0}, {0, 0, 0}}, 11]},
   {RGBColor[1, 0.8, 0], Ball[{-8, 0, 0}, 0.3]}
   },
  Boxed -> False]

With the result enter image description here

$\endgroup$

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.