MathGroup Archive 2012

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

Search the Archive

Re: Plots combining

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128771] Re: Plots combining
  • From: "Chris Degnen" <degnen at cwgsy.net>
  • Date: Sat, 24 Nov 2012 02:29:06 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k8ncg7$di9$1@smc.vnet.net>

ImagePadding will fix the sizes.  The precise amounts can be found,
thanks to a function from Szabolcs on StackExchange (1).
fig1 = Plot[x^2, {x, -2, 2}, Axes -> False, Frame -> True,
FrameLabel -> {{"Hej", "Hej hej"}, {"Hej hej", "Hej hej"}}];

fig2 = Plot[x^3, {x, -2, 2}, Axes -> False, Frame -> True,
FrameTicks -> {None}];

getPadding[g_] := Module[{im},
im = Image[Show[g, LabelStyle -> White, Background -> White]];
BorderDimensions[im]]

{p1h, p1v} = getPadding[fig1];
{p2h, p2v} = getPadding[fig2];
mh = Max /@ Transpose[{p1h, p2h}];
mv = Max /@ Transpose[{p1v, p2v}];

GraphicsGrid[{{Show[fig1, ImagePadding -> {mh, mv}],
Show[fig2, ImagePadding -> {mh, mv}]}}, ImageSize -> 700]


1. Ref. http://mathematica.stackexchange.com/a/8660/363


Piotr wrote:
>

> Dear All,
>
> for a long time I can not solve a simple problem with plots combining.
>
> I have two plots:
>
> fig1 = Plot[x^2, {x, -2, 2}, Axes -> False, Frame -> True,
>  FrameLabel -> {{"Hej", "Hej hej"}, {"Hej hej", "Hej hej"}}]
>
> fig2 = Plot[x^3, {x, -2, 2}, Axes -> False, Frame -> True,
>  FrameTicks -> {None}]
>
> I am trying to combine them with a following command
>
> GraphicsGrid[{{rys1, rys2}}]
>
> I do not know how to align these two frames and how to make their sizes to 
> be equeal.
>
> I would be grateful for a help.
>
> Regards,
>
> Piotr
> 





  • Prev by Date: Re: question about NIntegrate
  • Next by Date: How Can I Make A String Variable With Styled Text?
  • Previous by thread: Re: Plots combining
  • Next by thread: Model fitting