MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Plot axis length and size ratio (TwoPlot revive)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121552] Plot axis length and size ratio (TwoPlot revive)
  • From: matyigtm <matyigtm at gmail.com>
  • Date: Mon, 19 Sep 2011 07:06:43 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hi,

I want to combine two plots with the same "x" axis into one graphic.
Because the two plots have different magnitude, I choosed the "Inset"
command inside of one of the two plots. I want to put the two "y" axes
on left and right for the two plots, resp. (aka. TwoPlot)
My problem is that the two plots take different sizes when the numbers
written at the ticks on the "y" axis get different length, or when
AxesLabel is used. I've understood the the area of the plot is
extended by PlotRangePadding and with ImagePadding, but I cannot
retrieve the latter from the plots to get the right sizes.

The Inset command help a lot to position the origins of the two plots,
but its "size" parameter looses any relation to the coordinates used
in the plots.

The following example illustrates the problem, the hardcoded number
1.045 is to be programmed to give good results.

plt2 = Plot[x (x - 10) Cos[x], {x, 0, 10}, PlotStyle -> Red,
AxesOrigin -> {10, 0}, AxesStyle -> Red];
Plot[x Sin[x], {x, 0, 10},  Epilog -> Inset[plt2, {0, 0}, {0, 0}, 10 *
1.045]

Any idea to align the two plots is appreciated,
Matyi







  • Prev by Date: Re: namespaces
  • Next by Date: Re: (x - 1) or (-1 + x)
  • Previous by thread: Re: Changing excel table with Wolfram Mathematica
  • Next by thread: Re: Plot axis length and size ratio (TwoPlot revive)