MathGroup Archive 2002

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

Search the Archive

Re: superimpose to curves

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38301] Re: superimpose to curves
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Thu, 12 Dec 2002 01:31:26 -0500 (EST)
  • References: <at4c3n$enl$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

<sisir at hve.iisc.ernet.in> wrote in message news:at4c3n$enl$1 at smc.vnet.net...
> Respected Sir/Madam,
> I want to super impose(add) two curves of
> different ranges-one is -5ms to 15 ms and other one
> is 0ms to 20ms of different amplitude.
> So kindly suggest me
>
> --
> With best wishes..............
>
>
>
>
> SISIR KUMAR NAYAK
> ELECTRICAL SCIENCE
> U-79,STUDENT HOSTEL
> IISC, BANGALORE.
> PH:3942624(080)

One way:

gr1 = Plot[Sin[x], {x, 0, 7}, PlotStyle ->
     {Hue[0], Thickness[0.01]}];

gr2 = Plot[Sin[2*x], {x, 2, 5}, PlotStyle ->
     {Hue[0.7], Dashing[{0.01, 0.02}]}];

Show[gr1, gr2, PlotRange -> All];

PlotRange ->All is to protect against Mathematica restricting the display to
what it calculated is interesting - not actually needed here. You could also
set the plot numerically: here PlotRange-> {{0,7},{-1,1}} would be suitable.


We may not want to show the separate curves, only the combination: here are
three ways to do this

1)

gr1 = Plot[Sin[x], {x, 0, 7}, PlotStyle ->
     {Hue[0], Thickness[0.01]}, DisplayFunction ->
     Identity];

gr2 = Plot[Sin[2*x], {x, 2, 5}, PlotStyle ->
     {Hue[0.7], Dashing[{0.01, 0.02}]},
    DisplayFunction -> Identity];

Show[gr1, gr2, PlotRange -> All, DisplayFunction ->
    $DisplayFunction];


2)

Show[Plot[Sin[x], {x, 0, 7}, PlotStyle ->
    {Hue[0], Thickness[0.01]}, DisplayFunction ->
    Identity], Plot[Sin[2*x], {x, 2, 5},
   PlotStyle -> {Hue[0.7], Dashing[{0.01, 0.02}]},
   DisplayFunction -> Identity], DisplayFunction ->
   $DisplayFunction, PlotRange -> All]

3)

Show[Block[{$DisplayFunction = Identity},
    {Plot[Sin[x], {x, 0, 7}, PlotStyle ->
       {Hue[0], Thickness[0.01]}], Plot[Sin[2*x],
      {x, 2, 5}, PlotStyle -> {Hue[0.7],
        Dashing[{0.01, 0.02}]}]}], PlotRange -> All];

--
Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565





  • Prev by Date: Re: Mathematica Documentation
  • Next by Date: Re: Strange result with Integrate
  • Previous by thread: RE: superimpose to curves
  • Next by thread: Why can't Mathematica find this root?