3
$\begingroup$

OS: Windows Server 2012 R2

MMA Version: 10.3.0.0

Graphics3D[{Sphere[], Text[x^2 + y^2 + z^2 <= 1, {0, 0, 0}]}, 
           PlotRange -> {{0.5, 1}, {0.5, 1}, {-1, 1}}]

will give

text is outside the plot range

while I would like to expect the same behavior as Graphics:

Graphics[{Circle[], Text[x^2 + y^2 <= 1, {0, 0}]}, 
         PlotRange -> {{-0.04, 1.01}, {-0.05, 1}}]

which shows only part of the text:

only part of the text is shown

So can I make Graphics3D show texts only within the plot range (with MMA v10.3+)?

$\endgroup$
  • $\begingroup$ Why do you want to cut off text if it happens to be outside the frame? $\endgroup$ – David G. Stork Mar 11 '16 at 12:28
  • $\begingroup$ @DavidG.Stork I have a Graphics3D object and I want to have a "zoomed-in" version for some part of it. The texts outside will be annoying (they are hovering in the air without the graphics). $\endgroup$ – ziyuang Mar 11 '16 at 12:36
4
$\begingroup$

In Mma v9 the behavior was what you expected

Graphics3D[{Sphere[], Text[x^2 + y^2 + z^2 <= 1, {0, 0, 0}]}, 
 PlotRange -> {{0.5, 1}, {0.5, 1}, {-1, 1}}]

Mathematica graphics

Graphics3D[{Sphere[], Text[x^2 + y^2 + z^2 <= 1, {0.5, 0.7, 1}]}, 
 PlotRange -> {{0.5, 1}, {0.5, 1}, {-1, 1}}]

Mathematica graphics

In version 10, you need to use ImagePadding->None to reproduce this effect,

    Graphics3D[{Sphere[], Text[x^2 + y^2 + z^2 <= 1, {0, 0, 0}]}, 
       PlotRange -> {{0.5, 1}, {0.5, 1}, {-1, 1}}, 
       ImagePadding -> #] & /@ {Automatic, None}

Mathematica graphics

and

Graphics3D[{Sphere[], Text[x^2 + y^2 + z^2 <= 1, {0.5, 0.7, 1}]}, 
 PlotRange -> {{0.5, 1}, {0.5, 1}, {-1, 1}}, ImagePadding -> None]

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.