Search code examples
rplotlinessmoothing

Get data from lines() function


I have a plot like this (black points): enter image description here I calculate the average of some points (smoothing - the red points in the plot). Then I can draw with the lines() function a line between these points (blue in the plot). What I want now is the data of the blue line.

Does somebody know how to do this? Is it even possible?


Solution

  • I used the approx function which interpolates between points:

    approx(x = r, y = ionizations, n = 1000)
    

    enter image description here