MathGroup Archive 1999

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

Search the Archive

Re: combining two plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16759] Re: combining two plots
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Wed, 24 Mar 1999 02:24:02 -0500
  • References: <7d71u2$71r@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Joaquim Leitao <quim at ideiafix.fis.ua.pt> wrote in message
news:7d71u2$71r at smc.vnet.net...
> Hello:
>
> I'd like to draw in the same plot a function and some discrete
> points. How can I combine the ListPlot and Plot comands in the same
> figure?
>
> Any help will be appreciated
> Joaquim Pratas Leitao
> Departamento de Fisica
> Universidade de Aveiro
> 3810 Aveiro, Portugal
> tel: +351 34 370286
> e-mail: quim at fis.ua.pt
>

Joaquim:

Simplest here is using the option Epilog in Plot

Plot[Sin[x],{x,0,2Pi},
 Epilog ->{PointSize[.02], Table[Point[{x,Cos[x]}],{x,0,2Pi,Pi/10}]}
 ];

For more complicated situations use Show:

Use DisplayFunction->Identity to turn off display during construction.

gr1= Plot[Sin[x], {x,0,2Pi},DisplayFunction->Identity];
gr2= ListPlot[ Table[{x,Cos[x]},{x,0,2Pi,Pi/10}],
            PlotStyle -> PointSize[.02],
              DisplayFunction->Identity
        ];

Use Show with  DisplayFunction->$DisplayFunction to combine and display.

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

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: How to make axes being seen inside a sphere in SphericalPlot3D?
  • Next by Date: Plotting multiple outputs from cpu intensive function
  • Previous by thread: Re: combining two plots
  • Next by thread: Re: combining two plots