MathGroup Archive 2004

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

Search the Archive

Re: Overlay graphs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48872] Re: [mg48829] Overlay graphs
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Mon, 21 Jun 2004 03:49:03 -0400 (EDT)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <200406180612.CAA10681@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

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