Re: Re: Overlay graphs
- To: mathgroup at smc.vnet.net
- Subject: [mg48901] Re: [mg48872] Re: [mg48829] Overlay graphs
- From: Bob Walker <walkerbg at ieee.org>
- Date: Tue, 22 Jun 2004 05:32:16 -0400 (EDT)
- References: <200406180612.CAA10681@smc.vnet.net> <200406210749.DAA20965@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Another way to do this is to assign plots to variables and then use Show.
This is a convient way to build up complex graphs with multiple plots as
well as
position labels, shapes, and etc. (e.g. Graphics Primitives) based on
plot coordinates
sinplot = Plot[Sin[x], {x, 0, Pi/4}, DisplayFunction -> Identity];
cosplot = Plot[Cos[x], {x, Pi/4, Pi/2}, DisplayFunction -> Identity];
plabels =
Graphics[{Text["1st Plot", Scaled[{-0.02, 0.02}, {Pi/8, 0.2}]],
Text["2nd Plot", Scaled[{-0.02, 0.02}, {3Pi/8, 0.5}]]}]
Show[ {sinplot, cosplot, plabels}, DisplayFunction -> $DisplayFunction];
Take care,
Bob Walker
--------------------------------
Murray Eisenberg wrote:
>Probably the simplest way is to use PlotTogether from Standard AddOn
>package Graphics`Graphics`, as follows:
>
> Needs["Graphics`Graphics`"]
>
> DisplayTogether[
> {
> Plot[Sin[x], {x, 0, Pi/4}],
> Plot[Cos[x], {x, Pi/4, Pi/2}]
> }
> ];
>
>(Above, I pretty-printed the DisplayTogether expression the better to
>reveal the structure and to avoid an awkward mid-line break due to short
>lines in my e-mail client editor.)
>
>Note that you had some syntactical errors in your individual Plot
>expressions: like all functions, Sin and Cos need square brackets
>around their arguments, that's all.
>
>You may add individual PlotStyle options to the components of your
>graph. For example:
>
> Needs["Graphics`Colors`"]
>
> DisplayTogether[
> {Plot[Sin[x], { x, 0, Pi/4}, PlotStyle -> Red],
> Plot[Cos[x], {x, Pi/4, Pi/2}, PlotStyle -> Blue]}
> ];
>
>JosefG wrote:
>
>
>
>>I was wondering how to overlay graphs in Mathmatica. I need to
>>overlay: Plot[Sin{(x)},{x,0,Pi/4}] and
>>Plot[{Cos(x)},{x,Pi/4,Pi/2}]. I don't know how to do it. A phase shift
>>doesn't work because I need the data from the original points.
>>
>>
>
>
>
- References:
- Overlay graphs
- From: J_o_s_e_f@hotmail.com (JosefG)
- Re: Overlay graphs
- From: Murray Eisenberg <murray@math.umass.edu>
- Overlay graphs