MathGroup Archive 2000

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

Search the Archive

Re: Getting values from Plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22665] Re: Getting values from Plot
  • From: "Kevin J. McCann" <kevin.mccann at jhuapl.edu>
  • Date: Sat, 18 Mar 2000 01:27:42 -0500 (EST)
  • Organization: Johns Hopkins University Applied Physics Lab, Laurel, MD, USA
  • References: <8aqqt7$a4o@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

There may be other ways, but here is one. The trick is to remember that
everything is a Mathematica expression, e.g.


p1 = Plot[Sin[x], {x, 0, 2*Pi}];

Generates a plot, now to look at the Mathematica expression type

p1//FullForm

and you will see more than you probably wanted, but you may recognize some
things in there.  Now try

p1[[1]]

You will see a few Graphics directives and Line[{lots of points}]. This is
what you want. To make this story short type

pts = p1[[1,3,1,1]]

and you will have a list of the points that Mathematica used to generate the plot.
You can show them with:

ListPlot[pts, PlotJoined -> False];

--

Kevin J. McCann
Johns Hopkins University APL


Bernd Brandt <bernd at bio.vu.nl> wrote in message
news:8aqqt7$a4o at smc.vnet.net...
> Hi,
>
> Recently i read an answer to a question how to get the (x,y) pairs used
> in Plot into a list.
> I used SEARCH of Wolfram.com and support.wolfram.com but cannot refind
> this Recent posting.
> Does someone else remember this posting (i am not referring to the 1997
> postings)?
>
> Regards,
> Bernd
>




  • Prev by Date: Re: HELP: Display Trouble
  • Next by Date: Re: [Q] Differential equation?
  • Previous by thread: Re: Getting values from Plot
  • Next by thread: Re: Getting values from Plot