2
$\begingroup$

I used an iterative method to resolve equations, then i plotted the results using ListLinePlot. Unfortunately, now I need to use some of the data that was plot. I know the X-coordinate, and need to extract the Y one.

Using the list of data that I plot is not an option, knowing that I'm dealing with points that don't necessarily exist in my list.

Is there any function I can use?

$\endgroup$
  • $\begingroup$ If you can't use the list of plotted points, you can extract them and then interpolate, which will give you Y and function of X. $\endgroup$ – Virgil Apr 30 '15 at 13:16
1
$\begingroup$

Perhaps this example could be helpful

llp = ListLinePlot[
   Quantity[{0, 3, 6, 8, 10, 11, 11, 16, 20, 22}, "Centimeters"], 
   AxesLabel -> Automatic];
pts = Cases[llp, Line[x__] :> x, -1]
lp = ListPlot[pts, Joined -> True];
Grid[{{"Plot", "Replot"}, {llp, lp}}]

Extracted points: {{{1., 0.}, {2., 3.}, {3., 6.}, {4., 8.}, {5., 10.}, {6., 11.}, {7., 11.}, {8., 16.}, {9., 20.}, {10., 22.}}}

enter image description here

$\endgroup$
1
$\begingroup$

You can still use the list of data, that you plotted. You just need to Select those. (x, y) pairs you are interested in.

For example:

Select[plotData, MemberQ[xValues, #[[1]] ]& ]

To obtain the plot data, you can use Part on the ListPlot.

plotData=ListPlot[data][[1]] 
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.