3
$\begingroup$

Any way to get points obscured by SphericalPlot3D to show their Tooltip?

In the below example, Tooltips will appear when cursor moves over little spheres that are not obscured by the plot, but will not appear for spheres behind or within the SphericalPlot3D surface.

ttPoints = RandomReal[{-1, 1}, {15, 3}];
Show[
 Graphics3D[Tooltip[Sphere[2 #, .1], #] & /@ ttPoints]

, SphericalPlot3D[
  1.5 + .1 Sin[5 ϕ], {θ, 0, Pi}, {ϕ, 0, 2 Pi}
  , Mesh -> None
  , PlotStyle -> Opacity[.25]
  , BoxRatios -> {1, 1, 1}
  ]
]

Plotted Surface and small spheres

$\endgroup$
  • $\begingroup$ I'm using Version 12.0.0. on MacOS 10.13.6 $\endgroup$ – Brian Swift May 23 at 0:27
  • $\begingroup$ you need to provide an Epilog to override the 3D graphic, I believe. There is a post about geoplot and some city markings on a globe. I think that is what you want to do to overcome this! $\endgroup$ – CA Trevillian May 23 at 2:13
  • 1
    $\begingroup$ does Show[SphericalPlot3D[ 1.5 + .1 Sin[5 \[Phi]], {\[Theta], 0, Pi}, {\[Phi], 0, 2 Pi}, Mesh -> None, PlotStyle -> Opacity[.25], BoxRatios -> {1, 1, 1}], Graphics3D[{Sphere[ #, .1] & /@ ttPoints, Tooltip[Text["", #], #] & /@ ttPoints}], ImageSize -> 400] work in your version/os? $\endgroup$ – kglr May 23 at 4:09
3
$\begingroup$
  1. Remove Tooltip from Spheres and
  2. Add Tooltipped Text objects with the same coordinates using Tooltip[Text["", #], #] & /@ ttPoints

SeedRandom[1]
ttPoints = RandomReal[{-1, 1}, {15, 3}]; 
Show[ SphericalPlot3D[1.5 + .1 Sin[5 ϕ], {θ, 0, Pi}, {ϕ, 0, 2 Pi}, 
  Mesh -> None, PlotStyle -> Opacity[.25], BoxRatios -> {1, 1, 1}], 
 Graphics3D[{Sphere[#, .1] & /@ ttPoints, 
   Tooltip[Text["", #], #] & /@ ttPoints}]]

enter image description here

Note: This approach works in version 9 (Windows 64 bit). Cannot check if it works in later versions.

Note: Modified OP's example so that all spheres fall inside the spherical plot surface.

$\endgroup$
  • $\begingroup$ Thanks. Works fine on Version 12.0.0. on MacOS 10.13.6. $\endgroup$ – Brian Swift May 23 at 23:18
1
$\begingroup$

An alternative approach:

$Version

(* "12.0.0 for Mac OS X x86 (64-bit) (April 7, 2019)" *)

SeedRandom[1234];
ttPoints = RandomReal[{-1, 1}, {15, 3}] // Sort;

Manipulate[
 Column[{Show[
    Graphics3D[
     Transpose[
      {ReplacePart[
        ConstantArray[LightBlue, Length[ttPoints]],
        pt -> Red],
       Tooltip[Sphere[2 #, .1], #] & /@ ttPoints}]],
    SphericalPlot3D[1.5 + .1 Sin[5 ϕ],
     {θ, 0, Pi}, {ϕ, 0, 2 Pi},
     Mesh -> None,
     PlotStyle -> Opacity[.25],
     BoxRatios -> {1, 1, 1}],
    ImageSize -> Medium],
   ttPoints[[pt]]}],
 {{pt, 1, Point},
  Thread[Range[Length[ttPoints]] ->
    (NumberForm[#, {4, 1}] & /@ ttPoints)],
  ControlType -> RadioButtonBar}]

enter image description here

$\endgroup$
  • $\begingroup$ We could also do the same sort-of work around with an application of Epilog, no? It should, then, be possible to roll over the smaller spheres, and have the Tooltips appear in a single designated space! $\endgroup$ – CA Trevillian May 23 at 3:06

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.