Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: Vertical Lines (Boundaries)
Posted:
Sep 20, 1996 12:48 AM


Larry Smith wrote: > > After talking to Tech Support today I was able to get a short term fix for > a problem that I have encountered. > > Example: Plot the equation y=x^2 and show boundaries at x=1 and x=2 > (vertical lines). Is there an easy way to do this? > > The problem could also be asked where you need to use implicit plotting > ImplicitPlot[x=y^3,{x,0,3}] and have y horizontal lines at y=1 and y = 2. > Any suggestions? > > So far I only have the following: > > Show[Graphics[Line[{{1/2,1,{1/2,8}}]], DisplayFunction > Identity] > > Plot[x^2,{x,0,2},DisplayFunction > Identity] > > Then combine the previous Out[] which in this case was Out[10] Graphics, > and Out[11] Graphics > > Show[%10,%11, DisplayFunction > $DisplayFunction] >
Needing many customizations of plot output, I have really come to appreciate the Epilog and Prolog options available in all (I think) plotting functions. In your example, you could simply render the lines you need by
ImplicitPlot[yourEquation,yourDomain, Epilog > {Line[{startPt, endPt}] ]
or
ImplicitPlot[yourEquation,yourDomain, Prolog > { anyAndAllOfYourGraphicsPrimitives } ]
Prolog is the better choice if you specify style options to distinguish border lines and graph and want the graph to be _in front_ of the border lines (Prolog directives are rendered before the rest of the plot). Example:
ImplicitPlot[x == y^3,{x,0,3}, PlotStyle > {GrayLevel[0], Thickness[0.003] }, Prolog > { GrayLevel[0.5], Thickness[0.01], Line[{{.5, 1}, {.5, 8}}], Line[{{2, 1}, {2, 8}}] } ]
(Note that you'll have to specify PlotStyle in the plot, otherwise the graph will be rendered with the styles set in the Prolog.)  ______________________________________________________________________ Harald Berndt, Ph.D. Research Specialist, Consultant
Phone: 5106525974 FAX: 5102154299 ______________________________________________________________________ "I yam what I yam"...................................Popeye the sailor (Kryten:............"I thought that was Descartes!"..................) (Lister:............"So did I. mon, so did I!".......................)



