MathGroup Archive 2013

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

Search the Archive

Re: Getting the plotted data from a graph


Hello Lily,
This should do what you are looking for:

plot = Plot[Sin[x], {x, -Pi, Pi}, PlotStyle -> None, Axes -> False,
  Mesh -> All, MeshStyle -> Directive[PointSize[Medium]]]

points = Flatten[Cases[plot, GraphicsComplex[a_, ___] -> a, Infinity],
   1]


W Craig Carter
Professor of Materials Science, MIT



On Jun 15, 13, at 4:24 AM, Lily T. wrote:

> Dear All,
>
> My question is regarding the plotted data points in a graph. Assume =
you draw a graph of sinx as:
>
> g1 = Plot[Sin[x], {x, -Pi, Pi},
>      Frame -> True, FrameLabel -> {"x", "y"}, ImageSize -> 2.6*72
>    ]
>
> then how can I get all of the data points of this graph by using =
mathematica?
>
> This is really important for me and I couldn't find the answer =
anywhere online!
>
> Thank you for your help in advance!
>
> Best,
> Lily
>




  • Prev by Date: Working with arrays
  • Next by Date: Re: Applying data from a database link to a GraphPlot
  • Previous by thread: Re: Getting the plotted data from a graph
  • Next by thread: Re: Getting the plotted data from a graph