Re: Inset headache
- To: mathgroup at smc.vnet.net
- Subject: [mg85783] Re: Inset headache
- From: m.r at inbox.ru
- Date: Fri, 22 Feb 2008 05:01:29 -0500 (EST)
- References: <fphdkk$946$1@smc.vnet.net>
On Feb 20, 8:31=A0am, Yves Klett <yves.kl... at googlemail.com> wrote:
> Hi everyone,
>
> consider:
>
> g1=Graphics3D[Cylinder[{{0, 0, 0}, {10, 0, 0}}, 1]]
> g2=Graphics[Inset[g1]]
>
> I would like to have g2 the same aspect ratio and image size as g1, so
> that the resulting graphics look just the same (but as an Inset). Inset
> somehow mangles the aspect ratio and sometimes cuts off parts of g1,
> depending on the additional values for {pos,opos&size}.
>
> Can anyone give me a hint on how to achieve an equally-looking g2 using
> Inset?
>
> Regards,
> Yves
A bit weird, but you can use pixel dimensions obtained from Rasterize:
g1 = Graphics3D[Cylinder[{{0, 0, 0}, {10, 0, 0}}, 1]]
{w, h} = Take[#, 2]&@ Rasterize[g1, "BoundingBox"];
Graphics[Inset[g1, Scaled@ {.5, .5}, Automatic, Offset@ {w, h}],
ImageSize -> {w, h}]
Maxim Rytin
m.r at inbox.ru