0
$\begingroup$

This question already has an answer here:

The following code plots 3 cuboids, each with a label at the lower left vertex. The label is meant to be part of the cuboid object. Yet, since Text[] is used to display the label, the label "1" does not hide with cuboid #1 from the default view point.

Mathematica description of Text[] specifically calls out that

"Text is drawn in front of all other objects."

Is there a way to display labels truly with their respective objects, so that they show or hide with their respective objects?

centers = Table[{Cos[2 k], Sin[2 k], 0.5 k }, {k, 3}];  
setOfCuboids =
  Table[{Graphics3D[Cuboid[centers[[k]]]],
         Graphics3D[Text[k, centers[[k]]]]},
    {k, 1, 3}];  
Show[setOfCuboids]
$\endgroup$

marked as duplicate by Kuba, Yves Klett, Artes, C. E., Michael E2 Dec 15 '13 at 2:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

migrated from math.stackexchange.com Dec 14 '13 at 23:20

This question came from our site for people studying math at any level and professionals in related fields.

  • $\begingroup$ I'm suggesting this be moved to Mathematica.SE. $\endgroup$ – Nicholas R. Peterson Dec 14 '13 at 19:12
  • $\begingroup$ Inset is what you are looking for. $\endgroup$ – Kuba Dec 14 '13 at 23:22