Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12446

Re: Plots combining

From "Chris Degnen" <degnen@cwgsy.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Plots combining
Date 2012-11-24 07:28 +0000
Message-ID <k8psvi$is2$1@smc.vnet.net> (permalink)
References <k8ncg7$di9$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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
> 


Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Plots combining kalaipiotrek@gmail.com - 2012-11-23 08:35 +0000
  Re: Plots combining "Chris Degnen" <degnen@cwgsy.net> - 2012-11-24 07:28 +0000

csiph-web