       Re: Aligning ListPlots

• To: mathgroup at smc.vnet.net
• Subject: [mg77174] Re: Aligning ListPlots
• From: Hugh <h.g.d.goyder at cranfield.ac.uk>
• Date: Tue, 5 Jun 2007 06:42:03 -0400 (EDT)
• References: <f40g51$5vj$1@smc.vnet.net>

On 4 Jun, 08:48, Jan Rychter <j... at rychter.com> wrote:
> 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.

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

http://forums.wolfram.com/mathgroup/archive/2007/May/msg00300.html

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}}]



• Prev by Date: Re: Evaluate, Replace, and Hold
• Next by Date: Re: Latex and \sum
• Previous by thread: Re: Aligning ListPlots
• Next by thread: Linear algebra and machine precision