Re: Routines inside Epilog
- To: mathgroup at smc.vnet.net
- Subject: [mg14395] Re: Routines inside Epilog
- From: "P.J. Hinton" <paulh>
- Date: Sun, 18 Oct 1998 15:10:01 -0400
- Organization: "Wolfram Research, Inc."
- References: <7040at$i3i@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 15 Oct 1998, GERMAN BUITRAGO wrote: > I need to plot many lines between a curve and the x-axis for to show an > approximation of the area under the curve. > > Example: > f[x_] := 36 - 4*(x - 3)^2 > > Plot[f[x], {x, 0, 3}] > > Plot[f[x], {x, 0, 3}, Epilog -> {Line[{ {0.2, 0}, {0.2, f[0.2]}, {0.4,f[0.2]} }], > Line[{ {0.4, 0},{0.4, f[0.4]},{0.6, f[0.4]}}]] > > All the above-mentioned works correctly. However, I am not able to > create a routine for several similar lines, as: > > Plot[f[x], {x, 0, 3}, Epilog -> Do[Line[{ {i, 0}, {i, f[i]}, {i+.2, f[i]} }], > {i,15} ]] > > Where is my error? Epilog should be a list of graphics primitives, but Do[] returns a Null result. Try using Table[] instead. Plot[f[x], {x, 0, 3}, Epilog -> Table[Line[{ {i, 0}, {i, f[i]}, {i+.2, f[i]} }], {i,15} ]] -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. http://www.wolfram.com/~paulh/ Disclaimer: Opinions expressed herein are those of the author alone.