Re: Aligning two PLots
- To: mathgroup at smc.vnet.net
- Subject: [mg94450] Re: Aligning two PLots
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Sun, 14 Dec 2008 07:34:26 -0500 (EST)
- Organization: University of Bergen
- References: <ghtjf8$ra8$1@smc.vnet.net>
Nikolaus Rath wrote: > Hello, > > I would like to align two plots horizontally, i.e. the tics on the x > axis should be exactly aligned. Example: > > Plot[Sin[x], {x, 0, 3 \[Pi]}] > Plot[5000 Sin[x], {x, 0, 3 \[Pi]}] > > in the output, the x axis of the second plot is more to the right than > the x-axis of the first plot (due to the wider labels on the y-axis). > > Is there a way to align these two plots exactly? > > Note that I do not want to have the two functions overlapping in one > plot, the two graphs should be well separated vertically. > I, too, would be very much interested in an easy and reliable way to do this ... What I currently do is set ImagePadding manually for both plots, like this: GraphicsColumn[ {Plot[Sin[x], {x, 0, 3 \[Pi]}, ImagePadding -> {{22, 5}, {5, 5}}], Plot[5000 Sin[x], {x, 0, 3 \[Pi]}, ImagePadding -> {{22, 5}, {5, 5}}]}] So why is this not a good way of aligning the plots? First, the ImagePadding values have to be figured out manually (so ticks will be visible). AbsoluteOptions doesn't seem to work with ImagePadding, so I can't just take the wider padding of the two plots and use that ... Second, even if ImagePadding is set correctly for one image size, it may have to be changed when the image is resized ...