# How to create a list from a plot?

This is motivated by this question.

Consider the list

list={0.2, 0.5, 0.7};


If I plot the data using ListLinePlot I get a curve like this

If I now apply interpolation using

ListLinePlot[{0., 0.2, 0., 0., 0.5, 0., 0., 0.7, 0.},
InterpolationOrder -> 2]


I get

Now I wish to find the list which includes the interpolated values along with the zero values between 3 to 4 and 6 to 7 to generate Plot2.

How can I do this?

Update: A single list of points with negative y-values clipped to 0:

llp = ListLinePlot[{0., 0.2, 0., 0., 0.5, 0., 0., 0.7, 0.},
InterpolationOrder -> 2,  PlotRange -> {-.2, 1}];
clippedpoints =  Cases[llp,  Line[x_] :>
Transpose[{#, Clip[#2, {0, Infinity}]} & @@ Transpose[x]], Infinity]

Show[llp, ListPlot[clippedpoints, PlotStyle -> Directive[Red, PointSize[.01]]],
PlotRange -> All]


True

llp = ListLinePlot[{0., 0.2, 0., 0., 0.5, 0., 0., 0.7, 0.},
InterpolationOrder -> 2, PlotStyle -> Thick, PlotRange -> {0, All}];
points = Cases[llp, Line[x__] :> x, Infinity];

points // Short[#, 4] &


{{{1.,0.},{1.0234,0.00634228},{1.04853,0.0131544},{1.07539,0.0204362},{1.10399,0.0281879},<<45>>,{2.92412,0.0156563},{2.96203,0.00766473},{3.,3.46945*10^-18},{3.,0.}},{{<<18>>,0.},<<52>>},{<<1>>}}

Show[llp, ListPlot[points, PlotStyle -> Directive[Red, PointSize[.01]]],
PlotRange -> All]


• The original plot doesn't have any negative value. The negative values in your plot should be truncated to 0 as they are in the original list. Jan 17, 2018 at 20:06
• @Majis, please see the update.
– kglr
Jan 17, 2018 at 20:12
• The plot is now truncated but the truncated points (zero values) are not shown. Jan 17, 2018 at 20:18
• @Majis, there are no zero values in your original plot (due to the default plot range in version 11 you get a picture that does not show negative values). You can see that clearly if you remove the axes: ListLinePlot[{0., 0.2, 0., 0., 0.5, 0., 0., 0.7, 0.}, InterpolationOrder -> 2, Axes->False]
– kglr
Jan 17, 2018 at 20:35
• Yes, true. But I need the zero values as well. Jan 17, 2018 at 20:40