6

Bug persisting through 11.2.0


When I use ShrinkWrap to remove the white space around my 3D graphics, it always removes any text around the edges. Say for example I plot a sphere and some text:

Show[Graphics3D[{Sphere[], Text[Style["ABC", 24], {1, 1, 1}]}], Boxed -> False]

enter image description here

And if I use ShrinkWrap, it removed the text and part of the sphere

Show[Graphics3D[{Sphere[], Text[Style["ABC", 24], {1, 1, 1}]}], Boxed -> False,
 Method -> {"ShrinkWrap" -> True}]

enter image description here

How to prevent this?

Alexey Popkov
  • 61,809
  • 7
  • 149
  • 368
2ub
  • 301
  • 1
  • 8

1 Answers1

4

Try this to see if it works for you.

Show[Graphics3D[{Sphere[],Text[Style["ABC",24],{1,1,1}]}],
  Boxed->False,
  Method->{"ShrinkWrap"->True},
  ViewVector->{{9,2,2},{0,0,0}}
]

Mathematica graphics

Update

Using ImagePadding -> 0, PlotRangePadding -> 0 helps a little, as given by comment by Simon woods in method-shrinkwrap-messes-up-editting-graphics But the text is still missing, but sphere is not cropped.

Show[Graphics3D[{Sphere[],Text[Style["ABC",24],{1,1,1}]}],
Boxed->False,Method->{"ShrinkWrap"->True},
ImagePadding->0,PlotRangePadding->0]

Mathematica graphics

Nasser
  • 143,286
  • 11
  • 154
  • 359
  • (+1) Can you explain why specifying ViewVector helps in this case? – Alexey Popkov Nov 26 '17 at 06:58
  • 1
    @AlexeyPopkov I just noticed that by moving the image with the mouse did bring the text back. So by trial and error, this view vector was the best to show the text in this case. – Nasser Nov 26 '17 at 07:01
  • How do I know which specification for ViewVector to use though? Can it be done when there are multiple texts at several different margins? – 2ub Nov 26 '17 at 07:24
  • @L.Quen as I said, this was by trial and error for this case. This is just a workaround for the example you showed. This looks like a bug as was suggested. I could not find a general workaround for all cases at this time. The text is there. (you can see that by moving the image with the mouse). It is just that the view gets messed up and needs manual adjustment. – Nasser Nov 26 '17 at 07:25
  • OK thanks for the help – 2ub Nov 26 '17 at 07:27