Re: Coordinates for Implicit function
- To: mathgroup@smc.vnet.net
- Subject: [mg11796] Re: Coordinates for Implicit function
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Sat, 28 Mar 1998 00:25:32 -0500
- References: <6fd0n0$5i9@smc.vnet.net>
Bob Hanlon wrote:
>
> Needs["Graphics`ImplicitPlot`"]
>
> eqn = 3*x^2 - 4*x*y + 2*y^2 == 4;
>
> thePlot = ImplicitPlot[eqn, {x, -5, 5}];
>
> Extracting the data points from the Graphics object:
>
> theData1 = thePlot[[1,2,1,1,1]];
> theData2 = thePlot[[1,2,2,1,1]];
> theData = Union[theData1, theData2];
>
Bob:
Or, working more at arms' length,
Join@@Cases[thePlot, Line[datai_]->datai, Infinity];
Union mixes the upper part of the curve and the lower part. Fine for
data, but not for plotting.
ListPlot[theData, PlotJoined -> True]
Even with Joined there is a jump from the end of the first line to the
beginning of the second one.
This can be avoided with
ListPlot[Join[theData1, Reverse[theData2]], PlotJoined -> True]
But for plotting its probably better to keep the lines:
Cases[thePlot, _Line, Infinity];
Of course, if the equation cannot be solved symbolically have to use the
form like.
thePlot2 =ImplicitPlot[eqn, {x, -5, 5}, {y,-3,3}]
And since this gives a ContourGraphics object we must convert to a
Graphics object to get the lines explicitely
Union@@Cases[Graphics[thePlot2], Line[datai_]->datai, Infinity]
--
Allan Hayes
Mathematica Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642