RE: Overlay graphs

• To: mathgroup at smc.vnet.net
• Subject: [mg48852] RE: [mg48829] Overlay graphs
• From: "David Park" <djmp at earthlink.net>
• Date: Sat, 19 Jun 2004 04:30:55 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Josef,

First, you have to use the various brackets correctly. Function arguments
are always enclosed in [].

There are several ways to combine your plots.

Method 1

plot1 = Plot[Sin[x], {x, 0, Pi/4}, DisplayFunction -> Identity];
plot2 = Plot[Cos[x], {x, Pi/4, Pi/2}, DisplayFunction -> Identity];
Show[plot1, plot2, DisplayFunction -> \$DisplayFunction];

Method 2

Block[{\$DisplayFunction = Identity},
plot1 = Plot[Sin[x], {x, 0, Pi/4}];
plot2 = Plot[Cos[x], {x, Pi/4, Pi/2}];]
Show[plot1, plot2];

Method 3

Needs["Graphics`Graphics`"]

DisplayTogether[
Plot[Sin[x], {x, 0, Pi/4}],
Plot[Cos[x], {x, Pi/4, Pi/2}]];

Method 4 (Using the DrawGraphics package from my web site.)

Needs["DrawGraphics`DrawingMaster`"]

Draw2D[
{Draw[Sin[x], {x, 0, Pi/4}],
Draw[Cos[x], {x, Pi/4, Pi/2}]},
Axes -> True];

The only advantage of the last method would be if you wanted to combine the
curves with other Graphics primitives such as Points, Rectangles, Lines and
using various colors, say, and you had to draw and overlay them in a
specific order.

David Park

From: JosefG [mailto:J_o_s_e_f at hotmail.com]
To: mathgroup at smc.vnet.net

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.

Thanks alot,

Josef

```

• Prev by Date: Re: Using NDSolve in NonlinearFit
• Next by Date: RE: Reassembling Fourier Transforms
• Previous by thread: Re: Overlay graphs
• Next by thread: Re: Overlay graphs