MathGroup Archive 2010

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

Search the Archive

Re: Plotting functions and lines on the same figure?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113844] Re: Plotting functions and lines on the same figure?
  • From: Alexei Boulbitch <alexei.boulbitch at iee.lu>
  • Date: Mon, 15 Nov 2010 05:51:24 -0500 (EST)

Hi, Mark.

One regular method to do what you need is to use graphics primitives like Line[], Arrow[] and so on and
to combine them with the graphics of a function using Show. Since Show[] inherits the properties of its first argument,
I recommend to put as a first argument the graph of your function.
Try for instance, this:

pl = Plot[Sin[x], {x, -\[Pi], \[Pi]}];
ln1 = Graphics[{Red, Thickness[0.01],
     Line[{{-3 \[Pi]/4, -Sin[3 \[Pi]/4]}, {3 \[Pi]/4, Sin[3 \[Pi]/4]}}]
               }];
Show[{pl, ln1}]

and play with the line color, thickness and coordinates.
Have fun, Alexei

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.

-- 
Alexei Boulbitch, Dr. habil.
Senior Scientist
Material Development

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 CONTERN
Luxembourg

Tel: +352 2454 2566
Fax: +352 2454 3566
Mobile: +49 (0) 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu

www.iee.lu

--

This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended
recipient and have received this e-mail in error, you are hereby
notified that any review, copying or distribution of it is strictly
prohibited. Please inform us immediately and destroy the original
transmittal from your system. Thank you for your co-operation.



  • Prev by Date: SetAttributes[CenterDot, Flat]
  • Next by Date: FoldList for decaying local maximum?
  • Previous by thread: Re: Plotting functions and lines on the same figure?
  • Next by thread: Plot and DSolve