Re: Plotting functions and lines on the same figure?
- To: mathgroup at smc.vnet.net
 - Subject: [mg113846] Re: Plotting functions and lines on the same figure?
 - From: Murray Eisenberg <murray at math.umass.edu>
 - Date: Mon, 15 Nov 2010 05:51:49 -0500 (EST)
 
Two methods:
(1) Use the Epilog or Prolog option within your Plot expression. For 
example:
     Plot[Abs[x^(1/3)], {x, -1, 1},
          Epilog -> {Thick, Red, Line[{ {0,0}, {0,1} }]}]
(2) Combine a Plot expression (which gives output with a Head of 
Graphics) with another Graphics expression into a Show expression. For 
example:
     grf = Plot[Abs[x^(1/3)], {x, -1, 1}];
     tgt = Graphics[{Thick, Red, Line[{ {0,0}, {0,1} }]}];
     Show[{grf, tgt}]
On 11/14/2010 6:10 AM, Marco Masi wrote:
> I would like to plot straight lines into a graph of a function, i.e. after Plot[f[x], {x, -l, +l}] I need to insert into the graph three straight lines. Could not bring to work graphics primitive Line since I could make it plot only on a separate graph. How can one Plot and Line on the same figure?
>
> Mark.
>
-- 
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