MathGroup Archive 1998

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

Search the Archive

Re: Coordinates for Implicit function



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




  • Prev by Date: Re: Stack graphics
  • Next by Date: Re: Mathematica frustrations...
  • Prev by thread: Re: Coordinates for Implicit function
  • Next by thread: orthonormal version of Eigensystem[]?