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


Groups > comp.soft-sys.math.mathematica > #12433 > unrolled thread

Plots combining

Started bykalaipiotrek@gmail.com
First post2012-11-23 08:35 +0000
Last post2012-11-24 07:28 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  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

#12433 — Plots combining

Fromkalaipiotrek@gmail.com
Date2012-11-23 08:35 +0000
SubjectPlots combining
Message-ID<k8ncg7$di9$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#12446

From"Chris Degnen" <degnen@cwgsy.net>
Date2012-11-24 07:28 +0000
Message-ID<k8psvi$is2$1@smc.vnet.net>
In reply to#12433
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
> 


[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web