# Extract data coordinates from a line list plot

I used the below simple data (including 10 x-y data) and function ListLinePlot to draw a figure. The figure is this: Now I want to export a data x-y coordinates list which includes 100 x-y data at the same x axis interval. Like {1.0,5},{1.1,y1},{1.2,y2},{1.3,y3}...{9.9,y99},{10,7}

How can I do it?

• Duplicate of 81228?
– Syed
Apr 15 at 13:24

With pic=ListLinePlot[...] (your plot) you get the points from

pts=Cases[pic, Line[p_] :> p, -1][]

y=Interpolation[pts,InterpolationOrder->1]

• thanks, Neumann! Using your answer, I just get 10 x-y coordinates output. I want to get 100 x-y points coordinates. Apr 14 at 10:22
• I don't know your ListLinePlot. Try xy=Map[{#,y[#]}&, Range[1,10,.1]] Apr 14 at 10:48

You must interpolate your data. This can be done with the function "Interpolate" I assume that you want points that lay on your plot, therefore I am using InterpolationOrder->1 to get the points "pts":

d = {{1, 5}, {2, 8}, {3.5, 4}, {4.2, 6.9}, {5, 7.3}, {6.6, 11.6}, {7,
0.2}, {8.5, 5.5}, {9.3, 8.3}, {10, 7}};
interpol = Interpolation[d, InterpolationOrder -> 1];
pts = {#, interpol[#]} & /@ Range[1, 10, 9/100];
ListLinePlot[d, Epilog -> Point[pts]]; 