Mathematica: Text in Graphics3D relative to image coordinates
Asked Answered
A

1

6

Mathematica documentation states: "Text in three-dimensional graphics is placed at a position that corresponds to the projection of the point {x,y,z} specified. Text is drawn in front of all other objects". How do you position the text relative to the image size?

This is how it can be done in 2D:

custumLabels = Graphics[{
  Text[Style["A", Red, Bold, 18], ImageScaled[{0.025, .95}]], 
  Text[Style["B", Red, Bold, 18], ImageScaled[{0.95, .05}]]}
];
Framed[Show[
  Plot[
    Sin[x] Exp[x], {x, 0, 10},
    Frame -> True,
    PlotRangeClipping -> False,
    FrameLabel -> {"x", "y"}
  ],
  custumLabels
 ],
 FrameMargins -> 0]

Output

Those labels will always appear in that position as long as PlotRangeClipping is set to False. The question is, how do you make those labels appear at that particular position if I switch to Graphics3D. Try it with a simple one.

Framed[Show[
  Graphics3D[{Sphere[{0, 0, 0}, 1]}]
 ],
 FrameMargins -> 0]
Aetna answered 13/6, 2011 at 22:12 Comment(1)
That figure makes no sense. Another figure got the reference?Aetna
H
6

Epilog and Prolog in 3D use a scaled 2D coordinate system (for all primitives):

Graphics3D[{Sphere[]}, Epilog -> Text["abcdef", Scaled[{0.1, 0.1}]]]

enter image description here

Hydrogeology answered 13/6, 2011 at 22:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.