I always thought it to be a big omission in Mathematica that there was

no facility for easily aligning multiple plots in a grid or column. Now,

with the arrival of Mathematica 6, we finally have GraphicsGrid,

GraphicsColumn and GraphicsRow!

But -- I find those are essentially useless. When I build a

GraphicsColumn composed of multiple ListPlots, the vertical axes are NOT

aligned. Instead, Mathematica chooses to align the text labels on the

axes. Because of this, examples in the manual look just fine, because

labels on all the graphs are of the same length. But if you have, say,

two ListPlots, and one has labels in the range 1..5 and the other in the

range 10,000..100,000, the vertical axes will not align and the whole

column will look bad.

Does anyone know of a solution to this?

thanks,

--J.

Look up ImagePadding in the help:

?ImagePadding

ImagePadding is an option for graphics functions that specifies what \

absolute extra padding should be left for extended objects such as \

thick lines and annotations such as tick and axis labels.

Here are two examples:

padding = {{80, 10}, {30, 10}};

GraphicsGrid[{{Plot[x^2, {x, 0, 5}, ImagePadding -> padding]}, {Plot[

100000 x^2, {x, 0, 5}, ImagePadding -> padding]}}]

GraphicsColumn[{Plot[x^2, {x, 0, 5}], Plot[100000 x^2, {x, 0, 5}]} /.

Graphics[a_, b_List] :> Graphics[a, Append[b, ImagePadding -> padding]]]

Carl Woll

Wolfram Research

I found one solution in V6 which I posted in May at

http://www.yqcomputer.com/

and discussed various plots and one trick. Please look at this post.

The difficulty with formatting multiple plots is that the space for

numbers and text

must be given in the text units of points (with 72 points per inch)

while the

coordinates making up the plot use their own coordinate units.

Below is a solution for ListPlot

Hugh Goyder

d1 = Table[{x, Sin[x]}, {x, 0, 5*Pi, Pi/10}];

d2 = Table[{x, 10^5*Cos[x]}, {x, 0, 5*Pi, Pi/10}];

Graphics[{Inset[ListPlot[d1, PlotRange -> {{0, 5*Pi}, {-1, 1}},

PlotRangePadding -> {None, None},

BaseStyle -> {FontFamily -> "Times", FontSize -> 12},

Frame -> True, Axes -> False,

FrameLabel -> {None, "Amplitude 1"}, AspectRatio -> 2/5,

ImagePadding -> {{72, 1}, {24, 12}}], {0,

2.3333*72}, {0, -1}, 6*72],

Inset[ListPlot[d2, PlotRange -> {{0, 5*Pi}, {-10^5, 10^5}},

PlotRangePadding -> {None, None},

BaseStyle -> {FontFamily -> "Times", FontSize -> 12},

Frame -> True, Axes -> False,

FrameLabel -> {"Time", "Amplitude 2"}, AspectRatio -> 2/5,

ImagePadding -> {{72, 1}, {48, 12}}], {0, 0}, {0, -10^5},

6*72]},

PlotRange -> {{0, 5*72}, {0, 4.3333*72}}, AspectRatio -> 4.3333/5,

ImageSize -> 6*72,

ImagePadding -> {{72, 1}, {48, 12}}]

I'd like to thank everyone for the helpful answers. I will be working on

creating my own function that aligns my ListPlots properly.

However, I find one thing very puzzling: why in the world do we have to

do this kind of thing manually ourselves? Or, in other words, how is the

current behavior of aligning plots in GraphicsGrids useful to anyone?

I find it hard to imagine a scenario where you would not want your axes

to be perfectly aligned.

--J.

creating my own function that aligns my ListPlots properly.

However, I find one thing very puzzling: why in the world do we have to

do this kind of thing manually ourselves? Or, in other words, how is the

current behavior of aligning plots in GraphicsGrids useful to anyone?

I find it hard to imagine a scenario where you would not want your axes

to be perfectly aligned.

--J.

1. I have 'align left' and 'align centre' on tool bar I need align ri

2. Aligning decimal numers to the centre of the cell and aligning dec

3. MSB aligned - LSB aligned (DSP)

4. text-align left AND text-align-right in same container (on same line)

5. 2 lists: 1 left aligned and 1 right aligned on same line

6. Aligning already aligned math formulas in tabular environment

7. align on the right on an align environment possible?

8. Align Left, Align Right, Center, Justify

9. align right problems everything aligns right not selction

10. align text left and align text right: on the same line

11. align left and align right, on a single line

12. 4 byte aligned shared object / 8byte aligned application

13. div align="center" - Centre aligning text, not supposed to... why?

14. align left and align right buttons greyed out

15. How do I centre align a left aligned anchored picture?

5 post • Page:**1** of **1**