MathGroup Archive 2004

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

Search the Archive

Re: Overlay graphs


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.

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: Binomial Distribution
  • Next by Date: Re: Net/Link: Problem with DLL (1)
  • Previous by thread: Overlay graphs
  • Next by thread: Re: Re: Overlay graphs