MathGroup Archive 1999

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

Search the Archive

Re: combining two plots

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16796] Re: combining two plots
  • From: phbrf at t-online.de (Peter Breitfeld)
  • Date: Tue, 30 Mar 1999 02:35:06 -0500
  • Organization: das ist ein breites Feld ...
  • References: <7d71u2$71r@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Joaquim Leitao <quim at ideiafix.fis.ua.pt> schrieb:
> 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? 

Joaqim,

You can create your Plot:
gp=Plot[Sin[x],{x,-Pi,2Pi}]

and your ListPLot:
gl=ListPlot[Table[Point[{x,Sin[x]}],{x,-Pi,2Pi,Pi/4}],
    PlotStyle->PointSize[0.02]]

and then display them in one graphic using
Show[{gp,gl}]

Or you can add the Points directly in your Plot using Epilog:

Plot[Sin[x], {x, -Pi, 2*Pi}, 
    Epilog -> 
     {PointSize[0.02], 
      Table[Point[{x, Sin[x]}], 
       {x, -Pi, 2*Pi, Pi/4}]}]; 

Epilog (and Prolog) are good to add any Graphics-stuff in a Plot.

es gruesst
      Peter
-- 
=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=
  Peter Breitfeld, Saulgau, Germany       (PGP public key: 08548045)


  • Prev by Date: LogLinearListPlot
  • Next by Date: Re: Plotting multiple outputs from cpu intensive functi
  • Previous by thread: Re: combining two plots
  • Next by thread: Help Defining Variables (with long names)