MathGroup Archive 2008

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

Search the Archive

[M6] Aligning graphics on frame boundaries

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84894] [M6] Aligning graphics on frame boundaries
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Fri, 18 Jan 2008 05:48:20 -0500 (EST)

I would like to align two plots on their frame boundaries.  What is a 
good way of doing this?

Currently I'm using the following (not very good) method:

Consider these two plots, one labelled and one unlabelled:

gr1 = Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True,
   FrameLabel -> {"x", "sin x"}]
gr2 = Plot[Cos[x], {x, 0, 2 Pi}, Frame -> True]

When combined like this, the graphics are not aligned:

GraphicsColumn[{gr1, gr2}]

So I set the same ImagePadding on both to align them:

GraphicsColumn[{Show[gr1, ImagePadding -> {{50, 5}, {5, 5}}],
   Show[gr2, ImagePadding -> {{50, 5}, {5, 5}}]}]

But I would like to align them automatically, if possible, so I thought 
that I could get the actual ImagePadding values that are automatically 
determined by Mathematica when ImagePadding -> All, and use the greatest 
value for all plots.  But, as with some of the other graphics options in 
Mathematica 6, AbsoluteOptions refuses to tell me the actual numerical 
values:

In[13]:= AbsoluteOptions[gr1, ImagePadding]
Out[13]= {ImagePadding -> All}

I'm looking for suggestions for getting the actual ImagePadding values, 
or, preferably, for a better and simpler method of automatically 
aligning plots on frame boundaries.

Szabolcs


  • Prev by Date: Do -like iteration construct with parallel steps?
  • Next by Date: Re: Putting an expression into a module
  • Previous by thread: Re: Do -like iteration construct with parallel steps?
  • Next by thread: Re: Strange interaction between local symbols of a proc inside the