Re: Re: plotting two functions on the one graph
- To: mathgroup at smc.vnet.net
- Subject: [mg53146] Re: [mg53114] Re: plotting two functions on the one graph
- From: DrBob <drbob at bigfoot.com>
- Date: Sat, 25 Dec 2004 04:00:41 -0500 (EST)
- References: <18tzsc73qtgb@legacy> <200412241059.FAA05787@smc.vnet.net>
- Reply-to: drbob at bigfoot.com
- Sender: owner-wri-mathgroup at wolfram.com
Here's another option:
Needs["Graphics`Colors"] (* unnecessary in version 5.1 *)
SF = 10;
f = Plot[Sin[x], {x, 0, Pi}, DisplayFunction -> Identity];
g = Plot[Exp[x]/SF, {x, 0, Pi}, DisplayFunction -> Identity, PlotStyle -> {{
Red, Thickness[.01]}}];
Show[{f, g}, DisplayFunction -> $DisplayFunction, Frame -> True,
FrameTicks -> {PiScale,
Automatic, None, UnitScale[
0, Exp[Pi]/SF, 1/SF] /. {y_Real, label_} -> {y, SF label, .02, {
Red, Thickness[.01]}}}];
or (somewhat simpler):
DisplayTogether[Plot[Sin[x], {x,
0, Pi}],
Plot[Exp[x]/SF, {x, 0, Pi}, PlotStyle -> {{Red, Thickness[.01]}}],
Frame -> True, FrameTicks -> {
PiScale, Automatic, None,
UnitScale[0,
Exp[Pi]/SF, 1/SF] /. {
y_Real, label_} -> {y, SF label, .02, {Red, Thickness[.01]}}
}
]
Bobby
On Fri, 24 Dec 2004 05:59:00 -0500 (EST), Narasimham <mathma18 at hotmail.com> wrote:
>
>
> On 15 Dec 04 10:24:47 -0500 (EST), Frank Murphy wrote:
>> siafra at vaxsa.csied.unisa.it wrote:
>
>> how can I plot two functions f(x), g(x) with the same x range on
>> two different y-axes, say the one for f(x) at left and the one
>> for g(x) at right ?
>
> Plots (one or more) are usually made to compare quantities of the same
> order of magnitude, so Mathematica has such a default plotting
> feature. If there are big differences, either use a LogPlot or use a
> scale factor SF in multiples of 10 to divide out the larger quantity
> bringing it at par with the others for comparable plots.
>
> SF = 10;
> f = Plot[Sin[x], {x, 0, Pi}, DisplayFunction -> Identity];
> g = Plot[Exp[x]/SF, {x, 0, Pi}, DisplayFunction -> Identity];
> Show[{f, g}, DisplayFunction -> $DisplayFunction];
>
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
- References:
- Re: plotting two functions on the one graph
- From: mathma18@hotmail.com (Narasimham)
- Re: plotting two functions on the one graph