       Re: Combining Plots with Different Ordinate Axes in

• To: mathgroup at smc.vnet.net
• Subject: [mg94969] Re: [mg94953] Combining Plots with Different Ordinate Axes in
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Thu, 1 Jan 2009 07:27:25 -0500 (EST)
• References: <200812311110.GAA13681@smc.vnet.net>

For instance,

range1 = {0, 1.9};
range2 = {2.5, 3.5};
map = Interpolation[Transpose@{range1, range2},
InterpolationOrder -> 1];

With[{range3 = Flatten@{x, range1},
top = {#, Round[map@#, 0.01]} & /@ Range[Sequence @@ range1, 0.5]},
p1 = Plot[Sin[x], range3, PlotStyle -> Red];
p2 = Plot[Cos[map@x], range3, PlotStyle -> Blue];
Show[p1, p2, PlotRange -> All, Axes -> False, PlotRange -> All,
Frame -> True,
FrameTicks -> {{Automatic, Automatic}, {Automatic, top}}]
]

??

Bobby

On Wed, 31 Dec 2008 05:10:51 -0600, Buz Barstow <buzb at mac.com> wrote:

> Hi All,
>
> I'd like to combine two plots in Mathematica that have different x
> axes, but have similar y axes.
>
> In the first plot, the x range runs from 0 to 1.9, while in the second
> plot the x values run from 2.5 to 3.5.
>
> I'd like to combine these plots together, and have one set of x values
> displayed on the top edge of a frame, and the other set of x values
> displayed on the bottom edge of the frame.
>
> Both plots can have a common y axis.
>
> Thanks! and all the best,
>
> --Buz
>
>
>

--
DrMajorBob at longhorns.com

• Prev by Date: Re: Test for composite digit
• Next by Date: Re: Stopping a running program
• Previous by thread: Re: Combining Plots with Different Ordinate Axes in
• Next by thread: Re: Combining Plots with Different Ordinate Axes in