Re: Width of plots
- To: mathgroup at smc.vnet.net
- Subject: [mg65986] Re: [mg65930] Width of plots
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 25 Apr 2006 05:19:25 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Michael, The reason the y axes don't line up is indeed the tick labels. One way to correct the problem is to redefine the ticks so that both plots will have the same widths for the labels. Basically this is done with NumberForm and the NumberPadding option. So you can make up your own table of ticks but I would use the CustomTicks command from my DrawGraphics package. It provides the labeled and unlabeled ticks and allows the user to specify a number formatting function. Needs["DrawGraphics`DrawingMaster`"] f[x_] = Sin[x]; g[x_] = 1000*Sin[x]; yticks1 = CustomTicks[Identity, {-1, 1, 0.5, 5}, CTNumberFunction -> (NumberForm[#, {5, 1}, NumberPadding -> {" ", "0"}] &)]; yticks2 = CustomTicks[Identity, {-1000, 1000, 500.0, 5}, CTNumberFunction -> (NumberForm[#, {5, 1}, NumberPadding -> {" ", "0"}] &)]; p1 = Plot[f[x], {x, 0, 2Pi}, Ticks -> {Automatic, yticks1}, ImageSize -> 400]; p2 = Plot[g[x], {x, 0, 2Pi}, Ticks -> {Automatic, yticks2}, ImageSize -> 400]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Michael [mailto:chiller.michi at web.de] To: mathgroup at smc.vnet.net When making several plots, e.g. using f[x_] = Sin[x]; g[x_] = 1000*Sin[x]; p1 = Plot[f[x], {x, 0, 2Pi}, ImageSize -> 400]; p2 = Plot[g[x], {x, 0, 2Pi}, ImageSize -> 400]; the absolute position of the y-axes won't coincide despite the total image size being the same. This seems to be caused by the different width of the tick labels. Is there a possibility to rescale the images in such a way that the y-axes positions coincide in two different plots and the x-axes scale stays the same? Thanks for your help, Michael