Re: Bad Alignment of Y Axes

*To*: mathgroup at smc.vnet.net*Subject*: [mg37269] Re: [mg37250] Bad Alignment of Y Axes*From*: Tomas Garza <tgarza01 at prodigy.net.mx>*Date*: Mon, 21 Oct 2002 02:29:38 -0400 (EDT)*References*: <200210180917.FAA26102@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

The position of the plot in the cell is determined by option ImageMargins, and you may check that it is the same for both plots. But the plot includes the ticks along the axes, so the reason why the vertical axes are not aligned is that the ticks along them have different lengths, and this causes the position of each axis to move left or right, according to what is needed to include the ticks. You may check this by using the option Ticks->None in both plots. You'll see that the axes are now aligned. One possibility is to have the space assigned to the vertical ticks to be the same in both plots, and this may be achieved by using strings of the same length for the ticks, instead of letting them be automatically assigned. Try the following: In[1]:= Plot[Sin[x], {x, 0, 10}, Ticks -> {Automatic, {{-1, " -1"}, {-0.5, " -0.5"}, {0, " 0"}, {0.5, " 0.5"}, {1, " 1"}}}]; Plot[1000*Sin[x], {x, 0, 10}, Ticks -> {Automatic, {{-1000, " 1000"}, {-500, " -500"}, {0, " 0"}, {500, " 500"}, {1000, " 1000"}}}]; Here I left 5 positions as the maximum string length in both cases, corresponding to " -0.5" and "-1000", respectively. The vertical axes are now aligned. BTW, it is a relatively simple matter to construct the ticks without having to type a lot of stuff. Suppose t is the list of ticks you would like to have along the vertical axis, e.g.: In[2]:= t = Table[1000*j, {j, -1, 1, 0.25}]; In[3]:= tks = Transpose[{t, ToString /@ Round[t]}]; Then try In[4]:= Plot[Sin[x], {x, 0, 10}, Ticks -> {Automatic, {{-1, " -1"}, {-0.5, " -0.5"}, {0, " 0"}, {0.5, " 0.5"}, {1, " 1"}}}]; Plot[1000*Sin[x], {x, 0, 10}, Ticks -> {Automatic, tks}]; and you'll get an even nicer output. Tomas Garza Mexico City ----- Original Message ----- From: "Max Ulbrich" <ulbrich at biochem.mpg.de> To: mathgroup at smc.vnet.net Subject: [mg37269] [mg37250] Bad Alignment of Y Axes > Hi, > > I have 2 or more separate Plots which have different y but the same x > axes. > Like: > > Plot[Sin[x],{x,0,10}]; > Plot[1000Sin[x],{x,0,10}]; > > > At the display and printout, the y axes are not aligned. Even using the > PlotRegion and ImageSize Options doesn't help. The only way I found > was to align it manually with the mouse. > Is there a package that solves the problem? > The problem is, I have many, many plots to align... > I use Mathematica 4.0.2.0 on a Windows 2000 PC. > Who can help? > > Max > > Answers please to: > > ulbrich at biochem.mpg.de > > >

**References**:**Bad Alignment of Y Axes***From:*Max Ulbrich <ulbrich@biochem.mpg.de>

**Re: Again, How to speed up this calculation? and more**

**problem with Collect[] for long polynomial**

**Re: Bad Alignment of Y Axes**

**Re: Bad Alignment of Y Axes**