1

If this is trivial or a duplicate I apologize. I failed to find something.

I have the following code

g1 = Graphics3D[{Gray, Specularity[White, 60], Opacity[0.5], 
      Scale[#, {10, 3, 2}], Opacity[1], Scale[#, {.001, 3, 2}]} &@
    Sphere[], Axes -> True];
g2 = Graphics3D[{Thick, {Arrowheads[Medium], 
     Arrow[{{0, 0, 0}, {10, 0, 0}}], Arrow[{{0, 0, 0}, {0, 0, 2}}], 
     Arrow[{{0, 0, 0}, {0, -3, 0}}]}}];
Rasterize[
 Show[{g1, g2}, Boxed -> False, Axes -> False, ImagePadding -> None, 
  ImageMargins -> None, 
  PlotRange -> {{-10.1, 10.1}, {-3.1, 3.1}, {-2.1, 2.1}}, 
  ImageSize -> 600, Lighting -> "Neutral"], ImageResolution -> 200]

which produces the following figure. enter image description here

When I insert this figure in Latex I take something likeenter image description here

As you see there is a lot of space between the caption and the figure. How is it possible to decrease these "white margins"? In order to be more clear see the following figure. enter image description here

Thanks.

Dimitris
  • 4,794
  • 22
  • 50

1 Answers1

1

The following will do what I wanted (thanks to @Kuba and @J.M.)

g1 = Graphics3D[{Gray, Specularity[White, 60], Opacity[0.5], 
      Scale[#, {10, 3, 2}], Opacity[1], Scale[#, {.001, 3, 2}]} &@
    Sphere[], Axes -> True];
g2 = Graphics3D[{Thick, {Arrowheads[Medium], 
     Arrow[{{0, 0, 0}, {10, 0, 0}}], Arrow[{{0, 0, 0}, {0, 0, 2}}], 
     Arrow[{{0, 0, 0}, {0, -3, 0}}]}}];
Rasterize[
 Show[{g1, g2}, Boxed -> False, Axes -> False, ImagePadding -> None, 
  ImageMargins -> None, 
  PlotRange -> {{-10.1, 10.1}, {-3.1, 3.1}, {-2.1, 2.1}}, 
  ImageSize -> 600, Lighting -> "Neutral", 
  Method -> {"ShrinkWrap" -> True}], ImageResolution -> 300]

or

g1 = Graphics3D[{Gray, Specularity[White, 60], Opacity[0.5], 
      Scale[#, {10, 3, 2}], Opacity[1], Scale[#, {.001, 3, 2}]} &@
    Sphere[], Axes -> True];
g2 = Graphics3D[{Thick, {Arrowheads[Medium], 
     Arrow[{{0, 0, 0}, {10, 0, 0}}], Arrow[{{0, 0, 0}, {0, 0, 2}}], 
     Arrow[{{0, 0, 0}, {0, -3, 0}}]}}];
ImageCrop[
 Rasterize[
  Show[{g1, g2}, Boxed -> False, Axes -> False, ImagePadding -> None, 
   ImageMargins -> None, 
   PlotRange -> {{-10.1, 10.1}, {-3.1, 3.1}, {-2.1, 2.1}}, 
   ImageSize -> 600, Lighting -> "Neutral", 
   Method -> {"ShrinkWrap" -> True}], ImageResolution -> 300]]

Both result to the same output.

enter image description here

Dimitris
  • 4,794
  • 22
  • 50