I want to plot a graph that represents the distance of a moving point on a line and the center of a circle,
I want to plot the graph on the right (the red dotted graph)

screenshot of an explanatory image: 
[![enter image description here][1]][1]


 [1]: https://i.sstatic.net/zAfNt.png

thanks in advance :)