3
$\begingroup$

I am trying to annotate a plot with text. The text is intentionally line wrapped, and I want it to be centered, so I am trying to use TextAlignment. However, when I do this, the text gets pushed way off of the location in the plot where it is supposed to appear.

A MWE is:

Show[
Graphics3D[Sphere[{-1,1.5,1}]],
Graphics3D[Sphere[{1,1.5,1}]],
Graphics3D[Text[Style["THIS IS TEST\nTEXT",Medium,Bold,TextAlignment->Center],{-1,1.5,1},{0,0},Background->Green]]
]

Output of code

This shows that the text has been moved far off of its background (although it is properly centering the two lines of text relative to one another, as desired).

How can I fix this?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.