MathGroup Archive 2013

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

Search the Archive

Re: Getting the plotted data from a graph

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131186] Re: Getting the plotted data from a graph
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sun, 16 Jun 2013 05:17:55 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20130615082448.BFAE16A7C@smc.vnet.net>

g1 = Plot[Sin[x], {x, -Pi, Pi},
  Frame -> True,
  FrameLabel -> {"x", "y"},
  ImageSize -> 2.6*72]


g1Pts = Cases[g1, Line[pts_] :> pts, Infinity];


g2 = ListLinePlot[g1Pts,
  Frame -> True,
  FrameLabel -> {"x", "y"},
  ImageSize -> 2.6*72]


You can directly access the associated Part of g1; however, the specific
Part (position of Line) varies between plot types; whereas, locating the
Line with Cases works the same.


g1Pts ==
 List @@ g1[[1, 1, 3, 2]] ==
 Cases[g2, Line[pts_] :> pts, Infinity] ==
 List @@ g2[[1, 2, 1, 3, 3]]


True



Bob Hanlon


On Sat, Jun 15, 2013 at 4:24 AM, Lily T. <econactually at gmail.com> 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: Re: Multiplication by 0: non-zero in versions 8 and 9
  • Next by Date: Re: Getting the plotted data from a graph
  • Previous by thread: Getting the plotted data from a graph
  • Next by thread: Re: Getting the plotted data from a graph