MathGroup Archive 2007

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

Search the Archive

Aligning Plots in V6

  • To: mathgroup at
  • Subject: [mg78308] Aligning Plots in V6
  • From: "David Park" <djmpark at>
  • Date: Thu, 28 Jun 2007 04:20:32 -0400 (EDT)

A question yesterday about plotting in Do loops and the answers do it got me 
to exploring the example a little more.

A common complaint in pre Version 6 graphics was the difficulty in aligning 
vertical plots on the x axes of the two plots. With new commands like 
GraphicsColumn and ImagePadding V6 makes this much easier. The alignment 
problem usually occurs when the ticks values and labels outside of the plot 
frame take up different spaces. By using ImageMargin to allow for sufficient 
space for each of the plots the problem is solved. ImageMargins are in 
printer points and may be specified for all sides of a plot. They must leave 
enough room for tick labels, frame labels and plot labels. For alignment you 
need the same ImageMargins for each plot.

Here is an example where the bottom plot has longer y tick values, and a y 
frame label that takes more space.

  Table[Plot[10^(2 n) Sin[x], {x, 0, 2*Pi},
    Frame -> True,
    FrameLabel -> {x, function/n},
    PlotLabel -> 10^(2 n) Sin[x],
    ImagePadding -> {{80, 15}, {35, 25}},
    Background -> ColorData["Legacy", "Linen"]],
   {n, 1, 2}],
  {{20, 20}, {20, 5, 20}},
  Background -> LightGreen,
  ImageSize -> 500],
 "Aligning Two Plots",
 {{Bottom, Left}}]

I added extra elements to the plot that a user might typically use. The 
plots appear to be aligned whether Left, Center, Right or Automatic is used 
for the GraphicsColumn alignment. The only small problem I find is that 
right hand side horizontal spacing after the plots seems to be slightly off 
and difficult to control exactly.

David Park
djmpark at

  • Prev by Date: Re: NonlinearRegress and errors on parameter fit
  • Next by Date: Background color for plot area (not whole graphic) and white
  • Previous by thread: Re: Power Spectrum 2D field
  • Next by thread: Re: Aligning Plots in V6