2

This is a follow-up question to (138886).

According to this post, the proper way to export 3D graphics as vector graphics is by inserting them into a 2D regular Graphics as Inset. Now I want the graphics object and its inset to fit the 3D graphics precisely. The previous question was about a lot of white space that often appears around the object. This question is:

How can I set the size of the inset to fit the entire 3D graphics without cropping?

Ideally, a solution would preserve the original 3D graphics size, because things tend to shift and scale disproportionally while rescaling

Here is the example:

plot3d = Plot3D[100,
  {x, 0, 3}, {y, 0, .9},
  BoxRatios -> {3, .9, .5},
  ViewPoint -> {0, -Pi, 1.3},
  ImageSize -> {700, 220}
  ]

enter image description here

And here is what I tried:

Framed[Graphics[Inset[Framed@plot3d]]]

enter image description here

Framed[Graphics[Inset[Framed@plot3d], ImageSize -> {700, 220}]]

enter image description here

Framed[Graphics[Inset[Framed@plot3d]], 
 FrameMargins -> {{50, 50}, {-70, -70}}]

enter image description here

Framed[Graphics[
  Inset[Framed@plot3d, Automatic, Automatic, ImageScaled[1]]]]

enter image description here

Felix
  • 3,871
  • 13
  • 33

1 Answers1

2

You have to set the AspectRatio of the Graphics to be consistent with that of the initial Graphics3D, like in:

plot3d = Plot3D[100,
  {x, 0, 3}, {y, 0, .9},
  BoxRatios -> {3, .9, .5},
  ViewPoint -> {0, -Pi, 1.3},
  ImageSize -> {700, 220},
  PlotRange -> All
  ]
Framed @ Graphics[{Inset[Framed@plot3d2]}, AspectRatio -> .9/3, 
 ImageSize -> 700]

enter image description here

glS
  • 7,623
  • 1
  • 21
  • 61
  • Yes, thank you!! Do you know why AspectRatio is not already defined by setting width and height explicitly with ImageSize -> {700, 220}? It seems one really needs both. – Felix Mar 01 '17 at 14:59
  • @Felix not really I'm afraid. At first I too tried with only ImageSize -> {700, 220} expecting it to work, but to no avail. – glS Mar 01 '17 at 16:46