MathGroup Archive 2011

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

Search the Archive

Re: Plot axis length and size ratio (TwoPlot revive)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121668] Re: Plot axis length and size ratio (TwoPlot revive)
  • From: Armand Tamzarian <mike.honeychurch at gmail.com>
  • Date: Sat, 24 Sep 2011 22:35:08 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j5781h$jac$1@smc.vnet.net>

On Sep 19, 9:11 pm, matyigtm <matyi... at gmail.com> wrote:
> 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

There is this:

http://library.wolfram.com/infocenter/MathSource/7507/

which is for DateListPlot for could be modified for other plot types.
On one hand it is a lazy way of doing it because you create individual
plots and extract the info. On the other hand you can also combine bar
charts with your plots -- i..e like typical economic article plots
that combine a bar chart and line chart.

There is a tech conference coming up soon. Maybe people can ask for
this to be built in.

Mike




  • Prev by Date: Manipulate for differences tables. Can I call as function?
  • Next by Date: Re: Arbitrary vector
  • Previous by thread: Re: Plot axis length and size ratio (TwoPlot revive)
  • Next by thread: Re: Plot axis length and size ratio (TwoPlot revive)