Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Re: Overlay graphs

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.

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