MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Inset a 3D Graphic

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82171] Inset a 3D Graphic
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 13 Oct 2007 04:05:18 -0400 (EDT)

I find it difficult to Inset a Graphic3D image into Graphics2D and obtain 
precise size and spacings. In general I want to Inset several graphics into 
precise spaces with precise spacings between the various Insets. However, as 
an example I will use a single Inset that I want centered in a Graphics2D 
image.

Here is the Graphics3D to be Inset.

plot1 = Graphics3D[Sphere[],
  ImageSize -> {300, 300},
  AspectRatio -> Automatic,
  Background -> LightBrown]

This overall image appears to me to be perfectly square. Now here is an 
Inset construction that works. The image is 10 x 10 centered in a 12 x 12 
plot region. Normally I wouldn't have a Frame, but I include one to make it 
easy to check the alignment.

Graphics[
 {Inset[plot1, {6, 6}, {Center, Center}, {10, 10}]},
 PlotRange -> {{0, 12}, {0, 12}},
 Background -> Orange,
 Frame -> True,
 ImageSize -> 400]

However, there should be various ways of doing this, and my first attempts 
involved aligning the lower left corner of the Graphics3D image with the 
position {1,1} in the 2D graphics. First I tried using ImageScaled to 
specify the position in the Graphics3D image.

Graphics[
 {Inset[plot1, {1, 1}, ImageScaled[{0, 0}], {10, 10}]},
 PlotRange -> {{0, 12}, {0, 12}},
 Background -> Orange,
 Frame -> True,
 ImageSize -> 400]

That does not work at all. The vertical alignment is correct, but the 
horizontal alignment is way off. It seems like a bug to me, but maybe I 
don't understand ImageScaled. So I also tried:

Graphics[
 {Inset[plot1, {1, 1}, {Left, Bottom}, {10, 10}]},
 PlotRange -> {{0, 12}, {0, 12}},
 Background -> Orange,
 Frame -> True,
 ImageSize -> 400]

with the same undesired result. If I try to align on the upper right hand 
corner the horizontal alignment is again off.

Graphics[
 {Inset[plot1, {11, 11}, ImageScaled[{1, 1}], {10, 10}]},
 PlotRange -> {{0, 12}, {0, 12}},
 Background -> Orange,
 Frame -> True,
 ImageSize -> 400]

Using the center point again with ImageScaled the alignment does work.

Graphics[
 {Inset[plot1, {6, 6}, ImageScaled[{0.5, 0.5}], {10, 10}]},
 PlotRange -> {{0, 12}, {0, 12}},
 Background -> Orange,
 Frame -> True,
 ImageSize -> 400]


It seems that the only reliable point for alignment of a 3D graphic is the 
center point of the image. One can waste a lot of time trying something 
else.

-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/




  • Prev by Date: Re: How Import data from Excel and make a list of numbers
  • Next by Date: Re: Re: What is the purpose of the Defer Command?
  • Previous by thread: Re: Programming Euler's Method into Mathematica
  • Next by thread: Custom Control of Axes and Plot Labels in 2D and 3D Plots