Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

RE: Coordinates from an ImplicitPlot

  • To: mathgroup at
  • Subject: [mg39169] RE: [mg39155] Coordinates from an ImplicitPlot
  • From: "David Park" <djmp at>
  • Date: Sun, 2 Feb 2003 01:13:10 -0500 (EST)
  • Sender: owner-wri-mathgroup at


If you do a normal plot that produces a -Graphics- object, then the First
part of that object contains all the graphics primitives and directives,
such as Line, Point, etc., that create the plotted object. The Last part
contains the overall plot options that control things such as the Frame,
PlotLabel etc.

ImplicitPlot is a little tricky because if you use the single iterator form
it produces -Graphics- output. If you use the double iterator form it
-ContourGraphics-. You then have to convert that to Graphics.

So let's plot an ellipse with the single iterator form. I am going to use
colors later so will load the package now.


curves = First[
      ImplicitPlot[x^2 + 2y^2 == 5, {x, -3, 3}, PlotPoints -> 20,
        DisplayFunction -> Identity]];

We did an ImplicitPlot with the display suppressed, and took the first part.
This part contains the Lines that make up the curve. In general there will
be more than one Line. You could look at curves, but I won't display it
here. It contains two Lines.

Now we extract the points. The argument of each Line is just the points that
are used to plot the Line. So we can use...

pts = Cases[curves, Line[pts_] :> Point /@ pts, Infinity];

Now we can plot the curves and the points.

      {Tomato, curves,
        Cobalt, AbsolutePointSize[4], pts}],
    AspectRatio -> Automatic,
    Frame -> True,
    PlotLabel -> "Implicit Curve with Points",
    Background -> Linen,
    ImageSize -> 400

You can get the actual point coordinates for the two lines by...

pts /. Point -> Identity

which gives two lists of point coordinates for the lower and upper branches
of the ellipse.

If you use the two iterator form of ImplicitPlot, then you have to convert
it to Graphics before extracting the First part. Also, then Mathematica
embeds a color directive for each Line so if you want a colored line you
have to use PlotStyle. (If you don't specify a PlotStyle it embeds Black.)
So you would get the curves by the following statement. The rest would be
the same except that any color directive in the Show statement would not
affect the curves.

curves = First[
      Graphics[ImplicitPlot[x^2 + 2y^2 == 5, {x, -3, 3}, {y, -2, 2},
          PlotPoints -> 20, PlotStyle -> Tomato,
          DisplayFunction -> Identity]]];

If you want to try the DrawGraphics package at my web site below you can
combine everything into one plot statement because the Draw routines
automatically convert to Graphics, extract the First part and suppress side
plots. You can also mix in curves produced by other types of plot


      curves = ImplicitDraw[x^2 + 2y^2 == 5, {x, -3, 3}, PlotPoints -> 20],

      Cobalt, AbsolutePointSize[4],
      pts = Cases[curves, Line[pts_] :> Point /@ pts, Infinity]},

    AspectRatio -> Automatic,
    Frame -> True,
    PlotLabel -> "Implicit Curve with Points",
    Background -> Linen,
    ImageSize -> 400];

David Park
djmp at

From: Kay Orgassa [mailto:Kay.Orgassa at]
To: mathgroup at

Does anyone know, how to extract the data points from an ImplicitPlot?
Thanks, Kay

  • Prev by Date: Re: Another plea for help...
  • Next by Date: perate matrix of derivations
  • Previous by thread: Re: Coordinates from an ImplicitPlot
  • Next by thread: Problem with NIntegrate -- Monte Carlo